@sqdr2/dsh-fusion 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALL.md +89 -0
- package/INSTALL.zh.md +86 -0
- package/LICENSE +201 -0
- package/README.en.md +191 -0
- package/README.md +180 -2
- 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 +12661 -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 +176 -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,20 @@
|
|
|
1
|
+
import type { SessionEvent } from '@deepseek-ai/dsh-session/types';
|
|
2
|
+
/** Plugin-owned presentation record; never appended to a native Session. */
|
|
3
|
+
export interface FusionActivity {
|
|
4
|
+
schemaVersion: 1;
|
|
5
|
+
taskId: string;
|
|
6
|
+
childSessionId: string;
|
|
7
|
+
parentCallId: string;
|
|
8
|
+
turn: number;
|
|
9
|
+
step: number;
|
|
10
|
+
anchorSeq: number;
|
|
11
|
+
source: SessionEvent<'tool/call'> | SessionEvent<'tool/result'>;
|
|
12
|
+
}
|
|
13
|
+
/** Namespaced display identity; the unchanged native identity remains in source. */
|
|
14
|
+
export declare function activityCallId(activity: FusionActivity): string;
|
|
15
|
+
export interface FusionActivityPage {
|
|
16
|
+
events: FusionActivity[];
|
|
17
|
+
cursor: number;
|
|
18
|
+
more: boolean;
|
|
19
|
+
done: boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Digest, LogicalApproval, SnapshotId } from '../contracts.js';
|
|
2
|
+
export interface ApprovalScope {
|
|
3
|
+
argsDigest: Digest;
|
|
4
|
+
snapshot: SnapshotId;
|
|
5
|
+
permissionPolicyDigest: Digest;
|
|
6
|
+
}
|
|
7
|
+
export declare function answerApproval(approval: LogicalApproval, state: 'approved' | 'rejected' | 'withdrawn', decisionBy?: 'human' | 'preauthorized-policy'): LogicalApproval;
|
|
8
|
+
export declare function consumeApproval(approval: LogicalApproval, scope: ApprovalScope): LogicalApproval;
|
|
9
|
+
export declare function neverMeansDeny(policy: string): boolean;
|
|
10
|
+
export declare function pendingDoesNotExpire(_approval: LogicalApproval, _nowMs: number): true;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
3
|
+
import type { PairProfile } from '../contracts.js';
|
|
4
|
+
import type { SqliteFusionStore } from '../task/sqlite-store.js';
|
|
5
|
+
/** A declared benchmark treatment, never installed in product sessions. */
|
|
6
|
+
export declare const naivePrompts: {
|
|
7
|
+
lead: string;
|
|
8
|
+
worker: string;
|
|
9
|
+
};
|
|
10
|
+
export interface NaiveDelegation {
|
|
11
|
+
ordinal: number;
|
|
12
|
+
callId: string;
|
|
13
|
+
briefDigest: string;
|
|
14
|
+
startedAt: string;
|
|
15
|
+
endedAt: string | null;
|
|
16
|
+
childSessionId: string | null;
|
|
17
|
+
parentSessionId: string;
|
|
18
|
+
state: 'starting' | 'running' | 'settled' | 'failed';
|
|
19
|
+
stopReason: string | null;
|
|
20
|
+
disposed: boolean;
|
|
21
|
+
failure: string | null;
|
|
22
|
+
}
|
|
23
|
+
/** Simple sequential coordinator using the native single-activation child lifecycle. */
|
|
24
|
+
export declare class NaiveCoordinator {
|
|
25
|
+
#private;
|
|
26
|
+
readonly ctx: Context;
|
|
27
|
+
readonly parent: Agent;
|
|
28
|
+
readonly store: SqliteFusionStore;
|
|
29
|
+
readonly profile: PairProfile;
|
|
30
|
+
readonly workerMaxTokens: number;
|
|
31
|
+
readonly tools: readonly string[];
|
|
32
|
+
readonly delegations: NaiveDelegation[];
|
|
33
|
+
constructor(ctx: Context, parent: Agent, store: SqliteFusionStore, profile: PairProfile, workerMaxTokens: number, tools?: readonly string[]);
|
|
34
|
+
owns(agent: Agent): boolean;
|
|
35
|
+
assertReady(): void;
|
|
36
|
+
close(): Promise<void>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { SessionId } from '@deepseek-ai/dsh-session';
|
|
3
|
+
import { TaskId } from '../contracts.js';
|
|
4
|
+
import { NativeRequestBudget } from '../host/native-budget.js';
|
|
5
|
+
import type { NativeUsageRecord } from '../host/native-usage.js';
|
|
6
|
+
import type { ResolvedProfile } from '../profile/resolve.js';
|
|
7
|
+
import { type BenchmarkOutputLimits } from './output-limits.js';
|
|
8
|
+
export interface NativeBenchmarkOptions {
|
|
9
|
+
runId: string;
|
|
10
|
+
variant: 'lead_only' | 'worker_only' | 'worker_selfreview' | 'naive' | 'fusion';
|
|
11
|
+
dataKind: 'real' | 'synthetic';
|
|
12
|
+
/** Version read by the trusted launcher from the loaded artifact's metadata. */
|
|
13
|
+
engineVersion?: string;
|
|
14
|
+
workspace: string;
|
|
15
|
+
/** Fresh directory, outside the candidate's filesystem. Never reused. */
|
|
16
|
+
output: string;
|
|
17
|
+
prompt: string;
|
|
18
|
+
profile: ResolvedProfile;
|
|
19
|
+
/** Required for real runs: exact public model limits frozen before the attempt. */
|
|
20
|
+
outputLimits?: BenchmarkOutputLimits;
|
|
21
|
+
/** One campaign-wide ledger, so attempts cannot reset the approved limit. */
|
|
22
|
+
budget: NativeRequestBudget;
|
|
23
|
+
maxRequests: number;
|
|
24
|
+
timeoutMs: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Run one fresh attempt through the same native AgentLoop and FusionCoordinator
|
|
28
|
+
* as the product. The caller composes public Host services and a sandboxed shell;
|
|
29
|
+
* this function does not implement another LLM/tool loop or grade candidate code.
|
|
30
|
+
*/
|
|
31
|
+
export declare function runNativeBenchmark(ctx: Context, options: NativeBenchmarkOptions): Promise<{
|
|
32
|
+
status: string;
|
|
33
|
+
failure: string | null;
|
|
34
|
+
endReason: import("@deepseek-ai/dsh-session").TurnEndReason | null;
|
|
35
|
+
phases: {
|
|
36
|
+
stage: "implementation" | "self_review";
|
|
37
|
+
completed: boolean;
|
|
38
|
+
nativeRequests: number;
|
|
39
|
+
endReason: unknown;
|
|
40
|
+
}[];
|
|
41
|
+
deliveredSnapshot: import("../host/workspace.js").WorkspaceSnapshot;
|
|
42
|
+
fusionState: import("../index.js").TaskState | null;
|
|
43
|
+
usage: NativeUsageRecord[];
|
|
44
|
+
actualBilledUsd: null;
|
|
45
|
+
apiEquivalentUsd: null;
|
|
46
|
+
upstreamHttpCalls: null;
|
|
47
|
+
naiveDelegations?: import("./naive.js").NaiveDelegation[] | undefined;
|
|
48
|
+
schemaVersion: number;
|
|
49
|
+
runId: string;
|
|
50
|
+
variant: "lead_only" | "worker_only" | "worker_selfreview" | "naive" | "fusion";
|
|
51
|
+
dataKind: "real" | "synthetic";
|
|
52
|
+
startedAt: string;
|
|
53
|
+
endedAt: string;
|
|
54
|
+
wallSeconds: number;
|
|
55
|
+
parentSessionId: SessionId;
|
|
56
|
+
workerSessionId: string | null;
|
|
57
|
+
taskId: TaskId;
|
|
58
|
+
nativeRequests: number;
|
|
59
|
+
protocolComplete: boolean;
|
|
60
|
+
artifactPass: null;
|
|
61
|
+
workerParentSessionId: SessionId | null;
|
|
62
|
+
workerSessions: {
|
|
63
|
+
sessionId: SessionId;
|
|
64
|
+
parentSessionId: SessionId | undefined;
|
|
65
|
+
eventsFile: string;
|
|
66
|
+
}[];
|
|
67
|
+
}>;
|
|
68
|
+
export { NativeRequestBudget };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { PairProfile, Role } from '../contracts.js';
|
|
3
|
+
export interface BenchmarkOutputLimits {
|
|
4
|
+
policy: 'role-route-auto-v1';
|
|
5
|
+
roles: Record<Role, {
|
|
6
|
+
provider: string;
|
|
7
|
+
model: string;
|
|
8
|
+
contextWindow: number;
|
|
9
|
+
adapterDefault: number | null;
|
|
10
|
+
testedCap: number | null;
|
|
11
|
+
fallback: number;
|
|
12
|
+
maxTokens: number;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
/** Run before preregistration, then compare the exact snapshot before spending.
|
|
16
|
+
* Every treatment uses the same role's automatic product allowance; the profile
|
|
17
|
+
* reservation is a fallback, not a universal per-request cap.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveBenchmarkOutputLimits(ctx: Context, profile: PairProfile): Promise<BenchmarkOutputLimits>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ActivityRow } from './activity-model.js';
|
|
2
|
+
export declare function ActivityCard({ row, done, cwd, openFile }: {
|
|
3
|
+
row: ActivityRow;
|
|
4
|
+
done: boolean;
|
|
5
|
+
cwd?: string;
|
|
6
|
+
openFile(path: string): void;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
export declare const activityStyles = "\n.fusion-activity-row{font-size:13px;line-height:1.5;margin:4px 0;min-width:0;color:var(--dsw-alias-label-secondary)}\n.fusion-activity-toggle{display:flex;align-items:center;gap:8px;width:100%;padding:6px 0;background:none;border:0;color:inherit;text-align:left;cursor:pointer;font:inherit}\n.fusion-activity-toggle:focus-visible,.fusion-activity-file:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}\n.fusion-activity-summary{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-primary)}\n.fusion-activity-toggle small{white-space:nowrap}.fusion-activity-toggle small[data-failed=true]{color:var(--dsw-alias-state-error-primary)}\n.fusion-activity-body{padding:4px 0 10px;overflow:hidden}.fusion-activity-body pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:360px;overflow:auto;font-size:12px}\n.fusion-activity-file{font:inherit;border:0;background:none;color:var(--dsw-alias-brand-primary);padding:0 0 6px;cursor:pointer}\n";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ModelDirectoryState } from '@deepseek-ai/dsh-client-ui-model-selection/client';
|
|
2
|
+
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
|
|
3
|
+
export interface FusionHintProps {
|
|
4
|
+
sessionId: string;
|
|
5
|
+
directory: ObservableSnapshot<ModelDirectoryState>;
|
|
6
|
+
load(): void;
|
|
7
|
+
}
|
|
8
|
+
/** Additive composer hint. The original selector and its selection state stay native. */
|
|
9
|
+
export declare function FusionHint({ sessionId, directory, load }: FusionHintProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HistoryTotals } from '../host/history.js';
|
|
2
|
+
import { type Lang } from './i18n.js';
|
|
3
|
+
export declare function formatCompact(tokens: number): string;
|
|
4
|
+
export declare function outputTokens(lang: Lang, usage: HistoryTotals, calls: number): string;
|
|
5
|
+
export declare function FusionHistory(): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface FusionPanelIconProps {
|
|
3
|
+
/** Square size in pixels requested by the host sidebar (defaults to 16). */
|
|
4
|
+
size?: number;
|
|
5
|
+
/** Whether the panel is currently active/selected in the main column. */
|
|
6
|
+
active?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Compact, accessible icon for the Fusion sidebar entry.
|
|
11
|
+
* Renders a dual-node convergence (Lead + Sidekick models fusing into one) SVG glyph.
|
|
12
|
+
*/
|
|
13
|
+
export declare function FusionPanelIcon({ size, active, className }: FusionPanelIconProps): ReactNode;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PhysicalRoute } from '../contracts.js';
|
|
2
|
+
import type { SettingsCatalog } from '../host/settings.js';
|
|
3
|
+
export declare function ModelChoice({ role, route, catalog, onChange }: {
|
|
4
|
+
role: 'Lead' | 'Sidekick' | 'compactor';
|
|
5
|
+
route?: PhysicalRoute;
|
|
6
|
+
catalog: SettingsCatalog;
|
|
7
|
+
onChange(route: PhysicalRoute | undefined): void;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
export declare function FusionSettings(): import("react").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ToolCallViewProps } from '@deepseek-ai/dsh-client-ui-tool/client';
|
|
2
|
+
export declare const fusionControlTools: readonly ["fusion_read_state", "fusion_delegate_text", "fusion_explore", "fusion_delegate", "fusion_rework", "fusion_wait", "fusion_review_result", "fusion_submit_result", "fusion_takeover", "fusion_finish_direct", "fusion_read_evidence"];
|
|
3
|
+
/** Keep internal coordination out of the normal conversation. Errors remain visible. */
|
|
4
|
+
export declare function FusionTool({ block, sessionId, callId, toolName, cwd, openFile }: ToolCallViewProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DiffHunk } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
2
|
+
import type { FusionActivity } from '../activity.js';
|
|
3
|
+
export interface ActivityRow {
|
|
4
|
+
id: string;
|
|
5
|
+
call: Extract<FusionActivity['source'], {
|
|
6
|
+
type: 'tool/call';
|
|
7
|
+
}>;
|
|
8
|
+
result?: Extract<FusionActivity['source'], {
|
|
9
|
+
type: 'tool/result';
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export declare function activityRows(events: readonly FusionActivity[]): ActivityRow[];
|
|
13
|
+
/** Only actual result-time metadata is labelled an applied diff. */
|
|
14
|
+
export declare function activityDiffs(row: ActivityRow): DiffHunk[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** The DSH client locale service (`ctx.locale`), used by structure only. */
|
|
2
|
+
interface LocaleSource {
|
|
3
|
+
getSnapshot(): {
|
|
4
|
+
active: string;
|
|
5
|
+
};
|
|
6
|
+
subscribe(listener: () => void): () => void;
|
|
7
|
+
}
|
|
8
|
+
/** Called from the client entry when DSH's locale service is available; follows the user's language setting. */
|
|
9
|
+
export declare function bindLocale(next: LocaleSource): () => void;
|
|
10
|
+
export type Lang = 'zh' | 'en';
|
|
11
|
+
/** The UI language: Chinese for any zh locale, English otherwise (DSH's own fallback). */
|
|
12
|
+
export declare function useLang(): Lang;
|
|
13
|
+
/** Pick the text for the active language. */
|
|
14
|
+
export declare const tr: (lang: Lang, zh: string, en: string) => string;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
3
|
+
interface SlotMap {
|
|
4
|
+
'main': {
|
|
5
|
+
kind: 'keyed';
|
|
6
|
+
scope: 'root';
|
|
7
|
+
};
|
|
8
|
+
'sidebar.panellist': {
|
|
9
|
+
kind: 'list';
|
|
10
|
+
scope: 'root';
|
|
11
|
+
owner: {
|
|
12
|
+
size: number;
|
|
13
|
+
active: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export declare const name = "dsh-fusion/client";
|
|
19
|
+
export declare const inject: string[];
|
|
20
|
+
export declare const FUSION_PANEL_ID = "fusion";
|
|
21
|
+
export { FusionPanelIcon } from './FusionPanelIcon.js';
|
|
22
|
+
export declare function apply(ctx: Context): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FusionStatus } from '../status.js';
|
|
2
|
+
interface Snapshot {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
status?: FusionStatus;
|
|
5
|
+
failed: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** One in-flight read per mounted session; collapsed hints still discover new attention states. */
|
|
8
|
+
export declare function useFusionStatus(sessionId: string, expandedTask: string | undefined, attentionOnly?: boolean): Snapshot | undefined;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RoleContextPolicy, TokenMeasurement } from '../contracts.js';
|
|
2
|
+
export interface RequestParts {
|
|
3
|
+
systemTokens: number;
|
|
4
|
+
messageTokens: number;
|
|
5
|
+
toolSchemaTokens: number;
|
|
6
|
+
cacheReadTokens: number;
|
|
7
|
+
reservedOutputTokens: number;
|
|
8
|
+
contextWindow: number;
|
|
9
|
+
quality: TokenMeasurement['quality'];
|
|
10
|
+
}
|
|
11
|
+
export declare function safetyTokens(contextWindow: number, policy: RoleContextPolicy, quality: TokenMeasurement['quality']): number;
|
|
12
|
+
/** Output reservation that fits the disclosed window. Leaves half the usable window for input. */
|
|
13
|
+
export declare function fittedOutputReservation(contextWindow: number): number;
|
|
14
|
+
export declare function requestOutputReservation(contextWindow: number, requested?: number, adapterDefault?: number, testedCap?: number, fallback?: number): number;
|
|
15
|
+
export declare function inputBudget(policy: RoleContextPolicy, contextWindow: number, maxOutput: number, quality?: TokenMeasurement['quality']): number;
|
|
16
|
+
export declare function measureRequest(parts: RequestParts, policy: RoleContextPolicy): TokenMeasurement;
|
|
17
|
+
export declare function assertFinalBudget(measurement: TokenMeasurement, policy: RoleContextPolicy): void;
|
|
18
|
+
export interface RecoveryAttempt {
|
|
19
|
+
readonly projectionTokens: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function boundedOverflowRecovery(attempts: readonly RecoveryAttempt[]): 'continue' | 'needs-decision';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upper bound on recent conversation text carried into a Sidekick brief after compaction: about 10k tokens,
|
|
3
|
+
* enough for the latest exchanges while leaving most of the Sidekick's context for the task itself.
|
|
4
|
+
*/
|
|
5
|
+
export declare const HANDOFF_CONTENT_BYTES = 40000;
|
|
6
|
+
/** Content bytes only: envelopes and independently retained task facts are extra. */
|
|
7
|
+
export declare function recentHandoffSuffix<T extends {
|
|
8
|
+
readonly content: string;
|
|
9
|
+
}>(records: readonly T[]): {
|
|
10
|
+
policy: "recent-whole-records-utf8-v1";
|
|
11
|
+
contentByteBudget: number;
|
|
12
|
+
totalRecords: number;
|
|
13
|
+
omittedRecords: number;
|
|
14
|
+
totalContentBytes: number;
|
|
15
|
+
retainedContentBytes: number;
|
|
16
|
+
records: T[];
|
|
17
|
+
};
|