opencode-swarm 7.136.3 → 7.136.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/{config-doctor-g71mz50j.js → config-doctor-n3hatm9d.js} +2 -2
- package/dist/cli/{curation-policy-zhyttjpa.js → curation-policy-c4g08bg1.js} +2 -2
- package/dist/cli/{curator-36dxw38r.js → curator-jc5cc980.js} +12 -12
- package/dist/cli/{curator-llm-factory-k2a7cv41.js → curator-llm-factory-atfnhbn6.js} +12 -12
- package/dist/cli/{guardrail-explain-1k337z5d.js → guardrail-explain-v6f8efve.js} +13 -13
- package/dist/cli/{guardrail-log-xbc9bvdt.js → guardrail-log-0mrq14g9.js} +3 -3
- package/dist/cli/{hive-promoter-daxrn62p.js → hive-promoter-wyejhz8b.js} +12 -12
- package/dist/cli/{index-176zwqcq.js → index-6kd0ezgd.js} +1 -1
- package/dist/cli/{index-mgbpbs1f.js → index-84se71v1.js} +1 -1
- package/dist/cli/{index-zcrvn579.js → index-8f4346kf.js} +1 -1
- package/dist/cli/{index-pff46kfv.js → index-akc6rp3x.js} +2 -2
- package/dist/cli/{index-rtgqy0yg.js → index-bqan4y2y.js} +2 -2
- package/dist/cli/{index-0vq9gnqd.js → index-eeb35dnx.js} +1 -1
- package/dist/cli/{index-n89fdxwg.js → index-f5qs217h.js} +6 -1
- package/dist/cli/{index-brtg922w.js → index-hbzh7yyz.js} +669 -618
- package/dist/cli/{index-68tjkaqk.js → index-j7ja83v5.js} +1 -1
- package/dist/cli/{index-zwh5dewz.js → index-pyz1p8qv.js} +1 -1
- package/dist/cli/{index-wbdxmf1a.js → index-qhbr4h5n.js} +4 -4
- package/dist/cli/{index-kp5h245k.js → index-tr0ctbhq.js} +5 -5
- package/dist/cli/{index-79pgzj9a.js → index-vm05set2.js} +2 -2
- package/dist/cli/{index-g5rtcb1n.js → index-xp2pfbpq.js} +1 -1
- package/dist/cli/{index-g2kpqpvh.js → index-xvcctb2t.js} +14 -14
- package/dist/cli/{index-gj5jerzz.js → index-yj61bped.js} +3 -3
- package/dist/cli/index.js +12 -12
- package/dist/cli/{knowledge-escalator-h7fspgph.js → knowledge-escalator-2xe8z24p.js} +3 -3
- package/dist/cli/{knowledge-events-vkf7an5n.js → knowledge-events-wecrshsx.js} +1 -1
- package/dist/cli/{knowledge-store-s4976v9c.js → knowledge-store-9f74whxw.js} +1 -1
- package/dist/cli/{knowledge-validator-64ppqy4y.js → knowledge-validator-4ng7x9dr.js} +4 -4
- package/dist/cli/{scan-cursor-xbkae12h.js → scan-cursor-yzj9n225.js} +2 -2
- package/dist/cli/{schema-7jm70cab.js → schema-cr1nr1w0.js} +1 -1
- package/dist/cli/{skill-generator-8gtq1ajr.js → skill-generator-ybncj9et.js} +5 -5
- package/dist/hooks/context-budget.d.ts +8 -0
- package/dist/hooks/guardrails/file-authority.d.ts +20 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/message-priority.d.ts +62 -4
- package/dist/index.js +285 -286
- package/dist/memory/index.d.ts +1 -1
- package/dist/memory/local-jsonl-provider.d.ts +4 -1
- package/dist/memory/redaction.d.ts +91 -0
- package/dist/memory/sqlite-provider.d.ts +5 -1
- package/dist/utils/arg-hash.d.ts +113 -0
- package/dist/utils/stable-stringify.d.ts +47 -2
- package/package.json +1 -1
|
@@ -702,7 +702,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
702
702
|
const recovered = touched.filter((e) => e.confidence > CONFIDENCE_FLOOR + FLOOR_EPSILON && e.confidence_floor_demoted);
|
|
703
703
|
if (atFloor.length === 0 && recovered.length === 0)
|
|
704
704
|
return;
|
|
705
|
-
const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-
|
|
705
|
+
const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-wecrshsx.js");
|
|
706
706
|
const rollups = await readKnowledgeCounterRollups(directory);
|
|
707
707
|
const flagIds = new Set;
|
|
708
708
|
for (const e of atFloor) {
|
|
@@ -769,11 +769,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
if (action === "quarantine" && toQuarantine.length > 0) {
|
|
772
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
773
|
-
const { KnowledgeConfigSchema } = await import("./schema-
|
|
772
|
+
const { quarantineEntry } = await import("./knowledge-validator-4ng7x9dr.js");
|
|
773
|
+
const { KnowledgeConfigSchema } = await import("./schema-cr1nr1w0.js");
|
|
774
774
|
let config;
|
|
775
775
|
try {
|
|
776
|
-
const { loadPluginConfigWithMeta } = await import("./index-
|
|
776
|
+
const { loadPluginConfigWithMeta } = await import("./index-bqan4y2y.js");
|
|
777
777
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
778
778
|
config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
779
779
|
} catch {
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
resolveSwarmKnowledgePath,
|
|
7
7
|
transactKnowledge,
|
|
8
8
|
wordBigrams
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-qhbr4h5n.js";
|
|
10
10
|
import {
|
|
11
11
|
countEntryContradictionsInWindow,
|
|
12
12
|
countEntryViolationsInWindow,
|
|
13
13
|
readKnowledgeEvents,
|
|
14
14
|
recordKnowledgeEvent
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-84se71v1.js";
|
|
16
16
|
import {
|
|
17
17
|
init_knowledge_types,
|
|
18
18
|
isActiveStatus
|
|
@@ -190,11 +190,11 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
|
|
|
190
190
|
alreadyInactive: true
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
193
|
+
const { quarantineEntry } = await import("./knowledge-validator-4ng7x9dr.js");
|
|
194
194
|
let policyConfig;
|
|
195
195
|
try {
|
|
196
|
-
const { KnowledgeConfigSchema } = await import("./schema-
|
|
197
|
-
const { loadPluginConfigWithMeta } = await import("./index-
|
|
196
|
+
const { KnowledgeConfigSchema } = await import("./schema-cr1nr1w0.js");
|
|
197
|
+
const { loadPluginConfigWithMeta } = await import("./index-bqan4y2y.js");
|
|
198
198
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
199
199
|
policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
200
200
|
} catch {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
authorizeCuration
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-6kd0ezgd.js";
|
|
5
5
|
import {
|
|
6
6
|
findNearDuplicate,
|
|
7
7
|
inferTags,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
resolveSwarmKnowledgePath,
|
|
10
10
|
resolveSwarmRejectedPath,
|
|
11
11
|
transactKnowledge
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-qhbr4h5n.js";
|
|
13
13
|
import {
|
|
14
14
|
resolveKnowledgeStoreDir
|
|
15
15
|
} from "./index-zzhyws9g.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-akc6rp3x.js";
|
|
5
5
|
import {
|
|
6
6
|
handleGuardrailLog
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-xp2pfbpq.js";
|
|
8
8
|
import {
|
|
9
9
|
COMMAND_REGISTRY,
|
|
10
10
|
SWARM_COMMAND_TOOL_ALLOWLIST,
|
|
@@ -84,39 +84,39 @@ import {
|
|
|
84
84
|
handleWriteRetroCommand,
|
|
85
85
|
normalizeSwarmCommandInput,
|
|
86
86
|
resolveCommand
|
|
87
|
-
} from "./index-
|
|
87
|
+
} from "./index-hbzh7yyz.js";
|
|
88
88
|
import"./index-vm4xw9z3.js";
|
|
89
89
|
import"./index-nfm9f10v.js";
|
|
90
|
-
import"./index-
|
|
91
|
-
import"./index-
|
|
90
|
+
import"./index-f5qs217h.js";
|
|
91
|
+
import"./index-j7ja83v5.js";
|
|
92
92
|
import"./index-45y0y3xh.js";
|
|
93
93
|
import"./index-ne28wyyc.js";
|
|
94
94
|
import"./index-y8552snf.js";
|
|
95
95
|
import"./index-4905hd2m.js";
|
|
96
96
|
import"./index-134d35c1.js";
|
|
97
|
-
import"./index-
|
|
98
|
-
import"./index-
|
|
99
|
-
import"./index-
|
|
97
|
+
import"./index-yj61bped.js";
|
|
98
|
+
import"./index-tr0ctbhq.js";
|
|
99
|
+
import"./index-8f4346kf.js";
|
|
100
100
|
import"./index-6mjf4vr1.js";
|
|
101
101
|
import"./index-c8s9a3zh.js";
|
|
102
102
|
import"./index-9ss2m4rs.js";
|
|
103
103
|
import"./index-wsdnttf4.js";
|
|
104
104
|
import"./index-d2sf9an1.js";
|
|
105
|
-
import"./index-
|
|
106
|
-
import"./index-
|
|
105
|
+
import"./index-vm05set2.js";
|
|
106
|
+
import"./index-6kd0ezgd.js";
|
|
107
107
|
import"./index-rtry5xyf.js";
|
|
108
|
-
import"./index-
|
|
109
|
-
import"./index-
|
|
108
|
+
import"./index-qhbr4h5n.js";
|
|
109
|
+
import"./index-84se71v1.js";
|
|
110
110
|
import"./index-ae75rja9.js";
|
|
111
111
|
import"./index-zzhyws9g.js";
|
|
112
112
|
import"./index-b3jfcptk.js";
|
|
113
|
-
import"./index-
|
|
113
|
+
import"./index-pyz1p8qv.js";
|
|
114
114
|
import"./index-k5jrywpr.js";
|
|
115
115
|
import"./index-n832052r.js";
|
|
116
116
|
import {
|
|
117
117
|
init_schema,
|
|
118
118
|
stripKnownSwarmPrefix
|
|
119
|
-
} from "./index-
|
|
119
|
+
} from "./index-eeb35dnx.js";
|
|
120
120
|
import"./index-bk5tah7q.js";
|
|
121
121
|
import"./index-8fwhhayc.js";
|
|
122
122
|
import"./index-q1exe2b3.js";
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ALLOWED_SKILL_PATH_PREFIXES,
|
|
4
4
|
validateSkillPath
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-vm05set2.js";
|
|
6
6
|
import {
|
|
7
7
|
computeOutcomeSignal,
|
|
8
8
|
readKnowledge,
|
|
9
9
|
resolveHiveKnowledgePath,
|
|
10
10
|
resolveSwarmKnowledgePath,
|
|
11
11
|
transactKnowledge
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-qhbr4h5n.js";
|
|
13
13
|
import {
|
|
14
14
|
effectiveRetrievalOutcomes,
|
|
15
15
|
readKnowledgeCounterRollups
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-84se71v1.js";
|
|
17
17
|
import {
|
|
18
18
|
init_knowledge_types,
|
|
19
19
|
isActiveStatus
|
package/dist/cli/index.js
CHANGED
|
@@ -6,39 +6,39 @@ import {
|
|
|
6
6
|
getPluginConfigDir,
|
|
7
7
|
getPluginLockFilePaths,
|
|
8
8
|
resolveCommand
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-hbzh7yyz.js";
|
|
10
10
|
import"./index-vm4xw9z3.js";
|
|
11
11
|
import"./index-nfm9f10v.js";
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
12
|
+
import"./index-f5qs217h.js";
|
|
13
|
+
import"./index-j7ja83v5.js";
|
|
14
14
|
import"./index-45y0y3xh.js";
|
|
15
15
|
import"./index-ne28wyyc.js";
|
|
16
16
|
import"./index-y8552snf.js";
|
|
17
17
|
import"./index-4905hd2m.js";
|
|
18
18
|
import"./index-134d35c1.js";
|
|
19
|
-
import"./index-
|
|
20
|
-
import"./index-
|
|
21
|
-
import"./index-
|
|
19
|
+
import"./index-yj61bped.js";
|
|
20
|
+
import"./index-tr0ctbhq.js";
|
|
21
|
+
import"./index-8f4346kf.js";
|
|
22
22
|
import"./index-6mjf4vr1.js";
|
|
23
23
|
import"./index-c8s9a3zh.js";
|
|
24
24
|
import"./index-9ss2m4rs.js";
|
|
25
25
|
import"./index-wsdnttf4.js";
|
|
26
26
|
import"./index-d2sf9an1.js";
|
|
27
|
-
import"./index-
|
|
28
|
-
import"./index-
|
|
27
|
+
import"./index-vm05set2.js";
|
|
28
|
+
import"./index-6kd0ezgd.js";
|
|
29
29
|
import"./index-rtry5xyf.js";
|
|
30
|
-
import"./index-
|
|
31
|
-
import"./index-
|
|
30
|
+
import"./index-qhbr4h5n.js";
|
|
31
|
+
import"./index-84se71v1.js";
|
|
32
32
|
import"./index-ae75rja9.js";
|
|
33
33
|
import"./index-zzhyws9g.js";
|
|
34
34
|
import"./index-b3jfcptk.js";
|
|
35
|
-
import"./index-
|
|
35
|
+
import"./index-pyz1p8qv.js";
|
|
36
36
|
import"./index-k5jrywpr.js";
|
|
37
37
|
import"./index-n832052r.js";
|
|
38
38
|
import {
|
|
39
39
|
init_package,
|
|
40
40
|
package_default
|
|
41
|
-
} from "./index-
|
|
41
|
+
} from "./index-eeb35dnx.js";
|
|
42
42
|
import"./index-bk5tah7q.js";
|
|
43
43
|
import"./index-8fwhhayc.js";
|
|
44
44
|
import"./index-q1exe2b3.js";
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
maybeEscalateOnViolation,
|
|
9
9
|
maybeQuarantineOnContradiction,
|
|
10
10
|
readRecentEscalations
|
|
11
|
-
} from "./index-
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
11
|
+
} from "./index-tr0ctbhq.js";
|
|
12
|
+
import"./index-qhbr4h5n.js";
|
|
13
|
+
import"./index-84se71v1.js";
|
|
14
14
|
import"./index-ae75rja9.js";
|
|
15
15
|
import"./index-zzhyws9g.js";
|
|
16
16
|
import"./index-b3jfcptk.js";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
resolveKnowledgeCounterBaselinePath,
|
|
29
29
|
resolveKnowledgeEventsPath,
|
|
30
30
|
resolveLegacyApplicationLogPath
|
|
31
|
-
} from "./index-
|
|
31
|
+
} from "./index-84se71v1.js";
|
|
32
32
|
import"./index-ae75rja9.js";
|
|
33
33
|
import"./index-zzhyws9g.js";
|
|
34
34
|
import"./index-b3jfcptk.js";
|
|
@@ -23,11 +23,11 @@ import {
|
|
|
23
23
|
validateLesson,
|
|
24
24
|
validateSkillCandidatePath,
|
|
25
25
|
validateSkillPath
|
|
26
|
-
} from "./index-
|
|
27
|
-
import"./index-
|
|
26
|
+
} from "./index-vm05set2.js";
|
|
27
|
+
import"./index-6kd0ezgd.js";
|
|
28
28
|
import"./index-rtry5xyf.js";
|
|
29
|
-
import"./index-
|
|
30
|
-
import"./index-
|
|
29
|
+
import"./index-qhbr4h5n.js";
|
|
30
|
+
import"./index-84se71v1.js";
|
|
31
31
|
import"./index-ae75rja9.js";
|
|
32
32
|
import"./index-zzhyws9g.js";
|
|
33
33
|
import"./index-b3jfcptk.js";
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
alreadyCuratedThisGeneration,
|
|
5
5
|
claimNextScanBatch,
|
|
6
6
|
getScanStatus
|
|
7
|
-
} from "./index-
|
|
8
|
-
import"./index-
|
|
7
|
+
} from "./index-8f4346kf.js";
|
|
8
|
+
import"./index-qhbr4h5n.js";
|
|
9
9
|
import"./index-ae75rja9.js";
|
|
10
10
|
import"./index-zzhyws9g.js";
|
|
11
11
|
import"./index-b3jfcptk.js";
|
|
@@ -33,12 +33,12 @@ import {
|
|
|
33
33
|
sanitizeSlug,
|
|
34
34
|
selectCandidateEntries,
|
|
35
35
|
writeEvalStub
|
|
36
|
-
} from "./index-
|
|
37
|
-
import"./index-
|
|
38
|
-
import"./index-
|
|
36
|
+
} from "./index-yj61bped.js";
|
|
37
|
+
import"./index-vm05set2.js";
|
|
38
|
+
import"./index-6kd0ezgd.js";
|
|
39
39
|
import"./index-rtry5xyf.js";
|
|
40
|
-
import"./index-
|
|
41
|
-
import"./index-
|
|
40
|
+
import"./index-qhbr4h5n.js";
|
|
41
|
+
import"./index-84se71v1.js";
|
|
42
42
|
import"./index-ae75rja9.js";
|
|
43
43
|
import"./index-zzhyws9g.js";
|
|
44
44
|
import"./index-b3jfcptk.js";
|
|
@@ -17,6 +17,14 @@ interface MessageInfo {
|
|
|
17
17
|
interface MessagePart {
|
|
18
18
|
type: string;
|
|
19
19
|
text?: string;
|
|
20
|
+
tool?: string;
|
|
21
|
+
state?: {
|
|
22
|
+
status?: string;
|
|
23
|
+
output?: string;
|
|
24
|
+
error?: string;
|
|
25
|
+
input?: Record<string, unknown>;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
};
|
|
20
28
|
[key: string]: unknown;
|
|
21
29
|
}
|
|
22
30
|
interface MessageWithParts {
|
|
@@ -22,8 +22,27 @@ import { type FileZone } from '../../context/zone-classifier';
|
|
|
22
22
|
* silently dropped nested keys, collapsing distinct todo contents to the same
|
|
23
23
|
* hash.
|
|
24
24
|
*
|
|
25
|
+
* When `stableCanonicalStringify` throws (cyclic refs, BigInt quirks), a
|
|
26
|
+
* constant fallback would make distinct-but-unserializable args collide,
|
|
27
|
+
* producing false-positive consecutive-equality detection (#2060-class
|
|
28
|
+
* bug). `coarseObjectDiscriminator` mixes in a shallow structural summary
|
|
29
|
+
* instead, so identical unserializable args still collide (true positive
|
|
30
|
+
* preserved) while distinct ones no longer do.
|
|
31
|
+
*
|
|
32
|
+
* Hash input is bounded by `boundedBunHash` (`src/utils/arg-hash.ts`), which
|
|
33
|
+
* hashes a length-prefixed head+tail SAMPLE rather than a bare prefix. That
|
|
34
|
+
* matters here more than anywhere: this hash drives the consecutive-repetition
|
|
35
|
+
* circuit breaker in `tool-before.ts`, which THROWS. Under a bare-prefix cap,
|
|
36
|
+
* ten consecutive large writes sharing a 64 KB boilerplate header but with
|
|
37
|
+
* differing appended bodies would have hashed identically and tripped it.
|
|
38
|
+
*
|
|
39
|
+
* Both this bounding and the fallback discriminator are shared verbatim with
|
|
40
|
+
* `hooks/adversarial-detector.ts:hashArgsForSpiral`; keep them in the shared
|
|
41
|
+
* module rather than re-inlining a copy here.
|
|
42
|
+
*
|
|
25
43
|
* @param args Tool arguments to hash
|
|
26
|
-
* @returns Numeric hash (0 for non-objects
|
|
44
|
+
* @returns Numeric hash (0 for non-objects; a discriminated fallback hash if
|
|
45
|
+
* stable stringification fails)
|
|
27
46
|
*/
|
|
28
47
|
export declare function hashArgs(args: unknown): number;
|
|
29
48
|
/** A record of an agent attesting to (resolving/suppressing/deferring) a finding. */
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { createDelegationTrackerHook } from './delegation-tracker';
|
|
|
10
10
|
export { extractCurrentPhase, extractCurrentPhaseFromPlan, extractCurrentTask, extractCurrentTaskFromPlan, extractDecisions, extractIncompleteTasks, extractIncompleteTasksFromPlan, extractPatterns, } from './extractors';
|
|
11
11
|
export { createFullAutoInterceptHook } from './full-auto-intercept';
|
|
12
12
|
export { checkFileAuthority, createGuardrailsHooks, DEFAULT_AGENT_AUTHORITY_RULES, } from './guardrails';
|
|
13
|
-
export { classifyMessage, classifyMessages, containsPlanContent, isDuplicateToolRead, isStaleError, isToolResult, MessagePriority, type MessagePriorityType, type MessageWithParts, } from './message-priority';
|
|
13
|
+
export { classifyMessage, classifyMessages, containsPlanContent, getCompletedToolOutputs, getToolNames, getToolParts, isDuplicateToolRead, isStaleError, isToolResult, MessagePriority, type MessagePriorityType, type MessageWithParts, } from './message-priority';
|
|
14
14
|
export { consolidateSystemMessages } from './messages-transform';
|
|
15
15
|
export { extractModelInfo, NATIVE_MODEL_LIMITS, PROVIDER_CAPS, resolveModelLimit, } from './model-limits';
|
|
16
16
|
export { type CuratorDelegateFactory, createPhaseMonitorHook, } from './phase-monitor';
|
|
@@ -36,13 +36,27 @@ interface MessageInfo {
|
|
|
36
36
|
sessionID?: string;
|
|
37
37
|
modelID?: string;
|
|
38
38
|
providerID?: string;
|
|
39
|
-
toolName?: string;
|
|
40
|
-
toolArgs?: unknown;
|
|
41
39
|
[key: string]: unknown;
|
|
42
40
|
}
|
|
43
41
|
interface MessagePart {
|
|
44
42
|
type?: string;
|
|
45
43
|
text?: string;
|
|
44
|
+
tool?: string;
|
|
45
|
+
state?: ToolStateLike;
|
|
46
|
+
[key: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Minimal shape of a `ToolPart.state` value. The OpenCode SDK `ToolState` is a
|
|
50
|
+
* discriminated union on `status`; only `completed` carries `output` and only
|
|
51
|
+
* `error` carries `error`. We read defensively and never mutate `state` in
|
|
52
|
+
* place (see context-budget.ts mask/prune logic — those replace the whole
|
|
53
|
+
* ToolPart with a synthetic text part rather than corrupting the union).
|
|
54
|
+
*/
|
|
55
|
+
interface ToolStateLike {
|
|
56
|
+
status?: string;
|
|
57
|
+
output?: string;
|
|
58
|
+
error?: string;
|
|
59
|
+
input?: Record<string, unknown>;
|
|
46
60
|
[key: string]: unknown;
|
|
47
61
|
}
|
|
48
62
|
export interface MessageWithParts {
|
|
@@ -58,16 +72,60 @@ export interface MessageWithParts {
|
|
|
58
72
|
*/
|
|
59
73
|
export declare function containsPlanContent(text: string): boolean;
|
|
60
74
|
/**
|
|
61
|
-
*
|
|
75
|
+
* Returns all `ToolPart` objects in a message's `parts[]`.
|
|
76
|
+
*
|
|
77
|
+
* Per the OpenCode SDK contract (`@opencode-ai/sdk` v1+v2), tool results are
|
|
78
|
+
* delivered as `ToolPart` objects (`part.type === 'tool'`, with `part.tool`
|
|
79
|
+
* and `part.state`) inside a message's `parts[]` array — they are NOT separate
|
|
80
|
+
* `role:'tool'` messages and do not carry an `info.toolName` field. A message
|
|
81
|
+
* may contain multiple tool parts (parallel tool calls).
|
|
82
|
+
*
|
|
83
|
+
* @param message - The message to inspect
|
|
84
|
+
* @returns Array of tool parts (empty if none / malformed)
|
|
85
|
+
*/
|
|
86
|
+
export declare function getToolParts(message: MessageWithParts): MessagePart[];
|
|
87
|
+
/**
|
|
88
|
+
* Returns the completed tool outputs in a message — the countable, maskable
|
|
89
|
+
* payloads (`part.state.output` where `state.status === 'completed'`).
|
|
90
|
+
*
|
|
91
|
+
* Pending/running tools have no output; error tools expose `state.error`
|
|
92
|
+
* (diagnostic signal — never masked, only routed via the stale-error →
|
|
93
|
+
* DISPOSABLE pruning path). Completed outputs are the heavy payloads the
|
|
94
|
+
* context budget must count and may mask/prune.
|
|
95
|
+
*
|
|
96
|
+
* @param message - The message to inspect
|
|
97
|
+
* @returns Array of `{ part, output }` for each completed tool part
|
|
98
|
+
*/
|
|
99
|
+
export declare function getCompletedToolOutputs(message: MessageWithParts): Array<{
|
|
100
|
+
part: MessagePart;
|
|
101
|
+
output: string;
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* Returns the tool names (`part.tool`) for every tool part in a message.
|
|
105
|
+
*
|
|
106
|
+
* @param message - The message to inspect
|
|
107
|
+
* @returns Array of tool name strings (empty if none)
|
|
108
|
+
*/
|
|
109
|
+
export declare function getToolNames(message: MessageWithParts): string[];
|
|
110
|
+
/**
|
|
111
|
+
* Checks if a message carries at least one tool result (a `ToolPart` in its
|
|
112
|
+
* `parts[]`).
|
|
113
|
+
*
|
|
114
|
+
* This detects the real OpenCode SDK shape. The legacy `info.toolName` field
|
|
115
|
+
* never existed on production payloads and was removed (issue #2068).
|
|
62
116
|
*
|
|
63
117
|
* @param message - The message to check
|
|
64
|
-
* @returns true if the message
|
|
118
|
+
* @returns true if the message contains at least one tool part
|
|
65
119
|
*/
|
|
66
120
|
export declare function isToolResult(message: MessageWithParts): boolean;
|
|
67
121
|
/**
|
|
68
122
|
* Checks if two consecutive tool read calls are duplicates
|
|
69
123
|
* (same tool with same first argument).
|
|
70
124
|
*
|
|
125
|
+
* Compares the first tool part in each message (`part.tool` name and the first
|
|
126
|
+
* value of `part.state.input`). Two messages are duplicate reads when both
|
|
127
|
+
* call a read tool whose name contains "read" with the same first input value.
|
|
128
|
+
*
|
|
71
129
|
* @param current - The current message
|
|
72
130
|
* @param previous - The previous message
|
|
73
131
|
* @returns true if this is a duplicate tool read
|