@corenel/term 0.3.0 → 0.5.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.
- package/README.md +1 -1
- package/dist/approvalText.d.ts +6 -0
- package/dist/approvalText.d.ts.map +1 -0
- package/dist/{chunk-HUVRQX53.js → chunk-IF6DCCK2.js} +118 -12
- package/dist/{chunk-2MGDL3I4.js → chunk-MAZLORMD.js} +2 -0
- package/dist/{chunk-5RPHYXND.js → chunk-TWFWLEIP.js} +4 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +1 -1
- package/dist/ink/App.d.ts.map +1 -1
- package/dist/ink/ContextOverlay.d.ts +2 -1
- package/dist/ink/ContextOverlay.d.ts.map +1 -1
- package/dist/ink/HelpOverlay.d.ts +9 -2
- package/dist/ink/HelpOverlay.d.ts.map +1 -1
- package/dist/ink/McpOverlay.d.ts +2 -7
- package/dist/ink/McpOverlay.d.ts.map +1 -1
- package/dist/ink/Modal.d.ts +11 -2
- package/dist/ink/Modal.d.ts.map +1 -1
- package/dist/ink/index.d.ts +18 -0
- package/dist/ink/index.d.ts.map +1 -1
- package/dist/ink/index.js +293 -98
- package/dist/ink/overlayBudget.d.ts +27 -0
- package/dist/ink/overlayBudget.d.ts.map +1 -0
- package/dist/session.d.ts +51 -8
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +13 -5
- package/dist/state.d.ts +26 -2
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +3 -1
- package/package.json +5 -5
package/dist/session.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions';
|
|
2
2
|
import type OpenAI from 'openai';
|
|
3
|
-
import type { AgentEvent, AgentTool, AskAnswers, AskQuestion, CompressionConfig, PermissionDecision, Policy, ToolContext } from '@corenel/protocol';
|
|
3
|
+
import type { AgentEvent, AgentTool, ApprovalSuggestion, AskAnswers, AskQuestion, CompressionConfig, PermissionDecision, Policy, PromptAnswer, SuggestionChoice, ToolContext } from '@corenel/protocol';
|
|
4
4
|
import { type RunAgentArgs, type RunAgentResult } from '@corenel/harness/core/loop';
|
|
5
|
+
import type { SkillEntry } from '@corenel/harness/tools/skillTool';
|
|
5
6
|
import { type ModelRates } from '@corenel/harness/core/pricing';
|
|
6
7
|
import type { PermissionService } from '@corenel/harness/guardrail/permission-service';
|
|
7
8
|
import { type CommittedItem, type McpServerView, type PaletteEntry, type TuiState } from './state';
|
|
@@ -9,6 +10,7 @@ import { type ContextSnapshot } from './contextText';
|
|
|
9
10
|
import { type ReadExisting } from './writePreview';
|
|
10
11
|
import { type SessionPersistence } from './persist';
|
|
11
12
|
import type { PolicySource } from './policySource';
|
|
13
|
+
export { parseSuggestionChoice, suggestionKeys, suggestionLine, suggestionOutcome } from './approvalText';
|
|
12
14
|
/** The system prompt, as something that can be RE-DERIVED rather than fixed at
|
|
13
15
|
* construction. A bare string is fine for a host that never changes it (`corenel
|
|
14
16
|
* run`, tests); a thunk is what makes `/mode`/`/persona` real -- each of those
|
|
@@ -24,6 +26,10 @@ export interface TermSessionDeps {
|
|
|
24
26
|
cwd: string;
|
|
25
27
|
model: string;
|
|
26
28
|
system?: SystemSource;
|
|
29
|
+
/** The enabled skills, read fresh each turn so one enabled mid-session is
|
|
30
|
+
* offered on the next. The loop turns them into a system-prompt index plus
|
|
31
|
+
* `use_skill` (harness tools/skillTool.ts). Absent = no skills. */
|
|
32
|
+
skills?: () => Promise<SkillEntry[]>;
|
|
27
33
|
client: OpenAI;
|
|
28
34
|
tools: AgentTool[];
|
|
29
35
|
/** Per-1M-token rates for `model`, or null when nothing prices it -- used to
|
|
@@ -49,9 +55,12 @@ export interface TermSessionDeps {
|
|
|
49
55
|
* guess. */
|
|
50
56
|
contextWindow?: () => number | null;
|
|
51
57
|
/** The models this host knows about, for `/model` (list only). The model is
|
|
52
|
-
* FIXED once a session begins -- `resolveContextWindow(model)`
|
|
53
|
-
* launch (packages/cli/src/cli.ts's `resolvedWindow`) and
|
|
54
|
-
*
|
|
58
|
+
* FIXED once a session begins -- `resolveContextWindow(model)` resolves it
|
|
59
|
+
* at launch (packages/cli/src/cli.ts's `resolvedWindow`), and a later
|
|
60
|
+
* hydration from the backend's own catalog may raise or lower that number
|
|
61
|
+
* in place (see the same file's `compression.contextWindow` mutation), but
|
|
62
|
+
* the MODEL itself never changes mid-session and sizes rung-2 compaction
|
|
63
|
+
* throughout; switching to a model with a SMALLER window mid-session
|
|
55
64
|
* would leave compaction sized for the larger one and the loop would meet
|
|
56
65
|
* the context wall as a fatal 400 instead of compacting in time. So `/model
|
|
57
66
|
* <id>` refuses (see `runModelCommand`) and there is no `setModel` dep --
|
|
@@ -159,6 +168,9 @@ export interface TermSessionDeps {
|
|
|
159
168
|
* `/mcp login` registers afresh. See the CLI's `McpAdmin.forget` for why
|
|
160
169
|
* this is always a local write. */
|
|
161
170
|
forgetMcpServer?: (name: string) => Promise<void>;
|
|
171
|
+
/** Persist the user's answer to an approval suggestion (plan 2). Absent: the
|
|
172
|
+
* session never shows one. Supplied by the host from its approvals service. */
|
|
173
|
+
saveApprovalChoice?: (s: ApprovalSuggestion, choice: SuggestionChoice) => Promise<void>;
|
|
162
174
|
}
|
|
163
175
|
/** Deltas arrive per token; re-rendering React that often thrashes for output
|
|
164
176
|
* no eye can follow. They coalesce on this interval instead. */
|
|
@@ -207,6 +219,12 @@ export declare class TermSession {
|
|
|
207
219
|
private turnId;
|
|
208
220
|
private activeTurn;
|
|
209
221
|
private pending;
|
|
222
|
+
/** The tool name a `pending` permission ask is FOR -- set only by
|
|
223
|
+
* `askPermission`, never by `askUser` (a question is not tied to one tool).
|
|
224
|
+
* Consumed once by `resolvePending` to decide whether a denied ask should
|
|
225
|
+
* drop a held suggestion for the same tool (final review M3). */
|
|
226
|
+
private pendingAskTool;
|
|
227
|
+
private heldSuggestion;
|
|
210
228
|
private draining;
|
|
211
229
|
private historyGen;
|
|
212
230
|
private settling;
|
|
@@ -408,14 +426,18 @@ export declare class TermSession {
|
|
|
408
426
|
openMcpManager(): Promise<void>;
|
|
409
427
|
/** esc, or any other reason the overlay should close -- a no-op unless the
|
|
410
428
|
* manager is actually the modal open right now, so it can never steal a
|
|
411
|
-
* permission or question modal's close.
|
|
429
|
+
* permission or question modal's close. Restores a held suggestion (final
|
|
430
|
+
* review M3) rather than just clearing the modal -- otherwise an offer held
|
|
431
|
+
* behind this overlay came back only when some LATER, unrelated permission
|
|
432
|
+
* ask happened to resolve. */
|
|
412
433
|
closeMcpManager(): void;
|
|
413
434
|
/** `/help` with no argument, from the Ink face only -- see the module doc
|
|
414
435
|
* above. */
|
|
415
436
|
openHelp(): void;
|
|
416
437
|
/** esc, or any other reason the overlay should close -- a no-op unless the
|
|
417
438
|
* help overlay is actually the modal open right now, so it can never steal
|
|
418
|
-
* a permission, question, or MCP modal's close.
|
|
439
|
+
* a permission, question, or MCP modal's close. Restores a held suggestion
|
|
440
|
+
* (final review M3) -- see closeMcpManager's doc. */
|
|
419
441
|
closeHelp(): void;
|
|
420
442
|
/** The data `formatContext` (contextText.ts) needs, assembled from
|
|
421
443
|
* `TuiState`'s own accumulators and the two host-supplied static facts
|
|
@@ -430,7 +452,9 @@ export declare class TermSession {
|
|
|
430
452
|
openContext(): void;
|
|
431
453
|
/** esc, or any other reason the context overlay should close -- a no-op
|
|
432
454
|
* unless the context overlay is actually the modal open right now, so it
|
|
433
|
-
* can never steal a permission, question, help, or MCP modal's close.
|
|
455
|
+
* can never steal a permission, question, help, or MCP modal's close.
|
|
456
|
+
* Restores a held suggestion (final review M3) -- see closeMcpManager's
|
|
457
|
+
* doc. */
|
|
434
458
|
closeContext(): void;
|
|
435
459
|
/** Up/down inside the overlay -- wraps, and does nothing with zero rows. */
|
|
436
460
|
moveMcpSelection(delta: number): void;
|
|
@@ -500,7 +524,7 @@ export declare class TermSession {
|
|
|
500
524
|
askPermission(req: {
|
|
501
525
|
tool: string;
|
|
502
526
|
input: unknown;
|
|
503
|
-
}): Promise<PermissionDecision>;
|
|
527
|
+
}): Promise<PermissionDecision | PromptAnswer>;
|
|
504
528
|
askUser(questions: AskQuestion[]): Promise<AskAnswers | null>;
|
|
505
529
|
/** The view's answer to whichever modal is open. */
|
|
506
530
|
answer(value: PermissionDecision | AskAnswers | null): void;
|
|
@@ -512,5 +536,24 @@ export declare class TermSession {
|
|
|
512
536
|
* outcome that `askUserTool` (packages/harness/tools/builtins.ts) checks for. */
|
|
513
537
|
private forceClosePending;
|
|
514
538
|
private resolvePending;
|
|
539
|
+
/** Restore whatever suggestion is held (if any) as the visible modal,
|
|
540
|
+
* dropping it instead if `dropForTool` names the tool it is for. Shared by
|
|
541
|
+
* every path that can uncover a held offer: answering a permission/question
|
|
542
|
+
* ask (`resolvePending`), and closing the help/MCP/context overlays -- all
|
|
543
|
+
* of which used to just clear the modal, silently losing a held offer until
|
|
544
|
+
* some LATER, unrelated permission answer happened to surface it (final
|
|
545
|
+
* review M3). */
|
|
546
|
+
private restoreHeldSuggestion;
|
|
547
|
+
/** Offer a standing approval. Shown now if nothing is open, otherwise held
|
|
548
|
+
* until the open prompt is answered; a newer offer replaces a held one. */
|
|
549
|
+
offerApprovalSuggestion(s: ApprovalSuggestion): void;
|
|
550
|
+
/** Arm a widening choice (`workspace` / `global`) without granting it yet --
|
|
551
|
+
* only a following Enter (`respondApprovalSuggestion`) does that. See
|
|
552
|
+
* ApprovalSuggestionView's doc (final review I1). A no-op if the suggestion
|
|
553
|
+
* modal is not open. */
|
|
554
|
+
armApprovalSuggestion(choice: SuggestionChoice): void;
|
|
555
|
+
respondApprovalSuggestion(choice: SuggestionChoice): Promise<void>;
|
|
556
|
+
/** Escape: ignore the offer. Writes nothing (plan Task 5: ignoring is not a choice). */
|
|
557
|
+
dismissApprovalSuggestion(): void;
|
|
515
558
|
}
|
|
516
559
|
//# sourceMappingURL=session.d.ts.map
|
package/dist/session.d.ts.map
CHANGED
|
@@ -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;
|
|
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,kBAAkB,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACxM,OAAO,EAAY,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,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,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG3H,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAuC,KAAK,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AAG3G,OAAO,EAAoC,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACtF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,g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D;;;;;qFAKiF;IACjF,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,cAAc;IAgBtB;;;;;;qBAMiB;IACjB,OAAO,CAAC,qBAAqB;IAW7B;+EAC2E;IAC3E,uBAAuB,CAAC,CAAC,EAAE,kBAAkB,GAAG,IAAI;IAMpD;;;4BAGwB;IACxB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAK/C,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAaxE,wFAAwF;IACxF,yBAAyB,IAAI,IAAI;CAGlC"}
|
package/dist/session.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DELTA_FLUSH_MS,
|
|
3
3
|
TOOL_DELTA_CAP,
|
|
4
|
-
TermSession
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
TermSession,
|
|
5
|
+
parseSuggestionChoice,
|
|
6
|
+
suggestionKeys,
|
|
7
|
+
suggestionLine,
|
|
8
|
+
suggestionOutcome
|
|
9
|
+
} from "./chunk-IF6DCCK2.js";
|
|
10
|
+
import "./chunk-MAZLORMD.js";
|
|
11
|
+
import "./chunk-TWFWLEIP.js";
|
|
8
12
|
import "./chunk-M44CET5L.js";
|
|
9
13
|
import "./chunk-I44FC7PE.js";
|
|
10
14
|
import "./chunk-TYP4MMO7.js";
|
|
@@ -13,5 +17,9 @@ import "./chunk-CB5RFNB4.js";
|
|
|
13
17
|
export {
|
|
14
18
|
DELTA_FLUSH_MS,
|
|
15
19
|
TOOL_DELTA_CAP,
|
|
16
|
-
TermSession
|
|
20
|
+
TermSession,
|
|
21
|
+
parseSuggestionChoice,
|
|
22
|
+
suggestionKeys,
|
|
23
|
+
suggestionLine,
|
|
24
|
+
suggestionOutcome
|
|
17
25
|
};
|
package/dist/state.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AskQuestion, Usage } from '@corenel/protocol';
|
|
1
|
+
import type { ApprovalSuggestion, AskQuestion, SuggestionChoice, Usage } from '@corenel/protocol';
|
|
2
2
|
import type { WritePreview } from './writePreview';
|
|
3
3
|
/** One selectable id for a host-supplied capability (`/mode`, `/persona`,
|
|
4
4
|
* `/skill`, `/strategy`) -- a mode/persona/skill/strategy as DATA, never as a
|
|
@@ -129,7 +129,31 @@ export interface HelpView {
|
|
|
129
129
|
export interface ContextView {
|
|
130
130
|
kind: 'context';
|
|
131
131
|
}
|
|
132
|
-
|
|
132
|
+
/** A standing-approval offer (plan 2). NOT a pending ask: nothing waits on it,
|
|
133
|
+
* the turn keeps running, and Escape ignores it without writing anything.
|
|
134
|
+
*
|
|
135
|
+
* `openedAt` and `armedChoice` exist for one reason (final review I1): a
|
|
136
|
+
* standing-approval grant must be a deliberate keystroke, never a keystroke
|
|
137
|
+
* typed for something else. `openedAt` is the timestamp the offer became
|
|
138
|
+
* VISIBLE (set again each time a held offer is restored, not just on the
|
|
139
|
+
* first offer) -- a face ignores every key for a short arm delay after that,
|
|
140
|
+
* so a burst of type-ahead lands on nothing. `armedChoice` holds a choice
|
|
141
|
+
* that WIDENS access (`workspace` / `global`) once its key is pressed, but
|
|
142
|
+
* does not yet grant it -- only a following Enter does. `not-now` and `never`
|
|
143
|
+
* never widen anything, so they still apply on their own keystroke, without
|
|
144
|
+
* arming or Enter. */
|
|
145
|
+
export interface ApprovalSuggestionView {
|
|
146
|
+
kind: 'suggestion';
|
|
147
|
+
suggestion: ApprovalSuggestion;
|
|
148
|
+
openedAt: number;
|
|
149
|
+
armedChoice: SuggestionChoice | null;
|
|
150
|
+
}
|
|
151
|
+
/** How long a face ignores every key after a suggestion becomes visible
|
|
152
|
+
* (final review I1). Long enough to eat a burst of type-ahead landing right
|
|
153
|
+
* as the offer appears, short enough that a deliberate answer never feels
|
|
154
|
+
* delayed. */
|
|
155
|
+
export declare const SUGGESTION_ARM_DELAY_MS = 400;
|
|
156
|
+
export type Modal = PermissionAsk | UserAsk | McpManager | HelpView | ContextView | ApprovalSuggestionView;
|
|
133
157
|
export type TodoStatus = 'pending' | 'in_progress' | 'completed' | 'blocked';
|
|
134
158
|
/** A local mirror of the harness's `todo_write` tool contract (see
|
|
135
159
|
* packages/harness/tools/todo.ts) — kept local rather than imported so this
|
package/dist/state.d.ts.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAClG,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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
package/dist/state.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corenel/term",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.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.
|
|
50
|
-
"@corenel/protocol": "0.
|
|
49
|
+
"@corenel/harness": "0.11.0",
|
|
50
|
+
"@corenel/protocol": "0.10.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/node": "^24.13.1",
|
|
@@ -55,11 +55,11 @@
|
|
|
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.
|
|
58
|
+
"@corenel/tools-node": "0.5.1"
|
|
59
59
|
},
|
|
60
60
|
"license": "Elastic-2.0",
|
|
61
61
|
"engines": {
|
|
62
|
-
"node": ">=
|
|
62
|
+
"node": ">=22"
|
|
63
63
|
},
|
|
64
64
|
"files": [
|
|
65
65
|
"dist",
|