@jini-ai/daemon 0.2.1 → 0.3.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/README.md +92 -0
- package/dist/agent-executor.d.ts +714 -42
- package/dist/agent-executor.d.ts.map +1 -1
- package/dist/agent-executor.js +1416 -351
- package/dist/agent-executor.js.map +1 -1
- package/dist/continuation/index.d.ts +1 -0
- package/dist/continuation/index.d.ts.map +1 -1
- package/dist/continuation/index.js +1 -0
- package/dist/continuation/index.js.map +1 -1
- package/dist/continuation/run-scoped-context-store.d.ts +79 -0
- package/dist/continuation/run-scoped-context-store.d.ts.map +1 -0
- package/dist/continuation/run-scoped-context-store.js +56 -0
- package/dist/continuation/run-scoped-context-store.js.map +1 -0
- package/dist/continuation/run-start-handler.d.ts +39 -9
- package/dist/continuation/run-start-handler.d.ts.map +1 -1
- package/dist/continuation/run-start-handler.js +12 -2
- package/dist/continuation/run-start-handler.js.map +1 -1
- package/dist/delegated-tool-bridge.d.ts +8 -0
- package/dist/delegated-tool-bridge.d.ts.map +1 -1
- package/dist/delegated-tool-bridge.js +117 -1
- package/dist/delegated-tool-bridge.js.map +1 -1
- package/dist/event-log.d.ts +18 -105
- package/dist/event-log.d.ts.map +1 -1
- package/dist/event-log.js +0 -17
- package/dist/event-log.js.map +1 -1
- package/dist/frontend-capability-tools.d.ts +1 -1
- package/dist/frontend-capability-tools.js +1 -1
- package/dist/frontend-session-registry.d.ts.map +1 -1
- package/dist/frontend-session-registry.js +26 -10
- package/dist/frontend-session-registry.js.map +1 -1
- package/dist/image-prompt-delivery.d.ts +56 -0
- package/dist/image-prompt-delivery.d.ts.map +1 -0
- package/dist/image-prompt-delivery.js +104 -0
- package/dist/image-prompt-delivery.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/remote-tool-bridge.d.ts +45 -0
- package/dist/remote-tool-bridge.d.ts.map +1 -0
- package/dist/remote-tool-bridge.js +23 -0
- package/dist/remote-tool-bridge.js.map +1 -0
- package/dist/routines/routine-store.js +1 -1
- package/dist/routines/schedule.d.ts +0 -8
- package/dist/routines/schedule.d.ts.map +1 -1
- package/dist/routines/schedule.js +71 -44
- package/dist/routines/schedule.js.map +1 -1
- package/dist/routines/scheduler.d.ts +43 -0
- package/dist/routines/scheduler.d.ts.map +1 -1
- package/dist/routines/scheduler.js +160 -120
- package/dist/routines/scheduler.js.map +1 -1
- package/dist/run/core/retry.d.ts.map +1 -1
- package/dist/run/core/retry.js +47 -35
- package/dist/run/core/retry.js.map +1 -1
- package/dist/run/diagnostics/diagnostics.d.ts.map +1 -1
- package/dist/run/diagnostics/diagnostics.js +149 -91
- package/dist/run/diagnostics/diagnostics.js.map +1 -1
- package/dist/run-lifecycle.d.ts +84 -4
- package/dist/run-lifecycle.d.ts.map +1 -1
- package/dist/run-lifecycle.js +378 -116
- package/dist/run-lifecycle.js.map +1 -1
- package/dist/terminal-session.d.ts +1 -1
- package/dist/terminal-session.d.ts.map +1 -1
- package/dist/terminal-session.js +1 -1
- package/dist/tool-executor.d.ts +26 -6
- package/dist/tool-executor.d.ts.map +1 -1
- package/dist/tool-executor.js +220 -55
- package/dist/tool-executor.js.map +1 -1
- package/dist/tool-result-media.d.ts +79 -0
- package/dist/tool-result-media.d.ts.map +1 -0
- package/dist/tool-result-media.js +80 -0
- package/dist/tool-result-media.js.map +1 -0
- package/dist/tool-result-surfaces.d.ts +78 -0
- package/dist/tool-result-surfaces.d.ts.map +1 -0
- package/dist/tool-result-surfaces.js +92 -0
- package/dist/tool-result-surfaces.js.map +1 -0
- package/package.json +18 -9
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module image-prompt-delivery
|
|
3
|
+
*
|
|
4
|
+
* The `'prompt-path'` half of `RuntimeAgentDef.imageDelivery`
|
|
5
|
+
* (`@jini-ai/agent-runtime`'s `types.ts` — see that field's own doc for the
|
|
6
|
+
* full three-mode contract and why `'native'` defs must never also go
|
|
7
|
+
* through here). A def declares `imageDelivery: 'prompt-path'` when its CLI
|
|
8
|
+
* has no dedicated image-attachment mechanism but CAN read a local file once
|
|
9
|
+
* its path is named in the prompt text — confirmed for Claude Code by a live
|
|
10
|
+
* probe (see `defs/claude.ts`'s module doc): piping a prompt naming
|
|
11
|
+
* `/tmp/probe-image.png` into a real `claude -p` produced an accurate
|
|
12
|
+
* description of the image, but only once that path's directory was on the
|
|
13
|
+
* CLI's allowed-directory list.
|
|
14
|
+
*
|
|
15
|
+
* `applyImagePromptDelivery` is the ONE function `agent-executor.ts#run`
|
|
16
|
+
* calls, once, before `buildArgs`/`preparePromptFileForAgent`/
|
|
17
|
+
* `writePromptToStdin` ever see the prompt or `extraAllowedDirs` — see that
|
|
18
|
+
* module's own call site for why every downstream consumer of "the prompt"
|
|
19
|
+
* and "the allowed dirs" was switched to this function's output rather than
|
|
20
|
+
* the raw `input.prompt`/`input.extraAllowedDirs`. Adopting this mechanism
|
|
21
|
+
* for another def is exactly one line: add `imageDelivery: 'prompt-path'` to
|
|
22
|
+
* that def's literal. No other file needs to change.
|
|
23
|
+
*
|
|
24
|
+
* **Zero images is a strict no-op.** Every function below returns its inputs
|
|
25
|
+
* completely unchanged (not merely "equivalent" — literally the same
|
|
26
|
+
* `prompt` string and the same `extraAllowedDirs` reference/value) when
|
|
27
|
+
* `imagePaths` is empty, so a run with no attachments is byte-identical to
|
|
28
|
+
* this module never having been added. See
|
|
29
|
+
* `__tests__/image-prompt-delivery.test.ts`'s "byte-identical" case for the
|
|
30
|
+
* exact-equality regression proof.
|
|
31
|
+
*/
|
|
32
|
+
import path from 'node:path';
|
|
33
|
+
/**
|
|
34
|
+
* Appends an attachments section to `prompt`, naming each image as a real
|
|
35
|
+
* file the user provided rather than dumping bare paths — legible to a
|
|
36
|
+
* model, which needs to understand these are attachments to read and act on,
|
|
37
|
+
* not incidental text. `imagePaths` must already be non-empty; callers (just
|
|
38
|
+
* `applyImagePromptDelivery` below) are expected to have filtered/checked
|
|
39
|
+
* that themselves so this function's own contract stays a straightforward
|
|
40
|
+
* "always augment" rather than duplicating the empty-check in two places.
|
|
41
|
+
*
|
|
42
|
+
* @param prompt - The user's original prompt text, unmodified up to this point.
|
|
43
|
+
* @param imagePaths - One or more absolute image file paths, already filtered non-empty.
|
|
44
|
+
* @returns `prompt` with an attachments section appended.
|
|
45
|
+
* @complexity O(n) in the number of images — one line rendered per path, no I/O.
|
|
46
|
+
* @overallScore 100
|
|
47
|
+
*/
|
|
48
|
+
export function augmentPromptWithImageAttachments(prompt, imagePaths) {
|
|
49
|
+
const list = imagePaths.map((imagePath, index) => `${index + 1}. ${imagePath}`).join('\n');
|
|
50
|
+
const plural = imagePaths.length === 1;
|
|
51
|
+
return (`${prompt}\n\n---\n` +
|
|
52
|
+
`The user attached the following image ${plural ? 'file' : 'files'} to this message. ` +
|
|
53
|
+
`${plural ? 'It is a' : 'These are'} real file${plural ? '' : 's'} on disk — read ${plural ? 'it' : 'each one'} directly ` +
|
|
54
|
+
`(e.g. with your file-reading tool) before responding:\n${list}`);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Directories a 'prompt-path' def's CLI must be allowed to read from so it
|
|
58
|
+
* can actually open the files the augmented prompt just told it about — the
|
|
59
|
+
* second half of the live-probe finding in `defs/claude.ts`'s module doc
|
|
60
|
+
* (the CLI refused the same path until its directory was allow-listed).
|
|
61
|
+
* Deduplicated, and order-stable (`Set` preserves insertion order) so a
|
|
62
|
+
* snapshot/equality test against the merged list is deterministic.
|
|
63
|
+
*
|
|
64
|
+
* @param imagePaths - One or more absolute image file paths, already filtered non-empty.
|
|
65
|
+
* @returns Each path's containing directory (`node:path#dirname`), deduplicated.
|
|
66
|
+
* @complexity O(n) in the number of images.
|
|
67
|
+
* @overallScore 100
|
|
68
|
+
*/
|
|
69
|
+
export function deriveImageAllowedDirs(imagePaths) {
|
|
70
|
+
return [...new Set(imagePaths.map((imagePath) => path.dirname(imagePath)))];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Applies `'prompt-path'` image delivery when — and only when — `def`
|
|
74
|
+
* declares it and `imagePaths` is non-empty. Every other combination
|
|
75
|
+
* (`'native'`, `'unsupported'`, `undefined` delivery, or zero images on any
|
|
76
|
+
* def) returns `{ prompt, extraAllowedDirs }` completely unchanged, which is
|
|
77
|
+
* what keeps 'native' defs (ACP, pi-rpc, qoder) provably unaffected — this
|
|
78
|
+
* function is the single place that decides whether augmentation happens at
|
|
79
|
+
* all, so a 'native' def's `imageDelivery` value alone is what protects it
|
|
80
|
+
* from double delivery, not a second check duplicated at each call site.
|
|
81
|
+
*
|
|
82
|
+
* @param imageDelivery - `def.imageDelivery` — the def's own declared mode; pass this field directly rather than the whole def so this module has no dependency on `RuntimeAgentDef` beyond the one field's type.
|
|
83
|
+
* @param prompt - The user's original prompt text.
|
|
84
|
+
* @param imagePaths - The run's raw image paths, exactly as the caller received them (may be undefined/empty/contain blanks — this function does the filtering).
|
|
85
|
+
* @param extraAllowedDirs - The run's caller-supplied allowed directories, exactly as received.
|
|
86
|
+
* @returns The prompt and allowed-dirs to actually use for this run's `buildArgs`/prompt-delivery calls.
|
|
87
|
+
* @complexity O(n) in the number of images; O(1) when delivery is not `'prompt-path'` or there are no images.
|
|
88
|
+
* @overallScore 100
|
|
89
|
+
*/
|
|
90
|
+
export function applyImagePromptDelivery(imageDelivery, prompt, imagePaths, extraAllowedDirs) {
|
|
91
|
+
if (imageDelivery !== 'prompt-path')
|
|
92
|
+
return { prompt, extraAllowedDirs };
|
|
93
|
+
const paths = (imagePaths ?? []).filter((p) => typeof p === 'string' && p.length > 0);
|
|
94
|
+
if (paths.length === 0)
|
|
95
|
+
return { prompt, extraAllowedDirs };
|
|
96
|
+
const mergedDirs = new Set(extraAllowedDirs ?? []);
|
|
97
|
+
for (const dir of deriveImageAllowedDirs(paths))
|
|
98
|
+
mergedDirs.add(dir);
|
|
99
|
+
return {
|
|
100
|
+
prompt: augmentPromptWithImageAttachments(prompt, paths),
|
|
101
|
+
extraAllowedDirs: [...mergedDirs],
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=image-prompt-delivery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-prompt-delivery.js","sourceRoot":"","sources":["../src/image-prompt-delivery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAS7B;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iCAAiC,CAAC,MAAc,EAAE,UAA6B;IAC7F,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3F,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC;IACvC,OAAO,CACL,GAAG,MAAM,WAAW;QACpB,yCAAyC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,oBAAoB;QACtF,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,aAAa,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,mBAAmB,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,YAAY;QAC1H,0DAA0D,IAAI,EAAE,CACjE,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAA6B;IAClE,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,wBAAwB,CACtC,aAA+C,EAC/C,MAAc,EACd,UAAyC,EACzC,gBAA+C;IAE/C,IAAI,aAAa,KAAK,aAAa;QAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAEzE,MAAM,KAAK,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnG,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAE5D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;IACnD,KAAK,MAAM,GAAG,IAAI,sBAAsB,CAAC,KAAK,CAAC;QAAE,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAErE,OAAO;QACL,MAAM,EAAE,iCAAiC,CAAC,MAAM,EAAE,KAAK,CAAC;QACxD,gBAAgB,EAAE,CAAC,GAAG,UAAU,CAAC;KAClC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* `terminal-session.ts` (2026-07-21) adds the interactive-terminal session manager: a
|
|
19
19
|
* `node-pty`-backed `PtySpawn` wired into `@jini-ai/platform`'s generic `TerminalService`, plus
|
|
20
|
-
* session-ownership gating and the kill/write/resize lock `@jini-ai/http`'s `terminals.ts` route
|
|
20
|
+
* session-ownership gating and the kill/write/resize lock `@jini-ai/http-kit`'s `terminals.ts` route
|
|
21
21
|
* pack calls into. This is this workspace's first native-compiled-addon dependency — see this
|
|
22
22
|
* package's `package.json` and `source-map.md`'s dated section.
|
|
23
23
|
*/
|
|
@@ -26,6 +26,7 @@ export * from './close-status.js';
|
|
|
26
26
|
export * from './run-lifecycle.js';
|
|
27
27
|
export * from './tool-executor.js';
|
|
28
28
|
export * from './delegated-tool-bridge.js';
|
|
29
|
+
export * from './remote-tool-bridge.js';
|
|
29
30
|
export * from './frontend-session-registry.js';
|
|
30
31
|
export * from './frontend-capability-tools.js';
|
|
31
32
|
export * from './agent-executor.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* `terminal-session.ts` (2026-07-21) adds the interactive-terminal session manager: a
|
|
19
19
|
* `node-pty`-backed `PtySpawn` wired into `@jini-ai/platform`'s generic `TerminalService`, plus
|
|
20
|
-
* session-ownership gating and the kill/write/resize lock `@jini-ai/http`'s `terminals.ts` route
|
|
20
|
+
* session-ownership gating and the kill/write/resize lock `@jini-ai/http-kit`'s `terminals.ts` route
|
|
21
21
|
* pack calls into. This is this workspace's first native-compiled-addon dependency — see this
|
|
22
22
|
* package's `package.json` and `source-map.md`'s dated section.
|
|
23
23
|
*/
|
|
@@ -26,6 +26,7 @@ export * from './close-status.js';
|
|
|
26
26
|
export * from './run-lifecycle.js';
|
|
27
27
|
export * from './tool-executor.js';
|
|
28
28
|
export * from './delegated-tool-bridge.js';
|
|
29
|
+
export * from './remote-tool-bridge.js';
|
|
29
30
|
export * from './frontend-session-registry.js';
|
|
30
31
|
export * from './frontend-capability-tools.js';
|
|
31
32
|
export * from './agent-executor.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `RemoteToolEventRecorder` — lets a tool call that executed in a DIFFERENT process from the one
|
|
3
|
+
* holding this run's `RunLifecycle` still record its `tool_use`/`tool_result` events into that
|
|
4
|
+
* run's own event log, so the run's SSE subscribers (a chat UI, a reattaching client) see it the
|
|
5
|
+
* same way they see a locally-executed delegated tool call.
|
|
6
|
+
*
|
|
7
|
+
* This exists because `DelegatedToolBridge.execute()` (this package's `delegated-tool-bridge.ts`)
|
|
8
|
+
* calls `lifecycle.emit()` directly, in-process — there was previously no way for a caller that
|
|
9
|
+
* executed a tool somewhere else to report the outcome back into this run's log. That absence is
|
|
10
|
+
* what forced `ToolExecutor`/`ToolRegistry`/`RunLifecycle` to all live in one process per run (see
|
|
11
|
+
* this repo's own `tovu-learnings.md` §1a). This module is the missing half: the same two event
|
|
12
|
+
* shapes `DelegatedToolBridge.execute()` already emits (`tool_use` then `tool_result`), exposed as
|
|
13
|
+
* a small, explicit recording API a *transport* (this package does not itself expose one — see
|
|
14
|
+
* `@jini-ai/http-kit`'s `remote-run-events.ts`) can wrap with authentication and call remotely.
|
|
15
|
+
*
|
|
16
|
+
* This does not change how tool execution is authorized. A caller of `recordToolUse`/
|
|
17
|
+
* `recordToolResult` has, by definition, already run the tool through its OWN `ToolExecutor` (with
|
|
18
|
+
* its own `ToolPolicy` gate) before calling this — this module only records that the run's chat UI
|
|
19
|
+
* should reflect. It is not a second execution path and does not itself run anything.
|
|
20
|
+
*/
|
|
21
|
+
import type { RunProtocolEvent } from '@jini-ai/protocol';
|
|
22
|
+
import type { RunLifecycle } from './run-lifecycle.js';
|
|
23
|
+
export interface RemoteToolUseRecord {
|
|
24
|
+
/** Stable agent-side correlation id, matched by the following `recordToolResult` call. */
|
|
25
|
+
readonly toolUseId: string;
|
|
26
|
+
/** Jini registry id — never an agent-vendor-specific tool name. */
|
|
27
|
+
readonly toolId: string;
|
|
28
|
+
readonly input: unknown;
|
|
29
|
+
}
|
|
30
|
+
export interface RemoteToolResultRecord {
|
|
31
|
+
readonly toolUseId: string;
|
|
32
|
+
readonly content: string;
|
|
33
|
+
readonly isError?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface RemoteToolEventRecorder {
|
|
36
|
+
/** Records that a tool call started. Throws (matching `RunLifecycle.emit`) if `runId` is unknown or already terminal. */
|
|
37
|
+
recordToolUse(runId: string, record: RemoteToolUseRecord): Promise<RunProtocolEvent>;
|
|
38
|
+
/** Records that a tool call finished (or failed) — mirrors `DelegatedToolBridge.execute()`'s own `tool_result` shape exactly. */
|
|
39
|
+
recordToolResult(runId: string, record: RemoteToolResultRecord): Promise<RunProtocolEvent>;
|
|
40
|
+
}
|
|
41
|
+
export interface CreateRemoteToolEventRecorderOptions {
|
|
42
|
+
readonly lifecycle: RunLifecycle;
|
|
43
|
+
}
|
|
44
|
+
export declare function createRemoteToolEventRecorder(options: CreateRemoteToolEventRecorderOptions): RemoteToolEventRecorder;
|
|
45
|
+
//# sourceMappingURL=remote-tool-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-tool-bridge.d.ts","sourceRoot":"","sources":["../src/remote-tool-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAClC,0FAA0F;IAC1F,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,uBAAuB;IACtC,yHAAyH;IACzH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACrF,iIAAiI;IACjI,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC5F;AAED,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;CAClC;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,oCAAoC,GAAG,uBAAuB,CAsBpH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function createRemoteToolEventRecorder(options) {
|
|
2
|
+
const { lifecycle } = options;
|
|
3
|
+
return {
|
|
4
|
+
recordToolUse(runId, record) {
|
|
5
|
+
return lifecycle.emit(runId, {
|
|
6
|
+
event: 'agent',
|
|
7
|
+
data: { type: 'tool_use', id: record.toolUseId, name: record.toolId, input: record.input },
|
|
8
|
+
});
|
|
9
|
+
},
|
|
10
|
+
recordToolResult(runId, record) {
|
|
11
|
+
return lifecycle.emit(runId, {
|
|
12
|
+
event: 'agent',
|
|
13
|
+
data: {
|
|
14
|
+
type: 'tool_result',
|
|
15
|
+
toolUseId: record.toolUseId,
|
|
16
|
+
content: record.content,
|
|
17
|
+
...(record.isError ? { isError: true } : {}),
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=remote-tool-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-tool-bridge.js","sourceRoot":"","sources":["../src/remote-tool-bridge.ts"],"names":[],"mappings":"AAgDA,MAAM,UAAU,6BAA6B,CAAC,OAA6C;IACzF,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAE9B,OAAO;QACL,aAAa,CAAC,KAAK,EAAE,MAAM;YACzB,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE;gBAC3B,KAAK,EAAE,OAAO;gBACd,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE;aAC3F,CAAC,CAAC;QACL,CAAC;QACD,gBAAgB,CAAC,KAAK,EAAE,MAAM;YAC5B,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE;gBAC3B,KAAK,EAAE,OAAO;gBACd,IAAI,EAAE;oBACJ,IAAI,EAAE,aAAa;oBACnB,SAAS,EAAE,MAAM,CAAC,SAAS;oBAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBAC7C;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `RoutineStore` — the CRUD + run-history persistence port for `@jini-ai/http`'s routine routes.
|
|
2
|
+
* `RoutineStore` — the CRUD + run-history persistence port for `@jini-ai/http-kit`'s routine routes.
|
|
3
3
|
* Designed the same way `../event-log.js`'s `EventLog` is designed (that module's own doc
|
|
4
4
|
* comment is the explicit template named by the porting proposal,
|
|
5
5
|
* `ADS-memory/reports/proposals/PROP-http-route-packs-automation-routines-2026-07-21.md`): a
|
|
@@ -55,14 +55,6 @@ export declare function tzWallToUtcCandidates(timezone: string, year: number, mo
|
|
|
55
55
|
*/
|
|
56
56
|
export declare function tzWallToUtcGapFallback(timezone: string, year: number, month: number, day: number, hour: number, minute: number): Date | null;
|
|
57
57
|
export declare function nextHourlyRunAt(minute: number, now?: Date): Date;
|
|
58
|
-
/**
|
|
59
|
-
* Returns the next instant at which the wall-clock in `timezone` reads "HH:MM" on a day where
|
|
60
|
-
* `predicate(weekday)` holds. Walks forward at most 14 calendar days as a safety bound (covers
|
|
61
|
-
* any weekday-based pattern). Exported (unlike this module's other internal helpers) so its
|
|
62
|
-
* 14-day-exhaustion fallback is directly unit-testable: every `predicate` `nextRunAtForSchedule`
|
|
63
|
-
* actually passes (daily/weekdays/weekly) structurally guarantees a match within 7 days, making
|
|
64
|
-
* that branch otherwise unreachable through the public schedule-kind API alone.
|
|
65
|
-
*/
|
|
66
58
|
export declare function nextWallTimeMatching(timezone: string, time: string, predicate: (weekday: Weekday) => boolean, now: Date): Date | null;
|
|
67
59
|
export declare function nextRunAtForSchedule(schedule: RoutineSchedule, now?: Date): Date | null;
|
|
68
60
|
export declare function isValidWallTime(time: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../src/routines/schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO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function nextHourlyRunAt(minute, now = new Date()) {
|
|
|
136
136
|
* actually passes (daily/weekdays/weekly) structurally guarantees a match within 7 days, making
|
|
137
137
|
* that branch otherwise unreachable through the public schedule-kind API alone.
|
|
138
138
|
*/
|
|
139
|
-
|
|
139
|
+
/** Parses a strict "HH:MM" 24-hour wall time, returning `null` for any malformed or out-of-range value. */
|
|
140
|
+
function parseWallTime(time) {
|
|
140
141
|
const m = /^(\d{2}):(\d{2})$/.exec(time);
|
|
141
142
|
if (!m)
|
|
142
143
|
return null;
|
|
@@ -146,39 +147,58 @@ export function nextWallTimeMatching(timezone, time, predicate, now) {
|
|
|
146
147
|
return null;
|
|
147
148
|
if (!Number.isFinite(minute) || minute < 0 || minute > 59)
|
|
148
149
|
return null;
|
|
150
|
+
return { hour, minute };
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Resolves the requested wall time on one specific calendar day in `timezone` to the instant a
|
|
154
|
+
* routine should fire, given that everything at or before `now` has already passed.
|
|
155
|
+
*
|
|
156
|
+
* `abandon` covers the case where the requested wall time cannot be represented as a `Date` at all
|
|
157
|
+
* — see {@link nextWallTimeMatching} for when that actually happens.
|
|
158
|
+
*/
|
|
159
|
+
function resolveDayFireInstant(timezone, date, hour, minute, now) {
|
|
160
|
+
const candidates = tzWallToUtcCandidates(timezone, date.year, date.month, date.day, hour, minute);
|
|
161
|
+
if (candidates.length === 0) {
|
|
162
|
+
// Spring-forward gap: no valid wall instant exists today; pick the synthesized post-gap
|
|
163
|
+
// fallback so the routine still fires today.
|
|
164
|
+
const fallback = tzWallToUtcGapFallback(timezone, date.year, date.month, date.day, hour, minute);
|
|
165
|
+
if (!fallback)
|
|
166
|
+
return { kind: 'abandon' };
|
|
167
|
+
return fallback.getTime() > now.getTime() ? { kind: 'fire', at: fallback } : { kind: 'next-day' };
|
|
168
|
+
}
|
|
169
|
+
// Iterate candidates in ascending order so that on a fall-back overlap day, when `now`
|
|
170
|
+
// already passed the first occurrence (EDT), we still pick the second one (EST) before
|
|
171
|
+
// walking to the next day.
|
|
172
|
+
for (const candidate of candidates) {
|
|
173
|
+
if (candidate.getTime() > now.getTime())
|
|
174
|
+
return { kind: 'fire', at: candidate };
|
|
175
|
+
}
|
|
176
|
+
return { kind: 'next-day' };
|
|
177
|
+
}
|
|
178
|
+
export function nextWallTimeMatching(timezone, time, predicate, now) {
|
|
179
|
+
const wall = parseWallTime(time);
|
|
180
|
+
if (!wall)
|
|
181
|
+
return null;
|
|
149
182
|
// Walk day by day in the target timezone.
|
|
150
183
|
for (let offset = 0; offset < 14; offset += 1) {
|
|
151
184
|
const probe = new Date(now.getTime() + offset * 24 * 60 * 60_000);
|
|
152
185
|
const parts = partsInTimezone(timezone, probe);
|
|
153
186
|
if (!predicate(parts.weekday))
|
|
154
187
|
continue;
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (!fallback)
|
|
170
|
-
return null;
|
|
171
|
-
if (fallback.getTime() > now.getTime())
|
|
172
|
-
return fallback;
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
// Iterate candidates in ascending order so that on a fall-back overlap day, when `now`
|
|
176
|
-
// already passed the first occurrence (EDT), we still pick the second one (EST) before
|
|
177
|
-
// walking to the next day.
|
|
178
|
-
for (const candidate of candidates) {
|
|
179
|
-
if (candidate.getTime() > now.getTime())
|
|
180
|
-
return candidate;
|
|
181
|
-
}
|
|
188
|
+
const resolution = resolveDayFireInstant(timezone, parts, wall.hour, wall.minute, now);
|
|
189
|
+
if (resolution.kind === 'fire')
|
|
190
|
+
return resolution.at;
|
|
191
|
+
// `abandon` means `tzWallToUtcGapFallback` returned null. Its own `catch` fires whenever the
|
|
192
|
+
// Intl call inside it throws — which an invalid timezone causes, but so does an
|
|
193
|
+
// unrepresentable instant. The latter is reachable from right here despite `timezone` being
|
|
194
|
+
// proven valid by the `partsInTimezone` call above: when `now` sits within a day of the
|
|
195
|
+
// maximum representable `Date` (+275760-09-13), `Date.UTC(...)` for a later wall time that
|
|
196
|
+
// same day overflows to `NaN`, `new Date(NaN)` makes `formatToParts` throw `RangeError`, and
|
|
197
|
+
// both `tzWallToUtcCandidates` (hence the empty candidate list) and `tzWallToUtcGapFallback`
|
|
198
|
+
// swallow it. No later day can succeed either, so give up rather than spin the remaining
|
|
199
|
+
// iterations. Covered by a direct test in schedule.test.ts.
|
|
200
|
+
if (resolution.kind === 'abandon')
|
|
201
|
+
return null;
|
|
182
202
|
}
|
|
183
203
|
return null;
|
|
184
204
|
}
|
|
@@ -218,30 +238,37 @@ export function isValidTimezone(tz) {
|
|
|
218
238
|
return false;
|
|
219
239
|
}
|
|
220
240
|
}
|
|
241
|
+
function validateHourlyMinute(minute) {
|
|
242
|
+
if (!Number.isInteger(minute) || minute < 0 || minute > 59) {
|
|
243
|
+
throw new Error('hourly.minute must be an integer 0-59');
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function validateWeekday(weekday) {
|
|
247
|
+
if (!Number.isInteger(weekday) || weekday < 0 || weekday > 6) {
|
|
248
|
+
throw new Error('weekly.weekday must be 0-6');
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function validateWallClockSchedule(schedule) {
|
|
252
|
+
if (!isValidWallTime(schedule.time)) {
|
|
253
|
+
throw new Error(`Invalid time: ${schedule.time}`);
|
|
254
|
+
}
|
|
255
|
+
if (!isValidTimezone(schedule.timezone)) {
|
|
256
|
+
throw new Error(`Invalid timezone: ${schedule.timezone}`);
|
|
257
|
+
}
|
|
258
|
+
if (schedule.kind === 'weekly') {
|
|
259
|
+
validateWeekday(schedule.weekday);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
221
262
|
export function validateSchedule(schedule) {
|
|
222
263
|
if (!schedule || typeof schedule !== 'object') {
|
|
223
264
|
throw new Error('schedule is required');
|
|
224
265
|
}
|
|
225
266
|
if (schedule.kind === 'hourly') {
|
|
226
|
-
|
|
227
|
-
if (!Number.isInteger(m) || m < 0 || m > 59) {
|
|
228
|
-
throw new Error('hourly.minute must be an integer 0-59');
|
|
229
|
-
}
|
|
267
|
+
validateHourlyMinute(schedule.minute);
|
|
230
268
|
return;
|
|
231
269
|
}
|
|
232
270
|
if (schedule.kind === 'daily' || schedule.kind === 'weekdays' || schedule.kind === 'weekly') {
|
|
233
|
-
|
|
234
|
-
throw new Error(`Invalid time: ${schedule.time}`);
|
|
235
|
-
}
|
|
236
|
-
if (!isValidTimezone(schedule.timezone)) {
|
|
237
|
-
throw new Error(`Invalid timezone: ${schedule.timezone}`);
|
|
238
|
-
}
|
|
239
|
-
if (schedule.kind === 'weekly') {
|
|
240
|
-
const w = schedule.weekday;
|
|
241
|
-
if (!Number.isInteger(w) || w < 0 || w > 6) {
|
|
242
|
-
throw new Error('weekly.weekday must be 0-6');
|
|
243
|
-
}
|
|
244
|
-
}
|
|
271
|
+
validateWallClockSchedule(schedule);
|
|
245
272
|
return;
|
|
246
273
|
}
|
|
247
274
|
throw new Error(`Unsupported schedule kind: ${schedule.kind}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../src/routines/schedule.ts"],"names":[],"mappings":"AAWA,sCAAsC;AAEtC;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAgB,EAChB,KAAW;IAUX,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;QAC3C,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;I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Id: string): Date | null;
|
|
31
31
|
runNow(routineId: string): Promise<RoutineRunHandlerStart>;
|
|
32
|
+
/**
|
|
33
|
+
* Wraps a persistence failure as a {@link ScheduledRunPersistenceError} when this attempt was a
|
|
34
|
+
* scheduled fire, so the caller retries the same slot instead of advancing the cadence. Manual
|
|
35
|
+
* fires have no slot to retry and surface the original error unchanged.
|
|
36
|
+
*/
|
|
37
|
+
private asPersistenceFailure;
|
|
38
|
+
/**
|
|
39
|
+
* Tear-down for when the durable routine_run row was never inserted (insertRun threw, or another
|
|
40
|
+
* daemon already won the slot). Prefers the explicit `discardUnstarted` callback when the handler
|
|
41
|
+
* distinguishes the two cases — that one drops the in-memory chat run entirely instead of
|
|
42
|
+
* finalizing it as `canceled`, so duplicate scheduled losers do not surface phantom runs on a run
|
|
43
|
+
* listing. Handlers that do not implement the split still see `discard`.
|
|
44
|
+
*/
|
|
45
|
+
private discardUnstartedRun;
|
|
46
|
+
/**
|
|
47
|
+
* Claims the durable routine_run row for this attempt. Returns `false` when a sibling daemon
|
|
48
|
+
* already won the slot (the in-memory run has been discarded and the caller should just hand the
|
|
49
|
+
* handler's start handle back); throws when the write itself failed.
|
|
50
|
+
*/
|
|
51
|
+
private claimRunRow;
|
|
52
|
+
/**
|
|
53
|
+
* Copies the real project/conversation/run IDs `prepare()` resolved back onto the start handle and
|
|
54
|
+
* persists them. Scheduled fires always write (the row was inserted with routine placeholders);
|
|
55
|
+
* manual fires write only when `prepare()` actually changed something.
|
|
56
|
+
*/
|
|
57
|
+
private persistPreparedIds;
|
|
58
|
+
/**
|
|
59
|
+
* Finalizes a run whose `prepare()` step failed. Terminates the in-memory chat run created by
|
|
60
|
+
* `handler(...)` so its `completion` promise resolves instead of waiting forever on a run that
|
|
61
|
+
* will never start, surfacing (but not rethrowing) any cleanup failure, then persists the
|
|
62
|
+
* terminal row.
|
|
63
|
+
*
|
|
64
|
+
* The placeholder IDs are cleared first: they are only replaced with real resources by
|
|
65
|
+
* `prepare()`, so a failure before that enrichment would otherwise leave the terminal row
|
|
66
|
+
* pointing at fabricated project/conversation IDs. For scheduled runs the slot claim was already
|
|
67
|
+
* accepted at `insertRun()`, so retrying the same slot is not appropriate — the caller lets the
|
|
68
|
+
* error propagate so the scheduler advances to the next cadence.
|
|
69
|
+
*/
|
|
70
|
+
private finalizeUnpreparedRun;
|
|
71
|
+
/** Persists the terminal row once the host's run completes (or its completion promise rejects). */
|
|
72
|
+
private wireRunCompletion;
|
|
73
|
+
/** Hands control to the host's `start()`, finalizing the row as failed if it throws synchronously. */
|
|
74
|
+
private startPreparedRun;
|
|
32
75
|
private start_;
|
|
33
76
|
}
|
|
34
77
|
//# sourceMappingURL=scheduler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../src/routines/scheduler.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAEV,kBAAkB,EAElB,iBAAiB,EACjB,sBAAsB,EAEvB,MAAM,YAAY,CAAC;AAYpB;;;;;GAKG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IAEnD,QAAQ,CAAC,SAAS,EAAE,MAAM;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,aAAa,EAAE,OAAO;gBAFtB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,OAAO;CAKlC;
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../src/routines/scheduler.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAEV,kBAAkB,EAElB,iBAAiB,EACjB,sBAAsB,EAEvB,MAAM,YAAY,CAAC;AAYpB;;;;;GAKG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IAEnD,QAAQ,CAAC,SAAS,EAAE,MAAM;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,aAAa,EAAE,OAAO;gBAFtB,SAAS,EAAE,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