opencode-swarm 7.113.2 → 7.113.4
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.
- package/binaries/win32-arm64/.gitkeep +0 -0
- package/binaries/win32-x64/.gitkeep +0 -0
- package/dist/background/event-bus.d.ts +1 -1
- package/dist/background/queue.d.ts +11 -0
- package/dist/background/trigger.d.ts +1 -0
- package/dist/cli/{capability-probe-sh9bwh39.js → capability-probe-f1paszww.js} +1 -1
- package/dist/cli/{config-doctor-az11cwf5.js → config-doctor-xbdfrbwt.js} +2 -2
- package/dist/cli/{core-f4cbabe7.js → core-zg8s1jwx.js} +2 -2
- package/dist/cli/{curator-drift-jvs1v6em.js → curator-drift-c0by7063.js} +2 -2
- package/dist/cli/curator-llm-factory-b3g0g0cd.js +41 -0
- package/dist/cli/{curator-9s04amtf.js → curator-nh9raf1a.js} +26 -22
- package/dist/cli/{dispatch-wst7bypk.js → dispatch-mczsxy5s.js} +2 -2
- package/dist/cli/{evidence-summary-service-w1er1ea2.js → evidence-summary-service-8g594znj.js} +7 -7
- package/dist/cli/{gate-evidence-9hdwj6tt.js → gate-evidence-vkpqt300.js} +5 -5
- package/dist/cli/guardrail-explain-wpv5eskq.js +42 -0
- package/dist/cli/{guardrail-log-hysxdwg9.js → guardrail-log-qfc2j0tb.js} +4 -4
- package/dist/cli/hive-promoter-c0fd3j02.js +51 -0
- package/dist/cli/{index-0dab9w37.js → index-0p660a87.js} +2 -2
- package/dist/cli/{index-32bx4kch.js → index-0q7rrh59.js} +4 -4
- package/dist/cli/{index-n7rd2rkj.js → index-10v7hrkj.js} +2 -2
- package/dist/cli/{index-1ey3dxq7.js → index-147ja18h.js} +0 -4
- package/dist/cli/{index-0gf6de8b.js → index-2148358e.js} +45 -1
- package/dist/cli/{index-30ejh1tx.js → index-43khae15.js} +3 -3
- package/dist/cli/{index-x5g7et24.js → index-4h2ea8h5.js} +2 -2
- package/dist/cli/{index-5mkc2f9z.js → index-4sckv7y6.js} +1 -1
- package/dist/cli/{index-w51xz4dr.js → index-5yzr9fk6.js} +25 -25
- package/dist/cli/{index-q1jaeynn.js → index-80jkseqw.js} +2 -2
- package/dist/cli/{index-wvrj16f0.js → index-8fwhhayc.js} +4 -0
- package/dist/cli/{index-54dgk0bv.js → index-ct9e0y0q.js} +803 -450
- package/dist/cli/{index-afgh75zg.js → index-f6y341yk.js} +14 -11
- package/dist/cli/{index-db1fh1fv.js → index-g40r5d08.js} +1 -1
- package/dist/cli/{index-8f256d7t.js → index-g6va6n3t.js} +1 -1
- package/dist/cli/{index-9fxs0rm1.js → index-ga4ta3cr.js} +1 -1
- package/dist/cli/{index-t6wfwdm1.js → index-h7q1bvzm.js} +3 -3
- package/dist/cli/{index-h389ed8y.js → index-mr4whary.js} +3 -3
- package/dist/cli/{index-g55nzpwn.js → index-n6fa2hhk.js} +1 -1
- package/dist/cli/{index-vn263hqt.js → index-pa6t33pt.js} +17 -10
- package/dist/cli/{index-h91bv3hy.js → index-qe3v54nb.js} +6 -1
- package/dist/cli/{index-hpp2r0sd.js → index-qzqx2qky.js} +3 -3
- package/dist/cli/{index-fhmw7evd.js → index-rdwfqhp7.js} +2 -2
- package/dist/cli/{index-1rga1vvb.js → index-wh8949ef.js} +1 -1
- package/dist/cli/{index-r9fjzr3k.js → index-xbe1wtme.js} +1 -1
- package/dist/cli/index.js +22 -22
- package/dist/cli/{knowledge-escalator-4gbz527n.js → knowledge-escalator-0q1p6br7.js} +8 -8
- package/dist/cli/{knowledge-events-b6x28fgc.js → knowledge-events-9518gzsp.js} +6 -6
- package/dist/cli/{knowledge-store-h3cjx4dg.js → knowledge-store-k5rab79h.js} +6 -6
- package/dist/cli/{knowledge-validator-q6jw2p0t.js → knowledge-validator-csay9wqj.js} +7 -7
- package/dist/cli/{pending-delegations-t047f4a7.js → pending-delegations-ddbkbgxy.js} +4 -4
- package/dist/cli/{pr-subscriptions-p8g2rzxd.js → pr-subscriptions-vwv7zm2p.js} +5 -5
- package/dist/cli/{schema-qb313fyy.js → schema-e5kd993s.js} +1 -1
- package/dist/cli/{scope-persistence-5ccgtebg.js → scope-persistence-fm0gzhnk.js} +2 -2
- package/dist/cli/{skill-generator-nnwn4sq0.js → skill-generator-z01sjppf.js} +9 -9
- package/dist/cli/{telemetry-jm7t8031.js → telemetry-jny76r83.js} +1 -1
- package/dist/commands/registry.d.ts +7 -0
- package/dist/config/constants.d.ts +1 -1
- package/dist/hooks/curator.d.ts +33 -9
- package/dist/hooks/hive-promoter.d.ts +7 -0
- package/dist/hooks/knowledge-curator.d.ts +13 -0
- package/dist/hooks/messages-transform.d.ts +22 -1
- package/dist/hooks/spawn-helper.d.ts +10 -0
- package/dist/index.js +208 -206
- package/dist/sandbox/capability-probe.d.ts +14 -0
- package/dist/sandbox/macos/sandbox-exec-executor.d.ts +5 -0
- package/dist/tools/tool-metadata.d.ts +1 -1
- package/dist/utils/path-security.d.ts +28 -0
- package/package.json +2 -1
- package/dist/cli/curator-llm-factory-dwvk7rh0.js +0 -41
- package/dist/cli/guardrail-explain-2k271yh4.js +0 -42
- package/dist/cli/hive-promoter-0y4pnft4.js +0 -49
package/dist/hooks/curator.d.ts
CHANGED
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import { listSkills, parseDraftFrontmatter, retireOrMarkStale, retireSkill } from '../services/skill-generator.js';
|
|
28
28
|
import { getSkillVersion, reviseSkill } from '../services/skill-reviser.js';
|
|
29
|
-
import type { ComplianceObservation, CuratorConfig, CuratorInitResult, CuratorPhaseResult, CuratorSummary, KnowledgeRecommendation } from './curator-types.js';
|
|
30
|
-
import { getArchivedKnowledgeIds, readKnowledge } from './knowledge-store.js';
|
|
29
|
+
import type { ComplianceObservation, CuratorConfig, CuratorInitResult, CuratorPhaseResult, CuratorSummary, KnowledgeRecommendation, PhaseDigestEntry } from './curator-types.js';
|
|
30
|
+
import { getArchivedKnowledgeIds, readKnowledge, transactFile } from './knowledge-store.js';
|
|
31
31
|
import type { KnowledgeConfig } from './knowledge-types.js';
|
|
32
32
|
import { readSkillUsageEntries } from './skill-usage-log.js';
|
|
33
33
|
/**
|
|
@@ -41,6 +41,11 @@ export declare const _internals: {
|
|
|
41
41
|
parseKnowledgeRecommendationsWithDiagnostics: typeof parseKnowledgeRecommendationsWithDiagnostics;
|
|
42
42
|
readCuratorSummary: typeof readCuratorSummary;
|
|
43
43
|
writeCuratorSummary: typeof writeCuratorSummary;
|
|
44
|
+
appendCuratorRecommendation: typeof appendCuratorRecommendation;
|
|
45
|
+
mergeCuratorPhaseSummary: typeof mergeCuratorPhaseSummary;
|
|
46
|
+
readCuratorSummaryState: typeof readCuratorSummaryState;
|
|
47
|
+
writeCuratorSummaryState: typeof writeCuratorSummaryState;
|
|
48
|
+
transactFile: typeof transactFile;
|
|
44
49
|
filterPhaseEvents: typeof filterPhaseEvents;
|
|
45
50
|
checkPhaseCompliance: typeof checkPhaseCompliance;
|
|
46
51
|
normalizeAgentName: typeof normalizeAgentName;
|
|
@@ -113,18 +118,37 @@ export declare function parseStructuredCuratorBlocks(llmOutput: string): {
|
|
|
113
118
|
candidates: import('./curator-types.js').SkillCandidate[];
|
|
114
119
|
diagnostics: StructuredCuratorDiagnostic[];
|
|
115
120
|
};
|
|
121
|
+
interface CuratorSummaryFileState {
|
|
122
|
+
summary: CuratorSummary | null;
|
|
123
|
+
dirty: boolean;
|
|
124
|
+
}
|
|
125
|
+
declare function readCuratorSummaryState(filePath: string): Promise<CuratorSummaryFileState>;
|
|
126
|
+
declare function writeCuratorSummaryState(filePath: string, state: CuratorSummaryFileState): Promise<void>;
|
|
116
127
|
/**
|
|
117
|
-
* Read curator summary from .swarm/curator-summary.json
|
|
118
|
-
*
|
|
119
|
-
*
|
|
128
|
+
* Read and normalize curator summary from .swarm/curator-summary.json.
|
|
129
|
+
* Legacy recommendation spam is deduplicated and capped on first successful read.
|
|
130
|
+
* Cleanup failure is fail-open: callers still receive the normalized in-memory state.
|
|
120
131
|
*/
|
|
121
132
|
export declare function readCuratorSummary(directory: string): Promise<CuratorSummary | null>;
|
|
133
|
+
/** Write a fully normalized curator summary under the shared summary lock. */
|
|
134
|
+
export declare function writeCuratorSummary(directory: string, summary: CuratorSummary): Promise<void>;
|
|
122
135
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
136
|
+
* Append one recommendation through the shared locked persistence boundary.
|
|
137
|
+
* Returns false when no summary exists or no persisted representation changes.
|
|
138
|
+
* A semantic duplicate can return true when it replaces the retained representative
|
|
139
|
+
* under the newest-wins policy (for example, a hive event with a newer timestamp).
|
|
126
140
|
*/
|
|
127
|
-
export declare function
|
|
141
|
+
export declare function appendCuratorRecommendation(directory: string, recommendation: KnowledgeRecommendation): Promise<boolean>;
|
|
142
|
+
interface CuratorPhaseSummaryMerge {
|
|
143
|
+
phase: number;
|
|
144
|
+
phaseDigest: PhaseDigestEntry;
|
|
145
|
+
complianceObservations: ComplianceObservation[];
|
|
146
|
+
knowledgeRecommendations: KnowledgeRecommendation[];
|
|
147
|
+
sessionId: string;
|
|
148
|
+
timestamp: string;
|
|
149
|
+
}
|
|
150
|
+
/** Merge a phase result against the latest on-disk summary under the shared lock. */
|
|
151
|
+
export declare function mergeCuratorPhaseSummary(directory: string, merge: CuratorPhaseSummaryMerge): Promise<boolean>;
|
|
128
152
|
/**
|
|
129
153
|
* Normalize an agent name to its canonical role.
|
|
130
154
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Hive promoter hook for opencode-swarm v6.17 two-tier knowledge system. */
|
|
2
|
+
import { appendCuratorRecommendation, readCuratorSummary } from './curator.js';
|
|
2
3
|
import type { KnowledgeConfig, SwarmKnowledgeEntry } from './knowledge-types.js';
|
|
3
4
|
/** Hive promotion summary for curator state */
|
|
4
5
|
export interface HivePromotionSummary {
|
|
@@ -30,6 +31,12 @@ export declare function isHiveEligible(entry: SwarmKnowledgeEntry, autoPromoteDa
|
|
|
30
31
|
* (inferTags() never produces it automatically).
|
|
31
32
|
*/
|
|
32
33
|
export declare function checkHivePromotions(swarmEntries: SwarmKnowledgeEntry[], config: KnowledgeConfig): Promise<HivePromotionSummary>;
|
|
34
|
+
export declare const _internals: {
|
|
35
|
+
readSwarmEntries: (directory: string) => Promise<SwarmKnowledgeEntry[]>;
|
|
36
|
+
checkHivePromotions: typeof checkHivePromotions;
|
|
37
|
+
readCuratorSummary: typeof readCuratorSummary;
|
|
38
|
+
appendCuratorRecommendation: typeof appendCuratorRecommendation;
|
|
39
|
+
};
|
|
33
40
|
/**
|
|
34
41
|
* Create a hook that promotes swarm entries to the hive.
|
|
35
42
|
* The hook fires unconditionally - the caller decides when to invoke it.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Knowledge curator hook for opencode-swarm v6.17 two-tier knowledge system. */
|
|
2
|
+
import { realpath } from 'node:fs/promises';
|
|
2
3
|
import type { CuratorLLMDelegate } from './curator.js';
|
|
3
4
|
import type { ActionableDirectiveFields, KnowledgeConfig, SwarmKnowledgeEntry } from './knowledge-types.js';
|
|
4
5
|
import { type InsightCandidate } from './micro-reflector.js';
|
|
@@ -6,6 +7,7 @@ declare const seenRetroSections: Map<string, {
|
|
|
6
7
|
value: string;
|
|
7
8
|
timestamp: number;
|
|
8
9
|
}>;
|
|
10
|
+
declare const inFlightEvidenceEntries: Set<string>;
|
|
9
11
|
/**
|
|
10
12
|
* Bound seenRetroSections to MAX_TRACKED_RETRO_SECTIONS entries, evicting the
|
|
11
13
|
* oldest-timestamp entries first. Called after every insert so the map can never
|
|
@@ -16,6 +18,13 @@ declare function capSeenRetroSections(): void;
|
|
|
16
18
|
/** Record a seen-section hash and enforce the size cap in one step. */
|
|
17
19
|
declare function recordSeenRetroSection(key: string, value: string, timestamp: number): void;
|
|
18
20
|
declare function hashContent(content: string): string;
|
|
21
|
+
interface EvidenceLessonBatch {
|
|
22
|
+
identity: string;
|
|
23
|
+
lessons: string[];
|
|
24
|
+
projectName: string;
|
|
25
|
+
phaseNumber: number;
|
|
26
|
+
}
|
|
27
|
+
declare function extractEvidenceLessonBatches(evidenceData: Record<string, unknown>): EvidenceLessonBatch[];
|
|
19
28
|
/**
|
|
20
29
|
* Check if the input is a write operation targeting an evidence file.
|
|
21
30
|
* Exported for testing purposes only.
|
|
@@ -141,5 +150,9 @@ export declare const _internals: {
|
|
|
141
150
|
hashContent: typeof hashContent;
|
|
142
151
|
capSeenRetroSections: typeof capSeenRetroSections;
|
|
143
152
|
MAX_TRACKED_RETRO_SECTIONS: number;
|
|
153
|
+
inFlightEvidenceEntries: typeof inFlightEvidenceEntries;
|
|
154
|
+
MAX_IN_FLIGHT_EVIDENCE_ENTRIES: number;
|
|
155
|
+
extractEvidenceLessonBatches: typeof extractEvidenceLessonBatches;
|
|
156
|
+
realpath: typeof realpath;
|
|
144
157
|
};
|
|
145
158
|
export {};
|
|
@@ -3,11 +3,32 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Note: Merged content order matches original insertion order (OpenCode base prompt
|
|
5
5
|
* first, then swarm agent prompt) - this assumes sequential message construction.
|
|
6
|
+
*
|
|
7
|
+
* Dual-shape (issue #1778 H1): the OpenCode `messages.transform` hook delivers
|
|
8
|
+
* items shaped `{ info: { role, ... }, parts: [{ type: 'text', text }] }`, while
|
|
9
|
+
* unit fixtures and some callers use the flat `{ role, content }` shape. Both
|
|
10
|
+
* must be handled — reading role from `info.role` OR top-level `role`, and text
|
|
11
|
+
* from `parts[].text` OR `content` — or the consolidation (and the invariant-10
|
|
12
|
+
* safety-net that strips system messages at index > 0 for local models) becomes
|
|
13
|
+
* a silent no-op on production data.
|
|
6
14
|
*/
|
|
7
|
-
type
|
|
15
|
+
type FlatMessage = {
|
|
8
16
|
role: string;
|
|
9
17
|
content: unknown;
|
|
10
18
|
[key: string]: unknown;
|
|
11
19
|
};
|
|
20
|
+
type PartsMessage = {
|
|
21
|
+
info: {
|
|
22
|
+
role: string;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
parts: Array<{
|
|
26
|
+
type?: string;
|
|
27
|
+
text?: string;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}>;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
export type Message = FlatMessage | PartsMessage;
|
|
12
33
|
export declare function consolidateSystemMessages(messages: Message[]): Message[];
|
|
13
34
|
export {};
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import * as child_process from 'node:child_process';
|
|
2
|
+
/**
|
|
3
|
+
* DI seam (AGENTS.md invariant #7 — prefer `_internals` over `mock.module`).
|
|
4
|
+
* Tests inject a spawn spy here to assert the win32 `.cmd` transformation of
|
|
5
|
+
* the resolved command name without depending on `npm.cmd` actually existing
|
|
6
|
+
* on the (POSIX) test runner. Restore in `afterEach`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const _internals: {
|
|
9
|
+
spawn: typeof child_process.spawn;
|
|
10
|
+
};
|
|
1
11
|
export declare function spawnAsync(command: string[], cwd: string, timeoutMs: number): Promise<{
|
|
2
12
|
exitCode: number;
|
|
3
13
|
stdout: string;
|