zidane 6.1.13 → 6.2.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/{acp-BqfKqQ9x.js → acp-CYJvnqPa.js} +2 -2
- package/dist/{acp-BqfKqQ9x.js.map → acp-CYJvnqPa.js.map} +1 -1
- package/dist/acp-cli.js +4 -4
- package/dist/acp.d.ts +1 -1
- package/dist/acp.js +1 -1
- package/dist/{agent-CZ3WSWqR.js → agent-D11SxCvA.js} +155 -75
- package/dist/agent-D11SxCvA.js.map +1 -0
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/{anthropic-CV_OSYVD.js → anthropic-DdlSgT6K.js} +47 -25
- package/dist/anthropic-DdlSgT6K.js.map +1 -0
- package/dist/{auth-D5FfJtLf.js → auth-Ys_7TmRj.js} +2 -2
- package/dist/{auth-D5FfJtLf.js.map → auth-Ys_7TmRj.js.map} +1 -1
- package/dist/{cache-telemetry-BKAwsNxm.js → cache-telemetry-KJ7B-_Gh.js} +8 -3
- package/dist/cache-telemetry-KJ7B-_Gh.js.map +1 -0
- package/dist/chat/pure.d.ts +3 -3
- package/dist/chat/pure.js +2 -2
- package/dist/chat.d.ts +12 -5
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +7 -7
- package/dist/{completion-core-CXYSVhZo.js → completion-core-BRo86R_L.js} +23 -10
- package/dist/completion-core-BRo86R_L.js.map +1 -0
- package/dist/contexts/daytona.d.ts +1 -1
- package/dist/contexts/e2b.d.ts +1 -1
- package/dist/eval.d.ts +1 -1
- package/dist/extensions.d.ts +2 -2
- package/dist/extensions.js +2 -2
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/{index-X02SI0nt.d.ts → index-CNyYEOy0.d.ts} +351 -42
- package/dist/index-CNyYEOy0.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -6
- package/dist/{generate-data-WL_yGVL6.js → inline-autocomplete-BAwBcZtD.js} +191 -6
- package/dist/inline-autocomplete-BAwBcZtD.js.map +1 -0
- package/dist/mcp.d.ts +1 -1
- package/dist/output/stream-json.d.ts +1 -1
- package/dist/output/terminal.d.ts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +1 -1
- package/dist/providers/arcee.d.ts +1 -1
- package/dist/providers/baseten.d.ts +1 -1
- package/dist/providers/cerebras.d.ts +1 -1
- package/dist/providers/local.d.ts +1 -1
- package/dist/providers/openai-compat.d.ts +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +1 -1
- package/dist/restate.d.ts +1 -1
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/skills.d.ts +1 -1
- package/dist/{tool-formatters-kg8O6wHZ.d.ts → tool-formatters-B7oWiy5m.d.ts} +2 -2
- package/dist/tool-formatters-B7oWiy5m.d.ts.map +1 -0
- package/dist/tools/fetch-url.d.ts +1 -1
- package/dist/tools/web-search.d.ts +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +1 -1
- package/dist/{transcript-anchors-DAF4RbyU.d.ts → transcript-anchors-BUZ915pM.d.ts} +2 -2
- package/dist/{transcript-anchors-DAF4RbyU.d.ts.map → transcript-anchors-BUZ915pM.d.ts.map} +1 -1
- package/dist/{transcript-anchors-DAf0Mr_9.js → transcript-anchors-cc4gsU-j.js} +23 -8
- package/dist/transcript-anchors-cc4gsU-j.js.map +1 -0
- package/dist/tui.d.ts +25 -15
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +539 -57
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-zkZ1L0eb.d.ts → turn-operations-2Ou_DkbC.d.ts} +3 -3
- package/dist/{turn-operations-zkZ1L0eb.d.ts.map → turn-operations-2Ou_DkbC.d.ts.map} +1 -1
- package/dist/{turn-operations-D9p-y9EC.js → turn-operations-CXjRaltC.js} +72 -2
- package/dist/{turn-operations-D9p-y9EC.js.map → turn-operations-CXjRaltC.js.map} +1 -1
- package/dist/types-BIarq1qE.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/EXTENSIONS.md +43 -6
- package/package.json +2 -1
- package/scripts/eval.ts +21 -3
- package/dist/agent-CZ3WSWqR.js.map +0 -1
- package/dist/anthropic-CV_OSYVD.js.map +0 -1
- package/dist/cache-telemetry-BKAwsNxm.js.map +0 -1
- package/dist/completion-core-CXYSVhZo.js.map +0 -1
- package/dist/generate-data-WL_yGVL6.js.map +0 -1
- package/dist/index-X02SI0nt.d.ts.map +0 -1
- package/dist/tool-formatters-kg8O6wHZ.d.ts.map +0 -1
- package/dist/transcript-anchors-DAf0Mr_9.js.map +0 -1
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
2
|
+
import { readdirSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
1
4
|
//#region src/chat/commands.ts
|
|
2
5
|
/**
|
|
3
6
|
* Persisted form of output blocks inside a display-only `command` turn:
|
|
@@ -70,17 +73,29 @@ function commandSteps(command) {
|
|
|
70
73
|
* what keeps mid-prompt `/skill` mentions routed to the skills provider:
|
|
71
74
|
* `"summarize /research"` is not a command, `"/research foo"` is.
|
|
72
75
|
*
|
|
73
|
-
* `
|
|
74
|
-
*
|
|
76
|
+
* `known` is matched case-insensitively; entries may be bare names or
|
|
77
|
+
* `{ name, aliases }` records — an alias hit canonicalizes to the entry's
|
|
78
|
+
* `name` (registered casing), so dispatch-by-name downstream just works.
|
|
75
79
|
*/
|
|
76
|
-
function parseCommandInvocation(prompt,
|
|
80
|
+
function parseCommandInvocation(prompt, known) {
|
|
77
81
|
const body = prompt.trimStart();
|
|
78
82
|
if (body[0] !== "/") return null;
|
|
79
83
|
const afterSlash = body.slice(1);
|
|
80
84
|
const wsIdx = afterSlash.search(/\s/);
|
|
81
85
|
const typed = (wsIdx === -1 ? afterSlash : afterSlash.slice(0, wsIdx)).toLowerCase();
|
|
82
86
|
if (typed.length === 0) return null;
|
|
83
|
-
|
|
87
|
+
let canonical;
|
|
88
|
+
for (const entry of known) {
|
|
89
|
+
const name = typeof entry === "string" ? entry : entry.name;
|
|
90
|
+
if (name.toLowerCase() === typed) {
|
|
91
|
+
canonical = name;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (typeof entry !== "string" && entry.aliases?.some((a) => a.toLowerCase() === typed)) {
|
|
95
|
+
canonical = name;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
84
99
|
if (canonical === void 0) return null;
|
|
85
100
|
const args = (wsIdx === -1 ? "" : afterSlash.slice(wsIdx + 1)).trim();
|
|
86
101
|
return {
|
|
@@ -319,6 +334,176 @@ async function generateStructuredData(options) {
|
|
|
319
334
|
return payload;
|
|
320
335
|
}
|
|
321
336
|
//#endregion
|
|
322
|
-
|
|
337
|
+
//#region src/chat/inline-autocomplete.ts
|
|
338
|
+
/**
|
|
339
|
+
* Inline (ghost-text) autocomplete for the prompt.
|
|
340
|
+
*
|
|
341
|
+
* Distinct from the trigger-based completion popover (`@` files, `/`
|
|
342
|
+
* commands): providers here suggest plain text SUFFIX candidates to
|
|
343
|
+
* append at the cursor — the first renders as dim ghost text, up/down
|
|
344
|
+
* rotates through the rest, Tab accepts. No popover.
|
|
345
|
+
*
|
|
346
|
+
* Providers are queried in registration order with a shared AbortSignal;
|
|
347
|
+
* the engine returns the first provider's non-empty candidate list.
|
|
348
|
+
* Extensions add providers via `ctx.registerInlineAutocompleteProvider`
|
|
349
|
+
* — the built-in path provider ({@link createPathAutocompleteProvider})
|
|
350
|
+
* is always first.
|
|
351
|
+
*/
|
|
352
|
+
/** Default per-provider deadline — a hung provider is treated as "no suggestion". */
|
|
353
|
+
const PROVIDER_DEADLINE_MS = 150;
|
|
354
|
+
/** Hard cap on a provider's `deadlineMs` — past this, waiting for a ghost reads as broken. */
|
|
355
|
+
const MAX_PROVIDER_DEADLINE_MS = 2e3;
|
|
356
|
+
/**
|
|
357
|
+
* Query `providers` in order; the first provider yielding a non-empty
|
|
358
|
+
* candidate list wins (a bare string normalizes to a 1-element list).
|
|
359
|
+
* Provider errors are swallowed (a broken extension provider must not
|
|
360
|
+
* break typing), and each provider races its deadline —
|
|
361
|
+
* {@link PROVIDER_DEADLINE_MS} by default, a provider's own `deadlineMs`
|
|
362
|
+
* (capped at {@link MAX_PROVIDER_DEADLINE_MS}) when declared — so one
|
|
363
|
+
* hung provider can't permanently suppress the ghosts of providers
|
|
364
|
+
* behind it. Returns null when aborted or nothing matched.
|
|
365
|
+
*/
|
|
366
|
+
async function resolveInlineSuggestion(providers, ctx, deadlineMs = PROVIDER_DEADLINE_MS, maxDeadlineMs = MAX_PROVIDER_DEADLINE_MS) {
|
|
367
|
+
const TIMEOUT = Symbol("timeout");
|
|
368
|
+
for (const provider of providers) {
|
|
369
|
+
if (ctx.signal.aborted) return null;
|
|
370
|
+
try {
|
|
371
|
+
let timer;
|
|
372
|
+
const budget = provider.deadlineMs !== void 0 ? Math.min(Math.max(provider.deadlineMs, 1), maxDeadlineMs) : deadlineMs;
|
|
373
|
+
const result = await Promise.race([Promise.resolve(provider.suggest(ctx)), new Promise((r) => {
|
|
374
|
+
timer = setTimeout(r, budget, TIMEOUT);
|
|
375
|
+
})]);
|
|
376
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
377
|
+
if (result === TIMEOUT) continue;
|
|
378
|
+
if (ctx.signal.aborted) return null;
|
|
379
|
+
const suffixes = (typeof result === "string" ? [result] : result ?? []).filter((s) => typeof s === "string" && s.length > 0);
|
|
380
|
+
if (suffixes.length > 0) return {
|
|
381
|
+
suffixes,
|
|
382
|
+
providerId: provider.id
|
|
383
|
+
};
|
|
384
|
+
} catch {}
|
|
385
|
+
}
|
|
386
|
+
return null;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Extract the whitespace-delimited token that ends at `cursor`. Returns
|
|
390
|
+
* null when the cursor sits right after whitespace (nothing to complete).
|
|
391
|
+
*/
|
|
392
|
+
function tokenEndingAtCursor(text, cursor) {
|
|
393
|
+
const match = text.slice(0, cursor).match(/\S+$/);
|
|
394
|
+
return match ? match[0] : null;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Does this token carry an explicit path shape (`/` separator or a `~`
|
|
398
|
+
* prefix)? Path-shaped tokens complete from the first character after
|
|
399
|
+
* the separator; bare tokens (`sr` → `c/`) still complete against the
|
|
400
|
+
* cwd listing but need ≥2 chars first — see the provider.
|
|
401
|
+
*/
|
|
402
|
+
function looksLikePath(token) {
|
|
403
|
+
return token.includes("/") || token.startsWith("~");
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Cap on candidates returned for an ambiguous fragment — rotation past
|
|
407
|
+
* a dozen-odd entries stops being faster than typing another character.
|
|
408
|
+
*/
|
|
409
|
+
const MAX_PATH_CANDIDATES = 16;
|
|
410
|
+
function defaultReaddir(dir) {
|
|
411
|
+
return readdirSync(dir, { withFileTypes: true }).map((e) => ({
|
|
412
|
+
name: e.name,
|
|
413
|
+
isDirectory: e.isDirectory()
|
|
414
|
+
}));
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Built-in provider: complete filesystem paths under `cwd` (or absolute /
|
|
418
|
+
* `~` paths). Given the token `src/chat/comp`, lists `src/chat/` and
|
|
419
|
+
* returns every matching continuation of `comp` as a candidate list —
|
|
420
|
+
* directories first, alphabetical, `/`-terminated for directories so
|
|
421
|
+
* typing can continue. The host ghosts the first candidate and rotates
|
|
422
|
+
* through the rest on up/down.
|
|
423
|
+
*
|
|
424
|
+
* Bare tokens (no `/` yet) are matched against the cwd listing too, so
|
|
425
|
+
* a directory ghost appears as soon as the first characters of `src`
|
|
426
|
+
* are typed — but only from the second character on, so 1-letter prose
|
|
427
|
+
* words don't ghost-spam.
|
|
428
|
+
*
|
|
429
|
+
* Dotfiles are only offered when the typed fragment itself starts with
|
|
430
|
+
* `.` — the usual completion convention.
|
|
431
|
+
*/
|
|
432
|
+
function createPathAutocompleteProvider(opts = {}) {
|
|
433
|
+
const readdir = opts.io?.readdir ?? defaultReaddir;
|
|
434
|
+
const fallbackCwd = opts.cwd ?? (() => process.cwd());
|
|
435
|
+
return {
|
|
436
|
+
id: "paths",
|
|
437
|
+
suggest(ctx) {
|
|
438
|
+
const token = tokenEndingAtCursor(ctx.text, ctx.cursor);
|
|
439
|
+
if (!token) return null;
|
|
440
|
+
if (!looksLikePath(token) && token.length < 2) return null;
|
|
441
|
+
const expanded = token.startsWith("~") ? join(homedir(), token.slice(1)) : token;
|
|
442
|
+
const endsWithSep = expanded.endsWith("/");
|
|
443
|
+
const dirPart = endsWithSep ? expanded : dirname(expanded);
|
|
444
|
+
const fragment = endsWithSep ? "" : basename(expanded);
|
|
445
|
+
const baseCwd = ctx.cwd || fallbackCwd();
|
|
446
|
+
const dir = isAbsolute(dirPart) ? dirPart : resolve(baseCwd, dirPart);
|
|
447
|
+
let entries;
|
|
448
|
+
try {
|
|
449
|
+
entries = readdir(dir);
|
|
450
|
+
} catch {
|
|
451
|
+
return null;
|
|
452
|
+
}
|
|
453
|
+
const matches = entries.filter((e) => e.name.startsWith(fragment) && (fragment.startsWith(".") || !e.name.startsWith(".")));
|
|
454
|
+
matches.sort((a, b) => a.isDirectory !== b.isDirectory ? a.isDirectory ? -1 : 1 : a.name.localeCompare(b.name));
|
|
455
|
+
const suffixes = matches.map((e) => e.name.slice(fragment.length) + (e.isDirectory ? "/" : "")).filter((s) => s.length > 0).slice(0, MAX_PATH_CANDIDATES);
|
|
456
|
+
return suffixes.length > 0 ? suffixes : null;
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Optimistically transform the current ghost across a buffer edit so it
|
|
462
|
+
* stays visible while the debounced provider re-query is in flight —
|
|
463
|
+
* without this, every keystroke inside a completable token blinks the
|
|
464
|
+
* ghost (hide → 120 ms → reshow).
|
|
465
|
+
*
|
|
466
|
+
* Two edits are reconcilable (everything else returns null and waits for
|
|
467
|
+
* the authoritative result):
|
|
468
|
+
* - typing FORWARD along the suggestion (`bi` → `bin` with ghost
|
|
469
|
+
* `n/`): candidates are filtered to those starting with the typed
|
|
470
|
+
* chars and trimmed;
|
|
471
|
+
* - deleting BACKWARD within the token (`bin` → `bi` with ghost `/`):
|
|
472
|
+
* the deleted chars are re-prepended to every candidate. Guarded to
|
|
473
|
+
* non-whitespace so crossing a token boundary drops the ghost.
|
|
474
|
+
*
|
|
475
|
+
* The patched ghost is provisional — the provider's answer replaces it
|
|
476
|
+
* (and may add candidates the patch couldn't know about).
|
|
477
|
+
*/
|
|
478
|
+
function patchInlineGhost(prev, text, cursor) {
|
|
479
|
+
if (!prev) return null;
|
|
480
|
+
if (text === prev.text && cursor === prev.cursor) return prev;
|
|
481
|
+
if (text.slice(cursor) !== prev.text.slice(prev.cursor)) return null;
|
|
482
|
+
if (cursor > prev.cursor) {
|
|
483
|
+
if (text.slice(0, prev.cursor) !== prev.text.slice(0, prev.cursor)) return null;
|
|
484
|
+
const typed = text.slice(prev.cursor, cursor);
|
|
485
|
+
const shown = prev.suffixes[prev.index];
|
|
486
|
+
const suffixes = prev.suffixes.filter((s) => s.startsWith(typed) && s.length > typed.length).map((s) => s.slice(typed.length));
|
|
487
|
+
if (suffixes.length === 0) return null;
|
|
488
|
+
const shownTrimmed = shown.startsWith(typed) ? shown.slice(typed.length) : null;
|
|
489
|
+
return {
|
|
490
|
+
suffixes,
|
|
491
|
+
index: shownTrimmed !== null ? Math.max(0, suffixes.indexOf(shownTrimmed)) : 0,
|
|
492
|
+
text,
|
|
493
|
+
cursor
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
if (prev.text.slice(0, cursor) !== text.slice(0, cursor)) return null;
|
|
497
|
+
const deleted = prev.text.slice(cursor, prev.cursor);
|
|
498
|
+
if (deleted.length === 0 || /\s/.test(deleted)) return null;
|
|
499
|
+
return {
|
|
500
|
+
suffixes: prev.suffixes.map((s) => deleted + s),
|
|
501
|
+
index: prev.index,
|
|
502
|
+
text,
|
|
503
|
+
cursor
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
//#endregion
|
|
507
|
+
export { generateStructuredData as a, shouldAutoGenerateTitle as c, zodToJsonSchema as d, commandBlockToEvent as f, parseCommandInvocation as g, executeCommand as h, tokenEndingAtCursor as i, isStandardSchema as l, commandSteps as m, patchInlineGhost as n, cleanTitle as o, commandBlocksToContent as p, resolveInlineSuggestion as r, generateSessionTitle as s, createPathAutocompleteProvider as t, resolveSchemaInput as u };
|
|
323
508
|
|
|
324
|
-
//# sourceMappingURL=
|
|
509
|
+
//# sourceMappingURL=inline-autocomplete-BAwBcZtD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-autocomplete-BAwBcZtD.js","names":[],"sources":["../src/chat/commands.ts","../src/zod.ts","../src/chat/generate-title.ts","../src/chat/generate-data.ts","../src/chat/inline-autocomplete.ts"],"sourcesContent":["/**\n * `/` command model — an extension-contributed workflow invoked by typing\n * `/<name> [args]` as the whole prompt. A command is an ordered list of\n * handler **steps**; a bare `run` is sugar for a single step. Steps share a\n * mutable `data` bag, emit local output blocks (rendered in the transcript,\n * never sent to the model), and can drive the agent via `ctx.runAgent` so a\n * workflow can interact with the LLM mid-flight.\n *\n * This module is renderer-free and node-free: the types are the authoring\n * surface extensions compile against, and `executeCommand` / the parse\n * helper are pure so they're unit-testable without a TUI. The host supplies\n * the side-effecting capabilities on the step context: `emit` (render +\n * persist local output), `runAgent` (interactive sub-run), `generateData`\n * (silent schema-pinned JSON), and the optional `session` (read-only view)\n * and `interaction` (confirm / forms / plan approval) surfaces.\n */\n\nimport type { Logger } from '../logger'\nimport type { SessionRun } from '../session'\nimport type { JsonValue, SessionTurn } from '../types'\nimport type { InferSchemaOutput, SchemaInput, StandardSchemaLike } from '../zod'\nimport type { AnswerValue, PlanPayload, PlanResponse, QuestionPayload } from './interactions'\nimport type { StreamEvent } from './types'\n\n/**\n * A block of local output a step renders into the chat.\n *\n * Plain blocks (`text` only) render as full markdown, both live and on\n * reload — use them for the output the user should read in full (e.g. a\n * final commit message). Blocks with `detail` render as a collapsed\n * `command-detail` row instead (dim `▸ label` + line-capped body with\n * \"… N more lines\") — use them for bulky supporting output (diffs, logs,\n * listings) that shouldn't drown the transcript.\n */\nexport interface CommandOutputBlock {\n /**\n * The block body — full markdown, the detail body, or (for `custom`\n * blocks) the MANDATORY fallback markdown rendered wherever the\n * renderer isn't available: extension uninstalled or disabled,\n * headless host, GUI, renderer threw. The fallback is what persists\n * as the block's output, so pre-custom hosts render it natively.\n */\n text: string\n /**\n * Render as a collapsed detail row (dim `▸ label` + line-capped body)\n * instead of full markdown. `syntax: 'diff'` additionally colors\n * `+N` / `−N` count tokens (added green / deleted red) in both label\n * and body — for diff-stat-style output.\n */\n detail?: { label?: string, syntax?: 'diff' }\n /**\n * Render through an extension-registered custom renderer\n * (`ctx.tui.registerRenderer`). `renderer` must be the NAMESPACED id\n * (`<extension>/<id>`) — `ctx.appendNote` auto-prefixes bare ids for\n * its own extension; command `emit` requires the full form. `data`\n * must be JSON-safe (it persists in the session). Takes precedence\n * over `detail` when both are set.\n */\n custom?: { renderer: string, data?: JsonValue }\n}\n\n/**\n * User-interaction surface for commands — the same prompt-slot primitives\n * the `ask_user` / `present_plan` TOOLS render, but WITHOUT the tools: a\n * command enqueues directly into the host's interaction queue. No tool\n * calls, no turns, no model involvement — the answer routes straight back\n * to the awaiting step. Every method rejects on cancel/esc, which the\n * executor classifies as a quiet abort.\n */\nexport interface CommandInteraction {\n /**\n * One-tap yes/no — sugar over a single `confirm`-type question:\n *\n * if (await ctx.interaction.confirm('Push to origin/main?')) …\n */\n confirm: (prompt: string, opts?: {\n /** Optional context shown above the question (Markdown). */\n intro?: string\n /** Label for the affirmative option. Default `'yes'`. */\n affirmLabel?: string\n /** Label for the negative option. Default `'no'`. */\n denyLabel?: string\n }) => Promise<boolean>\n /**\n * Show a form (text / textarea / select / confirm questions — identical\n * UI to the ask_user tool) and resolve with the answers keyed by\n * `Question.id` (`string` for text/select, `boolean` for confirm,\n * `string[]` of choice ids for `multi: true` selects).\n */\n askUser: (form: QuestionPayload) => Promise<Readonly<Record<string, AnswerValue>>>\n /**\n * Present a plan for the full approval ceremony (approve / reject /\n * revise + optional comment — identical UI to present_plan). For\n * lightweight gating prefer {@link confirm}.\n */\n presentPlan: (plan: PlanPayload) => Promise<PlanResponse>\n}\n\n/**\n * Read-only view over the session a command runs inside — live getters, so\n * turns appended mid-workflow (e.g. by a `runAgent` sub-run) are visible on\n * the next read. Deliberately projection-only: no mutators, so commands\n * can't bypass the display-only `command`-turn contract or the wire guard\n * (`isWireTurn`). Persisting output goes through `emit`; driving the\n * conversation goes through `runAgent`.\n */\nexport interface CommandSessionView {\n readonly id: string\n /** Full persisted history, including display-only `command` turns. */\n readonly turns: readonly SessionTurn[]\n /** Run records (status, usage, cost, `origin`, …), newest last. */\n readonly runs: readonly SessionRun[]\n readonly metadata: Readonly<Record<string, unknown>>\n}\n\n/** Options for `ctx.generateData` — a silent, schema-pinned model call. */\nexport interface CommandGenerateDataOptions {\n /** Instruction describing the value to produce. */\n prompt: string\n /**\n * Shape of the result — a zod v4 schema (return type inferred, no casts)\n * or a plain JSON Schema object (name the type via the generic).\n */\n schema: SchemaInput\n /** Optional system prompt override. */\n system?: string\n /**\n * Fold a compacted transcript of the recent conversation into the call as\n * context. Default false — most workflow values derive from data the\n * command already gathered itself.\n */\n includeConversation?: boolean\n /**\n * Model id to run the call on (must exist in the host's model catalog —\n * see `ctx.runtime.models()` on the extension context). Omit to use the\n * session's active model.\n */\n model?: string\n}\n\n/** One task for {@link CommandStepContext.spawnAgents} — an isolated child agent run. */\nexport interface CommandSpawnTask {\n /** Task prompt for the child agent. Brief it like a colleague — it has no conversation context. */\n prompt: string\n /**\n * Model id from the host catalog (`ctx.runtime.models()` on the extension\n * context). Omit to inherit the session's active model. Unknown ids reject\n * the task (`status: 'rejected'`) without running anything.\n */\n model?: string\n /** System prompt override for the child. Inherits the agent's system prompt when omitted. */\n system?: string\n /** Short display label carried back on the result (defaults to the child id). */\n label?: string\n}\n\n/** Outcome of one {@link CommandSpawnTask}. */\nexport interface CommandSpawnResult {\n /** The task's `label` (or the child id when none was given). */\n label: string\n /** Model the task asked for, when pinned. */\n model?: string\n /** Terminal status. `'rejected'` = refused before running (unknown model, caps). */\n status: 'completed' | 'aborted' | 'timeout' | 'error' | 'rejected'\n /** The child's final assistant text. Empty unless `status === 'completed'`. */\n text: string\n /** Full formatted result / diagnostic (always set; useful for non-completed statuses). */\n message: string\n}\n\n/** Result of driving the agent from within a step via `ctx.runAgent`. */\nexport interface CommandAgentResult {\n /** The assistant's final text for this sub-run. */\n text: string\n}\n\n/** Capabilities + inputs handed to every step. */\nexport interface CommandStepContext {\n /** Raw text after `/<name>` (trimmed of the leading space). */\n readonly args: string\n /** `args` split on whitespace, empties removed. */\n readonly argv: readonly string[]\n /** Mutable bag threaded across steps; a step's returned `data` is merged in. */\n readonly data: Record<string, unknown>\n /** Render + persist a local output block. */\n readonly emit: (block: CommandOutputBlock) => void\n /**\n * Drive one agent run to completion and return its result. The prompt is\n * injected as a real user turn (model-visible, unchanged on the wire) and\n * the response streams into the transcript. Serialized with the host's run\n * slot, so a workflow can interleave deterministic steps with LLM\n * interaction. Any output `emit`ted before this call is flushed first,\n * preserving transcript order.\n *\n * `opts.display` replaces the full-prompt echo in the transcript with a\n * short line (the full prompt still renders beneath it as a collapsed\n * detail row, and still reaches the model verbatim) — pass it when the\n * prompt embeds bulky material like a diff.\n */\n readonly runAgent: (prompt: string, opts?: { readonly display?: string }) => Promise<CommandAgentResult>\n /**\n * Generate schema-conforming JSON with ONE silent model call — no session\n * turns, no transcript output, nothing added to the conversation (the\n * workflow presents results itself via `emit`). Reach for this when a\n * step needs a VALUE (a commit message, a classification, extracted\n * fields); reach for `runAgent` when it needs an interactive sub-run\n * with tools and streaming.\n */\n readonly generateData: {\n /** zod v4 schema → the result type is inferred from the schema. */\n <S extends StandardSchemaLike>(opts: Omit<CommandGenerateDataOptions, 'schema'> & { schema: S }): Promise<InferSchemaOutput<S>>\n /** Plain JSON Schema → name the result type explicitly. */\n <T = unknown>(opts: CommandGenerateDataOptions): Promise<T>\n }\n /** Logger with a `command=<name>` binding, routed to the host's log funnel. */\n readonly logger: Logger\n /** Aborts when the user presses esc during execution. */\n readonly signal: AbortSignal\n /** Working directory the command runs against. */\n readonly cwd: string\n /**\n * The surrounding session, when the host runs commands inside one (the\n * TUI always does). ABSENT in session-less contexts — a command that\n * reads it must guard (`if (!ctx.session) …`) or degrade gracefully.\n */\n readonly session?: CommandSessionView\n /**\n * User interaction (confirm / forms / plan approval), when the host has\n * an interactive surface (the TUI always does). ABSENT on UI-less hosts\n * — guard (`if (!ctx.interaction) …`) and degrade gracefully.\n */\n readonly interaction?: CommandInteraction\n /**\n * Run one or more ISOLATED child agents — each with its own context\n * window and the full tool set, optionally pinned to a different model\n * — and resolve when the whole batch settles. Tasks run in parallel\n * (bounded by `opts.maxConcurrent`, default 3). Children stream and\n * persist into the transcript exactly like `spawn`-tool subagents, so\n * the user sees their activity live and on reload; their context stays\n * isolated from the conversation.\n *\n * Complements {@link runAgent}: `runAgent` drives THE conversation\n * (model-visible turns, active model, serialized); `spawnAgents` fans\n * work out to throwaway workers. Results come back to the command —\n * persist what matters via {@link emit} (user-facing) and\n * {@link appendContext} (model-facing).\n *\n * ABSENT on hosts without an agent (guard like `session`).\n */\n readonly spawnAgents?: (\n tasks: readonly CommandSpawnTask[],\n opts?: { readonly maxConcurrent?: number },\n ) => Promise<readonly CommandSpawnResult[]>\n /**\n * Persist a compact MODEL-VISIBLE context note — a real user-role turn,\n * sent on the wire unchanged from the next run onward, without\n * triggering a run now. This is how a command's outcome becomes part of\n * the conversation: the next user prompt sees what the workflow\n * found/did without replaying subagent transcripts.\n *\n * `opts.display` swaps the transcript echo for a short one-line marker —\n * live AND on reload (the marker persists on the turn; replay renders it\n * with the full note as a collapsed detail), so note bodies the command\n * also emitted never display twice. Keep notes compact regardless — they\n * occupy context for the rest of the conversation. ABSENT on session-less\n * hosts.\n */\n readonly appendContext?: (text: string, opts?: { readonly display?: string }) => Promise<void>\n}\n\n/** Optional per-step return — `data` is merged into the shared bag for later steps. */\nexport interface CommandStepResult {\n data?: Record<string, unknown>\n}\n\nexport type CommandStepFn = (\n ctx: CommandStepContext,\n) => void | CommandStepResult | Promise<void | CommandStepResult>\n\nexport interface CommandStep {\n run: CommandStepFn\n}\n\n/** One argument suggestion returned by {@link Command.completeArgs}. */\nexport interface CommandArgSuggestion {\n /** Text inserted after `/<name> ` on accept. */\n value: string\n /** Display label. Defaults to `value`. */\n label?: string\n description?: string\n}\n\n/** An extension-contributed `/` command. Provide EITHER `run` (one step) or `steps`. */\nexport interface Command {\n /** Invoked as `/<name>`. Lowercase, no whitespace. */\n name: string\n /**\n * Alternate invocation names (same constraints as `name`). `/alias`\n * dispatches to this command; the popover shows the canonical name and\n * lists aliases in the description. Aliases participate in the same\n * first-registration-wins dedupe as names.\n */\n aliases?: readonly string[]\n /**\n * Grouping key for completion — the registry stamps the source\n * extension's name here, so typing `/<extension>` in the popover lists\n * every command that extension contributes. Not an invocation name:\n * `parseCommandInvocation` ignores it.\n */\n group?: string\n /** One-line summary shown in the completion popover. */\n description: string\n /** Single-step sugar. */\n run?: CommandStepFn\n /** Explicit ordered pipeline. Takes precedence over `run` when both are set. */\n steps?: readonly CommandStep[]\n /**\n * Argument completion — called while the user types `/<name> <prefix>▌`\n * with everything after the command name (may itself contain spaces).\n * Return suggestions to show in the `/` popover; return `[]`/`undefined`\n * for none. Sync or async.\n */\n completeArgs?: (argsPrefix: string) => readonly CommandArgSuggestion[] | undefined | Promise<readonly CommandArgSuggestion[] | undefined>\n}\n\n/**\n * Persisted form of output blocks inside a display-only `command` turn:\n * plain blocks → `text` content; `detail` blocks → `tool_result` content\n * with the label/syntax carried in namespaced metadata (rebuilt into the\n * collapsed rendering on reload). Shared by the command emit flush and\n * `ctx.appendNote` so both persist identically.\n */\nexport function commandBlocksToContent(blocks: readonly CommandOutputBlock[]): SessionTurn['content'] {\n return blocks.map((block) => {\n if (!block.detail && !block.custom)\n return { type: 'text' as const, text: block.text }\n // Custom blocks persist with the FALLBACK as the output — an older\n // zidane (or any host without the renderer) reads this turn as a\n // plain detail block and renders the fallback natively. The renderer\n // binding rides namespaced metadata, exactly like detail label/syntax.\n const commandMeta: Record<string, JsonValue> = block.custom\n ? { custom: { renderer: block.custom.renderer, ...(block.custom.data !== undefined ? { data: block.custom.data } : {}) } }\n : {\n ...(block.detail?.label ? { label: block.detail.label } : {}),\n ...(block.detail?.syntax ? { syntax: block.detail.syntax } : {}),\n }\n return {\n type: 'tool_result' as const,\n callId: `command_detail_${crypto.randomUUID()}`,\n output: block.text,\n ...(Object.keys(commandMeta).length > 0 ? { metadata: { command: commandMeta } } : {}),\n }\n })\n}\n\n/**\n * Map ONE command-output block to its LIVE transcript event — the\n * in-memory mirror of {@link commandBlocksToContent}'s persisted shape\n * (whose replay side lives in `eventsFromTurns`). One definition shared\n * by the command emit flush and the `ctx.appendNote` host impl so live\n * rendering can never drift from reloaded rendering — the exact drift\n * that shipped `custom` blocks rendering only after a reload.\n *\n * Precedence matches the persisted side: `custom` > `detail` > markdown.\n */\nexport function commandBlockToEvent(block: CommandOutputBlock): StreamEvent {\n if (block.custom) {\n return {\n kind: 'custom',\n text: block.text,\n custom: {\n renderer: block.custom.renderer,\n ...(block.custom.data !== undefined ? { data: block.custom.data } : {}),\n },\n }\n }\n if (block.detail) {\n return {\n kind: 'command-detail',\n text: block.text,\n ...(block.detail.label ? { label: block.detail.label } : {}),\n ...(block.detail.syntax ? { syntax: block.detail.syntax } : {}),\n }\n }\n return { kind: 'markdown', text: block.text, streaming: false }\n}\n\n/** Normalize a command to its ordered step list (`steps` wins over `run`). */\nexport function commandSteps(command: Command): readonly CommandStep[] {\n if (command.steps && command.steps.length > 0)\n return command.steps\n if (command.run)\n return [{ run: command.run }]\n return []\n}\n\n/** Parsed `/<name> [args]` invocation. */\nexport interface CommandInvocation {\n name: string\n /** Text after the name, trimmed. */\n args: string\n /** `args` split on whitespace. */\n argv: string[]\n}\n\n/**\n * Parse a prompt as a command invocation, but only when the command token is\n * the LEADING token of the whole prompt and names a known command. This is\n * what keeps mid-prompt `/skill` mentions routed to the skills provider:\n * `\"summarize /research\"` is not a command, `\"/research foo\"` is.\n *\n * `known` is matched case-insensitively; entries may be bare names or\n * `{ name, aliases }` records — an alias hit canonicalizes to the entry's\n * `name` (registered casing), so dispatch-by-name downstream just works.\n */\nexport function parseCommandInvocation(\n prompt: string,\n known: readonly (string | Pick<Command, 'name' | 'aliases'>)[],\n): CommandInvocation | null {\n const body = prompt.trimStart()\n if (body[0] !== '/')\n return null\n // First token = the command name; the remainder (after the first run of\n // whitespace) is the args. Linear scan — no backtracking-prone regex.\n const afterSlash = body.slice(1)\n const wsIdx = afterSlash.search(/\\s/)\n const typed = (wsIdx === -1 ? afterSlash : afterSlash.slice(0, wsIdx)).toLowerCase()\n if (typed.length === 0)\n return null\n let canonical: string | undefined\n for (const entry of known) {\n const name = typeof entry === 'string' ? entry : entry.name\n if (name.toLowerCase() === typed) {\n canonical = name\n break\n }\n if (typeof entry !== 'string' && entry.aliases?.some(a => a.toLowerCase() === typed)) {\n canonical = name\n break\n }\n }\n if (canonical === undefined)\n return null\n const args = (wsIdx === -1 ? '' : afterSlash.slice(wsIdx + 1)).trim()\n return { name: canonical, args, argv: args.length > 0 ? args.split(/\\s+/) : [] }\n}\n\n/** Outcome of a command run. `error` is set when a step threw (pipeline stops). */\nexport interface CommandExecution {\n ok: boolean\n /** Number of steps that ran (including the one that threw). */\n ranSteps: number\n error?: unknown\n /** True when the run stopped because `ctx.signal` aborted. */\n aborted?: boolean\n}\n\n/**\n * Run a command's steps in order, threading `ctx.data`. Stops at the first\n * step that throws (error isolated + returned, not rethrown) or when the\n * signal aborts. Pure orchestration — all I/O lives in the host-supplied\n * `ctx` capabilities.\n */\nexport async function executeCommand(\n command: Command,\n ctx: CommandStepContext,\n): Promise<CommandExecution> {\n const steps = commandSteps(command)\n let ranSteps = 0\n for (const step of steps) {\n if (ctx.signal.aborted)\n return { ok: false, ranSteps, aborted: true }\n ranSteps++\n try {\n const result = await step.run(ctx)\n if (result && result.data)\n Object.assign(ctx.data, result.data)\n }\n catch (error) {\n // An esc mid-step usually surfaces as a thrown AbortError from whatever\n // I/O the handler had in flight. Classify by the signal so hosts can\n // stay quiet on user-initiated aborts instead of painting an error.\n if (ctx.signal.aborted)\n return { ok: false, ranSteps, aborted: true }\n return { ok: false, ranSteps, error }\n }\n }\n return { ok: true, ranSteps }\n}\n","/**\n * Zod v4 integration helpers.\n *\n * Zod is an OPTIONAL peer dependency, so this module never imports it at the\n * top level. Schema-accepting APIs (`ctx.generateData`, `generateStructuredData`)\n * take either a plain JSON Schema object or any Standard-Schema-carrying\n * value (https://standardschema.dev — zod v4 implements it). Zod schemas are\n * detected structurally by vendor and converted with a lazy\n * `import('zod')` — safe because whoever constructed the schema necessarily\n * has zod installed. Result types are inferred from the standard-schema\n * `types.output` slot, so callers get full typing without a single cast:\n *\n * const CommitMessage = z.object({ subject: z.string(), body: z.string().optional() })\n * const msg = await ctx.generateData({ prompt, schema: CommitMessage })\n * // ^? { subject: string, body?: string }\n */\n\n/**\n * Structural stand-in for a Standard Schema (zod v4 et al.) — enough surface\n * to detect the vendor and infer the output type WITHOUT importing zod's\n * types into our public API.\n */\nexport interface StandardSchemaLike<Output = unknown> {\n readonly '~standard': {\n readonly version: number\n readonly vendor: string\n /** Type-level only (undefined at runtime) — carries the inferred output type. */\n readonly types?: { readonly output: Output } | undefined\n }\n}\n\n/** Output type carried by a {@link StandardSchemaLike}; `unknown` for plain JSON Schema. */\nexport type InferSchemaOutput<S> = S extends StandardSchemaLike<infer O> ? O : unknown\n\n/** A schema-accepting input: plain JSON Schema, or a Standard Schema (e.g. zod v4). */\nexport type SchemaInput = Record<string, unknown> | StandardSchemaLike\n\nexport function isStandardSchema(value: unknown): value is StandardSchemaLike {\n if (typeof value !== 'object' || value === null)\n return false\n const marker = (value as Record<string, unknown>)['~standard']\n return typeof marker === 'object' && marker !== null\n && typeof (marker as Record<string, unknown>).vendor === 'string'\n}\n\n/**\n * Resolve a {@link SchemaInput} to the plain JSON Schema object providers\n * expect. Zod schemas convert via the lazily-imported `z.toJSONSchema`\n * (v4 native); other Standard Schema vendors are rejected with a clear\n * error — conversion is vendor-specific and only zod is wired today.\n */\nexport async function resolveSchemaInput(schema: SchemaInput): Promise<Record<string, unknown>> {\n if (!isStandardSchema(schema))\n return schema\n const vendor = schema['~standard'].vendor\n if (vendor !== 'zod') {\n throw new Error(\n `unsupported schema vendor \"${vendor}\" — pass a zod v4 schema or a plain JSON Schema object`,\n )\n }\n // Lazy + guarded: zod is an optional peer, but a zod schema in hand means\n // the caller's process has zod — this import only fails on truly broken\n // installs, and then with an actionable message.\n let toJSONSchema: (schema: unknown) => Record<string, unknown>\n try {\n const zod = await import('zod')\n toJSONSchema = zod.z.toJSONSchema as typeof toJSONSchema\n }\n catch {\n throw new Error('a zod schema was passed but the \"zod\" package could not be imported — install zod >= 4')\n }\n return zodToJsonSchema(toJSONSchema(schema))\n}\n\n/**\n * Normalize a JSON Schema (e.g. from zod v4's z.toJSONSchema()) for use\n * as a ToolSpec.inputSchema.\n *\n * Strips the $schema key that some providers reject.\n */\nexport function zodToJsonSchema(jsonSchema: Record<string, unknown>): Record<string, unknown> {\n const { $schema, ...rest } = jsonSchema\n return rest\n}\n","/**\n * One-shot title generation for an existing session — feeds the last N\n * turns to the provider with a \"write me a title\" system prompt and\n * returns the cleaned-up result.\n *\n * Provider-agnostic: works with anything implementing the renderer-\n * shared `Provider` interface. No tools, no session mutation, no\n * caching — this is a cheap, isolated completion that should be safe to\n * fire even mid-session without touching the live agent loop.\n */\n\nimport type { Provider } from '../providers'\nimport type { SessionTurn } from '../types'\n\n/** Hard cap on the result length. Anything longer is truncated client-side. */\nconst TITLE_MAX_CHARS = 60\n\n/** Default turn count fed to the model. 10 covers most exchanges without bloat. */\nconst DEFAULT_MAX_TURNS = 10\n\n/** Tokens budgeted for the model's reply. 64 fits any sane title with headroom. */\nconst TITLE_RESPONSE_MAX_TOKENS = 64\n\n/** Per-turn body cap when assembling the prompt — keeps the request payload tight. */\nconst PROMPT_TURN_CHAR_MAX = 2000\n\nexport interface GenerateSessionTitleOptions {\n provider: Provider\n /** Model id used for the call. */\n model: string\n /** Conversation history to summarize. Empty → throws synchronously. */\n turns: readonly SessionTurn[]\n /** Cap on how many trailing turns to feed the model. Defaults to 10. */\n maxTurns?: number\n /** Optional cancellation signal — forwarded to the provider's stream. */\n signal?: AbortSignal\n}\n\n/**\n * Drive the provider's `stream()` once and return a concise title for\n * the conversation represented by `turns`. Throws when:\n * - `turns` contains no text-bearing content (nothing to summarize),\n * - the provider stream completes with no output text,\n * - `signal` is aborted (rethrown verbatim).\n *\n * Output is trimmed, single-line, with surrounding quotes / trailing\n * punctuation stripped, and truncated to `TITLE_MAX_CHARS`.\n */\nexport async function generateSessionTitle({\n provider,\n model,\n turns,\n maxTurns = DEFAULT_MAX_TURNS,\n signal,\n}: GenerateSessionTitleOptions): Promise<string> {\n const slice = turns.slice(-Math.max(1, maxTurns))\n const transcript = renderTurnsForPrompt(slice)\n if (!transcript)\n throw new Error('No text content in the recent turns to summarize.')\n\n const system = [\n 'You generate concise, descriptive titles for chat conversations.',\n 'Reply with ONLY the title — no quotes, no markdown, no trailing punctuation,',\n 'no preamble (do not say \"Title:\" or similar).',\n `Aim for 3 to 7 words and stay under ${TITLE_MAX_CHARS} characters.`,\n ].join(' ')\n\n const userPrompt = `Generate a title for this conversation:\\n\\n${transcript}`\n\n let text = ''\n const result = await provider.stream(\n {\n model,\n system,\n tools: [],\n messages: [provider.userMessage(userPrompt)],\n maxTokens: TITLE_RESPONSE_MAX_TOKENS,\n ...(signal ? { signal } : {}),\n },\n {\n onText: (delta) => { text += delta },\n },\n )\n // Prefer the streamed-text accumulator (driven by deltas) but fall\n // back to the provider's already-concatenated `result.text` for\n // adapters that batch on the final frame instead of emitting deltas.\n const raw = text.trim().length > 0 ? text : result.text\n return cleanTitle(raw)\n}\n\n/**\n * Decide whether a session is ready for one-shot automatic titling.\n *\n * Returns `true` iff the conversation has had its first exchange — at\n * least two turns, i.e. the opening user message plus the assistant's\n * reply (this is exactly the \"N turns\" count the sessions list shows) —\n * AND no explicit title has been set yet. An existing `metadata.title`\n * (a previous auto-generation, or a manual title from the session-details\n * \"generate title\" action) is never clobbered.\n *\n * Pure + total. The runtime layers its own \"is one already in flight?\"\n * and \"is a provider picked?\" guards on top of this; the predicate only\n * encodes the content-level rule so it can be pinned in tests without a\n * mock provider — same rationale as the exported {@link cleanTitle}.\n */\nexport function shouldAutoGenerateTitle(\n turns: readonly SessionTurn[],\n metadata?: Record<string, unknown>,\n): boolean {\n const existing = typeof metadata?.title === 'string' ? metadata.title.trim() : ''\n if (existing.length > 0)\n return false\n return turns.length >= 2\n}\n\n/**\n * Compact a turn list into a transcript-style prompt:\n *\n * user: …\n * assistant: …\n * user: …\n *\n * Tool calls and tool results are summarized to keep the request\n * payload small — the model needs the rough flow of the conversation,\n * not full JSON blobs. Per-turn text is clipped at `PROMPT_TURN_CHAR_MAX`\n * so a single huge code dump doesn't blow the budget.\n *\n * Returns an empty string when the slice has no text-bearing content\n * (e.g. a turn list that's only tool plumbing).\n *\n * Exported for reuse by other silent one-shot helpers (`generate-data`'s\n * optional conversation context) so every side-channel inference compacts\n * history the same way.\n */\nexport function renderTurnsForPrompt(turns: readonly SessionTurn[]): string {\n const lines: string[] = []\n for (const turn of turns) {\n const body = textBodyOf(turn)\n if (!body)\n continue\n const role = turn.role === 'assistant' ? 'assistant' : turn.role === 'user' ? 'user' : 'system'\n lines.push(`${role}: ${clip(body, PROMPT_TURN_CHAR_MAX)}`)\n }\n return lines.join('\\n\\n')\n}\n\nfunction textBodyOf(turn: SessionTurn): string {\n const parts: string[] = []\n for (const block of turn.content) {\n if (block.type === 'text' && block.text.trim())\n parts.push(block.text.trim())\n else if (block.type === 'tool_call')\n parts.push(`[tool: ${block.name}]`)\n else if (block.type === 'tool_result')\n parts.push(`[tool result]`)\n }\n return parts.join(' ')\n}\n\n/**\n * Normalize a model-generated title into the shape we want to persist:\n *\n * - Collapse internal whitespace + take the first line only (some\n * models emit \"Title: foo\\n\\nReason: …\" despite instructions).\n * - Strip surrounding quote characters (`\"foo\"`, `'foo'`, `` `foo` ``).\n * - Strip a leading `Title:` / `title -` prefix if the model added one.\n * - Strip trailing punctuation (`.`, `!`, `?`) — titles read cleaner\n * without it.\n * - Truncate to `TITLE_MAX_CHARS` with a trailing `…` when over.\n *\n * Exported as `cleanTitle` so tests can pin the normalization rules\n * without going through a mock provider.\n */\nexport function cleanTitle(raw: string): string {\n let s = raw.split('\\n')[0]?.trim() ?? ''\n // Strip a \"Title:\" / \"Title -\" preamble the model sometimes adds.\n s = s.replace(/^\\s*title\\s*[:\\-–—]\\s*/i, '')\n // Strip surrounding matched quotes.\n if (s.length >= 2) {\n const first = s.charAt(0)\n const last = s.charAt(s.length - 1)\n const matched = (first === '\"' && last === '\"')\n || (first === '\\'' && last === '\\'')\n || (first === '`' && last === '`')\n || (first === '“' && last === '”')\n if (matched)\n s = s.slice(1, -1).trim()\n }\n // Trim trailing terminal punctuation — titles don't take periods.\n s = s.replace(/[.!?]+$/, '').trim()\n if (s.length === 0)\n throw new Error('Model returned an empty title.')\n return s.length > TITLE_MAX_CHARS ? `${s.slice(0, TITLE_MAX_CHARS - 1)}…` : s\n}\n\nfunction clip(text: string, max: number): string {\n return text.length > max ? `${text.slice(0, max)}…` : text\n}\n","/**\n * Silent structured-output generation — one provider call that returns\n * schema-conforming JSON without touching the session or the transcript.\n *\n * Modeled on the two proven side-channel patterns in the codebase:\n * - `generate-title.ts`: a single `provider.stream()` with no session\n * writes and no transcript events (optionally seeded with a compacted\n * conversation transcript), and\n * - the loop's `__output__` schema enforcement: a synthetic tool whose\n * `inputSchema` IS the requested JSON Schema, with `toolChoice` pinned\n * so the model must answer with a conforming payload.\n *\n * Used by `/` commands via `ctx.generateData` to derive values from the\n * model (or from the conversation) mid-workflow without bloating the chat\n * history — e.g. `/commit` generating `{ subject, body }` from a diff.\n * For genuinely interactive sub-runs (real turns, streaming, tools), use\n * `ctx.runAgent` instead.\n */\n\nimport type { Provider, ToolSpec } from '../providers'\nimport type { SessionTurn } from '../types'\nimport type { InferSchemaOutput, SchemaInput, StandardSchemaLike } from '../zod'\nimport { resolveSchemaInput } from '../zod'\nimport { renderTurnsForPrompt } from './generate-title'\n\n/** Synthetic forced-choice tool name (never persisted — the call is side-channel only). */\nconst DATA_TOOL_NAME = '__data__'\n\n/** Default cap on conversation turns folded into the context block. */\nconst DEFAULT_CONTEXT_TURNS = 12\n\nexport interface GenerateStructuredDataOptions {\n provider: Provider\n model: string\n /** Instruction describing the value to produce. */\n prompt: string\n /**\n * Shape of the result — a plain JSON Schema object, or a zod v4 schema\n * (converted automatically; the return type is then inferred from it).\n * Becomes the forced tool's inputSchema.\n */\n schema: SchemaInput\n /** Optional system prompt. Defaults to a terse data-extraction persona. */\n system?: string\n /**\n * Conversation turns to fold in as compacted context (same clipping as\n * session auto-titling). Omit or pass empty for a context-free call.\n */\n turns?: readonly SessionTurn[]\n /** Cap on turns rendered into the context block. Default 12 (most recent). */\n maxContextTurns?: number\n signal?: AbortSignal\n}\n\n/**\n * Drive one schema-pinned provider call and return the conforming payload.\n * Throws when the provider returns no structured payload (and rethrows\n * aborts verbatim). The caller owns presentation — nothing is rendered or\n * persisted here.\n *\n * Pass a zod v4 schema and the return type is inferred from it; pass a\n * plain JSON Schema object and name the type via the generic.\n */\nexport async function generateStructuredData<S extends StandardSchemaLike>(\n options: GenerateStructuredDataOptions & { schema: S },\n): Promise<InferSchemaOutput<S>>\nexport async function generateStructuredData<T = unknown>(\n options: GenerateStructuredDataOptions,\n): Promise<T>\nexport async function generateStructuredData(\n options: GenerateStructuredDataOptions,\n): Promise<unknown> {\n const { provider, model, prompt, signal } = options\n const spec: ToolSpec = {\n name: DATA_TOOL_NAME,\n description: 'Return the result. The input of this call IS the answer — it must conform to the schema.',\n inputSchema: await resolveSchemaInput(options.schema),\n }\n\n const contextTurns = options.turns && options.turns.length > 0\n ? options.turns.slice(-(options.maxContextTurns ?? DEFAULT_CONTEXT_TURNS))\n : []\n const transcript = contextTurns.length > 0 ? renderTurnsForPrompt(contextTurns) : ''\n const userPrompt = transcript\n ? `<conversation>\\n${transcript}\\n</conversation>\\n\\n${prompt}`\n : prompt\n\n const result = await provider.stream(\n {\n model,\n system: options.system\n ?? `You produce structured data. Call the ${DATA_TOOL_NAME} tool exactly once with the requested value. No prose.`,\n tools: provider.formatTools([spec]),\n messages: [provider.userMessage(userPrompt)],\n toolChoice: { type: 'tool', name: DATA_TOOL_NAME },\n ...(signal ? { signal } : {}),\n },\n {\n onText: () => {},\n },\n )\n\n const payload = result.toolCalls.find(tc => tc.name === DATA_TOOL_NAME)?.input\n if (payload === undefined)\n throw new Error('generateStructuredData: the model returned no structured payload')\n return payload\n}\n","/**\n * Inline (ghost-text) autocomplete for the prompt.\n *\n * Distinct from the trigger-based completion popover (`@` files, `/`\n * commands): providers here suggest plain text SUFFIX candidates to\n * append at the cursor — the first renders as dim ghost text, up/down\n * rotates through the rest, Tab accepts. No popover.\n *\n * Providers are queried in registration order with a shared AbortSignal;\n * the engine returns the first provider's non-empty candidate list.\n * Extensions add providers via `ctx.registerInlineAutocompleteProvider`\n * — the built-in path provider ({@link createPathAutocompleteProvider})\n * is always first.\n */\n\nimport { readdirSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { basename, dirname, isAbsolute, join, resolve } from 'node:path'\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface InlineAutocompleteContext {\n /** Full prompt buffer. */\n text: string\n /** Cursor offset into `text`. Suggestions complete the token ENDING here. */\n cursor: number\n /** Workspace directory relative paths resolve against. */\n cwd: string\n /** Aborted when the buffer changes before the provider resolves. */\n signal: AbortSignal\n}\n\nexport interface InlineAutocompleteProvider {\n /** Stable id — used for first-wins dedupe across extensions. */\n id: string\n /**\n * Per-provider deadline override (ms), capped at\n * {@link MAX_PROVIDER_DEADLINE_MS}. The default\n * ({@link PROVIDER_DEADLINE_MS}) suits instant sources like directory\n * listings; a provider backed by a slow source (e.g. a local LLM) can\n * extend its own budget — the wait is async (typing is never blocked,\n * an edit aborts the query) and only delays providers ordered AFTER\n * this one.\n */\n deadlineMs?: number\n /**\n * Return the ghost suffix (or an ordered list of candidate suffixes —\n * the host shows the first and lets the user rotate with up/down) to\n * append at the cursor, or null/''/[] for no suggestion. Must respect\n * its deadline budget — it runs per keystroke (debounced by the\n * host).\n */\n suggest: (ctx: InlineAutocompleteContext) => string | readonly string[] | null | Promise<string | readonly string[] | null>\n}\n\n// ---------------------------------------------------------------------------\n// Engine\n// ---------------------------------------------------------------------------\n\n/** Default per-provider deadline — a hung provider is treated as \"no suggestion\". */\nconst PROVIDER_DEADLINE_MS = 150\n/** Hard cap on a provider's `deadlineMs` — past this, waiting for a ghost reads as broken. */\nexport const MAX_PROVIDER_DEADLINE_MS = 2_000\n\n/**\n * Query `providers` in order; the first provider yielding a non-empty\n * candidate list wins (a bare string normalizes to a 1-element list).\n * Provider errors are swallowed (a broken extension provider must not\n * break typing), and each provider races its deadline —\n * {@link PROVIDER_DEADLINE_MS} by default, a provider's own `deadlineMs`\n * (capped at {@link MAX_PROVIDER_DEADLINE_MS}) when declared — so one\n * hung provider can't permanently suppress the ghosts of providers\n * behind it. Returns null when aborted or nothing matched.\n */\nexport async function resolveInlineSuggestion(\n providers: readonly InlineAutocompleteProvider[],\n ctx: InlineAutocompleteContext,\n deadlineMs = PROVIDER_DEADLINE_MS,\n // Injectable cap — the host always uses the real MAX_PROVIDER_DEADLINE_MS;\n // tests pass a small value to prove clamping without a wall-clock stall.\n maxDeadlineMs = MAX_PROVIDER_DEADLINE_MS,\n): Promise<{ suffixes: readonly string[], providerId: string } | null> {\n const TIMEOUT = Symbol('timeout')\n for (const provider of providers) {\n if (ctx.signal.aborted)\n return null\n try {\n let timer: ReturnType<typeof setTimeout> | undefined\n const budget = provider.deadlineMs !== undefined\n ? Math.min(Math.max(provider.deadlineMs, 1), maxDeadlineMs)\n : deadlineMs\n const result = await Promise.race([\n Promise.resolve(provider.suggest(ctx)),\n new Promise<typeof TIMEOUT>((r) => { timer = setTimeout(r, budget, TIMEOUT) }),\n ])\n if (timer !== undefined)\n clearTimeout(timer)\n if (result === TIMEOUT)\n continue\n if (ctx.signal.aborted)\n return null\n const suffixes = (typeof result === 'string' ? [result] : result ?? [])\n .filter(s => typeof s === 'string' && s.length > 0)\n if (suffixes.length > 0)\n return { suffixes, providerId: provider.id }\n }\n catch {\n // Isolation-first: skip broken providers.\n }\n }\n return null\n}\n\n// ---------------------------------------------------------------------------\n// Built-in path provider\n// ---------------------------------------------------------------------------\n\n/**\n * Extract the whitespace-delimited token that ends at `cursor`. Returns\n * null when the cursor sits right after whitespace (nothing to complete).\n */\nexport function tokenEndingAtCursor(text: string, cursor: number): string | null {\n const before = text.slice(0, cursor)\n const match = before.match(/\\S+$/)\n return match ? match[0] : null\n}\n\n/**\n * Does this token carry an explicit path shape (`/` separator or a `~`\n * prefix)? Path-shaped tokens complete from the first character after\n * the separator; bare tokens (`sr` → `c/`) still complete against the\n * cwd listing but need ≥2 chars first — see the provider.\n */\nfunction looksLikePath(token: string): boolean {\n return token.includes('/') || token.startsWith('~')\n}\n\n/**\n * Cap on candidates returned for an ambiguous fragment — rotation past\n * a dozen-odd entries stops being faster than typing another character.\n */\nconst MAX_PATH_CANDIDATES = 16\n\n/** Directory listing seam — injectable for tests. */\nexport interface PathProviderIo {\n readdir?: (dir: string) => { name: string, isDirectory: boolean }[]\n}\n\nfunction defaultReaddir(dir: string): { name: string, isDirectory: boolean }[] {\n return readdirSync(dir, { withFileTypes: true }).map(e => ({ name: e.name, isDirectory: e.isDirectory() }))\n}\n\n/**\n * Built-in provider: complete filesystem paths under `cwd` (or absolute /\n * `~` paths). Given the token `src/chat/comp`, lists `src/chat/` and\n * returns every matching continuation of `comp` as a candidate list —\n * directories first, alphabetical, `/`-terminated for directories so\n * typing can continue. The host ghosts the first candidate and rotates\n * through the rest on up/down.\n *\n * Bare tokens (no `/` yet) are matched against the cwd listing too, so\n * a directory ghost appears as soon as the first characters of `src`\n * are typed — but only from the second character on, so 1-letter prose\n * words don't ghost-spam.\n *\n * Dotfiles are only offered when the typed fragment itself starts with\n * `.` — the usual completion convention.\n */\nexport function createPathAutocompleteProvider(opts: {\n cwd?: () => string\n io?: PathProviderIo\n} = {}): InlineAutocompleteProvider {\n const readdir = opts.io?.readdir ?? defaultReaddir\n // Prefer the per-invocation `ctx.cwd` (host truth); fall back to the\n // factory-supplied getter, then `process.cwd()`.\n const fallbackCwd = opts.cwd ?? (() => process.cwd())\n return {\n id: 'paths',\n suggest(ctx) {\n const token = tokenEndingAtCursor(ctx.text, ctx.cursor)\n if (!token)\n return null\n // Bare tokens complete against the cwd listing (dirname('sr') is '.',\n // so the resolution below just works) but require ≥2 typed chars.\n if (!looksLikePath(token) && token.length < 2)\n return null\n // Resolve the directory being completed and the fragment typed so\n // far. A trailing `/` means \"complete entries of this directory\".\n const expanded = token.startsWith('~')\n ? join(homedir(), token.slice(1))\n : token\n const endsWithSep = expanded.endsWith('/')\n const dirPart = endsWithSep ? expanded : dirname(expanded)\n const fragment = endsWithSep ? '' : basename(expanded)\n const baseCwd = ctx.cwd || fallbackCwd()\n const dir = isAbsolute(dirPart) ? dirPart : resolve(baseCwd, dirPart)\n let entries: { name: string, isDirectory: boolean }[]\n try {\n entries = readdir(dir)\n }\n catch {\n return null\n }\n const matches = entries.filter(e =>\n e.name.startsWith(fragment)\n && (fragment.startsWith('.') || !e.name.startsWith('.')),\n )\n // Directories first (they're what you're navigating through), then\n // alphabetical within each group.\n matches.sort((a, b) =>\n a.isDirectory !== b.isDirectory\n ? (a.isDirectory ? -1 : 1)\n : a.name.localeCompare(b.name))\n const suffixes = matches\n .map(e => e.name.slice(fragment.length) + (e.isDirectory ? '/' : ''))\n .filter(s => s.length > 0)\n .slice(0, MAX_PATH_CANDIDATES)\n return suffixes.length > 0 ? suffixes : null\n },\n }\n}\n\n// ---------------------------------------------------------------------------\n// Host-side ghost reconciliation\n// ---------------------------------------------------------------------------\n\nexport interface InlineGhost {\n suffixes: readonly string[]\n index: number\n text: string\n cursor: number\n}\n\n/**\n * Optimistically transform the current ghost across a buffer edit so it\n * stays visible while the debounced provider re-query is in flight —\n * without this, every keystroke inside a completable token blinks the\n * ghost (hide → 120 ms → reshow).\n *\n * Two edits are reconcilable (everything else returns null and waits for\n * the authoritative result):\n * - typing FORWARD along the suggestion (`bi` → `bin` with ghost\n * `n/`): candidates are filtered to those starting with the typed\n * chars and trimmed;\n * - deleting BACKWARD within the token (`bin` → `bi` with ghost `/`):\n * the deleted chars are re-prepended to every candidate. Guarded to\n * non-whitespace so crossing a token boundary drops the ghost.\n *\n * The patched ghost is provisional — the provider's answer replaces it\n * (and may add candidates the patch couldn't know about).\n */\nexport function patchInlineGhost(prev: InlineGhost | null, text: string, cursor: number): InlineGhost | null {\n if (!prev)\n return null\n if (text === prev.text && cursor === prev.cursor)\n return prev\n // The text after the caret must be untouched — edits there invalidate\n // the completion context entirely.\n if (text.slice(cursor) !== prev.text.slice(prev.cursor))\n return null\n if (cursor > prev.cursor) {\n if (text.slice(0, prev.cursor) !== prev.text.slice(0, prev.cursor))\n return null\n const typed = text.slice(prev.cursor, cursor)\n const shown = prev.suffixes[prev.index]\n const suffixes = prev.suffixes\n .filter(s => s.startsWith(typed) && s.length > typed.length)\n .map(s => s.slice(typed.length))\n if (suffixes.length === 0)\n return null\n // Keep the rotated-to candidate selected when it survives the filter.\n const shownTrimmed = shown.startsWith(typed) ? shown.slice(typed.length) : null\n const index = shownTrimmed !== null ? Math.max(0, suffixes.indexOf(shownTrimmed)) : 0\n return { suffixes, index, text, cursor }\n }\n if (prev.text.slice(0, cursor) !== text.slice(0, cursor))\n return null\n const deleted = prev.text.slice(cursor, prev.cursor)\n if (deleted.length === 0 || /\\s/.test(deleted))\n return null\n return { suffixes: prev.suffixes.map(s => deleted + s), index: prev.index, text, cursor }\n}\n"],"mappings":";;;;;;;;;;;AA4UA,SAAgB,uBAAuB,QAA+D;CACpG,OAAO,OAAO,KAAK,UAAU;EAC3B,IAAI,CAAC,MAAM,UAAU,CAAC,MAAM,QAC1B,OAAO;GAAE,MAAM;GAAiB,MAAM,MAAM;EAAK;EAKnD,MAAM,cAAyC,MAAM,SACjD,EAAE,QAAQ;GAAE,UAAU,MAAM,OAAO;GAAU,GAAI,MAAM,OAAO,SAAS,KAAA,IAAY,EAAE,MAAM,MAAM,OAAO,KAAK,IAAI,CAAC;EAAG,EAAE,IACvH;GACE,GAAI,MAAM,QAAQ,QAAQ,EAAE,OAAO,MAAM,OAAO,MAAM,IAAI,CAAC;GAC3D,GAAI,MAAM,QAAQ,SAAS,EAAE,QAAQ,MAAM,OAAO,OAAO,IAAI,CAAC;EAChE;EACJ,OAAO;GACL,MAAM;GACN,QAAQ,kBAAkB,OAAO,WAAW;GAC5C,QAAQ,MAAM;GACd,GAAI,OAAO,KAAK,WAAW,CAAC,CAAC,SAAS,IAAI,EAAE,UAAU,EAAE,SAAS,YAAY,EAAE,IAAI,CAAC;EACtF;CACF,CAAC;AACH;;;;;;;;;;;AAYA,SAAgB,oBAAoB,OAAwC;CAC1E,IAAI,MAAM,QACR,OAAO;EACL,MAAM;EACN,MAAM,MAAM;EACZ,QAAQ;GACN,UAAU,MAAM,OAAO;GACvB,GAAI,MAAM,OAAO,SAAS,KAAA,IAAY,EAAE,MAAM,MAAM,OAAO,KAAK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OAAO;EAET,MAAM,eAAe,MAAM,WAAW,KAAK,IAAI,MAAM,MAAM,MAAM,MAAM,IAAI;EAE3E,OAAO;GAAE;GAAU,OADL,iBAAiB,OAAO,KAAK,IAAI,GAAG,SAAS,QAAQ,YAAY,CAAC,IAAI;GAC1D;GAAM;EAAO;CACzC;CACA,IAAI,KAAK,KAAK,MAAM,GAAG,MAAM,MAAM,KAAK,MAAM,GAAG,MAAM,GACrD,OAAO;CACT,MAAM,UAAU,KAAK,KAAK,MAAM,QAAQ,KAAK,MAAM;CACnD,IAAI,QAAQ,WAAW,KAAK,KAAK,KAAK,OAAO,GAC3C,OAAO;CACT,OAAO;EAAE,UAAU,KAAK,SAAS,KAAI,MAAK,UAAU,CAAC;EAAG,OAAO,KAAK;EAAO;EAAM;CAAO;AAC1F"}
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Cc as deriveMcpToolMeta, Dc as wrapDiscoveredMcpTools, Ec as resultToString, Sc as connectMcpServers, Tc as normalizeMcpServers, bc as McpConnection, ef as McpServerConfig, nf as McpToolSchema, wc as normalizeMcpBlocks, xc as attachStderrWarnPump, yc as ConnectMcpServersOptions } from "./index-CNyYEOy0.js";
|
|
2
2
|
export { ConnectMcpServersOptions, McpConnection, type McpServerConfig, type McpToolSchema, attachStderrWarnPump, connectMcpServers, deriveMcpToolMeta, normalizeMcpBlocks, normalizeMcpServers, resultToString, wrapDiscoveredMcpTools };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { An as FormattedHeadlessTurnEvent, Fn as HeadlessResult, Mn as HeadlessEvent, Pi as Agent, Pn as HeadlessOutputFormat, kn as FormattedHeadlessResult } from "../index-
|
|
1
|
+
import { An as FormattedHeadlessTurnEvent, Fn as HeadlessResult, Mn as HeadlessEvent, Pi as Agent, Pn as HeadlessOutputFormat, kn as FormattedHeadlessResult } from "../index-CNyYEOy0.js";
|
|
2
2
|
|
|
3
3
|
//#region src/output/stream-json.d.ts
|
|
4
4
|
type StreamJsonOutputFormat = HeadlessOutputFormat;
|
package/dist/presets.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Fi as AgentHookMap, a as basicTools, i as _default, n as composePresets, r as definePreset, t as Preset } from "./index-
|
|
1
|
+
import { Fi as AgentHookMap, a as basicTools, i as _default, n as composePresets, r as definePreset, t as Preset } from "./index-CNyYEOy0.js";
|
|
2
2
|
export { type AgentHookMap, Preset, _default as basic, basicTools, composePresets, definePreset };
|
package/dist/presets.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ct as basicTools, lt as basic_default, ot as composePresets, st as definePreset } from "./agent-
|
|
1
|
+
import { ct as basicTools, lt as basic_default, ot as composePresets, st as definePreset } from "./agent-D11SxCvA.js";
|
|
2
2
|
export { basic_default as basic, basicTools, composePresets, definePreset };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $m as AnthropicThinkingPlan, Qm as AnthropicParams, Zm as AnthropicContextManagement, ah as resolveAnthropicBetas, eh as anthropic, ih as planAnthropicThinking, nh as classifyAnthropicError, oh as resolveAnthropicMaxOutput, rh as defaultAnthropicMaxTokens, th as applyAnthropicCacheBreakpoints } from "../index-CNyYEOy0.js";
|
|
2
2
|
export { AnthropicContextManagement, AnthropicParams, AnthropicThinkingPlan, anthropic, applyAnthropicCacheBreakpoints, classifyAnthropicError, defaultAnthropicMaxTokens, planAnthropicThinking, resolveAnthropicBetas, resolveAnthropicMaxOutput };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as planAnthropicThinking, i as defaultAnthropicMaxTokens, n as applyAnthropicCacheBreakpoints, o as resolveAnthropicBetas, r as classifyAnthropicError, s as resolveAnthropicMaxOutput, t as anthropic } from "../anthropic-
|
|
1
|
+
import { a as planAnthropicThinking, i as defaultAnthropicMaxTokens, n as applyAnthropicCacheBreakpoints, o as resolveAnthropicBetas, r as classifyAnthropicError, s as resolveAnthropicMaxOutput, t as anthropic } from "../anthropic-DdlSgT6K.js";
|
|
2
2
|
export { anthropic, applyAnthropicCacheBreakpoints, classifyAnthropicError, defaultAnthropicMaxTokens, planAnthropicThinking, resolveAnthropicBetas, resolveAnthropicMaxOutput };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Xm as arcee, Ym as ArceeParams } from "../index-CNyYEOy0.js";
|
|
2
2
|
export { ArceeParams, arcee };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Jm as planBasetenReasoning, Km as BasetenParams, qm as baseten } from "../index-CNyYEOy0.js";
|
|
2
2
|
export { BasetenParams, baseten, planBasetenReasoning };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gm as cerebras, Wm as CerebrasParams } from "../index-CNyYEOy0.js";
|
|
2
2
|
export { CerebrasParams, cerebras };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bm as LocalParams, Vm as local } from "../index-CNyYEOy0.js";
|
|
2
2
|
export { LocalParams, local };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Am as openAICompatPromptMessage, Cm as applyOAIToolCacheBreakpoint, Dm as consumeSSE, Em as classifyOpenAICompatError, Mm as toOAIMessages, Nm as toolResultsMessage, Om as formatTools, Pm as userMessage, Sm as applyOAICacheBreakpoints, Tm as buildAssistantContent, _m as OpenAICompatAuthHeader, bm as OpenAICompatStreamError, gm as OAITool, hm as OAIMessage, jm as openaiCompat, km as mapOAIFinishReason, mm as ASSISTANT_TOOL_CALLS_TAG, vm as OpenAICompatHttpError, wm as assistantMessage, xm as TOOL_RESULTS_TAG, ym as OpenAICompatParams } from "../index-CNyYEOy0.js";
|
|
2
2
|
export { ASSISTANT_TOOL_CALLS_TAG, OAIMessage, OAITool, OpenAICompatAuthHeader, OpenAICompatHttpError, OpenAICompatParams, OpenAICompatStreamError, TOOL_RESULTS_TAG, applyOAICacheBreakpoints, applyOAIToolCacheBreakpoint, assistantMessage, buildAssistantContent, classifyOpenAICompatError, consumeSSE, formatTools, mapOAIFinishReason, openAICompatPromptMessage, openaiCompat, toOAIMessages, toolResultsMessage, userMessage };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fm as OpenAIParams, Im as classifyOpenAIError, Lm as mapCodexStopReason, Rm as openai, zm as toPiMessages } from "../index-CNyYEOy0.js";
|
|
2
2
|
export { OpenAIParams, classifyOpenAIError, mapCodexStopReason, openai, toPiMessages };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dm as OpenRouterParams, fm as normalizeOpenRouterModelId, pm as openrouter } from "../index-CNyYEOy0.js";
|
|
2
2
|
export { OpenRouterParams, normalizeOpenRouterModelId, openrouter };
|
package/dist/providers/xai.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { am as xai, im as XaiParams } from "../index-CNyYEOy0.js";
|
|
2
2
|
export { XaiParams, xai };
|
package/dist/providers.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $p as
|
|
1
|
+
import { $p as TokenCountPayload, Bm as LocalParams, Em as classifyOpenAICompatError, Fm as OpenAIParams, Gm as cerebras, Hm as CursorParams, Jm as planBasetenReasoning, Km as BasetenParams, Qm as AnthropicParams, Qp as StreamOptions, Rm as openai, Um as cursor, Vm as local, Wm as CerebrasParams, Xm as arcee, Xp as ProviderCapabilities, Ym as ArceeParams, Yp as Provider, Zp as StreamCallbacks, _m as OpenAICompatAuthHeader, am as xai, cm as SchemaSanitizeResult, dm as OpenRouterParams, eh as anthropic, em as ToolCall, im as XaiParams, jm as openaiCompat, km as mapOAIFinishReason, lm as sanitizeToolSchema, nm as ToolSpec, om as SchemaSanitizeOptions, pm as openrouter, qm as baseten, rm as TurnResult, sm as SchemaSanitizeProfile, th as applyAnthropicCacheBreakpoints, tm as ToolResult, um as sanitizeToolSpecs, vm as OpenAICompatHttpError, ym as OpenAICompatParams } from "./index-CNyYEOy0.js";
|
|
2
2
|
export { type AnthropicParams, type ArceeParams, type BasetenParams, type CerebrasParams, type CursorParams, type LocalParams, type OpenAICompatAuthHeader, OpenAICompatHttpError, type OpenAICompatParams, type OpenAIParams, type OpenRouterParams, Provider, ProviderCapabilities, type SchemaSanitizeOptions, type SchemaSanitizeProfile, type SchemaSanitizeResult, StreamCallbacks, StreamOptions, TokenCountPayload, ToolCall, ToolResult, ToolSpec, TurnResult, type XaiParams, anthropic, applyAnthropicCacheBreakpoints, arcee, baseten, cerebras, classifyOpenAICompatError, cursor, local, mapOAIFinishReason, openai, openaiCompat, openrouter, planBasetenReasoning, sanitizeToolSchema, sanitizeToolSpecs, xai };
|
package/dist/providers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { f as mapOAIFinishReason, l as classifyOpenAICompatError, m as openaiCompat, n as OpenAICompatHttpError, v as sanitizeToolSchema, y as sanitizeToolSpecs } from "./openai-compat-TA7aihJ-.js";
|
|
2
|
-
import { n as applyAnthropicCacheBreakpoints, t as anthropic } from "./anthropic-
|
|
2
|
+
import { n as applyAnthropicCacheBreakpoints, t as anthropic } from "./anthropic-DdlSgT6K.js";
|
|
3
3
|
import { arcee } from "./providers/arcee.js";
|
|
4
4
|
import { baseten, planBasetenReasoning } from "./providers/baseten.js";
|
|
5
5
|
import { cerebras } from "./providers/cerebras.js";
|
package/dist/restate.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bd as AgentClock, Bi as McpToolWrap, Gf as ToolContext, Kf as ToolDef, Mf as ToolResultContent, Of as ToolBatchExecutor, Qp as StreamOptions, Yp as Provider, mp as SessionStore, zd as AgentBehavior, zi as McpToolMeta } from "./index-CNyYEOy0.js";
|
|
2
2
|
import { h as TaskExitInfo, l as ExecutionHandle, m as TaskEntry, o as DetachedTasksCapability } from "./types-BDccavwj.js";
|
|
3
3
|
|
|
4
4
|
//#region src/restate/types.d.ts
|
package/dist/session/sqlite.d.ts
CHANGED
package/dist/session.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Cf as SessionMessage, Cp as RemoteStoreOptions, Dp as FileMapStoreOptions, Ep as FileMapAdapter, Ip as ToWireMessagesOptions, Jp as toWireMessages, Kp as toAnthropic, Op as createFileMapStore, Rp as autoDetectAndConvert, Sp as withExtensionSession, Tp as createMemoryStore, Up as fromAnthropic, Wp as fromOpenAI, _p as deleteExtensionSessionState, bf as SessionContentBlock, bp as loadSession, dp as SessionData, fp as SessionMetaRow, gp as currentExtensionSession, hp as createSession, lp as CreateSessionOptions, mp as SessionStore, pp as SessionRun, qp as toOpenAI, up as Session, vp as demoteStaleRunningStatus, wf as SessionTurn, wp as createRemoteStore, xp as setExtensionSessionState, yp as getExtensionSessionState } from "./index-CNyYEOy0.js";
|
|
2
2
|
export { CreateSessionOptions, type FileMapAdapter, type FileMapStoreOptions, type RemoteStoreOptions, Session, type SessionContentBlock, SessionData, type SessionMessage, SessionMetaRow, SessionRun, SessionStore, type SessionTurn, type ToWireMessagesOptions, autoDetectAndConvert, createFileMapStore, createMemoryStore, createRemoteStore, createSession, currentExtensionSession, deleteExtensionSessionState, demoteStaleRunningStatus, fromAnthropic, fromOpenAI, getExtensionSessionState, loadSession, setExtensionSessionState, toAnthropic, toOpenAI, toWireMessages, withExtensionSession };
|
package/dist/skills.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $s as
|
|
1
|
+
import { $s as SkillInstallSpec, Bs as validateResourcePathReal, Fs as SkillValidationResult, Gs as interpolateShellCommands, Hs as validateSkillName, Is as isToolAllowedByUnion, Js as SkillInstallCandidate, Ks as stripShellInterpolations, Ls as matchesAllowedTool, Ms as writeSkillToDisk, Ns as writeSkillsToDisk, Ps as SkillValidationIssue, Qs as SkillInstallResult, Rs as parseAllowedToolPattern, Us as resolveSkills, Vs as validateSkillForWrite, Ws as InterpolateShellCommandsOptions, Xs as SkillInstallErrorCode, Ys as SkillInstallError, Zs as SkillInstallOptions, _c as SkillActivationStateOptions, ac as discoverSkills, ap as SkillDiagnostic, cc as parseFrontmatter, cp as SkillsConfig, dc as IMPLICITLY_ALLOWED_SKILL_TOOLS, ec as installSkillFromSpec, fc as installAllowedToolsGate, gc as SkillActivationState, hc as DeactivationReason, ic as SourcedScanPath, ip as SkillConfig, js as defineSkill, lc as parseSkillFile, mc as ActiveSkill, nc as parseSkillInstallSpec, oc as getDefaultScanPaths, op as SkillResource, pc as ActivationVia, qs as SKILL_PROVENANCE_FILE, rc as readSkillProvenance, rp as ShellInterpolationApproval, sc as inferSource, sp as SkillSource, tc as listSkillCandidates, uc as buildCatalog, vc as createSkillActivationState, zs as validateResourcePath } from "./index-CNyYEOy0.js";
|
|
2
2
|
export { type ActivationVia, type ActiveSkill, type DeactivationReason, IMPLICITLY_ALLOWED_SKILL_TOOLS, type InterpolateShellCommandsOptions, SKILL_PROVENANCE_FILE, type ShellInterpolationApproval, type SkillActivationState, type SkillActivationStateOptions, type SkillConfig, type SkillDiagnostic, type SkillInstallCandidate, SkillInstallError, type SkillInstallErrorCode, type SkillInstallOptions, type SkillInstallResult, type SkillInstallSpec, type SkillResource, type SkillSource, type SkillValidationIssue, type SkillValidationResult, type SkillsConfig, type SourcedScanPath, buildCatalog, createSkillActivationState, defineSkill, discoverSkills, getDefaultScanPaths, inferSource, installAllowedToolsGate, installSkillFromSpec, interpolateShellCommands, isToolAllowedByUnion, listSkillCandidates, matchesAllowedTool, parseAllowedToolPattern, parseFrontmatter, parseSkillFile, parseSkillInstallSpec, readSkillProvenance, resolveSkills, stripShellInterpolations, validateResourcePath, validateResourcePathReal, validateSkillForWrite, validateSkillName, writeSkillToDisk, writeSkillsToDisk };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Qu as ProviderKey, Ru as Settings, Zu as ProviderAuth, nd as ModelInfo, zu as StreamEvent } from "./index-CNyYEOy0.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/chat/turn-selection.d.ts
|
|
@@ -432,4 +432,4 @@ declare function displayNameFor(name: string, input?: Record<string, unknown>):
|
|
|
432
432
|
declare function formatToolCall(name: string, input: Record<string, unknown>): ToolFormatLine | null;
|
|
433
433
|
//#endregion
|
|
434
434
|
export { turnSelectionOwnership as A, useSafeModeActions as C, isTurnHighlighted as D, isEditErrorResult as E, isVisible as O, SafeModeProvider as S, EDIT_TOOL_NAMES as T, splitMarkdownCodeBlocks as _, formatToolCall as a, RequestApproval as b, splitPromptSegments as c, filterModelCatalog as d, indexOfEntry as f, normalizeMarkdownCodeFences as g, chunkMarkdownForRender as h, displayNameFor as i, selectableTurnIds as k, CatalogEntry as l, MarkdownSegment as m, ToolDisplayMeta as n, PromptSegment as o, MARKDOWN_RENDER_CHUNK_TARGET_BYTES as p, ToolFormatLine as r, PromptSegmentRef as s, TOOL_DISPLAY as t, buildModelCatalog as u, ApprovalDecision as v, useSafeModeQueue as w, SafeModeActions as x, ApprovalRequest as y };
|
|
435
|
-
//# sourceMappingURL=tool-formatters-
|
|
435
|
+
//# sourceMappingURL=tool-formatters-B7oWiy5m.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-formatters-B7oWiy5m.d.ts","names":[],"sources":["../src/chat/turn-selection.ts","../src/chat/safe-mode-context.tsx","../src/chat/markdown-segments.ts","../src/chat/model-catalog.ts","../src/chat/prompt-segments.ts","../src/chat/tool-formatters.ts"],"mappings":";;;;;cAaa,eAAA,EAAiB,WAAW;;AAAzC;;;;AAAyC;AAmBzC;;;;AAA8C;AAqE9C;;;;;;iBArEgB,iBAAA,CAAkB,IAAY;;;;;;;AAoLN;AA6BxC;;;;;;iBA5IgB,SAAA,CAAU,KAAA,EAAO,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H0D;AAiD3E;;;;;;;;EKpKE,WAAA,aAAwB,KAAA,EAAO,MAAA;ELqKnB;;;;;EK/JZ,MAAA,GAAS,KAAA,EAAO,MAAA,sBAA4B,cAAA;AAAA;AAAA,cAOjC,YAAA,EAAc,QAAA,CAAS,MAAA,SAAe,eAAA;;;;;;;;;ALyL9B;;;;AChNrB;;;iBIoUgB,cAAA,CACd,IAAA,UACA,KAAA,GAAQ,MAAM;AJjUa;AAQ7B;;;;;AAR6B,iBImVb,cAAA,CAAe,IAAA,UAAc,KAAA,EAAO,MAAA,oBAA0B,cAAc"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $n as waitTask,
|
|
1
|
+
import { $f as hydrateReadStateFromSession, $n as waitTask, As as matchModelEntries, Cr as glob, Cs as SubagentOverride, Ds as SpawnModelEntry, Es as isSpawnTool, Gf as ToolContext, Jf as HydrateReadStateOptions, Kf as ToolDef, Os as createModelSearchTool, Qf as hashContent, Qn as WAIT_TASK_TIMED_OUT_PREFIX, Sr as grep, Ss as SubagentDef, Ts as createSpawnTool, Xf as ReadStateMap, Yf as ReadStateEntry, Zf as getReadState, Zn as writeFile, _r as readFile, _s as SpawnTaskInput, ar as ToolSearchToolOptions, br as InteractionToolOptions, bs as SpawnToolOptions, cr as createSkillsUseTool, dr as SkillsReadToolOptions, ep as hydrateReadStateFromSessionAsync, er as ValidationResult, fr as createSkillsReadTool, gr as shell, gs as ExtensionSubagentDef, hr as createShellTool, hs as ChildAgent, ir as LazyToolEntry, ks as formatModelLine, lr as SkillsRunScriptToolOptions, mr as CreateShellToolOptions, np as resolveReadStateMap, nr as TailTruncateOptions, or as createToolSearchTool, pr as shellKill, qf as ToolMap, rr as tailTruncate, sr as SkillsUseToolOptions, tp as readStateKey, tr as validateToolArgs, ur as createSkillsRunScriptTool, vr as multiEdit, vs as SpawnTaskOutcome, wr as edit, ws as SubagentRegistry, xr as createInteractionTool, xs as SpawnToolState, yr as listFiles, ys as SpawnTool } from "./index-CNyYEOy0.js";
|
|
2
2
|
export { type ChildAgent, type CreateShellToolOptions, type ExtensionSubagentDef, type HydrateReadStateOptions, type InteractionToolOptions, type LazyToolEntry, type ReadStateEntry, type ReadStateMap, type SkillsReadToolOptions, type SkillsRunScriptToolOptions, type SkillsUseToolOptions, type SpawnModelEntry, type SpawnTaskInput, type SpawnTaskOutcome, type SpawnTool, type SpawnToolOptions, type SpawnToolState, type SubagentDef, type SubagentOverride, type SubagentRegistry, type TailTruncateOptions, type ToolContext, type ToolDef, type ToolMap, type ToolSearchToolOptions, type ValidationResult, WAIT_TASK_TIMED_OUT_PREFIX, createInteractionTool, createModelSearchTool, createShellTool, createSkillsReadTool, createSkillsRunScriptTool, createSkillsUseTool, createSpawnTool, createToolSearchTool, edit, formatModelLine, getReadState, glob, grep, hashContent, hydrateReadStateFromSession, hydrateReadStateFromSessionAsync, isSpawnTool, listFiles, matchModelEntries, multiEdit, readFile, readStateKey, resolveReadStateMap, shell, shellKill, tailTruncate, validateToolArgs, waitTask, writeFile };
|
package/dist/tools.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as hydrateReadStateFromSessionAsync, c as resolveReadStateMap, i as hydrateReadStateFromSession, r as hashContent, s as readStateKey, t as getReadState } from "./read-state-Dq_TXUX1.js";
|
|
2
|
-
import { At as createInteractionTool, Ct as readFile, Dt as formatModelLine, Et as createModelSearchTool, Mt as glob, Nt as edit, Ot as matchModelEntries, Pt as validateToolArgs, St as tailTruncate, Tt as multiEdit, _t as createSkillsRunScriptTool, bt as createShellTool, dt as WAIT_TASK_TIMED_OUT_PREFIX, ft as waitTask, gt as createSkillsUseTool, ht as isSpawnTool, jt as grep, kt as listFiles, mt as createSpawnTool, pt as createToolSearchTool, ut as writeFile, vt as createSkillsReadTool, xt as shell, yt as shellKill } from "./agent-
|
|
2
|
+
import { At as createInteractionTool, Ct as readFile, Dt as formatModelLine, Et as createModelSearchTool, Mt as glob, Nt as edit, Ot as matchModelEntries, Pt as validateToolArgs, St as tailTruncate, Tt as multiEdit, _t as createSkillsRunScriptTool, bt as createShellTool, dt as WAIT_TASK_TIMED_OUT_PREFIX, ft as waitTask, gt as createSkillsUseTool, ht as isSpawnTool, jt as grep, kt as listFiles, mt as createSpawnTool, pt as createToolSearchTool, ut as writeFile, vt as createSkillsReadTool, xt as shell, yt as shellKill } from "./agent-D11SxCvA.js";
|
|
3
3
|
export { WAIT_TASK_TIMED_OUT_PREFIX, createInteractionTool, createModelSearchTool, createShellTool, createSkillsReadTool, createSkillsRunScriptTool, createSkillsUseTool, createSpawnTool, createToolSearchTool, edit, formatModelLine, getReadState, glob, grep, hashContent, hydrateReadStateFromSession, hydrateReadStateFromSessionAsync, isSpawnTool, listFiles, matchModelEntries, multiEdit, readFile, readStateKey, resolveReadStateMap, shell, shellKill, tailTruncate, validateToolArgs, waitTask, writeFile };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Cs as SubagentOverride, Df as ThinkingLevel, Do as ExtensionRegistry, Fu as Picked, Ka as StoredExtensionConfigItem, Lu as SessionMeta, Mf as ToolResultContent, Pa as ExtensionConfigCategory, Qu as ProviderKey, Ru as Settings, Vu as ModelChainEntry, Zu as ProviderAuth, bf as SessionContentBlock, dp as SessionData, ef as McpServerConfig, id as ProviderDescriptor, ju as EditOutcome, mp as SessionStore, nd as ModelInfo, pp as SessionRun, t as Preset, wf as SessionTurn, ws as SubagentRegistry, yu as AgentRegistry, zu as StreamEvent } from "./index-CNyYEOy0.js";
|
|
2
2
|
//#region src/chat/hints.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Single hint entry — `<key> <label>`, optionally followed by an inline
|
|
@@ -1446,4 +1446,4 @@ declare function computeTurnAnchors(items: readonly TranscriptItem[]): {
|
|
|
1446
1446
|
};
|
|
1447
1447
|
//#endregion
|
|
1448
1448
|
export { KEYBINDING_KEY_COL_WIDTH as $, resolveStorageDirs as A, loadState as B, ResolvedPaths as C, StorageDirs as D, ResolveStorageDirsOptions as E, createStateStore as F, titleFromTurns as G, saveState as H, deriveSessionTitle as I, updateToolEventOutcomes as J, toolCallPreview as K, eventsFromTurns as L, StateStoreApi as M, TuiState as N, StorageMode as O, compactSummaryEvent as P, KEYBINDING_DEF_BY_ACTION as Q, lastContextSizeFromTurns as R, ResolvedConfig as S, resolveStoragePaths as T, stripSpawnTokensLine as U, marginTopFor as V, sumRunCosts as W, DEFAULT_KEYBINDINGS as X, usageByModel as Y, KEYBINDING_DEFS as Z, discoverProjectMcps as _, EMPTY_HINTS as _t, SessionExportTarget as a, ResolvedExtensionKeybinding as at, ChatOptions as b, hintsLength as bt, writeSessionExport as c, groupBindings as ct, useEnabledToggleSet as d, mergeKeybindings as dt, KeyAction as et, DiscoveredMcp as f, parseBindingSpec as ft, defaultMcpsConfigPaths as g, stripJsonComments as gt, buildMcpServers as h, resolveExtensionKeybindings as ht, SessionExportFormat as i, ParsedBinding as it, ModelUsageSummary as j, StorageSlot as k, EnabledAllowlistKey as l, keybindingsPath as lt, DiscoveryResult as m, readKeybindingsRaw as mt, computeTurnAnchors as n, KeyBindingSection as nt, renderSession as o, ensureKeybindingsFile as ot, DiscoveryError as p, readKeybindings as pt, toolResultText as q, SessionExportAnchor as r, KeyBindings as rt, resolveSessionExportTarget as s, formatBindingForDisplay as st, TranscriptItem as t, KeyBindingDef as tt, EnabledToggleSet as u, matchesBinding as ut, parseMcpsFile as v, Hint as vt, resolveConfig as w, ProviderRegistry as x, truncateTrailing as xt, AutoUpdateConfig as y, clipHintsToWidth as yt, listSessionMeta as z };
|
|
1449
|
-
//# sourceMappingURL=transcript-anchors-
|
|
1449
|
+
//# sourceMappingURL=transcript-anchors-BUZ915pM.d.ts.map
|