@corenel/term 0.2.9 → 0.4.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.
@@ -0,0 +1,27 @@
1
+ /** Rows the live region spends OUTSIDE the overlay box itself, every time an
2
+ * overlay is open: the modal Box's own `marginTop` (1), the input box's
3
+ * `marginTop` (1) plus its three border/content rows (3), and the one-line
4
+ * status row (1) -- 6 total. Live tool rows, streaming text, TodoBlock, the
5
+ * palette, the pending-skill indicator, and the empty-conversation hint are
6
+ * all suppressed while a modal is open (App.tsx), so none of them are part
7
+ * of this reservation; if a future change stops suppressing one of them,
8
+ * this constant must grow to match or the invariant this exists to keep
9
+ * (packages/term/src/ink/liveRegionHeight.test.tsx) goes red. */
10
+ export declare const RESERVED_CHROME_ROWS = 6;
11
+ /** No usable row count -- see App.tsx's `usableRows`: a stream that cannot
12
+ * report its height (not a TTY, piped output, a render test double) gets
13
+ * this, meaning "don't cap" rather than a guessed height. Callers pass it
14
+ * straight through to `capList`, whose `Number.MAX_SAFE_INTEGER` cap is a
15
+ * no-op (every real list is shorter than that). */
16
+ export declare function overlayBoxBudget(rows: number | undefined): number;
17
+ export interface CappedList<T> {
18
+ shown: T[];
19
+ /** Set only when `items` didn't fit -- the caller renders this as its own
20
+ * line, the same way TodoBlock renders `view.overflow`. */
21
+ overflow: string | null;
22
+ }
23
+ /** Cap `items` to `cap` rows TOTAL, overflow line included -- the exact rule
24
+ * `visibleTodos` (todos.ts) already applies to the todo list, generalized to
25
+ * any list an overlay renders one item per row. */
26
+ export declare function capList<T>(items: T[], cap: number, overflowLabel: (hiddenCount: number) => string): CappedList<T>;
27
+ //# sourceMappingURL=overlayBudget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlayBudget.d.ts","sourceRoot":"","sources":["../../src/ink/overlayBudget.ts"],"names":[],"mappings":"AAgBA;;;;;;;;iEAQiE;AACjE,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;;;mDAImD;AACnD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAGjE;AAED,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,KAAK,EAAE,CAAC,EAAE,CAAC;IACX;+DAC2D;IAC3D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;mDAEmD;AACnD,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAYjH"}
@@ -1 +1 @@
1
- {"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["../../src/ink/scroll.ts"],"names":[],"mappings":"AAmCA,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;wBASoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;uCAEmC;IACnC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;6CAI6C;AAC7C,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAehF"}
1
+ {"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["../../src/ink/scroll.ts"],"names":[],"mappings":"AAqCA,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;wBASoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;uCAEmC;IACnC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;6CAI6C;AAC7C,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAehF"}
@@ -0,0 +1,20 @@
1
+ import type { McpServerView } from './state';
2
+ /** Status word, in priority order: a server can be simultaneously signed out
3
+ * AND unreachable, but `error` is the more actionable fact -- there is
4
+ * nothing to sign into until the connection itself works. `cached` is what is
5
+ * left once neither applies: a primed-from-disk tool list nothing has
6
+ * refreshed yet this run. */
7
+ /** Exported for the Ink manager overlay (McpOverlay.tsx), which presents the
8
+ * SAME status computed here rather than a second copy of it -- see this
9
+ * module's own comment. */
10
+ export declare function mcpStatusWord(v: McpServerView): string;
11
+ /** The age phrase ALREADY READS AS A COMPLETE CLAUSE -- the caller does not
12
+ * prefix it with "fetched". Returning "never fetched" while the caller also
13
+ * wrote "fetched " produced "fetched never fetched" on every server nobody had
14
+ * refreshed yet, which is every server on a cold machine.
15
+ *
16
+ * Exported so the Ink manager overlay (McpOverlay.tsx) can reuse this same
17
+ * logic instead of writing a second age formatter -- two would drift. */
18
+ export declare function ageWord(fetchedAt: number | null, now: number): string;
19
+ export declare function formatMcpServers(views: McpServerView[], now: number): string;
20
+ //# sourceMappingURL=mcpText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcpText.d.ts","sourceRoot":"","sources":["../src/mcpText.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;6BAI6B;AAC7B;;2BAE2B;AAC3B,wBAAgB,aAAa,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAKtD;AAED;;;;;;0EAM0E;AAC1E,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAUrE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAgB5E"}
package/dist/session.d.ts CHANGED
@@ -4,7 +4,8 @@ import type { AgentEvent, AgentTool, AskAnswers, AskQuestion, CompressionConfig,
4
4
  import { type RunAgentArgs, type RunAgentResult } from '@corenel/harness/core/loop';
5
5
  import { type ModelRates } from '@corenel/harness/core/pricing';
6
6
  import type { PermissionService } from '@corenel/harness/guardrail/permission-service';
7
- import { type CommittedItem, type PaletteEntry, type TuiState } from './state';
7
+ import { type CommittedItem, type McpServerView, type PaletteEntry, type TuiState } from './state';
8
+ import { type ContextSnapshot } from './contextText';
8
9
  import { type ReadExisting } from './writePreview';
9
10
  import { type SessionPersistence } from './persist';
10
11
  import type { PolicySource } from './policySource';
@@ -35,6 +36,32 @@ export interface TermSessionDeps {
35
36
  * (or returning null) means no cost is displayed at all -- see TuiState's
36
37
  * `costUsd` for why that is silence rather than $0.00. */
37
38
  rates?: () => ModelRates | null;
39
+ /** The model's context window in tokens, or `null` when nothing sizes it --
40
+ * for `/context`'s fill fraction. A GETTER, for the same reason `rates` is
41
+ * one just above: this codebase keeps reintroducing the bug of a value
42
+ * captured once at construction going stale. The model itself is fixed for
43
+ * a session (`/model <id>` refuses -- see `listModels`'s field doc), so in
44
+ * practice this returns the same number every time today; the getter
45
+ * exists so that fact stays a consequence of how the loop is wired, not
46
+ * something this package has to assume. Absent, or returning `null`, means
47
+ * `/context` shows the raw token count sent and says the window is unknown
48
+ * -- see contextText.ts's honesty rule -- never a percentage against a
49
+ * guess. */
50
+ contextWindow?: () => number | null;
51
+ /** The models this host knows about, for `/model` (list only). The model is
52
+ * FIXED once a session begins -- `resolveContextWindow(model)` resolves it
53
+ * at launch (packages/cli/src/cli.ts's `resolvedWindow`), and a later
54
+ * hydration from the backend's own catalog may raise or lower that number
55
+ * in place (see the same file's `compression.contextWindow` mutation), but
56
+ * the MODEL itself never changes mid-session and sizes rung-2 compaction
57
+ * throughout; switching to a model with a SMALLER window mid-session
58
+ * would leave compaction sized for the larger one and the loop would meet
59
+ * the context wall as a fatal 400 instead of compacting in time. So `/model
60
+ * <id>` refuses (see `runModelCommand`) and there is no `setModel` dep --
61
+ * changing the model requires reprocessing the session, which is not
62
+ * implemented (see docs/BACKLOG.md section 5). `/model` with no id still
63
+ * lists what's available -- that's read-only. */
64
+ listModels?: () => Promise<PaletteEntry[]>;
38
65
  /** The agent modes the host has configured, for `/mode` (list + validate). */
39
66
  listModes?: () => Promise<PaletteEntry[]>;
40
67
  /** Switch the CURRENT mode. Only takes effect once `system` (above) is next
@@ -96,6 +123,11 @@ export interface TermSessionDeps {
96
123
  * no node dependency — the same pattern as `persistence` and `toolCtx`. Omit
97
124
  * to run with offload disabled, same as before this dep existed. */
98
125
  compression?: CompressionConfig;
126
+ /** Rung-2 history compaction, forwarded to the loop the same way
127
+ * `compression` is. A REPL conversation is long by nature, so this is the
128
+ * face most likely to reach the wall; omit it and the session behaves as it
129
+ * did before — which is to say it dies on a fatal 400 when it gets there. */
130
+ compaction?: RunAgentArgs['compaction'];
99
131
  /** Told the conversation's session id whenever it becomes known or changes —
100
132
  * once after `resume()` loads an existing session, and again after every
101
133
  * `persist()` assigns/confirms one. A host that offloads tool results into a
@@ -119,6 +151,17 @@ export interface TermSessionDeps {
119
151
  * every other host-supplied command in this file. */
120
152
  policy?: Policy;
121
153
  policySource?: PolicySource;
154
+ /** The MCP servers this host can see, for `/mcp`. Absent means the command
155
+ * reports itself unavailable, exactly like /policy without a policy. */
156
+ listMcpServers?: () => Promise<McpServerView[]>;
157
+ addMcpServer?: (name: string, url: string) => Promise<void>;
158
+ removeMcpServer?: (name: string) => Promise<void>;
159
+ loginMcpServer?: (name: string, onUrl: (url: string) => void) => Promise<void>;
160
+ refreshMcpServer?: (server?: string) => Promise<void>;
161
+ /** Clear the stored OAuth client registration for a server, so the next
162
+ * `/mcp login` registers afresh. See the CLI's `McpAdmin.forget` for why
163
+ * this is always a local write. */
164
+ forgetMcpServer?: (name: string) => Promise<void>;
122
165
  }
123
166
  /** Deltas arrive per token; re-rendering React that often thrashes for output
124
167
  * no eye can follow. They coalesce on this interval instead. */
@@ -181,6 +224,13 @@ export declare class TermSession {
181
224
  * reach a renderer. */
182
225
  private pendingSkill;
183
226
  wantsExit: boolean;
227
+ /** The last line that was WARNED ABOUT rather than sent, because its first
228
+ * word after `/` looked like a command but wasn't one -- see `submit`. Set
229
+ * on the warn, cleared the moment anything else happens (a different line,
230
+ * a real command, an empty line): only an EXACT resubmission of this same
231
+ * text counts as "I meant it, send it anyway". `null` means nothing is
232
+ * pending. */
233
+ private lastRejectedLine;
184
234
  constructor(deps: TermSessionDeps);
185
235
  attachPermission(p: PermissionService): void;
186
236
  historyForTest(): ChatCompletionMessageParam[];
@@ -256,7 +306,28 @@ export declare class TermSession {
256
306
  * no ordinal to show. */
257
307
  private ordFor;
258
308
  handleEvent(e: AgentEvent): void;
259
- /** Route one line: a command runs here; anything else is a turn. */
309
+ /** Whether calling `submit(text)` right now would warn-and-refuse rather
310
+ * than run a command or send a message -- i.e. `text`'s first word after a
311
+ * leading `/` looks like a command attempt but isn't one, AND this isn't
312
+ * already the resend of a line that was just warned about. PURE: does not
313
+ * touch `lastRejectedLine` or commit anything, so a caller can check it
314
+ * before deciding what to do with the input box (see ink/index.tsx's
315
+ * onSubmit, which must NOT clear the box for the line this reports true
316
+ * for) without racing `submit`'s own mutation of the same state. */
317
+ willReject(text: string): boolean;
318
+ /** Route one line: a command runs here; anything else is a turn -- UNLESS
319
+ * the first word after a leading `/` looks like a command attempt and
320
+ * isn't one (see commands.ts's `isKnownCommandWord`), in which case the
321
+ * FIRST Enter on that exact text warns and stops rather than paying for a
322
+ * model call on a typo (`/context` before Feature 2 added it, `/toosl`,
323
+ * `/hepl`, ...). A SECOND Enter on the identical, unchanged line is taken
324
+ * as "I meant it" and sent as an ordinary message -- tracked in
325
+ * `lastRejectedLine`, which both faces share automatically since it lives
326
+ * here rather than in either face's own state: the Ink face keeps the text
327
+ * in the input box (ink/index.tsx checks `willReject` before clearing it)
328
+ * so retyping Enter resubmits the SAME string; the readline face has no
329
+ * input box to hold onto, so there the "second Enter" is the user
330
+ * retyping the line themselves -- an honest equivalent, not a shortcut. */
260
331
  submit(text: string): Promise<void>;
261
332
  /** Run `line` as a turn now, or queue it, exactly like `submit` does for
262
333
  * ordinary text -- factored out so `/strategy` (runCommand) can send its
@@ -279,14 +350,112 @@ export declare class TermSession {
279
350
  * host call here, not just the two that are known to need it, means the
280
351
  * NEXT one added can't reintroduce the same gap by omission. */
281
352
  private safeCall;
282
- /** Shared `/mode` and `/persona` shape: no id lists what's configured, an
353
+ /** Shared `/mode`/`/persona` shape: no id lists what's configured, an
283
354
  * unknown id reports the valid options (never silently no-ops, never sends
284
- * a typo through to the model), a real id applies immediately -- "applies"
285
- * meaning `deps.system` will pick it up on the NEXT `resolveSystem()` call,
286
- * not this instant (see the field docs on TermSessionDeps.system). */
355
+ * a typo through to the model), a real id applies immediately.
356
+ *
357
+ * "applies" means `deps.system` will pick it up on the NEXT
358
+ * `resolveSystem()` call, not this instant (see the field docs on
359
+ * TermSessionDeps.system) -- `opts.apply` (the host's `setMode`/
360
+ * `setPersona`) is the whole story there.
361
+ *
362
+ * `/model` does NOT go through here -- see `runModelCommand`: the model is
363
+ * fixed for a session, so there is nothing for it to apply. */
287
364
  private switchIdentity;
365
+ /** `/model` -- READ-ONLY. No id lists what's available (see `listModels`'s
366
+ * field doc for why); an id refuses rather than switching, because the
367
+ * model is fixed for the life of a session -- `resolveContextWindow(model)`
368
+ * runs once at launch and sizes rung-2 compaction from it, so a downward
369
+ * switch would leave compaction believing it has a bigger window than the
370
+ * model actually has and the conversation would meet the context wall as a
371
+ * fatal 400 instead of compacting in time. Changing the model requires
372
+ * reprocessing the session, which is not implemented (docs/BACKLOG.md
373
+ * section 5) -- the remedy is a restart with `--model <id>`, not this
374
+ * command. Routed through `safeCall` for the listing, same guard every
375
+ * other identity command uses. */
376
+ private runModelCommand;
288
377
  private armSkillCommand;
289
378
  private runStrategyCommand;
379
+ /** Like `safeCall`, but for `/mcp`'s own host calls -- a SEPARATE wrapper,
380
+ * not a shared message, because the failure shape is different in kind.
381
+ * `safeCall`'s "not available -- could not read the config workspace"
382
+ * framing was written for `/mode`/`/persona`: there, a throw really does
383
+ * mean the config workspace itself is broken. An MCP host call throwing is
384
+ * usually something else entirely -- `McpAdmin`'s write methods
385
+ * (packages/cli/src/mcpAdmin.ts) return `Promise<void>` with no result
386
+ * channel, so a REFUSAL (a duplicate name, a daemon saying no, a failed
387
+ * sign-in) surfaces as a thrown Error too, indistinguishable by shape from
388
+ * a real transport failure. Telling the user the command is "not
389
+ * available" when it ran and was refused is actively wrong -- it says "try
390
+ * nothing" when the honest answer is "try something else, here is why this
391
+ * attempt didn't work". So this wrapper names the ACTION and reports the
392
+ * underlying reason verbatim, and leaves `safeCall` untouched for the four
393
+ * callers whose failure really is "could not read the config workspace". */
394
+ private safeMcpCall;
395
+ /** `/mcp` and its subcommands -- what is connected, and sign in or add one.
396
+ * `listMcpServers` gates the whole command, the same way `deps.policy` gates
397
+ * `/policy`: a host that wires none of the five deps reports `/mcp` itself
398
+ * unavailable rather than half-working. Each mutating subcommand ALSO checks
399
+ * its own specific dep, so a host that wires read-only `listMcpServers` still
400
+ * gets a working `/mcp list` instead of every subcommand failing alike.
401
+ *
402
+ * `unknown` carries a subcommand `parseCommand` did not recognize -- see
403
+ * commands.ts's `mcp` case. It is rejected BY NAME rather than aliased to
404
+ * `list` (a typo must never produce ordinary-looking output with nothing
405
+ * to say it was not understood) and rather than reaching here as `null`
406
+ * from the parser (which would send it to the model as a chat message --
407
+ * worse still: a silent misfire that LOOKS like an answer). */
408
+ private runMcpCommand;
409
+ /** `/mcp` with no argument, from the Ink face only -- see the module doc
410
+ * above. Fetches the current servers and opens the manager. */
411
+ openMcpManager(): Promise<void>;
412
+ /** esc, or any other reason the overlay should close -- a no-op unless the
413
+ * manager is actually the modal open right now, so it can never steal a
414
+ * permission or question modal's close. */
415
+ closeMcpManager(): void;
416
+ /** `/help` with no argument, from the Ink face only -- see the module doc
417
+ * above. */
418
+ openHelp(): void;
419
+ /** esc, or any other reason the overlay should close -- a no-op unless the
420
+ * help overlay is actually the modal open right now, so it can never steal
421
+ * a permission, question, or MCP modal's close. */
422
+ closeHelp(): void;
423
+ /** The data `formatContext` (contextText.ts) needs, assembled from
424
+ * `TuiState`'s own accumulators and the two host-supplied static facts
425
+ * (`deps.tools.length`, `deps.contextWindow()`) -- called fresh by both
426
+ * `runCommand`'s `'context'` case and the Ink overlay's render, never
427
+ * cached, so neither face can show a stale window size after `/context`'s
428
+ * OWN state changes mid-turn. */
429
+ contextSnapshot(): ContextSnapshot;
430
+ /** `/context` with no argument, from the Ink face only -- see the module
431
+ * doc above. Needs no host dep and nothing to fetch -- opening it is just
432
+ * setting the modal. */
433
+ openContext(): void;
434
+ /** esc, or any other reason the context overlay should close -- a no-op
435
+ * unless the context overlay is actually the modal open right now, so it
436
+ * can never steal a permission, question, help, or MCP modal's close. */
437
+ closeContext(): void;
438
+ /** Up/down inside the overlay -- wraps, and does nothing with zero rows. */
439
+ moveMcpSelection(delta: number): void;
440
+ /** `x` inside the overlay -- removes the selected row via the same
441
+ * `removeMcpServer` dep `/mcp remove` uses, then refreshes the list. */
442
+ removeMcpSelection(): Promise<void>;
443
+ /** `l` inside the overlay -- signs the selected row in via the same
444
+ * `loginMcpServer` dep `/mcp login` uses. The consent URL genuinely
445
+ * arrives before the sign-in itself completes (a daemon message, or a
446
+ * synchronous callback locally), so `modal.login.url` is updated live as
447
+ * it arrives rather than buffered until the whole call resolves. */
448
+ loginMcpSelection(): Promise<void>;
449
+ /** `r` inside the overlay -- refreshes the selected row via the same
450
+ * `refreshMcpServer` dep `/mcp refresh` uses, then refreshes the list so
451
+ * the updated tool count and age show without the user reopening the
452
+ * overlay. Same shape as `removeMcpSelection` above. */
453
+ refreshMcpSelection(): Promise<void>;
454
+ /** Re-fetches `listMcpServers` and replaces the overlay's snapshot,
455
+ * clamping the selection into range -- used after add/remove/login
456
+ * succeed so the overlay never shows a server list that mutation just
457
+ * made stale. */
458
+ private refreshMcpManager;
290
459
  /** Save after the turn, never during: a half-written turn is a lie on disk. */
291
460
  private persist;
292
461
  /** Reopen a conversation: `id` if given, otherwise the most recent. */
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpJ,OAAO,EAAY,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAA0B,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEvG,OAAO,EAAuC,KAAK,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AAG3G,OAAO,EAAoC,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACtF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAwBnD;;;;;;;;;wCASwC;AACxC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAE5D,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM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AAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOlD;;;;;;;;;mCAS+B;cACf,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,aAAa,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;YAgBzF,OAAO;IAsFrB;;;;kEAI8D;YAChD,eAAe;YAOf,KAAK;IAenB;0EACsE;IACtE,KAAK,IAAI,IAAI;IAOb;;;;;;;;;;;cAWU;IACV,aAAa,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA6BjF,OAAO,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAQ7D,oDAAoD;IACpD,MAAM,CAAC,KAAK,EAAE,kBAAkB,GAAG,UAAU,GAAG,IAAI,GAAG,IAAI;IAI3D;;;;;qFAKiF;IACjF,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,cAAc;CAOvB"}
package/dist/session.js CHANGED
@@ -2,9 +2,9 @@ import {
2
2
  DELTA_FLUSH_MS,
3
3
  TOOL_DELTA_CAP,
4
4
  TermSession
5
- } from "./chunk-QZJTOVZL.js";
6
- import "./chunk-L4KCEKIT.js";
7
- import "./chunk-VTJEWHM3.js";
5
+ } from "./chunk-HUVRQX53.js";
6
+ import "./chunk-2MGDL3I4.js";
7
+ import "./chunk-5RPHYXND.js";
8
8
  import "./chunk-M44CET5L.js";
9
9
  import "./chunk-I44FC7PE.js";
10
10
  import "./chunk-TYP4MMO7.js";
package/dist/state.d.ts CHANGED
@@ -96,7 +96,40 @@ export interface UserAsk {
96
96
  kind: 'user';
97
97
  questions: AskQuestion[];
98
98
  }
99
- export type Modal = PermissionAsk | UserAsk;
99
+ /** The `/mcp` overlay's own state -- presentation over the SAME `/mcp`
100
+ * dispatch the text commands use (TermSession.runMcpCommand), not a second
101
+ * copy of it. `servers` is a snapshot fetched when the manager opens (and
102
+ * refreshed after a mutation succeeds), never something the view itself
103
+ * caches or recomputes -- see McpOverlay.tsx. */
104
+ export interface McpManager {
105
+ kind: 'mcp';
106
+ servers: McpServerView[];
107
+ selected: number;
108
+ /** Set while a login is in flight; the consent URL once the daemon returns
109
+ * one. The URL genuinely arrives before the browser round-trip finishes on
110
+ * both write routes (daemon and local), so this is real, live state, not
111
+ * something the view can buffer or wait out. */
112
+ login: {
113
+ server: string;
114
+ url: string | null;
115
+ } | null;
116
+ }
117
+ /** Declared here, not in Task 10, because a discriminated union has to name
118
+ * all its variants at once to typecheck -- Task 10 builds the view that
119
+ * consumes this. */
120
+ export interface HelpView {
121
+ kind: 'help';
122
+ }
123
+ /** `/context`'s overlay. Carries no snapshot of its own -- unlike `McpManager`,
124
+ * which caches a fetched server list, `/context` has nothing to fetch: every
125
+ * field it shows already lives on `TuiState` (see `sentTokens`, `offloaded`,
126
+ * `checkpoints`, `toolNames` below), updated live as events arrive. So the
127
+ * view just reads `TuiState` directly while this stays open, and a turn that
128
+ * lands while the overlay is up updates it without anyone re-opening it. */
129
+ export interface ContextView {
130
+ kind: 'context';
131
+ }
132
+ export type Modal = PermissionAsk | UserAsk | McpManager | HelpView | ContextView;
100
133
  export type TodoStatus = 'pending' | 'in_progress' | 'completed' | 'blocked';
101
134
  /** A local mirror of the harness's `todo_write` tool contract (see
102
135
  * packages/harness/tools/todo.ts) — kept local rather than imported so this
@@ -112,6 +145,12 @@ export interface TodoItem {
112
145
  export interface TuiState {
113
146
  /** Bumped on every change so subscribers using useSyncExternalStore refresh. */
114
147
  seq: number;
148
+ /** The model this session is using, for the status row (see ink/App.tsx's
149
+ * fitStatus call). Set from `TermSessionDeps.model` at construction and
150
+ * never written again -- the model is fixed for a session (see
151
+ * @corenel/term's TermSessionDeps.listModels field doc for why `/model
152
+ * <id>` refuses rather than mutating this). */
153
+ model: string;
115
154
  transcriptGen: number;
116
155
  committed: CommittedItem[];
117
156
  live: {
@@ -152,8 +191,50 @@ export interface TuiState {
152
191
  * so the effect is never silent, and it is cleared the moment that message
153
192
  * is sent (see TermSession.runTurn), not when the turn finishes. */
154
193
  pendingSkill: string | null;
194
+ /** What was actually sent on the LAST model call -- overwritten by every
195
+ * `usage` event, not accumulated the way `usage`/`turnUsage` are: this
196
+ * answers "what's in the window right now", not "what has this
197
+ * conversation cost so far". `null` before any model call has completed. */
198
+ sentTokens: number | null;
199
+ /** Tool results offloaded to save context, oldest first -- recallable with
200
+ * `/expand`. Appended to by every `offload` event; never removed, since a
201
+ * `/clear` empties this the same way it empties `committed`. */
202
+ offloaded: {
203
+ id: string;
204
+ name: string;
205
+ bytes: number;
206
+ }[];
207
+ /** Compaction seams -- history collapsed into a checkpoint -- oldest first,
208
+ * appended to by every `checkpoint` event alongside the note it already
209
+ * commits (see TermSession.handleEvent's `checkpoint` case). */
210
+ checkpoints: {
211
+ collapsed: number;
212
+ checkpoint: string;
213
+ }[];
214
+ /** The MCP tool set's current names, as of the last `tools-loaded` event --
215
+ * REPLACED wholesale each time (the event carries the whole list), not
216
+ * appended to. */
217
+ toolNames: string[];
218
+ }
219
+ /** One configured MCP server, as `/mcp` needs it -- joined from config
220
+ * (`readMcpServers`, the source of truth: see mcpRegistry.ts's
221
+ * `mcpServerViews`), the live registry's connection status, credential
222
+ * presence, and the on-disk tool cache's age. A server never touched this
223
+ * process (no `ensureConnected` yet) still appears here, just with
224
+ * `connected: false` and a cache-derived (or zero) `toolCount` -- config, not
225
+ * the registry, decides who is enumerated. */
226
+ export interface McpServerView {
227
+ name: string;
228
+ url: string;
229
+ connected: boolean;
230
+ signedIn: boolean;
231
+ toolCount: number;
232
+ /** Epoch ms of the cached tool list, or null when never fetched. */
233
+ fetchedAt: number | null;
234
+ hosted: boolean;
235
+ error?: string;
155
236
  }
156
- export declare function emptyState(): TuiState;
237
+ export declare function emptyState(model?: string): TuiState;
157
238
  /** Parse a `todo_write` call's `args` into the list this face renders.
158
239
  *
159
240
  * This is MODEL OUTPUT, not a value our own code produced, so it is parsed
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;2EAG2E;AAC3E,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,oFAAoF;AACpF,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAC5C;;;;;;;;;;;;;;;;;;;;mBAoBe;IACf,YAAY,CAAC,EAAE,IAAI,CAAA;CAAE,GACvB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IACrF,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IACzG;;;;;kDAK8C;IAC9C,QAAQ,CAAC,EAAE,IAAI,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAA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@@ -1,7 +1,7 @@
1
1
  import {
2
2
  emptyState,
3
3
  parseTodos
4
- } from "./chunk-L4KCEKIT.js";
4
+ } from "./chunk-2MGDL3I4.js";
5
5
  export {
6
6
  emptyState,
7
7
  parseTodos
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corenel/term",
3
- "version": "0.2.9",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "Corenel's terminal face — a headless chat controller plus its Ink views. `./session` is ink-free and shared with the CLI's readline fallback; only `./ink` pulls React. dist/ is bundled (see build.mjs), but @corenel/harness and @corenel/protocol stay EXTERNAL to that bundle — they are real runtime dependencies, declared below, so the CLI and term share exactly one harness module instance (see build.mjs for why two instances is a governance hole, not a cosmetic bug).",
6
6
  "exports": {
@@ -46,8 +46,8 @@
46
46
  "ink-text-input": "^6.0.0",
47
47
  "openai": "^4.77.0",
48
48
  "react": "^18.3.1",
49
- "@corenel/harness": "0.7.5",
50
- "@corenel/protocol": "0.7.3"
49
+ "@corenel/harness": "0.9.0",
50
+ "@corenel/protocol": "0.8.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/node": "^24.13.1",
@@ -55,7 +55,7 @@
55
55
  "esbuild": "^0.21.5",
56
56
  "ink-testing-library": "^4.0.0",
57
57
  "typescript": "^5.9.3",
58
- "@corenel/tools-node": "0.3.7"
58
+ "@corenel/tools-node": "0.5.0"
59
59
  },
60
60
  "license": "Elastic-2.0",
61
61
  "engines": {
@@ -1,65 +0,0 @@
1
- // src/commands.ts
2
- var TERM_COMMANDS = [
3
- { name: "help", summary: "what you can type here" },
4
- { name: "tools", summary: "what the agent can do, and what it can change" },
5
- { name: "policy", summary: "how this session is governed -- levels, caps, and what actually confines it" },
6
- { name: "expand", args: "<#n>", summary: "re-print a tool result in full" },
7
- { name: "resume", args: "[id]", summary: "reopen an earlier conversation" },
8
- { name: "clear", summary: "forget the conversation" },
9
- { name: "exit", summary: "leave" },
10
- // -- config-workspace commands: what these do to the NEXT turn is real, see
11
- // TermSessionDeps.system in ./session (the re-derivable system prompt) and
12
- // the `mode`/`persona`/`skill`/`strategy` cases in runCommand.
13
- { name: "mode", args: "<id>", summary: "switch the agent mode (takes effect next turn); no id lists what is configured" },
14
- { name: "persona", args: "<id>", summary: "switch persona (takes effect next turn); no id lists what is configured" },
15
- { name: "skill", args: "<name>", summary: "apply a skill to your NEXT message only, then it clears; no name lists what is installed" },
16
- { name: "strategy", args: "<name>", summary: "run a saved strategy from .prompd/strategies; no name lists what is saved" }
17
- ];
18
- var ALIASES = { quit: "exit" };
19
- function parseCommand(line) {
20
- const t = line.trim();
21
- if (!t.startsWith("/")) return null;
22
- const [wordRaw, ...rest] = t.slice(1).split(/\s+/);
23
- const word = ALIASES[wordRaw.toLowerCase()] ?? wordRaw.toLowerCase();
24
- const arg = rest.join(" ").trim();
25
- switch (word) {
26
- case "help":
27
- return { cmd: "help" };
28
- case "tools":
29
- return { cmd: "tools" };
30
- case "policy":
31
- return { cmd: "policy" };
32
- case "clear":
33
- return { cmd: "clear" };
34
- case "exit":
35
- return { cmd: "exit" };
36
- case "expand": {
37
- const m = /^#?(\d+)$/.exec(arg);
38
- return m ? { cmd: "expand", ord: Number(m[1]) } : { cmd: "expand" };
39
- }
40
- case "resume":
41
- return arg ? { cmd: "resume", id: arg } : { cmd: "resume" };
42
- case "mode":
43
- return arg ? { cmd: "mode", id: arg } : { cmd: "mode" };
44
- case "persona":
45
- return arg ? { cmd: "persona", id: arg } : { cmd: "persona" };
46
- case "skill":
47
- return arg ? { cmd: "skill", id: arg } : { cmd: "skill" };
48
- case "strategy":
49
- return arg ? { cmd: "strategy", id: arg } : { cmd: "strategy" };
50
- default:
51
- return null;
52
- }
53
- }
54
- function filterCommands(input) {
55
- const t = input.trim();
56
- if (!t.startsWith("/")) return [];
57
- const prefix = t.slice(1).split(/\s+/)[0].toLowerCase();
58
- return TERM_COMMANDS.filter((c) => c.name.startsWith(prefix));
59
- }
60
-
61
- export {
62
- TERM_COMMANDS,
63
- parseCommand,
64
- filterCommands
65
- };