@cruxy/cli 1.0.2 → 1.0.4
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/dist/agent/loop.js +3 -0
- package/dist/agent/session.js +2 -1
- package/dist/theme/tokens.js +3 -0
- package/dist/usage/collect.js +41 -2
- package/dist/usage/index.js +1 -1
- package/dist/usage/summary.js +19 -0
- package/dist/usage/types.js +9 -0
- package/package.json +1 -1
- package/dist/agent/budget.d.ts +0 -52
- package/dist/agent/index.d.ts +0 -3
- package/dist/agent/loop.d.ts +0 -159
- package/dist/agent/prompts.d.ts +0 -69
- package/dist/agent/session.d.ts +0 -212
- package/dist/approval/classify.d.ts +0 -18
- package/dist/approval/index.d.ts +0 -6
- package/dist/approval/mutex.d.ts +0 -45
- package/dist/approval/policy.d.ts +0 -43
- package/dist/approval/prompt.d.ts +0 -48
- package/dist/approval/service.d.ts +0 -36
- package/dist/approval/types.d.ts +0 -82
- package/dist/brand/index.d.ts +0 -1
- package/dist/brand/voice.d.ts +0 -94
- package/dist/checkpoint/capture.d.ts +0 -17
- package/dist/checkpoint/gate-hook.d.ts +0 -28
- package/dist/checkpoint/gate.d.ts +0 -71
- package/dist/checkpoint/git-store.d.ts +0 -61
- package/dist/checkpoint/index.d.ts +0 -10
- package/dist/checkpoint/restore.d.ts +0 -23
- package/dist/checkpoint/service.d.ts +0 -89
- package/dist/checkpoint/set-rollback.d.ts +0 -51
- package/dist/checkpoint/set.d.ts +0 -44
- package/dist/checkpoint/shadow-store.d.ts +0 -23
- package/dist/checkpoint/types.d.ts +0 -164
- package/dist/cli/commands/checkpoint.d.ts +0 -7
- package/dist/cli/commands/config.d.ts +0 -2
- package/dist/cli/commands/hooks.d.ts +0 -8
- package/dist/cli/commands/index.d.ts +0 -7
- package/dist/cli/commands/init.d.ts +0 -7
- package/dist/cli/commands/login.d.ts +0 -8
- package/dist/cli/commands/mcp.d.ts +0 -9
- package/dist/cli/commands/memory.d.ts +0 -8
- package/dist/cli/commands/pr.d.ts +0 -8
- package/dist/cli/commands/rollback.d.ts +0 -18
- package/dist/cli/commands/run.d.ts +0 -2
- package/dist/cli/commands/skills.d.ts +0 -8
- package/dist/cli/commands/test.d.ts +0 -9
- package/dist/cli/commands/usage.d.ts +0 -9
- package/dist/cli/onboard.d.ts +0 -25
- package/dist/cli/program.d.ts +0 -2
- package/dist/cli/repl.d.ts +0 -27
- package/dist/cli/session-factory.d.ts +0 -42
- package/dist/cli/stream-print.d.ts +0 -14
- package/dist/components/autocomplete.d.ts +0 -32
- package/dist/components/frame.d.ts +0 -28
- package/dist/components/fuzzy.d.ts +0 -61
- package/dist/components/index.d.ts +0 -6
- package/dist/components/input.d.ts +0 -78
- package/dist/components/keys.d.ts +0 -48
- package/dist/components/select.d.ts +0 -28
- package/dist/config/credentials.d.ts +0 -18
- package/dist/config/index.d.ts +0 -5
- package/dist/config/manager.d.ts +0 -39
- package/dist/config/owner-only.d.ts +0 -19
- package/dist/config/paths.d.ts +0 -9
- package/dist/config/project.d.ts +0 -10
- package/dist/config/schema.d.ts +0 -2143
- package/dist/constants.d.ts +0 -65
- package/dist/errors/boundary.d.ts +0 -43
- package/dist/errors/constructors.d.ts +0 -411
- package/dist/errors/format.d.ts +0 -31
- package/dist/errors/index.d.ts +0 -4
- package/dist/errors/types.d.ts +0 -270
- package/dist/hooks/config.d.ts +0 -21
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/router.d.ts +0 -58
- package/dist/hooks/runner.d.ts +0 -88
- package/dist/hooks/service.d.ts +0 -38
- package/dist/hooks/slash.d.ts +0 -48
- package/dist/hooks/trust.d.ts +0 -46
- package/dist/hooks/types.d.ts +0 -147
- package/dist/index.d.ts +0 -2
- package/dist/indexing/chunker.d.ts +0 -28
- package/dist/indexing/embedder.d.ts +0 -98
- package/dist/indexing/index.d.ts +0 -9
- package/dist/indexing/indexer.d.ts +0 -45
- package/dist/indexing/retriever.d.ts +0 -61
- package/dist/indexing/service.d.ts +0 -49
- package/dist/indexing/store.d.ts +0 -103
- package/dist/indexing/types.d.ts +0 -78
- package/dist/indexing/util.d.ts +0 -34
- package/dist/indexing/walker.d.ts +0 -53
- package/dist/jobs/approval-queue.d.ts +0 -85
- package/dist/jobs/dispatch-tool.d.ts +0 -34
- package/dist/jobs/index.d.ts +0 -6
- package/dist/jobs/log-buffer.d.ts +0 -31
- package/dist/jobs/log-renderer.d.ts +0 -32
- package/dist/jobs/manager.d.ts +0 -139
- package/dist/jobs/types.d.ts +0 -81
- package/dist/lsp/client.d.ts +0 -25
- package/dist/lsp/index.d.ts +0 -8
- package/dist/lsp/pool.d.ts +0 -48
- package/dist/lsp/registry.d.ts +0 -38
- package/dist/lsp/server.d.ts +0 -48
- package/dist/lsp/service.d.ts +0 -44
- package/dist/lsp/tools/common.d.ts +0 -50
- package/dist/lsp/tools/find-definition.d.ts +0 -23
- package/dist/lsp/tools/find-references.d.ts +0 -23
- package/dist/lsp/tools/get-diagnostics.d.ts +0 -17
- package/dist/lsp/tools/hover.d.ts +0 -23
- package/dist/lsp/tools/index.d.ts +0 -4
- package/dist/lsp/transport.d.ts +0 -39
- package/dist/lsp/types.d.ts +0 -107
- package/dist/mcp/adapter.d.ts +0 -44
- package/dist/mcp/bounds.d.ts +0 -35
- package/dist/mcp/client.d.ts +0 -19
- package/dist/mcp/demarcate.d.ts +0 -12
- package/dist/mcp/http-transport.d.ts +0 -89
- package/dist/mcp/index.d.ts +0 -12
- package/dist/mcp/service.d.ts +0 -71
- package/dist/mcp/sibling-banner.d.ts +0 -25
- package/dist/mcp/transport.d.ts +0 -30
- package/dist/mcp/trust-gate.d.ts +0 -59
- package/dist/mcp/trust.d.ts +0 -62
- package/dist/mcp/types.d.ts +0 -62
- package/dist/mcp/url-guard.d.ts +0 -48
- package/dist/memory/index.d.ts +0 -7
- package/dist/memory/recall.d.ts +0 -56
- package/dist/memory/remember-tool.d.ts +0 -28
- package/dist/memory/secrets.d.ts +0 -29
- package/dist/memory/service.d.ts +0 -92
- package/dist/memory/store.d.ts +0 -32
- package/dist/memory/trust.d.ts +0 -52
- package/dist/memory/types.d.ts +0 -101
- package/dist/net/ip-guard.d.ts +0 -55
- package/dist/onboarding/detect.d.ts +0 -26
- package/dist/onboarding/flow.d.ts +0 -28
- package/dist/onboarding/index.d.ts +0 -5
- package/dist/onboarding/io.d.ts +0 -9
- package/dist/onboarding/steps.d.ts +0 -17
- package/dist/onboarding/types.d.ts +0 -81
- package/dist/plan/approve.d.ts +0 -16
- package/dist/plan/execute.d.ts +0 -28
- package/dist/plan/index.d.ts +0 -7
- package/dist/plan/policy.d.ts +0 -26
- package/dist/plan/render.d.ts +0 -5
- package/dist/plan/service.d.ts +0 -58
- package/dist/plan/submit-plan.d.ts +0 -33
- package/dist/plan/types.d.ts +0 -60
- package/dist/render/capabilities.d.ts +0 -31
- package/dist/render/diff.d.ts +0 -18
- package/dist/render/highlight.d.ts +0 -47
- package/dist/render/index.d.ts +0 -22
- package/dist/render/layout.d.ts +0 -59
- package/dist/render/motion.d.ts +0 -76
- package/dist/render/plain-renderer.d.ts +0 -39
- package/dist/render/resize.d.ts +0 -36
- package/dist/render/screen-reader-renderer.d.ts +0 -45
- package/dist/render/state.d.ts +0 -49
- package/dist/render/tty-renderer.d.ts +0 -106
- package/dist/render/types.d.ts +0 -201
- package/dist/routing/index.d.ts +0 -2
- package/dist/routing/resolve.d.ts +0 -17
- package/dist/routing/router.d.ts +0 -47
- package/dist/routing/types.d.ts +0 -42
- package/dist/sandbox/detect.d.ts +0 -22
- package/dist/sandbox/docker-runtime.d.ts +0 -32
- package/dist/sandbox/index.d.ts +0 -7
- package/dist/sandbox/policy.d.ts +0 -26
- package/dist/sandbox/service.d.ts +0 -64
- package/dist/sandbox/types.d.ts +0 -123
- package/dist/skills/index.d.ts +0 -4
- package/dist/skills/loader.d.ts +0 -43
- package/dist/skills/parser.d.ts +0 -31
- package/dist/skills/service.d.ts +0 -41
- package/dist/skills/types.d.ts +0 -94
- package/dist/subagent/index.d.ts +0 -5
- package/dist/subagent/orchestrator.d.ts +0 -169
- package/dist/subagent/registry-scope.d.ts +0 -41
- package/dist/subagent/semaphore.d.ts +0 -56
- package/dist/subagent/spawn-tool.d.ts +0 -86
- package/dist/subagent/types.d.ts +0 -65
- package/dist/testing/detect.d.ts +0 -3
- package/dist/testing/index.d.ts +0 -5
- package/dist/testing/parse.d.ts +0 -33
- package/dist/testing/run-tests-tool.d.ts +0 -64
- package/dist/testing/runner.d.ts +0 -26
- package/dist/testing/sandbox-runner.d.ts +0 -16
- package/dist/testing/types.d.ts +0 -66
- package/dist/theme/index.d.ts +0 -2
- package/dist/theme/resolve.d.ts +0 -43
- package/dist/theme/tokens.d.ts +0 -119
- package/dist/tools/create-pull-request.d.ts +0 -27
- package/dist/tools/file/apply-patch.d.ts +0 -94
- package/dist/tools/file/edit-file.d.ts +0 -12
- package/dist/tools/file/glob.d.ts +0 -17
- package/dist/tools/file/grep-files.d.ts +0 -43
- package/dist/tools/file/index.d.ts +0 -7
- package/dist/tools/file/match.d.ts +0 -43
- package/dist/tools/file/paths.d.ts +0 -160
- package/dist/tools/file/read-file.d.ts +0 -8
- package/dist/tools/file/write-file.d.ts +0 -10
- package/dist/tools/git-status.d.ts +0 -15
- package/dist/tools/index.d.ts +0 -9
- package/dist/tools/list-files.d.ts +0 -13
- package/dist/tools/list-skills.d.ts +0 -9
- package/dist/tools/load-skill.d.ts +0 -21
- package/dist/tools/registry.d.ts +0 -23
- package/dist/tools/search-codebase.d.ts +0 -35
- package/dist/tools/shell/exec.d.ts +0 -53
- package/dist/tools/shell/index.d.ts +0 -1
- package/dist/tools/shell/resolve-shell.d.ts +0 -81
- package/dist/tools/shell/run-command.d.ts +0 -14
- package/dist/tools/types.d.ts +0 -257
- package/dist/usage/collect.d.ts +0 -40
- package/dist/usage/cost.d.ts +0 -19
- package/dist/usage/index.d.ts +0 -15
- package/dist/usage/store.d.ts +0 -37
- package/dist/usage/summary.d.ts +0 -32
- package/dist/usage/types.d.ts +0 -220
- package/dist/utils/child-tree.d.ts +0 -33
- package/dist/utils/git.d.ts +0 -17
- package/dist/utils/logger.d.ts +0 -18
- package/dist/utils/process-tree.d.ts +0 -16
- package/dist/vcs/auth.d.ts +0 -22
- package/dist/vcs/generate.d.ts +0 -74
- package/dist/vcs/git.d.ts +0 -60
- package/dist/vcs/github.d.ts +0 -50
- package/dist/vcs/guidance.d.ts +0 -20
- package/dist/vcs/index.d.ts +0 -7
- package/dist/vcs/service.d.ts +0 -61
- package/dist/vcs/types.d.ts +0 -73
- package/dist/web/demarcate.d.ts +0 -13
- package/dist/web/fetch.d.ts +0 -11
- package/dist/web/index.d.ts +0 -7
- package/dist/web/provider.d.ts +0 -29
- package/dist/web/search.d.ts +0 -17
- package/dist/web/ssrf.d.ts +0 -41
- package/dist/web/tools.d.ts +0 -20
- package/dist/web/types.d.ts +0 -64
- package/dist/workspace/add-root.d.ts +0 -27
- package/dist/workspace/index.d.ts +0 -6
- package/dist/workspace/resolve.d.ts +0 -54
- package/dist/workspace/select.d.ts +0 -41
- package/dist/workspace/types.d.ts +0 -30
- package/dist/workspace/workspace.d.ts +0 -61
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { Theme } from "../theme/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Best-effort, bounded syntax highlighting for fenced code blocks in streamed
|
|
4
|
-
* markdown (U.2). Priorities, in order: never crash the stream, never hold the
|
|
5
|
-
* stream back, then look nice.
|
|
6
|
-
*
|
|
7
|
-
* - Prose passes through immediately, byte for byte. The only hold-back is a
|
|
8
|
-
* line that is still a plausible fence opener (a leading backtick run), held
|
|
9
|
-
* until disambiguated — bounded by one short line, never a block.
|
|
10
|
-
* - Inside a fence, lines are highlighted incrementally: each line is emitted
|
|
11
|
-
* the moment its newline arrives, so latency is one line, and committed
|
|
12
|
-
* output is never repainted.
|
|
13
|
-
* - Unknown language → plain text. A tokenizer throw → that line plain. The
|
|
14
|
-
* tokenizer is hand-rolled (no highlighter dependency, in the same spirit as
|
|
15
|
-
* the hand-rolled HTTP client) and colors only what it is sure about:
|
|
16
|
-
* comments, strings, keywords, numbers.
|
|
17
|
-
*/
|
|
18
|
-
/** Cross-line tokenizer state (block comments / multi-line strings). */
|
|
19
|
-
export interface HighlightCarry {
|
|
20
|
-
/** Inside a block comment (`/* … *``/`). */
|
|
21
|
-
blockComment: boolean;
|
|
22
|
-
/** Inside a multi-line string; the delimiter that will close it. */
|
|
23
|
-
stringDelim: string | null;
|
|
24
|
-
}
|
|
25
|
-
/** One line of code → styled line + the carry for the next line. */
|
|
26
|
-
export type LineHighlighter = (line: string, lang: string | null, carry: HighlightCarry) => {
|
|
27
|
-
text: string;
|
|
28
|
-
carry: HighlightCarry;
|
|
29
|
-
};
|
|
30
|
-
/** Incremental highlighter for one streamed text segment. */
|
|
31
|
-
export interface StreamHighlighter {
|
|
32
|
-
/** Feed a delta; returns the styled text that is safe to emit now. */
|
|
33
|
-
push(delta: string): string;
|
|
34
|
-
/** Return whatever is still held (segment end); resets to prose state. */
|
|
35
|
-
flush(): string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Create the per-segment streaming highlighter. `highlightLine` is injectable
|
|
39
|
-
* for tests (e.g. to prove a throwing tokenizer degrades to plain text).
|
|
40
|
-
*/
|
|
41
|
-
export declare function createStreamHighlighter(theme: Theme, highlightLine?: LineHighlighter): StreamHighlighter;
|
|
42
|
-
/**
|
|
43
|
-
* Build the default per-line tokenizer over `c`. A plain left-to-right scan:
|
|
44
|
-
* comments dim, strings green, keywords magenta, numbers yellow, everything
|
|
45
|
-
* else untouched. Unknown language → identity.
|
|
46
|
-
*/
|
|
47
|
-
export declare function defaultLineHighlighter(theme: Theme): LineHighlighter;
|
package/dist/render/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { RenderStream, StreamRenderer } from "./types.js";
|
|
2
|
-
export type { ProgressState, RenderCapabilities, RenderPhase, RenderStream, StreamRenderer, TokenUsage, ToolLifecycleEvent, } from "./types.js";
|
|
3
|
-
export { detectCapabilities, detectReducedMotion, resolveColumns, DEFAULT_COLUMNS, } from "./capabilities.js";
|
|
4
|
-
export { attachResize, processResizeSignal, type ResizeSignal, } from "./resize.js";
|
|
5
|
-
export { fit, fitMiddle, reflow, stripAnsi, visibleWidth, kvStack, MIN_VALUE_COLS, type KvRow, } from "./layout.js";
|
|
6
|
-
export { composeStatusLine, describePhase, ELAPSED_AFTER_MS, fitStatusLine, formatElapsed, formatTokens, phaseIdentity, } from "./state.js";
|
|
7
|
-
export { createFrameClock, inTransition, intervalFrameTimer, spinnerGlyph, FRAME_INTERVAL_MS, TRANSITION_TICKS, type FrameClock, type FrameTimer, } from "./motion.js";
|
|
8
|
-
export { renderActionPreview, PREVIEW_MAX_LINES } from "./diff.js";
|
|
9
|
-
export { createStreamHighlighter, defaultLineHighlighter, type HighlightCarry, type LineHighlighter, type StreamHighlighter, } from "./highlight.js";
|
|
10
|
-
export { PlainRenderer } from "./plain-renderer.js";
|
|
11
|
-
export { ScreenReaderRenderer } from "./screen-reader-renderer.js";
|
|
12
|
-
export { TtyRenderer } from "./tty-renderer.js";
|
|
13
|
-
/**
|
|
14
|
-
* Build the renderer for the detected environment (U.11 adds the first branch):
|
|
15
|
-
* - `screenReader` → the linear, worded {@link ScreenReaderRenderer}, regardless
|
|
16
|
-
* of cursor support (a screen-reader TTY must not get the live region);
|
|
17
|
-
* - else cursor-safe → the managed-live-region {@link TtyRenderer} (static, no
|
|
18
|
-
* timer, when `reducedMotion`);
|
|
19
|
-
* - else → the append-only {@link PlainRenderer} (pipes, CI, `TERM=dumb`).
|
|
20
|
-
* Everything downstream talks to {@link StreamRenderer} and never re-probes.
|
|
21
|
-
*/
|
|
22
|
-
export declare function createRenderer(out?: RenderStream, err?: RenderStream, env?: NodeJS.ProcessEnv): StreamRenderer;
|
package/dist/render/layout.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { Theme } from "../theme/index.js";
|
|
2
|
-
/** The visible text of a possibly-styled string (SGR removed). */
|
|
3
|
-
export declare function stripAnsi(text: string): string;
|
|
4
|
-
/**
|
|
5
|
-
* Visible width in code points — the number a terminal cell count approximates.
|
|
6
|
-
* Counts by code point (via spread) so a surrogate-pair glyph is 1, not 2, and
|
|
7
|
-
* is never split. Wide (CJK/emoji) cells are counted as 1; full display-width
|
|
8
|
-
* accounting is deliberately out of scope (U.12), but code-point counting is
|
|
9
|
-
* already strictly more correct than the pre-U.12 `.length`.
|
|
10
|
-
*/
|
|
11
|
-
export declare function visibleWidth(text: string): number;
|
|
12
|
-
/**
|
|
13
|
-
* Truncate `text` to at most `width` visible columns, appending an honest
|
|
14
|
-
* ellipsis when anything was dropped. Text that already fits is returned
|
|
15
|
-
* UNCHANGED (style preserved). A truncated string is returned as plain text:
|
|
16
|
-
* dropping the style on the cut tail is the safe choice — re-styling a slice
|
|
17
|
-
* risks emitting a half of an escape pair.
|
|
18
|
-
*
|
|
19
|
-
* `width < 1` yields "". When `width` is smaller than the ellipsis itself
|
|
20
|
-
* (very-narrow), we show that many content characters rather than only dots —
|
|
21
|
-
* a single legible char beats a clipped "…".
|
|
22
|
-
*/
|
|
23
|
-
export declare function fit(text: string, width: number, ellipsis?: string): string;
|
|
24
|
-
/**
|
|
25
|
-
* Truncate the MIDDLE, preserving the head and tail. For a path or a search
|
|
26
|
-
* hit, the tail (basename, `:line`) carries as much identity as the head
|
|
27
|
-
* (root) — a right-truncation would hide the very thing that names it. Yields
|
|
28
|
-
* `src/very/deep/…/Component.tsx`. Falls back to {@link fit} when there is no
|
|
29
|
-
* room for both sides plus the ellipsis. Returns plain text when it truncates.
|
|
30
|
-
*/
|
|
31
|
-
export declare function fitMiddle(text: string, width: number, ellipsis?: string): string;
|
|
32
|
-
/**
|
|
33
|
-
* Word-wrap `text` to `width` visible columns, returning the wrapped lines.
|
|
34
|
-
* Wraps at spaces; a single token longer than `width` is hard-broken (its style
|
|
35
|
-
* is dropped on the break). Existing newlines are preserved as paragraph
|
|
36
|
-
* breaks. Use this — not {@link fit} — when meaning must survive in full (an
|
|
37
|
-
* approval command you must see whole), trading vertical space for completeness.
|
|
38
|
-
*/
|
|
39
|
-
export declare function reflow(text: string, width: number): string[];
|
|
40
|
-
/** A key/value pair for {@link kvStack}. */
|
|
41
|
-
export interface KvRow {
|
|
42
|
-
key: string;
|
|
43
|
-
value: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Minimum value columns an aligned two-column table needs before it collapses
|
|
47
|
-
* to a stack. Below this, the value column is too cramped to read, so stacking
|
|
48
|
-
* (key on its own line, value reflowed beneath) is the honest presentation.
|
|
49
|
-
*/
|
|
50
|
-
export declare const MIN_VALUE_COLS = 16;
|
|
51
|
-
/**
|
|
52
|
-
* The table→stack collapser (U.12). At a width that affords the widest key plus
|
|
53
|
-
* {@link MIN_VALUE_COLS}, render aligned `key value` rows (values truncated to
|
|
54
|
-
* the remaining columns). Too narrow for that, STACK each pair — a bold key
|
|
55
|
-
* line, then the value reflowed and indented — so a table never soft-wraps into
|
|
56
|
-
* a misaligned mess and never hides a value. One column budgeter for every kv
|
|
57
|
-
* caller.
|
|
58
|
-
*/
|
|
59
|
-
export declare function kvStack(rows: KvRow[], width: number, theme: Theme): string[];
|
package/dist/render/motion.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { ThemeGlyphs } from "../theme/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Motion (U.10) — one frame clock drives every live animation on the render
|
|
4
|
-
* seam, and a tiny set of pure frame→glyph/style primitives express it. The
|
|
5
|
-
* design is the same honest-signal discipline as U.4 state: motion encodes real
|
|
6
|
-
* state (work is progressing, the activity changed, a result landed) and never
|
|
7
|
-
* decorates. It is a cosmetic overlay on the transient live region (U.2) — never
|
|
8
|
-
* in the content path, never touching committed bytes.
|
|
9
|
-
*
|
|
10
|
-
* The single gate is `caps.spinner` (`cursor && !reducedMotion`, from U.11):
|
|
11
|
-
* when motion is reduced the clock is *disabled* — it schedules nothing and
|
|
12
|
-
* never ticks, so every motion collapses to its static end-state, drawn once.
|
|
13
|
-
* There is exactly one clock per renderer (refcounted like the U.12 resize
|
|
14
|
-
* signal), not a timer per surface.
|
|
15
|
-
*/
|
|
16
|
-
/** The one frame cadence: 10 fps, the pre-U.10 spinner interval. Bounded by construction. */
|
|
17
|
-
export declare const FRAME_INTERVAL_MS = 100;
|
|
18
|
-
/**
|
|
19
|
-
* How many frames a phase-transition emphasis lasts before it settles — ~300ms
|
|
20
|
-
* at {@link FRAME_INTERVAL_MS}. Long enough for the eye to catch "the activity
|
|
21
|
-
* changed", short enough to never read as decoration.
|
|
22
|
-
*/
|
|
23
|
-
export declare const TRANSITION_TICKS = 3;
|
|
24
|
-
/** Schedule/cancel a repeating tick; injectable so tests drive frames deterministically. */
|
|
25
|
-
export interface FrameTimer {
|
|
26
|
-
schedule(callback: () => void, intervalMs: number): {
|
|
27
|
-
unref?: () => void;
|
|
28
|
-
};
|
|
29
|
-
cancel(handle: {
|
|
30
|
-
unref?: () => void;
|
|
31
|
-
}): void;
|
|
32
|
-
}
|
|
33
|
-
/** The real timer: a single unref'd interval that never holds the process open. */
|
|
34
|
-
export declare const intervalFrameTimer: FrameTimer;
|
|
35
|
-
/**
|
|
36
|
-
* The one clock that drives all live animation. Subscribers get a monotonic
|
|
37
|
-
* frame number on each tick; the underlying timer runs ONLY while at least one
|
|
38
|
-
* subscriber is attached (refcounted), and is torn down on the last unsubscribe
|
|
39
|
-
* — the same discipline that keeps the U.12 resize listener from leaking.
|
|
40
|
-
*/
|
|
41
|
-
export interface FrameClock {
|
|
42
|
-
/**
|
|
43
|
-
* Attach a per-frame callback. The first subscriber starts the single timer;
|
|
44
|
-
* the returned function detaches and, when it was the last subscriber, stops
|
|
45
|
-
* the timer. A no-op subscription (returns a no-op unsubscribe) when the clock
|
|
46
|
-
* is disabled — reduced motion never schedules anything.
|
|
47
|
-
*/
|
|
48
|
-
subscribe(onFrame: (frame: number) => void): () => void;
|
|
49
|
-
/** The current monotonic frame counter. Stays 0 while disabled (no ticks). */
|
|
50
|
-
readonly frame: number;
|
|
51
|
-
/** Whether motion runs at all — false under reduced motion (`caps.spinner`). */
|
|
52
|
-
readonly enabled: boolean;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Build the frame clock. `enabled` is `caps.spinner`: when false the clock is
|
|
56
|
-
* inert — {@link FrameClock.subscribe} schedules nothing, never ticks, and
|
|
57
|
-
* `frame` never advances, so callers draw their static end-state once and stop.
|
|
58
|
-
*/
|
|
59
|
-
export declare function createFrameClock(enabled: boolean, timer?: FrameTimer, intervalMs?: number): FrameClock;
|
|
60
|
-
/**
|
|
61
|
-
* The spinner glyph for a frame (U.10 progress motion): the animated braille
|
|
62
|
-
* (or single-column ASCII) cycle when the clock runs, the static marker
|
|
63
|
-
* otherwise. `animated=false` (reduced motion / no cursor) yields the static
|
|
64
|
-
* glyph with no reference to `frame` — the honest still form of "working".
|
|
65
|
-
*/
|
|
66
|
-
export declare function spinnerGlyph(frame: number, glyph: ThemeGlyphs, animated: boolean): string;
|
|
67
|
-
/**
|
|
68
|
-
* Whether a phase-transition emphasis is still playing (U.10): true for the
|
|
69
|
-
* first {@link TRANSITION_TICKS} frames after the phase *identity* changed. The
|
|
70
|
-
* caller records the frame the identity began on and passes it here; when the
|
|
71
|
-
* clock is not advancing (reduced motion), `startFrame === frame` forever, so
|
|
72
|
-
* this is briefly true only if drawn on the very first frame — the renderer
|
|
73
|
-
* gates the whole emphasis behind `clock.enabled`, so a static draw always uses
|
|
74
|
-
* the settled end-state.
|
|
75
|
-
*/
|
|
76
|
-
export declare function inTransition(frame: number, startFrame: number): boolean;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { ActionPreview } from "../tools/types.js";
|
|
2
|
-
import { type Theme } from "../theme/index.js";
|
|
3
|
-
import type { ProgressState, RenderCapabilities, RenderPhase, RenderStream, StreamRenderer, ToolLifecycleEvent } from "./types.js";
|
|
4
|
-
/**
|
|
5
|
-
* The append-only renderer for pipes, CI, and cursor-less terminals. Emits no
|
|
6
|
-
* cursor-control sequences ever, and no color unless the capabilities say so
|
|
7
|
-
* (FORCE_COLOR); with color off, not a single ANSI byte leaves this class.
|
|
8
|
-
*
|
|
9
|
-
* Assistant text goes to `out` verbatim (beyond the per-turn leading-newline
|
|
10
|
-
* trim) so piped stdout stays pure model output; chrome (`note`) goes to `err`,
|
|
11
|
-
* matching the logger's stdout/stderr split. Transient `status` has no meaning
|
|
12
|
-
* in an append-only medium and is dropped — the loop reports anything durable
|
|
13
|
-
* via `note`.
|
|
14
|
-
*/
|
|
15
|
-
export declare class PlainRenderer implements StreamRenderer {
|
|
16
|
-
readonly caps: RenderCapabilities;
|
|
17
|
-
private readonly out;
|
|
18
|
-
private readonly err;
|
|
19
|
-
readonly theme: Theme;
|
|
20
|
-
/** Per-turn leading-newline trim; also tells endSegment whether to newline. */
|
|
21
|
-
private print;
|
|
22
|
-
private wroteInSegment;
|
|
23
|
-
/** In-flight tool call (serial by contract) for the end-note duration. */
|
|
24
|
-
private toolStart;
|
|
25
|
-
constructor(caps: RenderCapabilities, out: RenderStream, err: RenderStream);
|
|
26
|
-
private newPrinter;
|
|
27
|
-
beginTurn(): void;
|
|
28
|
-
write(delta: string): void;
|
|
29
|
-
endSegment(): void;
|
|
30
|
-
note(text: string): void;
|
|
31
|
-
preview(preview: ActionPreview): void;
|
|
32
|
-
status(): void;
|
|
33
|
-
setPhase(phase: RenderPhase | null): void;
|
|
34
|
-
progress(state: ProgressState | null): void;
|
|
35
|
-
toolLifecycle(event: ToolLifecycleEvent): void;
|
|
36
|
-
promptResolved(): void;
|
|
37
|
-
endTurn(): void;
|
|
38
|
-
close(): void;
|
|
39
|
-
}
|
package/dist/render/resize.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { RenderCapabilities, RenderStream } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Resize reactivity (U.12). Terminal width lives in exactly one place —
|
|
4
|
-
* {@link RenderCapabilities.width} — and this module is what keeps it current:
|
|
5
|
-
* it listens for the OS resize signal, recomputes the width through the same
|
|
6
|
-
* {@link resolveColumns} rule that seeded it, updates `caps.width` IN PLACE, and
|
|
7
|
-
* pushes the new width to subscribers (the live region / transient frames).
|
|
8
|
-
*
|
|
9
|
-
* Committed output is never re-rendered from here — only surfaces that own a
|
|
10
|
-
* redrawable region subscribe. Everything else simply reads the now-current
|
|
11
|
-
* `caps.width` the next time it emits.
|
|
12
|
-
*
|
|
13
|
-
* The OS signal is injectable ({@link ResizeSignal}) so tests drive resize
|
|
14
|
-
* deterministically without a real terminal or a real SIGWINCH.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* The OS resize signal, abstracted for testability. `on` registers a callback
|
|
18
|
-
* fired on each terminal resize and returns an unsubscribe function.
|
|
19
|
-
*/
|
|
20
|
-
export interface ResizeSignal {
|
|
21
|
-
on(listener: () => void): () => void;
|
|
22
|
-
}
|
|
23
|
-
/** The real signal: Node emits `SIGWINCH` on the process when a TTY resizes. */
|
|
24
|
-
export declare const processResizeSignal: ResizeSignal;
|
|
25
|
-
/**
|
|
26
|
-
* Wire resize reactivity onto `caps`: install {@link RenderCapabilities.onResize}
|
|
27
|
-
* and start listening for terminal resizes. One OS listener is shared across all
|
|
28
|
-
* subscribers and is removed once the last one unsubscribes (and re-added if a
|
|
29
|
-
* new subscriber arrives), so nothing is leaked and the process is never held
|
|
30
|
-
* open by a stray handler.
|
|
31
|
-
*
|
|
32
|
-
* A no-op for streams that cannot resize (non-TTY / no `columns`): `onResize`
|
|
33
|
-
* stays undefined and surfaces fall back to the static width. Idempotent —
|
|
34
|
-
* calling twice on the same caps keeps the first wiring.
|
|
35
|
-
*/
|
|
36
|
-
export declare function attachResize(caps: RenderCapabilities, stream?: RenderStream, env?: NodeJS.ProcessEnv, signal?: ResizeSignal): void;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { PlainRenderer } from "./plain-renderer.js";
|
|
2
|
-
import type { ProgressState, RenderCapabilities, RenderPhase, RenderStream, ToolLifecycleEvent } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* The screen-reader renderer (U.11): {@link PlainRenderer}'s linear,
|
|
5
|
-
* append-only, zero-cursor-control output — plus two things a screen reader
|
|
6
|
-
* needs that the plain path drops.
|
|
7
|
-
*
|
|
8
|
-
* 1. **Worded status.** Its theme resolves the {@link SCREEN_READER_GLYPHS}
|
|
9
|
-
* table (via `caps.screenReader`), so every inherited code path that writes
|
|
10
|
-
* `theme.glyph.success` prints `done` instead of `✓`, `failed` for `✗`, etc.
|
|
11
|
-
* Nothing here special-cases it — the glyph table does the work.
|
|
12
|
-
*
|
|
13
|
-
* 2. **Announced state.** A screen reader cannot see an in-place live region, so
|
|
14
|
-
* each state change is emitted as its own committed line (never a redraw):
|
|
15
|
-
* a phase becomes `working: read_file src/x.ts`, a tool run brackets as
|
|
16
|
-
* `working: …` → `done …`, and plan progress announces `step 2 of 5: title`.
|
|
17
|
-
* Announcements are deduped by phase *identity* so token-count updates within
|
|
18
|
-
* the same activity don't repeat a line.
|
|
19
|
-
*
|
|
20
|
-
* Everything else — text streaming, `endSegment`, `note`, `preview` — is
|
|
21
|
-
* inherited unchanged. This is the whole of screen-reader mode: no parallel
|
|
22
|
-
* path, no behavior change to the plain or TTY renderers.
|
|
23
|
-
*/
|
|
24
|
-
export declare class ScreenReaderRenderer extends PlainRenderer {
|
|
25
|
-
/** Identity of the last phase announced, so we speak each activity once. */
|
|
26
|
-
private lastPhaseId;
|
|
27
|
-
/** Text of the last progress line announced, to avoid repeats. */
|
|
28
|
-
private lastProgress;
|
|
29
|
-
constructor(caps: RenderCapabilities, out: RenderStream, err: RenderStream);
|
|
30
|
-
/**
|
|
31
|
-
* Announce a phase transition as a committed line. `null`, `awaiting-approval`
|
|
32
|
-
* (the prompt block is its own announcement), and `calling-tool` (announced by
|
|
33
|
-
* {@link toolLifecycle}) are silent; repeats of the same activity are deduped.
|
|
34
|
-
*/
|
|
35
|
-
setPhase(phase: RenderPhase | null): void;
|
|
36
|
-
/** Announce plan-step progress as `step i of n: title`, deduped. */
|
|
37
|
-
progress(state: ProgressState | null): void;
|
|
38
|
-
/**
|
|
39
|
-
* Bracket a tool call with two committed lines — `working: label` on start,
|
|
40
|
-
* `done/failed label` on end — so a screen-reader user hears both that a call
|
|
41
|
-
* began (crucial for long ones) and how it resolved. The end note + honest
|
|
42
|
-
* duration is the inherited plain behavior; only the start line is added.
|
|
43
|
-
*/
|
|
44
|
-
toolLifecycle(event: ToolLifecycleEvent): void;
|
|
45
|
-
}
|
package/dist/render/state.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type ThemeGlyphs } from "../theme/index.js";
|
|
2
|
-
import type { ProgressState, RenderPhase } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* The U.4 state→text mapping: pure data → string, like plan/render.ts and
|
|
5
|
-
* diff.ts, so both renderers (and tests) share one composition with no
|
|
6
|
-
* terminal in sight. Color is deliberately absent — the live line is drawn
|
|
7
|
-
* dim as a whole by the TTY renderer; state text is content, not chrome.
|
|
8
|
-
*
|
|
9
|
-
* Glyphs (ellipsis, token arrows, the ` · ` joiner) come from the theme (U.1);
|
|
10
|
-
* they default to the unicode table so colorless/test callers are unchanged,
|
|
11
|
-
* and the TTY renderer passes its capability-resolved set for ASCII fallback.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Threshold before elapsed time appears on a live state or a committed tool
|
|
15
|
-
* note. Below this, a timer is noise; above it, it's the answer to "is this
|
|
16
|
-
* stuck?".
|
|
17
|
-
*/
|
|
18
|
-
export declare const ELAPSED_AFTER_MS = 5000;
|
|
19
|
-
/** `342`, `1.2k`, `3.4M` — token counts at status-line width. */
|
|
20
|
-
export declare function formatTokens(n: number): string;
|
|
21
|
-
/** `37s`, `2m08s` — durations at status-line width. */
|
|
22
|
-
export declare function formatElapsed(ms: number): string;
|
|
23
|
-
/** The live-line text for a phase. `awaiting-approval` never renders (the line hides). */
|
|
24
|
-
export declare function describePhase(phase: RenderPhase, glyph?: ThemeGlyphs): string;
|
|
25
|
-
/**
|
|
26
|
-
* Identity key for the elapsed clock: the clock resets when the phase becomes
|
|
27
|
-
* a *different activity*, not on every payload update — a thinking phase that
|
|
28
|
-
* gains token counts keeps its start time; a new tool label starts fresh.
|
|
29
|
-
*/
|
|
30
|
-
export declare function phaseIdentity(phase: RenderPhase | null): string;
|
|
31
|
-
/**
|
|
32
|
-
* Compose the single live line: `[2/5] title · read_file src/x.ts… (12s)`.
|
|
33
|
-
* Elapsed appears only past {@link ELAPSED_AFTER_MS} — callers pass it only
|
|
34
|
-
* when they can keep it ticking honestly (no timer → no frozen number).
|
|
35
|
-
*/
|
|
36
|
-
export declare function composeStatusLine(progress: ProgressState | null, phase: RenderPhase | null, elapsedMs?: number, glyph?: ThemeGlyphs): string;
|
|
37
|
-
/**
|
|
38
|
-
* The width-aware live line (U.12): {@link composeStatusLine} with honest
|
|
39
|
-
* degradation tiers so the status line never soft-wraps and never loses its
|
|
40
|
-
* essential meaning — *what is happening*. Priority is phase (the action) >
|
|
41
|
-
* the `[i/n] title` progress prefix (context) > the elapsed clock (decor), so
|
|
42
|
-
* as width shrinks we shed decor first and identity last:
|
|
43
|
-
*
|
|
44
|
-
* - wide: `[2/5] title · read_file src/x.ts… (12s)`
|
|
45
|
-
* - medium: drop the elapsed clock
|
|
46
|
-
* - narrow: drop the `[i/n] title` prefix, keep the phase
|
|
47
|
-
* - very-narrow: {@link fit} the phase text with an honest ellipsis
|
|
48
|
-
*/
|
|
49
|
-
export declare function fitStatusLine(progress: ProgressState | null, phase: RenderPhase | null, elapsedMs: number | undefined, glyph: ThemeGlyphs, width: number): string;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type { ActionPreview } from "../tools/types.js";
|
|
2
|
-
import { type Theme } from "../theme/index.js";
|
|
3
|
-
import type { ProgressState, RenderCapabilities, RenderPhase, RenderStream, StreamRenderer, ToolLifecycleEvent } from "./types.js";
|
|
4
|
-
/**
|
|
5
|
-
* The interactive renderer: committed content is append-only; the one transient
|
|
6
|
-
* thing on screen is a single managed status line, redrawn in place.
|
|
7
|
-
*
|
|
8
|
-
* The no-flicker discipline, concretely:
|
|
9
|
-
* - Only the status line is ever rewritten, via `\r` + erase-line — never a
|
|
10
|
-
* screen clear, never a repaint of committed rows.
|
|
11
|
-
* - Every committed write first erases the status line, so the live region is
|
|
12
|
-
* always the last row and committed text can never interleave with it. A
|
|
13
|
-
* committed write *dismisses* the status (it does not redraw underneath), so
|
|
14
|
-
* nothing re-renders per delta while text streams.
|
|
15
|
-
* - The status text is hard-truncated to the terminal width: a soft-wrapped
|
|
16
|
-
* status would span two rows and erase-line could no longer clean it up.
|
|
17
|
-
*
|
|
18
|
-
* Fenced code blocks are highlighted incrementally (see highlight.ts): prose
|
|
19
|
-
* deltas pass straight through, code is styled line-by-line on arrival.
|
|
20
|
-
*
|
|
21
|
-
* U.4 layers semantic state onto the SAME single live line — no new screen
|
|
22
|
-
* real estate, no extra timers. Two registers compose into it:
|
|
23
|
-
* - `phase` (loop-owned; cleared by endTurn) — thinking / calling-tool / …
|
|
24
|
-
* - `progressState` (plan-executor-owned; cleared only via progress(null))
|
|
25
|
-
* A committed write still only *hides* the drawn line (registers survive);
|
|
26
|
-
* the next state transition redraws. Nothing redraws per streamed delta, so
|
|
27
|
-
* the U.2 first-chunk-immediate guarantee is untouched.
|
|
28
|
-
*
|
|
29
|
-
* U.10 puts every live animation on ONE frame clock (see motion.ts) instead of
|
|
30
|
-
* a private interval: the spinner glyph and the phase-transition emphasis draw
|
|
31
|
-
* off `clock.frame`, subscribed only while the line is visible and torn down on
|
|
32
|
-
* hide/close (no leaked timer). Reduced motion disables the clock — the line is
|
|
33
|
-
* drawn once in its static end-state. The result reveal is a one-time entrance
|
|
34
|
-
* emphasis on a committed tool note (never a redraw of committed bytes), so it
|
|
35
|
-
* needs no clock. Motion is a cosmetic overlay on the live region only; it never
|
|
36
|
-
* gates a committed write, so the latency guarantee holds with motion active.
|
|
37
|
-
*/
|
|
38
|
-
export declare class TtyRenderer implements StreamRenderer {
|
|
39
|
-
readonly caps: RenderCapabilities;
|
|
40
|
-
private readonly out;
|
|
41
|
-
readonly theme: Theme;
|
|
42
|
-
private print;
|
|
43
|
-
private highlighter;
|
|
44
|
-
private wroteInSegment;
|
|
45
|
-
/** Ad-hoc/legacy status text; wins over composed state when set. */
|
|
46
|
-
private rawStatus;
|
|
47
|
-
private phase;
|
|
48
|
-
private progressState;
|
|
49
|
-
/** When the current phase *identity* began — drives honest elapsed display. */
|
|
50
|
-
private phaseStartedAt;
|
|
51
|
-
/** In-flight tool call (serial by contract) for end-note duration. */
|
|
52
|
-
private toolStart;
|
|
53
|
-
/** Phase (+ its clock) displaced by an approval prompt, for promptResolved. */
|
|
54
|
-
private displaced;
|
|
55
|
-
/** Whether the live line is currently drawn on screen. */
|
|
56
|
-
private lineVisible;
|
|
57
|
-
/** The one frame clock driving live animation (U.10); disabled under reduced motion. */
|
|
58
|
-
private readonly clock;
|
|
59
|
-
/** Detach from the clock; null when the live line is hidden (no ticks wanted). */
|
|
60
|
-
private unsubscribeFrame;
|
|
61
|
-
/** Clock frame the current phase *identity* began on — drives the transition emphasis (U.10). */
|
|
62
|
-
private phaseStartFrame;
|
|
63
|
-
private closed;
|
|
64
|
-
/** Unsubscribe from the resize signal (U.12); null when the stream can't resize. */
|
|
65
|
-
private unsubscribeResize;
|
|
66
|
-
constructor(caps: RenderCapabilities, out: RenderStream);
|
|
67
|
-
/**
|
|
68
|
-
* Redraw the live line at the current `caps.width` after a resize. A no-op
|
|
69
|
-
* when nothing is drawn (so a resize between turns writes zero bytes) — the
|
|
70
|
-
* next state transition will draw at the new width anyway.
|
|
71
|
-
*/
|
|
72
|
-
private reflowLive;
|
|
73
|
-
private newPrinter;
|
|
74
|
-
/** Append committed content, erasing the status line first if one is live. */
|
|
75
|
-
private commit;
|
|
76
|
-
/**
|
|
77
|
-
* Erase the drawn live line and stop the spinner — WITHOUT clearing the
|
|
78
|
-
* state registers. Committed content takes the screen; the next state
|
|
79
|
-
* transition redraws with full context. (This is what keeps streaming
|
|
80
|
-
* zero-cost: no redraw-under per delta.)
|
|
81
|
-
*/
|
|
82
|
-
private hideLine;
|
|
83
|
-
/** Detach from the frame clock — the timer stops once this is the last subscriber. */
|
|
84
|
-
private stopFrames;
|
|
85
|
-
/**
|
|
86
|
-
* The current live-line text, composed from the registers. `null` means the
|
|
87
|
-
* line must be hidden: nothing to say, or an interactive prompt owns the
|
|
88
|
-
* terminal (`awaiting-approval` — two things can't share the last row).
|
|
89
|
-
*/
|
|
90
|
-
private currentLine;
|
|
91
|
-
/** Redraw the live line from current state, or hide it when there is none. */
|
|
92
|
-
private refresh;
|
|
93
|
-
private drawLine;
|
|
94
|
-
beginTurn(): void;
|
|
95
|
-
write(delta: string): void;
|
|
96
|
-
endSegment(): void;
|
|
97
|
-
note(text: string): void;
|
|
98
|
-
preview(preview: ActionPreview): void;
|
|
99
|
-
status(text: string | null): void;
|
|
100
|
-
setPhase(phase: RenderPhase | null): void;
|
|
101
|
-
progress(state: ProgressState | null): void;
|
|
102
|
-
toolLifecycle(event: ToolLifecycleEvent): void;
|
|
103
|
-
promptResolved(): void;
|
|
104
|
-
endTurn(): void;
|
|
105
|
-
close(): void;
|
|
106
|
-
}
|