@xenosystem/primitives 0.8.1 → 0.10.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/cjs/dirs/procinfo.js +5 -0
- package/dist/cjs/process/index.d.ts +1 -0
- package/dist/cjs/process/index.js +10 -21
- package/dist/cjs/process/native.d.ts +22 -0
- package/dist/cjs/process/native.js +50 -0
- package/dist/cjs/secrets/dpapi.d.ts +9 -0
- package/dist/cjs/secrets/dpapi.js +53 -0
- package/dist/cjs/secrets/index.d.ts +1 -0
- package/dist/cjs/secrets/index.js +5 -1
- package/dist/cjs/sessions/agyNative.d.ts +90 -0
- package/dist/cjs/sessions/agyNative.js +392 -0
- package/dist/cjs/sessions/agyWire.d.ts +181 -0
- package/dist/cjs/sessions/agyWire.js +97 -0
- package/dist/cjs/sessions/convert.js +19 -2
- package/dist/cjs/sessions/index.d.ts +1 -0
- package/dist/cjs/sessions/index.js +9 -1
- package/dist/cjs/sessions/protowire.d.ts +29 -0
- package/dist/cjs/sessions/protowire.js +114 -0
- package/dist/cjs/sessions/read.js +2 -2
- package/dist/cjs/sessions/transcript.d.ts +1 -1
- package/dist/cjs/sessions/transcript.js +4 -2
- package/dist/cjs/sessions/types.d.ts +4 -0
- package/dist/cjs/sessions/write.d.ts +1 -0
- package/dist/cjs/sessions/write.js +18 -18
- package/dist/esm/dirs/procinfo.js +5 -0
- package/dist/esm/process/index.d.ts +1 -0
- package/dist/esm/process/index.js +8 -21
- package/dist/esm/process/native.d.ts +22 -0
- package/dist/esm/process/native.js +46 -0
- package/dist/esm/secrets/dpapi.d.ts +9 -0
- package/dist/esm/secrets/dpapi.js +48 -0
- package/dist/esm/secrets/index.d.ts +1 -0
- package/dist/esm/secrets/index.js +1 -0
- package/dist/esm/sessions/agyNative.d.ts +90 -0
- package/dist/esm/sessions/agyNative.js +383 -0
- package/dist/esm/sessions/agyWire.d.ts +181 -0
- package/dist/esm/sessions/agyWire.js +94 -0
- package/dist/esm/sessions/convert.js +19 -2
- package/dist/esm/sessions/index.d.ts +1 -0
- package/dist/esm/sessions/index.js +1 -0
- package/dist/esm/sessions/protowire.d.ts +29 -0
- package/dist/esm/sessions/protowire.js +105 -0
- package/dist/esm/sessions/read.js +2 -2
- package/dist/esm/sessions/transcript.d.ts +1 -1
- package/dist/esm/sessions/transcript.js +4 -2
- package/dist/esm/sessions/types.d.ts +4 -0
- package/dist/esm/sessions/write.d.ts +1 -0
- package/dist/esm/sessions/write.js +19 -19
- package/native/win32-x64/process.node +0 -0
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ exports.processStartTime = processStartTime;
|
|
|
5
5
|
exports.ownProcessStartTime = ownProcessStartTime;
|
|
6
6
|
const node_child_process_1 = require("node:child_process");
|
|
7
7
|
const promises_1 = require("node:fs/promises");
|
|
8
|
+
const native_ts_1 = require("../process/native.js");
|
|
8
9
|
/** True when a process with this pid exists (a process we may not signal still exists). */
|
|
9
10
|
function isProcessAlive(pid) {
|
|
10
11
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
@@ -45,6 +46,10 @@ async function processStartTime(pid) {
|
|
|
45
46
|
return out ? `darwin:${out}` : null;
|
|
46
47
|
}
|
|
47
48
|
if (process.platform === 'win32') {
|
|
49
|
+
// One GetProcessTimes call (0.06 ms) when the package's binary is here; the same FILETIME PowerShell prints.
|
|
50
|
+
const native = (0, native_ts_1.processCreationTime)(pid);
|
|
51
|
+
if (native !== undefined)
|
|
52
|
+
return native === null ? null : `win32:${native}`;
|
|
48
53
|
const root = process.env['SystemRoot'] ?? 'C:\\Windows';
|
|
49
54
|
const ps = `${root}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
50
55
|
const out = await run(ps, [
|
|
@@ -38,6 +38,7 @@ export interface ProcessGroup {
|
|
|
38
38
|
/** Processes still running in the group, where the platform can count them (Windows job only). */
|
|
39
39
|
activeProcesses(): number | undefined;
|
|
40
40
|
}
|
|
41
|
+
export { processCreationTime } from './native.ts';
|
|
41
42
|
/** What `spawnProcessGroup` will use on this machine, and why when it is not the strongest form. */
|
|
42
43
|
export declare function processGroupSupport(): {
|
|
43
44
|
containment: Containment;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processCreationTime = void 0;
|
|
3
4
|
exports.processGroupSupport = processGroupSupport;
|
|
4
5
|
exports.spawnProcessGroup = spawnProcessGroup;
|
|
5
6
|
/**
|
|
@@ -22,33 +23,21 @@ exports.spawnProcessGroup = spawnProcessGroup;
|
|
|
22
23
|
* that needs the guarantee can refuse rather than assume it.
|
|
23
24
|
*/
|
|
24
25
|
const node_child_process_1 = require("node:child_process");
|
|
25
|
-
const
|
|
26
|
-
const node_module_1 = require("node:module");
|
|
27
|
-
const node_path_1 = require("node:path");
|
|
28
|
-
const here_ts_1 = require("./here.js");
|
|
26
|
+
const native_ts_1 = require("./native.js");
|
|
29
27
|
let nativeCache;
|
|
30
28
|
/** The native job binding, or why it is not available. Windows only. */
|
|
31
29
|
function loadNative() {
|
|
32
30
|
if (nativeCache)
|
|
33
31
|
return nativeCache;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (!file)
|
|
41
|
-
return (nativeCache = { reason: `no native binary for ${name}` });
|
|
42
|
-
try {
|
|
43
|
-
const binding = (0, node_module_1.createRequire)(file)(file);
|
|
44
|
-
if (typeof binding.ProcessJob !== 'function')
|
|
45
|
-
return (nativeCache = { reason: 'native binary has no ProcessJob' });
|
|
46
|
-
return (nativeCache = { ctor: binding.ProcessJob });
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
return (nativeCache = { reason: `native binary failed to load: ${error.message}` });
|
|
50
|
-
}
|
|
32
|
+
const { binding, reason } = (0, native_ts_1.loadNativeBinding)();
|
|
33
|
+
if (!binding)
|
|
34
|
+
return (nativeCache = { reason: reason ?? 'unknown reason' });
|
|
35
|
+
if (typeof binding.ProcessJob !== 'function')
|
|
36
|
+
return (nativeCache = { reason: 'native binary has no ProcessJob' });
|
|
37
|
+
return (nativeCache = { ctor: binding.ProcessJob });
|
|
51
38
|
}
|
|
39
|
+
var native_ts_2 = require("./native.js");
|
|
40
|
+
Object.defineProperty(exports, "processCreationTime", { enumerable: true, get: function () { return native_ts_2.processCreationTime; } });
|
|
52
41
|
/** What `spawnProcessGroup` will use on this machine, and why when it is not the strongest form. */
|
|
53
42
|
function processGroupSupport() {
|
|
54
43
|
if (process.platform !== 'win32')
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** The functions the binary exports. Each is checked before use, so an older binary simply lacks the newer ones. */
|
|
2
|
+
export interface NativeBinding {
|
|
3
|
+
ProcessJob?: unknown;
|
|
4
|
+
privateFileOperation?: unknown;
|
|
5
|
+
processCreationTime?: (pid: number) => string | null;
|
|
6
|
+
dpapiProtect?: (data: Buffer) => Buffer;
|
|
7
|
+
dpapiUnprotect?: (data: Buffer) => Buffer;
|
|
8
|
+
}
|
|
9
|
+
/** The binary, or why it is not available. Windows only. */
|
|
10
|
+
export declare function loadNativeBinding(): {
|
|
11
|
+
binding?: NativeBinding;
|
|
12
|
+
reason?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The creation time of a process, as a decimal Windows FILETIME (100 ns since 1601-01-01 UTC), read with one
|
|
16
|
+
* `GetProcessTimes` call. Null when the process cannot be opened (it has ended, or belongs to another user).
|
|
17
|
+
* Undefined when this machine has no native binary that can answer (not Windows, or an older binary): the caller
|
|
18
|
+
* decides what to do then. It replaces starting `powershell.exe` for the same value, which took 2-3 s under load
|
|
19
|
+
* (measured 2026-11-29: 0.06 ms native, identical value to `StartTime.ToFileTimeUtc()`).
|
|
20
|
+
* Exported by `@xenosystem/primitives/process`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function processCreationTime(pid: number): string | null | undefined;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadNativeBinding = loadNativeBinding;
|
|
4
|
+
exports.processCreationTime = processCreationTime;
|
|
5
|
+
/**
|
|
6
|
+
* The one loader of this package's Windows binary (`native/win32-<arch>/process.node`), shared by the families that
|
|
7
|
+
* call into it: `process` (the job object), `dirs` (a process's start time, for lock staleness) and `secrets` (DPAPI).
|
|
8
|
+
* Internal: not an export of the package.
|
|
9
|
+
*/
|
|
10
|
+
const node_fs_1 = require("node:fs");
|
|
11
|
+
const node_module_1 = require("node:module");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
13
|
+
const here_ts_1 = require("./here.js");
|
|
14
|
+
let cache;
|
|
15
|
+
/** The binary, or why it is not available. Windows only. */
|
|
16
|
+
function loadNativeBinding() {
|
|
17
|
+
if (cache)
|
|
18
|
+
return cache;
|
|
19
|
+
if (process.platform !== 'win32')
|
|
20
|
+
return (cache = { reason: 'not Windows' });
|
|
21
|
+
const name = `win32-${process.arch}`;
|
|
22
|
+
// src/process (tests) and dist/{esm,cjs}/process (published) both sit under the package directory.
|
|
23
|
+
const candidates = [(0, node_path_1.join)(here_ts_1.moduleDir, '..', '..', 'native', name, 'process.node'), (0, node_path_1.join)(here_ts_1.moduleDir, '..', '..', '..', 'native', name, 'process.node')];
|
|
24
|
+
const file = candidates.find((p) => (0, node_fs_1.existsSync)(p));
|
|
25
|
+
if (!file)
|
|
26
|
+
return (cache = { reason: `no native binary for ${name}` });
|
|
27
|
+
try {
|
|
28
|
+
return (cache = { binding: (0, node_module_1.createRequire)(file)(file) });
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
return (cache = { reason: `native binary failed to load: ${error.message}` });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The creation time of a process, as a decimal Windows FILETIME (100 ns since 1601-01-01 UTC), read with one
|
|
36
|
+
* `GetProcessTimes` call. Null when the process cannot be opened (it has ended, or belongs to another user).
|
|
37
|
+
* Undefined when this machine has no native binary that can answer (not Windows, or an older binary): the caller
|
|
38
|
+
* decides what to do then. It replaces starting `powershell.exe` for the same value, which took 2-3 s under load
|
|
39
|
+
* (measured 2026-11-29: 0.06 ms native, identical value to `StartTime.ToFileTimeUtc()`).
|
|
40
|
+
* Exported by `@xenosystem/primitives/process`.
|
|
41
|
+
*/
|
|
42
|
+
function processCreationTime(pid) {
|
|
43
|
+
if (!Number.isInteger(pid) || pid <= 0 || pid > 0xffffffff)
|
|
44
|
+
return null;
|
|
45
|
+
const read = loadNativeBinding().binding?.processCreationTime;
|
|
46
|
+
if (typeof read !== 'function')
|
|
47
|
+
return undefined;
|
|
48
|
+
const value = read(pid);
|
|
49
|
+
return typeof value === 'string' && /^\d+$/.test(value) ? value : null;
|
|
50
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Whether this machine can protect in process, and why not when it cannot. */
|
|
2
|
+
export declare function dpapiSupport(): {
|
|
3
|
+
available: boolean;
|
|
4
|
+
reason?: string;
|
|
5
|
+
};
|
|
6
|
+
/** Encrypt for the current Windows user. Throws a SecretsError when DPAPI is unavailable or refuses. */
|
|
7
|
+
export declare function dpapiProtect(data: Uint8Array): Buffer;
|
|
8
|
+
/** Decrypt a blob protected for the current Windows user. Throws (never returns empty bytes) when it does not decrypt. */
|
|
9
|
+
export declare function dpapiUnprotect(data: Uint8Array): Buffer;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dpapiSupport = dpapiSupport;
|
|
4
|
+
exports.dpapiProtect = dpapiProtect;
|
|
5
|
+
exports.dpapiUnprotect = dpapiUnprotect;
|
|
6
|
+
/**
|
|
7
|
+
* Windows DPAPI for the current user, in process: `CryptProtectData` / `CryptUnprotectData`, no entropy, never any UI.
|
|
8
|
+
* The blob is the one .NET `ProtectedData.Protect(data, null, CurrentUser)` writes, so a record written by a product
|
|
9
|
+
* that used PowerShell for this reads here, and the other way round (proven both ways, 2026-11-29).
|
|
10
|
+
*
|
|
11
|
+
* Why it exists: products protected records by starting `powershell.exe` per call. That costs about 0.5 s idle and
|
|
12
|
+
* 2-3 s under load, and Spawn's startup made two such calls (measured 2026-11-29: native protect 4 ms, unprotect 1 ms).
|
|
13
|
+
*
|
|
14
|
+
* The bytes are the caller's to encode: this never decides a text encoding, and never logs or echoes what it is given.
|
|
15
|
+
*/
|
|
16
|
+
const native_ts_1 = require("../process/native.js");
|
|
17
|
+
const errors_ts_1 = require("./errors.js");
|
|
18
|
+
/** Whether this machine can protect in process, and why not when it cannot. */
|
|
19
|
+
function dpapiSupport() {
|
|
20
|
+
const { binding, reason } = (0, native_ts_1.loadNativeBinding)();
|
|
21
|
+
if (!binding)
|
|
22
|
+
return { available: false, reason: reason ?? 'unknown reason' };
|
|
23
|
+
if (typeof binding.dpapiProtect !== 'function' || typeof binding.dpapiUnprotect !== 'function')
|
|
24
|
+
return { available: false, reason: 'native binary has no DPAPI' };
|
|
25
|
+
return { available: true };
|
|
26
|
+
}
|
|
27
|
+
function binding() {
|
|
28
|
+
const b = (0, native_ts_1.loadNativeBinding)().binding;
|
|
29
|
+
if (!b || typeof b.dpapiProtect !== 'function' || typeof b.dpapiUnprotect !== 'function') {
|
|
30
|
+
throw new errors_ts_1.SecretsError('key-unavailable', `DPAPI is unavailable: ${dpapiSupport().reason ?? 'unknown reason'}`);
|
|
31
|
+
}
|
|
32
|
+
return { protect: b.dpapiProtect, unprotect: b.dpapiUnprotect };
|
|
33
|
+
}
|
|
34
|
+
/** Encrypt for the current Windows user. Throws a SecretsError when DPAPI is unavailable or refuses. */
|
|
35
|
+
function dpapiProtect(data) {
|
|
36
|
+
const { protect } = binding();
|
|
37
|
+
try {
|
|
38
|
+
return protect(Buffer.from(data));
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
throw new errors_ts_1.SecretsError('key-unavailable', 'DPAPI refused to protect the data');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Decrypt a blob protected for the current Windows user. Throws (never returns empty bytes) when it does not decrypt. */
|
|
45
|
+
function dpapiUnprotect(data) {
|
|
46
|
+
const { unprotect } = binding();
|
|
47
|
+
try {
|
|
48
|
+
return unprotect(Buffer.from(data));
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
throw new errors_ts_1.SecretsError('key-unavailable', 'DPAPI could not decrypt the data (another user, another machine, or damaged bytes)');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { SecretsError, isSecretsError, type SecretsErrorCode } from './errors.ts';
|
|
2
2
|
export { SecretStore, createSecretStore, type SecretStoreOptions } from './store.ts';
|
|
3
3
|
export { electronSafeStorageKeyStore, unprotectedKeyStore, type BlobLocation, type KeyStore, type SafeStorageLike, } from './keystore.ts';
|
|
4
|
+
export { dpapiProtect, dpapiSupport, dpapiUnprotect } from './dpapi.ts';
|
|
4
5
|
export { createLibsecretKeyStore, createMacKeychainKeyStore, createOsKeyStore, createWindowsCredentialKeyStore, type OsStoreOptions, } from './os-stores.ts';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createWindowsCredentialKeyStore = exports.createOsKeyStore = exports.createMacKeychainKeyStore = exports.createLibsecretKeyStore = exports.unprotectedKeyStore = exports.electronSafeStorageKeyStore = exports.createSecretStore = exports.SecretStore = exports.isSecretsError = exports.SecretsError = void 0;
|
|
3
|
+
exports.createWindowsCredentialKeyStore = exports.createOsKeyStore = exports.createMacKeychainKeyStore = exports.createLibsecretKeyStore = exports.dpapiUnprotect = exports.dpapiSupport = exports.dpapiProtect = exports.unprotectedKeyStore = exports.electronSafeStorageKeyStore = exports.createSecretStore = exports.SecretStore = exports.isSecretsError = exports.SecretsError = void 0;
|
|
4
4
|
var errors_ts_1 = require("./errors.js");
|
|
5
5
|
Object.defineProperty(exports, "SecretsError", { enumerable: true, get: function () { return errors_ts_1.SecretsError; } });
|
|
6
6
|
Object.defineProperty(exports, "isSecretsError", { enumerable: true, get: function () { return errors_ts_1.isSecretsError; } });
|
|
@@ -10,6 +10,10 @@ Object.defineProperty(exports, "createSecretStore", { enumerable: true, get: fun
|
|
|
10
10
|
var keystore_ts_1 = require("./keystore.js");
|
|
11
11
|
Object.defineProperty(exports, "electronSafeStorageKeyStore", { enumerable: true, get: function () { return keystore_ts_1.electronSafeStorageKeyStore; } });
|
|
12
12
|
Object.defineProperty(exports, "unprotectedKeyStore", { enumerable: true, get: function () { return keystore_ts_1.unprotectedKeyStore; } });
|
|
13
|
+
var dpapi_ts_1 = require("./dpapi.js");
|
|
14
|
+
Object.defineProperty(exports, "dpapiProtect", { enumerable: true, get: function () { return dpapi_ts_1.dpapiProtect; } });
|
|
15
|
+
Object.defineProperty(exports, "dpapiSupport", { enumerable: true, get: function () { return dpapi_ts_1.dpapiSupport; } });
|
|
16
|
+
Object.defineProperty(exports, "dpapiUnprotect", { enumerable: true, get: function () { return dpapi_ts_1.dpapiUnprotect; } });
|
|
13
17
|
var os_stores_ts_1 = require("./os-stores.js");
|
|
14
18
|
Object.defineProperty(exports, "createLibsecretKeyStore", { enumerable: true, get: function () { return os_stores_ts_1.createLibsecretKeyStore; } });
|
|
15
19
|
Object.defineProperty(exports, "createMacKeychainKeyStore", { enumerable: true, get: function () { return os_stores_ts_1.createMacKeychainKeyStore; } });
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type Msg } from './protowire.ts';
|
|
2
|
+
import type { Subagent, Turn } from './types.ts';
|
|
3
|
+
/** Per step, the most of a tool's output or a message the copy carries (the full record beside the copy keeps everything). */
|
|
4
|
+
export declare const AGY_STEP_CAP = 32000;
|
|
5
|
+
/** The most text the copy carries in all; over it the END is kept (where the conversation stopped), as for every target. */
|
|
6
|
+
export declare const AGY_TOTAL_CAP = 1500000;
|
|
7
|
+
/** A file path as agy writes it in a render: `file:///X:/a/b`. */
|
|
8
|
+
export declare function fileUri(path: string, cwd: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* The environment that points the `agy` command at a store: agy keeps its data in `<home>/.gemini/antigravity-cli`, found from HOME and
|
|
11
|
+
* USERPROFILE, so a store elsewhere (an isolated home, a Spawn profile) is reached by giving agy that home.
|
|
12
|
+
*/
|
|
13
|
+
export declare function agyEnv(store: string): NodeJS.ProcessEnv;
|
|
14
|
+
interface Render {
|
|
15
|
+
prefix?: string;
|
|
16
|
+
icon?: string;
|
|
17
|
+
agg?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
parts?: Msg[];
|
|
20
|
+
blocks?: Msg[];
|
|
21
|
+
markdown?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ToolStep {
|
|
24
|
+
name: string;
|
|
25
|
+
args: Record<string, string>;
|
|
26
|
+
render: Render;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* agy's own tool, arguments and drawing for one call. Names and drawings follow what agy writes for its own tools (read from its
|
|
30
|
+
* conversations, 2026-11-28): run_command, read_file, write_file, update_steps, … A tool agy has no equivalent for keeps its own name
|
|
31
|
+
* and is drawn as agy draws any tool, with what it was given and what it answered.
|
|
32
|
+
*/
|
|
33
|
+
export declare function agyTool(t: Turn, output: string, isError: boolean, cwd: string): ToolStep;
|
|
34
|
+
/** What a Claude Code user record holds when it is not the person typing. */
|
|
35
|
+
export type UserKind = {
|
|
36
|
+
kind: 'typed';
|
|
37
|
+
text: string;
|
|
38
|
+
} | {
|
|
39
|
+
kind: 'system';
|
|
40
|
+
text: string;
|
|
41
|
+
} | {
|
|
42
|
+
kind: 'skip';
|
|
43
|
+
};
|
|
44
|
+
/** Claude Code wraps slash commands, notices and shell input in tags: give each its meaning. */
|
|
45
|
+
export declare function userKind(t: Turn): UserKind;
|
|
46
|
+
export interface AgyStep {
|
|
47
|
+
type: number;
|
|
48
|
+
source: number;
|
|
49
|
+
at: string | null | undefined;
|
|
50
|
+
body: Msg;
|
|
51
|
+
tool?: {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
args: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export interface AgyReport {
|
|
58
|
+
steps: number;
|
|
59
|
+
userInputs: number;
|
|
60
|
+
replies: number;
|
|
61
|
+
tools: number;
|
|
62
|
+
systemMessages: number;
|
|
63
|
+
compactions: number;
|
|
64
|
+
thinkingDropped: number;
|
|
65
|
+
omitted: number;
|
|
66
|
+
}
|
|
67
|
+
/** The turns as agy steps, in agy's grouping: a reply carries its tool calls, then one step per tool follows it with its result. */
|
|
68
|
+
export declare function agySteps(turns: Turn[], subagents: Subagent[], cwd: string, opts?: {
|
|
69
|
+
fullRecord?: string;
|
|
70
|
+
}): {
|
|
71
|
+
steps: AgyStep[];
|
|
72
|
+
report: AgyReport;
|
|
73
|
+
};
|
|
74
|
+
export interface AgyWritten {
|
|
75
|
+
id: string;
|
|
76
|
+
file: string;
|
|
77
|
+
report: AgyReport;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Write the conversation as a new file in agy's store (`<store>/conversations/<id>.db`). It is built at a private name in the same
|
|
81
|
+
* folder and then linked to its final name, which fails if anything holds that name: nothing is ever replaced, and agy never sees a
|
|
82
|
+
* half-written conversation.
|
|
83
|
+
*/
|
|
84
|
+
export declare function writeAgyConversation(turns: Turn[], subagents: Subagent[], opts: {
|
|
85
|
+
store: string;
|
|
86
|
+
cwd: string;
|
|
87
|
+
fullRecord?: string;
|
|
88
|
+
now?: number;
|
|
89
|
+
}): Promise<AgyWritten>;
|
|
90
|
+
export {};
|