opencode-swarm 7.154.2 → 7.154.3
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-xqs49g07.js → coder-settlement-7c9h07f5.js} +7 -7
- package/dist/cli/{config-doctor-69eebk90.js → config-doctor-8zjz6dej.js} +2 -2
- package/dist/cli/{core-dyp14hcb.js → core-dn8bn81g.js} +1 -1
- package/dist/cli/{curation-policy-jm9jsxtt.js → curation-policy-2jkbybw7.js} +4 -4
- package/dist/cli/{curator-drift-h57z6tm3.js → curator-drift-g6w4ga1q.js} +1 -1
- package/dist/cli/{curator-llm-factory-5tq9c4v5.js → curator-llm-factory-mxdjw6kz.js} +28 -28
- package/dist/cli/{curator-he8n9z9n.js → curator-v12rhct2.js} +28 -28
- package/dist/cli/{evidence-summary-service-05s5y8d6.js → evidence-summary-service-zzvvcaa9.js} +10 -10
- package/dist/cli/{gate-evidence-3ptr9af3.js → gate-evidence-16jkjre9.js} +5 -5
- package/dist/cli/{guardrail-explain-tebk344k.js → guardrail-explain-11fx66cx.js} +29 -29
- package/dist/cli/{guardrail-log-x3gz3x17.js → guardrail-log-ahvfn58c.js} +3 -3
- package/dist/cli/{guardrail-reset-716pdyf5.js → guardrail-reset-zp5xe0n5.js} +28 -28
- package/dist/cli/{hive-promoter-nvwpj2t9.js → hive-promoter-k6y06jj8.js} +28 -28
- package/dist/cli/{index-kemxyzc0.js → index-0f4b9ywa.js} +1 -1
- package/dist/cli/{index-6rcx6vr6.js → index-2rgm3hgq.js} +4 -4
- package/dist/cli/{index-pj2nycpg.js → index-4dt91x6e.js} +1 -1
- package/dist/cli/{index-6qwp46k0.js → index-4n557t8w.js} +3 -3
- package/dist/cli/{index-xt6jx41g.js → index-6vcrkz80.js} +4 -4
- package/dist/cli/{index-vhhdj49x.js → index-7fyv62b2.js} +8 -9
- package/dist/cli/{index-2w6vy9a9.js → index-7qky94rr.js} +1 -1
- package/dist/cli/{index-6rns7b2m.js → index-94e20w95.js} +2 -2
- package/dist/cli/{index-v2ryvr8k.js → index-9nw6z98k.js} +30 -30
- package/dist/cli/{index-f6qmar4k.js → index-a6xjn2zt.js} +5 -5
- package/dist/cli/{index-j6q3k628.js → index-bhjkxasn.js} +1 -1
- package/dist/cli/{index-7tw116n6.js → index-ckp0z9d4.js} +2 -2
- package/dist/cli/{index-mnxtkt8s.js → index-d7r6y724.js} +3 -3
- package/dist/cli/{index-4cgee5vh.js → index-dtn0pne5.js} +20 -1
- package/dist/cli/{index-r0dactw2.js → index-ed13peqr.js} +1 -1
- package/dist/cli/{index-fv9ddfta.js → index-env8fk17.js} +1 -1
- package/dist/cli/{index-8v69hfpt.js → index-g1bh7980.js} +3 -3
- package/dist/cli/{index-ynvw5kxc.js → index-gbkdj7ay.js} +2 -2
- package/dist/cli/{index-nh4axsxc.js → index-kck2gtxk.js} +2 -2
- package/dist/cli/{index-bxvkn0ye.js → index-m0fy8jra.js} +93 -65
- package/dist/cli/{index-n0gqre56.js → index-n7nnz0jp.js} +6 -6
- package/dist/cli/{index-dm9tc6qb.js → index-q0prhdds.js} +1 -1
- package/dist/cli/{index-399e8aze.js → index-qdnmnq65.js} +1 -1
- package/dist/cli/{index-xq2v52tt.js → index-qxj63890.js} +1 -1
- package/dist/cli/{index-p7ey2w90.js → index-s23q9v6t.js} +6 -6
- package/dist/cli/{index-dsqat5pg.js → index-s5p8ryar.js} +1 -1
- package/dist/cli/{index-v9585wjc.js → index-v6xkgxts.js} +2 -2
- package/dist/cli/{index-4xqa0sgz.js → index-vntggpez.js} +2 -2
- package/dist/cli/{index-07n87ctw.js → index-wkagbmpt.js} +1 -1
- package/dist/cli/{index-57t97rtr.js → index-y3kw1zpm.js} +2 -1
- package/dist/cli/{index-9avdncr2.js → index-ymgsmjba.js} +5 -5
- package/dist/cli/{index-14bz2t7b.js → index-zak50rve.js} +1 -1
- package/dist/cli/index.js +28 -28
- package/dist/cli/{knowledge-escalator-s0tye368.js → knowledge-escalator-yew2fbxb.js} +10 -10
- package/dist/cli/{knowledge-events-eyy9yf6b.js → knowledge-events-zfg423hp.js} +8 -8
- package/dist/cli/{knowledge-link-rb11f06y.js → knowledge-link-ydv6shg2.js} +3 -3
- package/dist/cli/{knowledge-store-zjq5mz2d.js → knowledge-store-zcv9stzz.js} +4 -4
- package/dist/cli/{knowledge-validator-yw5qqqpd.js → knowledge-validator-q68wx2bf.js} +6 -6
- package/dist/cli/{pending-delegations-rdzjq3nw.js → pending-delegations-yet1rza6.js} +2 -2
- package/dist/cli/{pr-subscriptions-2f5fne6z.js → pr-subscriptions-mp7fyh1r.js} +3 -3
- package/dist/cli/{runner-yaqrj388.js → runner-s89ja08q.js} +4 -4
- package/dist/cli/{scan-cursor-8f0s883y.js → scan-cursor-38bzfhwf.js} +5 -5
- package/dist/cli/{schema-2xw94dh3.js → schema-9hqyt4t6.js} +1 -1
- package/dist/cli/{scope-persistence-tap2q94x.js → scope-persistence-dd9s9q2b.js} +5 -5
- package/dist/cli/{skill-generator-2xbfryqb.js → skill-generator-b28ezazm.js} +12 -12
- package/dist/cli/{worktree-collision-ownership-5gwey8ms.js → worktree-collision-ownership-zw65t2p9.js} +4 -4
- package/dist/cli/{worktree-isolation-xsy14t5a.js → worktree-isolation-0ag393t0.js} +28 -28
- package/dist/hooks/final-context-accounting.d.ts +60 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/knowledge-injector.d.ts +1 -1
- package/dist/hooks/system-enhancer.d.ts +13 -0
- package/dist/hooks/utils.d.ts +11 -0
- package/dist/index.js +65 -60
- package/dist/services/compaction-service.d.ts +9 -3
- package/dist/services/context-budget-service.d.ts +7 -3
- package/dist/services/injection-budget.d.ts +103 -26
- package/dist/state.d.ts +69 -0
- package/dist/summaries/summarizer.d.ts +34 -3
- package/package.json +2 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Final context accounting (#2107 §3).
|
|
3
|
+
*
|
|
4
|
+
* ONE final accounting step, run after every injector has contributed and after
|
|
5
|
+
* `consolidateSystemMessagesInPlace` — the last structure-mutating handler in
|
|
6
|
+
* the `experimental.chat.messages.transform` chain. It measures the actual
|
|
7
|
+
* final model-visible surface exactly once:
|
|
8
|
+
*
|
|
9
|
+
* - `output.messages` (post-consolidation; carries every messages-chain
|
|
10
|
+
* injection: knowledge, memory recall, the advisory block) via
|
|
11
|
+
* `computeContextUsage`, which prefers provider-reported token usage when the
|
|
12
|
+
* latest assistant message carries it;
|
|
13
|
+
* - PLUS the system chain's `output.system` content (system-enhancer banners,
|
|
14
|
+
* context capsules, the swarm-command banner). Those bytes live in a separate
|
|
15
|
+
* output structure the messages chain never sees and consolidation never
|
|
16
|
+
* merges (docs/context-map.md; engineering-invariants § v6.85.1), so they are
|
|
17
|
+
* added from the per-turn injection ledger's `surface: 'system'` emissions.
|
|
18
|
+
* Messages-surface producers are attribution-only — their bytes are already
|
|
19
|
+
* inside the measurement and are NEVER added again.
|
|
20
|
+
*
|
|
21
|
+
* The limit is resolved through the exact same ladder physical pruning uses
|
|
22
|
+
* (`resolveModelLimit` with `context_budget.model_limits` overrides and the
|
|
23
|
+
* live `model.limit.context` relayed from the system.transform hook), so the
|
|
24
|
+
* warning/critical thresholds here are the same thresholds, against the same
|
|
25
|
+
* denominator, that `context-budget.ts` enforces. A 128K–1M-window model can
|
|
26
|
+
* no longer receive a warning computed against a phantom denominator.
|
|
27
|
+
*
|
|
28
|
+
* The warning this step emits is bounded, advisory-only (it never removes
|
|
29
|
+
* content and says so), suppressed to once per session per band, and its own
|
|
30
|
+
* token cost is included in the recorded total AND recorded as a ledger
|
|
31
|
+
* emission — it cannot escape accounting. Fail-open by design: an accounting
|
|
32
|
+
* failure must never break request composition. The step is registered
|
|
33
|
+
* inside the plugin's single composeHandlers chain for messages.transform
|
|
34
|
+
* (one handler per hook type is all the host allows), which wraps it in
|
|
35
|
+
* safeHook; the inner try/catch below is the intentional first-line
|
|
36
|
+
* fail-open and logs the failure itself, so the outer wrapper is only a
|
|
37
|
+
* redundant backstop, never the primary swallowing layer.
|
|
38
|
+
*/
|
|
39
|
+
import type { PluginConfig } from '../config/index.js';
|
|
40
|
+
import type { MessageWithParts } from './knowledge-types.js';
|
|
41
|
+
interface FinalAccountingOptions {
|
|
42
|
+
config: PluginConfig;
|
|
43
|
+
/** Same seam createContextBudgetHandler uses: resolves the
|
|
44
|
+
* configured target model for an agent name. */
|
|
45
|
+
resolveAgentModelFn?: (agentName: string) => string | undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* One-shot-per-band warning suppression (#2107 §3), backed by the
|
|
49
|
+
* session-keyed `finalAccountingWarningBandsBySession` map in state.ts so
|
|
50
|
+
* `resetSwarmState` covers it (AGENTS.md invariant 8). Deliberately NOT
|
|
51
|
+
* reset on compaction: "once per session per band" mirrors the
|
|
52
|
+
* established contextPressureWarningSent one-shot pattern; the compaction
|
|
53
|
+
* tiers have their own per-session hysteresis.
|
|
54
|
+
*/
|
|
55
|
+
/** Test seam: clear warning-suppression state. */
|
|
56
|
+
export declare function _resetFinalAccountingState(): void;
|
|
57
|
+
export declare function createFinalContextAccountingStep(options: FinalAccountingOptions): (input: unknown, output: {
|
|
58
|
+
messages?: MessageWithParts[];
|
|
59
|
+
}) => Promise<void>;
|
|
60
|
+
export {};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { createDelegationGateHook, outputLooksLikeBackgroundRunning, } from './d
|
|
|
8
8
|
export { createDelegationSanitizerHook } from './delegation-sanitizer';
|
|
9
9
|
export { createDelegationTrackerHook } from './delegation-tracker';
|
|
10
10
|
export { extractCurrentPhase, extractCurrentPhaseFromPlan, extractCurrentTask, extractCurrentTaskFromPlan, extractDecisions, extractIncompleteTasks, extractIncompleteTasksFromPlan, extractPatterns, } from './extractors';
|
|
11
|
+
export { createFinalContextAccountingStep } from './final-context-accounting';
|
|
11
12
|
export { createFullAutoInterceptHook } from './full-auto-intercept';
|
|
12
13
|
export { checkFileAuthority, createGuardrailsHooks, DEFAULT_AGENT_AUTHORITY_RULES, } from './guardrails';
|
|
13
14
|
export { classifyMessage, classifyMessages, containsPlanContent, getCompletedToolOutputs, getToolNames, getToolParts, isDuplicateToolRead, isStaleError, isToolResult, MessagePriority, type MessagePriorityType, type MessageWithParts, } from './message-priority';
|
|
@@ -99,7 +99,7 @@ export declare function matchesDelegateScope(entry: Pick<RankedEntry, 'applies_t
|
|
|
99
99
|
/** Inserts the knowledge block just before the last user message (recency position). */
|
|
100
100
|
declare function injectKnowledgeMessage(output: {
|
|
101
101
|
messages?: MessageWithParts[];
|
|
102
|
-
}, text: string): void;
|
|
102
|
+
}, text: string, sessionId?: string): void;
|
|
103
103
|
/**
|
|
104
104
|
* Creates a knowledge injection hook that injects relevant knowledge into the
|
|
105
105
|
* architect's message context at phase start. Supports caching for re-injection
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Reads plan.md and injects phase context into the system prompt.
|
|
7
7
|
*/
|
|
8
8
|
import type { PluginConfig } from '../config';
|
|
9
|
+
import type { RuntimePlan } from '../config/plan-schema';
|
|
9
10
|
/**
|
|
10
11
|
* Build the [spec-drift] advisory injected into the model's system prompt
|
|
11
12
|
* after every loadPlan whenever spec staleness is detected (issue #853
|
|
@@ -29,6 +30,9 @@ export declare function buildSpecDriftAdvisory(args: {
|
|
|
29
30
|
source: string;
|
|
30
31
|
};
|
|
31
32
|
}): string;
|
|
33
|
+
declare function maybeAppendSpecDriftAdvisory(output: {
|
|
34
|
+
system: string[];
|
|
35
|
+
}, directory: string, plan: RuntimePlan | null, sessionId?: string): void;
|
|
32
36
|
/**
|
|
33
37
|
* Build a retrospective injection string for the architect system message.
|
|
34
38
|
* Tier 1: direct phase-scoped lookup for same-plan previous phase.
|
|
@@ -51,3 +55,12 @@ export type ArchitectMode = 'DISCOVER' | 'PLAN' | 'EXECUTE' | 'PHASE-WRAP' | 'UN
|
|
|
51
55
|
* @returns The current architect mode based on plan state
|
|
52
56
|
*/
|
|
53
57
|
export declare function detectArchitectMode(directory: string, cache?: Map<string, Promise<string | null>>): Promise<ArchitectMode>;
|
|
58
|
+
/**
|
|
59
|
+
* Tier-0 test seam (knowledge-injector precedent): exposes the spec-drift
|
|
60
|
+
* advisory helper so the #2107 §2 attribution test can drive its direct
|
|
61
|
+
* output.system push and assert the ledger emission is recorded exactly once.
|
|
62
|
+
*/
|
|
63
|
+
export declare const _test_exports: {
|
|
64
|
+
maybeAppendSpecDriftAdvisory: typeof maybeAppendSpecDriftAdvisory;
|
|
65
|
+
};
|
|
66
|
+
export {};
|
package/dist/hooks/utils.d.ts
CHANGED
|
@@ -77,5 +77,16 @@ export declare function composeBlockingHandlers<I, O>(...fns: Array<HookHandler<
|
|
|
77
77
|
*/
|
|
78
78
|
export declare function validateSwarmPath(directory: string, filename: string): string;
|
|
79
79
|
export declare function readSwarmFileAsync(directory: string, filename: string, cache?: Map<string, Promise<string | null>>): Promise<string | null>;
|
|
80
|
+
/**
|
|
81
|
+
* Estimate tokens from a character count using the canonical heuristic.
|
|
82
|
+
* This is the single sanctioned numeric form (issue #2107 §1).
|
|
83
|
+
*/
|
|
84
|
+
export declare function estimateTokensFromCharCount(chars: number): number;
|
|
85
|
+
/**
|
|
86
|
+
* Inverse of the canonical estimator: the character budget that corresponds to a
|
|
87
|
+
* token budget. Floor, so the result never overruns the token budget when converted
|
|
88
|
+
* back with `estimateTokensFromCharCount`.
|
|
89
|
+
*/
|
|
90
|
+
export declare function estimateCharsForTokens(tokens: number): number;
|
|
80
91
|
export declare function estimateTokens(text: string): number;
|
|
81
92
|
export {};
|