@xenosystem/primitives 0.8.1 → 0.9.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/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/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
|
@@ -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 {};
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AGY_TOTAL_CAP = exports.AGY_STEP_CAP = void 0;
|
|
4
|
+
exports.fileUri = fileUri;
|
|
5
|
+
exports.agyEnv = agyEnv;
|
|
6
|
+
exports.agyTool = agyTool;
|
|
7
|
+
exports.userKind = userKind;
|
|
8
|
+
exports.agySteps = agySteps;
|
|
9
|
+
exports.writeAgyConversation = writeAgyConversation;
|
|
10
|
+
/**
|
|
11
|
+
* A NATIVE agy (Antigravity) conversation, written in agy's own format, so agy resumes it as one of its own with
|
|
12
|
+
* `agy --conversation <id>` (owner, 2026-11-28: "we need proper session resume not handover").
|
|
13
|
+
*
|
|
14
|
+
* How it was established, measured 2026-11-28 on agy 1.5.19 in an isolated home:
|
|
15
|
+
* - agy keeps a conversation as ONE SQLite file, `conversations/<id>.db`, whose `steps` rows are protobuf `gemini_coder.Step`
|
|
16
|
+
* messages; the schema is compiled into agy.exe and was extracted from it (agyWire.ts).
|
|
17
|
+
* - A conversation written from turns, with no reply of agy's in it, was resumed and recalled both a codeword from the person's turn
|
|
18
|
+
* and a number from the reply's turn.
|
|
19
|
+
* - The file ALONE is enough: agy lists it, resumes it and writes its own row in `conversation_summaries.db`. So nothing here writes
|
|
20
|
+
* the list database the running desktop app holds open; the only write is one new file, created exclusively.
|
|
21
|
+
*
|
|
22
|
+
* 🔴 1:1, kind by kind (the kinds counted in the owner's 12 largest Claude Code sessions, 1.6 million records, 2026-11-28): every
|
|
23
|
+
* kind becomes agy's own step for it, drawn as agy draws its own (agy's `StepRenderInfo`), never a block of labelled text:
|
|
24
|
+
* the person's words USER_INPUT; typed while a turn ran → is_queued_message; a slash command → "/name args"
|
|
25
|
+
* another session, a job SYSTEM_MESSAGE, saying who sent it
|
|
26
|
+
* the reply PLANNER_RESPONSE, with its tool calls as agy tool calls
|
|
27
|
+
* a tool call + result GENERIC: agy's own tool name and arguments, the result, and its render (a terminal block for a command,
|
|
28
|
+
* file links and diff counts for reads and edits, a checklist for plans and tasks, …): see TOOLS
|
|
29
|
+
* a compaction CONVERSATION_HISTORY, carrying the original agent's summary
|
|
30
|
+
* signed thinking dropped and counted (never forged), as for every target
|
|
31
|
+
*/
|
|
32
|
+
const node_crypto_1 = require("node:crypto");
|
|
33
|
+
const node_fs_1 = require("node:fs");
|
|
34
|
+
const node_path_1 = require("node:path");
|
|
35
|
+
const agyWire_ts_1 = require("./agyWire.js");
|
|
36
|
+
const protowire_ts_1 = require("./protowire.js");
|
|
37
|
+
const owned_ts_1 = require("./owned.js");
|
|
38
|
+
/** Per step, the most of a tool's output or a message the copy carries (the full record beside the copy keeps everything). */
|
|
39
|
+
exports.AGY_STEP_CAP = 32_000;
|
|
40
|
+
/** The most text the copy carries in all; over it the END is kept (where the conversation stopped), as for every target. */
|
|
41
|
+
exports.AGY_TOTAL_CAP = 1_500_000;
|
|
42
|
+
const clip = (s, n = exports.AGY_STEP_CAP) => s.length > n ? `${s.slice(0, n)}\n… [${s.length - n} more characters are in the full record]` : s;
|
|
43
|
+
const json = (v) => { try {
|
|
44
|
+
return typeof v === 'string' ? v : JSON.stringify(v ?? {});
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return String(v);
|
|
48
|
+
} };
|
|
49
|
+
const str = (v) => typeof v === 'string' ? v : v == null ? '' : json(v);
|
|
50
|
+
/** A file path as agy writes it in a render: `file:///X:/a/b`. */
|
|
51
|
+
function fileUri(path, cwd) {
|
|
52
|
+
const p = ((0, node_path_1.isAbsolute)(path) ? path : (0, node_path_1.resolve)(cwd, path)).replace(/\\/g, '/');
|
|
53
|
+
return `file:///${p.replace(/^\/+/, '')}`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The environment that points the `agy` command at a store: agy keeps its data in `<home>/.gemini/antigravity-cli`, found from HOME and
|
|
57
|
+
* USERPROFILE, so a store elsewhere (an isolated home, a Spawn profile) is reached by giving agy that home.
|
|
58
|
+
*/
|
|
59
|
+
function agyEnv(store) {
|
|
60
|
+
const s = (0, node_path_1.resolve)(store), home = (0, node_path_1.dirname)((0, node_path_1.dirname)(s));
|
|
61
|
+
return (0, node_path_1.basename)(s) === 'antigravity-cli' && (0, node_path_1.basename)((0, node_path_1.dirname)(s)) === '.gemini' ? { ...process.env, HOME: home, USERPROFILE: home } : { ...process.env };
|
|
62
|
+
}
|
|
63
|
+
const textPart = (t) => ({ [agyWire_ts_1.F.TitlePart.text]: t });
|
|
64
|
+
const filePart = (uri) => ({ [agyWire_ts_1.F.TitlePart.file]: { [agyWire_ts_1.F.FileRef.uri]: uri } });
|
|
65
|
+
const diffPart = (uri, add, del) => ({ [agyWire_ts_1.F.TitlePart.file_diff]: { [agyWire_ts_1.F.FileDiffRef.uri]: uri, [agyWire_ts_1.F.FileDiffRef.diff_stats]: { [agyWire_ts_1.F.DiffStats.additions]: add, [agyWire_ts_1.F.DiffStats.deletions]: del } } });
|
|
66
|
+
const mdBlock = (m) => ({ [agyWire_ts_1.F.ContentBlock.markdown]: clip(m) });
|
|
67
|
+
const lines = (s) => typeof s === 'string' && s ? s.split('\n').length : 0;
|
|
68
|
+
/** A plan as agy's own checklist (`update_steps` draws `- [x]`, `- [>]`, `- [ ]`). */
|
|
69
|
+
function checklist(input) {
|
|
70
|
+
const items = Array.isArray(input?.todos) ? input.todos : Array.isArray(input?.plan) ? input.plan : Array.isArray(input?.steps) ? input.steps
|
|
71
|
+
: Array.isArray(input?.tasks) ? input.tasks : input && typeof input === 'object' ? [input] : [];
|
|
72
|
+
return items.map((i) => {
|
|
73
|
+
const s = String(i?.status ?? '').toLowerCase(), mark = /complete|done/.test(s) ? 'x' : /progress|active|doing/.test(s) ? '>' : ' ';
|
|
74
|
+
return `- [${mark}] ${str(i?.content ?? i?.step ?? i?.title ?? i?.subject ?? i?.description ?? i?.taskId ?? '')}`.trimEnd();
|
|
75
|
+
}).join('\n');
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* agy's own tool, arguments and drawing for one call. Names and drawings follow what agy writes for its own tools (read from its
|
|
79
|
+
* conversations, 2026-11-28): run_command, read_file, write_file, update_steps, … A tool agy has no equivalent for keeps its own name
|
|
80
|
+
* and is drawn as agy draws any tool, with what it was given and what it answered.
|
|
81
|
+
*/
|
|
82
|
+
function agyTool(t, output, isError, cwd) {
|
|
83
|
+
const tool = t.tool ?? 'tool', i = t.input ?? {};
|
|
84
|
+
const allArgs = () => Object.fromEntries(Object.entries(i && typeof i === 'object' ? i : { input: i }).map(([k, v]) => [k, clip(str(v), 4000)]));
|
|
85
|
+
if (/^(Bash|PowerShell|BashOutput|run_command|shell|exec_command|local_shell)$/i.test(tool)) {
|
|
86
|
+
const command = str(i.command ?? i.cmd ?? i.CommandLine ?? i.bash_id ?? ''), summary = str(i.description ?? '') || command.split('\n')[0].slice(0, 80);
|
|
87
|
+
const code = /^Exit code (\d+)/m.exec(output)?.[1];
|
|
88
|
+
const exit = code !== undefined ? Number(code) : isError ? 1 : 0;
|
|
89
|
+
return { name: 'run_command', args: { CommandLine: clip(command, 8000), ...(summary ? { toolSummary: summary } : {}) },
|
|
90
|
+
render: { prefix: 'Ran', icon: 'terminal', agg: 'terminal', parts: [textPart(summary || tool)],
|
|
91
|
+
blocks: [{ [agyWire_ts_1.F.ContentBlock.terminal]: { [agyWire_ts_1.F.TerminalBlock.command]: clip(command, 8000), [agyWire_ts_1.F.TerminalBlock.cwd]: cwd, [agyWire_ts_1.F.TerminalBlock.exit_code]: exit, [agyWire_ts_1.F.TerminalBlock.output]: clip(output) } }] } };
|
|
92
|
+
}
|
|
93
|
+
const path = str(i.file_path ?? i.path ?? i.notebook_path ?? i.file ?? '');
|
|
94
|
+
if (/^(Read|read_file|view_file)$/i.test(tool) && path) {
|
|
95
|
+
const uri = fileUri(path, cwd);
|
|
96
|
+
return { name: 'read_file', args: { Path: path }, render: { prefix: 'Analyzed', icon: 'description', agg: 'files', parts: [{ [agyWire_ts_1.F.TitlePart.file]: {
|
|
97
|
+
[agyWire_ts_1.F.FileRef.uri]: uri, [agyWire_ts_1.F.FileRef.start_line]: Number(i.offset) || 0, [agyWire_ts_1.F.FileRef.end_line]: i.limit ? (Number(i.offset) || 1) + Number(i.limit) - 1 : 0
|
|
98
|
+
} }] } };
|
|
99
|
+
}
|
|
100
|
+
if (/^(Write|write_file|create_file)$/i.test(tool) && path) {
|
|
101
|
+
const uri = fileUri(path, cwd);
|
|
102
|
+
return { name: 'write_file', args: { Path: path, Content: clip(str(i.content), 8000) },
|
|
103
|
+
render: { prefix: isError ? 'Tried to create' : 'Created', icon: 'edit', agg: 'edits', parts: [filePart(uri), diffPart(uri, lines(i.content), 0)] } };
|
|
104
|
+
}
|
|
105
|
+
if (/^(Edit|MultiEdit|NotebookEdit|edit_file|apply_patch|replace)$/i.test(tool)) {
|
|
106
|
+
const edits = Array.isArray(i.edits) ? i.edits : [i];
|
|
107
|
+
const add = edits.reduce((n, e) => n + lines(e.new_string ?? e.new_source ?? ''), 0), del = edits.reduce((n, e) => n + lines(e.old_string ?? ''), 0);
|
|
108
|
+
const uri = path ? fileUri(path, cwd) : '';
|
|
109
|
+
return { name: 'edit_file', args: allArgs(), render: { prefix: isError ? 'Tried to edit' : 'Edited', icon: 'edit', agg: 'edits',
|
|
110
|
+
parts: uri ? [filePart(uri), diffPart(uri, add, del)] : [textPart(tool)] } };
|
|
111
|
+
}
|
|
112
|
+
if (/^(Grep|grep_search|search_files)$/i.test(tool)) {
|
|
113
|
+
return { name: 'grep_search', args: allArgs(), render: { prefix: 'Searched', icon: 'search', agg: 'search', parts: [textPart(str(i.pattern ?? i.query ?? ''))], blocks: [mdBlock('```\n' + output + '\n```')] } };
|
|
114
|
+
}
|
|
115
|
+
if (/^(Glob|find_by_name|list_dir|LS)$/i.test(tool)) {
|
|
116
|
+
return { name: /LS|list_dir/i.test(tool) ? 'list_dir' : 'find_by_name', args: allArgs(), render: { prefix: 'Searched', icon: 'folder', agg: 'search', parts: [textPart(str(i.pattern ?? i.path ?? ''))], blocks: [mdBlock('```\n' + output + '\n```')] } };
|
|
117
|
+
}
|
|
118
|
+
if (/^(TodoWrite|TaskCreate|TaskUpdate|TaskList|update_plan|update_steps|mcp__ccd_turn__update_plan)$/i.test(tool)) {
|
|
119
|
+
const md = checklist(i);
|
|
120
|
+
return { name: 'update_steps', args: allArgs(), render: { prefix: 'Updated', icon: 'checklist', agg: 'steps', parts: [textPart(/Task/.test(tool) ? 'tasks' : 'plan')], markdown: md || undefined } };
|
|
121
|
+
}
|
|
122
|
+
if (/^(Agent|Task)$/i.test(tool)) {
|
|
123
|
+
const name = str(i.subagent_type ?? i.description ?? 'sub-agent');
|
|
124
|
+
return { name: 'invoke_subagent', args: allArgs(), render: { prefix: 'Ran sub-agent', icon: 'smart_toy', agg: 'subagents', parts: [textPart(name)],
|
|
125
|
+
blocks: [mdBlock(`**Asked:** ${clip(str(i.prompt), 6000)}\n\n**Answered:**\n\n${output}`)] } };
|
|
126
|
+
}
|
|
127
|
+
if (/^AskUserQuestion$/i.test(tool)) {
|
|
128
|
+
const qs = Array.isArray(i.questions) ? i.questions : [];
|
|
129
|
+
const md = qs.map((q) => `**${str(q.question)}**\n${(Array.isArray(q.options) ? q.options : []).map((o) => `- ${str(o.label)}${o.description ? `: ${str(o.description)}` : ''}`).join('\n')}`).join('\n\n');
|
|
130
|
+
return { name: 'ask_question', args: allArgs(), render: { prefix: 'Asked', icon: 'help', agg: 'questions', parts: [textPart(`${qs.length || 1} question${qs.length === 1 ? '' : 's'}`)],
|
|
131
|
+
blocks: [mdBlock(`${md}\n\n**Answer:** ${output}`)] } };
|
|
132
|
+
}
|
|
133
|
+
if (/^(ScheduleWakeup|CronCreate|CronDelete|CronList|Monitor|RemoteTrigger)$/i.test(tool)) {
|
|
134
|
+
const when = str(i.cron ?? i.delaySeconds ?? i.schedule ?? i.interval ?? '');
|
|
135
|
+
return { name: 'schedule', args: allArgs(), render: { prefix: /Delete/.test(tool) ? 'Cancelled schedule' : 'Scheduled', icon: 'schedule', agg: 'schedule',
|
|
136
|
+
parts: [textPart(when ? `${tool} ${when}` : tool)], blocks: [mdBlock(`${str(i.prompt ?? i.reason ?? i.command ?? '')}\n\n${output}`.trim())] } };
|
|
137
|
+
}
|
|
138
|
+
if (/^(WebSearch|search_web)$/i.test(tool)) {
|
|
139
|
+
return { name: 'search_web', args: allArgs(), render: { prefix: 'Searched the web', icon: 'travel_explore', agg: 'web', parts: [textPart(str(i.query))], blocks: [mdBlock(output)] } };
|
|
140
|
+
}
|
|
141
|
+
if (/^(WebFetch|read_url_content)$/i.test(tool)) {
|
|
142
|
+
return { name: 'read_url_content', args: allArgs(), render: { prefix: 'Read', icon: 'language', agg: 'web', parts: [textPart(str(i.url))], blocks: [mdBlock(output)] } };
|
|
143
|
+
}
|
|
144
|
+
if (/^SendMessage$/i.test(tool)) {
|
|
145
|
+
return { name: 'send_message', args: allArgs(), render: { prefix: 'Sent a message to', icon: 'send', agg: 'messages', parts: [textPart(str(i.to ?? i.recipient ?? ''))], blocks: [mdBlock(str(i.message ?? i.text ?? ''))] } };
|
|
146
|
+
}
|
|
147
|
+
if (/^Skill$/i.test(tool)) {
|
|
148
|
+
return { name: 'skill', args: allArgs(), render: { prefix: 'Used skill', icon: 'auto_awesome', agg: 'skills', parts: [textPart(str(i.skill ?? i.name ?? ''))], blocks: output ? [mdBlock(output)] : [] } };
|
|
149
|
+
}
|
|
150
|
+
const mcp = /^mcp__(.+?)__(.+)$/.exec(tool);
|
|
151
|
+
if (mcp) {
|
|
152
|
+
return { name: tool, args: allArgs(), render: { prefix: `Used ${mcp[1].replace(/_/g, ' ')}`, icon: 'extension', agg: 'mcp', parts: [textPart(mcp[2])], blocks: output ? [mdBlock(output)] : [] } };
|
|
153
|
+
}
|
|
154
|
+
return { name: tool, args: allArgs(), render: { prefix: 'Used', icon: 'build', agg: 'tools', parts: [textPart(tool)], blocks: output ? [mdBlock(output)] : [] } };
|
|
155
|
+
}
|
|
156
|
+
function renderInfo(r) {
|
|
157
|
+
return { [agyWire_ts_1.F.StepRenderInfo.title]: r.title, [agyWire_ts_1.F.StepRenderInfo.markdown]: r.markdown, [agyWire_ts_1.F.StepRenderInfo.title_prefix]: r.prefix, [agyWire_ts_1.F.StepRenderInfo.icon]: r.icon,
|
|
158
|
+
[agyWire_ts_1.F.StepRenderInfo.aggregation_key]: r.agg, [agyWire_ts_1.F.StepRenderInfo.title_parts]: r.parts, [agyWire_ts_1.F.StepRenderInfo.content_blocks]: r.blocks?.length ? r.blocks : undefined };
|
|
159
|
+
}
|
|
160
|
+
/** Claude Code wraps slash commands, notices and shell input in tags: give each its meaning. */
|
|
161
|
+
function userKind(t) {
|
|
162
|
+
const raw = t.text ?? '', s = raw.trim();
|
|
163
|
+
if (!s)
|
|
164
|
+
return { kind: 'skip' };
|
|
165
|
+
if (t.from === 'peer')
|
|
166
|
+
return { kind: 'system', text: `Message from another session:\n${raw}` };
|
|
167
|
+
if (t.from === 'harness' || /^<task-notification>/.test(s))
|
|
168
|
+
return { kind: 'system', text: `A background job reported:\n${raw}` };
|
|
169
|
+
const name = /<command-name>\s*\/?([^<]+?)\s*<\/command-name>/.exec(s);
|
|
170
|
+
if (name) {
|
|
171
|
+
const args = /<command-args>([\s\S]*?)<\/command-args>/.exec(s)?.[1]?.trim();
|
|
172
|
+
return { kind: 'typed', text: `/${name[1]}${args ? ` ${args}` : ''}` };
|
|
173
|
+
}
|
|
174
|
+
const bash = /^<bash-input>([\s\S]*?)<\/bash-input>$/.exec(s);
|
|
175
|
+
if (bash)
|
|
176
|
+
return { kind: 'typed', text: `!${bash[1]}` };
|
|
177
|
+
const out = /^<(local-command-stdout|bash-stdout|bash-stderr)>([\s\S]*?)<\/\1>/.exec(s);
|
|
178
|
+
if (out)
|
|
179
|
+
return out[2].trim() ? { kind: 'system', text: `Command output:\n${out[2]}` } : { kind: 'skip' };
|
|
180
|
+
if (/^<(local-command-caveat|system-reminder)>[\s\S]*<\/(local-command-caveat|system-reminder)>$/.test(s))
|
|
181
|
+
return { kind: 'skip' };
|
|
182
|
+
return { kind: 'typed', text: raw };
|
|
183
|
+
}
|
|
184
|
+
/** 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. */
|
|
185
|
+
function agySteps(turns, subagents, cwd, opts = {}) {
|
|
186
|
+
const report = { steps: 0, userInputs: 0, replies: 0, tools: 0, systemMessages: 0, compactions: 0, thinkingDropped: 0, omitted: 0 };
|
|
187
|
+
const results = new Map(), calls = new Set();
|
|
188
|
+
for (const t of turns) {
|
|
189
|
+
if (t.role === 'tool' && t.callId)
|
|
190
|
+
results.set(t.callId, t);
|
|
191
|
+
if (t.tool && t.callId)
|
|
192
|
+
calls.add(t.callId);
|
|
193
|
+
}
|
|
194
|
+
const steps = [];
|
|
195
|
+
let reply = null;
|
|
196
|
+
const flush = () => {
|
|
197
|
+
if (!reply)
|
|
198
|
+
return;
|
|
199
|
+
const r = reply;
|
|
200
|
+
reply = null;
|
|
201
|
+
const toolSteps = r.tools.map((t) => {
|
|
202
|
+
const res = t.callId ? results.get(t.callId) : undefined;
|
|
203
|
+
const step = agyTool(t, res?.output ?? '', !!res?.isError, cwd);
|
|
204
|
+
return { t, res, step, id: t.callId ?? `call_${(0, node_crypto_1.randomUUID)().replace(/-/g, '').slice(0, 24)}` };
|
|
205
|
+
});
|
|
206
|
+
if (!r.text.length && !toolSteps.length)
|
|
207
|
+
return;
|
|
208
|
+
steps.push({ type: agyWire_ts_1.E.StepType.PLANNER_RESPONSE, source: agyWire_ts_1.E.StepSource.MODEL, at: r.at, body: { [agyWire_ts_1.F.Step.planner_response]: {
|
|
209
|
+
[agyWire_ts_1.F.CortexStepPlannerResponse.response]: clip(r.text.join('\n\n')), [agyWire_ts_1.F.CortexStepPlannerResponse.message_id]: (0, node_crypto_1.randomUUID)(),
|
|
210
|
+
[agyWire_ts_1.F.CortexStepPlannerResponse.tool_calls]: toolSteps.map((x) => ({ [agyWire_ts_1.F.ChatToolCall.id]: x.id, [agyWire_ts_1.F.ChatToolCall.name]: x.step.name, [agyWire_ts_1.F.ChatToolCall.arguments_json]: json(x.step.args) }))
|
|
211
|
+
} } });
|
|
212
|
+
report.replies++;
|
|
213
|
+
for (const x of toolSteps) {
|
|
214
|
+
steps.push({ type: agyWire_ts_1.E.StepType.GENERIC, source: agyWire_ts_1.E.StepSource.MODEL, at: x.res?.at ?? x.t.at, tool: { id: x.id, name: x.step.name, args: json(x.step.args) },
|
|
215
|
+
body: { [agyWire_ts_1.F.Step.generic]: { [agyWire_ts_1.F.CortexStepGeneric.args]: (0, protowire_ts_1.mapEntries)(x.step.args), [agyWire_ts_1.F.CortexStepGeneric.result]: {
|
|
216
|
+
[agyWire_ts_1.F.GenericStepResult.result]: clip(x.res ? x.res.output ?? '' : '(the original session recorded no result for this call)'),
|
|
217
|
+
[agyWire_ts_1.F.GenericStepResult.step_render_info]: renderInfo(x.step.render)
|
|
218
|
+
} } } });
|
|
219
|
+
report.tools++;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const system = (text, at) => {
|
|
223
|
+
flush();
|
|
224
|
+
steps.push({ type: agyWire_ts_1.E.StepType.SYSTEM_MESSAGE, source: agyWire_ts_1.E.StepSource.SYSTEM, at, body: { [agyWire_ts_1.F.Step.system_message]: { [agyWire_ts_1.F.CortexStepSystemMessage.message]: clip(text) } } });
|
|
225
|
+
report.systemMessages++;
|
|
226
|
+
};
|
|
227
|
+
let inCompaction = false;
|
|
228
|
+
for (const t of turns) {
|
|
229
|
+
if (t.thinking) {
|
|
230
|
+
report.thinkingDropped++;
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
if (!t.compaction)
|
|
234
|
+
inCompaction = false;
|
|
235
|
+
if (t.compaction) {
|
|
236
|
+
if (!inCompaction)
|
|
237
|
+
report.compactions++;
|
|
238
|
+
inCompaction = true;
|
|
239
|
+
const summary = t.text && !/^\[conversation (compacted|checkpoint)\]$/.test(t.text) ? t.text : '';
|
|
240
|
+
if (summary) {
|
|
241
|
+
flush();
|
|
242
|
+
steps.push({ type: agyWire_ts_1.E.StepType.CONVERSATION_HISTORY, source: agyWire_ts_1.E.StepSource.SYSTEM, at: t.at, body: { [agyWire_ts_1.F.Step.conversation_history]: {
|
|
243
|
+
[agyWire_ts_1.F.CortexStepConversationHistory.content]: clip(`The original agent compacted the conversation here. Its summary of what came before:\n\n${summary}`, 200_000)
|
|
244
|
+
} } });
|
|
245
|
+
}
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (t.role === 'assistant') {
|
|
249
|
+
if (!reply)
|
|
250
|
+
reply = { text: [], tools: [], at: t.at };
|
|
251
|
+
// A reply's text that follows its own tool calls starts the next reply, as agy's planner does.
|
|
252
|
+
if (t.text && !t.tool && reply.tools.length) {
|
|
253
|
+
flush();
|
|
254
|
+
reply = { text: [], tools: [], at: t.at };
|
|
255
|
+
}
|
|
256
|
+
if (t.tool)
|
|
257
|
+
reply.tools.push(t);
|
|
258
|
+
else if (t.text)
|
|
259
|
+
reply.text.push(t.text);
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if (t.role === 'tool') {
|
|
263
|
+
if (t.callId && calls.has(t.callId))
|
|
264
|
+
continue; // carried with its call
|
|
265
|
+
system(`A tool result whose call is not in the original transcript:\n${t.output ?? ''}`, t.at);
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (t.role === 'system') {
|
|
269
|
+
if (t.text)
|
|
270
|
+
system(t.text, t.at);
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
const k = userKind(t);
|
|
274
|
+
if (k.kind === 'skip')
|
|
275
|
+
continue;
|
|
276
|
+
if (k.kind === 'system') {
|
|
277
|
+
system(k.text, t.at);
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
flush();
|
|
281
|
+
steps.push({ type: agyWire_ts_1.E.StepType.USER_INPUT, source: agyWire_ts_1.E.StepSource.USER_EXPLICIT, at: t.at, body: { [agyWire_ts_1.F.Step.user_input]: {
|
|
282
|
+
[agyWire_ts_1.F.CortexStepUserInput.user_response]: clip(k.text), [agyWire_ts_1.F.CortexStepUserInput.items]: [{ [agyWire_ts_1.F.TextOrScopeItem.text]: clip(k.text) }],
|
|
283
|
+
[agyWire_ts_1.F.CortexStepUserInput.is_queued_message]: !!t.queued
|
|
284
|
+
} } });
|
|
285
|
+
report.userInputs++;
|
|
286
|
+
}
|
|
287
|
+
flush();
|
|
288
|
+
for (const sa of subagents) {
|
|
289
|
+
const lines = sa.turns.filter((t) => t.text).map((t) => `${t.role === 'user' ? 'asked' : 'answered'}: ${t.text}`);
|
|
290
|
+
if (lines.length)
|
|
291
|
+
system(`Sub-agent ${sa.name} ran separately in the original session:\n${lines.join('\n')}`, null);
|
|
292
|
+
}
|
|
293
|
+
// 🔴 Over the limit, the END is kept, from a person's message so the conversation still opens with one.
|
|
294
|
+
let total = 0, from = steps.length;
|
|
295
|
+
const size = (s) => (0, protowire_ts_1.encode)(s.body).length;
|
|
296
|
+
while (from > 0 && total + size(steps[from - 1]) <= exports.AGY_TOTAL_CAP)
|
|
297
|
+
total += size(steps[--from]);
|
|
298
|
+
while (from > 0 && from < steps.length && steps[from].type !== agyWire_ts_1.E.StepType.USER_INPUT)
|
|
299
|
+
from++;
|
|
300
|
+
const lastIndex = (end, type) => { for (let i = end - 1; i >= 0; i--)
|
|
301
|
+
if (steps[i].type === type)
|
|
302
|
+
return i; return -1; };
|
|
303
|
+
if (from >= steps.length)
|
|
304
|
+
from = Math.max(0, lastIndex(steps.length, agyWire_ts_1.E.StepType.USER_INPUT));
|
|
305
|
+
let kept = steps.slice(from);
|
|
306
|
+
if (from > 0) {
|
|
307
|
+
// The last compaction summary before the cut carries what the left-out part said, and the full record holds all of it.
|
|
308
|
+
const s = lastIndex(from, agyWire_ts_1.E.StepType.CONVERSATION_HISTORY), lastSummary = s >= 0 ? steps[s] : undefined;
|
|
309
|
+
const where = opts.fullRecord ? ` The whole conversation is in ${opts.fullRecord}: read it when you need something from earlier.` : '';
|
|
310
|
+
kept = [{ type: agyWire_ts_1.E.StepType.CONVERSATION_HISTORY, source: agyWire_ts_1.E.StepSource.SYSTEM, at: kept[0]?.at, body: { [agyWire_ts_1.F.Step.conversation_history]: {
|
|
311
|
+
[agyWire_ts_1.F.CortexStepConversationHistory.content]: `This conversation was copied from another agent. Everything from here on is its most recent part, in full, up to where it stopped: answer about recent work from it directly. Its ${from} earliest steps are not in this copy, because the conversation is longer than a copy carries.${where}`
|
|
312
|
+
} } },
|
|
313
|
+
...(lastSummary ? [lastSummary] : []), ...kept];
|
|
314
|
+
}
|
|
315
|
+
report.omitted = from;
|
|
316
|
+
report.steps = kept.length;
|
|
317
|
+
return { steps: kept, report };
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* 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
|
|
321
|
+
* folder and then linked to its final name, which fails if anything holds that name: nothing is ever replaced, and agy never sees a
|
|
322
|
+
* half-written conversation.
|
|
323
|
+
*/
|
|
324
|
+
async function writeAgyConversation(turns, subagents, opts) {
|
|
325
|
+
const { steps, report } = agySteps(turns, subagents, opts.cwd, { fullRecord: opts.fullRecord });
|
|
326
|
+
if (!steps.some((s) => s.type === agyWire_ts_1.E.StepType.USER_INPUT))
|
|
327
|
+
throw new Error('There is no message from the person to start the agy conversation with.');
|
|
328
|
+
const dir = (0, owned_ts_1.ownedPath)(opts.store, (0, node_path_1.join)(opts.store, 'conversations'));
|
|
329
|
+
(0, node_fs_1.mkdirSync)(dir, { recursive: true });
|
|
330
|
+
const cid = (0, node_crypto_1.randomUUID)(), tid = (0, node_crypto_1.randomUUID)(), file = (0, owned_ts_1.ownedPath)(opts.store, (0, node_path_1.join)(dir, `${cid}.db`)), tmp = (0, node_path_1.join)(dir, `.${cid}.xeno-copy`);
|
|
331
|
+
if ((0, node_fs_1.existsSync)(file) || (0, node_fs_1.existsSync)(tmp))
|
|
332
|
+
throw new Error(`Refusing to overwrite ${file}`);
|
|
333
|
+
const now = opts.now ?? Date.now(), uri = fileUri(opts.cwd, opts.cwd);
|
|
334
|
+
const workspace = { [agyWire_ts_1.F.CortexWorkspaceMetadata.workspace_folder_absolute_uri]: uri, [agyWire_ts_1.F.CortexWorkspaceMetadata.repository]: {} };
|
|
335
|
+
const meta = (0, protowire_ts_1.encode)({ [agyWire_ts_1.F.CortexTrajectoryMetadata.workspaces]: [workspace], [agyWire_ts_1.F.CortexTrajectoryMetadata.created_at]: (0, protowire_ts_1.timestamp)(steps[0]?.at, now),
|
|
336
|
+
[agyWire_ts_1.F.CortexTrajectoryMetadata.root_conversation_id]: cid, [agyWire_ts_1.F.CortexTrajectoryMetadata.workspace_uris]: [uri], [agyWire_ts_1.F.CortexTrajectoryMetadata.project_id]: 'default-cli-project' });
|
|
337
|
+
const { DatabaseSync } = await Promise.resolve().then(() => require('node:sqlite'));
|
|
338
|
+
const db = new DatabaseSync(tmp);
|
|
339
|
+
try {
|
|
340
|
+
for (const p of agyWire_ts_1.AGY_DB_PRAGMAS)
|
|
341
|
+
db.exec(p);
|
|
342
|
+
for (const s of agyWire_ts_1.AGY_DB_SQL)
|
|
343
|
+
db.exec(s);
|
|
344
|
+
db.exec('BEGIN');
|
|
345
|
+
db.prepare('insert into trajectory_meta values (?,?,?,?)').run(tid, cid, agyWire_ts_1.AGY_TRAJECTORY.type, agyWire_ts_1.AGY_TRAJECTORY.source);
|
|
346
|
+
db.prepare("insert into trajectory_metadata_blob values ('main', ?)").run(meta);
|
|
347
|
+
const insert = db.prepare('insert into steps (idx,step_type,status,has_subtrajectory,metadata,step_payload,step_format) values (?,?,?,0,?,?,0)');
|
|
348
|
+
let execution = (0, node_crypto_1.randomUUID)(), last = now - steps.length * 1000;
|
|
349
|
+
steps.forEach((s, idx) => {
|
|
350
|
+
if (s.type === agyWire_ts_1.E.StepType.USER_INPUT)
|
|
351
|
+
execution = (0, node_crypto_1.randomUUID)();
|
|
352
|
+
// Times are the original's where it recorded them, and never run backwards.
|
|
353
|
+
const t = Math.max(last + 1, Number.isFinite(Date.parse(s.at ?? '')) ? Date.parse(s.at) : last + 1000);
|
|
354
|
+
last = t;
|
|
355
|
+
const stamp = (0, protowire_ts_1.timestamp)(t, now);
|
|
356
|
+
const metadata = { [agyWire_ts_1.F.CortexStepMetadata.created_at]: stamp, [agyWire_ts_1.F.CortexStepMetadata.source]: s.source, [agyWire_ts_1.F.CortexStepMetadata.completed_at]: stamp,
|
|
357
|
+
[agyWire_ts_1.F.CortexStepMetadata.execution_id]: execution, [agyWire_ts_1.F.CortexStepMetadata.source_trajectory_step_info]: { [agyWire_ts_1.F.SourceTrajectoryStepInfo.trajectory_id]: tid,
|
|
358
|
+
[agyWire_ts_1.F.SourceTrajectoryStepInfo.step_index]: idx, [agyWire_ts_1.F.SourceTrajectoryStepInfo.cascade_id]: cid },
|
|
359
|
+
[agyWire_ts_1.F.CortexStepMetadata.model_api_content_id]: (0, node_crypto_1.randomUUID)().replace(/-/g, ''),
|
|
360
|
+
...(s.tool ? { [agyWire_ts_1.F.CortexStepMetadata.tool_call]: { [agyWire_ts_1.F.ChatToolCall.id]: s.tool.id, [agyWire_ts_1.F.ChatToolCall.name]: s.tool.name, [agyWire_ts_1.F.ChatToolCall.arguments_json]: s.tool.args },
|
|
361
|
+
[agyWire_ts_1.F.CortexStepMetadata.tool_source]: agyWire_ts_1.E.ComponentSource.BUILTIN } : {}) };
|
|
362
|
+
const payload = (0, protowire_ts_1.encode)({ [agyWire_ts_1.F.Step.type]: s.type, [agyWire_ts_1.F.Step.status]: agyWire_ts_1.E.StepStatus.DONE, [agyWire_ts_1.F.Step.metadata]: metadata, ...s.body });
|
|
363
|
+
insert.run(idx, s.type, agyWire_ts_1.E.StepStatus.DONE, (0, protowire_ts_1.encode)(metadata), payload);
|
|
364
|
+
});
|
|
365
|
+
db.exec('COMMIT');
|
|
366
|
+
}
|
|
367
|
+
catch (e) {
|
|
368
|
+
try {
|
|
369
|
+
db.close();
|
|
370
|
+
}
|
|
371
|
+
catch { /* closing */ }
|
|
372
|
+
for (const f of [tmp, `${tmp}-wal`, `${tmp}-shm`])
|
|
373
|
+
try {
|
|
374
|
+
(0, node_fs_1.unlinkSync)(f);
|
|
375
|
+
}
|
|
376
|
+
catch { /* absent */ }
|
|
377
|
+
throw e;
|
|
378
|
+
}
|
|
379
|
+
db.close();
|
|
380
|
+
try {
|
|
381
|
+
(0, node_fs_1.linkSync)(tmp, file);
|
|
382
|
+
}
|
|
383
|
+
finally {
|
|
384
|
+
(0, node_fs_1.unlinkSync)(tmp);
|
|
385
|
+
for (const f of [`${tmp}-wal`, `${tmp}-shm`])
|
|
386
|
+
try {
|
|
387
|
+
(0, node_fs_1.unlinkSync)(f);
|
|
388
|
+
}
|
|
389
|
+
catch { /* absent */ }
|
|
390
|
+
}
|
|
391
|
+
return { id: cid, file, report };
|
|
392
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agy's (Antigravity's) conversation format: the field numbers and enum values a native conversation is written with.
|
|
3
|
+
*
|
|
4
|
+
* Source: the protobuf schema compiled into agy.exe 1.5.19, extracted with the scripts in `scripts/agy-schema/` (Go programs embed
|
|
5
|
+
* every .proto file they use). `agy-schema.json` beside this file is that extraction, and `agyWire.test.ts` checks every number here
|
|
6
|
+
* against it, so a typo or a schema change fails a test rather than writing a conversation agy misreads.
|
|
7
|
+
*
|
|
8
|
+
* Named as agy's schema names them: `Step` is gemini_coder.Step, the rest are in exa.cortex_pb.
|
|
9
|
+
*/
|
|
10
|
+
/** A conversation is one SQLite file, `conversations/<id>.db`, with these tables exactly as agy creates them. */
|
|
11
|
+
export declare const AGY_DB_SQL: readonly ["CREATE TABLE `trajectory_meta` (`trajectory_id` text,`cascade_id` text,`trajectory_type` integer,`source` integer,PRIMARY KEY (`trajectory_id`))", "CREATE TABLE `steps` (`idx` integer,`step_type` integer NOT NULL DEFAULT 0,`status` integer NOT NULL DEFAULT 0,`has_subtrajectory` numeric NOT NULL DEFAULT false,`metadata` blob,`error_details` blob,`permissions` blob,`task_details` blob,`render_info` blob,`step_payload` blob,`step_format` integer NOT NULL DEFAULT 0,PRIMARY KEY (`idx`))", "CREATE INDEX `idx_steps_status` ON `steps`(`status`)", "CREATE INDEX `idx_steps_step_type` ON `steps`(`step_type`)", "CREATE TABLE `gen_metadata` (`idx` integer,`data` blob,`size` integer NOT NULL DEFAULT 0,PRIMARY KEY (`idx`))", "CREATE TABLE `executor_metadata` (`idx` integer,`data` blob,PRIMARY KEY (`idx`))", "CREATE TABLE `parent_references` (`idx` integer,`data` blob,PRIMARY KEY (`idx`))", "CREATE TABLE `trajectory_metadata_blob` (`id` text DEFAULT \"main\",`data` blob,PRIMARY KEY (`id`))", "CREATE TABLE `battle_mode_infos` (`idx` integer,`data` blob,PRIMARY KEY (`idx`))"];
|
|
12
|
+
/**
|
|
13
|
+
* 🔴 agy refuses a database without these ("trajectory db is not initialized", measured 2026-11-28): schema version 1, and the page
|
|
14
|
+
* size and journal mode it creates its own with.
|
|
15
|
+
*/
|
|
16
|
+
export declare const AGY_DB_PRAGMAS: readonly ["pragma page_size = 32768", "pragma journal_mode = wal", "pragma user_version = 1"];
|
|
17
|
+
/** `trajectory_meta` columns for a conversation, as agy writes them (CORTEX_TRAJECTORY_TYPE_CASCADE, and its source code 17). */
|
|
18
|
+
export declare const AGY_TRAJECTORY: {
|
|
19
|
+
readonly type: 4;
|
|
20
|
+
readonly source: 17;
|
|
21
|
+
};
|
|
22
|
+
export declare const F: {
|
|
23
|
+
readonly Step: {
|
|
24
|
+
readonly type: 1;
|
|
25
|
+
readonly status: 4;
|
|
26
|
+
readonly metadata: 5;
|
|
27
|
+
readonly user_input: 19;
|
|
28
|
+
readonly planner_response: 20;
|
|
29
|
+
readonly error_message: 24;
|
|
30
|
+
readonly conversation_history: 111;
|
|
31
|
+
readonly system_message: 114;
|
|
32
|
+
readonly generic: 140;
|
|
33
|
+
};
|
|
34
|
+
readonly CortexStepMetadata: {
|
|
35
|
+
readonly created_at: 1;
|
|
36
|
+
readonly source: 3;
|
|
37
|
+
readonly tool_call: 4;
|
|
38
|
+
readonly viewable_at: 6;
|
|
39
|
+
readonly finished_generating_at: 7;
|
|
40
|
+
readonly completed_at: 8;
|
|
41
|
+
readonly execution_id: 12;
|
|
42
|
+
readonly source_trajectory_step_info: 20;
|
|
43
|
+
readonly started_at: 32;
|
|
44
|
+
readonly model_api_content_id: 35;
|
|
45
|
+
readonly tool_source: 38;
|
|
46
|
+
};
|
|
47
|
+
readonly SourceTrajectoryStepInfo: {
|
|
48
|
+
readonly trajectory_id: 1;
|
|
49
|
+
readonly step_index: 2;
|
|
50
|
+
readonly cascade_id: 4;
|
|
51
|
+
};
|
|
52
|
+
readonly CortexStepUserInput: {
|
|
53
|
+
readonly query: 1;
|
|
54
|
+
readonly user_response: 2;
|
|
55
|
+
readonly items: 3;
|
|
56
|
+
readonly is_queued_message: 6;
|
|
57
|
+
};
|
|
58
|
+
readonly TextOrScopeItem: {
|
|
59
|
+
readonly text: 1;
|
|
60
|
+
};
|
|
61
|
+
readonly CortexStepPlannerResponse: {
|
|
62
|
+
readonly response: 1;
|
|
63
|
+
readonly thinking: 3;
|
|
64
|
+
readonly message_id: 6;
|
|
65
|
+
readonly tool_calls: 7;
|
|
66
|
+
};
|
|
67
|
+
readonly ChatToolCall: {
|
|
68
|
+
readonly id: 1;
|
|
69
|
+
readonly name: 2;
|
|
70
|
+
readonly arguments_json: 3;
|
|
71
|
+
};
|
|
72
|
+
readonly CortexStepGeneric: {
|
|
73
|
+
readonly args: 1;
|
|
74
|
+
readonly result: 2;
|
|
75
|
+
};
|
|
76
|
+
readonly GenericStepResult: {
|
|
77
|
+
readonly result: 1;
|
|
78
|
+
readonly step_render_info: 3;
|
|
79
|
+
};
|
|
80
|
+
readonly StepRenderInfo: {
|
|
81
|
+
readonly title: 1;
|
|
82
|
+
readonly markdown: 2;
|
|
83
|
+
readonly hidden: 4;
|
|
84
|
+
readonly title_prefix: 5;
|
|
85
|
+
readonly icon: 6;
|
|
86
|
+
readonly aggregation_key: 7;
|
|
87
|
+
readonly title_parts: 9;
|
|
88
|
+
readonly content_blocks: 10;
|
|
89
|
+
};
|
|
90
|
+
readonly TitlePart: {
|
|
91
|
+
readonly text: 1;
|
|
92
|
+
readonly file: 2;
|
|
93
|
+
readonly file_diff: 4;
|
|
94
|
+
};
|
|
95
|
+
readonly FileRef: {
|
|
96
|
+
readonly uri: 1;
|
|
97
|
+
readonly start_line: 2;
|
|
98
|
+
readonly end_line: 3;
|
|
99
|
+
readonly total_lines: 4;
|
|
100
|
+
readonly total_bytes: 5;
|
|
101
|
+
};
|
|
102
|
+
readonly FileDiffRef: {
|
|
103
|
+
readonly uri: 1;
|
|
104
|
+
readonly diff_stats: 2;
|
|
105
|
+
};
|
|
106
|
+
readonly DiffStats: {
|
|
107
|
+
readonly additions: 1;
|
|
108
|
+
readonly deletions: 2;
|
|
109
|
+
};
|
|
110
|
+
readonly ContentBlock: {
|
|
111
|
+
readonly markdown: 1;
|
|
112
|
+
readonly terminal: 3;
|
|
113
|
+
};
|
|
114
|
+
readonly TerminalBlock: {
|
|
115
|
+
readonly command: 1;
|
|
116
|
+
readonly cwd: 2;
|
|
117
|
+
readonly exit_code: 3;
|
|
118
|
+
readonly output: 4;
|
|
119
|
+
};
|
|
120
|
+
readonly CortexStepSystemMessage: {
|
|
121
|
+
readonly message: 1;
|
|
122
|
+
};
|
|
123
|
+
readonly CortexStepConversationHistory: {
|
|
124
|
+
readonly content: 1;
|
|
125
|
+
};
|
|
126
|
+
readonly CortexTrajectoryMetadata: {
|
|
127
|
+
readonly workspaces: 1;
|
|
128
|
+
readonly created_at: 2;
|
|
129
|
+
readonly root_conversation_id: 6;
|
|
130
|
+
readonly workspace_uris: 7;
|
|
131
|
+
readonly project_id: 18;
|
|
132
|
+
};
|
|
133
|
+
readonly CortexWorkspaceMetadata: {
|
|
134
|
+
readonly workspace_folder_absolute_uri: 1;
|
|
135
|
+
readonly repository: 3;
|
|
136
|
+
};
|
|
137
|
+
readonly CascadeTrajectorySummary: {
|
|
138
|
+
readonly summary: 1;
|
|
139
|
+
readonly step_count: 2;
|
|
140
|
+
readonly last_modified_time: 3;
|
|
141
|
+
readonly trajectory_id: 4;
|
|
142
|
+
readonly status: 5;
|
|
143
|
+
readonly created_time: 7;
|
|
144
|
+
readonly workspaces: 9;
|
|
145
|
+
readonly last_user_input_time: 10;
|
|
146
|
+
readonly last_user_input_step_index: 16;
|
|
147
|
+
readonly trajectory_metadata: 17;
|
|
148
|
+
};
|
|
149
|
+
readonly Timestamp: {
|
|
150
|
+
readonly seconds: 1;
|
|
151
|
+
readonly nanos: 2;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
/** The schema message each table above is, for the check against `agy-schema.json`. */
|
|
155
|
+
export declare const MESSAGE_NAMES: Record<keyof typeof F, string>;
|
|
156
|
+
export declare const E: {
|
|
157
|
+
readonly StepType: {
|
|
158
|
+
readonly USER_INPUT: 14;
|
|
159
|
+
readonly PLANNER_RESPONSE: 15;
|
|
160
|
+
readonly ERROR_MESSAGE: 17;
|
|
161
|
+
readonly CONVERSATION_HISTORY: 98;
|
|
162
|
+
readonly SYSTEM_MESSAGE: 101;
|
|
163
|
+
readonly GENERIC: 132;
|
|
164
|
+
};
|
|
165
|
+
readonly StepStatus: {
|
|
166
|
+
readonly DONE: 3;
|
|
167
|
+
};
|
|
168
|
+
readonly StepSource: {
|
|
169
|
+
readonly MODEL: 2;
|
|
170
|
+
readonly USER_EXPLICIT: 4;
|
|
171
|
+
readonly SYSTEM: 5;
|
|
172
|
+
};
|
|
173
|
+
readonly RunStatus: {
|
|
174
|
+
readonly IDLE: 1;
|
|
175
|
+
};
|
|
176
|
+
readonly ComponentSource: {
|
|
177
|
+
readonly BUILTIN: 1;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
/** The schema enum and value prefix each table above is, for the same check. */
|
|
181
|
+
export declare const ENUM_NAMES: Record<keyof typeof E, [string, string]>;
|