zidane 4.1.9 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +11 -2
  2. package/dist/{agent-CMIhYhDz.d.ts → agent-JhicgLOV.d.ts} +78 -4
  3. package/dist/agent-JhicgLOV.d.ts.map +1 -0
  4. package/dist/chat.d.ts +336 -6
  5. package/dist/chat.d.ts.map +1 -1
  6. package/dist/chat.js +2 -2
  7. package/dist/{index-DAaKyadO.d.ts → index-2yLUyTbc.d.ts} +34 -4
  8. package/dist/{index-DAaKyadO.d.ts.map → index-2yLUyTbc.d.ts.map} +1 -1
  9. package/dist/{index-D6Dd6Kc0.d.ts → index-t_W9i7Ql.d.ts} +8 -3
  10. package/dist/index-t_W9i7Ql.d.ts.map +1 -0
  11. package/dist/index.d.ts +3 -3
  12. package/dist/index.js +4 -4
  13. package/dist/{interpolate-BydkV1eT.js → interpolate-Ck970-61.js} +9 -2
  14. package/dist/{interpolate-BydkV1eT.js.map → interpolate-Ck970-61.js.map} +1 -1
  15. package/dist/mcp.d.ts +1 -1
  16. package/dist/presets-BRFH2qsQ.js +90 -0
  17. package/dist/presets-BRFH2qsQ.js.map +1 -0
  18. package/dist/presets.d.ts +3 -2
  19. package/dist/presets.js +2 -2
  20. package/dist/providers.d.ts +1 -1
  21. package/dist/session/sqlite.d.ts +1 -1
  22. package/dist/session/sqlite.d.ts.map +1 -1
  23. package/dist/session/sqlite.js +28 -13
  24. package/dist/session/sqlite.js.map +1 -1
  25. package/dist/{session-B1RN0uoi.js → session-791hhrFa.js} +24 -1
  26. package/dist/session-791hhrFa.js.map +1 -0
  27. package/dist/session.d.ts +1 -1
  28. package/dist/session.js +1 -1
  29. package/dist/skills.d.ts +2 -2
  30. package/dist/skills.js +1 -1
  31. package/dist/theme-pJv47erq.d.ts +1202 -0
  32. package/dist/theme-pJv47erq.d.ts.map +1 -0
  33. package/dist/{tools-BdQENveS.js → tools-CLazLRb4.js} +81 -21
  34. package/dist/tools-CLazLRb4.js.map +1 -0
  35. package/dist/tools.d.ts +2 -2
  36. package/dist/tools.js +1 -1
  37. package/dist/tui.d.ts +258 -30
  38. package/dist/tui.d.ts.map +1 -1
  39. package/dist/tui.js +2957 -499
  40. package/dist/tui.js.map +1 -1
  41. package/dist/turn-operations-5aQu4dJg.js +3587 -0
  42. package/dist/turn-operations-5aQu4dJg.js.map +1 -0
  43. package/dist/types.d.ts +2 -2
  44. package/package.json +1 -1
  45. package/dist/agent-CMIhYhDz.d.ts.map +0 -1
  46. package/dist/index-D6Dd6Kc0.d.ts.map +0 -1
  47. package/dist/presets-4zCJzCYw.js +0 -39
  48. package/dist/presets-4zCJzCYw.js.map +0 -1
  49. package/dist/session-B1RN0uoi.js.map +0 -1
  50. package/dist/theme-Caf4AvTO.d.ts +0 -637
  51. package/dist/theme-Caf4AvTO.d.ts.map +0 -1
  52. package/dist/theme-context-DQM2lx4U.js +0 -1853
  53. package/dist/theme-context-DQM2lx4U.js.map +0 -1
  54. package/dist/tools-BdQENveS.js.map +0 -1
package/README.md CHANGED
@@ -479,7 +479,7 @@ await Promise.all([agent.warmup(), authenticate(), loadConfig()]) // pre-warm m
479
479
  const agent = createAgent({ provider, mcpServers, eager: true }) // or kick off automatically
480
480
  ```
481
481
 
482
- `warmup()` is idempotent and concurrency-safe. Failures surface on the next `warmup()` / `run()`, not on the eager kickoff.
482
+ `warmup()` fans MCP connect + skills resolution out in parallel — both idempotent and concurrency-safe. Failures surface on the next `warmup()` / `run()`, not on the eager kickoff. `agent.activateSkill(name)` also auto-resolves the catalog on its first call, so a TUI can wire `/slash`-style activation at submit time without ordering it against `run()`.
483
483
 
484
484
  Two hooks fire per bootstrap regardless of outcome — attribute cold-start latency per server:
485
485
 
@@ -570,7 +570,7 @@ agent.isRunning // run in progress?
570
570
  agent.turns // SessionTurn[]
571
571
  agent.abort() // cancel current run
572
572
  agent.reset() // clear turns + queues
573
- await agent.warmup() // pre-connect MCP (idempotent)
573
+ await agent.warmup() // pre-connect MCP + resolve skills (idempotent)
574
574
  await agent.destroy() // clean up context + MCP
575
575
  await agent.waitForIdle() // wait for run to complete
576
576
  ```
@@ -670,6 +670,15 @@ bun test
670
670
 
671
671
  Benchmark harnesses live in [`benchmarks/`](./benchmarks). First integration: [Terminal-Bench](./benchmarks/terminal-bench).
672
672
 
673
+ ## Docs
674
+
675
+ | Doc | What |
676
+ |---|---|
677
+ | [docs/ARCHITECTURE.md](./docs/ARCHITECTURE.md) | Mermaid diagrams of the agent loop, tool execution, hook firing order, dependency graph. |
678
+ | [docs/SKILL.md](./docs/SKILL.md) | Authoritative reference for `createAgent` + hooks + tools + sessions + skills + MCP. Long-form. |
679
+ | [docs/CHAT.md](./docs/CHAT.md) | `zidane/chat` — renderer-agnostic chat engine (auth, sessions, safe-mode, settings, theme). Consumed by the TUI and any future GUI. |
680
+ | [docs/TUI.md](./docs/TUI.md) | `zidane/tui` — terminal shell built on `zidane/chat`. `runTui()`, screens, modals, keyboard, theming. |
681
+
673
682
  ## License
674
683
 
675
684
  ISC
@@ -1420,6 +1420,21 @@ interface SessionRun {
1420
1420
  interface SessionData {
1421
1421
  id: string;
1422
1422
  agentId?: string;
1423
+ /**
1424
+ * Absolute path of the project this session belongs to — typically
1425
+ * the git root resolved from `cwd` at creation time, falling back to
1426
+ * `cwd` itself when not in a git repo. Set ONCE on creation and never
1427
+ * mutated thereafter (the session "belongs" to that project forever).
1428
+ *
1429
+ * Used by the TUI's sessions list to filter rows by current project,
1430
+ * so the user only sees conversations relevant to where they are
1431
+ * working — without needing one `.{prefix}/` directory per project.
1432
+ *
1433
+ * `undefined` on pre-tagging legacy sessions; the chat layer treats
1434
+ * those as "untagged" and hides them unless `Settings.showAllProjects`
1435
+ * is on.
1436
+ */
1437
+ projectRoot?: string;
1423
1438
  turns: SessionTurn[];
1424
1439
  runs: SessionRun[];
1425
1440
  status: 'idle' | 'running' | 'completed' | 'error';
@@ -1438,10 +1453,18 @@ interface SessionStore {
1438
1453
  save: (session: SessionData) => Promise<void>;
1439
1454
  /** Delete a session. */
1440
1455
  delete: (sessionId: string) => Promise<void>;
1441
- /** List session IDs, optionally filtered. */
1456
+ /**
1457
+ * List session IDs, optionally filtered. `projectRoot` restricts to
1458
+ * sessions whose `SessionData.projectRoot` matches exactly — untagged
1459
+ * (legacy) sessions are NOT returned under that filter; pass `null`
1460
+ * explicitly to ask for untagged ones, or omit the field to ignore
1461
+ * the axis entirely. `agentId` filters by recorded agent; the two
1462
+ * conditions AND together when both are set.
1463
+ */
1442
1464
  list: (filter?: {
1443
1465
  agentId?: string;
1444
1466
  limit?: number;
1467
+ projectRoot?: string | null;
1445
1468
  }) => Promise<string[]>;
1446
1469
  /** Append new turns to a session (incremental, avoids full re-save). */
1447
1470
  appendTurns: (sessionId: string, turns: SessionTurn[]) => Promise<void>;
@@ -1457,6 +1480,11 @@ interface Session {
1457
1480
  readonly id: string;
1458
1481
  /** Agent ID (optional label) */
1459
1482
  readonly agentId?: string;
1483
+ /**
1484
+ * Project this session was created under — see {@link SessionData.projectRoot}.
1485
+ * Set once on creation; surfaces here for read-only inspection.
1486
+ */
1487
+ readonly projectRoot?: string;
1460
1488
  /** Current turn history */
1461
1489
  readonly turns: SessionTurn[];
1462
1490
  /**
@@ -1518,6 +1546,16 @@ interface Session {
1518
1546
  appendTurns: (turns: SessionTurn[]) => Promise<void>;
1519
1547
  /** Replace all turns in-memory (does not persist — use save() for that) */
1520
1548
  setTurns: (turns: SessionTurn[]) => void;
1549
+ /**
1550
+ * Replace all runs in-memory (does not persist — use save() for that).
1551
+ * Mirrors {@link setTurns} for the fork / restore case: callers that
1552
+ * bootstrap a session from an externally-derived snapshot (e.g.
1553
+ * `onForkTurn` copying parent runs into a child session) need this so
1554
+ * the cloned runs land in `data.runs` before the first `save()`.
1555
+ * Production agent runs continue to mutate runs via `startRun` /
1556
+ * `completeRun` / `updateRun`; this is the bulk-replace escape hatch.
1557
+ */
1558
+ setRuns: (runs: SessionRun[]) => void;
1521
1559
  /** Update the session status in memory AND via store.updateStatus (if store present) */
1522
1560
  updateStatus: (status: SessionData['status']) => Promise<void>;
1523
1561
  /** Persist an updated run record via store.updateRun (if store present) */
@@ -1536,6 +1574,14 @@ interface CreateSessionOptions {
1536
1574
  id?: string;
1537
1575
  /** Agent ID label */
1538
1576
  agentId?: string;
1577
+ /**
1578
+ * Project tag — see {@link SessionData.projectRoot}. Stamped once on
1579
+ * creation; ignored when `_data` is set (restoring an existing
1580
+ * session preserves whatever was already persisted there). The TUI
1581
+ * resolves this from `findGitRoot(cwd) ?? cwd` so sessions started
1582
+ * from the same repo (no matter which subdir) share one tag.
1583
+ */
1584
+ projectRoot?: string;
1539
1585
  /** Initial metadata */
1540
1586
  metadata?: Record<string, unknown>;
1541
1587
  /** Storage backend (optional, enables save/load) */
@@ -2288,6 +2334,18 @@ interface AgentHooks {
2288
2334
  }) => void;
2289
2335
  'session:save': (ctx: SessionHookContext) => void;
2290
2336
  }
2337
+ /**
2338
+ * Strongly-typed hook registration map accepted on {@link AgentOptions.hooks}
2339
+ * (and therefore on any {@link Preset}). Each entry is a single handler or an
2340
+ * array of handlers — arrays are what {@link composePresets} produces when
2341
+ * multiple presets register handlers for the same event.
2342
+ *
2343
+ * Handlers registered here live for the **lifetime of the agent**. They fire
2344
+ * across every `run()`, mirroring a manual `agent.hooks.hook(event, fn)` call
2345
+ * made right after `createAgent` returns. For per-run handlers (auto-detached
2346
+ * at run end) use {@link AgentRunOptions.hooks} instead.
2347
+ */
2348
+ type AgentHookMap = Partial<{ [K in keyof AgentHooks]: AgentHooks[K] | AgentHooks[K][] }>;
2291
2349
  interface AgentOptions {
2292
2350
  provider: Provider;
2293
2351
  /** Display name for the agent (used in traces/logs). */
@@ -2314,6 +2372,21 @@ interface AgentOptions {
2314
2372
  session?: Session;
2315
2373
  /** Skills configuration */
2316
2374
  skills?: SkillsConfig;
2375
+ /**
2376
+ * Agent-lifetime hook registrations. Registered once when `createAgent`
2377
+ * returns; identical in effect to calling `agent.hooks.hook(event, fn)` for
2378
+ * each entry. Use this to bake observability / policy hooks into a
2379
+ * {@link Preset} so consumers get them automatically via `...spread`.
2380
+ *
2381
+ * Handlers may be a single function or an array — the array form is what
2382
+ * `composePresets()` produces when multiple presets register handlers for
2383
+ * the same event. Unknown event names throw at agent construction so typos
2384
+ * never silently no-op.
2385
+ *
2386
+ * For per-run handlers (auto-detached at run end) use
2387
+ * {@link AgentRunOptions.hooks}.
2388
+ */
2389
+ hooks?: AgentHookMap;
2317
2390
  /**
2318
2391
  * Test seam — replaces the default MCP connector with a custom
2319
2392
  * implementation. Bypasses the `mcpServers` normalization layer entirely
@@ -2405,8 +2478,9 @@ declare function createAgent({
2405
2478
  session,
2406
2479
  skills: agentSkills,
2407
2480
  mcpConnector,
2408
- eager
2481
+ eager,
2482
+ hooks: initialHooks
2409
2483
  }: AgentOptions): Agent;
2410
2484
  //#endregion
2411
- export { OpenAICompatHttpError as $, loadSession as A, ToolExecutionMode as At, FileMapStoreOptions as B, AgentContextExceededError as Bt, SkillsConfig as C, SessionEndStatus as Ct, SessionRun as D, SpawnHookContext as Dt, SessionData as E, SessionTurn as Et, fromOpenAI as F, TurnFinishReason as Ft, StreamOptions as G, ClassifiedErrorKind as Gt, Provider as H, AgentToolNotAllowedError as Ht, toAnthropic as I, TurnUsage as It, ToolSpec as J, ToolCall as K, matchesContextExceeded as Kt, toOpenAI as L, toolOutputByteLength as Lt, createRemoteStore as M, ToolResultContent as Mt, autoDetectAndConvert as N, ToolResultImageContent as Nt, SessionStore as O, StreamHookContext as Ot, fromAnthropic as P, ToolResultTextContent as Pt, OpenAICompatAuthHeader as Q, createMemoryStore as R, toolResultToText as Rt, SkillSource as S, SessionContentBlock as St, Session as T, SessionMessage as Tt, ProviderCapabilities as U, CONTEXT_EXCEEDED_MESSAGE_PATTERNS as Ut, createFileMapStore as V, AgentProviderError as Vt, StreamCallbacks as W, ClassifiedError as Wt, OpenRouterParams as X, TurnResult as Y, openrouter as Z, ToolDef as _, PromptDocumentPart as _t, ActivationVia as a, openai as at, SkillDiagnostic as b, PromptTextPart as bt, SkillActivationState as c, AnthropicParams as ct, McpConnection as d, AgentRunOptions as dt, OpenAICompatParams as et, connectMcpServers as f, AgentStats as ft, ToolContext as g, OAuthRefreshHookContext as gt, resultToString as h, McpToolHookContext as ht, createAgent as i, OpenAIParams as it, RemoteStoreOptions as j, ToolHookContext as jt, createSession as k, ThinkingLevel as kt, SkillActivationStateOptions as l, anthropic as lt, normalizeMcpServers as m, McpServerConfig as mt, AgentHooks as n, mapOAIFinishReason as nt, ActiveSkill as o, CerebrasParams as ot, normalizeMcpBlocks as p, ChildRunStats as pt, ToolResult as q, toTypedError as qt, AgentOptions as r, openaiCompat as rt, DeactivationReason as s, cerebras as st, Agent as t, classifyOpenAICompatError as tt, createSkillActivationState as u, AgentBehavior as ut, ToolMap as v, PromptImagePart as vt, CreateSessionOptions as w, SessionHookContext as wt, SkillResource as x, RunHookMap as xt, SkillConfig as y, PromptPart as yt, FileMapAdapter as z, AgentAbortedError as zt };
2412
- //# sourceMappingURL=agent-CMIhYhDz.d.ts.map
2485
+ export { OpenAICompatAuthHeader as $, createSession as A, ThinkingLevel as At, FileMapAdapter as B, AgentAbortedError as Bt, SkillSource as C, SessionContentBlock as Ct, SessionData as D, SessionTurn as Dt, Session as E, SessionMessage as Et, fromAnthropic as F, ToolResultTextContent as Ft, StreamCallbacks as G, ClassifiedError as Gt, createFileMapStore as H, AgentProviderError as Ht, fromOpenAI as I, TurnFinishReason as It, ToolResult as J, toTypedError as Jt, StreamOptions as K, ClassifiedErrorKind as Kt, toAnthropic as L, TurnUsage as Lt, RemoteStoreOptions as M, ToolHookContext as Mt, createRemoteStore as N, ToolResultContent as Nt, SessionRun as O, SpawnHookContext as Ot, autoDetectAndConvert as P, ToolResultImageContent as Pt, openrouter as Q, toOpenAI as R, toolOutputByteLength as Rt, SkillResource as S, RunHookMap as St, CreateSessionOptions as T, SessionHookContext as Tt, Provider as U, AgentToolNotAllowedError as Ut, FileMapStoreOptions as V, AgentContextExceededError as Vt, ProviderCapabilities as W, CONTEXT_EXCEEDED_MESSAGE_PATTERNS as Wt, TurnResult as X, ToolSpec as Y, OpenRouterParams as Z, ToolContext as _, OAuthRefreshHookContext as _t, createAgent as a, OpenAIParams as at, SkillConfig as b, PromptPart as bt, DeactivationReason as c, cerebras as ct, createSkillActivationState as d, AgentBehavior as dt, OpenAICompatHttpError as et, McpConnection as f, AgentRunOptions as ft, resultToString as g, McpToolHookContext as gt, normalizeMcpServers as h, McpServerConfig as ht, AgentOptions as i, openaiCompat as it, loadSession as j, ToolExecutionMode as jt, SessionStore as k, StreamHookContext as kt, SkillActivationState as l, AnthropicParams as lt, normalizeMcpBlocks as m, ChildRunStats as mt, AgentHookMap as n, classifyOpenAICompatError as nt, ActivationVia as o, openai as ot, connectMcpServers as p, AgentStats as pt, ToolCall as q, matchesContextExceeded as qt, AgentHooks as r, mapOAIFinishReason as rt, ActiveSkill as s, CerebrasParams as st, Agent as t, OpenAICompatParams as tt, SkillActivationStateOptions as u, anthropic as ut, ToolDef as v, PromptDocumentPart as vt, SkillsConfig as w, SessionEndStatus as wt, SkillDiagnostic as x, PromptTextPart as xt, ToolMap as y, PromptImagePart as yt, createMemoryStore as z, toolResultToText as zt };
2486
+ //# sourceMappingURL=agent-JhicgLOV.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-JhicgLOV.d.ts","names":[],"sources":["../src/errors.ts","../src/types.ts","../src/providers/anthropic.ts","../src/providers/cerebras.ts","../src/providers/openai.ts","../src/providers/openai-compat.ts","../src/providers/openrouter.ts","../src/providers/index.ts","../src/session/file-map.ts","../src/session/memory.ts","../src/session/messages.ts","../src/session/remote.ts","../src/session/index.ts","../src/skills/types.ts","../src/tools/types.ts","../src/mcp/index.ts","../src/skills/activation.ts","../src/agent.ts"],"mappings":";;;;;;;;;;AAYA;;;;;KAAY,mBAAA;;UAGK,eAAA;EACf,IAAA,EAA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,GAAgB,IAAA,aAAiB,OAAA;;;;;EAKjC,eAAA,GAAkB,IAAA,aAAiB,OAAA;Eb3lBnC;;;;;;AAgOF;;;;EasYE,MAAA,QAAc,OAAA;EAAA,SACL,SAAA;EAAA,SACA,KAAA,EAAO,WAAA;EAAA,SACP,SAAA,EAAW,gBAAA;EAAA,SACX,MAAA,EAAQ,eAAA;EAAA,SACR,OAAA,EAAS,OAAA;;WAET,YAAA,WAAuB,WAAA;EZ7DrB;;;;;;EAAA,SYoEF,IAAA,EAAM,QAAA,CAAS,MAAA;AAAA;AAAA,iBAiQV,WAAA,CAAA;EAAc,QAAA;EAAU,IAAA,EAAM,SAAA;EAAW,MAAA,EAAQ,WAAA;EAAa,KAAA,EAAO,UAAA;EAAY,WAAA;EAAa,QAAA,EAAU,aAAA;EAAe,SAAA;EAAW,UAAA;EAAY,OAAA;EAAS,MAAA,EAAQ,WAAA;EAAa,YAAA;EAAc,KAAA;EAAO,KAAA,EAAO;AAAA,GAAgB,YAAA,GAAe,KAAA"}
package/dist/chat.d.ts CHANGED
@@ -1,9 +1,102 @@
1
- import { It as TurnUsage } from "./agent-CMIhYhDz.js";
2
- import { $ as piIdOf, A as titleFromTurns, B as ProviderAuth, C as createStateStore, D as loadState, E as listSessionMeta, F as Screen, G as ProviderDescriptor, H as detectAuth, I as SessionMeta, J as credKeyOf, K as anthropicDescriptor, L as Settings, M as toolResultText, N as Owner, O as saveState, P as Picked, Q as openrouterDescriptor, R as StreamEvent, S as TuiState, T as lastContextSizeFromTurns, U as BUILTIN_PROVIDERS, V as ProviderKey, W as ModelInfo, X as modelsForDescriptor, Y as getContextWindow, Z as openaiDescriptor, _ as ChatOptions, a as Theme, at as DEFAULT_AGENT_ID, b as resolveConfig, c as ThemeSurfaces, ct as singleAgentRegistry, d as ApprovalRequest, et as AgentAccent, f as RequestApproval, g as useSafeModeQueue, h as useSafeModeActions, i as SyntaxTokenStyle, it as BUILTIN_AGENTS, j as toolCallPreview, k as stripSpawnTokensLine, l as resolveTheme, m as SafeModeProvider, n as DEFAULT_THEME, nt as AgentRegistry, o as ThemeColors, ot as PLAN_AGENT, p as SafeModeActions, q as cerebrasDescriptor, r as SyntaxStyles, rt as BUILD_AGENT, s as ThemeSelect, st as resolveAgentId, t as BUILTIN_THEMES, tt as AgentProfile, u as ApprovalDecision, v as ProviderRegistry, w as eventsFromTurns, x as StateStoreApi, y as ResolvedConfig, z as AuthMethod } from "./theme-Caf4AvTO.js";
1
+ import { D as SessionData, Dt as SessionTurn, Lt as TurnUsage, U as Provider, b as SkillConfig, w as SkillsConfig } from "./agent-JhicgLOV.js";
2
+ import { m as SourcedScanPath } from "./index-t_W9i7Ql.js";
3
+ import { $ as Settings, A as useEnabledToggleSet, At as BUILD_AGENT, B as lastContextSizeFromTurns, C as DiscoveredMcp, Ct as modelsForDescriptor, D as parseMcpsFile, Dt as AgentAccent, E as discoverProjectMcps, Et as piIdOf, F as StateStoreApi, Ft as singleAgentRegistry, G as stripSpawnTokensLine, H as loadState, I as TuiState, J as toolResultText, K as titleFromTurns, L as createStateStore, M as ProviderRegistry, Mt as DEFAULT_AGENT_ID, N as ResolvedConfig, Nt as PLAN_AGENT, O as EnabledAllowlistKey, Ot as AgentProfile, P as resolveConfig, Pt as resolveAgentId, Q as SessionMeta, R as deriveSessionTitle, S as splitPromptSegments, St as getContextWindow, T as defaultMcpsConfigPaths, Tt as openrouterDescriptor, U as saveState, V as listSessionMeta, W as selectableTurnIds, X as Picked, Y as Owner, Z as Screen, _ as SafeModeProvider, _t as ModelInfo, a as SyntaxStyles, at as CompletionReference, b as PromptSegment, bt as cerebrasDescriptor, c as ThemeColors, ct as collectReferences, d as resolveChipColor, dt as useCompletion, et as StreamEvent, f as resolveTheme, ft as AuthMethod, g as SafeModeActions, gt as BUILTIN_PROVIDERS, h as RequestApproval, ht as detectAuth, i as DEFAULT_THEME, it as CompletionProvider, j as ChatOptions, jt as BUILTIN_AGENTS, k as EnabledToggleSet, kt as AgentRegistry, l as ThemeSelect, lt as findActiveTrigger, m as ApprovalRequest, mt as ProviderKey, n as ChipColor, nt as CompletionContext, o as SyntaxTokenStyle, ot as CompletionState, p as ApprovalDecision, pt as ProviderAuth, q as toolCallPreview, r as ChipColorMap, rt as CompletionItem, s as Theme, st as applyInsert, t as BUILTIN_THEMES, tt as ActiveTrigger, u as ThemeSurfaces, ut as mergeReferences, v as useSafeModeActions, vt as ProviderDescriptor, w as buildMcpServers, wt as openaiDescriptor, x as PromptSegmentRef, xt as credKeyOf, y as useSafeModeQueue, yt as anthropicDescriptor, z as eventsFromTurns } from "./theme-pJv47erq.js";
3
4
  import { OAuthCredentials } from "@mariozechner/pi-ai/oauth";
4
5
  import { Dispatch, ReactNode, SetStateAction } from "react";
5
6
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
6
7
 
8
+ //#region src/chat/files-discovery.d.ts
9
+ /**
10
+ * Project file discovery for the `@`-prefixed files completion provider.
11
+ *
12
+ * Primary strategy — `git ls-files --cached --others --exclude-standard`.
13
+ * Git already understands `.gitignore`, `.git/info/exclude`, and global
14
+ * excludes, so we get correctness for free + sub-second performance on
15
+ * even huge monorepos. Falls back to a depth-limited filesystem walk when
16
+ * git isn't available or the directory isn't a repo.
17
+ *
18
+ * Pure: callers cache the returned list (e.g. in App state) and pass it
19
+ * into the provider's `getCatalog`. The list is a snapshot — refresh on
20
+ * cwd change or via a user-driven action.
21
+ */
22
+ /** One row in the project file catalog. `path` is forward-slashed + relative to `cwd`. */
23
+ interface FileEntry {
24
+ /** Forward-slashed relative path from the discovery cwd. Stable across OSes. */
25
+ path: string;
26
+ /** Basename — used for prefix ranking in the completion provider. */
27
+ name: string;
28
+ /** Source — `git` when listed via `git ls-files`, `fs` from the walk fallback. */
29
+ source: 'git' | 'fs';
30
+ }
31
+ /** Options for `listProjectFiles`. */
32
+ interface ListProjectFilesOptions {
33
+ /** Discovery root. Default: `process.cwd()`. */
34
+ cwd?: string;
35
+ /** Cap on returned entries. Default: 10,000. Bigger lists fall back to a truncated set. */
36
+ maxFiles?: number;
37
+ /** Aborts the scan early. Useful when re-running on rapid project switches. */
38
+ signal?: AbortSignal;
39
+ }
40
+ /**
41
+ * Discover every non-ignored file under `cwd`. Tries `git ls-files` first;
42
+ * on failure (no git, not a repo, abort) walks the fs with a hand-rolled
43
+ * skip list.
44
+ *
45
+ * Errors are not thrown — the function always returns an array (possibly
46
+ * empty). Callers wanting failure diagnostics can opt into them via
47
+ * `ZIDANE_DEBUG`.
48
+ */
49
+ declare function listProjectFiles(opts?: ListProjectFilesOptions): Promise<FileEntry[]>;
50
+ //#endregion
51
+ //#region src/chat/completion-files.d.ts
52
+ /** Trigger character — `@` is the conventional file-mention prefix in chat UIs. */
53
+ declare const FILES_TRIGGER = "@";
54
+ /**
55
+ * Build an `@`-prefixed files completion provider against a *live* catalog.
56
+ *
57
+ * The factory captures a getter so the catalog can be re-scanned (cwd
58
+ * change, manual refresh) without re-instantiating the provider — the
59
+ * App keeps one provider for the lifetime of the prompt block and just
60
+ * mutates the underlying state.
61
+ *
62
+ * `limit` caps the result list so the popover stays bounded on huge
63
+ * monorepos. Filtering is substring on `path` + `name`, case-insensitive;
64
+ * ranking prefers (in order): exact name match, name prefix, name
65
+ * substring, path substring, alphabetical.
66
+ */
67
+ declare function createFilesCompletionProvider(opts: {
68
+ /** Live file catalog. Re-evaluated per call so refreshes take effect immediately. */getCatalog: () => readonly FileEntry[]; /** Max items returned to the popover. Default: 50. */
69
+ limit?: number;
70
+ }): CompletionProvider<FileEntry>;
71
+ /**
72
+ * Walk a reference list and return the deduplicated set of files in
73
+ * first-mention order — input to "attach these files to the prompt"
74
+ * downstream logic.
75
+ */
76
+ declare function uniqueFilesFromReferences(references: readonly CompletionReference<unknown>[]): FileEntry[];
77
+ //#endregion
78
+ //#region src/chat/completion-skills.d.ts
79
+ /** Trigger character — slash-commands convention. */
80
+ declare const SKILLS_TRIGGER = "/";
81
+ /**
82
+ * Build a slash-command completion provider against a *live* skills
83
+ * catalog. The factory captures a getter so the catalog can change across
84
+ * renders (toggles, reload) without re-instantiating the provider.
85
+ *
86
+ * Pass `getEnabled` to additionally hide skills the user has toggled off
87
+ * — when undefined, every catalog entry is offered.
88
+ */
89
+ declare function createSkillsCompletionProvider(opts: {
90
+ /** Live catalog. Re-evaluated per call so toggles take effect immediately. */getCatalog: () => readonly SkillConfig[]; /** Optional enable-set filter; when undefined every catalog skill is offered. */
91
+ getEnabled?: () => readonly string[] | undefined;
92
+ }): CompletionProvider<SkillConfig>;
93
+ /**
94
+ * Walk a parsed prompt for skill references and return the deduplicated
95
+ * list of skill names — input to `agent.activateSkill(name)` calls on
96
+ * submit.
97
+ */
98
+ declare function uniqueSkillNamesFromReferences(references: readonly CompletionReference<unknown>[]): string[];
99
+ //#endregion
7
100
  //#region src/chat/config-context.d.ts
8
101
  declare function ConfigProvider({
9
102
  config,
@@ -82,6 +175,51 @@ declare function ageString(ts: number, now?: number): string;
82
175
  /** Six-char short form of a session id for headers and lists. */
83
176
  declare function shortId(id: string): string;
84
177
  //#endregion
178
+ //#region src/chat/generate-title.d.ts
179
+ interface GenerateSessionTitleOptions {
180
+ provider: Provider;
181
+ /** Model id used for the call. */
182
+ model: string;
183
+ /** Conversation history to summarize. Empty → throws synchronously. */
184
+ turns: readonly SessionTurn[];
185
+ /** Cap on how many trailing turns to feed the model. Defaults to 10. */
186
+ maxTurns?: number;
187
+ /** Optional cancellation signal — forwarded to the provider's stream. */
188
+ signal?: AbortSignal;
189
+ }
190
+ /**
191
+ * Drive the provider's `stream()` once and return a concise title for
192
+ * the conversation represented by `turns`. Throws when:
193
+ * - `turns` contains no text-bearing content (nothing to summarize),
194
+ * - the provider stream completes with no output text,
195
+ * - `signal` is aborted (rethrown verbatim).
196
+ *
197
+ * Output is trimmed, single-line, with surrounding quotes / trailing
198
+ * punctuation stripped, and truncated to `TITLE_MAX_CHARS`.
199
+ */
200
+ declare function generateSessionTitle({
201
+ provider,
202
+ model,
203
+ turns,
204
+ maxTurns,
205
+ signal
206
+ }: GenerateSessionTitleOptions): Promise<string>;
207
+ /**
208
+ * Normalize a model-generated title into the shape we want to persist:
209
+ *
210
+ * - Collapse internal whitespace + take the first line only (some
211
+ * models emit "Title: foo\n\nReason: …" despite instructions).
212
+ * - Strip surrounding quote characters (`"foo"`, `'foo'`, `` `foo` ``).
213
+ * - Strip a leading `Title:` / `title -` prefix if the model added one.
214
+ * - Strip trailing punctuation (`.`, `!`, `?`) — titles read cleaner
215
+ * without it.
216
+ * - Truncate to `TITLE_MAX_CHARS` with a trailing `…` when over.
217
+ *
218
+ * Exported as `cleanTitle` so tests can pin the normalization rules
219
+ * without going through a mock provider.
220
+ */
221
+ declare function cleanTitle(raw: string): string;
222
+ //#endregion
85
223
  //#region src/chat/oauth.d.ts
86
224
  declare function supportsOAuth(descriptor: ProviderDescriptor): boolean;
87
225
  interface OAuthFlowOptions {
@@ -180,6 +318,80 @@ declare function isOnSafelist(entries: readonly string[], tool: string, input: R
180
318
  */
181
319
  declare function suggestSafelistEntry(tool: string, input: Record<string, unknown>): string;
182
320
  //#endregion
321
+ //#region src/chat/session-export.d.ts
322
+ /** File format supported by the exporter. */
323
+ type SessionExportFormat = 'markdown' | 'json';
324
+ /**
325
+ * Anchor for the resolved destination directory:
326
+ * - `project` — the nearest enclosing git repository (`<repoRoot>/.{prefix}/sessions`)
327
+ * - `home` — fallback when no repo was found (`~/.{prefix}/sessions`)
328
+ */
329
+ type SessionExportAnchor = 'project' | 'home';
330
+ /** Resolved file destination for a session export. */
331
+ interface SessionExportTarget {
332
+ /** Absolute directory holding the file. May not exist yet — `writeSessionExport` creates it on demand. */
333
+ dir: string;
334
+ /** Absolute path of the file (`dir/{id}.{ext}`). */
335
+ filepath: string;
336
+ /** Where the destination was anchored. */
337
+ anchor: SessionExportAnchor;
338
+ }
339
+ /** Options shared by every resolve / write entry-point. */
340
+ interface ResolveOptions {
341
+ /** Discovery cwd. Defaults to `process.cwd()`. */
342
+ cwd?: string;
343
+ /** User home directory. Defaults to `os.homedir()`. */
344
+ home?: string;
345
+ /**
346
+ * Storage prefix. Leading dot tolerated (`zidane` and `.zidane` are
347
+ * equivalent). Defaults to `'.zidane'`.
348
+ */
349
+ prefix?: string;
350
+ }
351
+ /**
352
+ * Resolve the export target for a session id + format. Pure: no fs
353
+ * write happens here, the caller decides whether to `existsSync` the
354
+ * directory or hand the path to `writeSessionExport`.
355
+ *
356
+ * Anchor selection walks upward from `cwd` looking for a `.git` entry;
357
+ * the first hit anchors to that repo's root (`project`). When the walk
358
+ * exits without finding `.git`, the destination anchors to `home`.
359
+ *
360
+ * @throws RangeError when `sessionId` would resolve to an empty / `..`
361
+ * filename — defensive guard against malicious or buggy callers
362
+ * crossing into a sibling directory via the id.
363
+ */
364
+ declare function resolveSessionExportTarget(opts: {
365
+ sessionId: string;
366
+ format: SessionExportFormat;
367
+ } & ResolveOptions): SessionExportTarget;
368
+ /**
369
+ * Render a session into a string in the requested format.
370
+ *
371
+ * `markdown` produces a human-readable transcript: a YAML-free header
372
+ * block with the title and a one-line `id · created · turns` summary,
373
+ * a stats section (turns / runs / tokens / cost / status), then a
374
+ * `## Conversation` block where each turn renders as `### N. role ·
375
+ * run_X · ISO-date` with text, thinking, tool calls, and tool results
376
+ * formatted as appropriate fenced blocks. Useful for sharing a session
377
+ * with a teammate or pasting into an issue tracker.
378
+ *
379
+ * `json` returns a 2-space-indented, deterministic dump of the full
380
+ * `SessionData` blob. Useful for re-importing into the store or for
381
+ * post-hoc analysis tooling.
382
+ */
383
+ declare function renderSession(session: SessionData, format: SessionExportFormat): string;
384
+ /**
385
+ * Render `session` and write the resulting bytes to disk. Returns the
386
+ * resolved target so the caller can show the user where the file
387
+ * landed. The parent directory is created on demand (`recursive: true`)
388
+ * — first-time exports don't need any pre-flight setup.
389
+ */
390
+ declare function writeSessionExport(opts: {
391
+ session: SessionData;
392
+ format: SessionExportFormat;
393
+ } & ResolveOptions): Promise<SessionExportTarget>;
394
+ //#endregion
183
395
  //#region src/chat/settings-context.d.ts
184
396
  declare const DEFAULT_SETTINGS: Settings;
185
397
  interface SettingsContextValue {
@@ -202,10 +414,14 @@ declare function useSettings(): SettingsContextValue;
202
414
  /**
203
415
  * Keys of `Settings` whose value type is exactly `boolean`. Used to type
204
416
  * the toggle table so `SETTINGS_TOGGLES.key` only ever points to a
205
- * boolean-valued setting — string-valued settings like `theme` live in
206
- * `SETTINGS_CHOICES`.
417
+ * boolean-valued setting — string- and array-valued settings (theme,
418
+ * enabledSkills, …) live in `SETTINGS_CHOICES` or actions.
419
+ *
420
+ * `-?` strips optionality from the mapped output so `Settings[K]` doesn't
421
+ * silently broaden into `T | undefined` and short-circuit the `extends
422
+ * boolean` check via `undefined`.
207
423
  */
208
- type BooleanSettingKey = { [K in keyof Settings]: Settings[K] extends boolean ? K : never }[keyof Settings];
424
+ type BooleanSettingKey = { [K in keyof Settings]-?: Settings[K] extends boolean ? K : never }[keyof Settings];
209
425
  /**
210
426
  * Static description of every togglable setting, in display order. The TUI's
211
427
  * `SettingsModal` and any future GUI settings panel build their row list
@@ -237,6 +453,57 @@ interface SettingsChoice<K extends keyof Settings = keyof Settings> {
237
453
  }
238
454
  declare const SETTINGS_CHOICES: readonly SettingsChoice[];
239
455
  //#endregion
456
+ //#region src/chat/skills-discovery.d.ts
457
+ /**
458
+ * Resolve the default skill scan paths for a project. First-found wins on
459
+ * collision; earlier entries take precedence.
460
+ *
461
+ * Search order — see {@link projectUserPaths}. Non-existent paths are
462
+ * returned so downstream code can choose whether to create them;
463
+ * `discoverSkills` itself skips missing dirs without error.
464
+ */
465
+ declare function defaultSkillScanPaths(opts?: {
466
+ cwd?: string;
467
+ home?: string;
468
+ prefix?: string;
469
+ }): SourcedScanPath[];
470
+ /**
471
+ * Discover every skill reachable from the default scan paths. Returns
472
+ * parsed `SkillConfig`s with `name`, `description`, frontmatter, and
473
+ * lenient-load diagnostics. Pure I/O — does not activate or write.
474
+ *
475
+ * `signal` is forwarded to `discoverSkills` so the TUI's directory-watch
476
+ * effect can cancel a long scan when the user switches `cwd` rapidly.
477
+ *
478
+ * Errors during parse are surfaced as `diagnostics` on the returned
479
+ * skill, not thrown — keeps the picker usable even when a single
480
+ * SKILL.md is malformed.
481
+ */
482
+ declare function discoverProjectSkills(opts?: {
483
+ cwd?: string;
484
+ home?: string;
485
+ prefix?: string;
486
+ signal?: AbortSignal;
487
+ }): Promise<SkillConfig[]>;
488
+ /**
489
+ * Map a user-toggled enable list onto the format `createAgent` expects.
490
+ *
491
+ * Conventions:
492
+ * - `enabled === undefined` → all discovered skills enabled (default).
493
+ * - `enabled === []` → fully off; the agent will not scan or
494
+ * inject the skills tools.
495
+ * - `enabled === [names]` → allowlist; skills not in the list are
496
+ * left out of the catalog.
497
+ *
498
+ * `scan` is the resolved scan-path list (passed through verbatim). Pass
499
+ * `defaultSkillScanPaths()` for the standard project + user paths, or
500
+ * supply a host-specific list.
501
+ */
502
+ declare function buildSkillsConfig(opts: {
503
+ scan: SourcedScanPath[];
504
+ enabled?: readonly string[];
505
+ }): SkillsConfig;
506
+ //#endregion
240
507
  //#region src/chat/streaming.d.ts
241
508
  /** Flip any trailing streaming markdown blocks (any owner) to finalized. */
242
509
  declare function finalizeStreamingMarkdown(events: StreamEvent[]): StreamEvent[];
@@ -260,6 +527,13 @@ interface StreamSource {
260
527
  childId?: string;
261
528
  /** Nesting depth — 0 for parent, ≥ 1 for subagents. */
262
529
  depth?: number;
530
+ /**
531
+ * `SessionTurn.id` this delta belongs to. Tagged onto new events so the
532
+ * TUI's select-turn mode can group every event from one turn. Stored on
533
+ * the active bucket and refreshed on every delta so a turn boundary
534
+ * (`turn:after` flushes the bucket) doesn't carry stale ids forward.
535
+ */
536
+ turnId?: string;
263
537
  }
264
538
  interface StreamBuffer {
265
539
  /** Queue a streaming delta for the next flush tick. */
@@ -302,5 +576,61 @@ declare const CATPPUCCIN_LATTE: Theme;
302
576
  //#region src/chat/themes/vaporwave.d.ts
303
577
  declare const VAPORWAVE_THEME: Theme;
304
578
  //#endregion
305
- export { type AgentAccent, type AgentProfile, type AgentRegistry, type ApiKeyCredential, type ApprovalDecision, type ApprovalRequest, type AuthMethod, BUILD_AGENT, BUILTIN_AGENTS, BUILTIN_PROVIDERS, BUILTIN_THEMES, type BooleanSettingKey, CATPPUCCIN_FRAPPE, CATPPUCCIN_LATTE, CATPPUCCIN_MACCHIATO, CATPPUCCIN_MOCHA, type ChatOptions, ConfigProvider, type CredentialsFile, DEFAULT_AGENT_ID, DEFAULT_SETTINGS, DEFAULT_THEME, IMPLICITLY_SAFE_TOOLS, type ModelInfo, type OAuthCredential, type OAuthFlowOptions, type Owner, PLAN_AGENT, type Picked, type ProjectEntry, type ProjectsFile, type ProviderAuth, type ProviderCredential, type ProviderDescriptor, type ProviderKey, type ProviderRegistry, type RequestApproval, type ResolvedConfig, SETTINGS_CHOICES, SETTINGS_TOGGLES, type SafeModeActions, SafeModeProvider, type Screen, type SessionMeta, type Settings, type SettingsChoice, SettingsProvider, type SettingsToggle, type StateStoreApi, type StreamBuffer, type StreamEvent, type StreamSource, type SyntaxStyles, type SyntaxTokenStyle, type Theme, type ThemeColors, ThemeProvider, type ThemeSelect, type ThemeSurfaces, type TuiState, VAPORWAVE_THEME, addToSafelist, ageString, anthropicDescriptor, applyApiKeyEnv, cerebrasDescriptor, createStateStore, credKeyOf, credentialsPath, detectAuth, eventsFromTurns, finalizeStreamingMarkdown, finalizeStreamingMarkdownForOwner, fmtTokens, getContextWindow, getSafelist, isOnSafelist, lastContextSizeFromTurns, listSessionMeta, loadState, matchesSafelistEntry, modelsForDescriptor, openaiDescriptor, openrouterDescriptor, piIdOf, projectsFilePath, readCredentials, readProjects, readProviderCredential, removeProviderCredential, resolveAgentId, resolveConfig, resolveTheme, runOAuthLogin, saveState, setProviderCredential, shortId, singleAgentRegistry, stripSpawnTokensLine, suggestSafelistEntry, supportsOAuth, titleFromTurns, toolCallPreview, toolResultText, turnContextSize, useColors, useConfig, useSafeModeActions, useSafeModeQueue, useSelectStyle, useSettings, useStreamBuffer, useSurfaces, useSyntaxStyles, useTheme, writeCredentials, writeProjects };
579
+ //#region src/chat/turn-operations.d.ts
580
+ /**
581
+ * Fork — keep every turn up to and including `turnId`, then strip any
582
+ * `tool_call` blocks left without a matching `tool_result` in the slice.
583
+ *
584
+ * Semantics:
585
+ * - Include the selected turn ("branch from HERE" mental model — the
586
+ * user wants the selected message to be the latest in the fork).
587
+ * - If the selected turn is an assistant turn with unresolved
588
+ * `tool_call` blocks (their `tool_result`s live in turns AFTER the
589
+ * slice), strip those calls. Otherwise the fork would post an
590
+ * assistant turn with no matching tool results, breaking the next
591
+ * provider call.
592
+ * - Drop turns that become empty (all blocks stripped).
593
+ *
594
+ * Returns `null` when `turnId` doesn't exist in `turns` — caller should
595
+ * surface a "turn not found" error rather than silently no-op.
596
+ */
597
+ declare function truncateTurnsAt(turns: readonly SessionTurn[], turnId: string): SessionTurn[] | null;
598
+ /**
599
+ * Delete — remove the turn with `turnId` and any tool blocks left
600
+ * orphaned by the removal. Returns `null` when `turnId` doesn't exist.
601
+ *
602
+ * Strategy:
603
+ * 1. Drop the target turn.
604
+ * 2. Scan the remaining turns for `tool_call`s without a matching
605
+ * `tool_result` (orphaned by removing the user turn that carried
606
+ * the result), and `tool_result`s without a matching `tool_call`
607
+ * (orphaned by removing the assistant turn that issued the call).
608
+ * Strip both sides.
609
+ * 3. Drop turns whose content is now empty.
610
+ *
611
+ * This guarantees the resulting history is protocol-clean — a follow-up
612
+ * `agent.run()` against the modified session can post turns without the
613
+ * provider rejecting the history.
614
+ */
615
+ declare function deleteTurnSafely(turns: readonly SessionTurn[], turnId: string): SessionTurn[] | null;
616
+ /**
617
+ * Serialize a turn's content to a clean text representation suited for
618
+ * the clipboard. Joins text + thinking blocks verbatim; tool calls and
619
+ * tool results get bracketed labels so the user can paste a readable
620
+ * record of what happened without losing structure.
621
+ *
622
+ * Empty turns return `''`.
623
+ */
624
+ declare function turnAsText(turn: SessionTurn): string;
625
+ /**
626
+ * Count turns before / after the one identified by `turnId` in the
627
+ * given list. Returns `null` when the id is missing. Used to label the
628
+ * turn-details modal with `N before · M after`.
629
+ */
630
+ declare function countNeighbors(turnIds: readonly string[], turnId: string): {
631
+ before: number;
632
+ after: number;
633
+ } | null;
634
+ //#endregion
635
+ export { type ActiveTrigger, type AgentAccent, type AgentProfile, type AgentRegistry, type ApiKeyCredential, type ApprovalDecision, type ApprovalRequest, type AuthMethod, BUILD_AGENT, BUILTIN_AGENTS, BUILTIN_PROVIDERS, BUILTIN_THEMES, type BooleanSettingKey, CATPPUCCIN_FRAPPE, CATPPUCCIN_LATTE, CATPPUCCIN_MACCHIATO, CATPPUCCIN_MOCHA, type ChatOptions, type ChipColor, type ChipColorMap, type CompletionContext, type CompletionItem, type CompletionProvider, type CompletionReference, type CompletionState, ConfigProvider, type CredentialsFile, DEFAULT_AGENT_ID, DEFAULT_SETTINGS, DEFAULT_THEME, type DiscoveredMcp, type EnabledAllowlistKey, type EnabledToggleSet, FILES_TRIGGER, type FileEntry, type GenerateSessionTitleOptions, IMPLICITLY_SAFE_TOOLS, type ListProjectFilesOptions, type ModelInfo, type OAuthCredential, type OAuthFlowOptions, type Owner, PLAN_AGENT, type Picked, type ProjectEntry, type ProjectsFile, type PromptSegment, type PromptSegmentRef, type ProviderAuth, type ProviderCredential, type ProviderDescriptor, type ProviderKey, type ProviderRegistry, type RequestApproval, type ResolvedConfig, SETTINGS_CHOICES, SETTINGS_TOGGLES, SKILLS_TRIGGER, type SafeModeActions, SafeModeProvider, type Screen, type SessionExportAnchor, type SessionExportFormat, type SessionExportTarget, type SessionMeta, type Settings, type SettingsChoice, SettingsProvider, type SettingsToggle, type StateStoreApi, type StreamBuffer, type StreamEvent, type StreamSource, type SyntaxStyles, type SyntaxTokenStyle, type Theme, type ThemeColors, ThemeProvider, type ThemeSelect, type ThemeSurfaces, type TuiState, VAPORWAVE_THEME, addToSafelist, ageString, anthropicDescriptor, applyApiKeyEnv, applyInsert, buildMcpServers, buildSkillsConfig, cerebrasDescriptor, cleanTitle, collectReferences, countNeighbors, createFilesCompletionProvider, createSkillsCompletionProvider, createStateStore, credKeyOf, credentialsPath, defaultMcpsConfigPaths, defaultSkillScanPaths, deleteTurnSafely, deriveSessionTitle, detectAuth, discoverProjectMcps, discoverProjectSkills, eventsFromTurns, finalizeStreamingMarkdown, finalizeStreamingMarkdownForOwner, findActiveTrigger, fmtTokens, generateSessionTitle, getContextWindow, getSafelist, isOnSafelist, lastContextSizeFromTurns, listProjectFiles, listSessionMeta, loadState, matchesSafelistEntry, mergeReferences, modelsForDescriptor, openaiDescriptor, openrouterDescriptor, parseMcpsFile, piIdOf, projectsFilePath, readCredentials, readProjects, readProviderCredential, removeProviderCredential, renderSession, resolveAgentId, resolveChipColor, resolveConfig, resolveSessionExportTarget, resolveTheme, runOAuthLogin, saveState, selectableTurnIds, setProviderCredential, shortId, singleAgentRegistry, splitPromptSegments, stripSpawnTokensLine, suggestSafelistEntry, supportsOAuth, titleFromTurns, toolCallPreview, toolResultText, truncateTurnsAt, turnAsText, turnContextSize, uniqueFilesFromReferences, uniqueSkillNamesFromReferences, useColors, useCompletion, useConfig, useEnabledToggleSet, useSafeModeActions, useSafeModeQueue, useSelectStyle, useSettings, useStreamBuffer, useSurfaces, useSyntaxStyles, useTheme, writeCredentials, writeProjects, writeSessionExport };
306
636
  //# sourceMappingURL=chat.d.ts.map