@sqdr2/dsh-fusion 0.0.0-stage → 0.3.2
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/INSTALL.md +89 -0
- package/INSTALL.zh.md +86 -0
- package/LICENSE +201 -0
- package/README.en.md +193 -0
- package/README.md +182 -2
- package/RELEASING.md +123 -0
- package/RELEASING.zh.md +115 -0
- package/contracts/fusion.ts +279 -0
- package/contracts/storage.sql +86 -0
- package/cordis.patch.yml +3 -0
- package/docs/COMPATIBILITY.md +162 -0
- package/docs/EVIDENCE.md +141 -0
- package/dshx.yml +39 -0
- package/lib/client.js +1920 -0
- package/lib/client.js.map +1 -0
- package/lib/dsh-fusion.js +12664 -0
- package/lib/types/activity.d.ts +20 -0
- package/lib/types/approval/logical.d.ts +10 -0
- package/lib/types/benchmark/naive.d.ts +37 -0
- package/lib/types/benchmark/native-run.d.ts +68 -0
- package/lib/types/benchmark/output-limits.d.ts +19 -0
- package/lib/types/bilingual.d.ts +2 -0
- package/lib/types/client/ActivityRows.d.ts +8 -0
- package/lib/types/client/FusionCache.d.ts +4 -0
- package/lib/types/client/FusionHint.d.ts +9 -0
- package/lib/types/client/FusionHistory.d.ts +5 -0
- package/lib/types/client/FusionPanelIcon.d.ts +13 -0
- package/lib/types/client/FusionRecovery.d.ts +5 -0
- package/lib/types/client/FusionSettings.d.ts +9 -0
- package/lib/types/client/FusionStatus.d.ts +5 -0
- package/lib/types/client/FusionTool.d.ts +4 -0
- package/lib/types/client/activity-model.d.ts +14 -0
- package/lib/types/client/i18n.d.ts +15 -0
- package/lib/types/client/index.d.ts +22 -0
- package/lib/types/client/settings-events.d.ts +2 -0
- package/lib/types/client/status-polling.d.ts +9 -0
- package/lib/types/context/guard.d.ts +21 -0
- package/lib/types/context/handoff.d.ts +17 -0
- package/lib/types/contracts.d.ts +449 -0
- package/lib/types/digest.d.ts +5 -0
- package/lib/types/dsh-fusion.d.ts +13 -0
- package/lib/types/errors.d.ts +28 -0
- package/lib/types/evidence/gate.d.ts +23 -0
- package/lib/types/evidence/receipts.d.ts +65 -0
- package/lib/types/execution/write-lease.d.ts +42 -0
- package/lib/types/host/bindings.d.ts +30 -0
- package/lib/types/host/cache-defaults.d.ts +48 -0
- package/lib/types/host/cache-policy.d.ts +155 -0
- package/lib/types/host/change-evidence.d.ts +38 -0
- package/lib/types/host/compaction-routing.d.ts +15 -0
- package/lib/types/host/coordinator.d.ts +169 -0
- package/lib/types/host/evidence-page.d.ts +13 -0
- package/lib/types/host/history.d.ts +88 -0
- package/lib/types/host/http.d.ts +4 -0
- package/lib/types/host/model-output.d.ts +13 -0
- package/lib/types/host/native-activity.d.ts +26 -0
- package/lib/types/host/native-approvals.d.ts +29 -0
- package/lib/types/host/native-auxiliary.d.ts +17 -0
- package/lib/types/host/native-budget.d.ts +33 -0
- package/lib/types/host/native-checks.d.ts +104 -0
- package/lib/types/host/native-compaction.d.ts +8 -0
- package/lib/types/host/native-context.d.ts +36 -0
- package/lib/types/host/native-effects.d.ts +75 -0
- package/lib/types/host/native-evidence.d.ts +4 -0
- package/lib/types/host/native-exploration.d.ts +15 -0
- package/lib/types/host/native-keepalive.d.ts +82 -0
- package/lib/types/host/native-model-control.d.ts +99 -0
- package/lib/types/host/native-on-demand-context.d.ts +39 -0
- package/lib/types/host/native-request.d.ts +5 -0
- package/lib/types/host/native-review.d.ts +11 -0
- package/lib/types/host/native-role-sandbox.d.ts +49 -0
- package/lib/types/host/native-scopes.d.ts +49 -0
- package/lib/types/host/native-selection.d.ts +29 -0
- package/lib/types/host/native-task-context.d.ts +39 -0
- package/lib/types/host/native-usage.d.ts +46 -0
- package/lib/types/host/native-worker-brief.d.ts +74 -0
- package/lib/types/host/native-worker-notices.d.ts +15 -0
- package/lib/types/host/native-worker.d.ts +44 -0
- package/lib/types/host/native-workflow.d.ts +41 -0
- package/lib/types/host/route-transport.d.ts +22 -0
- package/lib/types/host/settings.d.ts +39 -0
- package/lib/types/host/shell.d.ts +11 -0
- package/lib/types/host/status.d.ts +7 -0
- package/lib/types/host/subagent-seam.d.ts +10 -0
- package/lib/types/host/tool-table.d.ts +35 -0
- package/lib/types/host/worker-terminal.d.ts +68 -0
- package/lib/types/host/workspace-guard.d.ts +13 -0
- package/lib/types/host/workspace.d.ts +52 -0
- package/lib/types/identity.d.ts +64 -0
- package/lib/types/index.d.ts +34 -0
- package/lib/types/message-source.d.ts +29 -0
- package/lib/types/profile/compactor.d.ts +5 -0
- package/lib/types/profile/keepalive.d.ts +3 -0
- package/lib/types/profile/resolve.d.ts +17 -0
- package/lib/types/prompts.d.ts +8 -0
- package/lib/types/recovery/reconcile.d.ts +28 -0
- package/lib/types/review/dispatch.d.ts +20 -0
- package/lib/types/review/protocol.d.ts +51 -0
- package/lib/types/review/ticket.d.ts +32 -0
- package/lib/types/status.d.ts +88 -0
- package/lib/types/store-migration.d.ts +29 -0
- package/lib/types/task/deletion.d.ts +64 -0
- package/lib/types/task/reducer.d.ts +6 -0
- package/lib/types/task/sqlite-store.d.ts +71 -0
- package/lib/types/task/state.d.ts +51 -0
- package/lib/types/task/status-index.d.ts +28 -0
- package/lib/types/task/store.d.ts +48 -0
- package/lib/types/usage/budget.d.ts +27 -0
- package/lib/types/usage/ledger.d.ts +66 -0
- package/lib/types/usage/normalize.d.ts +50 -0
- package/lib/types/usage/pricing.d.ts +18 -0
- package/package.json +178 -4
- package/profiles/fusion-auto.example.json +45 -0
- package/prompts/compact.md +7 -0
- package/prompts/lead.md +42 -0
- package/prompts/model-lead.md +13 -0
- package/prompts/model-worker.md +5 -0
- package/prompts/worker.md +21 -0
- package/src/activity.ts +23 -0
- package/src/approval/logical.ts +44 -0
- package/src/benchmark/naive.ts +216 -0
- package/src/benchmark/native-run.ts +215 -0
- package/src/benchmark/output-limits.ts +33 -0
- package/src/bilingual.ts +2 -0
- package/src/client/ActivityRows.tsx +59 -0
- package/src/client/FusionCache.tsx +130 -0
- package/src/client/FusionHint.tsx +39 -0
- package/src/client/FusionHistory.tsx +247 -0
- package/src/client/FusionPanelIcon.tsx +39 -0
- package/src/client/FusionRecovery.tsx +69 -0
- package/src/client/FusionSettings.tsx +205 -0
- package/src/client/FusionStatus.tsx +103 -0
- package/src/client/FusionTool.tsx +66 -0
- package/src/client/activity-model.ts +31 -0
- package/src/client/i18n.ts +30 -0
- package/src/client/index.ts +50 -0
- package/src/client/settings-events.ts +3 -0
- package/src/client/status-polling.ts +88 -0
- package/src/context/guard.ts +81 -0
- package/src/context/handoff.ts +28 -0
- package/src/contracts.ts +449 -0
- package/src/digest.ts +28 -0
- package/src/dsh-fusion.ts +321 -0
- package/src/errors.ts +34 -0
- package/src/evidence/gate.ts +290 -0
- package/src/evidence/receipts.ts +175 -0
- package/src/execution/write-lease.ts +187 -0
- package/src/host/bindings.ts +91 -0
- package/src/host/cache-defaults.ts +103 -0
- package/src/host/cache-policy.ts +168 -0
- package/src/host/change-evidence.ts +156 -0
- package/src/host/compaction-routing.ts +46 -0
- package/src/host/coordinator.ts +2160 -0
- package/src/host/evidence-page.ts +25 -0
- package/src/host/history.ts +114 -0
- package/src/host/http.ts +30 -0
- package/src/host/model-output.ts +22 -0
- package/src/host/native-activity.ts +199 -0
- package/src/host/native-approvals.ts +196 -0
- package/src/host/native-auxiliary.ts +19 -0
- package/src/host/native-budget.ts +112 -0
- package/src/host/native-checks.ts +474 -0
- package/src/host/native-compaction.ts +34 -0
- package/src/host/native-context.ts +204 -0
- package/src/host/native-effects.ts +260 -0
- package/src/host/native-evidence.ts +31 -0
- package/src/host/native-exploration.ts +114 -0
- package/src/host/native-keepalive.ts +292 -0
- package/src/host/native-model-control.ts +298 -0
- package/src/host/native-on-demand-context.ts +74 -0
- package/src/host/native-request.ts +12 -0
- package/src/host/native-review.ts +51 -0
- package/src/host/native-role-sandbox.ts +171 -0
- package/src/host/native-scopes.ts +203 -0
- package/src/host/native-selection.ts +110 -0
- package/src/host/native-task-context.ts +264 -0
- package/src/host/native-usage.ts +121 -0
- package/src/host/native-worker-brief.ts +122 -0
- package/src/host/native-worker-notices.ts +72 -0
- package/src/host/native-worker.ts +215 -0
- package/src/host/native-workflow.ts +103 -0
- package/src/host/route-transport.ts +54 -0
- package/src/host/settings.ts +93 -0
- package/src/host/shell.ts +13 -0
- package/src/host/status.ts +112 -0
- package/src/host/subagent-seam.ts +20 -0
- package/src/host/tool-table.ts +56 -0
- package/src/host/worker-terminal.ts +91 -0
- package/src/host/workspace-guard.ts +17 -0
- package/src/host/workspace.ts +184 -0
- package/src/identity.ts +76 -0
- package/src/index.ts +50 -0
- package/src/message-source.ts +31 -0
- package/src/profile/compactor.ts +26 -0
- package/src/profile/keepalive.ts +13 -0
- package/src/profile/resolve.ts +131 -0
- package/src/prompts.ts +32 -0
- package/src/recovery/reconcile.ts +38 -0
- package/src/review/dispatch.ts +48 -0
- package/src/review/protocol.ts +212 -0
- package/src/review/ticket.ts +166 -0
- package/src/status.ts +55 -0
- package/src/store-migration.ts +65 -0
- package/src/task/deletion.ts +105 -0
- package/src/task/reducer.ts +679 -0
- package/src/task/sqlite-store.ts +386 -0
- package/src/task/state.ts +72 -0
- package/src/task/status-index.ts +198 -0
- package/src/task/store.ts +287 -0
- package/src/usage/budget.ts +88 -0
- package/src/usage/ledger.ts +218 -0
- package/src/usage/normalize.ts +308 -0
- package/src/usage/pricing.ts +95 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
2
|
+
import type { GenerateOptions, UserMessage } from '@deepseek-ai/dsh-llm';
|
|
3
|
+
import type { Role, TaskId } from '../contracts.js';
|
|
4
|
+
import type { SqliteFusionStore } from '../task/sqlite-store.js';
|
|
5
|
+
import type { SessionBinding } from './bindings.js';
|
|
6
|
+
export declare const FUSION_TASK_CONTEXT = "fusion:task";
|
|
7
|
+
export type ContextDetail = 'compact' | 'full';
|
|
8
|
+
/** Programmatic facts travel as native user-role context, never as system instructions. */
|
|
9
|
+
export declare class NativeTaskContext {
|
|
10
|
+
#private;
|
|
11
|
+
readonly store: SqliteFusionStore;
|
|
12
|
+
readonly parent: (id: string) => Agent | undefined;
|
|
13
|
+
constructor(store: SqliteFusionStore, parent: (id: string) => Agent | undefined);
|
|
14
|
+
/**
|
|
15
|
+
* Record where this task's user instructions begin. A task created by an automatic
|
|
16
|
+
* rollover continues the same conversation, so it inherits the boundary of the task
|
|
17
|
+
* it replaces: the user's instructions belong to the conversation, not to one
|
|
18
|
+
* accounting task. Narrowing it to the rollover point silently hid every earlier
|
|
19
|
+
* user message from `fusion_delegate`'s verbatim requirement check, which then
|
|
20
|
+
* rejected the Lead's own true quotes as fabricated.
|
|
21
|
+
*/
|
|
22
|
+
begin(agent: Agent, taskId: TaskId, firstSeq?: number): void;
|
|
23
|
+
/** The recorded user-instruction boundary of a task, when it has one. */
|
|
24
|
+
originSeq(taskId: TaskId): number | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* `compact` is appended on every changed step: it carries only state the
|
|
27
|
+
* native history does not already hold, so the expensive Lead does not
|
|
28
|
+
* re-read its own brief, the delivered report or the user's messages on
|
|
29
|
+
* every request. `full` restores everything after compaction, when those
|
|
30
|
+
* native messages may have been summarized away.
|
|
31
|
+
*/
|
|
32
|
+
render(binding: SessionBinding, role: Role, detail?: ContextDetail): string;
|
|
33
|
+
/** Run after native pre-step handlers, including the existing compaction owner. */
|
|
34
|
+
message(agent: Agent, binding: SessionBinding, role: Role, detail?: ContextDetail): UserMessage | undefined;
|
|
35
|
+
/** The final frozen request must contain the snapshot that was actually assembled. */
|
|
36
|
+
assertPresent(agent: Agent, binding: SessionBinding, role: Role, request: GenerateOptions): void;
|
|
37
|
+
prepareCompaction(agent: Agent, binding: SessionBinding, role: Role, sourceSurfaceSeqs: readonly number[]): string;
|
|
38
|
+
restoreCompaction(agent: Agent, binding: SessionBinding, role: Role, id: string, compactionId: string): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
3
|
+
import type { TokenUsage } from '@deepseek-ai/dsh-llm';
|
|
4
|
+
import type { Role, TaskId } from '../contracts.js';
|
|
5
|
+
import type { CanonicalBill, UsageLedgerV2 } from '../usage/ledger.js';
|
|
6
|
+
import type { SqliteFusionStore } from '../task/sqlite-store.js';
|
|
7
|
+
import type { NativeAuxiliaryRequests } from './native-auxiliary.js';
|
|
8
|
+
export interface UsageOwner {
|
|
9
|
+
readonly taskId: TaskId;
|
|
10
|
+
readonly role: Role;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* DSH counters are disjoint; missing provider fields retain unknown applicability.
|
|
14
|
+
*
|
|
15
|
+
* A counter is known only when the provider reported a real finite number.
|
|
16
|
+
* Gateways that omit completion_tokens_details send reasoningTokens as null
|
|
17
|
+
* (seen on some claude-opus-5.5 routes). known(null) throws INVALID_TOKEN_COUNT
|
|
18
|
+
* inside the llm/stream hook and aborts the turn, so null and NaN stay unknown.
|
|
19
|
+
*/
|
|
20
|
+
export declare function billFromNativeUsage(usage: TokenUsage | undefined): CanonicalBill;
|
|
21
|
+
export interface NativeUsageRecord {
|
|
22
|
+
schemaVersion: 1;
|
|
23
|
+
taskId: TaskId;
|
|
24
|
+
sessionId: string;
|
|
25
|
+
role: Role;
|
|
26
|
+
purpose: 'conversation' | 'compaction' | 'session-title' | 'cache-keepalive';
|
|
27
|
+
/** Effective request envelope; Host compaction markers can retain their pre-routing cap. */
|
|
28
|
+
maxOutputTokens: number | null;
|
|
29
|
+
reasoningEffort?: string;
|
|
30
|
+
auxiliary?: {
|
|
31
|
+
seriesId: string;
|
|
32
|
+
iteration: number;
|
|
33
|
+
};
|
|
34
|
+
nativeInvocationId: string;
|
|
35
|
+
startedAt: string;
|
|
36
|
+
endedAt: string | null;
|
|
37
|
+
/** Entering a Host stream is observable; the adapter's HTTP retry count is not. */
|
|
38
|
+
nativeStreamInvocations: 1;
|
|
39
|
+
upstreamHttpCalls: null;
|
|
40
|
+
outcome: 'entered' | 'stop' | 'tool-calls' | 'max-tokens' | 'aborted' | 'error' | 'unknown';
|
|
41
|
+
ledger: UsageLedgerV2;
|
|
42
|
+
actualSubscriptionChargeUsd: null;
|
|
43
|
+
apiEquivalentCostUsd: null;
|
|
44
|
+
}
|
|
45
|
+
/** Read-only stream observer. It neither changes requests nor orchestrates agents. */
|
|
46
|
+
export declare function observeNativeUsage(ctx: Context, store: SqliteFusionStore, ownerOf: (agent: Agent) => UsageOwner | undefined, auxiliary?: NativeAuxiliaryRequests): () => void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
2
|
+
import type { ToolExecution } from '@deepseek-ai/dsh-tools';
|
|
3
|
+
import type { GenerateOptions } from '@deepseek-ai/dsh-llm';
|
|
4
|
+
import type { TaskId } from '../contracts.js';
|
|
5
|
+
import type { SqliteFusionStore } from '../task/sqlite-store.js';
|
|
6
|
+
/** Durable Lead-authored refinements survive native compaction and request races. */
|
|
7
|
+
export declare function workerBriefs(store: SqliteFusionStore, taskId: TaskId): {
|
|
8
|
+
revision: number;
|
|
9
|
+
deliveryId: string;
|
|
10
|
+
source: "lead-tool-feedback";
|
|
11
|
+
nativeCallId: string;
|
|
12
|
+
payloadRef: string;
|
|
13
|
+
feedback: string;
|
|
14
|
+
}[];
|
|
15
|
+
/**
|
|
16
|
+
* Pin a bounded projection, including the first handoff, on both native roles.
|
|
17
|
+
* The complete owned outbox, journal and artifact bytes remain durable. Original
|
|
18
|
+
* user input and the frozen work order are retained separately by NativeTaskContext.
|
|
19
|
+
*/
|
|
20
|
+
export declare function workerHandoffProjection(store: SqliteFusionStore, taskId: TaskId): {
|
|
21
|
+
latestBriefRevision: number;
|
|
22
|
+
historyDigest: import("../contracts.js").Digest;
|
|
23
|
+
policy: "recent-whole-records-utf8-v1";
|
|
24
|
+
contentByteBudget: number;
|
|
25
|
+
totalRecords: number;
|
|
26
|
+
omittedRecords: number;
|
|
27
|
+
totalContentBytes: number;
|
|
28
|
+
retainedContentBytes: number;
|
|
29
|
+
records: {
|
|
30
|
+
revision: number;
|
|
31
|
+
source: "lead-tool-handoff" | "lead-tool-feedback";
|
|
32
|
+
sourceId: string;
|
|
33
|
+
payloadRef: string;
|
|
34
|
+
content: string;
|
|
35
|
+
}[];
|
|
36
|
+
schemaVersion: 1;
|
|
37
|
+
};
|
|
38
|
+
/** Brief bodies already arrive as native messages; the snapshot pins only their identity and digests. */
|
|
39
|
+
export declare function compactHandoffs(projection: ReturnType<typeof workerHandoffProjection>): {
|
|
40
|
+
records: {
|
|
41
|
+
contentDigest: import("../contracts.js").Digest;
|
|
42
|
+
revision: number;
|
|
43
|
+
source: "lead-tool-handoff" | "lead-tool-feedback";
|
|
44
|
+
sourceId: string;
|
|
45
|
+
payloadRef: string;
|
|
46
|
+
}[];
|
|
47
|
+
latestBriefRevision: number;
|
|
48
|
+
historyDigest: import("../contracts.js").Digest;
|
|
49
|
+
policy: "recent-whole-records-utf8-v1";
|
|
50
|
+
contentByteBudget: number;
|
|
51
|
+
totalRecords: number;
|
|
52
|
+
omittedRecords: number;
|
|
53
|
+
totalContentBytes: number;
|
|
54
|
+
retainedContentBytes: number;
|
|
55
|
+
schemaVersion: 1;
|
|
56
|
+
};
|
|
57
|
+
export declare function assertWorkerBriefRequest(store: SqliteFusionStore, taskId: TaskId, request: GenerateOptions): void;
|
|
58
|
+
/** Bind model-generated tools to the brief that their exact native request saw. */
|
|
59
|
+
export declare function captureWorkerBrief(store: SqliteFusionStore, taskId: TaskId, agent: Agent, turn: number, step: number, revision: number): void;
|
|
60
|
+
/**
|
|
61
|
+
* Bind one non-read Worker tool to the brief its own request saw.
|
|
62
|
+
*
|
|
63
|
+
* A native call is identified by `rootCallId`, which is the id of the block the
|
|
64
|
+
* assistant message emitted. A bridge route (Antigravity's `agy`) instead runs
|
|
65
|
+
* the call inside its OWN loop and reports the step through its transport, so
|
|
66
|
+
* the bridged dispatch carries a bridge-local call id that never appears in this
|
|
67
|
+
* session (`agy-mcp-N`). Refusing it as "no native request" refused the one tool
|
|
68
|
+
* a bridge Worker exists to call — `fusion_submit_result` — and stranded the
|
|
69
|
+
* task (session-1d65b1d0). Such a call is still owned by a native request: it
|
|
70
|
+
* is dispatched synchronously while the transport call runs, so the enclosing
|
|
71
|
+
* assistant message is the one that emitted the transport. `transport` carries
|
|
72
|
+
* that name only for a role whose route really is a bridge.
|
|
73
|
+
*/
|
|
74
|
+
export declare function workerToolBriefProblem(store: SqliteFusionStore, taskId: TaskId, exec: ToolExecution, revision: number, transport?: string): string | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
2
|
+
import type { UserMessage } from '@deepseek-ai/dsh-llm';
|
|
3
|
+
import type { SqliteFusionStore } from '../task/sqlite-store.js';
|
|
4
|
+
import type { SessionBinding } from './bindings.js';
|
|
5
|
+
/** Reduce only our Worker's runtime closing notice, never its structured report. */
|
|
6
|
+
export declare class NativeWorkerNotices {
|
|
7
|
+
readonly store: SqliteFusionStore;
|
|
8
|
+
constructor(store: SqliteFusionStore);
|
|
9
|
+
project(agent: Agent, binding: SessionBinding, original: UserMessage): UserMessage;
|
|
10
|
+
/** Replace retained legacy notices before the native compactor reads history.
|
|
11
|
+
* Public surface replacement preserves the original append-only event and
|
|
12
|
+
* cites it. Already compacted prose cannot be safely reverse-transformed.
|
|
13
|
+
*/
|
|
14
|
+
projectHistory(agent: Agent, binding: SessionBinding): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
3
|
+
import type { MessageId } from '@deepseek-ai/dsh-llm';
|
|
4
|
+
import type { PhysicalRoute } from '../contracts.js';
|
|
5
|
+
export interface NativeWorkerRequest {
|
|
6
|
+
readonly childId: string;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
/** Model-authored brief from the Lead's native tool call. */
|
|
9
|
+
readonly brief: string;
|
|
10
|
+
readonly route: PhysicalRoute;
|
|
11
|
+
/** 0.2.0 startContinuable persona. 0.2.1 rejects it; the role scope carries the prompt. */
|
|
12
|
+
readonly persona: string;
|
|
13
|
+
/** 0.2.0 start-time tool ceiling. 0.2.1 rejects toolFilter; the role scope narrows tools. */
|
|
14
|
+
readonly allowedTools: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export interface NativeWorkerAcceptance {
|
|
17
|
+
readonly childId: string;
|
|
18
|
+
readonly messageId: MessageId;
|
|
19
|
+
}
|
|
20
|
+
/** Version-pinned public API adapter. It never calls an LLM adapter or runs a shell itself. */
|
|
21
|
+
export declare class NativeWorkerTransport {
|
|
22
|
+
#private;
|
|
23
|
+
private readonly ctx;
|
|
24
|
+
private readonly provider;
|
|
25
|
+
constructor(ctx: Context, provider?: string);
|
|
26
|
+
assertAvailable(): void;
|
|
27
|
+
/** Caller durably reserves the child and operation before entering this method. */
|
|
28
|
+
start(parent: Agent, request: NativeWorkerRequest, signal: AbortSignal): Promise<NativeWorkerAcceptance>;
|
|
29
|
+
/** Only Lead-authored feedback is sent through this public model-message API. */
|
|
30
|
+
continue(parent: Agent, childId: string, feedback: string, signal: AbortSignal): Promise<NativeWorkerAcceptance>;
|
|
31
|
+
/**
|
|
32
|
+
* Replace an in-flight generation through public cancellation, then deliver
|
|
33
|
+
* to the same durable child. The caller must first exclude live/unknown
|
|
34
|
+
* effectful tools. Otherwise use continue(), which steers at a step boundary.
|
|
35
|
+
*/
|
|
36
|
+
interruptAndContinue(parent: Agent, childId: string, feedback: string, signal: AbortSignal): Promise<NativeWorkerAcceptance>;
|
|
37
|
+
/** Interrupt acceptance is insufficient: wait for the exact native Agent to settle and flush. */
|
|
38
|
+
settle(parent: Agent, childId: string, signal: AbortSignal): Promise<Agent>;
|
|
39
|
+
/** Yield a blocking tool to native user steering without canceling or releasing the Worker. */
|
|
40
|
+
settle(parent: Agent, childId: string, signal: AbortSignal, yieldToSteering: true): Promise<Agent | undefined>;
|
|
41
|
+
stop(parent: Agent, childId: string): Promise<Agent>;
|
|
42
|
+
/** Native release owns quiescence, persistence and handle disposal across HMR. */
|
|
43
|
+
release(parent: Agent, childId: string): Promise<void>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
2
|
+
import type { ToolExecution, ToolExecutionResult } from '@deepseek-ai/dsh-tools';
|
|
3
|
+
import type { Role } from '../contracts.js';
|
|
4
|
+
import type { SqliteFusionStore } from '../task/sqlite-store.js';
|
|
5
|
+
import type { SessionBinding } from './bindings.js';
|
|
6
|
+
export declare const enforcedWorkflow: (binding: SessionBinding) => boolean;
|
|
7
|
+
/** v3 keeps every v2 mechanism and adds role separation (see native-role-sandbox). */
|
|
8
|
+
export declare const adaptiveWorkflow: (binding: SessionBinding) => boolean;
|
|
9
|
+
export interface ProgressWindow {
|
|
10
|
+
schemaVersion: 1;
|
|
11
|
+
milestone: string;
|
|
12
|
+
recent: string[];
|
|
13
|
+
tinyRead?: {
|
|
14
|
+
path: string;
|
|
15
|
+
count: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface ProgressObservation {
|
|
19
|
+
milestone: string;
|
|
20
|
+
fingerprint?: string;
|
|
21
|
+
tinyPath?: string;
|
|
22
|
+
role: Role;
|
|
23
|
+
}
|
|
24
|
+
/** Results, not model explanations, drive this bounded and persistable detector. */
|
|
25
|
+
export declare function advanceProgress(previous: ProgressWindow | undefined, observation: ProgressObservation): {
|
|
26
|
+
window: ProgressWindow;
|
|
27
|
+
stalled: boolean;
|
|
28
|
+
};
|
|
29
|
+
/** Only public execution results and durable task facts enter the workflow controller. */
|
|
30
|
+
export declare class NativeWorkflow {
|
|
31
|
+
readonly store: SqliteFusionStore;
|
|
32
|
+
constructor(store: SqliteFusionStore);
|
|
33
|
+
milestone(binding: SessionBinding): string;
|
|
34
|
+
observe(exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>, binding: SessionBinding, role: Role, read: boolean): boolean;
|
|
35
|
+
/** One local replanning opportunity, not an immediate request for user intervention. */
|
|
36
|
+
repairProgress(agent: Agent, binding: SessionBinding, role: Role): boolean;
|
|
37
|
+
denyEffect(binding: SessionBinding): string;
|
|
38
|
+
deniedEffect(binding: SessionBinding): boolean;
|
|
39
|
+
/** At most one repair generation per role and durable milestone, surviving reloads. */
|
|
40
|
+
repairStop(agent: Agent, binding: SessionBinding, role: Role, instruction: string): boolean;
|
|
41
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
/** The transport name this provider route needs, registered or not. */
|
|
3
|
+
export declare function routeTransportName(provider: string): string | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Whether `name` is a bridge-route transport. Such a tool only replays a step
|
|
6
|
+
* the route already executed in its own loop: it is presentation, not an effect
|
|
7
|
+
* this Host authorizes, bills or holds a write lease for.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isRouteTransportName(name: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The transport this route needs AND this Host can actually accept. An
|
|
12
|
+
* unregistered name is skipped, because a call naming it is rejected as
|
|
13
|
+
* `unknown tool` — the adapter must never invent one either.
|
|
14
|
+
*
|
|
15
|
+
* The lookup is the GLOBAL view on purpose. A bridge registers its transport at
|
|
16
|
+
* the host layer, while an agent scope's own restriction hides inherited tools:
|
|
17
|
+
* reading through the Worker's restricted scope would report "absent" on the
|
|
18
|
+
* very next refresh and shrink the ceiling that had just been widened.
|
|
19
|
+
*/
|
|
20
|
+
export declare function registeredRouteTransport(ctx: Context, provider: string): string | undefined;
|
|
21
|
+
/** Add the route's transport to a capability ceiling without duplicating a configured entry. */
|
|
22
|
+
export declare function withRouteTransport(ceiling: readonly string[], transport: string | undefined): readonly string[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PairProfile, PhysicalRoute } from '../contracts.js';
|
|
2
|
+
export interface PairChoice {
|
|
3
|
+
lead: PhysicalRoute;
|
|
4
|
+
worker: PhysicalRoute;
|
|
5
|
+
outputTokens?: Partial<Record<'lead' | 'worker', number>>;
|
|
6
|
+
cacheKeepalive?: PairProfile['cacheKeepalive'];
|
|
7
|
+
compactor?: PairProfile['compactor'];
|
|
8
|
+
}
|
|
9
|
+
export interface SettingsCatalog {
|
|
10
|
+
groups: readonly {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
models: readonly {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
reasoning?: {
|
|
17
|
+
efforts: readonly {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
}[];
|
|
21
|
+
defaultEffort?: string;
|
|
22
|
+
};
|
|
23
|
+
}[];
|
|
24
|
+
}[];
|
|
25
|
+
}
|
|
26
|
+
/** Saved Lead route from a raw settings or profile document, or undefined when unconfigured or pointed at Fusion itself. */
|
|
27
|
+
export declare function savedLeadRoute(value: unknown): {
|
|
28
|
+
provider: string;
|
|
29
|
+
model: string;
|
|
30
|
+
} | undefined;
|
|
31
|
+
/** Configuration chooses registered physical models; it cannot create adapters. */
|
|
32
|
+
export declare function validatePairChoice(value: unknown, catalog: SettingsCatalog): PairChoice;
|
|
33
|
+
/** New sessions can opt into this Worker cap. Frozen sessions keep their saved profile. */
|
|
34
|
+
export declare const WORKER_IMPLEMENTATION_OUTPUT_TOKENS = 128000;
|
|
35
|
+
export declare function profileFromChoice(pair: PairChoice): Record<string, unknown>;
|
|
36
|
+
/** Product defaults; explicit legacy/benchmark profiles retain their old contract. */
|
|
37
|
+
export declare function modelProfileFromChoice(pair: PairChoice): Record<string, unknown>;
|
|
38
|
+
/** Keep existing default settings stable; expose explicit larger/smaller limits on reload. */
|
|
39
|
+
export declare function choiceFromProfile(profile: PairProfile): PairChoice;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The native shell tool the Host mounts on this platform. cordis.patch.yml
|
|
3
|
+
* disables tool-bash on win32 and mounts tool-pwsh instead; elsewhere the
|
|
4
|
+
* bash tool is the native shell. Safety gates must apply to whichever shell
|
|
5
|
+
* tool issued the call, so checks use {@link isShellTool}, while defaults
|
|
6
|
+
* and probes use {@link nativeShellTool} — the tool that actually exists.
|
|
7
|
+
*/
|
|
8
|
+
export declare const nativeShellTool: 'bash' | 'pwsh';
|
|
9
|
+
export declare const isShellTool: (name: string) => name is "bash" | "pwsh";
|
|
10
|
+
/** Command text the prompt layer names for the platform's native shell. */
|
|
11
|
+
export declare const nativeShellDescription: string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TaskState } from '../task/state.js';
|
|
2
|
+
import type { SqliteFusionStore } from '../task/sqlite-store.js';
|
|
3
|
+
import type { FusionStatus } from '../status.js';
|
|
4
|
+
export declare function taskStage(state: TaskState, checking: boolean, workerStepLimitReached?: boolean, workerQuotaExhausted?: boolean): Pick<NonNullable<FusionStatus['task']>, 'stage' | 'detail' | 'attention'>;
|
|
5
|
+
/** Reads existing durable facts only. Polling never constructs a runtime or calls a model. */
|
|
6
|
+
export declare function readFusionStatus(store: SqliteFusionStore, sessionId: string): FusionStatus;
|
|
7
|
+
export declare function readFusionStatusAsync(store: SqliteFusionStore, sessionId: string, signal?: AbortSignal): Promise<FusionStatus>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime detection for the DSH subagent seam.
|
|
3
|
+
* 0.2.1-rc.2 renamed continuable start/drain and removed `ctx.subagents.start`.
|
|
4
|
+
* 0.2.0-rc.2 still has the old names. Callers branch on the function that is
|
|
5
|
+
* actually present. They do not read a version string.
|
|
6
|
+
*/
|
|
7
|
+
export declare const supportedDshVersions = "0.2.0-rc.2 and 0.2.1-rc.2";
|
|
8
|
+
export declare function hasStartActivation(subagents: object): boolean;
|
|
9
|
+
/** Prefer `primary` (the 0.2.1 name) when both exist. */
|
|
10
|
+
export declare function requireSubagentMethod(subagents: object, primary: string, fallback: string): string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** A model-facing tool, identified by the name the request will advertise. */
|
|
2
|
+
export interface NamedTool {
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ProjectedTools<T extends NamedTool> {
|
|
6
|
+
tools: T[];
|
|
7
|
+
/** Fusion tools this role must see that neither the assembled table nor the registry still has. */
|
|
8
|
+
missing: string[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Rebuild one role's request tool table after another plugin replaces `assembled.tools`.
|
|
12
|
+
*
|
|
13
|
+
* The allowlist is a capability ceiling, not a list of mandatory registrations.
|
|
14
|
+
* It filters the assembled table, then permitted names are copied back from this
|
|
15
|
+
* agent's own registry: allowlisted tools (such as `job_output`) and Fusion's own
|
|
16
|
+
* `fusion_*` registrations. An undefined allowlist keeps the assembled table and only
|
|
17
|
+
* unions Fusion's registrations, so a writing role is not narrowed.
|
|
18
|
+
*
|
|
19
|
+
* A Fusion tool is required only when this agent actually registered it and the role
|
|
20
|
+
* may see it. `fusion_read_state` and `fusion_delegate_text` are registered only for
|
|
21
|
+
* model-like profiles; a legacy allowlist that merely names them is not incomplete.
|
|
22
|
+
* Restore copies every permitted registry tool before the gap is measured, so `missing`
|
|
23
|
+
* stays empty for every table this function itself builds. The field remains so a later
|
|
24
|
+
* change that stops restoring a registered tool fails closed instead of sending a
|
|
25
|
+
* silently smaller catalog.
|
|
26
|
+
*/
|
|
27
|
+
export declare function projectRoleTools<T extends NamedTool>(input: {
|
|
28
|
+
assembled: readonly T[];
|
|
29
|
+
allowlist: readonly string[] | undefined;
|
|
30
|
+
registry: readonly T[];
|
|
31
|
+
/** Names this role keeps even when the allowlist omits them. */
|
|
32
|
+
always?: readonly string[];
|
|
33
|
+
}): ProjectedTools<T>;
|
|
34
|
+
/** Shown when the role's Fusion tools cannot be restored. The request must not proceed as a normal completion. */
|
|
35
|
+
export declare function fusionToolDiagnostic(missing: readonly string[]): string;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** What fusion_wait should do once the resident Worker handle is already gone. */
|
|
2
|
+
export declare function absentWorkerOutcome(input: {
|
|
3
|
+
pendingEffects: number;
|
|
4
|
+
outcomeUnknown: boolean;
|
|
5
|
+
submitted: boolean;
|
|
6
|
+
}): {
|
|
7
|
+
kind: 'recovery';
|
|
8
|
+
reason: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'collect-report';
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'incomplete';
|
|
13
|
+
};
|
|
14
|
+
/** Settlement notice text. It must match whether a report was persisted, and must not send the Lead back to a disposed Worker. */
|
|
15
|
+
export declare function workerSettlementGuidance(submitted: boolean): string;
|
|
16
|
+
/**
|
|
17
|
+
* How to describe a Worker model-control wait to the Lead.
|
|
18
|
+
* WORKFLOW_INCOMPLETE and NO_PROGRESS are missing work, not an unavailable provider.
|
|
19
|
+
*/
|
|
20
|
+
export declare function workerStopExplanation(code: string): {
|
|
21
|
+
reasonCode: string;
|
|
22
|
+
next: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Why a quiescent Worker produced no report.
|
|
26
|
+
*
|
|
27
|
+
* A Worker that was offered a tool table but never dispatched one tool call of it
|
|
28
|
+
* did not "run out of steps" or lose work: its route could not call those tools at
|
|
29
|
+
* all. Adapters that drive their own execution loop (for example an external CLI
|
|
30
|
+
* agent) only surface tool calls when the request also carries their own transport
|
|
31
|
+
* tool, so `fusion_submit_result` stays unreachable even though this plugin did
|
|
32
|
+
* advertise it. That is a configuration mismatch the Lead must report accurately
|
|
33
|
+
* instead of retrying or blaming the model.
|
|
34
|
+
*
|
|
35
|
+
* Both counts are read from the Worker's own session log, so a text assignment —
|
|
36
|
+
* offered the Worker Fusion tools and nothing else — is judged the same way. An
|
|
37
|
+
* unreadable log yields no evidence and therefore keeps the generic verdict.
|
|
38
|
+
*/
|
|
39
|
+
export declare function workerNoReportCause(input: {
|
|
40
|
+
requestedTools: number;
|
|
41
|
+
dispatchedToolCalls: number;
|
|
42
|
+
}): 'unreachable-tools' | 'no-report';
|
|
43
|
+
/**
|
|
44
|
+
* Whether the recorded unreachable route still speaks for the current order.
|
|
45
|
+
*
|
|
46
|
+
* The verdict is per work order: a new order must be judged on its own dispatch,
|
|
47
|
+
* so a replacement route is never refused on a predecessor's evidence. The task
|
|
48
|
+
* is only wedged while the same order that failed still owns the handoff.
|
|
49
|
+
*/
|
|
50
|
+
export declare function workerUnreachableFor(order: {
|
|
51
|
+
id?: string;
|
|
52
|
+
} | undefined, record: {
|
|
53
|
+
workOrderId?: string;
|
|
54
|
+
} | undefined): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* The one wording for a route that cannot reach Host tools, shared by every entry
|
|
57
|
+
* point that can rediscover the verdict, so a later `fusion_wait` says the same
|
|
58
|
+
* thing as the delegation that first failed.
|
|
59
|
+
*/
|
|
60
|
+
export declare function workerUnreachableReply(childId: string | undefined, route: {
|
|
61
|
+
provider: string;
|
|
62
|
+
model: string;
|
|
63
|
+
}): string;
|
|
64
|
+
/** Continue/switch is refused before the route is written. Say so when a switch was requested. */
|
|
65
|
+
export declare function unsettledContinuationError(switching: boolean): {
|
|
66
|
+
zh: string;
|
|
67
|
+
en: string;
|
|
68
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace write mutual exclusion for agents Fusion owns.
|
|
3
|
+
* Ordinary sessions are not governed: a foreign lease does not make them read-only.
|
|
4
|
+
* `exempt` covers read tools, Fusion's own control tools, and `run_code`.
|
|
5
|
+
* The caller passes the lease for this call's cwd only, so another directory is isolated.
|
|
6
|
+
*/
|
|
7
|
+
export declare function workspaceWriterDenial(input: {
|
|
8
|
+
fusionOwned: boolean;
|
|
9
|
+
exempt: boolean;
|
|
10
|
+
cwd?: string;
|
|
11
|
+
leaseHolder?: string;
|
|
12
|
+
agentId: string;
|
|
13
|
+
}): string | undefined;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { SnapshotId } from '../contracts.js';
|
|
2
|
+
export declare const SNAPSHOT_EXCLUSIONS: readonly [".git", "node_modules", "__pycache__", ".pytest_cache", ".mypy_cache", ".ruff_cache"];
|
|
3
|
+
export declare const FALLBACK_EXCLUSIONS: readonly [".git", "node_modules", "__pycache__", ".pytest_cache", ".mypy_cache", ".ruff_cache", ".venv", "venv", ".tox", ".nox", ".eggs", ".gradle", ".next", ".turbo", ".cache"];
|
|
4
|
+
export interface WorkspaceEntry {
|
|
5
|
+
path: string;
|
|
6
|
+
kind: 'file' | 'symlink';
|
|
7
|
+
digest: string;
|
|
8
|
+
executable: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface WorkspaceSnapshot {
|
|
11
|
+
schemaVersion: 1;
|
|
12
|
+
root: string;
|
|
13
|
+
excludedDirectoryNames: readonly string[];
|
|
14
|
+
/** Present when the entry list came from git (tracked + untracked, minus the repository's ignore rules). */
|
|
15
|
+
ignoreRules?: 'git-exclude-standard';
|
|
16
|
+
entries: readonly WorkspaceEntry[];
|
|
17
|
+
id: SnapshotId;
|
|
18
|
+
}
|
|
19
|
+
export declare function workspacePath(root: string, path: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* The root-relative form of a model-supplied path ('' for the root itself), or undefined outside the workspace.
|
|
22
|
+
* `root` is the canonical (realpath) workspace, but models write the session's own spelling of it: macOS
|
|
23
|
+
* `/tmp/x` for `/private/tmp/x`, a symlinked checkout, another drive-letter case. So an absolute path is
|
|
24
|
+
* matched by the filesystem identity of its ancestors, not by string. The shortest ancestor that is the root
|
|
25
|
+
* wins, so a link below the root is never followed here; workspacePath still refuses one.
|
|
26
|
+
*/
|
|
27
|
+
export declare function workspaceRelative(root: string, path: string): string | undefined;
|
|
28
|
+
export declare function snapshotWorkspace(cwd: string): WorkspaceSnapshot;
|
|
29
|
+
export declare function changedPaths(before: WorkspaceSnapshot, after: WorkspaceSnapshot): string[];
|
|
30
|
+
/**
|
|
31
|
+
* Workspace-relative allowlist check. `/` always separates segments; `\` is a
|
|
32
|
+
* separator only on Windows — on POSIX it is a legal filename character, so
|
|
33
|
+
* `src\file.ts` must not match a `src` grant there. `.`/`..` segments then
|
|
34
|
+
* resolve lexically, so `src/../outside` (and its backslash form on Windows)
|
|
35
|
+
* never matches a `src` grant. workspacePath only bounds a path to the
|
|
36
|
+
* workspace root; membership in allowedPaths is decided here. Absolute paths
|
|
37
|
+
* (`/x`, `C:\x`, drive-relative `C:x`, UNC), empty paths and NUL are not
|
|
38
|
+
* workspace-relative and never normalize.
|
|
39
|
+
*/
|
|
40
|
+
export declare function normalizeRelativePath(path: string): string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* One `allowedPaths` entry → the prefix it grants. `dir/**` is the conventional spelling of
|
|
43
|
+
* "this directory and everything under it", so it grants exactly what `dir` grants.
|
|
44
|
+
*
|
|
45
|
+
* A grant that matches nothing is not a narrow scope, it is an unrecoverable deadlock: the
|
|
46
|
+
* Host freezes it, the Worker's writes then fail the freeze check forever, and widening the
|
|
47
|
+
* scope needs the delegation-time bytes those writes already replaced (session-daa71a4a: a
|
|
48
|
+
* `lib/types/**` grant authorized nothing while the task's own build rewrote exactly those
|
|
49
|
+
* declarations). So a wildcard the Host cannot honour is refused when the Lead grants it.
|
|
50
|
+
*/
|
|
51
|
+
export declare function grantOf(raw: string): string;
|
|
52
|
+
export declare function pathAllowed(path: string, allowed: readonly string[]): boolean;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The identity this plugin registers under.
|
|
3
|
+
*
|
|
4
|
+
* Both halves import this module, so the provider route, the model entry and
|
|
5
|
+
* the durable producers keep one spelling. It deliberately has no imports: the
|
|
6
|
+
* browser bundle inlines it and must not pull a Host module in.
|
|
7
|
+
*/
|
|
8
|
+
/** The HTTP path the panel's own views and actions are served from. */
|
|
9
|
+
export declare const FUSION_API_PATH = "/api/fusion";
|
|
10
|
+
/**
|
|
11
|
+
* The path this plugin served before the rename. The host keeps answering it
|
|
12
|
+
* so a browser tab holding the previous client bundle keeps working until its
|
|
13
|
+
* next reload; nothing in the current bundle requests it.
|
|
14
|
+
*/
|
|
15
|
+
export declare const LEGACY_FUSION_API_PATH = "/api/model-fusion";
|
|
16
|
+
/**
|
|
17
|
+
* The npm package this project publishes under.
|
|
18
|
+
*
|
|
19
|
+
* Distinct from {@link PLUGIN_NAME}: the package name is the registry identity
|
|
20
|
+
* and the module specifier a profile's patch resolves, while the plugin id is
|
|
21
|
+
* the runtime identity that names the state directory, the bundle patch row and
|
|
22
|
+
* the log marker. Keeping them apart is what lets the package move into a scope
|
|
23
|
+
* without moving anyone's data.
|
|
24
|
+
*/
|
|
25
|
+
export declare const PACKAGE_NAME = "@sqdr2/dsh-fusion";
|
|
26
|
+
/** The plugin id this project registers under, and the name of its state directory. */
|
|
27
|
+
export declare const PLUGIN_NAME = "dsh-fusion";
|
|
28
|
+
/** The plugin id and package name this project used before the rename. */
|
|
29
|
+
export declare const LEGACY_PLUGIN_NAME = "dsh-model-fusion";
|
|
30
|
+
/** Registered provider route for the Fusion model entry. */
|
|
31
|
+
export declare const FUSION_PROVIDER = "dsh-fusion";
|
|
32
|
+
/** The single model id the Fusion entry advertises. */
|
|
33
|
+
export declare const FUSION_MODEL = "auto";
|
|
34
|
+
/**
|
|
35
|
+
* The provider route this plugin registered before it was renamed from
|
|
36
|
+
* `dsh-model-fusion`. Sessions created then still name it in their durable
|
|
37
|
+
* `model/selection` event, so reading it as Fusion is what keeps those
|
|
38
|
+
* sessions working; writing it is never correct.
|
|
39
|
+
*/
|
|
40
|
+
export declare const LEGACY_FUSION_PROVIDER = "dsh-model-fusion";
|
|
41
|
+
/** Whether a provider route belongs to this plugin, under either name. */
|
|
42
|
+
export declare const isFusionProvider: (provider: string | undefined) => boolean;
|
|
43
|
+
/** Whether a route names the Fusion entry, under either name. */
|
|
44
|
+
export declare const isFusionSelection: (route: {
|
|
45
|
+
provider?: string;
|
|
46
|
+
model?: string;
|
|
47
|
+
} | undefined) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* How a native model-switch notice names this entry (`provider/model`).
|
|
50
|
+
*
|
|
51
|
+
* Both spellings are listed: a session that switched to Fusion before the
|
|
52
|
+
* rename carries the old one in its durable log, and the notice is the same
|
|
53
|
+
* non-change on every Fusion step either way.
|
|
54
|
+
*/
|
|
55
|
+
export declare const FUSION_SELECTION_LABELS: readonly ["dsh-fusion/auto", "dsh-model-fusion/auto"];
|
|
56
|
+
/**
|
|
57
|
+
* Whether a route already names the entry under its current name. A durable
|
|
58
|
+
* intent that fails this is rewritten before the next request is assembled;
|
|
59
|
+
* the legacy spelling is a read-side alias, not a route that still dispatches.
|
|
60
|
+
*/
|
|
61
|
+
export declare const isCurrentFusionSelection: (route: {
|
|
62
|
+
provider?: string;
|
|
63
|
+
model?: string;
|
|
64
|
+
} | undefined) => boolean;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { FusionError, FUSION_CONTEXT_BUDGET, NEEDS_REPAIR, OUTCOME_UNKNOWN, SPEND_UNAUTHORIZED, STORE_MIGRATION_REQUIRED, USAGE_LEDGER_REQUIRED, WORK_ORDER_CONFLICT } from './errors.js';
|
|
2
|
+
export * from './contracts.js';
|
|
3
|
+
export { digestOf, sha256Hex } from './digest.js';
|
|
4
|
+
export { reduce, reduceAll } from './task/reducer.js';
|
|
5
|
+
export { FileFusionStore, failingRenameIo, requireStorageProjectionVersion, STORE_PROJECTION_VERSION } from './task/store.js';
|
|
6
|
+
export type { FusionStore } from './task/store.js';
|
|
7
|
+
export { SqliteFusionStore } from './task/sqlite-store.js';
|
|
8
|
+
export type { TaskState } from './task/state.js';
|
|
9
|
+
export { normalizeUsage, observationFromNormalized, apiEquivalentUsd, priceUsage } from './usage/normalize.js';
|
|
10
|
+
export type { UsageObservationMeta, UsagePrice, UsagePriceStatus } from './usage/normalize.js';
|
|
11
|
+
export { ingestDurable, ingestObservation, newLedger, projectLedger, restoreLedger, splitInput, } from './usage/ledger.js';
|
|
12
|
+
export type { CanonicalBill, UsageLedgerV2, UsageObservation, UsageProjection, UsageRequestKey } from './usage/ledger.js';
|
|
13
|
+
export { quoteLedger } from './usage/pricing.js';
|
|
14
|
+
export type { PriceRates, RequestQuote } from './usage/pricing.js';
|
|
15
|
+
export { BudgetLedger, loadSpendingAuthorization } from './usage/budget.js';
|
|
16
|
+
export { WorkspaceWriteLease, classifyEffect } from './execution/write-lease.js';
|
|
17
|
+
export { resolveProfile, completeProfile, loadJsonObject, promptDigests } from './profile/resolve.js';
|
|
18
|
+
export { assertFinalBudget, measureRequest, inputBudget, boundedOverflowRecovery } from './context/guard.js';
|
|
19
|
+
export { consumeApproval, answerApproval, neverMeansDeny, pendingDoesNotExpire } from './approval/logical.js';
|
|
20
|
+
export { evaluateReport, DEFAULT_TEST_VERIFIERS } from './evidence/gate.js';
|
|
21
|
+
export type { TrustedEvidenceRegistry, RegisteredVerifier, EvaluateReportOptions } from './evidence/gate.js';
|
|
22
|
+
export { assertPlannedCheck, invocationHeader, memoryVerificationRegistry, resolveInvocation, checkPlanDigest } from './evidence/receipts.js';
|
|
23
|
+
export type { CheckPlan, InvocationHeader, PlannedReceipt, VerificationRegistry } from './evidence/receipts.js';
|
|
24
|
+
export { assertCurrentSubject, captureTicket, createReviewTicket, resultFromCapturedTicket, reviewOutboxRow, reportSubject, reviewReadinessReceipt, reviewRequestedEvent, } from './review/ticket.js';
|
|
25
|
+
export { appendCapturedReviewResult, loadReviewOutboxByRequestId, persistReviewRequest } from './review/dispatch.js';
|
|
26
|
+
export { classifyReview, reviewAttemptFields, normalizeTermination, toReducerReviewDecision } from './review/protocol.js';
|
|
27
|
+
export type { ReviewClassification, ReviewDecision, ReviewStatus, ReviewTermination } from './review/protocol.js';
|
|
28
|
+
export { reconcile } from './recovery/reconcile.js';
|
|
29
|
+
export { loadPromptBundle, promptManifest } from './prompts.js';
|
|
30
|
+
export { runNativeBenchmark, NativeRequestBudget } from './benchmark/native-run.js';
|
|
31
|
+
export type { NativeBenchmarkOptions } from './benchmark/native-run.js';
|
|
32
|
+
export { resolveBenchmarkOutputLimits } from './benchmark/output-limits.js';
|
|
33
|
+
export type { BenchmarkOutputLimits } from './benchmark/output-limits.js';
|
|
34
|
+
export { snapshotWorkspace } from './host/workspace.js';
|