crow-central-agency 0.26.4 → 0.26.6
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-command.schema.js +7 -0
- package/dist/_shared/schemas/agent-message.schema.js +7 -0
- package/dist/_shared/schemas/artifact.schema.js +8 -0
- package/dist/_shared/schemas/message-source.schema.js +3 -0
- package/dist/_shared/schemas/websocket.schema.js +9 -0
- package/dist/mcp/artifacts/artifacts-mcp-server.js +2 -0
- package/dist/mcp/artifacts/move-artifact.js +77 -0
- package/dist/public/assets/architecture-7EHR7CIX-DCLkOO9h.js +1 -0
- package/dist/public/assets/{architectureDiagram-3BPJPVTR-Bz06JFon.js → architectureDiagram-3BPJPVTR-hb6K6wgj.js} +1 -1
- package/dist/public/assets/{blockDiagram-GPEHLZMM-B-ui54uY.js → blockDiagram-GPEHLZMM-B8TiZHkt.js} +1 -1
- package/dist/public/assets/{c4Diagram-AAUBKEIU-C7xPAjI3.js → c4Diagram-AAUBKEIU-C7EL8BgS.js} +1 -1
- package/dist/public/assets/channel-CpuupTCJ.js +1 -0
- package/dist/public/assets/{chunk-2J33WTMH-DLyyWUKS.js → chunk-2J33WTMH-r7brTJ1f.js} +1 -1
- package/dist/public/assets/{chunk-3OPIFGDE-BAV3S28P.js → chunk-3OPIFGDE-MQSAwWWp.js} +1 -1
- package/dist/public/assets/{chunk-5ZQYHXKU-k4j14TFR.js → chunk-5ZQYHXKU-DjjMoQy4.js} +1 -1
- package/dist/public/assets/{chunk-727SXJPM-5GKwh6fT.js → chunk-727SXJPM-C_gU2zm7.js} +1 -1
- package/dist/public/assets/{chunk-AQP2D5EJ-wMWKOYIc.js → chunk-AQP2D5EJ-B__4Eu33.js} +1 -1
- package/dist/public/assets/chunk-CSCIHK7Q-DuISv0xe.js +124 -0
- package/dist/public/assets/{chunk-L5ZTLDWV-Dv4f3XV4.js → chunk-L5ZTLDWV-qldrlPBQ.js} +1 -1
- package/dist/public/assets/{chunk-ND2GUHAM-BgcUO3cE.js → chunk-ND2GUHAM-Bpp57ujs.js} +1 -1
- package/dist/public/assets/{chunk-NZK2D7GU-DEdNhH61.js → chunk-NZK2D7GU-FABVcHPM.js} +1 -1
- package/dist/public/assets/{chunk-O5CBEL6O-BkWxYhMO.js → chunk-O5CBEL6O-IrQhDPxX.js} +1 -1
- package/dist/public/assets/classDiagram-4FO5ZUOK-DPYDjDtU.js +1 -0
- package/dist/public/assets/classDiagram-v2-Q7XG4LA2-DPYDjDtU.js +1 -0
- package/dist/public/assets/{dagre-BM42HDAG-BaqEK3sM.js → dagre-BM42HDAG-C_ua8jqr.js} +1 -1
- package/dist/public/assets/{diagram-2AECGRRQ-BFC7UJOh.js → diagram-2AECGRRQ-C_hAHBm3.js} +1 -1
- package/dist/public/assets/{diagram-5GNKFQAL-C0jqgvuM.js → diagram-5GNKFQAL-XfqU1l0i.js} +1 -1
- package/dist/public/assets/{diagram-KO2AKTUF-DbnrTKPq.js → diagram-KO2AKTUF-l-G_fXJx.js} +1 -1
- package/dist/public/assets/{diagram-LMA3HP47-KRJXH1WK.js → diagram-LMA3HP47-Dl4q9tdd.js} +1 -1
- package/dist/public/assets/{diagram-OG6HWLK6-CbGXtbWC.js → diagram-OG6HWLK6-DiwfBumT.js} +1 -1
- package/dist/public/assets/{erDiagram-TEJ5UH35-dMSRMTue.js → erDiagram-TEJ5UH35-B4DG_5N3.js} +1 -1
- package/dist/public/assets/eventmodeling-FCH6USID-Cm9TEclR.js +1 -0
- package/dist/public/assets/{flowDiagram-I6XJVG4X-CKHf79Nb.js → flowDiagram-I6XJVG4X-Dc1g_Yg4.js} +1 -1
- package/dist/public/assets/{ganttDiagram-6RSMTGT7-TRVQ1Fd3.js → ganttDiagram-6RSMTGT7-DcrRy6MU.js} +1 -1
- package/dist/public/assets/{gitGraph-WXDBUCRP-DK18B2O2.js → gitGraph-WXDBUCRP-BhIDpW78.js} +1 -1
- package/dist/public/assets/{gitGraphDiagram-PVQCEYII-CawvqXpb.js → gitGraphDiagram-PVQCEYII-C2wZyHYx.js} +1 -1
- package/dist/public/assets/index-Cq16E29e.js +479 -0
- package/dist/public/assets/{info-J43DQDTF-CpTMz9Tv.js → info-J43DQDTF-CzYqXPKX.js} +1 -1
- package/dist/public/assets/{infoDiagram-5YYISTIA-BvsQpC6d.js → infoDiagram-5YYISTIA-DrrCrVps.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-YF4QCWOH-z1LNiCtm.js → ishikawaDiagram-YF4QCWOH-1wxA3mcS.js} +1 -1
- package/dist/public/assets/{journeyDiagram-JHISSGLW-BadSfDOq.js → journeyDiagram-JHISSGLW-CetGiV--.js} +1 -1
- package/dist/public/assets/{kanban-definition-UN3LZRKU-m2MPOiiM.js → kanban-definition-UN3LZRKU-DadR2Di7.js} +1 -1
- package/dist/public/assets/{line-BxRqDWw8.js → line-kwTiCfuG.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-BdOZ0AFQ.js → mermaid-parser.core-BTfrTWwR.js} +2 -2
- package/dist/public/assets/{mindmap-definition-RKZ34NQL-zOLQH8v9.js → mindmap-definition-RKZ34NQL-D1_gceBb.js} +1 -1
- package/dist/public/assets/{packet-YPE3B663-DtrEp0HG.js → packet-YPE3B663-DpzZfEUr.js} +1 -1
- package/dist/public/assets/{pie-LRSECV5Y-Biojo2af.js → pie-LRSECV5Y-CKXDKuOS.js} +1 -1
- package/dist/public/assets/{pieDiagram-4H26LBE5-CsM1jwJk.js → pieDiagram-4H26LBE5-CI2HIITi.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-W4KKPZXB-DyqnhvLb.js → quadrantDiagram-W4KKPZXB-DLRwsW2X.js} +1 -1
- package/dist/public/assets/{radar-GUYGQ44K-Dl-OE3Q4.js → radar-GUYGQ44K-D6NB5Ces.js} +1 -1
- package/dist/public/assets/{requirementDiagram-4Y6WPE33-aMN3gWn2.js → requirementDiagram-4Y6WPE33-BG0_sqoy.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-5OEKKPKP-chSC0J1Z.js → sankeyDiagram-5OEKKPKP-D4dcxrbz.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-3UESZ5HK-DwgLNsZa.js → sequenceDiagram-3UESZ5HK-CGQg7J3F.js} +1 -1
- package/dist/public/assets/{stateDiagram-AJRCARHV-BWU7pHby.js → stateDiagram-AJRCARHV-CAnvOQIn.js} +1 -1
- package/dist/public/assets/stateDiagram-v2-BHNVJYJU-C376ULpU.js +1 -0
- package/dist/public/assets/{timeline-definition-PNZ67QCA-Cqw5PUrr.js → timeline-definition-PNZ67QCA-CgfFNDHN.js} +1 -1
- package/dist/public/assets/{treeView-BLDUP644-CI9praQE.js → treeView-BLDUP644-ogG90Vuy.js} +1 -1
- package/dist/public/assets/{treemap-LRROVOQU-CFg0aDpp.js → treemap-LRROVOQU-BQPk01Pq.js} +1 -1
- package/dist/public/assets/{vennDiagram-CIIHVFJN-6ZJ8KTO8.js → vennDiagram-CIIHVFJN-DfrIVn7E.js} +1 -1
- package/dist/public/assets/{wardley-L42UT6IY-J8igKzxr.js → wardley-L42UT6IY-CJ1EIHi0.js} +1 -1
- package/dist/public/assets/{wardleyDiagram-YWT4CUSO-DML2A9_-.js → wardleyDiagram-YWT4CUSO-SQF6BOhQ.js} +1 -1
- package/dist/public/assets/{xychartDiagram-2RQKCTM6-DMJqgVoY.js → xychartDiagram-2RQKCTM6-rKsoartu.js} +1 -1
- package/dist/public/index.html +8 -8
- package/dist/routes/artifact.routes.js +30 -1
- package/dist/routines/inter-agent-task-routine.js +2 -1
- package/dist/runner/agent-runner.js +7 -4
- package/dist/runner/claude-code-agent-runner.js +25 -7
- package/dist/runner/github-copilot-agent-runner.js +98 -5
- package/dist/runner/github-copilot-stream-processor.js +1 -3
- package/dist/runner/stream-processor.js +15 -1
- package/dist/server/setup-websocket.js +18 -2
- package/dist/services/artifact/artifact-manager.js +28 -1
- package/dist/services/runtime/agent-runtime-manager.js +3 -1
- package/dist/services/session/session-message-transformer.js +38 -4
- package/dist/utils/message-template.js +4 -0
- package/package.json +2 -2
- package/dist/public/assets/architecture-7EHR7CIX-DG_7xbiq.js +0 -1
- package/dist/public/assets/channel-Bqyn77ps.js +0 -1
- package/dist/public/assets/chunk-CSCIHK7Q-XbmkaXEE.js +0 -124
- package/dist/public/assets/classDiagram-4FO5ZUOK-DeakRfbI.js +0 -1
- package/dist/public/assets/classDiagram-v2-Q7XG4LA2-DeakRfbI.js +0 -1
- package/dist/public/assets/eventmodeling-FCH6USID-BX2CvCmJ.js +0 -1
- package/dist/public/assets/index-R4E59YNF.js +0 -479
- package/dist/public/assets/stateDiagram-v2-BHNVJYJU-BZV-KXVr.js +0 -1
package/dist/_shared/index.js
CHANGED
|
@@ -2,10 +2,10 @@ 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, } from "./schemas/agent-runtime-state.schema.js";
|
|
5
|
-
export { ClientMessageSchema, ServerMessageSchema, SendMessageSchema, InjectMessageSchema, PermissionResponseWsSchema, AgentTextWsMessageSchema, AgentActivityWsMessageSchema, AgentResultWsMessageSchema, AgentStatusWsMessageSchema, AgentCreatedWsMessageSchema, AgentUpdatedWsMessageSchema, AgentDeletedWsMessageSchema, AgentUsageWsMessageSchema, PermissionRequestWsMessageSchema, PermissionCancelledWsMessageSchema, ErrorWsMessageSchema, AgentMessageWsMessageSchema, AgentToolProgressWsMessageSchema, TaskAddedWsMessageSchema, TaskUpdatedWsMessageSchema, TaskAssignedWsMessageSchema, TaskStateChangedWsMessageSchema, TaskDeletedWsMessageSchema, CircleCreatedWsMessageSchema, CircleUpdatedWsMessageSchema, CircleDeletedWsMessageSchema, RelationshipCreatedWsMessageSchema, RelationshipDeletedWsMessageSchema, CLIENT_MESSAGE_TYPE, SERVER_MESSAGE_TYPE, } from "./schemas/websocket.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, CLIENT_MESSAGE_TYPE, SERVER_MESSAGE_TYPE, } from "./schemas/websocket.schema.js";
|
|
6
6
|
export { PERMISSION_DECISION, PermissionRequestSchema, PermissionResponseSchema, } from "./schemas/permission.schema.js";
|
|
7
7
|
export { AgentMessageSchema, MessageAnnotationSchema, AGENT_MESSAGE_ROLE, AGENT_MESSAGE_TYPE, } from "./schemas/agent-message.schema.js";
|
|
8
|
-
export { ARTIFACT_TYPE, ARTIFACT_CONTENT_TYPE, ArtifactTypeSchema, ArtifactContentTypeSchema, ArtifactMetadataSchema, } from "./schemas/artifact.schema.js";
|
|
8
|
+
export { ARTIFACT_TYPE, ARTIFACT_CONTENT_TYPE, ArtifactTypeSchema, ArtifactContentTypeSchema, ArtifactMetadataSchema, ArtifactTagsUpdateSchema, } from "./schemas/artifact.schema.js";
|
|
9
9
|
export { AGENT_TASK_STATE, AGENT_TASK_SOURCE_TYPE, AgentTaskStateSchema, AgentTaskSourceSchema, AgentTaskItemSchema, AgentTaskDatabaseSchema, CreateTaskInputSchema, UpdateTaskInputSchema, UpdateTaskStateInputSchema, AssignTaskInputSchema, } from "./schemas/agent-task.schema.js";
|
|
10
10
|
export { MCP_CONFIG_TYPE, InternalMcpConfigSchema, McpServerConfigSchema, CreateMcpConfigInputSchema, UpdateMcpConfigInputSchema, } from "./schemas/mcp-config.schema.js";
|
|
11
11
|
export { SensorInfoSchema } from "./schemas/sensor.schema.js";
|
|
@@ -19,6 +19,7 @@ export { BASE_CIRCLE_ID, BASE_CIRCLE_NAME } from "./constants/system-circle.js";
|
|
|
19
19
|
export { ENTITY_TYPE, RELATIONSHIP_TYPE, AgentCircleSchema, CreateAgentCircleInputSchema, UpdateAgentCircleInputSchema, EntityTypeSchema, RelationshipTypeSchema, RelationshipSchema, CreateRelationshipInputSchema, CircleMemberSchema, } from "./schemas/agent-circle.schema.js";
|
|
20
20
|
export { CROW_SYSTEM_AGENT_ID, CROW_TASK_DISPATCHER_AGENT_ID } from "./constants/system-agent.js";
|
|
21
21
|
export { MESSAGE_SOURCE_TYPE, MessageSourceSchema, } from "./schemas/message-source.schema.js";
|
|
22
|
+
export { AGENT_COMMAND, AgentCommandSchema } from "./schemas/agent-command.schema.js";
|
|
22
23
|
export { GraphNodeSchema, GraphEdgeSchema, GraphDataSchema, } from "./schemas/graph.schema.js";
|
|
23
24
|
export { ConnectorConnectionSchema, ConnectorInfoSchema, ConnectConnectorResponseSchema, } from "./schemas/connector.schema.js";
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Commands an operator can issue to an active provider session. */
|
|
3
|
+
export const AGENT_COMMAND = {
|
|
4
|
+
COMPACT: "compact",
|
|
5
|
+
};
|
|
6
|
+
export const AgentCommandSchema = z.enum([AGENT_COMMAND.COMPACT]);
|
|
7
|
+
//# sourceMappingURL=agent-command.schema.js.map
|
|
@@ -8,6 +8,7 @@ export const AGENT_MESSAGE_TYPE = {
|
|
|
8
8
|
TEXT: "TEXT",
|
|
9
9
|
THINKING: "THINKING",
|
|
10
10
|
TOOL_USE: "TOOL_USE",
|
|
11
|
+
COMMAND: "COMMAND",
|
|
11
12
|
};
|
|
12
13
|
export const MessageAnnotationSchema = z.object({
|
|
13
14
|
id: z.string(),
|
|
@@ -46,6 +47,11 @@ const ToolUseMessageSchema = AgentMessageBase.extend({
|
|
|
46
47
|
/** Raw tool input passed to the tool */
|
|
47
48
|
toolInput: z.record(z.string(), z.unknown()),
|
|
48
49
|
});
|
|
50
|
+
/** Slash-command invocation or its output (system-generated) */
|
|
51
|
+
const CommandMessageSchema = AgentMessageBase.extend({
|
|
52
|
+
role: z.literal(AGENT_MESSAGE_ROLE.SYSTEM),
|
|
53
|
+
type: z.literal(AGENT_MESSAGE_TYPE.COMMAND),
|
|
54
|
+
});
|
|
49
55
|
/**
|
|
50
56
|
* Agent message - the standard message data model for the conversation.
|
|
51
57
|
* Created exclusively by SessionManager from SDK SessionMessage data.
|
|
@@ -55,5 +61,6 @@ export const AgentMessageSchema = z.discriminatedUnion("type", [
|
|
|
55
61
|
TextMessageSchema,
|
|
56
62
|
ThinkingMessageSchema,
|
|
57
63
|
ToolUseMessageSchema,
|
|
64
|
+
CommandMessageSchema,
|
|
58
65
|
]);
|
|
59
66
|
//# sourceMappingURL=agent-message.schema.js.map
|
|
@@ -48,4 +48,12 @@ export const ArtifactMetadataSchema = z.object({
|
|
|
48
48
|
updatedTimestamp: z.number(),
|
|
49
49
|
createdBy: AgentTaskSourceSchema,
|
|
50
50
|
});
|
|
51
|
+
/**
|
|
52
|
+
* Request body for updating an artifact's tags. Applies a remove-then-add delta to the
|
|
53
|
+
* current tag set; at least one of addTags/removeTags must be non-empty.
|
|
54
|
+
*/
|
|
55
|
+
export const ArtifactTagsUpdateSchema = z.object({
|
|
56
|
+
addTags: z.array(z.string()).optional(),
|
|
57
|
+
removeTags: z.array(z.string()).optional(),
|
|
58
|
+
});
|
|
51
59
|
//# sourceMappingURL=artifact.schema.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { AgentCommandSchema } from "./agent-command.schema.js";
|
|
2
3
|
/** Source type identifiers for messages */
|
|
3
4
|
export const MESSAGE_SOURCE_TYPE = {
|
|
4
5
|
USER: "USER",
|
|
@@ -9,6 +10,7 @@ export const MESSAGE_SOURCE_TYPE = {
|
|
|
9
10
|
RECOVERY: "RECOVERY",
|
|
10
11
|
NOTIFICATION: "NOTIFICATION",
|
|
11
12
|
DISCORD: "DISCORD",
|
|
13
|
+
COMMAND: "COMMAND",
|
|
12
14
|
};
|
|
13
15
|
/** Zod schema for message source — identifies who originated a message */
|
|
14
16
|
export const MessageSourceSchema = z.discriminatedUnion("sourceType", [
|
|
@@ -26,5 +28,6 @@ export const MessageSourceSchema = z.discriminatedUnion("sourceType", [
|
|
|
26
28
|
discordUsername: z.string(),
|
|
27
29
|
isDm: z.boolean(),
|
|
28
30
|
}),
|
|
31
|
+
z.object({ sourceType: z.literal(MESSAGE_SOURCE_TYPE.COMMAND), command: AgentCommandSchema }),
|
|
29
32
|
]);
|
|
30
33
|
//# sourceMappingURL=message-source.schema.js.map
|
|
@@ -6,6 +6,7 @@ import { AgentTaskItemSchema, AgentTaskStateSchema } from "./agent-task.schema.j
|
|
|
6
6
|
import { AgentCircleSchema, RelationshipSchema } from "./agent-circle.schema.js";
|
|
7
7
|
import { AGENT_STATUS, AgentActivitySchema } from "./agent-runtime-state.schema.js";
|
|
8
8
|
import { MessageSourceSchema } from "./message-source.schema.js";
|
|
9
|
+
import { AgentCommandSchema } from "./agent-command.schema.js";
|
|
9
10
|
/**
|
|
10
11
|
* WebSocket message types - Client -> Server
|
|
11
12
|
*/
|
|
@@ -13,6 +14,7 @@ export const CLIENT_MESSAGE_TYPE = {
|
|
|
13
14
|
SEND_MESSAGE: "send_message",
|
|
14
15
|
INJECT_MESSAGE: "inject_message",
|
|
15
16
|
PERMISSION_RESPONSE: "permission_response",
|
|
17
|
+
COMMAND: "command",
|
|
16
18
|
};
|
|
17
19
|
/**
|
|
18
20
|
* WebSocket message types - Server -> Client
|
|
@@ -59,10 +61,17 @@ export const PermissionResponseWsSchema = z.object({
|
|
|
59
61
|
decision: z.enum([PERMISSION_DECISION.ALLOW, PERMISSION_DECISION.DENY, PERMISSION_DECISION.ALLOW_ALWAYS]),
|
|
60
62
|
message: z.string().optional(),
|
|
61
63
|
});
|
|
64
|
+
export const CommandMessageSchema = z.object({
|
|
65
|
+
type: z.literal(CLIENT_MESSAGE_TYPE.COMMAND),
|
|
66
|
+
agentId: z.string(),
|
|
67
|
+
command: AgentCommandSchema,
|
|
68
|
+
message: z.string().optional(),
|
|
69
|
+
});
|
|
62
70
|
export const ClientMessageSchema = z.discriminatedUnion("type", [
|
|
63
71
|
SendMessageSchema,
|
|
64
72
|
InjectMessageSchema,
|
|
65
73
|
PermissionResponseWsSchema,
|
|
74
|
+
CommandMessageSchema,
|
|
66
75
|
]);
|
|
67
76
|
export const AgentTextWsMessageSchema = z.object({
|
|
68
77
|
type: z.literal("agent_text"),
|
|
@@ -11,6 +11,7 @@ import { getReadCircleArtifactToolConfig } from "./read-circle-artifact.js";
|
|
|
11
11
|
import { getListCircleArtifactsToolConfig } from "./list-circle-artifacts.js";
|
|
12
12
|
import { getDeleteCircleArtifactToolConfig } from "./delete-circle-artifact.js";
|
|
13
13
|
import { getFindContentInCircleArtifactToolConfig } from "./find-content-in-circle-artifact.js";
|
|
14
|
+
import { getMoveArtifactToolConfig } from "./move-artifact.js";
|
|
14
15
|
export const ARTIFACTS_MCP_SERVER_NAME = "crow-artifacts";
|
|
15
16
|
export function getArtifactsMcpServerDefinition(artifactManager, registry, circleManager, sensorManager) {
|
|
16
17
|
return {
|
|
@@ -28,6 +29,7 @@ export function getArtifactsMcpServerDefinition(artifactManager, registry, circl
|
|
|
28
29
|
defineMcpTool(getListCircleArtifactsToolConfig(agentId, artifactManager, sensorManager)),
|
|
29
30
|
defineMcpTool(getDeleteCircleArtifactToolConfig(agentId, artifactManager)),
|
|
30
31
|
defineMcpTool(getFindContentInCircleArtifactToolConfig(agentId, artifactManager)),
|
|
32
|
+
defineMcpTool(getMoveArtifactToolConfig(agentId, artifactManager)),
|
|
31
33
|
],
|
|
32
34
|
};
|
|
33
35
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AGENT_TASK_SOURCE_TYPE, ENTITY_TYPE } from "../../_shared/index.js";
|
|
3
|
+
import { getErrorToolResult, textToolResult } from "../tool-utils.js";
|
|
4
|
+
export const MOVE_ARTIFACT_TOOL_NAME = "move_artifact";
|
|
5
|
+
export function getMoveArtifactToolConfig(agentId, artifactManager) {
|
|
6
|
+
const inputSchema = {
|
|
7
|
+
filename: z
|
|
8
|
+
.string()
|
|
9
|
+
.describe("Exact source filename to move, as returned by list_artifacts or list_circle_artifacts."),
|
|
10
|
+
source_circle_id: z
|
|
11
|
+
.string()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe("Circle the artifact currently lives in. Omit to move from your own artifacts folder."),
|
|
14
|
+
destination_circle_id: z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Circle to move the artifact into. Omit to move into your own artifacts folder."),
|
|
18
|
+
destination_filename: z
|
|
19
|
+
.string()
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("Filename at the destination. Defaults to the source filename."),
|
|
22
|
+
};
|
|
23
|
+
const handler = async ({ filename, source_circle_id, destination_circle_id, destination_filename, }) => {
|
|
24
|
+
const source = source_circle_id
|
|
25
|
+
? { entityType: ENTITY_TYPE.AGENT_CIRCLE, entityId: source_circle_id }
|
|
26
|
+
: { entityType: ENTITY_TYPE.AGENT, entityId: agentId };
|
|
27
|
+
const destination = destination_circle_id
|
|
28
|
+
? { entityType: ENTITY_TYPE.AGENT_CIRCLE, entityId: destination_circle_id }
|
|
29
|
+
: { entityType: ENTITY_TYPE.AGENT, entityId: agentId };
|
|
30
|
+
if (source.entityType === destination.entityType && source.entityId === destination.entityId) {
|
|
31
|
+
return textToolResult(["Error: source and destination are the same location; nothing to move."], true);
|
|
32
|
+
}
|
|
33
|
+
if (source_circle_id && !artifactManager.isDirectCircleMember(source_circle_id, agentId)) {
|
|
34
|
+
return textToolResult(["You are not a direct member of the source circle."], true);
|
|
35
|
+
}
|
|
36
|
+
if (destination_circle_id && !artifactManager.isDirectCircleMember(destination_circle_id, agentId)) {
|
|
37
|
+
return textToolResult(["You are not a direct member of the destination circle."], true);
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
// Source-removal author guard — mirror the delete tools so move can't bypass them.
|
|
41
|
+
const sourceMetadata = source_circle_id
|
|
42
|
+
? await artifactManager.getCircleArtifactMetadata(source_circle_id, filename)
|
|
43
|
+
: await artifactManager.getArtifactMetadata(agentId, filename);
|
|
44
|
+
const { createdBy } = sourceMetadata;
|
|
45
|
+
const canRemoveSource = source_circle_id
|
|
46
|
+
? createdBy.sourceType === AGENT_TASK_SOURCE_TYPE.AGENT
|
|
47
|
+
: createdBy.sourceType === AGENT_TASK_SOURCE_TYPE.AGENT && createdBy.agentId === agentId;
|
|
48
|
+
if (!canRemoveSource) {
|
|
49
|
+
return textToolResult([`Error: cannot move ${filename} - it is not yours to move (created by: ${createdBy.sourceType}).`], true);
|
|
50
|
+
}
|
|
51
|
+
const metadata = await artifactManager.moveArtifact(source, destination, filename, {
|
|
52
|
+
destinationFilename: destination_filename,
|
|
53
|
+
movedBy: { sourceType: AGENT_TASK_SOURCE_TYPE.AGENT, agentId },
|
|
54
|
+
});
|
|
55
|
+
const sourceLabel = source_circle_id ? `circle ${source_circle_id}` : "your artifacts";
|
|
56
|
+
const destinationLabel = destination_circle_id ? `circle ${destination_circle_id}` : "your artifacts";
|
|
57
|
+
const requestedFilename = destination_filename ?? sourceMetadata.filename;
|
|
58
|
+
const normalizedNote = metadata.filename !== requestedFilename
|
|
59
|
+
? ` (normalized from "${requestedFilename}" - use this exact filename on subsequent reads)`
|
|
60
|
+
: "";
|
|
61
|
+
return textToolResult([
|
|
62
|
+
`Moved ${filename} from ${sourceLabel} to ${destinationLabel} as ${metadata.filename}${normalizedNote}`,
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
return getErrorToolResult(error, "Failed to move artifact.");
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const config = {
|
|
70
|
+
name: MOVE_ARTIFACT_TOOL_NAME,
|
|
71
|
+
description: "Move one of your artifacts between your own folder and a circle you are a direct member of (own↔circle, or circle↔circle). Omit source_circle_id/destination_circle_id to use your own folder. You can only move artifacts you authored from your own folder, or agent-authored artifacts from a circle. Fails if an artifact with the destination name already exists; move it under a different destination_filename or delete the existing one first.",
|
|
72
|
+
inputSchema,
|
|
73
|
+
handler,
|
|
74
|
+
};
|
|
75
|
+
return config;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=move-artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-NNHCCRGN-DlpIbxXb.js";import{x as e}from"./mermaid-parser.core-BTfrTWwR.js";export{e as createArchitectureServices};
|