@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.
- package/dist/agent-config/seed.js +1 -6
- package/dist/agent-config/seed.js.map +1 -1
- package/dist/autosave-git.js +3 -4
- package/dist/autosave-git.js.map +1 -1
- package/dist/ci-wait/controller.d.ts +37 -37
- package/dist/core/backend-detect.js +2 -1
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/codex-hook-mapper.js +2 -1
- package/dist/core/codex-hook-mapper.js.map +1 -1
- package/dist/core/codex-ui-mapper.js +2 -2
- package/dist/core/codex-ui-mapper.js.map +1 -1
- package/dist/core/cursor-print-runner.js +2 -1
- package/dist/core/cursor-print-runner.js.map +1 -1
- package/dist/core/omp-runner.js +4 -5
- package/dist/core/omp-runner.js.map +1 -1
- package/dist/core/omp-subagent-rows.js +2 -1
- package/dist/core/omp-subagent-rows.js.map +1 -1
- package/dist/core/opencode-ui-mapper.js +2 -2
- package/dist/core/opencode-ui-mapper.js.map +1 -1
- package/dist/core/own-lookup.d.ts +5 -0
- package/dist/core/own-lookup.js +8 -0
- package/dist/core/own-lookup.js.map +1 -0
- package/dist/data-gitignore.js +2 -2
- package/dist/data-gitignore.js.map +1 -1
- package/dist/delegation/cli.js +2 -2
- package/dist/delegation/cli.js.map +1 -1
- package/dist/delegation/context.js +7 -11
- package/dist/delegation/context.js.map +1 -1
- package/dist/delegation/results.js +2 -2
- package/dist/delegation/results.js.map +1 -1
- package/dist/delegation/routes.d.ts +15 -15
- package/dist/delegation/service.js +2 -4
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +71 -71
- package/dist/git-command.d.ts +29 -0
- package/dist/git-command.js +27 -1
- package/dist/git-command.js.map +1 -1
- package/dist/git-worktree-lock-helper.d.ts +2 -0
- package/dist/git-worktree-lock-helper.js +12 -14
- package/dist/git-worktree-lock-helper.js.map +1 -1
- package/dist/git-worktree-lock.js +3 -10
- package/dist/git-worktree-lock.js.map +1 -1
- package/dist/project-migration/containment.js +2 -4
- package/dist/project-migration/containment.js.map +1 -1
- package/dist/project-migration/plan.js +2 -4
- package/dist/project-migration/plan.js.map +1 -1
- package/dist/release/publication.js +2 -2
- package/dist/release/publication.js.map +1 -1
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/checkout.js +5 -5
- package/dist/server/checkout.js.map +1 -1
- package/dist/server/create-project.js +9 -10
- package/dist/server/create-project.js.map +1 -1
- package/dist/server/forge/draft-pr.js +17 -13
- package/dist/server/forge/draft-pr.js.map +1 -1
- package/dist/server/git.js +2 -4
- package/dist/server/git.js.map +1 -1
- package/dist/server/repo-pull.js +3 -7
- package/dist/server/repo-pull.js.map +1 -1
- package/dist/server/server.d.ts +1626 -1617
- package/dist/server/server.js +22 -35
- package/dist/server/server.js.map +1 -1
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/dist/skills-remote.js +8 -12
- package/dist/skills-remote.js.map +1 -1
- package/dist/task-branch-head.js +2 -4
- package/dist/task-branch-head.js.map +1 -1
- package/dist/task-cli/discovery.js +2 -4
- package/dist/task-cli/discovery.js.map +1 -1
- package/dist/ui-state.d.ts +7 -6
- package/dist/ui-state.js +31 -6
- package/dist/ui-state.js.map +1 -1
- package/dist/workflows/run/attachment-writer.d.ts +5 -4
- package/dist/workflows/run/attachment-writer.js +9 -7
- package/dist/workflows/run/attachment-writer.js.map +1 -1
- package/dist/workflows/run/compose.d.ts +4 -1
- package/dist/workflows/run/compose.js +14 -10
- package/dist/workflows/run/compose.js.map +1 -1
- package/dist/workflows/run/continuation-acceptance.d.ts +4 -1
- package/dist/workflows/run/continuation-acceptance.js +4 -1
- package/dist/workflows/run/continuation-acceptance.js.map +1 -1
- package/dist/workflows/run/family-reconciler.d.ts +4 -0
- package/dist/workflows/run/family-reconciler.js +4 -0
- package/dist/workflows/run/family-reconciler.js.map +1 -1
- package/dist/workflows/run/inbox-claims.d.ts +2 -0
- package/dist/workflows/run/inbox-claims.js +2 -0
- package/dist/workflows/run/inbox-claims.js.map +1 -1
- package/dist/workflows/run/maintenance-claims.d.ts +2 -0
- package/dist/workflows/run/maintenance-claims.js +2 -0
- package/dist/workflows/run/maintenance-claims.js.map +1 -1
- package/dist/workflows/run/memory-guard.d.ts +6 -6
- package/dist/workflows/run/memory-guard.js +8 -8
- package/dist/workflows/run/memory-guard.js.map +1 -1
- package/dist/workflows/run/queued-input.d.ts +12 -10
- package/dist/workflows/run/queued-input.js +17 -16
- package/dist/workflows/run/queued-input.js.map +1 -1
- package/dist/workflows/run/run-line.d.ts +5 -4
- package/dist/workflows/run/run-line.js +11 -6
- package/dist/workflows/run/run-line.js.map +1 -1
- package/dist/workflows/run/run-memory.d.ts +52 -0
- package/dist/workflows/run/run-memory.js +58 -0
- package/dist/workflows/run/run-memory.js.map +1 -0
- package/dist/workflows/run/run-settlement.d.ts +11 -4
- package/dist/workflows/run/run-settlement.js +21 -17
- package/dist/workflows/run/run-settlement.js.map +1 -1
- package/dist/workflows/run/session-events.d.ts +2 -0
- package/dist/workflows/run/session-events.js +2 -2
- package/dist/workflows/run/session-events.js.map +1 -1
- package/dist/workflows/run/turn-bookkeeping.d.ts +5 -5
- package/dist/workflows/run/turn-bookkeeping.js +7 -7
- package/dist/workflows/run/turn-bookkeeping.js.map +1 -1
- package/dist/workflows/run/turn-settler.d.ts +3 -0
- package/dist/workflows/run/turn-settler.js +7 -3
- package/dist/workflows/run/turn-settler.js.map +1 -1
- package/dist/workflows/run/wait-registry.d.ts +1 -0
- package/dist/workflows/run/wait-registry.js +1 -0
- package/dist/workflows/run/wait-registry.js.map +1 -1
- package/dist/workflows/run/wake-retries.d.ts +10 -6
- package/dist/workflows/run/wake-retries.js +14 -10
- package/dist/workflows/run/wake-retries.js.map +1 -1
- package/dist/workflows/run/worker-executions.d.ts +11 -2
- package/dist/workflows/run/worker-executions.js +15 -6
- package/dist/workflows/run/worker-executions.js.map +1 -1
- package/dist/workflows/run/worker-orphans.js +2 -0
- package/dist/workflows/run/worker-orphans.js.map +1 -1
- package/dist/workflows/run/worktree-autosave.d.ts +2 -1
- package/dist/workflows/run/worktree-autosave.js +2 -1
- package/dist/workflows/run/worktree-autosave.js.map +1 -1
- package/dist/workflows/run-states.js +2 -2
- package/dist/workflows/run-states.js.map +1 -1
- package/dist/workflows/run.d.ts +2 -0
- package/dist/workflows/run.js +12 -3
- package/dist/workflows/run.js.map +1 -1
- package/dist/workspace/projects.d.ts +2 -0
- package/dist/workspace/projects.js +3 -4
- package/dist/workspace/projects.js.map +1 -1
- package/dist/worktree-manifest.js +2 -4
- package/dist/worktree-manifest.js.map +1 -1
- package/package.json +4 -4
- package/scripts/mock-ask-answer.mjs +19 -0
- package/scripts/mock-codex-app-server.mjs +16 -4
- package/scripts/mock-opencode-questions.mjs +89 -0
- 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
|
-
|
|
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
|
-
|
|
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() {
|