agentix-cli 0.29.0 → 0.31.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 (123) hide show
  1. package/dist/{App-IEQXWJ7B.js → App-6TP7YMQ3.js} +2 -2
  2. package/dist/{ChatApp-NWOSAP5U.js → ChatApp-G2MQUBR3.js} +2 -2
  3. package/dist/{agent-LS4CZPJ6.js → agent-A5G4DGVU.js} +2 -2
  4. package/dist/{board-dashboard-6QQCKFB3.js → board-dashboard-BU6QJK6X.js} +192 -171
  5. package/dist/board-dashboard-BU6QJK6X.js.map +1 -0
  6. package/dist/{chunk-DI7FMCDK.js → chunk-2J3NV6RZ.js} +2 -2
  7. package/dist/{chunk-UCQ2N3KO.js → chunk-2TJ5L7CB.js} +2 -2
  8. package/dist/{chunk-FKBGJYWQ.js → chunk-3RHPZXCR.js} +2 -2
  9. package/dist/{chunk-SBCZLZG3.js → chunk-6DD4DA2L.js} +2 -2
  10. package/dist/{chunk-52ZPELD2.js → chunk-7CVJ4JOE.js} +2 -2
  11. package/dist/{chunk-Z2Y24ETP.js → chunk-7JWYLSFF.js} +2 -2
  12. package/dist/{chunk-OTXDKKEU.js → chunk-7MNXKITO.js} +134 -122
  13. package/dist/chunk-7MNXKITO.js.map +1 -0
  14. package/dist/chunk-COOJI5SR.js +170 -0
  15. package/dist/chunk-COOJI5SR.js.map +1 -0
  16. package/dist/{chunk-JKYMXLYL.js → chunk-DLOYTMYZ.js} +2 -2
  17. package/dist/chunk-DWADWDMU.js +96 -0
  18. package/dist/chunk-DWADWDMU.js.map +1 -0
  19. package/dist/{chunk-SC5DIKBB.js → chunk-FFDXDUVQ.js} +2 -2
  20. package/dist/{chunk-F5AEXRPR.js → chunk-JC6ZHSTY.js} +2 -2
  21. package/dist/{chunk-F5AEXRPR.js.map → chunk-JC6ZHSTY.js.map} +1 -1
  22. package/dist/{chunk-UYSNGBDT.js → chunk-JJIYFBDH.js} +2 -2
  23. package/dist/{chunk-3QVOWDHZ.js → chunk-JV52UMCI.js} +2 -2
  24. package/dist/{chunk-6F2IKJ2F.js → chunk-NZ346QCV.js} +2 -2
  25. package/dist/{chunk-M4AMWP3H.js → chunk-QLTM3F7M.js} +17 -8
  26. package/dist/{chunk-M4AMWP3H.js.map → chunk-QLTM3F7M.js.map} +1 -1
  27. package/dist/{chunk-4KXBUORV.js → chunk-R7WLFEW3.js} +2 -2
  28. package/dist/{chunk-AE2LDMZU.js → chunk-UOGDSRG3.js} +2 -2
  29. package/dist/chunk-UOGDSRG3.js.map +1 -0
  30. package/dist/{chunk-IWMW5432.js → chunk-V7FYSZSV.js} +1 -1
  31. package/dist/{chunk-IWMW5432.js.map → chunk-V7FYSZSV.js.map} +1 -1
  32. package/dist/chunk-VMDA2SX2.js +43 -0
  33. package/dist/chunk-VMDA2SX2.js.map +1 -0
  34. package/dist/{chunk-JIOLJIBM.js → chunk-W6HKWISZ.js} +2 -2
  35. package/dist/{chunk-GMNKJXTR.js → chunk-Z3RKXKE2.js} +2 -2
  36. package/dist/{chunk-GMNKJXTR.js.map → chunk-Z3RKXKE2.js.map} +1 -1
  37. package/dist/{chunk-LNWX4MPX.js → chunk-ZZQMR526.js} +130 -129
  38. package/dist/chunk-ZZQMR526.js.map +1 -0
  39. package/dist/cli.js +1 -1
  40. package/dist/cli.js.map +1 -1
  41. package/dist/client-QALLJG62.js +2 -0
  42. package/dist/config-TNNODULV.js +2 -0
  43. package/dist/config-mutator-RI77M5YT.js +2 -0
  44. package/dist/doctor-DW27MR2T.js +2 -0
  45. package/dist/index.d.ts +178 -155
  46. package/dist/index.js +1 -1
  47. package/dist/index.js.map +1 -1
  48. package/dist/processes-I3XAPHG7.js +2 -0
  49. package/dist/program-WZ3GEOXO.js +2 -0
  50. package/dist/query-7X6VO5VU.js +2 -0
  51. package/dist/registry-LUMYXZ6F.js +2 -0
  52. package/dist/request-planner-RNQB4L6F.js +2 -0
  53. package/dist/request-planner-RNQB4L6F.js.map +1 -0
  54. package/dist/{review-candidates-F3OFYTCZ.js → review-candidates-ZX4JBWQL.js} +2 -2
  55. package/dist/routing-5VGXQ4VG.js +2 -0
  56. package/dist/scheduler-W5C43ZTE.js +2 -0
  57. package/dist/seat-SXPFROXT.js +2 -0
  58. package/dist/{select-L7C52URW.js → select-GJ47QACY.js} +2 -2
  59. package/dist/{surface-usage-NS74AXSE.js → surface-usage-UREILT2E.js} +2 -2
  60. package/dist/web/activity-graph.global.js +901 -368
  61. package/dist/web/activity-graph.global.js.map +1 -1
  62. package/dist/wiki-SRH3JKI4.js +2 -0
  63. package/dist/workspace-setup-G6KGWPHY.js +2 -0
  64. package/package.json +1 -1
  65. package/dist/board-dashboard-6QQCKFB3.js.map +0 -1
  66. package/dist/chunk-4BR7D2OU.js +0 -36
  67. package/dist/chunk-4BR7D2OU.js.map +0 -1
  68. package/dist/chunk-67Q4DCPS.js +0 -54
  69. package/dist/chunk-67Q4DCPS.js.map +0 -1
  70. package/dist/chunk-AE2LDMZU.js.map +0 -1
  71. package/dist/chunk-I3SIXTJO.js +0 -44
  72. package/dist/chunk-I3SIXTJO.js.map +0 -1
  73. package/dist/chunk-LNWX4MPX.js.map +0 -1
  74. package/dist/chunk-OTXDKKEU.js.map +0 -1
  75. package/dist/chunk-XPXO5K4L.js +0 -164
  76. package/dist/chunk-XPXO5K4L.js.map +0 -1
  77. package/dist/client-5Z3URGPY.js +0 -2
  78. package/dist/config-ORSGLVRW.js +0 -2
  79. package/dist/config-mutator-JB3S2E7H.js +0 -2
  80. package/dist/doctor-FS2BX6H4.js +0 -2
  81. package/dist/processes-WU23U2OJ.js +0 -2
  82. package/dist/program-I4J63BQ7.js +0 -2
  83. package/dist/query-R7EI3VGX.js +0 -2
  84. package/dist/registry-UJIJBLUR.js +0 -2
  85. package/dist/request-planner-BKT6RZKX.js +0 -2
  86. package/dist/request-planner-BKT6RZKX.js.map +0 -1
  87. package/dist/routing-S5WSFIAD.js +0 -2
  88. package/dist/scheduler-DSAOMV4O.js +0 -2
  89. package/dist/seat-ZVHXNAEN.js +0 -2
  90. package/dist/wiki-5YQI4YKM.js +0 -2
  91. package/dist/workspace-setup-B3F3TUDE.js +0 -2
  92. /package/dist/{App-IEQXWJ7B.js.map → App-6TP7YMQ3.js.map} +0 -0
  93. /package/dist/{ChatApp-NWOSAP5U.js.map → ChatApp-G2MQUBR3.js.map} +0 -0
  94. /package/dist/{agent-LS4CZPJ6.js.map → agent-A5G4DGVU.js.map} +0 -0
  95. /package/dist/{chunk-DI7FMCDK.js.map → chunk-2J3NV6RZ.js.map} +0 -0
  96. /package/dist/{chunk-UCQ2N3KO.js.map → chunk-2TJ5L7CB.js.map} +0 -0
  97. /package/dist/{chunk-FKBGJYWQ.js.map → chunk-3RHPZXCR.js.map} +0 -0
  98. /package/dist/{chunk-SBCZLZG3.js.map → chunk-6DD4DA2L.js.map} +0 -0
  99. /package/dist/{chunk-52ZPELD2.js.map → chunk-7CVJ4JOE.js.map} +0 -0
  100. /package/dist/{chunk-Z2Y24ETP.js.map → chunk-7JWYLSFF.js.map} +0 -0
  101. /package/dist/{chunk-JKYMXLYL.js.map → chunk-DLOYTMYZ.js.map} +0 -0
  102. /package/dist/{chunk-SC5DIKBB.js.map → chunk-FFDXDUVQ.js.map} +0 -0
  103. /package/dist/{chunk-UYSNGBDT.js.map → chunk-JJIYFBDH.js.map} +0 -0
  104. /package/dist/{chunk-3QVOWDHZ.js.map → chunk-JV52UMCI.js.map} +0 -0
  105. /package/dist/{chunk-6F2IKJ2F.js.map → chunk-NZ346QCV.js.map} +0 -0
  106. /package/dist/{chunk-4KXBUORV.js.map → chunk-R7WLFEW3.js.map} +0 -0
  107. /package/dist/{chunk-JIOLJIBM.js.map → chunk-W6HKWISZ.js.map} +0 -0
  108. /package/dist/{client-5Z3URGPY.js.map → client-QALLJG62.js.map} +0 -0
  109. /package/dist/{config-ORSGLVRW.js.map → config-TNNODULV.js.map} +0 -0
  110. /package/dist/{config-mutator-JB3S2E7H.js.map → config-mutator-RI77M5YT.js.map} +0 -0
  111. /package/dist/{doctor-FS2BX6H4.js.map → doctor-DW27MR2T.js.map} +0 -0
  112. /package/dist/{processes-WU23U2OJ.js.map → processes-I3XAPHG7.js.map} +0 -0
  113. /package/dist/{program-I4J63BQ7.js.map → program-WZ3GEOXO.js.map} +0 -0
  114. /package/dist/{query-R7EI3VGX.js.map → query-7X6VO5VU.js.map} +0 -0
  115. /package/dist/{registry-UJIJBLUR.js.map → registry-LUMYXZ6F.js.map} +0 -0
  116. /package/dist/{review-candidates-F3OFYTCZ.js.map → review-candidates-ZX4JBWQL.js.map} +0 -0
  117. /package/dist/{routing-S5WSFIAD.js.map → routing-5VGXQ4VG.js.map} +0 -0
  118. /package/dist/{scheduler-DSAOMV4O.js.map → scheduler-W5C43ZTE.js.map} +0 -0
  119. /package/dist/{seat-ZVHXNAEN.js.map → seat-SXPFROXT.js.map} +0 -0
  120. /package/dist/{select-L7C52URW.js.map → select-GJ47QACY.js.map} +0 -0
  121. /package/dist/{surface-usage-NS74AXSE.js.map → surface-usage-UREILT2E.js.map} +0 -0
  122. /package/dist/{wiki-5YQI4YKM.js.map → wiki-SRH3JKI4.js.map} +0 -0
  123. /package/dist/{workspace-setup-B3F3TUDE.js.map → workspace-setup-G6KGWPHY.js.map} +0 -0
package/dist/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{a as s}from"./chunk-LNWX4MPX.js";import"./chunk-DI7FMCDK.js";import"./chunk-JKYMXLYL.js";import"./chunk-6F2IKJ2F.js";import"./chunk-UCQ2N3KO.js";import"./chunk-52ZPELD2.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-OTXDKKEU.js";import"./chunk-F6CNF7V3.js";import"./chunk-3QVOWDHZ.js";import"./chunk-IWMW5432.js";import"./chunk-ZVP6GB4G.js";import"./chunk-XPXO5K4L.js";import"./chunk-Z2Y24ETP.js";import"./chunk-4BR7D2OU.js";import"./chunk-M4AMWP3H.js";import"./chunk-UYSNGBDT.js";import"./chunk-SFQUP3BP.js";import"./chunk-3SCPRYJB.js";import"./chunk-I3SIXTJO.js";import"./chunk-67Q4DCPS.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-4KXBUORV.js";import"./chunk-SC5DIKBB.js";import"./chunk-AE2LDMZU.js";import"./chunk-77OV7346.js";import"./chunk-VWTBHLMX.js";import"./chunk-SBCZLZG3.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-JIOLJIBM.js";import"./chunk-AJ5RMU7X.js";import"./chunk-EVWEG3VD.js";import"./chunk-F5AEXRPR.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-QOYAX2FT.js";import"./chunk-WPMX3VGI.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-VDMYBPYB.js";import"./chunk-DSYKYZMT.js";import"./chunk-GMNKJXTR.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function o(){let r=await s();if(process.argv.slice(2).length===0){r.outputHelp();return}r.parse()}o();
2
+ import{a as s}from"./chunk-ZZQMR526.js";import"./chunk-2J3NV6RZ.js";import"./chunk-DLOYTMYZ.js";import"./chunk-NZ346QCV.js";import"./chunk-2TJ5L7CB.js";import"./chunk-7CVJ4JOE.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-7MNXKITO.js";import"./chunk-F6CNF7V3.js";import"./chunk-JV52UMCI.js";import"./chunk-V7FYSZSV.js";import"./chunk-ZVP6GB4G.js";import"./chunk-COOJI5SR.js";import"./chunk-7JWYLSFF.js";import"./chunk-VMDA2SX2.js";import"./chunk-QLTM3F7M.js";import"./chunk-R7WLFEW3.js";import"./chunk-JJIYFBDH.js";import"./chunk-SFQUP3BP.js";import"./chunk-3SCPRYJB.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-FFDXDUVQ.js";import"./chunk-UOGDSRG3.js";import"./chunk-DWADWDMU.js";import"./chunk-77OV7346.js";import"./chunk-VWTBHLMX.js";import"./chunk-6DD4DA2L.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-W6HKWISZ.js";import"./chunk-AJ5RMU7X.js";import"./chunk-EVWEG3VD.js";import"./chunk-JC6ZHSTY.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-QOYAX2FT.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-VDMYBPYB.js";import"./chunk-DSYKYZMT.js";import"./chunk-Z3RKXKE2.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function o(){let r=await s();if(process.argv.slice(2).length===0){r.outputHelp();return}r.parse()}o();
3
3
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { buildProgram } from \"@/program\"\n\nprocess.on(\"SIGINT\", () => process.exit(0))\nprocess.on(\"SIGTERM\", () => process.exit(0))\n\nasync function main() {\n const program = await buildProgram()\n\n const args = process.argv.slice(2)\n if (args.length === 0) {\n program.outputHelp()\n return\n }\n\n program.parse()\n}\n\nmain()\n"],"mappings":";g6CAGA,QAAQ,GAAG,SAAU,IAAM,QAAQ,KAAK,CAAC,CAAC,EAC1C,QAAQ,GAAG,UAAW,IAAM,QAAQ,KAAK,CAAC,CAAC,EAE3C,eAAeA,GAAO,CACpB,IAAMC,EAAU,MAAMC,EAAa,EAGnC,GADa,QAAQ,KAAK,MAAM,CAAC,EACxB,SAAW,EAAG,CACrBD,EAAQ,WAAW,EACnB,OAGFA,EAAQ,MAAM,CAChB,CAEAD,EAAK","names":["main","program","buildProgram"]}
1
+ {"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { buildProgram } from \"@/program\"\n\nprocess.on(\"SIGINT\", () => process.exit(0))\nprocess.on(\"SIGTERM\", () => process.exit(0))\n\nasync function main() {\n const program = await buildProgram()\n\n const args = process.argv.slice(2)\n if (args.length === 0) {\n program.outputHelp()\n return\n }\n\n program.parse()\n}\n\nmain()\n"],"mappings":";o4CAGA,QAAQ,GAAG,SAAU,IAAM,QAAQ,KAAK,CAAC,CAAC,EAC1C,QAAQ,GAAG,UAAW,IAAM,QAAQ,KAAK,CAAC,CAAC,EAE3C,eAAeA,GAAO,CACpB,IAAMC,EAAU,MAAMC,EAAa,EAGnC,GADa,QAAQ,KAAK,MAAM,CAAC,EACxB,SAAW,EAAG,CACrBD,EAAQ,WAAW,EACnB,OAGFA,EAAQ,MAAM,CAChB,CAEAD,EAAK","names":["main","program","buildProgram"]}
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e,f,g}from"./chunk-2J3NV6RZ.js";import"./chunk-Z3RKXKE2.js";import"./chunk-FIOB3MEX.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
2
+ //# sourceMappingURL=client-QALLJG62.js.map
@@ -0,0 +1,2 @@
1
+ import{d as a,e as b,f as c,g as d,h as e,j as f}from"./chunk-Z3RKXKE2.js";import"./chunk-FIOB3MEX.js";f();export{a as INTEGRATION_KINDS,b as daemonConfigSchema,c as expandEnvVars,d as loadDaemonConfig,e as validateWorkspaces};
2
+ //# sourceMappingURL=config-TNNODULV.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d}from"./chunk-FFDXDUVQ.js";import"./chunk-Z3RKXKE2.js";import"./chunk-FIOB3MEX.js";export{a as applyConfigMutation,c as getAtPath,b as setAtPath,d as unsetAtPath};
2
+ //# sourceMappingURL=config-mutator-RI77M5YT.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b}from"./chunk-DLOYTMYZ.js";import"./chunk-Z3RKXKE2.js";import"./chunk-FIOB3MEX.js";export{b as doctor,a as runDoctorChecks};
2
+ //# sourceMappingURL=doctor-DW27MR2T.js.map
package/dist/index.d.ts CHANGED
@@ -4244,6 +4244,10 @@ declare const daemonConfigSchema: z.ZodObject<{
4244
4244
  * Setting this to 0 in active mode means the calibration report stops
4245
4245
  * being trustworthy the day you promote the seat. */
4246
4246
  explore: z.ZodDefault<z.ZodNumber>;
4247
+ /** Fraction of turns that bypass the seat as a randomized control group.
4248
+ * Unset lets the seat pick its own default; only seats that run an
4249
+ * experiment read it (today: request-gate, default 0.1). */
4250
+ holdout: z.ZodOptional<z.ZodNumber>;
4247
4251
  }, "strip", z.ZodTypeAny, {
4248
4252
  temperature: number;
4249
4253
  mode: "active" | "off" | "shadow";
@@ -4251,6 +4255,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4251
4255
  explore: number;
4252
4256
  model?: string | undefined;
4253
4257
  backend?: string | undefined;
4258
+ holdout?: number | undefined;
4254
4259
  }, {
4255
4260
  model?: string | undefined;
4256
4261
  temperature?: number | undefined;
@@ -4258,6 +4263,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4258
4263
  mode?: "active" | "off" | "shadow" | undefined;
4259
4264
  timeoutMs?: number | undefined;
4260
4265
  explore?: number | undefined;
4266
+ holdout?: number | undefined;
4261
4267
  }>>>>;
4262
4268
  /** Model routing driven by the task-tier seat. Models are scoped to their
4263
4269
  * CLI engine; the legacy cheapModel applies only to Claude Code. */
@@ -4335,6 +4341,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4335
4341
  explore: number;
4336
4342
  model?: string | undefined;
4337
4343
  backend?: string | undefined;
4344
+ holdout?: number | undefined;
4338
4345
  }>;
4339
4346
  routing: {
4340
4347
  cheapModel?: string | undefined;
@@ -4392,6 +4399,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4392
4399
  mode?: "active" | "off" | "shadow" | undefined;
4393
4400
  timeoutMs?: number | undefined;
4394
4401
  explore?: number | undefined;
4402
+ holdout?: number | undefined;
4395
4403
  } | undefined> | undefined;
4396
4404
  routing?: {
4397
4405
  cheapModel?: string | undefined;
@@ -5061,6 +5069,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5061
5069
  explore: number;
5062
5070
  model?: string | undefined;
5063
5071
  backend?: string | undefined;
5072
+ holdout?: number | undefined;
5064
5073
  }>;
5065
5074
  routing: {
5066
5075
  cheapModel?: string | undefined;
@@ -5628,6 +5637,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5628
5637
  mode?: "active" | "off" | "shadow" | undefined;
5629
5638
  timeoutMs?: number | undefined;
5630
5639
  explore?: number | undefined;
5640
+ holdout?: number | undefined;
5631
5641
  } | undefined> | undefined;
5632
5642
  routing?: {
5633
5643
  cheapModel?: string | undefined;
@@ -6079,6 +6089,13 @@ declare class AgentXDaemon {
6079
6089
  * board-dashboard routes), but no transitions fire. */
6080
6090
  private bootWorkflowEngine;
6081
6091
  private startHttpApi;
6092
+ /**
6093
+ * Record an inbound dispatch in the intent ledger so the activity graph
6094
+ * sees it. Shared by /task, /ask and /send/agent; `context.channel` is
6095
+ * what the graph shows as the origin. Never throws — the legacy path
6096
+ * stays authoritative, so a ledger failure only costs visibility.
6097
+ */
6098
+ private recordInboundDispatch;
6082
6099
  /**
6083
6100
  * Broadcast an SSE event to all connected clients.
6084
6101
  */
@@ -6375,6 +6392,159 @@ interface FriendlyError {
6375
6392
  raw?: string;
6376
6393
  }
6377
6394
 
6395
+ /**
6396
+ * Verified channel context — facts the channel adapter knows for certain.
6397
+ * Prevents agents from hallucinating about their environment.
6398
+ */
6399
+ interface ChannelMeta {
6400
+ /** Channel name */
6401
+ channel: string;
6402
+ /** Verified agents/bots present in this chat/group/project */
6403
+ agents?: Array<{
6404
+ id: string;
6405
+ name: string;
6406
+ handle?: string;
6407
+ }>;
6408
+ /** Project path (GitLab) or group topic */
6409
+ project?: string;
6410
+ /** Issue/MR context (GitLab) */
6411
+ issue?: {
6412
+ type: string;
6413
+ iid: string;
6414
+ title: string;
6415
+ };
6416
+ /** Channel-specific facts (e.g., pipeline status, group description) */
6417
+ facts?: string[];
6418
+ }
6419
+ interface IncomingMessage {
6420
+ id: string;
6421
+ channel: string;
6422
+ accountId: string;
6423
+ sender: {
6424
+ id: string;
6425
+ name: string;
6426
+ username?: string;
6427
+ /** True when the origin is another bot account (Telegram `from.is_bot`).
6428
+ * Used by the router to apply strict @-mention-only routing — prevents
6429
+ * cross-daemon cascades from bare-word matches in bot replies. */
6430
+ isBot?: boolean;
6431
+ };
6432
+ group?: {
6433
+ id: string;
6434
+ name: string;
6435
+ };
6436
+ text: string;
6437
+ replyTo?: string;
6438
+ replyToText?: string;
6439
+ timestamp: Date;
6440
+ media?: {
6441
+ path: string;
6442
+ type: string;
6443
+ fileName?: string;
6444
+ };
6445
+ raw?: unknown;
6446
+ resolvedAgent?: string;
6447
+ preferNode?: string;
6448
+ channelMeta?: ChannelMeta;
6449
+ /** Correlator threaded by the workflow engine. When a workflow dispatches
6450
+ * an agent, this carries the run id through the pipeline so post:response
6451
+ * can re-enter the engine with `kind: agentResult` transitions. Opaque
6452
+ * everywhere outside src/workflows/. */
6453
+ workflowRunId?: string;
6454
+ /** Phase 1 / 6 — when set, identifies the intent-ledger decision row
6455
+ * this message corresponds to. The agent registry calls
6456
+ * `ledger.recordResolution(...)` when the dispatched task completes,
6457
+ * so Inv-ActiveTaskSafety's "decision in flight" check can clear.
6458
+ * Set by the channel adapter (gitlab, router) right after
6459
+ * recordGitLabTargetDispatch / recordRouterDispatch returns the
6460
+ * decision row. Undefined when the dispatch was deduped/halted by
6461
+ * the ledger (no resolution to write) or when the source is in
6462
+ * mode=off. */
6463
+ intentRef?: {
6464
+ eventId: string;
6465
+ decidedBy: string;
6466
+ };
6467
+ /** Path to the project root whose runbook (CLAUDE.md / AGENTS.md / etc.)
6468
+ * the agent should consult for this task. Set by the gitlab/github
6469
+ * adapters when a project rule resolves a `runbook:` path. The agent
6470
+ * registry reads the file set into the cacheable system prefix.
6471
+ * Undefined when no rule matched — agent uses its own workspace's
6472
+ * CLAUDE.md as before. */
6473
+ runbookPath?: string;
6474
+ /** Override list of files the registry should read from runbookPath.
6475
+ * Carried alongside the path so per-project customisation applies
6476
+ * without the registry re-reading the rule. */
6477
+ runbookFiles?: string[];
6478
+ }
6479
+ interface OutgoingMessage {
6480
+ channel: string;
6481
+ chatId: string;
6482
+ text: string;
6483
+ replyTo?: string;
6484
+ parseMode?: "markdown" | "html" | "plain";
6485
+ agentId?: string;
6486
+ poll?: {
6487
+ name: string;
6488
+ values: string[];
6489
+ selectableCount?: number;
6490
+ };
6491
+ media?: {
6492
+ type: "image" | "document" | "audio" | "video";
6493
+ url: string;
6494
+ caption?: string;
6495
+ mimetype?: string;
6496
+ fileName?: string;
6497
+ };
6498
+ /** URL inline buttons (Phase 1). Telegram renders an inline_keyboard;
6499
+ * channels without button support ignore them. */
6500
+ buttons?: Array<{
6501
+ label: string;
6502
+ url: string;
6503
+ }>;
6504
+ }
6505
+ interface ChannelAdapter {
6506
+ readonly name: string;
6507
+ /** Start polling or webhook listener */
6508
+ start(): Promise<void>;
6509
+ /** Stop the adapter gracefully */
6510
+ stop(): Promise<void>;
6511
+ /** Send a message back to a chat */
6512
+ send(msg: OutgoingMessage): Promise<string | void>;
6513
+ /** Edit an existing message (returns false if not supported) */
6514
+ editMessage?(chatId: string, messageId: string, text: string, parseMode?: string): Promise<boolean>;
6515
+ /** Send typing/action indicator */
6516
+ sendTyping?(chatId: string): Promise<void>;
6517
+ /** React to a message with an emoji (e.g., 👀 for seen) */
6518
+ react?(chatId: string, messageId: string, emoji?: string): Promise<void>;
6519
+ /** Register handler for incoming messages */
6520
+ onMessage(handler: (msg: IncomingMessage) => Promise<void>): void;
6521
+ /** Get verified context for a chat (optional — channels implement what they can) */
6522
+ getChannelMeta?(chatId: string): Promise<ChannelMeta | undefined>;
6523
+ /** Fetch the most recent messages from the live channel for cold-start
6524
+ * session seeding. Called once per (agent, channel, chatId, day) when a
6525
+ * fresh session is created — never on warm cache hits. Bounded by
6526
+ * maxMessages and maxChars (enforced by the caller). Channels return their
6527
+ * own externalId so SessionStore can dedup against re-seeds. */
6528
+ seedHistory?(chatId: string, opts: {
6529
+ sinceISO?: string;
6530
+ maxMessages: number;
6531
+ maxChars: number;
6532
+ }): Promise<Array<SeededMessage>>;
6533
+ }
6534
+ /** A message returned by seedHistory — flat, channel-agnostic. */
6535
+ interface SeededMessage {
6536
+ role: "user" | "agent";
6537
+ name: string;
6538
+ content: string;
6539
+ timestamp: string;
6540
+ externalId?: string;
6541
+ /** Optional channel-side account/bot identity that handled this message
6542
+ * (e.g., Telegram accountId "acme_cx_bot"). Captured by adapters that
6543
+ * shadow-log outbound, so seeded history preserves the audit trail of
6544
+ * which bot identity actually sent each line. Renderers may ignore it. */
6545
+ accountId?: string;
6546
+ }
6547
+
6378
6548
  interface AgentPeer {
6379
6549
  id: string;
6380
6550
  name: string;
@@ -6439,6 +6609,10 @@ interface AgentTask {
6439
6609
  * that pattern without requiring callers to invent unique
6440
6610
  * chatIds. */
6441
6611
  freshSession?: boolean;
6612
+ /** Transcript held by a client that owns the conversation (OpenCode).
6613
+ * Seeds an empty AgentX session the same way a channel adapter's
6614
+ * seedHistory does, so a new or rotated session starts with it. */
6615
+ seedHistory?: SeededMessage[];
6442
6616
  context?: {
6443
6617
  channel?: string;
6444
6618
  sender?: string;
@@ -6645,159 +6819,6 @@ declare class MemoryStore {
6645
6819
  prune(agentId: string): void;
6646
6820
  }
6647
6821
 
6648
- /**
6649
- * Verified channel context — facts the channel adapter knows for certain.
6650
- * Prevents agents from hallucinating about their environment.
6651
- */
6652
- interface ChannelMeta {
6653
- /** Channel name */
6654
- channel: string;
6655
- /** Verified agents/bots present in this chat/group/project */
6656
- agents?: Array<{
6657
- id: string;
6658
- name: string;
6659
- handle?: string;
6660
- }>;
6661
- /** Project path (GitLab) or group topic */
6662
- project?: string;
6663
- /** Issue/MR context (GitLab) */
6664
- issue?: {
6665
- type: string;
6666
- iid: string;
6667
- title: string;
6668
- };
6669
- /** Channel-specific facts (e.g., pipeline status, group description) */
6670
- facts?: string[];
6671
- }
6672
- interface IncomingMessage {
6673
- id: string;
6674
- channel: string;
6675
- accountId: string;
6676
- sender: {
6677
- id: string;
6678
- name: string;
6679
- username?: string;
6680
- /** True when the origin is another bot account (Telegram `from.is_bot`).
6681
- * Used by the router to apply strict @-mention-only routing — prevents
6682
- * cross-daemon cascades from bare-word matches in bot replies. */
6683
- isBot?: boolean;
6684
- };
6685
- group?: {
6686
- id: string;
6687
- name: string;
6688
- };
6689
- text: string;
6690
- replyTo?: string;
6691
- replyToText?: string;
6692
- timestamp: Date;
6693
- media?: {
6694
- path: string;
6695
- type: string;
6696
- fileName?: string;
6697
- };
6698
- raw?: unknown;
6699
- resolvedAgent?: string;
6700
- preferNode?: string;
6701
- channelMeta?: ChannelMeta;
6702
- /** Correlator threaded by the workflow engine. When a workflow dispatches
6703
- * an agent, this carries the run id through the pipeline so post:response
6704
- * can re-enter the engine with `kind: agentResult` transitions. Opaque
6705
- * everywhere outside src/workflows/. */
6706
- workflowRunId?: string;
6707
- /** Phase 1 / 6 — when set, identifies the intent-ledger decision row
6708
- * this message corresponds to. The agent registry calls
6709
- * `ledger.recordResolution(...)` when the dispatched task completes,
6710
- * so Inv-ActiveTaskSafety's "decision in flight" check can clear.
6711
- * Set by the channel adapter (gitlab, router) right after
6712
- * recordGitLabTargetDispatch / recordRouterDispatch returns the
6713
- * decision row. Undefined when the dispatch was deduped/halted by
6714
- * the ledger (no resolution to write) or when the source is in
6715
- * mode=off. */
6716
- intentRef?: {
6717
- eventId: string;
6718
- decidedBy: string;
6719
- };
6720
- /** Path to the project root whose runbook (CLAUDE.md / AGENTS.md / etc.)
6721
- * the agent should consult for this task. Set by the gitlab/github
6722
- * adapters when a project rule resolves a `runbook:` path. The agent
6723
- * registry reads the file set into the cacheable system prefix.
6724
- * Undefined when no rule matched — agent uses its own workspace's
6725
- * CLAUDE.md as before. */
6726
- runbookPath?: string;
6727
- /** Override list of files the registry should read from runbookPath.
6728
- * Carried alongside the path so per-project customisation applies
6729
- * without the registry re-reading the rule. */
6730
- runbookFiles?: string[];
6731
- }
6732
- interface OutgoingMessage {
6733
- channel: string;
6734
- chatId: string;
6735
- text: string;
6736
- replyTo?: string;
6737
- parseMode?: "markdown" | "html" | "plain";
6738
- agentId?: string;
6739
- poll?: {
6740
- name: string;
6741
- values: string[];
6742
- selectableCount?: number;
6743
- };
6744
- media?: {
6745
- type: "image" | "document" | "audio" | "video";
6746
- url: string;
6747
- caption?: string;
6748
- mimetype?: string;
6749
- fileName?: string;
6750
- };
6751
- /** URL inline buttons (Phase 1). Telegram renders an inline_keyboard;
6752
- * channels without button support ignore them. */
6753
- buttons?: Array<{
6754
- label: string;
6755
- url: string;
6756
- }>;
6757
- }
6758
- interface ChannelAdapter {
6759
- readonly name: string;
6760
- /** Start polling or webhook listener */
6761
- start(): Promise<void>;
6762
- /** Stop the adapter gracefully */
6763
- stop(): Promise<void>;
6764
- /** Send a message back to a chat */
6765
- send(msg: OutgoingMessage): Promise<string | void>;
6766
- /** Edit an existing message (returns false if not supported) */
6767
- editMessage?(chatId: string, messageId: string, text: string, parseMode?: string): Promise<boolean>;
6768
- /** Send typing/action indicator */
6769
- sendTyping?(chatId: string): Promise<void>;
6770
- /** React to a message with an emoji (e.g., 👀 for seen) */
6771
- react?(chatId: string, messageId: string, emoji?: string): Promise<void>;
6772
- /** Register handler for incoming messages */
6773
- onMessage(handler: (msg: IncomingMessage) => Promise<void>): void;
6774
- /** Get verified context for a chat (optional — channels implement what they can) */
6775
- getChannelMeta?(chatId: string): Promise<ChannelMeta | undefined>;
6776
- /** Fetch the most recent messages from the live channel for cold-start
6777
- * session seeding. Called once per (agent, channel, chatId, day) when a
6778
- * fresh session is created — never on warm cache hits. Bounded by
6779
- * maxMessages and maxChars (enforced by the caller). Channels return their
6780
- * own externalId so SessionStore can dedup against re-seeds. */
6781
- seedHistory?(chatId: string, opts: {
6782
- sinceISO?: string;
6783
- maxMessages: number;
6784
- maxChars: number;
6785
- }): Promise<Array<SeededMessage>>;
6786
- }
6787
- /** A message returned by seedHistory — flat, channel-agnostic. */
6788
- interface SeededMessage {
6789
- role: "user" | "agent";
6790
- name: string;
6791
- content: string;
6792
- timestamp: string;
6793
- externalId?: string;
6794
- /** Optional channel-side account/bot identity that handled this message
6795
- * (e.g., Telegram accountId "acme_cx_bot"). Captured by adapters that
6796
- * shadow-log outbound, so seeded history preserves the audit trail of
6797
- * which bot identity actually sent each line. Renderers may ignore it. */
6798
- accountId?: string;
6799
- }
6800
-
6801
6822
  interface SessionMessage {
6802
6823
  role: "user" | "agent";
6803
6824
  name?: string;
@@ -6880,10 +6901,12 @@ declare class SessionStore {
6880
6901
  * - the session already has messages (warm cache or partially loaded)
6881
6902
  * - no adapter resolver is installed
6882
6903
  * - the channel adapter has no seedHistory method
6904
+ * Caller-supplied seeds (from a client that owns the transcript, such
6905
+ * as OpenCode) take the adapter's place.
6883
6906
  * Concurrent calls against the same key share one in-flight promise so
6884
6907
  * the channel API is hit exactly once per cold create. Errors are
6885
6908
  * swallowed — a seeding failure should never block a turn. */
6886
- seedIfEmpty(agentId: string, channel: string, chatId: string): Promise<void>;
6909
+ seedIfEmpty(agentId: string, channel: string, chatId: string, callerSeeds?: SeededMessage[]): Promise<void>;
6887
6910
  /** Append seeded messages to a session in chronological order, deduping
6888
6911
  * by externalId against anything already present. Marks each entry with
6889
6912
  * `seeded: true` so observers can distinguish them; the model's prompt
@@ -8493,7 +8516,7 @@ declare class AgentRegistry {
8493
8516
  byChannel: Record<string, {
8494
8517
  tasks: number;
8495
8518
  cost: number;
8496
- }>;
8519
+ }>; /** Runtime handover store — shared with MessageRouter via file on disk. */
8497
8520
  sessionStats: Record<string, {
8498
8521
  sessions: number;
8499
8522
  avgTasksPerSession: number;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as L}from"./chunk-W5C2GDNC.js";import{B as bt,C as Tt,D as Mt,a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt}from"./chunk-OTXDKKEU.js";import"./chunk-F6CNF7V3.js";import"./chunk-3QVOWDHZ.js";import"./chunk-IWMW5432.js";import"./chunk-ZVP6GB4G.js";import{H as yt,f as lt,g as ct,h as dt,i as mt,j as pt}from"./chunk-XPXO5K4L.js";import"./chunk-Z2Y24ETP.js";import"./chunk-4BR7D2OU.js";import"./chunk-M4AMWP3H.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-UYSNGBDT.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-3SCPRYJB.js";import"./chunk-I3SIXTJO.js";import"./chunk-67Q4DCPS.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import{h as ut}from"./chunk-4KXBUORV.js";import"./chunk-SC5DIKBB.js";import"./chunk-AE2LDMZU.js";import"./chunk-77OV7346.js";import"./chunk-VWTBHLMX.js";import{a as gt,b as ft,e as ht}from"./chunk-SBCZLZG3.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-JIOLJIBM.js";import"./chunk-AJ5RMU7X.js";import"./chunk-EVWEG3VD.js";import{j as it,k as rt,l as at}from"./chunk-F5AEXRPR.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-QOYAX2FT.js";import"./chunk-WPMX3VGI.js";import{a as ke,b as ve,c as xe,d as $e,e as Ce,f as Pe,g as be,h as Te,i as Me,j as Re,l as Ee,m as Ge,o as T,p as W}from"./chunk-LCIREYTD.js";import{a as m,b as G}from"./chunk-L2WSPY6S.js";import{a as Fe,b as Le,c as A,d as De}from"./chunk-VDMYBPYB.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{e as tt,g as st,h as ot,j as nt}from"./chunk-GMNKJXTR.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";W();G();import{execa as Rt}from"execa";import{existsSync as se,promises as X}from"fs";import S from"path";import ie from"node-fetch";async function Et(o,e){let t=o.split("/");if(t.length<2)throw new Error(`Invalid skill package ID: ${o}. Expected format: owner/repo`);let s=t[0],i=t[1],n=t[2];try{let a=n?`${s}/${i}/${n}`:`${s}/${i}`;await Rt("npx",["-y","skills","add",a],{cwd:e,stdio:"pipe"}),m.success(`Installed skill package: ${o}`);let r=S.resolve(e,".skills",`${s}_${i}`);if(se(r))return await ne(r,o);let d=S.resolve(e,".skills");return se(d)?await ne(d,o):[]}catch{return m.info(`Fetching skills directly from GitHub: ${s}/${i}`),await Gt(s,i,n,e)}}async function Gt(o,e,t,s){let i=[];try{let n=`https://api.github.com/repos/${o}/${e}/git/trees/main?recursive=1`,a=await ie(n);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let d=(await a.json()).tree.filter(p=>p.type==="blob"&&p.path.endsWith("SKILL.md"));if(t){let p=d.find(f=>f.path.includes(`/${t}/`)||f.path===`${t}/SKILL.md`);if(p){let f=await oe(o,e,p.path,s);f&&i.push(f)}}else for(let p of d){let f=await oe(o,e,p.path,s);f&&i.push(f)}}catch(n){m.error(`Failed to fetch skills from GitHub: ${n.message}`)}return i}async function oe(o,e,t,s){try{let i=`https://raw.githubusercontent.com/${o}/${e}/main/${t}`,n=await ie(i);if(!n.ok)return null;let a=await n.text(),r=A(a);if(r){r.source="remote",r.packageId=`${o}/${e}`;let d=S.dirname(t),p=S.resolve(s,".skills",`${o}_${e}`,d);await X.mkdir(p,{recursive:!0}),await X.writeFile(S.resolve(p,"SKILL.md"),a),r.path=S.resolve(p,"SKILL.md")}return r}catch{return null}}async function ne(o,e){let t=[],{default:s}=await import("fast-glob"),i=await s.glob("**/SKILL.md",{cwd:o,deep:5});for(let n of i)try{let a=S.resolve(o,n),r=await X.readFile(a,"utf8"),d=A(r);d&&(d.source="remote",d.path=a,d.packageId=e,t.push(d))}catch{}return t}async function At(o,e,t,s,i){let n=["---",`name: ${o}`,`description: ${e}`];if(s?.length){n.push("tags:");for(let a of s)n.push(` - ${a}`)}if(i?.length){n.push("globs:");for(let a of i)n.push(` - ${a}`)}return n.push("---"),`${n.join(`
1
+ import{a as L}from"./chunk-W5C2GDNC.js";import{B as bt,C as Tt,D as Mt,a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt}from"./chunk-7MNXKITO.js";import"./chunk-F6CNF7V3.js";import"./chunk-JV52UMCI.js";import"./chunk-V7FYSZSV.js";import"./chunk-ZVP6GB4G.js";import{J as yt,h as lt,i as ct,j as dt,k as mt,l as pt}from"./chunk-COOJI5SR.js";import"./chunk-7JWYLSFF.js";import"./chunk-VMDA2SX2.js";import"./chunk-QLTM3F7M.js";import{h as ut}from"./chunk-R7WLFEW3.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-JJIYFBDH.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-3SCPRYJB.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-FFDXDUVQ.js";import"./chunk-UOGDSRG3.js";import"./chunk-DWADWDMU.js";import"./chunk-77OV7346.js";import"./chunk-VWTBHLMX.js";import{a as gt,b as ft,e as ht}from"./chunk-6DD4DA2L.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-W6HKWISZ.js";import"./chunk-AJ5RMU7X.js";import"./chunk-EVWEG3VD.js";import{j as it,k as rt,l as at}from"./chunk-JC6ZHSTY.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-QOYAX2FT.js";import{a as ke,b as ve,c as xe,d as $e,e as Ce,f as Pe,g as be,h as Te,i as Me,j as Re,l as Ee,m as Ge,o as T,p as W}from"./chunk-LCIREYTD.js";import{a as m,b as G}from"./chunk-L2WSPY6S.js";import{a as Fe,b as Le,c as A,d as De}from"./chunk-VDMYBPYB.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{e as tt,g as st,h as ot,j as nt}from"./chunk-Z3RKXKE2.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";W();G();import{execa as Rt}from"execa";import{existsSync as se,promises as X}from"fs";import S from"path";import ie from"node-fetch";async function Et(o,e){let t=o.split("/");if(t.length<2)throw new Error(`Invalid skill package ID: ${o}. Expected format: owner/repo`);let s=t[0],i=t[1],n=t[2];try{let a=n?`${s}/${i}/${n}`:`${s}/${i}`;await Rt("npx",["-y","skills","add",a],{cwd:e,stdio:"pipe"}),m.success(`Installed skill package: ${o}`);let r=S.resolve(e,".skills",`${s}_${i}`);if(se(r))return await ne(r,o);let d=S.resolve(e,".skills");return se(d)?await ne(d,o):[]}catch{return m.info(`Fetching skills directly from GitHub: ${s}/${i}`),await Gt(s,i,n,e)}}async function Gt(o,e,t,s){let i=[];try{let n=`https://api.github.com/repos/${o}/${e}/git/trees/main?recursive=1`,a=await ie(n);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let d=(await a.json()).tree.filter(p=>p.type==="blob"&&p.path.endsWith("SKILL.md"));if(t){let p=d.find(f=>f.path.includes(`/${t}/`)||f.path===`${t}/SKILL.md`);if(p){let f=await oe(o,e,p.path,s);f&&i.push(f)}}else for(let p of d){let f=await oe(o,e,p.path,s);f&&i.push(f)}}catch(n){m.error(`Failed to fetch skills from GitHub: ${n.message}`)}return i}async function oe(o,e,t,s){try{let i=`https://raw.githubusercontent.com/${o}/${e}/main/${t}`,n=await ie(i);if(!n.ok)return null;let a=await n.text(),r=A(a);if(r){r.source="remote",r.packageId=`${o}/${e}`;let d=S.dirname(t),p=S.resolve(s,".skills",`${o}_${e}`,d);await X.mkdir(p,{recursive:!0}),await X.writeFile(S.resolve(p,"SKILL.md"),a),r.path=S.resolve(p,"SKILL.md")}return r}catch{return null}}async function ne(o,e){let t=[],{default:s}=await import("fast-glob"),i=await s.glob("**/SKILL.md",{cwd:o,deep:5});for(let n of i)try{let a=S.resolve(o,n),r=await X.readFile(a,"utf8"),d=A(r);d&&(d.source="remote",d.path=a,d.packageId=e,t.push(d))}catch{}return t}async function At(o,e,t,s,i){let n=["---",`name: ${o}`,`description: ${e}`];if(s?.length){n.push("tags:");for(let a of s)n.push(` - ${a}`)}if(i?.length){n.push("globs:");for(let a of i)n.push(` - ${a}`)}return n.push("---"),`${n.join(`
2
2
  `)}
3
3
 
4
4
  ${t}`}async function It(o){let{loadLocalSkills:e}=await import("./loader-BOKE5M5S.js");return e(o)}async function Ot(o,e,t,s,i){let a=[{role:"system",content:`You are a skill author for the Agent Skills ecosystem (skills.sh).