@agimon-ai/doompi-extension-contracts 0.0.1-alpha.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 (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/dist/backgroundWork.cjs +2 -0
  4. package/dist/backgroundWork.cjs.map +1 -0
  5. package/dist/backgroundWork.d.cts +73 -0
  6. package/dist/backgroundWork.d.cts.map +1 -0
  7. package/dist/backgroundWork.d.mts +73 -0
  8. package/dist/backgroundWork.d.mts.map +1 -0
  9. package/dist/backgroundWork.mjs +2 -0
  10. package/dist/backgroundWork.mjs.map +1 -0
  11. package/dist/childProcess.cjs +2 -0
  12. package/dist/childProcess.cjs.map +1 -0
  13. package/dist/childProcess.d.cts +20 -0
  14. package/dist/childProcess.d.cts.map +1 -0
  15. package/dist/childProcess.d.mts +20 -0
  16. package/dist/childProcess.d.mts.map +1 -0
  17. package/dist/childProcess.mjs +2 -0
  18. package/dist/childProcess.mjs.map +1 -0
  19. package/dist/config.cjs +2 -0
  20. package/dist/config.cjs.map +1 -0
  21. package/dist/config.d.cts +517 -0
  22. package/dist/config.d.cts.map +1 -0
  23. package/dist/config.d.mts +517 -0
  24. package/dist/config.d.mts.map +1 -0
  25. package/dist/config.mjs +2 -0
  26. package/dist/config.mjs.map +1 -0
  27. package/dist/delegation.cjs +2 -0
  28. package/dist/delegation.cjs.map +1 -0
  29. package/dist/delegation.d.cts +114 -0
  30. package/dist/delegation.d.cts.map +1 -0
  31. package/dist/delegation.d.mts +114 -0
  32. package/dist/delegation.d.mts.map +1 -0
  33. package/dist/delegation.mjs +2 -0
  34. package/dist/delegation.mjs.map +1 -0
  35. package/dist/fablePlan.cjs +2 -0
  36. package/dist/fablePlan.cjs.map +1 -0
  37. package/dist/fablePlan.d.cts +143 -0
  38. package/dist/fablePlan.d.cts.map +1 -0
  39. package/dist/fablePlan.d.mts +143 -0
  40. package/dist/fablePlan.d.mts.map +1 -0
  41. package/dist/fablePlan.mjs +2 -0
  42. package/dist/fablePlan.mjs.map +1 -0
  43. package/dist/footer.cjs +2 -0
  44. package/dist/footer.cjs.map +1 -0
  45. package/dist/footer.d.cts +141 -0
  46. package/dist/footer.d.cts.map +1 -0
  47. package/dist/footer.d.mts +141 -0
  48. package/dist/footer.d.mts.map +1 -0
  49. package/dist/footer.mjs +2 -0
  50. package/dist/footer.mjs.map +1 -0
  51. package/dist/index.cjs +1 -0
  52. package/dist/index.d.cts +2 -0
  53. package/dist/index.d.mts +2 -0
  54. package/dist/index.mjs +1 -0
  55. package/dist/leader.cjs +2 -0
  56. package/dist/leader.cjs.map +1 -0
  57. package/dist/leader.d.cts +171 -0
  58. package/dist/leader.d.cts.map +1 -0
  59. package/dist/leader.d.mts +171 -0
  60. package/dist/leader.d.mts.map +1 -0
  61. package/dist/leader.mjs +2 -0
  62. package/dist/leader.mjs.map +1 -0
  63. package/dist/mcpStatus.cjs +2 -0
  64. package/dist/mcpStatus.cjs.map +1 -0
  65. package/dist/mcpStatus.d.cts +79 -0
  66. package/dist/mcpStatus.d.cts.map +1 -0
  67. package/dist/mcpStatus.d.mts +79 -0
  68. package/dist/mcpStatus.d.mts.map +1 -0
  69. package/dist/mcpStatus.mjs +2 -0
  70. package/dist/mcpStatus.mjs.map +1 -0
  71. package/dist/mode.cjs +2 -0
  72. package/dist/mode.cjs.map +1 -0
  73. package/dist/mode.d.cts +132 -0
  74. package/dist/mode.d.cts.map +1 -0
  75. package/dist/mode.d.mts +132 -0
  76. package/dist/mode.d.mts.map +1 -0
  77. package/dist/mode.mjs +2 -0
  78. package/dist/mode.mjs.map +1 -0
  79. package/dist/protocol.cjs +2 -0
  80. package/dist/protocol.cjs.map +1 -0
  81. package/dist/protocol.d.cts +83 -0
  82. package/dist/protocol.d.cts.map +1 -0
  83. package/dist/protocol.d.mts +83 -0
  84. package/dist/protocol.d.mts.map +1 -0
  85. package/dist/protocol.mjs +2 -0
  86. package/dist/protocol.mjs.map +1 -0
  87. package/dist/runnerPty.cjs +2 -0
  88. package/dist/runnerPty.cjs.map +1 -0
  89. package/dist/runnerPty.d.cts +39 -0
  90. package/dist/runnerPty.d.cts.map +1 -0
  91. package/dist/runnerPty.d.mts +39 -0
  92. package/dist/runnerPty.d.mts.map +1 -0
  93. package/dist/runnerPty.mjs +2 -0
  94. package/dist/runnerPty.mjs.map +1 -0
  95. package/dist/skills.cjs +2 -0
  96. package/dist/skills.cjs.map +1 -0
  97. package/dist/skills.d.cts +51 -0
  98. package/dist/skills.d.cts.map +1 -0
  99. package/dist/skills.d.mts +51 -0
  100. package/dist/skills.d.mts.map +1 -0
  101. package/dist/skills.mjs +2 -0
  102. package/dist/skills.mjs.map +1 -0
  103. package/dist/subagentPolicy.cjs +2 -0
  104. package/dist/subagentPolicy.cjs.map +1 -0
  105. package/dist/subagentPolicy.d.cts +47 -0
  106. package/dist/subagentPolicy.d.cts.map +1 -0
  107. package/dist/subagentPolicy.d.mts +47 -0
  108. package/dist/subagentPolicy.d.mts.map +1 -0
  109. package/dist/subagentPolicy.mjs +2 -0
  110. package/dist/subagentPolicy.mjs.map +1 -0
  111. package/dist/subagentTool.cjs +2 -0
  112. package/dist/subagentTool.cjs.map +1 -0
  113. package/dist/subagentTool.d.cts +78 -0
  114. package/dist/subagentTool.d.cts.map +1 -0
  115. package/dist/subagentTool.d.mts +78 -0
  116. package/dist/subagentTool.d.mts.map +1 -0
  117. package/dist/subagentTool.mjs +2 -0
  118. package/dist/subagentTool.mjs.map +1 -0
  119. package/dist/workflow.cjs +2 -0
  120. package/dist/workflow.cjs.map +1 -0
  121. package/dist/workflow.d.cts +15 -0
  122. package/dist/workflow.d.cts.map +1 -0
  123. package/dist/workflow.d.mts +15 -0
  124. package/dist/workflow.d.mts.map +1 -0
  125. package/dist/workflow.mjs +2 -0
  126. package/dist/workflow.mjs.map +1 -0
  127. package/package.json +121 -0
@@ -0,0 +1,39 @@
1
+ import { NotificationDefinition, RequestReplyDefinition } from "./protocol.cjs";
2
+ import { Static, Type } from "typebox";
3
+ //#region src/runnerPty.d.ts
4
+ declare const RunnerPtyLaunchProtocol: RequestReplyDefinition<Type.TObject<{
5
+ id: Type.TString;
6
+ /** Shown in the runner list, so it should read as a task rather than a command. */
7
+ name: Type.TString;
8
+ command: Type.TString;
9
+ cwd: Type.TString;
10
+ cols: Type.TOptional<Type.TInteger>;
11
+ rows: Type.TOptional<Type.TInteger>;
12
+ }>, Type.TObject<{
13
+ launched: Type.TBoolean;
14
+ /** Why not, when the host has no pty available. */
15
+ reason: Type.TOptional<Type.TString>;
16
+ }>>;
17
+ /** Terminal output as it arrives. Chunks are raw, so they may split mid-line. */
18
+ declare const RunnerPtyData: NotificationDefinition<Type.TObject<{
19
+ id: Type.TString;
20
+ chunk: Type.TString;
21
+ }>>;
22
+ declare const RunnerPtyExit: NotificationDefinition<Type.TObject<{
23
+ id: Type.TString;
24
+ code: Type.TOptional<Type.TInteger>;
25
+ signal: Type.TOptional<Type.TString>;
26
+ }>>;
27
+ /** Types into the terminal. The host appends the newline. */
28
+ declare const RunnerPtyInput: NotificationDefinition<Type.TObject<{
29
+ id: Type.TString;
30
+ text: Type.TString;
31
+ }>>;
32
+ declare const RunnerPtyStop: NotificationDefinition<Type.TObject<{
33
+ id: Type.TString;
34
+ }>>;
35
+ type RunnerPtyLaunchRequest = Static<typeof RunnerPtyLaunchProtocol.request>;
36
+ type RunnerPtyLaunchResponse = Static<typeof RunnerPtyLaunchProtocol.response>;
37
+ //#endregion
38
+ export { RunnerPtyData, RunnerPtyExit, RunnerPtyInput, RunnerPtyLaunchProtocol, RunnerPtyLaunchRequest, RunnerPtyLaunchResponse, RunnerPtyStop };
39
+ //# sourceMappingURL=runnerPty.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runnerPty.d.cts","names":[],"sources":["../src/runnerPty.ts"],"mappings":";;;cAwBa,gDAAuB,KAAA;;;;;;;;;;;;;;cA8BvB,eAAa,uBAAA,KAAA;;;;cAMb,eAAa,uBAAA,KAAA;;;;;;cAcb,gBAAc,uBAAA,KAAA;;;;cAMd,eAAa,uBAAA,KAAA;;;KAMd,yBAAyB,cAAc,wBAAwB;KAC/D,0BAA0B,cAAc,wBAAwB"}
@@ -0,0 +1,39 @@
1
+ import { NotificationDefinition, RequestReplyDefinition } from "./protocol.mjs";
2
+ import { Static, Type } from "typebox";
3
+ //#region src/runnerPty.d.ts
4
+ declare const RunnerPtyLaunchProtocol: RequestReplyDefinition<Type.TObject<{
5
+ id: Type.TString;
6
+ /** Shown in the runner list, so it should read as a task rather than a command. */
7
+ name: Type.TString;
8
+ command: Type.TString;
9
+ cwd: Type.TString;
10
+ cols: Type.TOptional<Type.TInteger>;
11
+ rows: Type.TOptional<Type.TInteger>;
12
+ }>, Type.TObject<{
13
+ launched: Type.TBoolean;
14
+ /** Why not, when the host has no pty available. */
15
+ reason: Type.TOptional<Type.TString>;
16
+ }>>;
17
+ /** Terminal output as it arrives. Chunks are raw, so they may split mid-line. */
18
+ declare const RunnerPtyData: NotificationDefinition<Type.TObject<{
19
+ id: Type.TString;
20
+ chunk: Type.TString;
21
+ }>>;
22
+ declare const RunnerPtyExit: NotificationDefinition<Type.TObject<{
23
+ id: Type.TString;
24
+ code: Type.TOptional<Type.TInteger>;
25
+ signal: Type.TOptional<Type.TString>;
26
+ }>>;
27
+ /** Types into the terminal. The host appends the newline. */
28
+ declare const RunnerPtyInput: NotificationDefinition<Type.TObject<{
29
+ id: Type.TString;
30
+ text: Type.TString;
31
+ }>>;
32
+ declare const RunnerPtyStop: NotificationDefinition<Type.TObject<{
33
+ id: Type.TString;
34
+ }>>;
35
+ type RunnerPtyLaunchRequest = Static<typeof RunnerPtyLaunchProtocol.request>;
36
+ type RunnerPtyLaunchResponse = Static<typeof RunnerPtyLaunchProtocol.response>;
37
+ //#endregion
38
+ export { RunnerPtyData, RunnerPtyExit, RunnerPtyInput, RunnerPtyLaunchProtocol, RunnerPtyLaunchRequest, RunnerPtyLaunchResponse, RunnerPtyStop };
39
+ //# sourceMappingURL=runnerPty.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runnerPty.d.mts","names":[],"sources":["../src/runnerPty.ts"],"mappings":";;;cAwBa,gDAAuB,KAAA;;;;;;;;;;;;;;cA8BvB,eAAa,uBAAA,KAAA;;;;cAMb,eAAa,uBAAA,KAAA;;;;;;cAcb,gBAAc,uBAAA,KAAA;;;;cAMd,eAAa,uBAAA,KAAA;;;KAMd,yBAAyB,cAAc,wBAAwB;KAC/D,0BAA0B,cAAc,wBAAwB"}
@@ -0,0 +1,2 @@
1
+ import{defineNotification as e,defineRequestReply as t}from"./protocol.mjs";import{Type as n}from"typebox";const r=n.String({minLength:1,maxLength:128,pattern:`^[A-Za-z0-9][A-Za-z0-9._:-]*$`}),i=t({channels:{request:`doom:runner:pty:v1:launch`,response:`doom:runner:pty:v1:launched`,error:`doom:runner:pty:v1:error`},kinds:{request:`runner-pty.launch`,response:`runner-pty.launched`},request:n.Object({id:r,name:n.String({minLength:1,maxLength:64}),command:n.String({minLength:1,maxLength:4096}),cwd:n.String({minLength:1,maxLength:4096}),cols:n.Optional(n.Integer({minimum:20,maximum:500})),rows:n.Optional(n.Integer({minimum:5,maximum:200}))},{additionalProperties:!1}),response:n.Object({launched:n.Boolean(),reason:n.Optional(n.String({minLength:1,maxLength:240}))},{additionalProperties:!1})}),a=e({channel:`doom:runner:pty:v1:data`,kind:`runner-pty.data`,payload:n.Object({id:r,chunk:n.String({maxLength:65536})},{additionalProperties:!1})}),o=e({channel:`doom:runner:pty:v1:exit`,kind:`runner-pty.exit`,payload:n.Object({id:r,code:n.Optional(n.Integer({minimum:-1,maximum:255})),signal:n.Optional(n.String({minLength:1,maxLength:32}))},{additionalProperties:!1})}),s=e({channel:`doom:runner:pty:v1:input`,kind:`runner-pty.input`,payload:n.Object({id:r,text:n.String({maxLength:4096})},{additionalProperties:!1})}),c=e({channel:`doom:runner:pty:v1:stop`,kind:`runner-pty.stop`,payload:n.Object({id:r},{additionalProperties:!1})});export{a as RunnerPtyData,o as RunnerPtyExit,s as RunnerPtyInput,i as RunnerPtyLaunchProtocol,c as RunnerPtyStop};
2
+ //# sourceMappingURL=runnerPty.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runnerPty.mjs","names":[],"sources":["../src/runnerPty.ts"],"sourcesContent":["/**\n * Borrowing a pseudo terminal from doom-runner.\n *\n * Some extensions need to run a command the user has to watch and answer:\n * a package install that asks to proceed, a tool that wants a sudo password.\n * Buffered `spawn` cannot do that, and every extension growing its own pty would\n * mean every extension carrying a native module for it.\n *\n * doom-runner already owns that machinery, so this hands the job to it: the\n * caller asks for a command, receives the terminal's output as it arrives, and\n * can type back into it. The terminal lives and dies with the runner's session,\n * which is what stops an install outliving the window it was started from.\n *\n * The command runs through a login shell, so PATH matches what the user gets in\n * their own terminal. That is the point for installers: `brew` is frequently\n * only on PATH through a profile script.\n */\n\nimport { type Static, Type } from 'typebox';\nimport { defineNotification, defineRequestReply } from './protocol.ts';\n\n/** Caller-chosen and unique to the caller, since the host keys every message by it. */\nconst RunIdSchema = Type.String({ minLength: 1, maxLength: 128, pattern: '^[A-Za-z0-9][A-Za-z0-9._:-]*$' });\n\nexport const RunnerPtyLaunchProtocol = defineRequestReply({\n channels: {\n request: 'doom:runner:pty:v1:launch',\n response: 'doom:runner:pty:v1:launched',\n error: 'doom:runner:pty:v1:error',\n },\n kinds: { request: 'runner-pty.launch', response: 'runner-pty.launched' },\n request: Type.Object(\n {\n id: RunIdSchema,\n /** Shown in the runner list, so it should read as a task rather than a command. */\n name: Type.String({ minLength: 1, maxLength: 64 }),\n command: Type.String({ minLength: 1, maxLength: 4096 }),\n cwd: Type.String({ minLength: 1, maxLength: 4096 }),\n cols: Type.Optional(Type.Integer({ minimum: 20, maximum: 500 })),\n rows: Type.Optional(Type.Integer({ minimum: 5, maximum: 200 })),\n },\n { additionalProperties: false },\n ),\n response: Type.Object(\n {\n launched: Type.Boolean(),\n /** Why not, when the host has no pty available. */\n reason: Type.Optional(Type.String({ minLength: 1, maxLength: 240 })),\n },\n { additionalProperties: false },\n ),\n});\n\n/** Terminal output as it arrives. Chunks are raw, so they may split mid-line. */\nexport const RunnerPtyData = defineNotification({\n channel: 'doom:runner:pty:v1:data',\n kind: 'runner-pty.data',\n payload: Type.Object({ id: RunIdSchema, chunk: Type.String({ maxLength: 65_536 }) }, { additionalProperties: false }),\n});\n\nexport const RunnerPtyExit = defineNotification({\n channel: 'doom:runner:pty:v1:exit',\n kind: 'runner-pty.exit',\n payload: Type.Object(\n {\n id: RunIdSchema,\n code: Type.Optional(Type.Integer({ minimum: -1, maximum: 255 })),\n signal: Type.Optional(Type.String({ minLength: 1, maxLength: 32 })),\n },\n { additionalProperties: false },\n ),\n});\n\n/** Types into the terminal. The host appends the newline. */\nexport const RunnerPtyInput = defineNotification({\n channel: 'doom:runner:pty:v1:input',\n kind: 'runner-pty.input',\n payload: Type.Object({ id: RunIdSchema, text: Type.String({ maxLength: 4096 }) }, { additionalProperties: false }),\n});\n\nexport const RunnerPtyStop = defineNotification({\n channel: 'doom:runner:pty:v1:stop',\n kind: 'runner-pty.stop',\n payload: Type.Object({ id: RunIdSchema }, { additionalProperties: false }),\n});\n\nexport type RunnerPtyLaunchRequest = Static<typeof RunnerPtyLaunchProtocol.request>;\nexport type RunnerPtyLaunchResponse = Static<typeof RunnerPtyLaunchProtocol.response>;\n"],"mappings":"2GAsBA,MAAM,EAAc,EAAK,OAAO,CAAE,UAAW,EAAG,UAAW,IAAK,QAAS,+BAAgC,CAAC,EAE7F,EAA0B,EAAmB,CACxD,SAAU,CACR,QAAS,4BACT,SAAU,8BACV,MAAO,0BACT,EACA,MAAO,CAAE,QAAS,oBAAqB,SAAU,qBAAsB,EACvE,QAAS,EAAK,OACZ,CACE,GAAI,EAEJ,KAAM,EAAK,OAAO,CAAE,UAAW,EAAG,UAAW,EAAG,CAAC,EACjD,QAAS,EAAK,OAAO,CAAE,UAAW,EAAG,UAAW,IAAK,CAAC,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 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./protocol.cjs");let t=require("typebox");const n=t.Type.String({minLength:1,maxLength:128,pattern:`^[A-Za-z0-9@][A-Za-z0-9@/._:-]*$`}),r=t.Type.Object({source:n,directories:t.Type.Array(t.Type.String({minLength:1}))},{additionalProperties:!1}),i=t.Type.Object({contribution:r,generation:t.Type.String({minLength:1})},{additionalProperties:!1}),a=e.defineRequestReply({channels:{request:`doom:pi:skills:v1:register`,response:`doom:pi:skills:v1:registered`,error:`doom:pi:skills:v1:error`},kinds:{request:`skills.register`,response:`skills.registered`},request:i,response:t.Type.Object({handleId:t.Type.String({minLength:1})},{additionalProperties:!1})}),o=e.defineRequestReply({channels:{request:`doom:pi:skills:v1:unregister`,response:`doom:pi:skills:v1:unregistered`,error:`doom:pi:skills:v1:unregister-error`},kinds:{request:`skills.unregister`,response:`skills.unregistered`},request:t.Type.Object({handleId:t.Type.String({minLength:1})},{additionalProperties:!1}),response:t.Type.Object({removed:t.Type.Boolean()},{additionalProperties:!1})});function s(t){t instanceof e.DoomProtocolError&&t.code===e.DOOM_PROTOCOL_ERROR_CODE.timeout||queueMicrotask(()=>{throw t instanceof Error?t:Error(String(t))})}function c(t,n){let r=[...n.directories],i,c,l=0,u=!1,d=Promise.resolve(),f=(e,t)=>e.request(o,{handleId:t},{timeoutMs:250}).then(()=>void 0).catch(s),p=()=>{let e=i,t=c;c=void 0,!(!e||!t)&&(d=d.then(()=>f(e,t)))};return t.on(`session_start`,(o,m)=>{if(u)return;p();let h=++l,g=e.createProtocolRuntime({bus:t.events,source:n.source,sessionId:m.sessionManager.getSessionId()});i=g,d=d.then(async()=>{let e=await g.request(a,{contribution:{source:n.source,directories:r},generation:String(h)},{timeoutMs:250});if(u||l!==h||i!==g){await f(g,e.handleId);return}c=e.handleId}).catch(s)}),t.on(`session_shutdown`,()=>{l+=1,p(),i=void 0}),()=>{u=!0,l+=1,p(),i=void 0}}exports.SkillSourceContributionSchema=r,exports.SkillSourceNameSchema=n,exports.SkillSourceRegistrationProtocol=a,exports.SkillSourceRegistrationSchema=i,exports.SkillSourceUnregistrationProtocol=o,exports.registerDoomSkillSource=c;
2
+ //# sourceMappingURL=skills.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.cjs","names":["Type","defineRequestReply","DoomProtocolError","DOOM_PROTOCOL_ERROR_CODE","createProtocolRuntime"],"sources":["../src/skills.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\nimport type { DoomExtensionHost } from './config.ts';\nimport {\n createProtocolRuntime,\n defineRequestReply,\n DOOM_PROTOCOL_ERROR_CODE,\n DoomProtocolError,\n type ProtocolRuntime,\n} from './protocol.ts';\n\nexport const SkillSourceNameSchema = Type.String({\n minLength: 1,\n maxLength: 128,\n pattern: '^[A-Za-z0-9@][A-Za-z0-9@/._:-]*$',\n});\n\nexport const SkillSourceContributionSchema = Type.Object(\n {\n source: SkillSourceNameSchema,\n /** Absolute directories, the same ones the source hands `resources_discover`. */\n directories: Type.Array(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\nexport interface SkillSourceContribution {\n source: string;\n directories: readonly string[];\n}\n\nexport const SkillSourceRegistrationSchema = Type.Object(\n { contribution: SkillSourceContributionSchema, generation: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\nexport type SkillSourceRegistration = Static<typeof SkillSourceRegistrationSchema>;\n\n/**\n * An extension declaring where its own skills live.\n *\n * Pi hands `resources_discover` results straight to its resource loader and\n * keeps no extension-facing record of who contributed what, so a surface that\n * wants to attribute a skill to the package that shipped it has to be told\n * separately. Shaped after the leader registry: the host provides, contributors\n * request, and a contribution is replaced by source rather than merged.\n */\nexport const SkillSourceRegistrationProtocol = defineRequestReply({\n channels: {\n request: 'doom:pi:skills:v1:register',\n response: 'doom:pi:skills:v1:registered',\n error: 'doom:pi:skills:v1:error',\n },\n kinds: { request: 'skills.register', response: 'skills.registered' },\n request: SkillSourceRegistrationSchema,\n response: Type.Object({ handleId: Type.String({ minLength: 1 }) }, { additionalProperties: false }),\n});\n\nexport const SkillSourceUnregistrationProtocol = defineRequestReply({\n channels: {\n request: 'doom:pi:skills:v1:unregister',\n response: 'doom:pi:skills:v1:unregistered',\n error: 'doom:pi:skills:v1:unregister-error',\n },\n kinds: { request: 'skills.unregister', response: 'skills.unregistered' },\n request: Type.Object({ handleId: Type.String({ minLength: 1 }) }, { additionalProperties: false }),\n response: Type.Object({ removed: Type.Boolean() }, { additionalProperties: false }),\n});\n\nconst SKILL_SOURCE_TIMEOUT_MS = 250;\n\nfunction handleOptionalSkillSourceFailure(error: unknown): void {\n if (error instanceof DoomProtocolError && error.code === DOOM_PROTOCOL_ERROR_CODE.timeout) return;\n queueMicrotask(() => {\n throw error instanceof Error ? error : new Error(String(error));\n });\n}\n\nexport function registerDoomSkillSource(pi: DoomExtensionHost, contribution: SkillSourceContribution): () => void {\n const directories = [...contribution.directories];\n let runtime: ProtocolRuntime | undefined;\n let handleId: string | undefined;\n let generation = 0;\n let stopped = false;\n let queue: Promise<void> = Promise.resolve();\n\n const drop = (activeRuntime: ProtocolRuntime, activeHandle: string): Promise<void> =>\n activeRuntime\n .request(SkillSourceUnregistrationProtocol, { handleId: activeHandle }, { timeoutMs: SKILL_SOURCE_TIMEOUT_MS })\n .then(() => undefined)\n .catch(handleOptionalSkillSourceFailure);\n\n const unregister = (): void => {\n const activeRuntime = runtime;\n const activeHandle = handleId;\n handleId = undefined;\n if (!activeRuntime || !activeHandle) return;\n queue = queue.then(() => drop(activeRuntime, activeHandle));\n };\n\n pi.on('session_start', (_event, ctx) => {\n if (stopped) return;\n unregister();\n const activeGeneration = ++generation;\n const activeRuntime = createProtocolRuntime({\n bus: pi.events,\n source: contribution.source,\n sessionId: ctx.sessionManager.getSessionId(),\n });\n runtime = activeRuntime;\n queue = queue\n .then(async () => {\n const registration = await activeRuntime.request(\n SkillSourceRegistrationProtocol,\n {\n contribution: { source: contribution.source, directories },\n generation: String(activeGeneration),\n },\n { timeoutMs: SKILL_SOURCE_TIMEOUT_MS },\n );\n if (stopped || generation !== activeGeneration || runtime !== activeRuntime) {\n await drop(activeRuntime, registration.handleId);\n return;\n }\n handleId = registration.handleId;\n })\n .catch(handleOptionalSkillSourceFailure);\n });\n\n pi.on('session_shutdown', () => {\n generation += 1;\n unregister();\n runtime = undefined;\n });\n\n return () => {\n stopped = true;\n generation += 1;\n unregister();\n runtime = undefined;\n };\n}\n"],"mappings":"8HAUA,MAAa,EAAwBA,EAAAA,KAAK,OAAO,CAC/C,UAAW,EACX,UAAW,IACX,QAAS,kCACX,CAAC,EAEY,EAAgCA,EAAAA,KAAK,OAChD,CACE,OAAQ,EAER,YAAaA,EAAAA,KAAK,MAAMA,EAAAA,KAAK,OAAO,CAAE,UAAW,CAAE,CAAC,CAAC,CACvD,EACA,CAAE,qBAAsB,EAAM,CAChC,EAMa,EAAgCA,EAAAA,KAAK,OAChD,CAAE,aAAc,EAA+B,WAAYA,EAAAA,KAAK,OAAO,CAAE,UAAW,CAAE,CAAC,CAAE,EACzF,CAAE,qBAAsB,EAAM,CAChC,EAYa,EAAkCC,EAAAA,mBAAmB,CAChE,SAAU,CACR,QAAS,6BACT,SAAU,+BACV,MAAO,yBACT,EACA,MAAO,CAAE,QAAS,kBAAmB,SAAU,mBAAoB,EACnE,QAAS,EACT,SAAUD,EAAAA,KAAK,OAAO,CAAE,SAAUA,EAAAA,KAAK,OAAO,CAAE,UAAW,CAAE,CAAC,CAAE,EAAG,CAAE,qBAAsB,EAAM,CAAC,CACpG,CAAC,EAEY,EAAoCC,EAAAA,mBAAmB,CAClE,SAAU,CACR,QAAS,+BACT,SAAU,iCACV,MAAO,oCACT,EACA,MAAO,CAAE,QAAS,oBAAqB,SAAU,qBAAsB,EACvE,QAASD,EAAAA,KAAK,OAAO,CAAE,SAAUA,EAAAA,KAAK,OAAO,CAAE,UAAW,CAAE,CAAC,CAAE,EAAG,CAAE,qBAAsB,EAAM,CAAC,EACjG,SAAUA,EAAAA,KA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AAM,CAAgC,CAC3C,CAAC,EAED,EAAG,GAAG,uBAA0B,CAC9B,GAAc,EACd,EAAW,EACX,EAAU,IAAA,EACZ,CAAC,MAEY,CACX,EAAU,GACV,GAAc,EACd,EAAW,EACX,EAAU,IAAA,EACZ,CACF"}
@@ -0,0 +1,51 @@
1
+ import { RequestReplyDefinition } from "./protocol.cjs";
2
+ import { DoomExtensionHost } from "./config.cjs";
3
+ import { Static, Type } from "typebox";
4
+ //#region src/skills.d.ts
5
+ declare const SkillSourceNameSchema: Type.TString;
6
+ declare const SkillSourceContributionSchema: Type.TObject<{
7
+ source: Type.TString;
8
+ /** Absolute directories, the same ones the source hands `resources_discover`. */
9
+ directories: Type.TArray<Type.TString>;
10
+ }>;
11
+ interface SkillSourceContribution {
12
+ source: string;
13
+ directories: readonly string[];
14
+ }
15
+ declare const SkillSourceRegistrationSchema: Type.TObject<{
16
+ contribution: Type.TObject<{
17
+ source: Type.TString;
18
+ /** Absolute directories, the same ones the source hands `resources_discover`. */
19
+ directories: Type.TArray<Type.TString>;
20
+ }>;
21
+ generation: Type.TString;
22
+ }>;
23
+ type SkillSourceRegistration = Static<typeof SkillSourceRegistrationSchema>;
24
+ /**
25
+ * An extension declaring where its own skills live.
26
+ *
27
+ * Pi hands `resources_discover` results straight to its resource loader and
28
+ * keeps no extension-facing record of who contributed what, so a surface that
29
+ * wants to attribute a skill to the package that shipped it has to be told
30
+ * separately. Shaped after the leader registry: the host provides, contributors
31
+ * request, and a contribution is replaced by source rather than merged.
32
+ */
33
+ declare const SkillSourceRegistrationProtocol: RequestReplyDefinition<Type.TObject<{
34
+ contribution: Type.TObject<{
35
+ source: Type.TString;
36
+ /** Absolute directories, the same ones the source hands `resources_discover`. */
37
+ directories: Type.TArray<Type.TString>;
38
+ }>;
39
+ generation: Type.TString;
40
+ }>, Type.TObject<{
41
+ handleId: Type.TString;
42
+ }>>;
43
+ declare const SkillSourceUnregistrationProtocol: RequestReplyDefinition<Type.TObject<{
44
+ handleId: Type.TString;
45
+ }>, Type.TObject<{
46
+ removed: Type.TBoolean;
47
+ }>>;
48
+ declare function registerDoomSkillSource(pi: DoomExtensionHost, contribution: SkillSourceContribution): () => void;
49
+ //#endregion
50
+ export { SkillSourceContribution, SkillSourceContributionSchema, SkillSourceNameSchema, SkillSourceRegistration, SkillSourceRegistrationProtocol, SkillSourceRegistrationSchema, SkillSourceUnregistrationProtocol, registerDoomSkillSource };
51
+ //# sourceMappingURL=skills.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.d.cts","names":[],"sources":["../src/skills.ts"],"mappings":";;;;cAUa,uBAAqB,KAAA;cAMrB,+BAA6B,KAAA;;;;;UAQzB;EACf;EACA;;cAGW,+BAA6B,KAAA;;;;;;;;KAI9B,0BAA0B,cAAc;;;;;;;;;;cAWvC,wDAA+B,KAAA;;;;;;;;;;cAW/B,0DAAiC,KAAA;;;;;iBAoB9B,wBAAwB,IAAI,mBAAmB,cAAc"}
@@ -0,0 +1,51 @@
1
+ import { RequestReplyDefinition } from "./protocol.mjs";
2
+ import { DoomExtensionHost } from "./config.mjs";
3
+ import { Static, Type } from "typebox";
4
+ //#region src/skills.d.ts
5
+ declare const SkillSourceNameSchema: Type.TString;
6
+ declare const SkillSourceContributionSchema: Type.TObject<{
7
+ source: Type.TString;
8
+ /** Absolute directories, the same ones the source hands `resources_discover`. */
9
+ directories: Type.TArray<Type.TString>;
10
+ }>;
11
+ interface SkillSourceContribution {
12
+ source: string;
13
+ directories: readonly string[];
14
+ }
15
+ declare const SkillSourceRegistrationSchema: Type.TObject<{
16
+ contribution: Type.TObject<{
17
+ source: Type.TString;
18
+ /** Absolute directories, the same ones the source hands `resources_discover`. */
19
+ directories: Type.TArray<Type.TString>;
20
+ }>;
21
+ generation: Type.TString;
22
+ }>;
23
+ type SkillSourceRegistration = Static<typeof SkillSourceRegistrationSchema>;
24
+ /**
25
+ * An extension declaring where its own skills live.
26
+ *
27
+ * Pi hands `resources_discover` results straight to its resource loader and
28
+ * keeps no extension-facing record of who contributed what, so a surface that
29
+ * wants to attribute a skill to the package that shipped it has to be told
30
+ * separately. Shaped after the leader registry: the host provides, contributors
31
+ * request, and a contribution is replaced by source rather than merged.
32
+ */
33
+ declare const SkillSourceRegistrationProtocol: RequestReplyDefinition<Type.TObject<{
34
+ contribution: Type.TObject<{
35
+ source: Type.TString;
36
+ /** Absolute directories, the same ones the source hands `resources_discover`. */
37
+ directories: Type.TArray<Type.TString>;
38
+ }>;
39
+ generation: Type.TString;
40
+ }>, Type.TObject<{
41
+ handleId: Type.TString;
42
+ }>>;
43
+ declare const SkillSourceUnregistrationProtocol: RequestReplyDefinition<Type.TObject<{
44
+ handleId: Type.TString;
45
+ }>, Type.TObject<{
46
+ removed: Type.TBoolean;
47
+ }>>;
48
+ declare function registerDoomSkillSource(pi: DoomExtensionHost, contribution: SkillSourceContribution): () => void;
49
+ //#endregion
50
+ export { SkillSourceContribution, SkillSourceContributionSchema, SkillSourceNameSchema, SkillSourceRegistration, SkillSourceRegistrationProtocol, SkillSourceRegistrationSchema, SkillSourceUnregistrationProtocol, registerDoomSkillSource };
51
+ //# sourceMappingURL=skills.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.d.mts","names":[],"sources":["../src/skills.ts"],"mappings":";;;;cAUa,uBAAqB,KAAA;cAMrB,+BAA6B,KAAA;;;;;UAQzB;EACf;EACA;;cAGW,+BAA6B,KAAA;;;;;;;;KAI9B,0BAA0B,cAAc;;;;;;;;;;cAWvC,wDAA+B,KAAA;;;;;;;;;;cAW/B,0DAAiC,KAAA;;;;;iBAoB9B,wBAAwB,IAAI,mBAAmB,cAAc"}
@@ -0,0 +1,2 @@
1
+ import{DOOM_PROTOCOL_ERROR_CODE as e,DoomProtocolError as t,createProtocolRuntime as n,defineRequestReply as r}from"./protocol.mjs";import{Type as i}from"typebox";const a=i.String({minLength:1,maxLength:128,pattern:`^[A-Za-z0-9@][A-Za-z0-9@/._:-]*$`}),o=i.Object({source:a,directories:i.Array(i.String({minLength:1}))},{additionalProperties:!1}),s=i.Object({contribution:o,generation:i.String({minLength:1})},{additionalProperties:!1}),c=r({channels:{request:`doom:pi:skills:v1:register`,response:`doom:pi:skills:v1:registered`,error:`doom:pi:skills:v1:error`},kinds:{request:`skills.register`,response:`skills.registered`},request:s,response:i.Object({handleId:i.String({minLength:1})},{additionalProperties:!1})}),l=r({channels:{request:`doom:pi:skills:v1:unregister`,response:`doom:pi:skills:v1:unregistered`,error:`doom:pi:skills:v1:unregister-error`},kinds:{request:`skills.unregister`,response:`skills.unregistered`},request:i.Object({handleId:i.String({minLength:1})},{additionalProperties:!1}),response:i.Object({removed:i.Boolean()},{additionalProperties:!1})});function u(n){n instanceof t&&n.code===e.timeout||queueMicrotask(()=>{throw n instanceof Error?n:Error(String(n))})}function d(e,t){let r=[...t.directories],i,a,o=0,s=!1,d=Promise.resolve(),f=(e,t)=>e.request(l,{handleId:t},{timeoutMs:250}).then(()=>void 0).catch(u),p=()=>{let e=i,t=a;a=void 0,!(!e||!t)&&(d=d.then(()=>f(e,t)))};return e.on(`session_start`,(l,m)=>{if(s)return;p();let h=++o,g=n({bus:e.events,source:t.source,sessionId:m.sessionManager.getSessionId()});i=g,d=d.then(async()=>{let e=await g.request(c,{contribution:{source:t.source,directories:r},generation:String(h)},{timeoutMs:250});if(s||o!==h||i!==g){await f(g,e.handleId);return}a=e.handleId}).catch(u)}),e.on(`session_shutdown`,()=>{o+=1,p(),i=void 0}),()=>{s=!0,o+=1,p(),i=void 0}}export{o as SkillSourceContributionSchema,a as SkillSourceNameSchema,c as SkillSourceRegistrationProtocol,s as SkillSourceRegistrationSchema,l as SkillSourceUnregistrationProtocol,d as registerDoomSkillSource};
2
+ //# sourceMappingURL=skills.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.mjs","names":[],"sources":["../src/skills.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\nimport type { DoomExtensionHost } from './config.ts';\nimport {\n createProtocolRuntime,\n defineRequestReply,\n DOOM_PROTOCOL_ERROR_CODE,\n DoomProtocolError,\n type ProtocolRuntime,\n} from './protocol.ts';\n\nexport const SkillSourceNameSchema = Type.String({\n minLength: 1,\n maxLength: 128,\n pattern: '^[A-Za-z0-9@][A-Za-z0-9@/._:-]*$',\n});\n\nexport const SkillSourceContributionSchema = Type.Object(\n {\n source: SkillSourceNameSchema,\n /** Absolute directories, the same ones the source hands `resources_discover`. */\n directories: Type.Array(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\nexport interface SkillSourceContribution {\n source: string;\n directories: readonly string[];\n}\n\nexport const SkillSourceRegistrationSchema = Type.Object(\n { contribution: SkillSourceContributionSchema, generation: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\nexport type SkillSourceRegistration = Static<typeof SkillSourceRegistrationSchema>;\n\n/**\n * An extension declaring where its own skills live.\n *\n * Pi hands `resources_discover` results straight to its resource loader and\n * keeps no extension-facing record of who contributed what, so a surface that\n * wants to attribute a skill to the package that shipped it has to be told\n * separately. Shaped after the leader registry: the host provides, contributors\n * request, and a contribution is replaced by source rather than merged.\n */\nexport const SkillSourceRegistrationProtocol = defineRequestReply({\n channels: {\n request: 'doom:pi:skills:v1:register',\n response: 'doom:pi:skills:v1:registered',\n error: 'doom:pi:skills:v1:error',\n },\n kinds: { request: 'skills.register', response: 'skills.registered' },\n request: SkillSourceRegistrationSchema,\n response: Type.Object({ handleId: Type.String({ minLength: 1 }) }, { additionalProperties: false }),\n});\n\nexport const SkillSourceUnregistrationProtocol = defineRequestReply({\n channels: {\n request: 'doom:pi:skills:v1:unregister',\n response: 'doom:pi:skills:v1:unregistered',\n error: 'doom:pi:skills:v1:unregister-error',\n },\n kinds: { request: 'skills.unregister', response: 'skills.unregistered' },\n request: Type.Object({ handleId: Type.String({ minLength: 1 }) }, { additionalProperties: false }),\n response: Type.Object({ removed: Type.Boolean() }, { additionalProperties: false }),\n});\n\nconst SKILL_SOURCE_TIMEOUT_MS = 250;\n\nfunction handleOptionalSkillSourceFailure(error: unknown): void {\n if (error instanceof DoomProtocolError && error.code === DOOM_PROTOCOL_ERROR_CODE.timeout) return;\n queueMicrotask(() => {\n throw error instanceof Error ? error : new Error(String(error));\n });\n}\n\nexport function registerDoomSkillSource(pi: DoomExtensionHost, contribution: SkillSourceContribution): () => void {\n const directories = [...contribution.directories];\n let runtime: ProtocolRuntime | undefined;\n let handleId: string | undefined;\n let generation = 0;\n let stopped = false;\n let queue: Promise<void> = Promise.resolve();\n\n const drop = (activeRuntime: ProtocolRuntime, activeHandle: string): Promise<void> =>\n activeRuntime\n .request(SkillSourceUnregistrationProtocol, { handleId: activeHandle }, { timeoutMs: SKILL_SOURCE_TIMEOUT_MS })\n .then(() => undefined)\n .catch(handleOptionalSkillSourceFailure);\n\n const unregister = (): void => {\n const activeRuntime = runtime;\n const activeHandle = handleId;\n handleId = undefined;\n if (!activeRuntime || !activeHandle) return;\n queue = queue.then(() => drop(activeRuntime, activeHandle));\n };\n\n pi.on('session_start', (_event, ctx) => {\n if (stopped) return;\n unregister();\n const activeGeneration = ++generation;\n const activeRuntime = createProtocolRuntime({\n bus: pi.events,\n source: contribution.source,\n sessionId: ctx.sessionManager.getSessionId(),\n });\n runtime = activeRuntime;\n queue = queue\n .then(async () => {\n const registration = await activeRuntime.request(\n SkillSourceRegistrationProtocol,\n {\n contribution: { source: contribution.source, directories },\n generation: String(activeGeneration),\n },\n { timeoutMs: SKILL_SOURCE_TIMEOUT_MS },\n );\n if (stopped || generation !== activeGeneration || runtime !== activeRuntime) {\n await drop(activeRuntime, registration.handleId);\n return;\n }\n handleId = registration.handleId;\n })\n .catch(handleOptionalSkillSourceFailure);\n });\n\n pi.on('session_shutdown', () => {\n generation += 1;\n unregister();\n runtime = undefined;\n });\n\n return () => {\n stopped = true;\n generation += 1;\n unregister();\n runtime = undefined;\n };\n}\n"],"mappings":"mKAUA,MAAa,EAAwB,EAAK,OAAO,CAC/C,UAAW,EACX,UAAW,IACX,QAAS,kCACX,C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,CAAC,CAAC,CAC9G,SAAW,IAAA,EAAS,CAAC,CACrB,MAAM,CAAgC,EAErC,MAAyB,CAC7B,IAAM,EAAgB,EAChB,EAAe,EACrB,EAAW,IAAA,GACP,GAAC,GAAiB,CAAC,KACvB,EAAQ,EAAM,SAAW,EAAK,EAAe,CAAY,CAAC,EAC5D,EAqCA,OAnCA,EAAG,GAAG,iBAAkB,EAAQ,IAAQ,CACtC,GAAI,EAAS,OACb,EAAW,EACX,IAAM,EAAmB,EAAE,EACrB,EAAgB,EAAsB,CAC1C,IAAK,EAAG,OACR,OAAQ,EAAa,OACrB,UAAW,EAAI,eAAe,aAAa,CAC7C,CAAC,EACD,EAAU,EACV,EAAQ,EACL,KAAK,SAAY,CAChB,IAAM,EAAe,MAAM,EAAc,QACvC,EACA,CACE,aAAc,CAAE,OAAQ,EAAa,OAAQ,aAAY,EACzD,WAAY,OAAO,CAAgB,CACrC,EACA,CAAE,UAAW,GAAwB,CACvC,EACA,GAAI,GAAW,IAAe,GAAoB,IAAY,EAAe,CAC3E,MAAM,EAAK,EAAe,EAAa,QAAQ,EAC/C,MACF,CACA,EAAW,EAAa,QAC1B,CAAC,CAAC,CACD,MAAM,CAAgC,CAC3C,CAAC,EAED,EAAG,GAAG,uBAA0B,CAC9B,GAAc,EACd,EAAW,EACX,EAAU,IAAA,EACZ,CAAC,MAEY,CACX,EAAU,GACV,GAAc,EACd,EAAW,EACX,EAAU,IAAA,EACZ,CACF"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./protocol.cjs");let t=require("typebox");const n=t.Type.Object({owner:t.Type.String({minLength:1}),allowedTools:t.Type.Optional(t.Type.Array(t.Type.String({minLength:1}))),requiredTools:t.Type.Optional(t.Type.Array(t.Type.String({minLength:1}))),allowMcpTools:t.Type.Optional(t.Type.Boolean()),allowedExternalProfiles:t.Type.Optional(t.Type.Array(t.Type.String({minLength:1,maxLength:128}))),denyExtensions:t.Type.Optional(t.Type.Boolean())},{additionalProperties:!1}),r=t.Type.Object({policy:n,generation:t.Type.String({minLength:1})},{additionalProperties:!1}),i=t.Type.Object({owner:t.Type.String({minLength:1}),generation:t.Type.String({minLength:1})},{additionalProperties:!1}),a=e.defineNotification({channel:`doom:team:policy:v1:discover`,kind:`subagent-policy.discover`,payload:t.Type.Object({},{additionalProperties:!1})}),o=e.defineNotification({channel:`doom:team:policy:v1:register`,kind:`subagent-policy.register`,payload:r}),s=e.defineNotification({channel:`doom:team:policy:v1:changed`,kind:`subagent-policy.changed`,payload:r}),c=e.defineNotification({channel:`doom:team:policy:v1:unregister`,kind:`subagent-policy.unregister`,payload:i});function l(e,t){let n=`${t.owner}:${crypto.randomUUID()}`,r=t,i=!1,l=()=>{i||e.notify(o,{policy:r,generation:n})},u=e.onNotification(a,l);return l(),{update(t){if(i)throw Error(`Cannot update a disposed subagent policy.`);if(t.owner!==r.owner)throw Error(`Cannot change a subagent policy owner.`);r=t,e.notify(s,{policy:r,generation:n})},dispose(){i||(i=!0,u(),e.notify(c,{owner:r.owner,generation:n}))}}}exports.SubagentPolicyChanged=s,exports.SubagentPolicyDiscovery=a,exports.SubagentPolicyRegistration=o,exports.SubagentPolicySchema=n,exports.SubagentPolicyUnregistration=c,exports.registerSubagentPolicy=l;
2
+ //# sourceMappingURL=subagentPolicy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagentPolicy.cjs","names":["Type","defineNotification"],"sources":["../src/subagentPolicy.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\nimport { defineNotification, type ProtocolRuntime } from './protocol.ts';\n\nexport const SubagentPolicySchema = Type.Object(\n {\n owner: Type.String({ minLength: 1 }),\n allowedTools: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),\n requiredTools: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),\n allowMcpTools: Type.Optional(Type.Boolean()),\n allowedExternalProfiles: Type.Optional(Type.Array(Type.String({ minLength: 1, maxLength: 128 }))),\n denyExtensions: Type.Optional(Type.Boolean()),\n },\n { additionalProperties: false },\n);\nexport type SubagentPolicy = Static<typeof SubagentPolicySchema>;\n\nconst SubagentPolicyContributionSchema = Type.Object(\n {\n policy: SubagentPolicySchema,\n generation: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n);\n\nconst SubagentPolicyIdentitySchema = Type.Object(\n {\n owner: Type.String({ minLength: 1 }),\n generation: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n);\n\nexport const SubagentPolicyDiscovery = defineNotification({\n channel: 'doom:team:policy:v1:discover',\n kind: 'subagent-policy.discover',\n payload: Type.Object({}, { additionalProperties: false }),\n});\n\nexport const SubagentPolicyRegistration = defineNotification({\n channel: 'doom:team:policy:v1:register',\n kind: 'subagent-policy.register',\n payload: SubagentPolicyContributionSchema,\n});\n\nexport const SubagentPolicyChanged = defineNotification({\n channel: 'doom:team:policy:v1:changed',\n kind: 'subagent-policy.changed',\n payload: SubagentPolicyContributionSchema,\n});\n\nexport const SubagentPolicyUnregistration = defineNotification({\n channel: 'doom:team:policy:v1:unregister',\n kind: 'subagent-policy.unregister',\n payload: SubagentPolicyIdentitySchema,\n});\n\nexport interface SubagentPolicyHandle {\n update(policy: SubagentPolicy): void;\n dispose(): void;\n}\n\nexport function registerSubagentPolicy(runtime: ProtocolRuntime, initialPolicy: SubagentPolicy): SubagentPolicyHandle {\n const generation = `${initialPolicy.owner}:${crypto.randomUUID()}`;\n let policy = initialPolicy;\n let disposed = false;\n const announce = (): void => {\n if (!disposed) runtime.notify(SubagentPolicyRegistration, { policy, generation });\n };\n const disposeDiscovery = runtime.onNotification(SubagentPolicyDiscovery, announce);\n announce();\n return {\n update(nextPolicy) {\n if (disposed) throw new Error('Cannot update a disposed subagent policy.');\n if (nextPolicy.owner !== policy.owner) throw new Error('Cannot change a subagent policy owner.');\n policy = nextPolicy;\n runtime.notify(SubagentPolicyChanged, { policy, generation });\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n disposeDiscovery();\n runt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QAAS,8BACT,KAAM,0BACN,QAAS,CACX,CAAC,EAEY,EAA+BA,EAAAA,mBAAmB,CAC7D,QAAS,iCACT,KAAM,6BACN,QAAS,CACX,CAAC,EAOD,SAAgB,EAAuB,EAA0B,EAAqD,CACpH,IAAM,EAAa,GAAG,EAAc,MAAM,GAAG,OAAO,WAAW,IAC3D,EAAS,EACT,EAAW,GACT,MAAuB,CACtB,GAAU,EAAQ,OAAO,EAA4B,CAAE,SAAQ,YAAW,CAAC,CAClF,EACM,EAAmB,EAAQ,eAAe,EAAyB,CAAQ,EAEjF,OADA,EAAS,EACF,CACL,OAAO,EAAY,CACjB,GAAI,EAAU,MAAU,MAAM,2CAA2C,EACzE,GAAI,EAAW,QAAU,EAAO,MAAO,MAAU,MAAM,wCAAwC,EAC/F,EAAS,EACT,EAAQ,OAAO,EAAuB,CAAE,SAAQ,YAAW,CAAC,CAC9D,EACA,SAAU,CACJ,IACJ,EAAW,GACX,EAAiB,EACjB,EAAQ,OAAO,EAA8B,CAAE,MAAO,EAAO,MAAO,YAAW,CAAC,EAClF,CACF,CACF"}
@@ -0,0 +1,47 @@
1
+ import { NotificationDefinition, ProtocolRuntime } from "./protocol.cjs";
2
+ import { Static, Type } from "typebox";
3
+ //#region src/subagentPolicy.d.ts
4
+ declare const SubagentPolicySchema: Type.TObject<{
5
+ owner: Type.TString;
6
+ allowedTools: Type.TOptional<Type.TArray<Type.TString>>;
7
+ requiredTools: Type.TOptional<Type.TArray<Type.TString>>;
8
+ allowMcpTools: Type.TOptional<Type.TBoolean>;
9
+ allowedExternalProfiles: Type.TOptional<Type.TArray<Type.TString>>;
10
+ denyExtensions: Type.TOptional<Type.TBoolean>;
11
+ }>;
12
+ type SubagentPolicy = Static<typeof SubagentPolicySchema>;
13
+ declare const SubagentPolicyDiscovery: NotificationDefinition<Type.TObject<{}>>;
14
+ declare const SubagentPolicyRegistration: NotificationDefinition<Type.TObject<{
15
+ policy: Type.TObject<{
16
+ owner: Type.TString;
17
+ allowedTools: Type.TOptional<Type.TArray<Type.TString>>;
18
+ requiredTools: Type.TOptional<Type.TArray<Type.TString>>;
19
+ allowMcpTools: Type.TOptional<Type.TBoolean>;
20
+ allowedExternalProfiles: Type.TOptional<Type.TArray<Type.TString>>;
21
+ denyExtensions: Type.TOptional<Type.TBoolean>;
22
+ }>;
23
+ generation: Type.TString;
24
+ }>>;
25
+ declare const SubagentPolicyChanged: NotificationDefinition<Type.TObject<{
26
+ policy: Type.TObject<{
27
+ owner: Type.TString;
28
+ allowedTools: Type.TOptional<Type.TArray<Type.TString>>;
29
+ requiredTools: Type.TOptional<Type.TArray<Type.TString>>;
30
+ allowMcpTools: Type.TOptional<Type.TBoolean>;
31
+ allowedExternalProfiles: Type.TOptional<Type.TArray<Type.TString>>;
32
+ denyExtensions: Type.TOptional<Type.TBoolean>;
33
+ }>;
34
+ generation: Type.TString;
35
+ }>>;
36
+ declare const SubagentPolicyUnregistration: NotificationDefinition<Type.TObject<{
37
+ owner: Type.TString;
38
+ generation: Type.TString;
39
+ }>>;
40
+ interface SubagentPolicyHandle {
41
+ update(policy: SubagentPolicy): void;
42
+ dispose(): void;
43
+ }
44
+ declare function registerSubagentPolicy(runtime: ProtocolRuntime, initialPolicy: SubagentPolicy): SubagentPolicyHandle;
45
+ //#endregion
46
+ export { SubagentPolicy, SubagentPolicyChanged, SubagentPolicyDiscovery, SubagentPolicyHandle, SubagentPolicyRegistration, SubagentPolicySchema, SubagentPolicyUnregistration, registerSubagentPolicy };
47
+ //# sourceMappingURL=subagentPolicy.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagentPolicy.d.cts","names":[],"sources":["../src/subagentPolicy.ts"],"mappings":";;;cAGa,sBAAoB,KAAA;;;;;;;;KAWrB,iBAAiB,cAAc;cAkB9B,yBAAuB,uBAAA,KAAA;cAMvB,4BAA0B,uBAAA,KAAA;;;;;;;;;;;cAM1B,uBAAqB,uBAAA,KAAA;;;;;;;;;;;cAMrB,8BAA4B,uBAAA,KAAA;;;;UAMxB;EACf,OAAO,QAAQ;EACf;;iBAGc,uBAAuB,SAAS,iBAAiB,eAAe,iBAAiB"}
@@ -0,0 +1,47 @@
1
+ import { NotificationDefinition, ProtocolRuntime } from "./protocol.mjs";
2
+ import { Static, Type } from "typebox";
3
+ //#region src/subagentPolicy.d.ts
4
+ declare const SubagentPolicySchema: Type.TObject<{
5
+ owner: Type.TString;
6
+ allowedTools: Type.TOptional<Type.TArray<Type.TString>>;
7
+ requiredTools: Type.TOptional<Type.TArray<Type.TString>>;
8
+ allowMcpTools: Type.TOptional<Type.TBoolean>;
9
+ allowedExternalProfiles: Type.TOptional<Type.TArray<Type.TString>>;
10
+ denyExtensions: Type.TOptional<Type.TBoolean>;
11
+ }>;
12
+ type SubagentPolicy = Static<typeof SubagentPolicySchema>;
13
+ declare const SubagentPolicyDiscovery: NotificationDefinition<Type.TObject<{}>>;
14
+ declare const SubagentPolicyRegistration: NotificationDefinition<Type.TObject<{
15
+ policy: Type.TObject<{
16
+ owner: Type.TString;
17
+ allowedTools: Type.TOptional<Type.TArray<Type.TString>>;
18
+ requiredTools: Type.TOptional<Type.TArray<Type.TString>>;
19
+ allowMcpTools: Type.TOptional<Type.TBoolean>;
20
+ allowedExternalProfiles: Type.TOptional<Type.TArray<Type.TString>>;
21
+ denyExtensions: Type.TOptional<Type.TBoolean>;
22
+ }>;
23
+ generation: Type.TString;
24
+ }>>;
25
+ declare const SubagentPolicyChanged: NotificationDefinition<Type.TObject<{
26
+ policy: Type.TObject<{
27
+ owner: Type.TString;
28
+ allowedTools: Type.TOptional<Type.TArray<Type.TString>>;
29
+ requiredTools: Type.TOptional<Type.TArray<Type.TString>>;
30
+ allowMcpTools: Type.TOptional<Type.TBoolean>;
31
+ allowedExternalProfiles: Type.TOptional<Type.TArray<Type.TString>>;
32
+ denyExtensions: Type.TOptional<Type.TBoolean>;
33
+ }>;
34
+ generation: Type.TString;
35
+ }>>;
36
+ declare const SubagentPolicyUnregistration: NotificationDefinition<Type.TObject<{
37
+ owner: Type.TString;
38
+ generation: Type.TString;
39
+ }>>;
40
+ interface SubagentPolicyHandle {
41
+ update(policy: SubagentPolicy): void;
42
+ dispose(): void;
43
+ }
44
+ declare function registerSubagentPolicy(runtime: ProtocolRuntime, initialPolicy: SubagentPolicy): SubagentPolicyHandle;
45
+ //#endregion
46
+ export { SubagentPolicy, SubagentPolicyChanged, SubagentPolicyDiscovery, SubagentPolicyHandle, SubagentPolicyRegistration, SubagentPolicySchema, SubagentPolicyUnregistration, registerSubagentPolicy };
47
+ //# sourceMappingURL=subagentPolicy.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagentPolicy.d.mts","names":[],"sources":["../src/subagentPolicy.ts"],"mappings":";;;cAGa,sBAAoB,KAAA;;;;;;;;KAWrB,iBAAiB,cAAc;cAkB9B,yBAAuB,uBAAA,KAAA;cAMvB,4BAA0B,uBAAA,KAAA;;;;;;;;;;;cAM1B,uBAAqB,uBAAA,KAAA;;;;;;;;;;;cAMrB,8BAA4B,uBAAA,KAAA;;;;UAMxB;EACf,OAAO,QAAQ;EACf;;iBAGc,uBAAuB,SAAS,iBAAiB,eAAe,iBAAiB"}
@@ -0,0 +1,2 @@
1
+ import{defineNotification as e}from"./protocol.mjs";import{Type as t}from"typebox";const n=t.Object({owner:t.String({minLength:1}),allowedTools:t.Optional(t.Array(t.String({minLength:1}))),requiredTools:t.Optional(t.Array(t.String({minLength:1}))),allowMcpTools:t.Optional(t.Boolean()),allowedExternalProfiles:t.Optional(t.Array(t.String({minLength:1,maxLength:128}))),denyExtensions:t.Optional(t.Boolean())},{additionalProperties:!1}),r=t.Object({policy:n,generation:t.String({minLength:1})},{additionalProperties:!1}),i=t.Object({owner:t.String({minLength:1}),generation:t.String({minLength:1})},{additionalProperties:!1}),a=e({channel:`doom:team:policy:v1:discover`,kind:`subagent-policy.discover`,payload:t.Object({},{additionalProperties:!1})}),o=e({channel:`doom:team:policy:v1:register`,kind:`subagent-policy.register`,payload:r}),s=e({channel:`doom:team:policy:v1:changed`,kind:`subagent-policy.changed`,payload:r}),c=e({channel:`doom:team:policy:v1:unregister`,kind:`subagent-policy.unregister`,payload:i});function l(e,t){let n=`${t.owner}:${crypto.randomUUID()}`,r=t,i=!1,l=()=>{i||e.notify(o,{policy:r,generation:n})},u=e.onNotification(a,l);return l(),{update(t){if(i)throw Error(`Cannot update a disposed subagent policy.`);if(t.owner!==r.owner)throw Error(`Cannot change a subagent policy owner.`);r=t,e.notify(s,{policy:r,generation:n})},dispose(){i||(i=!0,u(),e.notify(c,{owner:r.owner,generation:n}))}}}export{s as SubagentPolicyChanged,a as SubagentPolicyDiscovery,o as SubagentPolicyRegistration,n as SubagentPolicySchema,c as SubagentPolicyUnregistration,l as registerSubagentPolicy};
2
+ //# sourceMappingURL=subagentPolicy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagentPolicy.mjs","names":[],"sources":["../src/subagentPolicy.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\nimport { defineNotification, type ProtocolRuntime } from './protocol.ts';\n\nexport const SubagentPolicySchema = Type.Object(\n {\n owner: Type.String({ minLength: 1 }),\n allowedTools: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),\n requiredTools: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),\n allowMcpTools: Type.Optional(Type.Boolean()),\n allowedExternalProfiles: Type.Optional(Type.Array(Type.String({ minLength: 1, maxLength: 128 }))),\n denyExtensions: Type.Optional(Type.Boolean()),\n },\n { additionalProperties: false },\n);\nexport type SubagentPolicy = Static<typeof SubagentPolicySchema>;\n\nconst SubagentPolicyContributionSchema = Type.Object(\n {\n policy: SubagentPolicySchema,\n generation: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n);\n\nconst SubagentPolicyIdentitySchema = Type.Object(\n {\n owner: Type.String({ minLength: 1 }),\n generation: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n);\n\nexport const SubagentPolicyDiscovery = defineNotification({\n channel: 'doom:team:policy:v1:discover',\n kind: 'subagent-policy.discover',\n payload: Type.Object({}, { additionalProperties: false }),\n});\n\nexport const SubagentPolicyRegistration = defineNotification({\n channel: 'doom:team:policy:v1:register',\n kind: 'subagent-policy.register',\n payload: SubagentPolicyContributionSchema,\n});\n\nexport const SubagentPolicyChanged = defineNotification({\n channel: 'doom:team:policy:v1:changed',\n kind: 'subagent-policy.changed',\n payload: SubagentPolicyContributionSchema,\n});\n\nexport const SubagentPolicyUnregistration = defineNotification({\n channel: 'doom:team:policy:v1:unregister',\n kind: 'subagent-policy.unregister',\n payload: SubagentPolicyIdentitySchema,\n});\n\nexport interface SubagentPolicyHandle {\n update(policy: SubagentPolicy): void;\n dispose(): void;\n}\n\nexport function registerSubagentPolicy(runtime: ProtocolRuntime, initialPolicy: SubagentPolicy): SubagentPolicyHandle {\n const generation = `${initialPolicy.owner}:${crypto.randomUUID()}`;\n let policy = initialPolicy;\n let disposed = false;\n const announce = (): void => {\n if (!disposed) runtime.notify(SubagentPolicyRegistration, { policy, generation });\n };\n const disposeDiscovery = runtime.onNotification(SubagentPolicyDiscovery, announce);\n announce();\n return {\n update(nextPolicy) {\n if (disposed) throw new Error('Cannot update a disposed subagent policy.');\n if (nextPolicy.owner !== policy.owner) throw new Error('Cannot change a subagent policy owner.');\n policy = nextPolicy;\n runtime.notify(SubagentPolicyChanged, { policy, generation });\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n disposeDiscovery();\n runtime.notify(SubagentPolicyUnregistration, { owner: policy.owner, generation });\n },\n };\n}\n"],"mappings":"mFAGA,MAAa,EAAuB,EAAK,OACvC,CACE,MAAO,EAAK,OAAO,CAAE,UAAW,CAAE,CAAC,EACnC,aAAc,EAAK,SAAS,EAAK,MAAM,EAAK,OAAO,CAAE,UAAW,CAAE,CAAC,CAAC,CAAC,EACrE,cAAe,EAAK,SAAS,EAAK,MAAM,EAAK,OAAO,CAAE,UAAW,CAAE,CAAC,CAAC,CAAC,EACtE,cAAe,EAAK,SAAS,E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AC,CAC9D,EACA,SAAU,CACJ,IACJ,EAAW,GACX,EAAiB,EACjB,EAAQ,OAAO,EAA8B,CAAE,MAAO,EAAO,MAAO,YAAW,CAAC,EAClF,CACF,CACF"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("typebox");const t={agents:`agents`,run:`run`,status:`status`,wait:`wait`,steer:`steer`,stop:`stop`,suspended:`suspended`,restore:`restore`},n={agents:[`action`,`name`,`cwd`,`scope`],run:[`action`,`requests`,`concurrency`,`artifacts`,`scope`],status:[`action`,`id`,`transcriptLines`],wait:[`action`,`ids`,`until`,`timeoutMs`],steer:[`action`,`id`,`message`],stop:[`action`,`id`,`reason`],suspended:[`action`],restore:[`action`,`id`]},r=new Set(Object.values(t));function i(e){return typeof e==`string`&&r.has(e)}function a(e,t){return n[e].includes(t)}const o=e.Type.Union([e.Type.Literal(`user`),e.Type.Literal(`project`),e.Type.Literal(`both`)]),s=e.Type.Union([e.Type.Literal(`completion`),e.Type.Literal(`attention`),e.Type.Literal(`any`)]),c=e.Type.Object({systemPrompt:e.Type.String({minLength:1})},{additionalProperties:!1}),l=e.Type.Object({agent:e.Type.String({minLength:1}),inlineAgent:e.Type.Optional(c),task:e.Type.String({minLength:1}),cwd:e.Type.Optional(e.Type.String({minLength:1})),model:e.Type.Optional(e.Type.String({minLength:1})),runtime:e.Type.Optional(e.Type.String({minLength:1}))},{additionalProperties:!1}),u=e.Type.Object({action:e.Type.Literal(t.agents),name:e.Type.Optional(e.Type.String({minLength:1})),cwd:e.Type.Optional(e.Type.String({minLength:1})),scope:e.Type.Optional(o)},{additionalProperties:!1}),d=e.Type.Object({action:e.Type.Literal(t.run),requests:e.Type.Array(l,{minItems:1}),concurrency:e.Type.Optional(e.Type.Integer({minimum:1})),artifacts:e.Type.Optional(e.Type.Boolean()),scope:e.Type.Optional(o)},{additionalProperties:!1}),f=e.Type.Object({action:e.Type.Literal(t.status)},{additionalProperties:!1}),p=e.Type.Object({action:e.Type.Literal(t.status),id:e.Type.String({minLength:1}),transcriptLines:e.Type.Optional(e.Type.Integer({minimum:1,maximum:500}))},{additionalProperties:!1}),m=e.Type.Object({action:e.Type.Literal(t.wait),ids:e.Type.Optional(e.Type.Array(e.Type.String({minLength:1}),{minItems:1})),until:e.Type.Optional(s),timeoutMs:e.Type.Optional(e.Type.Integer({minimum:1}))},{additionalProperties:!1}),h=e.Type.Object({action:e.Type.Literal(t.steer),id:e.Type.String({minLength:1}),message:e.Type.String({minLength:1})},{additionalProperties:!1}),g=e.Type.Object({action:e.Type.Literal(t.stop),id:e.Type.String({minLength:1}),reason:e.Type.Optional(e.Type.String({minLength:1}))},{additionalProperties:!1}),_=e.Type.Object({action:e.Type.Literal(t.suspended)},{additionalProperties:!1}),v=e.Type.Object({action:e.Type.Literal(t.restore),id:e.Type.String({minLength:1})},{additionalProperties:!1}),y=e.Type.Union([u,d,f,p,m,h,g,_,v]);exports.InlineAgentSchema=c,exports.SUBAGENT_ACTIONS=t,exports.SUBAGENT_ACTION_FIELDS=n,exports.SubagentParams=y,exports.isSubagentAction=i,exports.subagentActionAcceptsField=a;
2
+ //# sourceMappingURL=subagentTool.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagentTool.cjs","names":["Type"],"sources":["../src/subagentTool.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\n\nexport const SUBAGENT_ACTIONS = {\n agents: 'agents',\n run: 'run',\n status: 'status',\n wait: 'wait',\n steer: 'steer',\n stop: 'stop',\n suspended: 'suspended',\n restore: 'restore',\n} as const;\n\nexport type SubagentAction = (typeof SUBAGENT_ACTIONS)[keyof typeof SUBAGENT_ACTIONS];\n\nexport const SUBAGENT_ACTION_FIELDS = {\n agents: ['action', 'name', 'cwd', 'scope'],\n run: ['action', 'requests', 'concurrency', 'artifacts', 'scope'],\n status: ['action', 'id', 'transcriptLines'],\n wait: ['action', 'ids', 'until', 'timeoutMs'],\n steer: ['action', 'id', 'message'],\n stop: ['action', 'id', 'reason'],\n suspended: ['action'],\n restore: ['action', 'id'],\n} as const satisfies Record<SubagentAction, readonly string[]>;\n\nconst IMPLEMENTED_ACTIONS: ReadonlySet<string> = new Set(Object.values(SUBAGENT_ACTIONS));\n\nexport function isSubagentAction(value: unknown): value is SubagentAction {\n return typeof value === 'string' && IMPLEMENTED_ACTIONS.has(value);\n}\n\nexport function subagentActionAcceptsField(action: SubagentAction, field: string): boolean {\n return (SUBAGENT_ACTION_FIELDS[action] as readonly string[]).includes(field);\n}\n\nconst AgentScope = Type.Union([Type.Literal('user'), Type.Literal('project'), Type.Literal('both')]);\nconst WaitUntil = Type.Union([Type.Literal('completion'), Type.Literal('attention'), Type.Literal('any')]);\n\nexport const InlineAgentSchema = Type.Object(\n { systemPrompt: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\nexport type InlineAgent = Static<typeof InlineAgentSchema>;\n\nconst RunRequest = Type.Object(\n {\n agent: Type.String({ minLength: 1 }),\n inlineAgent: Type.Optional(InlineAgentSchema),\n task: Type.String({ minLength: 1 }),\n cwd: Type.Optional(Type.String({ minLength: 1 })),\n model: Type.Optional(Type.String({ minLength: 1 })),\n runtime: Type.Optional(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\n\nconst AgentsParams = Type.Object(\n {\n action: Type.Literal(SUBAGENT_ACTIONS.agents),\n name: Type.Optional(Type.String({ minLength: 1 })),\n cwd: Type.Optional(Type.String({ minLength: 1 })),\n scope: Type.Optional(AgentScope),\n },\n { additionalProperties: false },\n);\n\nconst RunParams = Type.Object(\n {\n action: Type.Literal(SUBAGENT_ACTIONS.run),\n requests: Type.Array(RunRequest, { minItems: 1 }),\n concurrency: Type.Optional(Type.Integer({ minimum: 1 })),\n artifacts: Type.Optional(Type.Boolean()),\n scope: Type.Optional(AgentScope),\n },\n { additionalProperties: false },\n);\n\nconst FleetStatusParams = Type.Object(\n { action: Type.Literal(SUBAGENT_ACTIONS.status) },\n { additionalProperties: false },\n);\n\nconst RunStatusParams = Type.Object(\n {\n action: Type.Literal(SUBAGENT_ACTIONS.status),\n id: Type.String({ minLength: 1 }),\n transcriptLines: Type.Optional(Type.Integer({ minimum: 1, maximum: 500 })),\n },\n { additionalProperties: false },\n);\n\nconst WaitParams = Type.Object(\n {\n action: Type.Literal(SUBAGENT_ACTIONS.wait),\n ids: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { minItems: 1 })),\n until: Type.Optional(WaitUntil),\n timeoutMs: Type.Optional(Type.Integer({ minimum: 1 })),\n },\n { additionalProperties: false },\n);\n\nconst SteerParams = Type.Object(\n {\n action: Type.Literal(SUBAGENT_ACTIONS.steer),\n id: Type.String({ minLength: 1 }),\n message: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n);\n\nconst StopParams = Type.Object(\n {\n action: Type.Literal(SUBAGENT_ACTIONS.stop),\n id: Type.String({ minLength: 1 }),\n reason: Type.Optional(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\n\nconst SuspendedParams = Type.Object(\n { action: Type.Literal(SUBAGENT_ACTIONS.suspended) },\n { additionalProperties: false },\n);\n\nconst RestoreParams = Type.Object(\n {\n action: Type.Literal(SUBAGENT_ACTIONS.restore),\n id: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n);\n\nexport const SubagentParams = Type.Union([\n AgentsParams,\n RunParams,\n FleetStatusParams,\n RunStatusParams,\n WaitParams,\n SteerParams,\n StopParams,\n SuspendedParams,\n RestoreParams,\n]);\n\nexport type SubagentToolParams = Static<typeof SubagentParams>;\n"],"mappings":"4FAEA,MAAa,EAAmB,CAC9B,OAAQ,SACR,IAAK,MACL,OAAQ,SACR,KAAM,OACN,MAAO,QACP,KAAM,OACN,UAAW,YACX,QAAS,SACX,EAIa,EAAyB,CACpC,OAAQ,CAAC,SAAU,OAAQ,MAAO,OAAO,EACzC,IAAK,CAAC,SAAU,WAAY,cAAe,YAAa,OAAO,EAC/D,OAAQ,CAAC,SAAU,KAAM,iBAAiB,EAC1C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S: {
4
+ readonly agents: "agents";
5
+ readonly run: "run";
6
+ readonly status: "status";
7
+ readonly wait: "wait";
8
+ readonly steer: "steer";
9
+ readonly stop: "stop";
10
+ readonly suspended: "suspended";
11
+ readonly restore: "restore";
12
+ };
13
+ type SubagentAction = (typeof SUBAGENT_ACTIONS)[keyof typeof SUBAGENT_ACTIONS];
14
+ declare const SUBAGENT_ACTION_FIELDS: {
15
+ readonly agents: readonly ["action", "name", "cwd", "scope"];
16
+ readonly run: readonly ["action", "requests", "concurrency", "artifacts", "scope"];
17
+ readonly status: readonly ["action", "id", "transcriptLines"];
18
+ readonly wait: readonly ["action", "ids", "until", "timeoutMs"];
19
+ readonly steer: readonly ["action", "id", "message"];
20
+ readonly stop: readonly ["action", "id", "reason"];
21
+ readonly suspended: readonly ["action"];
22
+ readonly restore: readonly ["action", "id"];
23
+ };
24
+ declare function isSubagentAction(value: unknown): value is SubagentAction;
25
+ declare function subagentActionAcceptsField(action: SubagentAction, field: string): boolean;
26
+ declare const InlineAgentSchema: Type.TObject<{
27
+ systemPrompt: Type.TString;
28
+ }>;
29
+ type InlineAgent = Static<typeof InlineAgentSchema>;
30
+ declare const SubagentParams: Type.TUnion<[Type.TObject<{
31
+ action: Type.TLiteral<"agents">;
32
+ name: Type.TOptional<Type.TString>;
33
+ cwd: Type.TOptional<Type.TString>;
34
+ scope: Type.TOptional<Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"project">, Type.TLiteral<"both">]>>;
35
+ }>, Type.TObject<{
36
+ action: Type.TLiteral<"run">;
37
+ requests: Type.TArray<Type.TObject<{
38
+ agent: Type.TString;
39
+ inlineAgent: Type.TOptional<Type.TObject<{
40
+ systemPrompt: Type.TString;
41
+ }>>;
42
+ task: Type.TString;
43
+ cwd: Type.TOptional<Type.TString>;
44
+ model: Type.TOptional<Type.TString>;
45
+ runtime: Type.TOptional<Type.TString>;
46
+ }>>;
47
+ concurrency: Type.TOptional<Type.TInteger>;
48
+ artifacts: Type.TOptional<Type.TBoolean>;
49
+ scope: Type.TOptional<Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"project">, Type.TLiteral<"both">]>>;
50
+ }>, Type.TObject<{
51
+ action: Type.TLiteral<"status">;
52
+ }>, Type.TObject<{
53
+ action: Type.TLiteral<"status">;
54
+ id: Type.TString;
55
+ transcriptLines: Type.TOptional<Type.TInteger>;
56
+ }>, Type.TObject<{
57
+ action: Type.TLiteral<"wait">;
58
+ ids: Type.TOptional<Type.TArray<Type.TString>>;
59
+ until: Type.TOptional<Type.TUnion<[Type.TLiteral<"completion">, Type.TLiteral<"attention">, Type.TLiteral<"any">]>>;
60
+ timeoutMs: Type.TOptional<Type.TInteger>;
61
+ }>, Type.TObject<{
62
+ action: Type.TLiteral<"steer">;
63
+ id: Type.TString;
64
+ message: Type.TString;
65
+ }>, Type.TObject<{
66
+ action: Type.TLiteral<"stop">;
67
+ id: Type.TString;
68
+ reason: Type.TOptional<Type.TString>;
69
+ }>, Type.TObject<{
70
+ action: Type.TLiteral<"suspended">;
71
+ }>, Type.TObject<{
72
+ action: Type.TLiteral<"restore">;
73
+ id: Type.TString;
74
+ }>]>;
75
+ type SubagentToolParams = Static<typeof SubagentParams>;
76
+ //#endregion
77
+ export { InlineAgent, InlineAgentSchema, SUBAGENT_ACTIONS, SUBAGENT_ACTION_FIELDS, SubagentAction, SubagentParams, SubagentToolParams, isSubagentAction, subagentActionAcceptsField };
78
+ //# sourceMappingURL=subagentTool.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagentTool.d.cts","names":[],"sources":["../src/subagentTool.ts"],"mappings":";;cAEa;;;;;;;;;;KAWD,yBAAyB,+BAA+B;cAEvD;;;;;;;;;;iBAaG,iBAAiB,iBAAiB,SAAS;iBAI3C,2BAA2B,QAAQ,gBAAgB;cAOtD,mBAAiB,KAAA;gBAAjB,KAAA;;KAID,cAAc,cAAc;cA0F3B,gBAAc,KAAA,QAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAYf,qBAAqB,cAAc"}
@@ -0,0 +1,78 @@
1
+ import { Static, Type } from "typebox";
2
+ //#region src/subagentTool.d.ts
3
+ declare const SUBAGENT_ACTIONS: {
4
+ readonly agents: "agents";
5
+ readonly run: "run";
6
+ readonly status: "status";
7
+ readonly wait: "wait";
8
+ readonly steer: "steer";
9
+ readonly stop: "stop";
10
+ readonly suspended: "suspended";
11
+ readonly restore: "restore";
12
+ };
13
+ type SubagentAction = (typeof SUBAGENT_ACTIONS)[keyof typeof SUBAGENT_ACTIONS];
14
+ declare const SUBAGENT_ACTION_FIELDS: {
15
+ readonly agents: readonly ["action", "name", "cwd", "scope"];
16
+ readonly run: readonly ["action", "requests", "concurrency", "artifacts", "scope"];
17
+ readonly status: readonly ["action", "id", "transcriptLines"];
18
+ readonly wait: readonly ["action", "ids", "until", "timeoutMs"];
19
+ readonly steer: readonly ["action", "id", "message"];
20
+ readonly stop: readonly ["action", "id", "reason"];
21
+ readonly suspended: readonly ["action"];
22
+ readonly restore: readonly ["action", "id"];
23
+ };
24
+ declare function isSubagentAction(value: unknown): value is SubagentAction;
25
+ declare function subagentActionAcceptsField(action: SubagentAction, field: string): boolean;
26
+ declare const InlineAgentSchema: Type.TObject<{
27
+ systemPrompt: Type.TString;
28
+ }>;
29
+ type InlineAgent = Static<typeof InlineAgentSchema>;
30
+ declare const SubagentParams: Type.TUnion<[Type.TObject<{
31
+ action: Type.TLiteral<"agents">;
32
+ name: Type.TOptional<Type.TString>;
33
+ cwd: Type.TOptional<Type.TString>;
34
+ scope: Type.TOptional<Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"project">, Type.TLiteral<"both">]>>;
35
+ }>, Type.TObject<{
36
+ action: Type.TLiteral<"run">;
37
+ requests: Type.TArray<Type.TObject<{
38
+ agent: Type.TString;
39
+ inlineAgent: Type.TOptional<Type.TObject<{
40
+ systemPrompt: Type.TString;
41
+ }>>;
42
+ task: Type.TString;
43
+ cwd: Type.TOptional<Type.TString>;
44
+ model: Type.TOptional<Type.TString>;
45
+ runtime: Type.TOptional<Type.TString>;
46
+ }>>;
47
+ concurrency: Type.TOptional<Type.TInteger>;
48
+ artifacts: Type.TOptional<Type.TBoolean>;
49
+ scope: Type.TOptional<Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"project">, Type.TLiteral<"both">]>>;
50
+ }>, Type.TObject<{
51
+ action: Type.TLiteral<"status">;
52
+ }>, Type.TObject<{
53
+ action: Type.TLiteral<"status">;
54
+ id: Type.TString;
55
+ transcriptLines: Type.TOptional<Type.TInteger>;
56
+ }>, Type.TObject<{
57
+ action: Type.TLiteral<"wait">;
58
+ ids: Type.TOptional<Type.TArray<Type.TString>>;
59
+ until: Type.TOptional<Type.TUnion<[Type.TLiteral<"completion">, Type.TLiteral<"attention">, Type.TLiteral<"any">]>>;
60
+ timeoutMs: Type.TOptional<Type.TInteger>;
61
+ }>, Type.TObject<{
62
+ action: Type.TLiteral<"steer">;
63
+ id: Type.TString;
64
+ message: Type.TString;
65
+ }>, Type.TObject<{
66
+ action: Type.TLiteral<"stop">;
67
+ id: Type.TString;
68
+ reason: Type.TOptional<Type.TString>;
69
+ }>, Type.TObject<{
70
+ action: Type.TLiteral<"suspended">;
71
+ }>, Type.TObject<{
72
+ action: Type.TLiteral<"restore">;
73
+ id: Type.TString;
74
+ }>]>;
75
+ type SubagentToolParams = Static<typeof SubagentParams>;
76
+ //#endregion
77
+ export { InlineAgent, InlineAgentSchema, SUBAGENT_ACTIONS, SUBAGENT_ACTION_FIELDS, SubagentAction, SubagentParams, SubagentToolParams, isSubagentAction, subagentActionAcceptsField };
78
+ //# sourceMappingURL=subagentTool.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagentTool.d.mts","names":[],"sources":["../src/subagentTool.ts"],"mappings":";;cAEa;;;;;;;;;;KAWD,yBAAyB,+BAA+B;cAEvD;;;;;;;;;;iBAaG,iBAAiB,iBAAiB,SAAS;iBAI3C,2BAA2B,QAAQ,gBAAgB;cAOtD,mBAAiB,KAAA;gBAAjB,KAAA;;KAID,cAAc,cAAc;cA0F3B,gBAAc,KAAA,QAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAYf,qBAAqB,cAAc"}
@@ -0,0 +1,2 @@
1
+ import{Type as e}from"typebox";const t={agents:`agents`,run:`run`,status:`status`,wait:`wait`,steer:`steer`,stop:`stop`,suspended:`suspended`,restore:`restore`},n={agents:[`action`,`name`,`cwd`,`scope`],run:[`action`,`requests`,`concurrency`,`artifacts`,`scope`],status:[`action`,`id`,`transcriptLines`],wait:[`action`,`ids`,`until`,`timeoutMs`],steer:[`action`,`id`,`message`],stop:[`action`,`id`,`reason`],suspended:[`action`],restore:[`action`,`id`]},r=new Set(Object.values(t));function i(e){return typeof e==`string`&&r.has(e)}function a(e,t){return n[e].includes(t)}const o=e.Union([e.Literal(`user`),e.Literal(`project`),e.Literal(`both`)]),s=e.Union([e.Literal(`completion`),e.Literal(`attention`),e.Literal(`any`)]),c=e.Object({systemPrompt:e.String({minLength:1})},{additionalProperties:!1}),l=e.Object({agent:e.String({minLength:1}),inlineAgent:e.Optional(c),task:e.String({minLength:1}),cwd:e.Optional(e.String({minLength:1})),model:e.Optional(e.String({minLength:1})),runtime:e.Optional(e.String({minLength:1}))},{additionalProperties:!1}),u=e.Object({action:e.Literal(t.agents),name:e.Optional(e.String({minLength:1})),cwd:e.Optional(e.String({minLength:1})),scope:e.Optional(o)},{additionalProperties:!1}),d=e.Object({action:e.Literal(t.run),requests:e.Array(l,{minItems:1}),concurrency:e.Optional(e.Integer({minimum:1})),artifacts:e.Optional(e.Boolean()),scope:e.Optional(o)},{additionalProperties:!1}),f=e.Object({action:e.Literal(t.status)},{additionalProperties:!1}),p=e.Object({action:e.Literal(t.status),id:e.String({minLength:1}),transcriptLines:e.Optional(e.Integer({minimum:1,maximum:500}))},{additionalProperties:!1}),m=e.Object({action:e.Literal(t.wait),ids:e.Optional(e.Array(e.String({minLength:1}),{minItems:1})),until:e.Optional(s),timeoutMs:e.Optional(e.Integer({minimum:1}))},{additionalProperties:!1}),h=e.Object({action:e.Literal(t.steer),id:e.String({minLength:1}),message:e.String({minLength:1})},{additionalProperties:!1}),g=e.Object({action:e.Literal(t.stop),id:e.String({minLength:1}),reason:e.Optional(e.String({minLength:1}))},{additionalProperties:!1}),_=e.Object({action:e.Literal(t.suspended)},{additionalProperties:!1}),v=e.Object({action:e.Literal(t.restore),id:e.String({minLength:1})},{additionalProperties:!1}),y=e.Union([u,d,f,p,m,h,g,_,v]);export{c as InlineAgentSchema,t as SUBAGENT_ACTIONS,n as SUBAGENT_ACTION_FIELDS,y as SubagentParams,i as isSubagentAction,a as subagentActionAcceptsField};
2
+ //# sourceMappingURL=subagentTool.mjs.map