@hearsay-tools/squawk 0.18.0-dev.6683 → 0.18.0-dev.6703

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 (143) hide show
  1. package/dist/agent-config/seed.js +1 -6
  2. package/dist/agent-config/seed.js.map +1 -1
  3. package/dist/autosave-git.js +3 -4
  4. package/dist/autosave-git.js.map +1 -1
  5. package/dist/ci-wait/controller.d.ts +37 -37
  6. package/dist/core/backend-detect.js +2 -1
  7. package/dist/core/backend-detect.js.map +1 -1
  8. package/dist/core/codex-hook-mapper.js +2 -1
  9. package/dist/core/codex-hook-mapper.js.map +1 -1
  10. package/dist/core/codex-ui-mapper.js +2 -2
  11. package/dist/core/codex-ui-mapper.js.map +1 -1
  12. package/dist/core/cursor-print-runner.js +2 -1
  13. package/dist/core/cursor-print-runner.js.map +1 -1
  14. package/dist/core/omp-runner.js +4 -5
  15. package/dist/core/omp-runner.js.map +1 -1
  16. package/dist/core/omp-subagent-rows.js +2 -1
  17. package/dist/core/omp-subagent-rows.js.map +1 -1
  18. package/dist/core/opencode-ui-mapper.js +2 -2
  19. package/dist/core/opencode-ui-mapper.js.map +1 -1
  20. package/dist/core/own-lookup.d.ts +5 -0
  21. package/dist/core/own-lookup.js +8 -0
  22. package/dist/core/own-lookup.js.map +1 -0
  23. package/dist/data-gitignore.js +2 -2
  24. package/dist/data-gitignore.js.map +1 -1
  25. package/dist/delegation/cli.js +2 -2
  26. package/dist/delegation/cli.js.map +1 -1
  27. package/dist/delegation/context.js +7 -11
  28. package/dist/delegation/context.js.map +1 -1
  29. package/dist/delegation/results.js +2 -2
  30. package/dist/delegation/results.js.map +1 -1
  31. package/dist/delegation/routes.d.ts +15 -15
  32. package/dist/delegation/service.js +2 -4
  33. package/dist/delegation/service.js.map +1 -1
  34. package/dist/delegation/transport.d.ts +71 -71
  35. package/dist/git-command.d.ts +29 -0
  36. package/dist/git-command.js +27 -1
  37. package/dist/git-command.js.map +1 -1
  38. package/dist/git-worktree-lock-helper.d.ts +2 -0
  39. package/dist/git-worktree-lock-helper.js +12 -14
  40. package/dist/git-worktree-lock-helper.js.map +1 -1
  41. package/dist/git-worktree-lock.js +3 -10
  42. package/dist/git-worktree-lock.js.map +1 -1
  43. package/dist/project-migration/containment.js +2 -4
  44. package/dist/project-migration/containment.js.map +1 -1
  45. package/dist/project-migration/plan.js +2 -4
  46. package/dist/project-migration/plan.js.map +1 -1
  47. package/dist/release/publication.js +2 -2
  48. package/dist/release/publication.js.map +1 -1
  49. package/dist/server/activity-routes.d.ts +23 -23
  50. package/dist/server/checkout.js +5 -5
  51. package/dist/server/checkout.js.map +1 -1
  52. package/dist/server/create-project.js +9 -10
  53. package/dist/server/create-project.js.map +1 -1
  54. package/dist/server/forge/draft-pr.js +17 -13
  55. package/dist/server/forge/draft-pr.js.map +1 -1
  56. package/dist/server/git.js +2 -4
  57. package/dist/server/git.js.map +1 -1
  58. package/dist/server/repo-pull.js +3 -7
  59. package/dist/server/repo-pull.js.map +1 -1
  60. package/dist/server/server.d.ts +1626 -1617
  61. package/dist/server/server.js +22 -35
  62. package/dist/server/server.js.map +1 -1
  63. package/dist/server/workspace-live-routes.d.ts +6 -6
  64. package/dist/skills-remote.js +8 -12
  65. package/dist/skills-remote.js.map +1 -1
  66. package/dist/task-branch-head.js +2 -4
  67. package/dist/task-branch-head.js.map +1 -1
  68. package/dist/task-cli/discovery.js +2 -4
  69. package/dist/task-cli/discovery.js.map +1 -1
  70. package/dist/ui-state.d.ts +7 -6
  71. package/dist/ui-state.js +31 -6
  72. package/dist/ui-state.js.map +1 -1
  73. package/dist/workflows/run/attachment-writer.d.ts +5 -4
  74. package/dist/workflows/run/attachment-writer.js +9 -7
  75. package/dist/workflows/run/attachment-writer.js.map +1 -1
  76. package/dist/workflows/run/compose.d.ts +4 -1
  77. package/dist/workflows/run/compose.js +14 -10
  78. package/dist/workflows/run/compose.js.map +1 -1
  79. package/dist/workflows/run/continuation-acceptance.d.ts +4 -1
  80. package/dist/workflows/run/continuation-acceptance.js +4 -1
  81. package/dist/workflows/run/continuation-acceptance.js.map +1 -1
  82. package/dist/workflows/run/family-reconciler.d.ts +4 -0
  83. package/dist/workflows/run/family-reconciler.js +4 -0
  84. package/dist/workflows/run/family-reconciler.js.map +1 -1
  85. package/dist/workflows/run/inbox-claims.d.ts +2 -0
  86. package/dist/workflows/run/inbox-claims.js +2 -0
  87. package/dist/workflows/run/inbox-claims.js.map +1 -1
  88. package/dist/workflows/run/maintenance-claims.d.ts +2 -0
  89. package/dist/workflows/run/maintenance-claims.js +2 -0
  90. package/dist/workflows/run/maintenance-claims.js.map +1 -1
  91. package/dist/workflows/run/memory-guard.d.ts +6 -6
  92. package/dist/workflows/run/memory-guard.js +8 -8
  93. package/dist/workflows/run/memory-guard.js.map +1 -1
  94. package/dist/workflows/run/queued-input.d.ts +12 -10
  95. package/dist/workflows/run/queued-input.js +17 -16
  96. package/dist/workflows/run/queued-input.js.map +1 -1
  97. package/dist/workflows/run/run-line.d.ts +5 -4
  98. package/dist/workflows/run/run-line.js +11 -6
  99. package/dist/workflows/run/run-line.js.map +1 -1
  100. package/dist/workflows/run/run-memory.d.ts +52 -0
  101. package/dist/workflows/run/run-memory.js +58 -0
  102. package/dist/workflows/run/run-memory.js.map +1 -0
  103. package/dist/workflows/run/run-settlement.d.ts +11 -4
  104. package/dist/workflows/run/run-settlement.js +21 -17
  105. package/dist/workflows/run/run-settlement.js.map +1 -1
  106. package/dist/workflows/run/session-events.d.ts +2 -0
  107. package/dist/workflows/run/session-events.js +2 -2
  108. package/dist/workflows/run/session-events.js.map +1 -1
  109. package/dist/workflows/run/turn-bookkeeping.d.ts +5 -5
  110. package/dist/workflows/run/turn-bookkeeping.js +7 -7
  111. package/dist/workflows/run/turn-bookkeeping.js.map +1 -1
  112. package/dist/workflows/run/turn-settler.d.ts +3 -0
  113. package/dist/workflows/run/turn-settler.js +7 -3
  114. package/dist/workflows/run/turn-settler.js.map +1 -1
  115. package/dist/workflows/run/wait-registry.d.ts +1 -0
  116. package/dist/workflows/run/wait-registry.js +1 -0
  117. package/dist/workflows/run/wait-registry.js.map +1 -1
  118. package/dist/workflows/run/wake-retries.d.ts +10 -6
  119. package/dist/workflows/run/wake-retries.js +14 -10
  120. package/dist/workflows/run/wake-retries.js.map +1 -1
  121. package/dist/workflows/run/worker-executions.d.ts +11 -2
  122. package/dist/workflows/run/worker-executions.js +15 -6
  123. package/dist/workflows/run/worker-executions.js.map +1 -1
  124. package/dist/workflows/run/worker-orphans.js +2 -0
  125. package/dist/workflows/run/worker-orphans.js.map +1 -1
  126. package/dist/workflows/run/worktree-autosave.d.ts +2 -1
  127. package/dist/workflows/run/worktree-autosave.js +2 -1
  128. package/dist/workflows/run/worktree-autosave.js.map +1 -1
  129. package/dist/workflows/run-states.js +2 -2
  130. package/dist/workflows/run-states.js.map +1 -1
  131. package/dist/workflows/run.d.ts +2 -0
  132. package/dist/workflows/run.js +12 -3
  133. package/dist/workflows/run.js.map +1 -1
  134. package/dist/workspace/projects.d.ts +2 -0
  135. package/dist/workspace/projects.js +3 -4
  136. package/dist/workspace/projects.js.map +1 -1
  137. package/dist/worktree-manifest.js +2 -4
  138. package/dist/worktree-manifest.js.map +1 -1
  139. package/package.json +4 -4
  140. package/scripts/mock-ask-answer.mjs +19 -0
  141. package/scripts/mock-codex-app-server.mjs +16 -4
  142. package/scripts/mock-opencode-questions.mjs +89 -0
  143. package/scripts/mock-opencode-serve.mjs +6 -72
@@ -11,6 +11,7 @@ import { tmpdir } from 'node:os';
11
11
  import { dirname, join } from 'node:path';
12
12
  import * as parityGateFs from 'node:fs';
13
13
  import { withoutSessionContextBody } from './mock-session-context.mjs';
14
+ import { questionReplies } from './mock-opencode-questions.mjs';
14
15
  const { failureControl, delivery } = await loadControls({ delivery: ['reject', 'hold-ack', 'hold-response'] });
15
16
  let inputClosed = false;
16
17
  // Bundled dry-run mock of `opencode serve` — speaks just enough of the HTTP+SSE
@@ -185,31 +186,8 @@ async function lifecycle(call) {
185
186
  }
186
187
  const finishText = async (text) => text + await lifecycle((await tools()).DONE);
187
188
 
188
- /** Questions the runner can look up an id for. `replyQuestion`/`rejectQuestion`
189
- * resolve the id through `GET /question` before answering (see
190
- * `opencode-server-runner.ts`), so a native ask needs an entry here. */
191
- const pendingQuestions = [];
192
189
  let echoSerial = 0;
193
- let lateQuestionReply = false;
194
- let answerDone = false;
195
190
 
196
- /** The question tool arrives as a `tool` part whose state.input holds it —
197
- * the shape `opencode-server-runner.test.ts`'s sendQuestion helper drives. */
198
- const sendQuestionPart = (input) =>
199
- send({
200
- type: 'message.part.updated',
201
- properties: {
202
- part: {
203
- id: 'prt_mock_question',
204
- messageID: MESSAGE_ID,
205
- sessionID: SESSION_ID,
206
- type: 'tool',
207
- callID: 'call_mock_question',
208
- tool: 'question',
209
- state: { status: 'running', input },
210
- },
211
- },
212
- });
213
191
  /** hearsay-tools/cezarion#1266: OpenCode 1.18.35 `permission.asked`. No `session.idle`
214
192
  * follows: the asking tool waits until `POST /permission/{id}/reply` answers it. */
215
193
  const pendingPermissionAsks = new Set();
@@ -252,11 +230,12 @@ const info = (extra) => ({
252
230
  tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } },
253
231
  ...extra,
254
232
  });
233
+ const questions = questionReplies({ send, info, finishText, sessionId: () => SESSION_ID, messageId: MESSAGE_ID });
255
234
 
256
235
  let autonomousTurn = 0;
257
236
  let autonomousCap = false;
258
237
  const bodyRoutes = [
259
- [(req, url) => req.method === 'POST' && /^\/question\/[^/]+\/(reply|reject)$/.test(url), replyToQuestion],
238
+ [(req, url) => req.method === 'POST' && /^\/question\/[^/]+\/(reply|reject)$/.test(url), questions.replyToQuestion],
260
239
  [(req, url) => req.method === 'POST' && /^\/permission\/([^/]+)\/reply$/.test(url), replyToPermission],
261
240
  [(req, url) => req.method === 'GET' && /^\/session\/([^/]+)$/.test(url), replyWithSession],
262
241
  [(req, url) => req.method === 'PATCH' && /^\/session\/([^/]+)$/.test(url), replyWithPatchedSession],
@@ -271,8 +250,7 @@ const nativeReplies = [
271
250
  [body => body.includes('mock:permission-late'), replyWithLatePermission],
272
251
  [body => body.includes('mock:permission-default'), replyWithDefaultPermission],
273
252
  [body => body.includes('mock:approval'), replyWithApproval],
274
- [body => body.includes('mock:ask-bad'), replyWithMalformedAsk],
275
- [body => body.includes('mock:ask'), replyWithAsk],
253
+ ...questions.promptRoutes,
276
254
  ];
277
255
  function matchesSessionPrompt(req, url) {
278
256
  const match = req.method === 'POST' && /^\/session\/([^/]+)\/(prompt_async|message)$/.exec(url);
@@ -291,7 +269,7 @@ function handleRequest(req, res) { wireRecorder?.recordHttpResponse(req, res);
291
269
  if (inputClosed && req.method === 'POST') { req.socket.destroy(); return; }
292
270
  if (req.method === 'GET' && url === '/question') {
293
271
  res.writeHead(200, { 'content-type': 'application/json' });
294
- res.end(JSON.stringify(pendingQuestions));
272
+ res.end(JSON.stringify(questions.pendingQuestions));
295
273
  return;
296
274
  }
297
275
  // Only user-written config, as the real server returns it: this user configured `bash: ask`,
@@ -421,24 +399,6 @@ function replyToPermission(req, res, url, body) {
421
399
  }, 30);
422
400
  return;
423
401
  }
424
- function replyToQuestion(req, res, url, body) {
425
- // Native question reply resumes the held turn, then its own session.idle
426
- // ends it (same SSE lifecycle shape as the baseline; never the HTTP ack).
427
- const answered = pendingQuestions.some(question => question.id === 'q_mock_1');
428
- pendingQuestions.length = 0;
429
- if (answered && url.endsWith('/reply')) setTimeout(async () => {
430
- const text = answerDone ? await finishText(`human answer: ${body}`) : `human answer: ${body}`;
431
- send({ type: 'message.part.updated', properties: { part: {
432
- id: 'prt_answer', messageID: MESSAGE_ID, sessionID: SESSION_ID, type: 'text', text,
433
- } } });
434
- // #505 review: CEZ_MOCK_OPENCODE_REPLY_HOLD_MS keeps the answered turn running.
435
- setTimeout(() => send({ type: 'session.idle', properties: { sessionID: SESSION_ID } }), Number(process.env.CEZ_MOCK_OPENCODE_REPLY_HOLD_MS ?? 0));
436
- }, 30);
437
- const acknowledge = () => { res.writeHead(200, { 'content-type': 'application/json' }); res.end('{}'); };
438
- if (lateQuestionReply) setTimeout(acknowledge, 250);
439
- else acknowledge();
440
- return;
441
- }
442
402
 
443
403
  async function replyWithSubagent(body) {
444
404
  // Wire shape from `__fixtures__/opencode/subtask-nested.ndjson`: a
@@ -542,33 +502,7 @@ async function replyWithApproval(body) {
542
502
  sendPermissionAsk('per_mock_1', 'bash', ['git status --short'], ['git status *']);
543
503
  return;
544
504
  }
545
- async function replyWithMalformedAsk(body) {
546
- // Malformed: `questions` is not an array, so the runner must REJECT the
547
- // native question and finish the turn rather than wait for an answer to
548
- // a card that can never render (#6's rejection path, harness parity R4).
549
- send({ type: 'message.updated', properties: { info: info({}) } });
550
- pendingQuestions.push({ id: 'q_mock_bad', sessionID: SESSION_ID });
551
- sendQuestionPart({ questions: 'not-an-array' });
552
- setTimeout(() => send({ type: 'session.idle', properties: { sessionID: SESSION_ID } }), 60);
553
- return;
554
- }
555
- async function replyWithAsk(body) {
556
- lateQuestionReply = body.includes('mock:ask-reply-late');
557
- answerDone = body.includes('mock:ask-reply-late-cezar-done') || body.includes('mock:resume-cezar-done');
558
- // The native question tool (#6). No `session.idle` follows: a real ask
559
- // holds the turn open until the answer is routed back.
560
- send({ type: 'message.updated', properties: { info: info({}) } });
561
- pendingQuestions.push({ id: 'q_mock_1', sessionID: SESSION_ID });
562
- sendQuestionPart({ questions: [{
563
- header: 'Library',
564
- question: 'Which test library?',
565
- options: [
566
- { label: 'Vitest', description: 'Use the existing test runner' },
567
- { label: 'Node test', description: 'Use node:test' },
568
- ],
569
- }] });
570
- return;
571
- }
505
+
572
506
 
573
507
  /** The turn's usage, then the session goes idle. */
574
508
  function sendUsageThenIdle() {