weacpx 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +101 -32
- package/dist/orchestration/orchestration-types.d.ts +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9555,7 +9555,7 @@ function isOptionalBoolean(value) {
|
|
|
9555
9555
|
return value === undefined || typeof value === "boolean";
|
|
9556
9556
|
}
|
|
9557
9557
|
function isTaskStatus(value) {
|
|
9558
|
-
return value === "
|
|
9558
|
+
return value === "needs_confirmation" || value === "running" || value === "blocked" || value === "waiting_for_human" || value === "completed" || value === "failed" || value === "cancelled";
|
|
9559
9559
|
}
|
|
9560
9560
|
function isSourceKind(value) {
|
|
9561
9561
|
return value === "human" || value === "coordinator" || value === "worker";
|
|
@@ -18204,6 +18204,7 @@ class CommandRouter {
|
|
|
18204
18204
|
});
|
|
18205
18205
|
return { text: renderCommandAccessDenied(command) };
|
|
18206
18206
|
}
|
|
18207
|
+
await this.refreshConfigFromStore();
|
|
18207
18208
|
return await this.executeCommand(chatKey, command.kind, startedAt, async () => {
|
|
18208
18209
|
switch (command.kind) {
|
|
18209
18210
|
case "invalid":
|
|
@@ -18409,8 +18410,21 @@ class CommandRouter {
|
|
|
18409
18410
|
...channel,
|
|
18410
18411
|
...channel.options ? { options: { ...channel.options } } : {}
|
|
18411
18412
|
}));
|
|
18413
|
+
this.config.plugins = updated.plugins.map((plugin) => ({ ...plugin }));
|
|
18412
18414
|
this.config.agents = { ...updated.agents };
|
|
18413
18415
|
this.config.workspaces = { ...updated.workspaces };
|
|
18416
|
+
this.config.orchestration = {
|
|
18417
|
+
...updated.orchestration,
|
|
18418
|
+
allowedAgentRequestTargets: [...updated.orchestration.allowedAgentRequestTargets],
|
|
18419
|
+
allowedAgentRequestRoles: [...updated.orchestration.allowedAgentRequestRoles]
|
|
18420
|
+
};
|
|
18421
|
+
}
|
|
18422
|
+
async refreshConfigFromStore() {
|
|
18423
|
+
if (!this.config || !this.configStore) {
|
|
18424
|
+
return;
|
|
18425
|
+
}
|
|
18426
|
+
const updated = await this.configStore.load();
|
|
18427
|
+
this.replaceConfig(updated);
|
|
18414
18428
|
}
|
|
18415
18429
|
async executeCommand(chatKey, kind, startedAt, operation) {
|
|
18416
18430
|
try {
|
|
@@ -18984,7 +18998,6 @@ class OrchestrationServer {
|
|
|
18984
18998
|
}
|
|
18985
18999
|
requireOnlyKeys(filter, ["coordinatorSession", "status", "stuck", "sort", "order"], "filter");
|
|
18986
19000
|
const status = requireOptionalEnum(filter, "status", [
|
|
18987
|
-
"pending",
|
|
18988
19001
|
"needs_confirmation",
|
|
18989
19002
|
"running",
|
|
18990
19003
|
"blocked",
|
|
@@ -21381,7 +21394,7 @@ class OrchestrationService {
|
|
|
21381
21394
|
}
|
|
21382
21395
|
buildGroupSummary(group, tasks) {
|
|
21383
21396
|
const sortedTasks = tasks.slice().sort((left, right) => left.createdAt.localeCompare(right.createdAt)).map((task) => ({ ...task }));
|
|
21384
|
-
const pendingApprovalTasks = sortedTasks.filter((task) => task.status === "
|
|
21397
|
+
const pendingApprovalTasks = sortedTasks.filter((task) => task.status === "needs_confirmation").length;
|
|
21385
21398
|
const runningTasks = sortedTasks.filter((task) => task.status === "running").length;
|
|
21386
21399
|
const completedTasks = sortedTasks.filter((task) => task.status === "completed").length;
|
|
21387
21400
|
const failedTasks = sortedTasks.filter((task) => task.status === "failed").length;
|
|
@@ -22236,7 +22249,7 @@ function isTerminalTaskStatus2(status) {
|
|
|
22236
22249
|
return status === "completed" || status === "failed" || status === "cancelled";
|
|
22237
22250
|
}
|
|
22238
22251
|
function isAttentionRequiredTask(task) {
|
|
22239
|
-
return task.reviewPending !== undefined || task.status === "
|
|
22252
|
+
return task.reviewPending !== undefined || task.status === "needs_confirmation" || task.status === "blocked" || task.status === "waiting_for_human";
|
|
22240
22253
|
}
|
|
22241
22254
|
function clampWaitTimeout(timeoutMs) {
|
|
22242
22255
|
if (timeoutMs === undefined) {
|
|
@@ -38624,7 +38637,6 @@ init_task_wait_timeouts();
|
|
|
38624
38637
|
init_quota_errors();
|
|
38625
38638
|
var groupStatusSchema = exports_external.enum(["pending", "running", "terminal"]);
|
|
38626
38639
|
var taskStatusSchema = exports_external.enum([
|
|
38627
|
-
"pending",
|
|
38628
38640
|
"needs_confirmation",
|
|
38629
38641
|
"running",
|
|
38630
38642
|
"blocked",
|
|
@@ -38641,11 +38653,11 @@ var taskQuestionSchema = exports_external.object({
|
|
|
38641
38653
|
questionId: exports_external.string().min(1)
|
|
38642
38654
|
}).strict();
|
|
38643
38655
|
function buildWeacpxMcpToolRegistry(input) {
|
|
38644
|
-
const { transport, coordinatorSession, sourceHandle, availableAgents } = input;
|
|
38645
|
-
|
|
38656
|
+
const { transport, coordinatorSession, sourceHandle, isExternalCoordinator, availableAgents } = input;
|
|
38657
|
+
const tools = [
|
|
38646
38658
|
{
|
|
38647
38659
|
name: "delegate_request",
|
|
38648
|
-
description: `Delegate a subtask to another agent under the current coordinator. Pass an absolute workingDirectory for the worker.${availableAgents && availableAgents.length > 0 ? ` Available agents: ${availableAgents.join(", ")}.` : ""}`,
|
|
38660
|
+
description: `Delegate a subtask to another agent under the current coordinator. Pass an absolute workingDirectory for the worker. After this returns status=running, call task_wait with the returned taskId to wait for completion before reporting back to the user; if status=needs_confirmation, wait for the user to approve (task_approve / task_reject) and do not call task_wait yet.${availableAgents && availableAgents.length > 0 ? ` Available agents: ${availableAgents.join(", ")}.` : ""}`,
|
|
38649
38661
|
inputSchema: exports_external.object({
|
|
38650
38662
|
targetAgent: exports_external.string().min(1),
|
|
38651
38663
|
task: exports_external.string().min(1),
|
|
@@ -38665,7 +38677,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38665
38677
|
},
|
|
38666
38678
|
{
|
|
38667
38679
|
name: "group_new",
|
|
38668
|
-
description: "Create a new task group under the current coordinator.",
|
|
38680
|
+
description: "Create a new task group under the current coordinator. Use to batch multiple delegate_request calls together; pass the resulting groupId on each delegate so they share lifecycle and cancellation.",
|
|
38669
38681
|
inputSchema: exports_external.object({
|
|
38670
38682
|
title: exports_external.string().min(1)
|
|
38671
38683
|
}).strict(),
|
|
@@ -38679,7 +38691,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38679
38691
|
},
|
|
38680
38692
|
{
|
|
38681
38693
|
name: "group_get",
|
|
38682
|
-
description: "Fetch a single task-group summary under the current coordinator.",
|
|
38694
|
+
description: "Fetch a single task-group summary under the current coordinator. Use to check aggregate progress when waiting on a batch of delegations.",
|
|
38683
38695
|
inputSchema: exports_external.object({
|
|
38684
38696
|
groupId: exports_external.string().min(1)
|
|
38685
38697
|
}).strict(),
|
|
@@ -38693,7 +38705,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38693
38705
|
},
|
|
38694
38706
|
{
|
|
38695
38707
|
name: "group_list",
|
|
38696
|
-
description: "List task groups under the current coordinator.",
|
|
38708
|
+
description: "List task groups under the current coordinator. Use to recover groupIds for an earlier batch.",
|
|
38697
38709
|
inputSchema: exports_external.object({
|
|
38698
38710
|
status: groupStatusSchema.optional(),
|
|
38699
38711
|
stuck: exports_external.boolean().optional(),
|
|
@@ -38714,7 +38726,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38714
38726
|
},
|
|
38715
38727
|
{
|
|
38716
38728
|
name: "group_cancel",
|
|
38717
|
-
description: "Cancel all unfinished tasks in a task group under the current coordinator.",
|
|
38729
|
+
description: "Cancel all unfinished tasks in a task group under the current coordinator. Use to abort a batch started via group_new + delegate_request.",
|
|
38718
38730
|
inputSchema: exports_external.object({
|
|
38719
38731
|
groupId: exports_external.string().min(1)
|
|
38720
38732
|
}).strict(),
|
|
@@ -38728,7 +38740,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38728
38740
|
},
|
|
38729
38741
|
{
|
|
38730
38742
|
name: "task_get",
|
|
38731
|
-
description: "Fetch a single task under the current coordinator.",
|
|
38743
|
+
description: "Fetch a single task under the current coordinator, including the worker's final result and any pending question. Use after task_wait returns to read the actual output before summarizing it for the user, or to inspect a task that requires attention.",
|
|
38732
38744
|
inputSchema: exports_external.object({
|
|
38733
38745
|
taskId: exports_external.string().min(1)
|
|
38734
38746
|
}).strict(),
|
|
@@ -38742,7 +38754,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38742
38754
|
},
|
|
38743
38755
|
{
|
|
38744
38756
|
name: "task_list",
|
|
38745
|
-
description: "List tasks under the current coordinator.",
|
|
38757
|
+
description: "List tasks under the current coordinator. Use to recover taskIds for in-flight delegations or to survey what is still running / blocked.",
|
|
38746
38758
|
inputSchema: exports_external.object({
|
|
38747
38759
|
status: taskStatusSchema.optional(),
|
|
38748
38760
|
stuck: exports_external.boolean().optional(),
|
|
@@ -38763,7 +38775,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38763
38775
|
},
|
|
38764
38776
|
{
|
|
38765
38777
|
name: "task_approve",
|
|
38766
|
-
description: "Approve a pending task under the current coordinator.",
|
|
38778
|
+
description: "Approve a pending task under the current coordinator. Use when delegate_request returned status=needs_confirmation and the user has authorized it; after approval, call task_wait.",
|
|
38767
38779
|
inputSchema: exports_external.object({
|
|
38768
38780
|
taskId: exports_external.string().min(1)
|
|
38769
38781
|
}).strict(),
|
|
@@ -38777,7 +38789,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38777
38789
|
},
|
|
38778
38790
|
{
|
|
38779
38791
|
name: "task_reject",
|
|
38780
|
-
description: "Reject a pending task under the current coordinator.",
|
|
38792
|
+
description: "Reject a pending task under the current coordinator. Use when delegate_request returned status=needs_confirmation and the user declined; no task_wait is needed afterwards.",
|
|
38781
38793
|
inputSchema: exports_external.object({
|
|
38782
38794
|
taskId: exports_external.string().min(1)
|
|
38783
38795
|
}).strict(),
|
|
@@ -38791,7 +38803,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38791
38803
|
},
|
|
38792
38804
|
{
|
|
38793
38805
|
name: "task_cancel",
|
|
38794
|
-
description: "Request cancellation for a task under the current coordinator.",
|
|
38806
|
+
description: "Request cancellation for a task under the current coordinator. Use to abort a running delegation; the task transitions to a terminal state shortly after.",
|
|
38795
38807
|
inputSchema: exports_external.object({
|
|
38796
38808
|
taskId: exports_external.string().min(1)
|
|
38797
38809
|
}).strict(),
|
|
@@ -38805,7 +38817,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38805
38817
|
},
|
|
38806
38818
|
{
|
|
38807
38819
|
name: "task_wait",
|
|
38808
|
-
description: `Wait for a task to finish or require attention. Defaults: timeout ${DEFAULT_TASK_WAIT_TIMEOUT_MS} ms, poll interval ${DEFAULT_TASK_WAIT_POLL_INTERVAL_MS} ms. Maximums: timeout ${MAX_TASK_WAIT_TIMEOUT_MS} ms, poll interval ${MAX_TASK_WAIT_POLL_INTERVAL_MS} ms.`,
|
|
38820
|
+
description: `Wait for a task to finish or require attention. Call this immediately after delegate_request (when status=running) unless you intend a fire-and-forget. Returns status=terminal (done; call task_get for the result), status=attention_required (call task_get first to read the task's current status, then branch: needs_confirmation -> task_approve or task_reject; blocked or waiting_for_human -> coordinator_answer_question; reviewPending set -> coordinator_review_contested_result; after resolving, call task_wait again), or status=timeout (still running; call task_wait again or task_get for a snapshot). Defaults: timeout ${DEFAULT_TASK_WAIT_TIMEOUT_MS} ms, poll interval ${DEFAULT_TASK_WAIT_POLL_INTERVAL_MS} ms. Maximums: timeout ${MAX_TASK_WAIT_TIMEOUT_MS} ms, poll interval ${MAX_TASK_WAIT_POLL_INTERVAL_MS} ms.`,
|
|
38809
38821
|
inputSchema: exports_external.object({
|
|
38810
38822
|
taskId: exports_external.string().min(1),
|
|
38811
38823
|
timeoutMs: exports_external.number().int().min(0).max(MAX_TASK_WAIT_TIMEOUT_MS).optional(),
|
|
@@ -38821,7 +38833,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38821
38833
|
},
|
|
38822
38834
|
{
|
|
38823
38835
|
name: "worker_raise_question",
|
|
38824
|
-
description: "Raise a blocker question for the current bound worker session.",
|
|
38836
|
+
description: "Raise a blocker question for the current bound worker session. Worker-side only: call this from inside a delegated task when you are blocked and need the coordinator's input. Coordinators waiting on a delegation should not call this; use task_wait instead.",
|
|
38825
38837
|
inputSchema: exports_external.object({
|
|
38826
38838
|
taskId: exports_external.string().min(1),
|
|
38827
38839
|
question: exports_external.string().min(1),
|
|
@@ -38841,7 +38853,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38841
38853
|
},
|
|
38842
38854
|
{
|
|
38843
38855
|
name: "coordinator_answer_question",
|
|
38844
|
-
description: "Answer a blocked worker question under the current coordinator.",
|
|
38856
|
+
description: "Answer a blocked worker question under the current coordinator. Use after task_wait returns status=attention_required and task_get shows a pending question; after answering, call task_wait again to keep waiting for the worker to finish.",
|
|
38845
38857
|
inputSchema: exports_external.object({
|
|
38846
38858
|
taskId: exports_external.string().min(1),
|
|
38847
38859
|
questionId: exports_external.string().min(1),
|
|
@@ -38857,7 +38869,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38857
38869
|
},
|
|
38858
38870
|
{
|
|
38859
38871
|
name: "coordinator_request_human_input",
|
|
38860
|
-
description: "Create or queue a human question package for blocked tasks under the current coordinator.",
|
|
38872
|
+
description: "Create or queue a human question package for blocked tasks under the current coordinator. Use when answering a worker question requires real human input rather than your own judgement.",
|
|
38861
38873
|
inputSchema: exports_external.object({
|
|
38862
38874
|
taskQuestions: exports_external.array(taskQuestionSchema).min(1),
|
|
38863
38875
|
promptText: exports_external.string().min(1),
|
|
@@ -38873,7 +38885,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38873
38885
|
},
|
|
38874
38886
|
{
|
|
38875
38887
|
name: "coordinator_follow_up_human_package",
|
|
38876
|
-
description: "Append a follow-up message to the active human question package under the current coordinator.",
|
|
38888
|
+
description: "Append a follow-up message to the active human question package under the current coordinator. Use to clarify or add context to an in-flight package created via coordinator_request_human_input.",
|
|
38877
38889
|
inputSchema: exports_external.object({
|
|
38878
38890
|
packageId: exports_external.string().min(1),
|
|
38879
38891
|
priorMessageId: exports_external.string().min(1),
|
|
@@ -38890,7 +38902,7 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38890
38902
|
},
|
|
38891
38903
|
{
|
|
38892
38904
|
name: "coordinator_review_contested_result",
|
|
38893
|
-
description: "Review a contested result under the current coordinator.",
|
|
38905
|
+
description: "Review a contested result under the current coordinator. Use when a worker's result has been challenged and the coordinator must decide accept or discard.",
|
|
38894
38906
|
inputSchema: exports_external.object({
|
|
38895
38907
|
taskId: exports_external.string().min(1),
|
|
38896
38908
|
reviewId: exports_external.string().min(1),
|
|
@@ -38907,6 +38919,14 @@ function buildWeacpxMcpToolRegistry(input) {
|
|
|
38907
38919
|
})
|
|
38908
38920
|
}
|
|
38909
38921
|
];
|
|
38922
|
+
if (isExternalCoordinator) {
|
|
38923
|
+
const externalCoordinatorIncompatibleTools = new Set([
|
|
38924
|
+
"coordinator_request_human_input",
|
|
38925
|
+
"coordinator_follow_up_human_package"
|
|
38926
|
+
]);
|
|
38927
|
+
return tools.filter((tool) => !externalCoordinatorIncompatibleTools.has(tool.name));
|
|
38928
|
+
}
|
|
38929
|
+
return tools;
|
|
38910
38930
|
}
|
|
38911
38931
|
async function asToolResult(action) {
|
|
38912
38932
|
try {
|
|
@@ -38935,12 +38955,28 @@ function renderTaskWaitResult(result) {
|
|
|
38935
38955
|
return `Task wait ${result.status.replace("_", " ")}; current state is unavailable.`;
|
|
38936
38956
|
}
|
|
38937
38957
|
if (result.status === "timeout") {
|
|
38938
|
-
return
|
|
38958
|
+
return [
|
|
38959
|
+
`Task ${result.task.taskId} wait timed out; current state is ${result.task.status}.`,
|
|
38960
|
+
`Next: call task_wait again with this taskId to keep waiting, or task_get for a snapshot.`
|
|
38961
|
+
].join(`
|
|
38962
|
+
`);
|
|
38939
38963
|
}
|
|
38940
38964
|
if (result.status === "attention_required") {
|
|
38941
|
-
return
|
|
38965
|
+
return [
|
|
38966
|
+
`Task ${result.task.taskId} requires attention; current state is ${result.task.status}.`,
|
|
38967
|
+
`Next: call task_get to read the task's current status and any reviewPending / openQuestion fields, then branch by what you see:`,
|
|
38968
|
+
` - status=needs_confirmation -> task_approve or task_reject`,
|
|
38969
|
+
` - status=blocked or waiting_for_human -> coordinator_answer_question`,
|
|
38970
|
+
` - reviewPending set -> coordinator_review_contested_result`,
|
|
38971
|
+
`After resolving, call task_wait again to keep waiting for the worker to finish.`
|
|
38972
|
+
].join(`
|
|
38973
|
+
`);
|
|
38942
38974
|
}
|
|
38943
|
-
return
|
|
38975
|
+
return [
|
|
38976
|
+
`Task ${result.task.taskId} reached terminal state ${result.task.status}.`,
|
|
38977
|
+
`Next: call task_get to read the worker's final result before reporting back to the user.`
|
|
38978
|
+
].join(`
|
|
38979
|
+
`);
|
|
38944
38980
|
}
|
|
38945
38981
|
function createSuccessResult(text, structuredContent) {
|
|
38946
38982
|
return {
|
|
@@ -38955,7 +38991,8 @@ function createErrorResult(message) {
|
|
|
38955
38991
|
};
|
|
38956
38992
|
}
|
|
38957
38993
|
function renderDelegateSuccess(result) {
|
|
38958
|
-
|
|
38994
|
+
const next = result.status === "needs_confirmation" ? `Next: this delegation requires user approval; do not call task_wait yet. Tell the user, then call task_approve or task_reject based on their response.` : `Next: call task_wait with taskId="${result.taskId}" to wait for the worker to finish, then task_get to read the result before reporting back.`;
|
|
38995
|
+
return [`Delegation task "${result.taskId}" created.`, `- Status: ${result.status}`, next].join(`
|
|
38959
38996
|
`);
|
|
38960
38997
|
}
|
|
38961
38998
|
function renderGroupCreated(group) {
|
|
@@ -39100,7 +39137,11 @@ function renderTaskCancelRequest(task) {
|
|
|
39100
39137
|
`);
|
|
39101
39138
|
}
|
|
39102
39139
|
function renderTaskApprovalSuccess(task) {
|
|
39103
|
-
return [
|
|
39140
|
+
return [
|
|
39141
|
+
`Task "${task.taskId}" approved.`,
|
|
39142
|
+
`- Current status: ${task.status}`,
|
|
39143
|
+
`Next: call task_wait with taskId="${task.taskId}" to wait for the worker to finish, then task_get to read the result before reporting back.`
|
|
39144
|
+
].join(`
|
|
39104
39145
|
`);
|
|
39105
39146
|
}
|
|
39106
39147
|
function renderTaskRejectionSuccess(task) {
|
|
@@ -39335,6 +39376,30 @@ function createOrchestrationTransport(endpoint, deps = {}) {
|
|
|
39335
39376
|
}
|
|
39336
39377
|
|
|
39337
39378
|
// src/mcp/weacpx-mcp-server.ts
|
|
39379
|
+
var WEACPX_MCP_SERVER_INSTRUCTIONS = [
|
|
39380
|
+
"Use these tools to orchestrate work across other agents under your coordinator session.",
|
|
39381
|
+
"",
|
|
39382
|
+
"Typical lifecycle for a single delegation:",
|
|
39383
|
+
"1. delegate_request → returns { taskId, status }.",
|
|
39384
|
+
" - status=running: the worker has started; go to step 2.",
|
|
39385
|
+
" - status=needs_confirmation: tell the user, then call task_approve or task_reject based on their response. After task_approve, return to step 2 to wait for the worker. Do not call task_wait before approval.",
|
|
39386
|
+
"2. task_wait(taskId) → blocks until the task is done, needs attention, or times out.",
|
|
39387
|
+
" - status=terminal: go to step 3.",
|
|
39388
|
+
" - status=attention_required: the task is in needs_confirmation / blocked / waiting_for_human, or has reviewPending set. Call task_get(taskId) to read the actual status and any openQuestion / reviewPending fields, then branch:",
|
|
39389
|
+
" * needs_confirmation -> task_approve or task_reject (after approval, go back to step 2)",
|
|
39390
|
+
" * blocked or waiting_for_human -> coordinator_answer_question (the answer can come from you or be relayed from a human you consulted)",
|
|
39391
|
+
" * reviewPending set -> coordinator_review_contested_result with accept or discard",
|
|
39392
|
+
" After resolving, call task_wait again to keep waiting.",
|
|
39393
|
+
" - status=timeout: the task is still running. Call task_wait again to keep waiting, or task_get for a snapshot.",
|
|
39394
|
+
"3. The task is terminal. Call task_get(taskId) to read the worker's final result, then summarize it for the user. Do not invent results that did not come from task_get.",
|
|
39395
|
+
"",
|
|
39396
|
+
"Batching: use group_new before a wave of delegate_request calls and pass groupId on each, then group_get / group_list / group_cancel to manage the batch.",
|
|
39397
|
+
"Cancellation: task_cancel aborts a single running task; group_cancel aborts the whole batch.",
|
|
39398
|
+
"Discovery: task_list / group_list recover taskIds and groupIds from earlier in the session.",
|
|
39399
|
+
"",
|
|
39400
|
+
"worker_raise_question is worker-side only — call it from inside a delegated task when you are blocked, not from the coordinator that is waiting on a delegation."
|
|
39401
|
+
].join(`
|
|
39402
|
+
`);
|
|
39338
39403
|
function createWeacpxMcpServer(options) {
|
|
39339
39404
|
const server = new Server({
|
|
39340
39405
|
name: "weacpx-orchestration",
|
|
@@ -39342,7 +39407,8 @@ function createWeacpxMcpServer(options) {
|
|
|
39342
39407
|
}, {
|
|
39343
39408
|
capabilities: {
|
|
39344
39409
|
tools: {}
|
|
39345
|
-
}
|
|
39410
|
+
},
|
|
39411
|
+
instructions: WEACPX_MCP_SERVER_INSTRUCTIONS
|
|
39346
39412
|
});
|
|
39347
39413
|
let toolState = null;
|
|
39348
39414
|
let toolStatePromise = null;
|
|
@@ -39361,6 +39427,7 @@ function createWeacpxMcpServer(options) {
|
|
|
39361
39427
|
transport: options.transport,
|
|
39362
39428
|
coordinatorSession: identity.coordinatorSession,
|
|
39363
39429
|
...identity.sourceHandle ? { sourceHandle: identity.sourceHandle } : {},
|
|
39430
|
+
...identity.isExternalCoordinator ? { isExternalCoordinator: true } : {},
|
|
39364
39431
|
...options.availableAgents ? { availableAgents: options.availableAgents } : {}
|
|
39365
39432
|
});
|
|
39366
39433
|
return toolState;
|
|
@@ -39410,7 +39477,8 @@ async function resolveMcpIdentity(server, options) {
|
|
|
39410
39477
|
if (options.coordinatorSession) {
|
|
39411
39478
|
return {
|
|
39412
39479
|
coordinatorSession: options.coordinatorSession,
|
|
39413
|
-
...options.sourceHandle ? { sourceHandle: options.sourceHandle } : {}
|
|
39480
|
+
...options.sourceHandle ? { sourceHandle: options.sourceHandle } : {},
|
|
39481
|
+
...options.isExternalCoordinator ? { isExternalCoordinator: true } : {}
|
|
39414
39482
|
};
|
|
39415
39483
|
}
|
|
39416
39484
|
throw new McpError(ErrorCode.InvalidRequest, "weacpx MCP identity is not configured; run through `weacpx mcp-stdio` or provide --coordinator-session");
|
|
@@ -41279,7 +41347,7 @@ function createMcpStdioIdentityResolver(input) {
|
|
|
41279
41347
|
clientName: context.clientName,
|
|
41280
41348
|
...resolvedWorkspace ? { workspace: resolvedWorkspace } : { instanceId }
|
|
41281
41349
|
});
|
|
41282
|
-
await prepareMcpCoordinatorStartup({
|
|
41350
|
+
const startup = await prepareMcpCoordinatorStartup({
|
|
41283
41351
|
coordinatorSession: resolvedCoordinatorSession,
|
|
41284
41352
|
...resolvedWorkspace ? { workspace: resolvedWorkspace } : {},
|
|
41285
41353
|
config: input.config,
|
|
@@ -41288,7 +41356,8 @@ function createMcpStdioIdentityResolver(input) {
|
|
|
41288
41356
|
});
|
|
41289
41357
|
return {
|
|
41290
41358
|
coordinatorSession: resolvedCoordinatorSession,
|
|
41291
|
-
...sourceHandle ? { sourceHandle } : {}
|
|
41359
|
+
...sourceHandle ? { sourceHandle } : {},
|
|
41360
|
+
...startup.kind === "external-coordinator" ? { isExternalCoordinator: true } : {}
|
|
41292
41361
|
};
|
|
41293
41362
|
};
|
|
41294
41363
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type OrchestrationTaskStatus = "
|
|
1
|
+
export type OrchestrationTaskStatus = "needs_confirmation" | "running" | "blocked" | "waiting_for_human" | "completed" | "failed" | "cancelled";
|
|
2
2
|
export type OrchestrationSourceKind = "human" | "coordinator" | "worker";
|
|
3
3
|
export interface OrchestrationOpenQuestionRecord {
|
|
4
4
|
questionId: string;
|