@corenel/term 0.1.0 → 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 (55) hide show
  1. package/dist/chunk-2D7G4YW2.js +97 -0
  2. package/dist/chunk-CB5RFNB4.js +33 -0
  3. package/dist/chunk-F4ENQXQQ.js +909 -0
  4. package/dist/chunk-I44FC7PE.js +142 -0
  5. package/dist/chunk-IK4ZANNW.js +95 -0
  6. package/dist/chunk-M44CET5L.js +40 -0
  7. package/dist/chunk-OSJFMQCW.js +44 -0
  8. package/dist/{chunk-R6AXTD55.js → chunk-VTJEWHM3.js} +19 -1
  9. package/dist/commands.d.ts +14 -0
  10. package/dist/commands.d.ts.map +1 -1
  11. package/dist/commands.js +1 -1
  12. package/dist/describe.d.ts +23 -0
  13. package/dist/describe.d.ts.map +1 -1
  14. package/dist/describe.js +6 -1
  15. package/dist/diff.d.ts +100 -0
  16. package/dist/diff.d.ts.map +1 -0
  17. package/dist/diff.js +18 -0
  18. package/dist/ink/App.d.ts +12 -0
  19. package/dist/ink/App.d.ts.map +1 -1
  20. package/dist/ink/Modal.d.ts.map +1 -1
  21. package/dist/ink/TodoBlock.d.ts +10 -0
  22. package/dist/ink/TodoBlock.d.ts.map +1 -0
  23. package/dist/ink/banner.d.ts +36 -0
  24. package/dist/ink/banner.d.ts.map +1 -0
  25. package/dist/ink/index.d.ts.map +1 -1
  26. package/dist/ink/index.js +300 -140
  27. package/dist/ink/items.d.ts.map +1 -1
  28. package/dist/ink/scroll.d.ts +14 -2
  29. package/dist/ink/scroll.d.ts.map +1 -1
  30. package/dist/ink/status.d.ts.map +1 -1
  31. package/dist/ink/theme.d.ts +9 -0
  32. package/dist/ink/theme.d.ts.map +1 -1
  33. package/dist/ink/todos.d.ts +20 -0
  34. package/dist/ink/todos.d.ts.map +1 -0
  35. package/dist/markdown.d.ts.map +1 -1
  36. package/dist/persist.d.ts +27 -4
  37. package/dist/persist.d.ts.map +1 -1
  38. package/dist/persist.js +3 -1
  39. package/dist/policySource.d.ts +26 -0
  40. package/dist/policySource.d.ts.map +1 -0
  41. package/dist/policySource.js +8 -0
  42. package/dist/session.d.ts +199 -13
  43. package/dist/session.d.ts.map +1 -1
  44. package/dist/session.js +10 -5
  45. package/dist/state.d.ts +84 -0
  46. package/dist/state.d.ts.map +1 -1
  47. package/dist/state.js +5 -3
  48. package/dist/writePreview.d.ts +58 -0
  49. package/dist/writePreview.d.ts.map +1 -0
  50. package/dist/writePreview.js +9 -0
  51. package/package.json +19 -6
  52. package/dist/chunk-47IH6X5H.js +0 -20
  53. package/dist/chunk-HAQGHLW6.js +0 -235
  54. package/dist/chunk-HYWLODZT.js +0 -1230
  55. package/dist/chunk-TCVDVYMF.js +0 -40
@@ -4,13 +4,25 @@ export interface ScrollableOut {
4
4
  write(chunk: string): void;
5
5
  }
6
6
  export interface PrimeScrollOptions {
7
+ /** Lines already destined for the screen AFTER this prime and BEFORE Ink's
8
+ * first frame -- i.e. the startup banner. Subtracted from the newlines
9
+ * written, so the banner lands immediately above the first frame.
10
+ *
11
+ * Getting the order wrong here is immediately visible, and did ship once:
12
+ * printing the banner and THEN priming a full window writes `rows` newlines
13
+ * on top of it, scrolling the art exactly one screen out of view. The owner's
14
+ * report was "it draws the CORENEL on the buffer and then adds a bunch of new
15
+ * lines and scrolls past it". Prime FIRST with the banner's height reserved,
16
+ * then print it. */
17
+ reserve?: number;
7
18
  /** True when `runTui` is reopening a saved conversation. Restored content
8
19
  * usually already fills the screen; priming would push it into scrollback
9
20
  * before the user ever sees it. */
10
21
  resuming: boolean;
11
22
  }
12
- /** Writes `out.rows` newlines to `out` and returns how many were written (0
13
- * when priming is skipped). Skips whenever `out.isTTY` is not `true`,
23
+ /** Writes `out.rows` minus `opts.reserve` newlines to `out` and returns how
24
+ * many were written (0 when priming is skipped, or when the reservation
25
+ * consumes the whole window). Skips whenever `out.isTTY` is not `true`,
14
26
  * `out.rows` is not a positive number, or `opts.resuming` is true. Must be
15
27
  * called before the first Ink `render()`. */
16
28
  export declare function primeScroll(out: ScrollableOut, opts: PrimeScrollOptions): number;
@@ -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;;uCAEmC;IACnC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;6CAG6C;AAC7C,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAOhF"}
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 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/ink/status.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;CACf;AAED;gDACgD;AAChD,eAAO,MAAM,eAAe,KAAK,CAAC;AAiClC;;iEAEiE;AACjE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAkBzG"}
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/ink/status.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;CACf;AAED;gDACgD;AAChD,eAAO,MAAM,eAAe,KAAK,CAAC;AAiClC;;iEAEiE;AACjE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAuBzG"}
@@ -16,6 +16,15 @@ export declare const glyph: {
16
16
  readonly fail: "✗";
17
17
  readonly bar: "│";
18
18
  readonly sep: "·";
19
+ /** The in-progress marker on a todo row -- the only status among
20
+ * pending/in_progress/completed/blocked without an existing glyph above. */
21
+ readonly active: "▸";
22
+ /** A restored tool row's outcome marker: a resumed conversation has no
23
+ * recorded success/failure for it (see persist.ts), so it must read as
24
+ * NEITHER `ok` nor `fail` -- a plain dash, not `sep`, which is this same
25
+ * row's own leading bullet a few columns to the left and would read as a
26
+ * second bullet rather than a status. */
27
+ readonly unknown: "–";
19
28
  };
20
29
  /** Tokens, abbreviated the way a status line has room for. */
21
30
  export declare function tokens(n: number): string;
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/ink/theme.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO;;;;;;;;;;CAUV,CAAC;AAEX,eAAO,MAAM,KAAK;;;;;;;CAOR,CAAC;AAEX,8DAA8D;AAC9D,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAExC"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/ink/theme.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO;;;;;;;;;;CAUV,CAAC;AAEX,eAAO,MAAM,KAAK;;;;;;;IAOhB;gFAC4E;;IAE5E;;;;6CAIyC;;CAEjC,CAAC;AAEX,8DAA8D;AAC9D,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAExC"}
@@ -0,0 +1,20 @@
1
+ import type { TodoItem, TodoStatus } from '../state';
2
+ export declare const DEFAULT_TODO_ROW_CAP = 4;
3
+ export interface TodoRow {
4
+ id: string;
5
+ title: string;
6
+ status: TodoStatus;
7
+ }
8
+ export interface TodoView {
9
+ /** e.g. "todos 2/7 done". */
10
+ header: string;
11
+ rows: TodoRow[];
12
+ /** e.g. "… 3 more", only when the list didn't fit in `rows`. */
13
+ overflow: string | null;
14
+ }
15
+ /** What the todo block should show, or `null` when there is nothing worth
16
+ * showing -- an empty list, or one where every item is already `completed`
17
+ * (a finished list disappears rather than sitting there as a stale trophy).
18
+ * `cap` bounds the total row count, overflow line included. */
19
+ export declare function visibleTodos(todos: TodoItem[], cap?: number): TodoView | null;
20
+ //# sourceMappingURL=todos.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todos.d.ts","sourceRoot":"","sources":["../../src/ink/todos.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ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CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAsC9D;AAED;oDACoD;AACpD,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAM7C"}
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,OAAO,GACf;IAAE,IAAI,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC3B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC5B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,EAAE,CAAA;CAAE,CAAC;AAOhC,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAErD;AAED;;;;yEAIyE;AACzE,MAAM,WAAW,WAAW;IAAG,KAAK,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE;AAE5D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAgD9D;AAED;oDACoD;AACpD,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAM7C"}
package/dist/persist.d.ts CHANGED
@@ -19,12 +19,35 @@ export interface SessionPersistence {
19
19
  list(): Promise<AgentSession[]>;
20
20
  }
21
21
  export declare function createSessionPersistence(files: FileService): SessionPersistence;
22
+ /** A restored row, before ordinals are assigned. Identical to `CommittedItem`
23
+ * except the `tool` variant has no `ord` yet — `committedFromMessages` doesn't
24
+ * own the ordinal counter (`TermSession.nextOrd` does, so it can keep handing
25
+ * out numbers past the restored rows without a second counter to drift out of
26
+ * sync); see `TermSession.resume()`, which assigns them. */
27
+ export type RestoredItem = Exclude<CommittedItem, {
28
+ kind: 'tool';
29
+ }> | Omit<Extract<CommittedItem, {
30
+ kind: 'tool';
31
+ }>, 'ord'>;
22
32
  /** The display transcript for a restored conversation.
23
33
  *
24
- * User and assistant TEXT only, deliberately: an identity mapping keeps the
25
- * restored transcript lined up with the history the next turn sends, which is
26
- * the trap a richer rebuild walks into. */
27
- export declare function committedFromMessages(messages: ChatCompletionMessageParam[]): CommittedItem[];
34
+ * History must stay untouched: this is DISPLAY ONLY, built by reading
35
+ * `messages` without changing them, so the next turn's request still lines
36
+ * up with what was loaded from disk.
37
+ *
38
+ * User and assistant text map straight across, as before. A tool row is
39
+ * rebuilt from an assistant message's `tool_calls` entry paired with its
40
+ * answering `role: 'tool'` message — `subject` via the SAME `describeToolCall`
41
+ * the live path uses, `preview` via the same `capPreview`. History records
42
+ * neither success/failure nor duration, so every restored row carries
43
+ * `isError: false` and no `durationMs`; `restored: true` tells a face to
44
+ * render a neutral marker instead of reading `isError` as a real outcome
45
+ * (see state.ts). A call with no matching tool message — an interrupted
46
+ * turn — is skipped rather than guessed at. If the persisted content is an
47
+ * offload pointer (@corenel/harness's `formatOffloadRef`), the row carries
48
+ * the blob id so `/expand` recalls the real body instead of the pointer
49
+ * text. */
50
+ export declare function committedFromMessages(messages: ChatCompletionMessageParam[]): RestoredItem[];
28
51
  /** The first line of the first user message, as a session title. */
29
52
  export declare function titleFrom(messages: ChatCompletionMessageParam[]): string;
30
53
  //# sourceMappingURL=persist.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"persist.d.ts","sourceRoot":"","sources":["../src/persist.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,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CACxC;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,0BAA0B,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACjD,IAAI,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CACjC;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,WAAW,GAAG,kBAAkB,CA4B/E;AAED;;;;4DAI4D;AAC5D,MAAM,MAAM,YAAY,GACpB,OAAO,CAAC,aAAa,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GACxC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AAU1D;;;;;;;;;;;;;;;;;WAiBW;AACX,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,0BAA0B,EAAE,GAAG,YAAY,EAAE,CAkD5F;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,0BAA0B,EAAE,GAAG,MAAM,CAKxE"}
package/dist/persist.js CHANGED
@@ -2,7 +2,9 @@ import {
2
2
  committedFromMessages,
3
3
  createSessionPersistence,
4
4
  titleFrom
5
- } from "./chunk-HAQGHLW6.js";
5
+ } from "./chunk-IK4ZANNW.js";
6
+ import "./chunk-2D7G4YW2.js";
7
+ import "./chunk-CB5RFNB4.js";
6
8
  export {
7
9
  committedFromMessages,
8
10
  createSessionPersistence,
@@ -0,0 +1,26 @@
1
+ export type PolicySource = {
2
+ kind: 'default';
3
+ } | {
4
+ kind: 'builtin';
5
+ name: string;
6
+ } | {
7
+ kind: 'file';
8
+ path: string;
9
+ } | {
10
+ kind: 'project';
11
+ path: string;
12
+ } | {
13
+ kind: 'user';
14
+ path: string;
15
+ };
16
+ /** The short name to name a NON-default policy by -- the builtin's own name,
17
+ * or the file's basename, never the full path (a user who pointed at a file
18
+ * needs to see it took effect, not read its whole path in a one-line status
19
+ * bar). `null` for the default source, which the banner deliberately does not
20
+ * name at all. */
21
+ export declare function sourceLabel(source: PolicySource): string | null;
22
+ /** Where the policy came from, in the words a person reads at the terminal --
23
+ * for `/policy`'s longer-form "where it came from" line, not the banner's
24
+ * terse suffix. */
25
+ export declare function sourceDescription(source: PolicySource): string;
26
+ //# sourceMappingURL=policySource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policySource.d.ts","sourceRoot":"","sources":["../src/policySource.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC;;;;kBAIkB;AAClB,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CAS/D;AAED;;mBAEmB;AACnB,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAQ9D"}
@@ -0,0 +1,8 @@
1
+ import {
2
+ sourceDescription,
3
+ sourceLabel
4
+ } from "./chunk-CB5RFNB4.js";
5
+ export {
6
+ sourceDescription,
7
+ sourceLabel
8
+ };
package/dist/session.d.ts CHANGED
@@ -1,35 +1,128 @@
1
1
  import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions';
2
2
  import type OpenAI from 'openai';
3
- import type { AgentEvent, AgentTool, AskAnswers, AskQuestion, PermissionDecision, ToolContext } from '@corenel/protocol';
3
+ import type { AgentEvent, AgentTool, AskAnswers, AskQuestion, CompressionConfig, PermissionDecision, Policy, ToolContext } from '@corenel/protocol';
4
4
  import { type RunAgentArgs, type RunAgentResult } from '@corenel/harness/core/loop';
5
5
  import type { PermissionService } from '@corenel/harness/guardrail/permission-service';
6
- import { type CommittedItem, type TuiState } from './state';
6
+ import { type CommittedItem, type PaletteEntry, type TuiState } from './state';
7
+ import { type ReadExisting } from './writePreview';
7
8
  import { type SessionPersistence } from './persist';
9
+ import type { PolicySource } from './policySource';
10
+ /** The system prompt, as something that can be RE-DERIVED rather than fixed at
11
+ * construction. A bare string is fine for a host that never changes it (`corenel
12
+ * run`, tests); a thunk is what makes `/mode`/`/persona` real -- each of those
13
+ * commands mutates state the HOST owns (its current mode/persona id), and this
14
+ * is called fresh at the start of every turn (see `resolveSystem`/`runTurn`
15
+ * below) so the switch takes effect on the very next message instead of only
16
+ * after a restart. This is deliberately the ONLY hook: `@corenel/term` never
17
+ * imports @corenel/tools-node, the CLI, or anything about the config workspace
18
+ * -- it just calls whatever the host handed it, whenever a turn needs a system
19
+ * prompt, and takes the string back. */
20
+ export type SystemSource = string | (() => Promise<string>);
8
21
  export interface TermSessionDeps {
9
22
  cwd: string;
10
23
  model: string;
11
- system?: string;
24
+ system?: SystemSource;
12
25
  client: OpenAI;
13
26
  tools: AgentTool[];
27
+ /** The agent modes the host has configured, for `/mode` (list + validate). */
28
+ listModes?: () => Promise<PaletteEntry[]>;
29
+ /** Switch the CURRENT mode. Only takes effect once `system` (above) is next
30
+ * re-derived -- i.e. the following turn, never the one in flight. */
31
+ setMode?: (id: string) => void;
32
+ /** The personas the host has configured, for `/persona`. */
33
+ listPersonas?: () => Promise<PaletteEntry[]>;
34
+ /** Switch the CURRENT persona. Same next-turn timing as `setMode`. */
35
+ setPersona?: (id: string) => void;
36
+ /** The skills the host has installed, for `/skill`. */
37
+ listSkills?: () => Promise<PaletteEntry[]>;
38
+ /** Resolve a skill id to its instructions, to arm for the NEXT message only.
39
+ * Returns null when the id can't be loaded (already validated against
40
+ * `listSkills` by the time this is called, but a read can still fail). */
41
+ armSkill?: (id: string) => Promise<{
42
+ id: string;
43
+ label: string;
44
+ instructions: string;
45
+ } | null>;
46
+ /** The strategies saved in the host's workspace, for `/strategy`. */
47
+ listStrategies?: () => Promise<PaletteEntry[]>;
48
+ /** Resolve a saved strategy id to a prompt that runs it. `@corenel/term` has
49
+ * no multi-agent orchestrator of its own -- see the CLI's implementation for
50
+ * what "running" a strategy currently means there. */
51
+ resolveStrategy?: (id: string) => Promise<{
52
+ name: string;
53
+ prompt: string;
54
+ } | null>;
14
55
  /** Built per turn so each turn gets its own signal, and so `ask` reaches the
15
- * tool context — which is how ask_user finally works in node. */
16
- toolCtx: (signal: AbortSignal, ask: (q: AskQuestion[]) => Promise<AskAnswers | null>) => ToolContext;
17
- /** Skip the per-command approval prompt (`--allow-shell`). */
56
+ * tool context — which is how ask_user finally works in node. The optional
57
+ * third argument is the session's OWN PermissionService (see
58
+ * `attachPermission`), forwarded so a host that wires `ctx.spawn` (e.g. the
59
+ * CLI's `nodeToolCtx`) can hand sub-agents the SAME gate the parent turn
60
+ * runs under — a spawned agent's mutating tool must prompt through the one
61
+ * PermissionService the user is already answering, never a second one. */
62
+ toolCtx: (signal: AbortSignal, ask: (q: AskQuestion[]) => Promise<AskAnswers | null>, permission?: PermissionService) => ToolContext;
63
+ /** Skip the per-command approval prompt (`--allow-mutations`, alias `--allow-shell`). */
18
64
  approveAll?: boolean;
19
65
  /** Injected so tests can drive a turn without a model. Defaults to runAgent. */
20
66
  runner?: (args: RunAgentArgs) => Promise<RunAgentResult>;
21
67
  /** Raw event tap for a face that renders the turn as it happens (the readline
22
68
  * face streams from this; the Ink face renders state instead). Called before
23
- * the event is reduced. */
24
- onEvent?: (e: AgentEvent) => void;
69
+ * the event is reduced.
70
+ *
71
+ * The second argument is the tool row's ordinal, for the two event types
72
+ * that name one ('tool-call', 'tool-result') -- `undefined` otherwise. This
73
+ * is the ONE place a face can learn an id without recomputing it: the
74
+ * ordinal is still assigned by `nextOrd` below, this just previews/reads
75
+ * that same counter rather than keeping a second one in the face, which is
76
+ * exactly the class of bug (two counters that can drift) a face-side
77
+ * ordinal would risk. */
78
+ onEvent?: (e: AgentEvent, ord?: number) => void;
25
79
  /** Conversation persistence. Omit and the session is not written to disk. */
26
80
  persistence?: SessionPersistence;
27
81
  /** Read back a tool result that was offloaded to save context. */
28
82
  recall?: (id: string) => Promise<string | null>;
83
+ /** Context-compression config (rung-1 offload, see @corenel/harness/compression).
84
+ * Supplied by the HOST (the CLI) so this package stays host-agnostic and gains
85
+ * no node dependency — the same pattern as `persistence` and `toolCtx`. Omit
86
+ * to run with offload disabled, same as before this dep existed. */
87
+ compression?: CompressionConfig;
88
+ /** Told the conversation's session id whenever it becomes known or changes —
89
+ * once after `resume()` loads an existing session, and again after every
90
+ * `persist()` assigns/confirms one. A host that offloads tool results into a
91
+ * session-owned store (the CLI's FileRecallStore) needs this to keep the
92
+ * store pointed at the CURRENT session rather than one captured at
93
+ * construction, since the id is unknown until the first save. */
94
+ onSessionId?: (id: string) => void;
95
+ /** Reads the CURRENT content at a workspace-relative path, for the write-tool
96
+ * approval prompt's diff (see ./writePreview) — `null` when nothing exists
97
+ * there yet, a rejection when it exists but couldn't be read as text. Supplied
98
+ * by the HOST (the CLI, over its FileService) so this package takes on no
99
+ * file-backend dependency; omit it and `askPermission` falls back to today's
100
+ * bare-path prompt for every tool, same as before this dep existed. */
101
+ previewWrite?: ReadExisting;
102
+ /** The policy this session's own `PermissionService` (attached via
103
+ * `attachPermission`, above) was built from, and where it came from --
104
+ * powers `/policy`. Both optional, and BOTH must be supplied together for
105
+ * `/policy` to work: `@corenel/term` never reads argv or the filesystem, so
106
+ * these always arrive from the CLI (see policyResolve.ts's `resolvePolicy`).
107
+ * Missing either one degrades `/policy` to "not available", the same as
108
+ * every other host-supplied command in this file. */
109
+ policy?: Policy;
110
+ policySource?: PolicySource;
29
111
  }
30
112
  /** Deltas arrive per token; re-rendering React that often thrashes for output
31
113
  * no eye can follow. They coalesce on this interval instead. */
32
114
  export declare const DELTA_FLUSH_MS = 50;
115
+ /** Characters of `tool-delta` output retained per in-flight tool call (see
116
+ * LiveTool.delta). A dev server can print for hours; this is a LIVE row Ink
117
+ * repaints every frame, never a <Static> commit, so unlike a committed tool
118
+ * result there is no bound from the wire, no `truncated` flag, and no floor
119
+ * on how often it grows -- capping it here is the only thing standing between
120
+ * a chatty process and the same unbounded-live-region redraw corruption the
121
+ * module comment describes for streamed assistant text. Generous on purpose:
122
+ * only the LAST LINE of this is ever rendered (see ink/items.tsx's
123
+ * LiveToolRow), so the cap exists to bound memory and the string-concat cost
124
+ * of each delta, not to bound what's on screen. */
125
+ export declare const TOOL_DELTA_CAP = 4000;
33
126
  export declare class TermSession {
34
127
  protected readonly deps: TermSessionDeps;
35
128
  protected state: TuiState;
@@ -42,6 +135,18 @@ export declare class TermSession {
42
135
  /** How many leading blocks of `streamFull` have already been committed.
43
136
  * Only the block at this index (the last one seen so far) is still live. */
44
137
  private streamCommittedBlocks;
138
+ /** Whether this TURN has committed an assistant block yet. Reset only in
139
+ * `beginTurn` (never per round-trip within a turn, even though a turn with
140
+ * tool calls emits several 'assistant' events) so a whole turn's streamed
141
+ * reply -- however many rounds of tool use it took -- reads as ONE reply
142
+ * with ONE leading blank line, not one per round. See `commitAssistantBlock`. */
143
+ private replyHasBlock;
144
+ /** Set when a `blank` markdown span was seen but not committed as its own
145
+ * item (see `commitCompletedBlocks`), and consumed by the next block that
146
+ * DOES commit -- see `commitAssistantBlock`. Reset in `beginTurn` too: a
147
+ * blank line at the very end of one round of streamed text must never leak
148
+ * a gap onto the first block of a LATER round (e.g. after a tool call). */
149
+ private pendingGap;
45
150
  private pendingOffload;
46
151
  /** The model's truth, as opposed to `committed`, which is display. */
47
152
  private history;
@@ -59,6 +164,11 @@ export declare class TermSession {
59
164
  * it cannot build one itself. Unattached, `runTurn` simply omits `permission`
60
165
  * from the runner args, and the loop runs every tool ungated. */
61
166
  private permission;
167
+ /** Armed by `/skill <name>` (see runCommand); consumed and cleared by the
168
+ * NEXT runTurn, never a later one. `state.pendingSkill` mirrors just the
169
+ * label, for a face's indicator -- the instructions text never needs to
170
+ * reach a renderer. */
171
+ private pendingSkill;
62
172
  wantsExit: boolean;
63
173
  constructor(deps: TermSessionDeps);
64
174
  attachPermission(p: PermissionService): void;
@@ -70,6 +180,21 @@ export declare class TermSession {
70
180
  protected set(patch: Partial<TuiState>): void;
71
181
  protected id(prefix: string): string;
72
182
  protected commit(item: CommittedItem): void;
183
+ /** Commit one assistant block, marking it `leadingBlank` iff no block has
184
+ * been committed yet this turn OR a `blank` span was seen (and swallowed --
185
+ * see `commitCompletedBlocks`) since the last one that was. This is the
186
+ * ONLY place that commits an 'assistant' item -- commitCompletedBlocks, the
187
+ * manual commits in the 'assistant' event case, and endTurn's
188
+ * trailing-block commit all route through here, so there is one rule for
189
+ * which block gets the leading margin rather than four call sites that
190
+ * merely happen to agree today. */
191
+ private commitAssistantBlock;
192
+ /** The system prompt for the turn about to run -- called fresh every time
193
+ * (see `runTurn`), never cached, so a mode/persona switch (which mutates
194
+ * state the HOST owns, then calls `deps.system` again on the next turn)
195
+ * actually changes what the model sees instead of only looking like it did.
196
+ * A plain string `deps.system` degrades to exactly today's behaviour. */
197
+ private resolveSystem;
73
198
  protected note(level: 'info' | 'warn' | 'error', text: string, detail?: string): void;
74
199
  /** Open a live turn. Public-for-test until Task 4 gives it a real caller. */
75
200
  beginTurnForTest(): void;
@@ -97,10 +222,60 @@ export declare class TermSession {
97
222
  * flushDeltas kept live, since every block before it is already committed
98
223
  * -- and close the turn. */
99
224
  protected endTurn(): void;
225
+ /** The ordinal a 'tool-result' with this callId will commit with: the id
226
+ * already recorded against it in `live.tools` if a 'tool-call' announced
227
+ * it, or the next fresh one otherwise -- the second path is how a bare
228
+ * result with no matching call (loop.ts emits one straight away when the
229
+ * model's JSON arguments don't parse) still gets a real ordinal.
230
+ *
231
+ * PEEKS `nextOrd`, never advances it. This is shared, read-only, by BOTH
232
+ * `ordFor` (the tap's preview) and the 'tool-result' reducer case below
233
+ * (which alone decides whether to advance `nextOrd`, immediately after
234
+ * calling this) precisely so there is one rule for "what ordinal does this
235
+ * result get", expressed once, rather than two conditions that merely
236
+ * happen to agree today. A same-shaped bare-result WITHOUT this shared
237
+ * helper is exactly the case that let the tap and the reducer drift before
238
+ * -- ordFor returned undefined while the reducer minted a real ordinal. */
239
+ private resultOrd;
240
+ /** The ordinal a face's raw event tap should show for `e`, read from the
241
+ * SAME state the reducer below is about to use -- never a second counter.
242
+ * 'tool-call' previews the id the reducer is about to hand out (`nextOrd`
243
+ * itself, not a copy of it); 'tool-result' previews `resultOrd` above,
244
+ * covering the announced AND the bare-result case alike. Anything else has
245
+ * no ordinal to show. */
246
+ private ordFor;
100
247
  handleEvent(e: AgentEvent): void;
101
248
  /** Route one line: a command runs here; anything else is a turn. */
102
249
  submit(text: string): Promise<void>;
250
+ /** Run `line` as a turn now, or queue it, exactly like `submit` does for
251
+ * ordinary text -- factored out so `/strategy` (runCommand) can send its
252
+ * resolved prompt through the SAME busy/queue check a typed line gets,
253
+ * rather than calling `runTurn` directly and risking two turns in flight. */
254
+ private queueOrRun;
103
255
  private runCommand;
256
+ /** Runs a host-supplied config-workspace call (`listModes`, `listSkills`,
257
+ * `armSkill`, ...) and turns a THROW into a `warn` note instead of letting
258
+ * it escape the command handler and take the turn down with it.
259
+ *
260
+ * `listSkills()` (packages/harness/skills.ts) already wraps its own
261
+ * `seedConfig()`/read calls this way and never throws; `loadModes`/
262
+ * `loadPersonas` (packages/harness/prompts/config.ts) call `seedConfig()`
263
+ * UNGUARDED, so a genuine config-workspace failure (permissions, a
264
+ * read-only home, disk full -- masked on a normal install because
265
+ * `NodeFileService.write()` mkdirs recursively, but real on a broken one)
266
+ * threw straight out of `/mode`/`/persona` and crashed the turn instead of
267
+ * reporting "not available" the way `/skill` already does. Wrapping every
268
+ * host call here, not just the two that are known to need it, means the
269
+ * NEXT one added can't reintroduce the same gap by omission. */
270
+ private safeCall;
271
+ /** Shared `/mode` and `/persona` shape: no id lists what's configured, an
272
+ * unknown id reports the valid options (never silently no-ops, never sends
273
+ * a typo through to the model), a real id applies immediately -- "applies"
274
+ * meaning `deps.system` will pick it up on the NEXT `resolveSystem()` call,
275
+ * not this instant (see the field docs on TermSessionDeps.system). */
276
+ private switchIdentity;
277
+ private armSkillCommand;
278
+ private runStrategyCommand;
104
279
  /** Save after the turn, never during: a half-written turn is a lie on disk. */
105
280
  private persist;
106
281
  /** Reopen a conversation: `id` if given, otherwise the most recent. */
@@ -115,11 +290,10 @@ export declare class TermSession {
115
290
  * body when it wasn't offloaded, the short offload ref when it was — see
116
291
  * @corenel/harness core/loop.ts's `messages.push({ role: 'tool', ... })`),
117
292
  * and `history` is cleared by `/clear`, so a stale row can't outlive the
118
- * conversation it belongs to the way a side map would. Task 8 adds the (a)
119
- * branch below: reading an offloaded body back out of the blob store by
120
- * `row.offloadRefId` — the seam, not the wiring: the CLI does not pass
121
- * `deps.recall` (context compression in node is a separate feature), so
122
- * this branch is currently always skipped in practice. */
293
+ * conversation it belongs to the way a side map would. Branch (a) below reads
294
+ * an offloaded body back out of the blob store by `row.offloadRefId` — live
295
+ * now that the CLI passes `deps.recall` and `deps.compression` (see
296
+ * packages/cli/src/cli.ts). */
123
297
  protected fullResult(_id: string, row: Extract<CommittedItem, {
124
298
  kind: 'tool';
125
299
  }>): Promise<string>;
@@ -134,6 +308,18 @@ export declare class TermSession {
134
308
  /** Stop the TURN, never the process. A long tool call you regret is the common
135
309
  * case, and killing the shell to escape it loses the conversation. */
136
310
  abort(): void;
311
+ /** DO NOT mark this method `async` -- that is a deliberate, load-bearing
312
+ * choice, not an oversight to "clean up" later. An `async` function turns a
313
+ * synchronous `throw` into a REJECTED PROMISE rather than an exception the
314
+ * caller's own `try`/`catch` sees, which would silently break the "a
315
+ * question is already open" guard immediately below (session.turn.test.ts's
316
+ * "refuses a second concurrent ask rather than queueing it quietly" pins
317
+ * this: it calls `askPermission` twice back-to-back and asserts the SECOND
318
+ * call throws synchronously). The diff read only ever happens for a write
319
+ * tool with a `path` AND a host that wired `previewWrite` -- reached via the
320
+ * `.then(openModal)` chain below, not `await` -- so every other call stays
321
+ * fully synchronous, exactly as before this method could show a diff at
322
+ * all. */
137
323
  askPermission(req: {
138
324
  tool: string;
139
325
  input: unknown;
@@ -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,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACzH,OAAO,EAAY,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAc,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIxE,OAAO,EAAoC,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAkBtF,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB;qEACiE;IACjE,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,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AChD,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
@@ -1,12 +1,17 @@
1
1
  import {
2
2
  DELTA_FLUSH_MS,
3
+ TOOL_DELTA_CAP,
3
4
  TermSession
4
- } from "./chunk-HYWLODZT.js";
5
- import "./chunk-47IH6X5H.js";
6
- import "./chunk-R6AXTD55.js";
7
- import "./chunk-TCVDVYMF.js";
8
- import "./chunk-HAQGHLW6.js";
5
+ } from "./chunk-F4ENQXQQ.js";
6
+ import "./chunk-OSJFMQCW.js";
7
+ import "./chunk-VTJEWHM3.js";
8
+ import "./chunk-M44CET5L.js";
9
+ import "./chunk-I44FC7PE.js";
10
+ import "./chunk-IK4ZANNW.js";
11
+ import "./chunk-2D7G4YW2.js";
12
+ import "./chunk-CB5RFNB4.js";
9
13
  export {
10
14
  DELTA_FLUSH_MS,
15
+ TOOL_DELTA_CAP,
11
16
  TermSession
12
17
  };