opencode-swarm 7.164.9 → 7.164.11
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/{coder-settlement-8wxdx3ge.js → coder-settlement-0rfk8y11.js} +10 -10
- package/dist/cli/{config-doctor-zqbzjqsk.js → config-doctor-j17b7qq2.js} +8 -4
- package/dist/cli/{core-6b997gee.js → core-evhjjrtt.js} +2 -2
- package/dist/cli/{curation-policy-w829da9a.js → curation-policy-vj6z5hvr.js} +4 -4
- package/dist/cli/{curator-drift-5sykmtf5.js → curator-drift-ez81vg2t.js} +4 -4
- package/dist/cli/curator-llm-factory-sxcpmcqq.js +68 -0
- package/dist/cli/{curator-hvet3ccp.js → curator-vqd5yeck.js} +34 -34
- package/dist/cli/{evidence-summary-service-zefetqqa.js → evidence-summary-service-937x7rbg.js} +15 -15
- package/dist/cli/{gate-evidence-8ex11125.js → gate-evidence-q1cehr4k.js} +8 -6
- package/dist/cli/guardrail-explain-xv9aw1bf.js +69 -0
- package/dist/cli/{guardrail-log-jf1sj1zc.js → guardrail-log-3g93f3g2.js} +7 -7
- package/dist/cli/{guardrail-reset-0062066m.js → guardrail-reset-qe2r5qzq.js} +34 -34
- package/dist/cli/{hive-promoter-8nr61bhn.js → hive-promoter-09yc9mp5.js} +34 -34
- package/dist/cli/{index-g1rnq3pg.js → index-1ww7wj8d.js} +4 -4
- package/dist/cli/{index-zg9d392c.js → index-3qf1vxtb.js} +2 -1
- package/dist/cli/{index-1afqzpj4.js → index-47kh2103.js} +6 -6
- package/dist/cli/{index-sf24zdbp.js → index-4gqxppcx.js} +1 -1
- package/dist/cli/{index-pxzx4wxb.js → index-4vb6qa73.js} +2 -2
- package/dist/cli/{index-8psybzzf.js → index-50j914b5.js} +5 -0
- package/dist/cli/{index-qxvdwx79.js → index-5jx22kwc.js} +3 -3
- package/dist/cli/{index-8nsknkgs.js → index-5kcvrpkt.js} +46 -4
- package/dist/cli/{index-18z6gf3a.js → index-77z98j76.js} +9 -9
- package/dist/cli/{index-7tme4v2x.js → index-7m32fjb4.js} +5 -5
- package/dist/cli/{index-t1qzjhnj.js → index-9gxbjkts.js} +1 -1
- package/dist/cli/{index-8m3w7sr7.js → index-aqppaaqx.js} +2 -2
- package/dist/cli/{index-bv90qkyw.js → index-b2nj04q6.js} +1 -1
- package/dist/cli/{index-qkzyfnmc.js → index-c5v1w13g.js} +4 -4
- package/dist/cli/{index-teq4xzkh.js → index-d9entpn3.js} +2 -2
- package/dist/cli/{index-1anz3srx.js → index-dsg9dw3b.js} +1 -1
- package/dist/cli/{index-wnw2rt73.js → index-e90em0x4.js} +1 -1
- package/dist/cli/{index-h933exaw.js → index-ggrp3v00.js} +7 -7
- package/dist/cli/{index-sdhshera.js → index-ggtmsm84.js} +1 -1
- package/dist/cli/{index-nnetagj1.js → index-hp22pzn5.js} +2 -2
- package/dist/cli/{index-3qeznjj9.js → index-kc2tgcm7.js} +4 -4
- package/dist/cli/{index-41m7f0xj.js → index-kch6yenm.js} +3 -3
- package/dist/cli/{index-prmwcpqn.js → index-kv2tdkk5.js} +1 -1
- package/dist/cli/{index-vsxq8b54.js → index-mmjamc9b.js} +5 -5
- package/dist/cli/{index-sxxh4ams.js → index-n8688d12.js} +2 -2
- package/dist/cli/{index-s6ejwhew.js → index-nqsj0g5y.js} +1 -1
- package/dist/cli/{index-0rpfwzkw.js → index-pp2nya9v.js} +3 -3
- package/dist/cli/{index-nj2gap5p.js → index-qbw3yw2d.js} +7 -7
- package/dist/cli/{index-5kstr2ga.js → index-r5q5gd2a.js} +3 -3
- package/dist/cli/{index-mh57gjsd.js → index-r656jh9j.js} +1386 -1264
- package/dist/cli/{index-jpfktfb7.js → index-rhqdsc1x.js} +1 -1
- package/dist/cli/{index-7fyjv3f2.js → index-vdn32nws.js} +1 -1
- package/dist/cli/{index-vjef4fy9.js → index-w95vxjde.js} +1 -1
- package/dist/cli/{index-rgj5zmms.js → index-x43debgx.js} +30 -6
- package/dist/cli/{index-pkga8b4j.js → index-xnb3tk7x.js} +1 -1
- package/dist/cli/{index-hwqxp3kr.js → index-y1yqmkv7.js} +36 -36
- package/dist/cli/{index-83bewmqd.js → index-zfs3zqeq.js} +3 -3
- package/dist/cli/{index-8tqqmsav.js → index-zjg4chy2.js} +1 -1
- package/dist/cli/index.js +34 -34
- package/dist/cli/{knowledge-escalator-p60t5809.js → knowledge-escalator-j04g450p.js} +13 -13
- package/dist/cli/{knowledge-events-90k35k0w.js → knowledge-events-53z45rs0.js} +11 -11
- package/dist/cli/{knowledge-link-kbbp0rhh.js → knowledge-link-a6kfg3qm.js} +3 -3
- package/dist/cli/{knowledge-store-rqkyw5zp.js → knowledge-store-whm0gagt.js} +4 -4
- package/dist/cli/{knowledge-validator-5zqwvnvr.js → knowledge-validator-h8m7065g.js} +6 -6
- package/dist/cli/{model-preflight-bq035tfh.js → model-preflight-288nsgpw.js} +1 -1
- package/dist/cli/{pending-delegations-jdztm7v1.js → pending-delegations-6hkpe5ze.js} +4 -4
- package/dist/cli/{pr-subscriptions-7am85psn.js → pr-subscriptions-11zca1mh.js} +4 -4
- package/dist/cli/{pr-workflow-gate-2rqn6eat.js → pr-workflow-gate-6g29rkg7.js} +34 -34
- package/dist/cli/{runner-59cbgcdy.js → runner-5abw3t35.js} +4 -4
- package/dist/cli/{scan-cursor-9bm4zfx2.js → scan-cursor-mkfx410t.js} +5 -5
- package/dist/cli/{schema-4yjk7z24.js → schema-jbbam3ev.js} +2 -2
- package/dist/cli/{scope-persistence-s2ayj1c3.js → scope-persistence-q1ct4k42.js} +8 -8
- package/dist/cli/{skill-generator-bddg7mx1.js → skill-generator-cv8fg96x.js} +15 -15
- package/dist/cli/{worktree-collision-ownership-84j7w373.js → worktree-collision-ownership-xgnn8dsq.js} +5 -5
- package/dist/cli/{worktree-isolation-s0d3qtpv.js → worktree-isolation-k2dgfmeg.js} +34 -34
- package/dist/config/constants.d.ts +1 -1
- package/dist/config/evidence-schema.d.ts +3 -0
- package/dist/evaluation/contracts.d.ts +8 -2
- package/dist/evaluation/gate-audit.d.ts +2 -0
- package/dist/gate-evidence.d.ts +30 -1
- package/dist/hooks/final-context-accounting.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/knowledge-injector.d.ts +1 -1
- package/dist/hooks/messages-transform.d.ts +43 -22
- package/dist/hooks/system-guidance-carrier.d.ts +112 -0
- package/dist/index.js +351 -310
- package/dist/quality/git-base.d.ts +41 -0
- package/dist/quality/metrics.d.ts +8 -1
- package/dist/services/config-doctor.d.ts +28 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/lean-turbo-critic.d.ts +49 -0
- package/dist/tools/manifest.d.ts +1 -0
- package/dist/tools/tool-metadata.d.ts +4 -0
- package/package.json +1 -1
- package/dist/cli/curator-llm-factory-mqyj4d2w.js +0 -68
- package/dist/cli/guardrail-explain-mk9z5n76.js +0 -69
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System-guidance carrier (issue #2526).
|
|
3
|
+
*
|
|
4
|
+
* The OpenCode host's `toModelMessagesEffect` (pinned @opencode-ai 1.18.3 —
|
|
5
|
+
* anomalyco/opencode@v1.18.3, packages/opencode/src/session/message-v2.ts:195-244,
|
|
6
|
+
* commit 127bdb30784d508cc556c71a0f32b508a3061517) branches ONLY on `user` and
|
|
7
|
+
* `assistant` with no `else`, and dereferences `msg.parts` unconditionally.
|
|
8
|
+
* Synthetic `role:'system'` entries spliced into `experimental.chat.messages.transform`
|
|
9
|
+
* were therefore silently discarded (and flat entries without `parts` crashed the
|
|
10
|
+
* host prompt build with a TypeError) while delivery telemetry recorded them as
|
|
11
|
+
* delivered.
|
|
12
|
+
*
|
|
13
|
+
* This module is the single source of truth for the fix: model-only guidance rides
|
|
14
|
+
* a USER-role message — which the host renders unconditionally — carrying an explicit
|
|
15
|
+
* provenance fence so the model can tell injected directives apart from real user
|
|
16
|
+
* speech. Detection is by `info.id` prefix, never by text sniffing.
|
|
17
|
+
*
|
|
18
|
+
* Host-render contract for a carrier (message-v2.ts user branch, :198-242):
|
|
19
|
+
* - `info.role === 'user'` and `info.id` a string (copied verbatim; treated as opaque)
|
|
20
|
+
* - ≥1 part `{type:'text', text !== ''}` (empty-string text parts are dropped; a
|
|
21
|
+
* message whose every part is dropped is not pushed)
|
|
22
|
+
* - `parts.length === 0` entries are skipped before the role branch — an EMPTY
|
|
23
|
+
* carrier (zero parts) is therefore truly inert and never renders.
|
|
24
|
+
*
|
|
25
|
+
* Carriers live only inside a single request's transform array: the host rebuilds
|
|
26
|
+
* that array from persisted (user/assistant-only) messages each turn, so carriers
|
|
27
|
+
* never persist, accumulate, or pollute the stored conversation.
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Structural message shape the carrier helpers operate on. Every consumer's
|
|
31
|
+
* local message type (knowledge `MessageWithParts`, the guardrails transform's
|
|
32
|
+
* local shape, memory's cast arrays) is assignable to this; arrays are passed
|
|
33
|
+
* BY REFERENCE and mutated in place (issue #1619 discipline).
|
|
34
|
+
*/
|
|
35
|
+
export interface GuidanceMessage {
|
|
36
|
+
info: {
|
|
37
|
+
role?: string;
|
|
38
|
+
/** String when plugin-built; every read goes through a typeof check. */
|
|
39
|
+
id?: unknown;
|
|
40
|
+
};
|
|
41
|
+
parts: Array<{
|
|
42
|
+
type: string;
|
|
43
|
+
text?: string;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
/** Identity prefix for guidance carriers. Detection = role user + this id prefix. */
|
|
47
|
+
export declare const GUIDANCE_CARRIER_ID_PREFIX = "swarm-guidance:";
|
|
48
|
+
export declare function guidanceCarrierId(kind: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Wrap guidance text in the provenance fence (null for empty/whitespace text).
|
|
51
|
+
* Shared by every carrier-construction path so the fence format cannot drift.
|
|
52
|
+
* Embedded fence markup is neutralized (see {@link neutralizeFenceMarkup}).
|
|
53
|
+
*/
|
|
54
|
+
export declare function fenceGuidanceText(kind: string, text: string): string | null;
|
|
55
|
+
/**
|
|
56
|
+
* True for a guidance carrier entry (role user + id prefix — no text
|
|
57
|
+
* sniffing). Accepts `unknown` so every consumer's local message type can be
|
|
58
|
+
* tested without casts.
|
|
59
|
+
*/
|
|
60
|
+
export declare function isGuidanceCarrier(message: unknown): boolean;
|
|
61
|
+
/** All guidance carriers in the array, in order. */
|
|
62
|
+
export declare function findGuidanceCarriers(messages: GuidanceMessage[]): GuidanceMessage[];
|
|
63
|
+
/**
|
|
64
|
+
* Joined text of a message's text parts (empty string when none). Used by
|
|
65
|
+
* dedupe predicates that must not re-inject a block already present in the
|
|
66
|
+
* carrier body.
|
|
67
|
+
*/
|
|
68
|
+
export declare function messageTextOf(message: GuidanceMessage | undefined | null): string;
|
|
69
|
+
/**
|
|
70
|
+
* Build a filled carrier. Returns null for empty/whitespace text — there is
|
|
71
|
+
* nothing to deliver, and an empty carrier must not be created by value sites
|
|
72
|
+
* (find-or-create sites use {@link ensureGuidanceCarrier} instead).
|
|
73
|
+
*
|
|
74
|
+
* `extraInfo` (e.g. agent/sessionID) is merged into info alongside id/role.
|
|
75
|
+
*/
|
|
76
|
+
export declare function buildGuidanceCarrier(kind: string, text: string, extraInfo?: Record<string, unknown>): GuidanceMessage | null;
|
|
77
|
+
/**
|
|
78
|
+
* Find the first guidance carrier, or `unshift` a new EMPTY one (zero parts —
|
|
79
|
+
* inert under the host's `parts.length === 0` continue; it renders nothing until
|
|
80
|
+
* a producer fills it, and it is never fence-only, because a fence-only text part
|
|
81
|
+
* WOULD render).
|
|
82
|
+
*/
|
|
83
|
+
export declare function ensureGuidanceCarrier(messages: GuidanceMessage[], kind: string): GuidanceMessage;
|
|
84
|
+
/**
|
|
85
|
+
* Prepend a block to the carrier's directive body (top-of-body, preserving the
|
|
86
|
+
* historical `block + existing` order the system-message sites used). The first
|
|
87
|
+
* fill creates the single text part with fence + body + close; later prepends
|
|
88
|
+
* insert inside the existing fence. Never produces a second fence.
|
|
89
|
+
*
|
|
90
|
+
* Returns the delivered block, or null when the block is empty/whitespace
|
|
91
|
+
* (nothing changed — the carrier stays exactly as it was).
|
|
92
|
+
*/
|
|
93
|
+
export declare function prependGuidanceText(carrier: GuidanceMessage, kind: string, block: string): string | null;
|
|
94
|
+
/**
|
|
95
|
+
* Splice a filled carrier at `atIndex`. Returns the inserted entry, or null when
|
|
96
|
+
* the text is empty/whitespace (nothing inserted).
|
|
97
|
+
*/
|
|
98
|
+
export declare function insertGuidanceCarrier(messages: GuidanceMessage[], kind: string, text: string, atIndex: number, extraInfo?: Record<string, unknown>): GuidanceMessage | null;
|
|
99
|
+
/** Push a filled carrier at the end. Returns the appended entry or null (empty text). */
|
|
100
|
+
export declare function appendGuidanceCarrier(messages: GuidanceMessage[], kind: string, text: string, extraInfo?: Record<string, unknown>): GuidanceMessage | null;
|
|
101
|
+
/**
|
|
102
|
+
* Host-render SHAPE predicate: the entry is in the exact shape the pinned host
|
|
103
|
+
* renders into the model request (user branch of toModelMessagesEffect).
|
|
104
|
+
*/
|
|
105
|
+
export declare function isRenderableGuidance(entry: GuidanceMessage | null | undefined): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Delivery gate for producer telemetry (replaces the pre-#2526 self-referential
|
|
108
|
+
* "I appended it to my own array" predicate). Delivery is recorded only when
|
|
109
|
+
* this call produced a non-empty (trimmed) delta AND the resulting entry is in
|
|
110
|
+
* the host-renderable shape. Pinned end-to-end by the host-contract tests.
|
|
111
|
+
*/
|
|
112
|
+
export declare function deliveredGuidanceDelta(entry: GuidanceMessage | null | undefined, delta: string | null): boolean;
|