@dsmm/dsmm 0.3.1 → 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/cordis.patch.yml +9 -0
- package/docs/compatibility.md +10 -0
- package/docs/releasing.md +25 -65
- package/docs/roadmap.md +44 -2
- package/lib/client/ChildPermissions.d.ts +43 -0
- package/lib/client/ChildPermissions.js +100 -0
- package/lib/client/ChildrenPanel.d.ts +4 -1
- package/lib/client/ChildrenPanel.js +3 -3
- package/lib/client/DeploymentFields.d.ts +6 -2
- package/lib/client/DeploymentFields.js +8 -6
- package/lib/client/DeploymentPage.d.ts +4 -1
- package/lib/client/DeploymentPage.js +5 -4
- package/lib/client/HistoryContinuation.d.ts +7 -0
- package/lib/client/HistoryContinuation.js +22 -0
- package/lib/client/PermissionPanelEntry.d.ts +8 -0
- package/lib/client/PermissionPanelEntry.js +11 -0
- package/lib/client/PermissionsPanel.d.ts +3 -1
- package/lib/client/PermissionsPanel.js +3 -2
- package/lib/client/ProfilesSection.js +3 -3
- package/lib/client/RoleAvailability.js +1 -1
- package/lib/client/SessionProfiles.js +21 -18
- package/lib/client/TemporaryPermissions.d.ts +21 -0
- package/lib/client/TemporaryPermissions.js +94 -0
- package/lib/client/children-locales.d.ts +4 -4
- package/lib/client/controller.d.ts +17 -0
- package/lib/client/controller.js +101 -18
- package/lib/client/deployment-locales.js +26 -26
- package/lib/client/history-controller.d.ts +29 -0
- package/lib/client/history-controller.js +111 -0
- package/lib/client/history-entry.d.ts +11 -0
- package/lib/client/history-entry.js +106 -0
- package/lib/client/history-locales.d.ts +95 -0
- package/lib/client/history-locales.js +41 -0
- package/lib/client/index.js +16 -3
- package/lib/client/locales.d.ts +6 -0
- package/lib/client/locales.js +104 -92
- package/lib/client/permission-locales.d.ts +26 -0
- package/lib/client/permission-locales.js +55 -35
- package/lib/client/temporary-permission-client.d.ts +20 -0
- package/lib/client/temporary-permission-client.js +52 -0
- package/lib/client/temporary-permission-entry.d.ts +6 -0
- package/lib/client/temporary-permission-entry.js +56 -0
- package/lib/client.js +3881 -1981
- package/lib/history-candidates.d.ts +30 -0
- package/lib/history-candidates.js +176 -0
- package/lib/history-codec.d.ts +11 -0
- package/lib/history-codec.js +102 -0
- package/lib/history-contract.d.ts +44 -0
- package/lib/history-contract.js +2 -0
- package/lib/history-controller.d.ts +42 -0
- package/lib/history-controller.js +329 -0
- package/lib/history-policy.d.ts +4 -0
- package/lib/history-policy.js +8 -0
- package/lib/history-remote.d.ts +28 -0
- package/lib/history-remote.js +17 -0
- package/lib/history-rpc.d.ts +24 -0
- package/lib/history-rpc.js +136 -0
- package/lib/history-support.d.ts +15 -0
- package/lib/history-support.js +21 -0
- package/lib/history-types.d.ts +67 -0
- package/lib/history-types.js +2 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +24 -6
- package/lib/native-admission.d.ts +21 -0
- package/lib/native-admission.js +206 -16
- package/lib/permission-child-control.d.ts +36 -0
- package/lib/permission-child-control.js +164 -0
- package/lib/permission-control.d.ts +2 -0
- package/lib/permission-control.js +7 -0
- package/lib/permission-controller.js +2 -2
- package/lib/permission-exec-argv.d.ts +32 -0
- package/lib/permission-exec-argv.js +171 -0
- package/lib/permission-fs-search.js +2 -1
- package/lib/permission-fs.js +2 -1
- package/lib/permission-native-rules.js +3 -3
- package/lib/permission-temporary-files.d.ts +19 -0
- package/lib/permission-temporary-files.js +248 -0
- package/lib/permission-temporary-grants.d.ts +106 -0
- package/lib/permission-temporary-grants.js +198 -0
- package/lib/permission-temporary-install.d.ts +25 -0
- package/lib/permission-temporary-install.js +86 -0
- package/lib/permission-temporary-remote.d.ts +19 -0
- package/lib/permission-temporary-remote.js +75 -0
- package/lib/permission-temporary-rpc.d.ts +37 -0
- package/lib/permission-temporary-rpc.js +154 -0
- package/lib/permission-temporary-types.d.ts +47 -0
- package/lib/permission-temporary-types.js +2 -0
- package/lib/permission-temporary-web.d.ts +11 -0
- package/lib/permission-temporary-web.js +154 -0
- package/lib/permission-web.js +2 -1
- package/lib/preset-skills.d.ts +1 -1
- package/lib/preset-skills.js +2 -2
- package/lib/profile-rpc.js +2 -0
- package/lib/profile-runtime.d.ts +12 -1
- package/lib/profile-runtime.js +122 -10
- package/lib/profile-store.d.ts +2 -2
- package/lib/profile-store.js +8 -1
- package/lib/profile-types.d.ts +1 -0
- package/lib/role-invocation.d.ts +1 -1
- package/lib/role-invocation.js +2 -2
- package/lib/role-subagents.js +16 -3
- package/lib/skills.d.ts +1 -0
- package/lib/skills.js +5 -1
- package/package.json +41 -33
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-gateway@0.2.1-rc.2.patch +13291 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-remotes@0.2.1-rc.2.patch +9133 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-client-ui-approval@0.2.1-rc.2.patch +156 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-subagent@0.2.1-rc.2.patch +3546 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-user-approval@0.2.1-rc.2.patch +431 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-web@0.2.1-rc.2.patch +119 -0
- package/patches/dsh-approval-settlement/README.md +41 -0
- package/patches/dsh-approval-settlement/metadata.json +10 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-loop@0.2.1-rc.2.patch +383 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-preset-registry@0.2.1-rc.2.patch +55 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-api-session-controller@0.2.1-rc.2.patch +16673 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-subagent@0.2.1-rc.2.patch +29 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-workspace@0.2.1-rc.2.patch +196 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence-jsonl@0.2.1-rc.2.patch +35 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence@0.2.1-rc.2.patch +40 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { isDeepStrictEqual } from "node:util";
|
|
3
|
+
import { Service, symbols } from "@deepseek-ai/cordis";
|
|
4
|
+
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
5
|
+
import { scopeLifetime } from "./lifetime.js";
|
|
6
|
+
import { historyJson, historySessionId, parseHistoryChoices, parseHistoryConfirmRequest, parseHistoryPreview, parseHistoryPreviewRequest } from "./history-codec.js";
|
|
7
|
+
export class HistoryRefusal extends Error {
|
|
8
|
+
code;
|
|
9
|
+
storageEffects;
|
|
10
|
+
constructor(code, storageEffects = "none") {
|
|
11
|
+
super(`History continuation refused: ${code}`);
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.storageEffects = storageEffects;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function original(value) { return Reflect.get(value, symbols.original) ?? value; }
|
|
17
|
+
/** Host-only one-operation intents around the native history and activation APIs. */
|
|
18
|
+
export class HistoryContinuations extends Service {
|
|
19
|
+
candidates;
|
|
20
|
+
admission;
|
|
21
|
+
lifetime = new AbortController();
|
|
22
|
+
intents = new Map();
|
|
23
|
+
prepared = new WeakMap();
|
|
24
|
+
guardedLoop;
|
|
25
|
+
cleanups = new Set();
|
|
26
|
+
constructor(ctx, candidates, admission) {
|
|
27
|
+
super(ctx, "dsmmHistoryContinuation");
|
|
28
|
+
this.candidates = candidates;
|
|
29
|
+
this.admission = admission;
|
|
30
|
+
ctx.effect(() => async () => { await Promise.all(this.cleanups); }, "dsmm: release history preparations");
|
|
31
|
+
const loop = ctx.get("agentLoop");
|
|
32
|
+
if (typeof loop?.requireActivationAdmission === "function" && typeof loop.registerActivationGuard === "function") {
|
|
33
|
+
loop.requireActivationAdmission();
|
|
34
|
+
ctx.effect(() => {
|
|
35
|
+
const remove = loop.registerActivationGuard(request => this.authorize(request));
|
|
36
|
+
this.guardedLoop = original(loop);
|
|
37
|
+
return () => { this.guardedLoop = undefined; remove(); };
|
|
38
|
+
}, "dsmm: history activation admission");
|
|
39
|
+
}
|
|
40
|
+
const controller = ctx.get("sessionController");
|
|
41
|
+
if (typeof controller?.registerHistoryOpenGuard === "function") {
|
|
42
|
+
const owner = original(controller);
|
|
43
|
+
ctx.effect(() => controller.registerHistoryOpenGuard({
|
|
44
|
+
signal: AbortSignal.any([this.lifetime.signal, admission.lifetime.signal, candidates.signal]),
|
|
45
|
+
assertCurrent: () => {
|
|
46
|
+
this.ready();
|
|
47
|
+
if (original(this.ctx.sessionController) !== owner)
|
|
48
|
+
throw new HistoryRefusal("unsupported-host");
|
|
49
|
+
},
|
|
50
|
+
}), "dsmm: history opening readiness");
|
|
51
|
+
}
|
|
52
|
+
scopeLifetime(ctx, "dsmm: revoke history intents", () => {
|
|
53
|
+
this.lifetime.abort();
|
|
54
|
+
for (const intent of this.intents.values()) {
|
|
55
|
+
try {
|
|
56
|
+
this.release(intent);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
ctx.logger.error(error);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
compatibility() {
|
|
65
|
+
const loop = this.ctx.get("agentLoop"), controller = this.ctx.get("sessionController");
|
|
66
|
+
if (typeof loop?.registerActivationGuard !== "function" || this.guardedLoop === undefined || original(loop) !== original(this.guardedLoop) || typeof loop.activationState !== "function"
|
|
67
|
+
|| typeof controller?.activateSession !== "function" || controller.activateOnFollow !== false)
|
|
68
|
+
return "unsupported-host";
|
|
69
|
+
if (this.ctx.get("sessionPersistence")?.writeAdmission?.lockedInspection !== 1)
|
|
70
|
+
return "unsupported-backend";
|
|
71
|
+
if (!this.admission.isReady || this.admission.lifetime.signal.aborted || this.candidates.signal.aborted || this.lifetime.signal.aborted)
|
|
72
|
+
return "unavailable";
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
visible(id, operator) {
|
|
76
|
+
operator.assertCurrent();
|
|
77
|
+
operator.assertVisible(id);
|
|
78
|
+
}
|
|
79
|
+
ready() { const reason = this.compatibility(); if (reason)
|
|
80
|
+
throw new HistoryRefusal(reason); }
|
|
81
|
+
async compatible() {
|
|
82
|
+
const reason = this.compatibility();
|
|
83
|
+
if (reason)
|
|
84
|
+
return reason;
|
|
85
|
+
try {
|
|
86
|
+
await this.candidates.checkCompatibility?.();
|
|
87
|
+
return this.compatibility();
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
return historyFailure(error).code;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async describe(input, operator) {
|
|
94
|
+
const sessionId = historySessionId(input);
|
|
95
|
+
this.visible(sessionId, operator);
|
|
96
|
+
const reason = await this.compatible();
|
|
97
|
+
let child = false;
|
|
98
|
+
try {
|
|
99
|
+
const observation = await this.ctx.sessionQuery.observeSession(SessionId(sessionId), { signal: operator.signal, projectionMode: "none" });
|
|
100
|
+
try {
|
|
101
|
+
child = observation.header.origin === "subagent";
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
observation[Symbol.dispose]();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
this.visible(sessionId, operator);
|
|
109
|
+
return { sessionId, readable: "unavailable", execution: "unavailable", compatibleHost: reason !== "unsupported-host", reason: reason ?? "format-unavailable" };
|
|
110
|
+
}
|
|
111
|
+
this.visible(sessionId, operator);
|
|
112
|
+
if (reason || child)
|
|
113
|
+
return { sessionId, readable: "readable", execution: "unavailable", compatibleHost: reason !== "unsupported-host", reason: reason ?? "child-owner-required" };
|
|
114
|
+
const state = this.ctx.agentLoop.activationState(SessionId(sessionId));
|
|
115
|
+
const live = this.ctx.agents.get(SessionId(sessionId));
|
|
116
|
+
return { sessionId, readable: "readable", compatibleHost: true,
|
|
117
|
+
execution: state?.phase === "initializing" || [...this.intents.values()].some(intent => intent.request.sessionId === sessionId && intent.operation !== undefined) ? "activating"
|
|
118
|
+
: live && this.admission.get(live) ? "active" : live ? "unavailable" : "authorization-required", ...(live && !this.admission.get(live) ? { reason: "unavailable" } : {}) };
|
|
119
|
+
}
|
|
120
|
+
async choices(operator) {
|
|
121
|
+
operator.assertCurrent();
|
|
122
|
+
this.ready();
|
|
123
|
+
await this.candidates.checkCompatibility?.();
|
|
124
|
+
operator.assertCurrent();
|
|
125
|
+
this.ready();
|
|
126
|
+
const result = await this.candidates.choices(operator.signal);
|
|
127
|
+
operator.assertCurrent();
|
|
128
|
+
this.ready();
|
|
129
|
+
return parseHistoryChoices(result);
|
|
130
|
+
}
|
|
131
|
+
async preview(input, operator) {
|
|
132
|
+
const request = parseHistoryPreviewRequest(input), sessionId = SessionId(request.sessionId);
|
|
133
|
+
this.visible(sessionId, operator);
|
|
134
|
+
this.ready();
|
|
135
|
+
await this.candidates.checkCompatibility?.();
|
|
136
|
+
this.visible(sessionId, operator);
|
|
137
|
+
this.ready();
|
|
138
|
+
if (this.ctx.agents.get(sessionId) || this.ctx.agentLoop.activationState(sessionId))
|
|
139
|
+
throw new HistoryRefusal("busy");
|
|
140
|
+
const persistence = this.ctx.sessionPersistence, controller = this.ctx.sessionController;
|
|
141
|
+
const stat = await persistence.stat(sessionId, { signal: operator.signal });
|
|
142
|
+
this.visible(sessionId, operator);
|
|
143
|
+
this.ready();
|
|
144
|
+
if (!stat)
|
|
145
|
+
throw new HistoryRefusal("not-found");
|
|
146
|
+
const observation = await this.ctx.sessionQuery.observeSession(sessionId, { signal: operator.signal, projectionMode: "all" });
|
|
147
|
+
let inspection, pending;
|
|
148
|
+
try {
|
|
149
|
+
if (observation.source !== "prepared")
|
|
150
|
+
throw new HistoryRefusal("busy");
|
|
151
|
+
if (observation.header.origin === "subagent")
|
|
152
|
+
throw new HistoryRefusal("child-owner-required");
|
|
153
|
+
if (!observation.header.cwd)
|
|
154
|
+
throw new HistoryRefusal("unavailable");
|
|
155
|
+
const inbox = observation.projections?.values.inbox;
|
|
156
|
+
if (!inbox)
|
|
157
|
+
throw new HistoryRefusal("unsupported-host");
|
|
158
|
+
inspection = structuredClone({ meta: observation.header, inheritedEventCount: observation.inheritedEventCount, events: [...observation.events] });
|
|
159
|
+
pending = { nextTurn: inbox["next-turn"].map(value => historyJson(value)), nextStep: inbox["next-step"].map(value => historyJson(value)) };
|
|
160
|
+
}
|
|
161
|
+
finally {
|
|
162
|
+
observation[Symbol.dispose]();
|
|
163
|
+
}
|
|
164
|
+
this.visible(sessionId, operator);
|
|
165
|
+
this.ready();
|
|
166
|
+
const candidate = await this.candidates.prepare(Object.freeze(request), structuredClone(inspection), operator.signal);
|
|
167
|
+
let intent;
|
|
168
|
+
try {
|
|
169
|
+
this.visible(sessionId, operator);
|
|
170
|
+
this.ready();
|
|
171
|
+
candidate.assertCurrent();
|
|
172
|
+
if (candidate.view.preset.id !== request.preset || (candidate.view.profile?.id ?? null) !== request.profileId
|
|
173
|
+
|| !isDeepStrictEqual(candidate.view.model, candidate.model))
|
|
174
|
+
throw new HistoryRefusal("stale");
|
|
175
|
+
for (const previous of this.intents.values())
|
|
176
|
+
if (previous.operator.peer === operator.peer && previous.request.sessionId === sessionId) {
|
|
177
|
+
if (previous.operation)
|
|
178
|
+
throw new HistoryRefusal("busy");
|
|
179
|
+
this.release(previous);
|
|
180
|
+
}
|
|
181
|
+
const abort = new AbortController();
|
|
182
|
+
const signal = AbortSignal.any([abort.signal, operator.peerSignal, this.lifetime.signal, this.admission.lifetime.signal, this.candidates.signal, candidate.signal]);
|
|
183
|
+
const expired = () => { if (intent && !intent.operation)
|
|
184
|
+
this.release(intent); };
|
|
185
|
+
intent = { id: randomUUID(), request, operator, inspection, persistence, persistenceIdentity: persistence.identity, controller, candidate, view: structuredClone(candidate.view), model: structuredClone(candidate.model), migrationRequired: stat.formatStatus === "migration-required", signal, abort,
|
|
186
|
+
detach: () => signal.removeEventListener("abort", expired), effects: "none" };
|
|
187
|
+
this.intents.set(intent.id, intent);
|
|
188
|
+
signal.addEventListener("abort", expired, { once: true });
|
|
189
|
+
this.check(intent);
|
|
190
|
+
return parseHistoryPreview({ sessionId, intentId: intent.id, cwd: inspection.meta.cwd, candidate: intent.view, migrationRequired: intent.migrationRequired, pending });
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
if (intent)
|
|
194
|
+
this.release(intent);
|
|
195
|
+
else
|
|
196
|
+
await candidate.dispose();
|
|
197
|
+
throw error;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
check(intent) {
|
|
201
|
+
if (intent.signal.aborted)
|
|
202
|
+
throw new HistoryRefusal("cancelled", intent.effects);
|
|
203
|
+
intent.operator.assertOwner();
|
|
204
|
+
this.ready();
|
|
205
|
+
if (this.intents.get(intent.id) !== intent || original(this.ctx.sessionPersistence) !== original(intent.persistence) || this.ctx.sessionPersistence.identity !== intent.persistenceIdentity
|
|
206
|
+
|| original(this.ctx.sessionController) !== original(intent.controller))
|
|
207
|
+
throw new HistoryRefusal("stale", intent.effects);
|
|
208
|
+
intent.operator.assertVisible(intent.request.sessionId);
|
|
209
|
+
if (!isDeepStrictEqual(intent.candidate.view, intent.view) || !isDeepStrictEqual(intent.candidate.model, intent.model))
|
|
210
|
+
throw new HistoryRefusal("stale", intent.effects);
|
|
211
|
+
intent.candidate.assertCurrent();
|
|
212
|
+
}
|
|
213
|
+
/** Called only by NativeAdmission.created for the exact unpublished continuation candidate. */
|
|
214
|
+
admissionForCreated(agent) {
|
|
215
|
+
const intent = this.prepared.get(agent);
|
|
216
|
+
if (!intent)
|
|
217
|
+
return undefined;
|
|
218
|
+
this.check(intent);
|
|
219
|
+
if (intent.agent !== agent || agent.id !== intent.request.sessionId || agent.session.header.origin === "subagent")
|
|
220
|
+
throw new HistoryRefusal("not-owned", intent.effects);
|
|
221
|
+
return intent.candidate.admission;
|
|
222
|
+
}
|
|
223
|
+
authorize(request) {
|
|
224
|
+
const intent = [...this.intents.values()].find(row => row.options === request.options);
|
|
225
|
+
if (!intent || request.parentAgent || !request.processPending || request.sessionId !== intent.request.sessionId || request.setup !== intent.options?.setup
|
|
226
|
+
|| original(request.persistence) !== original(intent.persistence) || request.persistence.identity !== intent.persistenceIdentity || original(request.owner.fiber) !== intent.nativeOwner)
|
|
227
|
+
throw new HistoryRefusal("authorization-required");
|
|
228
|
+
const check = () => { request.signal.throwIfAborted(); this.check(intent); };
|
|
229
|
+
check();
|
|
230
|
+
return {
|
|
231
|
+
assertCurrent: check,
|
|
232
|
+
validateLoaded: loaded => {
|
|
233
|
+
check();
|
|
234
|
+
if (!isDeepStrictEqual({ meta: loaded.meta, inheritedEventCount: loaded.inheritedEventCount, events: loaded.events }, intent.inspection)
|
|
235
|
+
|| loaded.migrationRequired !== intent.migrationRequired)
|
|
236
|
+
throw new HistoryRefusal("stale");
|
|
237
|
+
intent.effects = "may-have-committed";
|
|
238
|
+
},
|
|
239
|
+
validatePublish: agent => {
|
|
240
|
+
check();
|
|
241
|
+
if (this.prepared.get(agent) !== intent || intent.agent !== agent)
|
|
242
|
+
throw new HistoryRefusal("not-owned", intent.effects);
|
|
243
|
+
if (this.ctx.agents.get(agent.id) === agent && this.admission.assert(agent) !== intent.candidate.admission)
|
|
244
|
+
throw new HistoryRefusal("stale", intent.effects);
|
|
245
|
+
},
|
|
246
|
+
dispose() { },
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
confirm(input, operator) {
|
|
250
|
+
const request = parseHistoryConfirmRequest(input), intent = this.intents.get(request.intentId);
|
|
251
|
+
this.visible(request.sessionId, operator);
|
|
252
|
+
this.ready();
|
|
253
|
+
if (!intent || intent.request.sessionId !== request.sessionId || intent.operator.peer !== operator.peer || intent.operator.connection !== operator.connection)
|
|
254
|
+
throw new HistoryRefusal("authorization-required");
|
|
255
|
+
try {
|
|
256
|
+
this.check(intent);
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
if (!intent.operation)
|
|
260
|
+
this.release(intent);
|
|
261
|
+
throw error;
|
|
262
|
+
}
|
|
263
|
+
if (!request.processPending || intent.migrationRequired && !request.acceptMigration)
|
|
264
|
+
throw new HistoryRefusal("authorization-required");
|
|
265
|
+
if (intent.operation)
|
|
266
|
+
return intent.operation;
|
|
267
|
+
const signal = AbortSignal.any([operator.signal, intent.signal]);
|
|
268
|
+
const operation = (async () => {
|
|
269
|
+
let committed = false;
|
|
270
|
+
try {
|
|
271
|
+
await intent.candidate.revalidate(signal);
|
|
272
|
+
operator.assertCurrent();
|
|
273
|
+
this.check(intent);
|
|
274
|
+
const activation = {
|
|
275
|
+
sessionId: SessionId(request.sessionId), agentPreset: intent.request.preset, modelSelection: intent.model,
|
|
276
|
+
agentOptions: { provider: intent.model.provider, model: intent.model.model }, signal, processPending: true,
|
|
277
|
+
authorize: (options, owner) => { operator.assertCurrent(); this.check(intent); intent.options = options; intent.nativeOwner = original(owner.fiber); },
|
|
278
|
+
setup: async (_ctx, agent) => {
|
|
279
|
+
operator.assertCurrent();
|
|
280
|
+
this.check(intent);
|
|
281
|
+
intent.agent = agent;
|
|
282
|
+
this.prepared.set(agent, intent);
|
|
283
|
+
await intent.candidate.install(agent, signal);
|
|
284
|
+
operator.assertCurrent();
|
|
285
|
+
this.check(intent);
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
await intent.controller.activateSession(activation);
|
|
289
|
+
committed = true;
|
|
290
|
+
return { sessionId: request.sessionId, execution: "active" };
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
throw new HistoryRefusal(historyFailure(error).code, intent.effects);
|
|
294
|
+
}
|
|
295
|
+
finally {
|
|
296
|
+
this.release(intent, !committed);
|
|
297
|
+
}
|
|
298
|
+
})();
|
|
299
|
+
intent.operation = operation;
|
|
300
|
+
return operation;
|
|
301
|
+
}
|
|
302
|
+
release(intent, abort = true) {
|
|
303
|
+
if (this.intents.get(intent.id) !== intent)
|
|
304
|
+
return;
|
|
305
|
+
this.intents.delete(intent.id);
|
|
306
|
+
intent.detach();
|
|
307
|
+
if (abort)
|
|
308
|
+
intent.abort.abort();
|
|
309
|
+
if (intent.agent)
|
|
310
|
+
this.prepared.delete(intent.agent);
|
|
311
|
+
const result = intent.candidate.dispose();
|
|
312
|
+
if (result) {
|
|
313
|
+
const cleanup = Promise.resolve(result);
|
|
314
|
+
this.cleanups.add(cleanup);
|
|
315
|
+
void cleanup.then(() => this.cleanups.delete(cleanup), error => { this.ctx.logger.error(error); this.cleanups.delete(cleanup); });
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
export function historyFailure(error) {
|
|
320
|
+
if (error instanceof HistoryRefusal)
|
|
321
|
+
return { code: error.code, storageEffects: error.storageEffects };
|
|
322
|
+
if (error instanceof TypeError)
|
|
323
|
+
return { code: "validation", storageEffects: "none" };
|
|
324
|
+
const category = error && typeof error === "object" ? Reflect.get(error, "category") : undefined;
|
|
325
|
+
const code = category === "initializing" ? "busy" : category === "stale" || category === "cancelled" || category === "unsupported-backend" || category === "authorization-required" ? category
|
|
326
|
+
: error instanceof Error && error.name === "SessionAlreadyOwnedError" ? "busy" : error instanceof Error && error.name === "AbortError" ? "cancelled" : "initialization-failed";
|
|
327
|
+
return { code, storageEffects: "none" };
|
|
328
|
+
}
|
|
329
|
+
//# sourceMappingURL=history-controller.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DsmmGitWritePolicy, DsmmSettings } from "./settings.js";
|
|
2
|
+
/** The DSMM Git guard for the candidate's effective mode, not a grant from other policy layers. */
|
|
3
|
+
export declare function effectiveHistoryGitWriteGuard(settings: DsmmSettings, nativeFullAccess: boolean, deepworkActive: boolean): DsmmGitWritePolicy;
|
|
4
|
+
//# sourceMappingURL=history-policy.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The DSMM Git guard for the candidate's effective mode, not a grant from other policy layers. */
|
|
2
|
+
export function effectiveHistoryGitWriteGuard(settings, nativeFullAccess, deepworkActive) {
|
|
3
|
+
const inScope = settings.guards.scope === "always" || settings.guards.scope !== "off" && deepworkActive;
|
|
4
|
+
if (!inScope || nativeFullAccess && settings.guards.gitWriteGuard !== "deny")
|
|
5
|
+
return "off";
|
|
6
|
+
return settings.guards.gitWriteGuard;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=history-policy.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RemoteResult, TypertRemoteContribution } from "@deepseek-ai/dsh-typert-protocol";
|
|
2
|
+
import type { TypertContribution } from "@deepseek-ai/dsh-typert-registry";
|
|
3
|
+
import type { HistoryChoices, HistoryConfirmRequest, HistoryContinuationResult, HistoryFailure, HistoryPreview, HistoryPreviewRequest, HistoryStatus } from "./history-types.js";
|
|
4
|
+
import { parseHistoryFailure } from "./history-codec.js";
|
|
5
|
+
export interface DsmmHistoryRemote {
|
|
6
|
+
describe(sessionId: string): Promise<RemoteResult<HistoryStatus>>;
|
|
7
|
+
choices(): Promise<RemoteResult<HistoryChoices>>;
|
|
8
|
+
preview(sessionId: string, request: HistoryPreviewRequest): Promise<RemoteResult<HistoryPreview>>;
|
|
9
|
+
confirm(sessionId: string, request: HistoryConfirmRequest): Promise<RemoteResult<HistoryContinuationResult>>;
|
|
10
|
+
}
|
|
11
|
+
declare module "@deepseek-ai/dsh-typert-protocol/types" {
|
|
12
|
+
interface TypertRemoteMap {
|
|
13
|
+
"dsmmHistory/describe": DsmmHistoryRemote["describe"];
|
|
14
|
+
"dsmmHistory/choices": DsmmHistoryRemote["choices"];
|
|
15
|
+
"dsmmHistory/preview": DsmmHistoryRemote["preview"];
|
|
16
|
+
"dsmmHistory/confirm": DsmmHistoryRemote["confirm"];
|
|
17
|
+
}
|
|
18
|
+
interface TypertRemoteNamespaceMap {
|
|
19
|
+
dsmmHistory: DsmmHistoryRemote;
|
|
20
|
+
}
|
|
21
|
+
interface RemoteErrorDetailsMap {
|
|
22
|
+
"dsmm-history/refused": HistoryFailure;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export declare const HISTORY_REMOTE: TypertRemoteContribution;
|
|
26
|
+
export declare const HISTORY_HOST: TypertContribution;
|
|
27
|
+
export { parseHistoryFailure };
|
|
28
|
+
//# sourceMappingURL=history-remote.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { historyJson, historySessionId, parseHistoryChoices, parseHistoryConfirmRequest, parseHistoryFailure, parseHistoryPreview, parseHistoryPreviewRequest, parseHistoryResult, parseHistoryStatus } from "./history-codec.js";
|
|
2
|
+
function codec(name, parse) {
|
|
3
|
+
return { mode: "strict", typeSymbol: `@dsmm/dsmm#${name}`, create: () => ({ parse: value => parse(historyJson(value)) }) };
|
|
4
|
+
}
|
|
5
|
+
function descriptor(method, result, request, session = true) {
|
|
6
|
+
return { id: `@dsmm/dsmm-history#dsmmHistory/${method}`, service: "dsmmHistory", namespace: "dsmmHistory", method, invocation: { kind: "direct" },
|
|
7
|
+
parameters: [...session ? [{ name: "sessionId", wire: "sessionId", source: "json", codec: codec("HistorySessionId", historySessionId) }] : [], ...request ? [{ name: "request", wire: "request", source: "json", codec: request }] : []], result };
|
|
8
|
+
}
|
|
9
|
+
export const HISTORY_REMOTE = { package: "@dsmm/dsmm-history", descriptors: [
|
|
10
|
+
descriptor("describe", codec("HistoryStatus", parseHistoryStatus)),
|
|
11
|
+
descriptor("choices", codec("HistoryChoices", parseHistoryChoices), undefined, false),
|
|
12
|
+
descriptor("preview", codec("HistoryPreview", parseHistoryPreview), codec("HistoryPreviewRequest", parseHistoryPreviewRequest)),
|
|
13
|
+
descriptor("confirm", codec("HistoryContinuationResult", parseHistoryResult), codec("HistoryConfirmRequest", parseHistoryConfirmRequest)),
|
|
14
|
+
] };
|
|
15
|
+
export const HISTORY_HOST = { package: HISTORY_REMOTE.package, face: "host", schemas: [], model: { services: [], events: [], objects: [] }, invocations: HISTORY_REMOTE.descriptors };
|
|
16
|
+
export { parseHistoryFailure };
|
|
17
|
+
//# sourceMappingURL=history-remote.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import { TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
3
|
+
import { HistoryContinuations } from "./history-controller.js";
|
|
4
|
+
import type { HistoryCandidates, HistoryNativeAdmission } from "./history-contract.js";
|
|
5
|
+
import type { HistoryChoices, HistoryConfirmRequest, HistoryContinuationResult, HistoryPreview, HistoryPreviewRequest, HistoryStatus } from "./history-types.js";
|
|
6
|
+
/** Native authenticated local-operator RPC; browser payloads carry no admission authority. */
|
|
7
|
+
export declare class DsmmHistoryHost extends TypertRemoteService {
|
|
8
|
+
private readonly history;
|
|
9
|
+
private readonly lifetime;
|
|
10
|
+
constructor(ctx: Context, history: HistoryContinuations);
|
|
11
|
+
private operator;
|
|
12
|
+
private invoke;
|
|
13
|
+
describe(sessionId: string): Promise<HistoryStatus>;
|
|
14
|
+
choices(): Promise<HistoryChoices>;
|
|
15
|
+
preview(sessionId: string, input: HistoryPreviewRequest): Promise<HistoryPreview>;
|
|
16
|
+
confirm(sessionId: string, input: HistoryConfirmRequest): Promise<HistoryContinuationResult>;
|
|
17
|
+
}
|
|
18
|
+
declare module "@deepseek-ai/cordis" {
|
|
19
|
+
interface Context {
|
|
20
|
+
dsmmHistory: DsmmHistoryHost;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export declare function registerHistoryContinuationRpc(ctx: Context, candidates: HistoryCandidates, admission: HistoryNativeAdmission): DsmmHistoryHost;
|
|
24
|
+
//# sourceMappingURL=history-rpc.d.ts.map
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
import { getTraceable, symbols } from "@deepseek-ai/cordis";
|
|
36
|
+
import { RemoteAccessService } from "@deepseek-ai/dsh-api-remote-access";
|
|
37
|
+
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
38
|
+
import { Remote, RemoteError, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
39
|
+
import { assertLocalSettingsOperator } from "./profile-rpc.js";
|
|
40
|
+
import { scopeLifetime } from "./lifetime.js";
|
|
41
|
+
import { HistoryContinuations, HistoryRefusal, historyFailure } from "./history-controller.js";
|
|
42
|
+
import { HISTORY_HOST } from "./history-remote.js";
|
|
43
|
+
import { historySessionId, parseHistoryConfirmRequest, parseHistoryFailure, parseHistoryPreviewRequest } from "./history-codec.js";
|
|
44
|
+
/** Native authenticated local-operator RPC; browser payloads carry no admission authority. */
|
|
45
|
+
let DsmmHistoryHost = (() => {
|
|
46
|
+
let _classSuper = TypertRemoteService;
|
|
47
|
+
let _instanceExtraInitializers = [];
|
|
48
|
+
let _describe_decorators;
|
|
49
|
+
let _choices_decorators;
|
|
50
|
+
let _preview_decorators;
|
|
51
|
+
let _confirm_decorators;
|
|
52
|
+
return class DsmmHistoryHost extends _classSuper {
|
|
53
|
+
static {
|
|
54
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
55
|
+
_describe_decorators = [Remote];
|
|
56
|
+
_choices_decorators = [Remote];
|
|
57
|
+
_preview_decorators = [Remote];
|
|
58
|
+
_confirm_decorators = [Remote];
|
|
59
|
+
__esDecorate(this, null, _describe_decorators, { kind: "method", name: "describe", static: false, private: false, access: { has: obj => "describe" in obj, get: obj => obj.describe }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
60
|
+
__esDecorate(this, null, _choices_decorators, { kind: "method", name: "choices", static: false, private: false, access: { has: obj => "choices" in obj, get: obj => obj.choices }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
61
|
+
__esDecorate(this, null, _preview_decorators, { kind: "method", name: "preview", static: false, private: false, access: { has: obj => "preview" in obj, get: obj => obj.preview }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
62
|
+
__esDecorate(this, null, _confirm_decorators, { kind: "method", name: "confirm", static: false, private: false, access: { has: obj => "confirm" in obj, get: obj => obj.confirm }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
63
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
64
|
+
}
|
|
65
|
+
history = __runInitializers(this, _instanceExtraInitializers);
|
|
66
|
+
lifetime = new AbortController();
|
|
67
|
+
constructor(ctx, history) {
|
|
68
|
+
super(ctx, "dsmmHistory");
|
|
69
|
+
this.history = history;
|
|
70
|
+
scopeLifetime(ctx, "dsmm: close history RPC", () => this.lifetime.abort());
|
|
71
|
+
}
|
|
72
|
+
operator() {
|
|
73
|
+
try {
|
|
74
|
+
assertLocalSettingsOperator(this.ctx);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
throw new HistoryRefusal("not-owned");
|
|
78
|
+
}
|
|
79
|
+
const ctx = this.ctx, invocation = ctx.invocation;
|
|
80
|
+
const connection = ctx.get("connection");
|
|
81
|
+
const owner = Reflect.get(connection, symbols.original) ?? connection;
|
|
82
|
+
const peer = invocation.peer;
|
|
83
|
+
const signal = AbortSignal.any([invocation.signal, peer.signal, this.lifetime.signal]);
|
|
84
|
+
const assertOwner = () => {
|
|
85
|
+
this.lifetime.signal.throwIfAborted();
|
|
86
|
+
peer.signal.throwIfAborted();
|
|
87
|
+
const current = ctx.get("connection");
|
|
88
|
+
if (!current || (Reflect.get(current, symbols.original) ?? current) !== owner || current.browserPeer !== peer
|
|
89
|
+
|| ctx.get("webServer")?.host !== "127.0.0.1" || ctx.get("settings")?.writable !== true)
|
|
90
|
+
throw new HistoryRefusal("not-owned");
|
|
91
|
+
};
|
|
92
|
+
return { peer, connection: owner, peerSignal: peer.signal, signal, assertOwner,
|
|
93
|
+
assertCurrent: () => { signal.throwIfAborted(); assertOwner(); },
|
|
94
|
+
assertVisible: id => {
|
|
95
|
+
assertOwner();
|
|
96
|
+
const access = ctx.get("remoteAccess");
|
|
97
|
+
if (!(access instanceof RemoteAccessService) || !access.allows({ kind: "session", id: SessionId(id) }))
|
|
98
|
+
throw new HistoryRefusal("not-owned");
|
|
99
|
+
} };
|
|
100
|
+
}
|
|
101
|
+
async invoke(operation) {
|
|
102
|
+
try {
|
|
103
|
+
return await operation(getTraceable(this.ctx, this.history), this.operator());
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
throw new RemoteError("dsmm-history/refused", "The Host refused history continuation.", parseHistoryFailure(historyFailure(error)));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
describe(sessionId) { return this.invoke((history, operator) => history.describe(historySessionId(sessionId), operator)); }
|
|
110
|
+
choices() { return this.invoke((history, operator) => history.choices(operator)); }
|
|
111
|
+
preview(sessionId, input) {
|
|
112
|
+
return this.invoke((history, operator) => {
|
|
113
|
+
const request = parseHistoryPreviewRequest(input);
|
|
114
|
+
if (historySessionId(sessionId) !== request.sessionId)
|
|
115
|
+
throw new HistoryRefusal("validation");
|
|
116
|
+
return history.preview(request, operator);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
confirm(sessionId, input) {
|
|
120
|
+
return this.invoke((history, operator) => {
|
|
121
|
+
const request = parseHistoryConfirmRequest(input);
|
|
122
|
+
if (historySessionId(sessionId) !== request.sessionId)
|
|
123
|
+
throw new HistoryRefusal("validation");
|
|
124
|
+
return history.confirm(request, operator);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
})();
|
|
129
|
+
export { DsmmHistoryHost };
|
|
130
|
+
export function registerHistoryContinuationRpc(ctx, candidates, admission) {
|
|
131
|
+
const history = new HistoryContinuations(ctx, candidates, admission);
|
|
132
|
+
const host = new DsmmHistoryHost(ctx, history);
|
|
133
|
+
ctx.typert.register(HISTORY_HOST);
|
|
134
|
+
return host;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=history-rpc.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
/** Supply these native plugin configs before their constructors or configured restores run. */
|
|
3
|
+
export declare const DSMM_HISTORY_HOST_CONFIG: Readonly<{
|
|
4
|
+
agentLoop: Readonly<{
|
|
5
|
+
activationAdmissionRequired: true;
|
|
6
|
+
}>;
|
|
7
|
+
sessionController: Readonly<{
|
|
8
|
+
activateOnFollow: false;
|
|
9
|
+
}>;
|
|
10
|
+
}>;
|
|
11
|
+
/** Mount independently from the Core so failed configuration cannot reopen the Client gate. */
|
|
12
|
+
export declare function apply(ctx: Context): void;
|
|
13
|
+
/** A present patched loop becomes fail-closed before asynchronous DSMM configuration loading. */
|
|
14
|
+
export declare function requireHistoryAdmission(ctx: Context): void;
|
|
15
|
+
//# sourceMappingURL=history-support.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Supply these native plugin configs before their constructors or configured restores run. */
|
|
2
|
+
export const DSMM_HISTORY_HOST_CONFIG = Object.freeze({
|
|
3
|
+
agentLoop: Object.freeze({ activationAdmissionRequired: true }),
|
|
4
|
+
sessionController: Object.freeze({ activateOnFollow: false }),
|
|
5
|
+
});
|
|
6
|
+
/** Mount independently from the Core so failed configuration cannot reopen the Client gate. */
|
|
7
|
+
export function apply(ctx) {
|
|
8
|
+
requireHistoryAdmission(ctx);
|
|
9
|
+
ctx.events.on("webserver/index-inject", (rows) => {
|
|
10
|
+
rows.push({ kind: "global", name: "__DSMM_HISTORY_REQUIRED__", value: true });
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
/** A present patched loop becomes fail-closed before asynchronous DSMM configuration loading. */
|
|
14
|
+
export function requireHistoryAdmission(ctx) {
|
|
15
|
+
ctx.inject(["agentLoop"], scope => {
|
|
16
|
+
const loop = scope.agentLoop;
|
|
17
|
+
if (typeof loop.requireActivationAdmission === "function")
|
|
18
|
+
loop.requireActivationAdmission();
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=history-support.js.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** History content remains on the native list/page/follow and presentation surfaces. */
|
|
2
|
+
export type HistoryExecution = "authorization-required" | "activating" | "active" | "unavailable";
|
|
3
|
+
export type HistoryFailureCode = "validation" | "not-owned" | "not-found" | "unsupported-host" | "unsupported-backend" | "unavailable" | "busy" | "stale" | "cancelled" | "authorization-required" | "child-owner-required" | "format-unavailable" | "initialization-failed";
|
|
4
|
+
export interface HistoryFailure {
|
|
5
|
+
code: HistoryFailureCode;
|
|
6
|
+
storageEffects: "none" | "may-have-committed";
|
|
7
|
+
}
|
|
8
|
+
export interface HistoryStatus {
|
|
9
|
+
sessionId: string;
|
|
10
|
+
readable: "readable" | "unavailable";
|
|
11
|
+
execution: HistoryExecution;
|
|
12
|
+
compatibleHost: boolean;
|
|
13
|
+
reason?: HistoryFailureCode;
|
|
14
|
+
}
|
|
15
|
+
export interface HistoryChoice {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
}
|
|
19
|
+
export interface HistoryChoices {
|
|
20
|
+
presets: HistoryChoice[];
|
|
21
|
+
profiles: HistoryChoice[];
|
|
22
|
+
}
|
|
23
|
+
export interface HistoryPreviewRequest {
|
|
24
|
+
sessionId: string;
|
|
25
|
+
preset: string;
|
|
26
|
+
/** null selects the deployment baseline, not a historical session selection. */
|
|
27
|
+
profileId: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface HistoryConfirmRequest {
|
|
30
|
+
sessionId: string;
|
|
31
|
+
intentId: string;
|
|
32
|
+
processPending: boolean;
|
|
33
|
+
acceptMigration: boolean;
|
|
34
|
+
}
|
|
35
|
+
export type HistoryJson = null | boolean | number | string | HistoryJson[] | {
|
|
36
|
+
[key: string]: HistoryJson;
|
|
37
|
+
};
|
|
38
|
+
export interface HistoryCandidateView {
|
|
39
|
+
preset: HistoryChoice;
|
|
40
|
+
profile: HistoryChoice | null;
|
|
41
|
+
model: {
|
|
42
|
+
provider: string;
|
|
43
|
+
model: string;
|
|
44
|
+
reasoningEffort?: string;
|
|
45
|
+
};
|
|
46
|
+
roles: HistoryChoice[];
|
|
47
|
+
/** Current, effective restrictions from the trusted policy provider. */
|
|
48
|
+
restrictions: string[];
|
|
49
|
+
differences: string[];
|
|
50
|
+
}
|
|
51
|
+
export interface HistoryPreview {
|
|
52
|
+
sessionId: string;
|
|
53
|
+
intentId: string;
|
|
54
|
+
cwd: string;
|
|
55
|
+
candidate: HistoryCandidateView;
|
|
56
|
+
migrationRequired: boolean;
|
|
57
|
+
/** Native inbox projection, displayed as untrusted input and never replayed by DSMM. */
|
|
58
|
+
pending: {
|
|
59
|
+
nextTurn: HistoryJson[];
|
|
60
|
+
nextStep: HistoryJson[];
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface HistoryContinuationResult {
|
|
64
|
+
sessionId: string;
|
|
65
|
+
execution: "active";
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=history-types.d.ts.map
|