@ordewell/core 0.4.7 → 0.4.9
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/{ITerminalRunner-fynILAiR.d.mts → ITerminalRunner-1NAv8wCC.d.mts} +15 -3
- package/dist/{ITerminalRunner-Cpyzyrnl.d.ts → ITerminalRunner-CbE6gKLI.d.ts} +15 -3
- package/dist/index.d.mts +251 -3
- package/dist/index.d.ts +251 -3
- package/dist/index.js +2092 -134
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2067 -137
- package/dist/index.mjs.map +1 -1
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/package.json +1 -1
|
@@ -478,6 +478,8 @@ interface IPluginStore {
|
|
|
478
478
|
getUserPluginsDir(): string;
|
|
479
479
|
/** List subdirectory names inside the user plugins directory. */
|
|
480
480
|
listUserPluginDirs(): string[];
|
|
481
|
+
/** List entry names directly inside a directory. Returns [] when unreadable. */
|
|
482
|
+
listDir(dir: string): string[];
|
|
481
483
|
/** Read and parse a manifest.json from pluginDir. Returns null on failure. */
|
|
482
484
|
loadManifest(pluginDir: string): RunnerPluginManifest | null;
|
|
483
485
|
/** Recursively copy sourceDir to destDir. */
|
|
@@ -496,10 +498,15 @@ interface IPluginStore {
|
|
|
496
498
|
exists(path: string): boolean;
|
|
497
499
|
}
|
|
498
500
|
|
|
501
|
+
/** True when a name belongs to a built-in runner and is therefore not installable. */
|
|
502
|
+
declare function isReservedRunnerName(name: string): boolean;
|
|
503
|
+
/** Clone seam: takes a validated URL and a destination, or throws. */
|
|
504
|
+
type PluginCloneFn = (url: string, destDir: string) => void;
|
|
499
505
|
declare class RunnerRegistry {
|
|
500
506
|
private plugins;
|
|
501
507
|
private store;
|
|
502
|
-
|
|
508
|
+
private clone;
|
|
509
|
+
constructor(store?: IPluginStore, clone?: PluginCloneFn);
|
|
503
510
|
private loadBuiltins;
|
|
504
511
|
loadUserPlugins(): void;
|
|
505
512
|
get(id: string): PluginEntry | undefined;
|
|
@@ -510,7 +517,12 @@ declare class RunnerRegistry {
|
|
|
510
517
|
isBuiltIn(id: string): boolean;
|
|
511
518
|
installFromPath(sourcePath: string): RunnerPluginManifest;
|
|
512
519
|
installFromGit(url: string): RunnerPluginManifest;
|
|
513
|
-
|
|
520
|
+
/**
|
|
521
|
+
* The single destination-building step both install routes share: the name is
|
|
522
|
+
* constrained to a plain segment and the resolved destination is asserted to
|
|
523
|
+
* be inside the plugins directory before anything is copied.
|
|
524
|
+
*/
|
|
525
|
+
private registerInstalled;
|
|
514
526
|
remove(name: string): void;
|
|
515
527
|
createSkeleton(name: string, outputDir: string): string;
|
|
516
528
|
}
|
|
@@ -552,4 +564,4 @@ interface ITerminalRunner {
|
|
|
552
564
|
activeCount: number;
|
|
553
565
|
}
|
|
554
566
|
|
|
555
|
-
export { type AiProvider as A, type
|
|
567
|
+
export { type AiProvider as A, type ProviderModelsResult as B, type CatalogModel as C, DENY_ALL as D, type ResolveContext as E, type FetchAllProviderModelsOptions as F, GREP_DEFAULT_HEAD_LIMIT as G, type RunnerInvocation as H, type IApproval as I, type RunnerPluginManifest as J, RunnerRegistry as K, collectProviderCredentials as L, ModelCatalog as M, enabledRunners as N, ORCHESTRATOR_SHORTCUTS as O, type PluginCloneFn as P, fetchAllProviderModels as Q, type ReadFileOpts as R, SEARCH_EXCLUSIONS as S, type ToolOutcome as T, isReservedRunnerName as U, knownModelId as V, resolveModelShortcut as W, resolveProvider as X, toOrchestratorOptions as Y, type AllProviderModels as a, type ApprovalKind as b, type ApprovalMode as c, ApprovalPolicy as d, type ApprovalPolicyOptions as e, type ApprovalRequest as f, type ApprovalSource as g, type DiscoveryCommand as h, type FindSymbolOptions as i, type GlobOptions as j, type GrepOptions as k, type GrepOutputMode as l, type IConfig as m, type IFileSystem as n, type IPluginStore as o, type ITerminalRunner as p, type ITerminalSession as q, type ModelShortcut as r, type OrchestratorOption as s, type PluginEntry as t, type PluginFeatures as u, type PluginMode as v, type PluginModelDiscovery as w, type PluginRunnerDef as x, type ProviderCredentialSource as y, type ProviderModelLists as z };
|
|
@@ -478,6 +478,8 @@ interface IPluginStore {
|
|
|
478
478
|
getUserPluginsDir(): string;
|
|
479
479
|
/** List subdirectory names inside the user plugins directory. */
|
|
480
480
|
listUserPluginDirs(): string[];
|
|
481
|
+
/** List entry names directly inside a directory. Returns [] when unreadable. */
|
|
482
|
+
listDir(dir: string): string[];
|
|
481
483
|
/** Read and parse a manifest.json from pluginDir. Returns null on failure. */
|
|
482
484
|
loadManifest(pluginDir: string): RunnerPluginManifest | null;
|
|
483
485
|
/** Recursively copy sourceDir to destDir. */
|
|
@@ -496,10 +498,15 @@ interface IPluginStore {
|
|
|
496
498
|
exists(path: string): boolean;
|
|
497
499
|
}
|
|
498
500
|
|
|
501
|
+
/** True when a name belongs to a built-in runner and is therefore not installable. */
|
|
502
|
+
declare function isReservedRunnerName(name: string): boolean;
|
|
503
|
+
/** Clone seam: takes a validated URL and a destination, or throws. */
|
|
504
|
+
type PluginCloneFn = (url: string, destDir: string) => void;
|
|
499
505
|
declare class RunnerRegistry {
|
|
500
506
|
private plugins;
|
|
501
507
|
private store;
|
|
502
|
-
|
|
508
|
+
private clone;
|
|
509
|
+
constructor(store?: IPluginStore, clone?: PluginCloneFn);
|
|
503
510
|
private loadBuiltins;
|
|
504
511
|
loadUserPlugins(): void;
|
|
505
512
|
get(id: string): PluginEntry | undefined;
|
|
@@ -510,7 +517,12 @@ declare class RunnerRegistry {
|
|
|
510
517
|
isBuiltIn(id: string): boolean;
|
|
511
518
|
installFromPath(sourcePath: string): RunnerPluginManifest;
|
|
512
519
|
installFromGit(url: string): RunnerPluginManifest;
|
|
513
|
-
|
|
520
|
+
/**
|
|
521
|
+
* The single destination-building step both install routes share: the name is
|
|
522
|
+
* constrained to a plain segment and the resolved destination is asserted to
|
|
523
|
+
* be inside the plugins directory before anything is copied.
|
|
524
|
+
*/
|
|
525
|
+
private registerInstalled;
|
|
514
526
|
remove(name: string): void;
|
|
515
527
|
createSkeleton(name: string, outputDir: string): string;
|
|
516
528
|
}
|
|
@@ -552,4 +564,4 @@ interface ITerminalRunner {
|
|
|
552
564
|
activeCount: number;
|
|
553
565
|
}
|
|
554
566
|
|
|
555
|
-
export { type AiProvider as A, type
|
|
567
|
+
export { type AiProvider as A, type ProviderModelsResult as B, type CatalogModel as C, DENY_ALL as D, type ResolveContext as E, type FetchAllProviderModelsOptions as F, GREP_DEFAULT_HEAD_LIMIT as G, type RunnerInvocation as H, type IApproval as I, type RunnerPluginManifest as J, RunnerRegistry as K, collectProviderCredentials as L, ModelCatalog as M, enabledRunners as N, ORCHESTRATOR_SHORTCUTS as O, type PluginCloneFn as P, fetchAllProviderModels as Q, type ReadFileOpts as R, SEARCH_EXCLUSIONS as S, type ToolOutcome as T, isReservedRunnerName as U, knownModelId as V, resolveModelShortcut as W, resolveProvider as X, toOrchestratorOptions as Y, type AllProviderModels as a, type ApprovalKind as b, type ApprovalMode as c, ApprovalPolicy as d, type ApprovalPolicyOptions as e, type ApprovalRequest as f, type ApprovalSource as g, type DiscoveryCommand as h, type FindSymbolOptions as i, type GlobOptions as j, type GrepOptions as k, type GrepOutputMode as l, type IConfig as m, type IFileSystem as n, type IPluginStore as o, type ITerminalRunner as p, type ITerminalSession as q, type ModelShortcut as r, type OrchestratorOption as s, type PluginEntry as t, type PluginFeatures as u, type PluginMode as v, type PluginModelDiscovery as w, type PluginRunnerDef as x, type ProviderCredentialSource as y, type ProviderModelLists as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h as RunnerId, c as PlanStatus, L as LegacyPlanState, d as ResearchProgress, a as DiscoveredModel, T as Task, R as ResearchLogEntry, C as ConversationMessage, n as TaskSnapshot, Q as QueuedMessage, A as ActiveTaskSession, g as ResearchToolType, u as Verdict, e as ResearchStep, b as PlanState } from './Task-1NwmUImI.mjs';
|
|
2
2
|
export { D as DiscoveredMode, M as Message, P as PlanModificationWarnings, f as ResearchStepOutcome, S as StreamEvent, i as StreamStepEvent, j as StreamThinkingEvent, k as TaskMode, l as TaskModelAssignment, m as TaskOutputSummary, o as TaskStatus, p as TaskType, q as ThinkingBlock, U as UserPromptEntry, r as UserStep, V as ValidationCheck, s as ValidationContext, t as ValidationResult, v as VerificationCheck, w as addTaskToPlan, x as createEmptyPlan, y as createTask, z as emptyWarnings, B as flattenTasks, E as migrateLegacyPlan, F as migratePlanState, G as migrateTask, H as removeTaskFromPlan, I as renumberTasks, J as updateTaskInPlan, K as validateModifiedPlan, N as warningsText } from './Task-1NwmUImI.mjs';
|
|
3
|
-
import { n as IFileSystem, I as IApproval, R as ReadFileOpts, T as ToolOutcome, k as GrepOptions, j as GlobOptions, i as FindSymbolOptions, f as ApprovalRequest, m as IConfig, A as AiProvider,
|
|
4
|
-
export { a as AllProviderModels, d as ApprovalPolicy, e as ApprovalPolicyOptions, C as CatalogModel, D as DENY_ALL, h as DiscoveryCommand, F as FetchAllProviderModelsOptions, G as GREP_DEFAULT_HEAD_LIMIT, l as GrepOutputMode, M as ModelCatalog, r as ModelShortcut, O as ORCHESTRATOR_SHORTCUTS, P as
|
|
3
|
+
import { n as IFileSystem, I as IApproval, R as ReadFileOpts, T as ToolOutcome, k as GrepOptions, j as GlobOptions, i as FindSymbolOptions, f as ApprovalRequest, m as IConfig, A as AiProvider, z as ProviderModelLists, c as ApprovalMode, q as ITerminalSession, p as ITerminalRunner, K as RunnerRegistry, s as OrchestratorOption, b as ApprovalKind, g as ApprovalSource, H as RunnerInvocation, o as IPluginStore, J as RunnerPluginManifest, E as ResolveContext } from './ITerminalRunner-1NAv8wCC.mjs';
|
|
4
|
+
export { a as AllProviderModels, d as ApprovalPolicy, e as ApprovalPolicyOptions, C as CatalogModel, D as DENY_ALL, h as DiscoveryCommand, F as FetchAllProviderModelsOptions, G as GREP_DEFAULT_HEAD_LIMIT, l as GrepOutputMode, M as ModelCatalog, r as ModelShortcut, O as ORCHESTRATOR_SHORTCUTS, P as PluginCloneFn, t as PluginEntry, u as PluginFeatures, v as PluginMode, w as PluginModelDiscovery, x as PluginRunnerDef, y as ProviderCredentialSource, B as ProviderModelsResult, S as SEARCH_EXCLUSIONS, L as collectProviderCredentials, N as enabledRunners, Q as fetchAllProviderModels, U as isReservedRunnerName, V as knownModelId, W as resolveModelShortcut, X as resolveProvider, Y as toOrchestratorOptions } from './ITerminalRunner-1NAv8wCC.mjs';
|
|
5
5
|
import { R as RunnerModeInfo, b as PlanParseError } from './parsing-xpozY5ac.mjs';
|
|
6
6
|
export { M as ManifestLookup, P as PLAN_ENVELOPE_KEY, a as PartialPlanTask, T as TASK_OPS_ENVELOPE_KEY, c as buildModeGuide, d as checkDepsResolve, e as checkImmutableLog, f as checkInProgress, g as checkNoCycles, h as checkUniqueIds, i as escapeControlCharsInStrings, j as extractJsonObject, k as extractObjectWithBalance, l as extractObjectsWithKey, m as filteredBuildModes, n as looksLikePlanAttempt, p as parsePartialPlan, o as parsePlanJson, r as resolveDefaultMode, q as resolveTaskMode, s as runnerModesFrom, t as stripModelNoise, u as stripTrailingCommas, v as validatePlanModification } from './parsing-xpozY5ac.mjs';
|
|
7
7
|
import { T as TaskOp } from './plan-utils-nfHKSbd3.mjs';
|
|
@@ -121,13 +121,44 @@ declare function researchShellWarning(shell: ResearchShell): string | null;
|
|
|
121
121
|
* The old substring denylist both over-matched (`ls docs/removed` tripped `rm`)
|
|
122
122
|
* and under-matched (`$(rm -rf /)` was invisible once chaining was allowed).
|
|
123
123
|
*
|
|
124
|
+
* A segment is classified by the command that will actually execute, not by the
|
|
125
|
+
* name at the front of it: wrappers are unwrapped first, recursively, so
|
|
126
|
+
* `timeout 10 env nice rm -rf x` is an `rm`. See {@link WRAPPER_FAMILY}.
|
|
127
|
+
*
|
|
128
|
+
* A permitted binary is permitted with the flags it is known to be read-only
|
|
129
|
+
* with, not with any flag at all: several of them will run a helper program or
|
|
130
|
+
* write a file when asked to, so `auto` is a per-binary flag allowlist and an
|
|
131
|
+
* unrecognised flag is refused. See {@link FLAG_POLICY}.
|
|
132
|
+
*
|
|
124
133
|
* The lexer is dialect-aware, because the interpreter that will actually run
|
|
125
134
|
* the command decides what the tokens are, and getting that wrong is not a
|
|
126
135
|
* cosmetic error here — it is the difference between classifying what runs and
|
|
127
136
|
* classifying something else. See {@link Dialect}.
|
|
128
137
|
*/
|
|
129
138
|
|
|
139
|
+
/**
|
|
140
|
+
* `env` is deliberately absent. Given a command it is a wrapper, classified by
|
|
141
|
+
* what it actually runs (see {@link WRAPPER_FAMILY}); given none it prints the
|
|
142
|
+
* whole process environment — provider credentials included — into the research
|
|
143
|
+
* log, which is a disclosure the developer should get to see coming.
|
|
144
|
+
*
|
|
145
|
+
* Membership here is necessary but not sufficient: every name in this list also
|
|
146
|
+
* declares the flags it is read-only with in {@link FLAG_POLICY}.
|
|
147
|
+
*/
|
|
130
148
|
declare const AUTO_COMMANDS: string[];
|
|
149
|
+
/**
|
|
150
|
+
* `ls-remote` is deliberately absent, and it is the one entry here that is
|
|
151
|
+
* read-only against the repository. It reaches the network: it contacts
|
|
152
|
+
* whatever host the named remote or URL resolves to, which routes around the
|
|
153
|
+
* web fetcher's per-origin approval and its request-forgery guard. So it
|
|
154
|
+
* prompts rather than running silently.
|
|
155
|
+
*
|
|
156
|
+
* Prompting only became the right answer once {@link scopeFor} widened. Under
|
|
157
|
+
* the old scope it would have been remembered as `git ls-remote`, so one
|
|
158
|
+
* approval of the workspace's own remote would have authorised a listing
|
|
159
|
+
* against any host at all — which is the same hole with an approval dialog in
|
|
160
|
+
* front of it. The scope now carries the destination.
|
|
161
|
+
*/
|
|
131
162
|
declare const GIT_READONLY_SUBCOMMANDS: string[];
|
|
132
163
|
/**
|
|
133
164
|
* Never runs, with or without approval.
|
|
@@ -1866,6 +1897,72 @@ declare function configuredProviders(config: {
|
|
|
1866
1897
|
openaiCompatibleBaseUrl: string;
|
|
1867
1898
|
}): AiProvider[];
|
|
1868
1899
|
|
|
1900
|
+
/**
|
|
1901
|
+
* Which environment variables a settings update may write.
|
|
1902
|
+
*
|
|
1903
|
+
* The daemon's settings update sets `process.env` on the daemon itself, and
|
|
1904
|
+
* every runner it spawns inherits that environment. The admission rule used to
|
|
1905
|
+
* be "any upper-case key", which admitted the variables that make the runtime
|
|
1906
|
+
* load arbitrary modules, preload libraries into every child, redirect the
|
|
1907
|
+
* executable search path, move where settings are persisted, and turn approval
|
|
1908
|
+
* prompting off — so a single settings write was arbitrary code execution.
|
|
1909
|
+
*
|
|
1910
|
+
* The rule is now an allowlist: the provider credential and base-URL families,
|
|
1911
|
+
* derived from the provider registry so a new provider needs no second edit,
|
|
1912
|
+
* plus a small set of Ordewell's own configuration variables. Everything else
|
|
1913
|
+
* is refused and named back to the caller.
|
|
1914
|
+
*/
|
|
1915
|
+
/**
|
|
1916
|
+
* Ordewell's own settable configuration. Deliberately short: a variable earns a
|
|
1917
|
+
* place here only when a surface has a reason to change it on a live daemon.
|
|
1918
|
+
*
|
|
1919
|
+
* `ORDEWELL_AUTONOMOUS_MODE` is conspicuously absent and is in
|
|
1920
|
+
* `SETTINGS_ENV_REFUSED` instead — see that list.
|
|
1921
|
+
*/
|
|
1922
|
+
declare const ORDEWELL_SETTABLE_ENV: readonly string[];
|
|
1923
|
+
/**
|
|
1924
|
+
* Refused by name, not merely left out of the allowlist.
|
|
1925
|
+
*
|
|
1926
|
+
* Omission alone would already refuse these, so this list buys no admission
|
|
1927
|
+
* behaviour — it buys a place where the reason is written down, and a failing
|
|
1928
|
+
* test the moment someone widens the allowlist over one of them. Each entry is
|
|
1929
|
+
* a known escalation from "can change a setting" to "can run code as the user":
|
|
1930
|
+
*
|
|
1931
|
+
* - The approval-mode and pre-approved-scope variables switch the consent gate
|
|
1932
|
+
* off, so every later command runs unprompted.
|
|
1933
|
+
* - The settings-path override is honoured by the settings service, which
|
|
1934
|
+
* creates directories recursively when persisting — admitting it turns the
|
|
1935
|
+
* same write into an arbitrary-path file write.
|
|
1936
|
+
* - The runtime-option and dynamic-loader variables load attacker-chosen
|
|
1937
|
+
* modules or shared objects into the daemon and into every process it spawns.
|
|
1938
|
+
* - The executable-path variables redirect which binary a runner's command name
|
|
1939
|
+
* resolves to.
|
|
1940
|
+
*/
|
|
1941
|
+
declare const SETTINGS_ENV_REFUSED: readonly string[];
|
|
1942
|
+
/**
|
|
1943
|
+
* The credential and endpoint keys alone. A write to one of these is what
|
|
1944
|
+
* invalidates a model catalog — picking a planner, a model or an effort level
|
|
1945
|
+
* changes nothing a catalog contains.
|
|
1946
|
+
*/
|
|
1947
|
+
declare const PROVIDER_CREDENTIAL_ENV: ReadonlySet<string>;
|
|
1948
|
+
/**
|
|
1949
|
+
* Every key a settings update may write. Built once at module load; the refused
|
|
1950
|
+
* names are subtracted last so a provider registration can never smuggle one in.
|
|
1951
|
+
*/
|
|
1952
|
+
declare const SETTINGS_ENV_ALLOWLIST: ReadonlySet<string>;
|
|
1953
|
+
interface EnvAdmission {
|
|
1954
|
+
/** Keys that may be written, with their string values. */
|
|
1955
|
+
accepted: Record<string, string>;
|
|
1956
|
+
/** Keys the caller sent that were refused, in the order they arrived. */
|
|
1957
|
+
rejected: string[];
|
|
1958
|
+
}
|
|
1959
|
+
/**
|
|
1960
|
+
* Splits a settings update's `env` object into what may be written and what was
|
|
1961
|
+
* refused. A non-string value for an allowlisted key is refused rather than
|
|
1962
|
+
* dropped, so the caller never sees silence for a write that did not happen.
|
|
1963
|
+
*/
|
|
1964
|
+
declare function admitSettingsEnv(env: Record<string, unknown>): EnvAdmission;
|
|
1965
|
+
|
|
1869
1966
|
interface SpawnSpec {
|
|
1870
1967
|
command: string;
|
|
1871
1968
|
args: string[];
|
|
@@ -3037,6 +3134,93 @@ interface WorkspaceCheckDeps {
|
|
|
3037
3134
|
}
|
|
3038
3135
|
/** Throws {@link WorkspaceNotFoundError} unless `workspace` names an existing directory. */
|
|
3039
3136
|
declare function assertWorkspaceExists(workspace: string, deps?: WorkspaceCheckDeps): void;
|
|
3137
|
+
/**
|
|
3138
|
+
* A workspace whose resolved path carries none of the markers below. Thrown
|
|
3139
|
+
* instead of admitting the directory as-is: without this, a request pointed
|
|
3140
|
+
* at the filesystem root or an arbitrary system directory becomes the
|
|
3141
|
+
* confinement boundary for every read, search and permitted command the
|
|
3142
|
+
* planner runs, by definition. A denylist of "dangerous" roots was rejected
|
|
3143
|
+
* for the same reason as the other denylists in this project's remediation —
|
|
3144
|
+
* it would still admit unlisted system directories.
|
|
3145
|
+
*/
|
|
3146
|
+
declare class WorkspaceNotAProjectError extends Error {
|
|
3147
|
+
readonly workspace: string;
|
|
3148
|
+
constructor(workspace: string);
|
|
3149
|
+
}
|
|
3150
|
+
interface WorkspaceProjectCheckDeps {
|
|
3151
|
+
/** Resolves symlinks/`..` segments to a canonical absolute path. Defaults to `fs.realpathSync`. */
|
|
3152
|
+
realpath?: (candidate: string) => string;
|
|
3153
|
+
/** True when `candidate` names an existing filesystem entry. Defaults to `fs.existsSync`. */
|
|
3154
|
+
exists?: (candidate: string) => boolean;
|
|
3155
|
+
}
|
|
3156
|
+
/**
|
|
3157
|
+
* Throws {@link WorkspaceNotAProjectError} unless `workspace` resolves to a
|
|
3158
|
+
* directory carrying at least one project marker. Resolves the path first —
|
|
3159
|
+
* via `realpath`, not string inspection — so a request that traverses
|
|
3160
|
+
* through symlinks or `..` segments is judged on where it actually lands,
|
|
3161
|
+
* not on the path as written.
|
|
3162
|
+
*/
|
|
3163
|
+
declare function assertWorkspaceIsProject(workspace: string, deps?: WorkspaceProjectCheckDeps): void;
|
|
3164
|
+
|
|
3165
|
+
/**
|
|
3166
|
+
* The daemon's bearer token: minted at startup, written beside the per-port
|
|
3167
|
+
* process-id file, read by the CLI.
|
|
3168
|
+
*
|
|
3169
|
+
* Header validation defends against browsers and nothing else. This is what
|
|
3170
|
+
* stops another process running as the same user — an install script in the
|
|
3171
|
+
* very repository the planner was pointed at, say — from driving the daemon
|
|
3172
|
+
* just because it can see the port.
|
|
3173
|
+
*
|
|
3174
|
+
* Both ends of the wire live here so the carrier encodings cannot drift: the
|
|
3175
|
+
* daemon extracts with the same functions the CLI attaches with.
|
|
3176
|
+
*/
|
|
3177
|
+
/**
|
|
3178
|
+
* The subprotocol the token rides on during the WebSocket upgrade. A query
|
|
3179
|
+
* parameter would land in access logs and in `ps`; a subprotocol travels in a
|
|
3180
|
+
* request header like the HTTP `Authorization` it stands in for.
|
|
3181
|
+
*/
|
|
3182
|
+
declare const DAEMON_TOKEN_SUBPROTOCOL_PREFIX = "ordewell.token.";
|
|
3183
|
+
/**
|
|
3184
|
+
* Offered alongside the token subprotocol, and the one the server selects, so
|
|
3185
|
+
* the 101 response never echoes the secret back.
|
|
3186
|
+
*/
|
|
3187
|
+
declare const DAEMON_SUBPROTOCOL = "ordewell.v1";
|
|
3188
|
+
/**
|
|
3189
|
+
* One token file per port, with no default-port special case: unlike the
|
|
3190
|
+
* process-id file there is no legacy name to preserve, and naming every file
|
|
3191
|
+
* after its port is what stops a second daemon clobbering the first's token.
|
|
3192
|
+
*/
|
|
3193
|
+
declare function daemonTokenPath(port: number): string;
|
|
3194
|
+
/**
|
|
3195
|
+
* Mint this daemon's token and hand it off through the filesystem.
|
|
3196
|
+
*
|
|
3197
|
+
* Unlink-then-create-exclusively rather than a plain write: `mode` is ignored
|
|
3198
|
+
* when the file already exists, so writing over a pre-created file would leave
|
|
3199
|
+
* the token at whatever permissions that file already had, and an existing
|
|
3200
|
+
* symlink would carry the write somewhere else entirely.
|
|
3201
|
+
*/
|
|
3202
|
+
declare function mintDaemonToken(port: number): {
|
|
3203
|
+
token: string;
|
|
3204
|
+
file: string;
|
|
3205
|
+
};
|
|
3206
|
+
/** The token a client should present to the daemon on `port`, if one has been minted. */
|
|
3207
|
+
declare function readDaemonToken(port: number): string | undefined;
|
|
3208
|
+
/** Best-effort cleanup on shutdown, so a dead daemon leaves no usable-looking token behind. */
|
|
3209
|
+
declare function clearDaemonToken(port: number): void;
|
|
3210
|
+
/** The `Authorization` header value for HTTP requests. */
|
|
3211
|
+
declare function bearerHeaderValue(token: string): string;
|
|
3212
|
+
/** What a client offers on the upgrade: the real subprotocol first, the token second. */
|
|
3213
|
+
declare function tokenSubprotocols(token: string): string[];
|
|
3214
|
+
interface TokenCarriers {
|
|
3215
|
+
/** `Authorization: Bearer <token>` — the HTTP carrier. */
|
|
3216
|
+
authorization?: string | null;
|
|
3217
|
+
/** `Sec-WebSocket-Protocol` — the upgrade carrier. */
|
|
3218
|
+
secWebSocketProtocol?: string | null;
|
|
3219
|
+
}
|
|
3220
|
+
/** Pull the token out of whichever carrier it arrived on. */
|
|
3221
|
+
declare function extractPresentedToken(carriers: TokenCarriers): string | undefined;
|
|
3222
|
+
/** Constant-time comparison, so a wrong token leaks no information about the right one. */
|
|
3223
|
+
declare function tokensMatch(presented: string | undefined, expected: string): boolean;
|
|
3040
3224
|
|
|
3041
3225
|
interface KillTreeDeps {
|
|
3042
3226
|
platform?: NodeJS.Platform;
|
|
@@ -3137,6 +3321,7 @@ declare function clipboardCopyCommand(hasBin?: HasBinFn, platform?: NodeJS.Platf
|
|
|
3137
3321
|
declare class FsPluginStore implements IPluginStore {
|
|
3138
3322
|
getUserPluginsDir(): string;
|
|
3139
3323
|
listUserPluginDirs(): string[];
|
|
3324
|
+
listDir(dir: string): string[];
|
|
3140
3325
|
loadManifest(pluginDir: string): RunnerPluginManifest | null;
|
|
3141
3326
|
copyDir(sourceDir: string, destDir: string): void;
|
|
3142
3327
|
removeDir(dir: string): void;
|
|
@@ -3147,6 +3332,56 @@ declare class FsPluginStore implements IPluginStore {
|
|
|
3147
3332
|
exists(path: string): boolean;
|
|
3148
3333
|
}
|
|
3149
3334
|
|
|
3335
|
+
/**
|
|
3336
|
+
* Shape check for a manifest read off disk or out of a cloned repository. The
|
|
3337
|
+
* name is constrained here rather than at each install route, so every store
|
|
3338
|
+
* implementation gets the same guarantee that a manifest name is a plain
|
|
3339
|
+
* segment and never a traversal sequence.
|
|
3340
|
+
*/
|
|
3341
|
+
declare function isValidManifest(obj: unknown): obj is RunnerPluginManifest;
|
|
3342
|
+
|
|
3343
|
+
/**
|
|
3344
|
+
* A plugin name is a single plain path segment: alphanumeric at both ends,
|
|
3345
|
+
* dots/dashes/underscores in between. This is what keeps a manifest name from
|
|
3346
|
+
* being a traversal sequence (`..`, `../../etc`), an absolute path, or a
|
|
3347
|
+
* dash-prefixed string that a downstream tool reads as a flag.
|
|
3348
|
+
*/
|
|
3349
|
+
declare const PLUGIN_NAME_PATTERN: RegExp;
|
|
3350
|
+
declare function isPlainPluginName(name: unknown): name is string;
|
|
3351
|
+
declare function assertPlainPluginName(name: unknown): asserts name is string;
|
|
3352
|
+
/**
|
|
3353
|
+
* Resolve where a plugin of this name installs, and assert the result is still
|
|
3354
|
+
* a direct child of the plugins directory. Validation and use share this one
|
|
3355
|
+
* call so they cannot disagree about the path being checked.
|
|
3356
|
+
*/
|
|
3357
|
+
declare function resolvePluginInstallDir(pluginsDir: string, name: unknown): string;
|
|
3358
|
+
|
|
3359
|
+
/** Hosts a plugin may be cloned from. Exact hostname match, case-insensitive. */
|
|
3360
|
+
declare const ALLOWED_PLUGIN_HOSTS: readonly string[];
|
|
3361
|
+
type PluginSource = {
|
|
3362
|
+
kind: 'git';
|
|
3363
|
+
url: string;
|
|
3364
|
+
} | {
|
|
3365
|
+
kind: 'path';
|
|
3366
|
+
path: string;
|
|
3367
|
+
};
|
|
3368
|
+
/**
|
|
3369
|
+
* Validate a plugin repository URL. Requires an ordinary HTTPS repository on an
|
|
3370
|
+
* allowed host, which is also what rejects git's transport helpers (`ext::`,
|
|
3371
|
+
* `git://`, `ssh://`, `file://`) — they never reach the clone because they are
|
|
3372
|
+
* not the https scheme.
|
|
3373
|
+
*
|
|
3374
|
+
* Returns the parsed URL so callers clone the normalised form they validated.
|
|
3375
|
+
*/
|
|
3376
|
+
declare function assertInstallablePluginUrl(url: unknown): URL;
|
|
3377
|
+
/**
|
|
3378
|
+
* Decide whether an install source names a remote repository or a local
|
|
3379
|
+
* directory. Anything that carries a scheme or looks like an scp-style remote
|
|
3380
|
+
* goes down the URL route so it is rejected as a bad URL rather than silently
|
|
3381
|
+
* retried as a (nonexistent) directory.
|
|
3382
|
+
*/
|
|
3383
|
+
declare function classifyPluginSource(source: string): PluginSource;
|
|
3384
|
+
|
|
3150
3385
|
declare function resolveArgs(manifest: RunnerPluginManifest, ctx: ResolveContext): RunnerInvocation;
|
|
3151
3386
|
|
|
3152
3387
|
declare const CLAUDE_CODE_MANIFEST: RunnerPluginManifest;
|
|
@@ -3156,6 +3391,17 @@ declare const OPENCODE_MANIFEST: RunnerPluginManifest;
|
|
|
3156
3391
|
declare const STATE_DIR = ".ordewell";
|
|
3157
3392
|
declare function ensureDir(dir: string): void;
|
|
3158
3393
|
declare function getStateDir(baseDir?: string): string;
|
|
3394
|
+
/**
|
|
3395
|
+
* A match-everything ignore rule, written *inside* the state directory. A
|
|
3396
|
+
* `.gitignore` containing `*` inside a directory excludes that directory's
|
|
3397
|
+
* whole contents, itself included, so plans and sessions stop being
|
|
3398
|
+
* accidentally committable — without ever touching a file the developer wrote.
|
|
3399
|
+
* Editing their root `.gitignore` would be the intrusive version of this.
|
|
3400
|
+
*
|
|
3401
|
+
* Idempotent, and never overwrites an existing file: a developer who has
|
|
3402
|
+
* customised these rules (to commit their plans deliberately, say) keeps them.
|
|
3403
|
+
*/
|
|
3404
|
+
declare function ensureStateDirIgnored(baseDir?: string): void;
|
|
3159
3405
|
|
|
3160
3406
|
declare function saveState(plan: LegacyPlanState, baseDir?: string): void;
|
|
3161
3407
|
declare function loadState(baseDir?: string, logger?: ILogger): LegacyPlanState | null;
|
|
@@ -3178,6 +3424,8 @@ declare function getLatestSession(baseDir?: string, logger?: ILogger): {
|
|
|
3178
3424
|
} | null;
|
|
3179
3425
|
declare function deleteSession(sessionId: string, baseDir?: string, logger?: ILogger): boolean;
|
|
3180
3426
|
|
|
3427
|
+
declare function mintSessionId(): string;
|
|
3428
|
+
|
|
3181
3429
|
interface PrdBlock {
|
|
3182
3430
|
slug: string;
|
|
3183
3431
|
markdown: string;
|
|
@@ -3244,4 +3492,4 @@ declare class PlannerModelMemory {
|
|
|
3244
3492
|
recall(provider: string, catalog: PlannerModelCandidate[]): PlannerModelRecall;
|
|
3245
3493
|
}
|
|
3246
3494
|
|
|
3247
|
-
export { ALL_PROVIDERS, AUTO_COMMANDS, AbstractRunner, AbstractTerminalSession, ActiveTaskSession, type AgentAdapter, type AgentAdapterFactory, type AgentEvent, type AgentProcessDeps, type AgentStartOptions, AiProvider, ApprovalKind, ApprovalMode, ApprovalRequest, ApprovalSource, BaseAiService, BaseConfig, BaseFileSystem, CLAUDE_CODE_MANIFEST, CLI_PROVIDERS, CMD_EXE_MAX_COMMAND_LINE, CORE_PLANNER_PROMPT, type CappedRows, type CheckpointListener, ClaudeCodeAdapter, CliAgentAiService, type CliAgentAiServiceDeps, CodexAdapter, type CommandClassification, CommandLineTooLongError, type CommandTier, type ComposeOptions, ConsoleLogger, ContextCollector, ConversationMessage, type ConversationRequest, type ConversationTurn, DiscoveredModel, EmbeddedNewlineError, EnvConfig, type ExecFileFn, type ExecImpl, ExecutableNotFoundError, FindSymbolOptions, FsPluginStore, GIT_READONLY_SUBCOMMANDS, GeminiService, GlobOptions, type GrepInvocation, GrepOptions, type HasBinFn, HeadlessRunner, type HeadlessRunnerDeps, HeadlessSession, type IAiService, IApproval, IConfig, IFileSystem, type ILogger, type INotification, IPluginStore, ITerminalRunner, ITerminalSession, JSON_REPAIR_INSTRUCTION, type KillTreeDeps, type LaunchDeps, type LaunchPlan, LegacyPlanState, LineBuffer, type MappedTool, ModelResolver, type ModelResolverDeps, type ModifyPlanRequest, type NotificationAction, OPENCODE_MANIFEST, OpenAiService, OpenCodeAdapter, type OrchestratorObserver, OrchestratorOption, PROVIDER_DETECT_PRIORITY, PROVIDER_LABEL, PROVIDER_PRIORITY, PROVIDER_SHORT_LABEL, type PendingApproval, PendingApprovals, type PendingApprovalsOptions, PlanEditError, PlanParseError, type PlanRequest, PlanState, PlanStatus, PlanStore, Planner, type PlannerModelCandidate, type PlannerModelChoice, PlannerModelMemory, type PlannerModelRecall, type PlannerModelStore, type PlannerReplyClassification, type PlannerRuntimeToggles, type PrdBlock, type PreparedLaunch, type PriorOutput, type ProbeFn, ProviderModelLists, type ProviderRegistration, QueuedMessage, REFUSED_COMMANDS, ReadFileOpts, type RepairLoopOpts, type RepairVerdict, type ResearchChat, ResearchLogEntry, ResearchProgress, type ResearchShell, type ResearchShellDeps, ResearchStep, ResearchToolType, type ResearchTurn, ResolveContext, type RunnerCatalog, RunnerId, RunnerInstallation, RunnerInvocation, type RunnerMode, RunnerModeInfo, RunnerPluginManifest, RunnerRegistry, type RunnerSpawnOptions, STATE_DIR, STOPPED_TOOL_RESULT, SYMBOL_LANGUAGES, type SerializedPlan, type SerializedTask, type SerializedTaskStatus, Session, type SessionBroadcaster, type SessionData, type SessionDeps, type SessionMessage, type SessionMeta, type SessionPlanner, type SessionRuntimeSettings, SettingsService, type ShellDialect, type SpawnSpec, StdioAgentAdapter, TRUNCATED_PLAN_REPAIR_INSTRUCTION, Task, TaskOp, TaskOrchestrator, TaskSnapshot, TmuxRunner, type TmuxRunnerDeps, type ToolCall, ToolOutcome, type ToolResult, type UserSettings, Verdict, VerdictEngine, type VerdictListener, WINDOWS_MAX_COMMAND_LINE, type WorkspaceCheckDeps, WorkspaceNotFoundError, applyHeadLimit, assertWorkspaceExists, augmentPromptWithPriorOutputs, augmentedPath, buildConversationSystemPrompt, buildFallbackGrepArgs, buildGlobArgs, buildGrepArgs, buildMergePrompt, buildModifyDuringExecutionPrompt, buildModifyPlanPrompt, buildPlanWithResults, buildResearchPrompt, buildResearchToolsPrompt, buildRunnerInvocation, buildShellInvocation, buildSplitPrompt, buildSubagentSystemPrompt, clampThinkingEffort, classifyCommand, classifyPlannerReply, clearAugmentedPathCache, clearResearchShellCache, clearState, clipboardCopyCommand, coerceAssignments, collectDirectDependencyOutputs, composeAugmentedPrompt, configuredProviders, createAiService, defaultLogger, definitionPattern, deleteSession, discoverGeminiModels, effectiveAllowlist, ensureDir, executionLogBlock, executionSummary, extractPrdBlock, filterFallbackByAnchoredInclude, filterModelsForPrompt, formatSearchOutput, generatePlanWithRepair, getLatestSession, getProviderMeta, getSettingsPath, getStateDir, grantScopeFor, hasTmux, includeGlobFor, isCliProvider, isExecutableResolved, isOpenAiProvider, killTree, languageForId, listSessions, loadSession, loadSessionPlanState, loadState, mapAgentTool, modelContextBlock, modifyValidationFeedback, normalizeAgentArgs, normalizeGeminiModel, pendingEditRulesBlock, planDirectLaunch, planShellLaunch, posixShellQuote, prefixModelId, providerForRunner, reEmitPlanPrompt, reEmitTaskOpsPrompt, referencePattern, renderPlanMap, renderPriorOutputs, repairLoop, researchShellWarning, researchToolsPath, resolveArgs, resolveProviderFromPrefix, resolveResearchShell, resolveWithin, retargetTaskRunner, runnerAssignment, runnerForProvider, sanitizeSlug, savePrdMarkdown, saveSession, saveState, serializePlan, serializeTask, serializeTaskStatus, sessionRuntimeSettings, stateExists, stripAnsi, stripModelPrefix, summarizeOutput, taskOpsRejectedPrompt, tmuxSessionName, tmuxSocketName, tmuxWindowName, truncatedPlanReEmitPrompt, wellKnownBinDirs, windowsCommandLine, withPath, wrapWithPty };
|
|
3495
|
+
export { ALLOWED_PLUGIN_HOSTS, ALL_PROVIDERS, AUTO_COMMANDS, AbstractRunner, AbstractTerminalSession, ActiveTaskSession, type AgentAdapter, type AgentAdapterFactory, type AgentEvent, type AgentProcessDeps, type AgentStartOptions, AiProvider, ApprovalKind, ApprovalMode, ApprovalRequest, ApprovalSource, BaseAiService, BaseConfig, BaseFileSystem, CLAUDE_CODE_MANIFEST, CLI_PROVIDERS, CMD_EXE_MAX_COMMAND_LINE, CORE_PLANNER_PROMPT, type CappedRows, type CheckpointListener, ClaudeCodeAdapter, CliAgentAiService, type CliAgentAiServiceDeps, CodexAdapter, type CommandClassification, CommandLineTooLongError, type CommandTier, type ComposeOptions, ConsoleLogger, ContextCollector, ConversationMessage, type ConversationRequest, type ConversationTurn, DAEMON_SUBPROTOCOL, DAEMON_TOKEN_SUBPROTOCOL_PREFIX, DiscoveredModel, EmbeddedNewlineError, type EnvAdmission, EnvConfig, type ExecFileFn, type ExecImpl, ExecutableNotFoundError, FindSymbolOptions, FsPluginStore, GIT_READONLY_SUBCOMMANDS, GeminiService, GlobOptions, type GrepInvocation, GrepOptions, type HasBinFn, HeadlessRunner, type HeadlessRunnerDeps, HeadlessSession, type IAiService, IApproval, IConfig, IFileSystem, type ILogger, type INotification, IPluginStore, ITerminalRunner, ITerminalSession, JSON_REPAIR_INSTRUCTION, type KillTreeDeps, type LaunchDeps, type LaunchPlan, LegacyPlanState, LineBuffer, type MappedTool, ModelResolver, type ModelResolverDeps, type ModifyPlanRequest, type NotificationAction, OPENCODE_MANIFEST, ORDEWELL_SETTABLE_ENV, OpenAiService, OpenCodeAdapter, type OrchestratorObserver, OrchestratorOption, PLUGIN_NAME_PATTERN, PROVIDER_CREDENTIAL_ENV, PROVIDER_DETECT_PRIORITY, PROVIDER_LABEL, PROVIDER_PRIORITY, PROVIDER_SHORT_LABEL, type PendingApproval, PendingApprovals, type PendingApprovalsOptions, PlanEditError, PlanParseError, type PlanRequest, PlanState, PlanStatus, PlanStore, Planner, type PlannerModelCandidate, type PlannerModelChoice, PlannerModelMemory, type PlannerModelRecall, type PlannerModelStore, type PlannerReplyClassification, type PlannerRuntimeToggles, type PluginSource, type PrdBlock, type PreparedLaunch, type PriorOutput, type ProbeFn, ProviderModelLists, type ProviderRegistration, QueuedMessage, REFUSED_COMMANDS, ReadFileOpts, type RepairLoopOpts, type RepairVerdict, type ResearchChat, ResearchLogEntry, ResearchProgress, type ResearchShell, type ResearchShellDeps, ResearchStep, ResearchToolType, type ResearchTurn, ResolveContext, type RunnerCatalog, RunnerId, RunnerInstallation, RunnerInvocation, type RunnerMode, RunnerModeInfo, RunnerPluginManifest, RunnerRegistry, type RunnerSpawnOptions, SETTINGS_ENV_ALLOWLIST, SETTINGS_ENV_REFUSED, STATE_DIR, STOPPED_TOOL_RESULT, SYMBOL_LANGUAGES, type SerializedPlan, type SerializedTask, type SerializedTaskStatus, Session, type SessionBroadcaster, type SessionData, type SessionDeps, type SessionMessage, type SessionMeta, type SessionPlanner, type SessionRuntimeSettings, SettingsService, type ShellDialect, type SpawnSpec, StdioAgentAdapter, TRUNCATED_PLAN_REPAIR_INSTRUCTION, Task, TaskOp, TaskOrchestrator, TaskSnapshot, TmuxRunner, type TmuxRunnerDeps, type TokenCarriers, type ToolCall, ToolOutcome, type ToolResult, type UserSettings, Verdict, VerdictEngine, type VerdictListener, WINDOWS_MAX_COMMAND_LINE, type WorkspaceCheckDeps, WorkspaceNotAProjectError, WorkspaceNotFoundError, type WorkspaceProjectCheckDeps, admitSettingsEnv, applyHeadLimit, assertInstallablePluginUrl, assertPlainPluginName, assertWorkspaceExists, assertWorkspaceIsProject, augmentPromptWithPriorOutputs, augmentedPath, bearerHeaderValue, buildConversationSystemPrompt, buildFallbackGrepArgs, buildGlobArgs, buildGrepArgs, buildMergePrompt, buildModifyDuringExecutionPrompt, buildModifyPlanPrompt, buildPlanWithResults, buildResearchPrompt, buildResearchToolsPrompt, buildRunnerInvocation, buildShellInvocation, buildSplitPrompt, buildSubagentSystemPrompt, clampThinkingEffort, classifyCommand, classifyPlannerReply, classifyPluginSource, clearAugmentedPathCache, clearDaemonToken, clearResearchShellCache, clearState, clipboardCopyCommand, coerceAssignments, collectDirectDependencyOutputs, composeAugmentedPrompt, configuredProviders, createAiService, daemonTokenPath, defaultLogger, definitionPattern, deleteSession, discoverGeminiModels, effectiveAllowlist, ensureDir, ensureStateDirIgnored, executionLogBlock, executionSummary, extractPrdBlock, extractPresentedToken, filterFallbackByAnchoredInclude, filterModelsForPrompt, formatSearchOutput, generatePlanWithRepair, getLatestSession, getProviderMeta, getSettingsPath, getStateDir, grantScopeFor, hasTmux, includeGlobFor, isCliProvider, isExecutableResolved, isOpenAiProvider, isPlainPluginName, isValidManifest, killTree, languageForId, listSessions, loadSession, loadSessionPlanState, loadState, mapAgentTool, mintDaemonToken, mintSessionId, modelContextBlock, modifyValidationFeedback, normalizeAgentArgs, normalizeGeminiModel, pendingEditRulesBlock, planDirectLaunch, planShellLaunch, posixShellQuote, prefixModelId, providerForRunner, reEmitPlanPrompt, reEmitTaskOpsPrompt, readDaemonToken, referencePattern, renderPlanMap, renderPriorOutputs, repairLoop, researchShellWarning, researchToolsPath, resolveArgs, resolvePluginInstallDir, resolveProviderFromPrefix, resolveResearchShell, resolveWithin, retargetTaskRunner, runnerAssignment, runnerForProvider, sanitizeSlug, savePrdMarkdown, saveSession, saveState, serializePlan, serializeTask, serializeTaskStatus, sessionRuntimeSettings, stateExists, stripAnsi, stripModelPrefix, summarizeOutput, taskOpsRejectedPrompt, tmuxSessionName, tmuxSocketName, tmuxWindowName, tokenSubprotocols, tokensMatch, truncatedPlanReEmitPrompt, wellKnownBinDirs, windowsCommandLine, withPath, wrapWithPty };
|