@dsh-enhanced/assistant-automations 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.
- package/README.md +34 -1
- package/lib/coordinator.d.ts +15 -0
- package/lib/coordinator.d.ts.map +1 -1
- package/lib/coordinator.js +12 -0
- package/lib/coordinator.js.map +1 -1
- package/lib/host-agent-execution.d.ts +24 -0
- package/lib/host-agent-execution.d.ts.map +1 -0
- package/lib/host-agent-execution.js +248 -0
- package/lib/host-agent-execution.js.map +1 -0
- package/lib/host-executors.d.ts +10 -1
- package/lib/host-executors.d.ts.map +1 -1
- package/lib/host-executors.js +37 -7
- package/lib/host-executors.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/native-agent-execution.d.ts +123 -0
- package/lib/native-agent-execution.d.ts.map +1 -0
- package/lib/native-agent-execution.js +922 -0
- package/lib/native-agent-execution.js.map +1 -0
- package/lib/operator.d.ts +56 -2
- package/lib/operator.d.ts.map +1 -1
- package/lib/operator.js +307 -8
- package/lib/operator.js.map +1 -1
- package/lib/runner.d.ts +2 -86
- package/lib/runner.d.ts.map +1 -1
- package/lib/runner.js +2 -777
- package/lib/runner.js.map +1 -1
- package/lib/schedule.d.ts +2 -0
- package/lib/schedule.d.ts.map +1 -1
- package/lib/schedule.js +8 -1
- package/lib/schedule.js.map +1 -1
- package/lib/service.d.ts +38 -4
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +112 -8
- package/lib/service.js.map +1 -1
- package/lib/sqlite.d.ts +1 -1
- package/lib/sqlite.d.ts.map +1 -1
- package/lib/sqlite.js +53 -2
- package/lib/sqlite.js.map +1 -1
- package/lib/store.d.ts +47 -1
- package/lib/store.d.ts.map +1 -1
- package/lib/store.js +221 -10
- package/lib/store.js.map +1 -1
- package/lib/types.d.ts +59 -0
- package/lib/types.d.ts.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { types } from 'node:util';
|
|
2
|
+
import { acceptanceCanonicalJson, acceptanceDigest } from '@dsh-enhanced/task-acceptance-contract';
|
|
3
|
+
import { runHostNativeAgent } from './native-agent-execution.js';
|
|
4
|
+
/** Codepoint order, independent of host locale. Includes the complete schema objects. */
|
|
5
|
+
export function hostAgentToolSchemaDigest(schemas) {
|
|
6
|
+
const names = schemas.map(schema => schema.name);
|
|
7
|
+
if (names.some(name => typeof name !== 'string' || name.length === 0) || new Set(names).size !== names.length)
|
|
8
|
+
throw new Error('assistant-automations: invalid tool schema names');
|
|
9
|
+
return acceptanceDigest([...schemas].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
10
|
+
}
|
|
11
|
+
function contractSnapshot(value) {
|
|
12
|
+
const contract = structuredClone(value);
|
|
13
|
+
const keys = ['provider', 'model', 'reasoningEffort', 'prompt', 'allowedTools', 'toolSchemaDigest', 'maxModelCalls', 'maxToolCalls', 'maxOutputTokens', 'timeoutMs'];
|
|
14
|
+
if (Object.keys(contract).some(key => !keys.includes(key)) || typeof contract.provider !== 'string' || !contract.provider.trim()
|
|
15
|
+
|| typeof contract.model !== 'string' || !contract.model.trim() || typeof contract.prompt !== 'string' || !contract.prompt.trim()
|
|
16
|
+
|| Buffer.byteLength(contract.prompt) > 65536 || contract.reasoningEffort !== undefined && (typeof contract.reasoningEffort !== 'string' || !contract.reasoningEffort.trim())
|
|
17
|
+
|| !Array.isArray(contract.allowedTools) || contract.allowedTools.some(name => typeof name !== 'string' || !name.trim())
|
|
18
|
+
|| new Set(contract.allowedTools).size !== contract.allowedTools.length || !/^[a-f0-9]{64}$/u.test(contract.toolSchemaDigest)
|
|
19
|
+
|| !Number.isSafeInteger(contract.maxModelCalls) || contract.maxModelCalls < 1 || contract.maxModelCalls > 100
|
|
20
|
+
|| !Number.isSafeInteger(contract.maxToolCalls) || contract.maxToolCalls < 0 || contract.maxToolCalls > 1000
|
|
21
|
+
|| !Number.isSafeInteger(contract.maxOutputTokens) || contract.maxOutputTokens < 1 || contract.maxOutputTokens > 131072
|
|
22
|
+
|| !Number.isSafeInteger(contract.timeoutMs) || contract.timeoutMs < 1 || contract.timeoutMs > 3600000)
|
|
23
|
+
throw new Error('assistant-automations: invalid Host Agent contract');
|
|
24
|
+
const { reasoningEffort, ...required } = contract;
|
|
25
|
+
return Object.freeze({ ...required, ...(reasoningEffort === undefined ? {} : { reasoningEffort }), allowedTools: Object.freeze([...contract.allowedTools].sort()) });
|
|
26
|
+
}
|
|
27
|
+
function authorizationSnapshot(value) {
|
|
28
|
+
if (value === null || typeof value !== 'object' || types.isProxy(value) || Object.getPrototypeOf(value) !== Object.prototype)
|
|
29
|
+
throw new Error('assistant-automations: invalid authorization fence');
|
|
30
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
31
|
+
if (Reflect.ownKeys(value).length !== 2 || !['signal', 'assertCurrent'].every(key => descriptors[key]?.enumerable && Object.hasOwn(descriptors[key], 'value')))
|
|
32
|
+
throw new Error('assistant-automations: authorization fence requires own data fields');
|
|
33
|
+
const signal = descriptors.signal.value, callback = descriptors.assertCurrent.value;
|
|
34
|
+
if (typeof callback !== 'function' || types.isProxy(callback) || types.isAsyncFunction(callback))
|
|
35
|
+
throw new Error('assistant-automations: authorization fence must be synchronous');
|
|
36
|
+
try {
|
|
37
|
+
Object.getOwnPropertyDescriptor(AbortSignal.prototype, 'aborted').get.call(signal);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
throw new Error('assistant-automations: authorization fence signal is invalid');
|
|
41
|
+
}
|
|
42
|
+
return Object.freeze({ signal: signal, assertCurrent: callback });
|
|
43
|
+
}
|
|
44
|
+
/** Internal capability owner. This object and its runner key never leave the service. */
|
|
45
|
+
export class HostAgentExecutions {
|
|
46
|
+
ctx;
|
|
47
|
+
policy;
|
|
48
|
+
#key = Object.freeze({});
|
|
49
|
+
#invocations = new WeakMap();
|
|
50
|
+
#live = new Set();
|
|
51
|
+
#active = true;
|
|
52
|
+
#accepting = true;
|
|
53
|
+
constructor(ctx, policy) {
|
|
54
|
+
this.ctx = ctx;
|
|
55
|
+
this.policy = policy;
|
|
56
|
+
}
|
|
57
|
+
runnerKey() { return this.#key; }
|
|
58
|
+
open(key, invocation, input, freshReservation, publish) {
|
|
59
|
+
if (key !== this.#key || !this.#active || !this.#accepting || !freshReservation || input.occurrence.dryRun || input.task.attemptCount !== 1
|
|
60
|
+
|| input.automation.definition.retrySafety !== 'never' || input.automation.definition.maxRetries !== 0
|
|
61
|
+
|| input.automation.definition.budgetId === undefined || input.signal.aborted || invocation.signal.aborted)
|
|
62
|
+
return undefined;
|
|
63
|
+
const controller = new AbortController();
|
|
64
|
+
const snapshot = JSON.parse(JSON.stringify({ automation: input.automation, occurrence: input.occurrence, task: input.task, sessionId: input.sessionId }));
|
|
65
|
+
const state = { input: { ...snapshot, signal: input.signal }, controller, signal: AbortSignal.any([invocation.signal, controller.signal]), active: true, consumed: false,
|
|
66
|
+
...(input.markObjectiveUnverified === undefined ? {} : { markObjectiveUnverified: input.markObjectiveUnverified }) };
|
|
67
|
+
this.#invocations.set(invocation, state);
|
|
68
|
+
this.#live.add(state);
|
|
69
|
+
return async () => {
|
|
70
|
+
observeInvocation(state);
|
|
71
|
+
state.active = false;
|
|
72
|
+
this.#invocations.delete(invocation);
|
|
73
|
+
state.controller.abort('host-executor-ended');
|
|
74
|
+
try {
|
|
75
|
+
if (state.pending)
|
|
76
|
+
await drainInvocation(state);
|
|
77
|
+
if (state.consumed && !state.finished)
|
|
78
|
+
throw new Error('assistant-automations: executor abandoned its Agent execution');
|
|
79
|
+
return state.result;
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
observeInvocation(state);
|
|
83
|
+
const receipt = state.result ?? state.observed;
|
|
84
|
+
if (receipt !== undefined)
|
|
85
|
+
publish(receipt);
|
|
86
|
+
this.#live.delete(state);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
run(invocation, value, authorization) {
|
|
91
|
+
const execution = this.execute(invocation, value, authorization);
|
|
92
|
+
void execution.catch(() => { });
|
|
93
|
+
return execution;
|
|
94
|
+
}
|
|
95
|
+
async execute(invocation, value, authorization) {
|
|
96
|
+
const state = this.#invocations.get(invocation);
|
|
97
|
+
if (!this.#active || !this.#accepting || !state?.active || state.consumed || state.signal.aborted)
|
|
98
|
+
throw new Error('assistant-automations: exact live reserved Host invocation is required');
|
|
99
|
+
const fence = authorization === undefined ? undefined : authorizationSnapshot(authorization);
|
|
100
|
+
const contract = contractSnapshot(value);
|
|
101
|
+
if (contract.timeoutMs > state.input.automation.definition.timeoutMs)
|
|
102
|
+
throw new Error('assistant-automations: Host Agent deadline exceeds occurrence contract');
|
|
103
|
+
const contractDigest = acceptanceDigest(contract);
|
|
104
|
+
const now = Date.now(), startedAt = state.input.task.updatedAt;
|
|
105
|
+
const occurrenceDeadlineAt = startedAt + state.input.automation.definition.timeoutMs;
|
|
106
|
+
if (!Number.isSafeInteger(startedAt) || startedAt > now || !Number.isSafeInteger(occurrenceDeadlineAt))
|
|
107
|
+
throw new Error('assistant-automations: Host occurrence start time is invalid');
|
|
108
|
+
const deadlineAt = Math.min(occurrenceDeadlineAt, now + contract.timeoutMs);
|
|
109
|
+
const deadline = new AbortController();
|
|
110
|
+
const signal = AbortSignal.any([state.signal, deadline.signal, ...(fence === undefined ? [] : [fence.signal])]);
|
|
111
|
+
// Contract cloning can invoke getters which synchronously consume or revoke this invocation.
|
|
112
|
+
if (!this.#active || !this.#accepting || this.#invocations.get(invocation) !== state
|
|
113
|
+
|| !state.active || state.consumed || state.signal.aborted)
|
|
114
|
+
throw new Error('assistant-automations: exact live reserved Host invocation is required');
|
|
115
|
+
const check = () => {
|
|
116
|
+
if (Date.now() >= deadlineAt)
|
|
117
|
+
deadline.abort('host-agent-deadline');
|
|
118
|
+
signal.throwIfAborted();
|
|
119
|
+
if (!this.#active || !this.#accepting || this.#invocations.get(invocation) !== state || !state.active)
|
|
120
|
+
throw new Error('assistant-automations: Host Agent invocation is no longer active');
|
|
121
|
+
};
|
|
122
|
+
check();
|
|
123
|
+
state.consumed = true;
|
|
124
|
+
// Publish the monotonic reduction before any await/create/model call. The
|
|
125
|
+
// coordinator can commit an abort result before this invocation drains.
|
|
126
|
+
state.markObjectiveUnverified?.();
|
|
127
|
+
const authorize = fence === undefined ? undefined : () => {
|
|
128
|
+
try {
|
|
129
|
+
check();
|
|
130
|
+
const result = fence.assertCurrent();
|
|
131
|
+
// Best-effort rejection observation for ordinary built-in Promises, not hostile constructor/species objects.
|
|
132
|
+
if (types.isPromise(result))
|
|
133
|
+
void Promise.prototype.then.call(result, () => { }, () => { });
|
|
134
|
+
if (result !== undefined)
|
|
135
|
+
throw new Error('assistant-automations: authorization fence must return synchronously without a value');
|
|
136
|
+
check();
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
state.active = false;
|
|
140
|
+
this.#invocations.delete(invocation);
|
|
141
|
+
state.controller.abort('host-agent-authorization-revoked');
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
let timer;
|
|
146
|
+
let removeAbort;
|
|
147
|
+
try {
|
|
148
|
+
authorize?.();
|
|
149
|
+
timer = setTimeout(() => deadline.abort('host-agent-deadline'), Math.max(0, deadlineAt - Date.now()));
|
|
150
|
+
timer.unref?.();
|
|
151
|
+
const pending = runHostNativeAgent(this.ctx, this.policy, state.input, contract, contractDigest, signal, Object.freeze({ deadlineAt, check, ...(authorize === undefined ? {} : { authorize }),
|
|
152
|
+
observe: (read) => { if (state.active && !signal.aborted)
|
|
153
|
+
state.readObservation = read; } }));
|
|
154
|
+
state.pending = pending;
|
|
155
|
+
// Observe rejection even when a faulty executor drops its returned promise.
|
|
156
|
+
void pending.catch(() => { });
|
|
157
|
+
const cancelled = new Promise((_, reject) => {
|
|
158
|
+
const abort = () => reject(new Error('assistant-automations: Host Agent interrupted'));
|
|
159
|
+
if (signal.aborted)
|
|
160
|
+
abort();
|
|
161
|
+
else
|
|
162
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
163
|
+
removeAbort = () => signal.removeEventListener('abort', abort);
|
|
164
|
+
});
|
|
165
|
+
const result = await Promise.race([pending, cancelled]);
|
|
166
|
+
authorize?.();
|
|
167
|
+
check();
|
|
168
|
+
const snapshot = snapshotResult(result);
|
|
169
|
+
check();
|
|
170
|
+
state.result = snapshot;
|
|
171
|
+
state.finished = true;
|
|
172
|
+
return Object.freeze({ ...snapshot, contractDigest });
|
|
173
|
+
}
|
|
174
|
+
finally {
|
|
175
|
+
removeAbort?.();
|
|
176
|
+
clearTimeout(timer);
|
|
177
|
+
if (signal.aborted)
|
|
178
|
+
await drainInvocation(state);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
suspend() {
|
|
182
|
+
this.#accepting = false;
|
|
183
|
+
for (const state of this.#live) {
|
|
184
|
+
state.active = false;
|
|
185
|
+
state.controller.abort('automations-stopped');
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
resume() { if (this.#active)
|
|
189
|
+
this.#accepting = true; }
|
|
190
|
+
async drain() { await Promise.all([...this.#live].map(async (state) => { if (state.pending)
|
|
191
|
+
await drainInvocation(state); })); }
|
|
192
|
+
async dispose() { this.#active = false; this.suspend(); await this.drain(); }
|
|
193
|
+
}
|
|
194
|
+
/** Audit-only lower bound, sampled even when authorization or teardown is no longer confirmed. */
|
|
195
|
+
function observeInvocation(state) {
|
|
196
|
+
try {
|
|
197
|
+
const observation = state.readObservation?.();
|
|
198
|
+
if (!observation || observation.sessionId !== state.input.sessionId)
|
|
199
|
+
return;
|
|
200
|
+
const usage = { observedPartial: true };
|
|
201
|
+
for (const [key, value] of Object.entries(observation.usage)) {
|
|
202
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0)
|
|
203
|
+
continue;
|
|
204
|
+
const prior = state.observed?.usage[key];
|
|
205
|
+
usage[key] = typeof prior === 'number' ? Math.max(prior, value) : value;
|
|
206
|
+
}
|
|
207
|
+
state.observed = snapshotResult({ outcome: 'unknown', output: '', sessionId: observation.sessionId,
|
|
208
|
+
usage, quiescent: false });
|
|
209
|
+
}
|
|
210
|
+
catch { /* Retain any prior observation; missing audit data never authorizes success. */ }
|
|
211
|
+
}
|
|
212
|
+
function snapshotResult(result) {
|
|
213
|
+
const descriptors = Object.getOwnPropertyDescriptors(result);
|
|
214
|
+
const allowed = new Set(['outcome', 'output', 'usage', 'sessionId', 'diagnostic', 'quiescent']);
|
|
215
|
+
if (Reflect.ownKeys(result).some(key => typeof key !== 'string' || !allowed.has(key))
|
|
216
|
+
|| Object.values(descriptors).some(descriptor => !descriptor.enumerable || !Object.hasOwn(descriptor, 'value'))
|
|
217
|
+
|| !['outcome', 'output', 'usage'].every(key => Object.hasOwn(descriptors, key)))
|
|
218
|
+
throw new Error('assistant-automations: native receipt shape is invalid');
|
|
219
|
+
const body = Object.fromEntries(Object.entries(descriptors).filter(([key, descriptor]) => descriptor.value !== undefined || ['outcome', 'output', 'usage'].includes(key))
|
|
220
|
+
.map(([key, descriptor]) => [key, descriptor.value]));
|
|
221
|
+
const detached = JSON.parse(acceptanceCanonicalJson(body));
|
|
222
|
+
const freeze = (value) => {
|
|
223
|
+
if (value === null || typeof value !== 'object')
|
|
224
|
+
return;
|
|
225
|
+
for (const item of Object.values(value))
|
|
226
|
+
freeze(item);
|
|
227
|
+
Object.freeze(value);
|
|
228
|
+
};
|
|
229
|
+
freeze(detached);
|
|
230
|
+
return detached;
|
|
231
|
+
}
|
|
232
|
+
function drainInvocation(state) {
|
|
233
|
+
// Do not cache empty success: consumption may not have started yet.
|
|
234
|
+
if (!state.pending)
|
|
235
|
+
return Promise.resolve();
|
|
236
|
+
return state.drain ??= boundedDrain(state.pending);
|
|
237
|
+
}
|
|
238
|
+
async function boundedDrain(pending) {
|
|
239
|
+
let timer;
|
|
240
|
+
try {
|
|
241
|
+
await Promise.race([pending.then(() => { }, () => { }), new Promise((_, reject) => { timer = setTimeout(() => reject(new Error('assistant-automations: Host Agent teardown unconfirmed')), 2000); })]);
|
|
242
|
+
}
|
|
243
|
+
finally {
|
|
244
|
+
if (timer)
|
|
245
|
+
clearTimeout(timer);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=host-agent-execution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-agent-execution.js","sourceRoot":"","sources":["../src/host-agent-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAGjC,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AAElG,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAGhE,yFAAyF;AACzF,MAAM,UAAU,yBAAyB,CAAC,OAAoC;IAC5E,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAChD,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;IAClL,OAAO,gBAAgB,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAA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IAAI,CAAC,CAAA;QACrD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC,CAAA;IACD,MAAM,CAAC,QAAQ,CAAC,CAAA;IAChB,OAAO,QAAQ,CAAA;AACjB,CAAC;AACD,SAAS,eAAe,CAAC,KAAiB;IACxC,oEAAoE;IACpE,IAAI,CAAC,KAAK,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC5C,OAAO,KAAK,CAAC,KAAK,KAAK,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AACpD,CAAC;AACD,KAAK,UAAU,YAAY,CAAC,OAAyB;IACnD,IAAI,KAAgD,CAAA;IACpD,IAAI,CAAC;QAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAAC,CAAC;YAC1M,CAAC;QAAC,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAA;IAAC,CAAC;AAC5C,CAAC"}
|
package/lib/host-executors.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { HostAgentExecutions } from './host-agent-execution.js';
|
|
2
|
+
import type { AutomationRunnerInput, AutomationRunnerResult } from './coordinator.js';
|
|
1
3
|
import type { HostAutomationExecutionSpec, HostAutomationExecutor, HostAutomationExecutorDescriptor, HostAutomationExecutorInput, HostAutomationExecutorResult } from './types.js';
|
|
2
4
|
export type { HostAutomationExecutor } from './types.js';
|
|
3
5
|
export type HostExecutorRegistryErrorCode = 'duplicate-descriptor' | 'invalid-descriptor' | 'invalid-result' | 'stale-registration';
|
|
@@ -17,9 +19,16 @@ export type HostExecutorProof = Readonly<{
|
|
|
17
19
|
export declare function validateHostExecutorResult(value: HostAutomationExecutorResult): Readonly<HostAutomationExecutorResult>;
|
|
18
20
|
/** Process-local registry. Durable definitions store descriptors, never callbacks. */
|
|
19
21
|
export declare class HostAutomationExecutorRegistry {
|
|
22
|
+
#private;
|
|
20
23
|
private readonly registrations;
|
|
24
|
+
constructor(agentOwner?: HostAgentExecutions);
|
|
21
25
|
register(executor: HostAutomationExecutor): () => void;
|
|
22
26
|
prove(spec: HostAutomationExecutionSpec): HostExecutorProof;
|
|
23
|
-
execute(proof: HostExecutorProof, input: HostAutomationExecutorInput
|
|
27
|
+
execute(proof: HostExecutorProof, input: HostAutomationExecutorInput, authorization?: {
|
|
28
|
+
key: object;
|
|
29
|
+
input: AutomationRunnerInput;
|
|
30
|
+
freshReservation: boolean;
|
|
31
|
+
onNativeResult: (result: AutomationRunnerResult) => void;
|
|
32
|
+
}): Promise<Readonly<HostAutomationExecutorResult>>;
|
|
24
33
|
}
|
|
25
34
|
//# sourceMappingURL=host-executors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-executors.d.ts","sourceRoot":"","sources":["../src/host-executors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,sBAAsB,EACtB,gCAAgC,EAChC,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAExD,MAAM,MAAM,6BAA6B,GACrC,sBAAsB,GACtB,oBAAoB,GACpB,gBAAgB,GAChB,oBAAoB,CAAA;AAExB,qBAAa,yBAA0B,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAE,6BAA6B;gBAAnC,IAAI,EAAE,6BAA6B,EAAE,OAAO,EAAE,MAAM;CAI1E;AASD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,QAAQ,CAAC;IACP,SAAS,EAAE,IAAI,CAAA;IACf,UAAU,EAAE,QAAQ,CAAC,gCAAgC,CAAC,CAAA;IACtD,iBAAiB,EAAE,MAAM,CAAA;IACzB,eAAe,EAAE,WAAW,CAAA;CAC7B,CAAC,CAAA;AAiCN,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,4BAA4B,GAAG,QAAQ,CAAC,4BAA4B,CAAC,CAmDtH;AAED,sFAAsF;AACtF,qBAAa,8BAA8B;;IACzC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkC;gBAEpD,UAAU,CAAC,EAAE,mBAAmB;IAE5C,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,GAAG,MAAM,IAAI;IA2BtD,KAAK,CAAC,IAAI,EAAE,2BAA2B,GAAG,iBAAiB;IAoCrD,OAAO,CACX,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,2BAA2B,EAClC,aAAa,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,qBAAqB,CAAC;QAAC,gBAAgB,EAAE,OAAO,CAAC;QAAC,cAAc,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAA;KAAE,GACjJ,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC;CAiDnD"}
|
package/lib/host-executors.js
CHANGED
|
@@ -85,6 +85,8 @@ export function validateHostExecutorResult(value) {
|
|
|
85
85
|
/** Process-local registry. Durable definitions store descriptors, never callbacks. */
|
|
86
86
|
export class HostAutomationExecutorRegistry {
|
|
87
87
|
registrations = new Map();
|
|
88
|
+
#agentOwner;
|
|
89
|
+
constructor(agentOwner) { this.#agentOwner = agentOwner; }
|
|
88
90
|
register(executor) {
|
|
89
91
|
if (typeof executor !== 'object' || executor === null
|
|
90
92
|
|| typeof executor.accepts !== 'function' || typeof executor.execute !== 'function') {
|
|
@@ -115,9 +117,10 @@ export class HostAutomationExecutorRegistry {
|
|
|
115
117
|
}
|
|
116
118
|
prove(spec) {
|
|
117
119
|
const accepted = [];
|
|
120
|
+
const candidate = Object.freeze({ ...spec, targetScope: Object.freeze({ ...spec.targetScope }) });
|
|
118
121
|
for (const registration of this.registrations.values()) {
|
|
119
122
|
try {
|
|
120
|
-
if (registration.executor.accepts(
|
|
123
|
+
if (registration.executor.accepts(candidate))
|
|
121
124
|
accepted.push(registration);
|
|
122
125
|
}
|
|
123
126
|
catch {
|
|
@@ -149,7 +152,7 @@ export class HostAutomationExecutorRegistry {
|
|
|
149
152
|
reasonCode: exact === undefined ? 'host-executor-unavailable' : 'host-executor-contract-rejected',
|
|
150
153
|
});
|
|
151
154
|
}
|
|
152
|
-
async execute(proof, input) {
|
|
155
|
+
async execute(proof, input, authorization) {
|
|
153
156
|
if (!proof.available) {
|
|
154
157
|
throw new HostExecutorRegistryError('stale-registration', 'Host executor availability was not proven');
|
|
155
158
|
}
|
|
@@ -160,21 +163,48 @@ export class HostAutomationExecutorRegistry {
|
|
|
160
163
|
throw new HostExecutorRegistryError('stale-registration', 'Host executor registration is no longer exact');
|
|
161
164
|
}
|
|
162
165
|
const signal = AbortSignal.any([input.signal, registration.lifecycle.signal]);
|
|
163
|
-
const
|
|
166
|
+
const invocation = Object.freeze({ ...input, targetScope: Object.freeze({ ...input.targetScope }), signal });
|
|
167
|
+
const close = authorization === undefined ? undefined : this.#agentOwner?.open(authorization.key, invocation, authorization.input, authorization.freshReservation, authorization.onNativeResult);
|
|
168
|
+
const execution = Promise.resolve().then(() => registration.executor.execute(close === undefined ? { ...input, signal } : invocation));
|
|
164
169
|
const settled = execution.then(result => ({ kind: 'result', result }), error => ({ kind: 'error', error }));
|
|
170
|
+
let removeUnloaded;
|
|
165
171
|
const unloaded = new Promise(resolve => {
|
|
172
|
+
const abort = () => resolve({ kind: 'unloaded' });
|
|
166
173
|
if (registration.lifecycle.signal.aborted)
|
|
167
|
-
|
|
174
|
+
abort();
|
|
168
175
|
else
|
|
169
|
-
registration.lifecycle.signal.addEventListener('abort',
|
|
176
|
+
registration.lifecycle.signal.addEventListener('abort', abort, { once: true });
|
|
177
|
+
removeUnloaded = () => registration.lifecycle.signal.removeEventListener('abort', abort);
|
|
170
178
|
});
|
|
171
|
-
|
|
179
|
+
let removeCancel;
|
|
180
|
+
const cancelled = new Promise(resolve => {
|
|
181
|
+
if (close === undefined)
|
|
182
|
+
return;
|
|
183
|
+
const abort = () => resolve({ kind: 'unloaded' });
|
|
184
|
+
if (signal.aborted)
|
|
185
|
+
abort();
|
|
186
|
+
else
|
|
187
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
188
|
+
removeCancel = () => signal.removeEventListener('abort', abort);
|
|
189
|
+
});
|
|
190
|
+
let result;
|
|
191
|
+
try {
|
|
192
|
+
result = await Promise.race([settled, unloaded, cancelled]);
|
|
193
|
+
}
|
|
194
|
+
finally {
|
|
195
|
+
removeCancel?.();
|
|
196
|
+
removeUnloaded?.();
|
|
197
|
+
await close?.();
|
|
198
|
+
}
|
|
172
199
|
void settled.then(() => { });
|
|
173
200
|
if (result.kind === 'unloaded') {
|
|
174
201
|
throw new HostExecutorRegistryError('stale-registration', 'Host executor unloaded during execution');
|
|
175
202
|
}
|
|
176
|
-
if (result.kind === 'error')
|
|
203
|
+
if (result.kind === 'error') {
|
|
204
|
+
if (close !== undefined)
|
|
205
|
+
throw new Error('assistant-automations: Host Agent executor failed', { cause: result.error });
|
|
177
206
|
throw result.error;
|
|
207
|
+
}
|
|
178
208
|
return validateHostExecutorResult(result.result);
|
|
179
209
|
}
|
|
180
210
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-executors.js","sourceRoot":"","sources":["../src/host-executors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"host-executors.js","sourceRoot":"","sources":["../src/host-executors.ts"],"names":[],"mappings":"AAkBA,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAC7B;IAArB,YAAqB,IAAmC,EAAE,OAAe;QACvE,KAAK,CAAC,OAAO,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B,cAAc,EAAE,EAAE,CAAA;YAClB,MAAM,KAAK,EAAE,EAAE,CAAA;QACjB,CAAC;QACD,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QAC3B,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC/B,MAAM,IAAI,yBAAyB,CAAC,oBAAoB,EAAE,yCAAyC,CAAC,CAAA;QACtG,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC5B,IAAI,KAAK,KAAK,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;YACtH,MAAM,MAAM,CAAC,KAAK,CAAA;QACpB,CAAC;QACD,OAAO,0BAA0B,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAClD,CAAC;CACF"}
|
package/lib/index.d.ts
CHANGED
|
@@ -9,8 +9,9 @@ export * from './types.js';
|
|
|
9
9
|
export { externalEventDigest, parseExternalEventEnvelope } from './external-event.js';
|
|
10
10
|
export type { ExternalEventEnvelope } from './external-event.js';
|
|
11
11
|
export type { AcceptanceContract, AcceptedExecution, AcceptanceHandle, AcceptanceOwner, AcceptanceScope, AcceptanceTaskInput, TaskAcceptanceRegistration, } from './acceptance.js';
|
|
12
|
-
export { AutomationOperatorSnapshotError, automationDefinitionDigest, inspectAutomationInventoryLocally, inspectAutomationsOperatorSnapshot, listActiveAutomationsForReadiness, listActiveAutomationsLocally, listAutomationsLocally, } from './operator.js';
|
|
13
|
-
export type { AutomationOperatorFileIdentity, AutomationOperatorRecord, AutomationOperatorSnapshotErrorCode, AutomationsOperatorSnapshot, } from './operator.js';
|
|
12
|
+
export { AutomationOperatorSnapshotError, automationDefinitionDigest, automationRetirementSnapshotProtocol, inspectAutomationRetirementSnapshot, inspectAutomationInventoryLocally, inspectAutomationsOperatorSnapshot, listActiveAutomationsForReadiness, listActiveAutomationsLocally, listAutomationsLocally, } from './operator.js';
|
|
13
|
+
export type { AutomationOperatorFileIdentity, AutomationOperatorRecord, AutomationOperatorSnapshotErrorCode, AutomationsOperatorSnapshot, AutomationRetirementSnapshot, AutomationRetirementDefinitionRecord, AutomationRetirementReceipt, AutomationRetirementHistoryTable, AutomationRetirementSchemaEntry, } from './operator.js';
|
|
14
14
|
export declare function apply(ctx: Context, config: import('./service.js').Config): void;
|
|
15
15
|
export default AssistantAutomationsService;
|
|
16
|
+
export { hostAgentToolSchemaDigest } from './host-agent-execution.js';
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -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,2BAA2B,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,eAAO,MAAM,IAAI,uCAAuC,CAAA;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AACvD,YAAY,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAA;AAC7F,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAC3E,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AACrF,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAChE,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,+BAA+B,EAC/B,0B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ChC,+BAA+B,GAChC,MAAM,eAAe,CAAA;AAEtB,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,cAAc,EAAE,MAAM,GAAG,IAAI,CAE/E;AAED,eAAe,2BAA2B,CAAA;AAE1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -4,9 +4,10 @@ export const name = 'dsh-enhanced-assistant-automations';
|
|
|
4
4
|
export { AssistantAutomationsService, Config, version };
|
|
5
5
|
export * from './types.js';
|
|
6
6
|
export { externalEventDigest, parseExternalEventEnvelope } from './external-event.js';
|
|
7
|
-
export { AutomationOperatorSnapshotError, automationDefinitionDigest, inspectAutomationInventoryLocally, inspectAutomationsOperatorSnapshot, listActiveAutomationsForReadiness, listActiveAutomationsLocally, listAutomationsLocally, } from './operator.js';
|
|
7
|
+
export { AutomationOperatorSnapshotError, automationDefinitionDigest, automationRetirementSnapshotProtocol, inspectAutomationRetirementSnapshot, inspectAutomationInventoryLocally, inspectAutomationsOperatorSnapshot, listActiveAutomationsForReadiness, listActiveAutomationsLocally, listAutomationsLocally, } from './operator.js';
|
|
8
8
|
export function apply(ctx, config) {
|
|
9
9
|
new AssistantAutomationsService(ctx, config);
|
|
10
10
|
}
|
|
11
11
|
export default AssistantAutomationsService;
|
|
12
|
+
export { hostAgentToolSchemaDigest } from './host-agent-execution.js';
|
|
12
13
|
//# 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,2BAA2B,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,IAAI,GAAG,oCAAoC,CAAA;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AAGvD,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAWrF,OAAO,EACL,+BAA+B,EAC/B,0BAA0B,EAC1B,iCAAiC,EACjC,kCAAkC,EAClC,iCAAiC,EACjC,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,IAAI,GAAG,oCAAoC,CAAA;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AAGvD,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAWrF,OAAO,EACL,+BAA+B,EAC/B,0BAA0B,EAC1B,oCAAoC,EACpC,mCAAmC,EACnC,iCAAiC,EACjC,kCAAkC,EAClC,iCAAiC,EACjC,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,eAAe,CAAA;AAatB,MAAM,UAAU,KAAK,CAAC,GAAY,EAAE,MAAqC;IACvE,IAAI,2BAA2B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;AAC9C,CAAC;AAED,eAAe,2BAA2B,CAAA;AAE1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { HostAgentExecutionContract } from './types.js';
|
|
2
|
+
declare module '@deepseek-ai/dsh-llm' {
|
|
3
|
+
interface MessageSourceMap {
|
|
4
|
+
'assistant-automations': {
|
|
5
|
+
kind: 'assistant-automations';
|
|
6
|
+
form?: 'notice';
|
|
7
|
+
summary?: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
12
|
+
import type { AssistantPolicyService, PolicyBudgetConfig } from '@dsh-enhanced/assistant-policy';
|
|
13
|
+
import { HostAutomationExecutorRegistry } from './host-executors.js';
|
|
14
|
+
import { AutomationRunnerFailureError, type AutomationRunner, type AutomationRunnerInput, type AutomationRunnerResult } from './coordinator.js';
|
|
15
|
+
import type { AutomationExecutionContext } from './types.js';
|
|
16
|
+
import type { AcceptanceOwner } from './acceptance.js';
|
|
17
|
+
declare module '@deepseek-ai/cordis' {
|
|
18
|
+
interface Context {
|
|
19
|
+
assistantAutomationExecution: AutomationExecutionContext;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export declare class AutomationBudgetReplayError extends AutomationRunnerFailureError {
|
|
23
|
+
readonly reservationStatus: 'finalized' | 'released' | 'reserved';
|
|
24
|
+
readonly code: "automation-budget-reservation-replayed";
|
|
25
|
+
constructor(reservationStatus: 'finalized' | 'released' | 'reserved');
|
|
26
|
+
}
|
|
27
|
+
export declare const AUTOMATION_RUN_BUDGET_METRIC = "automation-runs";
|
|
28
|
+
/** Prove the configured Policy budget uses the fixed per-run unit before reservation. */
|
|
29
|
+
export declare function assertAutomationRunBudget(policy: Pick<AssistantPolicyService, 'getBudgetConfig'>, budgetId: string): Readonly<PolicyBudgetConfig>;
|
|
30
|
+
export interface DshAutomationRunnerOptions {
|
|
31
|
+
/** Explicit escape hatch for deployments whose unattended routes have no configured Policy budget. */
|
|
32
|
+
readonly allowUnbudgetedExecution?: boolean;
|
|
33
|
+
/** Host-only pre-prompt boundary; no Agent/model payload can reach it. */
|
|
34
|
+
readonly prepareAcceptance?: (input: {
|
|
35
|
+
taskId: string;
|
|
36
|
+
automationId: string;
|
|
37
|
+
scope: {
|
|
38
|
+
workspace: string;
|
|
39
|
+
preset: string;
|
|
40
|
+
};
|
|
41
|
+
objective: string;
|
|
42
|
+
owner?: AcceptanceOwner;
|
|
43
|
+
binding?: {
|
|
44
|
+
id: string;
|
|
45
|
+
version: number;
|
|
46
|
+
generation: number;
|
|
47
|
+
};
|
|
48
|
+
}) => void;
|
|
49
|
+
readonly acceptanceEnabled?: () => boolean;
|
|
50
|
+
/** Host-only synchronous fence after setup and before the first model prompt. */
|
|
51
|
+
readonly beforePrompt?: () => void;
|
|
52
|
+
/** Optional hard cap on DSH model stream dispatches for one runner invocation. */
|
|
53
|
+
readonly maxModelCalls?: number;
|
|
54
|
+
/** Host-only model turn: no preset mount and no executable tool surface. */
|
|
55
|
+
readonly modelOnly?: boolean;
|
|
56
|
+
}
|
|
57
|
+
declare class NativeAgentExecution implements AutomationRunner {
|
|
58
|
+
private readonly ctx;
|
|
59
|
+
private readonly policy;
|
|
60
|
+
private readonly hostContract?;
|
|
61
|
+
private readonly allowUnbudgetedExecution;
|
|
62
|
+
private readonly prepareAcceptance;
|
|
63
|
+
private readonly acceptanceEnabled;
|
|
64
|
+
private readonly beforePrompt;
|
|
65
|
+
private readonly maxModelCalls;
|
|
66
|
+
private readonly modelOnly;
|
|
67
|
+
constructor(ctx: Context, policy: AssistantPolicyService, options?: DshAutomationRunnerOptions, hostContract?: Readonly<{
|
|
68
|
+
contract: Readonly<HostAgentExecutionContract>;
|
|
69
|
+
digest: string;
|
|
70
|
+
deadline: Readonly<{
|
|
71
|
+
deadlineAt: number;
|
|
72
|
+
check: () => void;
|
|
73
|
+
authorize?: () => void;
|
|
74
|
+
observe: (read: () => AutomationRunnerResult) => void;
|
|
75
|
+
}>;
|
|
76
|
+
}> | undefined);
|
|
77
|
+
run(input: AutomationRunnerInput): Promise<AutomationRunnerResult>;
|
|
78
|
+
}
|
|
79
|
+
declare module '@deepseek-ai/dsh-session' {
|
|
80
|
+
interface PluginRecordMap {
|
|
81
|
+
'plugin:assistant-automations/host-agent-contract': {
|
|
82
|
+
protocol: 'assistant-automations/host-agent-contract/v1';
|
|
83
|
+
contract: Readonly<HostAgentExecutionContract>;
|
|
84
|
+
contractDigest: string;
|
|
85
|
+
automationId: string;
|
|
86
|
+
occurrenceId: string;
|
|
87
|
+
sessionId: string;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/** Original public runner options and acceptance/guidance/settlement behavior. */
|
|
92
|
+
export declare class DshAutomationRunner extends NativeAgentExecution {
|
|
93
|
+
constructor(ctx: Context, policy: AssistantPolicyService, options?: DshAutomationRunnerOptions);
|
|
94
|
+
}
|
|
95
|
+
/** Internal Host path: outer HostRunner alone reserves and settles the occurrence. */
|
|
96
|
+
export declare function runHostNativeAgent(ctx: Context, policy: AssistantPolicyService, input: AutomationRunnerInput, contract: Readonly<HostAgentExecutionContract>, contractDigest: string, signal: AbortSignal, deadline: Readonly<{
|
|
97
|
+
deadlineAt: number;
|
|
98
|
+
check: () => void;
|
|
99
|
+
authorize?: () => void;
|
|
100
|
+
observe: (read: () => AutomationRunnerResult) => void;
|
|
101
|
+
}>): Promise<AutomationRunnerResult>;
|
|
102
|
+
export interface HostAutomationRunnerOptions {
|
|
103
|
+
readonly allowUnbudgetedExecution?: boolean;
|
|
104
|
+
}
|
|
105
|
+
/** Executes immutable Host contracts without creating an Agent or model turn. */
|
|
106
|
+
export declare class HostAutomationRunner implements AutomationRunner {
|
|
107
|
+
#private;
|
|
108
|
+
private readonly registry;
|
|
109
|
+
private readonly policy;
|
|
110
|
+
private readonly allowUnbudgetedExecution;
|
|
111
|
+
constructor(registry: HostAutomationExecutorRegistry, policy: AssistantPolicyService, options?: HostAutomationRunnerOptions, hostAgentKey?: object);
|
|
112
|
+
run(input: AutomationRunnerInput): Promise<AutomationRunnerResult>;
|
|
113
|
+
private hostDiagnostic;
|
|
114
|
+
}
|
|
115
|
+
/** Preserves the legacy Agent runner while routing Host definitions explicitly. */
|
|
116
|
+
export declare class RoutedAutomationRunner implements AutomationRunner {
|
|
117
|
+
private readonly agent;
|
|
118
|
+
private readonly host;
|
|
119
|
+
constructor(agent: AutomationRunner, host: AutomationRunner);
|
|
120
|
+
run(input: AutomationRunnerInput): Promise<AutomationRunnerResult>;
|
|
121
|
+
}
|
|
122
|
+
export {};
|
|
123
|
+
//# sourceMappingURL=native-agent-execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-agent-execution.d.ts","sourceRoot":"","sources":["../src/native-agent-execution.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,gBAAgB;QACxB,uBAAuB,EAAE;YAAE,IAAI,EAAE,uBAAuB,CAAC;YAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAC9F;CACF;AAGD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAUlD,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAEhG,OAAO,EACL,8BAA8B,EAE/B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAEL,4BAA4B,EAC5B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAEV,0BAA0B,EAO3B,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAOtD,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,4BAA4B,EAAE,0BAA0B,CAAA;KACzD;CACF;AAmGD,qBAAa,2BAA4B,SAAQ,4BAA4B;IAG/D,QAAQ,CAAC,iBAAiB,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU;IAF7E,QAAQ,CAAC,IAAI,EAAG,wCAAwC,CAAS;gBAE5C,iBAAiB,EAAE,WAAW,GAAG,UAAU,GAAG,UAA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