@cjhyy/code-shell-core 0.6.0-rc.8 → 0.7.0-beta.1
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/THIRD_PARTY_NOTICES.md +206 -0
- package/dist/automation/scheduler.d.ts +13 -7
- package/dist/automation/scheduler.js +116 -37
- package/dist/capability-control/service.d.ts +2 -0
- package/dist/capability-control/service.js +4 -2
- package/dist/cc-orchestrator/agent-adapter.d.ts +2 -0
- package/dist/cc-orchestrator/agent-adapter.js +7 -1
- package/dist/cc-orchestrator/codex-session-history.js +1 -1
- package/dist/cc-orchestrator/cwd-normalize.d.ts +2 -0
- package/dist/cc-orchestrator/cwd-normalize.js +19 -0
- package/dist/cc-orchestrator/external-agent-bindings.d.ts +27 -0
- package/dist/cc-orchestrator/external-agent-bindings.js +150 -0
- package/dist/cc-orchestrator/external-agent-driver.d.ts +1 -0
- package/dist/cc-orchestrator/external-agent-driver.js +102 -51
- package/dist/cc-orchestrator/external-agent-session-store.d.ts +23 -0
- package/dist/cc-orchestrator/external-agent-session-store.js +146 -0
- package/dist/cc-orchestrator/session-history.js +2 -2
- package/dist/cli/agent-server-stdio.js +9 -2
- package/dist/context/compaction.d.ts +38 -1
- package/dist/context/compaction.js +138 -0
- package/dist/context/manager.d.ts +34 -2
- package/dist/context/manager.js +254 -58
- package/dist/context/token-counter.js +13 -0
- package/dist/credentials/access.d.ts +56 -0
- package/dist/credentials/access.js +183 -0
- package/dist/credentials/index.d.ts +1 -0
- package/dist/credentials/index.js +1 -0
- package/dist/credentials/inject-credential-tool.d.ts +3 -1
- package/dist/credentials/inject-credential-tool.js +30 -11
- package/dist/credentials/types.d.ts +2 -2
- package/dist/credentials/use-credential-tool.d.ts +9 -1
- package/dist/credentials/use-credential-tool.js +58 -45
- package/dist/engine/engine.d.ts +38 -12
- package/dist/engine/engine.js +477 -163
- package/dist/engine/image-policy.d.ts +6 -0
- package/dist/engine/image-policy.js +17 -6
- package/dist/engine/input-attachments.d.ts +13 -0
- package/dist/engine/input-attachments.js +255 -0
- package/dist/engine/model-facade.d.ts +5 -2
- package/dist/engine/model-facade.js +6 -16
- package/dist/engine/parse-task.d.ts +10 -0
- package/dist/engine/parse-task.js +5 -0
- package/dist/engine/query.js +2 -0
- package/dist/engine/session-usage.d.ts +12 -0
- package/dist/engine/session-usage.js +56 -0
- package/dist/engine/steer-queue.d.ts +2 -1
- package/dist/engine/steer-queue.js +2 -2
- package/dist/engine/streaming-tool-queue.d.ts +11 -7
- package/dist/engine/streaming-tool-queue.js +11 -7
- package/dist/engine/turn-loop.d.ts +34 -2
- package/dist/engine/turn-loop.js +269 -52
- package/dist/engine/types.d.ts +8 -0
- package/dist/git/worktree/crud.d.ts +69 -0
- package/dist/git/worktree/crud.js +206 -0
- package/dist/git/worktree/diff.d.ts +14 -0
- package/dist/git/worktree/diff.js +82 -0
- package/dist/git/worktree/git-exec.d.ts +7 -0
- package/dist/git/worktree/git-exec.js +51 -0
- package/dist/git/worktree/index.d.ts +5 -0
- package/dist/git/worktree/index.js +5 -0
- package/dist/git/worktree/query.d.ts +42 -0
- package/dist/git/worktree/query.js +121 -0
- package/dist/git/worktree/slug.d.ts +11 -0
- package/dist/git/worktree/slug.js +58 -0
- package/dist/git/worktree.d.ts +1 -84
- package/dist/git/worktree.js +5 -230
- package/dist/index.d.ts +31 -28
- package/dist/index.js +27 -25
- package/dist/logging/logger.js +6 -6
- package/dist/logging/sanitize-messages.d.ts +10 -2
- package/dist/logging/sanitize-messages.js +21 -6
- package/dist/plugins/installer/checkUpdate.d.ts +4 -1
- package/dist/plugins/installer/checkUpdate.js +4 -2
- package/dist/plugins/installer/install.js +2 -0
- package/dist/plugins/installer/installFromSource.js +9 -1
- package/dist/plugins/installer/parseSource.d.ts +4 -1
- package/dist/plugins/installer/parseSource.js +28 -10
- package/dist/plugins/installer/sourcePath.d.ts +9 -0
- package/dist/plugins/installer/sourcePath.js +50 -0
- package/dist/plugins/installer/update.d.ts +4 -1
- package/dist/plugins/installer/update.js +5 -3
- package/dist/plugins/parseMarketplaceInput.d.ts +4 -1
- package/dist/plugins/parseMarketplaceInput.js +4 -3
- package/dist/plugins/pluginInstaller.js +24 -22
- package/dist/preset/index.d.ts +1 -0
- package/dist/preset/index.js +16 -9
- package/dist/prompt/sections/base.md +1 -1
- package/dist/protocol/chat-session-manager.d.ts +2 -0
- package/dist/protocol/chat-session-manager.js +38 -2
- package/dist/protocol/chat-session.d.ts +5 -0
- package/dist/protocol/chat-session.js +2 -0
- package/dist/protocol/client.d.ts +13 -5
- package/dist/protocol/client.js +26 -3
- package/dist/protocol/server.d.ts +43 -12
- package/dist/protocol/server.js +326 -104
- package/dist/protocol/types.d.ts +51 -0
- package/dist/protocol/types.js +6 -0
- package/dist/run/FileRunStore.js +10 -1
- package/dist/run/Heartbeat.js +12 -0
- package/dist/run/RunApprovalBackend.d.ts +3 -0
- package/dist/run/RunApprovalBackend.js +41 -6
- package/dist/run/RunLock.js +2 -0
- package/dist/run/RunManager.d.ts +2 -0
- package/dist/run/RunManager.js +64 -24
- package/dist/run/ids.d.ts +2 -0
- package/dist/run/ids.js +23 -0
- package/dist/runtime/background-shell.d.ts +1 -0
- package/dist/runtime/background-shell.js +23 -13
- package/dist/runtime/safe-spawn.js +74 -11
- package/dist/runtime/spawn-common.js +10 -0
- package/dist/services/auto-dream.d.ts +15 -4
- package/dist/services/auto-dream.js +20 -20
- package/dist/services/dream-consolidation.d.ts +2 -3
- package/dist/services/dream-consolidation.js +65 -15
- package/dist/services/extract-memories.d.ts +14 -5
- package/dist/services/extract-memories.js +20 -3
- package/dist/services/global-dream-promotion.d.ts +23 -0
- package/dist/services/global-dream-promotion.js +112 -0
- package/dist/services/memory-orchestrator.js +347 -34
- package/dist/session/memory.d.ts +61 -18
- package/dist/session/memory.js +342 -79
- package/dist/session/session-manager.d.ts +35 -1
- package/dist/session/session-manager.js +197 -4
- package/dist/session/transcript.d.ts +5 -1
- package/dist/session/transcript.js +38 -5
- package/dist/settings/manager.d.ts +1 -0
- package/dist/settings/manager.js +87 -37
- package/dist/settings/schema-export.d.ts +2 -3
- package/dist/settings/schema-export.js +2 -3
- package/dist/settings/schema.d.ts +21 -0
- package/dist/settings/schema.js +12 -0
- package/dist/skills/scanner.d.ts +3 -2
- package/dist/skills/scanner.js +12 -9
- package/dist/tool-system/builtin/background-jobs.d.ts +10 -1
- package/dist/tool-system/builtin/background-jobs.js +12 -1
- package/dist/tool-system/builtin/background-work.d.ts +17 -18
- package/dist/tool-system/builtin/background-work.js +51 -5
- package/dist/tool-system/builtin/config.d.ts +2 -1
- package/dist/tool-system/builtin/config.js +16 -11
- package/dist/tool-system/builtin/drive-claude-code.d.ts +16 -2
- package/dist/tool-system/builtin/drive-claude-code.js +301 -47
- package/dist/tool-system/builtin/edit.js +5 -2
- package/dist/tool-system/builtin/generate-video.d.ts +1 -0
- package/dist/tool-system/builtin/generate-video.js +13 -4
- package/dist/tool-system/builtin/index.d.ts +8 -3
- package/dist/tool-system/builtin/index.js +37 -21
- package/dist/tool-system/builtin/lsp.d.ts +2 -1
- package/dist/tool-system/builtin/lsp.js +6 -3
- package/dist/tool-system/builtin/memory.js +40 -8
- package/dist/tool-system/builtin/notebook-edit.js +5 -2
- package/dist/tool-system/builtin/powershell.d.ts +5 -2
- package/dist/tool-system/builtin/powershell.js +11 -7
- package/dist/tool-system/builtin/read.js +118 -6
- package/dist/tool-system/builtin/view-image.d.ts +2 -2
- package/dist/tool-system/builtin/view-image.js +109 -19
- package/dist/tool-system/builtin/worktree.d.ts +4 -4
- package/dist/tool-system/builtin/worktree.js +297 -74
- package/dist/tool-system/builtin/write.js +5 -3
- package/dist/tool-system/context.d.ts +23 -1
- package/dist/tool-system/executor.d.ts +1 -5
- package/dist/tool-system/executor.js +94 -115
- package/dist/tool-system/mcp-manager.d.ts +18 -5
- package/dist/tool-system/mcp-manager.js +157 -74
- package/dist/tool-system/mcp-stdio-diagnostics.d.ts +9 -0
- package/dist/tool-system/mcp-stdio-diagnostics.js +93 -0
- package/dist/tool-system/path-policy.d.ts +2 -0
- package/dist/tool-system/path-policy.js +41 -12
- package/dist/tool-system/permission.d.ts +28 -7
- package/dist/tool-system/permission.js +130 -49
- package/dist/tool-system/registry.js +11 -4
- package/dist/tool-system/tool-result-redaction.d.ts +7 -0
- package/dist/tool-system/tool-result-redaction.js +48 -0
- package/dist/tool-system/workspace-bridge.d.ts +11 -0
- package/dist/tool-system/workspace-bridge.js +1 -0
- package/dist/types.d.ts +86 -5
- package/dist/utils/toolDisplay.js +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export const DEFAULT_WORKTREE_BRANCH_PREFIX = "worktree/";
|
|
2
|
+
export const HISTORICAL_WORKTREE_BRANCH_PREFIX = "worktree/";
|
|
3
|
+
/**
|
|
4
|
+
* Validate worktree slug to prevent path traversal attacks.
|
|
5
|
+
*/
|
|
6
|
+
export function validateWorktreeSlug(slug) {
|
|
7
|
+
if (slug.trim().length === 0)
|
|
8
|
+
throw new Error("Worktree slug cannot be empty");
|
|
9
|
+
if (slug.length > 64)
|
|
10
|
+
throw new Error("Worktree slug too long (max 64 chars)");
|
|
11
|
+
if (/[^a-zA-Z0-9._-]/.test(slug))
|
|
12
|
+
throw new Error("Worktree slug contains invalid characters");
|
|
13
|
+
if (slug.startsWith(".") || slug.includes(".."))
|
|
14
|
+
throw new Error("Worktree slug cannot start with '.' or contain '..'");
|
|
15
|
+
}
|
|
16
|
+
export function normalizeWorktreeBranchPrefix(prefix = DEFAULT_WORKTREE_BRANCH_PREFIX) {
|
|
17
|
+
const raw = (prefix ?? DEFAULT_WORKTREE_BRANCH_PREFIX).trim();
|
|
18
|
+
if (!isValidWorktreeBranchPrefix(raw)) {
|
|
19
|
+
throw new Error(`Invalid worktree branch prefix: ${prefix ?? ""}`);
|
|
20
|
+
}
|
|
21
|
+
return raw.endsWith("/") ? raw : `${raw}/`;
|
|
22
|
+
}
|
|
23
|
+
export function isValidWorktreeBranchPrefix(prefix) {
|
|
24
|
+
const raw = prefix.trim();
|
|
25
|
+
if (!raw)
|
|
26
|
+
return false;
|
|
27
|
+
if (raw.startsWith("/") || raw.includes("//"))
|
|
28
|
+
return false;
|
|
29
|
+
if (raw.includes("..") || raw.includes("@{"))
|
|
30
|
+
return false;
|
|
31
|
+
if (/[\x00-\x20~^:?*[\]\\]/.test(raw))
|
|
32
|
+
return false;
|
|
33
|
+
const withoutTrailingSlash = raw.endsWith("/") ? raw.slice(0, -1) : raw;
|
|
34
|
+
if (!withoutTrailingSlash)
|
|
35
|
+
return false;
|
|
36
|
+
return withoutTrailingSlash.split("/").every((part) => {
|
|
37
|
+
if (!part)
|
|
38
|
+
return false;
|
|
39
|
+
if (part.startsWith(".") || part.endsWith("."))
|
|
40
|
+
return false;
|
|
41
|
+
if (part.endsWith(".lock"))
|
|
42
|
+
return false;
|
|
43
|
+
return true;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export function applyPrefix(prefix, slug, sessionId) {
|
|
47
|
+
validateWorktreeSlug(slug);
|
|
48
|
+
return `${normalizeWorktreeBranchPrefix(prefix)}${slug}-${sessionId.slice(0, 8)}`;
|
|
49
|
+
}
|
|
50
|
+
export function managedBranchPrefixes(prefix) {
|
|
51
|
+
const configured = normalizeWorktreeBranchPrefix(prefix);
|
|
52
|
+
return configured === HISTORICAL_WORKTREE_BRANCH_PREFIX
|
|
53
|
+
? [configured]
|
|
54
|
+
: [configured, HISTORICAL_WORKTREE_BRANCH_PREFIX];
|
|
55
|
+
}
|
|
56
|
+
export function isManagedWorktreeBranch(branch, prefix) {
|
|
57
|
+
return managedBranchPrefixes(prefix).some((candidate) => branch.startsWith(candidate));
|
|
58
|
+
}
|
package/dist/git/worktree.d.ts
CHANGED
|
@@ -1,84 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Git worktree management — create/remove isolated worktrees for agents.
|
|
3
|
-
*/
|
|
4
|
-
import type { SandboxBackend } from "../tool-system/sandbox/index.js";
|
|
5
|
-
export interface WorktreeSession {
|
|
6
|
-
originalCwd: string;
|
|
7
|
-
worktreePath: string;
|
|
8
|
-
worktreeName: string;
|
|
9
|
-
worktreeBranch: string;
|
|
10
|
-
originalBranch?: string;
|
|
11
|
-
sessionId: string;
|
|
12
|
-
createdAt: number;
|
|
13
|
-
}
|
|
14
|
-
/** Per-platform setup/cleanup scripts (a project's localEnvironment). */
|
|
15
|
-
export interface PlatformScripts {
|
|
16
|
-
default?: string;
|
|
17
|
-
macos?: string;
|
|
18
|
-
linux?: string;
|
|
19
|
-
windows?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Pick the setup/cleanup script for the running platform, falling back to
|
|
23
|
-
* `default`. Empty/whitespace-only scripts are treated as absent so a project
|
|
24
|
-
* can leave a platform key blank without spawning an empty shell. `platform`
|
|
25
|
-
* defaults to `process.platform` so callers usually omit it; tests pass a
|
|
26
|
-
* fixed value.
|
|
27
|
-
*/
|
|
28
|
-
export declare function selectPlatformScript(scripts: PlatformScripts | undefined, platform?: NodeJS.Platform): string | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Validate worktree slug to prevent path traversal attacks.
|
|
31
|
-
*/
|
|
32
|
-
export declare function validateWorktreeSlug(slug: string): void;
|
|
33
|
-
/**
|
|
34
|
-
* Find the canonical git root (resolves worktree → main repo).
|
|
35
|
-
*/
|
|
36
|
-
export declare function findGitRoot(cwd: string): string;
|
|
37
|
-
/**
|
|
38
|
-
* Create an isolated git worktree for an agent session.
|
|
39
|
-
*/
|
|
40
|
-
export declare function createWorktree(cwd: string, slug: string, sessionId: string): WorktreeSession;
|
|
41
|
-
export interface WorktreeSetupResult {
|
|
42
|
-
/** True if no setup script was configured for this platform (nothing ran). */
|
|
43
|
-
skipped: boolean;
|
|
44
|
-
/** True if a script ran and exited 0. */
|
|
45
|
-
ok: boolean;
|
|
46
|
-
/** Combined stdout/stderr, for surfacing to the user on failure. */
|
|
47
|
-
output: string;
|
|
48
|
-
/** Exit code when a script ran; undefined when skipped. */
|
|
49
|
-
exitCode?: number | null;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Run a project's `localEnvironment.setupScripts` once, in the freshly-created
|
|
53
|
-
* worktree's root, right after `git worktree add`. This mirrors Codex's
|
|
54
|
-
* local-environment semantics: setup belongs to the *worktree* lifecycle, not
|
|
55
|
-
* the conversation — it runs when the isolated copy is born so e.g. `bun
|
|
56
|
-
* install` or `cp .env.example .env` happens before the agent works there.
|
|
57
|
-
*
|
|
58
|
-
* Failure is non-fatal by design (Beta decision 2026-06-08, "警告但继续"): a
|
|
59
|
-
* broken setup script shouldn't strand the agent outside a worktree it already
|
|
60
|
-
* created. The caller surfaces `output` as a warning and proceeds. cleanup
|
|
61
|
-
* scripts are intentionally NOT auto-run on exit (same decision).
|
|
62
|
-
*
|
|
63
|
-
* Reuses the same sandbox + env primitives as the Bash tool so the setup
|
|
64
|
-
* command sees the project's `localEnvironment.env` and runs under the same
|
|
65
|
-
* isolation the agent's later commands will.
|
|
66
|
-
*/
|
|
67
|
-
export declare function runWorktreeSetup(worktreePath: string, script: string | undefined, opts?: {
|
|
68
|
-
sandbox?: SandboxBackend;
|
|
69
|
-
shellEnv?: Record<string, string>;
|
|
70
|
-
timeoutMs?: number;
|
|
71
|
-
signal?: AbortSignal;
|
|
72
|
-
}): Promise<WorktreeSetupResult>;
|
|
73
|
-
/**
|
|
74
|
-
* Remove a worktree and optionally its branch.
|
|
75
|
-
*/
|
|
76
|
-
export declare function removeWorktree(worktreePath: string, removeBranch?: boolean): void;
|
|
77
|
-
/**
|
|
78
|
-
* List active worktrees.
|
|
79
|
-
*/
|
|
80
|
-
export declare function listWorktrees(cwd: string): Array<{
|
|
81
|
-
path: string;
|
|
82
|
-
branch: string;
|
|
83
|
-
head: string;
|
|
84
|
-
}>;
|
|
1
|
+
export * from "./worktree/index.js";
|
package/dist/git/worktree.js
CHANGED
|
@@ -1,230 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { join, resolve, dirname } from "node:path";
|
|
7
|
-
import { safeSpawnShell } from "../runtime/safe-spawn.js";
|
|
8
|
-
import { buildSandboxEnv, mergeShellEnv, defaultShellBinary } from "../runtime/spawn-common.js";
|
|
9
|
-
import { resolveExecutable } from "../utils/exec.js";
|
|
10
|
-
// git resolved via PATH×PATHEXT on Windows (.cmd/.exe shim); no-op on POSIX.
|
|
11
|
-
const GIT_BIN = resolveExecutable("git");
|
|
12
|
-
/**
|
|
13
|
-
* Pick the setup/cleanup script for the running platform, falling back to
|
|
14
|
-
* `default`. Empty/whitespace-only scripts are treated as absent so a project
|
|
15
|
-
* can leave a platform key blank without spawning an empty shell. `platform`
|
|
16
|
-
* defaults to `process.platform` so callers usually omit it; tests pass a
|
|
17
|
-
* fixed value.
|
|
18
|
-
*/
|
|
19
|
-
export function selectPlatformScript(scripts, platform = process.platform) {
|
|
20
|
-
if (!scripts)
|
|
21
|
-
return undefined;
|
|
22
|
-
const key = platform === "darwin" ? "macos" : platform === "win32" ? "windows" : "linux";
|
|
23
|
-
// A blank platform key shouldn't shadow a real `default` — fall through.
|
|
24
|
-
const platformScript = scripts[key]?.trim() ? scripts[key] : undefined;
|
|
25
|
-
const candidate = platformScript ?? scripts.default;
|
|
26
|
-
const trimmed = candidate?.trim();
|
|
27
|
-
return trimmed ? candidate : undefined;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Validate worktree slug to prevent path traversal attacks.
|
|
31
|
-
*/
|
|
32
|
-
export function validateWorktreeSlug(slug) {
|
|
33
|
-
if (slug.length > 64)
|
|
34
|
-
throw new Error("Worktree slug too long (max 64 chars)");
|
|
35
|
-
if (/[^a-zA-Z0-9._-]/.test(slug))
|
|
36
|
-
throw new Error("Worktree slug contains invalid characters");
|
|
37
|
-
if (slug.startsWith(".") || slug.includes(".."))
|
|
38
|
-
throw new Error("Worktree slug cannot start with '.' or contain '..'");
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Find the canonical git root (resolves worktree → main repo).
|
|
42
|
-
*/
|
|
43
|
-
export function findGitRoot(cwd) {
|
|
44
|
-
return execFileSync(GIT_BIN, ["rev-parse", "--show-toplevel"], { cwd, encoding: "utf-8", timeout: 5000 }).trim();
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Create an isolated git worktree for an agent session.
|
|
48
|
-
*/
|
|
49
|
-
export function createWorktree(cwd, slug, sessionId) {
|
|
50
|
-
validateWorktreeSlug(slug);
|
|
51
|
-
const gitRoot = findGitRoot(cwd);
|
|
52
|
-
const branchName = `worktree/${slug}-${sessionId.slice(0, 8)}`;
|
|
53
|
-
const worktreePath = resolve(gitRoot, "..", `.worktrees/${slug}-${sessionId.slice(0, 8)}`);
|
|
54
|
-
// Get current branch for later reference
|
|
55
|
-
let originalBranch;
|
|
56
|
-
try {
|
|
57
|
-
originalBranch = execFileSync(GIT_BIN, ["branch", "--show-current"], {
|
|
58
|
-
cwd: gitRoot,
|
|
59
|
-
encoding: "utf-8",
|
|
60
|
-
timeout: 5000,
|
|
61
|
-
}).trim();
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
// Detached HEAD
|
|
65
|
-
}
|
|
66
|
-
// Create the worktree. Pre-fix this used a quoted command string; the argv
|
|
67
|
-
// form keeps branchName/worktreePath as literal positional arguments even
|
|
68
|
-
// if a future caller bypasses validateWorktreeSlug.
|
|
69
|
-
execFileSync(GIT_BIN, ["worktree", "add", "-b", branchName, worktreePath], {
|
|
70
|
-
cwd: gitRoot,
|
|
71
|
-
timeout: 30000,
|
|
72
|
-
});
|
|
73
|
-
// Symlink large directories to avoid disk bloat
|
|
74
|
-
symlinkLargeDirectories(gitRoot, worktreePath);
|
|
75
|
-
return {
|
|
76
|
-
originalCwd: cwd,
|
|
77
|
-
worktreePath,
|
|
78
|
-
worktreeName: slug,
|
|
79
|
-
worktreeBranch: branchName,
|
|
80
|
-
originalBranch,
|
|
81
|
-
sessionId,
|
|
82
|
-
createdAt: Date.now(),
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Run a project's `localEnvironment.setupScripts` once, in the freshly-created
|
|
87
|
-
* worktree's root, right after `git worktree add`. This mirrors Codex's
|
|
88
|
-
* local-environment semantics: setup belongs to the *worktree* lifecycle, not
|
|
89
|
-
* the conversation — it runs when the isolated copy is born so e.g. `bun
|
|
90
|
-
* install` or `cp .env.example .env` happens before the agent works there.
|
|
91
|
-
*
|
|
92
|
-
* Failure is non-fatal by design (Beta decision 2026-06-08, "警告但继续"): a
|
|
93
|
-
* broken setup script shouldn't strand the agent outside a worktree it already
|
|
94
|
-
* created. The caller surfaces `output` as a warning and proceeds. cleanup
|
|
95
|
-
* scripts are intentionally NOT auto-run on exit (same decision).
|
|
96
|
-
*
|
|
97
|
-
* Reuses the same sandbox + env primitives as the Bash tool so the setup
|
|
98
|
-
* command sees the project's `localEnvironment.env` and runs under the same
|
|
99
|
-
* isolation the agent's later commands will.
|
|
100
|
-
*/
|
|
101
|
-
export async function runWorktreeSetup(worktreePath, script, opts = {}) {
|
|
102
|
-
const trimmed = script?.trim();
|
|
103
|
-
if (!trimmed)
|
|
104
|
-
return { skipped: true, ok: true, output: "" };
|
|
105
|
-
const shell = defaultShellBinary();
|
|
106
|
-
const backend = opts.sandbox;
|
|
107
|
-
const baseEnv = backend && backend.name !== "off" ? buildSandboxEnv() : { ...process.env };
|
|
108
|
-
const env = mergeShellEnv(baseEnv, opts.shellEnv);
|
|
109
|
-
const result = await safeSpawnShell(trimmed, {
|
|
110
|
-
cwd: worktreePath,
|
|
111
|
-
env,
|
|
112
|
-
timeoutMs: opts.timeoutMs ?? 120_000,
|
|
113
|
-
maxOutputBytes: 1024 * 1024,
|
|
114
|
-
sandbox: backend,
|
|
115
|
-
shell,
|
|
116
|
-
signal: opts.signal,
|
|
117
|
-
});
|
|
118
|
-
const parts = [];
|
|
119
|
-
if (result.stdout)
|
|
120
|
-
parts.push(result.stdout);
|
|
121
|
-
if (result.stderr)
|
|
122
|
-
parts.push(result.stderr);
|
|
123
|
-
const output = parts.join("\n").trim();
|
|
124
|
-
if (result.aborted)
|
|
125
|
-
return { skipped: false, ok: false, output: output || "setup aborted" };
|
|
126
|
-
if (result.timedOut)
|
|
127
|
-
return { skipped: false, ok: false, output: output || "setup timed out" };
|
|
128
|
-
if (result.spawnFailed) {
|
|
129
|
-
return { skipped: false, ok: false, output: result.error ?? "failed to spawn setup script" };
|
|
130
|
-
}
|
|
131
|
-
return { skipped: false, ok: result.exitCode === 0, output, exitCode: result.exitCode };
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Remove a worktree and optionally its branch.
|
|
135
|
-
*/
|
|
136
|
-
export function removeWorktree(worktreePath, removeBranch = false) {
|
|
137
|
-
try {
|
|
138
|
-
// The MAIN repo root, not the worktree's own toplevel. `git rev-parse
|
|
139
|
-
// --show-toplevel` from inside a worktree returns the worktree path, which
|
|
140
|
-
// is about to be deleted; the branch-delete must run from the main repo,
|
|
141
|
-
// which outlives the worktree. Derive it from the common git dir.
|
|
142
|
-
const commonDir = execFileSync(GIT_BIN, ["rev-parse", "--path-format=absolute", "--git-common-dir"], { cwd: worktreePath, encoding: "utf-8", timeout: 5000 }).trim();
|
|
143
|
-
const mainRoot = dirname(commonDir); // <main>/.git → <main>
|
|
144
|
-
// Capture the worktree's branch BEFORE removing the worktree — afterwards
|
|
145
|
-
// the directory is gone and `git branch --show-current` in it would fail
|
|
146
|
-
// (silently, leaving removeBranch a no-op).
|
|
147
|
-
let branch = "";
|
|
148
|
-
if (removeBranch) {
|
|
149
|
-
try {
|
|
150
|
-
branch = execFileSync(GIT_BIN, ["branch", "--show-current"], {
|
|
151
|
-
cwd: worktreePath,
|
|
152
|
-
encoding: "utf-8",
|
|
153
|
-
timeout: 5000,
|
|
154
|
-
}).trim();
|
|
155
|
-
}
|
|
156
|
-
catch {
|
|
157
|
-
// Detached HEAD or unreadable — nothing to delete.
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
execFileSync(GIT_BIN, ["worktree", "remove", worktreePath, "--force"], {
|
|
161
|
-
cwd: mainRoot,
|
|
162
|
-
timeout: 30000,
|
|
163
|
-
});
|
|
164
|
-
if (removeBranch && branch.startsWith("worktree/")) {
|
|
165
|
-
try {
|
|
166
|
-
execFileSync(GIT_BIN, ["branch", "-D", branch], { cwd: mainRoot, timeout: 10000 });
|
|
167
|
-
}
|
|
168
|
-
catch {
|
|
169
|
-
// Branch might already be removed.
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
catch {
|
|
174
|
-
// Worktree might already be removed
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* List active worktrees.
|
|
179
|
-
*/
|
|
180
|
-
export function listWorktrees(cwd) {
|
|
181
|
-
const raw = execFileSync(GIT_BIN, ["worktree", "list", "--porcelain"], {
|
|
182
|
-
cwd,
|
|
183
|
-
encoding: "utf-8",
|
|
184
|
-
timeout: 10000,
|
|
185
|
-
}).trim();
|
|
186
|
-
if (!raw)
|
|
187
|
-
return [];
|
|
188
|
-
const entries = [];
|
|
189
|
-
let current = { path: "", branch: "", head: "" };
|
|
190
|
-
for (const line of raw.split("\n")) {
|
|
191
|
-
if (line.startsWith("worktree ")) {
|
|
192
|
-
if (current.path)
|
|
193
|
-
entries.push(current);
|
|
194
|
-
current = { path: line.slice(9), branch: "", head: "" };
|
|
195
|
-
}
|
|
196
|
-
else if (line.startsWith("HEAD ")) {
|
|
197
|
-
current.head = line.slice(5, 13);
|
|
198
|
-
}
|
|
199
|
-
else if (line.startsWith("branch ")) {
|
|
200
|
-
current.branch = line.slice(7).replace("refs/heads/", "");
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
if (current.path)
|
|
204
|
-
entries.push(current);
|
|
205
|
-
return entries;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Symlink large directories (node_modules, .venv, etc.) from main repo to worktree.
|
|
209
|
-
*/
|
|
210
|
-
function symlinkLargeDirectories(sourceRoot, worktreePath) {
|
|
211
|
-
const largeDirs = ["node_modules", ".venv", "vendor", ".pnpm-store"];
|
|
212
|
-
// Windows directory symlinks need admin/Developer Mode and throw EPERM for a
|
|
213
|
-
// normal user; NTFS junctions don't and behave the same for our purpose
|
|
214
|
-
// (share node_modules into the worktree). Use "junction" on win32, "dir"
|
|
215
|
-
// elsewhere. Failure stays non-fatal — the worktree just doesn't share dirs.
|
|
216
|
-
const linkType = process.platform === "win32" ? "junction" : "dir";
|
|
217
|
-
for (const dir of largeDirs) {
|
|
218
|
-
const source = join(sourceRoot, dir);
|
|
219
|
-
const target = join(worktreePath, dir);
|
|
220
|
-
if (existsSync(source) && lstatSync(source).isDirectory() && !existsSync(target)) {
|
|
221
|
-
try {
|
|
222
|
-
symlinkSync(source, target, linkType);
|
|
223
|
-
}
|
|
224
|
-
catch {
|
|
225
|
-
// Symlink/junction might fail on some systems — non-fatal, the
|
|
226
|
-
// worktree just won't share this directory (more disk, still works).
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
1
|
+
// Compatibility barrel for the pre-split worktree module. The split made the
|
|
2
|
+
// query/create APIs async because they now share the async git executor; all
|
|
3
|
+
// in-repo callers await them, so this barrel intentionally does not add sync
|
|
4
|
+
// wrappers.
|
|
5
|
+
export * from "./worktree/index.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Public API exports.
|
|
5
5
|
*/
|
|
6
|
-
export declare const VERSION = "0.
|
|
7
|
-
export type { Message, ContentBlock, ToolDefinition, ToolCall, ToolResult, RegisteredTool, TranscriptEvent, TranscriptEventType, SessionState, SessionStatus, TokenUsage, CompiledInput, PermissionDecision, PermissionMode, PermissionRule, TurnPhase, TurnResult, TerminalReason, StreamEvent, StreamCallback, LLMConfig, ClientDefaults, LLMResponse, Settings, MCPServerConfig, } from "./types.js";
|
|
6
|
+
export declare const VERSION = "0.7.0-beta.1";
|
|
7
|
+
export type { Message, ContentBlock, ToolDefinition, ToolCall, ToolResult, RegisteredTool, TranscriptEvent, TranscriptEventType, SessionState, SessionWorkspace, ContextUsageAnchor, SessionStatus, TokenUsage, CompiledInput, PermissionDecision, PermissionMode, PermissionRule, TurnPhase, TurnResult, TerminalReason, StreamEvent, StreamCallback, LLMConfig, ClientDefaults, LLMResponse, Settings, MCPServerConfig, } from "./types.js";
|
|
8
8
|
export { FrameworkError, LLMError, LLMRateLimitError, ContextLimitError, ToolError, ToolNotFoundError, ToolExecutionError, ToolTimeoutError, PermissionDeniedError, SessionError, TranscriptError, ConfigError, SandboxUnavailableError, } from "./exceptions.js";
|
|
9
9
|
export { Engine, loadAgentDefinitionsForCwd } from "./engine/engine.js";
|
|
10
10
|
export type { EngineConfig, EngineHookConfig, EngineResult } from "./engine/types.js";
|
|
11
11
|
export { resolveLLMConfigForTag } from "./engine/resolve-llm-config.js";
|
|
12
12
|
export { resolveAuxKey } from "./engine/aux-key.js";
|
|
13
13
|
export { parseAgentDefinition, serializeAgentDefinition, type AgentDefinition, } from "./agent/agent-definition.js";
|
|
14
|
-
export { AgentDefinitionRegistry, type AgentSourceDir
|
|
14
|
+
export { AgentDefinitionRegistry, type AgentSourceDir } from "./agent/agent-definition-registry.js";
|
|
15
15
|
export type { CostStateStore, CostStateSnapshot } from "./engine/cost-store.js";
|
|
16
16
|
export { EngineRuntime } from "./engine/runtime.js";
|
|
17
17
|
export type { EngineRuntimeOptions } from "./engine/runtime.js";
|
|
@@ -25,7 +25,7 @@ export { ModelPool, type ModelEntry } from "./llm/model-pool.js";
|
|
|
25
25
|
export { modelEntriesFromConnections } from "./engine/model-connections-pool.js";
|
|
26
26
|
export { ToolRegistry } from "./tool-system/registry.js";
|
|
27
27
|
export { ToolExecutor } from "./tool-system/executor.js";
|
|
28
|
-
export { PermissionClassifier, HeadlessApprovalBackend, AutoApprovalBackend } from "./tool-system/permission.js";
|
|
28
|
+
export { PermissionClassifier, HeadlessApprovalBackend, AutoApprovalBackend, } from "./tool-system/permission.js";
|
|
29
29
|
export type { ApprovalBackend } from "./tool-system/permission.js";
|
|
30
30
|
export { BUILTIN_TOOLS } from "./tool-system/builtin/index.js";
|
|
31
31
|
export type { BuiltinTool, BuiltinToolFn } from "./tool-system/builtin/index.js";
|
|
@@ -38,17 +38,18 @@ export type { HookEventName, HookContext, HookResult } from "./hooks/events.js";
|
|
|
38
38
|
export { wrapHookMessages } from "./hooks/inject.js";
|
|
39
39
|
export { AgentServer, type AgentServerOptions } from "./protocol/server.js";
|
|
40
40
|
export { AgentClient, type BackgroundAgentCompletedHandler } from "./protocol/client.js";
|
|
41
|
-
export { createInProcessTransport, StdioTransport, type Transport
|
|
42
|
-
export { SocketTransport, listenTcp, type TcpListenResult
|
|
41
|
+
export { createInProcessTransport, StdioTransport, type Transport } from "./protocol/transport.js";
|
|
42
|
+
export { SocketTransport, listenTcp, type TcpListenResult } from "./protocol/tcp-transport.js";
|
|
43
43
|
export { createServer, createClient, type CreateServerOptions, type CreateClientOptions, type ServerHandle, } from "./protocol/factories.js";
|
|
44
|
-
export { Methods, ErrorCodes, type RpcMessage, type RunResult
|
|
44
|
+
export { Methods, ErrorCodes, type RpcMessage, type RunResult } from "./protocol/types.js";
|
|
45
45
|
export { Transcript } from "./session/transcript.js";
|
|
46
46
|
export { SessionManager } from "./session/session-manager.js";
|
|
47
47
|
export { FileHistory } from "./session/file-history.js";
|
|
48
|
+
export { createWorktree, currentBranch, DEFAULT_WORKTREE_BRANCH_PREFIX, getWorktreeDiff, isManagedWorktreeBranch, isValidWorktreeBranchPrefix, findMainWorktreeRoot, listWorktrees, listWorktreesFast, normalizeWorktreeBranchPrefix, removeWorktree, validateWorktreeSlug, worktreeHasUncommittedOrAheadChanges, worktreeHasUncommittedChanges, type CreateWorktreeOptions, type ListWorktreesOptions, type ListWorktreesFastOptions, type RemoveWorktreeResult, type RemoveWorktreeOptions, type WorktreeDiffSummary, type WorktreeInfo, type WorktreeWorkspaceOwner, } from "./git/worktree.js";
|
|
48
49
|
export { latestUndoTarget, earliestSnapshotsPerFile, latestTurnUndoTargets, latestRedoTargets, } from "./session/undo-target.js";
|
|
49
50
|
export { diffLines, renderDiffPreview, type DiffLine } from "./session/simple-diff.js";
|
|
50
51
|
export { MemoryManager } from "./session/memory.js";
|
|
51
|
-
export type { MemoryEntry, MemoryScope } from "./session/memory.js";
|
|
52
|
+
export type { MemoryEntry, MemoryOrigin, MemoryScope } from "./session/memory.js";
|
|
52
53
|
export { runDreamConsolidation, type DreamConsolidationInput, type DreamConsolidationResult, } from "./services/dream-consolidation.js";
|
|
53
54
|
export type { FileSnapshot, RedoRecord } from "./session/file-history.js";
|
|
54
55
|
export { PromptComposer } from "./prompt/composer.js";
|
|
@@ -56,7 +57,7 @@ export { SectionCache } from "./prompt/section-cache.js";
|
|
|
56
57
|
export { scanInstructions, combineInstructions } from "./prompt/instruction-scanner.js";
|
|
57
58
|
export { BUILTIN_AGENT_PRESETS, DEFAULT_AGENT_PRESET, DEFAULT_CLI_PRESET, resolveAgentPreset, resolveBuiltinToolNames, buildPresetSystemPrompt, registerPreset, listPresetNames, } from "./preset/index.js";
|
|
58
59
|
export type { AgentPreset, AgentPresetName } from "./preset/index.js";
|
|
59
|
-
export { loadSection, loadSections, availableSections, registerSection } from "./prompt/section-loader.js";
|
|
60
|
+
export { loadSection, loadSections, availableSections, registerSection, } from "./prompt/section-loader.js";
|
|
60
61
|
export { ContextManager } from "./context/manager.js";
|
|
61
62
|
export { estimateTokens, microcompact, windowCompact, truncateToolResult, buildSummarizationPrompt, applySummaryCompaction, COMPACTABLE_TOOL_NAMES, } from "./context/compaction.js";
|
|
62
63
|
export type { MicrocompactOptions } from "./context/compaction.js";
|
|
@@ -75,7 +76,7 @@ export { installPluginFromSource } from "./plugins/installer/installFromSource.j
|
|
|
75
76
|
export { installLocalPlugin, installPluginFromArchive, } from "./plugins/installer/installFromArchive.js";
|
|
76
77
|
export { parseSource, type ParsedSource } from "./plugins/installer/parseSource.js";
|
|
77
78
|
export { detectPluginFormat } from "./plugins/installer/detectFormat.js";
|
|
78
|
-
export { CodexPluginManifest, CSMeta, PluginInstallError
|
|
79
|
+
export { CodexPluginManifest, CSMeta, PluginInstallError } from "./plugins/installer/types.js";
|
|
79
80
|
export { mergePluginMcpServers } from "./plugins/installer/loadPluginMcp.js";
|
|
80
81
|
export { listPluginHooks, pluginHookKey, type PluginHookEntry } from "./plugins/loadPluginHooks.js";
|
|
81
82
|
export { describePluginContent, type PluginContentInventory } from "./plugins/pluginContent.js";
|
|
@@ -89,26 +90,26 @@ export { Arena } from "./arena/arena.js";
|
|
|
89
90
|
export { MODEL_PRESETS, getMaxOutputTokens } from "./arena/model-presets.js";
|
|
90
91
|
export type { ModelPreset } from "./arena/model-presets.js";
|
|
91
92
|
export { detectArenaMode } from "./arena/detect-mode.js";
|
|
92
|
-
export { getStrategy, getStrategyForPlan, ReviewStrategy, DiscussionStrategy, PlanningStrategy } from "./arena/strategies/index.js";
|
|
93
|
+
export { getStrategy, getStrategyForPlan, ReviewStrategy, DiscussionStrategy, PlanningStrategy, } from "./arena/strategies/index.js";
|
|
93
94
|
export { planArena } from "./arena/planner.js";
|
|
94
95
|
export { collectEvidence } from "./arena/providers/index.js";
|
|
95
96
|
export { selectTools, hasTools } from "./arena/tools/selector.js";
|
|
96
97
|
export { ArenaLedger } from "./arena/ledger.js";
|
|
97
98
|
export { registerClaims, selectClaimsForReview } from "./arena/phases/claim-registry.js";
|
|
98
99
|
export { buildDigest, formatDigest } from "./arena/digest-builder.js";
|
|
99
|
-
export { transitionClaim, resolveClaimStatus, markUnderReview, applyReviewResult, markUnresolved, isTerminal, validTransitions } from "./arena/transitions.js";
|
|
100
|
+
export { transitionClaim, resolveClaimStatus, markUnderReview, applyReviewResult, markUnresolved, isTerminal, validTransitions, } from "./arena/transitions.js";
|
|
100
101
|
export type { ArenaConfig, ArenaMode, ArenaResultV2, ArenaStrategy, ArenaParticipant, ArenaBaseContext, ArenaFinding, FindingReview, ParticipantReport, ArenaConsensus, ArenaConsensusItem, ArenaRoadmapPhase, ArenaProgressEvent, ArenaPlan, ArenaLens, ArenaLensName, ArenaSourceKind, ArenaArtifact, ArenaQuickFact, FindingKind, PeerVerdict, ToolTrace, EvidencePacket, FindingEvidenceLink, ResearchDossier, ClaimStatus, ClaimRecord, ClaimChallenge, ClaimAdjudication, RequestedCheck, DebateRound, DebateTurn, TargetedCheckTask, SharedResearchLedger, RoundResearchDigest, ArenaExecutionLimits, } from "./arena/types.js";
|
|
101
102
|
export { IterativeArena, defaultIterateConvergence, iterateDiffRatio, iterateCodeFormat, iterateDocumentFormat, getIterateFormat, } from "./arena/index.js";
|
|
102
103
|
export type { IterateConfig, IterateResult, IterateSubject, IterateFormat, IterateProgressEvent, IterateFormatPack, Draft, DraftCandidate, Critique, CritiqueCategory, CritiqueEvidence, CritiqueSeverity, ConvergenceSignal, Round, AuthorRotation, StoppedReason, CheckpointFn, CheckpointContext, CheckpointAction, } from "./arena/index.js";
|
|
103
104
|
export { RunManager, type RunManagerConfig, type RunStore, FileRunStore, RunQueue, EngineRunner, AUTOMATION_PROMPT_NOTE, AUTOMATION_RUN_SOURCE, type EngineRunnerConfig, type RunExecutionHandle, type RunExecutor, type CustomToolEntry, RunApprovalBackend, createRunAskUserFn, type RunLifecycleHooks, CheckpointWriter, ArtifactTracker, RunLock, type RunLockConfig, type RunLockAcquireResult, Heartbeat, NoopEvaluator, CompositeEvaluator, type Evaluator, type EvaluatorResult, type EvaluatorContext, type RunStatus, type RunSnapshot, type RunEvent, type RunCheckpoint, type RunApproval, type RunArtifactRef, type SubmitRunInput, type ResumeRunInput, type ListRunsQuery, type RunStreamEvent, type RunStreamCallback, type DetachFn, VALID_TRANSITIONS, createRunManager, type CreateRunManagerOptions, } from "./run/index.js";
|
|
104
105
|
export { defineProduct, type ProductDefinition, type ProductPreset, type ProductAdapter, type ProductContract, type CustomTool, type ProductRuntimeOptions, type ProductInstance, } from "./product/index.js";
|
|
105
106
|
export { logger } from "./logging/logger.js";
|
|
106
|
-
export { SettingsManager, type SettingsScope } from "./settings/manager.js";
|
|
107
|
+
export { SettingsManager, userHome, type SettingsScope } from "./settings/manager.js";
|
|
107
108
|
export { migrateConfig, configVersionOf, CURRENT_CONFIG_VERSION, type MigrationStep, } from "./settings/migrate-config.js";
|
|
108
109
|
export { SettingsSchema, validateSettings } from "./settings/schema.js";
|
|
109
110
|
export { settingsJsonSchema, writeSettingsSchemaFile } from "./settings/schema-export.js";
|
|
110
111
|
export { personalizationFrom, type PersonalizationConfig } from "./settings/personalization.js";
|
|
111
|
-
export { CredentialStore, type CredentialScope, type MaskedCredential, type Credential, type CredentialType, type CredentialStoreFile, formatNetscapeCookies, parseCookieJar, type CookieLike, useCredentialToolDef, useCredentialToolDefFor, sweepStaleCredentialCookies, type EncryptionCipher, PlaintextCipher, setDefaultCredentialCipher, getDefaultCredentialCipher, } from "./credentials/index.js";
|
|
112
|
+
export { CredentialStore, type CredentialScope, type MaskedCredential, type Credential, type CredentialType, type CredentialStoreFile, formatNetscapeCookies, parseCookieJar, type CookieLike, useCredentialToolDef, useCredentialToolDefFor, sweepStaleCredentialCookies, getCredentialAccess, setDefaultCredentialAccess, createIpcCredentialAccess, localCredentialAccess, credentialAccessScope, isCredentialSecretAvailable, materializeCookieSecret, type CredentialAccess, type CredentialAccessScope, type CredentialMetadata, type CredentialSnapshot, type CredentialSnapshotEntry, type EncryptionCipher, PlaintextCipher, setDefaultCredentialCipher, getDefaultCredentialCipher, } from "./credentials/index.js";
|
|
112
113
|
/** @internal Shared with the in-repo TUI/desktop hosts; not stable SDK surface. */
|
|
113
114
|
export { getSessionId, switchSession, getOriginalCwd, setOriginalCwd, getProjectRoot, setProjectRoot, getCwdState, getIsInteractive, updateLastInteractionTime, flushInteractionTime, markScrollActivity, type AttributedCounter, type ChannelEntry, } from "./state.js";
|
|
114
115
|
/** @internal Shared primitives for the in-repo TUI/desktop hosts; not stable SDK surface. */
|
|
@@ -125,7 +126,7 @@ export { startCapturingEarlyInput, stopCapturingEarlyInput, consumeEarlyInput, h
|
|
|
125
126
|
export { formatBytes, formatToolArgs, singleLine, MAX_LINE_WIDTH, TOOL_DOT_COLORS, } from "./utils/toolDisplay.js";
|
|
126
127
|
export { classifyBashLines, type BashLineKind, type ClassifiedBashLine, } from "./tool-system/builtin/bash-output-style.js";
|
|
127
128
|
export { formatDuration, formatTokens } from "./utils/format.js";
|
|
128
|
-
export { getTheme, type Theme, type ThemeName, type ThemeSetting
|
|
129
|
+
export { getTheme, type Theme, type ThemeName, type ThemeSetting } from "./utils/theme.js";
|
|
129
130
|
export { resolveThemeSetting, type SystemTheme } from "./utils/systemTheme.js";
|
|
130
131
|
/** @internal Host-lifecycle logging hooks for the in-repo TUI/desktop hosts; not stable SDK surface. */
|
|
131
132
|
export { rotateLogs } from "./logging/logger.js";
|
|
@@ -143,7 +144,7 @@ export { buildReviewPrompt, parseDimensions, ALL_DIMENSIONS, type ReviewDimensio
|
|
|
143
144
|
* primary Engine/Protocol API above.
|
|
144
145
|
*/
|
|
145
146
|
export { getInteractiveApprovalBackend } from "./tool-system/permission.js";
|
|
146
|
-
export { defaultSandboxConfig, type SandboxConfig
|
|
147
|
+
export { defaultSandboxConfig, type SandboxConfig } from "./tool-system/sandbox/index.js";
|
|
147
148
|
export { buildNotificationMessage, buildNotificationSummary, notificationQueue, agentNotificationBus, notificationItemToStreamEvent, type NotificationItem, } from "./tool-system/builtin/agent-notifications.js";
|
|
148
149
|
export type { BackgroundAgentCompletedEvent } from "./types.js";
|
|
149
150
|
export { startAutomation, type StartAutomationDeps, type AutomationHandle, CronScheduler, cronScheduler, type CronJob, type CronPermissionLevel, type CreateJobOptions, type UpdateJobPatch, CronStore, defaultCronStorePath, bindCronToEngine, bindCronToRunManager, type CronRunner, type CronRunRequest, type CronRunResult, type RunSubmitter, isCronExpression, parseCronExpression, nextCronTime, type ParsedCron, resolveWritePolicy, wrapUntrustedInput, type WritePolicy, runWriteJobInWorktree, type WriteJobGitOps, type RunWriteJobInput, type RunWriteJobResult, } from "./automation/index.js";
|
|
@@ -151,8 +152,9 @@ export * from "./cc-orchestrator/index.js";
|
|
|
151
152
|
export { checkQuota, formatQuota } from "./quota/index.js";
|
|
152
153
|
export { resolveQuotaCredentials } from "./quota/credentials.js";
|
|
153
154
|
export type { QuotaResult, ProviderQuota, QuotaWindow, QuotaCredentials } from "./quota/types.js";
|
|
154
|
-
export { asyncAgentRegistry, type AsyncAgentEntry
|
|
155
|
+
export { asyncAgentRegistry, type AsyncAgentEntry } from "./tool-system/builtin/agent-registry.js";
|
|
155
156
|
export { backgroundShellManager, BackgroundShellManager, type BgShell, type BgShellStatus, } from "./runtime/background-shell.js";
|
|
157
|
+
export { ENV_DENY_REGEX, ENV_ALLOWLIST } from "./runtime/spawn-common.js";
|
|
156
158
|
export { getImageProvider, DEFAULT_IMAGE_MODEL, type ImageProvider, type ImageProviderCreds, type ImageGenerateRequest, type ImageGenerateResult, } from "./tool-system/builtin/image-providers.js";
|
|
157
159
|
export { transcribe, type TranscribeCreds, type TranscribeRequest, type TranscribeResult, } from "./stt/transcribe.js";
|
|
158
160
|
export { resolveTranscribeProvider, isTranscribeAvailable, describeTranscribe, type ResolvedTranscribeProvider, type TranscribeDescription, } from "./stt/resolve-transcribe.js";
|
|
@@ -163,23 +165,24 @@ export type { ProtocolModelEntry } from "./protocol/types.js";
|
|
|
163
165
|
/** @internal Extended Arena surface for the in-repo TUI/desktop hosts; not stable SDK surface. */
|
|
164
166
|
export { formatArenaResult, printArenaResult, renderProgress, createProgressRenderer, type OutputSink, } from "./arena/render/terminal.js";
|
|
165
167
|
export { formatArenaResultForSession } from "./arena/render/session.js";
|
|
166
|
-
export { installPlugin, uninstallPlugin, listInstalled
|
|
168
|
+
export { installPlugin, uninstallPlugin, listInstalled } from "./plugins/pluginInstaller.js";
|
|
167
169
|
export { addMarketplace, refreshMarketplace, removeMarketplace, listMarketplaces, loadMarketplace, } from "./plugins/marketplaceManager.js";
|
|
168
|
-
export { parseMarketplaceInput, deriveMarketplaceName
|
|
169
|
-
export { scanPluginCommands, type PluginCommand
|
|
170
|
+
export { parseMarketplaceInput, deriveMarketplaceName } from "./plugins/parseMarketplaceInput.js";
|
|
171
|
+
export { scanPluginCommands, type PluginCommand } from "./plugins/pluginCommandsLoader.js";
|
|
170
172
|
/** @internal Extended LLM surface for the in-repo TUI/desktop hosts; not stable SDK surface. */
|
|
171
|
-
export { type CachedModel, defaultCacheDir
|
|
172
|
-
export { fetchModelList, type FetchResult
|
|
173
|
-
export { sanitizeApiKey, hasNonAsciiPrintable
|
|
174
|
-
export { PROVIDER_KINDS, type ProviderKindName
|
|
175
|
-
export { capabilitiesFor, type Capability
|
|
173
|
+
export { type CachedModel, defaultCacheDir } from "./llm/model-cache.js";
|
|
174
|
+
export { fetchModelList, type FetchResult } from "./llm/model-fetcher.js";
|
|
175
|
+
export { sanitizeApiKey, hasNonAsciiPrintable } from "./llm/api-key-sanitize.js";
|
|
176
|
+
export { PROVIDER_KINDS, type ProviderKindName } from "./llm/provider-kinds.js";
|
|
177
|
+
export { capabilitiesFor, type Capability } from "./llm/capabilities/index.js";
|
|
176
178
|
export { reasoningControlFor, type ReasoningControl, } from "./llm/capabilities/reasoning-control.js";
|
|
177
|
-
export { REASONING_EFFORTS, type ReasoningSetting
|
|
179
|
+
export { REASONING_EFFORTS, type ReasoningSetting } from "./llm/reasoning-setting.js";
|
|
178
180
|
export { type ProviderConfig } from "./llm/provider-catalog.js";
|
|
179
|
-
export { syncOpenRouterCatalog, getOpenRouterSnapshot
|
|
181
|
+
export { syncOpenRouterCatalog, getOpenRouterSnapshot } from "./data/openrouter-sync.js";
|
|
180
182
|
/** @internal Extended type surface for the in-repo TUI/desktop hosts; not stable SDK surface. */
|
|
181
|
-
export type { ApprovalRequest, ApprovalResult, ApprovalScope, TaskInfo
|
|
183
|
+
export type { ApprovalRequest, ApprovalResult, ApprovalScope, TaskInfo } from "./types.js";
|
|
182
184
|
export { resolveExternalAgentConfig } from "./external-agents/config.js";
|
|
183
185
|
export type { ExternalAgentMode, ExternalAgentsSettings, ResolvedExternalAgentsConfig, ResolvedClaudeCodeSettings, ResolvedCodexSettings, } from "./external-agents/types.js";
|
|
184
186
|
export { flattenAxTree, renderElementList, cleanPageText, CONTENT_CHAR_CAP, buildExtractLinksScript, EXTRACT_LINK_CAP, } from "./tool-system/browser-bridge.js";
|
|
185
187
|
export type { BrowserBridge, BrowserElement, BrowserSnapshot, BrowserResult, BrowserContent, BrowserExtract, BrowserLink, BrowserImage, BrowserVideo, BrowserImageData, BrowserTab, AXNode, } from "./tool-system/browser-bridge.js";
|
|
188
|
+
export type { WorkspaceBridge } from "./tool-system/workspace-bridge.js";
|