MCPcopy Create free account
hub / github.com/NanmiCoder/cc-haha / registerRemoteAgentTask

Function registerRemoteAgentTask

src/tasks/RemoteAgentTask/RemoteAgentTask.tsx:386–466  ·  view source on GitHub ↗
(options: {
  remoteTaskType: RemoteTaskType;
  session: {
    id: string;
    title: string;
  };
  command: string;
  context: TaskContext;
  toolUseId?: string;
  isRemoteReview?: boolean;
  isUltraplan?: boolean;
  isLongRunning?: boolean;
  remoteTaskMetadata?: RemoteTaskMetadata;
})

Source from the content-addressed store, hash-verified

384 * Callers remain responsible for custom pre-registration logic (git dialogs, transcript upload, teleport options).
385 */
386export function registerRemoteAgentTask(options: {
387 remoteTaskType: RemoteTaskType;
388 session: {
389 id: string;
390 title: string;
391 };
392 command: string;
393 context: TaskContext;
394 toolUseId?: string;
395 isRemoteReview?: boolean;
396 isUltraplan?: boolean;
397 isLongRunning?: boolean;
398 remoteTaskMetadata?: RemoteTaskMetadata;
399}): {
400 taskId: string;
401 sessionId: string;
402 cleanup: () => void;
403} {
404 const {
405 remoteTaskType,
406 session,
407 command,
408 context,
409 toolUseId,
410 isRemoteReview,
411 isUltraplan,
412 isLongRunning,
413 remoteTaskMetadata
414 } = options;
415 const taskId = generateTaskId('remote_agent');
416
417 // Create the output file before registering the task.
418 // RemoteAgentTask uses appendTaskOutput() (not TaskOutput), so
419 // the file must exist for readers before any output arrives.
420 void initTaskOutput(taskId);
421 const taskState: RemoteAgentTaskState = {
422 ...createTaskStateBase(taskId, 'remote_agent', session.title, toolUseId),
423 type: 'remote_agent',
424 remoteTaskType,
425 status: 'running',
426 sessionId: session.id,
427 command,
428 title: session.title,
429 todoList: [],
430 log: [],
431 isRemoteReview,
432 isUltraplan,
433 isLongRunning,
434 pollStartedAt: Date.now(),
435 remoteTaskMetadata
436 };
437 registerTask(taskState, context.setAppState);
438
439 // Persist identity to the session sidecar so --resume can reconnect to
440 // still-running remote sessions. Status is not stored — it's fetched
441 // fresh from CCR on restore.
442 void persistRemoteAgentMetadata({
443 taskId,

Callers 3

callFunction · 0.85
launchDetachedFunction · 0.85
launchRemoteReviewFunction · 0.85

Calls 6

generateTaskIdFunction · 0.85
initTaskOutputFunction · 0.85
createTaskStateBaseFunction · 0.85
registerTaskFunction · 0.85

Tested by

no test coverage detected