@wjarka/cezarion 0.11.2-pr50.83 → 0.11.2-pr56.84

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.
@@ -3461,19 +3461,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3461
3461
  } & {
3462
3462
  "/repo/commit/:sha": {
3463
3463
  $get: {
3464
- output: string;
3465
- outputFormat: "text";
3466
- status: import("hono/utils/http-status").ContentfulStatusCode;
3467
- input: {
3468
- query: {
3469
- structured?: string | undefined;
3470
- };
3471
- } & {
3472
- param: {
3473
- sha: string;
3474
- };
3475
- };
3476
- } | {
3477
3464
  output: {
3478
3465
  error: string;
3479
3466
  };
@@ -3536,6 +3523,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3536
3523
  sha: string;
3537
3524
  };
3538
3525
  };
3526
+ } | {
3527
+ output: string;
3528
+ outputFormat: "text";
3529
+ status: import("hono/utils/http-status").ContentfulStatusCode;
3530
+ input: {
3531
+ query: {
3532
+ structured?: string | undefined;
3533
+ };
3534
+ } & {
3535
+ param: {
3536
+ sha: string;
3537
+ };
3538
+ };
3539
3539
  };
3540
3540
  };
3541
3541
  } & {
@@ -7051,20 +7051,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
7051
7051
  } & {
7052
7052
  "/runs/:id/handoff": {
7053
7053
  $get: {
7054
- output: string;
7055
- outputFormat: "text";
7056
- status: 200;
7054
+ output: {
7055
+ error: string;
7056
+ };
7057
+ outputFormat: "json";
7058
+ status: 404;
7057
7059
  input: {
7058
7060
  param: {
7059
7061
  id: string;
7060
7062
  };
7061
7063
  };
7062
7064
  } | {
7063
- output: {
7064
- error: string;
7065
- };
7066
- outputFormat: "json";
7067
- status: 404;
7065
+ output: string;
7066
+ outputFormat: "text";
7067
+ status: 200;
7068
7068
  input: {
7069
7069
  param: {
7070
7070
  id: string;
@@ -7090,20 +7090,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
7090
7090
  } & {
7091
7091
  "/runs/:id/diff": {
7092
7092
  $get: {
7093
- output: string;
7094
- outputFormat: "text";
7095
- status: import("hono/utils/http-status").ContentfulStatusCode;
7093
+ output: {
7094
+ error: string;
7095
+ };
7096
+ outputFormat: "json";
7097
+ status: 404;
7096
7098
  input: {
7097
7099
  param: {
7098
7100
  id: string;
7099
7101
  };
7100
7102
  };
7101
7103
  } | {
7102
- output: {
7103
- error: string;
7104
- };
7105
- outputFormat: "json";
7106
- status: 404;
7104
+ output: string;
7105
+ outputFormat: "text";
7106
+ status: import("hono/utils/http-status").ContentfulStatusCode;
7107
7107
  input: {
7108
7108
  param: {
7109
7109
  id: string;
@@ -9019,19 +9019,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
9019
9019
  } & {
9020
9020
  "/repo/commit/:sha": {
9021
9021
  $get: {
9022
- output: string;
9023
- outputFormat: "text";
9024
- status: import("hono/utils/http-status").ContentfulStatusCode;
9025
- input: {
9026
- query: {
9027
- structured?: string | undefined;
9028
- };
9029
- } & {
9030
- param: {
9031
- sha: string;
9032
- };
9033
- };
9034
- } | {
9035
9022
  output: {
9036
9023
  error: string;
9037
9024
  };
@@ -9094,6 +9081,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
9094
9081
  sha: string;
9095
9082
  };
9096
9083
  };
9084
+ } | {
9085
+ output: string;
9086
+ outputFormat: "text";
9087
+ status: import("hono/utils/http-status").ContentfulStatusCode;
9088
+ input: {
9089
+ query: {
9090
+ structured?: string | undefined;
9091
+ };
9092
+ } & {
9093
+ param: {
9094
+ sha: string;
9095
+ };
9096
+ };
9097
9097
  };
9098
9098
  };
9099
9099
  } & {
@@ -12609,20 +12609,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
12609
12609
  } & {
12610
12610
  "/runs/:id/handoff": {
12611
12611
  $get: {
12612
- output: string;
12613
- outputFormat: "text";
12614
- status: 200;
12612
+ output: {
12613
+ error: string;
12614
+ };
12615
+ outputFormat: "json";
12616
+ status: 404;
12615
12617
  input: {
12616
12618
  param: {
12617
12619
  id: string;
12618
12620
  };
12619
12621
  };
12620
12622
  } | {
12621
- output: {
12622
- error: string;
12623
- };
12624
- outputFormat: "json";
12625
- status: 404;
12623
+ output: string;
12624
+ outputFormat: "text";
12625
+ status: 200;
12626
12626
  input: {
12627
12627
  param: {
12628
12628
  id: string;
@@ -12648,20 +12648,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
12648
12648
  } & {
12649
12649
  "/runs/:id/diff": {
12650
12650
  $get: {
12651
- output: string;
12652
- outputFormat: "text";
12653
- status: import("hono/utils/http-status").ContentfulStatusCode;
12651
+ output: {
12652
+ error: string;
12653
+ };
12654
+ outputFormat: "json";
12655
+ status: 404;
12654
12656
  input: {
12655
12657
  param: {
12656
12658
  id: string;
12657
12659
  };
12658
12660
  };
12659
12661
  } | {
12660
- output: {
12661
- error: string;
12662
- };
12663
- outputFormat: "json";
12664
- status: 404;
12662
+ output: string;
12663
+ outputFormat: "text";
12664
+ status: import("hono/utils/http-status").ContentfulStatusCode;
12665
12665
  input: {
12666
12666
  param: {
12667
12667
  id: string;
@@ -620,8 +620,6 @@ export declare class RunManager {
620
620
  * item-shape cache are session-scoped, like the mapper state feeding them.
621
621
  */
622
622
  private makeUiSink;
623
- /** Continue autonomous runs and markerless tool turns through one bounded path. */
624
- private tryAutoContinueTurn;
625
623
  /** Native backend asks arrive before turn-end. Persist and park immediately
626
624
  * so the cockpit shows attention and the run releases its workspace slot. */
627
625
  private handleRunnerUiEvent;
@@ -129,17 +129,6 @@ const REPOSITORY_ROOT_LOCK_DISABLED_NOTE = 'repository-root lock disabled by CEZ
129
129
  const MAX_AUTO_CONTINUES = 40;
130
130
  const AUTONOMOUS_NUDGE = 'Continue working autonomously until the task is fully complete. Do not ask me for confirmation or clarification — make reasonable assumptions and proceed. When everything is done, end the session with your done signal.';
131
131
  const MONITORING_WAKE_NUDGE = 'Re-check the downstream work you were monitoring. Continue toward the task goal; emit CEZ:MONITORING again only if it is still pending.';
132
- /** A question at the handoff boundary may be followed by Markdown answer choices. */
133
- function hasUserQuestion(text) {
134
- const lines = stripTaskMarkers(text).trimEnd().split('\n');
135
- while (lines.length > 0) {
136
- const line = lines.pop().trim();
137
- if (!line || /^(?:[-*+]|\d+[.)])\s+\S/.test(line))
138
- continue;
139
- return /\?[*_~`]*(?:\s*\([^()]*\))?$/.test(line);
140
- }
141
- return false;
142
- }
143
132
  /**
144
133
  * Auto-resume after a provider usage limit (spec 2026-08-03-auto-resume-after-usage-limit).
145
134
  *
@@ -2003,7 +1992,6 @@ export class RunManager {
2003
1992
  let stepCost = 0;
2004
1993
  let turnText = '';
2005
1994
  let sawClaudeScheduleWakeup = false;
2006
- let sawToolUse = false;
2007
1995
  let sessionError;
2008
1996
  const sink = this.makeUiSink(runId, stepId);
2009
1997
  const onEvent = (event) => {
@@ -2038,8 +2026,6 @@ export class RunManager {
2038
2026
  stepCost += event.usd;
2039
2027
  this.store.updateStep(runId, stepId, { costUsd: stepCost });
2040
2028
  }
2041
- if (event.type === 'tool-call')
2042
- sawToolUse = true;
2043
2029
  if (isClaudeScheduleWakeup(event, backend))
2044
2030
  sawClaudeScheduleWakeup = true;
2045
2031
  if (event.type === 'turn-end') {
@@ -2059,10 +2045,8 @@ export class RunManager {
2059
2045
  !done &&
2060
2046
  !ask &&
2061
2047
  (MONITORING_MARKER_RE.test(turnText.trimEnd()) || sawClaudeScheduleWakeup);
2062
- const markerlessMidWork = askResult?.kind === 'none' && !monitoring && sawToolUse && !hasUserQuestion(turnText);
2063
2048
  turnText = '';
2064
2049
  sawClaudeScheduleWakeup = false;
2065
- sawToolUse = false;
2066
2050
  if (askRejection)
2067
2051
  this.store.appendEvent(runId, { type: 'note', message: askRejection, stepId });
2068
2052
  if (done) {
@@ -2072,9 +2056,23 @@ export class RunManager {
2072
2056
  state.session?.end();
2073
2057
  return;
2074
2058
  }
2075
- let autoContinued = false;
2076
2059
  if (sessionOpen) {
2077
- autoContinued = this.tryAutoContinueTurn(runId, state, state.autonomous === true || markerlessMidWork);
2060
+ // Autonomous (#autonomous): never hand the ball back to the user. Nudge the agent to
2061
+ // keep going (bounded by MAX_AUTO_CONTINUES) instead of parking at `waiting`.
2062
+ const autoContinued = state.autonomous &&
2063
+ (state.autoContinues ?? 0) < MAX_AUTO_CONTINUES &&
2064
+ !state.cancelled &&
2065
+ (() => {
2066
+ const sent = state.session?.sendMessage([{ type: 'text', text: AUTONOMOUS_NUDGE }]);
2067
+ if (!sent)
2068
+ return false;
2069
+ state.autoContinues = (state.autoContinues ?? 0) + 1;
2070
+ this.store.appendEvent(runId, {
2071
+ type: 'note',
2072
+ message: `autonomous — continuing without pausing (${state.autoContinues}/${MAX_AUTO_CONTINUES})`,
2073
+ });
2074
+ return true;
2075
+ })();
2078
2076
  if (!autoContinued) {
2079
2077
  // `CEZ:ASK` → park `waiting` (attention) AND surface the structured
2080
2078
  // question as an ask card (#473). `CEZ:MONITORING` or Claude's native
@@ -2110,7 +2108,7 @@ export class RunManager {
2110
2108
  if (this.store.getRun(runId)?.autoResumeAttempts !== undefined) {
2111
2109
  this.store.updateRun(runId, { autoResumeAttempts: undefined });
2112
2110
  }
2113
- appendHandoffHeartbeat(this.dataDir, runId, `turn complete — status=${autoContinued ? 'running' : monitoring ? 'monitoring' : sessionOpen ? 'waiting' : 'running'}`);
2111
+ appendHandoffHeartbeat(this.dataDir, runId, `turn complete — status=${monitoring ? 'monitoring' : sessionOpen ? 'waiting' : 'running'}`);
2114
2112
  }
2115
2113
  };
2116
2114
  // Backend + model come off the record: the run's current backend by default, or the
@@ -2613,7 +2611,6 @@ export class RunManager {
2613
2611
  let stepCost = stepRecord?.costUsd ?? 0;
2614
2612
  let turnText = '';
2615
2613
  let sawClaudeScheduleWakeup = false;
2616
- let sawToolUse = false;
2617
2614
  let sessionError;
2618
2615
  const sink = this.makeUiSink(runId, step.id);
2619
2616
  const onEvent = (event) => {
@@ -2649,8 +2646,6 @@ export class RunManager {
2649
2646
  stepCost += event.usd;
2650
2647
  this.store.updateStep(runId, step.id, { costUsd: stepCost });
2651
2648
  }
2652
- if (event.type === 'tool-call')
2653
- sawToolUse = true;
2654
2649
  if (isClaudeScheduleWakeup(event, backend))
2655
2650
  sawClaudeScheduleWakeup = true;
2656
2651
  if (event.type === 'turn-end') {
@@ -2670,10 +2665,8 @@ export class RunManager {
2670
2665
  !done &&
2671
2666
  !ask &&
2672
2667
  (MONITORING_MARKER_RE.test(turnText.trimEnd()) || sawClaudeScheduleWakeup);
2673
- const markerlessMidWork = askResult?.kind === 'none' && !monitoring && sawToolUse && !hasUserQuestion(turnText);
2674
2668
  turnText = '';
2675
2669
  sawClaudeScheduleWakeup = false;
2676
- sawToolUse = false;
2677
2670
  if (askRejection)
2678
2671
  emit({ type: 'note', stepId: step.id, message: askRejection });
2679
2672
  if (done) {
@@ -2685,36 +2678,32 @@ export class RunManager {
2685
2678
  return;
2686
2679
  }
2687
2680
  const waiting = interactive && sessionOpen;
2688
- let autoContinued = false;
2689
2681
  if (waiting) {
2690
- autoContinued = this.tryAutoContinueTurn(runId, state, !ask && (state.autonomous === true || markerlessMidWork));
2691
- if (!autoContinued) {
2692
- // Turn over, session open. Either the ball is in the user's court
2693
- // (`waiting`) optionally with a structured `CEZ:ASK` question the
2694
- // cockpit renders as an ask card (#473) — or the agent declared it is
2695
- // still working through `CEZ:MONITORING` or Claude's native
2696
- // `ScheduleWakeup`. Monitoring parks as `running` with no user-wait
2697
- // idle timer, so the cockpit stays non-attention (#490, #46).
2698
- if (ask)
2699
- emitAskRequested(sink, ask);
2700
- if (monitoring) {
2701
- this.store.updateRun(runId, { status: 'running', activity: 'monitoring' });
2702
- this.store.updateStep(runId, step.id, { status: 'running' });
2703
- this.monitoring.add(runId);
2704
- this.clearIdleTimer(state);
2705
- this.armMonitoringWakeTimer(runId, state);
2706
- }
2707
- else {
2708
- this.store.updateRun(runId, { status: 'waiting', activity: undefined });
2709
- this.store.updateStep(runId, step.id, { status: 'waiting' });
2710
- this.monitoring.delete(runId);
2711
- this.clearMonitoringWakeTimer(state, runId);
2712
- }
2713
- this.waiting.add(runId);
2714
- if (!monitoring)
2715
- this.armIdleTimer(runId, state);
2716
- this.releaseSlot(); // the freed slot can start a queued run right away — in any project
2682
+ // Turn over, session open. Either the ball is in the user's court
2683
+ // (`waiting`) — optionally with a structured `CEZ:ASK` question the
2684
+ // cockpit renders as an ask card (#473) or the agent declared it is
2685
+ // still working through `CEZ:MONITORING` or Claude's native
2686
+ // `ScheduleWakeup`. Monitoring parks as `running` with no user-wait
2687
+ // idle timer, so the cockpit stays non-attention (#490, #46).
2688
+ if (ask)
2689
+ emitAskRequested(sink, ask);
2690
+ if (monitoring) {
2691
+ this.store.updateRun(runId, { status: 'running', activity: 'monitoring' });
2692
+ this.store.updateStep(runId, step.id, { status: 'running' });
2693
+ this.monitoring.add(runId);
2694
+ this.clearIdleTimer(state);
2695
+ this.armMonitoringWakeTimer(runId, state);
2717
2696
  }
2697
+ else {
2698
+ this.store.updateRun(runId, { status: 'waiting', activity: undefined });
2699
+ this.store.updateStep(runId, step.id, { status: 'waiting' });
2700
+ this.monitoring.delete(runId);
2701
+ this.clearMonitoringWakeTimer(state, runId);
2702
+ }
2703
+ this.waiting.add(runId);
2704
+ if (!monitoring)
2705
+ this.armIdleTimer(runId, state);
2706
+ this.releaseSlot(); // the freed slot can start a queued run right away — in any project
2718
2707
  }
2719
2708
  // The window is proven open — see the twin in `runContinuation`.
2720
2709
  if (this.store.getRun(runId)?.autoResumeAttempts !== undefined) {
@@ -2722,7 +2711,7 @@ export class RunManager {
2722
2711
  }
2723
2712
  // Cez's own heartbeat — the handoff stays current even when the
2724
2713
  // agent forgets to write (spec 007).
2725
- appendHandoffHeartbeat(this.dataDir, runId, `turn complete — status=${autoContinued ? 'running' : monitoring ? 'monitoring' : waiting ? 'waiting' : 'running'}`);
2714
+ appendHandoffHeartbeat(this.dataDir, runId, `turn complete — status=${monitoring ? 'monitoring' : waiting ? 'waiting' : 'running'}`);
2726
2715
  }
2727
2716
  };
2728
2717
  const stepBackend = step.runner ?? taskBackend;
@@ -2849,23 +2838,6 @@ export class RunManager {
2849
2838
  emitLive: (event) => this.store.emitEphemeral(runId, { ...event, stepId }),
2850
2839
  });
2851
2840
  }
2852
- /** Continue autonomous runs and markerless tool turns through one bounded path. */
2853
- tryAutoContinueTurn(runId, state, shouldContinue) {
2854
- if (!shouldContinue || (state.autoContinues ?? 0) >= MAX_AUTO_CONTINUES) {
2855
- return false;
2856
- }
2857
- if (state.cancelled)
2858
- return false;
2859
- const sent = state.session?.sendMessage([{ type: 'text', text: AUTONOMOUS_NUDGE }]);
2860
- if (!sent)
2861
- return false;
2862
- state.autoContinues = (state.autoContinues ?? 0) + 1;
2863
- this.store.appendEvent(runId, {
2864
- type: 'note',
2865
- message: `${state.autonomous ? 'autonomous' : 'work still in progress'} — continuing without pausing (${state.autoContinues}/${MAX_AUTO_CONTINUES})`,
2866
- });
2867
- return true;
2868
- }
2869
2841
  /** Native backend asks arrive before turn-end. Persist and park immediately
2870
2842
  * so the cockpit shows attention and the run releases its workspace slot. */
2871
2843
  handleRunnerUiEvent(runId, state, sink, event) {