crow-central-agency 0.27.2 → 0.27.4
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/_shared/index.js +3 -2
- package/dist/_shared/schemas/agent-runtime-state.schema.js +2 -0
- package/dist/_shared/schemas/agent-task.schema.js +8 -0
- package/dist/_shared/schemas/ask-user-question.schema.js +80 -0
- package/dist/_shared/schemas/websocket.schema.js +29 -0
- package/dist/mcp/agents/agents-mcp-server.js +2 -0
- package/dist/mcp/agents/notify-user.js +38 -0
- package/dist/public/assets/architecture-7EHR7CIX-BLDTKZff.js +1 -0
- package/dist/public/assets/{architectureDiagram-3BPJPVTR-CClJU70x.js → architectureDiagram-3BPJPVTR-DcLp53ks.js} +1 -1
- package/dist/public/assets/{blockDiagram-GPEHLZMM-DXGYsvdc.js → blockDiagram-GPEHLZMM-COb1KenB.js} +1 -1
- package/dist/public/assets/{c4Diagram-AAUBKEIU-ztTqSRMY.js → c4Diagram-AAUBKEIU-IUh6A7Za.js} +1 -1
- package/dist/public/assets/channel-C-wagQM8.js +1 -0
- package/dist/public/assets/{chunk-2J33WTMH-r7brTJ1f.js → chunk-2J33WTMH-Q9b9U5PC.js} +1 -1
- package/dist/public/assets/{chunk-3OPIFGDE-Bxujc1Rt.js → chunk-3OPIFGDE-CIb_TSQQ.js} +1 -1
- package/dist/public/assets/{chunk-5ZQYHXKU-BjSbc4aL.js → chunk-5ZQYHXKU-CYFDDL1w.js} +1 -1
- package/dist/public/assets/{chunk-727SXJPM-BAondkhN.js → chunk-727SXJPM-XIo7oVtG.js} +1 -1
- package/dist/public/assets/{chunk-AQP2D5EJ-kM5I-WKN.js → chunk-AQP2D5EJ-BI7xqZk2.js} +1 -1
- package/dist/public/assets/chunk-CSCIHK7Q-BVAvEr49.js +124 -0
- package/dist/public/assets/{chunk-L5ZTLDWV-DB34dWa1.js → chunk-L5ZTLDWV-BXJBnnPc.js} +1 -1
- package/dist/public/assets/{chunk-ND2GUHAM-Bpp57ujs.js → chunk-ND2GUHAM-CSUCpka6.js} +1 -1
- package/dist/public/assets/{chunk-NZK2D7GU-FABVcHPM.js → chunk-NZK2D7GU-D2mVFKEf.js} +1 -1
- package/dist/public/assets/{chunk-O5CBEL6O-DX0VXF6r.js → chunk-O5CBEL6O-CrmbDPo_.js} +1 -1
- package/dist/public/assets/classDiagram-4FO5ZUOK-DGcVm4Q5.js +1 -0
- package/dist/public/assets/classDiagram-v2-Q7XG4LA2-DGcVm4Q5.js +1 -0
- package/dist/public/assets/{dagre-BM42HDAG-DKTzSm29.js → dagre-BM42HDAG-B3patl-g.js} +1 -1
- package/dist/public/assets/{diagram-2AECGRRQ-5PrRefQL.js → diagram-2AECGRRQ-CxueRws9.js} +1 -1
- package/dist/public/assets/{diagram-5GNKFQAL-DKTGe-Ql.js → diagram-5GNKFQAL-DxnmH1-b.js} +1 -1
- package/dist/public/assets/{diagram-KO2AKTUF-Bw_mRWA5.js → diagram-KO2AKTUF-AH2lKBgH.js} +1 -1
- package/dist/public/assets/{diagram-LMA3HP47-Bb2RaPM2.js → diagram-LMA3HP47-DYsCbTL9.js} +1 -1
- package/dist/public/assets/{diagram-OG6HWLK6-B-tad09d.js → diagram-OG6HWLK6-Yd5rbBnP.js} +1 -1
- package/dist/public/assets/{erDiagram-TEJ5UH35-BL7n_6V6.js → erDiagram-TEJ5UH35-B_fNsE24.js} +1 -1
- package/dist/public/assets/eventmodeling-FCH6USID-CF9xEP-X.js +1 -0
- package/dist/public/assets/{flowDiagram-I6XJVG4X-BLdaPh9i.js → flowDiagram-I6XJVG4X-1RGxGFVo.js} +1 -1
- package/dist/public/assets/{ganttDiagram-6RSMTGT7-CQRvJhaK.js → ganttDiagram-6RSMTGT7-Dm-pxQMF.js} +1 -1
- package/dist/public/assets/{gitGraph-WXDBUCRP-BhIDpW78.js → gitGraph-WXDBUCRP-trIaHm_3.js} +1 -1
- package/dist/public/assets/{gitGraphDiagram-PVQCEYII-DWInzrI1.js → gitGraphDiagram-PVQCEYII-D_tYTS1S.js} +1 -1
- package/dist/public/assets/index-TGs47HRH.css +1 -0
- package/dist/public/assets/index-xjbIK240.js +506 -0
- package/dist/public/assets/{info-J43DQDTF-CzYqXPKX.js → info-J43DQDTF-CSWAtiX3.js} +1 -1
- package/dist/public/assets/{infoDiagram-5YYISTIA-CW9DCQBr.js → infoDiagram-5YYISTIA-BGMCoByw.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-YF4QCWOH-CwgrER31.js → ishikawaDiagram-YF4QCWOH-BovCFpGj.js} +1 -1
- package/dist/public/assets/{journeyDiagram-JHISSGLW-CetGiV--.js → journeyDiagram-JHISSGLW-CvgBFRhC.js} +1 -1
- package/dist/public/assets/{kanban-definition-UN3LZRKU-D1TuBRHr.js → kanban-definition-UN3LZRKU-Cvw4R6q0.js} +1 -1
- package/dist/public/assets/{line-TBAqc70M.js → line-DMGu7yNS.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-BTfrTWwR.js → mermaid-parser.core-BIrsRvbQ.js} +2 -2
- package/dist/public/assets/{mindmap-definition-RKZ34NQL-BtOi3_hU.js → mindmap-definition-RKZ34NQL-C1PB56AT.js} +1 -1
- package/dist/public/assets/{packet-YPE3B663-DpzZfEUr.js → packet-YPE3B663-LBm85dXD.js} +1 -1
- package/dist/public/assets/{pie-LRSECV5Y-CKXDKuOS.js → pie-LRSECV5Y-D72DSxK_.js} +1 -1
- package/dist/public/assets/{pieDiagram-4H26LBE5-DDo-JQZU.js → pieDiagram-4H26LBE5-BmlKEbOb.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-W4KKPZXB-DLRwsW2X.js → quadrantDiagram-W4KKPZXB-Bihi2ZP6.js} +1 -1
- package/dist/public/assets/{radar-GUYGQ44K-D6NB5Ces.js → radar-GUYGQ44K-uOB_KSJv.js} +1 -1
- package/dist/public/assets/{requirementDiagram-4Y6WPE33-ghmfv1SX.js → requirementDiagram-4Y6WPE33-fQsscjz4.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-5OEKKPKP-D4dcxrbz.js → sankeyDiagram-5OEKKPKP-D8WOyoNR.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-3UESZ5HK-D9BnXt7s.js → sequenceDiagram-3UESZ5HK-D3Dcgv4W.js} +1 -1
- package/dist/public/assets/{stateDiagram-AJRCARHV-BfaEy_5w.js → stateDiagram-AJRCARHV-CNDpWF6K.js} +1 -1
- package/dist/public/assets/stateDiagram-v2-BHNVJYJU-BoNssJ29.js +1 -0
- package/dist/public/assets/{timeline-definition-PNZ67QCA-pAl_71QE.js → timeline-definition-PNZ67QCA-BOFUBbBR.js} +1 -1
- package/dist/public/assets/{treeView-BLDUP644-ogG90Vuy.js → treeView-BLDUP644-Coi_gX2R.js} +1 -1
- package/dist/public/assets/{treemap-LRROVOQU-BQPk01Pq.js → treemap-LRROVOQU-BOL_opmV.js} +1 -1
- package/dist/public/assets/{vennDiagram-CIIHVFJN-DzbKt_lu.js → vennDiagram-CIIHVFJN-CC_D_mm2.js} +1 -1
- package/dist/public/assets/{wardley-L42UT6IY-CJ1EIHi0.js → wardley-L42UT6IY-CfWk2pwg.js} +1 -1
- package/dist/public/assets/{wardleyDiagram-YWT4CUSO-CxEPL2m6.js → wardleyDiagram-YWT4CUSO-C2PrhED2.js} +1 -1
- package/dist/public/assets/{xychartDiagram-2RQKCTM6-B9a3Jq4J.js → xychartDiagram-2RQKCTM6-Bz4b9Iiv.js} +1 -1
- package/dist/public/index.html +9 -9
- package/dist/routes/task.routes.js +13 -2
- package/dist/routines/inter-agent-task-routine.js +57 -30
- package/dist/runner/agent-runner-factory.js +3 -3
- package/dist/runner/claude-code-agent-runner.js +11 -2
- package/dist/runner/github-copilot-agent-runner.js +4 -1
- package/dist/runner/github-copilot-stream-processor.js +13 -0
- package/dist/server/setup-websocket.js +7 -1
- package/dist/services/agent-task-manager.js +25 -1
- package/dist/services/runtime/agent-runtime-manager.js +53 -1
- package/dist/services/runtime/question-handler.js +83 -0
- package/dist/services/runtime/question-handler.types.js +2 -0
- package/package.json +9 -7
- package/dist/public/assets/architecture-7EHR7CIX-DCLkOO9h.js +0 -1
- package/dist/public/assets/channel-CpuupTCJ.js +0 -1
- package/dist/public/assets/chunk-CSCIHK7Q-DuISv0xe.js +0 -124
- package/dist/public/assets/classDiagram-4FO5ZUOK-Dgr7qiRI.js +0 -1
- package/dist/public/assets/classDiagram-v2-Q7XG4LA2-Dgr7qiRI.js +0 -1
- package/dist/public/assets/eventmodeling-FCH6USID-Cm9TEclR.js +0 -1
- package/dist/public/assets/index-YTL1DK3j.css +0 -1
- package/dist/public/assets/index-uXjCHDqs.js +0 -506
- package/dist/public/assets/stateDiagram-v2-BHNVJYJU-CTwOziWy.js +0 -1
package/dist/_shared/index.js
CHANGED
|
@@ -2,11 +2,12 @@ export { CLAUDE_MODELS, GITHUB_COPILOT_MODELS, CLAUDE_CODE_MODEL_OPTIONS, ModelO
|
|
|
2
2
|
export { SchedulerTimeSchema, DAY_OF_WEEK, DayOfWeekSchema, TimeModeSchema, TIME_MODE, } from "./schemas/scheduler.schema.js";
|
|
3
3
|
export { createApiSuccessSchema, ApiErrorSchema, } from "./schemas/api-response.schema.js";
|
|
4
4
|
export { SessionUsageSchema, PendingPermissionInfoSchema, PendingInstructionReminderSchema, AgentRuntimeStateSchema, AgentActivitySchema, AGENT_ACTIVITY_TYPE, AGENT_STATUS, MAX_INPUT_HISTORY, } from "./schemas/agent-runtime-state.schema.js";
|
|
5
|
-
export { ClientMessageSchema, ServerMessageSchema, SendMessageSchema, InjectMessageSchema, PermissionResponseWsSchema, CommandMessageSchema, AgentTextWsMessageSchema, AgentActivityWsMessageSchema, AgentResultWsMessageSchema, AgentStatusWsMessageSchema, AgentCreatedWsMessageSchema, AgentUpdatedWsMessageSchema, AgentDeletedWsMessageSchema, AgentUsageWsMessageSchema, PermissionRequestWsMessageSchema, PermissionCancelledWsMessageSchema, ErrorWsMessageSchema, AgentMessageWsMessageSchema, AgentToolProgressWsMessageSchema, TaskAddedWsMessageSchema, TaskUpdatedWsMessageSchema, TaskAssignedWsMessageSchema, TaskStateChangedWsMessageSchema, TaskDeletedWsMessageSchema, CircleCreatedWsMessageSchema, CircleUpdatedWsMessageSchema, CircleDeletedWsMessageSchema, RelationshipCreatedWsMessageSchema, RelationshipDeletedWsMessageSchema, FragmentCreatedWsMessageSchema, FragmentUpdatedWsMessageSchema, FragmentDeletedWsMessageSchema, AgentBuilderDraftUpdatedWsMessageSchema, isAgentServerMessage, isAgentLifecycleServerMessage, CLIENT_MESSAGE_TYPE, SERVER_MESSAGE_TYPE, } from "./schemas/websocket.schema.js";
|
|
5
|
+
export { ClientMessageSchema, ServerMessageSchema, SendMessageSchema, InjectMessageSchema, PermissionResponseWsSchema, ResolveQuestionWsSchema, CommandMessageSchema, AgentTextWsMessageSchema, AgentActivityWsMessageSchema, AgentResultWsMessageSchema, AgentStatusWsMessageSchema, AgentCreatedWsMessageSchema, AgentUpdatedWsMessageSchema, AgentDeletedWsMessageSchema, AgentUsageWsMessageSchema, PermissionRequestWsMessageSchema, PermissionCancelledWsMessageSchema, QuestionRequestWsMessageSchema, QuestionResolvedWsMessageSchema, ErrorWsMessageSchema, AgentMessageWsMessageSchema, AgentToolProgressWsMessageSchema, TaskAddedWsMessageSchema, TaskUpdatedWsMessageSchema, TaskAssignedWsMessageSchema, TaskStateChangedWsMessageSchema, TaskDeletedWsMessageSchema, CircleCreatedWsMessageSchema, CircleUpdatedWsMessageSchema, CircleDeletedWsMessageSchema, RelationshipCreatedWsMessageSchema, RelationshipDeletedWsMessageSchema, FragmentCreatedWsMessageSchema, FragmentUpdatedWsMessageSchema, FragmentDeletedWsMessageSchema, AgentBuilderDraftUpdatedWsMessageSchema, isAgentServerMessage, isAgentLifecycleServerMessage, CLIENT_MESSAGE_TYPE, SERVER_MESSAGE_TYPE, } from "./schemas/websocket.schema.js";
|
|
6
6
|
export { PERMISSION_DECISION, PermissionRequestSchema, PermissionResponseSchema, } from "./schemas/permission.schema.js";
|
|
7
|
+
export { ASK_USER_QUESTION_TOOL_NAME, QUESTION_SUBMISSION_KIND, AskUserQuestionOptionSchema, AskUserQuestionItemSchema, AskUserQuestionSchema, PendingQuestionInfoSchema, QuestionAnswerSchema, QuestionAnswersSubmissionSchema, QuestionResponseSubmissionSchema, QuestionSubmissionSchema, AskUserQuestionAnswersInputSchema, AskUserQuestionResponseInputSchema, AskUserQuestionResolvedInputSchema, } from "./schemas/ask-user-question.schema.js";
|
|
7
8
|
export { AgentMessageSchema, MessageAnnotationSchema, AGENT_MESSAGE_ROLE, AGENT_MESSAGE_TYPE, } from "./schemas/agent-message.schema.js";
|
|
8
9
|
export { ARTIFACT_TYPE, ARTIFACT_CONTENT_TYPE, ArtifactTypeSchema, ArtifactContentTypeSchema, ArtifactEntityTypeSchema, ArtifactMetadataSchema, ArtifactUpdateSchema, } from "./schemas/artifact.schema.js";
|
|
9
|
-
export { AGENT_TASK_STATE, AGENT_TASK_SOURCE_TYPE, AgentTaskStateSchema, AgentTaskSourceSchema, AgentTaskItemSchema, AgentTaskDatabaseSchema, CreateTaskInputSchema, UpdateTaskInputSchema, UpdateTaskStateInputSchema, AssignTaskInputSchema, } from "./schemas/agent-task.schema.js";
|
|
10
|
+
export { AGENT_TASK_STATE, AGENT_TASK_SOURCE_TYPE, AgentTaskStateSchema, AgentTaskSourceSchema, AgentTaskItemSchema, AgentTaskDatabaseSchema, CreateTaskInputSchema, UpdateTaskInputSchema, UpdateTaskResultInputSchema, UpdateTaskStateInputSchema, AssignTaskInputSchema, } from "./schemas/agent-task.schema.js";
|
|
10
11
|
export { MCP_CONFIG_TYPE, InternalMcpConfigSchema, McpServerConfigSchema, CreateMcpConfigInputSchema, UpdateMcpConfigInputSchema, } from "./schemas/mcp-config.schema.js";
|
|
11
12
|
export { SensorInfoSchema } from "./schemas/sensor.schema.js";
|
|
12
13
|
export { AddFeedInputSchema, DetectFeedsInputSchema, } from "./schemas/feed.schema.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { MessageSourceSchema } from "./message-source.schema.js";
|
|
3
|
+
import { PendingQuestionInfoSchema } from "./ask-user-question.schema.js";
|
|
3
4
|
/** Maximum number of recent user inputs retained per agent for compose-box recall. */
|
|
4
5
|
export const MAX_INPUT_HISTORY = 30;
|
|
5
6
|
export const AGENT_STATUS = {
|
|
@@ -83,6 +84,7 @@ export const AgentRuntimeStateSchema = z.object({
|
|
|
83
84
|
lastGmailCheckTimestamp: z.number().optional(),
|
|
84
85
|
lastError: z.string().optional(),
|
|
85
86
|
pendingPermissions: z.array(PendingPermissionInfoSchema).optional(),
|
|
87
|
+
pendingQuestion: PendingQuestionInfoSchema.optional(),
|
|
86
88
|
pendingInstructionReminder: PendingInstructionReminderSchema.optional(),
|
|
87
89
|
inputHistory: z.array(z.string()).optional(),
|
|
88
90
|
});
|
|
@@ -70,6 +70,13 @@ export const CreateTaskInputSchema = z.object({
|
|
|
70
70
|
export const UpdateTaskInputSchema = z.object({
|
|
71
71
|
task: z.string().min(1, "Task description is required"),
|
|
72
72
|
});
|
|
73
|
+
/**
|
|
74
|
+
* Input for saving a draft result on an OPEN task without changing its state.
|
|
75
|
+
* Empty string is a legitimate value (clears the draft).
|
|
76
|
+
*/
|
|
77
|
+
export const UpdateTaskResultInputSchema = z.object({
|
|
78
|
+
taskResult: z.string(),
|
|
79
|
+
});
|
|
73
80
|
/**
|
|
74
81
|
* Input for transitioning a task to a new state via REST.
|
|
75
82
|
* Only includes states reachable by user action. OPEN is the initial
|
|
@@ -77,6 +84,7 @@ export const UpdateTaskInputSchema = z.object({
|
|
|
77
84
|
*/
|
|
78
85
|
export const UpdateTaskStateInputSchema = z.object({
|
|
79
86
|
state: z.enum([AGENT_TASK_STATE.INCOMPLETE, AGENT_TASK_STATE.COMPLETED, AGENT_TASK_STATE.CLOSED]),
|
|
87
|
+
taskResult: z.string().optional(),
|
|
80
88
|
});
|
|
81
89
|
/** Input for assigning a task. Accepts the owner source (who will handle the task). */
|
|
82
90
|
export const AssignTaskInputSchema = z.object({
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** The Claude SDK tool name whose `canUseTool` call parks for a user answer. */
|
|
3
|
+
export const ASK_USER_QUESTION_TOOL_NAME = "AskUserQuestion";
|
|
4
|
+
/**
|
|
5
|
+
* A single selectable option within a question. `preview` is a sanitized HTML fragment, present only
|
|
6
|
+
* because the query sets `previewFormat: "html"`; options may omit it.
|
|
7
|
+
*/
|
|
8
|
+
export const AskUserQuestionOptionSchema = z.object({
|
|
9
|
+
label: z.string(),
|
|
10
|
+
description: z.string(),
|
|
11
|
+
preview: z.string().optional(),
|
|
12
|
+
});
|
|
13
|
+
/** One question in an AskUserQuestion set, with its options and select mode. */
|
|
14
|
+
export const AskUserQuestionItemSchema = z.object({
|
|
15
|
+
question: z.string(),
|
|
16
|
+
header: z.string(),
|
|
17
|
+
multiSelect: z.boolean(),
|
|
18
|
+
options: z.array(AskUserQuestionOptionSchema),
|
|
19
|
+
});
|
|
20
|
+
/** The validated `canUseTool` input for the AskUserQuestion tool (SDK input is advisory; we parse it). */
|
|
21
|
+
export const AskUserQuestionSchema = z.object({
|
|
22
|
+
questions: z.array(AskUserQuestionItemSchema),
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Pending question metadata persisted on runtime state so the frontend recovers it on refresh.
|
|
26
|
+
* Single slot — the paused query allows at most one in-flight question per agent.
|
|
27
|
+
*/
|
|
28
|
+
export const PendingQuestionInfoSchema = z.object({
|
|
29
|
+
toolUseId: z.string(),
|
|
30
|
+
questions: z.array(AskUserQuestionItemSchema),
|
|
31
|
+
});
|
|
32
|
+
/** How a parked question is resolved: per-question selections, or a freeform reply. */
|
|
33
|
+
export const QUESTION_SUBMISSION_KIND = {
|
|
34
|
+
ANSWERS: "answers",
|
|
35
|
+
RESPONSE: "response",
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A single answer keyed by question index (question text is a fragile wire key; the backend owns the
|
|
39
|
+
* text mapping). `value` is one label for single-select/free-text, or many for multi-select.
|
|
40
|
+
*/
|
|
41
|
+
export const QuestionAnswerSchema = z.object({
|
|
42
|
+
questionIndex: z.number().int().nonnegative(),
|
|
43
|
+
value: z.union([z.string(), z.array(z.string())]),
|
|
44
|
+
});
|
|
45
|
+
/** Per-question answers submission — the index-keyed selections the user made. */
|
|
46
|
+
export const QuestionAnswersSubmissionSchema = z.object({
|
|
47
|
+
toolUseId: z.string(),
|
|
48
|
+
kind: z.literal(QUESTION_SUBMISSION_KIND.ANSWERS),
|
|
49
|
+
answers: z.array(QuestionAnswerSchema),
|
|
50
|
+
});
|
|
51
|
+
/** Freeform response submission — dismiss / general reply, valid regardless of per-question completeness. */
|
|
52
|
+
export const QuestionResponseSubmissionSchema = z.object({
|
|
53
|
+
toolUseId: z.string(),
|
|
54
|
+
kind: z.literal(QUESTION_SUBMISSION_KIND.RESPONSE),
|
|
55
|
+
response: z.string(),
|
|
56
|
+
});
|
|
57
|
+
/** UI -> backend submission resolving a parked question. */
|
|
58
|
+
export const QuestionSubmissionSchema = z.discriminatedUnion("kind", [
|
|
59
|
+
QuestionAnswersSubmissionSchema,
|
|
60
|
+
QuestionResponseSubmissionSchema,
|
|
61
|
+
]);
|
|
62
|
+
/**
|
|
63
|
+
* Resolved `updatedInput` returned to the SDK for a per-question answers submission. `answers` is
|
|
64
|
+
* text-keyed (`questions[i].question` -> value), the shape the tool expects.
|
|
65
|
+
*/
|
|
66
|
+
export const AskUserQuestionAnswersInputSchema = z.object({
|
|
67
|
+
questions: z.array(AskUserQuestionItemSchema),
|
|
68
|
+
answers: z.record(z.string(), z.union([z.string(), z.array(z.string())])),
|
|
69
|
+
});
|
|
70
|
+
/** Resolved `updatedInput` returned to the SDK for a freeform response submission. */
|
|
71
|
+
export const AskUserQuestionResponseInputSchema = z.object({
|
|
72
|
+
questions: z.array(AskUserQuestionItemSchema),
|
|
73
|
+
response: z.string(),
|
|
74
|
+
});
|
|
75
|
+
/** The backend-assembled `updatedInput` handed back to the paused SDK query. */
|
|
76
|
+
export const AskUserQuestionResolvedInputSchema = z.union([
|
|
77
|
+
AskUserQuestionAnswersInputSchema,
|
|
78
|
+
AskUserQuestionResponseInputSchema,
|
|
79
|
+
]);
|
|
80
|
+
//# sourceMappingURL=ask-user-question.schema.js.map
|
|
@@ -8,6 +8,7 @@ import { AGENT_STATUS, AgentActivitySchema } from "./agent-runtime-state.schema.
|
|
|
8
8
|
import { MessageSourceSchema } from "./message-source.schema.js";
|
|
9
9
|
import { AgentCommandSchema } from "./agent-command.schema.js";
|
|
10
10
|
import { AgentBuilderDraftViewSchema } from "./agent-builder.schema.js";
|
|
11
|
+
import { AskUserQuestionItemSchema, QUESTION_SUBMISSION_KIND, QuestionAnswerSchema, } from "./ask-user-question.schema.js";
|
|
11
12
|
/**
|
|
12
13
|
* WebSocket message types - Client -> Server
|
|
13
14
|
*/
|
|
@@ -15,6 +16,7 @@ export const CLIENT_MESSAGE_TYPE = {
|
|
|
15
16
|
SEND_MESSAGE: "send_message",
|
|
16
17
|
INJECT_MESSAGE: "inject_message",
|
|
17
18
|
PERMISSION_RESPONSE: "permission_response",
|
|
19
|
+
RESOLVE_QUESTION: "resolve_question",
|
|
18
20
|
COMMAND: "command",
|
|
19
21
|
};
|
|
20
22
|
/**
|
|
@@ -31,6 +33,8 @@ export const SERVER_MESSAGE_TYPE = {
|
|
|
31
33
|
AGENT_USAGE: "agent_usage",
|
|
32
34
|
PERMISSION_REQUEST: "permission_request",
|
|
33
35
|
PERMISSION_CANCELLED: "permission_cancelled",
|
|
36
|
+
QUESTION_REQUEST: "question_request",
|
|
37
|
+
QUESTION_RESOLVED: "question_resolved",
|
|
34
38
|
ERROR: "error",
|
|
35
39
|
AGENT_MESSAGE: "agent_message",
|
|
36
40
|
AGENT_TOOL_PROGRESS: "agent_tool_progress",
|
|
@@ -66,6 +70,17 @@ export const PermissionResponseWsSchema = z.object({
|
|
|
66
70
|
decision: z.enum([PERMISSION_DECISION.ALLOW, PERMISSION_DECISION.DENY, PERMISSION_DECISION.ALLOW_ALWAYS]),
|
|
67
71
|
message: z.string().optional(),
|
|
68
72
|
});
|
|
73
|
+
/**
|
|
74
|
+
* Resolve a parked AskUserQuestion. `answers`/`response` are loosely optional here; the strict xor is
|
|
75
|
+
* enforced by re-parsing into the question submission union at the routing boundary.
|
|
76
|
+
*/
|
|
77
|
+
export const ResolveQuestionWsSchema = z.object({
|
|
78
|
+
type: z.literal(CLIENT_MESSAGE_TYPE.RESOLVE_QUESTION),
|
|
79
|
+
toolUseId: z.string(),
|
|
80
|
+
kind: z.enum([QUESTION_SUBMISSION_KIND.ANSWERS, QUESTION_SUBMISSION_KIND.RESPONSE]),
|
|
81
|
+
answers: z.array(QuestionAnswerSchema).optional(),
|
|
82
|
+
response: z.string().optional(),
|
|
83
|
+
});
|
|
69
84
|
export const CommandMessageSchema = z.object({
|
|
70
85
|
type: z.literal(CLIENT_MESSAGE_TYPE.COMMAND),
|
|
71
86
|
agentId: z.string(),
|
|
@@ -76,6 +91,7 @@ export const ClientMessageSchema = z.discriminatedUnion("type", [
|
|
|
76
91
|
SendMessageSchema,
|
|
77
92
|
InjectMessageSchema,
|
|
78
93
|
PermissionResponseWsSchema,
|
|
94
|
+
ResolveQuestionWsSchema,
|
|
79
95
|
CommandMessageSchema,
|
|
80
96
|
]);
|
|
81
97
|
export const AgentTextWsMessageSchema = z.object({
|
|
@@ -137,6 +153,17 @@ export const PermissionCancelledWsMessageSchema = z.object({
|
|
|
137
153
|
agentId: z.string(),
|
|
138
154
|
toolUseId: z.string(),
|
|
139
155
|
});
|
|
156
|
+
export const QuestionRequestWsMessageSchema = z.object({
|
|
157
|
+
type: z.literal(SERVER_MESSAGE_TYPE.QUESTION_REQUEST),
|
|
158
|
+
agentId: z.string(),
|
|
159
|
+
toolUseId: z.string(),
|
|
160
|
+
questions: z.array(AskUserQuestionItemSchema),
|
|
161
|
+
});
|
|
162
|
+
export const QuestionResolvedWsMessageSchema = z.object({
|
|
163
|
+
type: z.literal(SERVER_MESSAGE_TYPE.QUESTION_RESOLVED),
|
|
164
|
+
agentId: z.string(),
|
|
165
|
+
toolUseId: z.string(),
|
|
166
|
+
});
|
|
140
167
|
export const ErrorWsMessageSchema = z.object({
|
|
141
168
|
type: z.literal(SERVER_MESSAGE_TYPE.ERROR),
|
|
142
169
|
agentId: z.string().optional(),
|
|
@@ -224,6 +251,8 @@ export const ServerMessageSchema = z.discriminatedUnion("type", [
|
|
|
224
251
|
AgentUsageWsMessageSchema,
|
|
225
252
|
PermissionRequestWsMessageSchema,
|
|
226
253
|
PermissionCancelledWsMessageSchema,
|
|
254
|
+
QuestionRequestWsMessageSchema,
|
|
255
|
+
QuestionResolvedWsMessageSchema,
|
|
227
256
|
ErrorWsMessageSchema,
|
|
228
257
|
AgentMessageWsMessageSchema,
|
|
229
258
|
AgentToolProgressWsMessageSchema,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineMcpTool } from "../crow-mcp-manager-utils.js";
|
|
2
2
|
import { getListAgentsToolConfig } from "./list-agents.js";
|
|
3
3
|
import { getInvokeAgentToolConfig } from "./invoke-agent.js";
|
|
4
|
+
import { getNotifyUserToolConfig } from "./notify-user.js";
|
|
4
5
|
import { getSearchWorkspaceToolConfig } from "./search-workspace.js";
|
|
5
6
|
import { CROW_NARRATIVE_ARCHITECT_AGENT_ID, CROW_WORLD_BUILDER_AGENT_ID, FRAGMENT_REFLECTION_AGENT_ID, } from "../../_shared/index.js";
|
|
6
7
|
export const CROW_AGENTS_MCP_SERVER_NAME = "crow-agents";
|
|
@@ -11,6 +12,7 @@ export function getAgentsMcpServerDefinition(registry, runtimeManager, taskManag
|
|
|
11
12
|
getTools: (agentId) => [
|
|
12
13
|
defineMcpTool(getListAgentsToolConfig(agentId, registry)),
|
|
13
14
|
defineMcpTool(getInvokeAgentToolConfig(agentId, registry, runtimeManager, taskManager)),
|
|
15
|
+
defineMcpTool(getNotifyUserToolConfig(agentId, taskManager)),
|
|
14
16
|
defineMcpTool(getSearchWorkspaceToolConfig(agentId, documentSearchService, taskManager, circleManager, fragmentManager)),
|
|
15
17
|
],
|
|
16
18
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { trace } from "@opentelemetry/api";
|
|
3
|
+
import { AGENT_TASK_SOURCE_TYPE } from "../../_shared/index.js";
|
|
4
|
+
import { getErrorToolResult, textToolResult } from "../tool-utils.js";
|
|
5
|
+
export const NOTIFY_USER_TOOL_NAME = "notify_user";
|
|
6
|
+
export function getNotifyUserToolConfig(agentId, taskManager) {
|
|
7
|
+
const inputSchema = {
|
|
8
|
+
note: z
|
|
9
|
+
.string()
|
|
10
|
+
.min(1)
|
|
11
|
+
.describe("A clear, self-contained note for the user. Include everything they need to act or decide, since they do not share your conversation history"),
|
|
12
|
+
};
|
|
13
|
+
const handler = async ({ note }) => {
|
|
14
|
+
const trimmedNote = note.trim();
|
|
15
|
+
if (!trimmedNote) {
|
|
16
|
+
return textToolResult(["Error: note cannot be empty"], true);
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
await taskManager.addTask(trimmedNote, { sourceType: AGENT_TASK_SOURCE_TYPE.AGENT, agentId }, { sourceType: AGENT_TASK_SOURCE_TYPE.USER });
|
|
20
|
+
trace.getActiveSpan()?.addEvent("notify_user", { "source.agent_id": agentId });
|
|
21
|
+
return textToolResult([
|
|
22
|
+
"Your note has been delivered to the user. This is fire-and-forget — do not wait for a reply.",
|
|
23
|
+
"If the user responds or dismisses it, you will be notified separately.",
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
return getErrorToolResult(error, "Failed to notify user.");
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const config = {
|
|
31
|
+
name: NOTIFY_USER_TOOL_NAME,
|
|
32
|
+
description: "Surface a note to the user — an actionable item or a question needing their decision. Use only for items that genuinely need the user's attention. This is fire-and-forget: do not wait for a reply; if the user responds you will be notified separately.",
|
|
33
|
+
inputSchema,
|
|
34
|
+
handler,
|
|
35
|
+
};
|
|
36
|
+
return config;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=notify-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-NNHCCRGN-DlpIbxXb.js";import{x as e}from"./mermaid-parser.core-BIrsRvbQ.js";export{e as createArchitectureServices};
|