opencode-swarm 7.83.0 → 7.85.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 (67) hide show
  1. package/.opencode/skills/codebase-review-swarm/references/review-protocol-v8.2.md +4 -0
  2. package/.opencode/skills/council/SKILL.md +6 -1
  3. package/.opencode/skills/deep-dive/SKILL.md +2 -0
  4. package/.opencode/skills/deep-research/SKILL.md +6 -0
  5. package/.opencode/skills/swarm-pr-feedback/SKILL.md +6 -0
  6. package/.opencode/skills/swarm-pr-review/SKILL.md +4 -0
  7. package/README.md +3 -1
  8. package/dist/background/lane-output-store.d.ts +72 -0
  9. package/dist/background/pending-delegations.d.ts +6 -0
  10. package/dist/cli/capability-probe-jevmgwmf.js +18 -0
  11. package/dist/cli/config-doctor-zejarrr6.js +35 -0
  12. package/dist/cli/dispatch-k86d928w.js +477 -0
  13. package/dist/cli/evidence-summary-service-g2znnd33.js +320 -0
  14. package/dist/cli/explorer-gz70sm9b.js +16 -0
  15. package/dist/cli/gate-evidence-y8zn7fe2.js +29 -0
  16. package/dist/cli/guardrail-explain-w4txg349.js +30 -0
  17. package/dist/cli/guardrail-log-80116wmz.js +15 -0
  18. package/dist/cli/index-0sxvwjt0.js +1241 -0
  19. package/dist/cli/index-293f68mj.js +13538 -0
  20. package/dist/cli/index-5cb86007.js +110 -0
  21. package/dist/cli/index-a76rekgs.js +67 -0
  22. package/dist/cli/index-b9v501fr.js +371 -0
  23. package/dist/cli/index-bcp79s17.js +1673 -0
  24. package/dist/cli/index-ckntc5gf.js +91 -0
  25. package/dist/cli/index-d9fbxaqd.js +2314 -0
  26. package/dist/cli/index-e7h9bb6v.js +233 -0
  27. package/dist/cli/index-e8pk68cc.js +540 -0
  28. package/dist/cli/index-eb85wtx9.js +242 -0
  29. package/dist/cli/index-f8r50m3h.js +14505 -0
  30. package/dist/cli/index-fjwwrwr5.js +37 -0
  31. package/dist/cli/index-hw9b2xng.js +2046 -0
  32. package/dist/cli/index-hz59hg4h.js +452 -0
  33. package/dist/cli/index-jtqkh8jf.js +119 -0
  34. package/dist/cli/index-p0arc26j.js +28 -0
  35. package/dist/cli/index-p0ye10nd.js +222 -0
  36. package/dist/cli/index-qqabjns2.js +412 -0
  37. package/dist/cli/index-red8fm8p.js +2914 -0
  38. package/dist/cli/index-vq2321gg.js +2391 -0
  39. package/dist/cli/index-x7qck34v.js +583 -0
  40. package/dist/cli/index-yhqt45de.js +29027 -0
  41. package/dist/cli/index-yhsmmv2z.js +339 -0
  42. package/dist/cli/index-yx44zd0p.js +40 -0
  43. package/dist/cli/index-zfsbaaqh.js +29 -0
  44. package/dist/cli/index.js +73 -69708
  45. package/dist/cli/knowledge-store-n4x6zyk7.js +73 -0
  46. package/dist/cli/pending-delegations-rd40tv9s.js +261 -0
  47. package/dist/cli/pr-subscriptions-y1nn36e5.js +33 -0
  48. package/dist/cli/schema-8d32b2v6.js +168 -0
  49. package/dist/cli/skill-generator-a5ehggyg.js +55 -0
  50. package/dist/cli/task-envelope-qn0qtnh0.js +90 -0
  51. package/dist/cli/telemetry-9bbyxrvn.js +20 -0
  52. package/dist/cli/workspace-snapshot-w58jr2ga.js +90 -0
  53. package/dist/commands/guardrail-explain.d.ts +1 -0
  54. package/dist/commands/guardrail-log.d.ts +1 -0
  55. package/dist/commands/index.d.ts +2 -0
  56. package/dist/commands/registry.d.ts +14 -0
  57. package/dist/hooks/guardrails/audit-log.d.ts +114 -0
  58. package/dist/index.js +4005 -2432
  59. package/dist/services/diagnose-service.d.ts +5 -0
  60. package/dist/services/guardrail-explain-service.d.ts +42 -0
  61. package/dist/services/guardrail-log-service.d.ts +10 -0
  62. package/dist/tools/dispatch-lanes.d.ts +14 -3
  63. package/dist/tools/index.d.ts +1 -0
  64. package/dist/tools/manifest.d.ts +1 -0
  65. package/dist/tools/retrieve-lane-output.d.ts +2 -0
  66. package/dist/tools/tool-metadata.d.ts +4 -0
  67. package/package.json +2 -2
@@ -0,0 +1,73 @@
1
+ // @bun
2
+ import {
3
+ OUTCOME_SIGNAL_SMOOTHING,
4
+ _internals,
5
+ appendKnowledge,
6
+ appendKnowledgeWithCapEnforcement,
7
+ appendRejectedLesson,
8
+ appendRetractionRecord,
9
+ bumpKnowledgeConfidenceBatch,
10
+ computeConfidence,
11
+ computeOutcomeSignal,
12
+ enforceKnowledgeCap,
13
+ findNearDuplicate,
14
+ getPlatformConfigDir,
15
+ inferTags,
16
+ jaccardBigram,
17
+ normalize,
18
+ normalizeEntry,
19
+ readKnowledge,
20
+ readRejectedLessons,
21
+ readRetractionRecords,
22
+ resolveHiveEventsPath,
23
+ resolveHiveKnowledgePath,
24
+ resolveHiveRejectedPath,
25
+ resolveSwarmKnowledgePath,
26
+ resolveSwarmRejectedPath,
27
+ resolveSwarmRetractionsPath,
28
+ rewriteKnowledge,
29
+ sweepAgedEntries,
30
+ sweepStaleTodos,
31
+ transactFile,
32
+ transactKnowledge,
33
+ wordBigrams
34
+ } from "./index-e8pk68cc.js";
35
+ import"./index-fjwwrwr5.js";
36
+ import"./index-jtqkh8jf.js";
37
+ import"./index-bcp79s17.js";
38
+ import"./index-b9v501fr.js";
39
+ import"./index-p0ye10nd.js";
40
+ import"./index-a76rekgs.js";
41
+ export {
42
+ wordBigrams,
43
+ transactKnowledge,
44
+ transactFile,
45
+ sweepStaleTodos,
46
+ sweepAgedEntries,
47
+ rewriteKnowledge,
48
+ resolveSwarmRetractionsPath,
49
+ resolveSwarmRejectedPath,
50
+ resolveSwarmKnowledgePath,
51
+ resolveHiveRejectedPath,
52
+ resolveHiveKnowledgePath,
53
+ resolveHiveEventsPath,
54
+ readRetractionRecords,
55
+ readRejectedLessons,
56
+ readKnowledge,
57
+ normalizeEntry,
58
+ normalize,
59
+ jaccardBigram,
60
+ inferTags,
61
+ getPlatformConfigDir,
62
+ findNearDuplicate,
63
+ enforceKnowledgeCap,
64
+ computeOutcomeSignal,
65
+ computeConfidence,
66
+ bumpKnowledgeConfidenceBatch,
67
+ appendRetractionRecord,
68
+ appendRejectedLesson,
69
+ appendKnowledgeWithCapEnforcement,
70
+ appendKnowledge,
71
+ _internals,
72
+ OUTCOME_SIGNAL_SMOOTHING
73
+ };
@@ -0,0 +1,261 @@
1
+ // @bun
2
+ import {
3
+ validateSwarmPath
4
+ } from "./index-ckntc5gf.js";
5
+ import"./index-jtqkh8jf.js";
6
+ import"./index-zfsbaaqh.js";
7
+ import"./index-p0arc26j.js";
8
+ import {
9
+ init_logger,
10
+ warn
11
+ } from "./index-yx44zd0p.js";
12
+ import {
13
+ withEvidenceLock
14
+ } from "./index-bcp79s17.js";
15
+ import {
16
+ exports_external
17
+ } from "./index-293f68mj.js";
18
+ import"./index-b9v501fr.js";
19
+ import"./index-p0ye10nd.js";
20
+ import"./index-a76rekgs.js";
21
+
22
+ // src/background/pending-delegations.ts
23
+ import { createHash } from "crypto";
24
+ import * as fs from "fs";
25
+ import * as path from "path";
26
+ init_logger();
27
+ var BACKGROUND_DELEGATIONS_FILE = "background-delegations.jsonl";
28
+ var STORE_LOCK_AGENT = "background";
29
+ var STORE_LOCK_TASK = "background-delegations";
30
+ var ResultSchema = exports_external.object({
31
+ text: exports_external.string().optional(),
32
+ error: exports_external.string().optional(),
33
+ chars: exports_external.number(),
34
+ truncated: exports_external.boolean(),
35
+ digest: exports_external.string(),
36
+ outputRef: exports_external.string().optional(),
37
+ outputPreviewChars: exports_external.number().optional(),
38
+ outputDegraded: exports_external.boolean().optional(),
39
+ outputArtifactError: exports_external.string().optional(),
40
+ transcriptIncomplete: exports_external.boolean().optional(),
41
+ messageCount: exports_external.number().optional()
42
+ }).strict();
43
+ var WorkspaceSchema = exports_external.object({
44
+ directory: exports_external.string(),
45
+ gitHead: exports_external.string().nullable(),
46
+ dirtyHash: exports_external.string().nullable(),
47
+ prHeadSha: exports_external.string().nullable(),
48
+ scope: exports_external.string().nullable()
49
+ }).strict();
50
+ var PromptSchema = exports_external.object({
51
+ text: exports_external.string(),
52
+ chars: exports_external.number(),
53
+ truncated: exports_external.boolean(),
54
+ digest: exports_external.string()
55
+ }).strict();
56
+ var RecordSchema = exports_external.object({
57
+ schemaVersion: exports_external.union([exports_external.literal(1), exports_external.literal(2)]),
58
+ correlationId: exports_external.string().min(1),
59
+ jobId: exports_external.string().nullable(),
60
+ subagentSessionId: exports_external.string().min(1),
61
+ parentSessionId: exports_external.string().min(1),
62
+ callID: exports_external.string(),
63
+ normalizedAgent: exports_external.string(),
64
+ swarmPrefixedAgent: exports_external.string(),
65
+ planTaskId: exports_external.string().nullable(),
66
+ evidenceTaskId: exports_external.string().nullable(),
67
+ status: exports_external.enum([
68
+ "pending",
69
+ "running",
70
+ "ingestion_error",
71
+ "completed",
72
+ "error",
73
+ "cancelled",
74
+ "stale",
75
+ "consumed"
76
+ ]),
77
+ createdAt: exports_external.number(),
78
+ updatedAt: exports_external.number(),
79
+ batchId: exports_external.string().optional(),
80
+ laneId: exports_external.string().optional(),
81
+ mode: exports_external.string().optional(),
82
+ promptHash: exports_external.string().optional(),
83
+ workspace: WorkspaceSchema.optional(),
84
+ prompt: PromptSchema.optional(),
85
+ generation: exports_external.number().optional(),
86
+ result: ResultSchema.optional(),
87
+ completedAt: exports_external.number().optional()
88
+ }).strict();
89
+ function storePath(directory) {
90
+ return validateSwarmPath(directory, BACKGROUND_DELEGATIONS_FILE);
91
+ }
92
+ function ensureSwarmDir(directory) {
93
+ fs.mkdirSync(path.resolve(directory, ".swarm"), { recursive: true });
94
+ }
95
+ function readDelegations(directory) {
96
+ let raw;
97
+ try {
98
+ raw = fs.readFileSync(storePath(directory), "utf-8");
99
+ } catch (err) {
100
+ if (err.code === "ENOENT")
101
+ return [];
102
+ warn(`[background] readDelegations failed: ${err instanceof Error ? err.message : String(err)}`);
103
+ return [];
104
+ }
105
+ const folded = new Map;
106
+ for (const line of raw.split(`
107
+ `)) {
108
+ const trimmed = line.trim();
109
+ if (trimmed.length === 0)
110
+ continue;
111
+ let parsedJson;
112
+ try {
113
+ parsedJson = JSON.parse(trimmed);
114
+ } catch {
115
+ continue;
116
+ }
117
+ const result = RecordSchema.safeParse(parsedJson);
118
+ if (!result.success)
119
+ continue;
120
+ folded.set(result.data.correlationId, result.data);
121
+ }
122
+ return [...folded.values()];
123
+ }
124
+ function findByCorrelationId(directory, correlationId) {
125
+ if (!correlationId)
126
+ return null;
127
+ for (const record of readDelegations(directory)) {
128
+ if (record.correlationId === correlationId)
129
+ return record;
130
+ }
131
+ return null;
132
+ }
133
+ function appendRecord(directory, record) {
134
+ ensureSwarmDir(directory);
135
+ fs.appendFileSync(storePath(directory), `${JSON.stringify(record)}
136
+ `, "utf-8");
137
+ }
138
+ async function recordPendingDelegation(directory, input, options = {}) {
139
+ const now = Date.now();
140
+ const record = {
141
+ schemaVersion: input.batchId ? 2 : 1,
142
+ correlationId: input.correlationId,
143
+ jobId: input.jobId,
144
+ subagentSessionId: input.subagentSessionId,
145
+ parentSessionId: input.parentSessionId,
146
+ callID: input.callID,
147
+ normalizedAgent: input.normalizedAgent,
148
+ swarmPrefixedAgent: input.swarmPrefixedAgent,
149
+ planTaskId: input.planTaskId,
150
+ evidenceTaskId: input.evidenceTaskId,
151
+ status: "pending",
152
+ createdAt: now,
153
+ updatedAt: now,
154
+ ...input.batchId ? { batchId: input.batchId } : {},
155
+ ...input.laneId ? { laneId: input.laneId } : {},
156
+ ...input.mode ? { mode: input.mode } : {},
157
+ ...input.promptHash ? { promptHash: input.promptHash } : {},
158
+ ...input.workspace ? { workspace: input.workspace } : {},
159
+ ...input.prompt ? { prompt: input.prompt } : {},
160
+ ...input.generation !== undefined ? { generation: input.generation } : {}
161
+ };
162
+ try {
163
+ await withEvidenceLock(directory, BACKGROUND_DELEGATIONS_FILE, STORE_LOCK_AGENT, STORE_LOCK_TASK, async () => {
164
+ if (options.staleTimeoutMs && options.staleTimeoutMs > 0) {
165
+ sweepStaleLocked(directory, options.staleTimeoutMs, now);
166
+ }
167
+ appendRecord(directory, record);
168
+ });
169
+ return record;
170
+ } catch (err) {
171
+ warn(`[background] recordPendingDelegation failed: ${err instanceof Error ? err.message : String(err)}`);
172
+ return null;
173
+ }
174
+ }
175
+ function buildPromptSnapshot(text, maxChars) {
176
+ const boundedMax = Math.max(0, Math.min(maxChars, 20000));
177
+ const truncated = text.length > boundedMax;
178
+ const bounded = truncated ? text.slice(0, boundedMax) : text;
179
+ return {
180
+ text: bounded,
181
+ chars: text.length,
182
+ truncated,
183
+ digest: createHash("sha256").update(text).digest("hex")
184
+ };
185
+ }
186
+ async function appendDelegationTransition(directory, correlationId, transition) {
187
+ const now = Date.now();
188
+ try {
189
+ let next = null;
190
+ await withEvidenceLock(directory, BACKGROUND_DELEGATIONS_FILE, STORE_LOCK_AGENT, STORE_LOCK_TASK, async () => {
191
+ const current = findByCorrelationId(directory, correlationId);
192
+ if (!current)
193
+ return;
194
+ if (isTerminal(current.status) && transition.status !== "consumed" && transition.status !== "ingestion_error") {
195
+ next = current;
196
+ return;
197
+ }
198
+ next = {
199
+ ...current,
200
+ schemaVersion: current.schemaVersion === 1 ? 2 : current.schemaVersion,
201
+ status: transition.status,
202
+ updatedAt: now,
203
+ ...transition.completedAt !== undefined ? { completedAt: transition.completedAt } : transition.status === "completed" || transition.status === "error" ? { completedAt: now } : {},
204
+ ...transition.result ? { result: transition.result } : {}
205
+ };
206
+ appendRecord(directory, next);
207
+ });
208
+ return next;
209
+ } catch (err) {
210
+ warn(`[background] appendDelegationTransition failed: ${err instanceof Error ? err.message : String(err)}`);
211
+ return null;
212
+ }
213
+ }
214
+ function findByBatchId(directory, batchId, opts) {
215
+ if (!batchId)
216
+ return [];
217
+ return readDelegations(directory).filter((record) => record.batchId === batchId && (opts?.parentSessionId === undefined || record.parentSessionId === opts.parentSessionId));
218
+ }
219
+ function findOpenAsyncLaneBatches(directory) {
220
+ return readDelegations(directory).filter((record) => record.batchId !== undefined && (record.status === "pending" || record.status === "running"));
221
+ }
222
+ function isTerminal(status) {
223
+ return status === "completed" || status === "error" || status === "cancelled" || status === "stale" || status === "consumed";
224
+ }
225
+ function sweepStaleLocked(directory, timeoutMs, now) {
226
+ let swept = 0;
227
+ for (const record of readDelegations(directory)) {
228
+ if (record.status !== "pending" && record.status !== "running" && record.status !== "ingestion_error")
229
+ continue;
230
+ if (now - record.updatedAt <= timeoutMs)
231
+ continue;
232
+ appendRecord(directory, {
233
+ ...record,
234
+ status: "stale",
235
+ updatedAt: now
236
+ });
237
+ swept += 1;
238
+ }
239
+ return swept;
240
+ }
241
+ async function sweepStaleDelegations(directory, timeoutMs) {
242
+ if (!timeoutMs || timeoutMs <= 0)
243
+ return 0;
244
+ try {
245
+ return await withEvidenceLock(directory, BACKGROUND_DELEGATIONS_FILE, STORE_LOCK_AGENT, STORE_LOCK_TASK, async () => sweepStaleLocked(directory, timeoutMs, Date.now()));
246
+ } catch (err) {
247
+ warn(`[background] sweepStaleDelegations failed: ${err instanceof Error ? err.message : String(err)}`);
248
+ return 0;
249
+ }
250
+ }
251
+ export {
252
+ sweepStaleDelegations,
253
+ recordPendingDelegation,
254
+ readDelegations,
255
+ findOpenAsyncLaneBatches,
256
+ findByCorrelationId,
257
+ findByBatchId,
258
+ buildPromptSnapshot,
259
+ appendDelegationTransition,
260
+ BACKGROUND_DELEGATIONS_FILE
261
+ };
@@ -0,0 +1,33 @@
1
+ // @bun
2
+ import {
3
+ PR_SUBSCRIPTIONS_FILE,
4
+ buildCorrelationId,
5
+ listActive,
6
+ lookupByPr,
7
+ setOnSubscriptionCreated,
8
+ subscribe,
9
+ sweepStale,
10
+ unsubscribe,
11
+ updateSnapshot
12
+ } from "./index-eb85wtx9.js";
13
+ import"./index-ckntc5gf.js";
14
+ import"./index-jtqkh8jf.js";
15
+ import"./index-zfsbaaqh.js";
16
+ import"./index-p0arc26j.js";
17
+ import"./index-yx44zd0p.js";
18
+ import"./index-bcp79s17.js";
19
+ import"./index-293f68mj.js";
20
+ import"./index-b9v501fr.js";
21
+ import"./index-p0ye10nd.js";
22
+ import"./index-a76rekgs.js";
23
+ export {
24
+ updateSnapshot,
25
+ unsubscribe,
26
+ sweepStale,
27
+ subscribe,
28
+ setOnSubscriptionCreated,
29
+ lookupByPr,
30
+ listActive,
31
+ buildCorrelationId,
32
+ PR_SUBSCRIPTIONS_FILE
33
+ };
@@ -0,0 +1,168 @@
1
+ // @bun
2
+ import {
3
+ AdversarialDetectionConfigSchema,
4
+ AdversarialTestingConfigSchema,
5
+ AgentAuthorityRuleSchema,
6
+ AgentOverrideConfigSchema,
7
+ AgentReasoningConfigSchema,
8
+ AgentThinkingConfigSchema,
9
+ ArchitecturalSupervisionConfigSchema,
10
+ AuthorityConfigSchema,
11
+ AutoReviewConfigSchema,
12
+ AutomationCapabilitiesSchema,
13
+ AutomationConfigSchema,
14
+ AutomationModeSchema,
15
+ CheckpointConfigSchema,
16
+ CompactionAdvisoryConfigSchema,
17
+ CompactionConfigSchema,
18
+ ContextBudgetConfigSchema,
19
+ ContextMapConfigSchema,
20
+ CouncilConfigSchema,
21
+ CuratorConfigSchema,
22
+ DEFAULT_AGENT_PROFILES,
23
+ DEFAULT_ARCHITECT_PROFILE,
24
+ DEFAULT_EXTERNAL_SKILLS_CONFIG,
25
+ DecisionDecaySchema,
26
+ DesignDocsConfigSchema,
27
+ DiscoverySourceSchema,
28
+ DocsConfigSchema,
29
+ EvidenceConfigSchema,
30
+ ExternalSkillCandidateEvaluationVerdictSchema,
31
+ ExternalSkillCandidateSchema,
32
+ ExternalSkillCandidateSourceTypeSchema,
33
+ ExternalSkillsConfigSchema,
34
+ GateConfigSchema,
35
+ GateFeatureSchema,
36
+ GeneralCouncilConfigSchema,
37
+ GuardrailsConfigSchema,
38
+ GuardrailsProfileSchema,
39
+ HooksConfigSchema,
40
+ IncrementalVerifyConfigSchema,
41
+ IntegrationAnalysisConfigSchema,
42
+ KnowledgeApplicationConfigSchema,
43
+ KnowledgeConfigSchema,
44
+ LeanTurboConfigSchema,
45
+ LeanTurboStrategyConfigSchema,
46
+ LintConfigSchema,
47
+ MemoryConfigSchema,
48
+ ParallelizationConfigSchema,
49
+ PhaseCompleteConfigSchema,
50
+ PipelineConfigSchema,
51
+ PlaceholderScanConfigSchema,
52
+ PlanCursorConfigSchema,
53
+ PluginConfigSchema,
54
+ PrMonitorConfigSchema,
55
+ PrmConfigSchema,
56
+ QualityBudgetConfigSchema,
57
+ RepoGraphConfigSchema,
58
+ ReviewPassesConfigSchema,
59
+ ScoringConfigSchema,
60
+ ScoringWeightsSchema,
61
+ SecretscanConfigSchema,
62
+ SelfReviewConfigSchema,
63
+ SkillImproverConfigSchema,
64
+ SkillPropagationConfigSchema,
65
+ SlopDetectorConfigSchema,
66
+ SpecWriterConfigSchema,
67
+ StandardTurboConfigSchema,
68
+ SummaryConfigSchema,
69
+ SwarmConfigSchema,
70
+ TokenRatiosSchema,
71
+ ToolFilterConfigSchema,
72
+ TurboConfigSchema,
73
+ UIReviewConfigSchema,
74
+ WatchdogConfigSchema,
75
+ WorktreeIsolationConfigSchema,
76
+ _internals,
77
+ getCanonicalAgentRole,
78
+ isKnownCanonicalRole,
79
+ resolveExternalSkillsConfig,
80
+ resolveGeneratedAgentRole,
81
+ resolveGuardrailsConfig,
82
+ stripKnownSwarmPrefix
83
+ } from "./index-hw9b2xng.js";
84
+ import"./index-p0arc26j.js";
85
+ import"./index-293f68mj.js";
86
+ import"./index-a76rekgs.js";
87
+ export {
88
+ stripKnownSwarmPrefix,
89
+ resolveGuardrailsConfig,
90
+ resolveGeneratedAgentRole,
91
+ resolveExternalSkillsConfig,
92
+ isKnownCanonicalRole,
93
+ getCanonicalAgentRole,
94
+ _internals,
95
+ WorktreeIsolationConfigSchema,
96
+ WatchdogConfigSchema,
97
+ UIReviewConfigSchema,
98
+ TurboConfigSchema,
99
+ ToolFilterConfigSchema,
100
+ TokenRatiosSchema,
101
+ SwarmConfigSchema,
102
+ SummaryConfigSchema,
103
+ StandardTurboConfigSchema,
104
+ SpecWriterConfigSchema,
105
+ SlopDetectorConfigSchema,
106
+ SkillPropagationConfigSchema,
107
+ SkillImproverConfigSchema,
108
+ SelfReviewConfigSchema,
109
+ SecretscanConfigSchema,
110
+ ScoringWeightsSchema,
111
+ ScoringConfigSchema,
112
+ ReviewPassesConfigSchema,
113
+ RepoGraphConfigSchema,
114
+ QualityBudgetConfigSchema,
115
+ PrmConfigSchema,
116
+ PrMonitorConfigSchema,
117
+ PluginConfigSchema,
118
+ PlanCursorConfigSchema,
119
+ PlaceholderScanConfigSchema,
120
+ PipelineConfigSchema,
121
+ PhaseCompleteConfigSchema,
122
+ ParallelizationConfigSchema,
123
+ MemoryConfigSchema,
124
+ LintConfigSchema,
125
+ LeanTurboStrategyConfigSchema,
126
+ LeanTurboConfigSchema,
127
+ KnowledgeConfigSchema,
128
+ KnowledgeApplicationConfigSchema,
129
+ IntegrationAnalysisConfigSchema,
130
+ IncrementalVerifyConfigSchema,
131
+ HooksConfigSchema,
132
+ GuardrailsProfileSchema,
133
+ GuardrailsConfigSchema,
134
+ GeneralCouncilConfigSchema,
135
+ GateFeatureSchema,
136
+ GateConfigSchema,
137
+ ExternalSkillsConfigSchema,
138
+ ExternalSkillCandidateSourceTypeSchema,
139
+ ExternalSkillCandidateSchema,
140
+ ExternalSkillCandidateEvaluationVerdictSchema,
141
+ EvidenceConfigSchema,
142
+ DocsConfigSchema,
143
+ DiscoverySourceSchema,
144
+ DesignDocsConfigSchema,
145
+ DecisionDecaySchema,
146
+ DEFAULT_EXTERNAL_SKILLS_CONFIG,
147
+ DEFAULT_ARCHITECT_PROFILE,
148
+ DEFAULT_AGENT_PROFILES,
149
+ CuratorConfigSchema,
150
+ CouncilConfigSchema,
151
+ ContextMapConfigSchema,
152
+ ContextBudgetConfigSchema,
153
+ CompactionConfigSchema,
154
+ CompactionAdvisoryConfigSchema,
155
+ CheckpointConfigSchema,
156
+ AutomationModeSchema,
157
+ AutomationConfigSchema,
158
+ AutomationCapabilitiesSchema,
159
+ AutoReviewConfigSchema,
160
+ AuthorityConfigSchema,
161
+ ArchitecturalSupervisionConfigSchema,
162
+ AgentThinkingConfigSchema,
163
+ AgentReasoningConfigSchema,
164
+ AgentOverrideConfigSchema,
165
+ AgentAuthorityRuleSchema,
166
+ AdversarialTestingConfigSchema,
167
+ AdversarialDetectionConfigSchema
168
+ };
@@ -0,0 +1,55 @@
1
+ // @bun
2
+ import {
3
+ DEFAULT_SKILL_MIN_CONFIDENCE,
4
+ DEFAULT_SKILL_MIN_CONFIRMATIONS,
5
+ STRONG_SKILL_OUTCOME_COUNT,
6
+ _internals,
7
+ activateProposal,
8
+ activePath,
9
+ activeRepoRelativePath,
10
+ autoApplyProposals,
11
+ clusterEntries,
12
+ generateSkills,
13
+ inspectSkill,
14
+ isSkillMaturityEligible,
15
+ isValidSlug,
16
+ listSkills,
17
+ parseDraftFrontmatter,
18
+ proposalPath,
19
+ regenerateSkill,
20
+ renderSkillMarkdown,
21
+ retireSkill,
22
+ sanitizeSlug,
23
+ selectCandidateEntries
24
+ } from "./index-d9fbxaqd.js";
25
+ import"./index-e8pk68cc.js";
26
+ import"./index-fjwwrwr5.js";
27
+ import"./index-jtqkh8jf.js";
28
+ import"./index-yx44zd0p.js";
29
+ import"./index-bcp79s17.js";
30
+ import"./index-b9v501fr.js";
31
+ import"./index-p0ye10nd.js";
32
+ import"./index-a76rekgs.js";
33
+ export {
34
+ selectCandidateEntries,
35
+ sanitizeSlug,
36
+ retireSkill,
37
+ renderSkillMarkdown,
38
+ regenerateSkill,
39
+ proposalPath,
40
+ parseDraftFrontmatter,
41
+ listSkills,
42
+ isValidSlug,
43
+ isSkillMaturityEligible,
44
+ inspectSkill,
45
+ generateSkills,
46
+ clusterEntries,
47
+ autoApplyProposals,
48
+ activeRepoRelativePath,
49
+ activePath,
50
+ activateProposal,
51
+ _internals,
52
+ STRONG_SKILL_OUTCOME_COUNT,
53
+ DEFAULT_SKILL_MIN_CONFIRMATIONS,
54
+ DEFAULT_SKILL_MIN_CONFIDENCE
55
+ };
@@ -0,0 +1,90 @@
1
+ // @bun
2
+ import"./index-a76rekgs.js";
3
+
4
+ // src/background/task-envelope.ts
5
+ var TASK_ENVELOPE_RE = /<task\s+id="([^"]+)"\s+state="(running|completed|error)"\s*>/;
6
+ var MAX_TASK_ENVELOPE_TEXT_CHARS = 20000;
7
+ function parseTaskEnvelope(text) {
8
+ if (typeof text !== "string" || text.length === 0)
9
+ return null;
10
+ const match = text.match(TASK_ENVELOPE_RE);
11
+ if (!match)
12
+ return null;
13
+ const sessionId = match[1];
14
+ const state = match[2];
15
+ if (!sessionId)
16
+ return null;
17
+ const summary = extractTagText(text, "summary");
18
+ const resultRaw = state === "error" ? extractTagText(text, "task_error") : extractTagText(text, "task_result");
19
+ const bounded = boundEnvelopeText(resultRaw);
20
+ return {
21
+ sessionId,
22
+ state,
23
+ ...summary !== undefined ? { summary } : {},
24
+ ...state === "error" && bounded ? {
25
+ errorText: bounded.text,
26
+ resultChars: bounded.chars,
27
+ resultTruncated: bounded.truncated
28
+ } : {},
29
+ ...state !== "error" && bounded ? {
30
+ resultText: bounded.text,
31
+ resultChars: bounded.chars,
32
+ resultTruncated: bounded.truncated
33
+ } : {}
34
+ };
35
+ }
36
+ function extractTagText(text, tag) {
37
+ const re = new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`);
38
+ const match = text.match(re);
39
+ if (!match)
40
+ return;
41
+ return match[1];
42
+ }
43
+ function boundEnvelopeText(text) {
44
+ if (text === undefined)
45
+ return;
46
+ if (text.length <= MAX_TASK_ENVELOPE_TEXT_CHARS) {
47
+ return { text, chars: text.length, truncated: false };
48
+ }
49
+ const omitted = text.length - MAX_TASK_ENVELOPE_TEXT_CHARS;
50
+ const suffix = `
51
+ [... ${omitted} chars truncated by task-envelope ...]`;
52
+ const maxContent = Math.max(0, MAX_TASK_ENVELOPE_TEXT_CHARS - suffix.length);
53
+ return {
54
+ text: `${text.slice(0, maxContent)}${suffix}`,
55
+ chars: text.length,
56
+ truncated: true
57
+ };
58
+ }
59
+ function extractDispatchIds(output) {
60
+ let subagentSessionId = null;
61
+ let jobId = null;
62
+ if (typeof output === "object" && output !== null) {
63
+ const o = output;
64
+ const metadata = o.metadata;
65
+ if (typeof metadata === "object" && metadata !== null) {
66
+ const rawJobId = metadata.jobId;
67
+ if (typeof rawJobId === "string" && rawJobId.length > 0) {
68
+ jobId = rawJobId;
69
+ }
70
+ }
71
+ const rendered = o.output;
72
+ const envelope = parseTaskEnvelope(typeof rendered === "string" ? rendered : undefined);
73
+ if (envelope && envelope.state === "running") {
74
+ subagentSessionId = envelope.sessionId;
75
+ }
76
+ } else if (typeof output === "string") {
77
+ const envelope = parseTaskEnvelope(output);
78
+ if (envelope && envelope.state === "running") {
79
+ subagentSessionId = envelope.sessionId;
80
+ }
81
+ }
82
+ if (!subagentSessionId && jobId) {
83
+ subagentSessionId = jobId;
84
+ }
85
+ return { subagentSessionId, jobId };
86
+ }
87
+ export {
88
+ parseTaskEnvelope,
89
+ extractDispatchIds
90
+ };
@@ -0,0 +1,20 @@
1
+ // @bun
2
+ import {
3
+ _internals,
4
+ addTelemetryListener,
5
+ emit,
6
+ initTelemetry,
7
+ resetTelemetryForTesting,
8
+ rotateTelemetryIfNeeded,
9
+ telemetry
10
+ } from "./index-p0ye10nd.js";
11
+ import"./index-a76rekgs.js";
12
+ export {
13
+ telemetry,
14
+ rotateTelemetryIfNeeded,
15
+ resetTelemetryForTesting,
16
+ initTelemetry,
17
+ emit,
18
+ addTelemetryListener,
19
+ _internals
20
+ };