opencode-swarm 7.82.2 → 7.84.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 (58) hide show
  1. package/README.md +3 -1
  2. package/dist/cli/capability-probe-jevmgwmf.js +18 -0
  3. package/dist/cli/config-doctor-4tcdd9vt.js +35 -0
  4. package/dist/cli/dispatch-k86d928w.js +477 -0
  5. package/dist/cli/evidence-summary-service-g2znnd33.js +320 -0
  6. package/dist/cli/explorer-gz70sm9b.js +16 -0
  7. package/dist/cli/gate-evidence-y8zn7fe2.js +29 -0
  8. package/dist/cli/guardrail-explain-tcamcdfy.js +30 -0
  9. package/dist/cli/guardrail-log-fd14n96q.js +15 -0
  10. package/dist/cli/index-293f68mj.js +13538 -0
  11. package/dist/cli/index-8ra2qpk8.js +29027 -0
  12. package/dist/cli/index-a76rekgs.js +67 -0
  13. package/dist/cli/index-a82d6d87.js +1241 -0
  14. package/dist/cli/index-b9v501fr.js +371 -0
  15. package/dist/cli/index-bcp79s17.js +1673 -0
  16. package/dist/cli/index-ckntc5gf.js +91 -0
  17. package/dist/cli/index-d9fbxaqd.js +2314 -0
  18. package/dist/cli/index-e7h9bb6v.js +233 -0
  19. package/dist/cli/index-e8pk68cc.js +540 -0
  20. package/dist/cli/index-eb85wtx9.js +242 -0
  21. package/dist/cli/index-f8r50m3h.js +14505 -0
  22. package/dist/cli/index-fjwwrwr5.js +37 -0
  23. package/dist/cli/index-hz59hg4h.js +452 -0
  24. package/dist/cli/index-j710h2ge.js +412 -0
  25. package/dist/cli/index-jfgr5gye.js +110 -0
  26. package/dist/cli/index-jtqkh8jf.js +119 -0
  27. package/dist/cli/index-p0arc26j.js +28 -0
  28. package/dist/cli/index-p0ye10nd.js +222 -0
  29. package/dist/cli/index-pv2xmc9k.js +2391 -0
  30. package/dist/cli/index-red8fm8p.js +2914 -0
  31. package/dist/cli/index-wg3r6acj.js +2042 -0
  32. package/dist/cli/index-xw0bcy0v.js +583 -0
  33. package/dist/cli/index-yhsmmv2z.js +339 -0
  34. package/dist/cli/index-yx44zd0p.js +40 -0
  35. package/dist/cli/index-zfsbaaqh.js +29 -0
  36. package/dist/cli/index.js +73 -69703
  37. package/dist/cli/knowledge-store-n4x6zyk7.js +73 -0
  38. package/dist/cli/pending-delegations-pz61mrsz.js +255 -0
  39. package/dist/cli/pr-subscriptions-y1nn36e5.js +33 -0
  40. package/dist/cli/schema-c2dbzhm8.js +168 -0
  41. package/dist/cli/skill-generator-a5ehggyg.js +55 -0
  42. package/dist/cli/task-envelope-qn0qtnh0.js +90 -0
  43. package/dist/cli/telemetry-9bbyxrvn.js +20 -0
  44. package/dist/cli/workspace-snapshot-w58jr2ga.js +90 -0
  45. package/dist/commands/guardrail-explain.d.ts +1 -0
  46. package/dist/commands/guardrail-log.d.ts +1 -0
  47. package/dist/commands/index.d.ts +2 -0
  48. package/dist/commands/registry.d.ts +14 -0
  49. package/dist/config/index.d.ts +2 -2
  50. package/dist/config/schema.d.ts +7 -0
  51. package/dist/hooks/guardrails/audit-log.d.ts +114 -0
  52. package/dist/hooks/repo-graph-builder.d.ts +4 -1
  53. package/dist/index.js +3615 -2378
  54. package/dist/services/diagnose-service.d.ts +5 -0
  55. package/dist/services/guardrail-explain-service.d.ts +42 -0
  56. package/dist/services/guardrail-log-service.d.ts +10 -0
  57. package/dist/tools/repo-graph/types.d.ts +6 -0
  58. 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,255 @@
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
+ }).strict();
37
+ var WorkspaceSchema = exports_external.object({
38
+ directory: exports_external.string(),
39
+ gitHead: exports_external.string().nullable(),
40
+ dirtyHash: exports_external.string().nullable(),
41
+ prHeadSha: exports_external.string().nullable(),
42
+ scope: exports_external.string().nullable()
43
+ }).strict();
44
+ var PromptSchema = exports_external.object({
45
+ text: exports_external.string(),
46
+ chars: exports_external.number(),
47
+ truncated: exports_external.boolean(),
48
+ digest: exports_external.string()
49
+ }).strict();
50
+ var RecordSchema = exports_external.object({
51
+ schemaVersion: exports_external.union([exports_external.literal(1), exports_external.literal(2)]),
52
+ correlationId: exports_external.string().min(1),
53
+ jobId: exports_external.string().nullable(),
54
+ subagentSessionId: exports_external.string().min(1),
55
+ parentSessionId: exports_external.string().min(1),
56
+ callID: exports_external.string(),
57
+ normalizedAgent: exports_external.string(),
58
+ swarmPrefixedAgent: exports_external.string(),
59
+ planTaskId: exports_external.string().nullable(),
60
+ evidenceTaskId: exports_external.string().nullable(),
61
+ status: exports_external.enum([
62
+ "pending",
63
+ "running",
64
+ "ingestion_error",
65
+ "completed",
66
+ "error",
67
+ "cancelled",
68
+ "stale",
69
+ "consumed"
70
+ ]),
71
+ createdAt: exports_external.number(),
72
+ updatedAt: exports_external.number(),
73
+ batchId: exports_external.string().optional(),
74
+ laneId: exports_external.string().optional(),
75
+ mode: exports_external.string().optional(),
76
+ promptHash: exports_external.string().optional(),
77
+ workspace: WorkspaceSchema.optional(),
78
+ prompt: PromptSchema.optional(),
79
+ generation: exports_external.number().optional(),
80
+ result: ResultSchema.optional(),
81
+ completedAt: exports_external.number().optional()
82
+ }).strict();
83
+ function storePath(directory) {
84
+ return validateSwarmPath(directory, BACKGROUND_DELEGATIONS_FILE);
85
+ }
86
+ function ensureSwarmDir(directory) {
87
+ fs.mkdirSync(path.resolve(directory, ".swarm"), { recursive: true });
88
+ }
89
+ function readDelegations(directory) {
90
+ let raw;
91
+ try {
92
+ raw = fs.readFileSync(storePath(directory), "utf-8");
93
+ } catch (err) {
94
+ if (err.code === "ENOENT")
95
+ return [];
96
+ warn(`[background] readDelegations failed: ${err instanceof Error ? err.message : String(err)}`);
97
+ return [];
98
+ }
99
+ const folded = new Map;
100
+ for (const line of raw.split(`
101
+ `)) {
102
+ const trimmed = line.trim();
103
+ if (trimmed.length === 0)
104
+ continue;
105
+ let parsedJson;
106
+ try {
107
+ parsedJson = JSON.parse(trimmed);
108
+ } catch {
109
+ continue;
110
+ }
111
+ const result = RecordSchema.safeParse(parsedJson);
112
+ if (!result.success)
113
+ continue;
114
+ folded.set(result.data.correlationId, result.data);
115
+ }
116
+ return [...folded.values()];
117
+ }
118
+ function findByCorrelationId(directory, correlationId) {
119
+ if (!correlationId)
120
+ return null;
121
+ for (const record of readDelegations(directory)) {
122
+ if (record.correlationId === correlationId)
123
+ return record;
124
+ }
125
+ return null;
126
+ }
127
+ function appendRecord(directory, record) {
128
+ ensureSwarmDir(directory);
129
+ fs.appendFileSync(storePath(directory), `${JSON.stringify(record)}
130
+ `, "utf-8");
131
+ }
132
+ async function recordPendingDelegation(directory, input, options = {}) {
133
+ const now = Date.now();
134
+ const record = {
135
+ schemaVersion: input.batchId ? 2 : 1,
136
+ correlationId: input.correlationId,
137
+ jobId: input.jobId,
138
+ subagentSessionId: input.subagentSessionId,
139
+ parentSessionId: input.parentSessionId,
140
+ callID: input.callID,
141
+ normalizedAgent: input.normalizedAgent,
142
+ swarmPrefixedAgent: input.swarmPrefixedAgent,
143
+ planTaskId: input.planTaskId,
144
+ evidenceTaskId: input.evidenceTaskId,
145
+ status: "pending",
146
+ createdAt: now,
147
+ updatedAt: now,
148
+ ...input.batchId ? { batchId: input.batchId } : {},
149
+ ...input.laneId ? { laneId: input.laneId } : {},
150
+ ...input.mode ? { mode: input.mode } : {},
151
+ ...input.promptHash ? { promptHash: input.promptHash } : {},
152
+ ...input.workspace ? { workspace: input.workspace } : {},
153
+ ...input.prompt ? { prompt: input.prompt } : {},
154
+ ...input.generation !== undefined ? { generation: input.generation } : {}
155
+ };
156
+ try {
157
+ await withEvidenceLock(directory, BACKGROUND_DELEGATIONS_FILE, STORE_LOCK_AGENT, STORE_LOCK_TASK, async () => {
158
+ if (options.staleTimeoutMs && options.staleTimeoutMs > 0) {
159
+ sweepStaleLocked(directory, options.staleTimeoutMs, now);
160
+ }
161
+ appendRecord(directory, record);
162
+ });
163
+ return record;
164
+ } catch (err) {
165
+ warn(`[background] recordPendingDelegation failed: ${err instanceof Error ? err.message : String(err)}`);
166
+ return null;
167
+ }
168
+ }
169
+ function buildPromptSnapshot(text, maxChars) {
170
+ const boundedMax = Math.max(0, Math.min(maxChars, 20000));
171
+ const truncated = text.length > boundedMax;
172
+ const bounded = truncated ? text.slice(0, boundedMax) : text;
173
+ return {
174
+ text: bounded,
175
+ chars: text.length,
176
+ truncated,
177
+ digest: createHash("sha256").update(text).digest("hex")
178
+ };
179
+ }
180
+ async function appendDelegationTransition(directory, correlationId, transition) {
181
+ const now = Date.now();
182
+ try {
183
+ let next = null;
184
+ await withEvidenceLock(directory, BACKGROUND_DELEGATIONS_FILE, STORE_LOCK_AGENT, STORE_LOCK_TASK, async () => {
185
+ const current = findByCorrelationId(directory, correlationId);
186
+ if (!current)
187
+ return;
188
+ if (isTerminal(current.status) && transition.status !== "consumed" && transition.status !== "ingestion_error") {
189
+ next = current;
190
+ return;
191
+ }
192
+ next = {
193
+ ...current,
194
+ schemaVersion: current.schemaVersion === 1 ? 2 : current.schemaVersion,
195
+ status: transition.status,
196
+ updatedAt: now,
197
+ ...transition.completedAt !== undefined ? { completedAt: transition.completedAt } : transition.status === "completed" || transition.status === "error" ? { completedAt: now } : {},
198
+ ...transition.result ? { result: transition.result } : {}
199
+ };
200
+ appendRecord(directory, next);
201
+ });
202
+ return next;
203
+ } catch (err) {
204
+ warn(`[background] appendDelegationTransition failed: ${err instanceof Error ? err.message : String(err)}`);
205
+ return null;
206
+ }
207
+ }
208
+ function findByBatchId(directory, batchId, opts) {
209
+ if (!batchId)
210
+ return [];
211
+ return readDelegations(directory).filter((record) => record.batchId === batchId && (opts?.parentSessionId === undefined || record.parentSessionId === opts.parentSessionId));
212
+ }
213
+ function findOpenAsyncLaneBatches(directory) {
214
+ return readDelegations(directory).filter((record) => record.batchId !== undefined && (record.status === "pending" || record.status === "running"));
215
+ }
216
+ function isTerminal(status) {
217
+ return status === "completed" || status === "error" || status === "cancelled" || status === "stale" || status === "consumed";
218
+ }
219
+ function sweepStaleLocked(directory, timeoutMs, now) {
220
+ let swept = 0;
221
+ for (const record of readDelegations(directory)) {
222
+ if (record.status !== "pending" && record.status !== "running" && record.status !== "ingestion_error")
223
+ continue;
224
+ if (now - record.updatedAt <= timeoutMs)
225
+ continue;
226
+ appendRecord(directory, {
227
+ ...record,
228
+ status: "stale",
229
+ updatedAt: now
230
+ });
231
+ swept += 1;
232
+ }
233
+ return swept;
234
+ }
235
+ async function sweepStaleDelegations(directory, timeoutMs) {
236
+ if (!timeoutMs || timeoutMs <= 0)
237
+ return 0;
238
+ try {
239
+ return await withEvidenceLock(directory, BACKGROUND_DELEGATIONS_FILE, STORE_LOCK_AGENT, STORE_LOCK_TASK, async () => sweepStaleLocked(directory, timeoutMs, Date.now()));
240
+ } catch (err) {
241
+ warn(`[background] sweepStaleDelegations failed: ${err instanceof Error ? err.message : String(err)}`);
242
+ return 0;
243
+ }
244
+ }
245
+ export {
246
+ sweepStaleDelegations,
247
+ recordPendingDelegation,
248
+ readDelegations,
249
+ findOpenAsyncLaneBatches,
250
+ findByCorrelationId,
251
+ findByBatchId,
252
+ buildPromptSnapshot,
253
+ appendDelegationTransition,
254
+ BACKGROUND_DELEGATIONS_FILE
255
+ };
@@ -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-wg3r6acj.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
+ };