@cjhyy/code-shell 0.1.6 → 0.2.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 (171) hide show
  1. package/dist/anthropic-OVRWAZRD.js +1 -0
  2. package/dist/arena/index.js +1 -104
  3. package/dist/arena-64T2EQD4.js +3 -0
  4. package/dist/bwrap-PVZMLHZR.js +2 -0
  5. package/dist/chunk-2EUIMKJA.js +1 -0
  6. package/dist/chunk-2GJ7H5NC.js +641 -0
  7. package/dist/chunk-2OD6VR4N.js +2 -0
  8. package/dist/chunk-3QP5BQ3L.js +1 -0
  9. package/dist/chunk-A4M2Y42L.js +2 -0
  10. package/dist/chunk-DEYFK6FP.js +1 -0
  11. package/dist/chunk-DTPABBSV.js +2 -0
  12. package/dist/chunk-EU3J7TBP.js +1 -0
  13. package/dist/chunk-FU7AHZNN.js +1 -0
  14. package/dist/chunk-L7B2ORID.js +4 -0
  15. package/dist/chunk-M7VU4YVY.js +49 -0
  16. package/dist/chunk-MGP35GKD.js +254 -0
  17. package/dist/chunk-MLCTC53I.js +1 -0
  18. package/dist/chunk-O5HFCH2U.js +1 -0
  19. package/dist/chunk-P6JSTIFM.js +1 -0
  20. package/dist/chunk-Q3RSX66I.js +1 -0
  21. package/dist/chunk-QTWU7UNA.js +5 -0
  22. package/dist/chunk-RERBX75D.js +251 -0
  23. package/dist/chunk-SNFAPSLA.js +1 -0
  24. package/dist/chunk-T222K6IV.js +18 -0
  25. package/dist/chunk-TKJA6W36.js +3 -0
  26. package/dist/chunk-VKKU4LOM.js +3 -0
  27. package/dist/chunk-WI6FSWGU.js +1 -0
  28. package/dist/chunk-XXCZE2U2.js +2 -0
  29. package/dist/chunk-ZSAONDT6.js +2 -0
  30. package/dist/cli/main.js +303 -22060
  31. package/dist/cli/onboarding.d.ts +7 -2
  32. package/dist/client-base-F5FCRSB3.js +1 -0
  33. package/dist/compaction-L3Y6NG4N.js +1 -0
  34. package/dist/context/compaction.d.ts +2 -1
  35. package/dist/data/static-catalogs.d.ts +25 -0
  36. package/dist/devtools-SGDUOOM4.js +1 -0
  37. package/dist/engine/engine.d.ts +24 -0
  38. package/dist/engine/turn-loop.d.ts +20 -0
  39. package/dist/export-md-U72T7NW7.js +22 -0
  40. package/dist/file-history-7FQFEQOL.js +1 -0
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.js +1 -347
  43. package/dist/llm/capabilities/index.d.ts +20 -0
  44. package/dist/llm/capabilities/rules.d.ts +26 -0
  45. package/dist/llm/capabilities/types.d.ts +108 -0
  46. package/dist/llm/model-pool.d.ts +7 -0
  47. package/dist/llm/provider-catalog.d.ts +2 -0
  48. package/dist/llm/provider-kinds.d.ts +1 -1
  49. package/dist/llm/providers/openai.d.ts +22 -0
  50. package/dist/llm/token-counter.d.ts +17 -0
  51. package/dist/llm/types.d.ts +8 -0
  52. package/dist/logging/logger.d.ts +10 -2
  53. package/dist/logging/session-recorder.d.ts +16 -3
  54. package/dist/manager-J6FXEUEK.js +1 -0
  55. package/dist/mcp-manager-27EVBKRT.js +1 -0
  56. package/dist/memory-BNI4WEWL.js +1 -0
  57. package/dist/model-cache-HEDXI7UJ.js +1 -0
  58. package/dist/model-fetcher-X5W5EASG.js +1 -0
  59. package/dist/off-7SDVMMXW.js +1 -0
  60. package/dist/openai-3QEADSYL.js +1 -0
  61. package/dist/openrouter-models-GZVCRWD2.js +1 -0
  62. package/dist/openrouter-sync-WG4AG5NC.js +1 -0
  63. package/dist/product/index.js +1 -21
  64. package/dist/protocol/client.d.ts +1 -1
  65. package/dist/run/index.js +1 -48
  66. package/dist/seatbelt-L54CNI2Y.js +37 -0
  67. package/dist/session/session-manager.d.ts +2 -0
  68. package/dist/session-manager-AGWS5SMJ.js +1 -0
  69. package/dist/settings/schema.d.ts +147 -21
  70. package/dist/tool-summary-V2B3MD5N.js +2 -0
  71. package/dist/tool-system/builtin/bash.d.ts +7 -1
  72. package/dist/tool-system/context.d.ts +7 -0
  73. package/dist/tool-system/executor.d.ts +4 -0
  74. package/dist/tool-system/sandbox/bwrap.d.ts +13 -0
  75. package/dist/tool-system/sandbox/index.d.ts +78 -0
  76. package/dist/tool-system/sandbox/off.d.ts +2 -0
  77. package/dist/tool-system/sandbox/seatbelt.d.ts +18 -0
  78. package/dist/tool-system/task-guard.d.ts +30 -0
  79. package/dist/types.d.ts +17 -0
  80. package/dist/ui/components/SessionPicker.d.ts +2 -0
  81. package/dist/ui/components/SpinnerWithVerb.d.ts +7 -2
  82. package/dist/ui/components/StatusLine.d.ts +7 -3
  83. package/dist/updater-OCNU2K2Z.js +1 -0
  84. package/package.json +7 -10
  85. package/dist/anthropic-IBTI4WL2.cjs +0 -10
  86. package/dist/anthropic-PRZZKHEZ.js +0 -10
  87. package/dist/arena/index.cjs +0 -104
  88. package/dist/arena-2LTLIXOL.js +0 -261
  89. package/dist/arena-ADB7DRFI.cjs +0 -261
  90. package/dist/chunk-2YW4FPFG.cjs +0 -101
  91. package/dist/chunk-3OA5G4TM.js +0 -47
  92. package/dist/chunk-3QO25N6E.js +0 -4711
  93. package/dist/chunk-3SBSUOWZ.js +0 -447
  94. package/dist/chunk-52LGZKT3.cjs +0 -47
  95. package/dist/chunk-55XGPMAP.cjs +0 -146
  96. package/dist/chunk-6QVAYW7C.cjs +0 -438
  97. package/dist/chunk-6S4BJ65N.js +0 -113
  98. package/dist/chunk-76HYEPDM.js +0 -307
  99. package/dist/chunk-7BI3V74Y.cjs +0 -447
  100. package/dist/chunk-7EG3V4JY.cjs +0 -113
  101. package/dist/chunk-7JVTYEEC.js +0 -340
  102. package/dist/chunk-7QIM3BKD.js +0 -44
  103. package/dist/chunk-7Y6S3OCX.js +0 -438
  104. package/dist/chunk-ABRRONJ7.js +0 -107
  105. package/dist/chunk-BSW22MPA.js +0 -146
  106. package/dist/chunk-BXCY2FSE.js +0 -203
  107. package/dist/chunk-BZ5TNE7L.js +0 -5128
  108. package/dist/chunk-DDB6QOKJ.cjs +0 -1252
  109. package/dist/chunk-HEKQCI7B.cjs +0 -224
  110. package/dist/chunk-IK4EWJBP.cjs +0 -203
  111. package/dist/chunk-ILHE7XLT.cjs +0 -107
  112. package/dist/chunk-JMR33QVF.cjs +0 -169
  113. package/dist/chunk-KAQHULYN.js +0 -54
  114. package/dist/chunk-KE4EQOWA.js +0 -294
  115. package/dist/chunk-KOVYSDHZ.cjs +0 -340
  116. package/dist/chunk-KS3RYAYL.cjs +0 -45
  117. package/dist/chunk-MD32R22I.js +0 -50
  118. package/dist/chunk-MV7YI4WO.cjs +0 -293
  119. package/dist/chunk-MY5XHADU.cjs +0 -216
  120. package/dist/chunk-NUNC3VFB.cjs +0 -307
  121. package/dist/chunk-PKGRTCCY.js +0 -9092
  122. package/dist/chunk-QARL3IDQ.js +0 -1252
  123. package/dist/chunk-S754JHLR.cjs +0 -54
  124. package/dist/chunk-SFXHZSRF.js +0 -101
  125. package/dist/chunk-SIHHIQLO.js +0 -224
  126. package/dist/chunk-T6VYG46N.js +0 -105
  127. package/dist/chunk-TNLGBJYS.cjs +0 -44
  128. package/dist/chunk-TUY2T5KP.cjs +0 -105
  129. package/dist/chunk-UXOCVJJ6.cjs +0 -9092
  130. package/dist/chunk-VIAGTYYW.js +0 -169
  131. package/dist/chunk-WASS5YWB.js +0 -215
  132. package/dist/chunk-WZJV6DJC.cjs +0 -5128
  133. package/dist/chunk-YIQBXAYU.cjs +0 -264
  134. package/dist/chunk-YKIAELDZ.cjs +0 -4711
  135. package/dist/chunk-ZBPSQCPU.js +0 -264
  136. package/dist/cli/main.cjs +0 -22156
  137. package/dist/client-base-HTF236ZD.cjs +0 -9
  138. package/dist/client-base-QKRKCOWB.js +0 -9
  139. package/dist/compaction-6VU2T643.js +0 -33
  140. package/dist/compaction-OKUNTCA7.cjs +0 -33
  141. package/dist/devtools-T2NIZBJK.cjs +0 -6
  142. package/dist/devtools-YXWHOVKR.js +0 -6
  143. package/dist/export-md-RXDW6F5W.cjs +0 -135
  144. package/dist/export-md-XXKZANW5.js +0 -135
  145. package/dist/file-history-KYPE3ECT.cjs +0 -7
  146. package/dist/file-history-LF4F7X26.js +0 -7
  147. package/dist/index.cjs +0 -347
  148. package/dist/manager-D65VFAPX.js +0 -7
  149. package/dist/manager-TTF5VHJC.cjs +0 -7
  150. package/dist/mcp-manager-QMKWPBZ4.js +0 -8
  151. package/dist/mcp-manager-Z3OKI74O.cjs +0 -8
  152. package/dist/memory-5LWZ6FI2.cjs +0 -9
  153. package/dist/memory-VIJLBAMQ.js +0 -9
  154. package/dist/model-cache-5KIYL5SL.js +0 -13
  155. package/dist/model-cache-OED3IM4R.cjs +0 -13
  156. package/dist/model-fetcher-HKGICACL.js +0 -8
  157. package/dist/model-fetcher-UR6WJOQP.cjs +0 -8
  158. package/dist/openai-JR2WEKOF.js +0 -10
  159. package/dist/openai-YBTOET4O.cjs +0 -10
  160. package/dist/openrouter-models-H56GHBHN.js +0 -15
  161. package/dist/openrouter-models-TWUFWZ5T.cjs +0 -15
  162. package/dist/openrouter-sync-5VMGN6C2.cjs +0 -11
  163. package/dist/openrouter-sync-ALEMF5IU.js +0 -11
  164. package/dist/product/index.cjs +0 -21
  165. package/dist/run/index.cjs +0 -48
  166. package/dist/session-manager-Q22BBMD3.js +0 -8
  167. package/dist/session-manager-XODQVL3C.cjs +0 -8
  168. package/dist/tool-summary-63DPIS7G.cjs +0 -31
  169. package/dist/tool-summary-NP5CDBKG.js +0 -31
  170. package/dist/updater-I7QBW4DP.cjs +0 -17
  171. package/dist/updater-NVME5S3Z.js +0 -17
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Per-(provider, model) capability descriptor.
3
+ *
4
+ * Captures the subset of request-shape divergence we've actually observed
5
+ * cause HTTP 400s or behavior changes. Each rule in `rules.ts` produces
6
+ * one of these; clients spread it into the outgoing request.
7
+ *
8
+ * Sources for every field are documented next to the matching rule in
9
+ * `rules.ts` — vendor docs, not folklore.
10
+ */
11
+ import type { ProviderKindName } from "../provider-kinds.js";
12
+ /** OpenAI-style reasoning effort levels — shared by several vendors. */
13
+ export type ReasoningEffort = "minimal" | "low" | "medium" | "high";
14
+ /** A binary thinking switch, like DeepSeek V4 and Z.AI GLM use. */
15
+ export type ThinkingSwitch = "enabled" | "disabled";
16
+ /**
17
+ * How the vendor exposes a "think harder / think less" knob (or none).
18
+ * Each kind has different field names and value shapes — we keep them
19
+ * separate so the engine can't accidentally cross-pollinate.
20
+ */
21
+ export type ReasoningShape = {
22
+ kind: "none";
23
+ }
24
+ /** DeepSeek V4, Z.AI GLM-4.5+ — `{thinking: {type: "enabled"|"disabled"}}` at top level. */
25
+ | {
26
+ kind: "deepseek-thinking";
27
+ }
28
+ /**
29
+ * OpenAI o-series & gpt-5+ — `reasoning_effort: "minimal"|"low"|"medium"|"high"`.
30
+ * `disabledEffort` is the value we send when the caller asks for thinking
31
+ * "disabled" — defaults to `"minimal"` (OpenAI), but vendors with a
32
+ * narrower vocabulary override it (e.g. xAI Grok 4.3 has no `"minimal"`;
33
+ * Mistral Magistral only accepts `"high"` and `"none"`).
34
+ */
35
+ | {
36
+ kind: "openai-effort";
37
+ disabledEffort?: ReasoningEffort | "none";
38
+ }
39
+ /** Anthropic Claude 4.x ≤ 4.5 — `{thinking: {type: "enabled", budget_tokens: N}}`. */
40
+ | {
41
+ kind: "anthropic-budget";
42
+ minBudgetTokens: number;
43
+ }
44
+ /** Anthropic Claude 4.6+ — no opt-in, thinking is adaptive. Sending `type: "enabled"` 400s. */
45
+ | {
46
+ kind: "anthropic-adaptive";
47
+ }
48
+ /** OpenRouter normalized — `{reasoning: {effort, max_tokens, exclude, enabled}}`. */
49
+ | {
50
+ kind: "openrouter-reasoning";
51
+ };
52
+ /**
53
+ * How prior `reasoning_content` (or `thinking` blocks) must be threaded
54
+ * back into the next request.
55
+ */
56
+ export type EchoReasoning =
57
+ /** DeepSeek `deepseek-reasoner`: 400 if you echo it back at all. */
58
+ "never"
59
+ /** DeepSeek V4 + tools, Claude 4.x + tools: must echo or 400. */
60
+ | "when-tools"
61
+ /** Optional — echo if you have it, but absence is fine. */
62
+ | "optional";
63
+ /**
64
+ * Parallel-tool-call shape. OpenAI exposes `parallel_tool_calls: bool`.
65
+ * Anthropic exposes it inside `tool_choice.disable_parallel_tool_use`.
66
+ * Some endpoints don't support it at all.
67
+ */
68
+ export type ParallelToolCallsShape = "openai-flag" | "anthropic-disable-flag" | "unsupported";
69
+ /**
70
+ * Streaming usage signal. OpenAI-compat needs `stream_options:
71
+ * {include_usage: true}`; Anthropic always emits usage in
72
+ * `message_delta`; some endpoints reject the field.
73
+ */
74
+ export type StreamUsageShape = "include-usage-flag" | "auto" | "none";
75
+ export interface Capability {
76
+ /** Token-limit request field. */
77
+ tokenLimitField: "max_tokens" | "max_completion_tokens";
78
+ /**
79
+ * Request fields the model 400s on (or silently drops). We just don't
80
+ * send them. Names are in OpenAI-compat spelling; clients translate
81
+ * for native protocols.
82
+ */
83
+ rejectedParams: ReadonlySet<"temperature" | "top_p" | "presence_penalty" | "frequency_penalty" | "logit_bias" | "logprobs" | "top_logprobs">;
84
+ /** How thinking is exposed (or not). */
85
+ reasoning: ReasoningShape;
86
+ /** Echo-back contract for prior reasoning. */
87
+ echoReasoning: EchoReasoning;
88
+ /** Parallel-tool-calls flag shape. */
89
+ parallelToolCalls: ParallelToolCallsShape;
90
+ /** Streaming usage reporting shape. */
91
+ streamUsage: StreamUsageShape;
92
+ }
93
+ /**
94
+ * Conservative default — used when no rule matches. Picks "send everything
95
+ * the vanilla OpenAI Chat Completions spec accepts," because that's what
96
+ * every OpenAI-compat endpoint at minimum understands.
97
+ */
98
+ export declare const DEFAULT_CAPABILITY: Capability;
99
+ export interface CapabilityRule {
100
+ /** Which provider kind this rule applies to. */
101
+ kind: ProviderKindName;
102
+ /** Model-id matcher. First matching rule wins (per kind). */
103
+ match: RegExp;
104
+ /** Patch applied on top of DEFAULT_CAPABILITY. */
105
+ capability: Partial<Capability>;
106
+ /** Free-text reason — shown in logs, helps future-you. */
107
+ why: string;
108
+ }
@@ -29,6 +29,13 @@ export interface ModelEntry {
29
29
  /** Optional reference into ProviderCatalog. When set, baseUrl/apiKey
30
30
  * come from the catalog unless the entry overrides them. */
31
31
  providerKey?: string;
32
+ /**
33
+ * Per-model thinking override. Wins over the provider-level setting
34
+ * (ProviderCatalog entry's `thinking`). Useful when models in the same
35
+ * provider need different defaults — e.g. DeepSeek V4 Pro off but
36
+ * V4 Flash on.
37
+ */
38
+ thinking?: "enabled" | "disabled";
32
39
  }
33
40
  export declare class ModelPool {
34
41
  private models;
@@ -13,6 +13,8 @@ export interface ProviderConfig {
13
13
  apiKey?: string;
14
14
  protocol?: "openai-compat" | "anthropic-style";
15
15
  modelsPath?: string;
16
+ /** Default DeepSeek V4 thinking-mode for this provider. See LLMConfig. */
17
+ thinking?: "enabled" | "disabled";
16
18
  }
17
19
  export declare class ProviderCatalog {
18
20
  private byKey;
@@ -6,7 +6,7 @@
6
6
  * (chat-completion only — embeddings / TTS / image generation are
7
7
  * filtered out so they don't show up in the model picker).
8
8
  */
9
- export type ProviderKindName = "openai" | "anthropic" | "deepseek" | "xai" | "mistral" | "groq" | "google" | "openrouter" | "ollama" | "custom";
9
+ export type ProviderKindName = "openai" | "anthropic" | "deepseek" | "zai" | "xai" | "mistral" | "groq" | "google" | "openrouter" | "ollama" | "custom";
10
10
  export type ProviderProtocol = "openai-compat" | "anthropic-style" | "gemini" | "ollama";
11
11
  export interface ProviderKindMeta {
12
12
  label: string;
@@ -1,15 +1,37 @@
1
1
  /**
2
2
  * OpenAI GPT provider using openai SDK.
3
+ *
4
+ * Serves every OpenAI-compatible endpoint we support (OpenAI, DeepSeek,
5
+ * OpenRouter, Z.AI, xAI, Mistral, Groq, Gemini-OpenAI-compat, Ollama,
6
+ * custom). Per-(provider, model) request-shape divergence — token-limit
7
+ * field name, rejected sampling params, thinking knob, reasoning echo —
8
+ * is resolved through `capabilitiesFor()`, not hardcoded.
3
9
  */
4
10
  import type { LLMConfig, LLMResponse } from "../../types.js";
5
11
  import type { CreateMessageOptions } from "../types.js";
6
12
  import { LLMClientBase } from "../client-base.js";
7
13
  export declare class OpenAIClient extends LLMClientBase {
8
14
  private _client;
15
+ private _forceMaxCompletionTokens;
9
16
  constructor(config: LLMConfig);
10
17
  protected initClient(): void;
11
18
  private get client();
19
+ /**
20
+ * Resolve the capability descriptor for the current (provider kind, model)
21
+ * pair. Cached for the lifetime of the client — model never changes
22
+ * mid-client. `providerKind` defaults to "openai" because legacy LLMConfig
23
+ * paths (arena, env-derived) don't always populate it; for those, the
24
+ * built-in rules table treats them as plain OpenAI.
25
+ */
26
+ private _capability;
27
+ private get capability();
12
28
  createMessage(options: CreateMessageOptions): Promise<LLMResponse>;
29
+ /**
30
+ * Build the request body honoring the model's capability descriptor.
31
+ * Centralized so both streaming and non-streaming paths agree on the
32
+ * exact shape.
33
+ */
34
+ private buildRequestBody;
13
35
  private nonStreamMessage;
14
36
  private streamMessage;
15
37
  private processChoice;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Token counter — best-effort live token count for streaming output.
3
+ *
4
+ * Uses gpt-tokenizer's cl100k_base encoding. It's exact for GPT-4 family and
5
+ * close enough (within ~10%) for Claude/DeepSeek/Qwen for the purpose of a
6
+ * live counter in the UI. The authoritative number is still the provider's
7
+ * `usage` field, captured at end-of-stream.
8
+ *
9
+ * The encoder is lazy-initialized on first use so we don't pay the cost on
10
+ * startup for sessions that never stream.
11
+ */
12
+ /**
13
+ * Count tokens in `text`. Synchronous. If the encoder isn't loaded yet,
14
+ * falls back to chars/4 — only happens for the very first stream chunk in a
15
+ * cold process.
16
+ */
17
+ export declare function countTokens(text: string): number;
@@ -19,6 +19,14 @@ export interface CreateMessageOptions {
19
19
  * @default true
20
20
  */
21
21
  recordUsage?: boolean;
22
+ /**
23
+ * DeepSeek V4 thinking-mode switch. "enabled" is the endpoint default;
24
+ * "disabled" turns reasoning off (faster, cheaper, no `reasoning_content`
25
+ * on the reply). Ignored by every provider except DeepSeek V4 — the OpenAI
26
+ * SDK forwards unknown top-level fields verbatim, so it's harmless on
27
+ * other compatible endpoints.
28
+ */
29
+ thinking?: "enabled" | "disabled";
22
30
  }
23
31
  export interface LLMUsageTracker {
24
32
  records: TokenUsage[];
@@ -1,7 +1,15 @@
1
1
  /**
2
2
  * Unified file logger for code-shell.
3
3
  *
4
- * Single sink: ~/.code-shell/logs/YYYY-MM-DD.log (JSON Lines).
4
+ * Sinks (JSON Lines), routed by `cat`:
5
+ * ~/.code-shell/logs/ui-ink-YYYY-MM-DD.log
6
+ * — UI/ink chatter: stream events, ctx render, ink screen diffs.
7
+ * ~/.code-shell/logs/engine-YYYY-MM-DD.log
8
+ * — everything else: engine, llm, tool, context, mcp, sandbox, ...
9
+ *
10
+ * Routing is by entry `cat`: cat ∈ {ui, ink, render, stream} → ui-ink bucket;
11
+ * anything else → engine bucket. Run scripts/logs.sh to query both at once
12
+ * (merge sorted by timestamp, filter by sid, etc).
5
13
  *
6
14
  * Level defaults:
7
15
  * - Local dev (CODE_SHELL_DEV=1, or running from src/, or --debug) → "debug"
@@ -9,7 +17,7 @@
9
17
  * - CODE_SHELL_LOG_LEVEL overrides everything.
10
18
  *
11
19
  * Category filter (--debug=mcp,api or CODE_SHELL_DEBUG=mcp,api):
12
- * When set, only logs whose `cat` matches are written.
20
+ * When set, only debug logs whose `cat` matches are written.
13
21
  *
14
22
  * Disable entirely: CODE_SHELL_LOG=0
15
23
  */
@@ -1,9 +1,16 @@
1
1
  /**
2
2
  * Per-session verbose recorder for local-dev runs.
3
3
  *
4
- * Writes a JSON-lines trace to <repo>/log/<YYYY-MM-DD>/session-<sid>.jsonl
5
- * containing every step: user input, system prompt, each LLM request+response
6
- * (full bodies), each tool call's args and result, and engine decision events.
4
+ * Layout (per day, split by bucket):
5
+ * <repo>/log/<YYYY-MM-DD>/engine/session-<sid>.jsonl
6
+ * unified timeline: LLM, tools, session events, AND UI events
7
+ * (UI events are dual-written so this file is the full story.)
8
+ * <repo>/log/<YYYY-MM-DD>/ui/session-<sid>.jsonl
9
+ * — UI-only events (stream events received, ctx renders, chatStore
10
+ * mutations). Open when chasing a display bug.
11
+ *
12
+ * Same sid → same filename in both folders. Diff/merge by sid to align
13
+ * "what the model said" with "what the UI did about it."
7
14
  *
8
15
  * Why a separate sink from logger.ts?
9
16
  * - logger.ts is the terse process-wide log (~/.code-shell/logs/) and stays
@@ -69,6 +76,12 @@ export declare function recordToolResult(sid: string, result: {
69
76
  error?: string;
70
77
  }): void;
71
78
  export declare function recordEvent(sid: string, name: string, data?: Record<string, unknown>): void;
79
+ /**
80
+ * Record a UI-side event. Goes into both engine.jsonl (unified timeline) and
81
+ * ui.jsonl (focused view). Use from the UI when chasing display bugs — pass
82
+ * the current sessionId.
83
+ */
84
+ export declare function recordUIEvent(sid: string | undefined, name: string, data?: Record<string, unknown>): void;
72
85
  export declare function recordSessionEnd(sid: string, info: {
73
86
  reason?: string;
74
87
  turns?: number;
@@ -0,0 +1 @@
1
+ export{c as SettingsManager}from'./chunk-DTPABBSV.js';import'./chunk-3QP5BQ3L.js';
@@ -0,0 +1 @@
1
+ export{a as MCPManager}from'./chunk-L7B2ORID.js';import'./chunk-ZSAONDT6.js';import'./chunk-3QP5BQ3L.js';
@@ -0,0 +1 @@
1
+ export{b as MemoryManager,a as resolveMemoryBaseDir}from'./chunk-T222K6IV.js';import'./chunk-3QP5BQ3L.js';
@@ -0,0 +1 @@
1
+ export{d as defaultCacheDir,c as isStale,a as readCache,b as writeCache}from'./chunk-P6JSTIFM.js';import'./chunk-3QP5BQ3L.js';
@@ -0,0 +1 @@
1
+ export{b as fetchModelList}from'./chunk-2OD6VR4N.js';import'./chunk-P6JSTIFM.js';import'./chunk-3QP5BQ3L.js';
@@ -0,0 +1 @@
1
+ export{a as createOffBackend}from'./chunk-SNFAPSLA.js';import'./chunk-3QP5BQ3L.js';
@@ -0,0 +1 @@
1
+ export{a as OpenAIClient}from'./chunk-VKKU4LOM.js';import'./chunk-O5HFCH2U.js';import'./chunk-2EUIMKJA.js';import'./chunk-FU7AHZNN.js';import'./chunk-ZSAONDT6.js';import'./chunk-3QP5BQ3L.js';
@@ -0,0 +1 @@
1
+ export{d as findOpenRouterModel,c as getOpenRouterModels,b as getOpenRouterSnapshot,e as listOpenRouterModelsByVendor,a as setOpenRouterSnapshot}from'./chunk-A4M2Y42L.js';import'./chunk-3QP5BQ3L.js';
@@ -0,0 +1 @@
1
+ export{a as syncOpenRouterCatalog}from'./chunk-XXCZE2U2.js';export{b as getOpenRouterSnapshot}from'./chunk-A4M2Y42L.js';import'./chunk-3QP5BQ3L.js';
@@ -1,21 +1 @@
1
- import {
2
- defineProduct
3
- } from "../chunk-ABRRONJ7.js";
4
- import "../chunk-PKGRTCCY.js";
5
- import "../chunk-BSW22MPA.js";
6
- import "../chunk-3OA5G4TM.js";
7
- import "../chunk-SIHHIQLO.js";
8
- import "../chunk-7Y6S3OCX.js";
9
- import "../chunk-VIAGTYYW.js";
10
- import "../chunk-76HYEPDM.js";
11
- import "../chunk-3SBSUOWZ.js";
12
- import "../chunk-T6VYG46N.js";
13
- import "../chunk-QARL3IDQ.js";
14
- import "../chunk-BZ5TNE7L.js";
15
- import "../chunk-3QO25N6E.js";
16
- import "../chunk-SFXHZSRF.js";
17
- import "../chunk-BXCY2FSE.js";
18
- import "../chunk-MD32R22I.js";
19
- export {
20
- defineProduct
21
- };
1
+ export{a as defineProduct}from'../chunk-Q3RSX66I.js';import'../chunk-MGP35GKD.js';import'../chunk-MLCTC53I.js';import'../chunk-WI6FSWGU.js';import'../chunk-P6JSTIFM.js';import'../chunk-SNFAPSLA.js';import'../chunk-L7B2ORID.js';import'../chunk-M7VU4YVY.js';import'../chunk-T222K6IV.js';import'../chunk-QTWU7UNA.js';import'../chunk-DTPABBSV.js';import'../chunk-RERBX75D.js';import'../chunk-2GJ7H5NC.js';import'../chunk-A4M2Y42L.js';import'../chunk-FU7AHZNN.js';import'../chunk-ZSAONDT6.js';import'../chunk-3QP5BQ3L.js';
@@ -45,7 +45,7 @@ export declare class AgentClient {
45
45
  /**
46
46
  * Query server state.
47
47
  */
48
- query(type: QueryParams["type"], sessionId?: string, ...extra: unknown[]): Promise<QueryResult>;
48
+ query(type: QueryParams["type"], arg?: string | Record<string, unknown>, ...extra: unknown[]): Promise<QueryResult>;
49
49
  /**
50
50
  * Inject context into the session transcript without triggering a LLM turn.
51
51
  * Used to make arena results, tool outputs, etc. visible to subsequent LLM calls.
package/dist/run/index.js CHANGED
@@ -1,48 +1 @@
1
- import {
2
- createRunManager
3
- } from "../chunk-7QIM3BKD.js";
4
- import {
5
- ArtifactTracker,
6
- CheckpointWriter,
7
- CompositeEvaluator,
8
- EngineRunner,
9
- FileRunStore,
10
- Heartbeat,
11
- NoopEvaluator,
12
- RunApprovalBackend,
13
- RunLock,
14
- RunManager,
15
- RunQueue,
16
- VALID_TRANSITIONS,
17
- createRunAskUserFn
18
- } from "../chunk-PKGRTCCY.js";
19
- import "../chunk-BSW22MPA.js";
20
- import "../chunk-3OA5G4TM.js";
21
- import "../chunk-SIHHIQLO.js";
22
- import "../chunk-7Y6S3OCX.js";
23
- import "../chunk-VIAGTYYW.js";
24
- import "../chunk-76HYEPDM.js";
25
- import "../chunk-3SBSUOWZ.js";
26
- import "../chunk-T6VYG46N.js";
27
- import "../chunk-QARL3IDQ.js";
28
- import "../chunk-BZ5TNE7L.js";
29
- import "../chunk-3QO25N6E.js";
30
- import "../chunk-SFXHZSRF.js";
31
- import "../chunk-BXCY2FSE.js";
32
- import "../chunk-MD32R22I.js";
33
- export {
34
- ArtifactTracker,
35
- CheckpointWriter,
36
- CompositeEvaluator,
37
- EngineRunner,
38
- FileRunStore,
39
- Heartbeat,
40
- NoopEvaluator,
41
- RunApprovalBackend,
42
- RunLock,
43
- RunManager,
44
- RunQueue,
45
- VALID_TRANSITIONS,
46
- createRunAskUserFn,
47
- createRunManager
48
- };
1
+ export{a as createRunManager}from'../chunk-EU3J7TBP.js';export{$ as ArtifactTracker,_ as CheckpointWriter,da as CompositeEvaluator,ea as EngineRunner,W as FileRunStore,ba as Heartbeat,ca as NoopEvaluator,Y as RunApprovalBackend,aa as RunLock,fa as RunManager,X as RunQueue,V as VALID_TRANSITIONS,Z as createRunAskUserFn}from'../chunk-MGP35GKD.js';import'../chunk-MLCTC53I.js';import'../chunk-WI6FSWGU.js';import'../chunk-P6JSTIFM.js';import'../chunk-SNFAPSLA.js';import'../chunk-L7B2ORID.js';import'../chunk-M7VU4YVY.js';import'../chunk-T222K6IV.js';import'../chunk-QTWU7UNA.js';import'../chunk-DTPABBSV.js';import'../chunk-RERBX75D.js';import'../chunk-2GJ7H5NC.js';import'../chunk-A4M2Y42L.js';import'../chunk-FU7AHZNN.js';import'../chunk-ZSAONDT6.js';import'../chunk-3QP5BQ3L.js';
@@ -0,0 +1,37 @@
1
+ import {h,a}from'./chunk-3QP5BQ3L.js';import {mkdtempSync,writeFileSync,rmSync}from'fs';import {tmpdir}from'os';import {join}from'path';h();function y(e){return {name:"seatbelt",wrap(o,l){let n=b(e),t=mkdtempSync(join(tmpdir(),"codeshell-sandbox-")),a$1=join(t,"profile.sb");return writeFileSync(a$1,n,"utf-8"),{file:"/usr/bin/sandbox-exec",args:["-f",a$1,l.shell,"-c",o],cleanup:a(()=>{try{rmSync(t,{recursive:!0,force:!0});}catch{}},"cleanup")}},hintForBlockedOutput(o){if(/Operation not permitted|sandbox/.test(o))return `
2
+ [sandbox:seatbelt] A syscall was blocked by the sandbox. If this path should be writable or this network call legitimate, ask the user to update sandbox.writableRoots / sandbox.network in settings.json.`}}}a(y,"createSeatbeltBackend");function b(e){let o=e.writableRoots.map(t=>` (subpath ${d(t)})`).join(`
3
+ `),l=e.deniedReads.map(t=>` (subpath ${d(t)})`).join(`
4
+ `),n=e.network==="deny"?"(deny network-outbound)":"(allow network*)";return `(version 1)
5
+ (deny default)
6
+
7
+ ;; Process control
8
+ (allow process-fork)
9
+ (allow process-exec)
10
+ (allow signal (target self))
11
+ (allow signal (target children))
12
+
13
+ ;; Reads: broadly allowed, then explicit deny of sensitive paths
14
+ (allow file-read*)
15
+ ${l?`(deny file-read*
16
+ ${l})`:""}
17
+
18
+ ;; Writes: workspace + listed roots only
19
+ (allow file-write*
20
+ ${o})
21
+ (allow file-write-data
22
+ (literal "/dev/null")
23
+ (literal "/dev/zero")
24
+ (literal "/dev/random")
25
+ (literal "/dev/urandom")
26
+ (literal "/dev/dtracehelper"))
27
+
28
+ ;; IPC & system services common tools need
29
+ (allow mach-lookup)
30
+ (allow ipc-posix-shm)
31
+ (allow sysctl-read)
32
+ (allow system-socket)
33
+ (allow iokit-open)
34
+
35
+ ;; Network
36
+ ${n}
37
+ `}a(b,"buildProfile");function d(e){return `"${e.replace(/"/g,'\\"')}"`}a(d,"quote");export{y as createSeatbeltBackend};
@@ -23,4 +23,6 @@ export declare class SessionManager {
23
23
  }
24
24
  export type SessionListEntry = SessionState & {
25
25
  preview?: string;
26
+ /** Last activity time — transcript mtime, falling back to startedAt. */
27
+ lastActiveAt: number;
26
28
  };
@@ -0,0 +1 @@
1
+ export{b as SessionManager}from'./chunk-QTWU7UNA.js';import'./chunk-FU7AHZNN.js';import'./chunk-3QP5BQ3L.js';