@mcoda/codali 0.1.135-codali.40 → 0.1.135-codali.42

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 (82) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/README.md +8 -0
  3. package/config/skills/testing-and-verification/SKILL.md +5 -5
  4. package/config/skills/webapp-testing/SKILL.md +13 -0
  5. package/config/skills/webapp-testing/journey-driver.mjs +85 -0
  6. package/dist/cli/TerminalCommand.js +2 -2
  7. package/dist/cli/tui/TerminalPresentation.js +1 -1
  8. package/dist/config/OrchestrationConfig.d.ts +1 -0
  9. package/dist/config/OrchestrationConfig.d.ts.map +1 -1
  10. package/dist/config/OrchestrationConfig.js +8 -3
  11. package/dist/docdex/DocdexClient.d.ts +11 -0
  12. package/dist/docdex/DocdexClient.d.ts.map +1 -1
  13. package/dist/docdex/DocdexClient.js +55 -1
  14. package/dist/permissions/PermissionGate.d.ts +7 -0
  15. package/dist/permissions/PermissionGate.d.ts.map +1 -1
  16. package/dist/permissions/PermissionGate.js +26 -0
  17. package/dist/providers/ConfiguredProvider.d.ts +2 -0
  18. package/dist/providers/ConfiguredProvider.d.ts.map +1 -1
  19. package/dist/providers/ConfiguredProvider.js +29 -0
  20. package/dist/providers/ModelServiceError.d.ts +2 -2
  21. package/dist/providers/ModelServiceError.d.ts.map +1 -1
  22. package/dist/providers/ModelServiceError.js +4 -0
  23. package/dist/runtime/AnswerVerification.d.ts +14 -0
  24. package/dist/runtime/AnswerVerification.d.ts.map +1 -1
  25. package/dist/runtime/AnswerVerification.js +26 -0
  26. package/dist/runtime/ContextCompression.d.ts +5 -0
  27. package/dist/runtime/ContextCompression.d.ts.map +1 -1
  28. package/dist/runtime/ContextCompression.js +16 -4
  29. package/dist/runtime/FigureCheck.d.ts +20 -0
  30. package/dist/runtime/FigureCheck.d.ts.map +1 -0
  31. package/dist/runtime/FigureCheck.js +44 -0
  32. package/dist/runtime/InteractionContract.d.ts +22 -0
  33. package/dist/runtime/InteractionContract.d.ts.map +1 -1
  34. package/dist/runtime/InteractionContract.js +41 -0
  35. package/dist/runtime/InteractionRouter.d.ts +3 -3
  36. package/dist/runtime/InteractionRouter.d.ts.map +1 -1
  37. package/dist/runtime/InteractionRouter.js +1 -1
  38. package/dist/runtime/OutageWait.d.ts +33 -5
  39. package/dist/runtime/OutageWait.d.ts.map +1 -1
  40. package/dist/runtime/OutageWait.js +68 -8
  41. package/dist/runtime/ResearchEvidence.d.ts +21 -1
  42. package/dist/runtime/ResearchEvidence.d.ts.map +1 -1
  43. package/dist/runtime/ResearchEvidence.js +109 -3
  44. package/dist/runtime/ReviewCoordinator.d.ts.map +1 -1
  45. package/dist/runtime/ReviewCoordinator.js +2 -1
  46. package/dist/runtime/ReviewSource.d.ts +5 -0
  47. package/dist/runtime/ReviewSource.d.ts.map +1 -1
  48. package/dist/runtime/ReviewSource.js +6 -1
  49. package/dist/runtime/SessionController.d.ts +71 -1
  50. package/dist/runtime/SessionController.d.ts.map +1 -1
  51. package/dist/runtime/SessionController.js +553 -39
  52. package/dist/runtime/TaskReview.d.ts.map +1 -1
  53. package/dist/runtime/TaskReview.js +17 -2
  54. package/dist/runtime/VerificationCommand.d.ts +8 -0
  55. package/dist/runtime/VerificationCommand.d.ts.map +1 -1
  56. package/dist/runtime/VerificationCommand.js +114 -0
  57. package/dist/runtime/WorkingStyle.d.ts +20 -0
  58. package/dist/runtime/WorkingStyle.d.ts.map +1 -0
  59. package/dist/runtime/WorkingStyle.js +71 -0
  60. package/dist/tools/ToolRegistry.d.ts.map +1 -1
  61. package/dist/tools/ToolRegistry.js +19 -2
  62. package/dist/tools/ToolTypes.d.ts +3 -0
  63. package/dist/tools/ToolTypes.d.ts.map +1 -1
  64. package/dist/tools/browser/BrowserTool.d.ts +23 -1
  65. package/dist/tools/browser/BrowserTool.d.ts.map +1 -1
  66. package/dist/tools/browser/BrowserTool.js +83 -4
  67. package/dist/tools/browser/HttpFallback.d.ts +39 -0
  68. package/dist/tools/browser/HttpFallback.d.ts.map +1 -0
  69. package/dist/tools/browser/HttpFallback.js +240 -0
  70. package/dist/tools/calculation/CalculatorTool.d.ts +16 -1
  71. package/dist/tools/calculation/CalculatorTool.d.ts.map +1 -1
  72. package/dist/tools/calculation/CalculatorTool.js +147 -20
  73. package/dist/tools/shell/AsyncProcess.d.ts.map +1 -1
  74. package/dist/tools/shell/AsyncProcess.js +6 -0
  75. package/dist/tools/shell/IsolatedExecutor.d.ts.map +1 -1
  76. package/dist/tools/shell/IsolatedExecutor.js +10 -2
  77. package/dist/tools/shell/ShellTool.d.ts +2 -0
  78. package/dist/tools/shell/ShellTool.d.ts.map +1 -1
  79. package/dist/tools/shell/ShellTool.js +32 -2
  80. package/dist/tools/verification/VitestTool.d.ts.map +1 -1
  81. package/dist/tools/verification/VitestTool.js +75 -5
  82. package/package.json +3 -3
@@ -10,16 +10,23 @@ export const outageWaitsMs = (budget = process.env.CODALI_MODEL_OUTAGE_WAIT_MS)
10
10
  let waited = 0;
11
11
  return PREFLIGHT_RECOVERY_WAITS_MS.filter(wait => (waited += wait) <= total);
12
12
  };
13
- /** The longest a turn waits out one model-service outage. The ladder alone
14
- * (about four minutes) lost a three-hour build to a nine-minute relay outage. */
15
- export const MODEL_OUTAGE_WAIT_MS = 30 * 60000;
13
+ /** The longest one model-service outage is waited out when the turn itself has
14
+ * no time limit (an interactive session, an open-ended build). Outages happen
15
+ * in real use: a node restarts, a host runs out of memory, a gateway queue
16
+ * backs up. The 30 minutes allowed before (and half the turn's remaining
17
+ * time) ended long builds on outages they could have outlasted. Six hours by
18
+ * default; CODALI_MODEL_OUTAGE_WAIT_MS raises or lowers it. */
19
+ export const MODEL_OUTAGE_WAIT_MS = 6 * 3600000;
20
+ /** Time kept back before a turn's limit, so the turn can still hand over what
21
+ * it has (a draft, a status report) when the service is still down then. */
22
+ export const OUTAGE_DELIVERY_RESERVE_MS = 90000;
16
23
  /** The wait before outage retry `attempt` (0-based): the ladder, then a minute
17
- * per retry, while the total stays within the host's budget
18
- * (CODALI_MODEL_OUTAGE_WAIT_MS), MODEL_OUTAGE_WAIT_MS and half the time the
19
- * turn has left. Undefined once the outage has used that allowance. */
24
+ * per retry. The total stays within the host's budget (CODALI_MODEL_OUTAGE_WAIT_MS,
25
+ * default MODEL_OUTAGE_WAIT_MS) and within the turn's remaining time less
26
+ * OUTAGE_DELIVERY_RESERVE_MS. Undefined once the outage has used that allowance. */
20
27
  export const outageWaitMs = (attempt, remainingMs = Infinity, budget = process.env.CODALI_MODEL_OUTAGE_WAIT_MS) => {
21
- const parsed = budget === undefined || budget.trim() === "" ? Infinity : Number(budget);
22
- const cap = Math.min(parsed >= 0 ? parsed : Infinity, MODEL_OUTAGE_WAIT_MS, remainingMs * 0.5);
28
+ const parsed = budget === undefined || budget.trim() === "" ? MODEL_OUTAGE_WAIT_MS : Number(budget);
29
+ const cap = Math.min(parsed >= 0 ? parsed : MODEL_OUTAGE_WAIT_MS, remainingMs - OUTAGE_DELIVERY_RESERVE_MS);
23
30
  let waited = 0;
24
31
  for (let index = 0; index <= attempt; index++) {
25
32
  const wait = PREFLIGHT_RECOVERY_WAITS_MS[index] ?? 60000;
@@ -31,3 +38,56 @@ export const outageWaitMs = (attempt, remainingMs = Infinity, budget = process.e
31
38
  }
32
39
  return undefined;
33
40
  };
41
+ /** Compute the next delay from actual elapsed outage time. A server-directed
42
+ * delay must fit in full, including the time reserved for the final response. */
43
+ export const outageRetryDelayMs = (attempt, remainingMs, elapsedMs, retryAfterSeconds, injected, budget = process.env.CODALI_MODEL_OUTAGE_WAIT_MS) => {
44
+ const parsed = budget?.trim() ? Number(budget) : MODEL_OUTAGE_WAIT_MS;
45
+ const allowance = Number.isFinite(parsed) && parsed >= 0 ? parsed : MODEL_OUTAGE_WAIT_MS;
46
+ const step = injected ? [500, 2000][attempt] : PREFLIGHT_RECOVERY_WAITS_MS[attempt] ?? 60000;
47
+ if (step === undefined)
48
+ return undefined;
49
+ const wait = Math.max(step, retryAfterSeconds * 1000);
50
+ // Interactive turns default to 90 seconds. Preserve a quick retry on those
51
+ // turns while leaving the full delivery reserve on long-running requests.
52
+ const reserveMs = Math.min(OUTAGE_DELIVERY_RESERVE_MS, remainingMs / 2);
53
+ const available = Math.min(allowance - elapsedMs, remainingMs - reserveMs);
54
+ if (injected && retryAfterSeconds > 2)
55
+ return undefined;
56
+ return wait <= available ? wait : undefined;
57
+ };
58
+ const NETWORK_CODES = new Set(["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT", "ENOTFOUND", "EAI_AGAIN", "EHOSTUNREACH", "ENETUNREACH", "ENETDOWN", "ECONNABORTED",
59
+ "UND_ERR_SOCKET", "UND_ERR_CONNECT_TIMEOUT", "UND_ERR_HEADERS_TIMEOUT", "UND_ERR_BODY_TIMEOUT", "UND_ERR_CLOSED"]);
60
+ /** Whether an error says the model service could not be reached at all (as
61
+ * opposed to a refusal it gave). A dropped stream ("terminated"), a failed
62
+ * connection ("fetch failed") and their low-level codes all count; so does a
63
+ * timed-out catalog request, which only means the gateway did not answer. */
64
+ export const transportOutage = (error) => {
65
+ let current = error;
66
+ for (let depth = 0; current && typeof current === "object" && depth < 4; current = current.cause, depth++) {
67
+ const code = current.code;
68
+ if (typeof code === "string" && NETWORK_CODES.has(code))
69
+ return true;
70
+ if (current instanceof TypeError && /^(?:fetch failed|terminated|network error)$/i.test(String(current.message)))
71
+ return true;
72
+ if (current instanceof Error && current.message === "Service request timed out")
73
+ return true;
74
+ }
75
+ return false;
76
+ };
77
+ /** How long one model request may stay unanswered before it is abandoned and
78
+ * retried. A request whose connection was lost, or that a scheduler dropped,
79
+ * never returns: a 12-hour build sat on one such review call for 158 minutes
80
+ * and ended unfinished although its work was done.
81
+ *
82
+ * The base allowance is the larger of ten minutes and four times the slowest
83
+ * request this turn has completed, but no more than the request could need at
84
+ * its ceiling on a slow server: two minutes to be scheduled, the prompt read at
85
+ * 1,000 tokens a second and the full output at 25. It doubles with every stall
86
+ * of the same request, without an upper bound short of an hour, so a model
87
+ * slower than those rates is waited for longer each time instead of being cut
88
+ * off at the same point for ever. */
89
+ export const modelStallAllowanceMs = (inputTokens, maxOutputTokens, longestModelMs, stalledAttempts = 0) => {
90
+ const ceiling = 120000 + Math.max(0, inputTokens) + Math.max(0, maxOutputTokens) * 40;
91
+ const base = Math.max(60000, Math.min(Math.max(600000, longestModelMs * 4), ceiling));
92
+ return Math.min(base * 2 ** Math.min(Math.max(0, stalledAttempts), 6), Math.max(base, 3600000));
93
+ };
@@ -13,7 +13,27 @@ export interface ResearchPacket {
13
13
  /** Strip repeated transport metadata, not supporting passages. Missing search
14
14
  * matches aren't source evidence and must not evict actual retrieved text. */
15
15
  export declare function researchPacket(tool: string, input: unknown, output: string): ResearchPacket | undefined;
16
+ /** Exact quotes and specific figures/identifiers in a draft: the claims an
17
+ * audit must be able to check against the passage they came from. */
18
+ export declare function draftAnchors(draft: string): string[];
16
19
  /** Bound audit input while retaining source diversity and relevant earlier
17
- * passages. FIFO eviction made late failed searches erase valid citations. */
20
+ * passages. FIFO eviction made late failed searches erase valid citations.
21
+ * Passages that carry the draft's own quotes and figures come first: in cycle 5
22
+ * the audit saw 9 of 67 passages, missed the one with "Civil penalty: 30,000
23
+ * penalty units", and relabelled that verbatim quote as unverified. */
18
24
  export declare function selectResearchEvidence(packets: ResearchPacket[], request: string, draft: string, maxChars?: number): ResearchPacket[];
25
+ /** What an investigation found, as a report, for when its answer could not be
26
+ * written: the model service was down or the final request would have run past
27
+ * the time limit. In cycle 6 a 41-minute investigation delivered nothing
28
+ * because that request hit three gateway timeouts in its last three minutes.
29
+ * Built without a model, so it is ready at once. It says plainly that it is
30
+ * evidence and not an answer, and quotes at most 25 words from any one source:
31
+ * the sentence that shares most with the request, figures and dates first. */
32
+ export declare function evidenceReport(packets: ResearchPacket[], request: string, reason: string, maxSources?: number): string | undefined;
33
+ /** The points a research draft itself leaves open: the sentences or list items
34
+ * in which it says something was not found, not verified or only alleged.
35
+ * A draft that says so with time left has not finished its research; in cycle
36
+ * 6 one called a core fact "alleged" and stopped with a quarter of its time
37
+ * unused. Decided from the draft's own words, not from the question. */
38
+ export declare function openResearchPoints(draft: string, limit?: number): string[];
19
39
  //# sourceMappingURL=ResearchEvidence.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResearchEvidence.d.ts","sourceRoot":"","sources":["../../src/runtime/ResearchEvidence.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9I,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAAE;AAE1F;8EAC8E;AAC9E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAmBvG;AAED;8EAC8E;AAC9E,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAQ,GAAG,cAAc,EAAE,CAmBpI"}
1
+ {"version":3,"file":"ResearchEvidence.d.ts","sourceRoot":"","sources":["../../src/runtime/ResearchEvidence.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9I,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAAE;AAE1F;8EAC8E;AAC9E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAmBvG;AAID;qEACqE;AACrE,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAUpD;AAED;;;;uEAIuE;AACvE,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAQ,GAAG,cAAc,EAAE,CAqCpI;AAED;;;;;;8EAM8E;AAC9E,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,SAAK,GAAG,MAAM,GAAG,SAAS,CAuB9H;AAID;;;;wEAIwE;AACxE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,MAAM,EAAE,CAcrE"}
@@ -26,9 +26,28 @@ export function researchPacket(tool, input, output) {
26
26
  catch { /* Docdex may return source-labelled text instead of JSON. */ }
27
27
  return output.trim() ? { source: tool, passage: output.slice(0, 4000), tool, query } : undefined;
28
28
  }
29
+ const squash = (text) => text.toLowerCase().replace(/[‘’]/gu, "'").replace(/[“”]/gu, '"').replace(/[‐-―−]/gu, "-").replace(/\s+/gu, " ");
30
+ /** Exact quotes and specific figures/identifiers in a draft: the claims an
31
+ * audit must be able to check against the passage they came from. */
32
+ export function draftAnchors(draft) {
33
+ const text = squash(draft), anchors = new Set();
34
+ for (const match of text.matchAll(/"([^"]{12,200})"/gu))
35
+ anchors.add(match[1].trim());
36
+ for (const match of text.matchAll(/(?<![\p{L}\p{N}])(?:\p{L}*\d[\p{L}\p{N}]*(?:[.,/:-]\p{N}+)*)(?![\p{L}\p{N}])/gu)) {
37
+ const token = match[0];
38
+ // Skip bare small numbers and single years: they match almost any page.
39
+ if (token.length < 4 || /^(?:19|20)\d\d$/u.test(token))
40
+ continue;
41
+ anchors.add(token);
42
+ }
43
+ return [...anchors].slice(0, 200);
44
+ }
29
45
  /** Bound audit input while retaining source diversity and relevant earlier
30
- * passages. FIFO eviction made late failed searches erase valid citations. */
31
- export function selectResearchEvidence(packets, request, draft, maxChars = 24000) {
46
+ * passages. FIFO eviction made late failed searches erase valid citations.
47
+ * Passages that carry the draft's own quotes and figures come first: in cycle 5
48
+ * the audit saw 9 of 67 passages, missed the one with "Civil penalty: 30,000
49
+ * penalty units", and relabelled that verbatim quote as unverified. */
50
+ export function selectResearchEvidence(packets, request, draft, maxChars = 48000) {
32
51
  const words = new Set((request + " " + draft).toLowerCase().match(/[\p{L}\p{N}_]{4,}/gu) ?? []);
33
52
  const unique = [...new Map(packets.map(packet => [packet.source + "\n" + packet.passage, packet])).values()];
34
53
  const ranked = unique.map((packet, index) => {
@@ -36,12 +55,39 @@ export function selectResearchEvidence(packets, request, draft, maxChars = 24000
36
55
  const overlap = [...terms].filter(term => words.has(term)).length;
37
56
  return { packet, index, score: overlap / Math.sqrt(Math.max(1, terms.size)) + (packet.query ? 1 : 0) };
38
57
  }).sort((a, b) => b.score - a.score || a.index - b.index);
58
+ // Greedy cover of the draft's anchors, within part of the budget.
59
+ const anchors = draftAnchors(draft), uncovered = new Set(anchors), anchored = [];
60
+ const passages = new Map(ranked.map(value => [value.index, squash(value.packet.passage)]));
61
+ let anchorChars = 0;
62
+ while (uncovered.size) {
63
+ let best, bestHits = 0;
64
+ for (const value of ranked) {
65
+ if (anchored.includes(value))
66
+ continue;
67
+ const passage = passages.get(value.index);
68
+ const hits = [...uncovered].filter(anchor => passage.includes(anchor)).length;
69
+ if (hits > bestHits) {
70
+ best = value;
71
+ bestHits = hits;
72
+ }
73
+ }
74
+ if (!best)
75
+ break;
76
+ const size = JSON.stringify(best.packet).length + 1;
77
+ if (anchorChars + size > maxChars * 0.6)
78
+ break;
79
+ anchorChars += size;
80
+ anchored.push(best);
81
+ for (const anchor of [...uncovered])
82
+ if (passages.get(best.index).includes(anchor))
83
+ uncovered.delete(anchor);
84
+ }
39
85
  const sources = new Set();
40
86
  const leaders = ranked.filter(value => { if (sources.has(value.packet.source))
41
87
  return false; sources.add(value.packet.source); return true; });
42
88
  const selected = [], included = new Set();
43
89
  let chars = 2;
44
- for (const value of [...leaders, ...ranked]) {
90
+ for (const value of [...anchored, ...leaders, ...ranked]) {
45
91
  if (included.has(value.index))
46
92
  continue;
47
93
  const size = JSON.stringify(value.packet).length + 1;
@@ -53,3 +99,63 @@ export function selectResearchEvidence(packets, request, draft, maxChars = 24000
53
99
  }
54
100
  return selected;
55
101
  }
102
+ /** What an investigation found, as a report, for when its answer could not be
103
+ * written: the model service was down or the final request would have run past
104
+ * the time limit. In cycle 6 a 41-minute investigation delivered nothing
105
+ * because that request hit three gateway timeouts in its last three minutes.
106
+ * Built without a model, so it is ready at once. It says plainly that it is
107
+ * evidence and not an answer, and quotes at most 25 words from any one source:
108
+ * the sentence that shares most with the request, figures and dates first. */
109
+ export function evidenceReport(packets, request, reason, maxSources = 30) {
110
+ // A search result packet carries several pages as JSON (possibly cut short); read each as its own source.
111
+ const pages = packets.flatMap(packet => /^https?:/.test(packet.source) ? [{ source: packet.source, passage: packet.passage }]
112
+ : [...packet.passage.matchAll(/"url"\s*:\s*"(https?:[^"\s]{1,1000})"\s*,\s*"content"\s*:\s*"((?:[^"\\]|\\.){0,3000})/gu)]
113
+ .map(match => ({ source: match[1], passage: match[2].replace(/\\[nrt]/gu, " ").replace(/\\(["\\/])/gu, "$1") })))
114
+ .filter(page => page.passage.trim().length >= 40);
115
+ if (!pages.length)
116
+ return undefined;
117
+ const terms = new Set(request.toLowerCase().match(/[\p{L}\p{N}_]{4,}/gu) ?? []);
118
+ const best = new Map();
119
+ for (const packet of pages) {
120
+ for (const sentence of packet.passage.replace(/\s+/gu, " ").split(/(?<=[.!?])\s+|\s+[-•|]\s+/u)) {
121
+ const words = sentence.trim().split(" ").filter(Boolean);
122
+ if (words.length < 5)
123
+ continue;
124
+ const overlap = new Set(words.map(word => word.toLowerCase().replace(/[^\p{L}\p{N}_]/gu, "")).filter(word => terms.has(word))).size;
125
+ const score = overlap * 2 + Math.min(4, words.filter(word => /\d/.test(word)).length);
126
+ const current = best.get(packet.source);
127
+ if (!current || score > current.score)
128
+ best.set(packet.source, { score, excerpt: words.slice(0, 25).join(" ") + (words.length > 25 ? " …" : "") });
129
+ }
130
+ }
131
+ const ranked = [...best.entries()].sort((a, b) => b[1].score - a[1].score).slice(0, maxSources);
132
+ if (!ranked.length)
133
+ return undefined;
134
+ return [`I could not finish writing the answer: ${reason}. What follows is the evidence gathered, not an answer: the pages that were read, each with the one short excerpt closest to the question. Nothing here has been checked against the question as a whole, and points it does not cover remain unanswered.`,
135
+ "", ...ranked.map(([source, { excerpt }], index) => `${index + 1}. ${source}\n "${excerpt}"`)].join("\n");
136
+ }
137
+ const OPEN_POINT = /\b(?:unverified|not (?:been )?(?:independently )?verified|unconfirmed|(?:could not|couldn't|can ?not|cannot|was unable to|were unable to|unable to|failed to|did not manage to) (?:be )?(?:independently )?(?:verif(?:y|ied)|confirm(?:ed)?|find|found|locate[d]?|access(?:ed)?|retrieved?|determined?|establish(?:ed)?|open(?:ed)?)|no (?:primary|official|direct|reliable|authoritative) (?:source|page|document|record|figure|confirmation)s? (?:was|were|has been|have been|could be) (?:found|located|retrieved|identified)|(?:was|were) not found (?:during|in) (?:this|the|my) (?:research|search|investigation|review)|remains? (?:unclear|unconfirmed|to be (?:confirmed|verified|determined))|to be (?:confirmed|determined|verified)|tbd)\b/iu;
138
+ /** The points a research draft itself leaves open: the sentences or list items
139
+ * in which it says something was not found, not verified or only alleged.
140
+ * A draft that says so with time left has not finished its research; in cycle
141
+ * 6 one called a core fact "alleged" and stopped with a quarter of its time
142
+ * unused. Decided from the draft's own words, not from the question. */
143
+ export function openResearchPoints(draft, limit = 8) {
144
+ const points = [], seen = new Set();
145
+ for (const block of draft.split(/\n+/u)) {
146
+ const line = block.replace(/^[\s>#*|-]+|[\s*|]+$/gu, "").replace(/\*\*/gu, "");
147
+ if (line.length < 12 || !OPEN_POINT.test(line))
148
+ continue;
149
+ // Only the sentences that carry the admission, not the settled ones beside them.
150
+ for (const sentence of line.split(/(?<=[.!?])\s+(?=[\p{Lu}\d"“(])/u).filter(part => OPEN_POINT.test(part))) {
151
+ const point = sentence.replace(/\s+/gu, " ").trim().slice(0, 240), key = point.toLowerCase().slice(0, 80);
152
+ if (seen.has(key))
153
+ continue;
154
+ seen.add(key);
155
+ points.push(point);
156
+ if (points.length >= limit)
157
+ return points;
158
+ }
159
+ }
160
+ return points;
161
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ReviewCoordinator.d.ts","sourceRoot":"","sources":["../../src/runtime/ReviewCoordinator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAgD,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC9G,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAiB,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAG9F,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,qBAAqB,EAAE,MAAM,CAAC;CAC/B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,EAAE,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC9C,mBAAmB,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACtD,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACjG,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5E,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA8F5B"}
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
2
2
  import { prepareReviewContract, reviewContractSources } from "./ReviewContract.js";
3
3
  import { reviewPromptContext } from "./TaskReviewContext.js";
4
4
  import { runTaskReview } from "./TaskReview.js";
5
+ import { REVIEW_PAGE_CHARS } from "./ReviewSource.js";
5
6
  import { validationOutputExcerpt } from "./ValidationOutput.js";
6
7
  export function reviewWorkspaceHash(hashes) {
7
8
  return createHash("sha256").update(JSON.stringify(Object.fromEntries(Object.entries(hashes)
@@ -109,7 +110,7 @@ export async function reviewTaskScope(options) {
109
110
  for (const file of initialPaths) {
110
111
  if (remaining <= 0)
111
112
  break;
112
- const evidence = await options.readSource(file, Math.min(8000, Math.floor(remaining / 2)));
113
+ const evidence = await options.readSource(file, Math.min(REVIEW_PAGE_CHARS, Math.floor(remaining / 2)));
113
114
  const addedChars = JSON.stringify({ [file]: evidence.content }).length + 32;
114
115
  if (addedChars > remaining)
115
116
  continue;
@@ -4,6 +4,11 @@ export declare const readReviewSource: (root: string, relative: string, expected
4
4
  content: string;
5
5
  truncated: boolean;
6
6
  }>;
7
+ /** Characters of one source page. At 8,000 a reviewer needed six or seven
8
+ * requests (a model call each) to read one 50k-character file, and ran into
9
+ * its four-round limit before it could decide; the review prompt is still
10
+ * fitted to the model's context after pages are added. */
11
+ export declare const REVIEW_PAGE_CHARS = 24000;
7
12
  /** Page offsets refer to redacted text, so repeated reads cannot reconstruct a secret. */
8
13
  export declare function readReviewSourcePage(root: string, relative: string, expectedHash: string, offset: number): Promise<ReviewSourcePage>;
9
14
  //# sourceMappingURL=ReviewSource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReviewSource.d.ts","sourceRoot":"","sources":["../../src/runtime/ReviewSource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,kFAAkF;AAClF,eAAO,MAAM,gBAAgB,GAAU,MAAM,MAAM,EAAE,UAAU,MAAM,EAAE,cAAc,MAAM,EAAE,UAAU,MAAM,KAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAyB9J,CAAC;AAEF,0FAA0F;AAC1F,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAQ1I"}
1
+ {"version":3,"file":"ReviewSource.d.ts","sourceRoot":"","sources":["../../src/runtime/ReviewSource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,kFAAkF;AAClF,eAAO,MAAM,gBAAgB,GAAU,MAAM,MAAM,EAAE,UAAU,MAAM,EAAE,cAAc,MAAM,EAAE,UAAU,MAAM,KAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAyB9J,CAAC;AAEF;;;0DAG0D;AAC1D,eAAO,MAAM,iBAAiB,QAAS,CAAC;AAExC,0FAA0F;AAC1F,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAQ1I"}
@@ -39,6 +39,11 @@ export const readReviewSource = async (root, relative, expectedHash, maxChars) =
39
39
  await handle.close();
40
40
  }
41
41
  };
42
+ /** Characters of one source page. At 8,000 a reviewer needed six or seven
43
+ * requests (a model call each) to read one 50k-character file, and ran into
44
+ * its four-round limit before it could decide; the review prompt is still
45
+ * fitted to the model's context after pages are added. */
46
+ export const REVIEW_PAGE_CHARS = 24000;
42
47
  /** Page offsets refer to redacted text, so repeated reads cannot reconstruct a secret. */
43
48
  export async function readReviewSourcePage(root, relative, expectedHash, offset) {
44
49
  if (!Number.isSafeInteger(offset) || offset < 0)
@@ -48,7 +53,7 @@ export async function readReviewSourcePage(root, relative, expectedHash, offset)
48
53
  return { path: relative, offset, content: source.content, truncated: true, unavailable: true };
49
54
  if (offset > source.content.length)
50
55
  throw new Error(`Review source offset exceeds the file length: ${relative}`);
51
- const content = source.content.slice(offset, offset + 8000);
56
+ const content = source.content.slice(offset, offset + REVIEW_PAGE_CHARS);
52
57
  const truncated = offset + content.length < source.content.length;
53
58
  return { path: relative, offset, content, truncated, ...(truncated ? { nextOffset: offset + content.length } : {}) };
54
59
  }
@@ -34,6 +34,11 @@ export interface SessionControllerOptions {
34
34
  /** Wall-clock time (epoch ms) at which the host stops this controller. Work
35
35
  * winds down before it and ends with a status report instead of an error. */
36
36
  deadlineAt?: number;
37
+ /** Share of a research turn's time after which its mid-run draft is written (default RESEARCH_DRAFT_SHARE). */
38
+ researchDraftShare?: number;
39
+ /** Fixed time one model request may stay unanswered before it is abandoned
40
+ * and retried; by default it follows modelStallAllowanceMs. */
41
+ modelStallMs?: number;
37
42
  workspaceRoot: string;
38
43
  resolved: ResolvedOrchestrationConfig;
39
44
  effort?: EffortLevel;
@@ -50,6 +55,8 @@ export interface SessionControllerOptions {
50
55
  allowMedia?: boolean;
51
56
  allowNetwork?: boolean;
52
57
  userInstructionsPath?: string | false;
58
+ /** Follow the user's working style from Docdex personal preferences. Default: config docdex.workingStyle, else on; CODALI_WORKING_STYLE=0 turns it off. Benchmarks pass false. */
59
+ workingStyle?: boolean;
53
60
  /** Authenticated host context; repository settings can only narrow tools. */
54
61
  runContext?: RunContext;
55
62
  projectTaskAuthority?: ProjectTaskAuthority;
@@ -76,12 +83,40 @@ export declare const searchEngineQuery: (url: unknown) => string | undefined;
76
83
  /** Time an interactive turn keeps back to write its answer and audit it. Sized
77
84
  * from the slowest model call seen: a fixed quarter of the timeout left 45-minute
78
85
  * research turns idle for their last 8 minutes while drafting took about 3. */
86
+ /** Share of a research turn's time after which it writes its mid-run draft. */
87
+ export declare const RESEARCH_DRAFT_SHARE = 0.55;
88
+ /** Research goes on after a draft with open points only when at least this much time is left beyond the answer reserve. */
89
+ export declare const RESEARCH_CONTINUE_MIN_MS: number;
90
+ /** Time kept before the limit to hand over the evidence when the final answer did not arrive. */
91
+ export declare const FINAL_DELIVERY_MARGIN_MS = 15000;
92
+ /** Waits before retrying a transcript write the disk had no space for (about 15 minutes in all). */
93
+ export declare const DISK_FULL_WAITS_MS: number[];
94
+ /** A full disk is an outage too: something else filled it and space often comes
95
+ * back (a log rotates, a cache is cleared). The write is retried after waits
96
+ * instead of ending the session on the first ENOSPC; any other error is final. */
97
+ export declare const appendWithSpaceWait: <T>(write: () => Promise<T>, signal?: AbortSignal, waits?: number[]) => Promise<T>;
79
98
  export declare const answerReserveMs: (timeoutMs: number, longestModelMs: number) => number;
99
+ /** First-attempt bound for the finalizing call, or undefined when two attempts
100
+ * of at least 1.5x the slowest call (and 90 s) do not fit in the window. */
101
+ export declare const finalAttemptMs: (windowMs: number, longestModelMs: number) => number | undefined;
80
102
  /** Whether every number in a draft is a value a passing verify_javascript run
81
103
  * returned. Such a draft comes from executed code that matched the model's own
82
104
  * expectations, so a tool-less equation review must not overwrite it: in
83
105
  * cycle 4 one replaced a verified round-robin simulation with a wrong hand trace. */
84
106
  export declare const draftBackedByVerifiedRun: (draft: string, verifiedOutputs: unknown[]) => boolean;
107
+ /** Whether an equation review overturned a draft that was worked out with
108
+ * calculation tools. The review itself has no tools: it re-derives the answer
109
+ * in its head. Across cycles 4-6 it fixed 6 short answers, each time by
110
+ * changing one value; every time it rewrote most of an answer it replaced
111
+ * correct values with wrong ones (cycle 6 case 08: five values from receipts
112
+ * became two wrong numbers and three nulls; the .42 regression pack, case 19:
113
+ * a linear programme solved with a constraint solver, all five values right,
114
+ * all five replaced). The first version of this guard applied only when every
115
+ * drafted number appeared literally in a tool result, which a solver's
116
+ * fractions ("65/4") and dual values do not. A review that adds nulls, or
117
+ * changes two or more values and more than half of them, is rejected whenever
118
+ * the turn used calculation tools at all. */
119
+ export declare const overturnsCalculatedDraft: (draft: string, revised: string, results: string[]) => boolean;
85
120
  /** Why a rewritten answer must not replace its draft, if it must not. Every
86
121
  * audit is an edit of a usable draft, so a bad edit keeps the draft. */
87
122
  export declare const rewriteDefect: (draft: string, response: {
@@ -106,13 +141,18 @@ export declare const markUnretrievedLinks: (answer: string, retrieved: ReadonlyS
106
141
  answer: string;
107
142
  unretrieved: string[];
108
143
  };
144
+ export declare const UI_JOURNEY_RULE = "A browser journey verifies what the user's action achieved, not only what the page shows: after each mutation (including logout) confirm the server state through a reload or a follow-up API read, and record every network response and console error during the journey; an unexpected 4xx/5xx response or uncaught error fails that step. Give every action the requirements grant a role a visible control and exercise it as that role. Check that each table row has one cell per header and that loading, empty and error states appear. Delivery notes may claim only checks whose receipts show them passing; name anything inspected but not executed.";
109
145
  export declare class SessionController {
110
146
  private readonly options;
111
147
  private projectHandoff;
112
148
  readonly store: SessionStore;
113
149
  readonly gate: PermissionGate;
114
150
  readonly registry: ToolRegistry;
115
- readonly isolation: import("../tools/shell/IsolatedExecutor.js").ExecutorStatus;
151
+ /** Sandbox availability. Probed again at the start of a run or turn while it
152
+ * is unavailable: a sandbox that was missing or overloaded when the session
153
+ * opened must not disable the shell for the rest of it. */
154
+ isolation: import("../tools/shell/IsolatedExecutor.js").ExecutorStatus;
155
+ private refreshIsolation;
116
156
  readonly workspaceRoot: string;
117
157
  sessionId?: string;
118
158
  state?: WorkState;
@@ -172,11 +212,23 @@ export declare class SessionController {
172
212
  skills: SkillCatalog;
173
213
  private inspectionDocdexStart?;
174
214
  private inspectionAnswerReserve;
215
+ /** The turn's own time limit, not a user's cancellation, aborted it: deliver what it gathered. */
216
+ private timeLimitFallback;
217
+ /** An answer turn that did not finish (a crash, a host restart, an outage it
218
+ * could not outlast), found on resume: its request and what it had gathered. */
219
+ private unfinished;
220
+ /** What the running answer turn has gathered so far, if it is a research turn. */
221
+ private turnProgress;
222
+ /** Gathered research handed to the next answer turn when it continues an unfinished one. */
223
+ private continuation;
224
+ /** What an answer turn can still deliver if its time limit aborts it mid-step. */
225
+ private turnFallback;
175
226
  private finalAttempts;
176
227
  private docdex?;
177
228
  private docdexNames;
178
229
  private docdexReady;
179
230
  private memoryContext;
231
+ private workingStyleLoad?;
180
232
  private preparingEdit;
181
233
  private lastRequestEstimate;
182
234
  private feedbackRound;
@@ -250,6 +302,8 @@ export declare class SessionController {
250
302
  private shellWritePaths;
251
303
  private validationReserve;
252
304
  private validationContext;
305
+ /** Time one model request may stay unanswered; a method so a host or a test can scale it. */
306
+ protected stallAllowanceMs(inputTokens: number, maxOutputTokens: number, longestModelMs: number, stalledAttempts: number): number;
253
307
  private provider;
254
308
  private beforeTool;
255
309
  private afterTool;
@@ -264,8 +318,24 @@ export declare class SessionController {
264
318
  private verify;
265
319
  private auditModelRequest;
266
320
  private applyVerificationGuide;
321
+ /** Loaded once per session and mode; an unavailable Docdex or tool adds nothing. */
322
+ private workingStyle;
267
323
  private loadInstructions;
268
324
  /** Route natural-language turns before creating work, indexing, or loading tool schemas. */
325
+ /** Whether the resumed session ends with an answer turn that never delivered. */
326
+ get unfinishedInteraction(): {
327
+ prompt: string;
328
+ evidence: number;
329
+ draft: boolean;
330
+ } | undefined;
331
+ /** Continue the unfinished answer turn of a resumed session from what it had
332
+ * gathered (evidence and, when one was saved, its draft) instead of starting
333
+ * the research again. */
334
+ continueInteraction(): Promise<{
335
+ content: string;
336
+ completed: boolean;
337
+ mode: InteractionDecision["mode"];
338
+ }>;
269
339
  interact(prompt: string): Promise<{
270
340
  content: string;
271
341
  completed: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"SessionController.d.ts","sourceRoot":"","sources":["../../src/runtime/SessionController.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAqC,MAAM,+BAA+B,CAAC;AAClH,OAAO,EAAwD,KAAK,WAAW,EAAqB,KAAK,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/K,OAAO,EAAE,cAAc,EAA8D,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAM7K,OAAO,EAA4e,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAQ5iB,OAAO,EAAE,2BAA2B,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACjH;;;uDAGuD;AACvD,4EAA4E;AAC5E,eAAO,MAAM,gCAAgC,QAAS,CAAC;AACvD,eAAO,MAAM,WAAW,GAAI,UAAgB,KAAG,MAAyO,CAAC;AACzR,OAAO,EAAE,2BAA2B,EAAE,aAA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