@xenosystem/agent-interface-electron-host 0.1.164 → 0.1.166

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.
@@ -0,0 +1,7 @@
1
+ export declare function toolCallStartedDetail(toolCallId: string, toolName: string, input: Record<string, unknown>): Record<string, unknown>;
2
+ export declare function toolCallEndedDetail(toolCallId: string, toolName: string, result: {
3
+ success: boolean;
4
+ output: string;
5
+ error?: string;
6
+ }): Record<string, unknown>;
7
+ //# sourceMappingURL=toolCallDetail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolCallDetail.d.ts","sourceRoot":"","sources":["../src/toolCallDetail.ts"],"names":[],"mappings":"AAuBA,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQnI;AAED,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * A tool call in full, for the surfaces watching it live.
3
+ *
4
+ * The journal keeps `tool.started` and `tool.completed` small: a preview of the input and 600 characters of output. A terminal drawing the
5
+ * call needs more, such as the file a Write is about to put down, or the end of a failed build's log. So the whole call goes out once on
6
+ * the transient channel. It is never stored or replayed, so a surface that connects later sees the previews, as it always has.
7
+ *
8
+ * Bounded, because a tool can return far more than anyone reads. An oversized output keeps its start and its end, where a failure usually
9
+ * is; an oversized input is left out, because half a file would draw a wrong diff, and the surface then uses the journal's preview.
10
+ */
11
+ const MAX_INPUT_CHARS = 256 * 1024;
12
+ const MAX_OUTPUT_HEAD_CHARS = 192 * 1024;
13
+ const MAX_OUTPUT_TAIL_CHARS = 64 * 1024;
14
+ function boundedOutput(output) {
15
+ if (output.length <= MAX_OUTPUT_HEAD_CHARS + MAX_OUTPUT_TAIL_CHARS)
16
+ return { output };
17
+ const omitted = output.length - MAX_OUTPUT_HEAD_CHARS - MAX_OUTPUT_TAIL_CHARS;
18
+ return {
19
+ output: `${output.slice(0, MAX_OUTPUT_HEAD_CHARS)}\n… ${omitted} characters omitted …\n${output.slice(-MAX_OUTPUT_TAIL_CHARS)}`,
20
+ truncated: true,
21
+ };
22
+ }
23
+ export function toolCallStartedDetail(toolCallId, toolName, input) {
24
+ let size = Number.POSITIVE_INFINITY;
25
+ try {
26
+ size = JSON.stringify(input).length;
27
+ }
28
+ catch {
29
+ // Not encodable: the same outcome as too large.
30
+ }
31
+ return { type: 'tool.call.started', toolCallId, toolName, ...(size <= MAX_INPUT_CHARS ? { input } : { inputOmitted: true }) };
32
+ }
33
+ export function toolCallEndedDetail(toolCallId, toolName, result) {
34
+ return {
35
+ type: 'tool.call.ended',
36
+ toolCallId,
37
+ toolName,
38
+ success: result.success,
39
+ ...boundedOutput(result.output ?? ''),
40
+ ...(result.error ? { error: result.error } : {}),
41
+ };
42
+ }
43
+ //# sourceMappingURL=toolCallDetail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolCallDetail.js","sourceRoot":"","sources":["../src/toolCallDetail.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,eAAe,GAAG,GAAG,GAAG,IAAI,CAAA;AAClC,MAAM,qBAAqB,GAAG,GAAG,GAAG,IAAI,CAAA;AACxC,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,CAAA;AAEvC,SAAS,aAAa,CAAC,MAAc;IACnC,IAAI,MAAM,CAAC,MAAM,IAAI,qBAAqB,GAAG,qBAAqB;QAAE,OAAO,EAAE,MAAM,EAAE,CAAA;IACr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.166",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "@xenosystem/agent-sdk": "0.10.105",
31
31
  "@xenosystem/web-context-client": "0.1.5",
32
- "@xenosystem/agent-interface-host": "0.1.164"
32
+ "@xenosystem/agent-interface-host": "0.1.166"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@xenosystem/capability-host": "0.1.0"