@cjhyy/code-shell 0.1.7 → 0.3.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/CHANGELOG.md +108 -0
- package/README.md +35 -2
- package/dist/anthropic-DJXVKFMJ.js +1 -0
- package/dist/arena/index.js +1 -1
- package/dist/arena-MRBATZFD.js +3 -0
- package/dist/chunk-2OD6VR4N.js +2 -0
- package/dist/{chunk-RP26WO4R.js → chunk-5QIVXFCT.js} +1 -1
- package/dist/{chunk-NFH3UQ3E.js → chunk-AFMP73YP.js} +1 -1
- package/dist/{chunk-XDOWC7EG.js → chunk-D3TVASD2.js} +2 -2
- package/dist/chunk-DI26OUIU.js +2 -0
- package/dist/chunk-FZXY554D.js +2 -0
- package/dist/chunk-GGVAOPI7.js +1 -0
- package/dist/chunk-GKAQH2DG.js +2 -0
- package/dist/chunk-GYNO4R7R.js +2 -0
- package/dist/{chunk-Q4O2HGWS.js → chunk-K4HILJ6G.js} +3 -3
- package/dist/chunk-M7VU4YVY.js +49 -0
- package/dist/chunk-MLCTC53I.js +1 -0
- package/dist/{chunk-HIJ2XXGX.js → chunk-OWBYLMDD.js} +1 -1
- package/dist/chunk-SKIX2M5Z.js +4 -0
- package/dist/chunk-SV7H4FKT.js +3 -0
- package/dist/{chunk-Y2NS6HPO.js → chunk-WONQHE4P.js} +41 -41
- package/dist/{chunk-WOP6MJKW.js → chunk-X2S7ASQ2.js} +1 -1
- package/dist/chunk-Z5HKHAO7.js +336 -0
- package/dist/cli/commands/builtin/plugin-commands-registration.d.ts +12 -0
- package/dist/cli/commands/builtin/plugin-handler.d.ts +6 -0
- package/dist/cli/commands/registry.d.ts +9 -2
- package/dist/cli/main.js +140 -124
- package/dist/cli/onboarding.d.ts +7 -2
- package/dist/client-base-GSFXPP2Y.js +1 -0
- package/dist/compaction-L3Y6NG4N.js +1 -0
- package/dist/context/compaction.d.ts +2 -1
- package/dist/data/static-catalogs.d.ts +25 -0
- package/dist/devtools-FBX4HVVY.js +1 -0
- package/dist/engine/engine.d.ts +45 -0
- package/dist/engine/turn-loop.d.ts +45 -0
- package/dist/hooks/events.d.ts +84 -5
- package/dist/hooks/inject.d.ts +19 -0
- package/dist/hooks/shell-runner.d.ts +45 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/llm/api-key-sanitize.d.ts +22 -0
- package/dist/llm/capabilities/index.d.ts +20 -0
- package/dist/llm/capabilities/rules.d.ts +26 -0
- package/dist/llm/capabilities/types.d.ts +108 -0
- package/dist/llm/model-pool.d.ts +7 -0
- package/dist/llm/provider-catalog.d.ts +2 -0
- package/dist/llm/provider-kinds.d.ts +1 -1
- package/dist/llm/providers/openai.d.ts +45 -0
- package/dist/llm/retry.d.ts +12 -0
- package/dist/llm/stream-watchdog.d.ts +42 -0
- package/dist/llm/types.d.ts +8 -0
- package/dist/logging/logger.d.ts +24 -2
- package/dist/logging/session-recorder.d.ts +16 -3
- package/dist/manager-4XKLZHKE.js +1 -0
- package/dist/mcp-manager-3JGHEJO3.js +1 -0
- package/dist/model-fetcher-X5W5EASG.js +1 -0
- package/dist/openai-OQ6LLN5J.js +1 -0
- package/dist/{openrouter-models-AM6M52D6.js → openrouter-models-ZT4R2AE3.js} +1 -1
- package/dist/openrouter-sync-ARMVWY7S.js +1 -0
- package/dist/plugin-handler-GJISMH5Q.js +11 -0
- package/dist/plugins/gitOps.d.ts +23 -0
- package/dist/plugins/installedPlugins.d.ts +15 -0
- package/dist/plugins/knownMarketplaces.d.ts +10 -0
- package/dist/plugins/loadPluginHooks.d.ts +52 -0
- package/dist/plugins/marketplaceManager.d.ts +49 -0
- package/dist/plugins/parseMarketplaceInput.d.ts +16 -0
- package/dist/plugins/pluginCommandHook.d.ts +54 -0
- package/dist/plugins/pluginCommandsLoader.d.ts +25 -0
- package/dist/plugins/pluginInstaller.d.ts +36 -0
- package/dist/plugins/schemas.d.ts +9 -0
- package/dist/plugins/types.d.ts +73 -2
- package/dist/plugins/varRewrite.d.ts +42 -0
- package/dist/product/index.js +1 -1
- package/dist/protocol/client.d.ts +1 -1
- package/dist/protocol/helpers.d.ts +42 -0
- package/dist/render/clearTerminal.d.ts +9 -3
- package/dist/render/components/App.d.ts +1 -0
- package/dist/render/components/Static.d.ts +23 -0
- package/dist/render/devtools.d.ts +8 -4
- package/dist/render/dom.d.ts +2 -1
- package/dist/render/frame.d.ts +1 -0
- package/dist/render/index.d.ts +10 -0
- package/dist/render/ink.d.ts +24 -2
- package/dist/render/log-update.d.ts +12 -1
- package/dist/render/selection.d.ts +1 -1
- package/dist/run/index.js +1 -1
- package/dist/{seatbelt-WBYROQT6.js → seatbelt-L54CNI2Y.js} +5 -5
- package/dist/services/index.d.ts +1 -0
- package/dist/services/memory-orchestrator.d.ts +39 -0
- package/dist/settings/schema.d.ts +168 -21
- package/dist/skills/frontmatter.d.ts +13 -0
- package/dist/skills/index.d.ts +4 -4
- package/dist/skills/scanner.d.ts +11 -21
- package/dist/tool-summary-HJX6RHG4.js +2 -0
- package/dist/tool-system/builtin/agent-notifications.d.ts +55 -0
- package/dist/tool-system/builtin/agent-registry.d.ts +35 -4
- package/dist/tool-system/builtin/agent-transcript-translator.d.ts +22 -0
- package/dist/tool-system/builtin/skill-prompt.d.ts +7 -0
- package/dist/tool-system/builtin/skill.d.ts +3 -1
- package/dist/tool-system/context.d.ts +23 -0
- package/dist/tool-system/executor.d.ts +5 -1
- package/dist/tool-system/permission.d.ts +1 -1
- package/dist/tool-system/sandbox/index.d.ts +7 -0
- package/dist/tool-system/task-guard.d.ts +30 -0
- package/dist/types.d.ts +48 -0
- package/dist/ui/components/AgentBlock.d.ts +5 -2
- package/dist/ui/components/AgentDock.d.ts +36 -0
- package/dist/ui/components/CommandInput.d.ts +12 -1
- package/dist/ui/components/MessageRow.d.ts +54 -0
- package/dist/ui/components/SpinnerWithVerb.d.ts +7 -1
- package/dist/ui/components/StatusLine.d.ts +5 -1
- package/dist/ui/components/TextInput.d.ts +9 -1
- package/dist/ui/components/VirtualMessageList.d.ts +30 -11
- package/dist/ui/dev-seed.d.ts +1 -0
- package/dist/ui/fullscreen-mode.d.ts +9 -0
- package/dist/ui/hooks/useVirtualScroll.d.ts +101 -0
- package/dist/ui/perf-probes.d.ts +22 -0
- package/dist/ui/query-guard.d.ts +35 -0
- package/dist/ui/slice-anchor.d.ts +44 -0
- package/dist/ui/store.d.ts +26 -1
- package/package.json +5 -3
- package/dist/anthropic-UBSB5AQH.js +0 -1
- package/dist/arena-OW55ZCHT.js +0 -3
- package/dist/chunk-2NS3JMNK.js +0 -1
- package/dist/chunk-B7K2OWKC.js +0 -2
- package/dist/chunk-EWWK56K6.js +0 -2
- package/dist/chunk-KCXSARAA.js +0 -1
- package/dist/chunk-NMBYBGC7.js +0 -250
- package/dist/chunk-NVAZJ5XS.js +0 -2
- package/dist/chunk-PGANL6F2.js +0 -3
- package/dist/chunk-UDPUTFQT.js +0 -2
- package/dist/chunk-W47Z7MGS.js +0 -33
- package/dist/client-base-6ZZJJYDY.js +0 -1
- package/dist/compaction-ECVQVOCT.js +0 -1
- package/dist/devtools-SGDUOOM4.js +0 -1
- package/dist/manager-C3TDN6MS.js +0 -1
- package/dist/mcp-manager-OP4XYV53.js +0 -1
- package/dist/model-fetcher-BJ64META.js +0 -1
- package/dist/openai-KEWQ54TM.js +0 -1
- package/dist/openrouter-sync-5JNBL3Z6.js +0 -1
- package/dist/plugins/loader.d.ts +0 -72
- package/dist/skills/matcher.d.ts +0 -21
- package/dist/tool-summary-5UE62VU4.js +0 -2
- package/skills-builtin/codeshell-help.md +0 -135
package/dist/plugins/types.d.ts
CHANGED
|
@@ -1,4 +1,75 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Plugin type definitions.
|
|
2
|
+
* Plugin marketplace type definitions for codeshell. Schemas mirror Claude
|
|
3
|
+
* Code's plugin system (see claude-code-sourcemap/restored-src/src/utils/plugins/schemas.ts)
|
|
4
|
+
* at the MVP subset documented in
|
|
5
|
+
* docs/superpowers/specs/2026-05-19-plugin-marketplace-design.md.
|
|
3
6
|
*/
|
|
4
|
-
export type
|
|
7
|
+
export type MarketplaceSource = {
|
|
8
|
+
source: "github";
|
|
9
|
+
repo: string;
|
|
10
|
+
} | {
|
|
11
|
+
source: "git";
|
|
12
|
+
url: string;
|
|
13
|
+
};
|
|
14
|
+
export interface KnownMarketplace {
|
|
15
|
+
source: MarketplaceSource;
|
|
16
|
+
installLocation: string;
|
|
17
|
+
lastUpdated: string;
|
|
18
|
+
}
|
|
19
|
+
export type KnownMarketplaces = Record<string, KnownMarketplace>;
|
|
20
|
+
export type PluginEntrySource = string | {
|
|
21
|
+
source: "git";
|
|
22
|
+
url: string;
|
|
23
|
+
ref?: string;
|
|
24
|
+
sha?: string;
|
|
25
|
+
} | {
|
|
26
|
+
source: "github";
|
|
27
|
+
repo: string;
|
|
28
|
+
ref?: string;
|
|
29
|
+
sha?: string;
|
|
30
|
+
} | {
|
|
31
|
+
source: "git-subdir";
|
|
32
|
+
url: string;
|
|
33
|
+
path: string;
|
|
34
|
+
ref?: string;
|
|
35
|
+
sha?: string;
|
|
36
|
+
};
|
|
37
|
+
export interface PluginMarketplaceEntry {
|
|
38
|
+
name: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
author?: {
|
|
41
|
+
name: string;
|
|
42
|
+
email?: string;
|
|
43
|
+
};
|
|
44
|
+
category?: string;
|
|
45
|
+
source: PluginEntrySource;
|
|
46
|
+
homepage?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface PluginMarketplace {
|
|
49
|
+
name: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
owner: {
|
|
52
|
+
name: string;
|
|
53
|
+
email?: string;
|
|
54
|
+
};
|
|
55
|
+
plugins: PluginMarketplaceEntry[];
|
|
56
|
+
}
|
|
57
|
+
export interface PluginInstallEntry {
|
|
58
|
+
scope: "user";
|
|
59
|
+
installPath: string;
|
|
60
|
+
version: string;
|
|
61
|
+
installedAt: string;
|
|
62
|
+
lastUpdated: string;
|
|
63
|
+
gitCommitSha?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface InstalledPluginsV2 {
|
|
66
|
+
version: 2;
|
|
67
|
+
plugins: Record<string, PluginInstallEntry[]>;
|
|
68
|
+
}
|
|
69
|
+
export type ValidationResult<T> = {
|
|
70
|
+
ok: true;
|
|
71
|
+
value: T;
|
|
72
|
+
} | {
|
|
73
|
+
ok: false;
|
|
74
|
+
error: string;
|
|
75
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin variable rewriter.
|
|
3
|
+
*
|
|
4
|
+
* After a plugin is materialized into the cache dir, walk its files and
|
|
5
|
+
* rewrite every occurrence of `CLAUDE_PLUGIN_ROOT` to `CODESHELL_PLUGIN_ROOT`.
|
|
6
|
+
*
|
|
7
|
+
* Why: plugins authored against Claude Code's protocol embed
|
|
8
|
+
* `${CLAUDE_PLUGIN_ROOT}` in their hooks.json command strings and inside
|
|
9
|
+
* shell scripts. codeshell uses its own env var name (`CODESHELL_PLUGIN_ROOT`)
|
|
10
|
+
* to keep plugin-side host detection unambiguous — so we rewrite the file
|
|
11
|
+
* tree at install time once, instead of dual-setting env vars at every hook
|
|
12
|
+
* invocation (which would let plugins falsely conclude they're running on
|
|
13
|
+
* Claude Code and emit CC-specific output formats).
|
|
14
|
+
*
|
|
15
|
+
* The rewrite is whole-token (not regex with word boundaries — Node's
|
|
16
|
+
* `String.replaceAll` on a literal substring is sufficient because no
|
|
17
|
+
* substring of the source contains the target as a prefix/suffix of another
|
|
18
|
+
* identifier in any plugin we've seen). If a plugin author chose
|
|
19
|
+
* `CLAUDE_PLUGIN_ROOT_SUFFIX` as an identifier this would also get rewritten,
|
|
20
|
+
* but that case is implausible enough we accept the risk over more complex
|
|
21
|
+
* tokenization.
|
|
22
|
+
*
|
|
23
|
+
* Binary files are skipped via NUL-byte heuristic on first 8 KiB.
|
|
24
|
+
*
|
|
25
|
+
* A breadcrumb file (`.code-shell-installed.json`) records the rewrite so
|
|
26
|
+
* a user debugging "why does this file differ from upstream?" has an
|
|
27
|
+
* explanation in-place.
|
|
28
|
+
*/
|
|
29
|
+
export interface RewriteSummary {
|
|
30
|
+
filesScanned: number;
|
|
31
|
+
filesRewritten: number;
|
|
32
|
+
rewrittenPaths: string[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Rewrite every `CLAUDE_PLUGIN_ROOT` → `CODESHELL_PLUGIN_ROOT` under
|
|
36
|
+
* `installPath`, then drop a breadcrumb file at the root.
|
|
37
|
+
*
|
|
38
|
+
* Idempotent: re-running on an already-rewritten tree is a no-op for the
|
|
39
|
+
* rewrite (no `CLAUDE_PLUGIN_ROOT` left) but refreshes the breadcrumb's
|
|
40
|
+
* timestamp so the user can see when the most recent install/update ran.
|
|
41
|
+
*/
|
|
42
|
+
export declare function rewritePluginVars(installPath: string): RewriteSummary;
|
package/dist/product/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as defineProduct}from'../chunk-
|
|
1
|
+
export{a as defineProduct}from'../chunk-GGVAOPI7.js';import'../chunk-Z5HKHAO7.js';import'../chunk-SKIX2M5Z.js';import'../chunk-MLCTC53I.js';import'../chunk-WI6FSWGU.js';import'../chunk-P6JSTIFM.js';import'../chunk-SNFAPSLA.js';import'../chunk-D3TVASD2.js';import'../chunk-FZXY554D.js';import'../chunk-M7VU4YVY.js';import'../chunk-T222K6IV.js';import'../chunk-QTWU7UNA.js';import'../chunk-K4HILJ6G.js';import'../chunk-WONQHE4P.js';import'../chunk-GKAQH2DG.js';import'../chunk-FU7AHZNN.js';import'../chunk-DI26OUIU.js';import'../chunk-3QP5BQ3L.js';
|
|
@@ -45,7 +45,7 @@ export declare class AgentClient {
|
|
|
45
45
|
/**
|
|
46
46
|
* Query server state.
|
|
47
47
|
*/
|
|
48
|
-
query(type: QueryParams["type"],
|
|
48
|
+
query(type: QueryParams["type"], arg?: string | Record<string, unknown>, ...extra: unknown[]): Promise<QueryResult>;
|
|
49
49
|
/**
|
|
50
50
|
* Inject context into the session transcript without triggering a LLM turn.
|
|
51
51
|
* Used to make arena results, tool outputs, etc. visible to subsequent LLM calls.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for spinning up an in-process AgentServer + AgentClient pair.
|
|
3
|
+
*
|
|
4
|
+
* All internal codeshell paths that want to run an engine should go through
|
|
5
|
+
* the protocol layer (AgentServer wraps the engine, AgentClient is the
|
|
6
|
+
* consumer-facing handle). This helper exists so callers don't repeat the
|
|
7
|
+
* 6-line "create transport / new server / new client / wire onStream /
|
|
8
|
+
* try-finally close" boilerplate at every call site.
|
|
9
|
+
*
|
|
10
|
+
* Existing call sites that should use this:
|
|
11
|
+
* - src/cli/commands/run.ts (headless CLI)
|
|
12
|
+
* - src/run/EngineRunner.ts (RunManager)
|
|
13
|
+
*
|
|
14
|
+
* The REPL builds its own server+client because it needs the long-lived
|
|
15
|
+
* AgentClient instance to drive the React UI's lifecycle (subscribing to
|
|
16
|
+
* stream events, approval requests, status changes). One-shot callers want
|
|
17
|
+
* the simpler "give me a client, hand back close()" shape this helper
|
|
18
|
+
* provides.
|
|
19
|
+
*/
|
|
20
|
+
import type { Engine } from "../engine/engine.js";
|
|
21
|
+
import type { StreamCallback } from "../types.js";
|
|
22
|
+
import { AgentClient } from "./client.js";
|
|
23
|
+
export interface InProcessClientHandle {
|
|
24
|
+
/** The client; pass to `client.run(task, sessionId)` to execute. */
|
|
25
|
+
readonly client: AgentClient;
|
|
26
|
+
/**
|
|
27
|
+
* Tear down server + client + transports. Call from a `finally` block.
|
|
28
|
+
* Safe to call multiple times; subsequent calls are no-ops.
|
|
29
|
+
*/
|
|
30
|
+
close(): void;
|
|
31
|
+
}
|
|
32
|
+
export interface CreateInProcessClientOptions {
|
|
33
|
+
/** Stream callback to receive every event the server emits. */
|
|
34
|
+
onStream?: StreamCallback;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Wrap an Engine in an in-process AgentServer and return a client handle.
|
|
38
|
+
* The handle's `close()` tears the whole pair down in the correct order:
|
|
39
|
+
* client first (so its pending requests reject cleanly), then server (which
|
|
40
|
+
* aborts any active run and clears approval timers).
|
|
41
|
+
*/
|
|
42
|
+
export declare function createInProcessClient(engine: Engine, options?: CreateInProcessClientOptions): InProcessClientHandle;
|
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
* Detects modern terminals that support ESC[3J for clearing scrollback.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* Returns the ANSI escape sequence to clear the terminal
|
|
7
|
-
*
|
|
6
|
+
* Returns the ANSI escape sequence to clear the terminal.
|
|
7
|
+
*
|
|
8
|
+
* `preserveScrollback=true` omits ERASE_SCROLLBACK (CSI 3J) so the user's
|
|
9
|
+
* scrollback buffer (and scroll position) survives a mid-stream fullReset.
|
|
10
|
+
* Used by log-update when emitting a flicker reset in flow mode — alt-screen
|
|
11
|
+
* has no user-visible scrollback so the default (clear it) is fine there.
|
|
8
12
|
*/
|
|
9
|
-
export declare function getClearTerminalSequence(
|
|
13
|
+
export declare function getClearTerminalSequence(options?: {
|
|
14
|
+
preserveScrollback?: boolean;
|
|
15
|
+
}): string;
|
|
10
16
|
/**
|
|
11
17
|
* Clears the terminal screen. On supported terminals, also clears scrollback.
|
|
12
18
|
*/
|
|
@@ -15,6 +15,7 @@ type Props = {
|
|
|
15
15
|
readonly terminalRows: number;
|
|
16
16
|
readonly selection: SelectionState;
|
|
17
17
|
readonly onSelectionChange: () => void;
|
|
18
|
+
readonly onSelectionFinish: () => void;
|
|
18
19
|
readonly onClickAt: (col: number, row: number) => boolean;
|
|
19
20
|
readonly onHoverAt: (col: number, row: number) => void;
|
|
20
21
|
readonly getHyperlinkAt: (col: number, row: number) => string | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ReactNode, type ReactElement } from 'react';
|
|
2
|
+
import '../global.d.ts';
|
|
3
|
+
interface StaticProps<T> {
|
|
4
|
+
/** Stable array; only NEW items past the previously-emitted index get rendered. */
|
|
5
|
+
items: readonly T[];
|
|
6
|
+
/** Render fn — same shape as Array.prototype.map. */
|
|
7
|
+
children: (item: T, index: number) => ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Append-only output component. Each time `items` grows, the NEW items are
|
|
11
|
+
* rendered to ANSI and written directly to stdout. They are never touched by
|
|
12
|
+
* the diff engine again — they live permanently in the terminal scrollback.
|
|
13
|
+
*
|
|
14
|
+
* Shape matches ink's <Static>: https://github.com/vadimdemedes/ink#static
|
|
15
|
+
*
|
|
16
|
+
* Implementation: we use a custom host element 'ink-static' so ink.tsx can
|
|
17
|
+
* detect it in onRender. The pendingStaticElement prop carries the React
|
|
18
|
+
* subtree for the new items. ink.tsx renders that element via renderToScreen,
|
|
19
|
+
* converts to ANSI, writes to stdout, then the next render cycle sees
|
|
20
|
+
* emittedCount === items.length and passes null (nothing to flush).
|
|
21
|
+
*/
|
|
22
|
+
export declare function Static<T>({ items, children }: StaticProps<T>): ReactElement;
|
|
23
|
+
export {};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { FrameEvent } from "./frame.js";
|
|
2
|
+
type Mode = "off" | "summary" | "verbose";
|
|
3
|
+
export declare function recordFrame(event: FrameEvent): void;
|
|
4
|
+
export declare const renderDevtools: {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
mode: Mode;
|
|
7
|
+
recordFrame: typeof recordFrame;
|
|
8
|
+
};
|
|
5
9
|
export {};
|
package/dist/render/dom.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ type InkNode = {
|
|
|
7
7
|
style: Styles;
|
|
8
8
|
};
|
|
9
9
|
export type TextName = '#text';
|
|
10
|
-
export type ElementNames = 'ink-root' | 'ink-box' | 'ink-text' | 'ink-virtual-text' | 'ink-link' | 'ink-progress' | 'ink-raw-ansi';
|
|
10
|
+
export type ElementNames = 'ink-root' | 'ink-box' | 'ink-text' | 'ink-virtual-text' | 'ink-link' | 'ink-progress' | 'ink-raw-ansi' | 'ink-static';
|
|
11
11
|
export type NodeNames = ElementNames | TextName;
|
|
12
12
|
export type DOMElement = {
|
|
13
13
|
nodeName: ElementNames;
|
|
@@ -35,6 +35,7 @@ export type DOMElement = {
|
|
|
35
35
|
};
|
|
36
36
|
focusManager?: FocusManager;
|
|
37
37
|
debugOwnerChain?: string[];
|
|
38
|
+
pendingStaticElement?: any;
|
|
38
39
|
} & InkNode;
|
|
39
40
|
export type TextNode = {
|
|
40
41
|
nodeName: TextName;
|
package/dist/render/frame.d.ts
CHANGED
package/dist/render/index.d.ts
CHANGED
|
@@ -15,6 +15,16 @@ export declare function useStdout(): {
|
|
|
15
15
|
};
|
|
16
16
|
write: (data: string) => boolean;
|
|
17
17
|
};
|
|
18
|
+
export declare function forceRedraw(options?: {
|
|
19
|
+
stdout?: NodeJS.WriteStream;
|
|
20
|
+
clearScrollback?: boolean;
|
|
21
|
+
}): void;
|
|
18
22
|
export { default as ScrollBox, type ScrollBoxHandle, type ScrollBoxProps } from "./components/ScrollBox.js";
|
|
19
23
|
export { AlternateScreen } from "./components/AlternateScreen.js";
|
|
24
|
+
export { Ansi } from "./Ansi.js";
|
|
25
|
+
export { NoSelect } from "./components/NoSelect.js";
|
|
26
|
+
export { default as Button } from "./components/Button.js";
|
|
27
|
+
export { default as Link } from "./components/Link.js";
|
|
28
|
+
export { RawAnsi } from "./components/RawAnsi.js";
|
|
29
|
+
export { Static } from "./components/Static.js";
|
|
20
30
|
export { default as render, renderSync, createRoot, type RenderOptions, type Instance } from "./root.js";
|
package/dist/render/ink.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export default class Ink {
|
|
|
39
39
|
private backFrame;
|
|
40
40
|
private lastPoolResetTime;
|
|
41
41
|
private drainTimer;
|
|
42
|
+
private drainConsecutive;
|
|
43
|
+
private drainTrace;
|
|
42
44
|
private lastYogaCounters;
|
|
43
45
|
private altScreenParkPatch;
|
|
44
46
|
readonly selection: SelectionState;
|
|
@@ -78,6 +80,17 @@ export default class Ink {
|
|
|
78
80
|
* returns, fullscreen scroll is dead.
|
|
79
81
|
*/
|
|
80
82
|
exitAlternateScreen(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Walk the DOM tree looking for 'ink-static' nodes that have a pending
|
|
85
|
+
* React element to flush. For each such node, render the element via
|
|
86
|
+
* renderToScreen, convert the resulting Screen to an ANSI string, and
|
|
87
|
+
* write it directly to stdout. Children are then detached from the node
|
|
88
|
+
* so they don't appear in the next frame's cell buffer.
|
|
89
|
+
*
|
|
90
|
+
* Called at the start of onRender, before the main renderer runs, so the
|
|
91
|
+
* diff engine never sees the static content.
|
|
92
|
+
*/
|
|
93
|
+
private flushStaticNodes;
|
|
81
94
|
onRender(): void;
|
|
82
95
|
pause(): void;
|
|
83
96
|
resume(): void;
|
|
@@ -93,9 +106,17 @@ export default class Ink {
|
|
|
93
106
|
* The traditional readline ctrl+l — clears the visible screen and
|
|
94
107
|
* redraws the current content. Also the recovery path when the terminal
|
|
95
108
|
* was cleared externally (macOS Cmd+K) and Ink's diff engine thinks
|
|
96
|
-
* unchanged cells don't need repainting.
|
|
109
|
+
* unchanged cells don't need repainting.
|
|
110
|
+
*
|
|
111
|
+
* `clearScrollback`: also emit CSI 3J (ERASE_SCROLLBACK) so the terminal's
|
|
112
|
+
* native scrollback buffer is wiped. Use at view-boundary transitions
|
|
113
|
+
* where the previous frame's content is unrelated to the next (e.g.
|
|
114
|
+
* switching from a sub-agent transcript back to main). Default false —
|
|
115
|
+
* scrollback preservation matches readline ctrl+l semantics.
|
|
97
116
|
*/
|
|
98
|
-
forceRedraw(
|
|
117
|
+
forceRedraw(options?: {
|
|
118
|
+
clearScrollback?: boolean;
|
|
119
|
+
}): void;
|
|
99
120
|
/**
|
|
100
121
|
* Mark the previous frame as untrustworthy for blit, forcing the next
|
|
101
122
|
* render to do a full-damage diff instead of the per-node fast path.
|
|
@@ -265,6 +286,7 @@ export default class Ink {
|
|
|
265
286
|
*/
|
|
266
287
|
subscribeToSelectionChange(cb: () => void): () => void;
|
|
267
288
|
private notifySelectionChange;
|
|
289
|
+
private notifySelectionFinish;
|
|
268
290
|
/**
|
|
269
291
|
* Hit-test the rendered DOM tree at (col, row) and bubble a ClickEvent
|
|
270
292
|
* from the deepest hit node up through ancestors with onClick handlers.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Diff, Frame } from './frame.js';
|
|
2
|
-
import { type StylePool } from './screen.js';
|
|
2
|
+
import { type Screen, type StylePool } from './screen.js';
|
|
3
3
|
type Options = {
|
|
4
4
|
isTTY: boolean;
|
|
5
5
|
stylePool: StylePool;
|
|
@@ -14,4 +14,15 @@ export declare class LogUpdate {
|
|
|
14
14
|
private getRenderOpsForDone;
|
|
15
15
|
render(prev: Frame, next: Frame, altScreen?: boolean, decstbmSafe?: boolean): Diff;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Convert a Screen buffer to a plain ANSI string suitable for direct stdout
|
|
19
|
+
* write. Each row is rendered with style transitions and separated by \r\n.
|
|
20
|
+
* Trailing blank cells (spaces without background) are trimmed per row to
|
|
21
|
+
* avoid leaking background colors into the terminal's natural line length.
|
|
22
|
+
* Ends with a final style reset so the caller's terminal state is clean.
|
|
23
|
+
*
|
|
24
|
+
* Used by the <Static> flush path in ink.tsx to commit finalized items to
|
|
25
|
+
* terminal scrollback without going through the diff engine.
|
|
26
|
+
*/
|
|
27
|
+
export declare function screenToAnsi(screen: Screen, stylePool: StylePool): string;
|
|
17
28
|
export {};
|
|
@@ -130,7 +130,7 @@ export declare function moveFocus(s: SelectionState, col: number, row: number):
|
|
|
130
130
|
* with shiftSelectionForFollow's top-edge check, but bidirectional: keyboard
|
|
131
131
|
* scroll can jump either way.
|
|
132
132
|
*/
|
|
133
|
-
export declare function shiftSelection(s: SelectionState, dRow: number, minRow: number, maxRow: number, width: number): void;
|
|
133
|
+
export declare function shiftSelection(s: SelectionState, dRow: number, minRow: number, maxRow: number, width: number, clearOnFullOvershoot?: boolean): void;
|
|
134
134
|
/**
|
|
135
135
|
* Shift the anchor row by dRow, clamped to [minRow, maxRow]. Used during
|
|
136
136
|
* drag-to-scroll: when the ScrollBox scrolls by N rows, the content that
|
package/dist/run/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as createRunManager}from'../chunk-
|
|
1
|
+
export{a as createRunManager}from'../chunk-5QIVXFCT.js';export{Y as ArtifactTracker,X as CheckpointWriter,aa as CompositeEvaluator,fa as EngineRunner,T as FileRunStore,_ as Heartbeat,$ as NoopEvaluator,V as RunApprovalBackend,Z as RunLock,ga as RunManager,U as RunQueue,S as VALID_TRANSITIONS,W as createRunAskUserFn}from'../chunk-Z5HKHAO7.js';import'../chunk-SKIX2M5Z.js';import'../chunk-MLCTC53I.js';import'../chunk-WI6FSWGU.js';import'../chunk-P6JSTIFM.js';import'../chunk-SNFAPSLA.js';import'../chunk-D3TVASD2.js';import'../chunk-FZXY554D.js';import'../chunk-M7VU4YVY.js';import'../chunk-T222K6IV.js';import'../chunk-QTWU7UNA.js';import'../chunk-K4HILJ6G.js';import'../chunk-WONQHE4P.js';import'../chunk-GKAQH2DG.js';import'../chunk-FU7AHZNN.js';import'../chunk-DI26OUIU.js';import'../chunk-3QP5BQ3L.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {h,a}from'./chunk-3QP5BQ3L.js';import {mkdtempSync,writeFileSync}from'fs';import {tmpdir}from'os';import {join}from'path';h();function
|
|
2
|
-
[sandbox:seatbelt] A syscall was blocked by the sandbox. If this path should be writable or this network call legitimate, ask the user to update sandbox.writableRoots / sandbox.network in settings.json.`}}}a(
|
|
1
|
+
import {h,a}from'./chunk-3QP5BQ3L.js';import {mkdtempSync,writeFileSync,rmSync}from'fs';import {tmpdir}from'os';import {join}from'path';h();function y(e){return {name:"seatbelt",wrap(o,l){let n=b(e),t=mkdtempSync(join(tmpdir(),"codeshell-sandbox-")),a$1=join(t,"profile.sb");return writeFileSync(a$1,n,"utf-8"),{file:"/usr/bin/sandbox-exec",args:["-f",a$1,l.shell,"-c",o],cleanup:a(()=>{try{rmSync(t,{recursive:!0,force:!0});}catch{}},"cleanup")}},hintForBlockedOutput(o){if(/Operation not permitted|sandbox/.test(o))return `
|
|
2
|
+
[sandbox:seatbelt] A syscall was blocked by the sandbox. If this path should be writable or this network call legitimate, ask the user to update sandbox.writableRoots / sandbox.network in settings.json.`}}}a(y,"createSeatbeltBackend");function b(e){let o=e.writableRoots.map(t=>` (subpath ${d(t)})`).join(`
|
|
3
3
|
`),l=e.deniedReads.map(t=>` (subpath ${d(t)})`).join(`
|
|
4
|
-
`),
|
|
4
|
+
`),n=e.network==="deny"?"(deny network-outbound)":"(allow network*)";return `(version 1)
|
|
5
5
|
(deny default)
|
|
6
6
|
|
|
7
7
|
;; Process control
|
|
@@ -33,5 +33,5 @@ ${o})
|
|
|
33
33
|
(allow iokit-open)
|
|
34
34
|
|
|
35
35
|
;; Network
|
|
36
|
-
${
|
|
37
|
-
`}a(b,"buildProfile");function d(e){return `"${e.replace(/"/g,'\\"')}"`}a(d,"quote");export{
|
|
36
|
+
${n}
|
|
37
|
+
`}a(b,"buildProfile");function d(e){return `"${e.replace(/"/g,'\\"')}"`}a(d,"quote");export{y as createSeatbeltBackend};
|
package/dist/services/index.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export { diagnostics } from "./diagnostics.js";
|
|
|
8
8
|
export { buildExtractionPrompt, parseExtractionResponse, type ExtractedMemory, } from "./extract-memories.js";
|
|
9
9
|
export { shouldAutoDream, recordSession, recordDreamComplete, buildDreamPrompt, } from "./auto-dream.js";
|
|
10
10
|
export { saveSessionMemory, loadSessionMemory, listSessionMemories, searchSessionMemories, buildSessionMemoryPrompt, } from "./session-memory.js";
|
|
11
|
+
export { MemoryOrchestrator, type MemoryOrchestratorOptions, type MemoryOrchestratorResult, } from "./memory-orchestrator.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MemoryOrchestrator — ties extract-memories, session-memory, and auto-dream
|
|
3
|
+
* into a single end-of-session pipeline.
|
|
4
|
+
*
|
|
5
|
+
* Called by Engine.run() after the turn loop completes. Runs memory extraction
|
|
6
|
+
* and session summarisation via lightweight LLM calls, then conditionally
|
|
7
|
+
* triggers auto-dream consolidation. None of this blocks the Engine result.
|
|
8
|
+
*/
|
|
9
|
+
import { MemoryManager } from "../session/memory.js";
|
|
10
|
+
export interface MemoryOrchestratorOptions {
|
|
11
|
+
/** Lightweight LLM call — must be a non-streaming summarisation call. */
|
|
12
|
+
callLLM: (systemPrompt: string, userMsg: string) => Promise<string>;
|
|
13
|
+
/** Project root; when set, memories are scoped per-project. */
|
|
14
|
+
projectDir?: string;
|
|
15
|
+
/** Optional pre-constructed MemoryManager (avoids re-creating for every call). */
|
|
16
|
+
memoryManager?: MemoryManager;
|
|
17
|
+
}
|
|
18
|
+
export interface MemoryOrchestratorResult {
|
|
19
|
+
/** Number of new memory entries extracted and saved. */
|
|
20
|
+
extracted: number;
|
|
21
|
+
/** Whether the auto-dream consolidation was triggered. */
|
|
22
|
+
dreamTriggered: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare class MemoryOrchestrator {
|
|
25
|
+
private readonly options;
|
|
26
|
+
constructor(options: MemoryOrchestratorOptions);
|
|
27
|
+
/**
|
|
28
|
+
* Run the full end-of-session memory pipeline.
|
|
29
|
+
*
|
|
30
|
+
* 1. Extract durable memories from the transcript (extract-memories)
|
|
31
|
+
* 2. Summarise the session (session-memory)
|
|
32
|
+
* 3. Record a completed session for auto-dream tracking
|
|
33
|
+
* 4. Conditionally trigger auto-dream consolidation
|
|
34
|
+
*/
|
|
35
|
+
run(transcript: Array<{
|
|
36
|
+
role: string;
|
|
37
|
+
content: string;
|
|
38
|
+
}>, sessionId: string): Promise<MemoryOrchestratorResult>;
|
|
39
|
+
}
|