MCPcopy Create free account
hub / github.com/WeaveMindAI/weft / cancelTask

Function cancelTask

extension/src/lib/api.ts:132–157  ·  view source on GitHub ↗
(
  task: PendingTask & { _tokenConfig?: ExtensionToken }
)

Source from the content-addressed store, hash-verified

130
131/// Cancel a task (skip downstream execution, remove from list)
132export async function cancelTask(
133 task: PendingTask & { _tokenConfig?: ExtensionToken }
134): Promise<void> {
135 const tokenConfig = task._tokenConfig;
136
137 if (!tokenConfig) {
138 throw new Error('Task missing token configuration');
139 }
140
141 const executionId = encodeURIComponent(task.executionId);
142 const url = `${tokenConfig.cloudUrl}/api/ext/${tokenConfig.token}/tasks/${executionId}/cancel`;
143
144 console.log('[WeaveMind] Cancelling task:', { url, executionId: task.executionId });
145
146 const response = await fetch(url, {
147 method: 'POST',
148 headers: { 'Content-Type': 'application/json' },
149 });
150
151 if (!response.ok) {
152 const text = await response.text();
153 throw new Error(`HTTP ${response.status}: ${text}`);
154 }
155
156 console.log('[WeaveMind] Task cancelled successfully');
157}
158
159/// Submit a trigger form (fires the trigger with form data)
160export async function submitTrigger(

Callers

nothing calls this directly

Calls 1

textMethod · 0.80

Tested by

no test coverage detected