agentix-cli 0.68.0 → 0.69.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 (100) hide show
  1. package/dist/{agent-HM7GNNUR.js → agent-VQIC7O5T.js} +2 -2
  2. package/dist/{board-dashboard-LEUIFDNJ.js → board-dashboard-ZPJHXX3U.js} +185 -185
  3. package/dist/board-dashboard-ZPJHXX3U.js.map +1 -0
  4. package/dist/{chunk-AQYST6P6.js → chunk-4NXIJEYU.js} +217 -215
  5. package/dist/chunk-4NXIJEYU.js.map +1 -0
  6. package/dist/chunk-5AMQFDLE.js +649 -0
  7. package/dist/chunk-5AMQFDLE.js.map +1 -0
  8. package/dist/{chunk-RX5VVHT4.js → chunk-ART666G6.js} +2 -2
  9. package/dist/chunk-AU6FFC4I.js +5 -0
  10. package/dist/chunk-AU6FFC4I.js.map +1 -0
  11. package/dist/{chunk-QHD473UI.js → chunk-B65FS265.js} +2 -2
  12. package/dist/{chunk-YQT4ZKY5.js → chunk-BYKF3UTL.js} +2 -2
  13. package/dist/{chunk-FZSEHYYU.js → chunk-CUZWGTXT.js} +2 -2
  14. package/dist/{chunk-G5JUY265.js → chunk-F2DEKA2Q.js} +2 -2
  15. package/dist/chunk-GQ76J72O.js +3 -0
  16. package/dist/chunk-GQ76J72O.js.map +1 -0
  17. package/dist/{chunk-DXOLLHVZ.js → chunk-HEJOWP7O.js} +2 -2
  18. package/dist/{chunk-7R334NQ5.js → chunk-KSDVKLHN.js} +2 -2
  19. package/dist/chunk-NMFXY3QU.js +2 -0
  20. package/dist/chunk-NMFXY3QU.js.map +1 -0
  21. package/dist/chunk-NVJHA63C.js +21 -0
  22. package/dist/chunk-NVJHA63C.js.map +1 -0
  23. package/dist/{chunk-FGRD3JAX.js → chunk-Q2WW2HF4.js} +2 -2
  24. package/dist/{chunk-CW63GAH5.js → chunk-QDRAKJSY.js} +65 -64
  25. package/dist/chunk-QDRAKJSY.js.map +1 -0
  26. package/dist/chunk-S4ASFOJU.js +2 -0
  27. package/dist/chunk-S4ASFOJU.js.map +1 -0
  28. package/dist/chunk-ST6KPQOY.js +3 -0
  29. package/dist/chunk-ST6KPQOY.js.map +1 -0
  30. package/dist/{chunk-TX7MWUC4.js → chunk-VOS2IW4V.js} +2 -2
  31. package/dist/chunk-ZXR6GNEK.js +3 -0
  32. package/dist/chunk-ZXR6GNEK.js.map +1 -0
  33. package/dist/cli.js +1 -1
  34. package/dist/cli.js.map +1 -1
  35. package/dist/fact-proposals-ERRQXV2J.js +2 -0
  36. package/dist/facts-X44PF73W.js +22 -0
  37. package/dist/facts-X44PF73W.js.map +1 -0
  38. package/dist/index.d.ts +57 -12
  39. package/dist/index.js +1 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/ledger-DHYRP4TN.js +2 -0
  42. package/dist/memory-migrate-ED37IBEL.js +2 -0
  43. package/dist/memory-migrate-ED37IBEL.js.map +1 -0
  44. package/dist/program-6PFRDQFT.js +2 -0
  45. package/dist/{promote-FDEKCVAE.js → promote-XRKH73IB.js} +2 -2
  46. package/dist/query-6272PJPD.js +2 -0
  47. package/dist/questions-QGITDLJY.js +2 -0
  48. package/dist/registry-KP3C4EZ4.js +2 -0
  49. package/dist/{request-planner-KQLWWR3U.js → request-planner-73Y5GI3D.js} +2 -2
  50. package/dist/{review-candidates-A6CLXAFS.js → review-candidates-VF5IWP5P.js} +2 -2
  51. package/dist/rotation-memo-store-X63HYIMV.js +2 -0
  52. package/dist/rotation-memo-store-X63HYIMV.js.map +1 -0
  53. package/dist/routing-T24BMMLM.js +2 -0
  54. package/dist/routing-T24BMMLM.js.map +1 -0
  55. package/dist/{seat-W3ZTOJUT.js → seat-XNA2O6EO.js} +2 -2
  56. package/dist/seat-XNA2O6EO.js.map +1 -0
  57. package/dist/{select-VPOWFRSN.js → select-WOUZIR3Y.js} +2 -2
  58. package/dist/web/activity-graph.global.js +75 -11
  59. package/dist/web/activity-graph.global.js.map +1 -1
  60. package/dist/wiki-W6WI6HL3.js +2 -0
  61. package/dist/wiki-W6WI6HL3.js.map +1 -0
  62. package/package.json +1 -1
  63. package/dist/board-dashboard-LEUIFDNJ.js.map +0 -1
  64. package/dist/chunk-ANGX6XPA.js +0 -20
  65. package/dist/chunk-ANGX6XPA.js.map +0 -1
  66. package/dist/chunk-AQYST6P6.js.map +0 -1
  67. package/dist/chunk-CW63GAH5.js.map +0 -1
  68. package/dist/chunk-L52X3YGH.js +0 -2
  69. package/dist/chunk-L52X3YGH.js.map +0 -1
  70. package/dist/chunk-WDRLN7F2.js +0 -648
  71. package/dist/chunk-WDRLN7F2.js.map +0 -1
  72. package/dist/facts-4YPSHIXJ.js +0 -22
  73. package/dist/facts-4YPSHIXJ.js.map +0 -1
  74. package/dist/program-KWSQLVSV.js +0 -2
  75. package/dist/query-PJG52OHP.js +0 -2
  76. package/dist/questions-2V2VGIT4.js +0 -3
  77. package/dist/questions-2V2VGIT4.js.map +0 -1
  78. package/dist/registry-6XJMNXY6.js +0 -2
  79. package/dist/routing-5G22WTPR.js +0 -2
  80. package/dist/wiki-ZM6BEOFX.js +0 -2
  81. /package/dist/{agent-HM7GNNUR.js.map → agent-VQIC7O5T.js.map} +0 -0
  82. /package/dist/{chunk-RX5VVHT4.js.map → chunk-ART666G6.js.map} +0 -0
  83. /package/dist/{chunk-QHD473UI.js.map → chunk-B65FS265.js.map} +0 -0
  84. /package/dist/{chunk-YQT4ZKY5.js.map → chunk-BYKF3UTL.js.map} +0 -0
  85. /package/dist/{chunk-FZSEHYYU.js.map → chunk-CUZWGTXT.js.map} +0 -0
  86. /package/dist/{chunk-G5JUY265.js.map → chunk-F2DEKA2Q.js.map} +0 -0
  87. /package/dist/{chunk-DXOLLHVZ.js.map → chunk-HEJOWP7O.js.map} +0 -0
  88. /package/dist/{chunk-7R334NQ5.js.map → chunk-KSDVKLHN.js.map} +0 -0
  89. /package/dist/{chunk-FGRD3JAX.js.map → chunk-Q2WW2HF4.js.map} +0 -0
  90. /package/dist/{chunk-TX7MWUC4.js.map → chunk-VOS2IW4V.js.map} +0 -0
  91. /package/dist/{program-KWSQLVSV.js.map → fact-proposals-ERRQXV2J.js.map} +0 -0
  92. /package/dist/{promote-FDEKCVAE.js.map → ledger-DHYRP4TN.js.map} +0 -0
  93. /package/dist/{query-PJG52OHP.js.map → program-6PFRDQFT.js.map} +0 -0
  94. /package/dist/{registry-6XJMNXY6.js.map → promote-XRKH73IB.js.map} +0 -0
  95. /package/dist/{routing-5G22WTPR.js.map → query-6272PJPD.js.map} +0 -0
  96. /package/dist/{seat-W3ZTOJUT.js.map → questions-QGITDLJY.js.map} +0 -0
  97. /package/dist/{wiki-ZM6BEOFX.js.map → registry-KP3C4EZ4.js.map} +0 -0
  98. /package/dist/{request-planner-KQLWWR3U.js.map → request-planner-73Y5GI3D.js.map} +0 -0
  99. /package/dist/{review-candidates-A6CLXAFS.js.map → review-candidates-VF5IWP5P.js.map} +0 -0
  100. /package/dist/{select-VPOWFRSN.js.map → select-WOUZIR3Y.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -8370,6 +8370,11 @@ interface AgentPeer {
8370
8370
  interface AgentTask {
8371
8371
  message: string;
8372
8372
  agentId: string;
8373
+ /** Set by the queue flush: when this message was first queued. The run
8374
+ * prepends the stale-state note from it when it starts, and a flushed
8375
+ * message that has to queue again keeps it, so the note is added once
8376
+ * and reports the whole wait (#282). */
8377
+ queuedAt?: number;
8373
8378
  /** Correlator threaded by the workflow engine. When the engine dispatches
8374
8379
  * an agent as part of a state transition, this carries the run id so
8375
8380
  * post:response can re-enter the engine with an agentResult condition. */
@@ -8618,6 +8623,19 @@ interface DriftReport {
8618
8623
  missingTools: string[];
8619
8624
  }
8620
8625
 
8626
+ type FactClass = "billing" | "account" | "outage" | "deploy" | "work-state" | "stable";
8627
+ /** Where a fact came from and when it was last checked. */
8628
+ interface Provenance {
8629
+ /** A system, URL or command, or "owner said". */
8630
+ source: string;
8631
+ verifiedAt: string;
8632
+ /** The agent or person who checked it. */
8633
+ verifiedBy: string;
8634
+ volatility: FactClass;
8635
+ /** Overrides the class TTL. */
8636
+ ttlDays?: number;
8637
+ }
8638
+
8621
8639
  type SourceTrust =
8622
8640
  /** Only the operator can reach it: CLI, dashboard, local voice, TUI and Raycast. */
8623
8641
  "operator"
@@ -8648,6 +8666,13 @@ interface MemoryFact {
8648
8666
  reviewedAt?: string;
8649
8667
  createdAt: string;
8650
8668
  expiresAt?: string;
8669
+ /** Where the fact was checked (#273). Absent on facts nobody checked. */
8670
+ provenance?: Partial<Provenance>;
8671
+ /** Flagged by `agentx memory facts flag-unsourced`: volatile, no source. */
8672
+ unverified?: {
8673
+ since: string;
8674
+ reason: string;
8675
+ };
8651
8676
  accessCount?: number;
8652
8677
  lastAccessed?: string;
8653
8678
  nextReview?: string;
@@ -8656,6 +8681,9 @@ interface MemoryFact {
8656
8681
  }
8657
8682
  declare class MemoryStore {
8658
8683
  private memoryDir;
8684
+ /** The wiki's fact ledger: memory lines that restate one of its facts
8685
+ * are rendered as references to it (memory-context.ts). */
8686
+ private ledger;
8659
8687
  constructor(baseDir?: string);
8660
8688
  private filePath;
8661
8689
  /** Store a fact. Refuses secrets (returns false). Stamps the source's
@@ -8693,7 +8721,10 @@ declare class MemoryStore {
8693
8721
  scrubSecrets(agentId: string, apply?: boolean): number;
8694
8722
  /** Trust and review counts, for the CLI. */
8695
8723
  trustSummary(agentId: string): Record<string, number>;
8696
- private rewrite;
8724
+ /** The agent's facts file, for backups. */
8725
+ fileFor(agentId: string): string;
8726
+ /** Replace every fact of an agent. Callers back the file up first. */
8727
+ rewrite(agentId: string, memories: MemoryFact[]): void;
8697
8728
  /**
8698
8729
  * Check if a substantially similar memory already exists.
8699
8730
  */
@@ -9310,6 +9341,8 @@ declare class WikiHub {
9310
9341
  * graph: agents/<id>/graph/
9311
9342
  */
9312
9343
  getAgentWiki(agentId: string): WikiStore;
9344
+ /** The wiki root: shared sidecars (_facts.json, _questions.json) live here. */
9345
+ getBaseDir(): string;
9313
9346
  getSharedStore(): WikiStore;
9314
9347
  listAgents(): string[];
9315
9348
  getAgentEntries(agentId: string): WikiEntry[];
@@ -9607,17 +9640,17 @@ declare const graphNodeSchema: z.ZodObject<{
9607
9640
  createdBy: z.ZodOptional<z.ZodString>;
9608
9641
  }, "strip", z.ZodTypeAny, {
9609
9642
  id: string;
9610
- createdAt: string;
9611
9643
  axes: Record<string, string>;
9612
9644
  level: string;
9613
9645
  parentId: string | null;
9646
+ createdAt: string;
9614
9647
  createdBy?: string | undefined;
9615
9648
  }, {
9616
9649
  id: string;
9617
- createdAt: string;
9618
9650
  axes: Record<string, string>;
9619
9651
  level: string;
9620
9652
  parentId: string | null;
9653
+ createdAt: string;
9621
9654
  createdBy?: string | undefined;
9622
9655
  }>;
9623
9656
  type GraphNode = z.infer<typeof graphNodeSchema>;
@@ -9655,7 +9688,7 @@ declare const classificationSchema: z.ZodObject<{
9655
9688
  preview: z.ZodOptional<z.ZodString>;
9656
9689
  }, "strip", z.ZodTypeAny, {
9657
9690
  path: string[];
9658
- status: "approved" | "rejected" | "pending";
9691
+ status: "pending" | "approved" | "rejected";
9659
9692
  source: "user" | "llm" | "cache";
9660
9693
  ts: string;
9661
9694
  msgHash: string;
@@ -9671,7 +9704,7 @@ declare const classificationSchema: z.ZodObject<{
9671
9704
  sender?: string | undefined;
9672
9705
  }, {
9673
9706
  path: string[];
9674
- status: "approved" | "rejected" | "pending";
9707
+ status: "pending" | "approved" | "rejected";
9675
9708
  source: "user" | "llm" | "cache";
9676
9709
  ts: string;
9677
9710
  msgHash: string;
@@ -9705,11 +9738,11 @@ declare const fingerprintEntrySchema: z.ZodObject<{
9705
9738
  }, "strip", z.ZodTypeAny, {
9706
9739
  path: string[];
9707
9740
  fingerprint: string;
9708
- updatedAt: string;
9709
9741
  leaf: {
9710
9742
  output?: string | undefined;
9711
9743
  input?: string | undefined;
9712
9744
  };
9745
+ updatedAt: string;
9713
9746
  }, {
9714
9747
  path: string[];
9715
9748
  fingerprint: string;
@@ -9737,37 +9770,37 @@ declare const nodesFileSchema: z.ZodObject<{
9737
9770
  createdBy: z.ZodOptional<z.ZodString>;
9738
9771
  }, "strip", z.ZodTypeAny, {
9739
9772
  id: string;
9740
- createdAt: string;
9741
9773
  axes: Record<string, string>;
9742
9774
  level: string;
9743
9775
  parentId: string | null;
9776
+ createdAt: string;
9744
9777
  createdBy?: string | undefined;
9745
9778
  }, {
9746
9779
  id: string;
9747
- createdAt: string;
9748
9780
  axes: Record<string, string>;
9749
9781
  level: string;
9750
9782
  parentId: string | null;
9783
+ createdAt: string;
9751
9784
  createdBy?: string | undefined;
9752
9785
  }>, "many">>;
9753
9786
  }, "strip", z.ZodTypeAny, {
9754
9787
  version: number;
9755
9788
  nodes: {
9756
9789
  id: string;
9757
- createdAt: string;
9758
9790
  axes: Record<string, string>;
9759
9791
  level: string;
9760
9792
  parentId: string | null;
9793
+ createdAt: string;
9761
9794
  createdBy?: string | undefined;
9762
9795
  }[];
9763
9796
  }, {
9764
9797
  version?: number | undefined;
9765
9798
  nodes?: {
9766
9799
  id: string;
9767
- createdAt: string;
9768
9800
  axes: Record<string, string>;
9769
9801
  level: string;
9770
9802
  parentId: string | null;
9803
+ createdAt: string;
9771
9804
  createdBy?: string | undefined;
9772
9805
  }[] | undefined;
9773
9806
  }>;
@@ -9792,11 +9825,11 @@ declare const indexFileSchema: z.ZodObject<{
9792
9825
  }, "strip", z.ZodTypeAny, {
9793
9826
  path: string[];
9794
9827
  fingerprint: string;
9795
- updatedAt: string;
9796
9828
  leaf: {
9797
9829
  output?: string | undefined;
9798
9830
  input?: string | undefined;
9799
9831
  };
9832
+ updatedAt: string;
9800
9833
  }, {
9801
9834
  path: string[];
9802
9835
  fingerprint: string;
@@ -9810,11 +9843,11 @@ declare const indexFileSchema: z.ZodObject<{
9810
9843
  entries: Record<string, {
9811
9844
  path: string[];
9812
9845
  fingerprint: string;
9813
- updatedAt: string;
9814
9846
  leaf: {
9815
9847
  output?: string | undefined;
9816
9848
  input?: string | undefined;
9817
9849
  };
9850
+ updatedAt: string;
9818
9851
  }>;
9819
9852
  version: number;
9820
9853
  }, {
@@ -11642,6 +11675,18 @@ declare class MessageRouter {
11642
11675
  * so the text says plainly that a re-mention is what resumes it.
11643
11676
  */
11644
11677
  private notifyMeshFailure;
11678
+ /**
11679
+ * The peer's agent was busy on this chat, so the peer queued the message
11680
+ * and answered with the registry's queued marker. That is an accepted
11681
+ * message, not a failure: the peer's queue flush runs it when the current
11682
+ * turn ends and posts the reply on the thread itself. So, as on the local
11683
+ * path: no ❌, no failure comment, and the intent resolves as "queued".
11684
+ *
11685
+ * `meshFailureNotified` is left alone: nothing was announced, so there is
11686
+ * nothing to mark, and the queued turn has not succeeded yet, so it is no
11687
+ * reason to re-arm a notice already posted on this thread.
11688
+ */
11689
+ private noteMeshQueued;
11645
11690
  /** A mesh-routed task succeeded — re-arm the failure notice for this thread. */
11646
11691
  private clearMeshFailure;
11647
11692
  private startTypingLoop;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as L}from"./chunk-Y57CULGE.js";import{a as St,b as kt,c as vt,d as xt,da as Tt,e as $t,ea as Mt,f as Ct,g as Pt,h as bt}from"./chunk-AQYST6P6.js";import"./chunk-QHD473UI.js";import"./chunk-G5JUY265.js";import"./chunk-ZVP6GB4G.js";import"./chunk-BYJ3A55Y.js";import"./chunk-LQRBGQIR.js";import"./chunk-NEC4RXFT.js";import"./chunk-RX5VVHT4.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-2D3RYIDU.js";import"./chunk-L53FTKEP.js";import{S as yt,l as lt,m as ct,n as dt,o as mt,p as pt}from"./chunk-CW63GAH5.js";import"./chunk-ANGX6XPA.js";import"./chunk-N6EWZGIX.js";import"./chunk-WP6KLXTP.js";import"./chunk-DP7RTNDM.js";import{s as ut}from"./chunk-JHWBCDD2.js";import"./chunk-APKAW7LU.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-YQT4ZKY5.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-FGRD3JAX.js";import"./chunk-DWADWDMU.js";import"./chunk-NO2HOK4B.js";import"./chunk-QD6IICK7.js";import"./chunk-VWTBHLMX.js";import"./chunk-L52X3YGH.js";import{a as gt,b as ft,e as ht}from"./chunk-FZSEHYYU.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-7R334NQ5.js";import"./chunk-TFVUOC2C.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-TX7MWUC4.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-FX3D7YON.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-SZJMS7K4.js";import{a as m,b as G}from"./chunk-7I7IEX4S.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{u as tt,w as st,x as ot,z as nt}from"./chunk-N5NPJ6DJ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.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-Y57CULGE.js";import{a as St,b as kt,c as vt,d as xt,da as Tt,e as $t,ea as Mt,f as Ct,g as Pt,h as bt}from"./chunk-4NXIJEYU.js";import"./chunk-B65FS265.js";import"./chunk-BYJ3A55Y.js";import"./chunk-NMFXY3QU.js";import"./chunk-F2DEKA2Q.js";import"./chunk-LQRBGQIR.js";import"./chunk-ZVP6GB4G.js";import"./chunk-ART666G6.js";import"./chunk-2D3RYIDU.js";import"./chunk-L53FTKEP.js";import{S as yt,l as lt,m as ct,n as dt,o as mt,p as pt}from"./chunk-QDRAKJSY.js";import"./chunk-NVJHA63C.js";import"./chunk-N6EWZGIX.js";import"./chunk-WP6KLXTP.js";import"./chunk-DP7RTNDM.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-BYKF3UTL.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-NEC4RXFT.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import{s as ut}from"./chunk-JHWBCDD2.js";import"./chunk-APKAW7LU.js";import"./chunk-ST6KPQOY.js";import"./chunk-GQ76J72O.js";import"./chunk-ZXR6GNEK.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-Q2WW2HF4.js";import"./chunk-DWADWDMU.js";import"./chunk-NO2HOK4B.js";import"./chunk-QD6IICK7.js";import"./chunk-VWTBHLMX.js";import"./chunk-S4ASFOJU.js";import{a as gt,b as ft,e as ht}from"./chunk-CUZWGTXT.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-KSDVKLHN.js";import"./chunk-TFVUOC2C.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-VOS2IW4V.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.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-SZJMS7K4.js";import{a as m,b as G}from"./chunk-7I7IEX4S.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{u as tt,w as st,x as ot,z as nt}from"./chunk-N5NPJ6DJ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.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-EVHZ2R73.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).