flavor-code 1.2.20 → 1.3.2
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 +18 -11
- package/README.zh-CN.md +18 -11
- package/dist/agent/loop.d.ts +11 -1
- package/dist/{app-5D5RSGQX.js → app-F6FEEF46.js} +1 -1
- package/dist/{chunk-A7PMQ22O.js → chunk-DFSMJ5SX.js} +1 -1
- package/dist/{chunk-AXLUVJKC.js → chunk-Q5EQ4T3F.js} +1797 -771
- package/dist/cli.js +21 -5
- package/dist/context/manager.d.ts +32 -0
- package/dist/desktop/main.js +3548 -1392
- package/dist/desktop/pals-broker-entry.js +1308 -0
- package/dist/desktop/preload.cjs +91 -2
- package/dist/desktop-renderer/assets/index--vSisKu7.css +1 -0
- package/dist/desktop-renderer/assets/index-ByWADjgv.js +154 -0
- package/dist/desktop-renderer/assets/interactive-terminal-BAwIPsif.js +35 -0
- package/dist/desktop-renderer/index.html +3 -3
- package/dist/goal/classifier.d.ts +2 -2
- package/dist/goal/orchestrator.d.ts +2 -1
- package/dist/goal/types.d.ts +33 -0
- package/dist/harness/invariants.d.ts +4 -0
- package/dist/harness/journal.d.ts +109 -0
- package/dist/harness/local.d.ts +6 -2
- package/dist/pals/broker-cli.d.ts +8 -0
- package/dist/permissions/engine.d.ts +2 -0
- package/dist/permissions/policy.d.ts +38 -0
- package/dist/plugins/types.d.ts +22 -2
- package/dist/production.d.ts +9 -1
- package/dist/sdk/index.js +2 -2
- package/dist/session/store.d.ts +30 -2
- package/dist/tools/runtime.d.ts +5 -0
- package/dist/tools/types.d.ts +3 -0
- package/dist/ui/session.d.ts +13 -0
- package/package.json +9 -5
- package/dist/desktop-renderer/assets/index-BmXr_vX3.js +0 -151
- package/dist/desktop-renderer/assets/index-DEL8gXBO.css +0 -1
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<meta name="color-scheme" content="light" />
|
|
7
|
-
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' http://127.0.0.1:* http://localhost:* ws://127.0.0.1:* ws://localhost:*; frame-src http://127.0.0.1:* http://localhost:*" />
|
|
7
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' http://127.0.0.1:* http://localhost:* http://[::1]:* ws://127.0.0.1:* ws://localhost:* ws://[::1]:*; frame-src http://127.0.0.1:* http://localhost:* http://[::1]:*" />
|
|
8
8
|
<title>Flavor Code</title>
|
|
9
|
-
<script type="module" crossorigin src="./assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="./assets/index
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-ByWADjgv.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="./assets/index--vSisKu7.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModelRegistry } from "../models/registry.js";
|
|
2
|
-
import { type AggregatedOutcome, type EvidencePacket, type Gap, type Plan } from "./types.js";
|
|
2
|
+
import { type AggregatedOutcome, type EvidencePacket, type Gap, type HostVerificationEvidence, type Plan } from "./types.js";
|
|
3
3
|
export interface ClassifierOptions {
|
|
4
4
|
registry: ModelRegistry;
|
|
5
5
|
modelId: string;
|
|
@@ -9,4 +9,4 @@ export interface ClassifierOptions {
|
|
|
9
9
|
}
|
|
10
10
|
export declare function runClassifier(evidence: EvidencePacket, plan: Plan, options: ClassifierOptions): Promise<AggregatedOutcome>;
|
|
11
11
|
export declare function computeFingerprint(gaps: Gap[]): string;
|
|
12
|
-
export declare function collectEvidence(workspace: string, objective: string, finalResponse: string, priorGaps: string): Promise<EvidencePacket>;
|
|
12
|
+
export declare function collectEvidence(workspace: string, objective: string, finalResponse: string, priorGaps: string, contractHash?: string, hostVerification?: HostVerificationEvidence): Promise<EvidencePacket>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentEvent } from "../agent/types.js";
|
|
2
2
|
import type { ModelRegistry } from "../models/registry.js";
|
|
3
|
-
import type { GoalRuntimeEvent, GoalState } from "./types.js";
|
|
3
|
+
import type { GoalRuntimeEvent, GoalState, HostVerificationEvidence } from "./types.js";
|
|
4
4
|
export interface GoalOrchestratorOptions {
|
|
5
5
|
workspace: string;
|
|
6
6
|
registry: ModelRegistry;
|
|
@@ -22,6 +22,7 @@ export interface GoalOrchestratorOptions {
|
|
|
22
22
|
persistence?: {
|
|
23
23
|
save(state: GoalState): Promise<void>;
|
|
24
24
|
};
|
|
25
|
+
verifyHost?(signal: AbortSignal): Promise<HostVerificationEvidence>;
|
|
25
26
|
}
|
|
26
27
|
export declare class GoalOrchestrator {
|
|
27
28
|
#private;
|
package/dist/goal/types.d.ts
CHANGED
|
@@ -88,6 +88,22 @@ export interface EvidencePacket {
|
|
|
88
88
|
planFile: string | null;
|
|
89
89
|
finalResponse: string;
|
|
90
90
|
priorGaps: string;
|
|
91
|
+
contractHash: string;
|
|
92
|
+
workspaceDiffHash: string;
|
|
93
|
+
workspaceStatus: string[];
|
|
94
|
+
hostVerification?: HostVerificationEvidence;
|
|
95
|
+
}
|
|
96
|
+
export interface HostVerificationEvidence {
|
|
97
|
+
passed: boolean;
|
|
98
|
+
summary: string;
|
|
99
|
+
commands: Array<{
|
|
100
|
+
command: string;
|
|
101
|
+
args: string[];
|
|
102
|
+
exitCode: number | null;
|
|
103
|
+
stdout?: string;
|
|
104
|
+
stderr?: string;
|
|
105
|
+
truncated?: boolean;
|
|
106
|
+
}>;
|
|
91
107
|
}
|
|
92
108
|
export declare const GoalStateSchema: z.ZodObject<{
|
|
93
109
|
id: z.ZodString;
|
|
@@ -141,6 +157,23 @@ export declare const GoalStateSchema: z.ZodObject<{
|
|
|
141
157
|
}, z.core.$strict>>;
|
|
142
158
|
gapFingerprint: z.ZodString;
|
|
143
159
|
stallStreak: z.ZodNumber;
|
|
160
|
+
contractHash: z.ZodString;
|
|
161
|
+
evidenceRounds: z.ZodArray<z.ZodObject<{
|
|
162
|
+
round: z.ZodNumber;
|
|
163
|
+
workspaceDiffHash: z.ZodString;
|
|
164
|
+
hostVerification: z.ZodOptional<z.ZodObject<{
|
|
165
|
+
passed: z.ZodBoolean;
|
|
166
|
+
summary: z.ZodString;
|
|
167
|
+
commands: z.ZodArray<z.ZodObject<{
|
|
168
|
+
command: z.ZodString;
|
|
169
|
+
args: z.ZodArray<z.ZodString>;
|
|
170
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
171
|
+
stdout: z.ZodOptional<z.ZodString>;
|
|
172
|
+
stderr: z.ZodOptional<z.ZodString>;
|
|
173
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
174
|
+
}, z.core.$strict>>;
|
|
175
|
+
}, z.core.$strict>>;
|
|
176
|
+
}, z.core.$strict>>;
|
|
144
177
|
createdAt: z.ZodString;
|
|
145
178
|
updatedAt: z.ZodString;
|
|
146
179
|
}, z.core.$strict>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HarnessJournalRecord } from "./journal.js";
|
|
2
|
+
/** Mechanical replay invariants owned by the durable harness package. */
|
|
3
|
+
export declare function harnessInvariantViolations(records: readonly HarnessJournalRecord[]): string[];
|
|
4
|
+
export declare function assertHarnessInvariants(records: readonly HarnessJournalRecord[]): void;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const HARNESS_JOURNAL_VERSION: 1;
|
|
3
|
+
declare const EventTypeSchema: z.ZodEnum<{
|
|
4
|
+
"model.completed": "model.completed";
|
|
5
|
+
"model.requested": "model.requested";
|
|
6
|
+
"queue.acked": "queue.acked";
|
|
7
|
+
"queue.admitted": "queue.admitted";
|
|
8
|
+
"queue.claimed": "queue.claimed";
|
|
9
|
+
"queue.released": "queue.released";
|
|
10
|
+
"recovery.completed": "recovery.completed";
|
|
11
|
+
"savepoint.created": "savepoint.created";
|
|
12
|
+
"tool.completed": "tool.completed";
|
|
13
|
+
"tool.interrupted": "tool.interrupted";
|
|
14
|
+
"tool.started": "tool.started";
|
|
15
|
+
"turn.completed": "turn.completed";
|
|
16
|
+
"turn.interrupted": "turn.interrupted";
|
|
17
|
+
"turn.started": "turn.started";
|
|
18
|
+
}>;
|
|
19
|
+
declare const JournalRecordSchema: z.ZodObject<{
|
|
20
|
+
version: z.ZodLiteral<1>;
|
|
21
|
+
sequence: z.ZodNumber;
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
timestamp: z.ZodString;
|
|
24
|
+
type: z.ZodEnum<{
|
|
25
|
+
"model.completed": "model.completed";
|
|
26
|
+
"model.requested": "model.requested";
|
|
27
|
+
"queue.acked": "queue.acked";
|
|
28
|
+
"queue.admitted": "queue.admitted";
|
|
29
|
+
"queue.claimed": "queue.claimed";
|
|
30
|
+
"queue.released": "queue.released";
|
|
31
|
+
"recovery.completed": "recovery.completed";
|
|
32
|
+
"savepoint.created": "savepoint.created";
|
|
33
|
+
"tool.completed": "tool.completed";
|
|
34
|
+
"tool.interrupted": "tool.interrupted";
|
|
35
|
+
"tool.started": "tool.started";
|
|
36
|
+
"turn.completed": "turn.completed";
|
|
37
|
+
"turn.interrupted": "turn.interrupted";
|
|
38
|
+
"turn.started": "turn.started";
|
|
39
|
+
}>;
|
|
40
|
+
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
41
|
+
previousHash: z.ZodNullable<z.ZodString>;
|
|
42
|
+
hash: z.ZodString;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
export type HarnessJournalEventType = z.infer<typeof EventTypeSchema>;
|
|
45
|
+
export type HarnessJournalRecord = z.infer<typeof JournalRecordSchema>;
|
|
46
|
+
export interface DurableQueueItem<T = unknown> {
|
|
47
|
+
id: string;
|
|
48
|
+
kind: "steer" | "followUp";
|
|
49
|
+
payload: T;
|
|
50
|
+
admittedAt: string;
|
|
51
|
+
recovered: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface IncompleteToolCall {
|
|
54
|
+
id: string;
|
|
55
|
+
tool: string;
|
|
56
|
+
retrySafe: boolean;
|
|
57
|
+
inputHash: string;
|
|
58
|
+
}
|
|
59
|
+
export interface HarnessRecovery<T = unknown> {
|
|
60
|
+
queue: DurableQueueItem<T>[];
|
|
61
|
+
incompleteTools: IncompleteToolCall[];
|
|
62
|
+
incompleteModelIds: string[];
|
|
63
|
+
interruptedTurnIds: string[];
|
|
64
|
+
lastSavepoint?: {
|
|
65
|
+
id: string;
|
|
66
|
+
phase: string;
|
|
67
|
+
configHash: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export interface HarnessJournalOptions {
|
|
71
|
+
workspace: string;
|
|
72
|
+
sessionId: string;
|
|
73
|
+
now?(): string;
|
|
74
|
+
maxBytes?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Crash-consistent, hash-chained execution journal. Queue admission uses a
|
|
78
|
+
* synchronous fsync because returning from steer/followUp is the durability
|
|
79
|
+
* boundary: once the UI says "queued", the prompt must survive a hard crash.
|
|
80
|
+
*/
|
|
81
|
+
export declare class HarnessJournal {
|
|
82
|
+
#private;
|
|
83
|
+
constructor(options: HarnessJournalOptions);
|
|
84
|
+
get path(): string;
|
|
85
|
+
get records(): readonly HarnessJournalRecord[];
|
|
86
|
+
admitQueue<T>(kind: "steer" | "followUp", payload: T): string;
|
|
87
|
+
claimQueue(id: string): void;
|
|
88
|
+
ackQueue(id: string): void;
|
|
89
|
+
releaseQueue(id: string, reason: string): void;
|
|
90
|
+
startTurn(config: unknown, prompt: unknown): string;
|
|
91
|
+
completeTurn(id: string): void;
|
|
92
|
+
interruptTurn(id: string, reason: string): void;
|
|
93
|
+
startModel(input: {
|
|
94
|
+
agent: string;
|
|
95
|
+
model: string;
|
|
96
|
+
iteration: number;
|
|
97
|
+
attempt: number;
|
|
98
|
+
messages: unknown;
|
|
99
|
+
}): string;
|
|
100
|
+
completeModel(id: string, completed: boolean, error?: string): void;
|
|
101
|
+
startTool(tool: string, input: unknown, retrySafe: boolean): string;
|
|
102
|
+
completeTool(id: string, result: unknown): void;
|
|
103
|
+
interruptTool(id: string, reason: string): void;
|
|
104
|
+
savepoint(phase: string, config: unknown): string;
|
|
105
|
+
recover<T = unknown>(): HarnessRecovery<T>;
|
|
106
|
+
markRecoveryComplete(recovery: HarnessRecovery): void;
|
|
107
|
+
}
|
|
108
|
+
export declare function hashJson(value: unknown): string;
|
|
109
|
+
export {};
|
package/dist/harness/local.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { AgentLoop } from "../agent/loop.js";
|
|
1
|
+
import { AgentLoop, type AgentLoopOptions } from "../agent/loop.js";
|
|
2
2
|
import type { TaskNode } from "../agent/planner.js";
|
|
3
3
|
import type { HallucinationGuard } from "../hallucination/guard.js";
|
|
4
4
|
import type { PermissionMode, PermissionProfile } from "../permissions/engine.js";
|
|
5
|
+
import type { CompiledPermissionPolicy } from "../permissions/policy.js";
|
|
5
6
|
import type { ContextManager } from "../context/manager.js";
|
|
6
7
|
import type { HookBus } from "../hooks/bus.js";
|
|
7
8
|
import type { ModelRegistry } from "../models/registry.js";
|
|
8
9
|
import type { ModelTool } from "../models/types.js";
|
|
9
|
-
import { ToolRuntime, type ApprovalCallback } from "../tools/runtime.js";
|
|
10
|
+
import { ToolRuntime, type ApprovalCallback, type ToolRuntimeOptions } from "../tools/runtime.js";
|
|
10
11
|
import type { ToolDefinition } from "../tools/types.js";
|
|
11
12
|
export interface LocalHarnessOptions {
|
|
12
13
|
registry: ModelRegistry;
|
|
@@ -25,6 +26,9 @@ export interface LocalHarnessOptions {
|
|
|
25
26
|
/** When true, non-destructive tools skip the approval callback. Destructive tools still require confirmation. */
|
|
26
27
|
loopMode?: boolean;
|
|
27
28
|
afterToolSuccess?(tool: string, paths: readonly string[], input: unknown, output: unknown, context: import("../tools/types.js").ToolContext): Promise<readonly string[]>;
|
|
29
|
+
toolJournal?: ToolRuntimeOptions["journal"];
|
|
30
|
+
permissionPolicy?: CompiledPermissionPolicy;
|
|
31
|
+
modelJournal?: AgentLoopOptions["modelJournal"];
|
|
28
32
|
}
|
|
29
33
|
export interface HarnessProfile {
|
|
30
34
|
modelId: string;
|
|
@@ -14,5 +14,13 @@ export interface EnsurePalBrokerOptions {
|
|
|
14
14
|
retryDelayMs?: number;
|
|
15
15
|
startBroker?: () => Promise<void>;
|
|
16
16
|
}
|
|
17
|
+
export interface SpawnPalBrokerProcessOptions {
|
|
18
|
+
address: string;
|
|
19
|
+
executable: string;
|
|
20
|
+
args: readonly string[];
|
|
21
|
+
environment?: NodeJS.ProcessEnv;
|
|
22
|
+
}
|
|
23
|
+
/** Start a detached broker entry under an embedder-selected runtime. */
|
|
24
|
+
export declare function spawnPalBrokerProcess(options: SpawnPalBrokerProcessOptions): Promise<void>;
|
|
17
25
|
export declare function runPalBroker(options: RunPalBrokerOptions): Promise<RunningPalBroker>;
|
|
18
26
|
export declare function ensurePalBrokerRunning(options: EnsurePalBrokerOptions): Promise<void>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type LegacyPermissionMode, type PermissionMode } from "../config/schema.js";
|
|
2
|
+
import type { CompiledPermissionPolicy } from "./policy.js";
|
|
2
3
|
export type { PermissionMode } from "../config/schema.js";
|
|
3
4
|
export type PermissionDecision = {
|
|
4
5
|
decision: "allow" | "deny" | "ask";
|
|
@@ -22,6 +23,7 @@ export interface PermissionEngineOptions {
|
|
|
22
23
|
workspace: string;
|
|
23
24
|
mode?: PermissionMode | LegacyPermissionMode;
|
|
24
25
|
profile?: PermissionProfile;
|
|
26
|
+
policy?: CompiledPermissionPolicy;
|
|
25
27
|
}
|
|
26
28
|
export type ToolCategory = "control" | "read" | "write" | "destructive" | "shell" | "network" | "unknown";
|
|
27
29
|
export declare function getToolCategory(name: string): ToolCategory;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { PermissionDecision, PermissionRequest } from "./engine.js";
|
|
3
|
+
declare const RuleSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
decision: z.ZodEnum<{
|
|
6
|
+
allow: "allow";
|
|
7
|
+
ask: "ask";
|
|
8
|
+
deny: "deny";
|
|
9
|
+
}>;
|
|
10
|
+
prefix: z.ZodArray<z.ZodString>;
|
|
11
|
+
tool: z.ZodOptional<z.ZodString>;
|
|
12
|
+
agent: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
main: "main";
|
|
14
|
+
subagent: "subagent";
|
|
15
|
+
}>>;
|
|
16
|
+
justification: z.ZodOptional<z.ZodString>;
|
|
17
|
+
match: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
|
|
18
|
+
notMatch: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
export type PermissionRule = z.infer<typeof RuleSchema> & {
|
|
21
|
+
source: string;
|
|
22
|
+
tier: "managed" | "user" | "project" | "local" | "session";
|
|
23
|
+
};
|
|
24
|
+
export interface PermissionPolicyLoadOptions {
|
|
25
|
+
workspace: string;
|
|
26
|
+
home: string;
|
|
27
|
+
managedPath?: string;
|
|
28
|
+
sessionRules?: readonly z.input<typeof RuleSchema>[];
|
|
29
|
+
}
|
|
30
|
+
export declare class CompiledPermissionPolicy {
|
|
31
|
+
#private;
|
|
32
|
+
readonly diagnostics: readonly string[];
|
|
33
|
+
constructor(rules: readonly PermissionRule[], diagnostics?: readonly string[]);
|
|
34
|
+
get rules(): readonly PermissionRule[];
|
|
35
|
+
decide(request: PermissionRequest): PermissionDecision | undefined;
|
|
36
|
+
}
|
|
37
|
+
export declare function loadPermissionPolicy(options: PermissionPolicyLoadOptions): Promise<CompiledPermissionPolicy>;
|
|
38
|
+
export {};
|
package/dist/plugins/types.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ export declare const PluginManifestSchema: z.ZodObject<{
|
|
|
10
10
|
permissions: z.ZodArray<z.ZodEnum<{
|
|
11
11
|
"filesystem:read": "filesystem:read";
|
|
12
12
|
"filesystem:write": "filesystem:write";
|
|
13
|
+
network: "network";
|
|
14
|
+
process: "process";
|
|
15
|
+
"runtime:in-process": "runtime:in-process";
|
|
13
16
|
}>>;
|
|
14
17
|
contributes: z.ZodObject<{
|
|
15
18
|
commands: z.ZodArray<z.ZodObject<{
|
|
@@ -74,8 +77,9 @@ export interface PluginCommandContext {
|
|
|
74
77
|
}
|
|
75
78
|
export type PluginCommandHandler = (args: readonly string[], context: PluginCommandContext) => unknown | Promise<unknown>;
|
|
76
79
|
/**
|
|
77
|
-
* A deliberately narrow registration surface.
|
|
78
|
-
*
|
|
80
|
+
* A deliberately narrow registration surface. Production runs plugins in an
|
|
81
|
+
* isolated Worker/vm realm by default. Hosts that explicitly opt into legacy
|
|
82
|
+
* in-process activation must treat the plugin as fully trusted Node.js code.
|
|
79
83
|
*/
|
|
80
84
|
export interface PluginContext {
|
|
81
85
|
readonly signal: AbortSignal;
|
|
@@ -107,6 +111,18 @@ export interface LoadedPlugin {
|
|
|
107
111
|
readonly version: string;
|
|
108
112
|
readonly source: PluginSource;
|
|
109
113
|
readonly root: string;
|
|
114
|
+
readonly fingerprint: string;
|
|
115
|
+
readonly sandboxed: boolean;
|
|
116
|
+
readonly permissions: readonly PluginPermission[];
|
|
117
|
+
}
|
|
118
|
+
export interface PluginTrustRequest {
|
|
119
|
+
readonly name: string;
|
|
120
|
+
readonly version: string;
|
|
121
|
+
readonly source: PluginSource;
|
|
122
|
+
readonly root: string;
|
|
123
|
+
readonly fingerprint: string;
|
|
124
|
+
readonly sandboxed: boolean;
|
|
125
|
+
readonly permissions: readonly PluginPermission[];
|
|
110
126
|
}
|
|
111
127
|
export interface PluginRegistrationCallbacks {
|
|
112
128
|
command(name: string, command: PluginCommandHandler, description?: string): PluginDisposer;
|
|
@@ -137,4 +153,8 @@ export interface PluginHostOptions {
|
|
|
137
153
|
/** When true, plugin modules run in an isolated Worker/vm realm. Only relative
|
|
138
154
|
* modules inside the plugin root and RPC-backed contribution calls are available. */
|
|
139
155
|
sandbox?: boolean;
|
|
156
|
+
/** Trust gate evaluated against the content fingerprint before activation. */
|
|
157
|
+
authorizePlugin?: (request: PluginTrustRequest) => boolean | Promise<boolean>;
|
|
158
|
+
/** Legacy in-process execution requires both a manifest capability and trust approval. */
|
|
159
|
+
requireInProcessTrust?: boolean;
|
|
140
160
|
}
|
package/dist/production.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { ToolDefinition } from "./tools/types.js";
|
|
|
9
9
|
import { FlavorSession, type SessionOutput, type SessionServices } from "./ui/session.js";
|
|
10
10
|
import { type TranscriptState } from "./ui/transcript.js";
|
|
11
11
|
import { MemoryReviewBridge } from "./memory/review.js";
|
|
12
|
-
import { type JobSnapshot } from "./jobs/registry.js";
|
|
12
|
+
import { type JobReadResult, type JobSnapshot } from "./jobs/registry.js";
|
|
13
13
|
import { type PalClientLike } from "./pals/tools.js";
|
|
14
14
|
/**
|
|
15
15
|
* Per-step shutdown budget. On Windows a hung child-process pipe, named pipe,
|
|
@@ -37,10 +37,17 @@ export interface ProductionRuntimeOptions {
|
|
|
37
37
|
shutdownStepTimeoutMs?: number;
|
|
38
38
|
/** Additional tools provided by embedders (e.g. desktop-only D2C tools). */
|
|
39
39
|
extraTools?: readonly ToolDefinition<unknown>[];
|
|
40
|
+
/** Compatibility seam for explicitly trusted legacy plugins. Product
|
|
41
|
+
* runtimes default to Worker/vm isolation. */
|
|
42
|
+
pluginSandbox?: boolean;
|
|
40
43
|
/** Explicitly opt into CLI-local collaboration. Omit for print/RPC/eval callers. */
|
|
41
44
|
collaboration?: {
|
|
42
45
|
instanceId: string;
|
|
43
46
|
alias?: string;
|
|
47
|
+
/** Optional integrations degrade to diagnostics instead of blocking runtime startup. */
|
|
48
|
+
optional?: boolean;
|
|
49
|
+
/** Embedder-owned broker starter, used by Electron where process.argv points at the desktop entry. */
|
|
50
|
+
startBroker?: (address: string) => Promise<void>;
|
|
44
51
|
client?: PalClientLike;
|
|
45
52
|
createClient?: (input: {
|
|
46
53
|
instanceId: string;
|
|
@@ -63,6 +70,7 @@ export interface ProductionRuntime {
|
|
|
63
70
|
restoredTranscript: TranscriptState;
|
|
64
71
|
jobs: {
|
|
65
72
|
list(): readonly JobSnapshot[];
|
|
73
|
+
read(id: string, owner: string, cursor?: number): JobReadResult;
|
|
66
74
|
subscribe(listener: (jobs: readonly JobSnapshot[]) => void): () => void;
|
|
67
75
|
};
|
|
68
76
|
dispose(): Promise<void>;
|
package/dist/sdk/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
FlavorRpcServer,
|
|
5
5
|
TraceRecordSchema,
|
|
6
6
|
TraceRecorder
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-DFSMJ5SX.js";
|
|
8
8
|
import {
|
|
9
9
|
AgentMessageQueue,
|
|
10
10
|
DockerExecutionEnvironment,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
WorkspaceCheckpointStore,
|
|
14
14
|
buildDockerInvocation,
|
|
15
15
|
createProductionRuntime
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-Q5EQ4T3F.js";
|
|
17
17
|
import "../chunk-IG4Z23CL.js";
|
|
18
18
|
import "../chunk-RQTYHUMK.js";
|
|
19
19
|
import "../chunk-S32JRDZK.js";
|
package/dist/session/store.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type TranscriptState } from "../ui/transcript.js";
|
|
3
3
|
import type { ModelContent } from "../models/types.js";
|
|
4
|
-
export declare const SESSION_VERSION:
|
|
4
|
+
export declare const SESSION_VERSION: 4;
|
|
5
5
|
export declare const DEFAULT_MAX_SESSION_BYTES: number;
|
|
6
6
|
export declare const SessionDocumentSchema: z.ZodObject<{
|
|
7
7
|
sessionId: z.ZodString;
|
|
@@ -93,12 +93,31 @@ export declare const SessionDocumentSchema: z.ZodObject<{
|
|
|
93
93
|
finalizedAt: z.ZodOptional<z.ZodString>;
|
|
94
94
|
transcriptHash: z.ZodOptional<z.ZodString>;
|
|
95
95
|
}, z.core.$strict>>;
|
|
96
|
-
version: z.ZodLiteral<
|
|
96
|
+
version: z.ZodLiteral<4>;
|
|
97
97
|
conversation: z.ZodObject<{
|
|
98
98
|
compact: z.ZodOptional<z.ZodObject<{
|
|
99
99
|
summary: z.ZodString;
|
|
100
100
|
compactedAt: z.ZodString;
|
|
101
101
|
}, z.core.$strict>>;
|
|
102
|
+
epoch: z.ZodOptional<z.ZodObject<{
|
|
103
|
+
version: z.ZodLiteral<1>;
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
startedAt: z.ZodString;
|
|
106
|
+
stableMessages: z.ZodArray<z.ZodObject<{
|
|
107
|
+
role: z.ZodLiteral<"system">;
|
|
108
|
+
content: z.ZodString;
|
|
109
|
+
cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
+
}, z.core.$strict>>;
|
|
111
|
+
sources: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
112
|
+
stableSourceHash: z.ZodString;
|
|
113
|
+
}, z.core.$strict>>;
|
|
114
|
+
visibilityLog: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
role: z.ZodLiteral<"system">;
|
|
117
|
+
content: z.ZodString;
|
|
118
|
+
admittedAt: z.ZodString;
|
|
119
|
+
scope: z.ZodLiteral<"run">;
|
|
120
|
+
}, z.core.$strict>>>;
|
|
102
121
|
messages: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
103
122
|
toolCallId: z.ZodOptional<z.ZodString>;
|
|
104
123
|
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -108,6 +127,15 @@ export declare const SessionDocumentSchema: z.ZodObject<{
|
|
|
108
127
|
}, z.core.$strict>>>;
|
|
109
128
|
role: z.ZodLiteral<"user">;
|
|
110
129
|
content: z.ZodType<ModelContent, unknown, z.core.$ZodTypeInternals<ModelContent, unknown>>;
|
|
130
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
131
|
+
toolCallId: z.ZodOptional<z.ZodString>;
|
|
132
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
133
|
+
id: z.ZodString;
|
|
134
|
+
name: z.ZodString;
|
|
135
|
+
input: z.ZodUnknown;
|
|
136
|
+
}, z.core.$strict>>>;
|
|
137
|
+
role: z.ZodLiteral<"system">;
|
|
138
|
+
content: z.ZodString;
|
|
111
139
|
}, z.core.$strict>, z.ZodObject<{
|
|
112
140
|
toolCallId: z.ZodOptional<z.ZodString>;
|
|
113
141
|
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
package/dist/tools/runtime.d.ts
CHANGED
|
@@ -20,6 +20,11 @@ export interface ToolRuntimeOptions {
|
|
|
20
20
|
/** Inline tool-result content budgets. */
|
|
21
21
|
outputLimits?: Partial<ToolOutputLimits>;
|
|
22
22
|
afterSuccess?(tool: string, paths: readonly string[], input: unknown, output: unknown, context: ToolContext): Promise<readonly string[]>;
|
|
23
|
+
journal?: {
|
|
24
|
+
start(tool: string, input: unknown, retrySafe: boolean): string;
|
|
25
|
+
complete(id: string, result: ToolResult): void;
|
|
26
|
+
interrupt(id: string, reason: string): void;
|
|
27
|
+
};
|
|
23
28
|
}
|
|
24
29
|
export interface ToolOutputLimits {
|
|
25
30
|
perToolChars: number;
|
package/dist/tools/types.d.ts
CHANGED
|
@@ -91,6 +91,9 @@ export interface ToolDefinition<T, O = unknown> {
|
|
|
91
91
|
modelStrict?: boolean;
|
|
92
92
|
/** Declared read-only: allowed without approval, same as Read/Glob/Grep (including plan mode). */
|
|
93
93
|
readOnly?: boolean;
|
|
94
|
+
/** Explicitly safe to retry after an interrupted process. Defaults to false;
|
|
95
|
+
* read-only tools are treated as retry-safe by the durable harness. */
|
|
96
|
+
retrySafe?: boolean;
|
|
94
97
|
paths(input: T): string[];
|
|
95
98
|
/**
|
|
96
99
|
* Optional short human-readable parameter summary, rendered dimmed next to the tool name.
|
package/dist/ui/session.d.ts
CHANGED
|
@@ -89,6 +89,7 @@ export interface PalSessionServices {
|
|
|
89
89
|
list(verbose: boolean): Promise<unknown>;
|
|
90
90
|
rename(alias: string): Promise<unknown>;
|
|
91
91
|
info(target: string): Promise<unknown>;
|
|
92
|
+
sendChat?(target: string, message: string): Promise<unknown>;
|
|
92
93
|
sendTask(target: string, goal: string): Promise<unknown>;
|
|
93
94
|
startCoWork(target: string, goal: string): Promise<unknown>;
|
|
94
95
|
coWorkStatus(coWorkId?: string): Promise<unknown>;
|
|
@@ -137,6 +138,7 @@ export interface SessionServices {
|
|
|
137
138
|
clearContext(): void | Promise<void>;
|
|
138
139
|
checkpoint?(label?: string): Promise<SessionTreeNode>;
|
|
139
140
|
tree?(): readonly SessionTreeNode[];
|
|
141
|
+
historyLeaf?(): string | null;
|
|
140
142
|
rewind?(nodeId: string): Promise<void>;
|
|
141
143
|
unrevert?(): Promise<void>;
|
|
142
144
|
fork?(nodeId: string): Promise<void>;
|
|
@@ -156,6 +158,17 @@ export interface SessionServices {
|
|
|
156
158
|
login(): Promise<string>;
|
|
157
159
|
logout(): Promise<string>;
|
|
158
160
|
pals?: PalSessionServices;
|
|
161
|
+
durableQueue?: {
|
|
162
|
+
recover(): readonly {
|
|
163
|
+
id: string;
|
|
164
|
+
kind: "steer" | "followUp";
|
|
165
|
+
payload: unknown;
|
|
166
|
+
}[];
|
|
167
|
+
admit(kind: "steer" | "followUp", payload: unknown): string;
|
|
168
|
+
claim(id: string): void;
|
|
169
|
+
ack(id: string): void;
|
|
170
|
+
release(id: string, reason: string): void;
|
|
171
|
+
};
|
|
159
172
|
}
|
|
160
173
|
export interface MultimodalSessionInput {
|
|
161
174
|
text: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flavor-code",
|
|
3
|
-
"version": "1.2
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"author": "YachuanWzh",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"desktop:pack": "npm run build && electron-builder --win --dir",
|
|
46
46
|
"desktop:dist": "npm run build && electron-builder --win nsis",
|
|
47
47
|
"test": "vitest run",
|
|
48
|
+
"test:reliability": "vitest run tests/harness/journal.test.ts tests/context/manager.test.ts tests/session/store.test.ts tests/permissions/policy.test.ts tests/goal/classifier.test.ts tests/goal/orchestrator.test.ts",
|
|
48
49
|
"test:watch": "vitest",
|
|
49
50
|
"test:desktop:e2e": "npm run build:desktop && node tests/desktop/electron-app.e2e.mjs",
|
|
50
51
|
"typecheck": "tsc --noEmit",
|
|
@@ -56,10 +57,11 @@
|
|
|
56
57
|
"appId": "dev.flavorcode.desktop",
|
|
57
58
|
"productName": "Flavor Code",
|
|
58
59
|
"asar": true,
|
|
59
|
-
"asarUnpack": [
|
|
60
|
-
"dist/desktop/pixel-worker.js",
|
|
61
|
-
"dist/desktop/plugin-worker-entry.js"
|
|
62
|
-
|
|
60
|
+
"asarUnpack": [
|
|
61
|
+
"dist/desktop/pixel-worker.js",
|
|
62
|
+
"dist/desktop/plugin-worker-entry.js",
|
|
63
|
+
"dist/desktop/pals-broker-entry.js"
|
|
64
|
+
],
|
|
63
65
|
"icon": "assets/icon",
|
|
64
66
|
"directories": {
|
|
65
67
|
"output": "release"
|
|
@@ -94,6 +96,8 @@
|
|
|
94
96
|
"@anthropic-ai/sdk": "^0.111.0",
|
|
95
97
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
96
98
|
"@vscode/ripgrep": "^1.18.0",
|
|
99
|
+
"@xterm/addon-fit": "^0.11.0",
|
|
100
|
+
"@xterm/xterm": "^6.0.0",
|
|
97
101
|
"bidi-js": "^1.0.3",
|
|
98
102
|
"chalk": "^5.6.2",
|
|
99
103
|
"commander": "^15.0.0",
|