flavor-code 1.3.4 → 1.3.6

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.
@@ -1,7 +1,14 @@
1
1
  import type { z } from "zod";
2
2
  import { type HookDecision, type HookEvent, type HookEventName, type HookHandler, type HookHandlerOptions, type ShellHookHandler } from "./types.js";
3
+ export interface HookBusOptions {
4
+ /** Stable runtime context attached to every handler-facing event. */
5
+ eventContext?: () => Readonly<Record<string, unknown>>;
6
+ eventId?: () => string;
7
+ now?: () => string;
8
+ }
3
9
  export declare class HookBus {
4
10
  #private;
11
+ constructor(options?: HookBusOptions);
5
12
  registerPayloadSchema(type: HookEventName, schema: z.ZodType<Record<string, unknown>>): () => void;
6
13
  on(type: HookEventName, handler: HookHandler | ShellHookHandler, options?: HookHandlerOptions): () => void;
7
14
  hasListeners(type: HookEventName): boolean;
package/dist/sdk/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  FlavorRpcServer,
5
5
  TraceRecordSchema,
6
6
  TraceRecorder
7
- } from "../chunk-RDBTC35M.js";
7
+ } from "../chunk-ZCEUFSHA.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-YKSMZDUZ.js";
16
+ } from "../chunk-BR3CWUYR.js";
17
17
  import "../chunk-IG4Z23CL.js";
18
18
  import "../chunk-RQTYHUMK.js";
19
19
  import "../chunk-S32JRDZK.js";
@@ -23,6 +23,9 @@ export type Question = z.infer<typeof QuestionSchema>;
23
23
  export interface AskUserQuestionHandler {
24
24
  (questions: readonly Question[], signal: AbortSignal): Promise<Record<number, string>>;
25
25
  }
26
+ export interface QuestionRelay {
27
+ (questions: readonly Question[], signal: AbortSignal): Promise<Record<number, string> | undefined>;
28
+ }
26
29
  /**
27
30
  * Extracts answers a hook-relayed UI (e.g. the Flavor Island app) returned for
28
31
  * an AskUserQuestion PermissionRequest. The decision's updatedInput carries the
@@ -38,7 +41,7 @@ export declare function hookAnswersFromUpdatedInput(updatedInput: unknown, quest
38
41
  */
39
42
  export declare class QuestionBridge {
40
43
  #private;
41
- constructor(onChange?: () => void);
44
+ constructor(onChange?: () => void, relay?: QuestionRelay);
42
45
  get pending(): readonly Question[] | undefined;
43
46
  ask(questions: readonly Question[], signal: AbortSignal): Promise<Record<number, string>>;
44
47
  answer(answers: Record<number, string>): void;
@@ -112,6 +112,8 @@ export interface ToolDefinition<T, O = unknown> {
112
112
  execute(input: T, signal: AbortSignal, context?: ToolContext): Promise<O>;
113
113
  }
114
114
  export interface ToolCall {
115
+ /** Provider call identity, preserved across lifecycle hooks when available. */
116
+ id?: string;
115
117
  name: string;
116
118
  input: unknown;
117
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flavor-code",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "author": "YachuanWzh",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -31,7 +31,7 @@
31
31
  "scripts": {
32
32
  "build": "npm run build:icons && npm run build:cli && npm run build:desktop",
33
33
  "build:icons": "node scripts/build-icons.mjs",
34
- "build:cli": "tsup && tsc -p tsconfig.sdk.json && node -e \"require('fs').cpSync('src/init/astgraph','dist/astgraph',{recursive:true})\"",
34
+ "build:cli": "tsup && tsc -p tsconfig.sdk.json && node -e \"require('fs').cpSync('src/init/astgraph','dist/astgraph',{recursive:true})\"",
35
35
  "build:desktop": "npm run build:desktop:main && npm run build:desktop:renderer",
36
36
  "build:desktop:main": "tsup --config tsup.desktop.config.ts",
37
37
  "build:desktop:renderer": "vite build --config vite.desktop.config.ts",