@dxos/assistant-toolkit 0.16.0 → 0.17.0

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 (215) hide show
  1. package/dist/lib/chunk-AgentOperation.mjs +5 -1
  2. package/dist/lib/chunk-AgentOperation.mjs.map +1 -1
  3. package/dist/lib/chunk-AgentOperationHandlerSet.mjs +1 -1
  4. package/dist/lib/chunk-AgentSkill.mjs +1 -1
  5. package/dist/lib/chunk-AlarmSkill.mjs +1 -1
  6. package/dist/lib/chunk-BrowserSkill.mjs +4 -6
  7. package/dist/lib/chunk-BrowserSkill.mjs.map +1 -1
  8. package/dist/lib/chunk-ChatContextSkill.mjs +1 -1
  9. package/dist/lib/chunk-DelegationSkill.mjs +2 -2
  10. package/dist/lib/chunk-DelegationSkill.mjs.map +1 -1
  11. package/dist/lib/chunk-DelegationStrategy.mjs +16 -30
  12. package/dist/lib/chunk-DelegationStrategy.mjs.map +1 -1
  13. package/dist/lib/chunk-PlanningSkill.mjs +12 -10
  14. package/dist/lib/chunk-PlanningSkill.mjs.map +1 -1
  15. package/dist/lib/chunk-SkillManagerSkill.mjs +62 -7
  16. package/dist/lib/chunk-SkillManagerSkill.mjs.map +1 -1
  17. package/dist/lib/chunk-SlashCommand.mjs +2 -2
  18. package/dist/lib/chunk-SlashCommand.mjs.map +1 -1
  19. package/dist/lib/chunk-add-mcp-connection.mjs +58 -0
  20. package/dist/lib/chunk-add-mcp-connection.mjs.map +1 -0
  21. package/dist/lib/chunk-ask-question.mjs.map +1 -1
  22. package/dist/lib/chunk-catalog.mjs +86 -0
  23. package/dist/lib/chunk-catalog.mjs.map +1 -0
  24. package/dist/lib/chunk-context-add.mjs +1 -1
  25. package/dist/lib/chunk-context-remove.mjs +1 -1
  26. package/dist/lib/chunk-delegate-task.mjs +2 -2
  27. package/dist/lib/chunk-delegate-task.mjs.map +1 -1
  28. package/dist/lib/chunk-delegate-tasks.mjs +2 -8
  29. package/dist/lib/chunk-delegate-tasks.mjs.map +1 -1
  30. package/dist/lib/chunk-enable-skills.mjs +1 -1
  31. package/dist/lib/chunk-get-context.mjs +1 -1
  32. package/dist/lib/chunk-get-current-date.mjs +1 -1
  33. package/dist/lib/chunk-mcp-connections.mjs +26 -0
  34. package/dist/lib/chunk-mcp-connections.mjs.map +1 -0
  35. package/dist/lib/chunk-operations.mjs +2 -2
  36. package/dist/lib/chunk-operations.mjs.map +1 -1
  37. package/dist/lib/chunk-operations2.mjs +144 -9
  38. package/dist/lib/chunk-operations2.mjs.map +1 -1
  39. package/dist/lib/chunk-operations3.mjs +6 -5
  40. package/dist/lib/chunk-operations3.mjs.map +1 -1
  41. package/dist/lib/chunk-operations4.mjs +30 -55
  42. package/dist/lib/chunk-operations4.mjs.map +1 -1
  43. package/dist/lib/chunk-operations5.mjs +28 -27
  44. package/dist/lib/chunk-operations5.mjs.map +1 -1
  45. package/dist/lib/chunk-operations6.mjs +64 -29
  46. package/dist/lib/chunk-operations6.mjs.map +1 -1
  47. package/dist/lib/chunk-operations7.mjs +4 -79
  48. package/dist/lib/chunk-operations7.mjs.map +1 -1
  49. package/dist/lib/chunk-plan-reminder.mjs +7 -12
  50. package/dist/lib/chunk-plan-reminder.mjs.map +1 -1
  51. package/dist/lib/chunk-query-mcp-connections.mjs +16 -0
  52. package/dist/lib/chunk-query-mcp-connections.mjs.map +1 -0
  53. package/dist/lib/chunk-query-operations.mjs +23 -0
  54. package/dist/lib/chunk-query-operations.mjs.map +1 -0
  55. package/dist/lib/chunk-query-skills.mjs +23 -3
  56. package/dist/lib/chunk-query-skills.mjs.map +1 -1
  57. package/dist/lib/chunk-query-types.mjs +24 -0
  58. package/dist/lib/chunk-query-types.mjs.map +1 -0
  59. package/dist/lib/chunk-relay.mjs +1 -1
  60. package/dist/lib/chunk-run-instructions.mjs +14 -10
  61. package/dist/lib/chunk-run-instructions.mjs.map +1 -1
  62. package/dist/lib/chunk-set-alarm.mjs +1 -1
  63. package/dist/lib/chunk-set-mcp-connection.mjs +18 -0
  64. package/dist/lib/chunk-set-mcp-connection.mjs.map +1 -0
  65. package/dist/lib/chunk-sync-automation.mjs +1 -1
  66. package/dist/lib/chunk-update-tasks.mjs +20 -3
  67. package/dist/lib/chunk-update-tasks.mjs.map +1 -1
  68. package/dist/lib/index.mjs +1 -3
  69. package/dist/lib/ns/AgentOperationHandlerSet.mjs +1 -1
  70. package/dist/lib/ns/AgentSkill.mjs +1 -1
  71. package/dist/lib/ns/AlarmSkill.mjs +1 -1
  72. package/dist/lib/ns/ChatContextSkill.mjs +1 -1
  73. package/dist/lib/ns/PlanningSkill.mjs +2 -2
  74. package/dist/lib/ns/SkillManagerSkill.mjs +3 -3
  75. package/dist/lib/testing.mjs +7 -10
  76. package/dist/lib/testing.mjs.map +1 -1
  77. package/dist/types/src/commands.d.ts +10 -0
  78. package/dist/types/src/commands.d.ts.map +1 -1
  79. package/dist/types/src/operations/run-instructions.d.ts.map +1 -1
  80. package/dist/types/src/skills/browser/BrowserSkill.d.ts.map +1 -1
  81. package/dist/types/src/skills/delegation/operations/delegate-task.d.ts +1 -1
  82. package/dist/types/src/skills/delegation/operations/delegate-tasks.d.ts +0 -6
  83. package/dist/types/src/skills/delegation/operations/delegate-tasks.d.ts.map +1 -1
  84. package/dist/types/src/skills/index.d.ts +0 -1
  85. package/dist/types/src/skills/index.d.ts.map +1 -1
  86. package/dist/types/src/skills/planning/PlanningSkill.d.ts +3 -0
  87. package/dist/types/src/skills/planning/PlanningSkill.d.ts.map +1 -1
  88. package/dist/types/src/skills/planning/operations/definitions.d.ts +3 -1
  89. package/dist/types/src/skills/planning/operations/definitions.d.ts.map +1 -1
  90. package/dist/types/src/skills/planning/operations/plan-reminder.d.ts +6 -5
  91. package/dist/types/src/skills/planning/operations/plan-reminder.d.ts.map +1 -1
  92. package/dist/types/src/skills/planning/operations/update-tasks.d.ts +1 -1
  93. package/dist/types/src/skills/planning/operations/update-tasks.d.ts.map +1 -1
  94. package/dist/types/src/skills/skill-manager/SkillManagerSkill.d.ts +7 -0
  95. package/dist/types/src/skills/skill-manager/SkillManagerSkill.d.ts.map +1 -1
  96. package/dist/types/src/skills/skill-manager/lookup.test.d.ts +2 -0
  97. package/dist/types/src/skills/skill-manager/lookup.test.d.ts.map +1 -0
  98. package/dist/types/src/skills/skill-manager/operations/add-mcp-connection.d.ts +19 -0
  99. package/dist/types/src/skills/skill-manager/operations/add-mcp-connection.d.ts.map +1 -0
  100. package/dist/types/src/skills/skill-manager/operations/catalog.d.ts +36 -0
  101. package/dist/types/src/skills/skill-manager/operations/catalog.d.ts.map +1 -0
  102. package/dist/types/src/skills/skill-manager/operations/definitions.d.ts +116 -1
  103. package/dist/types/src/skills/skill-manager/operations/definitions.d.ts.map +1 -1
  104. package/dist/types/src/skills/skill-manager/operations/index.d.ts.map +1 -1
  105. package/dist/types/src/skills/skill-manager/operations/mcp-connections.d.ts +15 -0
  106. package/dist/types/src/skills/skill-manager/operations/mcp-connections.d.ts.map +1 -0
  107. package/dist/types/src/skills/skill-manager/operations/query-mcp-connections.d.ts +11 -0
  108. package/dist/types/src/skills/skill-manager/operations/query-mcp-connections.d.ts.map +1 -0
  109. package/dist/types/src/skills/skill-manager/operations/query-operations.d.ts +17 -0
  110. package/dist/types/src/skills/skill-manager/operations/query-operations.d.ts.map +1 -0
  111. package/dist/types/src/skills/skill-manager/operations/query-skills.d.ts +20 -2
  112. package/dist/types/src/skills/skill-manager/operations/query-skills.d.ts.map +1 -1
  113. package/dist/types/src/skills/skill-manager/operations/query-types.d.ts +13 -0
  114. package/dist/types/src/skills/skill-manager/operations/query-types.d.ts.map +1 -0
  115. package/dist/types/src/skills/skill-manager/operations/set-mcp-connection.d.ts +14 -0
  116. package/dist/types/src/skills/skill-manager/operations/set-mcp-connection.d.ts.map +1 -0
  117. package/dist/types/src/supervisor/delegation-strategy.d.ts +2 -7
  118. package/dist/types/src/supervisor/delegation-strategy.d.ts.map +1 -1
  119. package/dist/types/src/testing/operations.d.ts.map +1 -1
  120. package/dist/types/src/types/AgentOperation.d.ts +2 -1
  121. package/dist/types/src/types/AgentOperation.d.ts.map +1 -1
  122. package/dist/types/src/types/index.d.ts +0 -1
  123. package/dist/types/src/types/index.d.ts.map +1 -1
  124. package/dist/types/tsconfig.tsbuildinfo +1 -1
  125. package/package.json +32 -40
  126. package/src/commands.test.ts +4 -0
  127. package/src/commands.ts +12 -2
  128. package/src/operations/run-instructions.test.ts +12 -6
  129. package/src/operations/run-instructions.ts +12 -2
  130. package/src/skills/browser/BrowserSkill.ts +3 -8
  131. package/src/skills/chat-context/operations/context-add.test.ts +6 -4
  132. package/src/skills/chat-context/operations/context-remove.test.ts +6 -4
  133. package/src/skills/delegation/DelegationSkill.ts +2 -2
  134. package/src/skills/delegation/operations/definitions.ts +2 -2
  135. package/src/skills/delegation/operations/delegate-task.test.ts +1 -2
  136. package/src/skills/delegation/operations/delegate-task.ts +2 -2
  137. package/src/skills/delegation/operations/delegate-tasks.ts +2 -8
  138. package/src/skills/index.ts +0 -1
  139. package/src/skills/planning/PlanningSkill.ts +8 -12
  140. package/src/skills/planning/operations/definitions.ts +5 -4
  141. package/src/skills/planning/operations/plan-reminder.test.ts +9 -15
  142. package/src/skills/planning/operations/plan-reminder.ts +7 -13
  143. package/src/skills/planning/operations/update-tasks.md +7 -5
  144. package/src/skills/planning/operations/update-tasks.model.test.ts +2 -2
  145. package/src/skills/planning/operations/update-tasks.test.ts +110 -10
  146. package/src/skills/planning/operations/update-tasks.ts +22 -10
  147. package/src/skills/planning/skill.test.ts +9 -7
  148. package/src/skills/skill-manager/SkillManagerSkill.ts +71 -5
  149. package/src/skills/skill-manager/lookup.test.ts +308 -0
  150. package/src/skills/skill-manager/operations/add-mcp-connection.ts +83 -0
  151. package/src/skills/skill-manager/operations/catalog.ts +140 -0
  152. package/src/skills/skill-manager/operations/definitions.ts +168 -6
  153. package/src/skills/skill-manager/operations/index.ts +14 -1
  154. package/src/skills/skill-manager/operations/mcp-connections.ts +29 -0
  155. package/src/skills/skill-manager/operations/query-mcp-connections.ts +22 -0
  156. package/src/skills/skill-manager/operations/query-operations.ts +50 -0
  157. package/src/skills/skill-manager/operations/query-skills.ts +43 -3
  158. package/src/skills/skill-manager/operations/query-types.ts +32 -0
  159. package/src/skills/skill-manager/operations/set-mcp-connection.ts +28 -0
  160. package/src/skills/skill-manager/skill.test.ts +172 -9
  161. package/src/supervisor/delegation-strategy.test.ts +55 -4
  162. package/src/supervisor/delegation-strategy.ts +13 -28
  163. package/src/testing/operations.ts +2 -6
  164. package/src/types/AgentOperation.ts +6 -1
  165. package/src/types/index.ts +0 -1
  166. package/dist/lib/Memory.mjs +0 -1
  167. package/dist/lib/chunk-Memory.mjs +0 -19
  168. package/dist/lib/chunk-Memory.mjs.map +0 -1
  169. package/dist/lib/chunk-MemorySkill.mjs +0 -39
  170. package/dist/lib/chunk-MemorySkill.mjs.map +0 -1
  171. package/dist/lib/chunk-delete.mjs +0 -14
  172. package/dist/lib/chunk-delete.mjs.map +0 -1
  173. package/dist/lib/chunk-operations8.mjs +0 -9
  174. package/dist/lib/chunk-operations8.mjs.map +0 -1
  175. package/dist/lib/chunk-query.mjs +0 -18
  176. package/dist/lib/chunk-query.mjs.map +0 -1
  177. package/dist/lib/chunk-save.mjs +0 -17
  178. package/dist/lib/chunk-save.mjs.map +0 -1
  179. package/dist/lib/ns/MemorySkill.mjs +0 -3
  180. package/dist/types/src/skills/memory/MemorySkill.d.ts +0 -6
  181. package/dist/types/src/skills/memory/MemorySkill.d.ts.map +0 -1
  182. package/dist/types/src/skills/memory/index.d.ts +0 -2
  183. package/dist/types/src/skills/memory/index.d.ts.map +0 -1
  184. package/dist/types/src/skills/memory/operations/definitions.d.ts +0 -15
  185. package/dist/types/src/skills/memory/operations/definitions.d.ts.map +0 -1
  186. package/dist/types/src/skills/memory/operations/delete.d.ts +0 -7
  187. package/dist/types/src/skills/memory/operations/delete.d.ts.map +0 -1
  188. package/dist/types/src/skills/memory/operations/delete.test.d.ts +0 -2
  189. package/dist/types/src/skills/memory/operations/delete.test.d.ts.map +0 -1
  190. package/dist/types/src/skills/memory/operations/index.d.ts +0 -4
  191. package/dist/types/src/skills/memory/operations/index.d.ts.map +0 -1
  192. package/dist/types/src/skills/memory/operations/query.d.ts +0 -8
  193. package/dist/types/src/skills/memory/operations/query.d.ts.map +0 -1
  194. package/dist/types/src/skills/memory/operations/query.test.d.ts +0 -2
  195. package/dist/types/src/skills/memory/operations/query.test.d.ts.map +0 -1
  196. package/dist/types/src/skills/memory/operations/save.d.ts +0 -8
  197. package/dist/types/src/skills/memory/operations/save.d.ts.map +0 -1
  198. package/dist/types/src/skills/memory/operations/save.test.d.ts +0 -2
  199. package/dist/types/src/skills/memory/operations/save.test.d.ts.map +0 -1
  200. package/dist/types/src/skills/memory/skill.test.d.ts +0 -2
  201. package/dist/types/src/skills/memory/skill.test.d.ts.map +0 -1
  202. package/dist/types/src/types/Memory.d.ts +0 -12
  203. package/dist/types/src/types/Memory.d.ts.map +0 -1
  204. package/src/skills/memory/MemorySkill.ts +0 -39
  205. package/src/skills/memory/index.ts +0 -5
  206. package/src/skills/memory/operations/definitions.ts +0 -72
  207. package/src/skills/memory/operations/delete.test.ts +0 -37
  208. package/src/skills/memory/operations/delete.ts +0 -20
  209. package/src/skills/memory/operations/index.ts +0 -16
  210. package/src/skills/memory/operations/query.test.ts +0 -76
  211. package/src/skills/memory/operations/query.ts +0 -32
  212. package/src/skills/memory/operations/save.test.ts +0 -43
  213. package/src/skills/memory/operations/save.ts +0 -20
  214. package/src/skills/memory/skill.test.ts +0 -147
  215. package/src/types/Memory.ts +0 -22
@@ -0,0 +1,58 @@
1
+ import { n as AddMcpConnection } from "./chunk-operations2.mjs";
2
+ import { t as describe } from "./chunk-mcp-connections.mjs";
3
+ import * as Effect from "effect/Effect";
4
+ import { AiContext, Harness } from "@dxos/assistant";
5
+ import { Database, Filter, Obj, Ref } from "@dxos/echo";
6
+ import * as Operation from "@dxos/compute/Operation";
7
+ import * as Option from "effect/Option";
8
+ import { AccessToken, Connection } from "@dxos/link";
9
+ import { McpToolkit } from "@dxos/mcp-client";
10
+ //#region src/skills/skill-manager/operations/add-mcp-connection.ts
11
+ /** Matches the Custom MCP Server connector, so the connection lists and behaves as one the user added. */
12
+ var MCP_CONNECTOR_ID = "mcp";
13
+ var add_mcp_connection_default = AddMcpConnection.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ url, name, protocol = "http", key }) {
14
+ const endpoint = {
15
+ url: url.trim(),
16
+ protocol
17
+ };
18
+ if (!URL.canParse(endpoint.url)) return yield* Effect.die(/* @__PURE__ */ new Error(`Not a URL: ${url}`));
19
+ const source = new URL(endpoint.url).host;
20
+ const existing = (yield* Database.query(Filter.type(Connection.Connection)).run).find((connection) => connection.connectorId === MCP_CONNECTOR_ID && connection.mcp?.url === endpoint.url);
21
+ const stored = existing?.accessToken ? yield* Database.load(existing.accessToken).pipe(Effect.option) : Option.none();
22
+ const newKey = key?.trim() || void 0;
23
+ const apiKey = newKey ?? Option.getOrUndefined(Option.map(stored, ({ token }) => token));
24
+ const probe = yield* McpToolkit.probe({
25
+ ...endpoint,
26
+ apiKey
27
+ }).pipe(Effect.result);
28
+ if (probe._tag === "Failure" && probe.failure.unauthorized) return yield* Effect.die(/* @__PURE__ */ new Error(apiKey ? "The MCP server rejected this API key." : "The MCP server needs sign-in. Ask the user to connect it with Connect, then Custom MCP Server."));
29
+ const connection = existing ?? (yield* Database.add(Obj.make(Connection.Connection, {
30
+ name: name ?? source,
31
+ connectorId: MCP_CONNECTOR_ID,
32
+ mcp: endpoint
33
+ })));
34
+ if (existing && existing.mcp?.protocol !== endpoint.protocol) Obj.update(existing, (existing) => {
35
+ existing.mcp = endpoint;
36
+ });
37
+ if (newKey) {
38
+ const accessToken = yield* Database.add(Obj.make(AccessToken.AccessToken, {
39
+ source,
40
+ token: newKey
41
+ }));
42
+ Obj.update(connection, (connection) => {
43
+ connection.accessToken = Ref.make(accessToken);
44
+ });
45
+ Obj.setParent(accessToken, connection);
46
+ if (Option.isSome(stored)) yield* Database.remove(stored.value);
47
+ }
48
+ const binder = yield* Harness.binder.pipe(Effect.orDie);
49
+ yield* Effect.promise(() => binder.setConnection(AiContext.connectionRef(connection), true));
50
+ return {
51
+ ...describe(connection, binder.getConnections()),
52
+ ...probe._tag === "Success" ? { tools: probe.success.tools } : { problem: probe.failure.message }
53
+ };
54
+ })));
55
+ //#endregion
56
+ export { add_mcp_connection_default as default };
57
+
58
+ //# sourceMappingURL=chunk-add-mcp-connection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-add-mcp-connection.mjs","names":[],"sources":["../../src/skills/skill-manager/operations/add-mcp-connection.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nimport { AiContext, Harness } from '@dxos/assistant';\nimport * as Operation from '@dxos/compute/Operation';\nimport { Database, Filter, Obj, Ref } from '@dxos/echo';\nimport { AccessToken, Connection } from '@dxos/link';\nimport { McpToolkit } from '@dxos/mcp-client';\n\nimport { AddMcpConnection } from './definitions.ts';\nimport { describe } from './mcp-connections.ts';\n\n/** Matches the Custom MCP Server connector, so the connection lists and behaves as one the user added. */\nconst MCP_CONNECTOR_ID = 'mcp';\n\nexport default AddMcpConnection.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ url, name, protocol = 'http', key }) {\n const endpoint: Connection.McpEndpoint = { url: url.trim(), protocol };\n if (!URL.canParse(endpoint.url)) {\n return yield* Effect.die(new Error(`Not a URL: ${url}`));\n }\n const source = new URL(endpoint.url).host;\n // A second connection to a server the space has would offer each of its tools twice, under two\n // names; the existing one is updated instead.\n const existing = (yield* Database.query(Filter.type(Connection.Connection)).run).find(\n (connection) => connection.connectorId === MCP_CONNECTOR_ID && connection.mcp?.url === endpoint.url,\n );\n const stored = existing?.accessToken\n ? yield* Database.load(existing.accessToken).pipe(Effect.option)\n : Option.none();\n const newKey = key?.trim() || undefined;\n const apiKey = newKey ?? Option.getOrUndefined(Option.map(stored, ({ token }) => token));\n\n // Only a refusal of credentials stops the add: a server that is down, or blocks this network,\n // may still answer the agent's turns.\n const probe = yield* McpToolkit.probe({ ...endpoint, apiKey }).pipe(Effect.result);\n if (probe._tag === 'Failure' && probe.failure.unauthorized) {\n return yield* Effect.die(\n new Error(\n apiKey\n ? 'The MCP server rejected this API key.'\n : 'The MCP server needs sign-in. Ask the user to connect it with Connect, then Custom MCP Server.',\n ),\n );\n }\n\n const connection =\n existing ??\n (yield* Database.add(\n Obj.make(Connection.Connection, { name: name ?? source, connectorId: MCP_CONNECTOR_ID, mcp: endpoint }),\n ));\n // The reply describes the endpoint that answered, so a re-add keeps that one.\n if (existing && existing.mcp?.protocol !== endpoint.protocol) {\n Obj.update(existing, (existing) => {\n existing.mcp = endpoint;\n });\n }\n if (newKey) {\n const accessToken = yield* Database.add(Obj.make(AccessToken.AccessToken, { source, token: newKey }));\n Obj.update(connection, (connection) => {\n connection.accessToken = Ref.make(accessToken);\n });\n Obj.setParent(accessToken, connection);\n // The key it replaces stays readable by every member until it is removed.\n if (Option.isSome(stored)) {\n yield* Database.remove(stored.value);\n }\n }\n\n const binder = yield* Harness.binder.pipe(Effect.orDie);\n yield* Effect.promise(() => binder.setConnection(AiContext.connectionRef(connection), true));\n return {\n ...describe(connection, binder.getConnections()),\n ...(probe._tag === 'Success' ? { tools: probe.success.tools } : { problem: probe.failure.message }),\n };\n }),\n ),\n);\n"],"mappings":";;;;;;;;;;;AAiBA,IAAM,mBAAmB;AAEzB,IAAA,6BAAe,iBAAiB,KAC9B,UAAU,YACR,OAAO,WAAW,WAAW,EAAE,KAAK,MAAM,WAAW,QAAQ,OAAO;CAClE,MAAM,WAAmC;EAAE,KAAK,IAAI,KAAK;EAAG;CAAS;CACrE,IAAI,CAAC,IAAI,SAAS,SAAS,GAAG,GAC5B,OAAO,OAAO,OAAO,oBAAI,IAAI,MAAM,cAAc,KAAK,CAAC;CAEzD,MAAM,SAAS,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cAAc,OAAO,cAAc,UAAU,cAAc,UAAU,GAAG,IAAI,CAAC;CAC3F,OAAO;EACL,GAAG,SAAS,YAAY,OAAO,eAAe,CAAC;EAC/C,GAAI,MAAM,SAAS,YAAY,EAAE,OAAO,MAAM,QAAQ,MAAM,IAAI,EAAE,SAAS,MAAM,QAAQ,QAAQ;CACnG;AACF,CAAC,CACH,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-ask-question.mjs","names":[],"sources":["../../src/skills/planning/operations/ask-question.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Harness } from '@dxos/assistant';\nimport * as Chat from '@dxos/assistant/Chat';\nimport * as Operation from '@dxos/compute/Operation';\nimport * as Trace from '@dxos/compute/Trace';\nimport { Database, Ref } from '@dxos/echo';\nimport { Task } from '@dxos/types';\nimport { trim } from '@dxos/util';\n\nimport { AskQuestion } from './definitions.ts';\nimport { selfActor } from './update-tasks.ts';\n\n/**\n * Files a question on a checklist task and blocks the task on it.\n *\n * The task is matched by title: the question has to name the task in words the reader recognizes,\n * and the title is the only part of a task the person answering ever sees. Two tasks sharing one\n * title are refused rather than guessed between — blocking the wrong one would leave the right one\n * looking live while nothing advances it.\n *\n * The question lands in the task's own history, so it cannot be separated from the work it blocks.\n * The task is set `blocked` alongside it — otherwise the checklist reads as work in progress that\n * nothing is advancing — and the entry carries the conversation ref, without which the answer has\n * no session to resume.\n */\nexport default AskQuestion.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ task: title, question: text, context, options }) {\n const chat = yield* Harness.getChat;\n\n const tasks = yield* Chat.loadTasks(chat);\n const matches = tasks.filter((candidate) => candidate.title === title.trim());\n if (matches.length > 1) {\n return trim`\n \"${title.trim()}\" is the title of ${matches.length} tasks on this conversation's checklist, so\n nothing was filed — blocking the wrong one would leave the right one looking live. Give the\n tasks distinct titles with update-tasks, then ask again.\n\n <checklist>\n ${yield* Chat.formatChecklist(chat)}\n </checklist>\n `;\n }\n const [task] = matches;\n if (!task) {\n // Not a failure: the model gets the checklist back and re-reads the title it should have used.\n return trim`\n No task titled \"${title.trim()}\" is on this conversation's checklist, so no question was asked.\n Ask again naming one of these exactly, or add the task first with update-tasks.\n\n <checklist>\n ${yield* Chat.formatChecklist(chat)}\n </checklist>\n `;\n }\n\n // A retried tool call must not file a second question: the reader would have two to answer\n // where only the first resumes anything cleanly, and the second answer would wake the same\n // chat again.\n if (Task.getPendingQuestions(task.history).length > 0) {\n return trim`\n \"${task.title}\" already has an unanswered question, so nothing was filed. Wait for it to be\n answered rather than asking again.\n\n <checklist>\n ${yield* Chat.formatChecklist(chat)}\n </checklist>\n `;\n }\n\n // A result, not a failure, as every refusal here: the model rewrites the question and asks again.\n if (text.trim() === '') {\n return 'The question is empty, so nothing was filed. Ask again with the question written out.';\n }\n\n const question = Task.ask(task, {\n text,\n ...(context ? { context } : {}),\n ...(options && options.length > 0\n ? { options: options.map(({ title, description }) => ({ title, ...(description ? { description } : {}) })) }\n : {}),\n conversation: Ref.make(chat),\n actor: yield* selfActor(chat),\n });\n\n const previousStatus = task.status;\n Task.setStatus(task, 'blocked');\n if (task.status !== undefined && task.status !== previousStatus) {\n yield* Trace.write(Trace.TaskStatusChanged, {\n taskId: task.id,\n title: task.title,\n status: task.status,\n ...(previousStatus ? { previousStatus } : {}),\n });\n }\n yield* Trace.write(Trace.QuestionAsked, {\n questionId: question.id,\n text: question.text,\n taskId: task.id,\n options: question.options?.length ?? 0,\n });\n yield* Database.flush();\n\n return trim`\n Question filed on \"${task.title}\", which is now blocked. Stop here and end your turn — you are\n sent a message when it is answered, and you read the answer back off the task's history.\n Show the reader the question by emitting this line verbatim, on its own:\n\n <surface role=\"question\">{\"task\":\"${task.id}\",\"question\":\"${question.id}\"}</surface>\n\n <checklist>\n ${yield* Chat.formatChecklist(chat)}\n </checklist>\n `;\n }),\n ),\n Operation.opaqueHandler,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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,eAAe,IAAI,CAAC;CAC7C,CAAC;CAEH,OAAO,MAAM,MAAM,MAAM,eAAe;EACtC,YAAY,SAAS;EACrB,MAAM,SAAS;EACf,QAAQ,KAAK;EACb,SAAS,SAAS,SAAS,UAAU;CACvC,CAAC;CACD,OAAO,SAAS,MAAM;CAEtB,OAAO,IAAI;6BACY,KAAK,MAAM;;;;4CAII,KAAK,GAAG,gBAAgB,SAAS,GAAG;;;UAGtE,OAAO,KAAK,gBAAgB,IAAI,EAAC;;;AAGvC,CAAC,CACH,GACA,UAAU,aACZ"}
1
+ {"version":3,"file":"chunk-ask-question.mjs","names":[],"sources":["../../src/skills/planning/operations/ask-question.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Harness } from '@dxos/assistant';\nimport * as Chat from '@dxos/assistant/Chat';\nimport * as Operation from '@dxos/compute/Operation';\nimport * as Trace from '@dxos/compute/Trace';\nimport { Database, Ref } from '@dxos/echo';\nimport { Task } from '@dxos/types';\nimport { trim } from '@dxos/util';\n\nimport { AskQuestion } from './definitions.ts';\nimport { selfActor } from './update-tasks.ts';\n\n/**\n * Files a question on a checklist task and blocks the task on it.\n *\n * The task is matched by title: the question has to name the task in words the reader recognizes,\n * and the title is the only part of a task the person answering ever sees. Two tasks sharing one\n * title are refused rather than guessed between — blocking the wrong one would leave the right one\n * looking live while nothing advances it.\n *\n * The question lands in the task's own history, so it cannot be separated from the work it blocks.\n * The task is set `blocked` alongside it — otherwise the checklist reads as work in progress that\n * nothing is advancing — and the entry carries the conversation ref, without which the answer has\n * no session to resume.\n */\nexport default AskQuestion.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ task: title, question: text, context, options }) {\n const chat = yield* Harness.getChat;\n\n const tasks = yield* Chat.loadTasks(chat);\n const matches = tasks.filter((candidate) => candidate.title === title.trim());\n if (matches.length > 1) {\n return trim`\n \"${title.trim()}\" is the title of ${matches.length} tasks on this conversation's checklist, so\n nothing was filed — blocking the wrong one would leave the right one looking live. Give the\n tasks distinct titles with update-tasks, then ask again.\n\n <checklist>\n ${yield* Chat.formatChecklist(chat)}\n </checklist>\n `;\n }\n const [task] = matches;\n if (!task) {\n // Not a failure: the model gets the checklist back and re-reads the title it should have used.\n return trim`\n No task titled \"${title.trim()}\" is on this conversation's checklist, so no question was asked.\n Ask again naming one of these exactly, or add the task first with update-tasks.\n\n <checklist>\n ${yield* Chat.formatChecklist(chat)}\n </checklist>\n `;\n }\n\n // A retried tool call must not file a second question: the reader would have two to answer\n // where only the first resumes anything cleanly, and the second answer would wake the same\n // chat again.\n if (Task.getPendingQuestions(task.history).length > 0) {\n return trim`\n \"${task.title}\" already has an unanswered question, so nothing was filed. Wait for it to be\n answered rather than asking again.\n\n <checklist>\n ${yield* Chat.formatChecklist(chat)}\n </checklist>\n `;\n }\n\n // A result, not a failure, as every refusal here: the model rewrites the question and asks again.\n if (text.trim() === '') {\n return 'The question is empty, so nothing was filed. Ask again with the question written out.';\n }\n\n const question = Task.ask(task, {\n text,\n ...(context ? { context } : {}),\n ...(options && options.length > 0\n ? { options: options.map(({ title, description }) => ({ title, ...(description ? { description } : {}) })) }\n : {}),\n conversation: Ref.make(chat),\n actor: yield* selfActor(chat),\n });\n\n const previousStatus = task.status;\n Task.setStatus(task, 'blocked');\n if (task.status !== undefined && task.status !== previousStatus) {\n yield* Trace.write(Trace.TaskStatusChanged, {\n taskId: task.id,\n title: task.title,\n status: task.status,\n ...(previousStatus ? { previousStatus } : {}),\n });\n }\n yield* Trace.write(Trace.QuestionAsked, {\n questionId: question.id,\n text: question.text,\n taskId: task.id,\n options: question.options?.length ?? 0,\n });\n yield* Database.flush();\n\n return trim`\n Question filed on \"${task.title}\", which is now blocked. Stop here and end your turn — you are\n sent a message when it is answered, and you read the answer back off the task's history.\n Show the reader the question by emitting this line verbatim, on its own:\n\n <surface role=\"question\">{\"task\":\"${task.id}\",\"question\":\"${question.id}\"}</surface>\n\n <checklist>\n ${yield* Chat.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,MAAM,mBAAmB;EAC1C,QAAQ,KAAK;EACb,OAAO,KAAK;EACZ,QAAQ,KAAK;EACb,GAAI,iBAAiB,EAAE,eAAe,IAAI,CAAC;CAC7C,CAAC;CAEH,OAAO,MAAM,MAAM,MAAM,eAAe;EACtC,YAAY,SAAS;EACrB,MAAM,SAAS;EACf,QAAQ,KAAK;EACb,SAAS,SAAS,SAAS,UAAU;CACvC,CAAC;CACD,OAAO,SAAS,MAAM;CAEtB,OAAO,IAAI;6BACY,KAAK,MAAM;;;;4CAII,KAAK,GAAG,gBAAgB,SAAS,GAAG;;;UAGtE,OAAO,KAAK,gBAAgB,IAAI,EAAE;;;AAGxC,CAAC,CACH,GACA,UAAU,aACZ"}
@@ -0,0 +1,86 @@
1
+ import * as Effect from "effect/Effect";
2
+ import { Harness } from "@dxos/assistant";
3
+ import { Obj } from "@dxos/echo";
4
+ import * as Operation from "@dxos/compute/Operation";
5
+ import { describeInput } from "@dxos/assistant/Describe";
6
+ //#region src/skills/skill-manager/operations/catalog.ts
7
+ /** The skills enabled in this conversation, or none where it has no binder. */
8
+ var enabledSkills = Harness.binder.pipe(Effect.tap((binder) => Effect.promise(() => binder.sync())), Effect.map((binder) => binder.getSkills()), Effect.orElseSucceed(() => []));
9
+ /** A skill's key, or for a space-authored skill with none its URI. */
10
+ var skillKey = (skill) => Obj.getMeta(skill).key ?? String(Obj.getURI(skill));
11
+ /** Keys compare with or without the `dxn:` prefix, which records and definitions spell differently. */
12
+ var sameKey = (left, right) => bare(left) === bare(right);
13
+ var bare = (key) => key.replace(/^dxn:/, "");
14
+ /** Whether `skill` is one of `enabled`. */
15
+ var isEnabled = (enabled, skill) => enabled.some((other) => sameKey(skillKey(other), skillKey(skill)));
16
+ /** The registry's skills and any enabled one it does not hold (a space-authored skill), by name. */
17
+ var knownSkills = (registered, enabled) => [...registered, ...enabled.filter((skill) => !isEnabled(registered, skill))].sort((left, right) => left.name.localeCompare(right.name));
18
+ var listedSkill = (skill, enabled) => ({
19
+ key: skillKey(skill),
20
+ name: skill.name,
21
+ ...skill.description === void 0 ? {} : { description: String(skill.description) },
22
+ enabled,
23
+ agentCanEnable: skill.agentCanEnable === true
24
+ });
25
+ /**
26
+ * The operations of `skills`, each once, read from the registry's records (which every host's tools resolve through).
27
+ * Enabled skills' come first, so an operation two skills share counts as enabled when either is.
28
+ */
29
+ var operationCandidates = (skills, enabled, records) => {
30
+ const byTool = new Map(records.flatMap((record) => {
31
+ const key = Operation.getKey(record);
32
+ const tool = key === void 0 ? void 0 : Operation.tryToolNameFromKey(key);
33
+ return key === void 0 || tool === void 0 ? [] : [[tool, {
34
+ key,
35
+ record
36
+ }]];
37
+ }));
38
+ const ordered = [...skills].sort((left, right) => Number(isEnabled(enabled, right)) - Number(isEnabled(enabled, left)));
39
+ const candidates = /* @__PURE__ */ new Map();
40
+ for (const skill of ordered) for (const tool of skill.tools) {
41
+ const found = byTool.get(String(tool));
42
+ if (found !== void 0 && !candidates.has(bare(found.key))) candidates.set(bare(found.key), {
43
+ listed: {
44
+ key: found.key,
45
+ tool: String(tool),
46
+ name: found.record.name,
47
+ ...found.record.description === void 0 ? {} : { description: found.record.description },
48
+ skill: skillKey(skill),
49
+ enabled: isEnabled(enabled, skill)
50
+ },
51
+ record: found.record
52
+ });
53
+ }
54
+ return [...candidates.values()];
55
+ };
56
+ /**
57
+ * The listed operation with its input, labelled as code passes it (refs as `Ref<typename>`). Left out where the record's
58
+ * schema cannot be rebuilt, which costs only that operation's input.
59
+ */
60
+ var withInput = ({ listed, record }) => Effect.try(() => describeInput(Operation.deserialize(record).input)).pipe(Effect.map((input) => ({
61
+ ...listed,
62
+ input
63
+ })), Effect.orElseSucceed(() => listed));
64
+ /** Lower-case words, splitting dotted keys, kebab-case and camelCase; words under three letters say nothing. */
65
+ var words = (text) => text.replace(/([a-z])([A-Z])/g, "$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter((word) => word.length >= 3);
66
+ /** The items any of the query's words match, most matched first; every item, in order, without a query. */
67
+ var ranked = (items, query, text) => {
68
+ const terms = words(query ?? "");
69
+ if (terms.length === 0) return [...items];
70
+ return items.map((item) => {
71
+ const itemWords = words(text(item).filter((part) => part !== void 0).join(" "));
72
+ return {
73
+ item,
74
+ score: terms.filter((term) => itemWords.some((word) => word.startsWith(term))).length
75
+ };
76
+ }).filter(({ score }) => score > 0).sort((left, right) => right.score - left.score).map(({ item }) => item);
77
+ };
78
+ /** An operation as a list shows it: its description cut to the first sentence, which a lookup by key gives in full. */
79
+ var brief = (listed) => listed.description === void 0 ? listed : {
80
+ ...listed,
81
+ description: (/^.*?[.!?](?=\s|$)/s.exec(listed.description)?.[0] ?? listed.description).slice(0, 200)
82
+ };
83
+ //#endregion
84
+ export { listedSkill as a, sameKey as c, knownSkills as i, skillKey as l, enabledSkills as n, operationCandidates as o, isEnabled as r, ranked as s, brief as t, withInput as u };
85
+
86
+ //# sourceMappingURL=chunk-catalog.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-catalog.mjs","names":[],"sources":["../../src/skills/skill-manager/operations/catalog.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Harness } from '@dxos/assistant';\nimport { describeInput } from '@dxos/assistant/Describe';\nimport * as Operation from '@dxos/compute/Operation';\nimport type * as Skill from '@dxos/compute/Skill';\nimport { Obj } from '@dxos/echo';\n\nimport type { ListedOperation, ListedSkill } from './definitions.ts';\n\n/** The skills enabled in this conversation, or none where it has no binder. */\nexport const enabledSkills: Effect.Effect<Skill.Skill[], never, Harness.HarnessService> = Harness.binder.pipe(\n Effect.tap((binder) => Effect.promise(() => binder.sync())),\n Effect.map((binder) => binder.getSkills()),\n Effect.orElseSucceed((): Skill.Skill[] => []),\n);\n\n/** A skill's key, or for a space-authored skill with none its URI. */\nexport const skillKey = (skill: Skill.Skill): string => Obj.getMeta(skill).key ?? String(Obj.getURI(skill));\n\n/** Keys compare with or without the `dxn:` prefix, which records and definitions spell differently. */\nexport const sameKey = (left: string, right: string): boolean => bare(left) === bare(right);\nconst bare = (key: string): string => key.replace(/^dxn:/, '');\n\n/** Whether `skill` is one of `enabled`. */\nexport const isEnabled = (enabled: readonly Skill.Skill[], skill: Skill.Skill): boolean =>\n enabled.some((other) => sameKey(skillKey(other), skillKey(skill)));\n\n/** The registry's skills and any enabled one it does not hold (a space-authored skill), by name. */\nexport const knownSkills = (registered: readonly Skill.Skill[], enabled: readonly Skill.Skill[]): Skill.Skill[] =>\n [...registered, ...enabled.filter((skill) => !isEnabled(registered, skill))].sort((left, right) =>\n left.name.localeCompare(right.name),\n );\n\nexport const listedSkill = (skill: Skill.Skill, enabled: boolean): ListedSkill => ({\n key: skillKey(skill),\n name: skill.name,\n ...(skill.description === undefined ? {} : { description: String(skill.description) }),\n enabled,\n agentCanEnable: skill.agentCanEnable === true,\n});\n\n/** A listed operation, with the record it describes. */\nexport type OperationCandidate = { readonly listed: ListedOperation; readonly record: Operation.PersistentOperation };\n\n/**\n * The operations of `skills`, each once, read from the registry's records (which every host's tools resolve through).\n * Enabled skills' come first, so an operation two skills share counts as enabled when either is.\n */\nexport const operationCandidates = (\n skills: readonly Skill.Skill[],\n enabled: readonly Skill.Skill[],\n records: readonly Operation.PersistentOperation[],\n): OperationCandidate[] => {\n const byTool = new Map(\n records.flatMap((record) => {\n const key = Operation.getKey(record);\n const tool = key === undefined ? undefined : Operation.tryToolNameFromKey(key);\n return key === undefined || tool === undefined ? [] : [[tool, { key, record }] as const];\n }),\n );\n const ordered = [...skills].sort(\n (left, right) => Number(isEnabled(enabled, right)) - Number(isEnabled(enabled, left)),\n );\n const candidates = new Map<string, OperationCandidate>();\n for (const skill of ordered) {\n for (const tool of skill.tools) {\n const found = byTool.get(String(tool));\n if (found !== undefined && !candidates.has(bare(found.key))) {\n candidates.set(bare(found.key), {\n listed: {\n key: found.key,\n tool: String(tool),\n name: found.record.name,\n ...(found.record.description === undefined ? {} : { description: found.record.description }),\n skill: skillKey(skill),\n enabled: isEnabled(enabled, skill),\n },\n record: found.record,\n });\n }\n }\n }\n return [...candidates.values()];\n};\n\n/**\n * The listed operation with its input, labelled as code passes it (refs as `Ref<typename>`). Left out where the record's\n * schema cannot be rebuilt, which costs only that operation's input.\n */\nexport const withInput = ({ listed, record }: OperationCandidate): Effect.Effect<ListedOperation> =>\n Effect.try(() => describeInput(Operation.deserialize(record).input)).pipe(\n Effect.map((input) => ({ ...listed, input })),\n Effect.orElseSucceed(() => listed),\n );\n\n/** Lower-case words, splitting dotted keys, kebab-case and camelCase; words under three letters say nothing. */\nconst words = (text: string): string[] =>\n text\n .replace(/([a-z])([A-Z])/g, '$1 $2')\n .toLowerCase()\n .split(/[^a-z0-9]+/)\n .filter((word) => word.length >= 3);\n\n/** The items any of the query's words match, most matched first; every item, in order, without a query. */\nexport const ranked = <T>(\n items: readonly T[],\n query: string | undefined,\n text: (item: T) => readonly (string | undefined)[],\n): T[] => {\n const terms = words(query ?? '');\n if (terms.length === 0) {\n return [...items];\n }\n return items\n .map((item) => {\n const itemWords = words(\n text(item)\n .filter((part) => part !== undefined)\n .join(' '),\n );\n return { item, score: terms.filter((term) => itemWords.some((word) => word.startsWith(term))).length };\n })\n .filter(({ score }) => score > 0)\n .sort((left, right) => right.score - left.score)\n .map(({ item }) => item);\n};\n\n/** An operation as a list shows it: its description cut to the first sentence, which a lookup by key gives in full. */\nexport const brief = (listed: ListedOperation): ListedOperation =>\n listed.description === undefined\n ? listed\n : {\n ...listed,\n description: (/^.*?[.!?](?=\\s|$)/s.exec(listed.description)?.[0] ?? listed.description).slice(0, 200),\n };\n"],"mappings":";;;;;;;AAeA,IAAa,gBAA6E,QAAQ,OAAO,KACvG,OAAO,KAAK,WAAW,OAAO,cAAc,OAAO,KAAK,CAAC,CAAC,GAC1D,OAAO,KAAK,WAAW,OAAO,UAAU,CAAC,GACzC,OAAO,oBAAmC,CAAC,CAAC,CAC9C;;AAGA,IAAa,YAAY,UAA+B,IAAI,QAAQ,KAAK,CAAC,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,UAAU,MAAM,QAAQ,KAAK,KAAK,CAAC,CAC/C,KAAK,EAAE,WAAW,IAAI;AAC3B;;AAGA,IAAa,SAAS,WACpB,OAAO,gBAAgB,KAAA,IACnB,SACA;CACE,GAAG;CACH,cAAc,qBAAqB,KAAK,OAAO,WAAW,CAAC,GAAG,MAAM,OAAO,YAAA,CAAa,MAAM,GAAG,GAAG;AACtG"}
@@ -1,4 +1,4 @@
1
- import { n as ContextAdd } from "./chunk-operations5.mjs";
1
+ import { n as ContextAdd } from "./chunk-operations4.mjs";
2
2
  import * as Effect from "effect/Effect";
3
3
  import { Harness } from "@dxos/assistant";
4
4
  import * as Operation from "@dxos/compute/Operation";
@@ -1,4 +1,4 @@
1
- import { r as ContextRemove } from "./chunk-operations5.mjs";
1
+ import { r as ContextRemove } from "./chunk-operations4.mjs";
2
2
  import * as Effect from "effect/Effect";
3
3
  import { Harness } from "@dxos/assistant";
4
4
  import * as Operation from "@dxos/compute/Operation";
@@ -9,7 +9,7 @@ import * as Operation from "@dxos/compute/Operation";
9
9
  //#region src/skills/delegation/operations/delegate-task.ts
10
10
  /**
11
11
  * Delegation is the promotion moment: the unit of work becomes a durable `Task` on the
12
- * conversation's checklist assigned to an agent (`role: 'assistant'`), which the supervisor's
12
+ * conversation's checklist delegated to an agent (`role: 'assistant'`), which the supervisor's
13
13
  * reconcile loop picks up and marks done/failed on completion (see the delegation strategy).
14
14
  */
15
15
  var handler = DelegateTask.pipe(Operation.withHandler(Effect.fn(function* ({ title }) {
@@ -18,7 +18,7 @@ var handler = DelegateTask.pipe(Operation.withHandler(Effect.fn(function* ({ tit
18
18
  const { db } = yield* Database.Service;
19
19
  const task = Chat.addTask(db, chat, title, {
20
20
  status: "todo",
21
- assignee: { role: "assistant" }
21
+ delegate: { role: "assistant" }
22
22
  });
23
23
  yield* Database.flush();
24
24
  return trim`
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-delegate-task.mjs","names":[],"sources":["../../src/skills/delegation/operations/delegate-task.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Harness } from '@dxos/assistant';\nimport * as Chat from '@dxos/assistant/Chat';\nimport * as Operation from '@dxos/compute/Operation';\nimport { Database } from '@dxos/echo';\nimport { trim } from '@dxos/util';\n\nimport { ToolkitError } from '../../../errors.ts';\nimport { DelegateTask } from './definitions.ts';\n\n/**\n * Delegation is the promotion moment: the unit of work becomes a durable `Task` on the\n * conversation's checklist assigned to an agent (`role: 'assistant'`), which the supervisor's\n * reconcile loop picks up and marks done/failed on completion (see the delegation strategy).\n */\nconst handler: Operation.WithHandler<typeof DelegateTask> = DelegateTask.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ title }) {\n if (title.length === 0) {\n return yield* Effect.fail(new ToolkitError({ message: 'Provide a non-empty task title.' }));\n }\n\n const chat = yield* Harness.getChat;\n const { db } = yield* Database.Service;\n\n // Queued (`todo`) rather than `started`: the reconcile loop spawns the sub-agent and marks\n // the task started at spawn, so `started` always means a live process.\n const task = Chat.addTask(db, chat, title, {\n status: 'todo',\n assignee: { role: 'assistant' },\n });\n yield* Database.flush();\n\n return trim`\n Delegated \"${task.title}\" as a queued agent task (id: ${task.id}).\n\n <checklist>\n ${yield* Chat.formatChecklist(chat)}\n </checklist>\n `;\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;;;;;;;;;;AAoBA,IAAM,UAAsD,aAAa,KACvE,UAAU,YACR,OAAO,GAAG,WAAW,EAAE,SAAS;CAC9B,IAAI,MAAM,WAAW,GACnB,OAAO,OAAO,OAAO,KAAK,IAAI,aAAa,EAAE,SAAS,kCAAkC,CAAC,CAAC;CAG5F,MAAM,OAAO,OAAO,QAAQ;CAC5B,MAAM,EAAE,OAAO,OAAO,SAAS;CAI/B,MAAM,OAAO,KAAK,QAAQ,IAAI,MAAM,OAAO;EACzC,QAAQ;EACR,UAAU,EAAE,MAAM,YAAY;CAChC,CAAC;CACD,OAAO,SAAS,MAAM;CAEtB,OAAO,IAAI;qBACI,KAAK,MAAM,gCAAgC,KAAK,GAAG;;;YAG5D,OAAO,KAAK,gBAAgB,IAAI,EAAC;;;AAGzC,CAAC,CACH,CACF"}
1
+ {"version":3,"file":"chunk-delegate-task.mjs","names":[],"sources":["../../src/skills/delegation/operations/delegate-task.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Harness } from '@dxos/assistant';\nimport * as Chat from '@dxos/assistant/Chat';\nimport * as Operation from '@dxos/compute/Operation';\nimport { Database } from '@dxos/echo';\nimport { trim } from '@dxos/util';\n\nimport { ToolkitError } from '../../../errors.ts';\nimport { DelegateTask } from './definitions.ts';\n\n/**\n * Delegation is the promotion moment: the unit of work becomes a durable `Task` on the\n * conversation's checklist delegated to an agent (`role: 'assistant'`), which the supervisor's\n * reconcile loop picks up and marks done/failed on completion (see the delegation strategy).\n */\nconst handler: Operation.WithHandler<typeof DelegateTask> = DelegateTask.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ title }) {\n if (title.length === 0) {\n return yield* Effect.fail(new ToolkitError({ message: 'Provide a non-empty task title.' }));\n }\n\n const chat = yield* Harness.getChat;\n const { db } = yield* Database.Service;\n\n // Queued (`todo`) rather than `started`: the reconcile loop spawns the sub-agent and marks\n // the task started at spawn, so `started` always means a live process.\n const task = Chat.addTask(db, chat, title, {\n status: 'todo',\n delegate: { role: 'assistant' },\n });\n yield* Database.flush();\n\n return trim`\n Delegated \"${task.title}\" as a queued agent task (id: ${task.id}).\n\n <checklist>\n ${yield* Chat.formatChecklist(chat)}\n </checklist>\n `;\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;;;;;;;;;;AAoBA,IAAM,UAAsD,aAAa,KACvE,UAAU,YACR,OAAO,GAAG,WAAW,EAAE,SAAS;CAC9B,IAAI,MAAM,WAAW,GACnB,OAAO,OAAO,OAAO,KAAK,IAAI,aAAa,EAAE,SAAS,kCAAkC,CAAC,CAAC;CAG5F,MAAM,OAAO,OAAO,QAAQ;CAC5B,MAAM,EAAE,OAAO,OAAO,SAAS;CAI/B,MAAM,OAAO,KAAK,QAAQ,IAAI,MAAM,OAAO;EACzC,QAAQ;EACR,UAAU,EAAE,MAAM,YAAY;CAChC,CAAC;CACD,OAAO,SAAS,MAAM;CAEtB,OAAO,IAAI;qBACI,KAAK,MAAM,gCAAgC,KAAK,GAAG;;;YAG5D,OAAO,KAAK,gBAAgB,IAAI,EAAE;;;AAG1C,CAAC,CACH,CACF"}
@@ -7,12 +7,6 @@ import { Database, Obj } from "@dxos/echo";
7
7
  import { trim } from "@dxos/util";
8
8
  import * as Operation from "@dxos/compute/Operation";
9
9
  //#region src/skills/delegation/operations/delegate-tasks.ts
10
- /**
11
- * Delegates existing checklist tasks: each selected task is assigned to an agent and queued, and
12
- * the supervisor's reconcile loop spawns one sub-agent per task once its dependencies are done
13
- * (marking it started at spawn; done/failed on exit). Selectors are 1-based checklist ordinals or
14
- * exact titles, so the model can act on "task 2" as easily as on a name.
15
- */
16
10
  var handler = DelegateTasks.pipe(Operation.withHandler(Effect.fn(function* ({ tasks: selectors }) {
17
11
  if (selectors.length === 0) return yield* Effect.fail(new ToolkitError({ message: "Select at least one task (ordinal or title)." }));
18
12
  const chat = yield* Harness.getChat;
@@ -34,14 +28,14 @@ var handler = DelegateTasks.pipe(Operation.withHandler(Effect.fn(function* ({ ta
34
28
  continue;
35
29
  }
36
30
  Obj.update(task, (task) => {
37
- task.assignee = { role: "assistant" };
31
+ task.delegate = { role: "assistant" };
38
32
  task.status = "todo";
39
33
  });
40
34
  delegated += 1;
41
35
  }
42
36
  yield* Database.flush();
43
37
  return trim`
44
- Delegated ${delegated} task(s) to sub-agents (each starts once its dependencies are done);
38
+ Delegated ${delegated} task(s) to sub-agents (each starts once its dependencies are done or in review);
45
39
  ${skipped.length > 0 ? `skipped: ${skipped.join(", ")}.` : ""}
46
40
 
47
41
  <checklist>
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-delegate-tasks.mjs","names":[],"sources":["../../src/skills/delegation/operations/delegate-tasks.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Harness } from '@dxos/assistant';\nimport * as Chat from '@dxos/assistant/Chat';\nimport * as Operation from '@dxos/compute/Operation';\nimport { Database, Obj } from '@dxos/echo';\nimport { type Task } from '@dxos/types';\nimport { trim } from '@dxos/util';\n\nimport { ToolkitError } from '../../../errors.ts';\nimport { DelegateTasks } from './definitions.ts';\n\n/**\n * Delegates existing checklist tasks: each selected task is assigned to an agent and queued, and\n * the supervisor's reconcile loop spawns one sub-agent per task once its dependencies are done\n * (marking it started at spawn; done/failed on exit). Selectors are 1-based checklist ordinals or\n * exact titles, so the model can act on \"task 2\" as easily as on a name.\n */\nconst handler: Operation.WithHandler<typeof DelegateTasks> = DelegateTasks.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ tasks: selectors }) {\n if (selectors.length === 0) {\n return yield* Effect.fail(new ToolkitError({ message: 'Select at least one task (ordinal or title).' }));\n }\n\n const chat = yield* Harness.getChat;\n const all = yield* Chat.loadTasks(chat);\n if (all.length === 0) {\n return yield* Effect.fail(new ToolkitError({ message: 'The conversation has no tasks to delegate.' }));\n }\n\n const selected = new Map<string, Task.Task>();\n const unmatched: (string | number)[] = [];\n for (const selector of selectors) {\n const task =\n typeof selector === 'number'\n ? all[selector - 1]\n : all.find((candidate) => candidate.title === selector.trim());\n if (task) {\n selected.set(task.id, task);\n } else {\n unmatched.push(selector);\n }\n }\n if (unmatched.length > 0) {\n return yield* Effect.fail(\n new ToolkitError({\n message: `No matching task for: ${unmatched.join(', ')}. Select by 1-based ordinal or exact title.`,\n }),\n );\n }\n\n const skipped: string[] = [];\n let delegated = 0;\n for (const task of selected.values()) {\n // A terminal task has nothing left to run; delegating an already-running one would fork it.\n if (task.status === 'done' || task.status === 'cancelled' || task.status === 'started') {\n skipped.push(`\"${task.title}\" (${task.status})`);\n continue;\n }\n Obj.update(task, (task) => {\n task.assignee = { role: 'assistant' };\n task.status = 'todo';\n });\n delegated += 1;\n }\n yield* Database.flush();\n\n return trim`\n Delegated ${delegated} task(s) to sub-agents (each starts once its dependencies are done);\n ${skipped.length > 0 ? `skipped: ${skipped.join(', ')}.` : ''}\n\n <checklist>\n ${yield* Chat.formatChecklist(chat)}\n </checklist>\n `;\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,IAAM,UAAuD,cAAc,KACzE,UAAU,YACR,OAAO,GAAG,WAAW,EAAE,OAAO,aAAa;CACzC,IAAI,UAAU,WAAW,GACvB,OAAO,OAAO,OAAO,KAAK,IAAI,aAAa,EAAE,SAAS,+CAA+C,CAAC,CAAC;CAGzG,MAAM,OAAO,OAAO,QAAQ;CAC5B,MAAM,MAAM,OAAO,KAAK,UAAU,IAAI;CACtC,IAAI,IAAI,WAAW,GACjB,OAAO,OAAO,OAAO,KAAK,IAAI,aAAa,EAAE,SAAS,6CAA6C,CAAC,CAAC;CAGvG,MAAM,2BAAW,IAAI,IAAuB;CAC5C,MAAM,YAAiC,CAAC;CACxC,KAAK,MAAM,YAAY,WAAW;EAChC,MAAM,OACJ,OAAO,aAAa,WAChB,IAAI,WAAW,KACf,IAAI,MAAM,cAAc,UAAU,UAAU,SAAS,KAAK,CAAC;EACjE,IAAI,MACF,SAAS,IAAI,KAAK,IAAI,IAAI;OAE1B,UAAU,KAAK,QAAQ;CAE3B;CACA,IAAI,UAAU,SAAS,GACrB,OAAO,OAAO,OAAO,KACnB,IAAI,aAAa,EACf,SAAS,yBAAyB,UAAU,KAAK,IAAI,EAAE,6CACzD,CAAC,CACH;CAGF,MAAM,UAAoB,CAAC;CAC3B,IAAI,YAAY;CAChB,KAAK,MAAM,QAAQ,SAAS,OAAO,GAAG;EAEpC,IAAI,KAAK,WAAW,UAAU,KAAK,WAAW,eAAe,KAAK,WAAW,WAAW;GACtF,QAAQ,KAAK,IAAI,KAAK,MAAM,KAAK,KAAK,OAAO,EAAE;GAC/C;EACF;EACA,IAAI,OAAO,OAAO,SAAS;GACzB,KAAK,WAAW,EAAE,MAAM,YAAY;GACpC,KAAK,SAAS;EAChB,CAAC;EACD,aAAa;CACf;CACA,OAAO,SAAS,MAAM;CAEtB,OAAO,IAAI;oBACG,UAAU;UACpB,QAAQ,SAAS,IAAI,YAAY,QAAQ,KAAK,IAAI,EAAE,KAAK,GAAE;;;YAGzD,OAAO,KAAK,gBAAgB,IAAI,EAAC;;;AAGzC,CAAC,CACH,CACF"}
1
+ {"version":3,"file":"chunk-delegate-tasks.mjs","names":[],"sources":["../../src/skills/delegation/operations/delegate-tasks.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Harness } from '@dxos/assistant';\nimport * as Chat from '@dxos/assistant/Chat';\nimport * as Operation from '@dxos/compute/Operation';\nimport { Database, Obj } from '@dxos/echo';\nimport { type Task } from '@dxos/types';\nimport { trim } from '@dxos/util';\n\nimport { ToolkitError } from '../../../errors.ts';\nimport { DelegateTasks } from './definitions.ts';\n\nconst handler: Operation.WithHandler<typeof DelegateTasks> = DelegateTasks.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ tasks: selectors }) {\n if (selectors.length === 0) {\n return yield* Effect.fail(new ToolkitError({ message: 'Select at least one task (ordinal or title).' }));\n }\n\n const chat = yield* Harness.getChat;\n const all = yield* Chat.loadTasks(chat);\n if (all.length === 0) {\n return yield* Effect.fail(new ToolkitError({ message: 'The conversation has no tasks to delegate.' }));\n }\n\n const selected = new Map<string, Task.Task>();\n const unmatched: (string | number)[] = [];\n for (const selector of selectors) {\n const task =\n typeof selector === 'number'\n ? all[selector - 1]\n : all.find((candidate) => candidate.title === selector.trim());\n if (task) {\n selected.set(task.id, task);\n } else {\n unmatched.push(selector);\n }\n }\n if (unmatched.length > 0) {\n return yield* Effect.fail(\n new ToolkitError({\n message: `No matching task for: ${unmatched.join(', ')}. Select by 1-based ordinal or exact title.`,\n }),\n );\n }\n\n const skipped: string[] = [];\n let delegated = 0;\n for (const task of selected.values()) {\n // A terminal task has nothing left to run; delegating an already-running one would fork it.\n if (task.status === 'done' || task.status === 'cancelled' || task.status === 'started') {\n skipped.push(`\"${task.title}\" (${task.status})`);\n continue;\n }\n Obj.update(task, (task) => {\n task.delegate = { role: 'assistant' };\n task.status = 'todo';\n });\n delegated += 1;\n }\n yield* Database.flush();\n\n return trim`\n Delegated ${delegated} task(s) to sub-agents (each starts once its dependencies are done or in review);\n ${skipped.length > 0 ? `skipped: ${skipped.join(', ')}.` : ''}\n\n <checklist>\n ${yield* Chat.formatChecklist(chat)}\n </checklist>\n `;\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;;;;;AAgBA,IAAM,UAAuD,cAAc,KACzE,UAAU,YACR,OAAO,GAAG,WAAW,EAAE,OAAO,aAAa;CACzC,IAAI,UAAU,WAAW,GACvB,OAAO,OAAO,OAAO,KAAK,IAAI,aAAa,EAAE,SAAS,+CAA+C,CAAC,CAAC;CAGzG,MAAM,OAAO,OAAO,QAAQ;CAC5B,MAAM,MAAM,OAAO,KAAK,UAAU,IAAI;CACtC,IAAI,IAAI,WAAW,GACjB,OAAO,OAAO,OAAO,KAAK,IAAI,aAAa,EAAE,SAAS,6CAA6C,CAAC,CAAC;CAGvG,MAAM,2BAAW,IAAI,IAAuB;CAC5C,MAAM,YAAiC,CAAC;CACxC,KAAK,MAAM,YAAY,WAAW;EAChC,MAAM,OACJ,OAAO,aAAa,WAChB,IAAI,WAAW,KACf,IAAI,MAAM,cAAc,UAAU,UAAU,SAAS,KAAK,CAAC;EACjE,IAAI,MACF,SAAS,IAAI,KAAK,IAAI,IAAI;OAE1B,UAAU,KAAK,QAAQ;CAE3B;CACA,IAAI,UAAU,SAAS,GACrB,OAAO,OAAO,OAAO,KACnB,IAAI,aAAa,EACf,SAAS,yBAAyB,UAAU,KAAK,IAAI,EAAE,6CACzD,CAAC,CACH;CAGF,MAAM,UAAoB,CAAC;CAC3B,IAAI,YAAY;CAChB,KAAK,MAAM,QAAQ,SAAS,OAAO,GAAG;EAEpC,IAAI,KAAK,WAAW,UAAU,KAAK,WAAW,eAAe,KAAK,WAAW,WAAW;GACtF,QAAQ,KAAK,IAAI,KAAK,MAAM,KAAK,KAAK,OAAO,EAAE;GAC/C;EACF;EACA,IAAI,OAAO,OAAO,SAAS;GACzB,KAAK,WAAW,EAAE,MAAM,YAAY;GACpC,KAAK,SAAS;EAChB,CAAC;EACD,aAAa;CACf;CACA,OAAO,SAAS,MAAM;CAEtB,OAAO,IAAI;oBACG,UAAU;UACpB,QAAQ,SAAS,IAAI,YAAY,QAAQ,KAAK,IAAI,EAAE,KAAK,GAAG;;;YAG1D,OAAO,KAAK,gBAAgB,IAAI,EAAE;;;AAG1C,CAAC,CACH,CACF"}
@@ -1,4 +1,4 @@
1
- import { n as EnableSkills } from "./chunk-operations2.mjs";
1
+ import { r as EnableSkills } from "./chunk-operations2.mjs";
2
2
  import * as Effect from "effect/Effect";
3
3
  import { Harness } from "@dxos/assistant";
4
4
  import { Ref } from "@dxos/echo";
@@ -1,4 +1,4 @@
1
- import { n as GetContext } from "./chunk-operations7.mjs";
1
+ import { n as GetContext } from "./chunk-operations6.mjs";
2
2
  import * as Effect from "effect/Effect";
3
3
  import { Harness, HarnessContextError } from "@dxos/assistant";
4
4
  import * as Agent from "@dxos/assistant/Agent";
@@ -1,4 +1,4 @@
1
- import { n as GetCurrentDate } from "./chunk-operations6.mjs";
1
+ import { n as GetCurrentDate } from "./chunk-operations5.mjs";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Operation from "@dxos/compute/Operation";
4
4
  import * as Clock from "effect/Clock";
@@ -0,0 +1,26 @@
1
+ import * as Effect from "effect/Effect";
2
+ import { AiContext } from "@dxos/assistant";
3
+ import { Database, Filter, Obj, Registry } from "@dxos/echo";
4
+ import { Connection } from "@dxos/link";
5
+ //#region src/skills/skill-manager/operations/mcp-connections.ts
6
+ /** The MCP servers a conversation can connect: the space's connections, then the registry's built-ins. */
7
+ var mcpConnections = Effect.gen(function* () {
8
+ const space = yield* Database.query(Filter.type(Connection.Connection)).run;
9
+ const builtin = (yield* Registry.runQuery(Filter.type(Connection.Connection))).filter(Connection.isBuiltin);
10
+ return [...space, ...builtin];
11
+ });
12
+ /** How the Skill Manager lists a connection: a built-in server by its key, which is what the agent passes back. */
13
+ var describe = (connection, states) => {
14
+ const builtin = Connection.isBuiltin(connection);
15
+ return {
16
+ id: builtin ? Obj.getMeta(connection).key ?? connection.id : connection.id,
17
+ name: connection.name,
18
+ connectorId: connection.connectorId,
19
+ enabled: AiContext.isConnectionOn(states, connection),
20
+ ...builtin ? { builtin } : {}
21
+ };
22
+ };
23
+ //#endregion
24
+ export { mcpConnections as n, describe as t };
25
+
26
+ //# sourceMappingURL=chunk-mcp-connections.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-mcp-connections.mjs","names":[],"sources":["../../src/skills/skill-manager/operations/mcp-connections.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { AiContext } from '@dxos/assistant';\nimport { Database, Filter, Obj, Registry } from '@dxos/echo';\nimport { type URI } from '@dxos/keys';\nimport { Connection } from '@dxos/link';\n\n/** The MCP servers a conversation can connect: the space's connections, then the registry's built-ins. */\nexport const mcpConnections = Effect.gen(function* () {\n const space = yield* Database.query(Filter.type(Connection.Connection)).run;\n const builtin = (yield* Registry.runQuery(Filter.type(Connection.Connection))).filter(Connection.isBuiltin);\n return [...space, ...builtin];\n});\n\n/** How the Skill Manager lists a connection: a built-in server by its key, which is what the agent passes back. */\nexport const describe = (connection: Connection.Connection, states: ReadonlyMap<URI.URI, boolean>) => {\n const builtin = Connection.isBuiltin(connection);\n return {\n id: builtin ? (Obj.getMeta(connection).key ?? connection.id) : connection.id,\n name: connection.name,\n connectorId: connection.connectorId,\n enabled: AiContext.isConnectionOn(states, connection),\n ...(builtin ? { builtin } : {}),\n };\n};\n"],"mappings":";;;;;;AAYA,IAAa,iBAAiB,OAAO,IAAI,aAAa;CACpD,MAAM,QAAQ,OAAO,SAAS,MAAM,OAAO,KAAK,WAAW,UAAU,CAAC,CAAC,CAAC;CACxE,MAAM,WAAW,OAAO,SAAS,SAAS,OAAO,KAAK,WAAW,UAAU,CAAC,EAAA,CAAG,OAAO,WAAW,SAAS;CAC1G,OAAO,CAAC,GAAG,OAAO,GAAG,OAAO;AAC9B,CAAC;;AAGD,IAAa,YAAY,YAAmC,WAA0C;CACpG,MAAM,UAAU,WAAW,UAAU,UAAU;CAC/C,OAAO;EACL,IAAI,UAAW,IAAI,QAAQ,UAAU,CAAC,CAAC,OAAO,WAAW,KAAM,WAAW;EAC1E,MAAM,WAAW;EACjB,aAAa,WAAW;EACxB,SAAS,UAAU,eAAe,QAAQ,UAAU;EACpD,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC;CAC/B;AACF"}
@@ -34,8 +34,8 @@ var DelegateTasks = Operation.make({
34
34
  description: trim`
35
35
  Delegate one or more EXISTING tasks from the conversation's checklist to background
36
36
  sub-agents. Select tasks by their checklist ordinal (1-based number) or exact title.
37
- Each selected task is assigned to an agent; the supervisor spawns one sub-agent per task
38
- once the task's dependencies are done, and reports each result back to the conversation.
37
+ Each selected task is handed to an agent; the supervisor spawns one sub-agent per task
38
+ once the task's dependencies are done or in review, and reports each result back to the conversation.
39
39
  `,
40
40
  icon: "ph--share-network--regular"
41
41
  },
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-operations.mjs","names":["DXN"],"sources":["../../src/skills/delegation/operations/definitions.ts","../../src/skills/delegation/operations/index.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Harness } from '@dxos/assistant';\nimport * as Operation from '@dxos/compute/Operation';\nimport { Database } from '@dxos/echo';\nimport { DXN } from '@dxos/keys';\nimport { trim } from '@dxos/util';\n\nexport const DelegateTask = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.assistantToolkit.delegateTask'),\n name: 'Delegate task',\n description: trim`\n Delegate a NEW unit of work to a sub-agent.\n Creates a durable task assigned to an agent; the supervisor spawns a background sub-agent\n for it and reports the result back to the conversation. To delegate tasks that already\n exist on the checklist, use delegate-tasks instead.\n `,\n icon: 'ph--share-network--regular',\n },\n input: Schema.Struct({\n title: Schema.String.annotate({\n description: 'Title of the work to delegate (matched against the checklist, created if new).',\n }),\n }),\n output: Schema.Any,\n services: [Harness.HarnessService, Database.Service],\n});\n\nexport const DelegateTasks = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.assistantToolkit.delegateTasks'),\n name: 'Delegate tasks',\n description: trim`\n Delegate one or more EXISTING tasks from the conversation's checklist to background\n sub-agents. Select tasks by their checklist ordinal (1-based number) or exact title.\n Each selected task is assigned to an agent; the supervisor spawns one sub-agent per task\n once the task's dependencies are done, and reports each result back to the conversation.\n `,\n icon: 'ph--share-network--regular',\n },\n input: Schema.Struct({\n tasks: Schema.Array(Schema.Union([Schema.Number, Schema.String])).annotate({\n description: 'Tasks to delegate: 1-based checklist ordinals and/or exact titles.',\n }),\n }),\n output: Schema.Any,\n services: [Harness.HarnessService, Database.Service],\n});\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Operation from '@dxos/compute/Operation';\nimport * as OperationHandlerSet from '@dxos/compute/OperationHandlerSet';\n\nimport { DelegateTask, DelegateTasks } from './definitions.ts';\n\nexport * as DelegationSkillOperations from './definitions.ts';\n\nexport const DelegationSkillHandlers = OperationHandlerSet.lazy([\n DelegateTask.pipe(Operation.lazyHandler(() => import('./delegate-task.ts'))),\n DelegateTasks.pipe(Operation.lazyHandler(() => import('./delegate-tasks.ts'))),\n]);\n"],"mappings":";;;;;;;;;;;;;AAYA,IAAa,eAAe,UAAU,KAAK;CACzC,MAAM;EACJ,KAAKA,MAAI,KAAK,kDAAkD;EAChE,MAAM;EACN,aAAa,IAAI;;;;;;EAMjB,MAAM;CACR;CACA,OAAO,OAAO,OAAO,EACnB,OAAO,OAAO,OAAO,SAAS,EAC5B,aAAa,iFACf,CAAC,EACH,CAAC;CACD,QAAQ,OAAO;CACf,UAAU,CAAC,QAAQ,gBAAgB,SAAS,OAAO;AACrD,CAAC;AAED,IAAa,gBAAgB,UAAU,KAAK;CAC1C,MAAM;EACJ,KAAKA,MAAI,KAAK,mDAAmD;EACjE,MAAM;EACN,aAAa,IAAI;;;;;;EAMjB,MAAM;CACR;CACA,OAAO,OAAO,OAAO,EACnB,OAAO,OAAO,MAAM,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,EACzE,aAAa,qEACf,CAAC,EACH,CAAC;CACD,QAAQ,OAAO;CACf,UAAU,CAAC,QAAQ,gBAAgB,SAAS,OAAO;AACrD,CAAC;;;ACzCD,IAAa,0BAA0B,oBAAoB,KAAK,CAC9D,aAAa,KAAK,UAAU,kBAAkB,OAAO,4BAAqB,CAAC,GAC3E,cAAc,KAAK,UAAU,kBAAkB,OAAO,6BAAsB,CAAC,CAC/E,CAAC"}
1
+ {"version":3,"file":"chunk-operations.mjs","names":["DXN"],"sources":["../../src/skills/delegation/operations/definitions.ts","../../src/skills/delegation/operations/index.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Harness } from '@dxos/assistant';\nimport * as Operation from '@dxos/compute/Operation';\nimport { Database } from '@dxos/echo';\nimport { DXN } from '@dxos/keys';\nimport { trim } from '@dxos/util';\n\nexport const DelegateTask = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.assistantToolkit.delegateTask'),\n name: 'Delegate task',\n description: trim`\n Delegate a NEW unit of work to a sub-agent.\n Creates a durable task assigned to an agent; the supervisor spawns a background sub-agent\n for it and reports the result back to the conversation. To delegate tasks that already\n exist on the checklist, use delegate-tasks instead.\n `,\n icon: 'ph--share-network--regular',\n },\n input: Schema.Struct({\n title: Schema.String.annotate({\n description: 'Title of the work to delegate (matched against the checklist, created if new).',\n }),\n }),\n output: Schema.Any,\n services: [Harness.HarnessService, Database.Service],\n});\n\nexport const DelegateTasks = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.assistantToolkit.delegateTasks'),\n name: 'Delegate tasks',\n description: trim`\n Delegate one or more EXISTING tasks from the conversation's checklist to background\n sub-agents. Select tasks by their checklist ordinal (1-based number) or exact title.\n Each selected task is handed to an agent; the supervisor spawns one sub-agent per task\n once the task's dependencies are done or in review, and reports each result back to the conversation.\n `,\n icon: 'ph--share-network--regular',\n },\n input: Schema.Struct({\n tasks: Schema.Array(Schema.Union([Schema.Number, Schema.String])).annotate({\n description: 'Tasks to delegate: 1-based checklist ordinals and/or exact titles.',\n }),\n }),\n output: Schema.Any,\n services: [Harness.HarnessService, Database.Service],\n});\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Operation from '@dxos/compute/Operation';\nimport * as OperationHandlerSet from '@dxos/compute/OperationHandlerSet';\n\nimport { DelegateTask, DelegateTasks } from './definitions.ts';\n\nexport * as DelegationSkillOperations from './definitions.ts';\n\nexport const DelegationSkillHandlers = OperationHandlerSet.lazy([\n DelegateTask.pipe(Operation.lazyHandler(() => import('./delegate-task.ts'))),\n DelegateTasks.pipe(Operation.lazyHandler(() => import('./delegate-tasks.ts'))),\n]);\n"],"mappings":";;;;;;;;;;;;;AAYA,IAAa,eAAe,UAAU,KAAK;CACzC,MAAM;EACJ,KAAKA,MAAI,KAAK,kDAAkD;EAChE,MAAM;EACN,aAAa,IAAI;;;;;;EAMjB,MAAM;CACR;CACA,OAAO,OAAO,OAAO,EACnB,OAAO,OAAO,OAAO,SAAS,EAC5B,aAAa,iFACf,CAAC,EACH,CAAC;CACD,QAAQ,OAAO;CACf,UAAU,CAAC,QAAQ,gBAAgB,SAAS,OAAO;AACrD,CAAC;AAED,IAAa,gBAAgB,UAAU,KAAK;CAC1C,MAAM;EACJ,KAAKA,MAAI,KAAK,mDAAmD;EACjE,MAAM;EACN,aAAa,IAAI;;;;;;EAMjB,MAAM;CACR;CACA,OAAO,OAAO,OAAO,EACnB,OAAO,OAAO,MAAM,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,EACzE,aAAa,qEACf,CAAC,EACH,CAAC;CACD,QAAQ,OAAO;CACf,UAAU,CAAC,QAAQ,gBAAgB,SAAS,OAAO;AACrD,CAAC;;;ACzCD,IAAa,0BAA0B,oBAAoB,KAAK,CAC9D,aAAa,KAAK,UAAU,kBAAkB,OAAO,4BAAqB,CAAC,GAC3E,cAAc,KAAK,UAAU,kBAAkB,OAAO,6BAAsB,CAAC,CAC/E,CAAC"}
@@ -8,30 +8,94 @@ import * as Operation from "@dxos/compute/Operation";
8
8
  import * as OperationHandlerSet from "@dxos/compute/OperationHandlerSet";
9
9
  //#region src/skills/skill-manager/operations/definitions.ts
10
10
  var definitions_exports = /* @__PURE__ */ __exportAll({
11
+ AddMcpConnection: () => AddMcpConnection,
11
12
  EnableSkills: () => EnableSkills,
12
- QuerySkills: () => QuerySkills
13
+ QueryMcpConnections: () => QueryMcpConnections,
14
+ QueryOperations: () => QueryOperations,
15
+ QuerySkills: () => QuerySkills,
16
+ QueryTypes: () => QueryTypes,
17
+ SetMcpConnection: () => SetMcpConnection
18
+ });
19
+ /** An operation of a skill, as the lookups below describe it. */
20
+ var ListedOperation = Schema.Struct({
21
+ key: Schema.String.annotate({ description: "The operation key." }),
22
+ tool: Schema.String.annotate({ description: "Its tool name." }),
23
+ name: Schema.optional(Schema.String),
24
+ description: Schema.optional(Schema.String),
25
+ skill: Schema.String.annotate({ description: "Key of the skill that provides it." }),
26
+ enabled: Schema.Boolean.annotate({ description: "Whether its skill is enabled in this conversation, so it can be used now." }),
27
+ input: Schema.optional(Schema.String).annotate({ description: "Its input, e.g. `{ title: string, owner?: Ref<org.dxos.type.person> }`; given when looked up by key." })
28
+ });
29
+ /** A skill, as `query-skills` describes it. */
30
+ var ListedSkill = Schema.Struct({
31
+ key: Schema.String,
32
+ name: Schema.String,
33
+ description: Schema.optional(Schema.String),
34
+ enabled: Schema.Boolean.annotate({ description: "Whether the skill is enabled in this conversation." }),
35
+ agentCanEnable: Schema.Boolean.annotate({ description: "Whether `enable-skills` may enable it." }),
36
+ instructions: Schema.optional(Schema.String).annotate({ description: "The skill's instructions; given when looked up by key." }),
37
+ operations: Schema.optional(Schema.Array(ListedOperation)).annotate({ description: "Its operations; given when looked up by key." })
38
+ });
39
+ /** A registered type, as `query-types` describes it. */
40
+ var ListedType = Schema.Struct({
41
+ typename: Schema.String,
42
+ dxn: Schema.String.annotate({ description: "The versioned DXN the type resolves by." }),
43
+ kind: Schema.Literals(["object", "relation"]),
44
+ fields: Schema.optional(Schema.String).annotate({ description: "Its fields; given when looked up by typename." })
13
45
  });
14
46
  var QuerySkills = Operation.make({
15
47
  meta: {
16
48
  key: DXN$1.make("org.dxos.operation.assistantToolkit.querySkills"),
17
49
  name: "Query skills",
18
- description: "Queries available skills.",
50
+ description: "Queries available skills, each saying whether it is enabled here and whether you may enable it. Pass `query` to find the skill that provides a tool you lack: the words are matched against skill names, descriptions and tool names, best match first. Pass `keys` to get those skills in full: their instructions and operations.",
19
51
  icon: "ph--student--regular"
20
52
  },
21
- input: Schema.Struct({}),
22
- output: Schema.Array(Type.getSchema(Skill.Skill)),
23
- services: [Registry.Service]
53
+ input: Schema.Struct({
54
+ query: Schema.optional(Schema.String).annotate({ description: "Words describing the tool or capability you need, e.g. \"link task to feature\"." }),
55
+ keys: Schema.optional(Schema.Array(Schema.String)).annotate({ description: "Skills to return in full." })
56
+ }),
57
+ output: Schema.Array(ListedSkill),
58
+ services: [Registry.Service, Harness.HarnessService]
59
+ });
60
+ var QueryOperations = Operation.make({
61
+ meta: {
62
+ key: DXN$1.make("org.dxos.operation.assistantToolkit.queryOperations"),
63
+ name: "Query operations",
64
+ description: "Searches the operations of the skills you can use (enabled here, or ones you may enable) by what they do; `skill` narrows to one skill's. Pass `keys` to get each in full, with its input.",
65
+ icon: "ph--magnifying-glass--regular"
66
+ },
67
+ input: Schema.Struct({
68
+ query: Schema.optional(Schema.String).annotate({ description: "Words describing what the operation does." }),
69
+ skill: Schema.optional(Schema.String).annotate({ description: "Only this skill's operations." }),
70
+ keys: Schema.optional(Schema.Array(Schema.String)).annotate({ description: "Operations to return in full." })
71
+ }),
72
+ output: Schema.Array(ListedOperation),
73
+ services: [Registry.Service, Harness.HarnessService]
74
+ });
75
+ var QueryTypes = Operation.make({
76
+ meta: {
77
+ key: DXN$1.make("org.dxos.operation.assistantToolkit.queryTypes"),
78
+ name: "Query types",
79
+ description: "Searches the registered object and relation types. Pass `typenames` to get their fields.",
80
+ icon: "ph--shapes--regular"
81
+ },
82
+ input: Schema.Struct({
83
+ query: Schema.optional(Schema.String).annotate({ description: "Words in the type or field names." }),
84
+ typenames: Schema.optional(Schema.Array(Schema.String)).annotate({ description: "Types to return with their fields, by typename or DXN." })
85
+ }),
86
+ output: Schema.Array(ListedType),
87
+ services: [Database.Service]
24
88
  });
25
89
  var EnableSkills = Operation.make({
26
90
  meta: {
27
91
  key: DXN$1.make("org.dxos.operation.assistantToolkit.enableSkills"),
28
92
  name: "Enable skills",
29
- description: "Enables skills in the current conversation by their keys. Only skills with agentCanEnable=true can be enabled. The available keys are already listed in the system prompt, so call this directly rather than querying first.",
93
+ description: "Enables skills in the current conversation by their keys, as query-skills lists them. Only skills with agentCanEnable=true can be enabled.",
30
94
  icon: "ph--plugs-connected--regular"
31
95
  },
32
96
  input: Schema.Struct({ keys: Schema.Array(Schema.String).annotate({
33
97
  description: "The keys of the skills to enable.",
34
- examples: [["org.dxos.skill.memory", "org.dxos.skill.database"]]
98
+ examples: [["org.dxos.skill.planning", "org.dxos.skill.database"]]
35
99
  }) }),
36
100
  output: Schema.Struct({
37
101
  enabled: Schema.Array(Type.getSchema(Skill.Skill)),
@@ -46,10 +110,81 @@ var EnableSkills = Operation.make({
46
110
  Harness.HarnessService
47
111
  ]
48
112
  });
113
+ var McpConnection = Schema.Struct({
114
+ id: Schema.String.annotate({ description: "The connection's id, or a built-in server's key." }),
115
+ name: Schema.optional(Schema.String),
116
+ connectorId: Schema.optional(Schema.String),
117
+ enabled: Schema.Boolean.annotate({ description: "Whether this conversation connects its MCP server." }),
118
+ builtin: Schema.optional(Schema.Boolean).annotate({ description: "A server Composer ships rather than a connection the space holds; off until turned on." })
119
+ });
120
+ var QueryMcpConnections = Operation.make({
121
+ meta: {
122
+ key: DXN$1.make("org.dxos.operation.assistantToolkit.queryMcpConnections"),
123
+ name: "Query MCP connections",
124
+ description: "Lists the MCP servers this conversation can connect and whether each is on: the space's connections, on unless the conversation turned them off, and the built-in servers Composer ships (such as Browser), off until turned on. A connection is not a skill: a skill whose tools come from one needs both.",
125
+ icon: "ph--plugs-connected--regular"
126
+ },
127
+ input: Schema.Struct({}),
128
+ output: Schema.Array(McpConnection),
129
+ services: [
130
+ Database.Service,
131
+ Registry.Service,
132
+ Harness.HarnessService
133
+ ]
134
+ });
135
+ var SetMcpConnection = Operation.make({
136
+ meta: {
137
+ key: DXN$1.make("org.dxos.operation.assistantToolkit.setMcpConnection"),
138
+ name: "Set MCP connection",
139
+ description: "Turns a connection's MCP server on or off for this conversation; enabling a skill does not do this. Its tools appear or disappear from your next step, so keep going in this response.",
140
+ icon: "ph--plugs-connected--regular"
141
+ },
142
+ input: Schema.Struct({
143
+ id: Schema.String.annotate({ description: "The connection's id or the built-in server's key, as the query lists it." }),
144
+ enabled: Schema.Boolean
145
+ }),
146
+ output: McpConnection,
147
+ services: [
148
+ Database.Service,
149
+ Registry.Service,
150
+ Harness.HarnessService
151
+ ]
152
+ });
153
+ var AddMcpConnection = Operation.make({
154
+ meta: {
155
+ key: DXN$1.make("org.dxos.operation.assistantToolkit.addMcpConnection"),
156
+ name: "Add MCP connection",
157
+ description: "Adds an MCP server to the space as a connection, with no credential or with an API key, or updates the connection the space already has for it. It is on in this conversation, so its tools are available from your next step. A server that needs sign-in can't be added this way: ask the user to connect it.",
158
+ icon: "ph--plugs-connected--regular"
159
+ },
160
+ input: Schema.Struct({
161
+ url: Schema.String.annotate({
162
+ description: "The server's MCP endpoint.",
163
+ examples: ["https://mcp.example.com/mcp"]
164
+ }),
165
+ name: Schema.optional(Schema.String).annotate({ description: "Defaults to the URL host." }),
166
+ protocol: Schema.optional(Schema.Literals(["http", "sse"])).annotate({ description: "Streamable HTTP unless the server only speaks the deprecated SSE transport." }),
167
+ key: Schema.optional(Schema.String).annotate({ description: "An API key the server takes as a Bearer token. It is stored in the space, readable by every member." })
168
+ }),
169
+ output: Schema.Struct({
170
+ ...McpConnection.fields,
171
+ tools: Schema.optional(Schema.Array(Schema.String)).annotate({ description: "The tools the server listed." }),
172
+ problem: Schema.optional(Schema.String).annotate({ description: "Why the server could not be reached just now; the connection is still added." })
173
+ }),
174
+ services: [Database.Service, Harness.HarnessService]
175
+ });
49
176
  //#endregion
50
177
  //#region src/skills/skill-manager/operations/index.ts
51
- var SkillManagerHandlers = OperationHandlerSet.lazy([QuerySkills.pipe(Operation.lazyHandler(() => import("./chunk-query-skills.mjs"))), EnableSkills.pipe(Operation.lazyHandler(() => import("./chunk-enable-skills.mjs")))]);
178
+ var SkillManagerHandlers = OperationHandlerSet.lazy([
179
+ QuerySkills.pipe(Operation.lazyHandler(() => import("./chunk-query-skills.mjs"))),
180
+ QueryOperations.pipe(Operation.lazyHandler(() => import("./chunk-query-operations.mjs"))),
181
+ QueryTypes.pipe(Operation.lazyHandler(() => import("./chunk-query-types.mjs"))),
182
+ EnableSkills.pipe(Operation.lazyHandler(() => import("./chunk-enable-skills.mjs"))),
183
+ AddMcpConnection.pipe(Operation.lazyHandler(() => import("./chunk-add-mcp-connection.mjs"))),
184
+ QueryMcpConnections.pipe(Operation.lazyHandler(() => import("./chunk-query-mcp-connections.mjs"))),
185
+ SetMcpConnection.pipe(Operation.lazyHandler(() => import("./chunk-set-mcp-connection.mjs")))
186
+ ]);
52
187
  //#endregion
53
- export { definitions_exports as i, EnableSkills as n, QuerySkills as r, SkillManagerHandlers as t };
188
+ export { QueryOperations as a, SetMcpConnection as c, QueryMcpConnections as i, definitions_exports as l, AddMcpConnection as n, QuerySkills as o, EnableSkills as r, QueryTypes as s, SkillManagerHandlers as t };
54
189
 
55
190
  //# sourceMappingURL=chunk-operations2.mjs.map