@wjarka/cezarion 0.17.0-pr2079.3192 → 0.17.0-pr2079.3199

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.
Files changed (31) hide show
  1. package/dist/delegation/routes.d.ts +15 -15
  2. package/dist/delegation/transport.d.ts +11 -11
  3. package/dist/server/server.d.ts +60 -60
  4. package/dist/workflows/run/turn-markers.d.ts +85 -0
  5. package/dist/workflows/run/turn-markers.js +262 -0
  6. package/dist/workflows/run/turn-markers.js.map +1 -0
  7. package/dist/workflows/run.d.ts +5 -64
  8. package/dist/workflows/run.js +5 -273
  9. package/dist/workflows/run.js.map +1 -1
  10. package/dist/workflows/turn-end.d.ts +10 -0
  11. package/dist/workflows/turn-end.js +10 -0
  12. package/dist/workflows/turn-end.js.map +1 -1
  13. package/package.json +3 -3
  14. package/web/dist/assets/{diff-D6cqOCLW2.js → diff-DqbMb8cM2.js} +2 -2
  15. package/web/dist/assets/{diff-view-Dybmn9Qn.js → diff-view-V-o3RKn5.js} +1 -1
  16. package/web/dist/assets/{git-toolbar-Do32iiRu.js → git-toolbar-CVlAfyIM.js} +1 -1
  17. package/web/dist/assets/{github-DySVDHbL.js → github-Cb7hFRhN.js} +1 -1
  18. package/web/dist/assets/{index-BeSxh84W.js → index-CTc9oMRZ.js} +3 -3
  19. package/web/dist/assets/{preview-pane-connected-C2UIBtAp.js → preview-pane-connected-CY-vuYfO.js} +1 -1
  20. package/web/dist/assets/{repo-git-DP2xKh5v.js → repo-git-BWtbFV2O.js} +1 -1
  21. package/web/dist/assets/{run-header-3sbYX6aF.js → run-header-BKBwU3A8.js} +1 -1
  22. package/web/dist/assets/{skills-lDb6ACKS.js → skills-JFLnGYt5.js} +1 -1
  23. package/web/dist/assets/{task-changes-DrF8vQQm.js → task-changes-DC3cG--6.js} +1 -1
  24. package/web/dist/assets/{task-commits-BDQ3ffG0.js → task-commits-DgaCzmqv.js} +1 -1
  25. package/web/dist/assets/{task-files-ObS4FJZ2.js → task-files-Q83CPWNp.js} +1 -1
  26. package/web/dist/assets/{task-github-item-Bk_e5QoR.js → task-github-item-A5JikjaC.js} +1 -1
  27. package/web/dist/assets/{task-thread-BFPg0VS2.js → task-thread-DVTbQe5A.js} +1 -1
  28. package/web/dist/assets/{thread-state-CvsNPsQv.js → thread-state-CRxCC4X7.js} +1 -1
  29. package/web/dist/assets/{use-hand-to-agent-state-DmdB69eP.js → use-hand-to-agent-state-ny1J-S5d.js} +1 -1
  30. package/web/dist/assets/{workflows-DQfQkUNp.js → workflows-CumRlPg2.js} +1 -1
  31. package/web/dist/index.html +1 -1
@@ -82,6 +82,17 @@ export declare function createDelegationRoutes(service: DelegationService, crede
82
82
  "/discover": {
83
83
  $post: {
84
84
  output: {
85
+ runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
86
+ models: {
87
+ id: string;
88
+ label: string;
89
+ description: string;
90
+ effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
91
+ }[];
92
+ source: "cache" | "live" | "unavailable";
93
+ stale: boolean;
94
+ reason?: string | undefined;
95
+ } | {
85
96
  scope: "host-default-account";
86
97
  runners: {
87
98
  status: "connected" | "disconnected" | "not-installed" | "unknown";
@@ -102,17 +113,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
102
113
  reason?: string | undefined;
103
114
  }[];
104
115
  nextOffset?: number | undefined;
105
- } | {
106
- runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
107
- models: {
108
- id: string;
109
- label: string;
110
- description: string;
111
- effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
112
- }[];
113
- source: "cache" | "live" | "unavailable";
114
- stale: boolean;
115
- reason?: string | undefined;
116
116
  };
117
117
  outputFormat: "json";
118
118
  status: 200;
@@ -221,13 +221,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
221
221
  status: 200;
222
222
  input: {
223
223
  json: {
224
- requestIds: string[];
225
- mode?: "all" | "any" | "one" | undefined;
226
- timeoutSeconds?: number | undefined;
227
- } | {
228
224
  workerIds: string[];
229
225
  timeoutSeconds?: number | undefined;
230
226
  mode?: "all" | "any" | "one" | undefined;
227
+ } | {
228
+ requestIds: string[];
229
+ mode?: "all" | "any" | "one" | undefined;
230
+ timeoutSeconds?: number | undefined;
231
231
  } | {
232
232
  peerIds: string[];
233
233
  timeoutSeconds?: number | undefined;
@@ -57,17 +57,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
57
57
  "/discover": {
58
58
  $post: {
59
59
  output: {
60
- runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
61
- models: {
62
- id: string;
63
- label: string;
64
- description: string;
65
- effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
66
- }[];
67
- source: "cache" | "live" | "unavailable";
68
- stale: boolean;
69
- reason?: string | undefined;
70
- } | {
71
60
  scope: "host-default-account";
72
61
  runners: {
73
62
  status: "connected" | "disconnected" | "not-installed" | "unknown";
@@ -88,6 +77,17 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
88
77
  reason?: string | undefined;
89
78
  }[];
90
79
  nextOffset?: number | undefined;
80
+ } | {
81
+ runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
82
+ models: {
83
+ id: string;
84
+ label: string;
85
+ description: string;
86
+ effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
87
+ }[];
88
+ source: "cache" | "live" | "unavailable";
89
+ stale: boolean;
90
+ reason?: string | undefined;
91
91
  };
92
92
  outputFormat: "json";
93
93
  status: 200;
@@ -4323,19 +4323,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4323
4323
  } & {
4324
4324
  "/repo/commit/:sha": {
4325
4325
  $get: {
4326
- output: string;
4327
- outputFormat: "text";
4328
- status: import("hono/utils/http-status").ContentfulStatusCode;
4329
- input: {
4330
- query: {
4331
- structured?: string | undefined;
4332
- };
4333
- } & {
4334
- param: {
4335
- sha: string;
4336
- };
4337
- };
4338
- } | {
4339
4326
  output: {
4340
4327
  error: string;
4341
4328
  code?: "invalid_input" | undefined;
@@ -4399,6 +4386,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4399
4386
  sha: string;
4400
4387
  };
4401
4388
  };
4389
+ } | {
4390
+ output: string;
4391
+ outputFormat: "text";
4392
+ status: import("hono/utils/http-status").ContentfulStatusCode;
4393
+ input: {
4394
+ query: {
4395
+ structured?: string | undefined;
4396
+ };
4397
+ } & {
4398
+ param: {
4399
+ sha: string;
4400
+ };
4401
+ };
4402
4402
  };
4403
4403
  };
4404
4404
  } & {
@@ -15371,20 +15371,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
15371
15371
  } & {
15372
15372
  "/runs/:id/handoff": {
15373
15373
  $get: {
15374
- output: string;
15375
- outputFormat: "text";
15376
- status: 200;
15374
+ output: {
15375
+ error: string;
15376
+ };
15377
+ outputFormat: "json";
15378
+ status: 404;
15377
15379
  input: {
15378
15380
  param: {
15379
15381
  id: string;
15380
15382
  };
15381
15383
  };
15382
15384
  } | {
15383
- output: {
15384
- error: string;
15385
- };
15386
- outputFormat: "json";
15387
- status: 404;
15385
+ output: string;
15386
+ outputFormat: "text";
15387
+ status: 200;
15388
15388
  input: {
15389
15389
  param: {
15390
15390
  id: string;
@@ -15422,15 +15422,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
15422
15422
  } & {
15423
15423
  "/runs/:id/diff": {
15424
15424
  $get: {
15425
- output: string;
15426
- outputFormat: "text";
15427
- status: import("hono/utils/http-status").ContentfulStatusCode;
15428
- input: {
15429
- param: {
15430
- id: string;
15431
- };
15432
- };
15433
- } | {
15434
15425
  output: {
15435
15426
  error: string;
15436
15427
  };
@@ -15452,6 +15443,15 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
15452
15443
  id: string;
15453
15444
  };
15454
15445
  };
15446
+ } | {
15447
+ output: string;
15448
+ outputFormat: "text";
15449
+ status: import("hono/utils/http-status").ContentfulStatusCode;
15450
+ input: {
15451
+ param: {
15452
+ id: string;
15453
+ };
15454
+ };
15455
15455
  };
15456
15456
  };
15457
15457
  } & {
@@ -17654,19 +17654,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
17654
17654
  } & {
17655
17655
  "/repo/commit/:sha": {
17656
17656
  $get: {
17657
- output: string;
17658
- outputFormat: "text";
17659
- status: import("hono/utils/http-status").ContentfulStatusCode;
17660
- input: {
17661
- query: {
17662
- structured?: string | undefined;
17663
- };
17664
- } & {
17665
- param: {
17666
- sha: string;
17667
- };
17668
- };
17669
- } | {
17670
17657
  output: {
17671
17658
  error: string;
17672
17659
  code?: "invalid_input" | undefined;
@@ -17730,6 +17717,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
17730
17717
  sha: string;
17731
17718
  };
17732
17719
  };
17720
+ } | {
17721
+ output: string;
17722
+ outputFormat: "text";
17723
+ status: import("hono/utils/http-status").ContentfulStatusCode;
17724
+ input: {
17725
+ query: {
17726
+ structured?: string | undefined;
17727
+ };
17728
+ } & {
17729
+ param: {
17730
+ sha: string;
17731
+ };
17732
+ };
17733
17733
  };
17734
17734
  };
17735
17735
  } & {
@@ -28702,20 +28702,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
28702
28702
  } & {
28703
28703
  "/runs/:id/handoff": {
28704
28704
  $get: {
28705
- output: string;
28706
- outputFormat: "text";
28707
- status: 200;
28705
+ output: {
28706
+ error: string;
28707
+ };
28708
+ outputFormat: "json";
28709
+ status: 404;
28708
28710
  input: {
28709
28711
  param: {
28710
28712
  id: string;
28711
28713
  };
28712
28714
  };
28713
28715
  } | {
28714
- output: {
28715
- error: string;
28716
- };
28717
- outputFormat: "json";
28718
- status: 404;
28716
+ output: string;
28717
+ outputFormat: "text";
28718
+ status: 200;
28719
28719
  input: {
28720
28720
  param: {
28721
28721
  id: string;
@@ -28753,15 +28753,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
28753
28753
  } & {
28754
28754
  "/runs/:id/diff": {
28755
28755
  $get: {
28756
- output: string;
28757
- outputFormat: "text";
28758
- status: import("hono/utils/http-status").ContentfulStatusCode;
28759
- input: {
28760
- param: {
28761
- id: string;
28762
- };
28763
- };
28764
- } | {
28765
28756
  output: {
28766
28757
  error: string;
28767
28758
  };
@@ -28783,6 +28774,15 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
28783
28774
  id: string;
28784
28775
  };
28785
28776
  };
28777
+ } | {
28778
+ output: string;
28779
+ outputFormat: "text";
28780
+ status: import("hono/utils/http-status").ContentfulStatusCode;
28781
+ input: {
28782
+ param: {
28783
+ id: string;
28784
+ };
28785
+ };
28786
28786
  };
28787
28787
  };
28788
28788
  } & {
@@ -0,0 +1,85 @@
1
+ import type { HumanWaitEntry } from '../../contract/index.js';
2
+ import { type AskRequest } from '../../core/ask.ts';
3
+ import type { AgentSession } from '../../core/claude-cli-runner.ts';
4
+ import type { AgentEvent, RunnerId } from '../../core/agent-runner.ts';
5
+ import type { UiEvent } from '../../core/ui-events.ts';
6
+ import type { UiEventSink } from '../../runs/ui-event-sink.ts';
7
+ import type { TurnTail } from './types.ts';
8
+ /** Claude's native scheduler is the backend-level equivalent of the textual
9
+ * monitoring marker. Keep this recognition here, at the workflow boundary,
10
+ * so the v1 event protocol stays unchanged and other backends do not acquire
11
+ * semantics from a coincidentally named tool (#46). Undefined: not the scheduler; null: the
12
+ * scheduler without a usable `delaySeconds`; otherwise that delay (hearsay-tools/cezarion#1233). */
13
+ export declare function claudeScheduleWakeupDelay(event: AgentEvent, backend: RunnerId): number | null | undefined;
14
+ /** A parked backend has resumed only when the parent owns a new turn.
15
+ * Nested Codex/Pi subagent `item.*` streams are not a parent turn — treating
16
+ * them as activity cancelled the only on-by-default wake (#121). Session
17
+ * diagnostics and completed-turn metadata stay passive for the same reason. */
18
+ export declare function isRunnerActivity(event: UiEvent): boolean;
19
+ /**
20
+ * Preserve boundaries between complete assistant text blocks while a turn is
21
+ * accumulated for marker parsing. The runners join these same v1 blocks with
22
+ * newlines in `AgentRunResult`; matching that contract here prevents a
23
+ * trailing `CEZ:TITLE=` block from absorbing later commentary (#623).
24
+ */
25
+ export declare function appendTurnText(current: string, next: string): string;
26
+ /** The v2 item is the complete assistant message the cockpit persists. Keep it
27
+ * as a fallback when a runner's legacy v1 text omitted a trailing CEZ:ASK. */
28
+ export declare function appendCompletedAssistantText(current: string, event: UiEvent): string;
29
+ /** Last top-level completed item: a non-empty assistant message is a visible tail; reasoning or a tool is silent even after earlier visible text (#544). An empty turn stays `none` and never nudges. */
30
+ export declare function trackTurnTail(tail: TurnTail, event: UiEvent): TurnTail;
31
+ /** Strip a trailing marker from one text event so transcripts stay free of
32
+ * protocol noise. Delta backends may split the marker across events — then
33
+ * it stays visible; detection above is unaffected. */
34
+ export declare function stripDoneMarker(text: string): string;
35
+ /** Strip a trailing `CEZ:MONITORING` marker from one text event (see
36
+ * `stripDoneMarker`; same delta-backend caveat). */
37
+ export declare function stripMonitoringMarker(text: string): string;
38
+ /** Emit the v2 `ask.requested` event for a parsed marker (the cockpit renders
39
+ * it as an ask card, #473). Returns the minted request id. */
40
+ export declare function emitAskRequested(sink: UiEventSink, ask: AskRequest): string;
41
+ /** A card's stored fields: its questions and, when it has one, its context (hearsay-tools/cezarion#1458).
42
+ * A card always replaces both, so a card without context never keeps an older card's. */
43
+ export declare function askCardFields(card: AskRequest): AskRequest;
44
+ /** The card a human wait holds, or none for a wait without questions. */
45
+ export declare function humanWaitCard(wait: Pick<HumanWaitEntry, 'questions' | 'context'> | undefined): AskRequest | undefined;
46
+ /** What a turn's active `CEZ:ASK` declaration resolves to: the card to raise, and
47
+ * the notes to persist alongside it. */
48
+ type AskTurnOutcome = {
49
+ ask: AskRequest | null;
50
+ /** Emitted in order by the caller, which owns how a note is persisted. */
51
+ notes: Array<{
52
+ message: string;
53
+ tone?: 'danger';
54
+ }>;
55
+ };
56
+ /** How a turn end reads its turn (`classifyTurnEnd`). */
57
+ export type TurnEndRead = AskTurnOutcome & {
58
+ done: boolean;
59
+ monitoring: boolean;
60
+ humanGate: boolean;
61
+ waitCard: boolean;
62
+ };
63
+ /** One turn-end decision for fresh and Continue, also retained until an input
64
+ * ACK settles. DONE and human gates take precedence over a quiet
65
+ * declaration or live workers; a false pending-ASK flag alone proves nothing.
66
+ * A human wait this turn registered and nobody has seen yet (hearsay-tools/cezarion#1234)
67
+ * raises its card, or the human gate when it has none, unless DONE wins or a valid ask line
68
+ * replaces its card; `waitCard` says the card is the wait's own. An accepted `cezar_done` is DONE
69
+ * whatever the text says, and beats any ask line in it. Only markers and waits count: no prose
70
+ * raises the gate, and a rejected ask line is a turn end with no wait. */
71
+ export declare function classifyTurnEnd(turnText: string, completedAssistantText: string, options: {
72
+ sessionOpen: boolean;
73
+ pendingHumanAsk: boolean;
74
+ scheduledWake: boolean;
75
+ liveWorkers: boolean;
76
+ humanWait?: Pick<HumanWaitEntry, 'questions' | 'context'> | undefined;
77
+ doneRequested?: boolean | undefined;
78
+ }): TurnEndRead;
79
+ /** An active ASK marker — valid card or rejected payload — means the user
80
+ * must answer. Drop follow-ups queued mid-turn so they cannot start a new
81
+ * turn the moment idle fires (OpenCode serializes `sendMessage` that way). */
82
+ export declare function discardQueuedMessagesOnAsk(session: AgentSession | undefined, outcome: AskTurnOutcome & {
83
+ humanGate?: boolean;
84
+ }): void;
85
+ export {};
@@ -0,0 +1,262 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { defined } from '../../core/defined.js';
3
+ import { parseAskMarkerResult, uiAskQuestions } from '../../core/ask.js';
4
+ /**
5
+ * Task-completion marker from the agent contract (HANDOFF_ONLY_INSTRUCTIONS):
6
+ * an active `CEZ:DONE` declaration means "goal achieved, nothing to ask" —
7
+ * the session is closed right away instead of parking at `waiting` (#347).
8
+ * Detection runs on the accumulated turn text so delta-streaming backends
9
+ * (codex, opencode) can't split the marker across text events.
10
+ */
11
+ /** Find the turn's active markers: quoted/indented examples and fenced code declare
12
+ * nothing. A standalone monitoring line belongs to this turn even when a later
13
+ * assistant block acknowledges a new instruction. The prose itself is never read
14
+ * (hearsay-tools/cezarion#1234). */
15
+ function turnParkSignals(text) {
16
+ let fence;
17
+ let monitoring = false;
18
+ let done = false;
19
+ let askResult = { kind: 'none' };
20
+ let previous = '';
21
+ for (const raw of text.split('\n')) {
22
+ const delimiter = raw.match(/^ {0,3}(`{3,}|~{3,})/);
23
+ if (delimiter) {
24
+ previous = ''; // a fenced example consumes its heading, not the next declaration
25
+ const token = delimiter[1];
26
+ if (!fence)
27
+ fence = { char: token[0], length: token.length };
28
+ else if (token[0] === fence.char && token.length >= fence.length)
29
+ fence = undefined;
30
+ continue;
31
+ }
32
+ if (fence)
33
+ continue;
34
+ if (/^(?: {4}|\t|\s*>)/.test(raw)) {
35
+ if (raw.trim())
36
+ previous = '';
37
+ continue;
38
+ }
39
+ // Lists and emphasis format active prose; they do not quote it. Exclude
40
+ // fenced/indented/blockquote examples before removing their decoration.
41
+ const line = raw.trim().replace(/^(?:[-+*]|\d+[.)])\s+(?:\[[ xX]\]\s+)?/, '')
42
+ .replace(/^#{1,6}\s+/, '').replace(/\*{1,2}|_{1,2}/g, '');
43
+ if (!line)
44
+ continue;
45
+ const example = /\b(?:example|sample|literal|quoted)(?: marker)?\s*:\s*$/i.test(previous);
46
+ if (!example && raw.trim() === 'CEZ:MONITORING') {
47
+ monitoring = true;
48
+ done = false;
49
+ }
50
+ if (!example && raw.trim() === 'CEZ:DONE') {
51
+ done = true;
52
+ askResult = { kind: 'none' }; // retain the existing later-DONE precedence
53
+ }
54
+ // Preserve the existing payload validation/repair and latest malformed
55
+ // marker diagnostics. Only active declarations participate: an ACK after
56
+ // a real ASK must not erase its card, nor turn examples into questions.
57
+ const candidate = example ? { kind: 'none' } : parseAskMarkerResult(raw);
58
+ if (candidate.kind !== 'none') {
59
+ askResult = candidate;
60
+ done = false;
61
+ }
62
+ previous = line;
63
+ }
64
+ return { monitoring, done, askResult };
65
+ }
66
+ /** Claude's native scheduler is the backend-level equivalent of the textual
67
+ * monitoring marker. Keep this recognition here, at the workflow boundary,
68
+ * so the v1 event protocol stays unchanged and other backends do not acquire
69
+ * semantics from a coincidentally named tool (#46). Undefined: not the scheduler; null: the
70
+ * scheduler without a usable `delaySeconds`; otherwise that delay (hearsay-tools/cezarion#1233). */
71
+ export function claudeScheduleWakeupDelay(event, backend) {
72
+ if (backend !== 'claude' || event.type !== 'tool-call' || event.tool !== 'ScheduleWakeup')
73
+ return undefined;
74
+ const delay = event.input?.delaySeconds;
75
+ return typeof delay === 'number' && Number.isFinite(delay) ? delay : null;
76
+ }
77
+ /** A parked backend has resumed only when the parent owns a new turn.
78
+ * Nested Codex/Pi subagent `item.*` streams are not a parent turn — treating
79
+ * them as activity cancelled the only on-by-default wake (#121). Session
80
+ * diagnostics and completed-turn metadata stay passive for the same reason. */
81
+ export function isRunnerActivity(event) {
82
+ return event.type === 'turn.started';
83
+ }
84
+ /**
85
+ * Preserve boundaries between complete assistant text blocks while a turn is
86
+ * accumulated for marker parsing. The runners join these same v1 blocks with
87
+ * newlines in `AgentRunResult`; matching that contract here prevents a
88
+ * trailing `CEZ:TITLE=` block from absorbing later commentary (#623).
89
+ */
90
+ export function appendTurnText(current, next) {
91
+ if (!current)
92
+ return next;
93
+ if (!next)
94
+ return current;
95
+ return `${current}\n${next}`;
96
+ }
97
+ /** The v2 item is the complete assistant message the cockpit persists. Keep it
98
+ * as a fallback when a runner's legacy v1 text omitted a trailing CEZ:ASK. */
99
+ export function appendCompletedAssistantText(current, event) {
100
+ if (event.type !== 'item.completed' ||
101
+ event.item.kind !== 'message' ||
102
+ event.item.role !== 'assistant' ||
103
+ event.item.parentItemId !== undefined) {
104
+ return current;
105
+ }
106
+ return appendTurnText(current, event.item.text);
107
+ }
108
+ /** Last top-level completed item: a non-empty assistant message is a visible tail; reasoning or a tool is silent even after earlier visible text (#544). An empty turn stays `none` and never nudges. */
109
+ export function trackTurnTail(tail, event) {
110
+ if (event.type !== 'item.completed' || event.item.parentItemId !== undefined)
111
+ return tail;
112
+ const item = event.item;
113
+ if (item.kind === 'message' && item.role === 'assistant' && item.text.trim() !== '')
114
+ return 'visible';
115
+ if (item.kind === 'reasoning' || item.kind === 'tool')
116
+ return 'silent';
117
+ return tail;
118
+ }
119
+ /** Strip a trailing marker from one text event so transcripts stay free of
120
+ * protocol noise. Delta backends may split the marker across events — then
121
+ * it stays visible; detection above is unaffected. */
122
+ export function stripDoneMarker(text) {
123
+ return text.replace(/\s*CEZ:DONE\s*$/, '');
124
+ }
125
+ /** Strip a trailing `CEZ:MONITORING` marker from one text event (see
126
+ * `stripDoneMarker`; same delta-backend caveat). */
127
+ export function stripMonitoringMarker(text) {
128
+ return text.replace(/\s*CEZ:MONITORING\s*$/, '');
129
+ }
130
+ /** Emit the v2 `ask.requested` event for a parsed marker (the cockpit renders
131
+ * it as an ask card, #473). Returns the minted request id. */
132
+ export function emitAskRequested(sink, ask) {
133
+ const requestId = randomUUID();
134
+ sink.handle({ type: 'ask.requested', requestId, ...defined(askCardFields(ask)), questions: uiAskQuestions(ask.questions) });
135
+ return requestId;
136
+ }
137
+ /** A card's stored fields: its questions and, when it has one, its context (hearsay-tools/cezarion#1458).
138
+ * A card always replaces both, so a card without context never keeps an older card's. */
139
+ export function askCardFields(card) {
140
+ return { questions: card.questions, ...(card.context !== undefined ? { context: card.context } : {}) };
141
+ }
142
+ /** The card a human wait holds, or none for a wait without questions. */
143
+ export function humanWaitCard(wait) {
144
+ return wait?.questions ? askCardFields({ questions: wait.questions, context: wait.context }) : undefined;
145
+ }
146
+ /** A persisted, non-fatal explanation for protocol-shaped text that could not
147
+ * become an ask card. Never include the raw payload in this diagnostic. */
148
+ function askMarkerRejection(result) {
149
+ if (result.kind === 'invalid-json') {
150
+ return 'structured question ignored — CEZ:ASK payload is not valid JSON';
151
+ }
152
+ if (result.kind !== 'invalid-structure')
153
+ return undefined;
154
+ const issue = result.issues[0];
155
+ const location = issue?.path.length ? ` at ${issue.path.join('.')}` : '';
156
+ return `structured question ignored — CEZ:ASK payload failed validation${location}${issue ? `: ${issue.message}` : ''}`;
157
+ }
158
+ /** A persisted, auditable trace for a card that only rendered because the
159
+ * payload's missing closers were appended (#936) — a repair can only lose what
160
+ * the truncation already removed, so the recovery must stay visible rather than
161
+ * passing for a clean parse. Carries `tone: 'danger'` for the same reason the
162
+ * rejection does: it is the ONLY signal that the card may be missing a trailing
163
+ * option or a trailing `multiSelect` the cut took with it, and the raw payload
164
+ * is stripped along with the card, so a dim footnote could not be acted on. */
165
+ function askMarkerRecovery(result) {
166
+ return result.kind === 'valid' && result.repaired
167
+ ? 'structured question recovered from an unbalanced CEZ:ASK payload — check the options, and how many you may pick, match what was asked'
168
+ : undefined;
169
+ }
170
+ /** Resolve the ask marker for one finished turn. Both turn-end handlers
171
+ * (`runAgentStep` and `runContinuation`) route through this single function:
172
+ * they are hand-duplicated, and `AGENTS.md` warns that a lifecycle change
173
+ * applied to only one of them ships half a fix — the notes and their tones are
174
+ * exactly that kind of change. `enabled` is the caller's own precondition (the
175
+ * session is open and the turn is not a terminating `CEZ:DONE`); when false
176
+ * there is no marker to look for. Intermediate steps can ask too (#427). */
177
+ function resolveAskTurn(v1Result, v2Result, enabled) {
178
+ if (!enabled)
179
+ return { ask: null, notes: [] };
180
+ // For unreconciled channels, v1 remains authoritative when it carries an
181
+ // ASK; a marker absent from v1 can still come from the complete v2 message.
182
+ const result = v1Result.kind === 'none' ? v2Result : v1Result;
183
+ const notes = [];
184
+ const rejection = askMarkerRejection(result);
185
+ if (rejection)
186
+ notes.push({ message: rejection, tone: 'danger' });
187
+ const recovery = askMarkerRecovery(result);
188
+ if (recovery)
189
+ notes.push({ message: recovery, tone: 'danger' });
190
+ return { ask: result.kind === 'valid' ? result.request : null, notes };
191
+ }
192
+ /** A partial channel cannot keep an earlier gate alive when the other carries
193
+ * the same transcript plus later declarations. Compare raw lines in order,
194
+ * preserving fences/examples and ACKs between declarations. Neither channel
195
+ * always wins: v1 reconstructs omitted snapshots, v2 can retain refreshed ones.
196
+ * Incomparable transcripts keep the existing conservative channel policy. */
197
+ function orderedTurnText(v1, v2) {
198
+ if (!v1)
199
+ return v2;
200
+ if (!v2 || v1 === v2)
201
+ return v1;
202
+ const contains = (full, partial) => {
203
+ const lines = partial.split('\n');
204
+ let next = 0;
205
+ for (const line of full.split('\n')) {
206
+ if (line === lines[next])
207
+ next++;
208
+ }
209
+ return next === lines.length;
210
+ };
211
+ if (contains(v2, v1))
212
+ return v2;
213
+ if (contains(v1, v2))
214
+ return v1;
215
+ return undefined;
216
+ }
217
+ /** Read the turn's markers once from the channel that holds the whole turn, or from each channel
218
+ * when neither holds the other (`orderedTurnText`). A done line counts only when no channel
219
+ * carries an ask line. */
220
+ function readTurnMarkers(turnText, completedAssistantText) {
221
+ const complete = orderedTurnText(turnText, completedAssistantText);
222
+ const v1 = turnParkSignals(complete ?? turnText);
223
+ const v2 = complete === undefined ? turnParkSignals(completedAssistantText) : v1;
224
+ return {
225
+ v1Ask: v1.askResult, v2Ask: v2.askResult,
226
+ doneLine: (v1.done || v2.done) && v1.askResult.kind === 'none' && v2.askResult.kind === 'none',
227
+ monitoringLine: v1.monitoring || v2.monitoring,
228
+ };
229
+ }
230
+ /** Read the turn's ask: its ask line, else the card of the human wait it registered, else the
231
+ * human gate when that wait has no card. A done reads no ask. */
232
+ function readTurnAsk(markers, options, done) {
233
+ const askTurn = resolveAskTurn(markers.v1Ask, markers.v2Ask, options.sessionOpen && !done);
234
+ const surfaced = options.humanWait && options.sessionOpen && !done && !askTurn.ask ? options.humanWait : undefined;
235
+ const waitCard = !!surfaced?.questions;
236
+ return { ...askTurn, ask: askTurn.ask ?? humanWaitCard(surfaced) ?? null, humanGate: !!surfaced && !waitCard, waitCard };
237
+ }
238
+ /** One turn-end decision for fresh and Continue, also retained until an input
239
+ * ACK settles. DONE and human gates take precedence over a quiet
240
+ * declaration or live workers; a false pending-ASK flag alone proves nothing.
241
+ * A human wait this turn registered and nobody has seen yet (hearsay-tools/cezarion#1234)
242
+ * raises its card, or the human gate when it has none, unless DONE wins or a valid ask line
243
+ * replaces its card; `waitCard` says the card is the wait's own. An accepted `cezar_done` is DONE
244
+ * whatever the text says, and beats any ask line in it. Only markers and waits count: no prose
245
+ * raises the gate, and a rejected ask line is a turn end with no wait. */
246
+ export function classifyTurnEnd(turnText, completedAssistantText, options) {
247
+ const markers = readTurnMarkers(turnText, completedAssistantText);
248
+ const done = options.sessionOpen && (!!options.doneRequested || markers.doneLine);
249
+ const { humanGate, waitCard, ...askTurn } = readTurnAsk(markers, options, done);
250
+ const monitoring = options.sessionOpen && !done && !askTurn.ask &&
251
+ !options.pendingHumanAsk && !humanGate &&
252
+ (markers.monitoringLine || options.scheduledWake || options.liveWorkers);
253
+ return { ...askTurn, done, monitoring, humanGate, waitCard };
254
+ }
255
+ /** An active ASK marker — valid card or rejected payload — means the user
256
+ * must answer. Drop follow-ups queued mid-turn so they cannot start a new
257
+ * turn the moment idle fires (OpenCode serializes `sendMessage` that way). */
258
+ export function discardQueuedMessagesOnAsk(session, outcome) {
259
+ if (outcome.ask || outcome.notes.length || outcome.humanGate)
260
+ session?.discardQueuedMessages();
261
+ }
262
+ //# sourceMappingURL=turn-markers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turn-markers.js","sourceRoot":"","sources":["../../../src/workflows/run/turn-markers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAA8C,MAAM,mBAAmB,CAAC;AAOrH;;;;;;GAMG;AACH;;;oCAGoC;AACpC,SAAS,eAAe,CAAC,IAAY;IACnC,IAAI,KAAmD,CAAC;IACxD,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI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