flavor-code 1.2.16 → 1.2.17

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.
@@ -15,7 +15,7 @@ export interface AgentRunRequest {
15
15
  /** Messages supplied while a tool batch is running, injected before the next model call. */
16
16
  getSteeringMessages?(): readonly string[];
17
17
  }
18
- export type AgentErrorCode = ProviderErrorCode | "iteration_limit" | "incomplete_stream";
18
+ export type AgentErrorCode = ProviderErrorCode | "iteration_limit" | "incomplete_stream" | "empty_response";
19
19
  export interface AgentError {
20
20
  code: AgentErrorCode;
21
21
  message: string;
@@ -15,7 +15,7 @@ import {
15
15
  packageVersion,
16
16
  redactErrorText,
17
17
  transcriptReducer
18
- } from "./chunk-5SRARNAC.js";
18
+ } from "./chunk-QQCXJC4U.js";
19
19
  import "./chunk-IG4Z23CL.js";
20
20
  import {
21
21
  Box_default,
@@ -6539,7 +6539,8 @@ var RECOVERABLE_MODEL_ERRORS = /* @__PURE__ */ new Set([
6539
6539
  "network",
6540
6540
  "rate_limit",
6541
6541
  "unknown",
6542
- "incomplete_stream"
6542
+ "incomplete_stream",
6543
+ "empty_response"
6543
6544
  ]);
6544
6545
  function envMaxIterations() {
6545
6546
  const raw = process.env["FLAVOR_MAX_ITERATIONS"];
@@ -6733,6 +6734,12 @@ var AgentLoop = class {
6733
6734
  } finally {
6734
6735
  if (!completed && terminalError === void 0) {
6735
6736
  terminalError = { code: "incomplete_stream", message: "Provider stream ended without a done or error event" };
6737
+ } else if (completed && assistantText.trim().length === 0 && collectedToolCalls.length === 0) {
6738
+ completed = false;
6739
+ terminalError = {
6740
+ code: "empty_response",
6741
+ message: "Provider completed without visible text or tool calls"
6742
+ };
6736
6743
  }
6737
6744
  providerError = terminalError !== void 0;
6738
6745
  try {
@@ -6772,7 +6779,7 @@ var AgentLoop = class {
6772
6779
  totalCacheCreationTokens += usage.cacheCreationTokens ?? 0;
6773
6780
  yield { type: "usage", ...usage, totalInputTokens, totalOutputTokens };
6774
6781
  }
6775
- const providerProducedOutput = assistantText.length > 0 || collectedToolCalls.length > 0;
6782
+ const providerProducedOutput = assistantText.trim().length > 0 || collectedToolCalls.length > 0;
6776
6783
  if (terminalError?.code === "context_overflow" && !reactiveRetried && !providerProducedOutput && attempt < maxAttempts) {
6777
6784
  let compacted = false;
6778
6785
  try {
@@ -19755,7 +19762,7 @@ async function createProductionRuntime(options) {
19755
19762
  const messages = allMessages.slice(memoryLifecycle.messageStart ?? 0);
19756
19763
  const transcriptHash = memoryTranscriptHash(messages);
19757
19764
  if (memoryLifecycle.status === "completed" && memoryLifecycle.transcriptHash === transcriptHash) {
19758
- return "Task was already completed and evaluated for long-term memory.";
19765
+ return "This conversation segment was already evaluated for long-term memory.";
19759
19766
  }
19760
19767
  if (!manual && memoryBehavior.autoExtractPaused) {
19761
19768
  return "Automatic long-term-memory extraction is paused after repeated dismissals; use /finish, /remember, or an explicit \u201Cremember\u201D request to store memory manually.";
@@ -19763,7 +19770,7 @@ async function createProductionRuntime(options) {
19763
19770
  autoStoredContents.length = 0;
19764
19771
  const finalization = memoryCoordinator === void 0 || !config.memory.autoExtract || options.approvalPolicy === "deny" ? { evaluated: true, candidates: false, stored: 0 } : await memoryCoordinator.finalize(memoryLifecycle.taskId ?? sessionId, messages);
19765
19772
  if (!finalization.evaluated) {
19766
- return "Task memory evaluation failed and was not marked complete; retry /finish after checking diagnostics.";
19773
+ return "Long-term-memory evaluation failed; retry /finish after checking diagnostics.";
19767
19774
  }
19768
19775
  memoryLifecycle = {
19769
19776
  status: "completed",
@@ -19775,9 +19782,9 @@ async function createProductionRuntime(options) {
19775
19782
  await persist();
19776
19783
  if (finalization.candidates && finalization.stored > 0) {
19777
19784
  const storedText = autoStoredContents[0] ?? "a high-confidence memory";
19778
- return `Task completed. Stored high-confidence long-term memory directly: "${storedText}". Run /forget to remove it if undesired.`;
19785
+ return `Long-term memory updated. Stored high-confidence entry: "${storedText}". Run /forget to remove it if undesired.`;
19779
19786
  }
19780
- return finalization.candidates ? "Task completed. Review the generated long-term-memory candidates before anything is stored." : "Task completed; no durable long-term-memory candidates passed the threshold.";
19787
+ return finalization.candidates ? "Long-term-memory evaluation completed. Review the generated candidates before anything is stored." : "Long-term-memory evaluation completed; no durable candidates passed the threshold.";
19781
19788
  };
19782
19789
  let explicitMemoryRequest;
19783
19790
  let automaticMemoryTask = false;
@@ -19788,10 +19795,10 @@ async function createProductionRuntime(options) {
19788
19795
  timelineState = transcriptReducer(timelineState, { type: "submit", prompt });
19789
19796
  automaticMemoryTask = !prompt.startsWith("/") && harness.permissionProfile !== "d2c";
19790
19797
  if (automaticMemoryTask) memoryReviews.dismissAll();
19791
- if (!prompt.startsWith("/") && memoryLifecycle.status === "completed") {
19798
+ if (!prompt.startsWith("/")) {
19792
19799
  memoryLifecycle = {
19793
19800
  status: "active",
19794
- taskId: createMemoryTaskId(),
19801
+ taskId: memoryLifecycle.status === "completed" ? createMemoryTaskId() : memoryLifecycle.taskId ?? createMemoryTaskId(),
19795
19802
  messageStart: harness.main.context.snapshot().messages.length
19796
19803
  };
19797
19804
  }
@@ -19833,9 +19840,9 @@ async function createProductionRuntime(options) {
19833
19840
  }
19834
19841
  if (explicit === void 0 && automatic && event.payload.outcome === "completed" && memoryCoordinator !== void 0 && config.memory.autoExtract && options.approvalPolicy !== "deny" && !memoryBehavior.autoExtractPaused) {
19835
19842
  const result = await finalizeMemoryTask();
19836
- if (result.startsWith("Task memory evaluation failed")) {
19843
+ if (result.startsWith("Long-term-memory evaluation failed")) {
19837
19844
  emitOutput({ type: "notice", message: "Automatic long-term-memory evaluation failed; use /finish to retry after checking diagnostics." });
19838
- } else if (result.startsWith("Task completed. Review") || result.startsWith("Task completed. Stored")) {
19845
+ } else if (result.startsWith("Long-term-memory evaluation completed. Review") || result.startsWith("Long-term memory updated.")) {
19839
19846
  emitOutput({ type: "notice", message: result });
19840
19847
  }
19841
19848
  }
@@ -4,7 +4,7 @@ import {
4
4
  message,
5
5
  redactErrorText,
6
6
  redactSecrets
7
- } from "./chunk-5SRARNAC.js";
7
+ } from "./chunk-QQCXJC4U.js";
8
8
 
9
9
  // src/rpc/server.ts
10
10
  import { createInterface } from "readline";
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import { createRequire } from "node:module"; const require = createRequire(impor
3
3
  import {
4
4
  FlavorRpcServer,
5
5
  TraceRecorder
6
- } from "./chunk-PGS3M32Y.js";
6
+ } from "./chunk-YRIPE5K5.js";
7
7
  import {
8
8
  staticTaskLines
9
9
  } from "./chunk-KKIBYDJI.js";
@@ -22,7 +22,7 @@ import {
22
22
  packageVersion,
23
23
  redactErrorText,
24
24
  runPalBroker
25
- } from "./chunk-5SRARNAC.js";
25
+ } from "./chunk-QQCXJC4U.js";
26
26
  import {
27
27
  McpServerConfigSchema,
28
28
  McpServerNameSchema,
@@ -861,7 +861,7 @@ async function runInteractiveCli(props) {
861
861
  const [{ render, AlternateScreen }, { createElement }, { App }] = await Promise.all([
862
862
  import("./claude-ink-ORUA7GWG.js"),
863
863
  import("react"),
864
- import("./app-7ZCJ3UOI.js")
864
+ import("./app-F4P7RV2X.js")
865
865
  ]);
866
866
  const instance = await render(createElement(
867
867
  AlternateScreen,
@@ -6128,7 +6128,8 @@ var RECOVERABLE_MODEL_ERRORS = /* @__PURE__ */ new Set([
6128
6128
  "network",
6129
6129
  "rate_limit",
6130
6130
  "unknown",
6131
- "incomplete_stream"
6131
+ "incomplete_stream",
6132
+ "empty_response"
6132
6133
  ]);
6133
6134
  function envMaxIterations() {
6134
6135
  const raw = process.env["FLAVOR_MAX_ITERATIONS"];
@@ -6322,6 +6323,12 @@ var AgentLoop = class {
6322
6323
  } finally {
6323
6324
  if (!completed && terminalError === void 0) {
6324
6325
  terminalError = { code: "incomplete_stream", message: "Provider stream ended without a done or error event" };
6326
+ } else if (completed && assistantText.trim().length === 0 && collectedToolCalls.length === 0) {
6327
+ completed = false;
6328
+ terminalError = {
6329
+ code: "empty_response",
6330
+ message: "Provider completed without visible text or tool calls"
6331
+ };
6325
6332
  }
6326
6333
  providerError = terminalError !== void 0;
6327
6334
  try {
@@ -6361,7 +6368,7 @@ var AgentLoop = class {
6361
6368
  totalCacheCreationTokens += usage.cacheCreationTokens ?? 0;
6362
6369
  yield { type: "usage", ...usage, totalInputTokens, totalOutputTokens };
6363
6370
  }
6364
- const providerProducedOutput = assistantText.length > 0 || collectedToolCalls.length > 0;
6371
+ const providerProducedOutput = assistantText.trim().length > 0 || collectedToolCalls.length > 0;
6365
6372
  if (terminalError?.code === "context_overflow" && !reactiveRetried && !providerProducedOutput && attempt < maxAttempts) {
6366
6373
  let compacted = false;
6367
6374
  try {
@@ -23458,7 +23465,7 @@ async function createProductionRuntime(options) {
23458
23465
  const messages = allMessages.slice(memoryLifecycle.messageStart ?? 0);
23459
23466
  const transcriptHash = memoryTranscriptHash(messages);
23460
23467
  if (memoryLifecycle.status === "completed" && memoryLifecycle.transcriptHash === transcriptHash) {
23461
- return "Task was already completed and evaluated for long-term memory.";
23468
+ return "This conversation segment was already evaluated for long-term memory.";
23462
23469
  }
23463
23470
  if (!manual && memoryBehavior.autoExtractPaused) {
23464
23471
  return "Automatic long-term-memory extraction is paused after repeated dismissals; use /finish, /remember, or an explicit \u201Cremember\u201D request to store memory manually.";
@@ -23466,7 +23473,7 @@ async function createProductionRuntime(options) {
23466
23473
  autoStoredContents.length = 0;
23467
23474
  const finalization = memoryCoordinator === void 0 || !config.memory.autoExtract || options.approvalPolicy === "deny" ? { evaluated: true, candidates: false, stored: 0 } : await memoryCoordinator.finalize(memoryLifecycle.taskId ?? sessionId, messages);
23468
23475
  if (!finalization.evaluated) {
23469
- return "Task memory evaluation failed and was not marked complete; retry /finish after checking diagnostics.";
23476
+ return "Long-term-memory evaluation failed; retry /finish after checking diagnostics.";
23470
23477
  }
23471
23478
  memoryLifecycle = {
23472
23479
  status: "completed",
@@ -23478,9 +23485,9 @@ async function createProductionRuntime(options) {
23478
23485
  await persist();
23479
23486
  if (finalization.candidates && finalization.stored > 0) {
23480
23487
  const storedText = autoStoredContents[0] ?? "a high-confidence memory";
23481
- return `Task completed. Stored high-confidence long-term memory directly: "${storedText}". Run /forget to remove it if undesired.`;
23488
+ return `Long-term memory updated. Stored high-confidence entry: "${storedText}". Run /forget to remove it if undesired.`;
23482
23489
  }
23483
- return finalization.candidates ? "Task completed. Review the generated long-term-memory candidates before anything is stored." : "Task completed; no durable long-term-memory candidates passed the threshold.";
23490
+ return finalization.candidates ? "Long-term-memory evaluation completed. Review the generated candidates before anything is stored." : "Long-term-memory evaluation completed; no durable candidates passed the threshold.";
23484
23491
  };
23485
23492
  let explicitMemoryRequest;
23486
23493
  let automaticMemoryTask = false;
@@ -23491,10 +23498,10 @@ async function createProductionRuntime(options) {
23491
23498
  timelineState = transcriptReducer(timelineState, { type: "submit", prompt });
23492
23499
  automaticMemoryTask = !prompt.startsWith("/") && harness.permissionProfile !== "d2c";
23493
23500
  if (automaticMemoryTask) memoryReviews.dismissAll();
23494
- if (!prompt.startsWith("/") && memoryLifecycle.status === "completed") {
23501
+ if (!prompt.startsWith("/")) {
23495
23502
  memoryLifecycle = {
23496
23503
  status: "active",
23497
- taskId: createMemoryTaskId(),
23504
+ taskId: memoryLifecycle.status === "completed" ? createMemoryTaskId() : memoryLifecycle.taskId ?? createMemoryTaskId(),
23498
23505
  messageStart: harness.main.context.snapshot().messages.length
23499
23506
  };
23500
23507
  }
@@ -23536,9 +23543,9 @@ async function createProductionRuntime(options) {
23536
23543
  }
23537
23544
  if (explicit === void 0 && automatic && event.payload.outcome === "completed" && memoryCoordinator !== void 0 && config.memory.autoExtract && options.approvalPolicy !== "deny" && !memoryBehavior.autoExtractPaused) {
23538
23545
  const result = await finalizeMemoryTask();
23539
- if (result.startsWith("Task memory evaluation failed")) {
23546
+ if (result.startsWith("Long-term-memory evaluation failed")) {
23540
23547
  emitOutput({ type: "notice", message: "Automatic long-term-memory evaluation failed; use /finish to retry after checking diagnostics." });
23541
- } else if (result.startsWith("Task completed. Review") || result.startsWith("Task completed. Stored")) {
23548
+ } else if (result.startsWith("Long-term-memory evaluation completed. Review") || result.startsWith("Long-term memory updated.")) {
23542
23549
  emitOutput({ type: "notice", message: result });
23543
23550
  }
23544
23551
  }
package/dist/sdk/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  FlavorRpcServer,
5
5
  TraceRecordSchema,
6
6
  TraceRecorder
7
- } from "../chunk-PGS3M32Y.js";
7
+ } from "../chunk-YRIPE5K5.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-5SRARNAC.js";
16
+ } from "../chunk-QQCXJC4U.js";
17
17
  import "../chunk-IG4Z23CL.js";
18
18
  import "../chunk-RQTYHUMK.js";
19
19
  import "../chunk-S32JRDZK.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flavor-code",
3
- "version": "1.2.16",
3
+ "version": "1.2.17",
4
4
  "author": "YachuanWzh",
5
5
  "type": "module",
6
6
  "publishConfig": {