buckyos 0.7.170 → 0.7.175
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/cli/core/app.ts +2 -0
- package/cli/core/argv.ts +45 -239
- package/cli/core/command.ts +3 -35
- package/cli/dist/cli.mjs +2151 -673
- package/cli/dist/cli.mjs.map +1 -1
- package/cli/modules/agent.ts +3 -1
- package/cli/modules/app.ts +13 -2
- package/cli/modules/pikg.ts +70 -1
- package/cli/modules/runtime.ts +497 -0
- package/cli/modules/skill.ts +583 -161
- package/cli/modules/skill_lint.ts +462 -0
- package/cli/version.ts +1 -1
- package/dist/account-7a7bde6f.mjs +105 -0
- package/dist/account-7a7bde6f.mjs.map +1 -0
- package/dist/account-b12ac6b9.js +2 -0
- package/dist/account-b12ac6b9.js.map +1 -0
- package/dist/aicc-67851c41.mjs +582 -0
- package/dist/aicc-67851c41.mjs.map +1 -0
- package/dist/aicc-ccb36ef7.js +2 -0
- package/dist/aicc-ccb36ef7.js.map +1 -0
- package/dist/browser.cjs +1 -1
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +2 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.mjs +204 -194
- package/dist/browser.mjs.map +1 -1
- package/dist/did_object_client-6a1b108a.js +2 -0
- package/dist/did_object_client-6a1b108a.js.map +1 -0
- package/dist/did_object_client-7fa36f90.mjs +87 -0
- package/dist/did_object_client-7fa36f90.mjs.map +1 -0
- package/dist/did_object_client.d.ts +39 -0
- package/dist/did_object_client.d.ts.map +1 -0
- package/dist/{executor_client-5f4d0468.mjs → executor_client-c620d25c.mjs} +233 -748
- package/dist/executor_client-c620d25c.mjs.map +1 -0
- package/dist/executor_client-d4439d54.js +13 -0
- package/dist/executor_client-d4439d54.js.map +1 -0
- package/dist/executor_client.d.ts +129 -0
- package/dist/executor_client.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +209 -199
- package/dist/index.mjs.map +1 -1
- package/dist/internal/command_args.d.ts +67 -0
- package/dist/internal/command_args.d.ts.map +1 -0
- package/dist/krpc_client-26c2dc8b.js +2 -0
- package/dist/krpc_client-26c2dc8b.js.map +1 -0
- package/dist/krpc_client-673448e5.mjs +173 -0
- package/dist/krpc_client-673448e5.mjs.map +1 -0
- package/dist/krpc_client.d.ts +5 -1
- package/dist/krpc_client.d.ts.map +1 -1
- package/dist/{ndn_types-ab30fac0.mjs → ndn_types-0fac2499.mjs} +115 -215
- package/dist/ndn_types-0fac2499.mjs.map +1 -0
- package/dist/ndn_types-5b138882.js +2 -0
- package/dist/ndn_types-5b138882.js.map +1 -0
- package/dist/node.cjs +1 -1
- package/dist/node.cjs.map +1 -1
- package/dist/node.mjs +201 -194
- package/dist/node.mjs.map +1 -1
- package/dist/object_url-8fb5a7bf.js +2 -0
- package/dist/object_url-8fb5a7bf.js.map +1 -0
- package/dist/object_url-f72c1704.mjs +412 -0
- package/dist/object_url-f72c1704.mjs.map +1 -0
- package/dist/openai-ae2978de.mjs +163 -0
- package/dist/openai-ae2978de.mjs.map +1 -0
- package/dist/openai-f560d518.js +2 -0
- package/dist/openai-f560d518.js.map +1 -0
- package/dist/provision.cjs +6 -6
- package/dist/provision.cjs.map +1 -1
- package/dist/provision.mjs +4 -3
- package/dist/provision.mjs.map +1 -1
- package/dist/site_manager-11a7a468.mjs +6410 -0
- package/dist/site_manager-11a7a468.mjs.map +1 -0
- package/dist/site_manager-334b1a51.js +2 -0
- package/dist/site_manager-334b1a51.js.map +1 -0
- package/dist/{tus_client-b231b248.js → tus_client-809c90ab.js} +2 -2
- package/dist/{tus_client-b231b248.js.map → tus_client-809c90ab.js.map} +1 -1
- package/dist/{tus_client-d1ffe2d6.mjs → tus_client-893a3287.mjs} +2 -2
- package/dist/{tus_client-d1ffe2d6.mjs.map → tus_client-893a3287.mjs.map} +1 -1
- package/dist/xllm/core/action_parser.d.ts +15 -0
- package/dist/xllm/core/action_parser.d.ts.map +1 -0
- package/dist/xllm/core/behavior_loop.d.ts +20 -0
- package/dist/xllm/core/behavior_loop.d.ts.map +1 -0
- package/dist/xllm/core/behavior_result.d.ts +11 -0
- package/dist/xllm/core/behavior_result.d.ts.map +1 -0
- package/dist/xllm/core/config.d.ts +62 -0
- package/dist/xllm/core/config.d.ts.map +1 -0
- package/dist/xllm/core/context_window.d.ts +15 -0
- package/dist/xllm/core/context_window.d.ts.map +1 -0
- package/dist/xllm/core/deps.d.ts +97 -0
- package/dist/xllm/core/deps.d.ts.map +1 -0
- package/dist/xllm/core/errors.d.ts +94 -0
- package/dist/xllm/core/errors.d.ts.map +1 -0
- package/dist/xllm/core/interrupt.d.ts +31 -0
- package/dist/xllm/core/interrupt.d.ts.map +1 -0
- package/dist/xllm/core/json.d.ts +11 -0
- package/dist/xllm/core/json.d.ts.map +1 -0
- package/dist/xllm/core/json_check.d.ts +17 -0
- package/dist/xllm/core/json_check.d.ts.map +1 -0
- package/dist/xllm/core/loop.d.ts +135 -0
- package/dist/xllm/core/loop.d.ts.map +1 -0
- package/dist/xllm/core/messages.d.ts +18 -0
- package/dist/xllm/core/messages.d.ts.map +1 -0
- package/dist/xllm/core/observer.d.ts +14 -0
- package/dist/xllm/core/observer.d.ts.map +1 -0
- package/dist/xllm/core/open_runtime.d.ts +22 -0
- package/dist/xllm/core/open_runtime.d.ts.map +1 -0
- package/dist/xllm/core/prepare.d.ts +54 -0
- package/dist/xllm/core/prepare.d.ts.map +1 -0
- package/dist/xllm/core/prompt.d.ts +40 -0
- package/dist/xllm/core/prompt.d.ts.map +1 -0
- package/dist/xllm/core/protocol.d.ts +15 -0
- package/dist/xllm/core/protocol.d.ts.map +1 -0
- package/dist/xllm/core/result.d.ts +12 -0
- package/dist/xllm/core/result.d.ts.map +1 -0
- package/dist/xllm/core/run.d.ts +198 -0
- package/dist/xllm/core/run.d.ts.map +1 -0
- package/dist/xllm/core/rust_text.d.ts +20 -0
- package/dist/xllm/core/rust_text.d.ts.map +1 -0
- package/dist/xllm/core/site_policy.d.ts +5 -0
- package/dist/xllm/core/site_policy.d.ts.map +1 -0
- package/dist/xllm/core/store.d.ts +60 -0
- package/dist/xllm/core/store.d.ts.map +1 -0
- package/dist/xllm/core/suspension.d.ts +13 -0
- package/dist/xllm/core/suspension.d.ts.map +1 -0
- package/dist/xllm/core/tokenizer.d.ts +8 -0
- package/dist/xllm/core/tokenizer.d.ts.map +1 -0
- package/dist/xllm/core/types.d.ts +826 -0
- package/dist/xllm/core/types.d.ts.map +1 -0
- package/dist/xllm/core/xml.d.ts +19 -0
- package/dist/xllm/core/xml.d.ts.map +1 -0
- package/dist/xllm/dev/openai.d.ts +17 -0
- package/dist/xllm/dev/openai.d.ts.map +1 -0
- package/dist/xllm/dev/scripted.d.ts +46 -0
- package/dist/xllm/dev/scripted.d.ts.map +1 -0
- package/dist/xllm/dev.d.ts +5 -0
- package/dist/xllm/dev.d.ts.map +1 -0
- package/dist/xllm/hosts/browser/store.d.ts +41 -0
- package/dist/xllm/hosts/browser/store.d.ts.map +1 -0
- package/dist/xllm/hosts/deno/deno_api.d.ts +103 -0
- package/dist/xllm/hosts/deno/deno_api.d.ts.map +1 -0
- package/dist/xllm/hosts/deno/identity.d.ts +29 -0
- package/dist/xllm/hosts/deno/identity.d.ts.map +1 -0
- package/dist/xllm/hosts/deno/index.d.ts +47 -0
- package/dist/xllm/hosts/deno/index.d.ts.map +1 -0
- package/dist/xllm/hosts/deno/native_runtime.d.ts +93 -0
- package/dist/xllm/hosts/deno/native_runtime.d.ts.map +1 -0
- package/dist/xllm/hosts/deno/native_tools.d.ts +105 -0
- package/dist/xllm/hosts/deno/native_tools.d.ts.map +1 -0
- package/dist/xllm/hosts/deno/provider.d.ts +13 -0
- package/dist/xllm/hosts/deno/provider.d.ts.map +1 -0
- package/dist/xllm/hosts/deno/store.d.ts +60 -0
- package/dist/xllm/hosts/deno/store.d.ts.map +1 -0
- package/dist/xllm/index.d.ts +48 -0
- package/dist/xllm/index.d.ts.map +1 -0
- package/dist/xllm/providers/aicc.d.ts +22 -0
- package/dist/xllm/providers/aicc.d.ts.map +1 -0
- package/dist/xllm/providers/timeout.d.ts +12 -0
- package/dist/xllm/providers/timeout.d.ts.map +1 -0
- package/dist/xllm/runtime/compress.d.ts +149 -0
- package/dist/xllm/runtime/compress.d.ts.map +1 -0
- package/dist/xllm/runtime/did_object_resources.d.ts +21 -0
- package/dist/xllm/runtime/did_object_resources.d.ts.map +1 -0
- package/dist/xllm/runtime/hints.d.ts +23 -0
- package/dist/xllm/runtime/hints.d.ts.map +1 -0
- package/dist/xllm/runtime/site.d.ts +22 -0
- package/dist/xllm/runtime/site.d.ts.map +1 -0
- package/dist/xllm/runtime/site_manager.d.ts +38 -0
- package/dist/xllm/runtime/site_manager.d.ts.map +1 -0
- package/dist/xllm/runtime/site_tools.d.ts +76 -0
- package/dist/xllm/runtime/site_tools.d.ts.map +1 -0
- package/dist/xllm/runtime/step_renderer.d.ts +54 -0
- package/dist/xllm/runtime/step_renderer.d.ts.map +1 -0
- package/dist/xllm/runtime/task_model.d.ts +64 -0
- package/dist/xllm/runtime/task_model.d.ts.map +1 -0
- package/dist/xllm/runtime/tool_result.d.ts +39 -0
- package/dist/xllm/runtime/tool_result.d.ts.map +1 -0
- package/dist/xllm/runtime/types.d.ts +99 -0
- package/dist/xllm/runtime/types.d.ts.map +1 -0
- package/dist/xllm.cjs +2 -0
- package/dist/xllm.cjs.map +1 -0
- package/dist/xllm.mjs +1167 -0
- package/dist/xllm.mjs.map +1 -0
- package/dist/xllm_deno.cjs +2 -0
- package/dist/xllm_deno.cjs.map +1 -0
- package/dist/xllm_deno.mjs +2487 -0
- package/dist/xllm_deno.mjs.map +1 -0
- package/dist/xllm_dev.cjs +2 -0
- package/dist/xllm_dev.cjs.map +1 -0
- package/dist/xllm_dev.mjs +70 -0
- package/dist/xllm_dev.mjs.map +1 -0
- package/package.json +22 -1
- package/src/internal/command_args.ts +268 -0
- package/dist/executor_client-1ee523cf.js +0 -13
- package/dist/executor_client-1ee523cf.js.map +0 -1
- package/dist/executor_client-5f4d0468.mjs.map +0 -1
- package/dist/ndn_types-8c2696d5.js +0 -2
- package/dist/ndn_types-8c2696d5.js.map +0 -1
- package/dist/ndn_types-ab30fac0.mjs.map +0 -1
|
@@ -0,0 +1,826 @@
|
|
|
1
|
+
import type { AiContent, AiCost, AiMessage, AiToolCall, JsonValue, ResourceRef } from '../../aicc_client';
|
|
2
|
+
export type { AiContent, AiCost, AiMessage, AiToolCall, JsonValue, ResourceRef };
|
|
3
|
+
/** `AiUsage` as Rust serializes it: every counter optional, `cost` summed per currency. */
|
|
4
|
+
export interface AiUsage {
|
|
5
|
+
input_tokens?: number;
|
|
6
|
+
output_tokens?: number;
|
|
7
|
+
total_tokens?: number;
|
|
8
|
+
cache_read_input_tokens?: number;
|
|
9
|
+
cache_write_input_tokens?: number;
|
|
10
|
+
cache_write_1h_input_tokens?: number;
|
|
11
|
+
reasoning_tokens?: number;
|
|
12
|
+
image_units?: number;
|
|
13
|
+
audio_seconds?: number;
|
|
14
|
+
video_seconds?: number;
|
|
15
|
+
reference_images?: number;
|
|
16
|
+
request_units?: number;
|
|
17
|
+
characters?: number;
|
|
18
|
+
audio_input_tokens?: number;
|
|
19
|
+
image_input_tokens?: number;
|
|
20
|
+
audio_output_tokens?: number;
|
|
21
|
+
image_output_tokens?: number;
|
|
22
|
+
reported_cost?: number;
|
|
23
|
+
cost?: AiCost;
|
|
24
|
+
}
|
|
25
|
+
export interface AiResponse {
|
|
26
|
+
message: AiMessage;
|
|
27
|
+
usage?: AiUsage;
|
|
28
|
+
cost?: AiCost;
|
|
29
|
+
finish_reason?: string;
|
|
30
|
+
provider_task_ref?: string;
|
|
31
|
+
extra?: JsonValue;
|
|
32
|
+
}
|
|
33
|
+
/** Externally tagged like Rust: unit variants are strings, `Refused` is `{ refused: { code } }`. */
|
|
34
|
+
export type ProviderFailure = 'transient' | 'permanent' | 'unknown' | 'context_limit' | {
|
|
35
|
+
refused: {
|
|
36
|
+
code: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type CheckpointStage = 'before_inference' | 'before_tool_call' | 'outcome_boundary';
|
|
40
|
+
export type ErrorSource = 'provider' | 'llm_output' | 'tool' | 'runtime' | 'snapshot' | 'internal';
|
|
41
|
+
export type LLMComputeError = {
|
|
42
|
+
kind: 'timeout';
|
|
43
|
+
} | {
|
|
44
|
+
kind: 'cancelled';
|
|
45
|
+
} | {
|
|
46
|
+
kind: 'provider';
|
|
47
|
+
failure: ProviderFailure;
|
|
48
|
+
message: string;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'output_parse';
|
|
51
|
+
message: string;
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'policy_rejected';
|
|
54
|
+
message: string;
|
|
55
|
+
} | {
|
|
56
|
+
kind: 'tool_failed';
|
|
57
|
+
tool: string;
|
|
58
|
+
call_id: string;
|
|
59
|
+
message: string;
|
|
60
|
+
} | {
|
|
61
|
+
kind: 'tool_runtime';
|
|
62
|
+
tool: string;
|
|
63
|
+
call_id: string;
|
|
64
|
+
message: string;
|
|
65
|
+
effect_unknown: boolean;
|
|
66
|
+
} | {
|
|
67
|
+
kind: 'checkpoint';
|
|
68
|
+
stage: CheckpointStage;
|
|
69
|
+
message: string;
|
|
70
|
+
} | {
|
|
71
|
+
kind: 'snapshot_corrupted';
|
|
72
|
+
message: string;
|
|
73
|
+
} | {
|
|
74
|
+
kind: 'internal';
|
|
75
|
+
message: string;
|
|
76
|
+
};
|
|
77
|
+
export type Observation = {
|
|
78
|
+
kind: 'success';
|
|
79
|
+
call_id: string;
|
|
80
|
+
content: JsonValue;
|
|
81
|
+
bytes: number;
|
|
82
|
+
truncated: boolean;
|
|
83
|
+
host?: JsonValue;
|
|
84
|
+
} | {
|
|
85
|
+
kind: 'error';
|
|
86
|
+
call_id: string;
|
|
87
|
+
message: string;
|
|
88
|
+
host?: JsonValue;
|
|
89
|
+
} | {
|
|
90
|
+
kind: 'cancelled';
|
|
91
|
+
call_id: string;
|
|
92
|
+
reason: string;
|
|
93
|
+
effect_unknown: boolean;
|
|
94
|
+
} | {
|
|
95
|
+
kind: 'unresolved';
|
|
96
|
+
call_id: string;
|
|
97
|
+
reason: string;
|
|
98
|
+
effect_unknown: boolean;
|
|
99
|
+
};
|
|
100
|
+
export type ToolExecStatus = 'succeeded' | 'failed' | 'unknown' | 'not_executed' | 'cancelled';
|
|
101
|
+
export interface ToolExecRecord {
|
|
102
|
+
tool_name: string;
|
|
103
|
+
call_id: string;
|
|
104
|
+
status: ToolExecStatus;
|
|
105
|
+
duration_ms: number;
|
|
106
|
+
error?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface ModelPolicy {
|
|
109
|
+
preferred: string;
|
|
110
|
+
fallbacks: string[];
|
|
111
|
+
temperature: number | null;
|
|
112
|
+
max_completion_tokens: number | null;
|
|
113
|
+
provider_options: JsonValue | null;
|
|
114
|
+
}
|
|
115
|
+
export type ToolMode = 'none' | 'whitelist' | 'all';
|
|
116
|
+
export interface ToolPolicy {
|
|
117
|
+
mode: ToolMode;
|
|
118
|
+
whitelist: string[];
|
|
119
|
+
action_mode: ToolMode;
|
|
120
|
+
action_whitelist: string[];
|
|
121
|
+
max_tool_iterations: number;
|
|
122
|
+
max_calls_per_round: number;
|
|
123
|
+
disable_capabilities: string[];
|
|
124
|
+
finish_grace_ms: number;
|
|
125
|
+
/** Omitted when empty. */
|
|
126
|
+
wrap_up_tools?: string[];
|
|
127
|
+
/** Omitted when `DEFAULT_WRAP_UP_ROUNDS`. */
|
|
128
|
+
wrap_up_rounds?: number;
|
|
129
|
+
}
|
|
130
|
+
export type OutputSpec = {
|
|
131
|
+
kind: 'text';
|
|
132
|
+
} | {
|
|
133
|
+
kind: 'json';
|
|
134
|
+
schema?: JsonValue;
|
|
135
|
+
strict: boolean;
|
|
136
|
+
max_repairs?: number;
|
|
137
|
+
};
|
|
138
|
+
export type BudgetAction = 'fail' | 'return_partial' | 'escalate_human';
|
|
139
|
+
export type ContextThreshold = {
|
|
140
|
+
kind: 'ratio';
|
|
141
|
+
value: number;
|
|
142
|
+
} | {
|
|
143
|
+
kind: 'absolute_tokens';
|
|
144
|
+
value: number;
|
|
145
|
+
};
|
|
146
|
+
export interface BudgetSpec {
|
|
147
|
+
max_total_tokens: number | null;
|
|
148
|
+
max_completion_tokens: number | null;
|
|
149
|
+
max_wallclock_ms: number | null;
|
|
150
|
+
max_cost_units: number | null;
|
|
151
|
+
on_exhausted: BudgetAction;
|
|
152
|
+
context_yield_threshold: ContextThreshold | null;
|
|
153
|
+
context_window_tokens: number | null;
|
|
154
|
+
}
|
|
155
|
+
export interface ErrorPolicy {
|
|
156
|
+
max_consecutive_errors: number;
|
|
157
|
+
}
|
|
158
|
+
export interface LLMContextRequest {
|
|
159
|
+
owner: JsonValue;
|
|
160
|
+
trace?: string;
|
|
161
|
+
objective: string;
|
|
162
|
+
/** Omitted when empty. */
|
|
163
|
+
behavior_name?: string;
|
|
164
|
+
input: AiMessage[];
|
|
165
|
+
model_policy: ModelPolicy;
|
|
166
|
+
tool_policy: ToolPolicy;
|
|
167
|
+
output: OutputSpec;
|
|
168
|
+
budget: BudgetSpec;
|
|
169
|
+
error_policy: ErrorPolicy;
|
|
170
|
+
forbid_next_behavior: boolean;
|
|
171
|
+
}
|
|
172
|
+
export type StepCompressionLevel = 'full' | 'compact' | 'summary';
|
|
173
|
+
export interface StepMeta {
|
|
174
|
+
behavior_name?: string;
|
|
175
|
+
step_index: number;
|
|
176
|
+
started_at_ms: number;
|
|
177
|
+
ended_at_ms?: number;
|
|
178
|
+
compression_level: StepCompressionLevel;
|
|
179
|
+
}
|
|
180
|
+
export interface HistorySummaryRecord {
|
|
181
|
+
step_count: number;
|
|
182
|
+
start_step_index: number;
|
|
183
|
+
end_step_index: number;
|
|
184
|
+
started_at_ms: number;
|
|
185
|
+
ended_at_ms: number;
|
|
186
|
+
behavior_names?: string[];
|
|
187
|
+
summary: string;
|
|
188
|
+
}
|
|
189
|
+
export interface StepRecord {
|
|
190
|
+
meta: StepMeta;
|
|
191
|
+
assistant_text: string;
|
|
192
|
+
assistant_message?: AiMessage;
|
|
193
|
+
native_messages?: AiMessage[];
|
|
194
|
+
observation?: string;
|
|
195
|
+
thought?: string;
|
|
196
|
+
actions?: AiToolCall[];
|
|
197
|
+
next_behavior?: string;
|
|
198
|
+
self_report?: string;
|
|
199
|
+
report_end: boolean;
|
|
200
|
+
report_result?: JsonValue;
|
|
201
|
+
action_results?: Observation[];
|
|
202
|
+
next_user_message?: AiMessage;
|
|
203
|
+
}
|
|
204
|
+
export interface LLMBehaviorResult {
|
|
205
|
+
do_actions?: AiToolCall[];
|
|
206
|
+
next_behavior?: string;
|
|
207
|
+
assistant_text: string;
|
|
208
|
+
observation?: string;
|
|
209
|
+
thought?: string;
|
|
210
|
+
self_report?: string;
|
|
211
|
+
report_end: boolean;
|
|
212
|
+
report_result?: JsonValue;
|
|
213
|
+
}
|
|
214
|
+
export type StepDecision = 'handover' | 'yield';
|
|
215
|
+
export type DecisionVerdict = {
|
|
216
|
+
accept: true;
|
|
217
|
+
} | {
|
|
218
|
+
refuse: string;
|
|
219
|
+
};
|
|
220
|
+
export type ContextLimitKind = 'approaching_window' | 'hard_limit' | 'provider_refused';
|
|
221
|
+
export interface Suspension {
|
|
222
|
+
which: ContextLimitKind;
|
|
223
|
+
estimated_tokens?: number;
|
|
224
|
+
at_ms: number;
|
|
225
|
+
}
|
|
226
|
+
export interface ToolBatch {
|
|
227
|
+
remaining?: AiToolCall[];
|
|
228
|
+
batch_error?: LLMComputeError;
|
|
229
|
+
}
|
|
230
|
+
export interface ActionStep {
|
|
231
|
+
step: StepRecord;
|
|
232
|
+
response: AiResponse;
|
|
233
|
+
}
|
|
234
|
+
export interface LLMContextState {
|
|
235
|
+
accumulated: AiMessage[];
|
|
236
|
+
usage: AiUsage;
|
|
237
|
+
tool_iterations_left: number;
|
|
238
|
+
wrap_up_rounds_used?: number;
|
|
239
|
+
started_at_ms: number;
|
|
240
|
+
cost_units: number;
|
|
241
|
+
consecutive_errors: number;
|
|
242
|
+
output_repairs?: number;
|
|
243
|
+
suspended?: Suspension;
|
|
244
|
+
tool_batch?: ToolBatch;
|
|
245
|
+
action_step?: ActionStep;
|
|
246
|
+
steps?: StepRecord[];
|
|
247
|
+
history_summaries?: HistorySummaryRecord[];
|
|
248
|
+
last_step?: StepRecord;
|
|
249
|
+
last_report?: string;
|
|
250
|
+
report_end: boolean;
|
|
251
|
+
next_step_index: number;
|
|
252
|
+
next_action_id: number;
|
|
253
|
+
snapshot_version: number;
|
|
254
|
+
host?: JsonValue;
|
|
255
|
+
}
|
|
256
|
+
export interface LLMContextSnapshot {
|
|
257
|
+
request: LLMContextRequest;
|
|
258
|
+
state: LLMContextState;
|
|
259
|
+
}
|
|
260
|
+
export type ContextOutput = {
|
|
261
|
+
kind: 'text';
|
|
262
|
+
content: string;
|
|
263
|
+
} | {
|
|
264
|
+
kind: 'json';
|
|
265
|
+
content: JsonValue;
|
|
266
|
+
} | {
|
|
267
|
+
kind: 'invalid';
|
|
268
|
+
content: string;
|
|
269
|
+
error: string;
|
|
270
|
+
};
|
|
271
|
+
export interface ContextRunTrace {
|
|
272
|
+
trace_id: string;
|
|
273
|
+
latency_ms: number;
|
|
274
|
+
tool_trace?: ToolExecRecord[];
|
|
275
|
+
}
|
|
276
|
+
export type BudgetKind = 'tokens' | 'wallclock' | 'cost_units' | 'tool_iterations';
|
|
277
|
+
export interface InferenceAbortTrace {
|
|
278
|
+
reason: string;
|
|
279
|
+
requested_at_ms: number;
|
|
280
|
+
observed_at_ms: number;
|
|
281
|
+
provider_cancel_supported: boolean;
|
|
282
|
+
provider_task_ref?: string;
|
|
283
|
+
}
|
|
284
|
+
export type LLMContextOutcome = {
|
|
285
|
+
kind: 'done';
|
|
286
|
+
reason?: string;
|
|
287
|
+
output: ContextOutput;
|
|
288
|
+
usage: AiUsage;
|
|
289
|
+
response: AiResponse;
|
|
290
|
+
trace: ContextRunTrace;
|
|
291
|
+
behavior_result?: LLMBehaviorResult;
|
|
292
|
+
} | {
|
|
293
|
+
kind: 'budget_exhausted';
|
|
294
|
+
which: BudgetKind;
|
|
295
|
+
partial?: ContextOutput;
|
|
296
|
+
usage: AiUsage;
|
|
297
|
+
} | {
|
|
298
|
+
kind: 'error';
|
|
299
|
+
error: LLMComputeError;
|
|
300
|
+
usage: AiUsage;
|
|
301
|
+
trace: ContextRunTrace;
|
|
302
|
+
} | {
|
|
303
|
+
kind: 'context_limit_reached';
|
|
304
|
+
which: ContextLimitKind;
|
|
305
|
+
usage: AiUsage;
|
|
306
|
+
accumulated: AiMessage[];
|
|
307
|
+
snapshot: LLMContextSnapshot;
|
|
308
|
+
deadline_ms?: number;
|
|
309
|
+
trace: ContextRunTrace;
|
|
310
|
+
} | {
|
|
311
|
+
kind: 'interrupted';
|
|
312
|
+
reason: string;
|
|
313
|
+
usage: AiUsage;
|
|
314
|
+
snapshot: LLMContextSnapshot;
|
|
315
|
+
abort: InferenceAbortTrace;
|
|
316
|
+
} | {
|
|
317
|
+
kind: 'settled';
|
|
318
|
+
reason: string;
|
|
319
|
+
usage: AiUsage;
|
|
320
|
+
snapshot: LLMContextSnapshot;
|
|
321
|
+
trace: ContextRunTrace;
|
|
322
|
+
};
|
|
323
|
+
export type ResumeFill = {
|
|
324
|
+
kind: 'rewritten_history';
|
|
325
|
+
history: AiMessage[];
|
|
326
|
+
} | {
|
|
327
|
+
kind: 'rewritten_steps';
|
|
328
|
+
input: AiMessage[];
|
|
329
|
+
history_summaries?: HistorySummaryRecord[];
|
|
330
|
+
steps?: StepRecord[];
|
|
331
|
+
last_step?: StepRecord;
|
|
332
|
+
} | {
|
|
333
|
+
kind: 'resume_from_mid_run';
|
|
334
|
+
};
|
|
335
|
+
export interface ToolSpecLite {
|
|
336
|
+
name: string;
|
|
337
|
+
description: string;
|
|
338
|
+
args_schema: JsonValue;
|
|
339
|
+
}
|
|
340
|
+
/** One inference sent to the provider adapter (`LlmInferenceRequest`). */
|
|
341
|
+
export interface LlmInferenceRequest {
|
|
342
|
+
trace_id?: string;
|
|
343
|
+
messages: AiMessage[];
|
|
344
|
+
model_alias: string;
|
|
345
|
+
fallbacks: string[];
|
|
346
|
+
temperature?: number;
|
|
347
|
+
max_completion_tokens?: number;
|
|
348
|
+
force_json: boolean;
|
|
349
|
+
json_schema?: JsonValue;
|
|
350
|
+
provider_options?: JsonValue;
|
|
351
|
+
disable_capabilities: string[];
|
|
352
|
+
tool_specs: ToolSpecLite[];
|
|
353
|
+
allow_tool_calls: boolean;
|
|
354
|
+
/** Fires when the run is interrupted; adapters wire it to their transport when they can. */
|
|
355
|
+
signal: AbortSignal;
|
|
356
|
+
}
|
|
357
|
+
/** Provider boundary: one call, one inference. Failures reject with an `LLMComputeException`. */
|
|
358
|
+
export interface LlmClient {
|
|
359
|
+
infer(req: LlmInferenceRequest): Promise<AiResponse>;
|
|
360
|
+
}
|
|
361
|
+
/** Failure of the dispatch infrastructure itself (not a tool that reported an error). */
|
|
362
|
+
export interface ToolDispatchError {
|
|
363
|
+
message: string;
|
|
364
|
+
effect_unknown: boolean;
|
|
365
|
+
}
|
|
366
|
+
export type CancelCause = 'interrupted' | 'finishing' | 'deadline';
|
|
367
|
+
export interface Tokenizer {
|
|
368
|
+
countTokens(text: string): number;
|
|
369
|
+
}
|
|
370
|
+
export interface Injection {
|
|
371
|
+
messages: AiMessage[];
|
|
372
|
+
host?: JsonValue;
|
|
373
|
+
}
|
|
374
|
+
export type InjectionPosition = {
|
|
375
|
+
kind: 'request_input';
|
|
376
|
+
at: number;
|
|
377
|
+
} | {
|
|
378
|
+
kind: 'accumulated';
|
|
379
|
+
at: number;
|
|
380
|
+
} | {
|
|
381
|
+
kind: 'step';
|
|
382
|
+
step_index: number;
|
|
383
|
+
} | {
|
|
384
|
+
kind: 'none';
|
|
385
|
+
};
|
|
386
|
+
export type WorkEvent = {
|
|
387
|
+
kind: 'llm_started';
|
|
388
|
+
trace_id?: string;
|
|
389
|
+
model: string;
|
|
390
|
+
} | {
|
|
391
|
+
kind: 'llm_finished';
|
|
392
|
+
trace_id?: string;
|
|
393
|
+
ok: boolean;
|
|
394
|
+
} | {
|
|
395
|
+
kind: 'llm_inference_failed';
|
|
396
|
+
trace_id?: string;
|
|
397
|
+
error: string;
|
|
398
|
+
} | {
|
|
399
|
+
kind: 'tool_call_planned';
|
|
400
|
+
trace_id?: string;
|
|
401
|
+
tool: string;
|
|
402
|
+
call_id: string;
|
|
403
|
+
args: Record<string, JsonValue>;
|
|
404
|
+
} | {
|
|
405
|
+
kind: 'tool_call_finished';
|
|
406
|
+
trace_id?: string;
|
|
407
|
+
tool: string;
|
|
408
|
+
call_id: string;
|
|
409
|
+
ok: boolean;
|
|
410
|
+
duration_ms: number;
|
|
411
|
+
} | {
|
|
412
|
+
kind: 'tool_call_failed';
|
|
413
|
+
trace_id?: string;
|
|
414
|
+
tool: string;
|
|
415
|
+
call_id: string;
|
|
416
|
+
message: string;
|
|
417
|
+
} | {
|
|
418
|
+
kind: 'output_parse_failed';
|
|
419
|
+
trace_id?: string;
|
|
420
|
+
error: string;
|
|
421
|
+
} | {
|
|
422
|
+
kind: 'tool_dispatch_failed';
|
|
423
|
+
trace_id?: string;
|
|
424
|
+
tool: string;
|
|
425
|
+
call_id: string;
|
|
426
|
+
message: string;
|
|
427
|
+
effect_unknown: boolean;
|
|
428
|
+
} | {
|
|
429
|
+
kind: 'checkpoint_failed';
|
|
430
|
+
trace_id?: string;
|
|
431
|
+
stage: CheckpointStage;
|
|
432
|
+
error: string;
|
|
433
|
+
} | {
|
|
434
|
+
kind: 'context_rewritten';
|
|
435
|
+
trace_id?: string;
|
|
436
|
+
from_messages: number;
|
|
437
|
+
to_messages: number;
|
|
438
|
+
} | {
|
|
439
|
+
kind: 'self_report_set';
|
|
440
|
+
trace_id?: string;
|
|
441
|
+
chars: number;
|
|
442
|
+
};
|
|
443
|
+
export interface Capabilities {
|
|
444
|
+
tools: Record<string, string>;
|
|
445
|
+
network: boolean;
|
|
446
|
+
os: string;
|
|
447
|
+
}
|
|
448
|
+
/** Identity of an execution target; a resume requires it to be equal field by field. */
|
|
449
|
+
export interface RuntimeDescriptor {
|
|
450
|
+
runtime_id: string;
|
|
451
|
+
kind: string;
|
|
452
|
+
host: string | null;
|
|
453
|
+
target: JsonValue;
|
|
454
|
+
workdir: string;
|
|
455
|
+
capabilities: Capabilities;
|
|
456
|
+
}
|
|
457
|
+
export type RuntimeBaseline = 'standard' | 'extended';
|
|
458
|
+
/** `.llm_context` `runtime` block (`deny_unknown_fields`). */
|
|
459
|
+
export interface RuntimeConfig {
|
|
460
|
+
kind?: string;
|
|
461
|
+
id?: string;
|
|
462
|
+
workdir?: string;
|
|
463
|
+
env: Record<string, string>;
|
|
464
|
+
remote_ssh?: {
|
|
465
|
+
host?: string | null;
|
|
466
|
+
user?: string;
|
|
467
|
+
port?: number;
|
|
468
|
+
identity_file?: string;
|
|
469
|
+
};
|
|
470
|
+
remote_node?: {
|
|
471
|
+
node_did?: string;
|
|
472
|
+
executor_id?: string;
|
|
473
|
+
profile_id?: string;
|
|
474
|
+
};
|
|
475
|
+
baseline?: RuntimeBaseline;
|
|
476
|
+
task_wait_ms?: number;
|
|
477
|
+
}
|
|
478
|
+
export interface RuntimeInfo {
|
|
479
|
+
id: string;
|
|
480
|
+
kind: string;
|
|
481
|
+
os: string;
|
|
482
|
+
arch: string;
|
|
483
|
+
hostname: string;
|
|
484
|
+
shell: string;
|
|
485
|
+
cwd: string;
|
|
486
|
+
tools: string[];
|
|
487
|
+
current_time: string;
|
|
488
|
+
timezone: string;
|
|
489
|
+
target: JsonValue;
|
|
490
|
+
platform: string;
|
|
491
|
+
shell_kind: string;
|
|
492
|
+
baseline: string;
|
|
493
|
+
}
|
|
494
|
+
export type ProviderKind = 'buckyos' | 'openai';
|
|
495
|
+
export type LoopModel = 'function_call' | 'behavior';
|
|
496
|
+
export type RunLogLevel = 'debug' | 'info' | 'warn' | 'result';
|
|
497
|
+
export type PromptMode = 'standard' | 'custom';
|
|
498
|
+
export type FilesystemPolicy = 'workspace' | 'unrestricted';
|
|
499
|
+
export type ResultFormat = {
|
|
500
|
+
kind: 'raw';
|
|
501
|
+
} | {
|
|
502
|
+
kind: 'path';
|
|
503
|
+
segments: string[];
|
|
504
|
+
};
|
|
505
|
+
export type SecretRef = {
|
|
506
|
+
kind: 'config_file';
|
|
507
|
+
path: string;
|
|
508
|
+
field: string;
|
|
509
|
+
} | {
|
|
510
|
+
kind: 'env';
|
|
511
|
+
name: string;
|
|
512
|
+
};
|
|
513
|
+
export interface ProviderConfig {
|
|
514
|
+
kind?: ProviderKind;
|
|
515
|
+
session_token?: SecretRef;
|
|
516
|
+
base_url?: string;
|
|
517
|
+
api_key?: SecretRef;
|
|
518
|
+
headers?: Record<string, string>;
|
|
519
|
+
on_behalf_of?: JsonValue;
|
|
520
|
+
}
|
|
521
|
+
export type ToolSource = {
|
|
522
|
+
kind: 'group';
|
|
523
|
+
groupname: string;
|
|
524
|
+
} | {
|
|
525
|
+
kind: 'mcp';
|
|
526
|
+
endpoint: string;
|
|
527
|
+
} | {
|
|
528
|
+
kind: 'named';
|
|
529
|
+
name: string;
|
|
530
|
+
};
|
|
531
|
+
export interface ShellToolConfig {
|
|
532
|
+
timeout_ms?: number;
|
|
533
|
+
max_timeout_ms?: number;
|
|
534
|
+
}
|
|
535
|
+
export interface ShellSettings {
|
|
536
|
+
wait_ms: number;
|
|
537
|
+
timeout_ms: number;
|
|
538
|
+
max_timeout_ms: number;
|
|
539
|
+
}
|
|
540
|
+
export interface BashToolManual {
|
|
541
|
+
name: string;
|
|
542
|
+
description: string;
|
|
543
|
+
command: string;
|
|
544
|
+
usage?: string;
|
|
545
|
+
}
|
|
546
|
+
export interface ToolsConfig {
|
|
547
|
+
enabled?: boolean;
|
|
548
|
+
filesystem_policy?: FilesystemPolicy;
|
|
549
|
+
tools2actions?: boolean;
|
|
550
|
+
tools?: ToolSource[];
|
|
551
|
+
actions?: ToolSource[];
|
|
552
|
+
bash_tools?: BashToolManual[];
|
|
553
|
+
shell?: ShellToolConfig;
|
|
554
|
+
}
|
|
555
|
+
export interface SectionDef {
|
|
556
|
+
key: string;
|
|
557
|
+
name?: string;
|
|
558
|
+
text?: string;
|
|
559
|
+
source: string;
|
|
560
|
+
}
|
|
561
|
+
export interface GroupDef {
|
|
562
|
+
default_user?: string;
|
|
563
|
+
sections?: Record<string, SectionDef>;
|
|
564
|
+
tools?: ToolsConfig;
|
|
565
|
+
sources: string[];
|
|
566
|
+
}
|
|
567
|
+
export interface PromptConfig {
|
|
568
|
+
mode?: PromptMode;
|
|
569
|
+
select?: string;
|
|
570
|
+
groups?: Record<string, GroupDef>;
|
|
571
|
+
sections?: Record<string, SectionDef>;
|
|
572
|
+
tools?: ToolsConfig;
|
|
573
|
+
system?: string;
|
|
574
|
+
}
|
|
575
|
+
export type RunsDirSetting = {
|
|
576
|
+
kind: 'disabled';
|
|
577
|
+
} | {
|
|
578
|
+
kind: 'path';
|
|
579
|
+
path: string;
|
|
580
|
+
};
|
|
581
|
+
/** One parsed `.llm_context` (here: the JSON form a host or a page hands over). */
|
|
582
|
+
export interface LlmContextFile {
|
|
583
|
+
runtime?: RuntimeConfig;
|
|
584
|
+
provider?: ProviderConfig;
|
|
585
|
+
model?: string;
|
|
586
|
+
file_model?: string;
|
|
587
|
+
max_tokens?: number;
|
|
588
|
+
max_tool_iterations?: number;
|
|
589
|
+
llm_timeout?: number;
|
|
590
|
+
context_window?: number;
|
|
591
|
+
context_yield_ratio?: number;
|
|
592
|
+
timeout?: number;
|
|
593
|
+
runs_dir?: RunsDirSetting;
|
|
594
|
+
loop_model?: LoopModel;
|
|
595
|
+
run_logs?: RunLogLevel;
|
|
596
|
+
result_format?: ResultFormat;
|
|
597
|
+
json?: boolean;
|
|
598
|
+
json_schema?: JsonValue;
|
|
599
|
+
tools?: ToolsConfig;
|
|
600
|
+
prompt?: PromptConfig;
|
|
601
|
+
}
|
|
602
|
+
/** The JSON object a caller passes as configuration (same schema as `.llm_context`, strict keys). */
|
|
603
|
+
export type LlmContextJson = {
|
|
604
|
+
[key: string]: JsonValue;
|
|
605
|
+
};
|
|
606
|
+
export interface RunLimits {
|
|
607
|
+
max_tokens?: number;
|
|
608
|
+
max_tool_iterations: number;
|
|
609
|
+
timeout_secs: number;
|
|
610
|
+
llm_timeout_secs: number;
|
|
611
|
+
context_window_tokens?: number;
|
|
612
|
+
context_yield_ratio?: number;
|
|
613
|
+
}
|
|
614
|
+
export interface ResolvedTool {
|
|
615
|
+
name: string;
|
|
616
|
+
description: string;
|
|
617
|
+
args_schema: JsonValue;
|
|
618
|
+
source: string;
|
|
619
|
+
}
|
|
620
|
+
export interface EffectiveTools {
|
|
621
|
+
enabled: boolean;
|
|
622
|
+
filesystem_policy: FilesystemPolicy;
|
|
623
|
+
tools2actions: boolean;
|
|
624
|
+
tool_sources: ToolSource[];
|
|
625
|
+
action_sources: ToolSource[];
|
|
626
|
+
native: ResolvedTool[];
|
|
627
|
+
actions: ResolvedTool[];
|
|
628
|
+
bash_tools: BashToolManual[];
|
|
629
|
+
shell: ShellSettings;
|
|
630
|
+
exec_enabled: boolean;
|
|
631
|
+
sources: Record<string, string>;
|
|
632
|
+
}
|
|
633
|
+
export interface EffectiveConfig {
|
|
634
|
+
runtime: RuntimeConfig;
|
|
635
|
+
runtime_descriptor: RuntimeDescriptor;
|
|
636
|
+
provider: ProviderConfig;
|
|
637
|
+
model: string;
|
|
638
|
+
file_model?: string;
|
|
639
|
+
loop_model: LoopModel;
|
|
640
|
+
limits: RunLimits;
|
|
641
|
+
run_logs: RunLogLevel;
|
|
642
|
+
result_format: ResultFormat;
|
|
643
|
+
json: boolean;
|
|
644
|
+
json_schema?: JsonValue;
|
|
645
|
+
disable_capabilities?: string[];
|
|
646
|
+
tools: EffectiveTools;
|
|
647
|
+
config_files: string[];
|
|
648
|
+
sources: Record<string, string>;
|
|
649
|
+
}
|
|
650
|
+
export interface SectionRender {
|
|
651
|
+
line: number;
|
|
652
|
+
name: string;
|
|
653
|
+
user_text?: string;
|
|
654
|
+
user_source?: string;
|
|
655
|
+
system_text?: string;
|
|
656
|
+
}
|
|
657
|
+
export interface PromptPlan {
|
|
658
|
+
mode: PromptMode;
|
|
659
|
+
group?: string;
|
|
660
|
+
loop_model: LoopModel;
|
|
661
|
+
sections: SectionRender[];
|
|
662
|
+
custom_system?: string;
|
|
663
|
+
custom_system_source?: string;
|
|
664
|
+
runtime_protocol: string;
|
|
665
|
+
protocol_version: string;
|
|
666
|
+
system_prompt: string;
|
|
667
|
+
user_request?: string;
|
|
668
|
+
user_request_source: string;
|
|
669
|
+
template_vars: Record<string, string>;
|
|
670
|
+
runtime_vars: Record<string, string>;
|
|
671
|
+
}
|
|
672
|
+
/** Which of xllm's own sections a hosted run appends after the host's system text. */
|
|
673
|
+
export interface HostPromptSections {
|
|
674
|
+
capabilities: boolean;
|
|
675
|
+
cmd_manual: boolean;
|
|
676
|
+
runtime_protocol: boolean;
|
|
677
|
+
}
|
|
678
|
+
export type HostProtocolFlavor = {
|
|
679
|
+
kind: 'one_shot';
|
|
680
|
+
} | {
|
|
681
|
+
kind: 'session';
|
|
682
|
+
intro: string;
|
|
683
|
+
};
|
|
684
|
+
export type RunStatus = 'running' | 'interrupted' | 'paused' | 'completed' | 'failed' | 'limit_reached';
|
|
685
|
+
export interface AttachmentRecord {
|
|
686
|
+
index: number;
|
|
687
|
+
kind: string;
|
|
688
|
+
label: string;
|
|
689
|
+
path?: string;
|
|
690
|
+
mime?: string;
|
|
691
|
+
bytes?: number;
|
|
692
|
+
sha256?: string;
|
|
693
|
+
}
|
|
694
|
+
export interface InputRecord {
|
|
695
|
+
request?: string;
|
|
696
|
+
request_source: string;
|
|
697
|
+
attachments: AttachmentRecord[];
|
|
698
|
+
stdin_role?: string;
|
|
699
|
+
stdin_chars?: number;
|
|
700
|
+
structured_messages?: number;
|
|
701
|
+
}
|
|
702
|
+
export interface FileModelStageRecord {
|
|
703
|
+
model: string;
|
|
704
|
+
analysis: string;
|
|
705
|
+
usage?: AiUsage;
|
|
706
|
+
response_model?: string;
|
|
707
|
+
completed_at_ms: number;
|
|
708
|
+
}
|
|
709
|
+
export interface RunErrorRecord {
|
|
710
|
+
phase: string;
|
|
711
|
+
kind: string;
|
|
712
|
+
message: string;
|
|
713
|
+
recoverable: boolean;
|
|
714
|
+
condition?: string;
|
|
715
|
+
at_ms: number;
|
|
716
|
+
}
|
|
717
|
+
export type ExtractedValue = {
|
|
718
|
+
kind: 'text';
|
|
719
|
+
text: string;
|
|
720
|
+
} | {
|
|
721
|
+
kind: 'json';
|
|
722
|
+
value: JsonValue;
|
|
723
|
+
} | {
|
|
724
|
+
kind: 'xml';
|
|
725
|
+
xml: string;
|
|
726
|
+
};
|
|
727
|
+
export interface RunResultRecord {
|
|
728
|
+
raw: string;
|
|
729
|
+
extracted?: ExtractedValue;
|
|
730
|
+
extract_error?: string;
|
|
731
|
+
json_valid?: boolean;
|
|
732
|
+
json_error?: string;
|
|
733
|
+
response_model?: string;
|
|
734
|
+
}
|
|
735
|
+
export interface UsageRecord {
|
|
736
|
+
main?: AiUsage;
|
|
737
|
+
file_model?: AiUsage;
|
|
738
|
+
compaction?: AiUsage;
|
|
739
|
+
llm_requests: number;
|
|
740
|
+
}
|
|
741
|
+
export interface FileStagePlan {
|
|
742
|
+
model: string;
|
|
743
|
+
request_text: string;
|
|
744
|
+
images: [string, ResourceRef][];
|
|
745
|
+
}
|
|
746
|
+
export interface PendingInput {
|
|
747
|
+
initial_messages: AiMessage[];
|
|
748
|
+
main_user_parts: AiContent[];
|
|
749
|
+
file_stage?: FileStagePlan;
|
|
750
|
+
}
|
|
751
|
+
export interface HostRunInfo {
|
|
752
|
+
assembled_by: string;
|
|
753
|
+
session_id?: string;
|
|
754
|
+
runtime_kind?: string;
|
|
755
|
+
runtime_id?: string;
|
|
756
|
+
env_check?: JsonValue;
|
|
757
|
+
extra?: JsonValue;
|
|
758
|
+
}
|
|
759
|
+
export interface RunHandover {
|
|
760
|
+
next_behavior: string;
|
|
761
|
+
at_ms: number;
|
|
762
|
+
}
|
|
763
|
+
/** `run.json` (`RUN_RECORD_VERSION` 7). */
|
|
764
|
+
export interface RunRecord {
|
|
765
|
+
version: number;
|
|
766
|
+
run_id: string;
|
|
767
|
+
status: RunStatus;
|
|
768
|
+
workdir: string;
|
|
769
|
+
runs_dir?: string;
|
|
770
|
+
created_at_ms: number;
|
|
771
|
+
updated_at_ms: number;
|
|
772
|
+
summary: string;
|
|
773
|
+
input: InputRecord;
|
|
774
|
+
config: EffectiveConfig;
|
|
775
|
+
prompt: PromptPlan;
|
|
776
|
+
file_model_stage?: FileModelStageRecord;
|
|
777
|
+
pending_input?: PendingInput;
|
|
778
|
+
latest_snapshot_idx?: number;
|
|
779
|
+
last_error?: RunErrorRecord;
|
|
780
|
+
result?: RunResultRecord;
|
|
781
|
+
artifacts: string[];
|
|
782
|
+
usage: UsageRecord;
|
|
783
|
+
limit_reason?: string;
|
|
784
|
+
interrupt_reason?: string;
|
|
785
|
+
compactions: number;
|
|
786
|
+
pid: number;
|
|
787
|
+
host?: HostRunInfo;
|
|
788
|
+
host_commit_pending?: number;
|
|
789
|
+
hints_once?: string[];
|
|
790
|
+
handover?: RunHandover;
|
|
791
|
+
}
|
|
792
|
+
export type RunPhase = 'preparing_input' | 'file_model' | 'waiting_model' | 'executing_tool' | 'compacting_context' | 'saving_result';
|
|
793
|
+
export type RunEvent = {
|
|
794
|
+
kind: 'phase';
|
|
795
|
+
phase: RunPhase;
|
|
796
|
+
detail: string;
|
|
797
|
+
} | {
|
|
798
|
+
kind: 'llm_started';
|
|
799
|
+
model: string;
|
|
800
|
+
} | {
|
|
801
|
+
kind: 'llm_finished';
|
|
802
|
+
ok: boolean;
|
|
803
|
+
elapsed_ms: number;
|
|
804
|
+
} | {
|
|
805
|
+
kind: 'tool_started';
|
|
806
|
+
name: string;
|
|
807
|
+
call_id: string;
|
|
808
|
+
command?: string;
|
|
809
|
+
} | {
|
|
810
|
+
kind: 'tool_finished';
|
|
811
|
+
name: string;
|
|
812
|
+
call_id: string;
|
|
813
|
+
command?: string;
|
|
814
|
+
ok: boolean;
|
|
815
|
+
duration_ms: number;
|
|
816
|
+
} | {
|
|
817
|
+
kind: 'warning';
|
|
818
|
+
message: string;
|
|
819
|
+
} | {
|
|
820
|
+
kind: 'debug';
|
|
821
|
+
message: string;
|
|
822
|
+
};
|
|
823
|
+
export interface RunObserver {
|
|
824
|
+
onEvent(runId: string, event: RunEvent): void;
|
|
825
|
+
}
|
|
826
|
+
//# sourceMappingURL=types.d.ts.map
|