@inventarch/runner 0.0.0-stage → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/open.js ADDED
@@ -0,0 +1,461 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { resolve } from 'node:path';
3
+ import { open, writeRunnerEvidence } from '@inventarch/db';
4
+ import { Engine } from '@inventarch/agent-system';
5
+ import { compileHarness, executionManifest, installedReadCatalog, INSTALLED_READ, } from '@inventarch/agent-composition-system';
6
+ import { captureWorkspace } from '@inventarch/workspace-runtime';
7
+ import { canonical, copy, digest, SessionError, terminal } from '@inventarch/session-system';
8
+ import { sqliteStore } from '@inventarch/session-system/sqlite';
9
+ import { governingMandates, mandateAuthorityOf, profileRefusal, requireMandatesAdmitted } from '@inventarch/runtime';
10
+ import { runnerCatalog } from './catalog.js';
11
+ import { RunnerContext } from './context.js';
12
+ import { requireRunner, RunnerError } from './errors.js';
13
+ import { bindOperations } from './operations.js';
14
+ const boundedKeys = {
15
+ steps: 'steps',
16
+ modelCalls: 'model-calls',
17
+ operations: 'operations',
18
+ tokens: 'tokens',
19
+ children: 'children',
20
+ depth: 'depth',
21
+ bytes: 'bytes',
22
+ };
23
+ function field(record, section, key) {
24
+ const found = record.sections
25
+ .filter((row) => row.name === section)
26
+ .flatMap((row) => row.fields)
27
+ .filter((row) => 'key' in row && row.key === key);
28
+ requireRunner(found.length <= 1, 'IA-RUNNER-FIELD', `Repeated ${section}.${key} is not supported by this host`);
29
+ const row = found[0];
30
+ if (!row || !('value' in row))
31
+ return undefined;
32
+ requireRunner(!row.when && !row.fields, 'IA-RUNNER-FIELD', `Conditional ${section}.${key} is not executable`);
33
+ return row.value;
34
+ }
35
+ const text = (value) => (value && 'text' in value ? value.text : '');
36
+ /** Opens compiled execution on a pinned capture. Every resumed dispatch rechecks that capture and installed code. */
37
+ export function openRunner(options) {
38
+ const root = resolve(options.root), inputs = options.inputs ?? {};
39
+ const capture = captureWorkspace(root, 'runner', inputs);
40
+ const reader = open(root, { ...inputs, cache: false }), within = reader.resolveScope().token;
41
+ let context;
42
+ let bound;
43
+ const store = sqliteStore(resolve(root, '.ia/work/runs'));
44
+ try {
45
+ requireMandatesAdmitted(reader, within);
46
+ requireRunner(!reader.report.findings.some((item) => item.severity === 'error'), 'IA-RUNNER-ADMISSION', 'The workspace does not admit cleanly');
47
+ const records = reader.records({ within });
48
+ const profiles = records.filter((row) => row.discriminator === 'agent-profile' && [row.name, row.identity].includes(options.profile));
49
+ requireRunner(profiles.length === 1, 'IA-RUNNER-PROFILE', 'Select one admitted agent profile');
50
+ const profileRecord = profiles[0];
51
+ const resolveRef = (value) => {
52
+ if (value?.kind !== 'ref')
53
+ return undefined;
54
+ const got = reader.resolve(value, { within });
55
+ return got.ok ? got.identity : undefined;
56
+ };
57
+ const entries = records.filter((row) => row.discriminator === 'execution-binding' &&
58
+ text(field(row, 'binding', 'kind')) === 'entry' &&
59
+ resolveRef(field(row, 'binding', 'target')) === profileRecord.identity &&
60
+ (!options.entry || [row.name, row.identity].includes(options.entry)));
61
+ requireRunner(entries.length === 1, 'IA-RUNNER-ENTRY', 'Select one entry binding for the profile');
62
+ const entry = entries[0];
63
+ const harnesses = records.filter((row) => {
64
+ if (row.discriminator !== 'harness' || (options.harness && ![row.name, row.identity].includes(options.harness)))
65
+ return false;
66
+ const bindings = field(row, 'composition', 'bindings');
67
+ return bindings?.kind === 'list' && bindings.items.some((value) => resolveRef(value) === entry.identity);
68
+ });
69
+ requireRunner(harnesses.length === 1, 'IA-RUNNER-HARNESS', 'Select one harness containing the entry binding');
70
+ const catalog = copy(options.catalog ?? runnerCatalog());
71
+ const result = compileHarness(capture, { harness: harnesses[0].identity, entry: entry.identity, catalog });
72
+ if (!result.ok)
73
+ throw new RunnerError('IA-RUNNER-COMPOSITION', canonical(result.diagnostics));
74
+ const compiled = result.manifest, manifest = executionManifest(compiled, catalog);
75
+ const principal = options.principal ?? 'local-operator';
76
+ const currentCapture = () => captureWorkspace(root, 'runner', inputs);
77
+ const profileMandates = (profile, path) => {
78
+ const found = governingMandates(reader, within, {
79
+ actor: profile.agent,
80
+ workspace: manifest.workspace,
81
+ ...(path ? { path } : {}),
82
+ });
83
+ const selected = compiled.profiles[profile.id]?.mandate;
84
+ const named = records.find((row) => row.identity === selected);
85
+ if (!named || found.some((other) => other.identity === named.identity))
86
+ return [...found];
87
+ const authority = mandateAuthorityOf(named);
88
+ const participant = resolveRef(field(named, 'authority', 'participant'));
89
+ return [
90
+ ...found,
91
+ {
92
+ ...authority,
93
+ ...(participant ? { participant } : {}),
94
+ binds: !authority.participant || participant === profile.agent,
95
+ },
96
+ ];
97
+ };
98
+ const authorizeOperation = (operation, path, profileId = compiled.entry.profile) => {
99
+ const profile = manifest.profiles[profileId];
100
+ const operationRow = manifest.operations[operation];
101
+ requireRunner(operationRow && profile.operations.includes(operation), 'IA-RUNNER-OPERATION-DENIED', 'Operation is outside the selected profile');
102
+ const mode = operationRow.effects.every((effect) => effect === 'read') ? 'read' : 'effect';
103
+ const refusal = profileRefusal(profileMandates(profile, path), mode, ['operation']).refusal;
104
+ if (refusal)
105
+ throw new RunnerError(refusal.code, refusal.message, refusal.next);
106
+ };
107
+ bound = bindOperations({
108
+ capture,
109
+ compiled,
110
+ catalog,
111
+ manifest,
112
+ principal,
113
+ reader,
114
+ currentCapture,
115
+ authorize: async (operation, path, operationContext) => {
116
+ const state = await store.read(operationContext.sessionId);
117
+ const run = state.runs[operationContext.runId];
118
+ authorizeOperation(operation, path, run.profile);
119
+ const limits = operationLimits(state, run.id, operation, path, true);
120
+ for (const key of Object.keys(limits))
121
+ operationContext.grant.limits[key] = Math.min(operationContext.grant.limits[key], limits[key]);
122
+ operationContext.grant.expiresAt = Math.min(operationContext.grant.expiresAt, limits.deadline);
123
+ },
124
+ });
125
+ context = new RunnerContext(root, { ...inputs, cache: false });
126
+ let phase = 'orient';
127
+ const narrowedGrant = (profile, state, path) => {
128
+ const selected = compiled.profiles[profile.id];
129
+ const mandates = profileMandates(profile, path);
130
+ const limits = {
131
+ steps: 64,
132
+ modelCalls: 16,
133
+ operations: 16,
134
+ tokens: 200000,
135
+ children: 0,
136
+ depth: 0,
137
+ bytes: 8000000,
138
+ deadline: state?.limits.deadline ?? Date.now() + Math.min(selected.limits.durationMs ?? 3600000, 3600000),
139
+ };
140
+ for (const [key, spelling] of Object.entries(boundedKeys)) {
141
+ limits[key] = Math.min(limits[key], selected.limits[key] ?? limits[key]);
142
+ for (const mandate of mandates) {
143
+ if (mandate.binds === false)
144
+ continue;
145
+ const record = records.find((row) => row.identity === mandate.identity);
146
+ const value = field(record, 'execution', `limit-${spelling}`);
147
+ if (value && 'text' in value)
148
+ limits[key] = Math.min(limits[key], Number(value.text));
149
+ }
150
+ }
151
+ for (const mandate of mandates) {
152
+ if (mandate.binds === false)
153
+ continue;
154
+ const value = field(records.find((row) => row.identity === mandate.identity), 'execution', 'limit-duration-ms');
155
+ if (value && 'text' in value)
156
+ limits.deadline = Math.min(limits.deadline, (state ? Date.parse(state.createdAt) : Date.now()) + Number(value.text));
157
+ }
158
+ return {
159
+ id: `runner-${capture.revision}`,
160
+ principal,
161
+ workspace: manifest.workspace,
162
+ profiles: [profile.id],
163
+ operations: [...profile.operations],
164
+ effects: ['read'],
165
+ sources: [capture.revision],
166
+ models: [profile.model],
167
+ limits,
168
+ expiresAt: limits.deadline,
169
+ };
170
+ };
171
+ const authorize = async (who, current, state) => {
172
+ requireRunner(who === principal && digest(current) === digest(manifest), 'IA-RUNNER-AUTHORITY', 'Principal or manifest changed');
173
+ const ceiling = narrowedGrant(manifest.profiles[compiled.entry.profile], state);
174
+ if (!options.authorize)
175
+ return ceiling;
176
+ const grant = copy(await options.authorize(who, current, state));
177
+ for (const key of Object.keys(ceiling.limits))
178
+ grant.limits[key] = Math.min(grant.limits[key], ceiling.limits[key]);
179
+ for (const key of ['operations', 'effects', 'profiles', 'sources', 'models'])
180
+ grant[key] = grant[key].filter((value) => ceiling[key].includes(value));
181
+ grant.expiresAt = Math.min(grant.expiresAt, ceiling.expiresAt);
182
+ return grant;
183
+ };
184
+ const operationPath = (args) => args && typeof args === 'object' && !Array.isArray(args) && 'path' in args && typeof args.path === 'string'
185
+ ? args.path
186
+ : undefined;
187
+ const operationLimits = (state, runId, operation, path, prepared) => {
188
+ const run = state.runs[runId];
189
+ const limits = narrowedGrant(manifest.profiles[run.profile], state, path).limits;
190
+ const used = state.budget;
191
+ requireRunner(Date.now() < limits.deadline &&
192
+ used.steps <= limits.steps &&
193
+ used.modelCalls <= limits.modelCalls &&
194
+ used.operations + (prepared ? 0 : 1) <= limits.operations &&
195
+ used.usedTokens + used.reservedTokens <= limits.tokens &&
196
+ used.children <= limits.children &&
197
+ run.depth <= limits.depth &&
198
+ // Reserve the installed output ceiling and journal envelope before revealing a body.
199
+ used.retainedBytes + (manifest.operations[operation]?.maxOutputBytes ?? 65536) + 2048 <= limits.bytes, 'IA-RUNNER-MANDATE-LIMIT', 'The applicable mandate limits do not admit this operation against the original session budget');
200
+ return limits;
201
+ };
202
+ const disclosure = (profile, grant) => {
203
+ requireRunner(grant.principal === principal &&
204
+ grant.workspace === manifest.workspace &&
205
+ grant.expiresAt > Date.now() &&
206
+ grant.limits.deadline > Date.now() &&
207
+ grant.profiles.includes(profile.id) &&
208
+ grant.models.includes(profile.model) &&
209
+ grant.effects.includes('read') &&
210
+ grant.sources.includes(capture.revision), 'IA-RUNNER-AUTHORITY', 'Retained and current host authority do not permit source context disclosure');
211
+ const refusal = profileRefusal(profileMandates(profile), 'read').refusal;
212
+ if (refusal)
213
+ throw new RunnerError(refusal.code, refusal.message, refusal.next);
214
+ };
215
+ const currentDisclosure = async (sessionId, runId, profile) => {
216
+ const state = await store.read(sessionId);
217
+ const grant = await authorize(principal, manifest, state);
218
+ const retained = state.runs[runId].authority;
219
+ for (const key of ['operations', 'effects', 'profiles', 'sources', 'models'])
220
+ grant[key] = grant[key].filter((value) => retained[key].includes(value));
221
+ for (const key of Object.keys(grant.limits))
222
+ grant.limits[key] = Math.min(grant.limits[key], retained.limits[key]);
223
+ grant.expiresAt = Math.min(grant.expiresAt, retained.expiresAt);
224
+ disclosure(profile, grant);
225
+ };
226
+ const verify = async () => {
227
+ if (currentCapture().revision !== capture.revision)
228
+ return false;
229
+ const fresh = compileHarness(capture, { harness: compiled.id, entry: compiled.entry.binding, catalog });
230
+ return (fresh.ok &&
231
+ fresh.manifest.digest === compiled.digest &&
232
+ (!manifest.operations[INSTALLED_READ.operation] ||
233
+ canonical(installedReadCatalog().operations[INSTALLED_READ.implementation]) ===
234
+ canonical(catalog.operations[INSTALLED_READ.implementation])));
235
+ };
236
+ const model = options.model ?? { id: 'runner/external', generate: async () => ({ deferred: true }) };
237
+ const constrainResponse = (response, profileId) => {
238
+ const action = response.action;
239
+ if (action &&
240
+ typeof action === 'object' &&
241
+ 'type' in action &&
242
+ action.type === 'invoke' &&
243
+ 'operation' in action &&
244
+ typeof action.operation === 'string') {
245
+ const args = 'input' in action ? action.input : undefined;
246
+ try {
247
+ authorizeOperation(action.operation, args && typeof args === 'object' && 'path' in args && typeof args.path === 'string' ? args.path : undefined, profileId);
248
+ }
249
+ catch (error) {
250
+ if (!(error instanceof RunnerError))
251
+ throw error;
252
+ return {
253
+ ...response,
254
+ action: {
255
+ type: 'outcome',
256
+ kind: 'refusal',
257
+ message: `${error.code}: ${error.message}; next: ${error.next}`,
258
+ continuation: 'finish',
259
+ },
260
+ };
261
+ }
262
+ }
263
+ return response;
264
+ };
265
+ const engine = new Engine(manifest, {
266
+ store,
267
+ operations: bound.operations,
268
+ authorize,
269
+ verifyManifest: verify,
270
+ evaluate: options.evaluate ??
271
+ (async () => ({ status: 'unavailable', evidence: [], message: 'No evaluator is installed in this host' })),
272
+ preflight: async (operation, args, operationContext) => {
273
+ authorizeOperation(operation.id, args && typeof args === 'object' && !Array.isArray(args) && typeof args['path'] === 'string'
274
+ ? args['path']
275
+ : undefined);
276
+ return (operationContext.grant.effects.includes('read') && operation.effects.every((effect) => effect === 'read'));
277
+ },
278
+ model: {
279
+ id: model.id,
280
+ generate: async (request, signal) => {
281
+ try {
282
+ await currentDisclosure(request.sessionId, request.runId, request.profile);
283
+ }
284
+ catch (error) {
285
+ if (!(error instanceof RunnerError))
286
+ throw error;
287
+ // The attempt is already journaled, but no request has reached the model transport.
288
+ return {
289
+ action: {
290
+ type: 'outcome',
291
+ kind: 'refusal',
292
+ message: `${error.code}: ${error.message}; next: ${error.next}`,
293
+ continuation: 'finish',
294
+ },
295
+ usage: 0,
296
+ model: request.profile.model,
297
+ provider: 'runner-policy',
298
+ };
299
+ }
300
+ // Compiler teaching remains provenance. Current position/read disclosure supplies model teaching.
301
+ const response = await model.generate({ ...request, profile: { ...request.profile, instructions: [], voice: '' } }, signal);
302
+ return 'deferred' in response ? response : constrainResponse(response, request.profile.id);
303
+ },
304
+ },
305
+ context: async (profile, _task, grant, budget) => {
306
+ // Engine supplies the grant intersected with the authority retained at session creation.
307
+ disclosure(profile, grant);
308
+ const ctx = catalog.contexts[compiled.profiles[profile.id].contexts[0]].value;
309
+ const shape = ctx.coordinate.category === 'capability'
310
+ ? 'execution'
311
+ : ctx.coordinate.category === 'rule'
312
+ ? 'governance'
313
+ : ctx.coordinate.category === 'evidence'
314
+ ? 'learning'
315
+ : 'context';
316
+ return context.position({
317
+ seat: manifest.workspace,
318
+ shape,
319
+ phase,
320
+ depth: Math.min(2, grant.limits.depth),
321
+ budget: Math.min(64, ctx.records, grant.limits.steps),
322
+ }, budget);
323
+ },
324
+ });
325
+ let active;
326
+ const persist = async (state) => {
327
+ writeRunnerEvidence(root, {
328
+ authoredRevision: reader.authoredRevision,
329
+ events: (await store.journal(state.id)).events,
330
+ });
331
+ return state;
332
+ };
333
+ const step = async () => {
334
+ requireRunner(active, 'IA-RUNNER-NOT-OPEN', 'Open or resume a run first');
335
+ const before = await store.read(active);
336
+ const pending = before.runs[before.rootId].pendingAction;
337
+ const lastAttempt = Object.values(before.attempts).at(-1);
338
+ phase =
339
+ before.budget.modelCalls === 0
340
+ ? 'orient'
341
+ : pending && typeof pending === 'object' && !Array.isArray(pending) && pending['type'] === 'invoke'
342
+ ? 'act'
343
+ : lastAttempt?.kind === 'operation' && lastAttempt.status === 'observed'
344
+ ? 'learn'
345
+ : 'plan';
346
+ try {
347
+ if (before.runs[before.rootId].status === 'running' &&
348
+ pending &&
349
+ typeof pending === 'object' &&
350
+ !Array.isArray(pending) &&
351
+ pending['type'] === 'invoke' &&
352
+ typeof pending['operation'] === 'string') {
353
+ const path = operationPath(pending['input']);
354
+ authorizeOperation(pending['operation'], path, before.runs[before.rootId].profile);
355
+ operationLimits(before, before.rootId, pending['operation'], path, false);
356
+ }
357
+ return await persist(await engine.advance(active, principal, { maxActions: 1 }));
358
+ }
359
+ catch (error) {
360
+ if (!(error instanceof RunnerError) &&
361
+ (!(error instanceof SessionError) ||
362
+ !['IA-ENGINE-LIMIT-EXCEEDED', 'IA-ENGINE-AUTHORITY-DENIED'].includes(error.code)))
363
+ throw error;
364
+ // Preserve exact expected refusals. Unexpected Engine/host/storage errors still propagate.
365
+ const owner = await store.acquire(active);
366
+ try {
367
+ const latest = await store.read(active);
368
+ const prepared = Object.values(latest.attempts).filter((attempt) => attempt.runId === latest.rootId && attempt.status === 'prepared');
369
+ // Retain preparation and settle only proven undispatched attempts; never rewrite dispatched effects.
370
+ const mutations = prepared.map((attempt) => ({ type: 'attempt.abandon', attemptId: attempt.id }));
371
+ mutations.push({
372
+ type: 'run.wait',
373
+ runId: latest.rootId,
374
+ wait: {
375
+ id: randomUUID(),
376
+ reason: error.code.includes('LIMIT') ? 'runner-limit-refusal' : 'runner-authority-refusal',
377
+ objectIds: prepared.map((attempt) => attempt.id),
378
+ continuation: 'stop',
379
+ details: {
380
+ code: error.code,
381
+ message: error.message,
382
+ next: error instanceof RunnerError
383
+ ? error.next
384
+ : `ia position --seat ${compiled.profiles[compiled.entry.profile].mandate ?? manifest.workspace} --shape governance`,
385
+ },
386
+ },
387
+ });
388
+ await store.command({
389
+ id: randomUUID(),
390
+ sessionId: active,
391
+ actor: principal,
392
+ expected: latest.sequence,
393
+ mutation: mutations[0],
394
+ following: mutations.slice(1),
395
+ }, owner);
396
+ }
397
+ finally {
398
+ await store.release(owner);
399
+ }
400
+ return persist(await store.read(active));
401
+ }
402
+ };
403
+ return {
404
+ manifest,
405
+ compiled,
406
+ capture,
407
+ store,
408
+ async start(task, id = randomUUID()) {
409
+ const state = await engine.start({
410
+ commandId: `open-${id}`,
411
+ sessionId: id,
412
+ principal,
413
+ profile: compiled.entry.profile,
414
+ task,
415
+ });
416
+ active = id;
417
+ return persist(state);
418
+ },
419
+ async resume(id) {
420
+ const state = await store.read(id);
421
+ requireRunner(state.principal === principal && state.manifestDigest === digest(manifest), 'IA-RUNNER-RESUME-DENIED', 'Resume requires the pinned principal, profile, capture and installed contracts');
422
+ requireRunner(await verify(), 'IA-RUNNER-SOURCE-CHANGED', 'Pinned input or implementation changed');
423
+ active = id;
424
+ return persist(state);
425
+ },
426
+ step,
427
+ async run(maxSteps = 64) {
428
+ requireRunner(Number.isSafeInteger(maxSteps) && maxSteps > 0 && maxSteps <= 128, 'IA-RUNNER-LIMIT', 'Run requires 1..128 scheduler steps');
429
+ requireRunner(active, 'IA-RUNNER-NOT-OPEN', 'Open or resume a run first');
430
+ let state = await store.read(active);
431
+ for (let n = 0; n < maxSteps && !terminal(state.runs[state.rootId]); n++) {
432
+ const before = state.sequence;
433
+ state = await step();
434
+ if (state.sequence === before || state.runs[state.rootId].status === 'waiting')
435
+ break;
436
+ }
437
+ return state;
438
+ },
439
+ async submit(attempt, response, commandId = randomUUID()) {
440
+ requireRunner(active, 'IA-RUNNER-NOT-OPEN', 'Open or resume a run first');
441
+ return persist(await engine.submitModel(active, principal, attempt, constrainResponse(response, compiled.entry.profile), commandId));
442
+ },
443
+ async close() {
444
+ bound.close();
445
+ context.close();
446
+ reader.close();
447
+ await store.close();
448
+ },
449
+ };
450
+ }
451
+ catch (error) {
452
+ bound?.close();
453
+ context?.close();
454
+ reader.close();
455
+ void store.close();
456
+ if (error instanceof SessionError)
457
+ throw error;
458
+ throw error;
459
+ }
460
+ }
461
+ //# sourceMappingURL=open.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open.js","sourceRoot":"","sources":["../src/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,GACf,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAE7F,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAErH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAgBjD,MAAM,WAAW,GAAG;IAClB,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,aAAa;IACzB,UAAU,EAAE,YAAY;IACxB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACN,CAAC;AAEX,SAAS,KA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AK,CAAC,MAAM,CAAE,CAAC,MAAM,KAAK,SAAS;wBAAE,MAAM;gBACzF,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;YACD,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,QAAuB,EAAE,YAAoB,UAAU,EAAE;gBACrF,aAAa,CAAC,MAAM,EAAE,oBAAoB,EAAE,4BAA4B,CAAC,CAAC;gBAC1E,OAAO,OAAO,CACZ,MAAM,MAAM,CAAC,WAAW,CACtB,MAAM,EACN,SAAS,EACT,OAAO,EACP,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,EACnD,SAAS,CACV,CACF,CAAC;YACJ,CAAC;YACD,KAAK,CAAC,KAAK;gBACT,KAAM,CAAC,KAAK,EAAE,CAAC;gBACf,OAAQ,CAAC,KAAK,EAAE,CAAC;gBACjB,MAAM,CAAC,KAAK,EAAE,CAAC;gBACf,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;YACtB,CAAC;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,KAAK,EAAE,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,KAAK,EAAE,CAAC;QACjB,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,KAAK,YAAY,YAAY;YAAE,MAAM,KAAK,CAAC;QAC/C,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { CompiledHarness, CompositionCatalog } from '@inventarch/agent-composition-system';
2
+ import type { Manifest, OperationAdapter, OperationContext } from '@inventarch/agent-system';
3
+ import type { Capture } from '@inventarch/workspace-runtime';
4
+ import type { ReadHandle } from '@inventarch/db';
5
+ /** Only statically imported first-party code may bind; authored module names are never resolved. */
6
+ export declare function bindOperations(input: {
7
+ capture: Capture;
8
+ compiled: CompiledHarness;
9
+ catalog: CompositionCatalog;
10
+ manifest: Manifest;
11
+ principal: string;
12
+ reader: ReadHandle;
13
+ currentCapture: () => Capture;
14
+ authorize: (operation: string, path: string | undefined, context: OperationContext) => Promise<void>;
15
+ }): {
16
+ operations: Readonly<Record<string, OperationAdapter>>;
17
+ close: () => void | undefined;
18
+ };
19
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIjD,oGAAoG;AACpG,wBAAgB,cAAc,CAAC,KAAK,EAAE;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,cAAc,EAAE,MAAM,OAAO,CAAC;IAC9B,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACtG;;;EAuEA"}
@@ -0,0 +1,75 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { readFileSync } from 'node:fs';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { INSTALLED_READ, installedReadAdapters, installedReadCatalog } from '@inventarch/agent-composition-system';
5
+ import { bindExecution, executionBindings } from '@inventarch/workspace-runtime/bind';
6
+ import { canonical } from '@inventarch/session-system';
7
+ import { RunnerError } from './errors.js';
8
+ /** Only statically imported first-party code may bind; authored module names are never resolved. */
9
+ export function bindOperations(input) {
10
+ const bindings = executionBindings(input.reader);
11
+ const fixed = installedReadCatalog();
12
+ const entryUrl = import.meta.resolve('@inventarch/agent-composition-system');
13
+ const extension = entryUrl.endsWith('.ts') ? 'ts' : 'js';
14
+ const codePath = fileURLToPath(new URL(`./installed-read.${extension}`, entryUrl));
15
+ const codeDigest = createHash('sha256').update(readFileSync(codePath)).digest('hex');
16
+ const read = Object.hasOwn(input.manifest.operations, INSTALLED_READ.operation)
17
+ ? installedReadAdapters(input.capture, input)
18
+ : undefined;
19
+ const operations = {};
20
+ for (const operation of Object.values(input.manifest.operations)) {
21
+ const selected = input.compiled.bindings.find((row) => row.kind === 'operation' && row.target === operation.id);
22
+ const binding = bindings.find((row) => row.identity === selected?.identity);
23
+ const available = operation.id === INSTALLED_READ.operation &&
24
+ selected?.implementation === INSTALLED_READ.implementation &&
25
+ canonical(input.catalog.operations[INSTALLED_READ.implementation]) ===
26
+ canonical(fixed.operations[INSTALLED_READ.implementation]);
27
+ const result = binding &&
28
+ bindExecution(binding, available
29
+ ? {
30
+ status: 'present',
31
+ operations: [
32
+ {
33
+ id: INSTALLED_READ.implementation,
34
+ status: 'available',
35
+ version: 1,
36
+ operation: INSTALLED_READ.operation,
37
+ handler: INSTALLED_READ.handler,
38
+ input: INSTALLED_READ.input,
39
+ output: INSTALLED_READ.output,
40
+ module: `runtime/node_modules/@inventarch/agent-composition-system/${extension === 'ts' ? 'src' : 'dist'}/installed-read.${extension}`,
41
+ digest: codeDigest,
42
+ packages: ['@inventarch/agent-composition-system'],
43
+ },
44
+ ],
45
+ }
46
+ : {
47
+ status: 'unavailable',
48
+ reason: 'This runner has no statically installed implementation for that operation',
49
+ });
50
+ const bound = result?.status === 'bound' ? read?.operations[operation.handler] : undefined;
51
+ operations[operation.handler] = {
52
+ id: operation.handler,
53
+ execute: async (args, context) => {
54
+ const path = args && typeof args === 'object' && !Array.isArray(args) && typeof args['path'] === 'string'
55
+ ? args['path']
56
+ : undefined;
57
+ await input.authorize(operation.id, path, context);
58
+ if (!bound)
59
+ throw new RunnerError('IA-RUNNER-BINDING-UNAVAILABLE', result?.reason ?? 'No admitted execution binding');
60
+ const scoped = {
61
+ ...context,
62
+ assertCurrent: async () => {
63
+ await context.assertCurrent?.();
64
+ scoped.grant = context.grant;
65
+ await input.authorize(operation.id, path, scoped);
66
+ },
67
+ };
68
+ // installedReadAdapters rechecks complete implementation closure, capture and current grant at dispatch.
69
+ return bound.execute(args, scoped);
70
+ },
71
+ };
72
+ }
73
+ return { operations: Object.freeze(operations), close: () => read?.close() };
74
+ }
75
+ //# sourceMappingURL=operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAInH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEtF,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,oGAAoG;AACpG,MAAM,UAAU,cAAc,CAAC,KAS9B;IACC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,oBAAoB,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAC;IAC7E,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAA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AAK,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;gBACnD,IAAI,CAAC,KAAK;oBACR,MAAM,IAAI,WAAW,CAAC,+BAA+B,EAAE,MAAM,EAAE,MAAM,IAAI,+BAA+B,CAAC,CAAC;gBAC5G,MAAM,MAAM,GAAqB;oBAC/B,GAAG,OAAO;oBACV,aAAa,EAAE,KAAK,IAAI,EAAE;wBACxB,MAAM,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC;wBAChC,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;wBAC7B,MAAM,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;oBACpD,CAAC;iBACF,CAAC;gBACF,yGAAyG;gBACzG,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACrC,CAAC;SACF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;AAC/E,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** An explicit local response is data: read at most 64 KiB from one unchanged regular file. */
2
+ export declare function readResponseFile(path: string): string;
3
+ //# sourceMappingURL=response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../src/response.ts"],"names":[],"mappings":"AAgBA,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAiCrD"}