flavor-code 1.2.8 → 1.2.10
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 +47 -0
- package/README.zh-CN.md +42 -0
- package/dist/agent/loop.d.ts +4 -0
- package/dist/agent/types.d.ts +10 -0
- package/dist/{app-NL2O75LQ.js → app-USAFQVSX.js} +379 -12
- package/dist/{chunk-NVLYFU6P.js → chunk-F2HMO5Q2.js} +28 -11
- package/dist/{chunk-6X5PHLZI.js → chunk-G32MCAZA.js} +1 -1
- package/dist/{chunk-N2S7USST.js → chunk-RQTYHUMK.js} +2 -1
- package/dist/{chunk-ED4R7ZCP.js → chunk-WGYNTR4Q.js} +1820 -492
- package/dist/{chunk-MBLAXTUP.js → chunk-XFCJXRJ2.js} +15 -5
- package/dist/{claude-ink-WPWPEL5A.js → claude-ink-ORUA7GWG.js} +2 -2
- package/dist/cli.js +9 -8
- package/dist/config/protected-file.d.ts +6 -0
- package/dist/context/manager.d.ts +2 -0
- package/dist/context/workspace-instructions.d.ts +10 -0
- package/dist/desktop/main.js +10528 -2912
- package/dist/desktop/pixel-worker.js +73 -0
- package/dist/desktop/preload.cjs +80 -2
- package/dist/desktop-renderer/assets/index-BVxdOZFW.js +151 -0
- package/dist/desktop-renderer/assets/index-CPxt3vFY.css +1 -0
- package/dist/desktop-renderer/index.html +3 -4
- package/dist/harness/local.d.ts +4 -1
- package/dist/jobs/registry.d.ts +48 -0
- package/dist/{load-RN3WBX4C.js → load-6ZMEBHSG.js} +1 -1
- package/dist/permissions/engine.d.ts +7 -0
- package/dist/production.d.ts +13 -1
- package/dist/sdk/index.js +4 -4
- package/dist/terminal/service.d.ts +57 -0
- package/dist/tools/files.d.ts +10 -0
- package/dist/tools/jobs.d.ts +4 -0
- package/dist/tools/runtime.d.ts +2 -0
- package/dist/tools/shell.d.ts +13 -3
- package/dist/tools/terminal.d.ts +3 -0
- package/dist/tools/types.d.ts +76 -4
- package/dist/tools/web.d.ts +53 -0
- package/package.json +13 -2
- package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +752 -1
- package/dist/desktop-renderer/assets/index-57tXtXhI.js +0 -143
- package/dist/desktop-renderer/assets/index-Cm_ktmXm.css +0 -1
package/dist/tools/runtime.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface ToolRuntimeOptions {
|
|
|
19
19
|
workspace?: string;
|
|
20
20
|
/** Inline tool-result content budgets. */
|
|
21
21
|
outputLimits?: Partial<ToolOutputLimits>;
|
|
22
|
+
afterSuccess?(tool: string, paths: readonly string[], input: unknown, output: unknown, context: ToolContext): Promise<readonly string[]>;
|
|
22
23
|
}
|
|
23
24
|
export interface ToolOutputLimits {
|
|
24
25
|
perToolChars: number;
|
|
@@ -55,4 +56,5 @@ export declare class ToolRuntime {
|
|
|
55
56
|
label(call: ToolCall): string | undefined;
|
|
56
57
|
hint(call: ToolCall): string | undefined;
|
|
57
58
|
execute(call: ToolCall, context: ToolContext): Promise<ToolResult>;
|
|
59
|
+
callPresentation(call: ToolCall): import("./types.js").ToolPresentation | undefined;
|
|
58
60
|
}
|
package/dist/tools/shell.d.ts
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ToolDefinition } from "./types.js";
|
|
3
3
|
import type { ExecutionEnvironment } from "../execution/types.js";
|
|
4
|
+
import type { JobRegistry } from "../jobs/registry.js";
|
|
4
5
|
export declare const DEFAULT_MAX_OUTPUT_BYTES = 1048576;
|
|
6
|
+
export declare const DEFAULT_SHELL_TIMEOUT_MS: number;
|
|
5
7
|
declare const ShellInput: z.ZodObject<{
|
|
6
8
|
command: z.ZodString;
|
|
7
9
|
args: z.ZodArray<z.ZodString>;
|
|
8
10
|
cwd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
11
|
timeoutMs: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
12
|
+
background: z.ZodOptional<z.ZodBoolean>;
|
|
10
13
|
}, z.core.$strip>;
|
|
11
14
|
export interface ShellToolOptions {
|
|
12
15
|
maxOutputBytes?: number;
|
|
16
|
+
defaultTimeoutMs?: number;
|
|
13
17
|
executionEnvironment?: ExecutionEnvironment;
|
|
18
|
+
jobs?: JobRegistry;
|
|
14
19
|
}
|
|
15
20
|
export interface TruncationMetadata {
|
|
16
21
|
truncated: boolean;
|
|
@@ -29,9 +34,14 @@ export interface ShellResult {
|
|
|
29
34
|
};
|
|
30
35
|
terminationReason: "timeout" | "cancelled" | null;
|
|
31
36
|
}
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
export interface ShellBackgroundResult extends ShellResult {
|
|
38
|
+
jobId: string;
|
|
39
|
+
state: "running";
|
|
40
|
+
command: string;
|
|
41
|
+
}
|
|
42
|
+
type ShellTool = Omit<ToolDefinition<z.infer<typeof ShellInput>, ShellResult | ShellBackgroundResult>, "execute"> & {
|
|
43
|
+
execute(input: z.infer<typeof ShellInput>, signal: AbortSignal, context?: import("./types.js").ToolContext): Promise<ShellResult | ShellBackgroundResult>;
|
|
34
44
|
};
|
|
35
45
|
export declare function createShellTool(workspace: string, options?: ShellToolOptions): ShellTool;
|
|
36
|
-
export declare function executeShell(root: string, input: z.infer<typeof ShellInput>, cancellation: AbortSignal, maxBytes: number): Promise<ShellResult>;
|
|
46
|
+
export declare function executeShell(root: string, input: z.infer<typeof ShellInput>, cancellation: AbortSignal, maxBytes: number, onOutput?: (stream: "stdout" | "stderr", text: string) => void): Promise<ShellResult>;
|
|
37
47
|
export {};
|
package/dist/tools/types.d.ts
CHANGED
|
@@ -14,14 +14,75 @@ export interface FileChangePresentation {
|
|
|
14
14
|
added: number;
|
|
15
15
|
removed: number;
|
|
16
16
|
lines: FileDiffLine[];
|
|
17
|
+
/** Additional files changed by the same atomic multi-file operation. */
|
|
18
|
+
relatedChanges?: readonly FileChangePresentation[];
|
|
17
19
|
}
|
|
18
|
-
export
|
|
20
|
+
export interface ChangeSetPresentation {
|
|
21
|
+
kind: "changeset";
|
|
22
|
+
files: readonly {
|
|
23
|
+
path: string;
|
|
24
|
+
operation: "create" | "update" | "delete";
|
|
25
|
+
added: number;
|
|
26
|
+
removed: number;
|
|
27
|
+
}[];
|
|
28
|
+
}
|
|
29
|
+
export interface GenericToolPresentation {
|
|
30
|
+
kind: "generic";
|
|
31
|
+
title: string;
|
|
32
|
+
summary?: string;
|
|
33
|
+
details?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface TerminalToolPresentation {
|
|
36
|
+
kind: "terminal";
|
|
37
|
+
variant?: "command" | "terminal";
|
|
38
|
+
title: string;
|
|
39
|
+
command?: string;
|
|
40
|
+
stdout?: string;
|
|
41
|
+
stderr?: string;
|
|
42
|
+
exitCode?: number | null;
|
|
43
|
+
state?: "running" | "completed" | "failed" | "cancelled";
|
|
44
|
+
truncated?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface WebToolPresentation {
|
|
47
|
+
kind: "web";
|
|
48
|
+
title: string;
|
|
49
|
+
url?: string;
|
|
50
|
+
summary?: string;
|
|
51
|
+
items?: readonly {
|
|
52
|
+
title: string;
|
|
53
|
+
url: string;
|
|
54
|
+
snippet?: string;
|
|
55
|
+
}[];
|
|
56
|
+
}
|
|
57
|
+
export interface JobToolPresentation {
|
|
58
|
+
kind: "job";
|
|
59
|
+
action: "start" | "list" | "read" | "wait" | "kill";
|
|
60
|
+
id?: string;
|
|
61
|
+
jobKind?: string;
|
|
62
|
+
label?: string;
|
|
63
|
+
state?: "running" | "completed" | "failed" | "cancelled";
|
|
64
|
+
exitCode?: number | null;
|
|
65
|
+
error?: string;
|
|
66
|
+
output?: string;
|
|
67
|
+
cursor?: number;
|
|
68
|
+
truncated?: boolean;
|
|
69
|
+
jobs?: readonly {
|
|
70
|
+
id: string;
|
|
71
|
+
kind: string;
|
|
72
|
+
label: string;
|
|
73
|
+
state: "running" | "completed" | "failed" | "cancelled";
|
|
74
|
+
exitCode?: number | null;
|
|
75
|
+
}[];
|
|
76
|
+
}
|
|
77
|
+
export type ToolPresentation = ChangeSetPresentation | FileChangePresentation | GenericToolPresentation | TerminalToolPresentation | WebToolPresentation | JobToolPresentation;
|
|
19
78
|
export declare function withToolPresentation<T extends object>(output: T, presentation: ToolPresentation): T;
|
|
20
|
-
export declare function getToolPresentation(output: unknown):
|
|
21
|
-
export interface ToolDefinition<T> {
|
|
79
|
+
export declare function getToolPresentation(output: unknown): FileChangePresentation | undefined;
|
|
80
|
+
export interface ToolDefinition<T, O = unknown> {
|
|
22
81
|
name: string;
|
|
23
82
|
description: string;
|
|
24
83
|
inputSchema: z.ZodType<T>;
|
|
84
|
+
/** Optional validation for the canonical value produced by execute. */
|
|
85
|
+
outputSchema?: z.ZodType<O>;
|
|
25
86
|
/** Restrict a tool to selected agent roles. Omit to expose it to both roles. */
|
|
26
87
|
agents?: readonly ToolContext["agent"][];
|
|
27
88
|
/** Optional provider-facing JSON Schema when it must differ from runtime validation. */
|
|
@@ -34,8 +95,14 @@ export interface ToolDefinition<T> {
|
|
|
34
95
|
* Must return plain text (no ANSI escapes). Return undefined or an empty string to omit the hint.
|
|
35
96
|
*/
|
|
36
97
|
summarize?(input: T): string | undefined;
|
|
98
|
+
/** Stable, model-facing serialization. Runtime output budgets are applied to this text. */
|
|
99
|
+
renderForModel?(output: O, input: T): string;
|
|
100
|
+
/** Renderer-neutral presentation available as soon as the call starts. */
|
|
101
|
+
presentCall?(input: T): ToolPresentation | undefined;
|
|
102
|
+
/** Renderer-neutral presentation of a completed call. */
|
|
103
|
+
presentResult?(output: O, input: T): ToolPresentation | undefined;
|
|
37
104
|
permissions?(input: T): ToolPermissionMetadata;
|
|
38
|
-
execute(input: T, signal: AbortSignal): Promise<
|
|
105
|
+
execute(input: T, signal: AbortSignal, context?: ToolContext): Promise<O>;
|
|
39
106
|
}
|
|
40
107
|
export interface ToolCall {
|
|
41
108
|
name: string;
|
|
@@ -43,12 +110,17 @@ export interface ToolCall {
|
|
|
43
110
|
}
|
|
44
111
|
export interface ToolContext {
|
|
45
112
|
agent: "main" | "subagent";
|
|
113
|
+
ownerId?: string;
|
|
46
114
|
signal?: AbortSignal;
|
|
47
115
|
}
|
|
48
116
|
export interface ToolResult {
|
|
49
117
|
ok: boolean;
|
|
50
118
|
output?: unknown;
|
|
119
|
+
/** Bounded model-facing content when the tool opts into the standard protocol. */
|
|
120
|
+
content?: string;
|
|
51
121
|
presentation?: ToolPresentation;
|
|
122
|
+
/** Context discovered as a consequence of this successful call. */
|
|
123
|
+
additionalContext?: readonly string[];
|
|
52
124
|
error?: {
|
|
53
125
|
code: string;
|
|
54
126
|
message: string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ToolDefinition } from "./types.js";
|
|
3
|
+
declare const WebFetchInput: z.ZodObject<{
|
|
4
|
+
url: z.ZodString;
|
|
5
|
+
timeoutMs: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
6
|
+
maxBytes: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
declare const WebSearchInput: z.ZodObject<{
|
|
9
|
+
query: z.ZodString;
|
|
10
|
+
maxResults: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export interface WebFetchResult {
|
|
13
|
+
url: string;
|
|
14
|
+
status: number;
|
|
15
|
+
contentType: string;
|
|
16
|
+
content: string;
|
|
17
|
+
truncated: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface WebSearchResult {
|
|
20
|
+
title: string;
|
|
21
|
+
url: string;
|
|
22
|
+
snippet: string;
|
|
23
|
+
}
|
|
24
|
+
export interface WebSearchResponse {
|
|
25
|
+
query: string;
|
|
26
|
+
results: WebSearchResult[];
|
|
27
|
+
}
|
|
28
|
+
export interface WebSearchProvider {
|
|
29
|
+
search(query: string, maxResults: number, signal: AbortSignal): Promise<readonly WebSearchResult[]>;
|
|
30
|
+
}
|
|
31
|
+
export declare function createWebFetchTool(): ToolDefinition<z.infer<typeof WebFetchInput>, WebFetchResult>;
|
|
32
|
+
export declare function createWebSearchTool(provider?: WebSearchProvider): ToolDefinition<z.infer<typeof WebSearchInput>, WebSearchResponse>;
|
|
33
|
+
type WebFetcher = (initialUrl: string, options: {
|
|
34
|
+
signal: AbortSignal;
|
|
35
|
+
timeoutMs: number;
|
|
36
|
+
maxBytes: number;
|
|
37
|
+
rawHtml?: boolean;
|
|
38
|
+
}) => Promise<WebFetchResult>;
|
|
39
|
+
export declare function createDefaultWebSearchProvider(fetcher?: WebFetcher): WebSearchProvider;
|
|
40
|
+
export declare function fetchPublic(initialUrl: string, options: {
|
|
41
|
+
signal: AbortSignal;
|
|
42
|
+
timeoutMs: number;
|
|
43
|
+
maxBytes: number;
|
|
44
|
+
rawHtml?: boolean;
|
|
45
|
+
}): Promise<WebFetchResult>;
|
|
46
|
+
export declare function isBlockedResolvedAddress(input: string, hostname: string): boolean;
|
|
47
|
+
export declare function isBlockedAddress(input: string, options?: {
|
|
48
|
+
allowBenchmarkCarrier?: boolean;
|
|
49
|
+
}): boolean;
|
|
50
|
+
export declare function htmlToText(html: string): string;
|
|
51
|
+
export declare function parseDuckDuckGo(html: string): WebSearchResult[];
|
|
52
|
+
export declare function parseBing(html: string): WebSearchResult[];
|
|
53
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flavor-code",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
4
4
|
"author": "YachuanWzh",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -46,14 +46,19 @@
|
|
|
46
46
|
"desktop:dist": "npm run build && electron-builder --win nsis",
|
|
47
47
|
"test": "vitest run",
|
|
48
48
|
"test:watch": "vitest",
|
|
49
|
+
"test:desktop:e2e": "npm run build:desktop && node tests/desktop/electron-app.e2e.mjs",
|
|
49
50
|
"typecheck": "tsc --noEmit",
|
|
50
51
|
"smoke:install": "node scripts/smoke-install.mjs",
|
|
52
|
+
"smoke:d2c-worker": "npm run build:desktop:main && node scripts/smoke-d2c-worker.mjs",
|
|
51
53
|
"prepack": "npm run build"
|
|
52
54
|
},
|
|
53
55
|
"build": {
|
|
54
56
|
"appId": "dev.flavorcode.desktop",
|
|
55
57
|
"productName": "Flavor Code",
|
|
56
58
|
"asar": true,
|
|
59
|
+
"asarUnpack": [
|
|
60
|
+
"dist/desktop/pixel-worker.js"
|
|
61
|
+
],
|
|
57
62
|
"icon": "assets/icon",
|
|
58
63
|
"directories": {
|
|
59
64
|
"output": "release"
|
|
@@ -97,7 +102,10 @@
|
|
|
97
102
|
"ink": "^7.1.0",
|
|
98
103
|
"lodash-es": "^4.17.23",
|
|
99
104
|
"marked": "^16.4.2",
|
|
105
|
+
"node-pty": "^1.1.0",
|
|
100
106
|
"openai": "^6.46.0",
|
|
107
|
+
"pixelmatch": "^7.2.0",
|
|
108
|
+
"pngjs": "^7.0.0",
|
|
101
109
|
"react": "^19.2.7",
|
|
102
110
|
"react-dom": "^19.2.7",
|
|
103
111
|
"semver": "^7.7.4",
|
|
@@ -110,12 +118,14 @@
|
|
|
110
118
|
},
|
|
111
119
|
"devDependencies": {
|
|
112
120
|
"@types/node": "^26.1.1",
|
|
121
|
+
"@types/pngjs": "^6.0.5",
|
|
113
122
|
"@types/react": "^19.2.17",
|
|
114
123
|
"@types/react-dom": "^19.2.3",
|
|
115
124
|
"@types/vscode": "1.95.0",
|
|
116
125
|
"@vscode/vsce": "3.9.2",
|
|
117
126
|
"electron": "^42.7.0",
|
|
118
127
|
"electron-builder": "^26.15.3",
|
|
128
|
+
"playwright-core": "^1.62.1",
|
|
119
129
|
"sharp": "^0.35.3",
|
|
120
130
|
"tsup": "^8.5.1",
|
|
121
131
|
"vite": "^8.1.5",
|
|
@@ -124,6 +134,7 @@
|
|
|
124
134
|
"allowScripts": {
|
|
125
135
|
"electron-winstaller@5.4.0": true,
|
|
126
136
|
"esbuild@0.27.7": true,
|
|
127
|
-
"electron@42.7.0": true
|
|
137
|
+
"electron@42.7.0": true,
|
|
138
|
+
"node-pty@1.1.0": true
|
|
128
139
|
}
|
|
129
140
|
}
|