@cruxy/cli 1.0.3 → 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/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 -125
- 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 -53
- 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 -283
- 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
package/dist/memory/types.d.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Types for persistent memory (C.29). Everything here is **data**: a memory
|
|
4
|
-
* entry is validated (fail-loud, malformed excluded) and stored as structured
|
|
5
|
-
* JSON that is NEVER eval'd. Recalled entries are injected into the model's
|
|
6
|
-
* context as clearly-demarcated REFERENCE DATA (see `recall.ts`) — they are not
|
|
7
|
-
* instructions and can never grant authority: the U.3 approval gate is
|
|
8
|
-
* structural and does not read memory at all (proven in `recall.test.ts`).
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* What a memory entry records. A small, closed set — the enum is the extension
|
|
12
|
-
* point (out of scope: freeform blobs, which we deliberately reject).
|
|
13
|
-
* - `fact` — a durable fact about the user or project.
|
|
14
|
-
* - `decision` — a choice made and its rationale.
|
|
15
|
-
* - `preference` — how the user likes things done.
|
|
16
|
-
*/
|
|
17
|
-
export declare const MEMORY_KINDS: readonly ["fact", "decision", "preference"];
|
|
18
|
-
export type MemoryKind = (typeof MEMORY_KINDS)[number];
|
|
19
|
-
/**
|
|
20
|
-
* Where an entry lives. `user` (`~/.cruxy/memory`) is your own memory, authored
|
|
21
|
-
* on this machine → trusted. `project` (`<repo>/.cruxy/memory`) can arrive with
|
|
22
|
-
* a cloned repo (another author) → untrusted until explicitly trusted (see
|
|
23
|
-
* `trust.ts`). This is the supply-chain boundary.
|
|
24
|
-
*/
|
|
25
|
-
export declare const MEMORY_SCOPES: readonly ["user", "project"];
|
|
26
|
-
export type MemoryScope = (typeof MEMORY_SCOPES)[number];
|
|
27
|
-
/** Recall renders `user` first (trusted, cross-project), then `project`. */
|
|
28
|
-
export declare const MEMORY_SCOPE_ORDER: readonly MemoryScope[];
|
|
29
|
-
/** Hard cap on a single note's length — memory is for terse facts, not blobs;
|
|
30
|
-
* this also bounds the per-entry cost of the recall budget. */
|
|
31
|
-
export declare const MAX_CONTENT_CHARS = 2000;
|
|
32
|
-
/**
|
|
33
|
-
* Strict schema for one memory entry as persisted. `.strict()` rejects unknown
|
|
34
|
-
* keys so a malformed/foreign object is a loud validation error (excluded), not
|
|
35
|
-
* silently absorbed. Parsed with this on every load — the file is never trusted
|
|
36
|
-
* shape-wise just because it is JSON.
|
|
37
|
-
*/
|
|
38
|
-
export declare const MemoryEntrySchema: z.ZodObject<{
|
|
39
|
-
/** Stable unique id (crypto.randomUUID) — the handle for `forget`. */
|
|
40
|
-
id: z.ZodString;
|
|
41
|
-
kind: z.ZodEnum<["fact", "decision", "preference"]>;
|
|
42
|
-
/** The note. DATA, never instructions. Non-empty, length-capped. */
|
|
43
|
-
content: z.ZodString;
|
|
44
|
-
scope: z.ZodEnum<["user", "project"]>;
|
|
45
|
-
/** ISO 8601 timestamp the entry was recorded. */
|
|
46
|
-
createdAt: z.ZodString;
|
|
47
|
-
}, "strict", z.ZodTypeAny, {
|
|
48
|
-
kind: "fact" | "decision" | "preference";
|
|
49
|
-
id: string;
|
|
50
|
-
createdAt: string;
|
|
51
|
-
content: string;
|
|
52
|
-
scope: "project" | "user";
|
|
53
|
-
}, {
|
|
54
|
-
kind: "fact" | "decision" | "preference";
|
|
55
|
-
id: string;
|
|
56
|
-
createdAt: string;
|
|
57
|
-
content: string;
|
|
58
|
-
scope: "project" | "user";
|
|
59
|
-
}>;
|
|
60
|
-
export type MemoryEntry = z.infer<typeof MemoryEntrySchema>;
|
|
61
|
-
/** Current on-disk file version — lets a future migration detect old files. */
|
|
62
|
-
export declare const MEMORY_FILE_VERSION = 1;
|
|
63
|
-
/** The whole `entries.json` file shape (one file per scope). */
|
|
64
|
-
export declare const MemoryFileSchema: z.ZodObject<{
|
|
65
|
-
version: z.ZodDefault<z.ZodNumber>;
|
|
66
|
-
entries: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
67
|
-
}, "strict", z.ZodTypeAny, {
|
|
68
|
-
entries: unknown[];
|
|
69
|
-
version: number;
|
|
70
|
-
}, {
|
|
71
|
-
entries?: unknown[] | undefined;
|
|
72
|
-
version?: number | undefined;
|
|
73
|
-
}>;
|
|
74
|
-
/** Why an entry was rejected on load — surfaced, never silently dropped. */
|
|
75
|
-
export type MemoryLoadReason = "invalid" | "secret";
|
|
76
|
-
/** A rejected entry (malformed, or a detected secret), excluded from recall and
|
|
77
|
-
* from the writable set, and surfaced loudly. */
|
|
78
|
-
export interface MemoryLoadError {
|
|
79
|
-
scope: MemoryScope;
|
|
80
|
-
reason: MemoryLoadReason;
|
|
81
|
-
/** The offending entry's id when known (else a positional marker). */
|
|
82
|
-
id: string;
|
|
83
|
-
message: string;
|
|
84
|
-
}
|
|
85
|
-
/** The validated result of loading one scope's file: the good entries plus the
|
|
86
|
-
* excluded ones. A missing file is not an error — it yields an empty result. */
|
|
87
|
-
export interface MemoryLoad {
|
|
88
|
-
entries: MemoryEntry[];
|
|
89
|
-
errors: MemoryLoadError[];
|
|
90
|
-
}
|
|
91
|
-
/** One repo's recorded PROJECT-memory trust decision (persisted in
|
|
92
|
-
* `~/.cruxy/memory-trust.json`). The `fingerprint` binds trust to the exact
|
|
93
|
-
* project entries seen at trust time, so editing them re-gates (see `trust.ts`). */
|
|
94
|
-
export interface MemoryTrust {
|
|
95
|
-
/** Absolute project root. */
|
|
96
|
-
root: string;
|
|
97
|
-
/** sha256 of the canonicalized project entries (see `fingerprintMemory`). */
|
|
98
|
-
fingerprint: string;
|
|
99
|
-
/** ISO timestamp the decision was recorded. */
|
|
100
|
-
at: string;
|
|
101
|
-
}
|
package/dist/net/ip-guard.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The ONE owner of "is this IP allowed to be reached" (JC-A). The SSRF address
|
|
3
|
-
* math — parsing and range-classifying v4/v6 literals, including IPv4-mapped and
|
|
4
|
-
* alternate encodings — lives here and nowhere else. Both the web subsystem
|
|
5
|
-
* (`web/ssrf.ts`, C.20) and the network MCP transport (`mcp/http-transport.ts`,
|
|
6
|
-
* C.27b) consume it, so there is exactly one implementation of the range rules
|
|
7
|
-
* and one place to audit them.
|
|
8
|
-
*
|
|
9
|
-
* The two connection-facing helpers a caller needs are also here:
|
|
10
|
-
* - {@link assertAllPublic} — resolve a host and require EVERY address be public;
|
|
11
|
-
* - {@link pinnedLookup} — a `dns.lookup` shim that pins a connection to a set of
|
|
12
|
-
* already-validated addresses (defeats DNS rebinding). Each subsystem wraps it
|
|
13
|
-
* in its OWN undici `Agent` (the web one-shot fetch vs. MCP's long-lived
|
|
14
|
-
* POST + SSE shape differ), but the pinning logic is shared.
|
|
15
|
-
*/
|
|
16
|
-
/** Resolve a hostname to its IP addresses (injected so the guard is testable). */
|
|
17
|
-
export type HostResolver = (host: string) => Promise<string[]>;
|
|
18
|
-
/** Default resolver: node's `dns.lookup` returning ALL addresses. */
|
|
19
|
-
export declare const defaultResolveHost: HostResolver;
|
|
20
|
-
/** Thrown when a URL/host is refused pre-dispatch; carries a human reason. */
|
|
21
|
-
export declare class BlockedHostError extends Error {
|
|
22
|
-
}
|
|
23
|
-
/** Thrown when the host could not be resolved (a network failure, not a block). */
|
|
24
|
-
export declare class HostUnresolvedError extends Error {
|
|
25
|
-
}
|
|
26
|
-
/** True if an address (v4 or v6) is in a range that must never be reached. */
|
|
27
|
-
export declare function isBlockedAddress(addr: string): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* True if an address is a LOOPBACK address (127.0.0.0/8, ::1, or an IPv4-mapped
|
|
30
|
-
* loopback). This is the ONLY range the network MCP transport permits over plain
|
|
31
|
-
* `http` (loopback dev servers); everything else must be `https` to a public IP.
|
|
32
|
-
* An unparseable address is not loopback (fail closed — it won't get the http pass).
|
|
33
|
-
*/
|
|
34
|
-
export declare function isLoopbackAddress(addr: string): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Resolve `host` and require that EVERY resolved address is public — the SSRF
|
|
37
|
-
* gate for any URL a caller did not fully control. Throws {@link BlockedHostError}
|
|
38
|
-
* if any address is private/loopback/link-local/reserved (a security refusal), or
|
|
39
|
-
* {@link HostUnresolvedError} if the host cannot be resolved (a network failure).
|
|
40
|
-
* Returns the validated addresses so the caller can PIN the connection to them.
|
|
41
|
-
*/
|
|
42
|
-
export declare function assertAllPublic(host: string, resolve: HostResolver): Promise<string[]>;
|
|
43
|
-
/**
|
|
44
|
-
* A `dns.lookup`-compatible function that ignores the hostname and always hands
|
|
45
|
-
* back one of the pre-validated `addresses`. This is what pins a connection to the
|
|
46
|
-
* address the SSRF check already approved, defeating DNS rebinding: the socket can
|
|
47
|
-
* only reach a validated IP, never a value re-resolved at connect time. The Host
|
|
48
|
-
* header / TLS SNI still carry the original hostname (only the dialed IP is pinned).
|
|
49
|
-
*/
|
|
50
|
-
export declare function pinnedLookup(addresses: string[]): (_hostname: string, options: unknown, callback: (err: NodeJS.ErrnoException | null, address: string | {
|
|
51
|
-
address: string;
|
|
52
|
-
family: number;
|
|
53
|
-
}[], family?: number) => void) => void;
|
|
54
|
-
/** Sort + dedupe an address set so equality checks are order-insensitive. */
|
|
55
|
-
export declare function normalizeAddressSet(addresses: string[]): string[];
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { OnboardingState } from "./types.js";
|
|
2
|
-
/** `~/.cruxy/onboarding.json` */
|
|
3
|
-
export declare function onboardingStatePath(): string;
|
|
4
|
-
/** Read persisted onboarding state, or `null` if absent/unreadable. */
|
|
5
|
-
export declare function readOnboardingState(file?: string): OnboardingState | null;
|
|
6
|
-
/** Persist onboarding state (creates `~/.cruxy` if needed). */
|
|
7
|
-
export declare function writeOnboardingState(state: OnboardingState, file?: string): void;
|
|
8
|
-
/** A fresh state object. */
|
|
9
|
-
export declare function newOnboardingState(): OnboardingState;
|
|
10
|
-
/** Whether onboarding has been completed (the marker exists). */
|
|
11
|
-
export declare function onboardingCompleted(file?: string): boolean;
|
|
12
|
-
export interface FirstRunInput {
|
|
13
|
-
readonly provider: string;
|
|
14
|
-
/** Whether stdin is a TTY (the gate — non-TTY is never first-run). */
|
|
15
|
-
readonly interactive: boolean;
|
|
16
|
-
/** Override key resolution (tests); defaults to {@link resolveApiKey}. */
|
|
17
|
-
readonly resolveKey?: (provider: string) => string | undefined;
|
|
18
|
-
/** Override completion check (tests); defaults to {@link onboardingCompleted}. */
|
|
19
|
-
readonly completed?: () => boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* True iff we should launch the guided first-run flow: interactive **and** no
|
|
23
|
-
* resolvable key **and** no completion marker. Any one being false means we do
|
|
24
|
-
* not onboard (non-TTY fails loud elsewhere; a marker means "don't nag again").
|
|
25
|
-
*/
|
|
26
|
-
export declare function isFirstRun(input: FirstRunInput): boolean;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { CruxyConfig } from "../config/index.js";
|
|
2
|
-
import type { OnboardingDeps, OnboardingOptions, OnboardingResult, ValidationOutcome } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Orchestrate the onboarding steps (U.6) — resumable and idempotent. The key
|
|
5
|
-
* step is skipped when a key already resolves; the completion marker is written
|
|
6
|
-
* only once a key is in place. An abort during the (mandatory) key step returns
|
|
7
|
-
* `{ aborted: true }` and writes **no** marker, so it resumes next time.
|
|
8
|
-
*/
|
|
9
|
-
export declare function runOnboarding(opts: OnboardingOptions): Promise<OnboardingResult>;
|
|
10
|
-
/** Dependencies for the default (production) wiring. */
|
|
11
|
-
export interface DefaultDepsOptions {
|
|
12
|
-
config: CruxyConfig;
|
|
13
|
-
cwd: string;
|
|
14
|
-
/** Runs the first-win task; omit to disable that step. */
|
|
15
|
-
runTask?: (prompt: string) => Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Build the production {@link OnboardingDeps}: live gateway validation, the
|
|
19
|
-
* credentials store, real state persistence, and a wall-clock timestamp.
|
|
20
|
-
*/
|
|
21
|
-
export declare function createDefaultDeps(opts: DefaultDepsOptions): OnboardingDeps;
|
|
22
|
-
/**
|
|
23
|
-
* Validate a key with one cheap live call: start a 1-token stream and look at the
|
|
24
|
-
* first event. `AuthError` ⇒ invalid (bad key), `NetworkError` ⇒ unreachable;
|
|
25
|
-
* anything else (a token, rate-limit, transient API error) means the key was
|
|
26
|
-
* accepted, so ⇒ valid.
|
|
27
|
-
*/
|
|
28
|
-
export declare function validateKeyLive(provider: string, apiKey: string, config: CruxyConfig): Promise<ValidationOutcome>;
|
package/dist/onboarding/io.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { OnboardingIO } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* The real stdin/stderr-backed {@link OnboardingIO}. Prompts go to stderr (stdout
|
|
4
|
-
* stays clean for piping); the secret reader echoes `*` per keystroke and never
|
|
5
|
-
* the real character. Raw-mode key handling is the shared U.7 reader
|
|
6
|
-
* (`components/input.ts`) — the single owner of `setRawMode` — so cooked mode
|
|
7
|
-
* is restored on every exit path, Ctrl-C / EOF included.
|
|
8
|
-
*/
|
|
9
|
-
export declare function defaultOnboardingIO(color?: boolean): OnboardingIO;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { OnboardingDeps, OnboardingIO, StepResult } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Acquire and persist a provider key: print the create-key URL, read it masked,
|
|
4
|
-
* validate it live, and **only then** write it to the credentials store. Loops on
|
|
5
|
-
* a rejected key (up to 3 tries); a network failure or an empty entry stops.
|
|
6
|
-
*/
|
|
7
|
-
export declare function acquireKeyStep(io: OnboardingIO, deps: OnboardingDeps, provider: string): Promise<StepResult>;
|
|
8
|
-
/**
|
|
9
|
-
* Offer to scaffold a project `CRUXY.md`. Skipped silently when one already
|
|
10
|
-
* exists (or `AGENTS.md`); otherwise a `y` confirmation writes the template.
|
|
11
|
-
*/
|
|
12
|
-
export declare function scaffoldStep(io: OnboardingIO, cwd: string): Promise<StepResult>;
|
|
13
|
-
/**
|
|
14
|
-
* Offer the first-win demo run. Skipped when no runner is wired or the user
|
|
15
|
-
* declines; otherwise runs one real task so they see value immediately.
|
|
16
|
-
*/
|
|
17
|
-
export declare function firstWinStep(io: OnboardingIO, deps: OnboardingDeps): Promise<StepResult>;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types for the first-run onboarding flow (U.6). The flow is built from injected
|
|
3
|
-
* dependencies (validation, persistence, the first-win runner) so every step is
|
|
4
|
-
* unit-testable with scripted IO and no real network or filesystem.
|
|
5
|
-
*/
|
|
6
|
-
/** Outcome of validating a candidate key against the gateway. */
|
|
7
|
-
export type ValidationOutcome = "valid" | "invalid" | "unreachable";
|
|
8
|
-
/** Why a step ended. `aborted` is reserved for the mandatory key step. */
|
|
9
|
-
export type StepStatus = "ok" | "skipped" | "aborted" | "failed";
|
|
10
|
-
export interface StepResult {
|
|
11
|
-
readonly status: StepStatus;
|
|
12
|
-
/** The validated key, when a key step succeeds. */
|
|
13
|
-
readonly apiKey?: string;
|
|
14
|
-
/** A short human note (e.g. why a step failed) for the caller to surface. */
|
|
15
|
-
readonly message?: string;
|
|
16
|
-
}
|
|
17
|
-
/** Persisted onboarding state / completion marker (`~/.cruxy/onboarding.json`). */
|
|
18
|
-
export interface OnboardingState {
|
|
19
|
-
readonly version: number;
|
|
20
|
-
/** ISO timestamp; **its presence is the completion marker**. */
|
|
21
|
-
readonly completedAt?: string;
|
|
22
|
-
/** Whether a key has been successfully configured at least once. */
|
|
23
|
-
readonly keyConfigured?: boolean;
|
|
24
|
-
}
|
|
25
|
-
export interface OnboardingResult {
|
|
26
|
-
/** True once the flow ran to completion and wrote the marker. */
|
|
27
|
-
readonly completed: boolean;
|
|
28
|
-
/** True when the user aborted (Ctrl-C / EOF) before a key was saved. */
|
|
29
|
-
readonly aborted: boolean;
|
|
30
|
-
/** The key in effect after onboarding, if any. */
|
|
31
|
-
readonly apiKey?: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* IO surface for onboarding — a superset of the approval `PromptIO` with a
|
|
35
|
-
* **masked** `readSecret()`. Injectable so tests script keystrokes and capture
|
|
36
|
-
* every write (to assert the secret is never echoed).
|
|
37
|
-
*/
|
|
38
|
-
export interface OnboardingIO {
|
|
39
|
-
/** Emit prompt text (to stderr in the default impl). */
|
|
40
|
-
write(text: string): void;
|
|
41
|
-
/** Read one line in cooked mode; "" on EOF. */
|
|
42
|
-
readLine(): Promise<string>;
|
|
43
|
-
/** Read a single keypress (y/n prompts); "" on EOF / Ctrl-C. */
|
|
44
|
-
readKey(): Promise<string>;
|
|
45
|
-
/** Read a secret with no echo (each char shown as `*`); "" on Ctrl-C / EOF. */
|
|
46
|
-
readSecret(): Promise<string>;
|
|
47
|
-
/** Whether to emit ANSI color. */
|
|
48
|
-
color: boolean;
|
|
49
|
-
}
|
|
50
|
-
/** Injected dependencies — the seams for testing and for the default wiring. */
|
|
51
|
-
export interface OnboardingDeps {
|
|
52
|
-
/** Validate a candidate key with one cheap live call. */
|
|
53
|
-
validateKey(provider: string, apiKey: string): Promise<ValidationOutcome>;
|
|
54
|
-
/** Persist a validated key to the credentials store (`0600`). */
|
|
55
|
-
writeCredential(provider: string, key: string): void;
|
|
56
|
-
/** Resolve the currently effective key (env → store). */
|
|
57
|
-
resolveApiKey(provider: string): string | undefined;
|
|
58
|
-
/** Read persisted onboarding state, or `null`. */
|
|
59
|
-
readState(): OnboardingState | null;
|
|
60
|
-
/** Persist onboarding state. */
|
|
61
|
-
writeState(state: OnboardingState): void;
|
|
62
|
-
/** Run the first-win task; absent ⇒ the first-win step is skipped. */
|
|
63
|
-
runTask?: (prompt: string) => Promise<void>;
|
|
64
|
-
/** Project root (for the scaffold step). */
|
|
65
|
-
cwd: string;
|
|
66
|
-
/** ISO timestamp source (injectable for deterministic tests). */
|
|
67
|
-
now: () => string;
|
|
68
|
-
}
|
|
69
|
-
export type OnboardingMode = "first-run" | "login" | "init";
|
|
70
|
-
export interface OnboardingOptions {
|
|
71
|
-
readonly provider: string;
|
|
72
|
-
readonly mode: OnboardingMode;
|
|
73
|
-
/** Run the key step even if a key already resolves (re-key, `cruxy login`). */
|
|
74
|
-
readonly forceKey?: boolean;
|
|
75
|
-
/** Offer the first-win demo run (only when there's no real task queued). */
|
|
76
|
-
readonly offerFirstWin?: boolean;
|
|
77
|
-
/** Offer to scaffold a project `CRUXY.md` (init). */
|
|
78
|
-
readonly offerScaffold?: boolean;
|
|
79
|
-
readonly io: OnboardingIO;
|
|
80
|
-
readonly deps: OnboardingDeps;
|
|
81
|
-
}
|
package/dist/plan/approve.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { PromptIO } from "../approval/index.js";
|
|
2
|
-
import type { Plan, PlanDecision } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* The plan-approval prompt (C.31). Renders the plan and reads a single-key,
|
|
5
|
-
* 3-way decision, reusing the U.3 {@link PromptIO} (so it's testable with the
|
|
6
|
-
* same scripted-IO helper and honors NO_COLOR / non-TTY). The copy is explicit
|
|
7
|
-
* that "allow safe steps" never covers destructive or irreversible actions.
|
|
8
|
-
*
|
|
9
|
-
* Default-deny: EOF / Ctrl-C / any unrecognized key → `abort`.
|
|
10
|
-
*/
|
|
11
|
-
export declare function promptPlanDecision(plan: Plan, io: PromptIO): Promise<PlanDecision>;
|
|
12
|
-
/**
|
|
13
|
-
* After a failed step, ask whether to continue with the remaining steps or abort
|
|
14
|
-
* the run. Default-deny → abort (the safe choice: stop on failure).
|
|
15
|
-
*/
|
|
16
|
-
export declare function promptContinueAfterFailure(io: PromptIO): Promise<boolean>;
|
package/dist/plan/execute.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { PromptIO } from "../approval/index.js";
|
|
2
|
-
import type { StreamRenderer } from "../render/index.js";
|
|
3
|
-
import type { Plan, PlanExecutionResult, PlanStep } from "./types.js";
|
|
4
|
-
/**
|
|
5
|
-
* Execute an approved plan step-by-step (C.31): mark each step `running`, run it,
|
|
6
|
-
* mark `done` / `failed`, rendering live status. Fail-loud — a failed step
|
|
7
|
-
* **halts** by default (no silent skip); the user chooses continue or abort.
|
|
8
|
-
*
|
|
9
|
-
* The per-step runner is injected (`runStep`) so ordering, status, and
|
|
10
|
-
* halt-on-failure are testable without a real model. In production it drives one
|
|
11
|
-
* agent turn scoped to the step, with per-action U.3 gating still applying.
|
|
12
|
-
*/
|
|
13
|
-
export interface ExecuteDeps {
|
|
14
|
-
/**
|
|
15
|
-
* Run one step. Resolve normally on success; **throw** (ideally a
|
|
16
|
-
* {@link CruxyError}) to signal failure — that halts the run.
|
|
17
|
-
*/
|
|
18
|
-
runStep: (step: PlanStep) => Promise<void>;
|
|
19
|
-
io: PromptIO;
|
|
20
|
-
/**
|
|
21
|
-
* Live step progress (U.4): each step feeds `[i/n] title` to the renderer's
|
|
22
|
-
* progress register, straight from this walk of `plan.steps` — the same
|
|
23
|
-
* statuses the committed trail renders, never recomputed. Optional so the
|
|
24
|
-
* executor stays drivable without a terminal (tests, future CI mode).
|
|
25
|
-
*/
|
|
26
|
-
renderer?: StreamRenderer;
|
|
27
|
-
}
|
|
28
|
-
export declare function executePlan(plan: Plan, deps: ExecuteDeps): Promise<PlanExecutionResult>;
|
package/dist/plan/index.d.ts
DELETED
package/dist/plan/policy.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ApprovalDecision, ApprovalPolicy, ApprovalRequest, SessionAllowlist } from "../approval/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* The execution-phase approval policy for plan mode (C.31). It wraps the base
|
|
4
|
-
* (interactive) policy and adds exactly one behavior, gated behind the user's
|
|
5
|
-
* "approve + allow safe steps" choice: auto-allow **grantable mutate** actions
|
|
6
|
-
* for the rest of the run, recording the real scope in the shared
|
|
7
|
-
* {@link SessionAllowlist} so U.3's own scoping (`scopeCovers`) governs reuse.
|
|
8
|
-
*
|
|
9
|
-
* What it deliberately does NOT do — the two-tier boundary:
|
|
10
|
-
* • **destructive** actions always fall through to the base policy (prompt);
|
|
11
|
-
* • **ungrantable** actions (`scope:"none"`) always fall through (prompt),
|
|
12
|
-
* even if the tier is `mutate` — because `SessionAllowlist.grant` is a no-op
|
|
13
|
-
* on `none`, an ungrantable action can never be pre-approved.
|
|
14
|
-
*
|
|
15
|
-
* So approving a plan (even with "allow safe steps") never consents to a
|
|
16
|
-
* destructive or irreversible action; those re-confirm at execution time.
|
|
17
|
-
*/
|
|
18
|
-
export declare class PlanExecutionPolicy implements ApprovalPolicy {
|
|
19
|
-
private readonly allowlist;
|
|
20
|
-
private readonly base;
|
|
21
|
-
private safeStepGrants;
|
|
22
|
-
constructor(allowlist: SessionAllowlist, base: ApprovalPolicy);
|
|
23
|
-
/** Turn on auto-allow for safe (grantable mutate) steps — the `[g]` choice. */
|
|
24
|
-
enableSafeStepGrants(): void;
|
|
25
|
-
decide(request: ApprovalRequest): Promise<ApprovalDecision>;
|
|
26
|
-
}
|
package/dist/plan/render.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Plan, PlanStep } from "./types.js";
|
|
2
|
-
/** Render the whole plan as a block (header + one line per step + rationale). */
|
|
3
|
-
export declare function renderPlan(plan: Plan, color: boolean): string;
|
|
4
|
-
/** A one-line status update for a single step (used during execution). */
|
|
5
|
-
export declare function renderStepStatus(step: PlanStep, color: boolean): string;
|
package/dist/plan/service.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { Message, Provider, Usage } from "@cruxy/sdk";
|
|
2
|
-
import type { CruxyConfig } from "../config/index.js";
|
|
3
|
-
import type { PromptIO } from "../approval/index.js";
|
|
4
|
-
import { ToolRegistry, type ToolContext } from "../tools/index.js";
|
|
5
|
-
import { type AgentResult } from "../agent/loop.js";
|
|
6
|
-
import type { StreamRenderer } from "../render/index.js";
|
|
7
|
-
import type { Router } from "../routing/index.js";
|
|
8
|
-
import { PlanExecutionPolicy } from "./policy.js";
|
|
9
|
-
/**
|
|
10
|
-
* Orchestrates a plan-mode turn (C.31): propose → approve/revise (capped) →
|
|
11
|
-
* execute, all on the ordinary agent loop. The propose phase runs with a
|
|
12
|
-
* read-only + `submit_plan` registry so the agent cannot act before approval;
|
|
13
|
-
* execution runs with the full registry, one step at a time, per-action U.3
|
|
14
|
-
* gating intact.
|
|
15
|
-
*/
|
|
16
|
-
/** Default cap on plan revisions before failing loud. */
|
|
17
|
-
export declare const MAX_PLAN_REVISIONS = 3;
|
|
18
|
-
export interface PlanSessionArgs {
|
|
19
|
-
provider: Provider;
|
|
20
|
-
config: CruxyConfig;
|
|
21
|
-
ctx: ToolContext;
|
|
22
|
-
/** The full (execution-phase) tool registry. */
|
|
23
|
-
execRegistry: ToolRegistry;
|
|
24
|
-
/** The plan-mode approval policy (flipped on the `[g]` choice). */
|
|
25
|
-
planPolicy: PlanExecutionPolicy;
|
|
26
|
-
/** Prompt IO for plan approval + status (reuses U.3's PromptIO). */
|
|
27
|
-
io: PromptIO;
|
|
28
|
-
/** Whether we can actually prompt (a TTY). Non-interactive → fail loud. */
|
|
29
|
-
interactive: boolean;
|
|
30
|
-
/** The running conversation (with the user turn already appended). */
|
|
31
|
-
messages: Message[];
|
|
32
|
-
git?: {
|
|
33
|
-
branch: string;
|
|
34
|
-
dirty: boolean;
|
|
35
|
-
} | null;
|
|
36
|
-
projectInstructions?: string | null;
|
|
37
|
-
/** Persistent memory (C.29): recall block injected into the propose + execute
|
|
38
|
-
* phases' system prompts (reference data only). */
|
|
39
|
-
recalledMemory?: string | null;
|
|
40
|
-
renderer?: StreamRenderer;
|
|
41
|
-
/** Revision cap (defaults to {@link MAX_PLAN_REVISIONS}). */
|
|
42
|
-
maxRevisions?: number;
|
|
43
|
-
/**
|
|
44
|
-
* Multi-model routing (C.30). When set, the propose phase routes on `plan`
|
|
45
|
-
* and step execution on `main-turn`; omitted → the provider default.
|
|
46
|
-
*/
|
|
47
|
-
router?: Router;
|
|
48
|
-
/**
|
|
49
|
-
* Usage telemetry (C.22): forwarded to every model request the plan turn
|
|
50
|
-
* drives (propose + each execution step), so plan-mode usage is captured and
|
|
51
|
-
* tier-attributed exactly like a normal turn.
|
|
52
|
-
*/
|
|
53
|
-
onRequestUsage?: (req: {
|
|
54
|
-
tier?: string;
|
|
55
|
-
usage?: Usage;
|
|
56
|
-
}) => void;
|
|
57
|
-
}
|
|
58
|
-
export declare function runPlanSession(args: PlanSessionArgs): Promise<AgentResult>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { Tool } from "../tools/index.js";
|
|
3
|
-
import type { PlanHolder } from "./types.js";
|
|
4
|
-
declare const parameters: z.ZodObject<{
|
|
5
|
-
steps: z.ZodArray<z.ZodObject<{
|
|
6
|
-
title: z.ZodString;
|
|
7
|
-
rationale: z.ZodString;
|
|
8
|
-
kind: z.ZodEnum<["read", "mutate", "destructive"]>;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
kind: "read" | "mutate" | "destructive";
|
|
11
|
-
title: string;
|
|
12
|
-
rationale: string;
|
|
13
|
-
}, {
|
|
14
|
-
kind: "read" | "mutate" | "destructive";
|
|
15
|
-
title: string;
|
|
16
|
-
rationale: string;
|
|
17
|
-
}>, "many">;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
steps: {
|
|
20
|
-
kind: "read" | "mutate" | "destructive";
|
|
21
|
-
title: string;
|
|
22
|
-
rationale: string;
|
|
23
|
-
}[];
|
|
24
|
-
}, {
|
|
25
|
-
steps: {
|
|
26
|
-
kind: "read" | "mutate" | "destructive";
|
|
27
|
-
title: string;
|
|
28
|
-
rationale: string;
|
|
29
|
-
}[];
|
|
30
|
-
}>;
|
|
31
|
-
/** Build a `submit_plan` tool bound to `holder`, which captures the last plan. */
|
|
32
|
-
export declare function makeSubmitPlanTool(holder: PlanHolder): Tool<typeof parameters>;
|
|
33
|
-
export {};
|
package/dist/plan/types.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types for plan mode (C.31). A {@link Plan} is a first-class, typed artifact the
|
|
3
|
-
* agent produces via the `submit_plan` tool — never free text — so the user can
|
|
4
|
-
* review the shape of the work once, and execution can track per-step status.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* The agent's risk *estimate* for a step, used only to render intent and shape
|
|
8
|
-
* the approval copy. It is NOT authoritative: the real U.3 gate re-classifies
|
|
9
|
-
* every concrete action at execution time (a step the agent calls "mutate" whose
|
|
10
|
-
* action turns out destructive still confirms).
|
|
11
|
-
*/
|
|
12
|
-
export type PlanStepKind = "read" | "mutate" | "destructive";
|
|
13
|
-
/** Live execution status of a step. */
|
|
14
|
-
export type PlanStepStatus = "pending" | "running" | "done" | "failed";
|
|
15
|
-
export interface PlanStep {
|
|
16
|
-
/** Stable 1-based id assigned on submit (e.g. "1"). */
|
|
17
|
-
readonly id: string;
|
|
18
|
-
/** One-line imperative title. */
|
|
19
|
-
readonly title: string;
|
|
20
|
-
/** Why this step exists / what it accomplishes. */
|
|
21
|
-
readonly rationale: string;
|
|
22
|
-
/** The agent's risk estimate (advisory; see {@link PlanStepKind}). */
|
|
23
|
-
readonly kind: PlanStepKind;
|
|
24
|
-
/** Mutated in place as execution progresses. */
|
|
25
|
-
status: PlanStepStatus;
|
|
26
|
-
}
|
|
27
|
-
export interface Plan {
|
|
28
|
-
readonly steps: PlanStep[];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* The user's decision at the plan-approval prompt.
|
|
32
|
-
* - `approve` — execute; every action still hits the U.3 gate.
|
|
33
|
-
* - `approve-grant` — execute AND auto-allow the safe (read/mutate, grantable)
|
|
34
|
-
* steps for this run; destructive/ungrantable actions still confirm.
|
|
35
|
-
* - `revise` — send `feedback` back to the agent for a revised plan.
|
|
36
|
-
* - `abort` — cancel; nothing executes (also the default-deny for EOF/Ctrl-C).
|
|
37
|
-
*/
|
|
38
|
-
export type PlanDecision = {
|
|
39
|
-
readonly kind: "approve";
|
|
40
|
-
} | {
|
|
41
|
-
readonly kind: "approve-grant";
|
|
42
|
-
} | {
|
|
43
|
-
readonly kind: "revise";
|
|
44
|
-
readonly feedback: string;
|
|
45
|
-
} | {
|
|
46
|
-
readonly kind: "abort";
|
|
47
|
-
};
|
|
48
|
-
/** Outcome of executing an approved plan. */
|
|
49
|
-
export interface PlanExecutionResult {
|
|
50
|
-
/** True if every step reached `done`. */
|
|
51
|
-
readonly completed: boolean;
|
|
52
|
-
/** True if a step failed and the user chose to abort the run. */
|
|
53
|
-
readonly halted: boolean;
|
|
54
|
-
/** The id of the step that failed, when halted. */
|
|
55
|
-
readonly failedStepId?: string;
|
|
56
|
-
}
|
|
57
|
-
/** A mutable holder the `submit_plan` tool writes the captured plan into. */
|
|
58
|
-
export interface PlanHolder {
|
|
59
|
-
plan: Plan | null;
|
|
60
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { RenderCapabilities, RenderStream } from "./types.js";
|
|
2
|
-
/** Fallback width when the terminal reports none (non-TTY, pipe, unknown). */
|
|
3
|
-
export declare const DEFAULT_COLUMNS = 80;
|
|
4
|
-
/**
|
|
5
|
-
* Resolve the terminal width (U.12) — the single rule behind
|
|
6
|
-
* {@link RenderCapabilities.width} and every resize recompute. `COLUMNS` wins
|
|
7
|
-
* when set (honored so `COLUMNS=100 cruxy …` and CI overrides work), then the
|
|
8
|
-
* stream's own `columns`, then {@link DEFAULT_COLUMNS}. Never returns a
|
|
9
|
-
* non-positive width — an unknown terminal degrades to a sensible default, it
|
|
10
|
-
* does not crash a width calculation with 0.
|
|
11
|
-
*/
|
|
12
|
-
export declare function resolveColumns(stream?: RenderStream, env?: NodeJS.ProcessEnv): number;
|
|
13
|
-
/**
|
|
14
|
-
* Reduced-motion (U.11) — the ecosystem `NO_MOTION` signal, the explicit cruxy
|
|
15
|
-
* knob `CRUXY_REDUCED_MOTION`, and `CRUXY_NO_SPINNER` kept as an alias flowing
|
|
16
|
-
* through this one axis. A screen reader implies it (no live region to animate).
|
|
17
|
-
* The single source of the spinner gate.
|
|
18
|
-
*/
|
|
19
|
-
export declare function detectReducedMotion(env?: NodeJS.ProcessEnv): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Probe the environment once and reduce it to {@link RenderCapabilities}. Pure
|
|
22
|
-
* given its inputs (stream + env are injectable), so every row of the
|
|
23
|
-
* degradation matrix is directly testable.
|
|
24
|
-
*
|
|
25
|
-
* Color reuses {@link shouldUseColor} (NO_COLOR / FORCE_COLOR / TTY) with one
|
|
26
|
-
* refinement: `TERM=dumb` terminals get no color even though they are TTYs.
|
|
27
|
-
* The axes are independent (U.1/U.11): a NO_COLOR terminal still supports
|
|
28
|
-
* in-place status updates; a dumb terminal supports neither; reduced motion and
|
|
29
|
-
* screen-reader mode compose orthogonally with color and unicode.
|
|
30
|
-
*/
|
|
31
|
-
export declare function detectCapabilities(stream?: RenderStream, env?: NodeJS.ProcessEnv): RenderCapabilities;
|
package/dist/render/diff.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ActionPreview } from "../tools/types.js";
|
|
2
|
-
import type { Theme } from "../theme/index.js";
|
|
3
|
-
/**
|
|
4
|
-
* The one diff/action-preview renderer (U.2). The approval prompt, PR preview,
|
|
5
|
-
* and the streaming render path all draw diffs through here — there is no
|
|
6
|
-
* second implementation to drift. Pure data → string; color is sourced from
|
|
7
|
-
* the resolved {@link Theme} (U.1), so NO_COLOR/non-TTY callers get symbol-only
|
|
8
|
-
* `+`/`-` lines from the exact same code path. Diff add/remove intentionally
|
|
9
|
-
* reuse the `success`/`danger` hues (green/red), as before.
|
|
10
|
-
*/
|
|
11
|
-
/** Cap on rendered preview lines before collapsing the rest. */
|
|
12
|
-
export declare const PREVIEW_MAX_LINES = 40;
|
|
13
|
-
/**
|
|
14
|
-
* Render any {@link ActionPreview} as an indented block: a diff for edits and
|
|
15
|
-
* patches, a create/overwrite listing for writes, the publish plan for PRs.
|
|
16
|
-
* Long previews collapse past {@link PREVIEW_MAX_LINES}.
|
|
17
|
-
*/
|
|
18
|
-
export declare function renderActionPreview(preview: ActionPreview | undefined, c: Theme, width?: number): string;
|