@dsmm/dsmm 0.3.2 → 0.3.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/README.md +2 -2
- package/cordis.patch.yml +0 -9
- package/docs/agent-presets.md +5 -5
- package/docs/compatibility.md +2 -6
- package/docs/migration-from-ocmm.md +1 -1
- package/docs/roadmap.md +5 -12
- package/docs/settings-status.md +1 -1
- package/lib/client/ChildrenPanel.d.ts +1 -4
- package/lib/client/ChildrenPanel.js +3 -3
- package/lib/client/DeploymentPage.d.ts +1 -3
- package/lib/client/DeploymentPage.js +2 -2
- package/lib/client/PermissionsPanel.d.ts +1 -3
- package/lib/client/PermissionsPanel.js +2 -3
- package/lib/client/children-locales.d.ts +4 -4
- package/lib/client/controller.js +4 -1
- package/lib/client/deployment-locales.js +0 -1
- package/lib/client/deployment-modules.js +1 -1
- package/lib/client/index.js +2 -7
- package/lib/client/locales.js +131 -119
- package/lib/client/permission-locales.d.ts +0 -26
- package/lib/client/permission-locales.js +0 -20
- package/lib/client.js +1837 -3634
- package/lib/index.d.ts +0 -2
- package/lib/index.js +9 -22
- package/lib/native-admission.d.ts +0 -3
- package/lib/native-admission.js +12 -45
- package/lib/permission-fs-search.js +1 -2
- package/lib/permission-fs.js +1 -2
- package/lib/permission-web.js +1 -2
- package/lib/preset-materializer.js +3 -3
- package/lib/preset-registry.d.ts +20 -2
- package/lib/preset-registry.js +46 -17
- package/lib/profile-diagnostics.js +1 -1
- package/lib/profile-remote.js +1 -3
- package/lib/role-policy.js +2 -2
- package/lib/role-subagents.js +2 -1
- package/lib/roles.d.ts +2 -0
- package/lib/roles.js +2 -0
- package/lib/settings.d.ts +1 -3
- package/lib/settings.js +4 -9
- package/package.json +1 -5
- package/lib/client/ChildPermissions.d.ts +0 -43
- package/lib/client/ChildPermissions.js +0 -100
- package/lib/client/HistoryContinuation.d.ts +0 -7
- package/lib/client/HistoryContinuation.js +0 -22
- package/lib/client/PermissionPanelEntry.d.ts +0 -8
- package/lib/client/PermissionPanelEntry.js +0 -11
- package/lib/client/TemporaryPermissions.d.ts +0 -21
- package/lib/client/TemporaryPermissions.js +0 -94
- package/lib/client/history-controller.d.ts +0 -29
- package/lib/client/history-controller.js +0 -111
- package/lib/client/history-entry.d.ts +0 -11
- package/lib/client/history-entry.js +0 -106
- package/lib/client/history-locales.d.ts +0 -95
- package/lib/client/history-locales.js +0 -41
- package/lib/client/temporary-permission-client.d.ts +0 -20
- package/lib/client/temporary-permission-client.js +0 -52
- package/lib/client/temporary-permission-entry.d.ts +0 -6
- package/lib/client/temporary-permission-entry.js +0 -56
- package/lib/history-candidates.d.ts +0 -30
- package/lib/history-candidates.js +0 -176
- package/lib/history-codec.d.ts +0 -11
- package/lib/history-codec.js +0 -102
- package/lib/history-contract.d.ts +0 -44
- package/lib/history-contract.js +0 -2
- package/lib/history-controller.d.ts +0 -42
- package/lib/history-controller.js +0 -329
- package/lib/history-policy.d.ts +0 -4
- package/lib/history-policy.js +0 -8
- package/lib/history-remote.d.ts +0 -28
- package/lib/history-remote.js +0 -17
- package/lib/history-rpc.d.ts +0 -24
- package/lib/history-rpc.js +0 -136
- package/lib/history-support.d.ts +0 -15
- package/lib/history-support.js +0 -21
- package/lib/history-types.d.ts +0 -67
- package/lib/history-types.js +0 -2
- package/lib/permission-child-control.d.ts +0 -36
- package/lib/permission-child-control.js +0 -164
- package/lib/permission-exec-argv.d.ts +0 -32
- package/lib/permission-exec-argv.js +0 -171
- package/lib/permission-temporary-files.d.ts +0 -19
- package/lib/permission-temporary-files.js +0 -248
- package/lib/permission-temporary-grants.d.ts +0 -106
- package/lib/permission-temporary-grants.js +0 -198
- package/lib/permission-temporary-install.d.ts +0 -25
- package/lib/permission-temporary-install.js +0 -86
- package/lib/permission-temporary-remote.d.ts +0 -19
- package/lib/permission-temporary-remote.js +0 -75
- package/lib/permission-temporary-rpc.d.ts +0 -37
- package/lib/permission-temporary-rpc.js +0 -154
- package/lib/permission-temporary-types.d.ts +0 -47
- package/lib/permission-temporary-types.js +0 -2
- package/lib/permission-temporary-web.d.ts +0 -11
- package/lib/permission-temporary-web.js +0 -154
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-gateway@0.2.1-rc.2.patch +0 -13291
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-remotes@0.2.1-rc.2.patch +0 -9133
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-client-ui-approval@0.2.1-rc.2.patch +0 -156
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-subagent@0.2.1-rc.2.patch +0 -3546
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-user-approval@0.2.1-rc.2.patch +0 -431
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-web@0.2.1-rc.2.patch +0 -119
- package/patches/dsh-approval-settlement/README.md +0 -41
- package/patches/dsh-approval-settlement/metadata.json +0 -10
- package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-loop@0.2.1-rc.2.patch +0 -383
- package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-preset-registry@0.2.1-rc.2.patch +0 -55
- package/patches/dsh-session-activation/@deepseek-ai__dsh-api-session-controller@0.2.1-rc.2.patch +0 -16673
- package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-subagent@0.2.1-rc.2.patch +0 -29
- package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-workspace@0.2.1-rc.2.patch +0 -196
- package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence-jsonl@0.2.1-rc.2.patch +0 -35
- package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence@0.2.1-rc.2.patch +0 -40
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
export declare const historyLocales: {
|
|
2
|
-
en: {
|
|
3
|
-
title: string;
|
|
4
|
-
preset: string;
|
|
5
|
-
profile: string;
|
|
6
|
-
baseline: string;
|
|
7
|
-
choose: string;
|
|
8
|
-
preview: string;
|
|
9
|
-
confirm: string;
|
|
10
|
-
refresh: string;
|
|
11
|
-
loading: string;
|
|
12
|
-
preparing: string;
|
|
13
|
-
confirming: string;
|
|
14
|
-
active: string;
|
|
15
|
-
browsing: string;
|
|
16
|
-
unknown: string;
|
|
17
|
-
pending: string;
|
|
18
|
-
pendingWarning: string;
|
|
19
|
-
consent: string;
|
|
20
|
-
migration: string;
|
|
21
|
-
effects: string;
|
|
22
|
-
model: string;
|
|
23
|
-
roles: string;
|
|
24
|
-
permissions: string;
|
|
25
|
-
differences: string;
|
|
26
|
-
project: string;
|
|
27
|
-
noPending: string;
|
|
28
|
-
nextTurn: string;
|
|
29
|
-
nextStep: string;
|
|
30
|
-
candidate: string;
|
|
31
|
-
disconnected: string;
|
|
32
|
-
reasons: {
|
|
33
|
-
validation: string;
|
|
34
|
-
"not-owned": string;
|
|
35
|
-
"not-found": string;
|
|
36
|
-
"unsupported-host": string;
|
|
37
|
-
"unsupported-backend": string;
|
|
38
|
-
unavailable: string;
|
|
39
|
-
busy: string;
|
|
40
|
-
stale: string;
|
|
41
|
-
cancelled: string;
|
|
42
|
-
"authorization-required": string;
|
|
43
|
-
"child-owner-required": string;
|
|
44
|
-
"format-unavailable": string;
|
|
45
|
-
"initialization-failed": string;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
zh: {
|
|
49
|
-
title: string;
|
|
50
|
-
preset: string;
|
|
51
|
-
profile: string;
|
|
52
|
-
baseline: string;
|
|
53
|
-
choose: string;
|
|
54
|
-
preview: string;
|
|
55
|
-
confirm: string;
|
|
56
|
-
refresh: string;
|
|
57
|
-
loading: string;
|
|
58
|
-
preparing: string;
|
|
59
|
-
confirming: string;
|
|
60
|
-
active: string;
|
|
61
|
-
browsing: string;
|
|
62
|
-
unknown: string;
|
|
63
|
-
pending: string;
|
|
64
|
-
pendingWarning: string;
|
|
65
|
-
consent: string;
|
|
66
|
-
migration: string;
|
|
67
|
-
effects: string;
|
|
68
|
-
model: string;
|
|
69
|
-
roles: string;
|
|
70
|
-
permissions: string;
|
|
71
|
-
differences: string;
|
|
72
|
-
project: string;
|
|
73
|
-
noPending: string;
|
|
74
|
-
nextTurn: string;
|
|
75
|
-
nextStep: string;
|
|
76
|
-
candidate: string;
|
|
77
|
-
disconnected: string;
|
|
78
|
-
reasons: {
|
|
79
|
-
validation: string;
|
|
80
|
-
"not-owned": string;
|
|
81
|
-
"not-found": string;
|
|
82
|
-
"unsupported-host": string;
|
|
83
|
-
"unsupported-backend": string;
|
|
84
|
-
unavailable: string;
|
|
85
|
-
busy: string;
|
|
86
|
-
stale: string;
|
|
87
|
-
cancelled: string;
|
|
88
|
-
"authorization-required": string;
|
|
89
|
-
"child-owner-required": string;
|
|
90
|
-
"format-unavailable": string;
|
|
91
|
-
"initialization-failed": string;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
//# sourceMappingURL=history-locales.d.ts.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const en = {
|
|
2
|
-
title: "Continue this session", preset: "Current agent preset", profile: "Session configuration", baseline: "Use deployment defaults",
|
|
3
|
-
choose: "Choose a current preset", preview: "Review continuation", confirm: "Continue this session", refresh: "Refresh status",
|
|
4
|
-
loading: "Loading current configuration…", preparing: "Preparing confirmation…", confirming: "Activating session…",
|
|
5
|
-
active: "This session is active. Continue using the native conversation.", browsing: "History remains available without continuing execution.",
|
|
6
|
-
unknown: "The result is not confirmed. Refresh status before taking another action.",
|
|
7
|
-
pending: "Pending input", pendingWarning: "These stored inputs are untrusted. Continuing processes this exact pending set under current permissions; it does not restore old approvals.",
|
|
8
|
-
consent: "Process the pending inputs shown above", migration: "Publish the required native format migration and recovery entries",
|
|
9
|
-
effects: "Native recovery entries or a migration may already have been committed. History and pending input are not rolled back.",
|
|
10
|
-
model: "Current model", roles: "Current roles", permissions: "Current restrictions", differences: "Changes to execution", project: "Project",
|
|
11
|
-
noPending: "No pending inputs.", nextTurn: "Next turn", nextStep: "Next step", candidate: "Configuration to be used", disconnected: "Connect to the local Host to review continuation.",
|
|
12
|
-
reasons: {
|
|
13
|
-
validation: "The request is invalid. Refresh and review the selection.", "not-owned": "Use the current local Host operator connection.", "not-found": "The stored session is unavailable.",
|
|
14
|
-
"unsupported-host": "A compatible Host with read-only history following is required. The original Desktop has not been patched by this plugin.",
|
|
15
|
-
"unsupported-backend": "This storage backend cannot validate continuation before writing.", unavailable: "Current execution services are unavailable. History can still be inspected.",
|
|
16
|
-
busy: "An activation or other owner is already using this session. Refresh its status.", stale: "The session or current configuration changed. Review a new confirmation.",
|
|
17
|
-
cancelled: "Continuation was cancelled. Refresh before trying again.", "authorization-required": "Review the current configuration and explicitly confirm continuation.",
|
|
18
|
-
"child-owner-required": "This child can be browsed here. Continuing requires its exact live parent owner.", "format-unavailable": "The native reader could not load this format. Keep the existing history view and inspect its diagnostic.",
|
|
19
|
-
"initialization-failed": "Execution initialization failed. Refresh status; do not replay the request.",
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
export const historyLocales = { en, zh: {
|
|
23
|
-
title: "继续此会话", preset: "当前 Agent 预设", profile: "本次会话配置", baseline: "使用部署默认配置",
|
|
24
|
-
choose: "选择当前可用的预设", preview: "查看继续方案", confirm: "继续此会话", refresh: "刷新状态",
|
|
25
|
-
loading: "正在读取当前配置…", preparing: "正在准备确认信息…", confirming: "正在激活会话…",
|
|
26
|
-
active: "此会话已激活,可继续使用原生对话界面。", browsing: "不继续执行也可以浏览历史。",
|
|
27
|
-
unknown: "结果待确认。请先刷新状态,不要重复执行。",
|
|
28
|
-
pending: "待处理输入", pendingWarning: "以下历史输入是不可信内容。继续后将按当前权限处理这一组输入,不恢复旧审批。",
|
|
29
|
-
consent: "处理上方列出的待处理输入", migration: "允许发布所需的原生格式迁移和恢复记录",
|
|
30
|
-
effects: "原生恢复记录或迁移可能已经提交,不承诺回滚历史或待处理输入。",
|
|
31
|
-
model: "当前模型", roles: "当前角色", permissions: "当前限制", differences: "执行变化", project: "项目",
|
|
32
|
-
noPending: "没有待处理输入。", nextTurn: "下一轮", nextStep: "下一步", candidate: "将采用的配置", disconnected: "连接本地 Host 后可查看继续方案。",
|
|
33
|
-
reasons: {
|
|
34
|
-
validation: "请求无效,请刷新后重新查看选择。", "not-owned": "请使用当前本地 Host 的操作者连接。", "not-found": "找不到该持久化会话。",
|
|
35
|
-
"unsupported-host": "需要支持只读历史跟随的兼容 Host。仅安装插件不会修补原版 Desktop。", "unsupported-backend": "当前存储后端不能在写入前校验继续权限。",
|
|
36
|
-
unavailable: "当前执行服务不可用,仍可查看历史。", busy: "该会话正被其他执行者或激活操作使用,请刷新状态。", stale: "会话或当前配置已变化,请重新查看确认信息。",
|
|
37
|
-
cancelled: "继续操作已取消,请刷新后再试。", "authorization-required": "请查看当前配置并明确确认继续。", "child-owner-required": "此处可浏览子会话,继续执行需要其真实存活的父级所有者。",
|
|
38
|
-
"format-unavailable": "原生读取器无法加载此格式。请保留现有历史视图并查看诊断。", "initialization-failed": "执行初始化失败,请刷新状态,不要重放请求。",
|
|
39
|
-
},
|
|
40
|
-
} };
|
|
41
|
-
//# sourceMappingURL=history-locales.js.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ConnectionHandle } from "@deepseek-ai/dsh-client-connection/client";
|
|
2
|
-
import type { PendingApproval } from "@deepseek-ai/dsh-client-ui-approval/client";
|
|
3
|
-
import type { ChildPermissionRemote, TemporaryPermissionDuration, TemporaryPermissionRemote } from "../permission-temporary-types.js";
|
|
4
|
-
export declare function temporaryPermissionClient(connection: ConnectionHandle, signal: AbortSignal): TemporaryPermissionRemote & ChildPermissionRemote;
|
|
5
|
-
/** Public PendingApproval type only: answers use the native object and first-wins path. */
|
|
6
|
-
export type TemporaryPendingApproval = PendingApproval & {
|
|
7
|
-
readonly requestId?: string;
|
|
8
|
-
readonly deliveryId?: string;
|
|
9
|
-
answer(outcome: "allowed-once" | "rejected", options?: {
|
|
10
|
-
readonly permit?: string;
|
|
11
|
-
readonly retention?: string;
|
|
12
|
-
}): Promise<void>;
|
|
13
|
-
};
|
|
14
|
-
export declare function pendingDelivery(pending: TemporaryPendingApproval): {
|
|
15
|
-
requestId: string;
|
|
16
|
-
deliveryId: string;
|
|
17
|
-
} | undefined;
|
|
18
|
-
export declare function retainAndAnswer(pending: TemporaryPendingApproval, remote: TemporaryPermissionRemote, duration: TemporaryPermissionDuration, current: () => boolean, scope?: string): Promise<void>;
|
|
19
|
-
export declare function answerWithTemporaryPermit(pending: TemporaryPendingApproval, remote: TemporaryPermissionRemote, current: () => boolean): Promise<void>;
|
|
20
|
-
//# sourceMappingURL=temporary-permission-client.d.ts.map
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { TEMPORARY_PERMISSION_REMOTE, parseTemporaryGrants, parseTemporaryRequest, parseChildPermission } from "../permission-temporary-remote.js";
|
|
2
|
-
export function temporaryPermissionClient(connection, signal) {
|
|
3
|
-
const generation = connection.generation.getSnapshot();
|
|
4
|
-
const check = () => { signal.throwIfAborted(); if (connection.generation.getSnapshot() !== generation)
|
|
5
|
-
throw new Error("Connection generation changed."); };
|
|
6
|
-
async function call(method, args) {
|
|
7
|
-
check();
|
|
8
|
-
const result = await connection.rpc.call("/api", `dsmmTemporaryPermissions/${method}`, { args }, signal);
|
|
9
|
-
check();
|
|
10
|
-
if (!result.ok)
|
|
11
|
-
throw new Error("Temporary permission service unavailable; use the native once-only prompt.");
|
|
12
|
-
const descriptor = TEMPORARY_PERMISSION_REMOTE.descriptors.find(value => value.method === method);
|
|
13
|
-
if (descriptor.result.mode !== "strict")
|
|
14
|
-
throw new Error("Invalid permission protocol.");
|
|
15
|
-
return descriptor.result.create().parse(result.value);
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
async describe(sessionId) { return parseTemporaryGrants(await call("describe", { sessionId })); },
|
|
19
|
-
async request(sessionId, delivery) { return parseTemporaryRequest(await call("request", { sessionId, delivery })); },
|
|
20
|
-
async retain(sessionId, delivery, duration, scope = "exact") { return String(await call("retain", { sessionId, delivery, duration, scope })); },
|
|
21
|
-
async permit(sessionId, delivery) { const value = await call("permit", { sessionId, delivery }); return value === null ? null : String(value); },
|
|
22
|
-
async revoke(sessionId, grantId) { return parseTemporaryGrants(await call("revoke", { sessionId, grantId })); },
|
|
23
|
-
async child(sessionId, childSessionId) { return parseChildPermission(await call("child", { sessionId, childSessionId })); },
|
|
24
|
-
async enableChild(sessionId, childSessionId) { return parseChildPermission(await call("enableChild", { sessionId, childSessionId })); },
|
|
25
|
-
async revokeChild(sessionId, childSessionId) { return parseChildPermission(await call("revokeChild", { sessionId, childSessionId })); },
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
export function pendingDelivery(pending) {
|
|
29
|
-
return pending.requestId && pending.deliveryId ? { requestId: pending.requestId, deliveryId: pending.deliveryId } : undefined;
|
|
30
|
-
}
|
|
31
|
-
export async function retainAndAnswer(pending, remote, duration, current, scope = "exact") {
|
|
32
|
-
if (!current() || !pending.answerable)
|
|
33
|
-
return;
|
|
34
|
-
const delivery = pendingDelivery(pending);
|
|
35
|
-
let retention;
|
|
36
|
-
if (duration !== "once") {
|
|
37
|
-
if (!delivery)
|
|
38
|
-
throw new Error("Scoped approval unsupported.");
|
|
39
|
-
retention = await remote.retain(pending.sessionId, delivery, duration, scope);
|
|
40
|
-
}
|
|
41
|
-
if (current() && pending.answerable)
|
|
42
|
-
await pending.answer("allowed-once", retention === undefined ? undefined : { retention });
|
|
43
|
-
}
|
|
44
|
-
export async function answerWithTemporaryPermit(pending, remote, current) {
|
|
45
|
-
const delivery = pendingDelivery(pending);
|
|
46
|
-
if (!delivery || !current() || !pending.answerable)
|
|
47
|
-
return;
|
|
48
|
-
const permit = await remote.permit(pending.sessionId, delivery);
|
|
49
|
-
if (permit && current() && pending.answerable)
|
|
50
|
-
await pending.answer("allowed-once", { permit });
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=temporary-permission-client.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
-
import type { TemporaryPermissionRemote } from "../permission-temporary-types.js";
|
|
3
|
-
import type { PermissionController } from "./permission-controller.js";
|
|
4
|
-
/** Approval slots belong to the connection generation; the drawer also borrows its exact current scope. */
|
|
5
|
-
export declare function registerTemporaryPermissionEntry(ctx: Context, permissions: PermissionController): import("@deepseek-ai/dsh-client-store").SnapshotStore<TemporaryPermissionRemote | undefined>;
|
|
6
|
-
//# sourceMappingURL=temporary-permission-entry.d.ts.map
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { createSnapshotStore } from "@deepseek-ai/dsh-client-store";
|
|
2
|
-
import { registerTemporaryPermissionSlots } from "./TemporaryPermissions.js";
|
|
3
|
-
import { temporaryPermissionClient } from "./temporary-permission-client.js";
|
|
4
|
-
/** Approval slots belong to the connection generation; the drawer also borrows its exact current scope. */
|
|
5
|
-
export function registerTemporaryPermissionEntry(ctx, permissions) {
|
|
6
|
-
const store = createSnapshotStore(undefined);
|
|
7
|
-
void ctx.inject(["connection"], connectionCtx => {
|
|
8
|
-
const connection = connectionCtx.connection;
|
|
9
|
-
let generation = connection.generation.getSnapshot(), lifetime;
|
|
10
|
-
let owner;
|
|
11
|
-
let scopeLifetime, scopeKey = "";
|
|
12
|
-
const bindScope = () => {
|
|
13
|
-
const state = permissions.store.getSnapshot();
|
|
14
|
-
const key = JSON.stringify([state.generation, state.sessionId, state.scope, state.connected]);
|
|
15
|
-
if (key === scopeKey)
|
|
16
|
-
return;
|
|
17
|
-
scopeKey = key;
|
|
18
|
-
scopeLifetime?.abort();
|
|
19
|
-
scopeLifetime = undefined;
|
|
20
|
-
store.set(undefined);
|
|
21
|
-
if (!lifetime || lifetime.signal.aborted || !state.connected || state.sessionId === null || state.scope === "unknown")
|
|
22
|
-
return;
|
|
23
|
-
scopeLifetime = new AbortController();
|
|
24
|
-
store.set(temporaryPermissionClient(connection, AbortSignal.any([lifetime.signal, scopeLifetime.signal])));
|
|
25
|
-
};
|
|
26
|
-
const update = () => {
|
|
27
|
-
const next = connection.generation.getSnapshot();
|
|
28
|
-
if (lifetime && generation === next)
|
|
29
|
-
return;
|
|
30
|
-
generation = next;
|
|
31
|
-
lifetime?.abort();
|
|
32
|
-
lifetime = undefined;
|
|
33
|
-
scopeLifetime?.abort();
|
|
34
|
-
scopeKey = "";
|
|
35
|
-
void owner?.dispose();
|
|
36
|
-
owner = undefined;
|
|
37
|
-
store.set(undefined);
|
|
38
|
-
if (next !== undefined) {
|
|
39
|
-
const current = lifetime = new AbortController();
|
|
40
|
-
owner = connectionCtx.plugin({ name: "dsmm-temporary-permission-generation", apply(ownerCtx) {
|
|
41
|
-
ownerCtx.effect(() => () => current.abort());
|
|
42
|
-
if (current.signal.aborted || connection.generation.getSnapshot() !== next)
|
|
43
|
-
return;
|
|
44
|
-
registerTemporaryPermissionSlots(ownerCtx, connection);
|
|
45
|
-
} });
|
|
46
|
-
}
|
|
47
|
-
bindScope();
|
|
48
|
-
};
|
|
49
|
-
update();
|
|
50
|
-
connectionCtx.effect(() => connection.generation.subscribe(update));
|
|
51
|
-
connectionCtx.effect(() => permissions.store.subscribe(bindScope));
|
|
52
|
-
connectionCtx.effect(() => () => { lifetime?.abort(); scopeLifetime?.abort(); store.set(undefined); }, "dsmm: temporary permission connection lifetime");
|
|
53
|
-
});
|
|
54
|
-
return store;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=temporary-permission-entry.js.map
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
-
import type { SessionInspection } from "@deepseek-ai/dsh-session-persistence";
|
|
3
|
-
import type { NativeAdmission } from "./native-admission.js";
|
|
4
|
-
import type { DsmmProfileRuntime } from "./profile-runtime.js";
|
|
5
|
-
import type { DsmmDeploymentConfig } from "./deployment-config.js";
|
|
6
|
-
import type { HistoryCandidate, HistoryCandidates } from "./history-contract.js";
|
|
7
|
-
import type { HistoryPreviewRequest } from "./history-types.js";
|
|
8
|
-
/** Current deployment/profile and native composition only; history supplies content and restrictive ceilings. */
|
|
9
|
-
export declare class DsmmHistoryCandidates implements HistoryCandidates {
|
|
10
|
-
private readonly ctx;
|
|
11
|
-
private readonly profiles;
|
|
12
|
-
private readonly deployment;
|
|
13
|
-
private readonly admission;
|
|
14
|
-
readonly signal: AbortSignal;
|
|
15
|
-
private modelGeneration;
|
|
16
|
-
constructor(ctx: Context, profiles: DsmmProfileRuntime, deployment: DsmmDeploymentConfig, admission: NativeAdmission);
|
|
17
|
-
checkCompatibility(): Promise<void>;
|
|
18
|
-
choices(signal: AbortSignal): Promise<{
|
|
19
|
-
presets: {
|
|
20
|
-
id: string;
|
|
21
|
-
label: string;
|
|
22
|
-
}[];
|
|
23
|
-
profiles: {
|
|
24
|
-
id: string;
|
|
25
|
-
label: string;
|
|
26
|
-
}[];
|
|
27
|
-
}>;
|
|
28
|
-
prepare(request: HistoryPreviewRequest, inspection: SessionInspection, signal: AbortSignal): Promise<HistoryCandidate>;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=history-candidates.d.ts.map
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
import { isDeepStrictEqual } from "node:util";
|
|
3
|
-
import { symbols } from "@deepseek-ai/cordis";
|
|
4
|
-
import { ReasoningEffortId } from "@deepseek-ai/dsh-llm";
|
|
5
|
-
import { setSandboxMode } from "@deepseek-ai/dsh-sandbox-policy";
|
|
6
|
-
import { setApprovalPolicy } from "@deepseek-ai/dsh-user-approval";
|
|
7
|
-
import { HistoryRefusal } from "./history-controller.js";
|
|
8
|
-
import { DSMM_ROLES, isDsmmRoleId } from "./roles.js";
|
|
9
|
-
import { isRootRoleEnabled } from "./settings.js";
|
|
10
|
-
import { appendModeRecord } from "./session-metadata.js";
|
|
11
|
-
import { effectiveHistoryGitWriteGuard } from "./history-policy.js";
|
|
12
|
-
const require = createRequire(import.meta.url), sdk = createRequire(require.resolve("@deepseek-ai/dsh-agent-preset-registry"));
|
|
13
|
-
const { createScope, scopeParentOf } = sdk("@deepseek-ai/dsh-scope");
|
|
14
|
-
const original = (value) => Reflect.get(value, symbols.original) ?? value;
|
|
15
|
-
const services = ["llm", "tools", "systemPrompt", "skills", "sandboxPolicy", "approval"];
|
|
16
|
-
function requireCurrentLease(lease) {
|
|
17
|
-
if (!("assertCurrent" in lease) || typeof lease.assertCurrent !== "function")
|
|
18
|
-
throw new HistoryRefusal("unsupported-host");
|
|
19
|
-
}
|
|
20
|
-
/** Current deployment/profile and native composition only; history supplies content and restrictive ceilings. */
|
|
21
|
-
export class DsmmHistoryCandidates {
|
|
22
|
-
ctx;
|
|
23
|
-
profiles;
|
|
24
|
-
deployment;
|
|
25
|
-
admission;
|
|
26
|
-
signal;
|
|
27
|
-
modelGeneration = 0;
|
|
28
|
-
constructor(ctx, profiles, deployment, admission) {
|
|
29
|
-
this.ctx = ctx;
|
|
30
|
-
this.profiles = profiles;
|
|
31
|
-
this.deployment = deployment;
|
|
32
|
-
this.admission = admission;
|
|
33
|
-
this.signal = admission.lifetime.signal;
|
|
34
|
-
ctx.on("llm/adapters-updated", () => { this.modelGeneration++; }, { global: true });
|
|
35
|
-
}
|
|
36
|
-
async checkCompatibility() {
|
|
37
|
-
this.signal.throwIfAborted();
|
|
38
|
-
const registry = this.ctx.agentPresets, preset = (await registry.list()).find(row => !row.broken);
|
|
39
|
-
if (!preset)
|
|
40
|
-
throw new HistoryRefusal("unavailable");
|
|
41
|
-
const lease = await registry.acquireScope(preset.id);
|
|
42
|
-
try {
|
|
43
|
-
requireCurrentLease(lease);
|
|
44
|
-
lease.assertCurrent();
|
|
45
|
-
this.signal.throwIfAborted();
|
|
46
|
-
}
|
|
47
|
-
finally {
|
|
48
|
-
await lease[Symbol.asyncDispose]();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async choices(signal) {
|
|
52
|
-
signal.throwIfAborted();
|
|
53
|
-
this.signal.throwIfAborted();
|
|
54
|
-
const desired = await this.deployment.readDesired(), rows = await this.ctx.agentPresets.list(), profiles = await this.profiles.describe();
|
|
55
|
-
signal.throwIfAborted();
|
|
56
|
-
this.signal.throwIfAborted();
|
|
57
|
-
return { presets: rows.filter(row => !row.broken && (!row.id.startsWith("dsmm-") || isDsmmRoleId(row.id) && isRootRoleEnabled(desired.settings, row.id)))
|
|
58
|
-
.map(row => ({ id: row.id, label: (row.name ?? row.id).slice(0, 120) })),
|
|
59
|
-
profiles: profiles.profiles.filter(row => row.revision !== null && row.error === undefined).map(row => ({ id: row.id, label: (row.label ?? row.id).slice(0, 120) })) };
|
|
60
|
-
}
|
|
61
|
-
async prepare(request, inspection, signal) {
|
|
62
|
-
signal.throwIfAborted();
|
|
63
|
-
this.signal.throwIfAborted();
|
|
64
|
-
if (inspection.meta.origin === "subagent")
|
|
65
|
-
throw new HistoryRefusal("child-owner-required");
|
|
66
|
-
const profile = await this.profiles.prepareHistory(request.profileId, this.signal), settings = profile.admission.settings;
|
|
67
|
-
if (request.preset.startsWith("dsmm-") && (!isDsmmRoleId(request.preset) || !isRootRoleEnabled(settings, request.preset)))
|
|
68
|
-
throw new HistoryRefusal("unavailable");
|
|
69
|
-
const registry = this.ctx.agentPresets, metadata = await registry.resolve(request.preset);
|
|
70
|
-
if (metadata.broken)
|
|
71
|
-
throw new HistoryRefusal("unavailable");
|
|
72
|
-
const lease = await registry.acquireScope(request.preset);
|
|
73
|
-
try {
|
|
74
|
-
requireCurrentLease(lease);
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
await lease[Symbol.asyncDispose]();
|
|
78
|
-
throw error;
|
|
79
|
-
}
|
|
80
|
-
const scope = createScope(this.ctx, {}, { parent: lease.key });
|
|
81
|
-
const dispose = async () => { try {
|
|
82
|
-
await scope.dispose();
|
|
83
|
-
}
|
|
84
|
-
finally {
|
|
85
|
-
await lease[Symbol.asyncDispose]();
|
|
86
|
-
} };
|
|
87
|
-
try {
|
|
88
|
-
const get = (name) => registry.serviceFor({ ctx: scope.ctx }, name) ?? this.ctx.get(name);
|
|
89
|
-
const captured = services.map(name => get(name));
|
|
90
|
-
if (captured.some(value => value === undefined))
|
|
91
|
-
throw new HistoryRefusal("unavailable");
|
|
92
|
-
const llm = get("llm"), sandbox = get("sandboxPolicy"), approval = get("approval");
|
|
93
|
-
const permissions = this.ctx.get("dsmmPermissionController");
|
|
94
|
-
if (!permissions)
|
|
95
|
-
throw new HistoryRefusal("unavailable");
|
|
96
|
-
await permissions.rules.refresh();
|
|
97
|
-
const rules = permissions.rules.getPolicy(), permissionSignal = permissions.rules.signal;
|
|
98
|
-
const source = this.deployment.permissionSource();
|
|
99
|
-
if (source.globalRevision !== profile.admission.deployment?.globalRevision || source.nativeRevision !== profile.admission.deployment?.nativeRevision)
|
|
100
|
-
throw new HistoryRefusal("stale");
|
|
101
|
-
const generation = this.modelGeneration;
|
|
102
|
-
const active = settings.modules.deepwork.enabled && (isDsmmRoleId(request.preset) || request.preset !== "minimal" && settings.defaultActive);
|
|
103
|
-
const role = isDsmmRoleId(request.preset) ? request.preset : active ? "dsmm-orchestrator" : undefined;
|
|
104
|
-
const route = role === undefined ? undefined : settings.roleRouting[role]?.primary;
|
|
105
|
-
const defaultModel = this.ctx.get?.("agentDefaultModel");
|
|
106
|
-
if (!route && !defaultModel)
|
|
107
|
-
throw new HistoryRefusal("unavailable");
|
|
108
|
-
const model = route === undefined ? structuredClone(defaultModel.currentSelection()) : { provider: route.provider, model: route.model,
|
|
109
|
-
...(route.reasoningEffort === undefined ? {} : { reasoningEffort: ReasoningEffortId(route.reasoningEffort) }) };
|
|
110
|
-
await llm.resolveCallConfig(model, signal);
|
|
111
|
-
const oldSandbox = inspection.events.filter(event => event.type === "sandbox/mode").at(-1);
|
|
112
|
-
const oldApproval = inspection.events.filter(event => event.type === "approval/policy").at(-1);
|
|
113
|
-
const oldPreset = inspection.events.filter(event => event.type === "agent-preset/selected").at(-1)?.data.agentPreset ?? inspection.meta.agentPreset;
|
|
114
|
-
const readOnlyHistory = oldSandbox?.data.mode === "read-only" || DSMM_ROLES.some(role => role.id === oldPreset && role.access === "read-only");
|
|
115
|
-
const defaultMode = sandbox.defaultMode, defaultApproval = approval.config.policy ?? "ask";
|
|
116
|
-
const mode = readOnlyHistory ? "read-only" : defaultMode;
|
|
117
|
-
const approvalPolicy = oldApproval?.data.policy === "never" ? "never" : defaultApproval;
|
|
118
|
-
const check = () => {
|
|
119
|
-
this.signal.throwIfAborted();
|
|
120
|
-
permissionSignal.throwIfAborted();
|
|
121
|
-
try {
|
|
122
|
-
lease.assertCurrent();
|
|
123
|
-
profile.assertCurrent();
|
|
124
|
-
}
|
|
125
|
-
catch {
|
|
126
|
-
throw new HistoryRefusal("stale");
|
|
127
|
-
}
|
|
128
|
-
const current = this.ctx.get("dsmmPermissionController");
|
|
129
|
-
const currentDefault = this.ctx.get?.("agentDefaultModel");
|
|
130
|
-
if (!this.admission.isReady || original(this.ctx.agentPresets) !== original(registry) || this.modelGeneration !== generation
|
|
131
|
-
|| current === undefined || original(current) !== original(permissions) || current.rules.signal !== permissionSignal
|
|
132
|
-
|| current.rules.getPolicy().revision !== rules.revision || this.deployment.permissionSource().revision !== source.revision
|
|
133
|
-
|| captured.some((value, index) => { const now = get(services[index]); return value === undefined || now === undefined || original(value) !== original(now); })
|
|
134
|
-
|| route === undefined && (currentDefault === undefined || original(currentDefault) !== original(defaultModel) || !isDeepStrictEqual(currentDefault.currentSelection(), model))
|
|
135
|
-
|| sandbox.defaultMode !== defaultMode || (approval.config.policy ?? "ask") !== defaultApproval)
|
|
136
|
-
throw new HistoryRefusal("stale");
|
|
137
|
-
};
|
|
138
|
-
check();
|
|
139
|
-
signal.throwIfAborted();
|
|
140
|
-
return { admission: profile.admission, model, signal: AbortSignal.any([this.signal, permissionSignal]),
|
|
141
|
-
view: { preset: { id: request.preset, label: (metadata.name ?? metadata.id).slice(0, 120) }, profile: request.profileId === null ? null : { id: request.profileId, label: (profile.label ?? request.profileId).slice(0, 120) }, model,
|
|
142
|
-
roles: DSMM_ROLES.filter(role => active && settings.roles[role.id]).map(role => ({ id: role.id, label: role.name })),
|
|
143
|
-
restrictions: [`sandbox: ${mode}`, `approval: ${approvalPolicy}`, `Deepwork: ${active ? "on" : "off"}`, `DSMM Git-write guard: ${effectiveHistoryGitWriteGuard(settings, mode === "danger-full-access", active)}`],
|
|
144
|
-
differences: ["Current preset, saved configuration and current native permissions replace historical execution settings. Historical approval outcomes and temporary grants are not reused."] },
|
|
145
|
-
assertCurrent: check,
|
|
146
|
-
revalidate: async (currentSignal) => {
|
|
147
|
-
check();
|
|
148
|
-
await profile.revalidate(currentSignal);
|
|
149
|
-
await llm.resolveCallConfig(model, currentSignal);
|
|
150
|
-
check();
|
|
151
|
-
currentSignal.throwIfAborted();
|
|
152
|
-
},
|
|
153
|
-
install: async (agent, currentSignal) => {
|
|
154
|
-
check();
|
|
155
|
-
currentSignal.throwIfAborted();
|
|
156
|
-
if (scopeParentOf(agent) !== lease.key || registry.composedPreset(agent.ctx) !== request.preset
|
|
157
|
-
|| captured.some((value, index) => { const actual = registry.serviceFor(agent, services[index]) ?? agent.ctx.get(services[index]); return value === undefined || actual === undefined || original(value) !== original(actual); }))
|
|
158
|
-
throw new HistoryRefusal("stale");
|
|
159
|
-
setSandboxMode(agent.session, mode);
|
|
160
|
-
check();
|
|
161
|
-
setApprovalPolicy(agent.session, approvalPolicy);
|
|
162
|
-
check();
|
|
163
|
-
appendModeRecord(agent.session, active);
|
|
164
|
-
check();
|
|
165
|
-
await this.admission.prepareHistory(agent, profile.admission, currentSignal);
|
|
166
|
-
check();
|
|
167
|
-
currentSignal.throwIfAborted();
|
|
168
|
-
}, dispose };
|
|
169
|
-
}
|
|
170
|
-
catch (error) {
|
|
171
|
-
await dispose();
|
|
172
|
-
throw error;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
//# sourceMappingURL=history-candidates.js.map
|
package/lib/history-codec.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { HistoryChoices, HistoryConfirmRequest, HistoryContinuationResult, HistoryFailure, HistoryJson, HistoryPreview, HistoryPreviewRequest, HistoryStatus } from "./history-types.js";
|
|
2
|
-
export declare function historySessionId(input: unknown): string;
|
|
3
|
-
export declare function historyJson(input: unknown, depth?: number, active?: Set<object>): HistoryJson;
|
|
4
|
-
export declare function parseHistoryFailure(input: unknown): HistoryFailure;
|
|
5
|
-
export declare function parseHistoryStatus(input: unknown): HistoryStatus;
|
|
6
|
-
export declare function parseHistoryChoices(input: unknown): HistoryChoices;
|
|
7
|
-
export declare function parseHistoryPreviewRequest(input: unknown): HistoryPreviewRequest;
|
|
8
|
-
export declare function parseHistoryConfirmRequest(input: unknown): HistoryConfirmRequest;
|
|
9
|
-
export declare function parseHistoryPreview(input: unknown): HistoryPreview;
|
|
10
|
-
export declare function parseHistoryResult(input: unknown): HistoryContinuationResult;
|
|
11
|
-
//# sourceMappingURL=history-codec.d.ts.map
|
package/lib/history-codec.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { isNativeSessionId, isProfileId } from "./profile-remote.js";
|
|
2
|
-
const codes = ["validation", "not-owned", "not-found", "unsupported-host", "unsupported-backend", "unavailable", "busy", "stale", "cancelled", "authorization-required", "child-owner-required", "format-unavailable", "initialization-failed"];
|
|
3
|
-
function invalid() { throw new TypeError("Invalid history continuation request or response"); }
|
|
4
|
-
function object(input, required, optional = []) {
|
|
5
|
-
if (!input || typeof input !== "object" || Array.isArray(input)
|
|
6
|
-
|| ![Object.prototype, null].includes(Object.getPrototypeOf(input)) || Object.getOwnPropertySymbols(input).length
|
|
7
|
-
|| Object.values(Object.getOwnPropertyDescriptors(input)).some(row => !Object.hasOwn(row, "value") || !row.enumerable))
|
|
8
|
-
invalid();
|
|
9
|
-
const row = input;
|
|
10
|
-
if (required.some(key => !Object.hasOwn(row, key)) || Object.keys(row).some(key => !required.includes(key) && !optional.includes(key)))
|
|
11
|
-
invalid();
|
|
12
|
-
return row;
|
|
13
|
-
}
|
|
14
|
-
function text(input, maximum = 4096) { if (typeof input !== "string" || input.length > maximum)
|
|
15
|
-
invalid(); return input; }
|
|
16
|
-
function bool(input) { if (typeof input !== "boolean")
|
|
17
|
-
invalid(); return input; }
|
|
18
|
-
function list(input, parse) { if (!Array.isArray(input))
|
|
19
|
-
invalid(); return input.map(value => parse(value)); }
|
|
20
|
-
function code(input) { if (!codes.includes(input))
|
|
21
|
-
invalid(); return input; }
|
|
22
|
-
export function historySessionId(input) { if (!isNativeSessionId(input))
|
|
23
|
-
invalid(); return input; }
|
|
24
|
-
function intentId(input) { const id = text(input, 36); if (!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u.test(id))
|
|
25
|
-
invalid(); return id; }
|
|
26
|
-
function profileId(input) { if (input === null)
|
|
27
|
-
return null; if (!isProfileId(input))
|
|
28
|
-
invalid(); return input; }
|
|
29
|
-
function presetId(input) { return historySessionId(input); }
|
|
30
|
-
function choice(input) { const row = object(input, ["id", "label"]); return { id: text(row.id, 256), label: text(row.label, 120) }; }
|
|
31
|
-
export function historyJson(input, depth = 0, active = new Set()) {
|
|
32
|
-
if (depth > 32)
|
|
33
|
-
invalid();
|
|
34
|
-
if (input === null || typeof input === "boolean" || typeof input === "string")
|
|
35
|
-
return input;
|
|
36
|
-
if (typeof input === "number") {
|
|
37
|
-
if (!Number.isFinite(input))
|
|
38
|
-
invalid();
|
|
39
|
-
return input;
|
|
40
|
-
}
|
|
41
|
-
if (!input || typeof input !== "object")
|
|
42
|
-
invalid();
|
|
43
|
-
if (active.has(input))
|
|
44
|
-
invalid();
|
|
45
|
-
active.add(input);
|
|
46
|
-
try {
|
|
47
|
-
if (Array.isArray(input)) {
|
|
48
|
-
if (Object.getOwnPropertySymbols(input).length || Object.entries(Object.getOwnPropertyDescriptors(input)).some(([key, property]) => key !== "length" && (!/^(0|[1-9][0-9]*)$/u.test(key) || !Object.hasOwn(property, "value") || !property.enumerable)))
|
|
49
|
-
invalid();
|
|
50
|
-
return input.map(value => historyJson(value, depth + 1, active));
|
|
51
|
-
}
|
|
52
|
-
const row = object(input, Object.keys(input));
|
|
53
|
-
return Object.fromEntries(Object.entries(row).map(([key, value]) => [key, historyJson(value, depth + 1, active)]));
|
|
54
|
-
}
|
|
55
|
-
finally {
|
|
56
|
-
active.delete(input);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export function parseHistoryFailure(input) {
|
|
60
|
-
const row = object(input, ["code", "storageEffects"]);
|
|
61
|
-
if (row.storageEffects !== "none" && row.storageEffects !== "may-have-committed")
|
|
62
|
-
invalid();
|
|
63
|
-
return { code: code(row.code), storageEffects: row.storageEffects };
|
|
64
|
-
}
|
|
65
|
-
export function parseHistoryStatus(input) {
|
|
66
|
-
const row = object(input, ["sessionId", "readable", "execution", "compatibleHost"], ["reason"]);
|
|
67
|
-
if (row.readable !== "readable" && row.readable !== "unavailable")
|
|
68
|
-
invalid();
|
|
69
|
-
if (!["authorization-required", "activating", "active", "unavailable"].includes(String(row.execution)))
|
|
70
|
-
invalid();
|
|
71
|
-
return { sessionId: historySessionId(row.sessionId), readable: row.readable, execution: row.execution, compatibleHost: bool(row.compatibleHost), ...(row.reason === undefined ? {} : { reason: code(row.reason) }) };
|
|
72
|
-
}
|
|
73
|
-
export function parseHistoryChoices(input) {
|
|
74
|
-
const row = object(input, ["presets", "profiles"]);
|
|
75
|
-
return { presets: list(row.presets, value => { const result = choice(value); presetId(result.id); return result; }), profiles: list(row.profiles, value => { const result = choice(value); profileId(result.id); return result; }) };
|
|
76
|
-
}
|
|
77
|
-
export function parseHistoryPreviewRequest(input) {
|
|
78
|
-
const row = object(input, ["sessionId", "preset", "profileId"]);
|
|
79
|
-
return { sessionId: historySessionId(row.sessionId), preset: presetId(row.preset), profileId: profileId(row.profileId) };
|
|
80
|
-
}
|
|
81
|
-
export function parseHistoryConfirmRequest(input) {
|
|
82
|
-
const row = object(input, ["sessionId", "intentId", "processPending", "acceptMigration"]);
|
|
83
|
-
return { sessionId: historySessionId(row.sessionId), intentId: intentId(row.intentId), processPending: bool(row.processPending), acceptMigration: bool(row.acceptMigration) };
|
|
84
|
-
}
|
|
85
|
-
function candidate(input) {
|
|
86
|
-
const row = object(input, ["preset", "profile", "model", "roles", "restrictions", "differences"]);
|
|
87
|
-
const model = object(row.model, ["provider", "model"], ["reasoningEffort"]);
|
|
88
|
-
return { preset: choice(row.preset), profile: row.profile === null ? null : choice(row.profile),
|
|
89
|
-
model: { provider: text(model.provider, 256), model: text(model.model, 256), ...(model.reasoningEffort === undefined ? {} : { reasoningEffort: text(model.reasoningEffort, 128) }) },
|
|
90
|
-
roles: list(row.roles, choice), restrictions: list(row.restrictions, value => text(value)), differences: list(row.differences, value => text(value)) };
|
|
91
|
-
}
|
|
92
|
-
export function parseHistoryPreview(input) {
|
|
93
|
-
const row = object(input, ["sessionId", "intentId", "cwd", "candidate", "migrationRequired", "pending"]), pending = object(row.pending, ["nextTurn", "nextStep"]);
|
|
94
|
-
return { sessionId: historySessionId(row.sessionId), intentId: intentId(row.intentId), cwd: text(row.cwd), candidate: candidate(row.candidate), migrationRequired: bool(row.migrationRequired), pending: { nextTurn: list(pending.nextTurn, historyJson), nextStep: list(pending.nextStep, historyJson) } };
|
|
95
|
-
}
|
|
96
|
-
export function parseHistoryResult(input) {
|
|
97
|
-
const row = object(input, ["sessionId", "execution"]);
|
|
98
|
-
if (row.execution !== "active")
|
|
99
|
-
invalid();
|
|
100
|
-
return { sessionId: historySessionId(row.sessionId), execution: "active" };
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=history-codec.js.map
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { Agent, ModelSelection } from "@deepseek-ai/dsh-agent";
|
|
2
|
-
import type { SessionInspection } from "@deepseek-ai/dsh-session-persistence";
|
|
3
|
-
import type { DsmmProfileAdmission } from "./settings.js";
|
|
4
|
-
import type { HistoryCandidateView, HistoryChoices, HistoryPreviewRequest } from "./history-types.js";
|
|
5
|
-
/** A current profile/preset/policy preparation, never reconstructed from old epochs or approvals. */
|
|
6
|
-
export interface HistoryCandidate {
|
|
7
|
-
readonly admission: DsmmProfileAdmission;
|
|
8
|
-
readonly view: HistoryCandidateView;
|
|
9
|
-
readonly model: ModelSelection;
|
|
10
|
-
readonly signal: AbortSignal;
|
|
11
|
-
/** Re-read current configuration and availability without touching the historical log. */
|
|
12
|
-
revalidate(signal: AbortSignal): Promise<void>;
|
|
13
|
-
/** Synchronous revision/owner/policy fence, including across native created notifications. */
|
|
14
|
-
assertCurrent(): undefined;
|
|
15
|
-
/** Install current native restrictions in the unpublished Agent; registrations belong to that Agent. */
|
|
16
|
-
install(agent: Agent, signal: AbortSignal): Promise<void>;
|
|
17
|
-
/** Release preparation resources, not successfully installed Agent policy. */
|
|
18
|
-
dispose(): void | Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
export interface HistoryCandidates {
|
|
21
|
-
readonly signal: AbortSignal;
|
|
22
|
-
checkCompatibility?(): Promise<void>;
|
|
23
|
-
choices(signal: AbortSignal): Promise<HistoryChoices>;
|
|
24
|
-
prepare(request: HistoryPreviewRequest, inspection: SessionInspection, signal: AbortSignal): Promise<HistoryCandidate>;
|
|
25
|
-
}
|
|
26
|
-
/** Existing NativeAdmission surface; the bridge adds no second admission owner. */
|
|
27
|
-
export interface HistoryNativeAdmission {
|
|
28
|
-
readonly lifetime: AbortController;
|
|
29
|
-
readonly isReady: boolean;
|
|
30
|
-
get(agent: Agent): DsmmProfileAdmission | undefined;
|
|
31
|
-
assert(agent: Agent): DsmmProfileAdmission;
|
|
32
|
-
}
|
|
33
|
-
/** Host-created identity. None of these fields is accepted from the wire. */
|
|
34
|
-
export interface HistoryOperator {
|
|
35
|
-
readonly peer: object;
|
|
36
|
-
readonly connection: object;
|
|
37
|
-
readonly peerSignal: AbortSignal;
|
|
38
|
-
readonly signal: AbortSignal;
|
|
39
|
-
assertCurrent(): void;
|
|
40
|
-
/** Does not retain a completed preview RPC's cancellation signal. */
|
|
41
|
-
assertOwner(): void;
|
|
42
|
-
assertVisible(sessionId: string): void;
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=history-contract.d.ts.map
|