flavor-code 1.3.10 → 1.3.11

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.
@@ -11,6 +11,10 @@ export interface StructuredOutputOptions<T> {
11
11
  name: string;
12
12
  description: string;
13
13
  schema: z.ZodType<T>;
14
+ /** Provider-facing schema when runtime validation was derived from another source (for example MCP). */
15
+ modelInputSchema?: Record<string, unknown>;
16
+ /** Preserve the original tool's provider strictness during argument repair. */
17
+ modelStrict?: boolean;
14
18
  retry?: StructuredOutputRetryPolicy;
15
19
  beforeAttempt?(attempt: StructuredOutputAttempt): void | Promise<void>;
16
20
  afterAttempt?(attempt: StructuredOutputAttemptResult): void | Promise<void>;
@@ -72,6 +76,10 @@ export declare class StructuredOutputError extends Error {
72
76
  }
73
77
  export declare function withStructuredOutput<T>(options: StructuredOutputOptions<T>): StructuredModel<T>;
74
78
  export declare function strictJsonSchema(schema: z.ZodType<unknown>): Record<string, unknown>;
79
+ /** Runtime-facing JSON Schema before provider strictness rewrites optional fields. */
80
+ export declare function jsonSchemaFromZod(schema: z.ZodType<unknown>): Record<string, unknown>;
81
+ /** Recursively adapts an existing JSON Schema for providers that require strict function tools. */
82
+ export declare function strictJsonSchemaObject(schema: Record<string, unknown>): Record<string, unknown>;
75
83
  /**
76
84
  * Extract the first JSON object or array from free-form model text (plain JSON,
77
85
  * fenced ```json blocks, or JSON embedded in prose). Returns undefined when no
@@ -80,10 +88,11 @@ export declare function strictJsonSchema(schema: z.ZodType<unknown>): Record<str
80
88
  export declare function extractJsonObject(text: string): unknown;
81
89
  /**
82
90
  * Best-effort type coercion guided by a JSON schema. Some providers serialize
83
- * typed fields as strings (`"10"` for an integer). This rewrites string→number /
84
- * string→boolean where the schema demands those types, recursing into object
85
- * properties and anyOf branches. Values already matching the schema are
86
- * returned unchanged, so a valid payload is a no-op.
91
+ * typed fields as strings (`"10"` for an integer) or collapse a single-item
92
+ * array to its item (`"main"` instead of `["main"]`). This rewrites those
93
+ * provider representations where the schema demands another type, recursing
94
+ * into object properties and anyOf branches. Values already matching the
95
+ * schema are returned unchanged, so a valid payload is a no-op.
87
96
  */
88
97
  export declare function coerceByJsonSchema(value: unknown, schema: unknown): unknown;
89
98
  export declare function modelToolFromZod(name: string, description: string, schema: z.ZodType<unknown>): ModelTool;
@@ -23,6 +23,8 @@ export interface ProductionRuntimeOptions {
23
23
  environment?: NodeJS.ProcessEnv;
24
24
  output(event: SessionOutput): void;
25
25
  onApprovalChange?(): void;
26
+ /** Called whenever the active registerTool-managed command set changes. */
27
+ onToolsChange?(): void;
26
28
  /** Non-interactive callers must deny requests instead of waiting for input. */
27
29
  approvalPolicy?: "prompt" | "deny";
28
30
  /** Allow a protocol host to resolve tool approvals without enabling other interactive UI bridges. */
package/dist/sdk/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  FlavorRpcServer,
5
5
  TraceRecordSchema,
6
6
  TraceRecorder
7
- } from "../chunk-T2ARW6CZ.js";
7
+ } from "../chunk-JZ5FVBET.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-Y3DPUAEJ.js";
16
+ } from "../chunk-IGFN2DM5.js";
17
17
  import "../chunk-IG4Z23CL.js";
18
18
  import "../chunk-RQTYHUMK.js";
19
19
  import "../chunk-S32JRDZK.js";
@@ -61,5 +61,10 @@ export declare class ToolRuntime {
61
61
  label(call: ToolCall): string | undefined;
62
62
  hint(call: ToolCall): string | undefined;
63
63
  execute(call: ToolCall, context: ToolContext): Promise<ToolResult>;
64
+ /**
65
+ * Validates a call and applies the same conservative provider-argument
66
+ * normalization used by the agent loop before falling back to repair.
67
+ */
68
+ normalize(call: ToolCall): ToolInputValidation;
64
69
  callPresentation(call: ToolCall): import("./types.js").ToolPresentation | undefined;
65
70
  }
@@ -1,4 +1,4 @@
1
- export declare const MVP_COMMANDS: readonly ["model", "init", "config", "login", "logout", "permissions", "skills", "plugins", "hooks", "tasks", "finish", "compact", "clear", "help", "exit", "audit", "usage", "loop", "goal", "evolve", "mcp", "commit", "review", "ide", "memory", "remember", "forget", "forget-cold", "checkpoint", "tree", "rewind", "unrevert", "fork", "pals", "chat", "co-work"];
1
+ export declare const MVP_COMMANDS: readonly ["model", "init", "config", "login", "logout", "permissions", "skills", "plugins", "hooks", "tasks", "finish", "compact", "clear", "help", "exit", "audit", "usage", "loop", "goal", "evolve", "mcp", "commit", "review", "ide", "memory", "remember", "forget", "forget-cold", "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";
@@ -57,6 +57,10 @@ export type SlashCommand = {
57
57
  name: "skill";
58
58
  skill: string;
59
59
  prompt: string;
60
+ } | {
61
+ name: "managed-tool";
62
+ tool: string;
63
+ input: string;
60
64
  } | {
61
65
  name: "loop";
62
66
  goal: string;
@@ -87,7 +91,7 @@ export type SlashCommand = {
87
91
  target: string;
88
92
  goal: string;
89
93
  } | CoWorkSlashCommand | {
90
- name: Exclude<(typeof MVP_COMMANDS)[number], "model" | "permissions" | "audit" | "loop" | "goal" | "evolve" | "commit" | "review" | "mcp" | "remember" | "forget" | "checkpoint" | "rewind" | "fork" | "pals" | "chat" | "co-work">;
94
+ name: Exclude<(typeof MVP_COMMANDS)[number], "model" | "permissions" | "audit" | "loop" | "goal" | "evolve" | "commit" | "review" | "mcp" | "remember" | "forget" | "checkpoint" | "rewind" | "fork" | "pals" | "chat" | "co-work" | "tool">;
91
95
  } | {
92
96
  name: "audit";
93
97
  toolFilter?: string | undefined;
@@ -103,6 +107,6 @@ export type SlashCommand = {
103
107
  command: string;
104
108
  message: string;
105
109
  };
106
- export declare function parseSlashCommand(input: string, dynamicCommands?: readonly string[], skillCommands?: readonly string[]): SlashCommand | null;
110
+ export declare function parseSlashCommand(input: string, dynamicCommands?: readonly string[], skillCommands?: readonly string[], managedTools?: readonly string[]): SlashCommand | null;
107
111
  import { type PermissionMode } from "../config/schema.js";
108
112
  import { type MemoryType } from "../memory/types.js";
@@ -153,6 +153,11 @@ export interface SessionServices {
153
153
  description?: string;
154
154
  }[];
155
155
  runPluginCommand(name: string, args: readonly string[], signal: AbortSignal): Promise<unknown>;
156
+ managedToolCommands(): readonly {
157
+ name: string;
158
+ description?: string;
159
+ }[];
160
+ runManagedTool(name: string, input: string, signal: AbortSignal): Promise<unknown>;
156
161
  output(event: SessionOutput): void;
157
162
  questions: QuestionBridge;
158
163
  login(): Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flavor-code",
3
- "version": "1.3.10",
3
+ "version": "1.3.11",
4
4
  "author": "YachuanWzh",
5
5
  "type": "module",
6
6
  "publishConfig": {