crow-central-agency 0.26.6 → 0.26.8

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.
Files changed (87) hide show
  1. package/README.md +70 -0
  2. package/dist/_shared/constants/system-agent.js +2 -0
  3. package/dist/_shared/index.js +5 -3
  4. package/dist/_shared/schemas/agent-builder.schema.js +111 -0
  5. package/dist/_shared/schemas/agent.schema.js +10 -5
  6. package/dist/_shared/schemas/generation.schema.js +29 -0
  7. package/dist/_shared/schemas/message-source.schema.js +2 -0
  8. package/dist/_shared/schemas/system-capabilities.schema.js +2 -1
  9. package/dist/_shared/schemas/websocket.schema.js +11 -0
  10. package/dist/agents/crow-narrative-architect-agent.js +93 -0
  11. package/dist/agents/crow-world-builder-agent.js +98 -0
  12. package/dist/bootstrap.js +10 -1
  13. package/dist/config/env.js +6 -0
  14. package/dist/mcp/agents/agents-mcp-server.js +2 -0
  15. package/dist/mcp/agents/builder-agent-mcp-server.js +22 -0
  16. package/dist/mcp/agents/get-agent-details.js +37 -0
  17. package/dist/mcp/agents/invoke-agent.js +1 -1
  18. package/dist/mcp/agents/list-mcp-servers.js +32 -0
  19. package/dist/mcp/artifacts/artifacts-mcp-server.js +2 -0
  20. package/dist/mcp/artifacts/move-artifact.js +13 -8
  21. package/dist/mcp/audio/audio-mcp-server.js +2 -0
  22. package/dist/mcp/crow-mcp-manager.js +39 -14
  23. package/dist/mcp/places/geocode-place.js +33 -18
  24. package/dist/mcp/places/places-format-utils.js +23 -1
  25. package/dist/mcp/reminders/reminders-mcp-server.js +2 -0
  26. package/dist/mcp/tasks/tasks-mcp-server.js +2 -0
  27. package/dist/public/assets/{architectureDiagram-3BPJPVTR-hb6K6wgj.js → architectureDiagram-3BPJPVTR-DDgVnuoo.js} +1 -1
  28. package/dist/public/assets/{chunk-727SXJPM-C_gU2zm7.js → chunk-727SXJPM-PDiAD8Du.js} +1 -1
  29. package/dist/public/assets/{chunk-AQP2D5EJ-B__4Eu33.js → chunk-AQP2D5EJ-wy5_L253.js} +1 -1
  30. package/dist/public/assets/{classDiagram-v2-Q7XG4LA2-DPYDjDtU.js → classDiagram-4FO5ZUOK-BYJ5bFf6.js} +1 -1
  31. package/dist/public/assets/{classDiagram-4FO5ZUOK-DPYDjDtU.js → classDiagram-v2-Q7XG4LA2-BYJ5bFf6.js} +1 -1
  32. package/dist/public/assets/{dagre-BM42HDAG-C_ua8jqr.js → dagre-BM42HDAG-CjoXczSR.js} +1 -1
  33. package/dist/public/assets/{diagram-2AECGRRQ-C_hAHBm3.js → diagram-2AECGRRQ-CCKmxsdo.js} +1 -1
  34. package/dist/public/assets/{diagram-5GNKFQAL-XfqU1l0i.js → diagram-5GNKFQAL-yKZCpt4W.js} +1 -1
  35. package/dist/public/assets/{diagram-LMA3HP47-Dl4q9tdd.js → diagram-LMA3HP47-DneZvlxQ.js} +1 -1
  36. package/dist/public/assets/{diagram-OG6HWLK6-DiwfBumT.js → diagram-OG6HWLK6-Ud_EdkZh.js} +1 -1
  37. package/dist/public/assets/{erDiagram-TEJ5UH35-B4DG_5N3.js → erDiagram-TEJ5UH35-B-vZXvBd.js} +1 -1
  38. package/dist/public/assets/{flowDiagram-I6XJVG4X-Dc1g_Yg4.js → flowDiagram-I6XJVG4X-rVn14Wbt.js} +1 -1
  39. package/dist/public/assets/index-BTKdu_X_.js +478 -0
  40. package/dist/public/assets/index-DwcUOyrO.css +1 -0
  41. package/dist/public/assets/{infoDiagram-5YYISTIA-DrrCrVps.js → infoDiagram-5YYISTIA-BbX08lDC.js} +1 -1
  42. package/dist/public/assets/{ishikawaDiagram-YF4QCWOH-1wxA3mcS.js → ishikawaDiagram-YF4QCWOH-CYs43POM.js} +1 -1
  43. package/dist/public/assets/{kanban-definition-UN3LZRKU-DadR2Di7.js → kanban-definition-UN3LZRKU--Cb13wva.js} +1 -1
  44. package/dist/public/assets/{mindmap-definition-RKZ34NQL-D1_gceBb.js → mindmap-definition-RKZ34NQL-CQJGU9F-.js} +1 -1
  45. package/dist/public/assets/{pieDiagram-4H26LBE5-CI2HIITi.js → pieDiagram-4H26LBE5-DMNxEuMG.js} +1 -1
  46. package/dist/public/assets/{requirementDiagram-4Y6WPE33-BG0_sqoy.js → requirementDiagram-4Y6WPE33-DVzHOXTK.js} +1 -1
  47. package/dist/public/assets/{sequenceDiagram-3UESZ5HK-CGQg7J3F.js → sequenceDiagram-3UESZ5HK-CrIiBex5.js} +1 -1
  48. package/dist/public/assets/{stateDiagram-AJRCARHV-CAnvOQIn.js → stateDiagram-AJRCARHV-LVBo72aS.js} +1 -1
  49. package/dist/public/assets/{stateDiagram-v2-BHNVJYJU-C376ULpU.js → stateDiagram-v2-BHNVJYJU-pc1U14yi.js} +1 -1
  50. package/dist/public/assets/{timeline-definition-PNZ67QCA-CgfFNDHN.js → timeline-definition-PNZ67QCA-COcJo8Ga.js} +1 -1
  51. package/dist/public/assets/{vennDiagram-CIIHVFJN-DfrIVn7E.js → vennDiagram-CIIHVFJN-qOZm-QC4.js} +1 -1
  52. package/dist/public/assets/{wardleyDiagram-YWT4CUSO-SQF6BOhQ.js → wardleyDiagram-YWT4CUSO-idQAwlbA.js} +1 -1
  53. package/dist/public/assets/{xychartDiagram-2RQKCTM6-rKsoartu.js → xychartDiagram-2RQKCTM6-Caywd0sW.js} +1 -1
  54. package/dist/public/index.html +2 -2
  55. package/dist/routes/agent-builder.routes.js +47 -0
  56. package/dist/routes/generation.routes.js +8 -19
  57. package/dist/routes/system.routes.js +2 -7
  58. package/dist/runner/agent-runner.js +37 -2
  59. package/dist/sensors/geolocation-sensor.js +2 -2
  60. package/dist/services/agent-registry.js +25 -2
  61. package/dist/services/artifact/artifact-manager.js +23 -5
  62. package/dist/services/google/google-request.js +5 -1
  63. package/dist/services/google/google-request.types.js +11 -1
  64. package/dist/services/places/google/google-address-utils.js +51 -0
  65. package/dist/services/places/google/google-opening-hours-parser.js +105 -0
  66. package/dist/services/places/google/google-place-mapper.js +149 -0
  67. package/dist/services/places/google/google-place-type-mapping.js +70 -0
  68. package/dist/services/places/google/google-places-adapter.js +105 -0
  69. package/dist/services/places/google/google-places-adapter.types.js +94 -0
  70. package/dist/services/places/google/google-places-client.js +141 -0
  71. package/dist/services/places/google/google-request-utils.js +22 -0
  72. package/dist/services/places/google/google-search-area.js +31 -0
  73. package/dist/services/places/google/google-transit-mapping.js +43 -0
  74. package/dist/services/places/places-manager.js +19 -1
  75. package/dist/services/places/places-manager.types.js +27 -0
  76. package/dist/services/runtime/agent-runtime-manager.js +23 -2
  77. package/dist/services/world-builder/extract-marked.js +31 -0
  78. package/dist/services/world-builder/fleet-instruction-composer.js +25 -0
  79. package/dist/services/world-builder/instruction-composer.js +50 -0
  80. package/dist/services/world-builder/world-builder-draft-store.js +28 -0
  81. package/dist/services/world-builder/world-builder-service.js +285 -0
  82. package/dist/services/world-builder/world-builder.constants.js +9 -0
  83. package/dist/utils/id-utils.js +7 -2
  84. package/dist/utils/number-utils.js +5 -0
  85. package/package.json +3 -3
  86. package/dist/public/assets/index-C9uHckFR.css +0 -1
  87. package/dist/public/assets/index-Cq16E29e.js +0 -479
package/README.md CHANGED
@@ -107,6 +107,9 @@ See `.env.example` for the full list, including:
107
107
  - `FEED_TEXT_GENERATION_*` — optional OpenAI-compatible endpoint used by the feed manager to summarize feed items into a consistent length for better agent consumption.
108
108
  - `FEED_MAX_SUMMARIZATION_ITEMS` — cap on items summarized per refresh (default: `50`). Items left unsummarized become retry candidates on the next refresh; when the retry backlog exceeds the cap, retries are skipped so a feed isn't permanently blocked by hundreds or thousands of stuck unsummarized items.
109
109
  - `AUDIO_GENERATION_*` — optional Gemini TTS configuration that powers the play-message button on the agent console. See [Audio generation](#audio-generation) below.
110
+ - `PLACES_DEFAULT_SOURCE` — default provider for the Places tools when a lookup doesn't request one explicitly: `OSM` (default, no key needed) or `GOOGLE`. `GOOGLE` requires `GOOGLE_PLACES_API_KEY`; without it, lookups fall back to OSM. See [Places](#places) below.
111
+ - `GOOGLE_PLACES_API_KEY` — Google API key that registers the Google Places adapter alongside the default OSM source. See [Places](#places) below.
112
+ - `PHOTON_API_URL` / `OVERPASS_INTERPRETER_URL` — override the geocoding / nearby-search endpoints the OSM places source calls (default to the public Photon and Overpass instances).
110
113
  - `GOOGLE_CONNECTOR_CLIENT_ID` / `GOOGLE_CONNECTOR_CLIENT_SECRET` / `CONNECTOR_CALLBACK_URL` — OAuth credentials for the Google connector. Required if you want agents to access Gmail / Calendar / Contacts. See [Connectors](#connectors) below.
111
114
  - `OAUTH_PENDING_STATE_TTL_MS` — how long an unfinished OAuth flow stays valid before being swept (default: `600_000`, i.e. 10 minutes).
112
115
  - `OTEL_*` — optional OpenTelemetry export.
@@ -139,6 +142,73 @@ The `AUDIO_GENERATION_API_KEY` must be a Google API key with access to the
139
142
  You can use the same key as `TEXT_GENERATION_API_KEY` if that is also a
140
143
  Gemini-backed configuration, but the two are read independently.
141
144
 
145
+ ## Places
146
+
147
+ The **Places** MCP server gives agents location tools — `geocode_place`,
148
+ `search_nearby_places`, and `get_place_details`. It is enabled per-agent from
149
+ the **MCP Servers** section of the agent editor.
150
+
151
+ Two providers back these tools:
152
+
153
+ - **OSM** (default) — uses the public OpenStreetMap-based services (Photon for
154
+ geocoding, Overpass for nearby search). No API key required, so the Places
155
+ tools work out of the box.
156
+ - **GOOGLE** — uses the Google Places API (New) and Geocoding API for richer
157
+ results. Opt in by setting `GOOGLE_PLACES_API_KEY`.
158
+
159
+ `PLACES_DEFAULT_SOURCE` selects which provider serves lookups that don't name a
160
+ source explicitly (`OSM` or `GOOGLE`, defaulting to `OSM`). When
161
+ `GOOGLE_PLACES_API_KEY` is set, the Google adapter is registered alongside OSM;
162
+ if `PLACES_DEFAULT_SOURCE=GOOGLE` is set without a key, lookups fall back to OSM.
163
+
164
+ ### Configuration
165
+
166
+ ```bash
167
+ PLACES_DEFAULT_SOURCE=GOOGLE
168
+ GOOGLE_PLACES_API_KEY=<your Google API key>
169
+ ```
170
+
171
+ ### Getting a Google Places API key
172
+
173
+ The key is a plain Google API key (not an OAuth client — unrelated to the
174
+ Google connector setup below).
175
+
176
+ **1. Sign in to Google Cloud Console.**
177
+
178
+ Go to [console.cloud.google.com](https://console.cloud.google.com/) and select
179
+ (or create) a project. Unlike the OAuth connector, the Places and Geocoding
180
+ APIs are **paid** and require a billing account on the project. Google provides
181
+ a recurring monthly free allotment, but you must still enable billing to use
182
+ the key.
183
+
184
+ **2. Enable the required APIs.**
185
+
186
+ Open **APIs & Services → Library** and enable both:
187
+
188
+ - **Places API (New)** — powers `search_nearby_places` and `get_place_details`.
189
+ - **Geocoding API** — powers reverse geocoding for `geocode_place`.
190
+
191
+ Click each result, then click **Enable**.
192
+
193
+ **3. Create the API key.**
194
+
195
+ Open **APIs & Services → Credentials → Create Credentials → API key**. Copy the
196
+ generated key.
197
+
198
+ > [!NOTE]
199
+ > Restrict the key to just the **Places API (New)** and **Geocoding API** under
200
+ > the key's **API restrictions** so a leaked key can't be used against other
201
+ > Google services.
202
+
203
+ **4. Add the key to your `.env` and restart Crow.**
204
+
205
+ ```bash
206
+ GOOGLE_PLACES_API_KEY=<paste the API key>
207
+ PLACES_DEFAULT_SOURCE=GOOGLE
208
+ ```
209
+
210
+ Restart the server so it picks up the new env vars.
211
+
142
212
  ## Connectors
143
213
 
144
214
  Connectors are a framework-level capability - they are not tools agents call
@@ -1,4 +1,6 @@
1
1
  /** Well-known ID for the Crow system agent */
2
2
  export const CROW_SYSTEM_AGENT_ID = "__super_crow__";
3
3
  export const CROW_TASK_DISPATCHER_AGENT_ID = "__crow_task_dp__";
4
+ export const CROW_NARRATIVE_ARCHITECT_AGENT_ID = "__crow_narrative_architect__";
5
+ export const CROW_WORLD_BUILDER_AGENT_ID = "__crow_world_builder__";
4
6
  //# sourceMappingURL=system-agent.js.map
@@ -1,8 +1,8 @@
1
- export { CLAUDE_MODELS, GITHUB_COPILOT_MODELS, CLAUDE_CODE_MODEL_OPTIONS, ModelOptionSchema, REASONING_EFFORT, ReasoningEffortSchema, CLAUDE_DEFAULT_MODEL, COPILOT_DEFAULT_MODEL, AgentIdSchema, AgentConfigSchema, AgentConfigTemplateSchema, CreateAgentInputSchema, UpdateAgentInputSchema, ToolConfigSchema, PermissionModeSchema, SettingSourceSchema, DiscoveredSkillSchema, LoopConfigSchema, ConfiguredFeedSchema, MAX_LOOP_TIMES, PERMISSION_MODE, SETTING_SOURCE, DEFAULT_SETTING_SOURCES, TOOL_MODE, DEFAULT_CLAUDE_CODE_AVAILABLE_TOOLS, DEFAULT_GITHUB_COPILOT_AVAILABLE_TOOLS, DEFAULT_AVAILABLE_TOOLS_BY_TYPE, SUBAGENT_TOOL_NAME, AGENT_TYPE, } from "./schemas/agent.schema.js";
1
+ export { CLAUDE_MODELS, GITHUB_COPILOT_MODELS, CLAUDE_CODE_MODEL_OPTIONS, ModelOptionSchema, REASONING_EFFORT, ReasoningEffortSchema, CLAUDE_DEFAULT_MODEL, COPILOT_DEFAULT_MODEL, AgentIdSchema, AgentConfigSchema, AgentConfigTemplateSchema, CreateAgentInputSchema, UpdateAgentInputSchema, ToolConfigSchema, PermissionModeSchema, SettingSourceSchema, DiscoveredSkillSchema, LoopConfigSchema, ConfiguredFeedSchema, MAX_LOOP_TIMES, PERMISSION_MODE, SETTING_SOURCE, DEFAULT_SETTING_SOURCES, TOOL_MODE, DEFAULT_CLAUDE_CODE_AVAILABLE_TOOLS, DEFAULT_GITHUB_COPILOT_AVAILABLE_TOOLS, DEFAULT_AVAILABLE_TOOLS_BY_TYPE, SUBAGENT_TOOL_NAME, AGENT_TYPE, AgentTypeSchema, DEFAULT_AGENT_TYPE, AGENT_NAME_MAX_LENGTH, } from "./schemas/agent.schema.js";
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, 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";
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, AgentBuilderDraftUpdatedWsMessageSchema, isAgentServerMessage, 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
8
  export { ARTIFACT_TYPE, ARTIFACT_CONTENT_TYPE, ArtifactTypeSchema, ArtifactContentTypeSchema, ArtifactMetadataSchema, ArtifactTagsUpdateSchema, } from "./schemas/artifact.schema.js";
@@ -13,11 +13,13 @@ export { AddFeedInputSchema, DetectFeedsInputSchema, } from "./schemas/feed.sche
13
13
  export { DiscordConfigSchema } from "./schemas/discord-config.schema.js";
14
14
  export { SuperCrowSettingsSchema, UpdateSuperCrowSettingsInputSchema, DashboardSettingsSchema, UpdateDashboardSettingsInputSchema, } from "./schemas/system-settings.schema.js";
15
15
  export { SystemCapabilitiesSchema } from "./schemas/system-capabilities.schema.js";
16
+ export { GENERATION_TYPE, GenerationTypeSchema, GenerateRequestSchema, } from "./schemas/generation.schema.js";
17
+ export { AGENT_BUILDER_LIMITS, AGENT_BUILDER_WORD_BUDGET, AGENT_BUILDER_DRAFT_STATUS, AgentBuilderDraftStatusSchema, AgentBuilderBuiltAgentSchema, AgentBuilderBuildResultSchema, FleetAgentSchema, FleetResponseSchema, AgentBuilderDraftSchema, AgentBuilderDesignRequestSchema, AgentBuilderPatchRequestSchema, FleetNamedRefSchema, FleetAgentViewSchema, AgentBuilderDraftViewSchema, AgentBuilderDraftResponseSchema, AgentBuilderDraftMutationResponseSchema, } from "./schemas/agent-builder.schema.js";
16
18
  export { applyAgentOrder } from "./utils/apply-agent-order.js";
17
19
  export { MODEL_ALIASES, resolveModel } from "./utils/resolve-model.js";
18
20
  export { BASE_CIRCLE_ID, BASE_CIRCLE_NAME } from "./constants/system-circle.js";
19
21
  export { ENTITY_TYPE, RELATIONSHIP_TYPE, AgentCircleSchema, CreateAgentCircleInputSchema, UpdateAgentCircleInputSchema, EntityTypeSchema, RelationshipTypeSchema, RelationshipSchema, CreateRelationshipInputSchema, CircleMemberSchema, } from "./schemas/agent-circle.schema.js";
20
- export { CROW_SYSTEM_AGENT_ID, CROW_TASK_DISPATCHER_AGENT_ID } from "./constants/system-agent.js";
22
+ export { CROW_SYSTEM_AGENT_ID, CROW_TASK_DISPATCHER_AGENT_ID, CROW_NARRATIVE_ARCHITECT_AGENT_ID, CROW_WORLD_BUILDER_AGENT_ID, } from "./constants/system-agent.js";
21
23
  export { MESSAGE_SOURCE_TYPE, MessageSourceSchema, } from "./schemas/message-source.schema.js";
22
24
  export { AGENT_COMMAND, AgentCommandSchema } from "./schemas/agent-command.schema.js";
23
25
  export { GraphNodeSchema, GraphEdgeSchema, GraphDataSchema, } from "./schemas/graph.schema.js";
@@ -0,0 +1,111 @@
1
+ import { z } from "zod";
2
+ import { AGENT_NAME_MAX_LENGTH, AgentTypeSchema } from "./agent.schema.js";
3
+ export const AgentBuilderBuiltAgentSchema = z.object({
4
+ id: z.string(),
5
+ name: z.string(),
6
+ });
7
+ /**
8
+ * Outcome of a best-effort fleet build: agents that were created and agents that failed. A
9
+ * backend-produced response type, not a request contract. On full success the draft goes COMPLETED;
10
+ * on partial failure the failed agents stay so the build can be retried.
11
+ */
12
+ export const AgentBuilderBuildResultSchema = z.object({
13
+ created: z.array(AgentBuilderBuiltAgentSchema),
14
+ failed: z.array(z.object({ name: z.string(), error: z.string() })),
15
+ });
16
+ /**
17
+ * Lifecycle of the single active draft.
18
+ */
19
+ export const AGENT_BUILDER_DRAFT_STATUS = {
20
+ READY: "ready",
21
+ BUILDING: "building",
22
+ COMPLETED: "completed",
23
+ };
24
+ export const AgentBuilderDraftStatusSchema = z.enum([
25
+ AGENT_BUILDER_DRAFT_STATUS.READY,
26
+ AGENT_BUILDER_DRAFT_STATUS.BUILDING,
27
+ AGENT_BUILDER_DRAFT_STATUS.COMPLETED,
28
+ ]);
29
+ /**
30
+ * Word budgets the World Builder is asked to stay within.
31
+ */
32
+ export const AGENT_BUILDER_WORD_BUDGET = {
33
+ DESCRIPTION: 30,
34
+ PERSONA_BRIEF: 50,
35
+ AGENT_MD_BRIEF: 150,
36
+ };
37
+ export const AGENT_BUILDER_LIMITS = {
38
+ NAME: AGENT_NAME_MAX_LENGTH,
39
+ DESCRIPTION: 400,
40
+ PERSONA_BRIEF: 600,
41
+ AGENT_MD_BRIEF: 2000,
42
+ PROJECT_PATH: 1000,
43
+ INPUT: 4000,
44
+ };
45
+ /**
46
+ * A single agent designed by the World Builder.
47
+ */
48
+ export const FleetAgentSchema = z.object({
49
+ name: z.string().min(1).max(AGENT_BUILDER_LIMITS.NAME),
50
+ description: z.string().min(1).max(AGENT_BUILDER_LIMITS.DESCRIPTION),
51
+ personaBrief: z.string().min(1).max(AGENT_BUILDER_LIMITS.PERSONA_BRIEF),
52
+ agentMdBrief: z.string().min(1).max(AGENT_BUILDER_LIMITS.AGENT_MD_BRIEF).optional(),
53
+ mcpServerIds: z.array(z.string().min(1)).optional(),
54
+ circleIds: z.array(z.string().min(1)).optional(),
55
+ });
56
+ /** The World Builder's JSON output */
57
+ export const FleetResponseSchema = z.object({
58
+ agents: z.array(FleetAgentSchema),
59
+ existingAgents: z.array(AgentBuilderBuiltAgentSchema).optional(),
60
+ });
61
+ export const AgentBuilderDraftSchema = z.object({
62
+ projectPath: z.string().min(1).max(AGENT_BUILDER_LIMITS.PROJECT_PATH).optional(),
63
+ agentType: AgentTypeSchema.optional(),
64
+ status: AgentBuilderDraftStatusSchema.default(AGENT_BUILDER_DRAFT_STATUS.READY),
65
+ lastBuildResult: AgentBuilderBuildResultSchema.optional(),
66
+ existingAgents: z.array(AgentBuilderBuiltAgentSchema).optional(),
67
+ builtAgents: z.array(AgentBuilderBuiltAgentSchema).optional(),
68
+ agents: z.array(FleetAgentSchema),
69
+ });
70
+ export const AgentBuilderDesignRequestSchema = z.object({
71
+ input: z.string().min(1).max(AGENT_BUILDER_LIMITS.INPUT),
72
+ });
73
+ export const AgentBuilderPatchRequestSchema = z.object({
74
+ projectPath: z.string().max(AGENT_BUILDER_LIMITS.PROJECT_PATH).optional(),
75
+ agentType: AgentTypeSchema.optional(),
76
+ });
77
+ export const FleetNamedRefSchema = z.object({
78
+ id: z.string(),
79
+ name: z.string(),
80
+ });
81
+ export const FleetAgentViewSchema = z.object({
82
+ name: z.string(),
83
+ description: z.string(),
84
+ personaBrief: z.string(),
85
+ agentMdBrief: z.string().optional(),
86
+ mcpServers: z.array(FleetNamedRefSchema),
87
+ circles: z.array(FleetNamedRefSchema),
88
+ });
89
+ /**
90
+ * The active draft prepared for display: a resolved view of {@link AgentBuilderDraft} whose agents
91
+ * carry friendly names instead of raw ids, plus the lifecycle `status` and the most recent
92
+ * `lastBuildResult`. Backend-produced response type, not a request contract.
93
+ */
94
+ export const AgentBuilderDraftViewSchema = z.object({
95
+ projectPath: z.string().optional(),
96
+ agentType: AgentTypeSchema.optional(),
97
+ status: AgentBuilderDraftStatusSchema,
98
+ lastBuildResult: AgentBuilderBuildResultSchema.optional(),
99
+ existingAgents: z.array(AgentBuilderBuiltAgentSchema).optional(),
100
+ builtAgents: z.array(AgentBuilderBuiltAgentSchema).optional(),
101
+ agents: z.array(FleetAgentViewSchema),
102
+ });
103
+ /** Response from `GET /api/agent-builder/draft` — the active draft, or null when none exists. */
104
+ export const AgentBuilderDraftResponseSchema = z.object({
105
+ draft: AgentBuilderDraftViewSchema.nullable(),
106
+ });
107
+ /** Response from the design and fleet-config endpoints — the updated draft (always present). */
108
+ export const AgentBuilderDraftMutationResponseSchema = z.object({
109
+ draft: AgentBuilderDraftViewSchema,
110
+ });
111
+ //# sourceMappingURL=agent-builder.schema.js.map
@@ -188,12 +188,16 @@ export const AGENT_TYPE = {
188
188
  GITHUB_COPILOT: "GITHUB_COPILOT",
189
189
  };
190
190
  export const AgentTypeSchema = z.enum([AGENT_TYPE.CLAUDE_CODE, AGENT_TYPE.GITHUB_COPILOT]);
191
+ /** Default agent type applied when none is specified. */
192
+ export const DEFAULT_AGENT_TYPE = AGENT_TYPE.CLAUDE_CODE;
191
193
  /** Default builtin tool catalog per provider, used to seed new agents and the editor's tool picker. */
192
194
  export const DEFAULT_AVAILABLE_TOOLS_BY_TYPE = {
193
195
  [AGENT_TYPE.CLAUDE_CODE]: DEFAULT_CLAUDE_CODE_AVAILABLE_TOOLS,
194
196
  [AGENT_TYPE.GITHUB_COPILOT]: DEFAULT_GITHUB_COPILOT_AVAILABLE_TOOLS,
195
197
  };
196
198
  export const AgentIdSchema = z.uuid();
199
+ /** Maximum length of an agent name, enforced on the create/update input path. */
200
+ export const AGENT_NAME_MAX_LENGTH = 50;
197
201
  /** Maximum number of time entries allowed in a loop config */
198
202
  export const MAX_LOOP_TIMES = 6;
199
203
  /** Loop configuration */
@@ -249,7 +253,7 @@ export const AgentVoiceConfigSchema = z.object({
249
253
  */
250
254
  export const AgentConfigSchema = z.object({
251
255
  id: AgentIdSchema,
252
- type: AgentTypeSchema.default(AGENT_TYPE.CLAUDE_CODE),
256
+ type: AgentTypeSchema.default(DEFAULT_AGENT_TYPE),
253
257
  name: z.string().min(1).max(64),
254
258
  description: z.string().optional(),
255
259
  workspace: z.string().min(1).optional(),
@@ -283,8 +287,8 @@ export const AgentConfigSchema = z.object({
283
287
  * Input for creating a new agent - only required fields
284
288
  */
285
289
  export const CreateAgentInputSchema = z.object({
286
- type: AgentTypeSchema.default(AGENT_TYPE.CLAUDE_CODE),
287
- name: z.string().min(1).max(50),
290
+ type: AgentTypeSchema.default(DEFAULT_AGENT_TYPE),
291
+ name: z.string().min(1).max(AGENT_NAME_MAX_LENGTH),
288
292
  description: z.string().optional(),
289
293
  workspace: z.string().min(1).optional(),
290
294
  persona: z.string().optional(),
@@ -308,12 +312,13 @@ export const CreateAgentInputSchema = z.object({
308
312
  * Input for updating an existing agent - all fields optional
309
313
  */
310
314
  export const UpdateAgentInputSchema = z.object({
311
- name: z.string().min(1).max(50).optional(),
315
+ name: z.string().min(1).max(AGENT_NAME_MAX_LENGTH).optional(),
312
316
  description: z.string().optional(),
313
317
  workspace: z.string().optional(),
314
318
  persona: z.string().optional(),
315
319
  model: z.string().optional(),
316
- effort: ReasoningEffortSchema.optional(),
320
+ // null explicitly clears the effort (back to provider default); undefined leaves it unchanged.
321
+ effort: ReasoningEffortSchema.nullish(),
317
322
  permissionMode: PermissionModeSchema.optional(),
318
323
  settingSources: z.array(SettingSourceSchema).optional(),
319
324
  settingSourceConfig: SettingSourceConfigInputSchema.optional(),
@@ -0,0 +1,29 @@
1
+ import { z } from "zod";
2
+ /** Kind of artifact the Narrative Architect produces. Doubles as the requested operation. */
3
+ export const GENERATION_TYPE = {
4
+ PERSONA: "persona",
5
+ AGENT_MD: "agentmd",
6
+ };
7
+ export const GenerationTypeSchema = z.enum([GENERATION_TYPE.PERSONA, GENERATION_TYPE.AGENT_MD]);
8
+ /**
9
+ * Structured generation request. `type` selects persona vs AGENT.md; the optional hints describe the
10
+ * agent being authored. Presence of `currentPersona` / `currentAgentMd` switches the operation from
11
+ * author/generate to refine/reinforce.
12
+ */
13
+ /** Upper bounds keep the always-reachable generation endpoint from driving unbounded token usage. */
14
+ export const GENERATION_LIMITS = {
15
+ PROMPT: 4000,
16
+ NAME: 200,
17
+ DESCRIPTION: 2000,
18
+ PERSONA: 20000,
19
+ AGENT_MD: 50000,
20
+ };
21
+ export const GenerateRequestSchema = z.object({
22
+ type: GenerationTypeSchema,
23
+ prompt: z.string().min(1).max(GENERATION_LIMITS.PROMPT),
24
+ name: z.string().max(GENERATION_LIMITS.NAME).optional(),
25
+ description: z.string().max(GENERATION_LIMITS.DESCRIPTION).optional(),
26
+ currentPersona: z.string().max(GENERATION_LIMITS.PERSONA).optional(),
27
+ currentAgentMd: z.string().max(GENERATION_LIMITS.AGENT_MD).optional(),
28
+ });
29
+ //# sourceMappingURL=generation.schema.js.map
@@ -11,6 +11,7 @@ export const MESSAGE_SOURCE_TYPE = {
11
11
  NOTIFICATION: "NOTIFICATION",
12
12
  DISCORD: "DISCORD",
13
13
  COMMAND: "COMMAND",
14
+ INTERNAL: "INTERNAL",
14
15
  };
15
16
  /** Zod schema for message source — identifies who originated a message */
16
17
  export const MessageSourceSchema = z.discriminatedUnion("sourceType", [
@@ -29,5 +30,6 @@ export const MessageSourceSchema = z.discriminatedUnion("sourceType", [
29
30
  isDm: z.boolean(),
30
31
  }),
31
32
  z.object({ sourceType: z.literal(MESSAGE_SOURCE_TYPE.COMMAND), command: AgentCommandSchema }),
33
+ z.object({ sourceType: z.literal(MESSAGE_SOURCE_TYPE.INTERNAL) }),
32
34
  ]);
33
35
  //# sourceMappingURL=message-source.schema.js.map
@@ -7,7 +7,8 @@ import { ModelOptionSchema } from "./agent.schema.js";
7
7
  export const SystemCapabilitiesSchema = z.object({
8
8
  /** True when the audio generation provider, API key, and model are all configured. */
9
9
  audioGeneration: z.boolean(),
10
- /** True when the chat-completion text generation provider is configured (powers persona / AGENT.md generation). */
10
+ // True when persona / AGENT.md generation is available. Backed by the internal Narrative Architect
11
+ // (Claude Code runtime), so effectively always available.
11
12
  textGeneration: z.boolean(),
12
13
  /** True when the shared Copilot SDK client started successfully (Copilot agents can run). */
13
14
  copilotAvailable: z.boolean(),
@@ -7,6 +7,7 @@ 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
9
  import { AgentCommandSchema } from "./agent-command.schema.js";
10
+ import { AgentBuilderDraftViewSchema } from "./agent-builder.schema.js";
10
11
  /**
11
12
  * WebSocket message types - Client -> Server
12
13
  */
@@ -43,6 +44,7 @@ export const SERVER_MESSAGE_TYPE = {
43
44
  CIRCLE_DELETED: "circle_deleted",
44
45
  RELATIONSHIP_CREATED: "relationship_created",
45
46
  RELATIONSHIP_DELETED: "relationship_deleted",
47
+ AGENT_BUILDER_DRAFT_UPDATED: "agent_builder_draft_updated",
46
48
  };
47
49
  export const SendMessageSchema = z.object({
48
50
  type: z.literal("send_message"),
@@ -190,6 +192,11 @@ export const RelationshipDeletedWsMessageSchema = z.object({
190
192
  type: z.literal(SERVER_MESSAGE_TYPE.RELATIONSHIP_DELETED),
191
193
  relationshipId: z.string(),
192
194
  });
195
+ /** The single agent-builder draft changed; carries the resolved view, or null when it was cleared. */
196
+ export const AgentBuilderDraftUpdatedWsMessageSchema = z.object({
197
+ type: z.literal(SERVER_MESSAGE_TYPE.AGENT_BUILDER_DRAFT_UPDATED),
198
+ draft: AgentBuilderDraftViewSchema.nullable(),
199
+ });
193
200
  /** Server -> Client discriminated union for runtime parsing */
194
201
  export const ServerMessageSchema = z.discriminatedUnion("type", [
195
202
  AgentTextWsMessageSchema,
@@ -215,5 +222,9 @@ export const ServerMessageSchema = z.discriminatedUnion("type", [
215
222
  CircleDeletedWsMessageSchema,
216
223
  RelationshipCreatedWsMessageSchema,
217
224
  RelationshipDeletedWsMessageSchema,
225
+ AgentBuilderDraftUpdatedWsMessageSchema,
218
226
  ]);
227
+ export function isAgentServerMessage(message) {
228
+ return "agentId" in message && typeof message.agentId === "string";
229
+ }
219
230
  //# sourceMappingURL=websocket.schema.js.map
@@ -0,0 +1,93 @@
1
+ import { PERMISSION_MODE, TOOL_MODE, CLAUDE_MODELS, CROW_NARRATIVE_ARCHITECT_AGENT_ID, AGENT_TYPE, } from "../_shared/index.js";
2
+ import path from "node:path";
3
+ import { env } from "../config/env.js";
4
+ import { createMessageContentFromTemplate, getDefaultPromptContext } from "../utils/message-template.js";
5
+ import { SYSTEM_AGENTS_PROJECT_DIR_NAME } from "../config/constants.js";
6
+ import { WORLD_BUILDER_BEGIN, WORLD_BUILDER_END } from "../services/world-builder/world-builder.constants.js";
7
+ const CROW_NARRATIVE_ARCHITECT_AGENT_NAME = "Crow Narrative Architect";
8
+ const CROW_NARRATIVE_ARCHITECT_AGENT_PERSONA = {
9
+ role: "system",
10
+ content: [
11
+ {
12
+ content: [
13
+ "You are the Narrative Architect for Crow Central Agency: the internal specialist who authors the",
14
+ "identity and operating doctrine of other agents. Each request asks for exactly one artifact, of",
15
+ "one of two kinds, and you return that artifact finished and ready to use — you are an authoring",
16
+ "engine, not a conversational assistant, and you never negotiate, ask follow-up questions, or hedge.",
17
+ "",
18
+ "The two artifacts you produce:",
19
+ "- A PERSONA: the second-person character brief that defines who an agent is, not how it operates.",
20
+ ' Written as direct address ("You are...") in present tense, it establishes the agent\'s role and',
21
+ " character, its inner voice and temperament, and the register and manner in which it speaks. It is",
22
+ " identity, not procedure: keep workflows, tool usage, step-by-step decision rules, and operating",
23
+ " conventions out, as those belong in the AGENT.md. A strong persona reads as one coherent character",
24
+ " in one or two short paragraphs of cohesive prose (roughly 100 words or fewer) — no labeled",
25
+ " sections, no bold headers, and no checklist of dimensions or list of adjectives.",
26
+ "- An AGENT.md: the durable operating manual loaded into every one of that agent's sessions. Written",
27
+ " in clear Markdown with focused headings and tight bullet points, it captures purpose,",
28
+ " responsibilities, conventions, and concrete do/don't rules the agent must follow.",
29
+ "",
30
+ "Craft principles:",
31
+ "- Write with directorial intent. Every line earns its place; favor precision and concrete guidance",
32
+ " over length, filler, or generic boilerplate that could describe any agent.",
33
+ "- Persona and AGENT.md are complementary, never overlapping: identity lives in the persona, operating",
34
+ " doctrine in the AGENT.md. Never let a persona drift into procedure. Length is a cost — prefer the",
35
+ " shortest version that fully captures the artifact.",
36
+ "- Ground the artifact in the request: take cues from the agent's name, description, and the user's",
37
+ " prompt, and match the domain, register, and seniority they imply.",
38
+ "- When the request includes a current persona or AGENT.md to refine, treat it as authoritative",
39
+ " source material: preserve what works and its established voice, apply the requested change, sharpen",
40
+ " weak passages, and return a coherent whole — never discard good material or restart from scratch.",
41
+ "- Author in the artifact's own voice only. Do not address the requester or describe what you did.",
42
+ "",
43
+ "Output contract (strict, non-negotiable):",
44
+ `- Emit ONLY the finished artifact, wrapped exactly between a line containing ${WORLD_BUILDER_BEGIN}`,
45
+ ` before it and a line containing ${WORLD_BUILDER_END} after it.`,
46
+ "- Between those markers is the artifact verbatim — the exact text to be saved, with no enclosing",
47
+ " code fences.",
48
+ "- Output nothing outside the markers: no preamble, no greeting, no commentary, no explanation, and",
49
+ " no restatement of the request. The very first characters you emit are the begin marker.",
50
+ "",
51
+ "Shape of every response:",
52
+ WORLD_BUILDER_BEGIN,
53
+ "<the persona or AGENT.md, exactly as it should be stored>",
54
+ WORLD_BUILDER_END,
55
+ ],
56
+ },
57
+ ],
58
+ };
59
+ const CROW_NARRATIVE_ARCHITECT_BIRTHDAY = "1970-01-01T00:00:00Z";
60
+ const CROW_NARRATIVE_ARCHITECT_TOOLS = [];
61
+ /**
62
+ * Build the Narrative Architect agent config - an internal, non-visible system agent that authors
63
+ * personas and generates/reinforces AGENT.md on the Claude Code runtime. Background only; never
64
+ * persists a session and carries no tools.
65
+ */
66
+ export function getNarrativeArchitectAgent() {
67
+ const persona = createMessageContentFromTemplate(CROW_NARRATIVE_ARCHITECT_AGENT_PERSONA, getDefaultPromptContext());
68
+ return {
69
+ id: CROW_NARRATIVE_ARCHITECT_AGENT_ID,
70
+ type: AGENT_TYPE.CLAUDE_CODE,
71
+ name: CROW_NARRATIVE_ARCHITECT_AGENT_NAME,
72
+ description: "Internal generation specialist. Authors agent personas and generates/reinforces AGENT.md.",
73
+ workspace: path.join(env.CROW_SYSTEM_PATH, SYSTEM_AGENTS_PROJECT_DIR_NAME),
74
+ persona,
75
+ model: CLAUDE_MODELS.SONNET,
76
+ permissionMode: PERMISSION_MODE.DEFAULT,
77
+ settingSources: [],
78
+ availableTools: [],
79
+ toolConfig: {
80
+ mode: TOOL_MODE.RESTRICTED,
81
+ tools: CROW_NARRATIVE_ARCHITECT_TOOLS,
82
+ autoApprovedTools: CROW_NARRATIVE_ARCHITECT_TOOLS,
83
+ },
84
+ mcpServerIds: [],
85
+ persistSession: false,
86
+ excludeClaudeCodeSystemPrompt: true,
87
+ isSystemAgent: true,
88
+ isBackgroundAgent: true,
89
+ createdAt: CROW_NARRATIVE_ARCHITECT_BIRTHDAY,
90
+ updatedAt: CROW_NARRATIVE_ARCHITECT_BIRTHDAY,
91
+ };
92
+ }
93
+ //# sourceMappingURL=crow-narrative-architect-agent.js.map
@@ -0,0 +1,98 @@
1
+ import { PERMISSION_MODE, TOOL_MODE, CLAUDE_MODELS, CROW_WORLD_BUILDER_AGENT_ID, AGENT_TYPE, AGENT_NAME_MAX_LENGTH, } from "../_shared/index.js";
2
+ import path from "node:path";
3
+ import { env } from "../config/env.js";
4
+ import { createMessageContentFromTemplate, getDefaultPromptContext } from "../utils/message-template.js";
5
+ import { SYSTEM_AGENTS_PROJECT_DIR_NAME } from "../config/constants.js";
6
+ import { WORLD_BUILDER_BEGIN, WORLD_BUILDER_END } from "../services/world-builder/world-builder.constants.js";
7
+ import { LIST_AGENTS_TOOL_NAME } from "../mcp/agents/list-agents.js";
8
+ import { GET_AGENT_DETAILS_TOOL_NAME } from "../mcp/agents/get-agent-details.js";
9
+ import { LIST_MCP_SERVERS_TOOL_NAME } from "../mcp/agents/list-mcp-servers.js";
10
+ const CROW_WORLD_BUILDER_AGENT_NAME = "Crow World Builder";
11
+ const CROW_WORLD_BUILDER_AGENT_PERSONA = {
12
+ role: "system",
13
+ content: [
14
+ {
15
+ content: [
16
+ "You are the World Builder for Crow Central Agency: the internal architect who designs a fleet of",
17
+ "agents from a single requirement. Given what the user wants to accomplish, you decide which agents",
18
+ "should exist, what each one is for, and how they fit together as a team. You are a designer of",
19
+ "teams, not a conversational assistant — you do not negotiate, ask follow-up questions, or hedge.",
20
+ "",
21
+ "Director, not author:",
22
+ "- You do NOT write finished personas or AGENT.md text. For each agent you emit directional BRIEFS",
23
+ " that instruct a separate authoring specialist who renders the finished artifacts from them.",
24
+ "- A `personaBrief` is a directive describing the identity and character the agent should have — who",
25
+ " it is, its temperament, the register in which it speaks. Write it as an instruction TO the author,",
26
+ " not as the persona itself.",
27
+ "- An `agentMdBrief` is a directive describing the operating manual the agent needs — the doctrine,",
28
+ " conventions, and concrete do/don't rules it should cover. Include it only when an agent needs an",
29
+ " operating manual; omit it for a persona-only agent that has character but no procedure to follow.",
30
+ "- Never write the briefs as the artifacts themselves, and never address the end agent in them.",
31
+ "",
32
+ "Ground every design in the existing ecosystem:",
33
+ `- Survey what already exists before you design: call \`${LIST_AGENTS_TOOL_NAME}\` (and`,
34
+ ` \`${GET_AGENT_DETAILS_TOOL_NAME}\` to inspect any whose role overlaps) so you complement the fleet`,
35
+ " rather than duplicate roles already covered.",
36
+ "- Report in `existingAgents` (by real id and name) any existing agent that belongs to this fleet — one",
37
+ " that already covers a needed role, or that your designed agents should collaborate with — instead of",
38
+ " redesigning it; if existing agents already cover the whole requirement, design no new agents at all.",
39
+ `- The MCP servers are NOT attached to you. Call \`${LIST_MCP_SERVERS_TOOL_NAME}\` to discover the`,
40
+ " configurable servers assignable to the agents you design, and set `mcpServerIds` only from the ids",
41
+ " it returns — never invent one.",
42
+ "- Assign `circleIds` only from the circles present in your context; omit `circleIds` to leave an",
43
+ " agent in the base circle.",
44
+ "- Design the smallest fleet that fully covers the requirement. Every agent has a distinct,",
45
+ " non-overlapping role, and its `name` and `description` are user-facing — make them concrete and",
46
+ ` specific, never generic. Each \`name\` must be ${AGENT_NAME_MAX_LENGTH} characters or fewer.`,
47
+ "",
48
+ "Output contract (strict, non-negotiable):",
49
+ "- Each request specifies the exact JSON object shape, its fields, and their length limits. Honor that",
50
+ " contract precisely and keep every field within its stated limit.",
51
+ `- Emit ONLY that single JSON object, wrapped exactly between a line containing ${WORLD_BUILDER_BEGIN}`,
52
+ ` before it and a line containing ${WORLD_BUILDER_END} after it.`,
53
+ "- No code fences, and nothing outside the markers: no preamble, no commentary, no explanation, and",
54
+ " no restatement of the request. The very first characters you emit are the begin marker.",
55
+ "",
56
+ "Shape of every response:",
57
+ WORLD_BUILDER_BEGIN,
58
+ "<the fleet JSON object, exactly as specified>",
59
+ WORLD_BUILDER_END,
60
+ ],
61
+ },
62
+ ],
63
+ };
64
+ const CROW_WORLD_BUILDER_BIRTHDAY = "1970-01-01T00:00:00Z";
65
+ const CROW_WORLD_BUILDER_TOOLS = [];
66
+ /**
67
+ * Build the World Builder agent config - an internal, non-visible system agent that designs a fleet of
68
+ * agents from a requirement as directional briefs. Background only; never persists a session. MCP read
69
+ * tools attach via the server allowlist in a later phase.
70
+ */
71
+ export function getWorldBuilderAgent() {
72
+ const persona = createMessageContentFromTemplate(CROW_WORLD_BUILDER_AGENT_PERSONA, getDefaultPromptContext());
73
+ return {
74
+ id: CROW_WORLD_BUILDER_AGENT_ID,
75
+ type: AGENT_TYPE.CLAUDE_CODE,
76
+ name: CROW_WORLD_BUILDER_AGENT_NAME,
77
+ description: "Internal fleet architect. Designs a set of agents from a requirement as directional briefs.",
78
+ workspace: path.join(env.CROW_SYSTEM_PATH, SYSTEM_AGENTS_PROJECT_DIR_NAME),
79
+ persona,
80
+ model: CLAUDE_MODELS.SONNET,
81
+ permissionMode: PERMISSION_MODE.DEFAULT,
82
+ settingSources: [],
83
+ availableTools: [],
84
+ toolConfig: {
85
+ mode: TOOL_MODE.RESTRICTED,
86
+ tools: CROW_WORLD_BUILDER_TOOLS,
87
+ autoApprovedTools: CROW_WORLD_BUILDER_TOOLS,
88
+ },
89
+ mcpServerIds: [],
90
+ persistSession: false,
91
+ excludeClaudeCodeSystemPrompt: true,
92
+ isSystemAgent: true,
93
+ isBackgroundAgent: true,
94
+ createdAt: CROW_WORLD_BUILDER_BIRTHDAY,
95
+ updatedAt: CROW_WORLD_BUILDER_BIRTHDAY,
96
+ };
97
+ }
98
+ //# sourceMappingURL=crow-world-builder-agent.js.map
package/dist/bootstrap.js CHANGED
@@ -18,6 +18,7 @@ import { registerArtifactRoutes } from "./routes/artifact.routes.js";
18
18
  import { getArtifactsMcpServerDefinition } from "./mcp/artifacts/artifacts-mcp-server.js";
19
19
  import { getAgentsMcpServerDefinition } from "./mcp/agents/agents-mcp-server.js";
20
20
  import { getSuperAgentMcpServerDefinition } from "./mcp/agents/super-agent-mcp-server.js";
21
+ import { getBuilderAgentMcpServerDefinition } from "./mcp/agents/builder-agent-mcp-server.js";
21
22
  import { getTasksMcpServerDefinition } from "./mcp/tasks/tasks-mcp-server.js";
22
23
  import { getSuperTasksMcpServerDefinition } from "./mcp/tasks/super-tasks-mcp-server.js";
23
24
  import { getRemindersMcpServerDefinition } from "./mcp/reminders/reminders-mcp-server.js";
@@ -27,6 +28,9 @@ import { SystemSettingsManager } from "./services/system-settings-manager.js";
27
28
  import { MessageQueueManager } from "./services/message-queue-manager.js";
28
29
  import { AgentTaskManager } from "./services/agent-task-manager.js";
29
30
  import { registerGenerationRoutes } from "./routes/generation.routes.js";
31
+ import { registerAgentBuilderRoutes } from "./routes/agent-builder.routes.js";
32
+ import { WorldBuilderService } from "./services/world-builder/world-builder-service.js";
33
+ import { WorldBuilderDraftStore } from "./services/world-builder/world-builder-draft-store.js";
30
34
  import { registerTaskRoutes } from "./routes/task.routes.js";
31
35
  import { CrowMcpManager } from "./mcp/crow-mcp-manager.js";
32
36
  import { registerMcpRoutes } from "./routes/mcp.routes.js";
@@ -105,6 +109,8 @@ export async function bootstrap(options) {
105
109
  sensorManager.registerSensor(new WeatherSensor());
106
110
  const runtimeManager = new AgentRuntimeManager(storeProvider, broadcaster, registry, mcpManager, sessionManager, messageQueue, taskManager, sensorManager, circleManager);
107
111
  await runtimeManager.initialize();
112
+ const worldBuilderDraftStore = new WorldBuilderDraftStore(storeProvider);
113
+ const worldBuilderService = new WorldBuilderService(runtimeManager, worldBuilderDraftStore, registry, circleManager, mcpManager, broadcaster);
108
114
  const routineManager = new RoutineManager(registry, runtimeManager, taskManager, crowScheduler, feedManager);
109
115
  const interAgentRoutine = createInterAgentTaskRoutine(registry, runtimeManager, taskManager);
110
116
  routineManager.addRoutine(interAgentRoutine);
@@ -133,6 +139,7 @@ export async function bootstrap(options) {
133
139
  mcpManager.registerMcpServer(getAudioMcpServerDefinition(registry, artifactManager));
134
140
  mcpManager.registerMcpServer(getSuperTasksMcpServerDefinition(taskManager, registry, circleManager, sensorManager));
135
141
  mcpManager.registerMcpServer(getSuperAgentMcpServerDefinition(registry, runtimeManager, sessionManager));
142
+ mcpManager.registerMcpServer(getBuilderAgentMcpServerDefinition(registry, mcpManager));
136
143
  mcpManager.registerMcpServer(getRemindersMcpServerDefinition(crowScheduler, sensorManager));
137
144
  mcpManager.registerMcpServer(getGmailMcpServerDefinition(connectorManager, sensorManager));
138
145
  mcpManager.registerMcpServer(getGoogleCalendarMcpServerDefinition(connectorManager, sensorManager));
@@ -151,7 +158,8 @@ export async function bootstrap(options) {
151
158
  await registerAgentRoutes(server, registry, runtimeManager, sessionManager, storeProvider, connectorManager, mcpManager);
152
159
  await registerArtifactRoutes(server, artifactManager);
153
160
  await registerTaskRoutes(server, taskManager, registry);
154
- await registerGenerationRoutes(server);
161
+ await registerGenerationRoutes(server, worldBuilderService);
162
+ await registerAgentBuilderRoutes(server, worldBuilderService);
155
163
  await registerMcpRoutes(server, mcpManager);
156
164
  await registerSensorRoutes(server, sensorManager);
157
165
  await registerCircleRoutes(server, circleManager, registry);
@@ -162,6 +170,7 @@ export async function bootstrap(options) {
162
170
  // Start listening
163
171
  await server.listen({ host: env.HOST, port: env.PORT });
164
172
  logger.info({ host: env.HOST, port: env.PORT, static: options.serveStatic }, "Server started");
173
+ await worldBuilderService.recoverInterruptedBuild();
165
174
  // Graceful shutdown
166
175
  const shutdown = async () => {
167
176
  logger.info("Shutting down...");