opencode-swarm 7.168.1 → 7.170.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.
- package/.opencode/skills/swarm-pr-feedback/SKILL.md +11 -11
- package/README.md +1 -0
- package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
- package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
- package/dist/ci/evaluate.d.ts +100 -0
- package/dist/ci/index.d.ts +13 -0
- package/dist/ci/quality-checks.d.ts +58 -0
- package/dist/ci/report.d.ts +21 -0
- package/dist/ci/runtime.d.ts +81 -0
- package/dist/cli/{capability-probe-faqefhah.js → capability-probe-pdwwz8gs.js} +1 -1
- package/dist/cli/{coder-settlement-54a3d97g.js → coder-settlement-65zx1bet.js} +12 -12
- package/dist/cli/{config-doctor-vzp6b3ng.js → config-doctor-c30rss1c.js} +2 -2
- package/dist/cli/{core-yynse50x.js → core-8wkbr1tr.js} +5 -2
- package/dist/cli/{curation-policy-mgwv8h2k.js → curation-policy-k74qz9ms.js} +5 -5
- package/dist/cli/{curator-drift-k0zrnm09.js → curator-drift-3ssjr0nx.js} +5 -5
- package/dist/cli/curator-llm-factory-jkjqasfs.js +72 -0
- package/dist/cli/{curator-agdhhzqt.js → curator-pckzk1q4.js} +40 -39
- package/dist/cli/{dispatch-8ks9dyk5.js → dispatch-hwwj3qrb.js} +2 -2
- package/dist/cli/{evidence-summary-service-6mmcekr7.js → evidence-summary-service-4ydcapke.js} +17 -17
- package/dist/cli/{gate-evidence-xqvkqhrk.js → gate-evidence-xwqfky3m.js} +7 -7
- package/dist/cli/guardrail-explain-fe2veh2s.js +73 -0
- package/dist/cli/{guardrail-log-5wa5c77w.js → guardrail-log-z38j69bx.js} +8 -8
- package/dist/cli/{guardrail-reset-dh78tbcf.js → guardrail-reset-mmnzt4mz.js} +40 -39
- package/dist/cli/hive-promoter-68hrw1y1.js +87 -0
- package/dist/cli/{index-gmpmgtzn.js → index-06rbdzqn.js} +5 -5
- package/dist/cli/index-0hgmsyfp.js +92 -0
- package/dist/cli/{index-f1fps3w9.js → index-0xprxg95.js} +7 -7
- package/dist/cli/{index-p612v1mv.js → index-2s7dvzff.js} +200 -51
- package/dist/cli/{index-qthc56c4.js → index-31sqcdsd.js} +4 -4
- package/dist/cli/{index-y85aptep.js → index-3axdtaf0.js} +7 -7
- package/dist/cli/{index-9b2105n0.js → index-3eh2n3dx.js} +2 -2
- package/dist/cli/{index-w1dfkp1q.js → index-3p3y55xg.js} +15 -15
- package/dist/cli/{index-apy1qfj0.js → index-4wc5gfgm.js} +26 -4
- package/dist/cli/{index-d5qf7hvh.js → index-5400m33a.js} +1 -1
- package/dist/cli/{index-qkwtth00.js → index-59fcfpkh.js} +197 -35
- package/dist/cli/{index-j0bxxz9d.js → index-5bbem0ey.js} +8 -8
- package/dist/cli/{index-qwsh0h2g.js → index-5qt9yf5w.js} +4 -4
- package/dist/cli/{index-q1r1cfww.js → index-76qm2c2y.js} +37 -26
- package/dist/cli/{index-qhey6vc3.js → index-7h01bkm6.js} +2 -2
- package/dist/cli/{index-6df6wbvj.js → index-8w1mrvbd.js} +8 -8
- package/dist/cli/{index-8ybjqg51.js → index-9ttqbhvw.js} +1 -1
- package/dist/cli/{index-xhb4gryr.js → index-9xk97bcf.js} +4 -4
- package/dist/cli/{index-kear8gb7.js → index-b3pmzbh1.js} +2 -2
- package/dist/cli/{index-h439y187.js → index-bernkwgf.js} +1 -1
- package/dist/cli/{index-m35hybf0.js → index-bm5xrfnx.js} +1 -1
- package/dist/cli/{index-pyf517sz.js → index-br3mvbsa.js} +2 -2
- package/dist/cli/{index-4r5pmtvk.js → index-bx1wgn3a.js} +4 -4
- package/dist/cli/{index-nwwk3dej.js → index-cgpwjctj.js} +1 -1
- package/dist/cli/{index-wst6n478.js → index-dvbf6fpn.js} +1 -1
- package/dist/cli/{index-a8xbvsse.js → index-fgp96k3r.js} +2 -2
- package/dist/cli/{index-5zqakgp4.js → index-fhh02gwx.js} +3 -3
- package/dist/cli/{index-dfyv3xkd.js → index-gfbggp8k.js} +9 -9
- package/dist/cli/{index-kkmezerc.js → index-j144fgk8.js} +4831 -2776
- package/dist/cli/{index-xkf3672y.js → index-mjn6aqqk.js} +2 -2
- package/dist/cli/{index-3jmb4ppa.js → index-n0d5hrs4.js} +2 -2
- package/dist/cli/{index-v3xc4sde.js → index-nbdmdyke.js} +2 -1
- package/dist/cli/{index-z6qreakh.js → index-nprdr0sm.js} +6 -4
- package/dist/cli/{index-bvqqwx84.js → index-nyn01yrz.js} +2 -2
- package/dist/cli/{index-q8091q8b.js → index-p6fj7qz7.js} +3 -3
- package/dist/cli/{index-gh9ybrrs.js → index-pw00xcj0.js} +7 -7
- package/dist/cli/{index-bw9x8d8n.js → index-r1z8nrb6.js} +5 -5
- package/dist/cli/{index-2xbww1x0.js → index-ssx8087p.js} +7 -7
- package/dist/cli/{index-4kv1ew3q.js → index-t73888m0.js} +1 -1
- package/dist/cli/{index-91ww9hyr.js → index-td6xrw55.js} +1 -1
- package/dist/cli/{index-gp9yzr1v.js → index-xnpjwc4h.js} +1 -1
- package/dist/cli/{index-yt9n9zt3.js → index-xztkjj3c.js} +48 -41
- package/dist/cli/{index-5g6rhkn7.js → index-ye43mdfm.js} +36 -1
- package/dist/cli/{index-w3x1dmrf.js → index-z5vas8c3.js} +40 -39
- package/dist/cli/{index-chebm5h5.js → index-zw3hkzch.js} +3 -3
- package/dist/cli/index.js +45 -39
- package/dist/cli/{knowledge-escalator-135dz4eh.js → knowledge-escalator-pz2faktx.js} +13 -13
- package/dist/cli/{knowledge-events-27gwv47q.js → knowledge-events-s6s8qedx.js} +11 -11
- package/dist/cli/{knowledge-link-dr3xnwyd.js → knowledge-link-rkxfrmhm.js} +4 -4
- package/dist/cli/{knowledge-store-80m44bfw.js → knowledge-store-dgv3xw3h.js} +5 -5
- package/dist/cli/{knowledge-validator-crsfb2cc.js → knowledge-validator-22qppdyv.js} +7 -7
- package/dist/cli/{pending-delegations-gwgjzzkz.js → pending-delegations-4r21nf9d.js} +12 -12
- package/dist/cli/{pr-subscriptions-g633nhz4.js → pr-subscriptions-d52xy3zd.js} +12 -12
- package/dist/cli/{pr-workflow-gate-4dc5nt2e.js → pr-workflow-gate-0de81kzw.js} +40 -39
- package/dist/cli/{runner-k0ycgv8x.js → runner-1dwrgyyr.js} +6 -6
- package/dist/cli/{scan-cursor-avxjsm4w.js → scan-cursor-ahbbejab.js} +6 -6
- package/dist/cli/{schema-3ja77k4y.js → schema-17h2hcw9.js} +5 -1
- package/dist/cli/{scope-persistence-f540tc50.js → scope-persistence-gcn3zm5e.js} +14 -14
- package/dist/cli/{skill-generator-kcqqpg1g.js → skill-generator-hkqr5qs7.js} +15 -15
- package/dist/cli/{snapshot-coordination-init-e4s8bn4p.js → snapshot-coordination-init-ms36zxv6.js} +40 -39
- package/dist/cli/{telemetry-2wzapf11.js → telemetry-fdtaemnv.js} +1 -1
- package/dist/cli/{workspace-snapshot-rkgxhj9b.js → workspace-snapshot-hkz2wt1c.js} +4 -4
- package/dist/cli/{worktree-collision-ownership-rk9gz638.js → worktree-collision-ownership-7v7gg511.js} +18 -104
- package/dist/cli/{worktree-isolation-1bdzfgky.js → worktree-isolation-nanamt25.js} +40 -39
- package/dist/commands/ci.d.ts +40 -0
- package/dist/commands/destructive-purge.d.ts +85 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/registry.d.ts +10 -2
- package/dist/commands/reset-session.d.ts +5 -1
- package/dist/config/constants.d.ts +4 -1
- package/dist/config/lane-context.d.ts +19 -0
- package/dist/config/schema.d.ts +77 -0
- package/dist/evaluation/index.d.ts +1 -0
- package/dist/evaluation/retrieval-quality.d.ts +116 -0
- package/dist/failures/invocation-failure.d.ts +23 -4
- package/dist/hooks/gate-denial-tracker.d.ts +18 -14
- package/dist/hooks/init-orphan-recovery.d.ts +7 -0
- package/dist/hooks/pr-workflow-gate.d.ts +8 -2
- package/dist/index.js +616 -608
- package/dist/memory/embeddings/reranker.d.ts +13 -2
- package/dist/memory/evaluation.d.ts +99 -0
- package/dist/memory/heldout-evaluation-corpus.d.ts +51 -0
- package/dist/memory/index.d.ts +5 -2
- package/dist/memory/sqlite-provider.d.ts +35 -1
- package/dist/memory/types.d.ts +14 -0
- package/dist/observability/otel-mapping.d.ts +5 -5
- package/dist/observability/otlp-exporter.d.ts +80 -0
- package/dist/parallel/lane-owners.d.ts +76 -0
- package/dist/sandbox/macos/sandbox-exec-executor.d.ts +48 -11
- package/dist/tools/repo-graph/query.d.ts +6 -1
- package/dist/tools/repo-graph/types.d.ts +13 -4
- package/dist/utils/bun-compat.d.ts +20 -0
- package/dist/utils/gitignore-warning.d.ts +5 -2
- package/dist/worktree/base-migration.d.ts +55 -0
- package/dist/worktree/core.d.ts +15 -6
- package/dist/worktree/ownership.d.ts +66 -0
- package/opencode-swarm.schema.json +97 -0
- package/package.json +4 -2
- package/tests/fixtures/memory-recall-heldout/manifest.json +311 -0
- package/tests/fixtures/memory-recall-heldout/sources/bash.sh +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/c.c +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/cpp.cpp +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/csharp.cs +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/css.css +3 -0
- package/tests/fixtures/memory-recall-heldout/sources/dart.dart +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/go.go +3 -0
- package/tests/fixtures/memory-recall-heldout/sources/ini.ini +2 -0
- package/tests/fixtures/memory-recall-heldout/sources/java.java +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/javascript.js +3 -0
- package/tests/fixtures/memory-recall-heldout/sources/kotlin.kt +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/php.php +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/powershell.ps1 +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/python.py +2 -0
- package/tests/fixtures/memory-recall-heldout/sources/regex.regex +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/ruby.rb +3 -0
- package/tests/fixtures/memory-recall-heldout/sources/rust.rs +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/swift.swift +1 -0
- package/tests/fixtures/memory-recall-heldout/sources/tsx.tsx +3 -0
- package/tests/fixtures/memory-recall-heldout/sources/typescript.ts +3 -0
- package/dist/cli/curator-llm-factory-ygxd6hfx.js +0 -71
- package/dist/cli/guardrail-explain-vjtjhgzs.js +0 -72
- package/dist/cli/hive-promoter-3czsx7c6.js +0 -86
|
@@ -3,6 +3,16 @@ export interface RerankCandidate {
|
|
|
3
3
|
text: string;
|
|
4
4
|
score?: number;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* The narrow reranking contract used by the SQLite retrieval pipeline.
|
|
8
|
+
* Keeping this structural makes deterministic, offline evaluation possible
|
|
9
|
+
* without making the optional transformers dependency part of the evaluator.
|
|
10
|
+
*/
|
|
11
|
+
export interface MemoryReranker {
|
|
12
|
+
readonly available: boolean;
|
|
13
|
+
readonly modelVersion?: string;
|
|
14
|
+
rerank<T extends RerankCandidate>(candidates: T[], query?: string, topN?: number): Promise<T[]>;
|
|
15
|
+
}
|
|
6
16
|
/**
|
|
7
17
|
* Latency gate: skip reranking when the previous recall step already
|
|
8
18
|
* exceeded the caller's latency budget.
|
|
@@ -18,8 +28,9 @@ export declare function shouldRerank(previousRecallElapsedMs: number, latencyBud
|
|
|
18
28
|
* Graceful degradation: if the package is missing or the model fails to
|
|
19
29
|
* load, `available` is false and rerank() returns candidates unchanged.
|
|
20
30
|
*/
|
|
21
|
-
export declare class CrossEncoderReranker {
|
|
31
|
+
export declare class CrossEncoderReranker implements MemoryReranker {
|
|
22
32
|
private readonly options;
|
|
33
|
+
readonly modelVersion: string;
|
|
23
34
|
private loadFailed;
|
|
24
35
|
private _available;
|
|
25
36
|
private pipeline;
|
|
@@ -38,5 +49,5 @@ export declare class CrossEncoderReranker {
|
|
|
38
49
|
* Returns the top `topN` candidates sorted descending by cross-encoder
|
|
39
50
|
* score. If the model is unavailable, returns candidates unchanged.
|
|
40
51
|
*/
|
|
41
|
-
rerank(candidates:
|
|
52
|
+
rerank<T extends RerankCandidate>(candidates: T[], query?: string, topN?: number): Promise<T[]>;
|
|
42
53
|
}
|
|
@@ -1,10 +1,88 @@
|
|
|
1
|
+
import { type SQLiteRetrievalDependencies } from './sqlite-provider';
|
|
1
2
|
import type { MemoryKind, MemoryRecord, MemoryScopeRef, MemorySource, RecallMode } from './types';
|
|
2
3
|
export type RecallEvaluationProviderName = 'local-jsonl' | 'sqlite';
|
|
3
4
|
export type RecallEvaluationMode = Extract<RecallMode, 'manual' | 'injection' | 'curator'>;
|
|
5
|
+
export type RecallEvaluationProfile = 'lexical' | 'hybrid' | 'hybrid+rerank';
|
|
6
|
+
export interface RecallEvaluationResourceCaps {
|
|
7
|
+
candidate_count: number;
|
|
8
|
+
token_budget: number;
|
|
9
|
+
}
|
|
10
|
+
export interface RecallEvaluationResourceUsage {
|
|
11
|
+
lexical_candidate_count: number;
|
|
12
|
+
dense_candidate_count: number;
|
|
13
|
+
rerank_candidate_count: number;
|
|
14
|
+
returned_count: number;
|
|
15
|
+
query_embedding_invocation_count: number;
|
|
16
|
+
/** Text-only estimate over actual returned records; prompt consumption is not measured here. */
|
|
17
|
+
returned_token_estimate: number;
|
|
18
|
+
}
|
|
19
|
+
export interface RecallEvaluationManifest {
|
|
20
|
+
version: '1.0.0';
|
|
21
|
+
source_id: string;
|
|
22
|
+
model_id: string;
|
|
23
|
+
provider_id: string;
|
|
24
|
+
config_hash: string;
|
|
25
|
+
corpus_hash: string;
|
|
26
|
+
profile_thresholds: Record<string, number>;
|
|
27
|
+
sample_counts: Record<string, number>;
|
|
28
|
+
metric_definitions: Record<string, string>;
|
|
29
|
+
uncertainty: {
|
|
30
|
+
method: string;
|
|
31
|
+
confidence: number;
|
|
32
|
+
sample_count: number;
|
|
33
|
+
};
|
|
34
|
+
variants?: Record<string, RecallEvaluationIdentity>;
|
|
35
|
+
}
|
|
36
|
+
export interface RecallEvaluationIdentity {
|
|
37
|
+
source_id: string;
|
|
38
|
+
model_id: string;
|
|
39
|
+
provider_id: string;
|
|
40
|
+
config_hash: string;
|
|
41
|
+
}
|
|
42
|
+
export interface RecallEvaluationScenario {
|
|
43
|
+
id: string;
|
|
44
|
+
language: string;
|
|
45
|
+
analyzer_id?: string;
|
|
46
|
+
source_provenance: 'direct-source';
|
|
47
|
+
/** Graph extraction/index querying is deliberately not claimed by memory recall. */
|
|
48
|
+
index_state: 'not-measured';
|
|
49
|
+
graph_measurement: {
|
|
50
|
+
status: 'unmeasured';
|
|
51
|
+
reason: string;
|
|
52
|
+
};
|
|
53
|
+
expected_symbols: string[];
|
|
54
|
+
expected_edges: Array<string | {
|
|
55
|
+
from: string;
|
|
56
|
+
to: string;
|
|
57
|
+
}>;
|
|
58
|
+
known_misses: string[];
|
|
59
|
+
spurious_edges: Array<string | {
|
|
60
|
+
from: string;
|
|
61
|
+
to: string;
|
|
62
|
+
}>;
|
|
63
|
+
}
|
|
64
|
+
export interface RecallEvaluationComparison {
|
|
65
|
+
fixture: string;
|
|
66
|
+
provider: RecallEvaluationProviderName;
|
|
67
|
+
mode: RecallEvaluationMode;
|
|
68
|
+
baseline_profile: RecallEvaluationProfile;
|
|
69
|
+
variant_profile: RecallEvaluationProfile;
|
|
70
|
+
precision_at_k_delta: number;
|
|
71
|
+
recall_at_k_delta: number;
|
|
72
|
+
latency_ms_delta: number;
|
|
73
|
+
cost_delta: null;
|
|
74
|
+
cost_comparison: 'unavailable';
|
|
75
|
+
}
|
|
4
76
|
export interface RecallEvaluationOptions {
|
|
5
77
|
fixtureDirectory: string;
|
|
6
78
|
providers?: RecallEvaluationProviderName[];
|
|
7
79
|
modes?: RecallEvaluationMode[];
|
|
80
|
+
/** Omitted preserves the legacy provider × mode report. */
|
|
81
|
+
profiles?: RecallEvaluationProfile[];
|
|
82
|
+
/** Instance-owned offline dependencies; never used by normal agent recall. */
|
|
83
|
+
dependencies?: SQLiteRetrievalDependencies;
|
|
84
|
+
resourceCaps?: Partial<RecallEvaluationResourceCaps>;
|
|
85
|
+
heldoutCorpusDirectory?: string;
|
|
8
86
|
keepTempRoots?: boolean;
|
|
9
87
|
}
|
|
10
88
|
export interface RecallEvaluationMetrics {
|
|
@@ -28,6 +106,20 @@ export interface RecallEvaluationRun {
|
|
|
28
106
|
retrieved_ids: string[];
|
|
29
107
|
metrics: RecallEvaluationMetrics;
|
|
30
108
|
passed: boolean;
|
|
109
|
+
profile?: RecallEvaluationProfile;
|
|
110
|
+
status?: 'complete' | 'degraded' | 'skipped';
|
|
111
|
+
degradation_reason?: string;
|
|
112
|
+
provenance?: string;
|
|
113
|
+
resource_cap?: RecallEvaluationResourceCaps;
|
|
114
|
+
resource_usage?: RecallEvaluationResourceUsage;
|
|
115
|
+
latency_ms?: number;
|
|
116
|
+
cost_provenance?: string;
|
|
117
|
+
cost?: {
|
|
118
|
+
provenance: string;
|
|
119
|
+
amount: null;
|
|
120
|
+
};
|
|
121
|
+
identity?: RecallEvaluationIdentity;
|
|
122
|
+
scenario?: RecallEvaluationScenario;
|
|
31
123
|
}
|
|
32
124
|
export interface RecallEvaluationReport {
|
|
33
125
|
schema_version: 1;
|
|
@@ -41,6 +133,9 @@ export interface RecallEvaluationReport {
|
|
|
41
133
|
passed_run_count: number;
|
|
42
134
|
};
|
|
43
135
|
runs: RecallEvaluationRun[];
|
|
136
|
+
comparisons: RecallEvaluationComparison[];
|
|
137
|
+
/** Additive contract metadata; schema_version stays v1 for legacy callers. */
|
|
138
|
+
manifest: RecallEvaluationManifest;
|
|
44
139
|
}
|
|
45
140
|
type FixtureRecordState = {
|
|
46
141
|
deleted?: boolean;
|
|
@@ -71,7 +166,11 @@ interface RecallEvaluationFixture {
|
|
|
71
166
|
k?: number;
|
|
72
167
|
expectedLabels: string[];
|
|
73
168
|
records: FixtureRecord[];
|
|
169
|
+
scenario?: RecallEvaluationScenario;
|
|
170
|
+
sourceHash?: string;
|
|
74
171
|
}
|
|
75
172
|
export declare function evaluateMemoryRecallFixtures(options: RecallEvaluationOptions): Promise<RecallEvaluationReport>;
|
|
76
173
|
export declare function loadRecallEvaluationFixtures(fixtureDirectory: string): Promise<RecallEvaluationFixture[]>;
|
|
174
|
+
/** Strict, filesystem-independent report metadata validation. */
|
|
175
|
+
export declare function validateRecallEvaluationManifest(value: unknown): asserts value is RecallEvaluationManifest;
|
|
77
176
|
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare const MAX_HELDOUT_MANIFEST_BYTES: number;
|
|
2
|
+
export interface HeldoutRecallCorpusCase {
|
|
3
|
+
id?: string;
|
|
4
|
+
language: string;
|
|
5
|
+
expected_symbols: string[];
|
|
6
|
+
expected_edges: Array<string | {
|
|
7
|
+
from: string;
|
|
8
|
+
to: string;
|
|
9
|
+
}>;
|
|
10
|
+
known_misses: string[];
|
|
11
|
+
spurious_edges: Array<string | {
|
|
12
|
+
from: string;
|
|
13
|
+
to: string;
|
|
14
|
+
}>;
|
|
15
|
+
paraphrase: string;
|
|
16
|
+
source_path?: string;
|
|
17
|
+
content_hash?: string;
|
|
18
|
+
analyzer_id?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface HeldoutRecallCorpusManifest {
|
|
21
|
+
corpus_id: string;
|
|
22
|
+
split: 'heldout';
|
|
23
|
+
version?: string;
|
|
24
|
+
thresholds?: Record<string, number>;
|
|
25
|
+
cases: HeldoutRecallCorpusCase[];
|
|
26
|
+
}
|
|
27
|
+
export interface LoadedHeldoutRecallScenario extends HeldoutRecallCorpusCase {
|
|
28
|
+
id: string;
|
|
29
|
+
source_text: string;
|
|
30
|
+
source_hash: string;
|
|
31
|
+
source_provenance: 'direct-source';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Validate the data contract only. Filesystem membership, safe paths, byte
|
|
35
|
+
* caps, and source hashes are intentionally enforced by the loader below.
|
|
36
|
+
*/
|
|
37
|
+
export declare function validateHeldoutRecallCorpusManifest(value: unknown): asserts value is HeldoutRecallCorpusManifest;
|
|
38
|
+
/**
|
|
39
|
+
* Bounded filesystem boundary for held-out corpora. It does not recurse, and
|
|
40
|
+
* every optional source file must remain inside the supplied corpus root.
|
|
41
|
+
*/
|
|
42
|
+
export declare function loadHeldoutRecallEvaluationCorpus(corpusDirectory: string): Promise<HeldoutRecallCorpusManifest>;
|
|
43
|
+
/**
|
|
44
|
+
* Bounded direct-source scenarios for production retrieval evaluation. This
|
|
45
|
+
* loader validates corpus membership and content hashes; it never scores or
|
|
46
|
+
* manufactures analyzer results.
|
|
47
|
+
*/
|
|
48
|
+
export declare function loadHeldoutRecallEvaluationScenarios(corpusDirectory: string): Promise<{
|
|
49
|
+
manifest: HeldoutRecallCorpusManifest;
|
|
50
|
+
scenarios: LoadedHeldoutRecallScenario[];
|
|
51
|
+
}>;
|
package/dist/memory/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export type { MemoryConfig } from './config';
|
|
2
2
|
export { DEFAULT_MEMORY_CONFIG, resolveMemoryConfig } from './config';
|
|
3
|
+
export type { MemoryReranker, RerankCandidate } from './embeddings/reranker';
|
|
3
4
|
export { MemoryDisabledError, MemoryPiiDetectorError, MemoryValidationError, } from './errors';
|
|
4
|
-
export { evaluateMemoryRecallFixtures, loadRecallEvaluationFixtures, type RecallEvaluationMetrics, type RecallEvaluationMode, type RecallEvaluationOptions, type RecallEvaluationProviderName, type RecallEvaluationReport, type RecallEvaluationRun, } from './evaluation';
|
|
5
|
+
export { evaluateMemoryRecallFixtures, loadRecallEvaluationFixtures, type RecallEvaluationComparison, type RecallEvaluationIdentity, type RecallEvaluationManifest, type RecallEvaluationMetrics, type RecallEvaluationMode, type RecallEvaluationOptions, type RecallEvaluationProfile, type RecallEvaluationProviderName, type RecallEvaluationReport, type RecallEvaluationResourceCaps, type RecallEvaluationResourceUsage, type RecallEvaluationRun, type RecallEvaluationScenario, validateRecallEvaluationManifest, } from './evaluation';
|
|
5
6
|
export type { MemoryGatewayOptions, ProposeMemoryInput, RecallMemoryInput, RecordMemoryOutcomeInput, } from './gateway';
|
|
6
7
|
export { createConfiguredMemoryProvider, createConfiguredMemoryProviderForRoot, createMemoryGateway, MemoryGateway, } from './gateway';
|
|
8
|
+
export { type HeldoutRecallCorpusCase, type HeldoutRecallCorpusManifest, type LoadedHeldoutRecallScenario, loadHeldoutRecallEvaluationCorpus, loadHeldoutRecallEvaluationScenarios, validateHeldoutRecallCorpusManifest, } from './heldout-evaluation-corpus';
|
|
7
9
|
export { createMemoryLifecycleHooks, type MemoryLifecycleHookOptions, type MemoryLifecycleHooks, } from './injector';
|
|
8
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';
|
|
9
11
|
export { LocalJsonlMemoryProvider } from './local-jsonl-provider';
|
|
@@ -19,6 +21,7 @@ export { readDeadAnchorMemoryIds, readReflectionDigest, recordOutcomeWithReflect
|
|
|
19
21
|
export { MEMORY_RECALL_PROFILES, type MemoryRecallProfile, normalizeMemoryAgentRole, resolveMemoryRecallProfile, } from './role-profiles';
|
|
20
22
|
export { appendMemoryRunLog, sanitizeRunId } from './run-log';
|
|
21
23
|
export { computeMemoryContentHash, createBundleId, createMemoryId, createProposalId, isExpired, MemoryAnchorSchema, normalizeMemoryAnchorFile, normalizeMemoryText, validateCuratorMemoryDecision, validateMemoryProposal, validateMemoryRecordRules, } from './schema';
|
|
24
|
+
export type { MemoryRecallQualityTrace, SQLiteRetrievalDependencies, } from './sqlite-provider';
|
|
22
25
|
export { EVENT_CHAIN_GENESIS, MEMORY_EVENTS_CHAIN_HEAD_KEY, type MemoryAuditVerificationReport, type MemoryEventRow, memoryEventRowHash, SQLiteMemoryProvider, verifyMemoryEventChainRows, } from './sqlite-provider';
|
|
23
26
|
export { isCohortRoot, isLocalRoot, resolveVettedMemoryRoot, rootStoragePath, type VettedMemoryRoot, wrapLocalRoot, } from './storage-root';
|
|
24
|
-
export type { AppliedMemoryChange, CuratorMemoryDecision, MemoryAnchor, MemoryContext, MemoryKind, MemoryListFilter, MemoryOutcome, MemoryPatch, MemoryProposal, MemoryRecord, MemoryRelation, MemoryScopeRef, MemoryScopeType, NewMemoryRecord, RecallBundle, RecallInjectionSkipReason, RecallMode, RecallRequest, RecallResultItem, ResolvedCuratorMemoryDecision, } from './types';
|
|
27
|
+
export type { AppliedMemoryChange, CuratorMemoryDecision, MemoryAnchor, MemoryContext, MemoryKind, MemoryListFilter, MemoryOutcome, MemoryPatch, MemoryProposal, MemoryRecord, MemoryRelation, MemoryScopeRef, MemoryScopeType, NewMemoryRecord, RecallBundle, RecallInjectionSkipReason, RecallMode, RecallQualityProfile, RecallRequest, RecallResultItem, ResolvedCuratorMemoryDecision, } from './types';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type MemoryConfig } from './config';
|
|
2
|
+
import { type MemoryReranker } from './embeddings/reranker';
|
|
3
|
+
import type { EmbeddingProvider } from './embeddings/types';
|
|
2
4
|
import { type JsonlMigrationReport } from './jsonl-migration';
|
|
3
5
|
import { type MemoryOutcomeEvent } from './outcome-events';
|
|
4
6
|
import type { MemoryCompactOptions, MemoryCompactResult, MemoryProposalStore, MemoryProvider, MemoryRecallUsageEvent, MemoryRecallUsageFilter, MemoryRewardEvent, MemoryRewardEventFilter, MemoryTransaction } from './provider';
|
|
@@ -55,6 +57,7 @@ interface Migration {
|
|
|
55
57
|
name: string;
|
|
56
58
|
sql: string;
|
|
57
59
|
}
|
|
60
|
+
declare function capQualityRecallItemsByTokenBudget(items: readonly RecallResultItem[], tokenBudget: number): RecallResultItem[];
|
|
58
61
|
export declare const MIGRATIONS: Migration[];
|
|
59
62
|
export interface SQLiteJsonlImportResult {
|
|
60
63
|
importedMemories: number;
|
|
@@ -63,6 +66,33 @@ export interface SQLiteJsonlImportResult {
|
|
|
63
66
|
invalidRows: JsonlMigrationReport['invalidRows'];
|
|
64
67
|
totalRows: number;
|
|
65
68
|
}
|
|
69
|
+
export interface SQLiteRetrievalDependencies {
|
|
70
|
+
/** Optional deterministic override used by quality evaluation and focused tests. */
|
|
71
|
+
embeddingProvider?: EmbeddingProvider;
|
|
72
|
+
/** Selects dense candidates without claiming sqlite-vec availability. */
|
|
73
|
+
denseSelector?: (request: RecallRequest, queryEmbedding: Float32Array, records: readonly MemoryRecord[]) => Promise<MemoryRecord[]>;
|
|
74
|
+
reranker?: MemoryReranker;
|
|
75
|
+
/** Monotonic clock seam; default is Date.now. */
|
|
76
|
+
now?: () => number;
|
|
77
|
+
}
|
|
78
|
+
export interface MemoryRecallQualityTrace {
|
|
79
|
+
profile: 'lexical' | 'hybrid' | 'hybrid+rerank';
|
|
80
|
+
status: 'complete' | 'degraded' | 'skipped';
|
|
81
|
+
degradationReason?: string;
|
|
82
|
+
provenance: 'lexical' | 'sqlite-vec' | 'injected-dense';
|
|
83
|
+
usedEmbedding: boolean;
|
|
84
|
+
usedReranker: boolean;
|
|
85
|
+
latencyMs: number;
|
|
86
|
+
resourceUsage: {
|
|
87
|
+
lexical_candidate_count: number;
|
|
88
|
+
dense_candidate_count: number;
|
|
89
|
+
rerank_candidate_count: number;
|
|
90
|
+
returned_count: number;
|
|
91
|
+
query_embedding_invocation_count: number;
|
|
92
|
+
/** Deterministic estimate over the text actually returned, not a budget echo. */
|
|
93
|
+
returned_token_estimate: number;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
66
96
|
export declare class SQLiteMemoryProvider implements MemoryProvider, MemoryProposalStore {
|
|
67
97
|
readonly name = "sqlite";
|
|
68
98
|
private readonly rootDirectory;
|
|
@@ -83,6 +113,7 @@ export declare class SQLiteMemoryProvider implements MemoryProvider, MemoryPropo
|
|
|
83
113
|
private embeddingProvider;
|
|
84
114
|
private embeddingCache;
|
|
85
115
|
private reranker;
|
|
116
|
+
private readonly retrievalDependencies;
|
|
86
117
|
private memories;
|
|
87
118
|
private proposals;
|
|
88
119
|
private lastAutomaticJsonlMigration;
|
|
@@ -97,7 +128,7 @@ export declare class SQLiteMemoryProvider implements MemoryProvider, MemoryPropo
|
|
|
97
128
|
* `.swarm` path with full `validateSwarmPath` enforcement (today's
|
|
98
129
|
* behavior).
|
|
99
130
|
*/
|
|
100
|
-
vettedCohortRoot?: string | null);
|
|
131
|
+
vettedCohortRoot?: string | null, retrievalDependencies?: SQLiteRetrievalDependencies);
|
|
101
132
|
/**
|
|
102
133
|
* #1850 (critic GAP-5): explicit cohort-root path branch.
|
|
103
134
|
* - cohort root → `<cohortRoot>/memory.db` (NO validateSwarmPath — the
|
|
@@ -122,6 +153,7 @@ export declare class SQLiteMemoryProvider implements MemoryProvider, MemoryPropo
|
|
|
122
153
|
recallWithDiagnostics(request: RecallRequest): Promise<{
|
|
123
154
|
items: RecallResultItem[];
|
|
124
155
|
diagnostics: RecallScoringDiagnostics;
|
|
156
|
+
qualityTrace?: MemoryRecallQualityTrace;
|
|
125
157
|
}>;
|
|
126
158
|
private expandRelated;
|
|
127
159
|
recordRecallUsage(event: MemoryRecallUsageEvent): Promise<void>;
|
|
@@ -179,6 +211,7 @@ export declare class SQLiteMemoryProvider implements MemoryProvider, MemoryPropo
|
|
|
179
211
|
private selectRecallCandidates;
|
|
180
212
|
private getStoredModelVersion;
|
|
181
213
|
private selectDenseCandidates;
|
|
214
|
+
private now;
|
|
182
215
|
private runMigrations;
|
|
183
216
|
private backfillScopeKeys;
|
|
184
217
|
private backfillRecallRunIds;
|
|
@@ -292,5 +325,6 @@ export declare const _test_exports: {
|
|
|
292
325
|
extractFtsTerms: typeof extractFtsTerms;
|
|
293
326
|
FTS_SCHEMA_MIGRATION_NAME: string;
|
|
294
327
|
FTS_SCHEMA_MIGRATION_VERSION: number;
|
|
328
|
+
capQualityRecallItemsByTokenBudget: typeof capQualityRecallItemsByTokenBudget;
|
|
295
329
|
};
|
|
296
330
|
export {};
|
package/dist/memory/types.d.ts
CHANGED
|
@@ -195,6 +195,8 @@ export interface AppliedMemoryChange {
|
|
|
195
195
|
}
|
|
196
196
|
export type RecallMode = 'manual' | 'injection' | 'curator' | 'evaluation';
|
|
197
197
|
export type RecallInjectionSkipReason = 'disabled' | 'no_signal' | 'below_threshold' | 'no_results';
|
|
198
|
+
/** Explicit, evaluator-only opt-in. Normal agent recall never requests it. */
|
|
199
|
+
export type RecallQualityProfile = 'lexical' | 'hybrid' | 'hybrid+rerank';
|
|
198
200
|
export interface RecallRequest {
|
|
199
201
|
query: string;
|
|
200
202
|
task?: string;
|
|
@@ -214,6 +216,18 @@ export interface RecallRequest {
|
|
|
214
216
|
* suppression never deletes or tombstones the underlying record.
|
|
215
217
|
*/
|
|
216
218
|
includeLowQ?: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Produces bounded retrieval-quality telemetry on `recallWithDiagnostics`.
|
|
221
|
+
* This is intentionally opt-in so agent-facing recall output stays unchanged.
|
|
222
|
+
*/
|
|
223
|
+
quality?: {
|
|
224
|
+
profile: RecallQualityProfile;
|
|
225
|
+
/**
|
|
226
|
+
* Bounded evaluator-only retrieval work cap. Omitted for normal agent
|
|
227
|
+
* recall, which preserves the established provider candidate behavior.
|
|
228
|
+
*/
|
|
229
|
+
candidateCap?: number;
|
|
230
|
+
};
|
|
217
231
|
}
|
|
218
232
|
export interface RecallResultItem {
|
|
219
233
|
record: MemoryRecord;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External-convention attribute mappings (issue #2029 item 6).
|
|
3
3
|
*
|
|
4
|
-
* These are
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* consumer
|
|
4
|
+
* These tables are DATA consumed by the static contract check (which asserts
|
|
5
|
+
* every catalog entry records a mapping decision), by
|
|
6
|
+
* `docs/observability-event-contract.md`, and — since issue #2485 — by the
|
|
7
|
+
* opt-in runtime exporter (`src/observability/otlp-exporter.ts`), the runtime
|
|
8
|
+
* consumer originally deferred here to #2049.
|
|
9
9
|
*
|
|
10
10
|
* Import rules: no filesystem, network, subprocess, or OTel SDK.
|
|
11
11
|
*/
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { ObservabilityEvent } from './envelope.js';
|
|
2
|
+
/** Spool home, relative to the project root (retention-registry row `otlp-export-spool`). */
|
|
3
|
+
export declare const OTLP_EXPORT_SPOOL_DIR = ".swarm/otlp-export";
|
|
4
|
+
/** Bounded iteration ceiling for one flush cycle (drain-all semantics). */
|
|
5
|
+
export declare const MAX_FLUSH_ITERATIONS = 100;
|
|
6
|
+
export interface OtlpExportConfig {
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
endpoint: string;
|
|
9
|
+
convention: 'genai' | 'openinference';
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
batchSize: number;
|
|
12
|
+
flushIntervalMs: number;
|
|
13
|
+
requestTimeoutMs: number;
|
|
14
|
+
spoolMaxBytes: number;
|
|
15
|
+
spoolMaxAgeMs: number;
|
|
16
|
+
maxRetries: number;
|
|
17
|
+
backoffBaseMs: number;
|
|
18
|
+
backoffMaxMs: number;
|
|
19
|
+
circuitThreshold: number;
|
|
20
|
+
circuitCooldownMs: number;
|
|
21
|
+
}
|
|
22
|
+
export type OtlpExporterState = 'disabled' | 'active' | 'cooldown';
|
|
23
|
+
export interface OtlpExporterHealth {
|
|
24
|
+
state: OtlpExporterState;
|
|
25
|
+
convention: 'genai' | 'openinference' | null;
|
|
26
|
+
mappingVersion: string | null;
|
|
27
|
+
spoolRecords: number;
|
|
28
|
+
spoolBytes: number;
|
|
29
|
+
accepted: number;
|
|
30
|
+
exported: number;
|
|
31
|
+
retried: number;
|
|
32
|
+
dropped: Record<string, number>;
|
|
33
|
+
lastErrorCategory: string | null;
|
|
34
|
+
lastErrorAt: string | null;
|
|
35
|
+
lastSuccessAt: string | null;
|
|
36
|
+
circuitOpen: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Project a canonical event onto the pinned attribute table for `convention`
|
|
40
|
+
* plus the closed `swarm.*` extension set. PURE: no I/O, no clock, no throw.
|
|
41
|
+
* `legacy.raw` is read ONLY at the exact mapped keys with typeof guards —
|
|
42
|
+
* never traversed or serialized (it may be circular; envelope.ts documents
|
|
43
|
+
* the alias contract).
|
|
44
|
+
*/
|
|
45
|
+
export declare function projectOtlpAttributes(event: ObservabilityEvent, convention: 'genai' | 'openinference'): Record<string, string | number | boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Build one OTLP/HTTP-JSON span for the event, or `null` when the event must
|
|
48
|
+
* not be exported at all (`content` privacy class).
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildOtlpSpan(event: ObservabilityEvent, convention: 'genai' | 'openinference'): Record<string, unknown> | null;
|
|
51
|
+
/** Minimal fetch shape used by the transport (Bun's fetch adds `preconnect`). */
|
|
52
|
+
export type OtlpFetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
53
|
+
/** DI seam (repo convention): tests inject a stub collector fetch. */
|
|
54
|
+
export declare const _internals: {
|
|
55
|
+
fetch: OtlpFetch;
|
|
56
|
+
sleep: (ms: number) => Promise<void>;
|
|
57
|
+
now: () => number;
|
|
58
|
+
};
|
|
59
|
+
/** Drain ALL pending batches now (bounded by MAX_FLUSH_ITERATIONS). */
|
|
60
|
+
export declare function flushOtlpExporterForTesting(directory: string): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Register the OTLP exporter for this project root. O(1), idempotent, never
|
|
63
|
+
* throws — safe on the plugin init path (invariant 1). All flush/listener
|
|
64
|
+
* I/O is post-resolution; the ONE init-path exception is a small
|
|
65
|
+
* (state.json-sized) synchronous read performed only when the exporter is
|
|
66
|
+
* enabled — fail-open and far inside the invariant's latency budget. When
|
|
67
|
+
* disabled (default), the kill switch is set, or the endpoint violates
|
|
68
|
+
* policy, NOTHING is registered and no `.swarm/otlp-export/` directory is
|
|
69
|
+
* created.
|
|
70
|
+
*/
|
|
71
|
+
export declare function registerOtlpExporter(directory: string, config: OtlpExportConfig): void;
|
|
72
|
+
export declare function isOtlpExporterActive(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Drop the listener and forget in-memory state. Records already appended to
|
|
75
|
+
* the spool are ON DISK (appends are synchronous), so nothing in-flight is
|
|
76
|
+
* lost; counters are persisted before clearing so health survives rebind.
|
|
77
|
+
*/
|
|
78
|
+
export declare function resetOtlpExporterForTesting(): void;
|
|
79
|
+
/** Merged health for `/swarm report`. Null when the exporter never ran here. */
|
|
80
|
+
export declare function readOtlpExporterHealth(directory: string): OtlpExporterHealth | null;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issue #2527 (PARALLEL-3): durable live-lane owner records.
|
|
3
|
+
*
|
|
4
|
+
* Every cross-process liveness signal that existed before this module
|
|
5
|
+
* expired after five minutes regardless of the lane's actual state: lane
|
|
6
|
+
* lock metas are stamped once (`file-locks.ts` LOCK_TIMEOUT_MS) with no
|
|
7
|
+
* renewal path, and provisioning owners are leased for five minutes and
|
|
8
|
+
* then dropped by init orphan recovery. A lane that legitimately ran longer
|
|
9
|
+
* became invisible to a second process and was reclaimed as an "orphan".
|
|
10
|
+
*
|
|
11
|
+
* This store gives a lane a durable owner signal whose lifetime is the
|
|
12
|
+
* LANE's, not a lock TTL:
|
|
13
|
+
*
|
|
14
|
+
* - recorded at lane provisioning (lean runner AND standard worktree
|
|
15
|
+
* isolation — one primitive for both lane types, F3/A3);
|
|
16
|
+
* - cleared when the worktree is removed (`removeWorktree` in
|
|
17
|
+
* `src/worktree/core.ts`, both success returns) and by GC-on-read for
|
|
18
|
+
* any record whose lane path no longer exists (crashes, manual removal,
|
|
19
|
+
* every non-git deletion path);
|
|
20
|
+
* - liveness = owning PID exists AND the record's `startedAt` is within a
|
|
21
|
+
* 24-hour claim window. The window bounds PID-reuse blindness: a record
|
|
22
|
+
* older than 24h is stale regardless of what now lives at that PID
|
|
23
|
+
* (dispatch deadlines are minutes, so a genuinely-running lane never
|
|
24
|
+
* approaches it; a >24h CLEAN lane being reclaimed is the low-harm case
|
|
25
|
+
* — a >24h DIRTY lane still survives via git's own refusal, F2).
|
|
26
|
+
* `process.kill(pid, 0)` EPERM ⇒ alive (fail-closed on Windows ACLs).
|
|
27
|
+
*
|
|
28
|
+
* Store pattern mirrors `dead-lane-reclaim.ts`: a bounded JSON file under
|
|
29
|
+
* `.swarm/`, written via `atomicWriteSwarmFileSync`, never grown past the
|
|
30
|
+
* entry/byte caps.
|
|
31
|
+
*/
|
|
32
|
+
import * as fs from 'node:fs';
|
|
33
|
+
import { atomicWriteSwarmFileSync } from '../utils/atomic-write';
|
|
34
|
+
/** Plan-critic round-1 item 5: PID-recency witness bound (24h). */
|
|
35
|
+
export declare const LIVE_LANE_OWNER_CLAIM_WINDOW_MS: number;
|
|
36
|
+
export interface LiveLaneOwnerEntry {
|
|
37
|
+
lanePath: string;
|
|
38
|
+
branchName: string;
|
|
39
|
+
sessionId: string;
|
|
40
|
+
taskId: string;
|
|
41
|
+
ownerPid: number;
|
|
42
|
+
startedAt: number;
|
|
43
|
+
}
|
|
44
|
+
export interface LiveLaneOwnersView {
|
|
45
|
+
/** Records whose owner process is alive within the claim window. */
|
|
46
|
+
live: LiveLaneOwnerEntry[];
|
|
47
|
+
/** Records dropped this read: path gone, or past the claim window. */
|
|
48
|
+
reaped: LiveLaneOwnerEntry[];
|
|
49
|
+
}
|
|
50
|
+
export declare const _internals: {
|
|
51
|
+
readFileSync: (p: string, enc: BufferEncoding) => string;
|
|
52
|
+
rmSync: typeof fs.rmSync;
|
|
53
|
+
statSync: (p: string) => unknown;
|
|
54
|
+
atomicWriteSwarmFileSync: typeof atomicWriteSwarmFileSync;
|
|
55
|
+
now: () => number;
|
|
56
|
+
kill: (pid: number, signal: 0) => true;
|
|
57
|
+
process: {
|
|
58
|
+
pid: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
/** Record (or refresh) the durable owner of a live lane. Never throws. */
|
|
62
|
+
export declare function recordLiveLaneOwner(directory: string, entry: {
|
|
63
|
+
lanePath: string;
|
|
64
|
+
branchName: string;
|
|
65
|
+
sessionId: string;
|
|
66
|
+
taskId: string;
|
|
67
|
+
}): void;
|
|
68
|
+
/** Clear the durable owner record for one lane path. Never throws. */
|
|
69
|
+
export declare function clearLiveLaneOwner(directory: string, lanePath: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* Read the live-lane-owner view, GC-ing records whose lane path no longer
|
|
72
|
+
* exists (universal clear fallback: every removal path that bypassed
|
|
73
|
+
* `removeWorktree` — manual rm, /swarm close sweeps, future tooling — is
|
|
74
|
+
* healed on the next read) and records past the 24h claim window.
|
|
75
|
+
*/
|
|
76
|
+
export declare function listLiveLaneOwners(directory: string): LiveLaneOwnersView;
|
|
@@ -23,12 +23,18 @@ declare function resolveProbeTargetBinary(): string;
|
|
|
23
23
|
*
|
|
24
24
|
* F6a item 2 (issue #2236): this deliberately shares the same primitives and
|
|
25
25
|
* ordering as buildSandboxProfile's production profile — a blanket
|
|
26
|
-
* `(deny file-write*)` followed by a scoped `(allow file-write* (subpath …))
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
26
|
+
* `(deny file-write*)` followed by a scoped `(allow file-write* (subpath …))` —
|
|
27
|
+
* so that probe success implies the production profile's primitives actually
|
|
28
|
+
* parse under this host's sandbox-exec. A trivial `(allow default)`-only probe
|
|
29
|
+
* would pass even when the production profile is unparseable, which is the
|
|
30
|
+
* exact probe-passes/production-fails failure mode this guards against.
|
|
31
|
+
*
|
|
32
|
+
* NEVER add env directives here or to buildSandboxProfile: `setenv`/`unsetenv`
|
|
33
|
+
* are not SBPL operations — the profile parser treats them as unbound
|
|
34
|
+
* variables and rejects the whole profile (exit 65), which silently disabled
|
|
35
|
+
* this executor on every macOS host (issue #2590). SBPL cannot mutate the
|
|
36
|
+
* sandboxed process's environment at all; env overrides are applied inside the
|
|
37
|
+
* wrapped command instead (see buildEnvOverridePrefix / wrapCommand).
|
|
32
38
|
*/
|
|
33
39
|
declare function buildProbeProfile(tempDir: string): string;
|
|
34
40
|
/**
|
|
@@ -61,15 +67,41 @@ export declare const _internals: {
|
|
|
61
67
|
resetProbeMemo: typeof resetProbeMemo;
|
|
62
68
|
buildSandboxProfile: typeof buildSandboxProfile;
|
|
63
69
|
buildProbeProfile: typeof buildProbeProfile;
|
|
70
|
+
buildEnvOverridePrefix: typeof buildEnvOverridePrefix;
|
|
64
71
|
resolveSandboxExecBinary: typeof resolveSandboxExecBinary;
|
|
65
72
|
resolveProbeTargetBinary: typeof resolveProbeTargetBinary;
|
|
66
73
|
exists: typeof existsSync;
|
|
67
74
|
spawnSync: typeof spawnSync;
|
|
68
75
|
};
|
|
69
76
|
/**
|
|
70
|
-
* Build
|
|
77
|
+
* Build the shell prefix that applies env overrides inside the wrapped
|
|
78
|
+
* command's `bash -c` payload (issue #2590).
|
|
79
|
+
*
|
|
80
|
+
* SBPL cannot mutate the sandboxed process's environment, so the hardening
|
|
81
|
+
* declared by getEnvOverrides() (DYLD_* unsets, PATH pin) and any per-call
|
|
82
|
+
* overrides are applied by the inner shell itself, before the user command:
|
|
83
|
+
* null-valued keys are unset via a single `unset` builtin, string-valued keys
|
|
84
|
+
* are exported with the value single-quote-escaped via shellEscape. Keys
|
|
85
|
+
* failing isValidEnvKey are silently dropped — the same contract the (broken)
|
|
86
|
+
* SBPL emitter applied, and required for shell safety too: an invalid key is
|
|
87
|
+
* neither a safe shell word nor a safe SBPL token.
|
|
88
|
+
*
|
|
89
|
+
* Returns '' when there is nothing to apply, so the no-override payload is
|
|
90
|
+
* byte-identical to the pre-#2590 wrapped command. The trailing '; ' lets the
|
|
91
|
+
* prefix compose with arbitrary user payloads.
|
|
92
|
+
*/
|
|
93
|
+
declare function buildEnvOverridePrefix(envOverrides?: Record<string, string | null>): string;
|
|
94
|
+
/**
|
|
95
|
+
* Build a sandbox-exec profile string for the given scope paths and temp dir.
|
|
96
|
+
*
|
|
97
|
+
* NOTE: there are deliberately NO environment directives in the profile.
|
|
98
|
+
* `setenv`/`unsetenv` are not SBPL operations — sandbox-exec rejects them as
|
|
99
|
+
* unbound variables (exit 65), which silently disabled this executor on every
|
|
100
|
+
* macOS host (issue #2590). SBPL cannot mutate the sandboxed process's
|
|
101
|
+
* environment at all; env overrides are applied by the inner shell instead
|
|
102
|
+
* (see buildEnvOverridePrefix / wrapCommand).
|
|
71
103
|
*/
|
|
72
|
-
declare function buildSandboxProfile(scopePaths: string[], tempDir: string
|
|
104
|
+
declare function buildSandboxProfile(scopePaths: string[], tempDir: string): string;
|
|
73
105
|
/**
|
|
74
106
|
* macOS sandbox-exec sandbox executor.
|
|
75
107
|
*/
|
|
@@ -100,6 +132,8 @@ export declare class MacOSSandboxExecutor implements SandboxExecutor {
|
|
|
100
132
|
* @param scopePaths - Additional scope paths to bind (merged with constructor scope)
|
|
101
133
|
* @param tempDir - Optional temp directory override
|
|
102
134
|
* @param envOverrides - Optional per-call env overrides: string sets the var, null unsets it.
|
|
135
|
+
* Applied by the inner shell BEFORE the user command runs — SBPL
|
|
136
|
+
* cannot mutate the sandboxed process's environment (issue #2590).
|
|
103
137
|
* When omitted, no per-call env override is applied.
|
|
104
138
|
* @returns A sandbox-exec wrapped command string ready for shell execution,
|
|
105
139
|
* or the raw command string when the sandbox is unavailable (passthrough mode)
|
|
@@ -110,9 +144,12 @@ export declare class MacOSSandboxExecutor implements SandboxExecutor {
|
|
|
110
144
|
/**
|
|
111
145
|
* Return environment variable overrides required for the macOS sandbox.
|
|
112
146
|
*
|
|
113
|
-
* DYLD_INSERT_LIBRARIES, DYLD_LIBRARY_PATH, DYLD_FRAMEWORK_PATH,
|
|
114
|
-
* DYLD_ROOT_PATH can be used to bypass
|
|
115
|
-
*
|
|
147
|
+
* DYLD_INSERT_LIBRARIES, DYLD_LIBRARY_PATH, DYLD_FRAMEWORK_PATH,
|
|
148
|
+
* DYLD_ROOT_PATH, and DYLD_FORCE_FLAT_NAMESPACE can be used to bypass
|
|
149
|
+
* sandbox restrictions by injecting or redirecting dynamic-library
|
|
150
|
+
* loading. Unsetting them improves sandbox enforcement (defense in
|
|
151
|
+
* depth); DYLD_FORCE_FLAT_NAMESPACE matches the Windows executors'
|
|
152
|
+
* scrub lists (review PRR-006, PR #2630).
|
|
116
153
|
*/
|
|
117
154
|
getEnvOverrides(): Record<string, string | null>;
|
|
118
155
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { FreshnessProbe } from './freshness';
|
|
2
|
-
import type { BlastRadiusResult, CallerReference, ContextPackResult, ContextPackSourceMode, DeadExportsResult, FileOntology, FileReference, GraphHealthResult, GraphNode, LocalizationBlock, PackageBoundarySummary, RepoGraph, SymbolReference } from './types';
|
|
2
|
+
import type { BlastRadiusResult, CallerReference, ContextPackResult, ContextPackSourceMode, DeadExportsResult, FileOntology, FileReference, GraphHealthResult, GraphNode, LocalizationBlock, PackageBoundarySummary, RepoGraph, SymbolEdge, SymbolReference } from './types';
|
|
3
|
+
export interface SymbolEdgeIndexes {
|
|
4
|
+
forward: Map<string, SymbolEdge[]>;
|
|
5
|
+
reverse: Map<string, SymbolEdge[]>;
|
|
6
|
+
}
|
|
3
7
|
export declare function getGraphNode(graph: RepoGraph, input: string): GraphNode | undefined;
|
|
8
|
+
export declare function getSymbolEdgeIndexes(graph: RepoGraph): SymbolEdgeIndexes;
|
|
4
9
|
/**
|
|
5
10
|
* Drop every cached query index. Required after any in-place mutation of a
|
|
6
11
|
* graph's `nodes` or `edges` (see the {@link queryIndexCache} contract note),
|