opencode-swarm 7.163.1 → 7.164.1

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 (105) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/{coder-settlement-f1gtvcy8.js → coder-settlement-w4qk90kh.js} +12 -13
  3. package/dist/cli/{config-doctor-0fnqzqz1.js → config-doctor-r81bp1nd.js} +3 -3
  4. package/dist/cli/{core-w81fk5sc.js → core-xfw4s9b9.js} +2 -2
  5. package/dist/cli/{curation-policy-j12j2gvc.js → curation-policy-2h37sd6p.js} +6 -7
  6. package/dist/cli/{curator-as495r18.js → curator-7zy6bdmw.js} +36 -39
  7. package/dist/cli/{curator-drift-g6w4ga1q.js → curator-drift-ykrdf08r.js} +105 -38
  8. package/dist/cli/curator-llm-factory-7gjvm4ds.js +66 -0
  9. package/dist/cli/{evidence-summary-service-51dxfcn5.js → evidence-summary-service-519ny6b1.js} +17 -18
  10. package/dist/cli/{gate-evidence-nb1e8hz0.js → gate-evidence-a7st3vbc.js} +8 -9
  11. package/dist/cli/guardrail-explain-ewcm37em.js +67 -0
  12. package/dist/cli/{guardrail-log-2kwntcqw.js → guardrail-log-kp51by1v.js} +8 -9
  13. package/dist/cli/{guardrail-reset-mrxrc56j.js → guardrail-reset-reyfwtwn.js} +36 -39
  14. package/dist/cli/hive-promoter-zf2vf5sw.js +81 -0
  15. package/dist/cli/{index-4p0wyz5p.js → index-1af3rb5n.js} +9 -9
  16. package/dist/cli/{index-2zgjcmmc.js → index-1b1h770t.js} +3 -3
  17. package/dist/cli/{index-0tervb1m.js → index-2ee2g27m.js} +7795 -2724
  18. package/dist/cli/{index-x2f1f011.js → index-2s40e3b0.js} +4 -3
  19. package/dist/cli/{index-9xd073d4.js → index-2yd732fd.js} +7 -1
  20. package/dist/cli/{index-9crtmnqg.js → index-36nt17m8.js} +1 -1
  21. package/dist/cli/{index-d3azve4r.js → index-5084szce.js} +122 -300
  22. package/dist/cli/{index-d9gdwh34.js → index-5bza8nxz.js} +2 -2
  23. package/dist/cli/{index-xyhmt813.js → index-6097tx05.js} +1 -1
  24. package/dist/cli/{index-5056zmpt.js → index-644t46hr.js} +1 -1
  25. package/dist/cli/{index-2v06a1yh.js → index-6ay5zp1v.js} +5 -5
  26. package/dist/cli/{index-n2mhyect.js → index-6kd3jnaf.js} +1 -1
  27. package/dist/cli/{index-n67vx5zw.js → index-6t35714n.js} +2 -2
  28. package/dist/cli/{index-tnpf9wwv.js → index-862c0xhc.js} +1 -1
  29. package/dist/cli/{index-2n1ym7jb.js → index-b98r3pyv.js} +5 -5
  30. package/dist/cli/{index-8ada7ag7.js → index-dhzsvmx6.js} +2 -2
  31. package/dist/cli/{index-n985274d.js → index-e630pvvw.js} +4 -4
  32. package/dist/cli/{index-3b762978.js → index-f9nfknjg.js} +182 -37
  33. package/dist/cli/{index-m1fvbah1.js → index-fwfhbs27.js} +2 -2
  34. package/dist/cli/{index-t34daffb.js → index-h2f21caa.js} +2 -2
  35. package/dist/cli/{index-9ss2m4rs.js → index-hcn69kp0.js} +410 -1
  36. package/dist/cli/{index-g3znh2yd.js → index-hzaw10zh.js} +7 -7
  37. package/dist/cli/{index-cqgpvx2d.js → index-j0ajeary.js} +2 -2
  38. package/dist/cli/{index-f923njwh.js → index-jczbtx2x.js} +7 -7
  39. package/dist/cli/{index-hm239n1p.js → index-k8j7m0e2.js} +1 -1
  40. package/dist/cli/{index-zjme8atd.js → index-n1wcq816.js} +5 -5
  41. package/dist/cli/{index-66073kej.js → index-pmmfhzsp.js} +3 -3
  42. package/dist/cli/{index-fckfgptr.js → index-qbr05tbw.js} +2 -2
  43. package/dist/cli/{index-r56f3f81.js → index-r5jn0ah5.js} +2 -2
  44. package/dist/cli/{index-dtn0pne5.js → index-v56mhyhs.js} +1 -1
  45. package/dist/cli/{index-etvq73mp.js → index-vc3zmtxb.js} +38 -41
  46. package/dist/cli/{index-kvra3nv1.js → index-vdgw2k4c.js} +3 -3
  47. package/dist/cli/{index-0103w5pf.js → index-vkckf2ch.js} +2 -2
  48. package/dist/cli/{index-swgy9xvk.js → index-vrxx0ea4.js} +4 -4
  49. package/dist/cli/{index-08y8pccg.js → index-wnf1ej2q.js} +4 -4
  50. package/dist/cli/{index-qynqyfgj.js → index-wv4b01ex.js} +32 -34
  51. package/dist/cli/{index-7n9jznv0.js → index-x2qmpkth.js} +5 -5
  52. package/dist/cli/index-y2f5s2cf.js +403 -0
  53. package/dist/cli/{index-ma52g2pq.js → index-yc415pzf.js} +655 -16
  54. package/dist/cli/{index-n249fbw7.js → index-zaab1wz9.js} +5 -0
  55. package/dist/cli/index.js +36 -39
  56. package/dist/cli/{knowledge-escalator-fq7dm2g4.js → knowledge-escalator-wwkbsgvw.js} +14 -15
  57. package/dist/cli/{knowledge-events-3zanyfkr.js → knowledge-events-vmmgwfmc.js} +12 -13
  58. package/dist/cli/{knowledge-link-vmdj5e5d.js → knowledge-link-bvra01zv.js} +5 -6
  59. package/dist/cli/{knowledge-store-vhehnw52.js → knowledge-store-6wbagbqm.js} +6 -7
  60. package/dist/cli/{knowledge-validator-0tt0pe6b.js → knowledge-validator-q1z4fmeg.js} +8 -9
  61. package/dist/cli/{model-preflight-c3mc8njg.js → model-preflight-1ecjbg73.js} +1 -1
  62. package/dist/cli/{pending-delegations-b92pecbj.js → pending-delegations-cq5g4rr4.js} +6 -8
  63. package/dist/cli/{pr-subscriptions-2mkdt0ak.js → pr-subscriptions-m0z5wxkb.js} +6 -7
  64. package/dist/cli/pr-workflow-gate-0zvp0qs9.js +221 -0
  65. package/dist/cli/{runner-3gw2njnx.js → runner-s55g5233.js} +6 -7
  66. package/dist/cli/{scan-cursor-1c8a3b0m.js → scan-cursor-z6zepy3r.js} +7 -8
  67. package/dist/cli/{schema-c554j5c8.js → schema-skf0ckh4.js} +2 -2
  68. package/dist/cli/{scope-persistence-vtbcszvv.js → scope-persistence-f6davq7x.js} +10 -11
  69. package/dist/cli/{skill-generator-0es21fck.js → skill-generator-wqbazppk.js} +16 -17
  70. package/dist/cli/{sqlite-loader-c92413n7.js → sqlite-loader-8zefc142.js} +1 -1
  71. package/dist/cli/{telemetry-x4zggfd7.js → telemetry-q51s6tyt.js} +1 -1
  72. package/dist/cli/{worktree-collision-ownership-043dg8gg.js → worktree-collision-ownership-c0030qbm.js} +7 -9
  73. package/dist/cli/{worktree-isolation-hk42yxw7.js → worktree-isolation-09qq8066.js} +36 -39
  74. package/dist/db/canonical-project.d.ts +31 -0
  75. package/dist/db/db-errors.d.ts +24 -0
  76. package/dist/db/driver-parity.d.ts +31 -0
  77. package/dist/db/durability.d.ts +40 -0
  78. package/dist/db/group-commit-writer.d.ts +117 -0
  79. package/dist/db/health.d.ts +35 -0
  80. package/dist/db/insight-candidate-store.d.ts +61 -0
  81. package/dist/db/legacy-import.d.ts +77 -0
  82. package/dist/db/phase-report-store.d.ts +45 -0
  83. package/dist/db/project-db.d.ts +35 -8
  84. package/dist/db/qa-gate-profile.d.ts +2 -0
  85. package/dist/hooks/curator-drift.d.ts +9 -5
  86. package/dist/hooks/curator-types.d.ts +1 -0
  87. package/dist/hooks/delegation-gate.d.ts +1 -0
  88. package/dist/hooks/knowledge-curator.d.ts +5 -3
  89. package/dist/hooks/micro-reflector.d.ts +12 -7
  90. package/dist/hooks/pr-workflow-gate.d.ts +14 -8
  91. package/dist/hooks/pr-workflow-response-gate.d.ts +9 -12
  92. package/dist/index.js +627 -574
  93. package/dist/memory/schema.d.ts +4 -4
  94. package/dist/pr-review/authorization.d.ts +18 -12
  95. package/dist/prm/index.d.ts +3 -1
  96. package/dist/tools/authorize-pr-review-reentry.d.ts +12 -8
  97. package/package.json +3 -2
  98. package/dist/cli/authorization-vstrh7ra.js +0 -23
  99. package/dist/cli/curator-llm-factory-v8vwz20c.js +0 -69
  100. package/dist/cli/guardrail-explain-z2qb6v67.js +0 -70
  101. package/dist/cli/hive-promoter-c62x2ncb.js +0 -84
  102. package/dist/cli/index-c8s9a3zh.js +0 -73
  103. package/dist/cli/index-ed5ykebp.js +0 -151
  104. package/dist/cli/index-mmngnxev.js +0 -883
  105. package/dist/cli/index-w7ekntej.js +0 -643
@@ -8,8 +8,8 @@ export declare const MAX_OUTCOME_QUESTION_LENGTH: number;
8
8
  export declare const MemoryScopeTypeSchema: z.ZodEnum<{
9
9
  agent: "agent";
10
10
  project: "project";
11
- workspace: "workspace";
12
11
  run: "run";
12
+ workspace: "workspace";
13
13
  repository: "repository";
14
14
  global_user: "global_user";
15
15
  cohort: "cohort";
@@ -18,8 +18,8 @@ export declare const MemoryScopeRefSchema: z.ZodObject<{
18
18
  type: z.ZodEnum<{
19
19
  agent: "agent";
20
20
  project: "project";
21
- workspace: "workspace";
22
21
  run: "run";
22
+ workspace: "workspace";
23
23
  repository: "repository";
24
24
  global_user: "global_user";
25
25
  cohort: "cohort";
@@ -75,8 +75,8 @@ export declare const MemoryRecordSchema: z.ZodObject<{
75
75
  type: z.ZodEnum<{
76
76
  agent: "agent";
77
77
  project: "project";
78
- workspace: "workspace";
79
78
  run: "run";
79
+ workspace: "workspace";
80
80
  repository: "repository";
81
81
  global_user: "global_user";
82
82
  cohort: "cohort";
@@ -173,8 +173,8 @@ export declare const MemoryProposalSchema: z.ZodObject<{
173
173
  type: z.ZodEnum<{
174
174
  agent: "agent";
175
175
  project: "project";
176
- workspace: "workspace";
177
176
  run: "run";
177
+ workspace: "workspace";
178
178
  repository: "repository";
179
179
  global_user: "global_user";
180
180
  cohort: "cohort";
@@ -7,10 +7,11 @@
7
7
  * `reviewer`/`test_engineer` may bypass the generic Stage-A task-workflow
8
8
  * requirement. The PR workflow controller issues an authorization bound to
9
9
  * the exact active session, workflow, run, base/head SHA, worktree revision
10
- * digest, role, and gate generation; the Task delegation gate consumes it
11
- * atomically, exactly once. Stale, cross-session, wrong-role, replayed,
12
- * expired, or revision-drifted requests fail closed to the normal gating
13
- * path.
10
+ * digest, role, and gate generation; the PR workflow controller boundary
11
+ * reserves it atomically for exactly one Task call and the Task delegation
12
+ * gate verifies that same call-bound reservation (idempotent for the same
13
+ * callID). Stale, cross-session, wrong-role, replayed, expired, or
14
+ * revision-drifted requests fail closed to the normal gating path.
14
15
  *
15
16
  * Binding verification: the CURRENT gate binding (head/revision/generation)
16
17
  * is supplied by the owning gate through a bound reader
@@ -80,7 +81,11 @@ type AuthorizationFile = z.infer<typeof AuthorizationFileSchema>;
80
81
  declare function reentryAuthorizationFilePath(directory: string, sessionID: string): string;
81
82
  declare function renameWithRetryAsync(tempPath: string, targetPath: string): Promise<void>;
82
83
  declare function writeAuthorizationFile(filePath: string, file: AuthorizationFile): Promise<void>;
83
- /** Drop consumed/expired records past the retention bound; keep newest first. */
84
+ /**
85
+ * Drop expired records past the retention bound; keep newest first. A burst
86
+ * of consumed records must never evict a still-live unconsumed authorization
87
+ * before its TTL, so unconsumed records take priority within the cap.
88
+ */
84
89
  declare function pruneAuthorizations(records: readonly PrReviewReentryAuthorizationRecord[], nowMs: number): PrReviewReentryAuthorizationRecord[];
85
90
  /**
86
91
  * Issue a one-use authorization for the CURRENT active PR_REVIEW workflow.
@@ -93,22 +98,23 @@ export declare function issuePrReviewReentryAuthorization(directory: string, ses
93
98
  prHeadSha: string;
94
99
  role: PrReviewReentryRole;
95
100
  }): Promise<PrReviewReentryAuthorizationRecord>;
101
+ declare function authorizationMatchesBinding(record: PrReviewReentryAuthorizationRecord, binding: PrReviewReentryBindingContext): boolean;
96
102
  /**
97
- * Atomically consume the one active authorization for this session+role.
98
- * Re-verifies the binding against the CURRENT PR_REVIEW gate state any
99
- * drift (mode change, head change, revision digest change, generation bump)
100
- * fails closed to null, as does replay, expiry, cross-session use, or wrong
101
- * role. Returns the consumed record on success.
103
+ * Reserve or verify one authorization against a binding whose owning workflow
104
+ * lock is held by the caller. The authorization-file lock is always acquired
105
+ * second. A consumed record is retained until expiry so the exact same Task
106
+ * call can verify its reservation in a later hook (and after process restart).
102
107
  */
103
- export declare function consumePrReviewReentryAuthorization(directory: string, sessionID: string, request: {
108
+ export declare function reservePrReviewReentryAuthorizationAgainstBinding(directory: string, sessionID: string, request: {
104
109
  role: PrReviewReentryRole;
105
110
  callID: string;
106
- }): Promise<PrReviewReentryAuthorizationRecord | null>;
111
+ }, binding: PrReviewReentryBindingContext): Promise<PrReviewReentryAuthorizationRecord | null>;
107
112
  export declare const _internals: {
108
113
  AUTHORIZATION_TTL_MS: number;
109
114
  MAX_ACTIVE_AUTHORIZATIONS: number;
110
115
  reentryAuthorizationFilePath: typeof reentryAuthorizationFilePath;
111
116
  pruneAuthorizations: typeof pruneAuthorizations;
117
+ authorizationMatchesBinding: typeof authorizationMatchesBinding;
112
118
  /** DI seam: the rename implementation (tests inject failure modes). */
113
119
  renameImpl: (from: string, to: string) => Promise<void>;
114
120
  /** DI seam: retry backoff schedule (tests shrink to avoid real sleeps). */
@@ -126,7 +126,9 @@ export interface PrmPatternPersistenceOptions {
126
126
  *
127
127
  * It must never gate the durable append (issue #1821 F3): AC8 says disabled
128
128
  * or crashed real-time work loses nothing, and the phase-boundary backstop
129
- * can only see candidates that reached `.swarm/insight-candidates.jsonl`.
129
+ * can only see candidates that reached the durable insight stream
130
+ * (`insight_candidate` in `.swarm/swarm.db` since #2480; previously
131
+ * `.swarm/insight-candidates.jsonl`).
130
132
  * ANDing the two flags at the call site made `realtime_admission.enabled=false`
131
133
  * silently discard every PRM candidate. Mirrors `micro-reflector.ts`, which
132
134
  * appends unconditionally and gates only its enqueue.
@@ -1,14 +1,18 @@
1
1
  import { createSwarmTool } from './create-tool.js';
2
2
  /**
3
3
  * Issue a ONE-USE reviewer re-entry authorization (issue #2383) for the
4
- * CURRENT active PR_REVIEW workflow. The very next direct Task dispatch of
5
- * the declared role consumes it atomically and bypasses ONLY the generic
6
- * Stage-A task-workflow requirement; every other delegation gate stays
7
- * authoritative. Bindings are exact (session, workflow, run, head SHA,
8
- * worktree revision digest, role, gate generation): replay, cross-session
9
- * use, wrong role, expiry, or any workflow progress since issuance fails
10
- * closed. Issue immediately before the Task dispatch authorizations are
11
- * not stockpilable.
4
+ * CURRENT active PR_REVIEW workflow. The very next direct subagent_type Task
5
+ * dispatch of the declared role reserves it atomically at the controller
6
+ * boundary admitting that one dispatch past the PR_REVIEW read-only
7
+ * restriction and the delegation gate verifies the same call-bound
8
+ * reservation while bypassing ONLY the generic Stage-A task-workflow
9
+ * requirement; every other delegation gate stays authoritative. Bindings are
10
+ * exact (session, workflow, run, head SHA, worktree revision digest, role,
11
+ * gate generation): replay, cross-session use, wrong role, expiry, or any
12
+ * workflow progress since issuance fails closed. A Task the delegation gate
13
+ * later rejects for an unrelated reason still burns the authorization —
14
+ * issue a fresh one before retrying. Issue immediately before the Task
15
+ * dispatch — authorizations are not stockpilable.
12
16
  */
13
17
  export declare function executeAuthorizePrReviewReentry(args: unknown, directory: string, context?: {
14
18
  sessionID?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.163.1",
3
+ "version": "7.164.1",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,7 +16,8 @@
16
16
  },
17
17
  "type": "module",
18
18
  "engines": {
19
- "bun": ">=1.3.13"
19
+ "bun": ">=1.3.13",
20
+ "node": ">=22.13"
20
21
  },
21
22
  "license": "MIT",
22
23
  "repository": {
@@ -1,23 +0,0 @@
1
- // @bun
2
- import {
3
- _internals,
4
- bindPrReviewReentryBindingReader,
5
- consumePrReviewReentryAuthorization,
6
- issuePrReviewReentryAuthorization
7
- } from "./index-mmngnxev.js";
8
- import"./index-w7ekntej.js";
9
- import"./index-dtn0pne5.js";
10
- import"./index-z6xqpmqg.js";
11
- import"./index-r3mvsbtq.js";
12
- import"./index-zjygnfay.js";
13
- import"./index-ed5ykebp.js";
14
- import"./index-7g4c7s5r.js";
15
- import"./index-bpmtbmy9.js";
16
- import"./index-zgwm4ryv.js";
17
- import"./index-a76rekgs.js";
18
- export {
19
- issuePrReviewReentryAuthorization,
20
- consumePrReviewReentryAuthorization,
21
- bindPrReviewReentryBindingReader,
22
- _internals
23
- };
@@ -1,69 +0,0 @@
1
- // @bun
2
- import {
3
- createCuratorLLMDelegate
4
- } from "./index-0tervb1m.js";
5
- import"./index-xyhmt813.js";
6
- import"./index-qynqyfgj.js";
7
- import"./index-r56f3f81.js";
8
- import"./index-d3azve4r.js";
9
- import"./index-0103w5pf.js";
10
- import"./index-txdagbh7.js";
11
- import"./index-n249fbw7.js";
12
- import"./index-3146wmgv.js";
13
- import"./index-n985274d.js";
14
- import"./index-2v06a1yh.js";
15
- import"./index-t34daffb.js";
16
- import"./index-70ha9e09.js";
17
- import"./index-c8s9a3zh.js";
18
- import"./index-9ss2m4rs.js";
19
- import"./index-7n9jznv0.js";
20
- import"./index-zsrtt42s.js";
21
- import"./index-g3znh2yd.js";
22
- import"./index-3f7hqtgg.js";
23
- import"./index-fckfgptr.js";
24
- import"./index-08y8pccg.js";
25
- import"./index-hm239n1p.js";
26
- import"./index-rtry5xyf.js";
27
- import"./index-zjme8atd.js";
28
- import"./index-d9gdwh34.js";
29
- import"./index-ma52g2pq.js";
30
- import"./index-ddszzne4.js";
31
- import"./index-mmngnxev.js";
32
- import"./index-w7ekntej.js";
33
- import"./index-2n1ym7jb.js";
34
- import"./index-kvra3nv1.js";
35
- import"./index-8ada7ag7.js";
36
- import"./index-556ja8an.js";
37
- import"./index-4fwbbad3.js";
38
- import"./index-b43rt5ph.js";
39
- import"./index-q7sjgr1y.js";
40
- import"./index-f923njwh.js";
41
- import"./index-4p0wyz5p.js";
42
- import"./index-66073kej.js";
43
- import"./index-zg9d392c.js";
44
- import"./index-n832052r.js";
45
- import"./index-dtn0pne5.js";
46
- import"./index-z6xqpmqg.js";
47
- import"./index-r3mvsbtq.js";
48
- import"./index-tnpf9wwv.js";
49
- import"./index-x2f1f011.js";
50
- import"./index-9e6fdz2h.js";
51
- import"./index-4rhhvd1a.js";
52
- import"./index-cqgpvx2d.js";
53
- import"./index-9xd073d4.js";
54
- import"./index-zjygnfay.js";
55
- import"./index-ae75rja9.js";
56
- import"./index-n2mhyect.js";
57
- import"./index-n67vx5zw.js";
58
- import"./index-bk5tah7q.js";
59
- import"./index-9crtmnqg.js";
60
- import"./index-3b762978.js";
61
- import"./index-2zgjcmmc.js";
62
- import"./index-ed5ykebp.js";
63
- import"./index-7g4c7s5r.js";
64
- import"./index-bpmtbmy9.js";
65
- import"./index-zgwm4ryv.js";
66
- import"./index-a76rekgs.js";
67
- export {
68
- createCuratorLLMDelegate
69
- };
@@ -1,70 +0,0 @@
1
- // @bun
2
- import {
3
- handleGuardrailExplain
4
- } from "./index-m1fvbah1.js";
5
- import"./index-0tervb1m.js";
6
- import"./index-xyhmt813.js";
7
- import"./index-qynqyfgj.js";
8
- import"./index-r56f3f81.js";
9
- import"./index-d3azve4r.js";
10
- import"./index-0103w5pf.js";
11
- import"./index-txdagbh7.js";
12
- import"./index-n249fbw7.js";
13
- import"./index-3146wmgv.js";
14
- import"./index-n985274d.js";
15
- import"./index-2v06a1yh.js";
16
- import"./index-t34daffb.js";
17
- import"./index-70ha9e09.js";
18
- import"./index-c8s9a3zh.js";
19
- import"./index-9ss2m4rs.js";
20
- import"./index-7n9jznv0.js";
21
- import"./index-zsrtt42s.js";
22
- import"./index-g3znh2yd.js";
23
- import"./index-3f7hqtgg.js";
24
- import"./index-fckfgptr.js";
25
- import"./index-08y8pccg.js";
26
- import"./index-hm239n1p.js";
27
- import"./index-rtry5xyf.js";
28
- import"./index-zjme8atd.js";
29
- import"./index-d9gdwh34.js";
30
- import"./index-ma52g2pq.js";
31
- import"./index-ddszzne4.js";
32
- import"./index-mmngnxev.js";
33
- import"./index-w7ekntej.js";
34
- import"./index-2n1ym7jb.js";
35
- import"./index-kvra3nv1.js";
36
- import"./index-8ada7ag7.js";
37
- import"./index-556ja8an.js";
38
- import"./index-4fwbbad3.js";
39
- import"./index-b43rt5ph.js";
40
- import"./index-q7sjgr1y.js";
41
- import"./index-f923njwh.js";
42
- import"./index-4p0wyz5p.js";
43
- import"./index-66073kej.js";
44
- import"./index-zg9d392c.js";
45
- import"./index-n832052r.js";
46
- import"./index-dtn0pne5.js";
47
- import"./index-z6xqpmqg.js";
48
- import"./index-r3mvsbtq.js";
49
- import"./index-tnpf9wwv.js";
50
- import"./index-x2f1f011.js";
51
- import"./index-9e6fdz2h.js";
52
- import"./index-4rhhvd1a.js";
53
- import"./index-cqgpvx2d.js";
54
- import"./index-9xd073d4.js";
55
- import"./index-zjygnfay.js";
56
- import"./index-ae75rja9.js";
57
- import"./index-n2mhyect.js";
58
- import"./index-n67vx5zw.js";
59
- import"./index-bk5tah7q.js";
60
- import"./index-9crtmnqg.js";
61
- import"./index-3b762978.js";
62
- import"./index-2zgjcmmc.js";
63
- import"./index-ed5ykebp.js";
64
- import"./index-7g4c7s5r.js";
65
- import"./index-bpmtbmy9.js";
66
- import"./index-zgwm4ryv.js";
67
- import"./index-a76rekgs.js";
68
- export {
69
- handleGuardrailExplain
70
- };
@@ -1,84 +0,0 @@
1
- // @bun
2
- import {
3
- _internals2 as _internals,
4
- checkHivePromotions,
5
- countDistinctProjects,
6
- createHivePromoterHook,
7
- isHiveEligible,
8
- promoteFromSwarm,
9
- promoteToHive
10
- } from "./index-0tervb1m.js";
11
- import"./index-xyhmt813.js";
12
- import"./index-qynqyfgj.js";
13
- import"./index-r56f3f81.js";
14
- import"./index-d3azve4r.js";
15
- import"./index-0103w5pf.js";
16
- import"./index-txdagbh7.js";
17
- import"./index-n249fbw7.js";
18
- import"./index-3146wmgv.js";
19
- import"./index-n985274d.js";
20
- import"./index-2v06a1yh.js";
21
- import"./index-t34daffb.js";
22
- import"./index-70ha9e09.js";
23
- import"./index-c8s9a3zh.js";
24
- import"./index-9ss2m4rs.js";
25
- import"./index-7n9jznv0.js";
26
- import"./index-zsrtt42s.js";
27
- import"./index-g3znh2yd.js";
28
- import"./index-3f7hqtgg.js";
29
- import"./index-fckfgptr.js";
30
- import"./index-08y8pccg.js";
31
- import"./index-hm239n1p.js";
32
- import"./index-rtry5xyf.js";
33
- import"./index-zjme8atd.js";
34
- import"./index-d9gdwh34.js";
35
- import"./index-ma52g2pq.js";
36
- import"./index-ddszzne4.js";
37
- import"./index-mmngnxev.js";
38
- import"./index-w7ekntej.js";
39
- import"./index-2n1ym7jb.js";
40
- import"./index-kvra3nv1.js";
41
- import"./index-8ada7ag7.js";
42
- import"./index-556ja8an.js";
43
- import"./index-4fwbbad3.js";
44
- import"./index-b43rt5ph.js";
45
- import"./index-q7sjgr1y.js";
46
- import {
47
- resolveHiveKnowledgePath
48
- } from "./index-f923njwh.js";
49
- import"./index-4p0wyz5p.js";
50
- import"./index-66073kej.js";
51
- import"./index-zg9d392c.js";
52
- import"./index-n832052r.js";
53
- import"./index-dtn0pne5.js";
54
- import"./index-z6xqpmqg.js";
55
- import"./index-r3mvsbtq.js";
56
- import"./index-tnpf9wwv.js";
57
- import"./index-x2f1f011.js";
58
- import"./index-9e6fdz2h.js";
59
- import"./index-4rhhvd1a.js";
60
- import"./index-cqgpvx2d.js";
61
- import"./index-9xd073d4.js";
62
- import"./index-zjygnfay.js";
63
- import"./index-ae75rja9.js";
64
- import"./index-n2mhyect.js";
65
- import"./index-n67vx5zw.js";
66
- import"./index-bk5tah7q.js";
67
- import"./index-9crtmnqg.js";
68
- import"./index-3b762978.js";
69
- import"./index-2zgjcmmc.js";
70
- import"./index-ed5ykebp.js";
71
- import"./index-7g4c7s5r.js";
72
- import"./index-bpmtbmy9.js";
73
- import"./index-zgwm4ryv.js";
74
- import"./index-a76rekgs.js";
75
- export {
76
- resolveHiveKnowledgePath,
77
- promoteToHive,
78
- promoteFromSwarm,
79
- isHiveEligible,
80
- createHivePromoterHook,
81
- countDistinctProjects,
82
- checkHivePromotions,
83
- _internals
84
- };
@@ -1,73 +0,0 @@
1
- // @bun
2
- import {
3
- log
4
- } from "./index-zgwm4ryv.js";
5
-
6
- // src/background/event-bus.ts
7
- class AutomationEventBus {
8
- listeners = new Map;
9
- eventHistory = [];
10
- maxHistorySize;
11
- constructor(options) {
12
- this.maxHistorySize = options?.maxHistorySize ?? 100;
13
- }
14
- subscribe(type, listener) {
15
- if (!this.listeners.has(type)) {
16
- this.listeners.set(type, new Set);
17
- }
18
- this.listeners.get(type).add(listener);
19
- return () => {
20
- this.listeners.get(type)?.delete(listener);
21
- };
22
- }
23
- async publish(type, payload, source) {
24
- const event = {
25
- type,
26
- timestamp: Date.now(),
27
- payload,
28
- source
29
- };
30
- this.eventHistory.push(event);
31
- if (this.eventHistory.length > this.maxHistorySize) {
32
- this.eventHistory.shift();
33
- }
34
- log(`[EventBus] ${type}`, {
35
- source,
36
- payload: typeof payload === "object" ? "..." : payload
37
- });
38
- const listeners = this.listeners.get(type);
39
- if (listeners) {
40
- await Promise.all(Array.from(listeners).map(async (listener) => {
41
- try {
42
- await listener(event);
43
- } catch (error) {
44
- log(`[EventBus] Listener error for ${type}`, { error });
45
- }
46
- }));
47
- }
48
- }
49
- getHistory(types) {
50
- if (!types || types.length === 0) {
51
- return [...this.eventHistory];
52
- }
53
- return this.eventHistory.filter((e) => types.includes(e.type));
54
- }
55
- clearHistory() {
56
- this.eventHistory = [];
57
- }
58
- getListenerCount(type) {
59
- return this.listeners.get(type)?.size ?? 0;
60
- }
61
- hasListeners(type) {
62
- return this.getListenerCount(type) > 0;
63
- }
64
- }
65
- var globalEventBus = null;
66
- function getGlobalEventBus() {
67
- if (!globalEventBus) {
68
- globalEventBus = new AutomationEventBus;
69
- }
70
- return globalEventBus;
71
- }
72
-
73
- export { getGlobalEventBus };
@@ -1,151 +0,0 @@
1
- // @bun
2
- // src/utils/swarm-artifact-cache.ts
3
- import * as fsSync from "fs";
4
- import * as fs from "fs/promises";
5
- import * as path from "path";
6
- var MAX_CACHE_ENTRIES = 128;
7
- var textCache = new Map;
8
- var parsedCache = new Map;
9
- var stats = {
10
- textReadCount: 0,
11
- textCacheHitCount: 0,
12
- textCacheMissCount: 0,
13
- parsedReadCount: 0,
14
- parseCount: 0,
15
- parsedCacheHitCount: 0,
16
- parsedCacheMissCount: 0,
17
- statFailureCount: 0,
18
- evictionCount: 0,
19
- textEvictionCount: 0,
20
- parsedEvictionCount: 0,
21
- cloneFallbackCount: 0,
22
- textEntryCount: 0,
23
- parsedEntryCount: 0
24
- };
25
- function sameStamp(a, b) {
26
- return a.mtimeMs === b.mtimeMs && a.ctimeMs === b.ctimeMs && a.size === b.size;
27
- }
28
- var _internals = {
29
- stat: fs.stat,
30
- statSync: fsSync.statSync
31
- };
32
- async function getStamp(filePath) {
33
- try {
34
- const stat2 = await _internals.stat(filePath);
35
- if (!stat2.isFile())
36
- return null;
37
- return { mtimeMs: stat2.mtimeMs, ctimeMs: stat2.ctimeMs, size: stat2.size };
38
- } catch {
39
- stats.statFailureCount++;
40
- return null;
41
- }
42
- }
43
- function canStoreRead(before, after) {
44
- return after !== null && sameStamp(before, after);
45
- }
46
- function setBounded(cache, key, value, cacheKind) {
47
- cache.set(key, value);
48
- while (cache.size > MAX_CACHE_ENTRIES) {
49
- const oldest = cache.keys().next().value;
50
- if (oldest === undefined)
51
- break;
52
- cache.delete(oldest);
53
- stats.evictionCount++;
54
- if (cacheKind === "text") {
55
- stats.textEvictionCount++;
56
- } else {
57
- stats.parsedEvictionCount++;
58
- }
59
- }
60
- stats.textEntryCount = textCache.size;
61
- stats.parsedEntryCount = parsedCache.size;
62
- }
63
- function cloneCachedValue(value) {
64
- if (value === null || typeof value !== "object")
65
- return value;
66
- if (typeof structuredClone === "function") {
67
- return structuredClone(value);
68
- }
69
- stats.cloneFallbackCount++;
70
- return JSON.parse(JSON.stringify(value));
71
- }
72
- async function readCachedTextFile(filePath, directRead) {
73
- const cacheKey = path.resolve(filePath);
74
- const stamp = await getStamp(cacheKey);
75
- if (!stamp) {
76
- stats.textReadCount++;
77
- return directRead();
78
- }
79
- const cached = textCache.get(cacheKey);
80
- if (cached && sameStamp(cached, stamp)) {
81
- stats.textCacheHitCount++;
82
- return cached.value;
83
- }
84
- stats.textCacheMissCount++;
85
- stats.textReadCount++;
86
- const value = await directRead();
87
- const afterReadStamp = await getStamp(cacheKey);
88
- if (value !== null && canStoreRead(stamp, afterReadStamp)) {
89
- setBounded(textCache, cacheKey, { ...afterReadStamp, value }, "text");
90
- }
91
- return value;
92
- }
93
- async function readCachedParsedFile(filePath, namespace, readText, parse) {
94
- const resolvedPath = path.resolve(filePath);
95
- const cacheKey = `${resolvedPath}\x00${namespace}`;
96
- const stamp = await getStamp(resolvedPath);
97
- if (!stamp) {
98
- stats.parsedReadCount++;
99
- const content2 = await readText();
100
- if (content2 === null)
101
- return null;
102
- stats.parseCount++;
103
- return parse(content2);
104
- }
105
- const cached = parsedCache.get(cacheKey);
106
- if (cached && sameStamp(cached, stamp)) {
107
- stats.parsedCacheHitCount++;
108
- return cloneCachedValue(cached.value);
109
- }
110
- stats.parsedCacheMissCount++;
111
- stats.parsedReadCount++;
112
- const content = await readText();
113
- if (content === null)
114
- return null;
115
- stats.parseCount++;
116
- const value = parse(content);
117
- const afterReadStamp = await getStamp(resolvedPath);
118
- if (canStoreRead(stamp, afterReadStamp)) {
119
- setBounded(parsedCache, cacheKey, { ...afterReadStamp, value }, "parsed");
120
- }
121
- return cloneCachedValue(value);
122
- }
123
- function invalidateCachedArtifact(filePath) {
124
- const resolvedPath = path.resolve(filePath);
125
- textCache.delete(resolvedPath);
126
- const prefix = `${resolvedPath}\x00`;
127
- for (const key of parsedCache.keys()) {
128
- if (key.startsWith(prefix))
129
- parsedCache.delete(key);
130
- }
131
- }
132
- function resetSwarmArtifactCache() {
133
- textCache.clear();
134
- parsedCache.clear();
135
- stats.textReadCount = 0;
136
- stats.textCacheHitCount = 0;
137
- stats.textCacheMissCount = 0;
138
- stats.parsedReadCount = 0;
139
- stats.parseCount = 0;
140
- stats.parsedCacheHitCount = 0;
141
- stats.parsedCacheMissCount = 0;
142
- stats.statFailureCount = 0;
143
- stats.evictionCount = 0;
144
- stats.textEvictionCount = 0;
145
- stats.parsedEvictionCount = 0;
146
- stats.cloneFallbackCount = 0;
147
- stats.textEntryCount = 0;
148
- stats.parsedEntryCount = 0;
149
- }
150
-
151
- export { readCachedTextFile, readCachedParsedFile, invalidateCachedArtifact, resetSwarmArtifactCache };