opencode-swarm 7.177.1 → 7.178.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/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
- package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
- package/dist/agents/architect.d.ts +8 -0
- package/dist/cli/{capability-probe-pdwwz8gs.js → capability-probe-8k8ebeyp.js} +2 -2
- package/dist/cli/{coder-settlement-c0kysest.js → coder-settlement-m03dfyec.js} +13 -13
- package/dist/cli/{config-doctor-bqwse4pd.js → config-doctor-x8b260sh.js} +4 -4
- package/dist/cli/{core-e6vtme4x.js → core-2d0xcyby.js} +4 -4
- package/dist/cli/{curation-policy-d8s9w1z8.js → curation-policy-7am15ht9.js} +5 -5
- package/dist/cli/{curator-2xb1d80j.js → curator-5kfkqzc9.js} +41 -41
- package/dist/cli/{curator-drift-4m984tvy.js → curator-drift-d93pwt8h.js} +5 -5
- package/dist/cli/curator-llm-factory-rgdb2ee5.js +72 -0
- package/dist/cli/{evidence-summary-service-9yxm6jkq.js → evidence-summary-service-959pwbwb.js} +20 -20
- package/dist/cli/{gate-evidence-43bnst3v.js → gate-evidence-66kjx6zj.js} +8 -8
- package/dist/cli/guardrail-explain-rre9ntq3.js +73 -0
- package/dist/cli/{guardrail-log-j7cj3rjy.js → guardrail-log-t0ydqz5s.js} +9 -9
- package/dist/cli/{guardrail-reset-jcsyfvf4.js → guardrail-reset-6gad352a.js} +41 -41
- package/dist/cli/hive-promoter-zgnagx67.js +87 -0
- package/dist/cli/{index-tbswvz8s.js → index-0pmh1kks.js} +2 -2
- package/dist/cli/{index-fnq5ac3f.js → index-1hgqs8j8.js} +5 -5
- package/dist/cli/{index-bc4x76z7.js → index-1jcy4gc6.js} +41 -41
- package/dist/cli/{index-epsy1rh1.js → index-1qnykdaw.js} +43 -43
- package/dist/cli/{index-7c24bb1r.js → index-1zrrerev.js} +2 -2
- package/dist/cli/{index-5d2avnj9.js → index-2b0ktpbf.js} +2 -2
- package/dist/cli/{index-67amf4my.js → index-2e6txjp7.js} +3 -3
- package/dist/cli/{index-634pjhe4.js → index-2pyba37z.js} +7 -7
- package/dist/cli/{index-7nsvszwn.js → index-3pzwsesm.js} +2 -2
- package/dist/cli/{index-bqmxxbrw.js → index-4e4zsj2g.js} +7 -7
- package/dist/cli/{index-fpbcxykc.js → index-6b295cas.js} +87 -1
- package/dist/cli/{index-1042jnb9.js → index-6e8fpjdg.js} +7 -3
- package/dist/cli/{index-822hhbkc.js → index-7kty6f59.js} +9 -9
- package/dist/cli/{index-k6bjkqw8.js → index-7n4dtzk4.js} +1 -1
- package/dist/cli/{index-yzjaj53h.js → index-9rwhas09.js} +1 -1
- package/dist/cli/{index-yrs4wwfq.js → index-b50qevsm.js} +4 -4
- package/dist/cli/{index-v2he8xfj.js → index-bb148vht.js} +2 -2
- package/dist/cli/{index-hp5eet6g.js → index-byfrearz.js} +4 -4
- package/dist/cli/{index-fnw6zfh0.js → index-eq1n57tg.js} +1 -1
- package/dist/cli/{index-4ygb35m1.js → index-h0kyy9rd.js} +95 -229
- package/dist/cli/{index-eefz8ghz.js → index-h4nh6s8b.js} +1 -1
- package/dist/cli/{index-j82xdrqp.js → index-j7w16s92.js} +4 -4
- package/dist/cli/{index-t6q73twc.js → index-kj599831.js} +2 -2
- package/dist/cli/{index-drgt81xf.js → index-ksq6cqg0.js} +14 -7
- package/dist/cli/{index-tj0sdxg9.js → index-kz9pcqn9.js} +2 -2
- package/dist/cli/{index-n7nzwz0q.js → index-m2n1rhgv.js} +8 -0
- package/dist/cli/{index-yhaxn5r7.js → index-ne9zamcs.js} +9 -9
- package/dist/cli/{index-vfp9hjgv.js → index-nrfjjqm4.js} +1 -1
- package/dist/cli/{index-xnednxvm.js → index-nzekzzs2.js} +4 -4
- package/dist/cli/{index-2jtmevrr.js → index-pk97v7b8.js} +6 -6
- package/dist/cli/{index-7ntcak58.js → index-pyxs697r.js} +34 -9
- package/dist/cli/{index-m0cdjvtv.js → index-qbs49vge.js} +30 -2
- package/dist/cli/{index-qgf5xexz.js → index-r78kphsr.js} +4 -4
- package/dist/cli/{index-exhm2ztr.js → index-s4bkey0q.js} +1 -1
- package/dist/cli/{index-en0p0hqp.js → index-t8dqe4ns.js} +1 -1
- package/dist/cli/{index-t2nf57mv.js → index-w1b5qqnp.js} +2 -2
- package/dist/cli/{index-yepxmq4f.js → index-wajcx84s.js} +3418 -2893
- package/dist/cli/{index-1bq6hkw5.js → index-whjrhatw.js} +1 -1
- package/dist/cli/{index-76qm2c2y.js → index-wvghb3x6.js} +4 -4
- package/dist/cli/{index-fgv6qp10.js → index-x1m1nnry.js} +37 -6
- package/dist/cli/{index-k330631a.js → index-x54339yd.js} +5 -5
- package/dist/cli/{index-cv191ybt.js → index-xr3eye3f.js} +8 -8
- package/dist/cli/{index-wemtrnch.js → index-xr9n0vjv.js} +2 -2
- package/dist/cli/{index-eya03h5m.js → index-yew23624.js} +7 -7
- package/dist/cli/{index-e48h8m73.js → index-zv3j0v08.js} +9 -5
- package/dist/cli/index.js +42 -42
- package/dist/cli/{knowledge-escalator-j4jcpver.js → knowledge-escalator-5r6mww64.js} +13 -13
- package/dist/cli/{knowledge-events-fcpzfp2m.js → knowledge-events-typjw0sd.js} +11 -11
- package/dist/cli/{knowledge-link-9z3fha35.js → knowledge-link-mvykydxg.js} +4 -4
- package/dist/cli/{knowledge-store-6evy197p.js → knowledge-store-9qcf3emn.js} +5 -5
- package/dist/cli/{knowledge-validator-s28b1ddg.js → knowledge-validator-k6ydsxzy.js} +7 -7
- package/dist/cli/{mcp-9kqsnehc.js → mcp-tedxsgey.js} +48 -7
- package/dist/cli/mcp.d.ts +9 -0
- package/dist/cli/{model-preflight-1pp1a4yf.js → model-preflight-kh9dwts2.js} +1 -1
- package/dist/cli/{pending-delegations-e15f26e0.js → pending-delegations-d20fnrzv.js} +12 -12
- package/dist/cli/{pr-subscriptions-mqv51zvm.js → pr-subscriptions-awwhg139.js} +12 -12
- package/dist/cli/{pr-workflow-gate-fj31btdv.js → pr-workflow-gate-ke79bb9c.js} +41 -41
- package/dist/cli/{runner-yhfmejzb.js → runner-y3sydwtj.js} +5 -5
- package/dist/cli/{scan-cursor-tpnq7e56.js → scan-cursor-16s6dp7f.js} +6 -6
- package/dist/cli/{schema-1wwcyaxp.js → schema-nqjp43vq.js} +4 -2
- package/dist/cli/{scope-persistence-332nvn9b.js → scope-persistence-8z1hwdr2.js} +21 -17
- package/dist/cli/{server-19bpfaps.js → server-x16hp9aq.js} +2062 -741
- package/dist/cli/{skill-generator-gn1k4yxj.js → skill-generator-xadg43ph.js} +15 -15
- package/dist/cli/{snapshot-coordination-init-6ztt4v99.js → snapshot-coordination-init-3yyzb2c4.js} +41 -41
- package/dist/cli/{telemetry-w774xb8g.js → telemetry-c9wv2cfw.js} +1 -1
- package/dist/cli/{workspace-snapshot-9gqna7gq.js → workspace-snapshot-rfnn80dg.js} +3 -3
- package/dist/cli/{worktree-collision-ownership-q2ydb0ph.js → worktree-collision-ownership-drqhmmtd.js} +13 -13
- package/dist/cli/{worktree-isolation-fsqe1qdv.js → worktree-isolation-aebdyb1m.js} +41 -41
- package/dist/commands/dashboard.d.ts +15 -0
- package/dist/commands/registry.d.ts +7 -0
- package/dist/config/plan-schema.d.ts +23 -0
- package/dist/config/schema.d.ts +16 -0
- package/dist/dashboard/assets.d.ts +12 -0
- package/dist/dashboard/index.d.ts +74 -0
- package/dist/dashboard/server.d.ts +94 -0
- package/dist/dashboard/views.d.ts +131 -0
- package/dist/evidence/phase-participation.d.ts +3 -2
- package/dist/hooks/delegation-gate.d.ts +1 -1
- package/dist/hooks/extractors.d.ts +5 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/tool-summarizer.d.ts +7 -2
- package/dist/index.js +676 -513
- package/dist/mcp/adapters/knowledge-add.d.ts +19 -0
- package/dist/mcp/adapters/receipt-status.d.ts +3 -0
- package/dist/mcp/adapters/scope-validation.d.ts +3 -0
- package/dist/mcp/registry.d.ts +26 -14
- package/dist/mcp/server.d.ts +5 -0
- package/dist/mcp/write-receipts.d.ts +168 -0
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/memory-family-migration.d.ts +35 -3
- package/dist/plan/ledger.d.ts +14 -0
- package/dist/plan/manager.d.ts +0 -2
- package/dist/plan/parallel-verdict.d.ts +28 -14
- package/dist/scope/scope-persistence.d.ts +41 -0
- package/dist/summaries/index.d.ts +1 -1
- package/dist/summaries/manager.d.ts +27 -1
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/knowledge-receipt-status.d.ts +8 -0
- package/dist/tools/manifest.d.ts +2 -0
- package/dist/tools/plan-conflict-check.d.ts +7 -6
- package/dist/tools/scope-validate.d.ts +55 -0
- package/dist/tools/tool-metadata.d.ts +8 -0
- package/dist/utils/path-security.d.ts +21 -0
- package/opencode-swarm.schema.json +14 -0
- package/package.json +1 -1
- package/dist/cli/curator-llm-factory-fywmb8jh.js +0 -72
- package/dist/cli/guardrail-explain-gm69b76w.js +0 -73
- package/dist/cli/hive-promoter-hc0r0z9h.js +0 -87
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Explicitly-authorized MCP knowledge_add adapter (#2500).
|
|
3
|
+
*
|
|
4
|
+
* This adapter owns only the MCP idempotency boundary. Validation,
|
|
5
|
+
* actionability, deduplication, reinforcement, quarantine, and the atomic
|
|
6
|
+
* knowledge transaction remain in the registered production knowledge_add
|
|
7
|
+
* tool. The adapter passes a fixed server root and never accepts a
|
|
8
|
+
* working-directory override.
|
|
9
|
+
*/
|
|
10
|
+
import { type KnowledgeAddAdapterRuntime, knowledgeAddInput } from '../write-receipts.js';
|
|
11
|
+
export interface McpKnowledgeAddWriteAdapter {
|
|
12
|
+
name: 'knowledge_add';
|
|
13
|
+
kind: 'write';
|
|
14
|
+
pathFields: string[];
|
|
15
|
+
inputSchema: typeof knowledgeAddInput;
|
|
16
|
+
execute(rawArgs: unknown, root: string, runtime?: KnowledgeAddAdapterRuntime): Promise<unknown>;
|
|
17
|
+
}
|
|
18
|
+
export declare function executeKnowledgeAdd(rawArgs: unknown, root: string, runtime?: KnowledgeAddAdapterRuntime): Promise<unknown>;
|
|
19
|
+
export declare const knowledgeAddAdapter: McpKnowledgeAddWriteAdapter;
|
package/dist/mcp/registry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tool registry for the
|
|
2
|
+
* Tool registry for the MCP verification surface (#2499, #2500).
|
|
3
3
|
*
|
|
4
4
|
* `buildMcpToolRegistry` composes the read-only tool set for ONE configured
|
|
5
5
|
* project root. Descriptions are sourced from `TOOL_METADATA` — the same
|
|
@@ -7,21 +7,20 @@
|
|
|
7
7
|
* registered tool names with exact description parity (frozen by
|
|
8
8
|
* repro/check-mcp-registry-capability-coverage.sh, C2).
|
|
9
9
|
*
|
|
10
|
-
* The write boundary is fail-closed
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* documented forward-compat seam for the #2500 write surface and adds
|
|
15
|
-
* nothing today.
|
|
10
|
+
* The write boundary is fail-closed: a write is present only when the caller
|
|
11
|
+
* supplies both the startup capability flag and an exact reviewed tool name.
|
|
12
|
+
* The positive allowlist below is checked again here (rather than trusting the
|
|
13
|
+
* CLI) so direct programmatic callers cannot widen the MCP surface.
|
|
16
14
|
*/
|
|
17
15
|
import type { z } from 'zod';
|
|
16
|
+
import type { KnowledgeAddAdapterRuntime } from './write-receipts.js';
|
|
18
17
|
/** Write-capable tool-name shapes. Mirrors the frozen C6 denylist. */
|
|
19
18
|
export declare const WRITE_TOOL_NAME_PATTERN: RegExp;
|
|
20
19
|
export interface McpReadTool {
|
|
21
20
|
/** Registered plugin tool name (a TOOL_METADATA key). */
|
|
22
21
|
name: string;
|
|
23
22
|
/** Exact TOOL_METADATA description (parity assigned at build time). */
|
|
24
|
-
description
|
|
23
|
+
description?: string;
|
|
25
24
|
kind: 'read';
|
|
26
25
|
/** Argument field names carrying file-path values (containment-checked). */
|
|
27
26
|
pathFields: string[];
|
|
@@ -29,19 +28,32 @@ export interface McpReadTool {
|
|
|
29
28
|
inputSchema: z.ZodObject<z.ZodRawShape>;
|
|
30
29
|
execute(args: Record<string, unknown>, root: string): Promise<unknown>;
|
|
31
30
|
}
|
|
31
|
+
export interface McpWriteTool {
|
|
32
|
+
/** Registered plugin tool name (a TOOL_METADATA key). */
|
|
33
|
+
name: string;
|
|
34
|
+
/** Exact TOOL_METADATA description (parity assigned at build time). */
|
|
35
|
+
description?: string;
|
|
36
|
+
kind: 'write';
|
|
37
|
+
/** Argument field names carrying file-path values (containment-checked). */
|
|
38
|
+
pathFields: string[];
|
|
39
|
+
/** MCP input schema (mirrors the reviewed tool's zod args). */
|
|
40
|
+
inputSchema: z.ZodObject<z.ZodRawShape>;
|
|
41
|
+
execute(args: Record<string, unknown>, root: string, runtime?: KnowledgeAddAdapterRuntime): Promise<unknown>;
|
|
42
|
+
}
|
|
43
|
+
export type McpTool = McpReadTool | McpWriteTool;
|
|
32
44
|
export interface McpToolRegistry {
|
|
33
|
-
tools:
|
|
45
|
+
tools: McpTool[];
|
|
34
46
|
}
|
|
35
47
|
export interface BuildMcpToolRegistryOptions {
|
|
36
48
|
/** The single configured project root (one server = one root). */
|
|
37
49
|
root: string;
|
|
38
50
|
/** Alias for `root` (accepted for harness compatibility). */
|
|
39
51
|
directory?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Forward-compat seam for the #2500 explicitly-authorized write surface.
|
|
42
|
-
* Phase 1 has no write tools, so this flag never adds anything; the
|
|
43
|
-
* write-name denylist stays fail-closed either way.
|
|
44
|
-
*/
|
|
52
|
+
/** Startup capability gate. This flag alone never registers a write. */
|
|
45
53
|
allowWrite?: boolean;
|
|
54
|
+
/** Exact reviewed write names authorized for this server instance. */
|
|
55
|
+
writeTools?: string[];
|
|
46
56
|
}
|
|
57
|
+
/** The only MCP write adapter reviewed and shipped by #2500. */
|
|
58
|
+
export declare const REVIEWED_MCP_WRITE_TOOLS: readonly ["knowledge_add"];
|
|
47
59
|
export declare function buildMcpToolRegistry(options: BuildMcpToolRegistryOptions): McpToolRegistry;
|
package/dist/mcp/server.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* the response pipeline before it leaves the server.
|
|
9
9
|
*/
|
|
10
10
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
11
|
+
import type { KnowledgeAddAdapterRuntime } from './write-receipts.js';
|
|
11
12
|
/** Containment rejection carried as a tool-level error result. */
|
|
12
13
|
export declare class McpContainmentError extends Error {
|
|
13
14
|
readonly field: string;
|
|
@@ -20,6 +21,10 @@ export declare function validatePathField(field: string, value: unknown, root: s
|
|
|
20
21
|
export interface RunMcpServerOptions {
|
|
21
22
|
root: string;
|
|
22
23
|
allowWrite?: boolean;
|
|
24
|
+
/** Exact reviewed write names authorized for this server instance. */
|
|
25
|
+
writeTools?: string[];
|
|
26
|
+
/** Test-only receipt fault and clock hooks. */
|
|
27
|
+
writeHooks?: KnowledgeAddAdapterRuntime['hooks'];
|
|
23
28
|
/** Test seam: inject transports instead of stdio (InMemoryTransport pair). */
|
|
24
29
|
transport?: {
|
|
25
30
|
connect(server: unknown): Promise<void>;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable settlement receipts for explicitly-authorized MCP writes (#2500).
|
|
3
|
+
*
|
|
4
|
+
* The receipt journal is deliberately a separate durability domain from the
|
|
5
|
+
* knowledge store. Its lock is held only while looking up or appending a
|
|
6
|
+
* receipt. A production mutation is always made after PREPARED is durable and
|
|
7
|
+
* outside that lock, so the journal cannot be nested with the knowledge-store
|
|
8
|
+
* transaction lock.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
export declare const MCP_WRITE_RECEIPTS_RELATIVE_PATH: string;
|
|
12
|
+
/**
|
|
13
|
+
* Terminal receipt history is moved here when the active journal reaches its
|
|
14
|
+
* bounded record count. Unresolved records remain active; if an active rewrite
|
|
15
|
+
* fails after archive rotation, a best-effort recovery shadow is written so a
|
|
16
|
+
* newly prepared attempt cannot disappear before mutation.
|
|
17
|
+
*/
|
|
18
|
+
export declare const MCP_WRITE_RECEIPTS_ARCHIVE_RELATIVE_PATH: string;
|
|
19
|
+
export declare const PREPARED_LEASE_MS = 30000;
|
|
20
|
+
export declare const MAX_RECEIPT_RECORDS = 500;
|
|
21
|
+
export declare const MAX_RECEIPT_ARCHIVE_RECORDS = 10000;
|
|
22
|
+
export declare const MAX_RECEIPT_LINE_BYTES = 16384;
|
|
23
|
+
export declare const MAX_RECEIPT_JOURNAL_BYTES: number;
|
|
24
|
+
export declare const MAX_RECEIPT_ARCHIVE_BYTES: number;
|
|
25
|
+
export declare const MAX_RECEIPT_RESPONSE_BYTES: number;
|
|
26
|
+
/** Immutable receipt identity version for the reviewed knowledge_add policy. */
|
|
27
|
+
export declare const KNOWLEDGE_ADD_POLICY_VERSION = "knowledge_add:v1";
|
|
28
|
+
export declare const writeReceiptStatusInput: z.ZodObject<{
|
|
29
|
+
idempotency_key: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export declare const WRITE_RECEIPT_STATES: readonly ["PREPARED", "COMMITTED", "FAILED_NO_EFFECT", "IN_DOUBT"];
|
|
32
|
+
export type WriteReceiptState = (typeof WRITE_RECEIPT_STATES)[number];
|
|
33
|
+
export interface WriteReceiptRecord {
|
|
34
|
+
version: 1;
|
|
35
|
+
receipt_id: string;
|
|
36
|
+
attempt_id: string;
|
|
37
|
+
tool: string;
|
|
38
|
+
root_hash: string;
|
|
39
|
+
idempotency_hash: string;
|
|
40
|
+
arguments_digest: string;
|
|
41
|
+
policy_digest: string;
|
|
42
|
+
state: WriteReceiptState;
|
|
43
|
+
prepared_at: number;
|
|
44
|
+
updated_at: number;
|
|
45
|
+
lease_expires_at: number;
|
|
46
|
+
response?: string;
|
|
47
|
+
error?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface WriteReceiptHooks {
|
|
50
|
+
/**
|
|
51
|
+
* Test-only fault seam. It is invoked before each durable transition. The
|
|
52
|
+
* supplied record is already sanitized and contains no raw request fields.
|
|
53
|
+
*/
|
|
54
|
+
persistReceipt?: (receipt: WriteReceiptRecord) => Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Test-only fault/order seam. It is invoked immediately before each
|
|
57
|
+
* physical archive or active-journal rewrite. The records are sanitized
|
|
58
|
+
* receipt records and the callback may throw to model an I/O failure.
|
|
59
|
+
*/
|
|
60
|
+
persistStorage?: (kind: 'archive' | 'active', records: readonly WriteReceiptRecord[]) => Promise<void>;
|
|
61
|
+
/** Test-only interruption seam after PREPARED is durable. */
|
|
62
|
+
afterPrepare?: (receipt: WriteReceiptRecord) => Promise<void>;
|
|
63
|
+
/** Test-only interruption seam after the production call returns. */
|
|
64
|
+
afterMutation?: (receipt: WriteReceiptRecord) => Promise<void>;
|
|
65
|
+
/** Test-only clock seam. Production uses Date.now. */
|
|
66
|
+
now?: () => number;
|
|
67
|
+
}
|
|
68
|
+
export interface WriteReceiptRequest {
|
|
69
|
+
root: string;
|
|
70
|
+
tool: string;
|
|
71
|
+
idempotencyKey: string;
|
|
72
|
+
arguments: unknown;
|
|
73
|
+
policy?: string;
|
|
74
|
+
}
|
|
75
|
+
export type PrepareReceiptResult = {
|
|
76
|
+
kind: 'prepared';
|
|
77
|
+
receipt: WriteReceiptRecord;
|
|
78
|
+
} | {
|
|
79
|
+
kind: 'replay';
|
|
80
|
+
receipt: WriteReceiptRecord;
|
|
81
|
+
response: unknown;
|
|
82
|
+
} | {
|
|
83
|
+
kind: 'in_progress' | 'in_doubt';
|
|
84
|
+
receipt: WriteReceiptRecord;
|
|
85
|
+
} | {
|
|
86
|
+
kind: 'conflict';
|
|
87
|
+
receipt: WriteReceiptRecord;
|
|
88
|
+
response: unknown;
|
|
89
|
+
};
|
|
90
|
+
export declare class WriteReceiptError extends Error {
|
|
91
|
+
readonly code: 'INVALID_REQUEST' | 'JOURNAL_UNAVAILABLE' | 'JOURNAL_CORRUPT' | 'JOURNAL_CAPACITY' | 'TRANSITION_REJECTED';
|
|
92
|
+
constructor(code: WriteReceiptError['code'], message: string);
|
|
93
|
+
}
|
|
94
|
+
export declare function getWriteReceiptPath(root: string): string;
|
|
95
|
+
export declare function getWriteReceiptArchivePath(root: string): string;
|
|
96
|
+
export declare function canonicalArguments(value: unknown): string;
|
|
97
|
+
export declare function computeWriteReceiptIdentity(request: WriteReceiptRequest): Pick<WriteReceiptRecord, 'root_hash' | 'idempotency_hash' | 'arguments_digest' | 'policy_digest'>;
|
|
98
|
+
export interface WriteReceiptStatus {
|
|
99
|
+
found: boolean;
|
|
100
|
+
status: WriteReceiptState | 'NOT_FOUND';
|
|
101
|
+
tool?: string;
|
|
102
|
+
receipt_id?: string;
|
|
103
|
+
attempt_id?: string;
|
|
104
|
+
updated_at?: number;
|
|
105
|
+
lease_expires_at?: number;
|
|
106
|
+
archived?: boolean;
|
|
107
|
+
/** A missing receipt is safe to submit; every recorded state is not. */
|
|
108
|
+
retryable: boolean;
|
|
109
|
+
}
|
|
110
|
+
export declare function sanitizeReceiptResponse(value: unknown, request?: Pick<WriteReceiptRequest, 'root' | 'idempotencyKey' | 'arguments'>): string;
|
|
111
|
+
export declare function parseReceiptResponse(response: string): unknown;
|
|
112
|
+
/**
|
|
113
|
+
* Read the latest status for one knowledge_add idempotency key without
|
|
114
|
+
* creating a lock or any other project state. Response/error payloads are
|
|
115
|
+
* intentionally omitted: this surface is only an uncertainty/replay probe.
|
|
116
|
+
*/
|
|
117
|
+
export declare function readWriteReceiptStatus(root: string, idempotencyKey: string): Promise<WriteReceiptStatus>;
|
|
118
|
+
/**
|
|
119
|
+
* Add fixed receipt metadata to a bounded stored response. The production
|
|
120
|
+
* result remains intact, including success:false; no receipt IDs or request
|
|
121
|
+
* fields are exposed to the MCP client.
|
|
122
|
+
*/
|
|
123
|
+
export declare function addReplayMarker(value: unknown): unknown;
|
|
124
|
+
/**
|
|
125
|
+
* Look up or durably prepare one write attempt. The returned PREPARED record
|
|
126
|
+
* owns the attempt. Callers MUST release the receipt transition lock before
|
|
127
|
+
* invoking production code, then call commitReceipt or markInDoubt.
|
|
128
|
+
*/
|
|
129
|
+
export declare function prepareReceipt(request: WriteReceiptRequest, hooks?: WriteReceiptHooks): Promise<PrepareReceiptResult>;
|
|
130
|
+
export declare function commitReceipt(request: WriteReceiptRequest, attempt: WriteReceiptRecord, response: unknown, hooks?: WriteReceiptHooks): Promise<WriteReceiptRecord>;
|
|
131
|
+
export declare function markInDoubt(request: WriteReceiptRequest, attempt: WriteReceiptRecord, error: string, hooks?: WriteReceiptHooks): Promise<WriteReceiptRecord>;
|
|
132
|
+
/**
|
|
133
|
+
* Adapter-facing execution helper. It owns the prepare/call/settle sequence
|
|
134
|
+
* but accepts the production operation as a callback so the registry can
|
|
135
|
+
* provide knowledge_add without duplicating its logic.
|
|
136
|
+
*/
|
|
137
|
+
export declare function executeWithReceipt<T>(request: WriteReceiptRequest, operation: () => Promise<T>, hooks?: WriteReceiptHooks): Promise<unknown>;
|
|
138
|
+
export declare const knowledgeAddInput: z.ZodObject<{
|
|
139
|
+
idempotency_key: z.ZodString;
|
|
140
|
+
lesson: z.ZodString;
|
|
141
|
+
category: z.ZodEnum<{
|
|
142
|
+
security: "security";
|
|
143
|
+
other: "other";
|
|
144
|
+
process: "process";
|
|
145
|
+
architecture: "architecture";
|
|
146
|
+
tooling: "tooling";
|
|
147
|
+
testing: "testing";
|
|
148
|
+
debugging: "debugging";
|
|
149
|
+
performance: "performance";
|
|
150
|
+
integration: "integration";
|
|
151
|
+
todo: "todo";
|
|
152
|
+
}>;
|
|
153
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
154
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
155
|
+
applies_to_agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
156
|
+
applies_to_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
157
|
+
required_actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
158
|
+
forbidden_actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
159
|
+
verification_checks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
160
|
+
}, z.core.$strict>;
|
|
161
|
+
export interface KnowledgeAddAdapterRuntime {
|
|
162
|
+
hooks?: WriteReceiptHooks;
|
|
163
|
+
policy?: string;
|
|
164
|
+
}
|
|
165
|
+
export declare function buildKnowledgeAddRequest(root: string, rawArgs: unknown, runtime?: KnowledgeAddAdapterRuntime): {
|
|
166
|
+
request: WriteReceiptRequest;
|
|
167
|
+
productionArgs: Record<string, unknown>;
|
|
168
|
+
};
|
package/dist/memory/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { createMemoryLifecycleHooks, type MemoryLifecycleHookOptions, type Memor
|
|
|
10
10
|
export { backupLegacyJsonl, getLegacyJsonlFileStatus, getLegacyOutcomeJsonlSignature, type JsonlBackupResult, type JsonlImportPayload, type JsonlInvalidRow, type JsonlMigrationReport, LEGACY_JSONL_MIGRATION_NAME, LEGACY_JSONL_MIGRATION_VERSION, LEGACY_JSONL_OUTCOME_META_KEY, readLegacyJsonl, readMigrationReport, resolveMemoryStorageDir, resolveSqliteDatabasePath, writeJsonlExport, writeMigrationReport, } from './jsonl-migration';
|
|
11
11
|
export { LocalJsonlMemoryProvider } from './local-jsonl-provider';
|
|
12
12
|
export { buildMemoryMaintenanceReport, type MemoryMaintenanceReport, type MemoryMaintenanceReportOptions, type MemoryRecallUsageByMemory, type MemoryRecallUsageByRole, type MemorySupersededChain, shouldCompactMemory, } from './maintenance';
|
|
13
|
+
export { MemoryMigrationLockError } from './memory-family-migration';
|
|
13
14
|
export { invalidateMemoryStoreDirCache, isMemoryLinked, MEMORY_LINK_POINTER_FILENAME, type MemoryLinkPointer, readMemoryLinkPointer, removeMemoryLinkPointer, resolveMemoryStoreDir, writeMemoryLinkPointer, } from './memory-link';
|
|
14
15
|
export type { MemoryOutcomeEvent } from './outcome-events';
|
|
15
16
|
export { computePiiScore, createPiiDetector, type PiiDetector, type PiiFinding, type PiiType, RegexPiiDetector, summarizePiiFindings, } from './pii';
|
|
@@ -18,15 +18,46 @@
|
|
|
18
18
|
* (`handleMemoryLinkCommand`), so a mid-migration failure leaves the worktree
|
|
19
19
|
* in its prior link state and a retry is idempotent.
|
|
20
20
|
*
|
|
21
|
-
* Lock discipline: `proper-lockfile` on the destination
|
|
22
|
-
* bumped `stale` (30s) for the migration
|
|
23
|
-
* knowledge family so there is one source
|
|
21
|
+
* Lock discipline: `proper-lockfile` on the destination storage dir (cohort
|
|
22
|
+
* OR local — both directions) with a bumped `stale` (30s) for the migration
|
|
23
|
+
* critical section — reused from the knowledge family so there is one source
|
|
24
|
+
* of truth for the lock config. `realpath: false` keeps the lock identity on
|
|
25
|
+
* the literal path so it is the SAME lock the local JSONL provider takes on
|
|
26
|
+
* this directory (PRR-U1): symlinked roots (e.g. macOS /var → /private/var)
|
|
27
|
+
* must not split the exclusion into two identities.
|
|
28
|
+
* Admission is fail-closed (#2577): if the destination lock cannot be
|
|
29
|
+
* acquired (a legitimate concurrent writer holds it, or acquisition fails for
|
|
30
|
+
* a storage reason), the migration throws a typed
|
|
31
|
+
* {@link MemoryMigrationLockError} and never runs unlocked.
|
|
24
32
|
*
|
|
25
33
|
* No writes happen here on the plugin-init path (invariant 1). Called only
|
|
26
34
|
* from the `/swarm memory link` / `/swarm memory unlink` command handlers.
|
|
27
35
|
*/
|
|
28
36
|
import { type MemoryOutcomeEvent } from './outcome-events.js';
|
|
29
37
|
import type { VettedMemoryRoot } from './storage-root.js';
|
|
38
|
+
/**
|
|
39
|
+
* Minimal typing for the async `proper-lockfile` API this engine uses,
|
|
40
|
+
* exposed through {@link _internals} so tests can classify acquisition
|
|
41
|
+
* failures deterministically (same DI pattern as `src/full-auto/state.ts`).
|
|
42
|
+
*/
|
|
43
|
+
type MigrationLockFile = {
|
|
44
|
+
lock: typeof import('proper-lockfile')['lock'];
|
|
45
|
+
};
|
|
46
|
+
/** Failure category for destination-lock admission (#2577, #2575 contract). */
|
|
47
|
+
export type MemoryMigrationLockErrorCategory = 'contention' | 'storage';
|
|
48
|
+
/**
|
|
49
|
+
* Typed failure for acquiring the destination migration lock. Thrown BEFORE
|
|
50
|
+
* the merge loop opens, so no destination or source write ever happens on a
|
|
51
|
+
* failed admission. Mirrors `FullAutoStateLockError` in
|
|
52
|
+
* `src/full-auto/state.ts` (#2575): stable category + code, cause preserved
|
|
53
|
+
* for diagnostics, and messages that never echo absolute host paths.
|
|
54
|
+
*/
|
|
55
|
+
export declare class MemoryMigrationLockError extends Error {
|
|
56
|
+
readonly category: MemoryMigrationLockErrorCategory;
|
|
57
|
+
readonly cause: unknown;
|
|
58
|
+
readonly code: `MEMORY_MIGRATION_LOCK_${Uppercase<MemoryMigrationLockErrorCategory>}`;
|
|
59
|
+
constructor(category: MemoryMigrationLockErrorCategory, message: string, cause?: unknown);
|
|
60
|
+
}
|
|
30
61
|
export interface MemoryFamilyMigrationCounts {
|
|
31
62
|
readonly perMember: ReadonlyArray<{
|
|
32
63
|
filename: string;
|
|
@@ -102,5 +133,6 @@ export declare const _internals: {
|
|
|
102
133
|
stageSqliteDb: typeof stageSqliteDb;
|
|
103
134
|
mergeStagedSqlite: typeof mergeStagedSqlite;
|
|
104
135
|
countRowsSafe: typeof countRowsSafe;
|
|
136
|
+
lockfile: MigrationLockFile;
|
|
105
137
|
};
|
|
106
138
|
export {};
|
package/dist/plan/ledger.d.ts
CHANGED
|
@@ -163,6 +163,20 @@ export declare function computePlanLedgerHash(plan: Plan): string;
|
|
|
163
163
|
* any structural change (description, acceptance, dependencies, files, added
|
|
164
164
|
* or removed tasks/phases) always must.
|
|
165
165
|
*
|
|
166
|
+
* DELIBERATE exception, recorded with #2532 (PLAN-4): `current_phase` — the
|
|
167
|
+
* execution cursor — IS included in this hash (and in
|
|
168
|
+
* {@link computePlanLedgerHash}). Unlike task/phase statuses, a cursor
|
|
169
|
+
* advance therefore DOES change the baseline hash: bindings and approved
|
|
170
|
+
* snapshots declared against the pre-advance plan stop matching, exactly as
|
|
171
|
+
* they already do for any save_plan revision. This is intentional — the
|
|
172
|
+
* hash bytes are persisted on every live binding (`planStructureHash`,
|
|
173
|
+
* verified with strict equality) and every critic-approved snapshot
|
|
174
|
+
* (`payload_hash`), so changing the normalization would silently invalidate
|
|
175
|
+
* all pre-existing state at upgrade. The bounded safety property: only a
|
|
176
|
+
* phase-boundary advancement moves the cursor (task-status churn inside a
|
|
177
|
+
* phase is hash-excluded), so mid-phase parallel siblings keep their
|
|
178
|
+
* bindings across ordinary task completion.
|
|
179
|
+
*
|
|
166
180
|
* This mirrors {@link computePlanLedgerHash}'s normalization byte-for-byte
|
|
167
181
|
* EXCEPT it omits the two status fields from the hashed payload. The two
|
|
168
182
|
* functions are deliberately distinct: {@link computePlanLedgerHash} is
|
package/dist/plan/manager.d.ts
CHANGED
|
@@ -44,7 +44,6 @@ import { getWorktreeMergeFailure } from '../hooks/delegation-gate/worktree-merge
|
|
|
44
44
|
import { recordTaskAttempt } from '../services/run-memory.js';
|
|
45
45
|
import { isEpicModeActiveForProject } from '../turbo/epic/state.js';
|
|
46
46
|
import { commitTaskCompletion } from '../turbo/epic/task-commit.js';
|
|
47
|
-
import { readTaskScopes } from '../turbo/lean/conflicts.js';
|
|
48
47
|
import { type LedgerEvent, type LedgerEventInput, ledgerExists, loadLastApprovedPlan, readLedgerEventsWithIntegrity, replayFromLedger, takeSnapshotWithRetry } from './ledger';
|
|
49
48
|
/** Reset the startup ledger check flag. For testing only. */
|
|
50
49
|
export declare function resetStartupLedgerCheck(): void;
|
|
@@ -69,7 +68,6 @@ export declare const _internals: {
|
|
|
69
68
|
regeneratePlanMarkdown: typeof regeneratePlanMarkdown;
|
|
70
69
|
isGitRepo: typeof isGitRepo;
|
|
71
70
|
isEpicModeActiveForProject: typeof isEpicModeActiveForProject;
|
|
72
|
-
readTaskScopes: typeof readTaskScopes;
|
|
73
71
|
commitTaskCompletion: typeof commitTaskCompletion;
|
|
74
72
|
getWorktreeMergeFailure: typeof getWorktreeMergeFailure;
|
|
75
73
|
recordTaskAttempt: typeof recordTaskAttempt;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Plan-time parallel-execution verdict helper (#1656 / #1674 v8 flagship).
|
|
3
3
|
*
|
|
4
|
-
* Pure,
|
|
4
|
+
* Pure, side-effect-free pairwise conflict analysis for N proposed
|
|
5
5
|
* parallel task groups. Used by BOTH:
|
|
6
6
|
* - the `plan_conflict_check` tool (architect-facing advisory — see
|
|
7
7
|
* `src/tools/plan-conflict-check.ts`), and
|
|
@@ -14,23 +14,30 @@
|
|
|
14
14
|
* means.
|
|
15
15
|
*
|
|
16
16
|
* Design notes:
|
|
17
|
-
* - Sync by design: it reads only
|
|
18
|
-
* the
|
|
19
|
-
* `toolBefore` on every tool call
|
|
20
|
-
* helper would violate the bounded-gate
|
|
17
|
+
* - Sync by design: it reads only the authoritative v2 scope-binding store
|
|
18
|
+
* (the same authority `declare_scope` writes) via the hardened
|
|
19
|
+
* fail-closed readers. The gate runs in `toolBefore` on every tool call
|
|
20
|
+
* and must stay bounded; an async helper would violate the bounded-gate
|
|
21
|
+
* spirit. One binding-set scan is hoisted per verdict, never per task.
|
|
22
|
+
* - #2532 (PARALLEL-4): scope resolution deliberately does NOT consult the
|
|
23
|
+
* legacy v1 `.swarm/scopes/scope-<taskId>.json` projection — no production
|
|
24
|
+
* code writes it in the project root (its one writer targets lane
|
|
25
|
+
* worktrees), so v2-declared disjoint scopes used to be reported as
|
|
26
|
+
* `unknown_scopes` and parallel-first could never engage.
|
|
21
27
|
* - The helper itself NEVER calls `getCoChangePairs` (async + `git log`).
|
|
22
28
|
* Co-change signal is opt-in and supplied by the caller (the tool) via
|
|
23
29
|
* `options.cochangePairs`. The gate never supplies it, keeping the
|
|
24
30
|
* enforcement path git-free and fast.
|
|
25
|
-
* - Fail-closed: a
|
|
26
|
-
* with everything, so `verdict` can never be
|
|
27
|
-
* lacks a declared scope. This is the v8
|
|
31
|
+
* - Fail-closed: a task with no single live exact-plan v2 binding →
|
|
32
|
+
* `unknown`, which conflicts with everything, so `verdict` can never be
|
|
33
|
+
* `all_disjoint` while any task lacks a declared scope. This is the v8
|
|
34
|
+
* safety guarantee.
|
|
28
35
|
* - Writes nothing. Honors issue #1656's "read-only (writes nothing)" tool
|
|
29
36
|
* acceptance criterion.
|
|
30
37
|
*/
|
|
38
|
+
import { type Plan } from '../config/plan-schema.js';
|
|
31
39
|
import type { CoChangeEntry } from '../tools/co-change-analyzer.js';
|
|
32
40
|
import { type CoChangeThreshold } from '../turbo/epic/cochange-conflict.js';
|
|
33
|
-
import { normalizePath, pathsConflict, readTaskScopes } from '../turbo/lean/conflicts.js';
|
|
34
41
|
/**
|
|
35
42
|
* Per-pair conflict classification. Mirrors `EpicPairVerdict`'s signal
|
|
36
43
|
* decomposition but flattens `none` into `disjoint` for the plan-level view.
|
|
@@ -70,14 +77,22 @@ export interface ComputeParallelVerdictOptions {
|
|
|
70
77
|
cochangePairs?: CoChangeEntry[];
|
|
71
78
|
/** Override the co-change threshold. Defaults to `DEFAULT_PARALLEL_COCHANGE_THRESHOLD`. */
|
|
72
79
|
cochangeThreshold?: CoChangeThreshold;
|
|
80
|
+
/**
|
|
81
|
+
* The plan the verdict is computed against (issue #2532). Bindings must
|
|
82
|
+
* match its exact identity (`planId` + `planStructureHash`). When omitted,
|
|
83
|
+
* the helper synchronously reads `<directory>/.swarm/plan.json`; a missing
|
|
84
|
+
* or unparseable plan resolves every task to `unknown` (fail-closed).
|
|
85
|
+
*/
|
|
86
|
+
plan?: Plan;
|
|
73
87
|
}
|
|
74
88
|
/**
|
|
75
89
|
* Compute a pairwise conflict verdict for the given task ids.
|
|
76
90
|
*
|
|
77
|
-
* Pure + synchronous. Reads only
|
|
78
|
-
*
|
|
91
|
+
* Pure + synchronous. Reads only the authoritative v2 binding store (plus a
|
|
92
|
+
* bounded plan.json read when `options.plan` is omitted). Writes nothing.
|
|
93
|
+
* Fail-closed on any read/parse error (treats the task as `unknown`).
|
|
79
94
|
*
|
|
80
|
-
* @param directory Project root (for
|
|
95
|
+
* @param directory Project root (for the binding store and plan.json reads).
|
|
81
96
|
* @param taskIds Task ids to analyze. Caller is responsible for min-length
|
|
82
97
|
* validation (the tool requires ≥2; the gate only calls this
|
|
83
98
|
* with ≥2 pending tasks).
|
|
@@ -90,5 +105,4 @@ export declare function computeParallelVerdict(directory: string, taskIds: strin
|
|
|
90
105
|
* Equivalent to `computeParallelVerdict(...).verdict === 'all_disjoint'` but
|
|
91
106
|
* exposed as a named predicate so the gate reads as intent.
|
|
92
107
|
*/
|
|
93
|
-
export declare function isProvablyDisjoint(directory: string, taskIds: string[]): boolean;
|
|
94
|
-
export { normalizePath, pathsConflict, readTaskScopes };
|
|
108
|
+
export declare function isProvablyDisjoint(directory: string, taskIds: string[], options?: ComputeParallelVerdictOptions): boolean;
|
|
@@ -117,6 +117,47 @@ export declare function readScopeBindingFromDisk(input: {
|
|
|
117
117
|
requireDispatchCorrelation?: boolean;
|
|
118
118
|
requireDeclaration?: boolean;
|
|
119
119
|
}): ScopeBinding | null;
|
|
120
|
+
/**
|
|
121
|
+
* Resolve the currently-declared scope FILES for a task from the authoritative
|
|
122
|
+
* v2 binding store (issue #2532 / PARALLEL-4).
|
|
123
|
+
*
|
|
124
|
+
* Scheduling/conflict consumers (the v8 parallel verdict, Rule-2 auto-commit)
|
|
125
|
+
* must resolve task scopes from the same authority `declare_scope` writes —
|
|
126
|
+
* never from the legacy v1 `scope-<taskId>.json` projection, which no
|
|
127
|
+
* production code writes in the project root. This is a scheduling read, NOT
|
|
128
|
+
* write authorization: it deliberately does not require owner-session or
|
|
129
|
+
* dispatch correlation, but it DOES require an exact `planStructureHash`
|
|
130
|
+
* match so a declaration made against an older plan revision cannot certify
|
|
131
|
+
* disjointness for the current one.
|
|
132
|
+
*
|
|
133
|
+
* Fail-closed: zero live candidates (undeclared or store failure), live
|
|
134
|
+
* candidates that DISAGREE on the file set, or an empty file list all return
|
|
135
|
+
* `null`, which callers treat as "unknown scope" → serial. Multiple live
|
|
136
|
+
* candidates that AGREE on the exact same file set are NOT ambiguous: the
|
|
137
|
+
* delegation gate mints a dispatch-correlated binding (activation 'active',
|
|
138
|
+
* child owner) alongside the architect's declaration binding for the same
|
|
139
|
+
* task with the same files, and the scheduling question — "what is this
|
|
140
|
+
* task's currently-declared scope?" — has one answer whenever they agree.
|
|
141
|
+
*
|
|
142
|
+
* `bindingSet` lets a multi-task caller hoist ONE
|
|
143
|
+
* `readAllAuthoritativeScopeBindings` scan for the whole verdict (pass the
|
|
144
|
+
* result of {@link readAuthoritativeScopeBindingSet}); omit it for a
|
|
145
|
+
* single-task read.
|
|
146
|
+
*/
|
|
147
|
+
export declare function readDeclaredScopeFilesFromBindings(input: {
|
|
148
|
+
directory: string;
|
|
149
|
+
taskId: string;
|
|
150
|
+
plan: Plan;
|
|
151
|
+
bindingSet?: ScopeBinding[] | null;
|
|
152
|
+
}): string[] | null;
|
|
153
|
+
/**
|
|
154
|
+
* Hoisted single read of the authoritative v2 binding set for multi-task
|
|
155
|
+
* scheduling consumers (issue #2532): one bounded scan shared by every
|
|
156
|
+
* per-task {@link readDeclaredScopeFilesFromBindings} call in a verdict.
|
|
157
|
+
* Returns `null` when the store is unreadable/overloaded so callers fail
|
|
158
|
+
* closed to "unknown scope" per task.
|
|
159
|
+
*/
|
|
160
|
+
export declare function readAuthoritativeScopeBindingSet(directory: string): ScopeBinding[] | null;
|
|
120
161
|
export declare function resolveScopeBindingFromDisk(input: {
|
|
121
162
|
directory: string;
|
|
122
163
|
taskId: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { cleanupSummaries, listSummaries, loadFullOutput, storeSummary, } from './manager';
|
|
1
|
+
export { allocateSummaryId, cleanupSummaries, listSummaries, loadFullOutput, SummaryIdCollisionError, storeSummary, } from './manager';
|
|
2
2
|
export { createSummary, detectContentType, HYSTERESIS_FACTOR, shouldSummarize, } from './summarizer';
|
|
@@ -5,9 +5,20 @@
|
|
|
5
5
|
* @throws Error with descriptive message on failure
|
|
6
6
|
*/
|
|
7
7
|
export declare function sanitizeSummaryId(id: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Typed collision signal for the no-overwrite store contract (issue #2576):
|
|
10
|
+
* the destination summary entry already exists and must never be replaced.
|
|
11
|
+
* Callers distinguish this from storage errors by `instanceof` (or `name`).
|
|
12
|
+
*/
|
|
13
|
+
export declare class SummaryIdCollisionError extends Error {
|
|
14
|
+
readonly summaryId: string;
|
|
15
|
+
constructor(summaryId: string);
|
|
16
|
+
}
|
|
8
17
|
/**
|
|
9
18
|
* Store a summary entry to .swarm/summaries/{id}.json.
|
|
10
|
-
* Performs atomic
|
|
19
|
+
* Performs an atomic, no-overwrite install: temp file + exclusive
|
|
20
|
+
* hard-link install. Throws {@link SummaryIdCollisionError} if an entry
|
|
21
|
+
* with this ID already exists (it is never replaced — issue #2576).
|
|
11
22
|
* @throws Error if summary ID is invalid or size limit would be exceeded
|
|
12
23
|
*/
|
|
13
24
|
export declare function storeSummary(directory: string, id: string, fullOutput: string, summaryText: string, maxStoredBytes: number): Promise<void>;
|
|
@@ -26,6 +37,21 @@ export declare function loadFullOutput(directory: string, id: string): Promise<s
|
|
|
26
37
|
* directory directly so stale files beyond the newest N are still pruned.
|
|
27
38
|
*/
|
|
28
39
|
export declare const MAX_SUMMARIES_LISTED = 500;
|
|
40
|
+
/**
|
|
41
|
+
* Durable summary ID allocation (issue #2576): returns the next free numeric
|
|
42
|
+
* ID (`S<max+1>`) derived from the entries that actually exist on disk, so a
|
|
43
|
+
* restarted process continues after persisted IDs instead of reusing `S1`.
|
|
44
|
+
*
|
|
45
|
+
* The scan uses the strict write-side grammar (`^S\d+`) via
|
|
46
|
+
* {@link enumerateSummaryIds} — large timestamp-suffixed IDs (e.g. Stage A's
|
|
47
|
+
* `S<ms><random>`) match and are included; filenames outside the grammar are
|
|
48
|
+
* ignored. The max is computed with BigInt so 16-digit IDs stay exact past
|
|
49
|
+
* 2^53 (a float max could alias two distinct large IDs and hand the retry
|
|
50
|
+
* loop an already-occupied slot); `max + 1n` always stringifies back to a
|
|
51
|
+
* valid `^S\d+$` ID, and leading-zero legacy entries (`S007`) normalize
|
|
52
|
+
* numerically so allocation never regresses.
|
|
53
|
+
*/
|
|
54
|
+
export declare function allocateSummaryId(directory: string): string;
|
|
29
55
|
/**
|
|
30
56
|
* List summary IDs that have summary entries, newest-first (mtime
|
|
31
57
|
* descending, code-unit filename tie-break), capped at
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export { knowledge_archive } from './knowledge-archive';
|
|
|
42
42
|
export { knowledge_query } from './knowledge-query';
|
|
43
43
|
export { knowledge_recall } from './knowledge-recall';
|
|
44
44
|
export { knowledge_receipt } from './knowledge-receipt';
|
|
45
|
+
export { knowledge_receipt_status } from './knowledge-receipt-status';
|
|
45
46
|
export { knowledge_remove } from './knowledge-remove';
|
|
46
47
|
export { lint } from './lint';
|
|
47
48
|
export { osv_scan } from './osv-scan';
|
|
@@ -68,6 +69,7 @@ export type { SavePlanArgs, SavePlanResult } from './save-plan';
|
|
|
68
69
|
export { save_plan } from './save-plan';
|
|
69
70
|
export { type SbomGenerateInput, type SbomGenerateResult, sbom_generate, } from './sbom-generate';
|
|
70
71
|
export { schema_drift } from './schema-drift';
|
|
72
|
+
export { evaluateScopeValidate, type ScopeValidateArgs, type ScopeValidateResult, ScopeValidationError, scope_validate, } from './scope-validate';
|
|
71
73
|
export { search } from './search';
|
|
72
74
|
export { type SecretFinding, type SecretscanResult, secretscan, } from './secretscan';
|
|
73
75
|
export { set_qa_gates } from './set-qa-gates';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Read-only status for an explicitly-authorized MCP knowledge write receipt. */
|
|
2
|
+
import { createSwarmTool } from './create-tool.js';
|
|
3
|
+
export declare const knowledge_receipt_status: ReturnType<typeof createSwarmTool>;
|
|
4
|
+
export declare const _test_exports: {
|
|
5
|
+
writeReceiptStatusInput: import("zod").ZodObject<{
|
|
6
|
+
idempotency_key: import("zod").ZodString;
|
|
7
|
+
}, import("zod/v4/core").$strip>;
|
|
8
|
+
};
|
package/dist/tools/manifest.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ export declare const TOOL_MANIFEST: {
|
|
|
90
90
|
write_hallucination_evidence: () => ToolDefinition;
|
|
91
91
|
write_mutation_evidence: () => ToolDefinition;
|
|
92
92
|
declare_scope: () => ToolDefinition;
|
|
93
|
+
scope_validate: () => ToolDefinition;
|
|
93
94
|
knowledge_query: () => ToolDefinition;
|
|
94
95
|
doc_scan: () => ToolDefinition;
|
|
95
96
|
doc_extract: () => ToolDefinition;
|
|
@@ -127,6 +128,7 @@ export declare const TOOL_MANIFEST: {
|
|
|
127
128
|
skill_improve: () => ToolDefinition;
|
|
128
129
|
spec_write: () => ToolDefinition;
|
|
129
130
|
knowledge_receipt: () => ToolDefinition;
|
|
131
|
+
knowledge_receipt_status: () => ToolDefinition;
|
|
130
132
|
knowledge_archive: () => ToolDefinition;
|
|
131
133
|
swarm_memory_recall: () => ToolDefinition;
|
|
132
134
|
swarm_memory_propose: () => ToolDefinition;
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* READ-ONLY CONTRACT (issue #1656 acceptance): this tool writes NOTHING — not
|
|
9
9
|
* to `.swarm/`, not to the source tree. It calls no other tools. The only I/O
|
|
10
|
-
* is reading `.swarm/plan.json` (via `loadPlanJsonOnly`) and
|
|
11
|
-
*
|
|
12
|
-
* `computeParallelVerdict
|
|
13
|
-
* opts in via `use_cochange: true`).
|
|
10
|
+
* is reading `.swarm/plan.json` (via `loadPlanJsonOnly`) and the
|
|
11
|
+
* authoritative v2 scope-binding store (via `readDeclaredScopeFilesFromBindings`
|
|
12
|
+
* inside `computeParallelVerdict`, #2532), plus an optional `git log` (only
|
|
13
|
+
* when the caller opts in via `use_cochange: true`).
|
|
14
14
|
*
|
|
15
15
|
* Why this tool exists alongside the gate: the gate (`delegation-gate.ts`)
|
|
16
16
|
* independently recomputes the verdict INLINE at coder-dispatch time via the
|
|
@@ -50,8 +50,9 @@ export interface PlanConflictCheckResult {
|
|
|
50
50
|
/**
|
|
51
51
|
* Pure executor (no createSwarmTool wrapper) so it is directly unit-testable.
|
|
52
52
|
*
|
|
53
|
-
* Reads `.swarm/plan.json` (to confirm the task ids exist) and
|
|
54
|
-
*
|
|
53
|
+
* Reads `.swarm/plan.json` (to confirm the task ids exist) and the
|
|
54
|
+
* authoritative v2 scope-binding store (via `computeParallelVerdict`,
|
|
55
|
+
* #2532). Writes nothing.
|
|
55
56
|
*/
|
|
56
57
|
export declare function executePlanConflictCheck(args: {
|
|
57
58
|
task_ids: string[];
|