flavor-code 1.4.2 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -1
- package/README.zh-CN.md +53 -1
- package/dist/agent/loop.d.ts +1 -0
- package/dist/{app-4CUS3GEJ.js → app-TVY2HM5L.js} +891 -604
- package/dist/apply-WOW3QU5I.js +51 -0
- package/dist/broker-cli-X5H46FZV.js +15 -0
- package/dist/check-CSKTV4O2.js +16 -0
- package/dist/chunk-3563SW4X.js +10513 -0
- package/dist/chunk-36IDJRLQ.js +630 -0
- package/dist/chunk-3UX2CGDW.js +1955 -0
- package/dist/chunk-4TMLXZVZ.js +75 -0
- package/dist/{chunk-7YFHRORG.js → chunk-5BDKRA6U.js} +412 -172
- package/dist/chunk-6F66UXBI.js +48 -0
- package/dist/{chunk-KMBDK4SN.js → chunk-6URQ7FIF.js} +24 -88
- package/dist/chunk-7Y64WNBB.js +8930 -0
- package/dist/chunk-AA4QNKTF.js +501 -0
- package/dist/chunk-BDX777JR.js +11 -0
- package/dist/chunk-CVP5OUHD.js +103 -0
- package/dist/chunk-EWD7FWTH.js +14547 -0
- package/dist/{chunk-N5MXHJKD.js → chunk-GTFP2R5I.js} +1 -1
- package/dist/{chunk-W2TIY6JY.js → chunk-IKGT4MDT.js} +2028 -516
- package/dist/chunk-IQEEFDEE.js +389 -0
- package/dist/chunk-IU3UBETC.js +30 -0
- package/dist/chunk-JQM2L2YM.js +1003 -0
- package/dist/chunk-KRWWCVXA.js +74 -0
- package/dist/chunk-OKHV7CTB.js +482 -0
- package/dist/chunk-ONRY3C2L.js +196 -0
- package/dist/chunk-PULWAH6E.js +474 -0
- package/dist/chunk-PZ5NKRVA.js +85 -0
- package/dist/chunk-QACFKPZP.js +43704 -0
- package/dist/chunk-RBAZLFKB.js +1022 -0
- package/dist/chunk-RV3EXUXM.js +30 -0
- package/dist/chunk-TIEOVQW6.js +61 -0
- package/dist/chunk-WLZUAVVU.js +15 -0
- package/dist/chunk-X442CJJH.js +114 -0
- package/dist/chunk-X6U6BO5D.js +2130 -0
- package/dist/{chunk-RAYH6K2H.js → chunk-Y7EH4NVO.js} +1 -1
- package/dist/{chunk-S32JRDZK.js → chunk-ZKKVSR37.js} +6 -1
- package/dist/{claude-ink-VQU3C5UL.js → claude-ink-F554I3GJ.js} +9 -4
- package/dist/cli-MAWCV2YR.js +163 -0
- package/dist/cli-main.js +3805 -473
- package/dist/cli.js +50 -4
- package/dist/config/load.d.ts +8 -0
- package/dist/config/protected-file.d.ts +2 -0
- package/dist/config/schema.d.ts +14 -0
- package/dist/context/global-instructions.d.ts +12 -0
- package/dist/context/manager.d.ts +4 -0
- package/dist/desktop/main.js +4943 -1562
- package/dist/desktop/preload.cjs +30 -0
- package/dist/desktop-renderer/assets/index-BWklSoOO.css +1 -0
- package/dist/desktop-renderer/assets/index-CjC0Ibiq.js +153 -0
- package/dist/desktop-renderer/assets/{interactive-terminal-ouQQ3brz.js → interactive-terminal-IjIT3Xoa.js} +1 -1
- package/dist/desktop-renderer/index.html +2 -2
- package/dist/doctor-SEL32R7M.js +20 -0
- package/dist/harness/local.d.ts +1 -0
- package/dist/load-RHWXNUCS.js +25 -0
- package/dist/log-ATFIPRNU.js +19 -0
- package/dist/manager-IYBNNKUP.js +191 -0
- package/dist/models/anthropic.d.ts +3 -0
- package/dist/node-LOIXT44J.js +879 -0
- package/dist/plugin-worker-entry.js +1 -1
- package/dist/production-TQROFEPV.js +46 -0
- package/dist/production.d.ts +28 -1
- package/dist/project-3QXE22TG.js +11 -0
- package/dist/react-M6JGXSJZ.js +7 -0
- package/dist/recorder-FAGJJH3N.js +11 -0
- package/dist/sdk/index.js +30 -8
- package/dist/server-2KLKPHPL.js +11 -0
- package/dist/session/store.d.ts +1 -0
- package/dist/store-MZZERW7K.js +18 -0
- package/dist/ui/commands.d.ts +11 -3
- package/dist/ui/session.d.ts +2 -1
- package/dist/usage-summary-G5FBOJLK.js +13 -0
- package/dist/write-stream-CGD57URC.js +77 -0
- package/package.json +1 -1
- package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +649 -1
- package/dist/chunk-B23V72YR.js +0 -170
- package/dist/chunk-QKND3FX7.js +0 -26103
- package/dist/desktop-renderer/assets/index-Bk6FYhyh.css +0 -1
- package/dist/desktop-renderer/assets/index-CPXrzFgv.js +0 -154
- package/dist/load-UPOG3XQR.js +0 -19
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from "node:module"; const require =
|
|
2
|
+
import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
|
|
3
3
|
|
|
4
4
|
// src/plugins/plugin-worker-entry.ts
|
|
5
5
|
import { readFile, realpath } from "fs/promises";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
ApprovalBridge,
|
|
5
|
+
DEFAULT_SHUTDOWN_STEP_TIMEOUT_MS,
|
|
6
|
+
compileHeadlessToolAllowlist,
|
|
7
|
+
createProductionRuntime,
|
|
8
|
+
createPromptEnvironment,
|
|
9
|
+
matchesHeadlessAllowlist,
|
|
10
|
+
runGoalSession,
|
|
11
|
+
runResumeGoalSession
|
|
12
|
+
} from "./chunk-QACFKPZP.js";
|
|
13
|
+
import "./chunk-TIEOVQW6.js";
|
|
14
|
+
import "./chunk-OKHV7CTB.js";
|
|
15
|
+
import "./chunk-JQM2L2YM.js";
|
|
16
|
+
import "./chunk-IU3UBETC.js";
|
|
17
|
+
import "./chunk-PZ5NKRVA.js";
|
|
18
|
+
import "./chunk-6F66UXBI.js";
|
|
19
|
+
import "./chunk-3UX2CGDW.js";
|
|
20
|
+
import "./chunk-7Y64WNBB.js";
|
|
21
|
+
import "./chunk-CVP5OUHD.js";
|
|
22
|
+
import "./chunk-3563SW4X.js";
|
|
23
|
+
import "./chunk-RBAZLFKB.js";
|
|
24
|
+
import "./chunk-36IDJRLQ.js";
|
|
25
|
+
import "./chunk-WLZUAVVU.js";
|
|
26
|
+
import "./chunk-RV3EXUXM.js";
|
|
27
|
+
import "./chunk-IQEEFDEE.js";
|
|
28
|
+
import "./chunk-GTFP2R5I.js";
|
|
29
|
+
import "./chunk-5BDKRA6U.js";
|
|
30
|
+
import "./chunk-X6U6BO5D.js";
|
|
31
|
+
import "./chunk-BDX777JR.js";
|
|
32
|
+
import "./chunk-ONRY3C2L.js";
|
|
33
|
+
import "./chunk-EWD7FWTH.js";
|
|
34
|
+
import "./chunk-KRWWCVXA.js";
|
|
35
|
+
import "./chunk-X442CJJH.js";
|
|
36
|
+
import "./chunk-ZKKVSR37.js";
|
|
37
|
+
export {
|
|
38
|
+
ApprovalBridge,
|
|
39
|
+
DEFAULT_SHUTDOWN_STEP_TIMEOUT_MS,
|
|
40
|
+
compileHeadlessToolAllowlist,
|
|
41
|
+
createProductionRuntime,
|
|
42
|
+
createPromptEnvironment,
|
|
43
|
+
matchesHeadlessAllowlist,
|
|
44
|
+
runGoalSession,
|
|
45
|
+
runResumeGoalSession
|
|
46
|
+
};
|
package/dist/production.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentEvent } from "./agent/types.js";
|
|
2
2
|
import { GoalOrchestrator } from "./goal/orchestrator.js";
|
|
3
3
|
import { type McpClientFactory } from "./mcp/client.js";
|
|
4
|
-
import type { PermissionProfile, PermissionRequest } from "./permissions/engine.js";
|
|
4
|
+
import type { PermissionMode, PermissionProfile, PermissionRequest } from "./permissions/engine.js";
|
|
5
5
|
import { type PromptEnvironment } from "./prompts/system.js";
|
|
6
6
|
import type { ApprovalDecision } from "./tools/runtime.js";
|
|
7
7
|
import { type MemoryRestartContinuation } from "./utils/memory-restart.js";
|
|
@@ -35,6 +35,12 @@ export interface ProductionRuntimeOptions {
|
|
|
35
35
|
onToolsChange?(): void;
|
|
36
36
|
/** Non-interactive callers must deny requests instead of waiting for input. */
|
|
37
37
|
approvalPolicy?: "prompt" | "deny";
|
|
38
|
+
/** Override the resolved permission mode for this runtime (CLI --permission-mode). Takes precedence over recovered and configured modes. */
|
|
39
|
+
permissionMode?: PermissionMode;
|
|
40
|
+
/** Override the main model for this runtime (CLI --model), validated against the registry and any PKCE allowlist. */
|
|
41
|
+
modelOverride?: string;
|
|
42
|
+
/** Tool patterns auto-approved when approvalPolicy is "deny" (CLI --allowed-tools), e.g. "Read", "mcp__docs__*", "Shell(npm test:*)". */
|
|
43
|
+
headlessToolAllowlist?: readonly string[];
|
|
38
44
|
/** Allow a protocol host to resolve tool approvals without enabling other interactive UI bridges. */
|
|
39
45
|
rpcToolApprovals?: boolean;
|
|
40
46
|
/** Optional pre-commit gate used by protocol hosts to stream a proposed text write before it reaches disk. */
|
|
@@ -118,5 +124,26 @@ export interface MemoryRestartRotation {
|
|
|
118
124
|
/** Retention census holders reported by the major in-memory owners. */
|
|
119
125
|
holders?: Record<string, RotationCensusHolder>;
|
|
120
126
|
}
|
|
127
|
+
interface HeadlessAllowlistEntry {
|
|
128
|
+
/** Exact tool name match. */
|
|
129
|
+
tool?: string;
|
|
130
|
+
/** `pattern*` matches any tool name starting with the pattern. */
|
|
131
|
+
prefix?: string;
|
|
132
|
+
/** `Shell(prefix:*)` additionally requires the raw shell command to start with prefix. */
|
|
133
|
+
command?: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Compiles CLI --allowed-tools patterns for headless runs. Supported forms:
|
|
137
|
+
* `Read` (exact tool), `mcp__docs__*` (name prefix), `Shell(npm test:*)`
|
|
138
|
+
* (shell command prefix). Malformed patterns are ignored.
|
|
139
|
+
*/
|
|
140
|
+
export declare function compileHeadlessToolAllowlist(patterns: readonly string[]): readonly HeadlessAllowlistEntry[];
|
|
141
|
+
/**
|
|
142
|
+
* Decides whether an "ask" permission request is pre-approved by the headless
|
|
143
|
+
* allowlist. Monotonic denials from the permission engine never reach here,
|
|
144
|
+
* and wrapped/opaque shell commands are never auto-approved.
|
|
145
|
+
*/
|
|
146
|
+
export declare function matchesHeadlessAllowlist(entries: readonly HeadlessAllowlistEntry[], request: Pick<PermissionRequest, "tool" | "command" | "args">): boolean;
|
|
121
147
|
export declare function runGoalSession(orchestrator: GoalOrchestrator, goal: string, signal: AbortSignal): AsyncIterable<AgentEvent>;
|
|
122
148
|
export declare function runResumeGoalSession(orchestrator: GoalOrchestrator, goalId: string, signal: AbortSignal): AsyncIterable<AgentEvent>;
|
|
149
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
initializeFlavor,
|
|
5
|
+
inspectProject
|
|
6
|
+
} from "./chunk-OKHV7CTB.js";
|
|
7
|
+
import "./chunk-ZKKVSR37.js";
|
|
8
|
+
export {
|
|
9
|
+
initializeFlavor,
|
|
10
|
+
inspectProject
|
|
11
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
require_react
|
|
5
|
+
} from "./chunk-PULWAH6E.js";
|
|
6
|
+
import "./chunk-ZKKVSR37.js";
|
|
7
|
+
export default require_react();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
TraceRecorder
|
|
5
|
+
} from "./chunk-4TMLXZVZ.js";
|
|
6
|
+
import "./chunk-WLZUAVVU.js";
|
|
7
|
+
import "./chunk-EWD7FWTH.js";
|
|
8
|
+
import "./chunk-ZKKVSR37.js";
|
|
9
|
+
export {
|
|
10
|
+
TraceRecorder
|
|
11
|
+
};
|
package/dist/sdk/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from "node:module"; const require =
|
|
2
|
+
import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
FlavorRpcServer
|
|
5
|
+
} from "../chunk-6URQ7FIF.js";
|
|
3
6
|
import {
|
|
4
|
-
FlavorRpcServer,
|
|
5
7
|
TraceRecordSchema,
|
|
6
8
|
TraceRecorder
|
|
7
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-4TMLXZVZ.js";
|
|
8
10
|
import {
|
|
9
11
|
AgentMessageQueue,
|
|
10
12
|
DockerExecutionEnvironment,
|
|
@@ -13,11 +15,31 @@ import {
|
|
|
13
15
|
WorkspaceCheckpointStore,
|
|
14
16
|
buildDockerInvocation,
|
|
15
17
|
createProductionRuntime
|
|
16
|
-
} from "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
18
|
+
} from "../chunk-QACFKPZP.js";
|
|
19
|
+
import "../chunk-TIEOVQW6.js";
|
|
20
|
+
import "../chunk-OKHV7CTB.js";
|
|
21
|
+
import "../chunk-JQM2L2YM.js";
|
|
22
|
+
import "../chunk-IU3UBETC.js";
|
|
23
|
+
import "../chunk-PZ5NKRVA.js";
|
|
24
|
+
import "../chunk-6F66UXBI.js";
|
|
25
|
+
import "../chunk-3UX2CGDW.js";
|
|
26
|
+
import "../chunk-7Y64WNBB.js";
|
|
27
|
+
import "../chunk-CVP5OUHD.js";
|
|
28
|
+
import "../chunk-3563SW4X.js";
|
|
29
|
+
import "../chunk-RBAZLFKB.js";
|
|
30
|
+
import "../chunk-36IDJRLQ.js";
|
|
31
|
+
import "../chunk-WLZUAVVU.js";
|
|
32
|
+
import "../chunk-RV3EXUXM.js";
|
|
33
|
+
import "../chunk-IQEEFDEE.js";
|
|
34
|
+
import "../chunk-GTFP2R5I.js";
|
|
35
|
+
import "../chunk-5BDKRA6U.js";
|
|
36
|
+
import "../chunk-X6U6BO5D.js";
|
|
37
|
+
import "../chunk-BDX777JR.js";
|
|
38
|
+
import "../chunk-ONRY3C2L.js";
|
|
39
|
+
import "../chunk-EWD7FWTH.js";
|
|
40
|
+
import "../chunk-KRWWCVXA.js";
|
|
41
|
+
import "../chunk-X442CJJH.js";
|
|
42
|
+
import "../chunk-ZKKVSR37.js";
|
|
21
43
|
|
|
22
44
|
// src/trace/replay.ts
|
|
23
45
|
import { readFile } from "fs/promises";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
FlavorRpcServer
|
|
5
|
+
} from "./chunk-6URQ7FIF.js";
|
|
6
|
+
import "./chunk-BDX777JR.js";
|
|
7
|
+
import "./chunk-EWD7FWTH.js";
|
|
8
|
+
import "./chunk-ZKKVSR37.js";
|
|
9
|
+
export {
|
|
10
|
+
FlavorRpcServer
|
|
11
|
+
};
|
package/dist/session/store.d.ts
CHANGED
|
@@ -109,6 +109,7 @@ export declare const SessionDocumentSchema: z.ZodObject<{
|
|
|
109
109
|
cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
|
|
110
110
|
}, z.core.$strict>>;
|
|
111
111
|
sources: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
112
|
+
pinnedSources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
112
113
|
stableSourceHash: z.ZodString;
|
|
113
114
|
}, z.core.$strict>>;
|
|
114
115
|
visibilityLog: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_MAX_SESSION_BYTES,
|
|
5
|
+
SESSION_VERSION,
|
|
6
|
+
SessionDocumentSchema,
|
|
7
|
+
SessionStore
|
|
8
|
+
} from "./chunk-X6U6BO5D.js";
|
|
9
|
+
import "./chunk-BDX777JR.js";
|
|
10
|
+
import "./chunk-ONRY3C2L.js";
|
|
11
|
+
import "./chunk-EWD7FWTH.js";
|
|
12
|
+
import "./chunk-ZKKVSR37.js";
|
|
13
|
+
export {
|
|
14
|
+
DEFAULT_MAX_SESSION_BYTES,
|
|
15
|
+
SESSION_VERSION,
|
|
16
|
+
SessionDocumentSchema,
|
|
17
|
+
SessionStore
|
|
18
|
+
};
|
package/dist/ui/commands.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const MVP_COMMANDS: readonly ["model", "init", "config", "login", "logout", "permissions", "skills", "plugins", "hooks", "tasks", "finish", "compact", "clear", "paste-image", "help", "exit", "audit", "usage", "doctor", "loop", "goal", "evolve", "mcp", "commit", "review", "explain", "ide", "memory", "remember", "forget", "forget-cold", "checkpoint", "tree", "rewind", "unrevert", "fork", "pals", "chat", "co-work", "tool"];
|
|
1
|
+
export declare const MVP_COMMANDS: readonly ["model", "init", "config", "login", "logout", "permissions", "skills", "plugins", "hooks", "tasks", "finish", "compact", "clear", "paste-image", "help", "exit", "audit", "usage", "doctor", "loop", "goal", "evolve", "mcp", "commit", "review", "explain", "ide", "memory", "remember", "forget", "forget-cold", "global", "checkpoint", "tree", "rewind", "unrevert", "fork", "pals", "chat", "co-work", "tool"];
|
|
2
2
|
export declare const COMMAND_DESCRIPTIONS: Record<(typeof MVP_COMMANDS)[number], string>;
|
|
3
3
|
export type PermissionCommandMode = PermissionMode;
|
|
4
4
|
export type ModelRole = "main" | "subagent";
|
|
@@ -14,6 +14,14 @@ export type McpSlashCommand = {
|
|
|
14
14
|
action: "enable" | "disable";
|
|
15
15
|
target: string;
|
|
16
16
|
};
|
|
17
|
+
export type GlobalSlashCommand = {
|
|
18
|
+
name: "global";
|
|
19
|
+
action: "show";
|
|
20
|
+
} | {
|
|
21
|
+
name: "global";
|
|
22
|
+
action: "remember" | "forget";
|
|
23
|
+
text: string;
|
|
24
|
+
};
|
|
17
25
|
export type PalsSlashCommand = {
|
|
18
26
|
name: "pals";
|
|
19
27
|
action: "list";
|
|
@@ -84,7 +92,7 @@ export type SlashCommand = {
|
|
|
84
92
|
} | {
|
|
85
93
|
name: "forget";
|
|
86
94
|
query: string;
|
|
87
|
-
} | {
|
|
95
|
+
} | GlobalSlashCommand | {
|
|
88
96
|
name: "checkpoint";
|
|
89
97
|
label?: string;
|
|
90
98
|
} | {
|
|
@@ -95,7 +103,7 @@ export type SlashCommand = {
|
|
|
95
103
|
target: string;
|
|
96
104
|
goal: string;
|
|
97
105
|
} | CoWorkSlashCommand | {
|
|
98
|
-
name: Exclude<(typeof MVP_COMMANDS)[number], "model" | "permissions" | "audit" | "loop" | "goal" | "evolve" | "commit" | "review" | "explain" | "mcp" | "remember" | "forget" | "checkpoint" | "rewind" | "fork" | "pals" | "chat" | "co-work" | "tool">;
|
|
106
|
+
name: Exclude<(typeof MVP_COMMANDS)[number], "model" | "permissions" | "audit" | "loop" | "goal" | "evolve" | "commit" | "review" | "explain" | "mcp" | "remember" | "forget" | "global" | "checkpoint" | "rewind" | "fork" | "pals" | "chat" | "co-work" | "tool">;
|
|
99
107
|
} | {
|
|
100
108
|
name: "audit";
|
|
101
109
|
toolFilter?: string | undefined;
|
package/dist/ui/session.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { AgentEvent } from "../agent/types.js";
|
|
|
2
2
|
import type { HookBus } from "../hooks/bus.js";
|
|
3
3
|
import type { PermissionMode } from "../permissions/engine.js";
|
|
4
4
|
import type { SkillMetadata } from "../skills/registry.js";
|
|
5
|
-
import { type McpSlashCommand, type ModelRole } from "./commands.js";
|
|
5
|
+
import { type GlobalSlashCommand, type McpSlashCommand, type ModelRole } from "./commands.js";
|
|
6
6
|
import type { QuestionBridge } from "../tools/ask-user-question.js";
|
|
7
7
|
import type { MemoryRestartContinuation } from "../utils/memory-restart.js";
|
|
8
8
|
import type { MemoryType } from "../memory/types.js";
|
|
@@ -156,6 +156,7 @@ export interface SessionServices {
|
|
|
156
156
|
unrevert?(): Promise<void>;
|
|
157
157
|
fork?(nodeId: string): Promise<void>;
|
|
158
158
|
memory(): Promise<string>;
|
|
159
|
+
global?(command: GlobalSlashCommand): Promise<string>;
|
|
159
160
|
refreshMemory?(): Promise<void>;
|
|
160
161
|
remember(type: MemoryType, text: string): Promise<string>;
|
|
161
162
|
forget(query: string): Promise<string>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
formatUsageSummary,
|
|
5
|
+
parseUsageEntries,
|
|
6
|
+
summarizeUsage
|
|
7
|
+
} from "./chunk-X442CJJH.js";
|
|
8
|
+
import "./chunk-ZKKVSR37.js";
|
|
9
|
+
export {
|
|
10
|
+
formatUsageSummary,
|
|
11
|
+
parseUsageEntries,
|
|
12
|
+
summarizeUsage
|
|
13
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
|
|
3
|
+
import "./chunk-ZKKVSR37.js";
|
|
4
|
+
|
|
5
|
+
// src/rpc/write-stream.ts
|
|
6
|
+
import { randomUUID } from "crypto";
|
|
7
|
+
var RpcWriteStreamBridge = class {
|
|
8
|
+
#output;
|
|
9
|
+
#pending;
|
|
10
|
+
constructor(output) {
|
|
11
|
+
this.#output = output;
|
|
12
|
+
}
|
|
13
|
+
get pendingId() {
|
|
14
|
+
return this.#pending?.id;
|
|
15
|
+
}
|
|
16
|
+
async preview(proposal, signal) {
|
|
17
|
+
if (this.#pending !== void 0) throw new Error("Another streamed write is still awaiting commit");
|
|
18
|
+
if (signal.aborted) throw signal.reason;
|
|
19
|
+
const id = randomUUID();
|
|
20
|
+
this.#output({
|
|
21
|
+
type: "write-start",
|
|
22
|
+
id,
|
|
23
|
+
path: proposal.path,
|
|
24
|
+
before: proposal.before,
|
|
25
|
+
totalBytes: Buffer.byteLength(proposal.after)
|
|
26
|
+
});
|
|
27
|
+
for (const delta of streamChunks(proposal.after)) this.#output({ type: "write-delta", id, delta });
|
|
28
|
+
this.#output({ type: "write-ready", id });
|
|
29
|
+
await new Promise((resolve, reject) => {
|
|
30
|
+
const onAbort = () => {
|
|
31
|
+
this.#output({ type: "write-cancelled", id });
|
|
32
|
+
this.#clear(id);
|
|
33
|
+
reject(signal.reason);
|
|
34
|
+
};
|
|
35
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
36
|
+
this.#pending = {
|
|
37
|
+
id,
|
|
38
|
+
resolve,
|
|
39
|
+
reject,
|
|
40
|
+
removeAbort: () => signal.removeEventListener("abort", onAbort)
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
commit(id) {
|
|
45
|
+
const pending = this.#pending;
|
|
46
|
+
if (pending === void 0 || pending.id !== id) throw new Error("Streamed write is no longer awaiting commit");
|
|
47
|
+
pending.removeAbort();
|
|
48
|
+
this.#pending = void 0;
|
|
49
|
+
pending.resolve();
|
|
50
|
+
}
|
|
51
|
+
dispose() {
|
|
52
|
+
const pending = this.#pending;
|
|
53
|
+
if (pending === void 0) return;
|
|
54
|
+
pending.removeAbort();
|
|
55
|
+
this.#pending = void 0;
|
|
56
|
+
pending.reject(new Error("Streamed write bridge disposed"));
|
|
57
|
+
}
|
|
58
|
+
#clear(id) {
|
|
59
|
+
if (this.#pending?.id !== id) return;
|
|
60
|
+
this.#pending.removeAbort();
|
|
61
|
+
this.#pending = void 0;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
function streamChunks(content, maxChars = 2048) {
|
|
65
|
+
if (!content) return [];
|
|
66
|
+
const chunks = [];
|
|
67
|
+
for (const line of content.match(/[^\n]*\n|[^\n]+$/g) ?? []) {
|
|
68
|
+
for (let offset = 0; offset < line.length; offset += maxChars) {
|
|
69
|
+
chunks.push(line.slice(offset, offset + maxChars));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return chunks;
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
RpcWriteStreamBridge,
|
|
76
|
+
streamChunks
|
|
77
|
+
};
|