flavor-code 1.3.17 → 1.3.18

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.
@@ -18,7 +18,7 @@ import {
18
18
  thinkingWindow,
19
19
  transcriptReducer,
20
20
  withTimeout
21
- } from "./chunk-BKOOYSGH.js";
21
+ } from "./chunk-PF457XCH.js";
22
22
  import "./chunk-CIVPKHF4.js";
23
23
  import "./chunk-HJOCNKPN.js";
24
24
  import {
@@ -4,7 +4,7 @@ import {
4
4
  message,
5
5
  redactErrorText,
6
6
  redactSecrets
7
- } from "./chunk-BKOOYSGH.js";
7
+ } from "./chunk-PF457XCH.js";
8
8
 
9
9
  // src/rpc/server.ts
10
10
  import { createInterface } from "readline";
@@ -3616,6 +3616,7 @@ var HELP = [
3616
3616
  "/chat <alias-or-uuid> <goal> send a task that starts on the receiving pal",
3617
3617
  "/co-work <pal> <goal> | status [id] | cancel <id> [reason]"
3618
3618
  ].join("\n");
3619
+ var MAX_STOP_DENIALS = 2;
3619
3620
  var FlavorSession = class {
3620
3621
  #services;
3621
3622
  #active;
@@ -3626,6 +3627,7 @@ var FlavorSession = class {
3626
3627
  #submissionTail = Promise.resolve();
3627
3628
  #coWorkEventTail = Promise.resolve();
3628
3629
  #pendingSubmissions = 0;
3630
+ #stopDenials = 0;
3629
3631
  #closePromise;
3630
3632
  #queue = new AgentMessageQueue();
3631
3633
  #queuedSubmissions = { steer: [], followUp: [] };
@@ -3827,6 +3829,7 @@ var FlavorSession = class {
3827
3829
  return operation;
3828
3830
  }
3829
3831
  async #runSubmissionChain(initialSubmission) {
3832
+ this.#stopDenials = 0;
3830
3833
  const pending = [initialSubmission];
3831
3834
  let initial = true;
3832
3835
  while (pending.length > 0) {
@@ -3920,8 +3923,9 @@ var FlavorSession = class {
3920
3923
  this.#active = void 0;
3921
3924
  this.#activeSubmission = void 0;
3922
3925
  if (submission.coWorkPlanningKey !== void 0) this.#finishActivePlanning(submission.coWorkPlanningKey);
3926
+ let stopDecision;
3923
3927
  try {
3924
- await this.#services.hooks.emit({
3928
+ stopDecision = await this.#services.hooks.emit({
3925
3929
  version: 1,
3926
3930
  type: "Stop",
3927
3931
  payload: {
@@ -3936,6 +3940,21 @@ var FlavorSession = class {
3936
3940
  } catch {
3937
3941
  }
3938
3942
  }
3943
+ try {
3944
+ if (stopDecision?.decision === "deny" && typeof stopDecision.reason === "string" && stopDecision.reason.length > 0 && !this.#closed && outcome !== "cancelled" && outcome !== "denied") {
3945
+ if (this.#stopDenials < MAX_STOP_DENIALS) {
3946
+ this.#stopDenials += 1;
3947
+ const text = `[stop-guard] A Stop hook vetoed ending this turn (continuation ${this.#stopDenials}/${MAX_STOP_DENIALS}). It reported:
3948
+ ${stopDecision.reason}
3949
+ Address this now (for example run the required verification or fix), then finish.`;
3950
+ this.#enqueueMessage("followUp", { text, displayText: text });
3951
+ this.#notice(`Stop hook requested continuation (${this.#stopDenials}/${MAX_STOP_DENIALS}).`);
3952
+ } else {
3953
+ this.#notice("Stop hook kept vetoing after the continuation budget; ending the turn anyway.");
3954
+ }
3955
+ }
3956
+ } catch {
3957
+ }
3939
3958
  this.#ackDurable(submission);
3940
3959
  this.#ackActiveSteering();
3941
3960
  }
package/dist/cli-main.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-RV3PTIQE.js";
6
+ } from "./chunk-6LDYDQ3P.js";
7
7
  import {
8
8
  staticTaskLines
9
9
  } from "./chunk-2BF7CVWZ.js";
@@ -23,7 +23,7 @@ import {
23
23
  packageVersion,
24
24
  redactErrorText,
25
25
  runPalBroker
26
- } from "./chunk-BKOOYSGH.js";
26
+ } from "./chunk-PF457XCH.js";
27
27
  import "./chunk-CIVPKHF4.js";
28
28
  import {
29
29
  McpServerConfigSchema,
@@ -878,7 +878,7 @@ async function runInteractiveCli(props) {
878
878
  const [{ render, AlternateScreen }, { createElement }, { App }] = await Promise.all([
879
879
  import("./claude-ink-AUZBJ3BE.js"),
880
880
  import("react"),
881
- import("./app-VPS5QIRK.js")
881
+ import("./app-LKK5RBTO.js")
882
882
  ]);
883
883
  const instance = await render(createElement(
884
884
  AlternateScreen,
@@ -21296,6 +21296,7 @@ var HELP = [
21296
21296
  "/chat <alias-or-uuid> <goal> send a task that starts on the receiving pal",
21297
21297
  "/co-work <pal> <goal> | status [id] | cancel <id> [reason]"
21298
21298
  ].join("\n");
21299
+ var MAX_STOP_DENIALS = 2;
21299
21300
  var FlavorSession = class {
21300
21301
  #services;
21301
21302
  #active;
@@ -21306,6 +21307,7 @@ var FlavorSession = class {
21306
21307
  #submissionTail = Promise.resolve();
21307
21308
  #coWorkEventTail = Promise.resolve();
21308
21309
  #pendingSubmissions = 0;
21310
+ #stopDenials = 0;
21309
21311
  #closePromise;
21310
21312
  #queue = new AgentMessageQueue();
21311
21313
  #queuedSubmissions = { steer: [], followUp: [] };
@@ -21507,6 +21509,7 @@ var FlavorSession = class {
21507
21509
  return operation;
21508
21510
  }
21509
21511
  async #runSubmissionChain(initialSubmission) {
21512
+ this.#stopDenials = 0;
21510
21513
  const pending2 = [initialSubmission];
21511
21514
  let initial = true;
21512
21515
  while (pending2.length > 0) {
@@ -21600,8 +21603,9 @@ var FlavorSession = class {
21600
21603
  this.#active = void 0;
21601
21604
  this.#activeSubmission = void 0;
21602
21605
  if (submission.coWorkPlanningKey !== void 0) this.#finishActivePlanning(submission.coWorkPlanningKey);
21606
+ let stopDecision;
21603
21607
  try {
21604
- await this.#services.hooks.emit({
21608
+ stopDecision = await this.#services.hooks.emit({
21605
21609
  version: 1,
21606
21610
  type: "Stop",
21607
21611
  payload: {
@@ -21616,6 +21620,21 @@ var FlavorSession = class {
21616
21620
  } catch {
21617
21621
  }
21618
21622
  }
21623
+ try {
21624
+ if (stopDecision?.decision === "deny" && typeof stopDecision.reason === "string" && stopDecision.reason.length > 0 && !this.#closed && outcome !== "cancelled" && outcome !== "denied") {
21625
+ if (this.#stopDenials < MAX_STOP_DENIALS) {
21626
+ this.#stopDenials += 1;
21627
+ const text = `[stop-guard] A Stop hook vetoed ending this turn (continuation ${this.#stopDenials}/${MAX_STOP_DENIALS}). It reported:
21628
+ ${stopDecision.reason}
21629
+ Address this now (for example run the required verification or fix), then finish.`;
21630
+ this.#enqueueMessage("followUp", { text, displayText: text });
21631
+ this.#notice(`Stop hook requested continuation (${this.#stopDenials}/${MAX_STOP_DENIALS}).`);
21632
+ } else {
21633
+ this.#notice("Stop hook kept vetoing after the continuation budget; ending the turn anyway.");
21634
+ }
21635
+ }
21636
+ } catch {
21637
+ }
21619
21638
  this.#ackDurable(submission);
21620
21639
  this.#ackActiveSteering();
21621
21640
  }
package/dist/sdk/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  FlavorRpcServer,
5
5
  TraceRecordSchema,
6
6
  TraceRecorder
7
- } from "../chunk-RV3PTIQE.js";
7
+ } from "../chunk-6LDYDQ3P.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-BKOOYSGH.js";
16
+ } from "../chunk-PF457XCH.js";
17
17
  import "../chunk-CIVPKHF4.js";
18
18
  import "../chunk-HJOCNKPN.js";
19
19
  import "../chunk-RQTYHUMK.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flavor-code",
3
- "version": "1.3.17",
3
+ "version": "1.3.18",
4
4
  "author": "YachuanWzh",
5
5
  "type": "module",
6
6
  "publishConfig": {