@dsh-enhanced/assistant-delivery 0.1.65 → 0.1.67

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.
Files changed (101) hide show
  1. package/README.md +128 -4
  2. package/lib/agent-runtime.d.ts +6 -2
  3. package/lib/agent-runtime.d.ts.map +1 -1
  4. package/lib/agent-runtime.js +60 -14
  5. package/lib/agent-runtime.js.map +1 -1
  6. package/lib/attention-audit-store.d.ts +54 -0
  7. package/lib/attention-audit-store.d.ts.map +1 -0
  8. package/lib/attention-audit-store.js +213 -0
  9. package/lib/attention-audit-store.js.map +1 -0
  10. package/lib/attention-enforcement.d.ts +75 -0
  11. package/lib/attention-enforcement.d.ts.map +1 -0
  12. package/lib/attention-enforcement.js +84 -0
  13. package/lib/attention-enforcement.js.map +1 -0
  14. package/lib/attention.d.ts +203 -0
  15. package/lib/attention.d.ts.map +1 -0
  16. package/lib/attention.js +288 -0
  17. package/lib/attention.js.map +1 -0
  18. package/lib/coordinator.d.ts.map +1 -1
  19. package/lib/coordinator.js +6 -0
  20. package/lib/coordinator.js.map +1 -1
  21. package/lib/feedback-command.d.ts +23 -0
  22. package/lib/feedback-command.d.ts.map +1 -1
  23. package/lib/feedback-command.js +176 -0
  24. package/lib/feedback-command.js.map +1 -1
  25. package/lib/foreground-observation.d.ts +21 -0
  26. package/lib/foreground-observation.d.ts.map +1 -1
  27. package/lib/foreground-observation.js.map +1 -1
  28. package/lib/foreground-termination.d.ts +31 -0
  29. package/lib/foreground-termination.d.ts.map +1 -0
  30. package/lib/foreground-termination.js +42 -0
  31. package/lib/foreground-termination.js.map +1 -0
  32. package/lib/in-process-reload-runtime.d.ts +87 -0
  33. package/lib/in-process-reload-runtime.d.ts.map +1 -0
  34. package/lib/in-process-reload-runtime.js +319 -0
  35. package/lib/in-process-reload-runtime.js.map +1 -0
  36. package/lib/index.d.ts +20 -6
  37. package/lib/index.d.ts.map +1 -1
  38. package/lib/index.js +9 -3
  39. package/lib/index.js.map +1 -1
  40. package/lib/native-termination.d.ts +12 -0
  41. package/lib/native-termination.d.ts.map +1 -0
  42. package/lib/native-termination.js +57 -0
  43. package/lib/native-termination.js.map +1 -0
  44. package/lib/native-web-owner.d.ts +7 -0
  45. package/lib/native-web-owner.d.ts.map +1 -1
  46. package/lib/native-web-owner.js +40 -10
  47. package/lib/native-web-owner.js.map +1 -1
  48. package/lib/operator-snapshot.d.ts +31 -3
  49. package/lib/operator-snapshot.d.ts.map +1 -1
  50. package/lib/operator-snapshot.js +120 -47
  51. package/lib/operator-snapshot.js.map +1 -1
  52. package/lib/progress-attention.d.ts +55 -0
  53. package/lib/progress-attention.d.ts.map +1 -0
  54. package/lib/progress-attention.js +128 -0
  55. package/lib/progress-attention.js.map +1 -0
  56. package/lib/service.d.ts +515 -4
  57. package/lib/service.d.ts.map +1 -1
  58. package/lib/service.js +2183 -130
  59. package/lib/service.js.map +1 -1
  60. package/lib/sqlite.d.ts +1 -1
  61. package/lib/sqlite.d.ts.map +1 -1
  62. package/lib/sqlite.js +102 -2
  63. package/lib/sqlite.js.map +1 -1
  64. package/lib/store.d.ts +113 -2
  65. package/lib/store.d.ts.map +1 -1
  66. package/lib/store.js +450 -39
  67. package/lib/store.js.map +1 -1
  68. package/lib/types.d.ts +175 -0
  69. package/lib/types.d.ts.map +1 -1
  70. package/lib/types.js.map +1 -1
  71. package/lib/version.d.ts +1 -1
  72. package/lib/version.js +1 -1
  73. package/lib/work-item-engineering-context.d.ts +127 -0
  74. package/lib/work-item-engineering-context.d.ts.map +1 -0
  75. package/lib/work-item-engineering-context.js +151 -0
  76. package/lib/work-item-engineering-context.js.map +1 -0
  77. package/lib/work-item-feedback-schema.d.ts +2 -0
  78. package/lib/work-item-feedback-schema.d.ts.map +1 -0
  79. package/lib/work-item-feedback-schema.js +29 -0
  80. package/lib/work-item-feedback-schema.js.map +1 -0
  81. package/lib/work-item-feedback-store.d.ts +29 -0
  82. package/lib/work-item-feedback-store.d.ts.map +1 -0
  83. package/lib/work-item-feedback-store.js +111 -0
  84. package/lib/work-item-feedback-store.js.map +1 -0
  85. package/lib/work-item-feedback.d.ts +157 -0
  86. package/lib/work-item-feedback.d.ts.map +1 -0
  87. package/lib/work-item-feedback.js +2 -0
  88. package/lib/work-item-feedback.js.map +1 -0
  89. package/lib/work-item-replies-schema.d.ts +3 -0
  90. package/lib/work-item-replies-schema.d.ts.map +1 -0
  91. package/lib/work-item-replies-schema.js +45 -0
  92. package/lib/work-item-replies-schema.js.map +1 -0
  93. package/lib/work-item-replies-store.d.ts +43 -0
  94. package/lib/work-item-replies-store.d.ts.map +1 -0
  95. package/lib/work-item-replies-store.js +203 -0
  96. package/lib/work-item-replies-store.js.map +1 -0
  97. package/lib/work-item-replies.d.ts +93 -0
  98. package/lib/work-item-replies.d.ts.map +1 -0
  99. package/lib/work-item-replies.js +15 -0
  100. package/lib/work-item-replies.js.map +1 -0
  101. package/package.json +24 -24
@@ -0,0 +1,87 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ export interface InProcessReloadRuntimeTarget {
3
+ package: string;
4
+ version: string;
5
+ artifactDigest: string;
6
+ patchDigest: string;
7
+ changesProcessSubtree: boolean;
8
+ holdsUnprovenProcessAuthority: boolean;
9
+ }
10
+ export interface InProcessReloadRuntimeProbe {
11
+ checks: number;
12
+ failures: number;
13
+ reloaded: boolean;
14
+ /** Fibers that reached DISPOSED. A config-only reload restarts in place: 0. */
15
+ fibersDisposed: number;
16
+ /** Local diagnostics for the failed assertion names; never part of the digest. */
17
+ failedChecks: string[];
18
+ probeDigest: string;
19
+ }
20
+ export interface InProcessReloadRuntimeActivationInput {
21
+ warrantDigest: string;
22
+ target: InProcessReloadRuntimeTarget;
23
+ previousHostGeneration: number;
24
+ previousInProcessGeneration: number;
25
+ }
26
+ export interface InProcessReloadRuntimeActivationResult {
27
+ previousHostGeneration: number;
28
+ currentHostGeneration: number;
29
+ previousInProcessGeneration: number;
30
+ currentInProcessGeneration: number;
31
+ probe: InProcessReloadRuntimeProbe;
32
+ }
33
+ export interface InProcessReloadRuntimeRollbackInput {
34
+ warrantDigest: string;
35
+ target: InProcessReloadRuntimeTarget;
36
+ reloadedInProcessGeneration: number;
37
+ }
38
+ export interface InProcessReloadRuntimeRollbackResult {
39
+ hostGeneration: number;
40
+ inProcessGeneration: number;
41
+ restored: boolean;
42
+ profileRestored: boolean;
43
+ probe: InProcessReloadRuntimeProbe;
44
+ }
45
+ /**
46
+ * Structurally identical to the control plane's `InProcessReloadHostPort`.
47
+ * `assistant-delivery` must not depend on `@dsh-enhanced/plugin-control-plane`
48
+ * (that would create a peer cycle), so the seam is mirrored here and the
49
+ * compatibility is asserted by the type-level test in
50
+ * `tests/in-process-reload-runtime.spec.ts`, not by a compiled import.
51
+ */
52
+ export interface InProcessReloadRuntime {
53
+ activate(input: InProcessReloadRuntimeActivationInput): Promise<InProcessReloadRuntimeActivationResult>;
54
+ rollback(input: InProcessReloadRuntimeRollbackInput): Promise<InProcessReloadRuntimeRollbackResult>;
55
+ snapshot(): {
56
+ hostGeneration: number;
57
+ inProcessGeneration: number;
58
+ };
59
+ }
60
+ export interface InProcessReloadRuntimeOptions {
61
+ /** Profile directory that owns `cordis.yml` (same value the runtime observer uses). */
62
+ profilePath: string;
63
+ /** Entry id inside the `include` tree, e.g. `candidate` or `include:candidate`. */
64
+ entryId: string;
65
+ /** Expected mounted package name for the entry. */
66
+ package: string;
67
+ /**
68
+ * Authoritative current Host *process* generation (for example from the Host
69
+ * attestation ledger). Required: the adapter must not invent it.
70
+ */
71
+ hostGeneration: () => number;
72
+ /**
73
+ * Optional caller-owned profile patch step applied *before* the include tree is
74
+ * re-read (for example renaming the staged profile into place).
75
+ */
76
+ apply?: () => Promise<void> | void;
77
+ /**
78
+ * Optional caller-owned restore step used by rollback. Without it, rollback
79
+ * reports `profileRestored: false` and the control plane keeps the plan in
80
+ * `rollback-pending`; there is no path that claims an unproven restore.
81
+ */
82
+ restore?: () => Promise<void> | void;
83
+ /** Reload/probe deadline. Clamped to `[1000, 120000]`. */
84
+ timeoutMs?: number;
85
+ }
86
+ export declare function createInProcessReloadRuntime(ctx: Context, options: InProcessReloadRuntimeOptions): InProcessReloadRuntime;
87
+ //# sourceMappingURL=in-process-reload-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-process-reload-runtime.d.ts","sourceRoot":"","sources":["../src/in-process-reload-runtime.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAgElD,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,qBAAqB,EAAE,OAAO,CAAA;IAC9B,6BAA6B,EAAE,OAAO,CAAA;CACvC;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,+EAA+E;IAC/E,cAAc,EAAE,MAAM,CAAA;IACtB,kFAAkF;IAClF,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,qCAAqC;IACpD,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,4BAA4B,CAAA;IACpC,sBAAsB,EAAE,MAAM,CAAA;IAC9B,2BAA2B,EAAE,MAAM,CAAA;CACpC;AAED,MAAM,WAAW,sCAAsC;IACrD,sBAAsB,EAAE,MAAM,CAAA;IAC9B,qBAAqB,EAAE,MAAM,CAAA;IAC7B,2BAA2B,EAAE,MAAM,CAAA;IACnC,0BAA0B,EAAE,MAAM,CAAA;IAClC,KAAK,EAAE,2BAA2B,CAAA;CACnC;AAED,MAAM,WAAW,mCAAmC;IAClD,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,4BAA4B,CAAA;IACpC,2BAA2B,EAAE,MAAM,CAAA;CACpC;AAED,MAAM,WAAW,oCAAoC;IACnD,cAAc,EAAE,MAAM,CAAA;IACtB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,QAAQ,EAAE,OAAO,CAAA;IACjB,eAAe,EAAE,OAAO,CAAA;IACxB,KAAK,EAAE,2BAA2B,CAAA;CACnC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,qCAAqC,GAAG,OAAO,CAAC,sCAAsC,CAAC,CAAA;IACvG,QAAQ,CAAC,KAAK,EAAE,mCAAmC,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAA;IACnG,QAAQ,IAAI;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,mBAAmB,EAAE,MAAM,CAAA;KAAE,CAAA;CACpE;AAED,MAAM,WAAW,6BAA6B;IAC5C,uFAAuF;IACvF,WAAW,EAAE,MAAM,CAAA;IACnB,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAA;IACf,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,cAAc,EAAE,MAAM,MAAM,CAAA;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAClC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACpC,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAwBD,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,6BAA6B,GAAG,sBAAsB,CAqOzH"}
@@ -0,0 +1,319 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { join } from 'node:path';
4
+ import { pathToFileURL } from 'node:url';
5
+ /**
6
+ * Host-side adapter for the control plane's in-process reload protocol.
7
+ *
8
+ * Scope, stated honestly:
9
+ *
10
+ * - It reloads the *mounted configuration* of a running Host process by
11
+ * re-reading the profile's Cordis Include file and letting the pinned Loader
12
+ * restart the changed entries (`include` subtree `refresh()`).
13
+ * - It does **not** replace installed plugin code. ESM module instances are
14
+ * cached by the pinned Loader, so a changed artifact (`lib/`) cannot be
15
+ * re-imported in-process; that stays a process-restart obligation of the
16
+ * existing `reload` attestation path. The control plane therefore refuses an
17
+ * in-process reload whose artifact digest differs from the mounted one.
18
+ * - It never claims success. Success requires a probe that observed a changed
19
+ * profile file, a restarted (same-uid) fiber with a rebuilt store, an
20
+ * unchanged loaded module instance, an unchanged process identity
21
+ * (pid/invocation id) and an unchanged Host generation. Any failed assertion
22
+ * is reported as `failures > 0`, which the control plane maps to
23
+ * `rollback-pending`.
24
+ *
25
+ * This module is inert: it is a factory that nothing in `apply()` registers, so
26
+ * the plugin's default behavior and `--dump-config` output do not change.
27
+ */
28
+ // Cordis 4.0.5 exports `FiberState` as an ambient const enum that is unavailable
29
+ // at runtime, so the numeric values are used directly.
30
+ const ACTIVE = 2;
31
+ const DIGEST = /^[a-f0-9]{64}$/u;
32
+ const DEFAULT_TIMEOUT_MS = 15_000;
33
+ const MAX_TIMEOUT_MS = 120_000;
34
+ function canonical(value) {
35
+ if (Array.isArray(value))
36
+ return `[${value.map(canonical).join(',')}]`;
37
+ if (typeof value === 'object' && value !== null) {
38
+ return `{${Object.entries(value).filter(([, item]) => item !== undefined)
39
+ .sort(([left], [right]) => left.localeCompare(right)).map(([key, item]) => `${JSON.stringify(key)}:${canonical(item)}`).join(',')}}`;
40
+ }
41
+ return JSON.stringify(value);
42
+ }
43
+ function digestOf(value) { return createHash('sha256').update(canonical(value)).digest('hex'); }
44
+ function fiberOf(entry) {
45
+ const fiber = entry?.fiber;
46
+ return fiber && typeof fiber === 'object' ? fiber : undefined;
47
+ }
48
+ function normalizeEntryId(entryId) {
49
+ const local = entryId.startsWith('include:') ? entryId.slice('include:'.length) : entryId;
50
+ if (!local || local.includes(':'))
51
+ throw new Error(`in-process reload entry id is invalid: ${entryId}`);
52
+ return local;
53
+ }
54
+ export function createInProcessReloadRuntime(ctx, options) {
55
+ const localEntryId = normalizeEntryId(options.entryId);
56
+ const profileFile = join(options.profilePath, 'cordis.yml');
57
+ const profileUrl = pathToFileURL(profileFile).href;
58
+ const timeoutMs = Math.min(MAX_TIMEOUT_MS, Math.max(1_000, options.timeoutMs ?? DEFAULT_TIMEOUT_MS));
59
+ const pid = process.pid;
60
+ const invocationId = /^[a-f0-9]{32}$/u.test(process.env.INVOCATION_ID ?? '') ? process.env.INVOCATION_ID : null;
61
+ let inProcessGeneration = 1;
62
+ function withDeadline(work) {
63
+ return new Promise((resolve, reject) => {
64
+ const timer = setTimeout(() => reject(new Error(`in-process reload exceeded its ${timeoutMs}ms deadline`)), timeoutMs);
65
+ void work().then(value => { clearTimeout(timer); resolve(value); }, error => { clearTimeout(timer); reject(error); });
66
+ });
67
+ }
68
+ function loader() {
69
+ const value = ctx.get('loader');
70
+ if (!value || typeof value.resolve !== 'function')
71
+ throw new Error('the Cordis Loader service is not available');
72
+ return value;
73
+ }
74
+ /**
75
+ * Resolve and verify the mounted include root and the target entry. This is the
76
+ * narrowest injection point: the include root is the only tree that owns the
77
+ * profile file, and the loader provider is re-resolved per call, never cached.
78
+ */
79
+ function resolveMount() {
80
+ const active = loader();
81
+ let root;
82
+ try {
83
+ root = active.resolve('include');
84
+ }
85
+ catch {
86
+ throw new Error('the Cordis include root is not mounted');
87
+ }
88
+ if (!root || typeof root !== 'object')
89
+ throw new Error('the Cordis include root is not mounted');
90
+ const rootEntry = root;
91
+ const tree = rootEntry.subtree;
92
+ if (rootEntry.options?.id !== 'include' || rootEntry.options.name !== 'cordis:include'
93
+ || rootEntry.parent !== active.root || !tree || tree.ctx?.fiber?.entry !== rootEntry) {
94
+ throw new Error('the Cordis include root is not the profile include tree');
95
+ }
96
+ const config = rootEntry.options.config;
97
+ const configuredPath = config && typeof config === 'object' && !Array.isArray(config)
98
+ ? config.path : undefined;
99
+ if (configuredPath !== profileUrl)
100
+ throw new Error('the Cordis include root is not bound to this profile');
101
+ const rootFiber = fiberOf(rootEntry);
102
+ if (!rootFiber || rootFiber.state !== ACTIVE)
103
+ throw new Error('the Cordis include root is not active');
104
+ let target;
105
+ try {
106
+ target = active.resolve(`include:${localEntryId}`);
107
+ }
108
+ catch {
109
+ throw new Error(`the target entry ${localEntryId} is not mounted`);
110
+ }
111
+ if (!target || typeof target !== 'object')
112
+ throw new Error(`the target entry ${localEntryId} is not mounted`);
113
+ const targetEntry = target;
114
+ if (targetEntry.options?.id !== localEntryId || targetEntry.parent !== tree.root) {
115
+ throw new Error(`the target entry ${localEntryId} is not a child of the include root`);
116
+ }
117
+ if (typeof targetEntry.options.name !== 'string' || targetEntry.options.name !== options.package) {
118
+ throw new Error(`the target entry ${localEntryId} is not mounted from ${options.package}`);
119
+ }
120
+ return { loader: active, root: rootEntry, tree, target: targetEntry };
121
+ }
122
+ async function profileDigest() {
123
+ return createHash('sha256').update(await readFile(profileFile)).digest('hex');
124
+ }
125
+ async function capture() {
126
+ const mount = resolveMount();
127
+ const fiber = fiberOf(mount.target);
128
+ if (!fiber)
129
+ throw new Error(`the target entry ${localEntryId} has no running fiber`);
130
+ return { mount, identity: {
131
+ fiber,
132
+ uid: fiber.uid, store: fiber.store ?? null, state: fiber.state,
133
+ moduleNamespace: mount.target.moduleNamespace, profileDigest: await profileDigest(),
134
+ pid, invocationId, hostGeneration: options.hostGeneration(),
135
+ } };
136
+ }
137
+ /**
138
+ * Re-resolve the mount and assert the post-reload facts. Every assertion is
139
+ * counted; `reloaded` is only true when a real replacement was observed.
140
+ */
141
+ async function probe(before, expectedHostGeneration) {
142
+ let checks = 0;
143
+ let failures = 0;
144
+ const failedChecks = [];
145
+ const bad = (check) => { checks += 1; failures += 1; failedChecks.push(check); };
146
+ const good = () => { checks += 1; };
147
+ const observations = {};
148
+ let after = null;
149
+ try {
150
+ const mount = resolveMount();
151
+ const fiber = fiberOf(mount.target);
152
+ const currentProfileDigest = await profileDigest();
153
+ const hostGeneration = options.hostGeneration();
154
+ after = {
155
+ fiber: fiber ?? before.fiber,
156
+ uid: fiber?.uid ?? null, store: fiber?.store ?? null, state: fiber?.state ?? -1,
157
+ moduleNamespace: mount.target.moduleNamespace, profileDigest: currentProfileDigest,
158
+ pid, invocationId, hostGeneration,
159
+ };
160
+ if (currentProfileDigest !== before.profileDigest)
161
+ good();
162
+ else
163
+ bad('profile-changed');
164
+ if (fiber !== undefined && fiber.state === ACTIVE)
165
+ good();
166
+ else
167
+ bad('fiber-active');
168
+ // A config-only reload restarts the same fiber in place: Cordis keeps the
169
+ // uid and rebuilds the store, so a *changed* uid would mean the entry was
170
+ // replaced by code this adapter cannot bind to an artifact digest.
171
+ if (fiber !== undefined && fiber.uid !== null && fiber.uid === before.uid)
172
+ good();
173
+ else
174
+ bad('fiber-preserved');
175
+ if (fiber !== undefined && fiber.store !== undefined && fiber.store !== null && fiber.store !== before.store)
176
+ good();
177
+ else
178
+ bad('store-rebuilt');
179
+ // Config-only scope: the mounted module code must be the same module
180
+ // instance, otherwise the reload would have replaced code that this
181
+ // adapter cannot bind to the authorized artifact digest.
182
+ if (mount.target.moduleNamespace === before.moduleNamespace)
183
+ good();
184
+ else
185
+ bad('module-reused');
186
+ if (hostGeneration === expectedHostGeneration && after.hostGeneration === expectedHostGeneration)
187
+ good();
188
+ else
189
+ bad('host-generation-unchanged');
190
+ if (before.hostGeneration === expectedHostGeneration)
191
+ good();
192
+ else
193
+ bad('host-generation-before');
194
+ if (pid === before.pid && invocationId === before.invocationId)
195
+ good();
196
+ else
197
+ bad('process-identity');
198
+ // The same fiber must still be the live mount; it was restarted, not replaced.
199
+ if (before.fiber.state === ACTIVE && fiber === before.fiber)
200
+ good();
201
+ else
202
+ bad('same-fiber-live');
203
+ observations.profileChanged = currentProfileDigest !== before.profileDigest;
204
+ observations.fiberPreserved = after.uid === before.uid;
205
+ observations.storeRebuilt = after.store !== before.store;
206
+ observations.moduleReused = mount.target.moduleNamespace === before.moduleNamespace;
207
+ observations.probe = { pid, invocationId, hostGeneration };
208
+ }
209
+ catch (error) {
210
+ bad('mount-resolvable');
211
+ observations.error = error instanceof Error ? error.message : String(error);
212
+ observations.probe = { pid, invocationId, hostGeneration: options.hostGeneration() };
213
+ }
214
+ // A config-only reload disposes effects and re-runs `apply` on the same fiber;
215
+ // no fiber reaches DISPOSED, so the count stays 0 and the restart is proven by
216
+ // the rebuilt store plus the recorded effect disposals in the caller's probe.
217
+ const fibersDisposed = 0;
218
+ const reloaded = after !== null && failures === 0
219
+ && after.profileDigest !== before.profileDigest
220
+ && after.store !== before.store && after.uid === before.uid && after.state === ACTIVE;
221
+ observations.before = { uid: before.uid, state: before.state, profileDigest: before.profileDigest };
222
+ observations.after = after === null ? null : { uid: after.uid, state: after.state, profileDigest: after.profileDigest };
223
+ observations.failedChecks = failedChecks;
224
+ observations.fibersDisposed = fibersDisposed;
225
+ observations.reloaded = reloaded;
226
+ return { probe: { checks, failures, reloaded, fibersDisposed, failedChecks, probeDigest: digestOf(observations) }, after };
227
+ }
228
+ async function refreshTree(mount) {
229
+ if (typeof mount.tree.refresh !== 'function')
230
+ throw new Error('the Cordis include tree does not expose refresh()');
231
+ await mount.tree.refresh();
232
+ // Await the tree's settled state so old fibers/disposers finish before the
233
+ // probe hands over any exclusive resource.
234
+ if (typeof mount.tree.await === 'function')
235
+ await mount.tree.await();
236
+ }
237
+ function assertTarget(target) {
238
+ if (target.package !== options.package)
239
+ throw new Error(`in-process reload target ${target.package} is not the mounted package ${options.package}`);
240
+ if (!DIGEST.test(target.artifactDigest) || !DIGEST.test(target.patchDigest))
241
+ throw new Error('in-process reload target digests are invalid');
242
+ if (target.changesProcessSubtree || target.holdsUnprovenProcessAuthority) {
243
+ throw new Error(`in-process reload target ${target.package} requires a process restart`);
244
+ }
245
+ }
246
+ return {
247
+ snapshot: () => ({ hostGeneration: options.hostGeneration(), inProcessGeneration }),
248
+ async activate(input) {
249
+ if (!DIGEST.test(input.warrantDigest))
250
+ throw new Error('in-process reload warrant digest is invalid');
251
+ assertTarget(input.target);
252
+ const currentHostGeneration = options.hostGeneration();
253
+ if (input.previousHostGeneration !== currentHostGeneration) {
254
+ throw new Error('in-process reload warrant is bound to another Host generation');
255
+ }
256
+ const before = await capture();
257
+ const observedGeneration = before.identity.hostGeneration;
258
+ if (observedGeneration !== input.previousHostGeneration)
259
+ throw new Error('in-process reload started across a Host generation change');
260
+ try {
261
+ await withDeadline(async () => {
262
+ if (options.apply)
263
+ await options.apply();
264
+ await refreshTree(before.mount);
265
+ });
266
+ }
267
+ catch (error) {
268
+ // The mount may be partially reloaded; report it as an attempted mount so
269
+ // the control plane transitions to rollback-pending instead of retrying.
270
+ inProcessGeneration += 1;
271
+ throw error;
272
+ }
273
+ inProcessGeneration += 1;
274
+ const { probe: result } = await probe(before.identity, input.previousHostGeneration);
275
+ return {
276
+ previousHostGeneration: before.identity.hostGeneration,
277
+ // The Host process generation is captured from the same authoritative
278
+ // source before and after; the probe asserts it did not move.
279
+ currentHostGeneration: options.hostGeneration(),
280
+ previousInProcessGeneration: input.previousInProcessGeneration,
281
+ currentInProcessGeneration: inProcessGeneration,
282
+ probe: result,
283
+ };
284
+ },
285
+ async rollback(input) {
286
+ if (!DIGEST.test(input.warrantDigest))
287
+ throw new Error('in-process reload warrant digest is invalid');
288
+ assertTarget(input.target);
289
+ const currentHostGeneration = options.hostGeneration();
290
+ const before = await capture();
291
+ if (before.identity.hostGeneration !== currentHostGeneration)
292
+ throw new Error('in-process rollback started across a Host generation change');
293
+ let profileRestored = false;
294
+ try {
295
+ await withDeadline(async () => {
296
+ if (options.restore) {
297
+ await options.restore();
298
+ profileRestored = true;
299
+ }
300
+ await refreshTree(before.mount);
301
+ });
302
+ }
303
+ catch (error) {
304
+ inProcessGeneration += 1;
305
+ throw error;
306
+ }
307
+ inProcessGeneration += 1;
308
+ const { probe: result } = await probe(before.identity, currentHostGeneration);
309
+ return {
310
+ hostGeneration: options.hostGeneration(),
311
+ inProcessGeneration,
312
+ restored: profileRestored && result.failures === 0 && result.reloaded,
313
+ profileRestored,
314
+ probe: result,
315
+ };
316
+ },
317
+ };
318
+ }
319
+ //# sourceMappingURL=in-process-reload-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-process-reload-runtime.js","sourceRoot":"","sources":["../src/in-process-reload-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAGxC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,iFAAiF;AACjF,uDAAuD;AACvD,MAAM,MAAM,GAAG,CAAC,CAAA;AAEhB,MAAM,MAAM,GAAG,iBAAiB,CAAA;AAChC,MAAM,kBAAkB,GAAG,MAAM,CAAA;AACjC,MAAM,cAAc,GAAG,OAAO,CAAA;AAyH9B,SAAS,SAAS,CAAC,KAAc;IAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;IACtE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC;aACjG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CA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AAI,MAAM,CAAC,QAAQ,CAAC,cAAc,KAAK,qBAAqB;gBAAE,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;YAC5I,IAAI,eAAe,GAAG,KAAK,CAAA;YAC3B,IAAI,CAAC;gBACH,MAAM,YAAY,CAAC,KAAK,IAAI,EAAE;oBAC5B,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;wBAAC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;wBAAC,eAAe,GAAG,IAAI,CAAA;oBAAC,CAAC;oBACxE,MAAM,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;gBACjC,CAAC,CAAC,CAAA;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,mBAAmB,IAAI,CAAC,CAAA;gBACxB,MAAM,KAAK,CAAA;YACb,CAAC;YACD,mBAAmB,IAAI,CAAC,CAAA;YACxB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAA;YAC7E,OAAO;gBACL,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE;gBACxC,mBAAmB;gBACnB,QAAQ,EAAE,eAAe,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,IAAI,MAAM,CAAC,QAAQ;gBACrE,eAAe;gBACf,KAAK,EAAE,MAAM;aACd,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
2
  import { DeliveryAdapterRegistryStoppedError } from './coordinator.js';
3
- import { AssistantDeliveryService, Config, isTrustedDeliveryPreferenceProducer } from './service.js';
3
+ import { AssistantDeliveryService, Config, isTrustedDeliveryPreferenceProducer, ownerNotificationReplyProtocol, ownerNotificationWithdrawalProtocol } from './service.js';
4
4
  import { version } from './version.js';
5
5
  export declare const name = "dsh-enhanced-assistant-delivery";
6
- export { AssistantDeliveryService, Config, DeliveryAdapterRegistryStoppedError, isTrustedDeliveryPreferenceProducer, version };
7
- export type { CommitOwnerAnchoredWorkflowTraceServiceResult, DeliveryInboundRuntime, OwnerForegroundLearningTask, } from './service.js';
6
+ export { AssistantDeliveryService, Config, DeliveryAdapterRegistryStoppedError, isTrustedDeliveryPreferenceProducer, ownerNotificationReplyProtocol, ownerNotificationWithdrawalProtocol, version };
7
+ export type { CommitOwnerAnchoredWorkflowTraceServiceResult, DeliveryInboundRuntime, OwnerForegroundLearningTask, OwnerNotificationReply, OwnerNotificationReplyBinding, OwnerNotificationReplyInput, OwnerNotificationReplyOutcome, OwnerNotificationWithdrawal, OwnerNotificationWithdrawalBinding, } from './service.js';
8
8
  export type { ForegroundExecution } from './acceptance.js';
9
- export type { ForegroundTaskIdentity, ForegroundTaskObservationRegistration, ForegroundToolCallAttestation } from './foreground-observation.js';
9
+ export type { ForegroundTerminationObservation } from './foreground-termination.js';
10
+ export type { ForegroundTaskIdentity, ForegroundTaskObservationRegistration, ForegroundToolCallAttestation, ForegroundToolInputPage, OwnerForegroundToolInput } from './foreground-observation.js';
10
11
  export type { DeliveryGoalWakeInput, DeliveryGoalWakeResult, OwnerGoalOutcomeFeedbackLocator, OwnerGoalOutcomeFeedbackProof, OwnerGoalOutcomeFeedbackTarget, } from './goal-wake-types.js';
11
12
  export * from './types.js';
12
13
  export * from './operator.js';
@@ -15,9 +16,22 @@ export type { ReplyReplayBlockConfig, ReplyReplayBlockHandle, ReplyReplayBlockSn
15
16
  export * from './learning-command.js';
16
17
  export { externalPrincipalId, ownerRouteAuthorityHash } from './canonical.js';
17
18
  export { deliverySchemaVersion } from './sqlite.js';
18
- export { ActiveLarkOwnerBindingsSnapshotError, activeLarkOwnerBindingsSnapshotProtocol, inspectActiveLarkOwnerBindingsLocally, inspectActiveWebOwnerBindingLocally, listActiveIdleWebOwnerBindingsLocally, } from './operator-snapshot.js';
19
- export type { ActiveIdleWebOwnerBindingsInspection, ActiveLarkOwnerBinding, ActiveLarkOwnerBindingsQuery, ActiveLarkOwnerBindingsSnapshot, ActiveLarkOwnerBindingsSnapshotErrorCode, ActiveWebOwnerBindingInspection, ActiveWebOwnerBindingQuery, ActiveWebOwnerBindingSnapshot, DeliveryOperatorFileIdentity, } from './operator-snapshot.js';
19
+ export { createInProcessReloadRuntime, } from './in-process-reload-runtime.js';
20
+ export type { InProcessReloadRuntime, InProcessReloadRuntimeActivationInput, InProcessReloadRuntimeActivationResult, InProcessReloadRuntimeOptions, InProcessReloadRuntimeProbe, InProcessReloadRuntimeRollbackInput, InProcessReloadRuntimeRollbackResult, InProcessReloadRuntimeTarget, } from './in-process-reload-runtime.js';
21
+ export { ActiveLarkOwnerBindingsSnapshotError, activeLarkOwnerBindingsSnapshotProtocol, inspectActiveLarkOwnerBindingsLocally, inspectActiveWebOwnerBindingLocally, listActiveIdleWebOwnerBindingsLocally, inspectRevokedOwnerRouteLocally, revokedOwnerRouteSnapshotProtocol, } from './operator-snapshot.js';
22
+ export type { ActiveIdleWebOwnerBindingsInspection, ActiveLarkOwnerBinding, ActiveLarkOwnerBindingsQuery, ActiveLarkOwnerBindingsSnapshot, ActiveLarkOwnerBindingsSnapshotErrorCode, ActiveWebOwnerBindingInspection, ActiveWebOwnerBindingQuery, ActiveWebOwnerBindingSnapshot, DeliveryOperatorFileIdentity, RevokedOwnerRouteQuery, RevokedOwnerRouteSnapshot, } from './operator-snapshot.js';
20
23
  export declare function apply(ctx: Context, config: import('./service.js').Config): void;
21
24
  export default AssistantDeliveryService;
22
25
  export type { NativeWebOwnerAccess, NativeWebOwnerConfig } from './native-web-owner.js';
26
+ export type { WorkItemReportTarget, WorkItemReplySource, WorkItemReplyConsumerRegistration, WorkItemReplyReadInput, WorkItemReplyListInput } from './work-item-replies.js';
27
+ export { WorkItemReplyCancelledError } from './work-item-replies.js';
28
+ export { assessAttention, assessAttentionSplit, attentionAttachmentSummaryGraphemes, attentionAttachmentSummaryWords, attentionAuditReasons, attentionGraphemeCaps, attentionOverCap, attentionSplitWindowMs, attentionWordCaps, convertOverCapAttention, countAttentionWords, defaultAttentionPurpose, measureAttentionText, NOTIFICATION_OUTCOME_FACTS_PROTOCOL } from './attention.js';
29
+ export type { AttentionAssessment, AttentionAuditEntry, AttentionAuditReason, AttentionEnvelope, AttentionLane, AttentionLedgerView, AttentionPurpose, AttentionPurposeSource, AttentionQuestion, AttentionSplitVerdict, AttentionTextMeasure, AttentionVerdict, NotificationOutcomeFact } from './attention.js';
30
+ export { ProgressAttentionAudit, progressAttentionText } from './progress-attention.js';
31
+ export { AttentionRejectedError } from './service.js';
32
+ export { AttentionRejectionLog, attentionEnforcedPurposeReasons, attentionEnforcementOnlyReasons, attentionEnforcementReasons } from './attention-enforcement.js';
33
+ export type { AttentionRejectionEntry, AttentionRejectionPage, AttentionRejectionReason } from './attention-enforcement.js';
34
+ export type { ProgressAttentionAuditEntry, ProgressAttentionAuditPage } from './progress-attention.js';
35
+ export type { OwnerWorkItemLearningTask, OwnerLearningSourceExpectation, OwnerLearningSourceSnapshot, OwnerWorkItemLearningSourceExpectation, OwnerWorkItemLearningTaskFenceInput } from './work-item-feedback.js';
36
+ export type { EngineeringReportRef, EngineeringNode, EngineeringRootInput, EngineeringContinuationInput, WorkItemEngineeringMaterial, OwnerWorkItemEngineeringManifest, OwnerWorkItemEngineeringContextLocator, OwnerWorkItemEngineeringContextExpectation, OwnerWorkItemEngineeringContextReadInput, OwnerWorkItemEngineeringContextPage, OwnerWorkItemEngineeringContext, OwnerWorkItemEngineeringContextSource } from './work-item-engineering-context.js';
23
37
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,mCAAmC,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM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2
- import { AssistantDeliveryService, Config, isTrustedDeliveryPreferenceProducer } from './service.js';
2
+ import { AssistantDeliveryService, Config, isTrustedDeliveryPreferenceProducer, ownerNotificationReplyProtocol, ownerNotificationWithdrawalProtocol } from './service.js';
3
3
  import { version } from './version.js';
4
4
  export const name = 'dsh-enhanced-assistant-delivery';
5
- export { AssistantDeliveryService, Config, DeliveryAdapterRegistryStoppedError, isTrustedDeliveryPreferenceProducer, version };
5
+ export { AssistantDeliveryService, Config, DeliveryAdapterRegistryStoppedError, isTrustedDeliveryPreferenceProducer, ownerNotificationReplyProtocol, ownerNotificationWithdrawalProtocol, version };
6
6
  export * from './types.js';
7
7
  export * from './operator.js';
8
8
  export { ReplyReplayBlockedError, replyReplayInputDigest, replyReplayBlockContract } from './reply-replay.js';
9
9
  export * from './learning-command.js';
10
10
  export { externalPrincipalId, ownerRouteAuthorityHash } from './canonical.js';
11
11
  export { deliverySchemaVersion } from './sqlite.js';
12
- export { ActiveLarkOwnerBindingsSnapshotError, activeLarkOwnerBindingsSnapshotProtocol, inspectActiveLarkOwnerBindingsLocally, inspectActiveWebOwnerBindingLocally, listActiveIdleWebOwnerBindingsLocally, } from './operator-snapshot.js';
12
+ export { createInProcessReloadRuntime, } from './in-process-reload-runtime.js';
13
+ export { ActiveLarkOwnerBindingsSnapshotError, activeLarkOwnerBindingsSnapshotProtocol, inspectActiveLarkOwnerBindingsLocally, inspectActiveWebOwnerBindingLocally, listActiveIdleWebOwnerBindingsLocally, inspectRevokedOwnerRouteLocally, revokedOwnerRouteSnapshotProtocol, } from './operator-snapshot.js';
13
14
  export function apply(ctx, config) {
14
15
  new AssistantDeliveryService(ctx, config);
15
16
  }
16
17
  export default AssistantDeliveryService;
18
+ export { WorkItemReplyCancelledError } from './work-item-replies.js';
19
+ export { assessAttention, assessAttentionSplit, attentionAttachmentSummaryGraphemes, attentionAttachmentSummaryWords, attentionAuditReasons, attentionGraphemeCaps, attentionOverCap, attentionSplitWindowMs, attentionWordCaps, convertOverCapAttention, countAttentionWords, defaultAttentionPurpose, measureAttentionText, NOTIFICATION_OUTCOME_FACTS_PROTOCOL } from './attention.js';
20
+ export { ProgressAttentionAudit, progressAttentionText } from './progress-attention.js';
21
+ export { AttentionRejectedError } from './service.js';
22
+ export { AttentionRejectionLog, attentionEnforcedPurposeReasons, attentionEnforcementOnlyReasons, attentionEnforcementReasons } from './attention-enforcement.js';
17
23
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mCAAmC,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE,mCAAmC,EAAE,MAAM,cAAc,CAAA;AACpG,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,IAAI,GAAG,iCAAiC,CAAA;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE,mCAAmC,EAAE,mCAAmC,EAAE,OAAO,EAAE,CAAA;AAY9H,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAE7G,cAAc,uBAAuB,CAAA;AACrC,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EACL,oCAAoC,EAAE,uCAAuC,EAC7E,qCAAqC,EAAE,mCAAmC,EAC1E,qCAAqC,GACtC,MAAM,wBAAwB,CAAA;AAQ/B,MAAM,UAAU,KAAK,CAAC,GAAY,EAAE,MAAqC;IACvE,IAAI,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;AAC3C,CAAC;AAED,eAAe,wBAAwB,CAAA"}
1
+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BAAsB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,mCAAmC,EAAE,MAAM,gBAAgB,CAAA;AAEzX,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,qBAAqB,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA"}
@@ -0,0 +1,12 @@
1
+ import type { TurnEndReason } from '@deepseek-ai/dsh-session';
2
+ import { type ForegroundTerminationObservation } from './foreground-termination.js';
3
+ /** Facts owned by the Host, never an exception message or model-authored text. */
4
+ export type NativeTerminationCause = 'runtime-error' | 'execution-timeout' | 'owner-stop' | 'owner-new-session' | 'lease-or-authority-lost' | 'host-disposed' | 'execution-aborted';
5
+ export declare function observeNativeTermination(input: {
6
+ producer: ForegroundTerminationObservation['producer'];
7
+ reason?: TurnEndReason | undefined;
8
+ cause?: NativeTerminationCause | undefined;
9
+ handleDisposed: boolean;
10
+ completed: boolean;
11
+ }): Readonly<ForegroundTerminationObservation>;
12
+ //# sourceMappingURL=native-termination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-termination.d.ts","sourceRoot":"","sources":["../src/native-termination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAA6C,KAAK,gCAAgC,EAAE,MAAM,6BAA6B,CAAA;AAE9H,kFAAkF;AAClF,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG,mBAAmB,GAAG,YAAY,GACrF,mBAAmB,GAAG,yBAAyB,GAAG,eAAe,GAAG,mBAAmB,CAAA;AAE3F,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,QAAQ,EAAE,gCAAgC,CAAC,UAAU,CAAC,CAAA;IACtD,MAAM,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;IAClC,KAAK,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAA;IAC1C,cAAc,EAAE,OAAO,CAAA;IACvB,SAAS,EAAE,OAAO,CAAA;CACnB,GAAG,QAAQ,CAAC,gCAAgC,CAAC,CAkC7C"}
@@ -0,0 +1,57 @@
1
+ import { normalizeForegroundTerminationObservation } from './foreground-termination.js';
2
+ export function observeNativeTermination(input) {
3
+ let kind = 'unknown';
4
+ let causeCode = 'turn-missing';
5
+ const reason = input.reason;
6
+ if (input.completed && input.handleDisposed) {
7
+ kind = 'completed';
8
+ causeCode = 'turn-completed';
9
+ }
10
+ else if (input.cause === 'owner-stop' || input.cause === 'owner-new-session') {
11
+ kind = 'owner-cancelled';
12
+ causeCode = input.cause;
13
+ }
14
+ else if (reason?.kind === 'aborted' && reason.reason.kind === 'user') {
15
+ kind = 'owner-cancelled';
16
+ causeCode = 'turn-user-aborted';
17
+ }
18
+ else if (input.cause === 'execution-timeout') {
19
+ kind = 'timeout';
20
+ causeCode = input.cause;
21
+ }
22
+ else if (input.cause === 'lease-or-authority-lost' || input.cause === 'host-disposed'
23
+ || input.cause === 'execution-aborted') {
24
+ kind = 'interrupted';
25
+ causeCode = input.cause;
26
+ }
27
+ else if (reason?.kind === 'error') {
28
+ kind = 'error';
29
+ causeCode = 'turn-error';
30
+ }
31
+ else if (reason?.kind === 'max-tokens') {
32
+ kind = 'error';
33
+ causeCode = 'turn-max-tokens';
34
+ }
35
+ else if (reason?.kind === 'aborted') {
36
+ kind = 'interrupted';
37
+ causeCode = 'turn-aborted';
38
+ }
39
+ else if (input.cause === 'runtime-error') {
40
+ kind = 'error';
41
+ causeCode = input.cause;
42
+ }
43
+ else if (!input.handleDisposed) {
44
+ causeCode = 'teardown-unconfirmed';
45
+ }
46
+ else if (reason?.kind === 'completed') {
47
+ causeCode = 'completion-unconfirmed';
48
+ }
49
+ else if (reason !== undefined) {
50
+ causeCode = 'turn-unclassified';
51
+ }
52
+ return normalizeForegroundTerminationObservation({
53
+ protocol: 'assistant-delivery/foreground-termination/v1', producer: input.producer,
54
+ kind, causeCode, handleDisposed: input.handleDisposed, effects: 'unknown', replay: 'forbidden',
55
+ });
56
+ }
57
+ //# sourceMappingURL=native-termination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-termination.js","sourceRoot":"","sources":["../src/native-termination.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yCAAyC,EAAyC,MAAM,6BAA6B,CAAA;AAM9H,MAAM,UAAU,wBAAwB,CAAC,KAMxC;IACC,IAAI,IAAI,GAA6C,SAAS,CAAA;IAC9D,IAAI,SAAS,GAAkD,cAAc,CAAA;IAC7E,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;IAC3B,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QAC5C,IAAI,GAAG,WAAW,CAAC;QAAC,SAAS,GAAG,gBAAgB,CAAA;IAClD,CAAC;SAAM,IAAI,KAAK,CAAC,KAAK,KAAK,YAAY,IAAI,KAAK,CAAC,KAAK,KAAK,mBAAmB,EAAE,CAAC;QAC/E,IAAI,GAAG,iBAAiB,CAAC;QAAC,SAAS,GAAG,KAAK,CAAC,KAAK,CAAA;IACnD,CAAC;SAAM,IAAI,MAAM,EAAE,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACvE,IAAI,GAAG,iBAAiB,CAAC;QAAC,SAAS,GAAG,mBAAmB,CAAA;IAC3D,CAAC;SAAM,IAAI,KAAK,CAAC,KAAK,KAAK,mBAAmB,EAAE,CAAC;QAC/C,IAAI,GAAG,SAAS,CAAC;QAAC,SAAS,GAAG,KAAK,CAAC,KAAK,CAAA;IAC3C,CAAC;SAAM,IAAI,KAAK,CAAC,KAAK,KAAK,yBAAyB,IAAI,KAAK,CAAC,KAAK,KAAK,eAAe;WAClF,KAAK,CAAC,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ions, ResumeAgentOptions } from '@deepseek-ai/dsh-agent';
3
3
  import type { AssistantPolicyService } from '@dsh-enhanced/assistant-policy';
4
4
  import type { AcceptanceHandle } from './acceptance.js';
5
+ import type { ForegroundTerminationObservation } from './foreground-termination.js';
5
6
  import type { DeliveryStore } from './store.js';
6
7
  import { DeliverySessionLeases } from './session-lease-runtime.js';
7
8
  import type { ConversationBinding, ExternalPrincipalKey, InboundEnvelope } from './types.js';
@@ -43,6 +44,12 @@ interface OwnerPort {
43
44
  completeExecution(inboxId: string, input: {
44
45
  status: 'succeeded' | 'failed' | 'cancelled' | 'unknown';
45
46
  quiescent: boolean;
47
+ termination?: Readonly<ForegroundTerminationObservation>;
48
+ }): void;
49
+ recordExecutionModelSelection(inboxId: string, input: {
50
+ provider: string;
51
+ model: string;
52
+ reasoningEffort?: string;
46
53
  }): void;
47
54
  claimed(agent: Agent, envelope: InboundEnvelope, turn: number): void;
48
55
  released(): void;