opencode-swarm 7.81.4 → 7.82.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.
- package/dist/background/completion-observer.d.ts +4 -17
- package/dist/background/pending-delegations.d.ts +12 -3
- package/dist/background/stage-b-gates.d.ts +18 -0
- package/dist/background/workspace-snapshot.d.ts +31 -0
- package/dist/cli/index.js +2 -2
- package/dist/hooks/review-receipt-collector.d.ts +8 -0
- package/dist/index.js +2511 -2177
- package/dist/tools/tool-metadata.d.ts +12 -12
- package/package.json +1 -1
|
@@ -1,27 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Background subagent completion observer/ingester.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* instrument operators use to verify the runtime signal in a real environment.
|
|
9
|
-
*
|
|
10
|
-
* PR1 async advisory lanes ingest trusted terminal completions into the durable
|
|
11
|
-
* background-delegation ledger only. This still NEVER advances workflow gates or records
|
|
12
|
-
* gate evidence; gate-bearing execution is intentionally outside this advisory path.
|
|
13
|
-
*
|
|
14
|
-
* The `synthetic` flag is the trust gate (set by OpenCode, not the model/user). Non-synthetic
|
|
15
|
-
* text that merely looks like an envelope is ignored. The observer is fail-open: any error is
|
|
16
|
-
* swallowed so it can never block event delivery or plugin load (Invariant 1/10).
|
|
4
|
+
* Trusted synthetic background completions always settle the durable
|
|
5
|
+
* background-delegation ledger. Correctness-critical Stage B completions then
|
|
6
|
+
* pass through workspace freshness validation before gate evidence, receipts, or
|
|
7
|
+
* task workflow state can advance.
|
|
17
8
|
*/
|
|
18
9
|
interface ObserverConfig {
|
|
19
10
|
enabled: boolean;
|
|
20
11
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Build the background completion observer. Returns an `event` handler suitable for the
|
|
23
|
-
* OpenCode plugin `event` hook. No-op (cheap early return) when the feature is disabled.
|
|
24
|
-
*/
|
|
25
12
|
export declare function createBackgroundCompletionObserver(opts: {
|
|
26
13
|
config: ObserverConfig;
|
|
27
14
|
directory: string;
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Scope: dispatch records `pending`/`running` snapshots, collection or trusted synthetic
|
|
14
14
|
* completions record terminal snapshots, and the stale sweep records `stale` snapshots.
|
|
15
|
-
* This store
|
|
16
|
-
*
|
|
15
|
+
* This store itself has no gate-advancement side effect. Stage B gate ingestion is a
|
|
16
|
+
* separate consumer of trusted terminal snapshots.
|
|
17
17
|
*
|
|
18
18
|
* Concurrency: all writes (append, sweep) run under a single project-scoped lock via
|
|
19
19
|
* `withEvidenceLock`, so concurrent dispatches/sweeps cannot interleave appends. Reads are
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* `.swarm/` (Invariant 4).
|
|
24
24
|
*/
|
|
25
25
|
export declare const BACKGROUND_DELEGATIONS_FILE = "background-delegations.jsonl";
|
|
26
|
-
export type BackgroundDelegationStatus = 'pending' | 'running' | 'completed' | 'error' | 'cancelled' | 'stale' | 'consumed';
|
|
26
|
+
export type BackgroundDelegationStatus = 'pending' | 'running' | 'ingestion_error' | 'completed' | 'error' | 'cancelled' | 'stale' | 'consumed';
|
|
27
27
|
export interface BackgroundDelegationRecord {
|
|
28
28
|
schemaVersion: 1 | 2;
|
|
29
29
|
/** Subagent session id from the dispatch envelope — the correlation key. */
|
|
@@ -56,6 +56,7 @@ export interface BackgroundDelegationRecord {
|
|
|
56
56
|
promptHash?: string;
|
|
57
57
|
/** Project/root provenance captured at dispatch time. */
|
|
58
58
|
workspace?: BackgroundWorkspaceSnapshot;
|
|
59
|
+
prompt?: BackgroundPromptSnapshot;
|
|
59
60
|
generation?: number;
|
|
60
61
|
result?: BackgroundDelegationResult;
|
|
61
62
|
completedAt?: number;
|
|
@@ -67,6 +68,12 @@ export interface BackgroundWorkspaceSnapshot {
|
|
|
67
68
|
prHeadSha: string | null;
|
|
68
69
|
scope: string | null;
|
|
69
70
|
}
|
|
71
|
+
export interface BackgroundPromptSnapshot {
|
|
72
|
+
text: string;
|
|
73
|
+
chars: number;
|
|
74
|
+
truncated: boolean;
|
|
75
|
+
digest: string;
|
|
76
|
+
}
|
|
70
77
|
export interface BackgroundDelegationResult {
|
|
71
78
|
text?: string;
|
|
72
79
|
error?: string;
|
|
@@ -101,6 +108,7 @@ export interface RecordPendingInput {
|
|
|
101
108
|
mode?: string;
|
|
102
109
|
promptHash?: string;
|
|
103
110
|
workspace?: BackgroundWorkspaceSnapshot;
|
|
111
|
+
prompt?: BackgroundPromptSnapshot;
|
|
104
112
|
generation?: number;
|
|
105
113
|
}
|
|
106
114
|
/**
|
|
@@ -113,6 +121,7 @@ export interface RecordPendingInput {
|
|
|
113
121
|
export declare function recordPendingDelegation(directory: string, input: RecordPendingInput, options?: {
|
|
114
122
|
staleTimeoutMs?: number;
|
|
115
123
|
}): Promise<BackgroundDelegationRecord | null>;
|
|
124
|
+
export declare function buildPromptSnapshot(text: string, maxChars: number): BackgroundPromptSnapshot;
|
|
116
125
|
export declare function appendDelegationTransition(directory: string, correlationId: string, transition: {
|
|
117
126
|
status: BackgroundDelegationStatus;
|
|
118
127
|
result?: BackgroundDelegationResult;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BackgroundDelegationRecord, BackgroundDelegationResult } from './pending-delegations.js';
|
|
2
|
+
export interface StageBIngestionResult {
|
|
3
|
+
ok: boolean;
|
|
4
|
+
consumed: boolean;
|
|
5
|
+
stale?: boolean;
|
|
6
|
+
reason?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function isBackgroundGateBearingRecord(record: BackgroundDelegationRecord): boolean;
|
|
9
|
+
export declare function validateStageBWorkspace(directory: string, record: BackgroundDelegationRecord): {
|
|
10
|
+
ok: boolean;
|
|
11
|
+
stale: boolean;
|
|
12
|
+
reason?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function ingestBackgroundStageBCompletion(args: {
|
|
15
|
+
directory: string;
|
|
16
|
+
record: BackgroundDelegationRecord;
|
|
17
|
+
result: BackgroundDelegationResult;
|
|
18
|
+
}): Promise<StageBIngestionResult>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as child_process from 'node:child_process';
|
|
2
|
+
import type { BackgroundWorkspaceSnapshot } from './pending-delegations.js';
|
|
3
|
+
type SpawnSync = typeof child_process.spawnSync;
|
|
4
|
+
interface CaptureWorkspaceSnapshotOptions {
|
|
5
|
+
scope?: string | null;
|
|
6
|
+
prHeadSha?: string | null;
|
|
7
|
+
/**
|
|
8
|
+
* Re-resolve the current upstream ref for freshness validation. When the
|
|
9
|
+
* dispatch captured an explicit PR head SHA, ingestion must compare against a
|
|
10
|
+
* live local ref, not replay the stored metadata back into the snapshot.
|
|
11
|
+
*/
|
|
12
|
+
resolveCurrentPrHeadSha?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function captureWorkspaceSnapshot(directory: string, optionsOrScope?: string | null | CaptureWorkspaceSnapshotOptions, prHeadShaArg?: string | null): BackgroundWorkspaceSnapshot;
|
|
15
|
+
export declare function workspaceSnapshotMatches(expected: BackgroundWorkspaceSnapshot | undefined, current: BackgroundWorkspaceSnapshot): {
|
|
16
|
+
ok: true;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
reason: string;
|
|
20
|
+
};
|
|
21
|
+
export type WorkspaceFreshness = ReturnType<typeof workspaceSnapshotMatches>;
|
|
22
|
+
export declare const compareWorkspaceSnapshot: typeof workspaceSnapshotMatches;
|
|
23
|
+
export declare function compareWorkspaceSnapshots(expected: BackgroundWorkspaceSnapshot | undefined, current: BackgroundWorkspaceSnapshot): {
|
|
24
|
+
stale: boolean;
|
|
25
|
+
reason?: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function digest(text: string): string;
|
|
28
|
+
export declare const _internals: {
|
|
29
|
+
spawnSync: SpawnSync;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
package/dist/cli/index.js
CHANGED
|
@@ -52,7 +52,7 @@ var package_default;
|
|
|
52
52
|
var init_package = __esm(() => {
|
|
53
53
|
package_default = {
|
|
54
54
|
name: "opencode-swarm",
|
|
55
|
-
version: "7.
|
|
55
|
+
version: "7.82.1",
|
|
56
56
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
57
57
|
main: "dist/index.js",
|
|
58
58
|
types: "dist/index.d.ts",
|
|
@@ -17771,7 +17771,7 @@ var init_tool_metadata = __esm(() => {
|
|
|
17771
17771
|
agents: ["architect"]
|
|
17772
17772
|
},
|
|
17773
17773
|
collect_lane_results: {
|
|
17774
|
-
description: "collect or poll results for a dispatch_lanes_async advisory
|
|
17774
|
+
description: "collect or poll results for a dispatch_lanes_async batch; this is the required join barrier for advisory lane workflows and does not advance workflow gates",
|
|
17775
17775
|
agents: ["architect"]
|
|
17776
17776
|
},
|
|
17777
17777
|
summarize_work: {
|
|
@@ -48,6 +48,14 @@ export interface ReviewerReceiptInput {
|
|
|
48
48
|
export interface ReviewerReceiptOutput {
|
|
49
49
|
output?: unknown;
|
|
50
50
|
}
|
|
51
|
+
export interface ReviewerReceiptTranscriptInput {
|
|
52
|
+
targetAgent?: string;
|
|
53
|
+
prompt: string;
|
|
54
|
+
transcript: string;
|
|
55
|
+
sessionID?: string;
|
|
56
|
+
sessionId?: string;
|
|
57
|
+
}
|
|
58
|
+
export declare function collectReviewerReceiptFromTranscript(directory: string, input: ReviewerReceiptTranscriptInput): Promise<string | null>;
|
|
51
59
|
/**
|
|
52
60
|
* `tool.execute.after` collector. When a reviewer Task returns, parse its
|
|
53
61
|
* verdict block and persist a durable review receipt. No-op for non-reviewer
|