@ordewell/core 0.10.4 → 0.10.6
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/{IRunner-D_UkkMbJ.d.ts → IFileSystem-C4_mpfze.d.ts} +159 -15
- package/dist/{IRunner-NtTHQgLR.d.mts → IFileSystem-DUgeWWQN.d.mts} +159 -15
- package/dist/{ModeResolver-wnTFsDnF.d.mts → ModeResolver-4qNjxcDs.d.mts} +1 -1
- package/dist/{ModeResolver-Dy3Ef6p-.d.ts → ModeResolver-DGK2rWHE.d.ts} +1 -1
- package/dist/{Task-DZs9eKgg.d.mts → Task-C0o4i3Nn.d.mts} +114 -13
- package/dist/{Task-DZs9eKgg.d.ts → Task-C0o4i3Nn.d.ts} +114 -13
- package/dist/{chunk-FH6M5QZG.mjs → chunk-DMG4ISUG.mjs} +1008 -49
- package/dist/chunk-DMG4ISUG.mjs.map +1 -0
- package/dist/{chunk-SM6BV6XS.mjs → chunk-EEE2GBLG.mjs} +116 -27
- package/dist/chunk-EEE2GBLG.mjs.map +1 -0
- package/dist/chunk-H7QX32BH.mjs +647 -0
- package/dist/chunk-H7QX32BH.mjs.map +1 -0
- package/dist/{chunk-645FALZX.mjs → chunk-LTHKFBKM.mjs} +4 -4
- package/dist/chunk-LTHKFBKM.mjs.map +1 -0
- package/dist/{chunk-OYUSADFM.mjs → chunk-NJGID6BG.mjs} +3 -1
- package/dist/chunk-NJGID6BG.mjs.map +1 -0
- package/dist/index.d.mts +498 -1689
- package/dist/index.d.ts +498 -1689
- package/dist/index.js +4108 -2082
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3380 -1639
- package/dist/index.mjs.map +1 -1
- package/dist/parsing.d.mts +2 -2
- package/dist/parsing.d.ts +2 -2
- package/dist/parsing.js +231 -75
- package/dist/parsing.js.map +1 -1
- package/dist/parsing.mjs +3 -3
- package/dist/plan-utils.d.mts +20 -4
- package/dist/plan-utils.d.ts +20 -4
- package/dist/plan-utils.js +335 -88
- package/dist/plan-utils.js.map +1 -1
- package/dist/plan-utils.mjs +43 -19
- package/dist/{plan-utils-CtKceSsQ.d.mts → runSettingsText-BgOmLxdw.d.mts} +2242 -224
- package/dist/{plan-utils-POIz5d8z.d.ts → runSettingsText-BgXvajj2.d.ts} +2242 -224
- package/dist/testing.d.mts +5 -3
- package/dist/testing.d.ts +5 -3
- package/dist/testing.js +7 -0
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +7 -2
- package/dist/testing.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/IFileSystem-_effm8-b.d.ts +0 -78
- package/dist/IFileSystem-vyqMdL-x.d.mts +0 -78
- package/dist/chunk-645FALZX.mjs.map +0 -1
- package/dist/chunk-A57ITQE7.mjs +0 -1378
- package/dist/chunk-A57ITQE7.mjs.map +0 -1
- package/dist/chunk-FH6M5QZG.mjs.map +0 -1
- package/dist/chunk-OYUSADFM.mjs.map +0 -1
- package/dist/chunk-SM6BV6XS.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChildProcess } from 'child_process';
|
|
2
|
-
import {
|
|
2
|
+
import { a4 as RunnerId, av as UsageRecord, ag as SubagentOutcome, a5 as RunnerSessionCost, d as DiscoveredModel, ap as TaskSkillSnapshot } from './Task-C0o4i3Nn.js';
|
|
3
3
|
import { z } from 'zod/v4';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -791,6 +791,7 @@ declare const taskOutputInput: z.ZodObject<{
|
|
|
791
791
|
runner_loaded: "runner_loaded";
|
|
792
792
|
compaction: "compaction";
|
|
793
793
|
command_output: "command_output";
|
|
794
|
+
model_switched: "model_switched";
|
|
794
795
|
text_delta: "text_delta";
|
|
795
796
|
turn_start: "turn_start";
|
|
796
797
|
message_queued: "message_queued";
|
|
@@ -1060,6 +1061,11 @@ interface RunnerCommand {
|
|
|
1060
1061
|
/** Other names the runner answers to for the same command. */
|
|
1061
1062
|
aliases?: string[];
|
|
1062
1063
|
}
|
|
1064
|
+
/** A model as a runner lists it: the id it accepts, which is the one a plan holds, and the name it shows. */
|
|
1065
|
+
interface RunnerModelRef {
|
|
1066
|
+
model: string;
|
|
1067
|
+
label?: string;
|
|
1068
|
+
}
|
|
1063
1069
|
/** An MCP server a runner loaded for a task, and the state the runner reported it in. */
|
|
1064
1070
|
interface RunnerMcpServer {
|
|
1065
1071
|
name: string;
|
|
@@ -1077,6 +1083,15 @@ declare function findRunnerCommand(commands: readonly RunnerCommand[], name: str
|
|
|
1077
1083
|
* surfaces — is already provider-agnostic, so an adapter is the entire cost of
|
|
1078
1084
|
* teaching Ordewell to plan with another agent.
|
|
1079
1085
|
*/
|
|
1086
|
+
/**
|
|
1087
|
+
* A runner's structured word that its account's usage limit ended the turn
|
|
1088
|
+
* (ADR-0018, U1). `resetsAt` (ISO) is when, where the runner's own limit state
|
|
1089
|
+
* says so; without it the reset is read from the error's words, as for a
|
|
1090
|
+
* runner that reports the limit in words alone.
|
|
1091
|
+
*/
|
|
1092
|
+
interface UsageLimitSignal {
|
|
1093
|
+
resetsAt?: string;
|
|
1094
|
+
}
|
|
1080
1095
|
/**
|
|
1081
1096
|
* One normalized event from a running agent turn. Deliberately smaller than
|
|
1082
1097
|
* any single agent's native protocol: this is the intersection Ordewell can act
|
|
@@ -1086,22 +1101,28 @@ declare function findRunnerCommand(commands: readonly RunnerCommand[], name: str
|
|
|
1086
1101
|
*/
|
|
1087
1102
|
type AgentEvent =
|
|
1088
1103
|
/**
|
|
1089
|
-
* A complete run of the assistant's reply
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1092
|
-
* appended after them.
|
|
1104
|
+
* A complete run of the assistant's reply — one text block, message or
|
|
1105
|
+
* part — under `runId`, the runner's own id for it. It is the authoritative
|
|
1106
|
+
* copy of the deltas streamed under the same id: it replaces them wherever
|
|
1107
|
+
* they now sit, it is not appended after them. No run carries the
|
|
1108
|
+
* paragraph break between it and the one before; a consumer joining runs
|
|
1109
|
+
* puts one there itself.
|
|
1093
1110
|
*/
|
|
1094
1111
|
{
|
|
1095
1112
|
type: 'assistant_text';
|
|
1113
|
+
runId: string;
|
|
1096
1114
|
text: string;
|
|
1097
1115
|
}
|
|
1098
1116
|
/**
|
|
1099
|
-
* An incremental piece of the
|
|
1100
|
-
*
|
|
1101
|
-
*
|
|
1117
|
+
* An incremental piece of the run `runId`, for agents that stream partial
|
|
1118
|
+
* messages. A run's first delta marks where it began, which is where it
|
|
1119
|
+
* stays when its complete copy arrives after later steps. The planner's own
|
|
1120
|
+
* text only: a subagent's words never arrive here, so they can never
|
|
1121
|
+
* become the reply.
|
|
1102
1122
|
*/
|
|
1103
1123
|
| {
|
|
1104
1124
|
type: 'assistant_text_delta';
|
|
1125
|
+
runId: string;
|
|
1105
1126
|
text: string;
|
|
1106
1127
|
}
|
|
1107
1128
|
/**
|
|
@@ -1216,10 +1237,16 @@ type AgentEvent =
|
|
|
1216
1237
|
type: 'message_dropped';
|
|
1217
1238
|
id: string;
|
|
1218
1239
|
}
|
|
1219
|
-
/**
|
|
1240
|
+
/**
|
|
1241
|
+
* The turn failed. Carries the agent's own words — never a Ordewell paraphrase.
|
|
1242
|
+
* `usageLimit` is set where the runner's protocol says in a field, not only
|
|
1243
|
+
* in words, whether its account's usage limit failed the turn: `false` when
|
|
1244
|
+
* the field names another cause, which its words then cannot overrule.
|
|
1245
|
+
*/
|
|
1220
1246
|
| {
|
|
1221
1247
|
type: 'error';
|
|
1222
1248
|
message: string;
|
|
1249
|
+
usageLimit?: UsageLimitSignal | false;
|
|
1223
1250
|
}
|
|
1224
1251
|
/**
|
|
1225
1252
|
* What the runner loaded for this process from the user's and the
|
|
@@ -1242,6 +1269,28 @@ type AgentEvent =
|
|
|
1242
1269
|
| {
|
|
1243
1270
|
type: 'command_output';
|
|
1244
1271
|
text: string;
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* The runner's main thread now answers on another model, after a model
|
|
1275
|
+
* command sent through the task's chat (#106): the user's own choice, which
|
|
1276
|
+
* the plan follows. Each side is named by the id the runner lists it under,
|
|
1277
|
+
* the one a plan holds. `effort` only where the runner reports one.
|
|
1278
|
+
*/
|
|
1279
|
+
| {
|
|
1280
|
+
type: 'model_switched';
|
|
1281
|
+
from: RunnerModelRef;
|
|
1282
|
+
to: RunnerModelRef;
|
|
1283
|
+
effort?: string;
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* The runner's main thread now answers on another model with no model
|
|
1287
|
+
* command before it (#106). Nobody in the chat chose it, so the plan does
|
|
1288
|
+
* not follow; the drift is reported so it is stated, not hidden.
|
|
1289
|
+
*/
|
|
1290
|
+
| {
|
|
1291
|
+
type: 'model_drifted';
|
|
1292
|
+
from: RunnerModelRef;
|
|
1293
|
+
to: RunnerModelRef;
|
|
1245
1294
|
};
|
|
1246
1295
|
/**
|
|
1247
1296
|
* What a planner's permission request is for, read from the runner's own
|
|
@@ -1289,6 +1338,8 @@ interface AgentStartCommon {
|
|
|
1289
1338
|
* degrades to a fresh session seeded from the stored history, not an error.
|
|
1290
1339
|
*/
|
|
1291
1340
|
resumeSessionId?: string;
|
|
1341
|
+
/** What was counted of the cost of `resumeSessionId` before, for a runner that reports a running total. */
|
|
1342
|
+
resumeCost?: RunnerSessionCost;
|
|
1292
1343
|
}
|
|
1293
1344
|
/** The read-only planner (ADR-0008/0009). The only start `CliAgentAiService` can express. */
|
|
1294
1345
|
interface PlannerStartOptions extends AgentStartCommon {
|
|
@@ -1372,6 +1423,8 @@ interface AgentAdapter {
|
|
|
1372
1423
|
send(message: string, onEvent: (event: AgentEvent) => void, signal?: AbortSignal, onActivity?: () => void): Promise<void>;
|
|
1373
1424
|
/** The agent's native session id once it has announced one. Resumption hint only. */
|
|
1374
1425
|
nativeSessionId(): string | null;
|
|
1426
|
+
/** What has been counted of the session's running cost, for a runner that reports one; null while unknown. */
|
|
1427
|
+
sessionCost?(): RunnerSessionCost | null;
|
|
1375
1428
|
/** Kill the process and release its resources. Idempotent. */
|
|
1376
1429
|
dispose(): void;
|
|
1377
1430
|
/**
|
|
@@ -1396,9 +1449,10 @@ interface AgentAdapter {
|
|
|
1396
1449
|
/**
|
|
1397
1450
|
* Answer an open `permission_request`. False when the id is not open — it
|
|
1398
1451
|
* was answered, cancelled, or never asked. Absent on an adapter that leaves
|
|
1399
|
-
* no planner request open.
|
|
1452
|
+
* no planner request open. HTTP replies resolve only after delivery and
|
|
1453
|
+
* reject on failure, leaving the request open for another attempt.
|
|
1400
1454
|
*/
|
|
1401
|
-
answerPermission?(id: string, decision: ApprovalDecision): boolean
|
|
1455
|
+
answerPermission?(id: string, decision: ApprovalDecision): boolean | Promise<boolean>;
|
|
1402
1456
|
}
|
|
1403
1457
|
/** What an adapter adds to run a task rather than a planner (ADR-0018). */
|
|
1404
1458
|
interface TaskModeAgentAdapter extends AgentAdapter {
|
|
@@ -1432,7 +1486,7 @@ interface TaskModeAgentAdapter extends AgentAdapter {
|
|
|
1432
1486
|
* mid-turn.
|
|
1433
1487
|
*/
|
|
1434
1488
|
steer?(id: string, text: string): Promise<boolean>;
|
|
1435
|
-
answerPermission(id: string, decision: ApprovalDecision): boolean
|
|
1489
|
+
answerPermission(id: string, decision: ApprovalDecision): boolean | Promise<boolean>;
|
|
1436
1490
|
/**
|
|
1437
1491
|
* The slash commands the runner offers this session — its built-ins, the
|
|
1438
1492
|
* user's and the project's skills and custom commands (#66) — as it
|
|
@@ -1768,6 +1822,8 @@ interface IRunnerSession {
|
|
|
1768
1822
|
interrupt(): Promise<void>;
|
|
1769
1823
|
/** The runner's own session id once announced — what a continue resumes (ADR-0018, K1). */
|
|
1770
1824
|
nativeSessionId(): string | null;
|
|
1825
|
+
/** What has been counted of that session's running cost, for a runner that reports one; null while unknown. */
|
|
1826
|
+
sessionCost?(): RunnerSessionCost | null;
|
|
1771
1827
|
/**
|
|
1772
1828
|
* The slash commands the runner offers this task (#66): its built-ins and
|
|
1773
1829
|
* the user's and the project's skills and custom commands. Empty for a
|
|
@@ -1784,9 +1840,10 @@ interface IRunnerSession {
|
|
|
1784
1840
|
invokeCommand(name: string, args?: string): string;
|
|
1785
1841
|
/**
|
|
1786
1842
|
* Answer a `permission_request` this session emitted, by its event id. False
|
|
1787
|
-
* when it is no longer open — answered, withdrawn, or never asked.
|
|
1843
|
+
* when it is no longer open — answered, withdrawn, or never asked. An HTTP
|
|
1844
|
+
* answer settles after delivery; on failure it stays open and returns false.
|
|
1788
1845
|
*/
|
|
1789
|
-
answerPermission(id: string, decision: ApprovalDecision): boolean
|
|
1846
|
+
answerPermission(id: string, decision: ApprovalDecision): boolean | Promise<boolean>;
|
|
1790
1847
|
/**
|
|
1791
1848
|
* The runner's `task_complete` calls on this attempt's token (ADR-0022):
|
|
1792
1849
|
* the only completion evidence, for `VerdictEngine` to weigh.
|
|
@@ -1826,6 +1883,18 @@ interface IRunner {
|
|
|
1826
1883
|
env?: Record<string, string>;
|
|
1827
1884
|
/** The runner's own session to continue in (ADR-0018, K1). */
|
|
1828
1885
|
resumeSessionId?: string;
|
|
1886
|
+
/** What was counted of that session's running cost before, so its first turn is counted from there. */
|
|
1887
|
+
resumeCost?: RunnerSessionCost;
|
|
1888
|
+
/**
|
|
1889
|
+
* The model that session last ran on and its window, so a resumed turn that
|
|
1890
|
+
* states none is measured as before. Runners ignore it; the window fill
|
|
1891
|
+
* that wraps one reads it.
|
|
1892
|
+
*/
|
|
1893
|
+
resumeWindow?: {
|
|
1894
|
+
source?: string;
|
|
1895
|
+
model?: string;
|
|
1896
|
+
contextWindow?: number;
|
|
1897
|
+
};
|
|
1829
1898
|
/**
|
|
1830
1899
|
* Which run of the task this is, from 1. A structured runner binds the
|
|
1831
1900
|
* attempt's MCP token to it (ADR-0022, A2).
|
|
@@ -1844,4 +1913,79 @@ interface IRunner {
|
|
|
1844
1913
|
activeCount: number;
|
|
1845
1914
|
}
|
|
1846
1915
|
|
|
1847
|
-
|
|
1916
|
+
interface ToolOutcome {
|
|
1917
|
+
success: boolean;
|
|
1918
|
+
output: string;
|
|
1919
|
+
truncated: boolean;
|
|
1920
|
+
}
|
|
1921
|
+
interface ReadFileOpts {
|
|
1922
|
+
maxBytes?: number;
|
|
1923
|
+
offset?: number;
|
|
1924
|
+
limit?: number;
|
|
1925
|
+
}
|
|
1926
|
+
/**
|
|
1927
|
+
* `content` returns matching lines, `files` only the paths that matched, and
|
|
1928
|
+
* `count` a per-file tally. Cheap models otherwise grep and then read whole
|
|
1929
|
+
* files to answer "which files touch this", burning rounds against the budget.
|
|
1930
|
+
*/
|
|
1931
|
+
type GrepOutputMode = 'content' | 'files' | 'count';
|
|
1932
|
+
interface GrepOptions {
|
|
1933
|
+
/** File glob filter, e.g. `*.ts`. */
|
|
1934
|
+
include?: string;
|
|
1935
|
+
/** Search root. Relative to the workspace unless approved as external. */
|
|
1936
|
+
path?: string;
|
|
1937
|
+
outputMode?: GrepOutputMode;
|
|
1938
|
+
/** Lines of context around each match (`content` mode only). */
|
|
1939
|
+
contextBefore?: number;
|
|
1940
|
+
contextAfter?: number;
|
|
1941
|
+
/** Treat the pattern as a literal string rather than a regex. */
|
|
1942
|
+
literal?: boolean;
|
|
1943
|
+
caseInsensitive?: boolean;
|
|
1944
|
+
/** Global cap on returned rows. Defaults to {@link GREP_DEFAULT_HEAD_LIMIT}. */
|
|
1945
|
+
headLimit?: number;
|
|
1946
|
+
}
|
|
1947
|
+
interface GlobOptions {
|
|
1948
|
+
/** Search root. Relative to the workspace unless approved as external. */
|
|
1949
|
+
path?: string;
|
|
1950
|
+
headLimit?: number;
|
|
1951
|
+
}
|
|
1952
|
+
interface FindSymbolOptions {
|
|
1953
|
+
/** Language id or file extension, e.g. `typescript` or `.go`. Narrows the keyword set. */
|
|
1954
|
+
language?: string;
|
|
1955
|
+
/** Search root. Relative to the workspace unless approved as external. */
|
|
1956
|
+
path?: string;
|
|
1957
|
+
}
|
|
1958
|
+
/** Global row cap for grep. A per-file cap is not a budget — see PoolFileSystem. */
|
|
1959
|
+
declare const GREP_DEFAULT_HEAD_LIMIT = 100;
|
|
1960
|
+
/**
|
|
1961
|
+
* Directories that are never interesting to a planner and would otherwise eat
|
|
1962
|
+
* the result budget. Applied by every search entry point, not just `glob` —
|
|
1963
|
+
* `dist/` and `.ordewell/` are frequently not gitignored.
|
|
1964
|
+
*/
|
|
1965
|
+
declare const SEARCH_EXCLUSIONS: string[];
|
|
1966
|
+
interface IFileSystem {
|
|
1967
|
+
readFile(path: string, opts?: ReadFileOpts): Promise<ToolOutcome>;
|
|
1968
|
+
readFiles(paths: string[]): Promise<ToolOutcome>;
|
|
1969
|
+
glob(pattern: string, opts?: GlobOptions): Promise<ToolOutcome>;
|
|
1970
|
+
grep(pattern: string, opts?: GrepOptions): Promise<ToolOutcome>;
|
|
1971
|
+
listDir(path: string, depth?: number): Promise<ToolOutcome>;
|
|
1972
|
+
/**
|
|
1973
|
+
* `signal` stops the planning turn this command belongs to: adapters kill
|
|
1974
|
+
* the spawned child rather than let it run out its own timeout. The other
|
|
1975
|
+
* tools here are short enough that the loop's between-call abort check is
|
|
1976
|
+
* indistinguishable from cancelling them mid-flight; a `bash` call is not.
|
|
1977
|
+
*/
|
|
1978
|
+
bash(command: string, signal?: AbortSignal): Promise<ToolOutcome>;
|
|
1979
|
+
/** Definition-first lookup for one symbol. See `symbolPatterns.ts`. */
|
|
1980
|
+
findSymbol(symbol: string, opts?: FindSymbolOptions): Promise<ToolOutcome>;
|
|
1981
|
+
getWorkspaceRoot(): string;
|
|
1982
|
+
/**
|
|
1983
|
+
* Inject the human-approval channel for out-of-envelope access. Optional so
|
|
1984
|
+
* test doubles stay small; every adapter extending `BaseFileSystem` has it.
|
|
1985
|
+
*/
|
|
1986
|
+
setApproval?(approval: IApproval): void;
|
|
1987
|
+
/** Held credentials read live by the outbound secret check. */
|
|
1988
|
+
setOutboundSecrets?(secrets: () => Iterable<string>): void;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
export { ORCHESTRATOR_SHORTCUTS as $, AUTO_COMMANDS as A, type GlobOptions as B, type CatalogModel as C, DEFAULT_PLANNER_ALLOWLIST as D, type EditPlanArgs as E, type FetchAllProviderModelsOptions as F, GIT_READONLY_SUBCOMMANDS as G, type GrepOptions as H, type GrepOutputMode as I, type IApproval as J, type IConfig as K, type IFileSystem as L, type IRunner as M, type IRunnerSession as N, type InvokedCommand as O, LineBuffer as P, type ListModelsArgs as Q, type ListRunnersArgs as R, type LoadSkillArgs as S, type McpClientConfig as T, type McpCredential as U, type McpTool as V, type McpToolContext as W, type McpToolReply as X, type MessageTaskArgs as Y, ModelCatalog as Z, type ModelShortcut as _, type AgentAdapter as a, effectiveApprovalMode as a$, ORDEWELL_MCP_PATH as a0, ORDEWELL_MCP_SERVER_NAME as a1, type OneTaskArgs as a2, type OrchestratorOption as a3, OrdewellMcpServer as a4, type OwnerOnlyFile as a5, PLANNER_EXECUTION_TOOLS as a6, PLANNER_TOOLS as a7, type PlannerAllowlist as a8, type PlannerBackendId as a9, type ShellDialect as aA, type SpawnFn as aB, type StandingDecision as aC, type StructuredEvent as aD, type StructuredTurnEnd as aE, type SubmitPlanArgs as aF, TASK_COMPLETE_TOOL as aG, TASK_COMPLETION_CONTRACT as aH, TASK_TOOLS as aI, type TaskCompleteArgs as aJ, type TaskDiffArgs as aK, type TaskMessageFrom as aL, type TaskModeAgentAdapter as aM, TaskModeUnsupportedError as aN, type TaskOutputArgs as aO, type TaskQueryArgs as aP, type TaskRunnerFlags as aQ, type TaskStartOptions as aR, type TaskTokenScope as aS, type TaskToolHandler as aT, type ToolOutcome as aU, type UsageLimitSignal as aV, approvalScopes as aW, classifyCommand as aX, clearResearchShellCache as aY, collectProviderCredentials as aZ, commandAllowedBy as a_, type PlannerStartOptions as aa, type PlannerTokenScope as ab, type PlannerToolHandler as ac, type ProjectMcpServer as ad, type ProviderCredentialSource as ae, type ProviderModelLists as af, type ProviderModelsResult as ag, type QueuedTaskMessage as ah, REFUSED_COMMANDS as ai, type ReadFileOpts as aj, type ResearchShell as ak, type ResearchShellDeps as al, type RetryTaskArgs as am, type RunCommandArgs as an, type RunPlanArgs as ao, type RunnerCommand as ap, type RunnerCommandKind as aq, type RunnerEntry as ar, type RunnerFeatures as as, type RunnerManifest as at, type RunnerMcpServer as au, type RunnerMode as av, type RunnerModelDiscovery as aw, type RunnerModelRef as ax, RunnerRegistry as ay, SEARCH_EXCLUSIONS as az, type AgentAdapterFactory as b, enabledRunners as b0, fetchAllProviderModels as b1, findRunnerCommand as b2, isGranted as b3, isRunnerApproval as b4, knownModelId as b5, mcpClientConfig as b6, ownerOnlyConfigFile as b7, parseAllowlist as b8, parseApprovalModeSetting as b9, researchShellWarning as ba, researchToolsPath as bb, resolveModelShortcut as bc, resolveProvider as bd, resolveResearchShell as be, scopeAllowed as bf, sharedMcpServer as bg, toApprovalDecision as bh, toOrchestratorOptions as bi, toolAllowed as bj, type AgentEvent as c, type AgentProcessDeps as d, type AgentStartOptions as e, type AiProvider as f, type AllProviderModels as g, type AnswerApprovalArgs as h, type ApprovalAnswer as i, type ApprovalDecision as j, type ApprovalKind as k, type ApprovalMode as l, type ApprovalModeSetting as m, ApprovalPolicy as n, type ApprovalPolicyOptions as o, type ApprovalRequest as p, type ApprovalSource as q, type CheckpointAnswer as r, type CheckpointArgs as s, type CommandClassification as t, type CommandTier as u, type CommandWords as v, DENY_ALL as w, type DiscoveryCommand as x, type FindSymbolOptions as y, GREP_DEFAULT_HEAD_LIMIT as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChildProcess } from 'child_process';
|
|
2
|
-
import {
|
|
2
|
+
import { a4 as RunnerId, av as UsageRecord, ag as SubagentOutcome, a5 as RunnerSessionCost, d as DiscoveredModel, ap as TaskSkillSnapshot } from './Task-C0o4i3Nn.mjs';
|
|
3
3
|
import { z } from 'zod/v4';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -791,6 +791,7 @@ declare const taskOutputInput: z.ZodObject<{
|
|
|
791
791
|
runner_loaded: "runner_loaded";
|
|
792
792
|
compaction: "compaction";
|
|
793
793
|
command_output: "command_output";
|
|
794
|
+
model_switched: "model_switched";
|
|
794
795
|
text_delta: "text_delta";
|
|
795
796
|
turn_start: "turn_start";
|
|
796
797
|
message_queued: "message_queued";
|
|
@@ -1060,6 +1061,11 @@ interface RunnerCommand {
|
|
|
1060
1061
|
/** Other names the runner answers to for the same command. */
|
|
1061
1062
|
aliases?: string[];
|
|
1062
1063
|
}
|
|
1064
|
+
/** A model as a runner lists it: the id it accepts, which is the one a plan holds, and the name it shows. */
|
|
1065
|
+
interface RunnerModelRef {
|
|
1066
|
+
model: string;
|
|
1067
|
+
label?: string;
|
|
1068
|
+
}
|
|
1063
1069
|
/** An MCP server a runner loaded for a task, and the state the runner reported it in. */
|
|
1064
1070
|
interface RunnerMcpServer {
|
|
1065
1071
|
name: string;
|
|
@@ -1077,6 +1083,15 @@ declare function findRunnerCommand(commands: readonly RunnerCommand[], name: str
|
|
|
1077
1083
|
* surfaces — is already provider-agnostic, so an adapter is the entire cost of
|
|
1078
1084
|
* teaching Ordewell to plan with another agent.
|
|
1079
1085
|
*/
|
|
1086
|
+
/**
|
|
1087
|
+
* A runner's structured word that its account's usage limit ended the turn
|
|
1088
|
+
* (ADR-0018, U1). `resetsAt` (ISO) is when, where the runner's own limit state
|
|
1089
|
+
* says so; without it the reset is read from the error's words, as for a
|
|
1090
|
+
* runner that reports the limit in words alone.
|
|
1091
|
+
*/
|
|
1092
|
+
interface UsageLimitSignal {
|
|
1093
|
+
resetsAt?: string;
|
|
1094
|
+
}
|
|
1080
1095
|
/**
|
|
1081
1096
|
* One normalized event from a running agent turn. Deliberately smaller than
|
|
1082
1097
|
* any single agent's native protocol: this is the intersection Ordewell can act
|
|
@@ -1086,22 +1101,28 @@ declare function findRunnerCommand(commands: readonly RunnerCommand[], name: str
|
|
|
1086
1101
|
*/
|
|
1087
1102
|
type AgentEvent =
|
|
1088
1103
|
/**
|
|
1089
|
-
* A complete run of the assistant's reply
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1092
|
-
* appended after them.
|
|
1104
|
+
* A complete run of the assistant's reply — one text block, message or
|
|
1105
|
+
* part — under `runId`, the runner's own id for it. It is the authoritative
|
|
1106
|
+
* copy of the deltas streamed under the same id: it replaces them wherever
|
|
1107
|
+
* they now sit, it is not appended after them. No run carries the
|
|
1108
|
+
* paragraph break between it and the one before; a consumer joining runs
|
|
1109
|
+
* puts one there itself.
|
|
1093
1110
|
*/
|
|
1094
1111
|
{
|
|
1095
1112
|
type: 'assistant_text';
|
|
1113
|
+
runId: string;
|
|
1096
1114
|
text: string;
|
|
1097
1115
|
}
|
|
1098
1116
|
/**
|
|
1099
|
-
* An incremental piece of the
|
|
1100
|
-
*
|
|
1101
|
-
*
|
|
1117
|
+
* An incremental piece of the run `runId`, for agents that stream partial
|
|
1118
|
+
* messages. A run's first delta marks where it began, which is where it
|
|
1119
|
+
* stays when its complete copy arrives after later steps. The planner's own
|
|
1120
|
+
* text only: a subagent's words never arrive here, so they can never
|
|
1121
|
+
* become the reply.
|
|
1102
1122
|
*/
|
|
1103
1123
|
| {
|
|
1104
1124
|
type: 'assistant_text_delta';
|
|
1125
|
+
runId: string;
|
|
1105
1126
|
text: string;
|
|
1106
1127
|
}
|
|
1107
1128
|
/**
|
|
@@ -1216,10 +1237,16 @@ type AgentEvent =
|
|
|
1216
1237
|
type: 'message_dropped';
|
|
1217
1238
|
id: string;
|
|
1218
1239
|
}
|
|
1219
|
-
/**
|
|
1240
|
+
/**
|
|
1241
|
+
* The turn failed. Carries the agent's own words — never a Ordewell paraphrase.
|
|
1242
|
+
* `usageLimit` is set where the runner's protocol says in a field, not only
|
|
1243
|
+
* in words, whether its account's usage limit failed the turn: `false` when
|
|
1244
|
+
* the field names another cause, which its words then cannot overrule.
|
|
1245
|
+
*/
|
|
1220
1246
|
| {
|
|
1221
1247
|
type: 'error';
|
|
1222
1248
|
message: string;
|
|
1249
|
+
usageLimit?: UsageLimitSignal | false;
|
|
1223
1250
|
}
|
|
1224
1251
|
/**
|
|
1225
1252
|
* What the runner loaded for this process from the user's and the
|
|
@@ -1242,6 +1269,28 @@ type AgentEvent =
|
|
|
1242
1269
|
| {
|
|
1243
1270
|
type: 'command_output';
|
|
1244
1271
|
text: string;
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* The runner's main thread now answers on another model, after a model
|
|
1275
|
+
* command sent through the task's chat (#106): the user's own choice, which
|
|
1276
|
+
* the plan follows. Each side is named by the id the runner lists it under,
|
|
1277
|
+
* the one a plan holds. `effort` only where the runner reports one.
|
|
1278
|
+
*/
|
|
1279
|
+
| {
|
|
1280
|
+
type: 'model_switched';
|
|
1281
|
+
from: RunnerModelRef;
|
|
1282
|
+
to: RunnerModelRef;
|
|
1283
|
+
effort?: string;
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* The runner's main thread now answers on another model with no model
|
|
1287
|
+
* command before it (#106). Nobody in the chat chose it, so the plan does
|
|
1288
|
+
* not follow; the drift is reported so it is stated, not hidden.
|
|
1289
|
+
*/
|
|
1290
|
+
| {
|
|
1291
|
+
type: 'model_drifted';
|
|
1292
|
+
from: RunnerModelRef;
|
|
1293
|
+
to: RunnerModelRef;
|
|
1245
1294
|
};
|
|
1246
1295
|
/**
|
|
1247
1296
|
* What a planner's permission request is for, read from the runner's own
|
|
@@ -1289,6 +1338,8 @@ interface AgentStartCommon {
|
|
|
1289
1338
|
* degrades to a fresh session seeded from the stored history, not an error.
|
|
1290
1339
|
*/
|
|
1291
1340
|
resumeSessionId?: string;
|
|
1341
|
+
/** What was counted of the cost of `resumeSessionId` before, for a runner that reports a running total. */
|
|
1342
|
+
resumeCost?: RunnerSessionCost;
|
|
1292
1343
|
}
|
|
1293
1344
|
/** The read-only planner (ADR-0008/0009). The only start `CliAgentAiService` can express. */
|
|
1294
1345
|
interface PlannerStartOptions extends AgentStartCommon {
|
|
@@ -1372,6 +1423,8 @@ interface AgentAdapter {
|
|
|
1372
1423
|
send(message: string, onEvent: (event: AgentEvent) => void, signal?: AbortSignal, onActivity?: () => void): Promise<void>;
|
|
1373
1424
|
/** The agent's native session id once it has announced one. Resumption hint only. */
|
|
1374
1425
|
nativeSessionId(): string | null;
|
|
1426
|
+
/** What has been counted of the session's running cost, for a runner that reports one; null while unknown. */
|
|
1427
|
+
sessionCost?(): RunnerSessionCost | null;
|
|
1375
1428
|
/** Kill the process and release its resources. Idempotent. */
|
|
1376
1429
|
dispose(): void;
|
|
1377
1430
|
/**
|
|
@@ -1396,9 +1449,10 @@ interface AgentAdapter {
|
|
|
1396
1449
|
/**
|
|
1397
1450
|
* Answer an open `permission_request`. False when the id is not open — it
|
|
1398
1451
|
* was answered, cancelled, or never asked. Absent on an adapter that leaves
|
|
1399
|
-
* no planner request open.
|
|
1452
|
+
* no planner request open. HTTP replies resolve only after delivery and
|
|
1453
|
+
* reject on failure, leaving the request open for another attempt.
|
|
1400
1454
|
*/
|
|
1401
|
-
answerPermission?(id: string, decision: ApprovalDecision): boolean
|
|
1455
|
+
answerPermission?(id: string, decision: ApprovalDecision): boolean | Promise<boolean>;
|
|
1402
1456
|
}
|
|
1403
1457
|
/** What an adapter adds to run a task rather than a planner (ADR-0018). */
|
|
1404
1458
|
interface TaskModeAgentAdapter extends AgentAdapter {
|
|
@@ -1432,7 +1486,7 @@ interface TaskModeAgentAdapter extends AgentAdapter {
|
|
|
1432
1486
|
* mid-turn.
|
|
1433
1487
|
*/
|
|
1434
1488
|
steer?(id: string, text: string): Promise<boolean>;
|
|
1435
|
-
answerPermission(id: string, decision: ApprovalDecision): boolean
|
|
1489
|
+
answerPermission(id: string, decision: ApprovalDecision): boolean | Promise<boolean>;
|
|
1436
1490
|
/**
|
|
1437
1491
|
* The slash commands the runner offers this session — its built-ins, the
|
|
1438
1492
|
* user's and the project's skills and custom commands (#66) — as it
|
|
@@ -1768,6 +1822,8 @@ interface IRunnerSession {
|
|
|
1768
1822
|
interrupt(): Promise<void>;
|
|
1769
1823
|
/** The runner's own session id once announced — what a continue resumes (ADR-0018, K1). */
|
|
1770
1824
|
nativeSessionId(): string | null;
|
|
1825
|
+
/** What has been counted of that session's running cost, for a runner that reports one; null while unknown. */
|
|
1826
|
+
sessionCost?(): RunnerSessionCost | null;
|
|
1771
1827
|
/**
|
|
1772
1828
|
* The slash commands the runner offers this task (#66): its built-ins and
|
|
1773
1829
|
* the user's and the project's skills and custom commands. Empty for a
|
|
@@ -1784,9 +1840,10 @@ interface IRunnerSession {
|
|
|
1784
1840
|
invokeCommand(name: string, args?: string): string;
|
|
1785
1841
|
/**
|
|
1786
1842
|
* Answer a `permission_request` this session emitted, by its event id. False
|
|
1787
|
-
* when it is no longer open — answered, withdrawn, or never asked.
|
|
1843
|
+
* when it is no longer open — answered, withdrawn, or never asked. An HTTP
|
|
1844
|
+
* answer settles after delivery; on failure it stays open and returns false.
|
|
1788
1845
|
*/
|
|
1789
|
-
answerPermission(id: string, decision: ApprovalDecision): boolean
|
|
1846
|
+
answerPermission(id: string, decision: ApprovalDecision): boolean | Promise<boolean>;
|
|
1790
1847
|
/**
|
|
1791
1848
|
* The runner's `task_complete` calls on this attempt's token (ADR-0022):
|
|
1792
1849
|
* the only completion evidence, for `VerdictEngine` to weigh.
|
|
@@ -1826,6 +1883,18 @@ interface IRunner {
|
|
|
1826
1883
|
env?: Record<string, string>;
|
|
1827
1884
|
/** The runner's own session to continue in (ADR-0018, K1). */
|
|
1828
1885
|
resumeSessionId?: string;
|
|
1886
|
+
/** What was counted of that session's running cost before, so its first turn is counted from there. */
|
|
1887
|
+
resumeCost?: RunnerSessionCost;
|
|
1888
|
+
/**
|
|
1889
|
+
* The model that session last ran on and its window, so a resumed turn that
|
|
1890
|
+
* states none is measured as before. Runners ignore it; the window fill
|
|
1891
|
+
* that wraps one reads it.
|
|
1892
|
+
*/
|
|
1893
|
+
resumeWindow?: {
|
|
1894
|
+
source?: string;
|
|
1895
|
+
model?: string;
|
|
1896
|
+
contextWindow?: number;
|
|
1897
|
+
};
|
|
1829
1898
|
/**
|
|
1830
1899
|
* Which run of the task this is, from 1. A structured runner binds the
|
|
1831
1900
|
* attempt's MCP token to it (ADR-0022, A2).
|
|
@@ -1844,4 +1913,79 @@ interface IRunner {
|
|
|
1844
1913
|
activeCount: number;
|
|
1845
1914
|
}
|
|
1846
1915
|
|
|
1847
|
-
|
|
1916
|
+
interface ToolOutcome {
|
|
1917
|
+
success: boolean;
|
|
1918
|
+
output: string;
|
|
1919
|
+
truncated: boolean;
|
|
1920
|
+
}
|
|
1921
|
+
interface ReadFileOpts {
|
|
1922
|
+
maxBytes?: number;
|
|
1923
|
+
offset?: number;
|
|
1924
|
+
limit?: number;
|
|
1925
|
+
}
|
|
1926
|
+
/**
|
|
1927
|
+
* `content` returns matching lines, `files` only the paths that matched, and
|
|
1928
|
+
* `count` a per-file tally. Cheap models otherwise grep and then read whole
|
|
1929
|
+
* files to answer "which files touch this", burning rounds against the budget.
|
|
1930
|
+
*/
|
|
1931
|
+
type GrepOutputMode = 'content' | 'files' | 'count';
|
|
1932
|
+
interface GrepOptions {
|
|
1933
|
+
/** File glob filter, e.g. `*.ts`. */
|
|
1934
|
+
include?: string;
|
|
1935
|
+
/** Search root. Relative to the workspace unless approved as external. */
|
|
1936
|
+
path?: string;
|
|
1937
|
+
outputMode?: GrepOutputMode;
|
|
1938
|
+
/** Lines of context around each match (`content` mode only). */
|
|
1939
|
+
contextBefore?: number;
|
|
1940
|
+
contextAfter?: number;
|
|
1941
|
+
/** Treat the pattern as a literal string rather than a regex. */
|
|
1942
|
+
literal?: boolean;
|
|
1943
|
+
caseInsensitive?: boolean;
|
|
1944
|
+
/** Global cap on returned rows. Defaults to {@link GREP_DEFAULT_HEAD_LIMIT}. */
|
|
1945
|
+
headLimit?: number;
|
|
1946
|
+
}
|
|
1947
|
+
interface GlobOptions {
|
|
1948
|
+
/** Search root. Relative to the workspace unless approved as external. */
|
|
1949
|
+
path?: string;
|
|
1950
|
+
headLimit?: number;
|
|
1951
|
+
}
|
|
1952
|
+
interface FindSymbolOptions {
|
|
1953
|
+
/** Language id or file extension, e.g. `typescript` or `.go`. Narrows the keyword set. */
|
|
1954
|
+
language?: string;
|
|
1955
|
+
/** Search root. Relative to the workspace unless approved as external. */
|
|
1956
|
+
path?: string;
|
|
1957
|
+
}
|
|
1958
|
+
/** Global row cap for grep. A per-file cap is not a budget — see PoolFileSystem. */
|
|
1959
|
+
declare const GREP_DEFAULT_HEAD_LIMIT = 100;
|
|
1960
|
+
/**
|
|
1961
|
+
* Directories that are never interesting to a planner and would otherwise eat
|
|
1962
|
+
* the result budget. Applied by every search entry point, not just `glob` —
|
|
1963
|
+
* `dist/` and `.ordewell/` are frequently not gitignored.
|
|
1964
|
+
*/
|
|
1965
|
+
declare const SEARCH_EXCLUSIONS: string[];
|
|
1966
|
+
interface IFileSystem {
|
|
1967
|
+
readFile(path: string, opts?: ReadFileOpts): Promise<ToolOutcome>;
|
|
1968
|
+
readFiles(paths: string[]): Promise<ToolOutcome>;
|
|
1969
|
+
glob(pattern: string, opts?: GlobOptions): Promise<ToolOutcome>;
|
|
1970
|
+
grep(pattern: string, opts?: GrepOptions): Promise<ToolOutcome>;
|
|
1971
|
+
listDir(path: string, depth?: number): Promise<ToolOutcome>;
|
|
1972
|
+
/**
|
|
1973
|
+
* `signal` stops the planning turn this command belongs to: adapters kill
|
|
1974
|
+
* the spawned child rather than let it run out its own timeout. The other
|
|
1975
|
+
* tools here are short enough that the loop's between-call abort check is
|
|
1976
|
+
* indistinguishable from cancelling them mid-flight; a `bash` call is not.
|
|
1977
|
+
*/
|
|
1978
|
+
bash(command: string, signal?: AbortSignal): Promise<ToolOutcome>;
|
|
1979
|
+
/** Definition-first lookup for one symbol. See `symbolPatterns.ts`. */
|
|
1980
|
+
findSymbol(symbol: string, opts?: FindSymbolOptions): Promise<ToolOutcome>;
|
|
1981
|
+
getWorkspaceRoot(): string;
|
|
1982
|
+
/**
|
|
1983
|
+
* Inject the human-approval channel for out-of-envelope access. Optional so
|
|
1984
|
+
* test doubles stay small; every adapter extending `BaseFileSystem` has it.
|
|
1985
|
+
*/
|
|
1986
|
+
setApproval?(approval: IApproval): void;
|
|
1987
|
+
/** Held credentials read live by the outbound secret check. */
|
|
1988
|
+
setOutboundSecrets?(secrets: () => Iterable<string>): void;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
export { ORCHESTRATOR_SHORTCUTS as $, AUTO_COMMANDS as A, type GlobOptions as B, type CatalogModel as C, DEFAULT_PLANNER_ALLOWLIST as D, type EditPlanArgs as E, type FetchAllProviderModelsOptions as F, GIT_READONLY_SUBCOMMANDS as G, type GrepOptions as H, type GrepOutputMode as I, type IApproval as J, type IConfig as K, type IFileSystem as L, type IRunner as M, type IRunnerSession as N, type InvokedCommand as O, LineBuffer as P, type ListModelsArgs as Q, type ListRunnersArgs as R, type LoadSkillArgs as S, type McpClientConfig as T, type McpCredential as U, type McpTool as V, type McpToolContext as W, type McpToolReply as X, type MessageTaskArgs as Y, ModelCatalog as Z, type ModelShortcut as _, type AgentAdapter as a, effectiveApprovalMode as a$, ORDEWELL_MCP_PATH as a0, ORDEWELL_MCP_SERVER_NAME as a1, type OneTaskArgs as a2, type OrchestratorOption as a3, OrdewellMcpServer as a4, type OwnerOnlyFile as a5, PLANNER_EXECUTION_TOOLS as a6, PLANNER_TOOLS as a7, type PlannerAllowlist as a8, type PlannerBackendId as a9, type ShellDialect as aA, type SpawnFn as aB, type StandingDecision as aC, type StructuredEvent as aD, type StructuredTurnEnd as aE, type SubmitPlanArgs as aF, TASK_COMPLETE_TOOL as aG, TASK_COMPLETION_CONTRACT as aH, TASK_TOOLS as aI, type TaskCompleteArgs as aJ, type TaskDiffArgs as aK, type TaskMessageFrom as aL, type TaskModeAgentAdapter as aM, TaskModeUnsupportedError as aN, type TaskOutputArgs as aO, type TaskQueryArgs as aP, type TaskRunnerFlags as aQ, type TaskStartOptions as aR, type TaskTokenScope as aS, type TaskToolHandler as aT, type ToolOutcome as aU, type UsageLimitSignal as aV, approvalScopes as aW, classifyCommand as aX, clearResearchShellCache as aY, collectProviderCredentials as aZ, commandAllowedBy as a_, type PlannerStartOptions as aa, type PlannerTokenScope as ab, type PlannerToolHandler as ac, type ProjectMcpServer as ad, type ProviderCredentialSource as ae, type ProviderModelLists as af, type ProviderModelsResult as ag, type QueuedTaskMessage as ah, REFUSED_COMMANDS as ai, type ReadFileOpts as aj, type ResearchShell as ak, type ResearchShellDeps as al, type RetryTaskArgs as am, type RunCommandArgs as an, type RunPlanArgs as ao, type RunnerCommand as ap, type RunnerCommandKind as aq, type RunnerEntry as ar, type RunnerFeatures as as, type RunnerManifest as at, type RunnerMcpServer as au, type RunnerMode as av, type RunnerModelDiscovery as aw, type RunnerModelRef as ax, RunnerRegistry as ay, SEARCH_EXCLUSIONS as az, type AgentAdapterFactory as b, enabledRunners as b0, fetchAllProviderModels as b1, findRunnerCommand as b2, isGranted as b3, isRunnerApproval as b4, knownModelId as b5, mcpClientConfig as b6, ownerOnlyConfigFile as b7, parseAllowlist as b8, parseApprovalModeSetting as b9, researchShellWarning as ba, researchToolsPath as bb, resolveModelShortcut as bc, resolveProvider as bd, resolveResearchShell as be, scopeAllowed as bf, sharedMcpServer as bg, toApprovalDecision as bh, toOrchestratorOptions as bi, toolAllowed as bj, type AgentEvent as c, type AgentProcessDeps as d, type AgentStartOptions as e, type AiProvider as f, type AllProviderModels as g, type AnswerApprovalArgs as h, type ApprovalAnswer as i, type ApprovalDecision as j, type ApprovalKind as k, type ApprovalMode as l, type ApprovalModeSetting as m, ApprovalPolicy as n, type ApprovalPolicyOptions as o, type ApprovalRequest as p, type ApprovalSource as q, type CheckpointAnswer as r, type CheckpointArgs as s, type CommandClassification as t, type CommandTier as u, type CommandWords as v, DENY_ALL as w, type DiscoveryCommand as x, type FindSymbolOptions as y, GREP_DEFAULT_HEAD_LIMIT as z };
|