MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / stopBackgroundTask

Method stopBackgroundTask

packages/node-sdk/src/session.ts:346–361  ·  view source on GitHub ↗

* Request a running background task to stop. Sends SIGTERM with a * grace period (handled by the core BPM); subscribers receive a * `background.task.terminated` event when the kill settles. Calls * for unknown or already-terminal task ids are no-ops at the core * level — this method does

(
    taskId: string,
    options: { reason?: string } = {},
  )

Source from the content-addressed store, hash-verified

344 * level — this method does not throw in those cases.
345 */
346 async stopBackgroundTask(
347 taskId: string,
348 options: { reason?: string } = {},
349 ): Promise<void> {
350 this.ensureOpen();
351 const trimmedTaskId = normalizeRequiredString(
352 taskId,
353 'Task id cannot be empty',
354 ErrorCodes.BACKGROUND_TASK_ID_EMPTY,
355 );
356 await this.rpc.stopBackgroundTask({
357 sessionId: this.id,
358 taskId: trimmedTaskId,
359 reason: options.reason,
360 });
361 }
362
363 /**
364 * Detach a running foreground task so the current tool call can return while

Callers 2

handleStopMethod · 0.80

Calls 2

ensureOpenMethod · 0.95
normalizeRequiredStringFunction · 0.85

Tested by

no test coverage detected