omnius 1.0.891 → 1.0.892
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/index.js +2 -2
- package/dist/library.js +655 -356
- package/dist/tui/native/worker.js +46 -22
- package/docs/DISCOVERY.json +2 -2
- package/docs/DISCOVERY.md +1 -1
- package/docs/reference/configuration.md +21 -0
- package/docs/reference/slash-commands.md +78 -22
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/library.js
CHANGED
|
@@ -3505,6 +3505,9 @@ var init_jetson_monitor = __esm({
|
|
|
3505
3505
|
function currentHostEnvironment() {
|
|
3506
3506
|
return globalThis.process?.env ?? {};
|
|
3507
3507
|
}
|
|
3508
|
+
function cpuOffloadAllowedFromEnv(env = currentHostEnvironment()) {
|
|
3509
|
+
return env[OMNIUS_CPU_OFFLOAD_ALLOWED_ENV] === "1";
|
|
3510
|
+
}
|
|
3508
3511
|
function normalizeGpuUuidList(value) {
|
|
3509
3512
|
if (value === void 0)
|
|
3510
3513
|
return void 0;
|
|
@@ -3541,12 +3544,13 @@ function isGpuUuidEnabled(uuid, enabledUuids = enabledGpuUuidsFromEnv()) {
|
|
|
3541
3544
|
return true;
|
|
3542
3545
|
return Boolean(uuid && enabledUuids.includes(uuid));
|
|
3543
3546
|
}
|
|
3544
|
-
var OMNIUS_GPU_ENABLED_UUIDS_ENV, OMNIUS_GPU_PREFERRED_UUID_ENV;
|
|
3547
|
+
var OMNIUS_GPU_ENABLED_UUIDS_ENV, OMNIUS_GPU_PREFERRED_UUID_ENV, OMNIUS_CPU_OFFLOAD_ALLOWED_ENV;
|
|
3545
3548
|
var init_gpu_selection = __esm({
|
|
3546
3549
|
"packages/schemas/dist/gpu-selection.js"() {
|
|
3547
3550
|
"use strict";
|
|
3548
3551
|
OMNIUS_GPU_ENABLED_UUIDS_ENV = "OMNIUS_GPU_ENABLED_UUIDS";
|
|
3549
3552
|
OMNIUS_GPU_PREFERRED_UUID_ENV = "OMNIUS_GPU_PREFERRED_UUID";
|
|
3553
|
+
OMNIUS_CPU_OFFLOAD_ALLOWED_ENV = "OMNIUS_CPU_OFFLOAD_ALLOWED";
|
|
3550
3554
|
}
|
|
3551
3555
|
});
|
|
3552
3556
|
|
|
@@ -338743,7 +338747,7 @@ var init_ollama_pool = __esm({
|
|
|
338743
338747
|
continue;
|
|
338744
338748
|
}
|
|
338745
338749
|
const PROBE_GRACE_MS = 3e4;
|
|
338746
|
-
if (inst.state.inflight === 0 && Date.now() - inst.state.spawnedAtMs > PROBE_GRACE_MS && await this.isPartialVramSpilled(inst)) {
|
|
338750
|
+
if (!cpuOffloadAllowedFromEnv() && inst.state.inflight === 0 && Date.now() - inst.state.spawnedAtMs > PROBE_GRACE_MS && await this.isPartialVramSpilled(inst)) {
|
|
338747
338751
|
const reapedAtMs = Date.now();
|
|
338748
338752
|
await inst.terminate();
|
|
338749
338753
|
this.dropAffinityFor(inst.state.id);
|
|
@@ -352526,6 +352530,193 @@ var NativeOllamaToolCalls = class {
|
|
|
352526
352530
|
}
|
|
352527
352531
|
};
|
|
352528
352532
|
|
|
352533
|
+
// packages/orchestrator/dist/tool-argument-repair.js
|
|
352534
|
+
function shape2(parameters) {
|
|
352535
|
+
const properties = parameters["properties"];
|
|
352536
|
+
return {
|
|
352537
|
+
properties: new Set(properties && typeof properties === "object" && !Array.isArray(properties) ? Object.keys(properties) : []),
|
|
352538
|
+
required: Array.isArray(parameters["required"]) ? parameters["required"].filter((key) => typeof key === "string") : []
|
|
352539
|
+
};
|
|
352540
|
+
}
|
|
352541
|
+
function findBetterToolSchemaMatches(input) {
|
|
352542
|
+
const keys4 = [...new Set(input.providedKeys.filter((key) => !key.startsWith("_")))];
|
|
352543
|
+
if (!keys4.length)
|
|
352544
|
+
return [];
|
|
352545
|
+
const provided = new Set(keys4), requested = shape2(input.requestedParameters);
|
|
352546
|
+
const requestedMissing = requested.required.filter((key) => !provided.has(key)).length;
|
|
352547
|
+
const requestedUnknown = keys4.filter((key) => !requested.properties.has(key)).length;
|
|
352548
|
+
if (!requestedMissing && !requestedUnknown)
|
|
352549
|
+
return [];
|
|
352550
|
+
const matches = /* @__PURE__ */ new Map();
|
|
352551
|
+
for (const candidate of input.candidates) {
|
|
352552
|
+
if (candidate.name === input.requestedToolName)
|
|
352553
|
+
continue;
|
|
352554
|
+
const target2 = shape2(candidate.parameters ?? {});
|
|
352555
|
+
if (!target2.properties.size || target2.required.some((key) => !provided.has(key)) || keys4.some((key) => !target2.properties.has(key)))
|
|
352556
|
+
continue;
|
|
352557
|
+
matches.set(candidate.name, keys4.length * 2 + target2.required.length * 3);
|
|
352558
|
+
}
|
|
352559
|
+
return [...matches].sort(([left, leftScore], [right, rightScore]) => rightScore - leftScore || left.localeCompare(right)).slice(0, 3).map(([name]) => name);
|
|
352560
|
+
}
|
|
352561
|
+
|
|
352562
|
+
// packages/orchestrator/dist/adjudication.js
|
|
352563
|
+
import { z as z18 } from "zod";
|
|
352564
|
+
var ADJUDICATION_TOOL_NAME = "adjudicate";
|
|
352565
|
+
var ADJUDICATION_ID_PATTERN = "^[A-Za-z0-9][A-Za-z0-9._:-]*$";
|
|
352566
|
+
function adjudicationArgumentRepairContract(error, argsHash) {
|
|
352567
|
+
let issues = [];
|
|
352568
|
+
try {
|
|
352569
|
+
const parsed = JSON.parse(error);
|
|
352570
|
+
if (Array.isArray(parsed))
|
|
352571
|
+
issues = parsed.filter((issue3) => issue3 && typeof issue3 === "object");
|
|
352572
|
+
} catch {
|
|
352573
|
+
}
|
|
352574
|
+
const parameters = adjudicationToolParameters();
|
|
352575
|
+
const fields2 = issues.slice(0, 8).map((issue3) => {
|
|
352576
|
+
const parts = Array.isArray(issue3.path) ? issue3.path : [];
|
|
352577
|
+
let schema = parameters;
|
|
352578
|
+
for (const part of parts) {
|
|
352579
|
+
const next = typeof part === "number" ? schema?.items : schema?.properties?.[part];
|
|
352580
|
+
schema = next && typeof next === "object" && !Array.isArray(next) ? next : void 0;
|
|
352581
|
+
}
|
|
352582
|
+
const constraints = schema && Object.fromEntries(Object.entries(schema).filter(([key]) => ["type", "minLength", "maxLength", "pattern", "enum", "minimum", "maximum", "minItems", "maxItems", "required"].includes(key)));
|
|
352583
|
+
return {
|
|
352584
|
+
path: parts.map((part) => typeof part === "number" ? `[${part}]` : part).join(".").replace(/\.\[/g, "[") || "arguments",
|
|
352585
|
+
message: String(issue3.message ?? "invalid value"),
|
|
352586
|
+
...constraints ? { schema: constraints } : {}
|
|
352587
|
+
};
|
|
352588
|
+
});
|
|
352589
|
+
return {
|
|
352590
|
+
reason_code: "invalid_tool_arguments",
|
|
352591
|
+
tool: ADJUDICATION_TOOL_NAME,
|
|
352592
|
+
retryable: false,
|
|
352593
|
+
...argsHash ? { args_sha256: argsHash } : {},
|
|
352594
|
+
fields: fields2.length ? fields2 : [{ path: "arguments", message: error.slice(0, 1400) }]
|
|
352595
|
+
};
|
|
352596
|
+
}
|
|
352597
|
+
function formatAdjudicationArgumentRepair(error, argsHash) {
|
|
352598
|
+
const contract = adjudicationArgumentRepairContract(error, argsHash);
|
|
352599
|
+
return [
|
|
352600
|
+
"[ADJUDICATION_ARGUMENT_REPAIR]",
|
|
352601
|
+
JSON.stringify(contract),
|
|
352602
|
+
...contract.fields.map((field) => `${field.path}: ${field.message}`),
|
|
352603
|
+
"Required keys for adjudicate: question, allowedOutcomes, evidence",
|
|
352604
|
+
`IDs must be 1–96 characters matching ${ADJUDICATION_ID_PATTERN}; no whitespace or sentence-valued IDs.`,
|
|
352605
|
+
'Format-only example: allowedOutcomes=["option_a","option_b"], context="option_a means the first described outcome; option_b means the second described outcome".',
|
|
352606
|
+
"Keep the user's actual outcome descriptions in context/evidence. Choose explicit stable IDs yourself; do not drop or silently rewrite evidence, manufacture an outcome, or substitute another tool for a field-format error.",
|
|
352607
|
+
"This exact argument instance cannot be retried unchanged. Correct the named values and retry immediately, or continue other substantive work. No panel ran for this rejected call."
|
|
352608
|
+
].join("\n");
|
|
352609
|
+
}
|
|
352610
|
+
var IdSchema = z18.string().trim().min(1).max(96).regex(new RegExp(ADJUDICATION_ID_PATTERN), "use a stable identifier without whitespace").describe("Stable identifier: 1–96 characters matching ^[A-Za-z0-9][A-Za-z0-9._:-]*$. Put prose descriptions in context/evidence, not IDs.");
|
|
352611
|
+
var AdjudicationEvidenceSchema = z18.object({
|
|
352612
|
+
id: IdSchema,
|
|
352613
|
+
content: z18.string().trim().min(1).max(32e3),
|
|
352614
|
+
source: z18.string().trim().min(1).max(500),
|
|
352615
|
+
kind: z18.enum([
|
|
352616
|
+
"fact",
|
|
352617
|
+
"observation",
|
|
352618
|
+
"artifact",
|
|
352619
|
+
"test_result",
|
|
352620
|
+
"testimony",
|
|
352621
|
+
"constraint",
|
|
352622
|
+
"precedent"
|
|
352623
|
+
]).default("observation"),
|
|
352624
|
+
observedAt: z18.string().trim().max(80).optional(),
|
|
352625
|
+
sha256: z18.string().trim().regex(/^[a-fA-F0-9]{64}$/).optional(),
|
|
352626
|
+
reliability: z18.number().min(0).max(1).optional()
|
|
352627
|
+
});
|
|
352628
|
+
var AdjudicationArgumentSchema = z18.object({
|
|
352629
|
+
id: IdSchema,
|
|
352630
|
+
position: z18.string().trim().min(1).max(160),
|
|
352631
|
+
claim: z18.string().trim().min(1).max(4e3),
|
|
352632
|
+
citedEvidenceIds: z18.array(IdSchema).min(1).max(64),
|
|
352633
|
+
submittedBy: z18.string().trim().max(160).optional()
|
|
352634
|
+
});
|
|
352635
|
+
var AdjudicationConstituentInputSchema = z18.object({
|
|
352636
|
+
id: IdSchema.optional(),
|
|
352637
|
+
label: z18.string().trim().min(1).max(120),
|
|
352638
|
+
question: z18.string().trim().min(1).max(2e3),
|
|
352639
|
+
instructions: z18.string().trim().max(2e3).optional(),
|
|
352640
|
+
evidenceIds: z18.array(IdSchema).min(1).max(128).optional(),
|
|
352641
|
+
argumentIds: z18.array(IdSchema).max(64).optional(),
|
|
352642
|
+
decisionRuleIds: z18.array(IdSchema).max(32).optional()
|
|
352643
|
+
});
|
|
352644
|
+
var AdjudicationInputSchema = z18.object({
|
|
352645
|
+
caseId: IdSchema.optional(),
|
|
352646
|
+
question: z18.string().trim().min(1).max(4e3).describe("The exact decision question. Ask one decision only."),
|
|
352647
|
+
context: z18.string().trim().max(8e3).optional().describe("Neutral context needed to interpret the record, including each stable outcome ID's prose meaning."),
|
|
352648
|
+
exclusions: z18.array(z18.string().trim().min(1).max(2e3)).max(32).default([]).describe("Explicitly excluded material or considerations that the panel must not admit."),
|
|
352649
|
+
allowedOutcomes: z18.array(IdSchema).min(2).max(12).describe("Closed set of stable verdict IDs, for example option_a and option_b; preserve their prose meanings in context. insufficient_evidence is reserved by the tool."),
|
|
352650
|
+
decisionRules: z18.array(z18.string().trim().min(1).max(2e3)).max(24).default([]).describe("Rules the judge must apply."),
|
|
352651
|
+
burdenOfProof: z18.enum([
|
|
352652
|
+
"best_supported",
|
|
352653
|
+
"preponderance",
|
|
352654
|
+
"clear_and_convincing",
|
|
352655
|
+
"beyond_reasonable_doubt",
|
|
352656
|
+
"risk_averse"
|
|
352657
|
+
]).default("best_supported"),
|
|
352658
|
+
evidence: z18.array(AdjudicationEvidenceSchema).min(1).max(128),
|
|
352659
|
+
arguments: z18.array(AdjudicationArgumentSchema).max(64).default([]),
|
|
352660
|
+
constituents: z18.array(AdjudicationConstituentInputSchema).min(2).max(6).optional().describe("Optional independent focus assignments. Omit to let the case framer derive them."),
|
|
352661
|
+
panelSize: z18.number().int().min(2).max(6).default(3),
|
|
352662
|
+
maxConcurrency: z18.number().int().min(1).max(6).default(3),
|
|
352663
|
+
quorum: z18.number().int().min(2).max(6).optional(),
|
|
352664
|
+
constituentExecution: z18.enum(["auto", "full_sub_agent", "direct"]).default("auto").describe("auto uses the dedicated full_sub_agent profile when available, otherwise the direct bounded fallback."),
|
|
352665
|
+
timeoutMs: z18.number().int().min(5e3).max(6e5).default(12e4),
|
|
352666
|
+
maxTokensPerConstituent: z18.number().int().min(512).max(8192).default(2048),
|
|
352667
|
+
maxJudgeTokens: z18.number().int().min(768).max(12288).default(3072)
|
|
352668
|
+
});
|
|
352669
|
+
function adjudicationToolParameters() {
|
|
352670
|
+
const { $schema: _dialect, ...parameters } = z18.toJSONSchema(AdjudicationInputSchema, { target: "draft-7", io: "input" });
|
|
352671
|
+
return parameters;
|
|
352672
|
+
}
|
|
352673
|
+
var PlannerResponseSchema = z18.object({
|
|
352674
|
+
schemaVersion: z18.literal(1),
|
|
352675
|
+
caseId: IdSchema,
|
|
352676
|
+
assignments: z18.array(z18.object({
|
|
352677
|
+
id: IdSchema,
|
|
352678
|
+
label: z18.string().trim().min(1).max(120),
|
|
352679
|
+
question: z18.string().trim().min(1).max(2e3),
|
|
352680
|
+
instructions: z18.string().trim().max(2e3).default(""),
|
|
352681
|
+
evidenceIds: z18.array(IdSchema).min(1).max(128),
|
|
352682
|
+
argumentIds: z18.array(IdSchema).max(64).default([]),
|
|
352683
|
+
decisionRuleIds: z18.array(IdSchema).min(1).max(32)
|
|
352684
|
+
})).min(2).max(6)
|
|
352685
|
+
});
|
|
352686
|
+
var ConstituentResponseSchema = z18.object({
|
|
352687
|
+
schemaVersion: z18.literal(1),
|
|
352688
|
+
caseId: IdSchema,
|
|
352689
|
+
constituentId: IdSchema,
|
|
352690
|
+
assessment: z18.string().trim().min(20).max(8e3),
|
|
352691
|
+
recommendation: IdSchema,
|
|
352692
|
+
confidence: z18.number().min(0).max(1),
|
|
352693
|
+
citedEvidenceIds: z18.array(IdSchema).min(1).max(128),
|
|
352694
|
+
claims: z18.array(z18.object({
|
|
352695
|
+
claim: z18.string().trim().min(1).max(2e3),
|
|
352696
|
+
evidenceIds: z18.array(IdSchema).min(1).max(64)
|
|
352697
|
+
})).min(1).max(24),
|
|
352698
|
+
counterarguments: z18.array(z18.string().trim().min(1).max(2e3)).max(16).default([]),
|
|
352699
|
+
uncertainties: z18.array(z18.string().trim().min(1).max(2e3)).max(16).default([])
|
|
352700
|
+
});
|
|
352701
|
+
var JudgeResponseSchema = z18.object({
|
|
352702
|
+
schemaVersion: z18.literal(1),
|
|
352703
|
+
caseId: IdSchema,
|
|
352704
|
+
verdict: IdSchema,
|
|
352705
|
+
confidence: z18.number().min(0).max(1),
|
|
352706
|
+
rationale: z18.string().trim().min(30).max(12e3),
|
|
352707
|
+
citedEvidenceIds: z18.array(IdSchema).min(1).max(128),
|
|
352708
|
+
consideredConstituentIds: z18.array(IdSchema).min(2).max(6),
|
|
352709
|
+
acceptedFindingIds: z18.array(IdSchema).max(144),
|
|
352710
|
+
rejectedFindingIds: z18.array(IdSchema).max(144),
|
|
352711
|
+
dissent: z18.array(z18.object({
|
|
352712
|
+
constituentId: IdSchema,
|
|
352713
|
+
recommendation: IdSchema,
|
|
352714
|
+
summary: z18.string().trim().min(1).max(2e3)
|
|
352715
|
+
})).max(6).default([]),
|
|
352716
|
+
unresolvedQuestions: z18.array(z18.string().trim().min(1).max(2e3)).max(24).default([]),
|
|
352717
|
+
nextAction: z18.string().trim().min(1).max(4e3)
|
|
352718
|
+
});
|
|
352719
|
+
|
|
352529
352720
|
// packages/orchestrator/dist/openai-chat-stream-parser.js
|
|
352530
352721
|
var object10 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
352531
352722
|
var MAX_PACKET_BYTES = 8388608;
|
|
@@ -355125,15 +355316,15 @@ var SelfImprovementArchive = class {
|
|
|
355125
355316
|
import { createHash as createHash69, randomUUID as randomUUID41 } from "node:crypto";
|
|
355126
355317
|
import { closeSync as closeSync12, existsSync as existsSync30, fsyncSync as fsyncSync6, mkdirSync as mkdirSync24, openSync as openSync12, readFileSync as readFileSync34, renameSync as renameSync12, unlinkSync as unlinkSync12, writeFileSync as writeFileSync22 } from "node:fs";
|
|
355127
355318
|
import { dirname as dirname23, join as join40 } from "node:path";
|
|
355128
|
-
import { z as
|
|
355319
|
+
import { z as z20 } from "zod";
|
|
355129
355320
|
|
|
355130
355321
|
// packages/orchestrator/dist/commandEvidenceReceipt.js
|
|
355131
|
-
import { z as
|
|
355132
|
-
var token2 =
|
|
355133
|
-
var timestamp2 =
|
|
355134
|
-
var integer3 =
|
|
355135
|
-
var CommandEvidenceReceiptSchema =
|
|
355136
|
-
schema:
|
|
355322
|
+
import { z as z19 } from "zod";
|
|
355323
|
+
var token2 = z19.string().refine((value) => value.trim().length > 0 && !value.includes("\0"));
|
|
355324
|
+
var timestamp2 = z19.string().datetime({ offset: true });
|
|
355325
|
+
var integer3 = z19.number().int().safe();
|
|
355326
|
+
var CommandEvidenceReceiptSchema = z19.object({
|
|
355327
|
+
schema: z19.literal("omnius.command-evidence-receipt.v1"),
|
|
355137
355328
|
command: token2,
|
|
355138
355329
|
canonicalCommand: token2,
|
|
355139
355330
|
cwd: token2,
|
|
@@ -355141,20 +355332,20 @@ var CommandEvidenceReceiptSchema = z18.object({
|
|
|
355141
355332
|
primaryCommand: token2.optional(),
|
|
355142
355333
|
primaryExitCode: integer3.nullable().optional(),
|
|
355143
355334
|
runnerExitCode: integer3.nullable().optional(),
|
|
355144
|
-
primaryExitProvenance:
|
|
355145
|
-
pipefail:
|
|
355146
|
-
timedOut:
|
|
355335
|
+
primaryExitProvenance: z19.enum(["runner_process", "trailing_exit_reporter"]).optional(),
|
|
355336
|
+
pipefail: z19.boolean(),
|
|
355337
|
+
timedOut: z19.boolean(),
|
|
355147
355338
|
startedAtIso: timestamp2,
|
|
355148
355339
|
finishedAtIso: timestamp2,
|
|
355149
|
-
shellRunId:
|
|
355340
|
+
shellRunId: z19.string().uuid().optional(),
|
|
355150
355341
|
timeoutMs: integer3.positive().nullable().optional(),
|
|
355151
|
-
cancelled:
|
|
355342
|
+
cancelled: z19.boolean().optional(),
|
|
355152
355343
|
signal: token2.nullable().optional(),
|
|
355153
|
-
observation:
|
|
355344
|
+
observation: z19.object({ kind: z19.literal("search_no_match") }).strict().optional(),
|
|
355154
355345
|
outputRef: token2.optional(),
|
|
355155
|
-
observedPaths:
|
|
355156
|
-
artifactHashes:
|
|
355157
|
-
declaredVerification:
|
|
355346
|
+
observedPaths: z19.array(token2).optional(),
|
|
355347
|
+
artifactHashes: z19.array(z19.object({ path: token2, sha256: z19.string().regex(/^[a-f0-9]{64}$/) }).strict()).optional(),
|
|
355348
|
+
declaredVerification: z19.object({ protocol: z19.literal("OMNIUS_VERIFICATION_RESULT"), outcome: z19.enum(["pass", "fail"]) }).strict().optional()
|
|
355158
355349
|
}).strict().refine((value) => Date.parse(value.finishedAtIso) >= Date.parse(value.startedAtIso));
|
|
355159
355350
|
function parseCommandEvidenceReceipt(value) {
|
|
355160
355351
|
try {
|
|
@@ -355167,21 +355358,21 @@ function parseCommandEvidenceReceipt(value) {
|
|
|
355167
355358
|
|
|
355168
355359
|
// packages/orchestrator/dist/conversationReportEvidence.js
|
|
355169
355360
|
var SCHEMA = "omnius.conversation-report-evidence.v2";
|
|
355170
|
-
var token3 =
|
|
355171
|
-
var timestamp3 =
|
|
355172
|
-
var integer4 =
|
|
355173
|
-
var identitySchema =
|
|
355174
|
-
var reference =
|
|
355175
|
-
var paths =
|
|
355176
|
-
var deliveryReceiptSchema =
|
|
355177
|
-
schema:
|
|
355361
|
+
var token3 = z20.string().refine((value) => value.trim().length > 0 && !value.includes("\0"));
|
|
355362
|
+
var timestamp3 = z20.string().datetime({ offset: true });
|
|
355363
|
+
var integer4 = z20.number().int().safe();
|
|
355364
|
+
var identitySchema = z20.object({ sessionId: token3, runId: token3, taskEpoch: integer4.nonnegative() }).strict();
|
|
355365
|
+
var reference = z20.string().regex(/^omnius-artifact:\/\/sha256\/[a-f0-9]{64}$/);
|
|
355366
|
+
var paths = z20.array(token3);
|
|
355367
|
+
var deliveryReceiptSchema = z20.object({
|
|
355368
|
+
schema: z20.literal("omnius.completion-delivery-receipt.v1"),
|
|
355178
355369
|
provider: token3,
|
|
355179
355370
|
target: token3,
|
|
355180
355371
|
receiptId: token3,
|
|
355181
355372
|
deliveredAtIso: timestamp3,
|
|
355182
355373
|
artifactPaths: paths.optional()
|
|
355183
355374
|
}).strict();
|
|
355184
|
-
var objectiveEvidenceKindSchema =
|
|
355375
|
+
var objectiveEvidenceKindSchema = z20.enum([
|
|
355185
355376
|
"visible_response",
|
|
355186
355377
|
"observation",
|
|
355187
355378
|
"mutation",
|
|
@@ -355193,79 +355384,79 @@ var objectiveEvidenceKindSchema = z19.enum([
|
|
|
355193
355384
|
"authenticated_session",
|
|
355194
355385
|
"human_input"
|
|
355195
355386
|
]);
|
|
355196
|
-
var externalEffectReceiptSchema =
|
|
355197
|
-
schema:
|
|
355387
|
+
var externalEffectReceiptSchema = z20.object({
|
|
355388
|
+
schema: z20.literal("omnius.external-effect-receipt.v1"),
|
|
355198
355389
|
effectKind: token3,
|
|
355199
355390
|
semanticTarget: token3,
|
|
355200
355391
|
idempotencyKey: token3,
|
|
355201
|
-
effectState:
|
|
355392
|
+
effectState: z20.enum(["pending", "applied", "absent", "unknown"]),
|
|
355202
355393
|
artifactRevision: token3.optional(),
|
|
355203
355394
|
evidenceId: token3,
|
|
355204
|
-
criterionIds:
|
|
355205
|
-
evidenceKinds:
|
|
355206
|
-
destination:
|
|
355395
|
+
criterionIds: z20.array(token3),
|
|
355396
|
+
evidenceKinds: z20.array(objectiveEvidenceKindSchema).optional(),
|
|
355397
|
+
destination: z20.object({ url: z20.string().url(), provider: token3 }).strict().optional()
|
|
355207
355398
|
}).strict();
|
|
355208
|
-
var verificationReceiptSchema =
|
|
355209
|
-
schema:
|
|
355399
|
+
var verificationReceiptSchema = z20.object({
|
|
355400
|
+
schema: z20.literal("omnius.verification-receipt.v1"),
|
|
355210
355401
|
evidenceId: token3,
|
|
355211
355402
|
criterionId: token3,
|
|
355212
355403
|
artifactEvidenceId: token3,
|
|
355213
355404
|
artifactRevision: token3.optional(),
|
|
355214
355405
|
verifierMethod: token3,
|
|
355215
|
-
outcome:
|
|
355216
|
-
evidenceIds:
|
|
355217
|
-
evidenceKinds:
|
|
355406
|
+
outcome: z20.enum(["passed", "artifact_failed", "verifier_invalid", "downstream_auth_required", "inconclusive"]),
|
|
355407
|
+
evidenceIds: z20.array(token3),
|
|
355408
|
+
evidenceKinds: z20.array(objectiveEvidenceKindSchema).optional()
|
|
355218
355409
|
}).strict();
|
|
355219
|
-
var externalBlockerSchema =
|
|
355220
|
-
schema:
|
|
355221
|
-
criterionIds:
|
|
355410
|
+
var externalBlockerSchema = z20.object({
|
|
355411
|
+
schema: z20.literal("omnius.objective-external-blocker.v1"),
|
|
355412
|
+
criterionIds: z20.array(token3),
|
|
355222
355413
|
evidenceId: token3,
|
|
355223
355414
|
blockerKind: token3,
|
|
355224
|
-
retryable:
|
|
355415
|
+
retryable: z20.boolean()
|
|
355225
355416
|
}).strict();
|
|
355226
|
-
var evidenceSchema =
|
|
355417
|
+
var evidenceSchema = z20.object({
|
|
355227
355418
|
id: token3,
|
|
355228
|
-
kind:
|
|
355419
|
+
kind: z20.literal("tool_result"),
|
|
355229
355420
|
observedAtIso: timestamp3,
|
|
355230
|
-
summary:
|
|
355421
|
+
summary: z20.string(),
|
|
355231
355422
|
toolName: token3,
|
|
355232
|
-
success:
|
|
355423
|
+
success: z20.boolean().optional(),
|
|
355233
355424
|
rawRef: token3.optional(),
|
|
355234
355425
|
targetPaths: paths.optional(),
|
|
355235
|
-
role:
|
|
355426
|
+
role: z20.enum(["observation", "verification", "mutation", "blocker", "delivery"]).optional(),
|
|
355236
355427
|
family: token3.optional(),
|
|
355237
|
-
verificationImpact:
|
|
355238
|
-
metrics:
|
|
355428
|
+
verificationImpact: z20.enum(["invalidates", "neutral"]).optional(),
|
|
355429
|
+
metrics: z20.record(z20.string(), z20.unknown()).optional(),
|
|
355239
355430
|
receipt: CommandEvidenceReceiptSchema.optional(),
|
|
355240
355431
|
deliveryReceipt: deliveryReceiptSchema.optional(),
|
|
355241
|
-
progressClass:
|
|
355242
|
-
criterionIds:
|
|
355243
|
-
objectiveEvidenceKinds:
|
|
355432
|
+
progressClass: z20.enum(["work_product", "control_bookkeeping", "observation", "blocker"]).optional(),
|
|
355433
|
+
criterionIds: z20.array(token3).optional(),
|
|
355434
|
+
objectiveEvidenceKinds: z20.array(objectiveEvidenceKindSchema).optional(),
|
|
355244
355435
|
externalEffectReceipt: externalEffectReceiptSchema.optional(),
|
|
355245
355436
|
verificationReceipt: verificationReceiptSchema.optional(),
|
|
355246
355437
|
externalBlocker: externalBlockerSchema.optional()
|
|
355247
355438
|
}).strict();
|
|
355248
|
-
var chunkSchema =
|
|
355249
|
-
schema:
|
|
355439
|
+
var chunkSchema = z20.object({
|
|
355440
|
+
schema: z20.literal(SCHEMA),
|
|
355250
355441
|
identity: identitySchema,
|
|
355251
355442
|
previousReference: reference.nullable(),
|
|
355252
355443
|
sequence: integer4.positive(),
|
|
355253
355444
|
startEntry: integer4.nonnegative(),
|
|
355254
355445
|
entryCount: integer4.nonnegative(),
|
|
355255
|
-
entries:
|
|
355446
|
+
entries: z20.array(z20.object({ callId: token3, evidence: evidenceSchema }).strict()),
|
|
355256
355447
|
ledgerCreatedAtIso: timestamp3,
|
|
355257
355448
|
updatedAtIso: timestamp3,
|
|
355258
355449
|
recoveryGap: token3.max(500).optional()
|
|
355259
355450
|
}).strict();
|
|
355260
|
-
var pointerSchema =
|
|
355261
|
-
schema:
|
|
355451
|
+
var pointerSchema = z20.object({
|
|
355452
|
+
schema: z20.literal(SCHEMA),
|
|
355262
355453
|
identity: identitySchema,
|
|
355263
355454
|
reference,
|
|
355264
355455
|
entryCount: integer4.nonnegative(),
|
|
355265
355456
|
chunkCount: integer4.positive()
|
|
355266
355457
|
}).strict();
|
|
355267
|
-
var pendingSchema =
|
|
355268
|
-
schema:
|
|
355458
|
+
var pendingSchema = z20.object({
|
|
355459
|
+
schema: z20.literal(SCHEMA),
|
|
355269
355460
|
identity: identitySchema,
|
|
355270
355461
|
previousReference: reference.nullable(),
|
|
355271
355462
|
previousEntryCount: integer4.nonnegative(),
|
|
@@ -355472,7 +355663,7 @@ var ConversationReportEvidence = class {
|
|
|
355472
355663
|
this.persistedChunkCount = pointer.chunkCount;
|
|
355473
355664
|
this.persistedGap = chain[0].recoveryGap;
|
|
355474
355665
|
} catch (error) {
|
|
355475
|
-
const detail = error instanceof
|
|
355666
|
+
const detail = error instanceof z20.ZodError || error instanceof SyntaxError ? "Saved report evidence has invalid fields or contains task authority." : error instanceof Error ? error.message : String(error);
|
|
355476
355667
|
this.recoveryGap = `Earlier conversation evidence could not be restored: ${detail}${pendingGap ? ` ${pendingGap}` : ""}`.slice(0, 500);
|
|
355477
355668
|
}
|
|
355478
355669
|
}
|
|
@@ -355607,7 +355798,7 @@ init_dist5();
|
|
|
355607
355798
|
import { createHash as createHash71 } from "node:crypto";
|
|
355608
355799
|
import { closeSync as closeSync14, existsSync as existsSync32, fsyncSync as fsyncSync8, lstatSync as lstatSync4, mkdirSync as mkdirSync26, openSync as openSync14, readFileSync as readFileSync36, readdirSync as readdirSync11, realpathSync as realpathSync10, renameSync as renameSync14, statSync as statSync17, unlinkSync as unlinkSync14, writeFileSync as writeFileSync24 } from "node:fs";
|
|
355609
355800
|
import { dirname as dirname24, isAbsolute as isAbsolute13, join as join42, relative as relative9, resolve as resolve27 } from "node:path";
|
|
355610
|
-
import { z as
|
|
355801
|
+
import { z as z21 } from "zod";
|
|
355611
355802
|
|
|
355612
355803
|
// packages/orchestrator/dist/contentAddressedArtifactStore.js
|
|
355613
355804
|
import { createHash as createHash70, randomUUID as randomUUID42 } from "node:crypto";
|
|
@@ -356478,10 +356669,10 @@ var equal = (a, b) => canonical6(a) === canonical6(b);
|
|
|
356478
356669
|
function fail3(reason) {
|
|
356479
356670
|
throw new Error(`feature_workflow_${reason}`);
|
|
356480
356671
|
}
|
|
356481
|
-
var token4 =
|
|
356482
|
-
var integer5 =
|
|
356483
|
-
var ref7 =
|
|
356484
|
-
var digest5 =
|
|
356672
|
+
var token4 = z21.string().trim().min(1).max(1e3);
|
|
356673
|
+
var integer5 = z21.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
356674
|
+
var ref7 = z21.string().regex(/^omnius-artifact:\/\/sha256\/[a-f0-9]{64}$/);
|
|
356675
|
+
var digest5 = z21.string().regex(/^[a-f0-9]{64}$/);
|
|
356485
356676
|
function featureWorkflowInputArtifactsHash(artifacts) {
|
|
356486
356677
|
return createHash71("sha256").update(JSON.stringify([...artifacts].sort((a, b) => a.slotId.localeCompare(b.slotId)).map((a) => ({
|
|
356487
356678
|
slotId: a.slotId,
|
|
@@ -356489,13 +356680,13 @@ function featureWorkflowInputArtifactsHash(artifacts) {
|
|
|
356489
356680
|
content: a.content
|
|
356490
356681
|
})))).digest("hex");
|
|
356491
356682
|
}
|
|
356492
|
-
var identitySchema2 =
|
|
356683
|
+
var identitySchema2 = z21.object({
|
|
356493
356684
|
sessionId: token4,
|
|
356494
356685
|
runId: token4,
|
|
356495
356686
|
taskEpoch: integer5,
|
|
356496
356687
|
generation: integer5
|
|
356497
356688
|
}).strict();
|
|
356498
|
-
var bindingSchema =
|
|
356689
|
+
var bindingSchema = z21.object({
|
|
356499
356690
|
parentOperationId: token4,
|
|
356500
356691
|
parentRunId: token4,
|
|
356501
356692
|
parentGeneration: integer5,
|
|
@@ -356503,22 +356694,22 @@ var bindingSchema = z20.object({
|
|
|
356503
356694
|
cardId: token4,
|
|
356504
356695
|
planReference: ref7,
|
|
356505
356696
|
cardContract: digest5,
|
|
356506
|
-
inputSlots:
|
|
356507
|
-
kind:
|
|
356508
|
-
readOnly:
|
|
356509
|
-
ownedFiles:
|
|
356697
|
+
inputSlots: z21.record(token4, ref7),
|
|
356698
|
+
kind: z21.enum(["work", "review", "verification"]),
|
|
356699
|
+
readOnly: z21.boolean(),
|
|
356700
|
+
ownedFiles: z21.array(token4).max(128),
|
|
356510
356701
|
inputArtifactsHash: digest5
|
|
356511
356702
|
}).strict();
|
|
356512
356703
|
var childSchema = bindingSchema.extend({
|
|
356513
|
-
schema:
|
|
356704
|
+
schema: z21.literal("omnius.feature-workflow-child-receipt.v1"),
|
|
356514
356705
|
childId: token4,
|
|
356515
356706
|
childRunId: token4,
|
|
356516
356707
|
childTaskEpoch: integer5,
|
|
356517
356708
|
childInputHash: digest5,
|
|
356518
|
-
status:
|
|
356709
|
+
status: z21.enum(["completed", "failed", "cancelled", "running"]),
|
|
356519
356710
|
terminalReceiptId: token4.optional()
|
|
356520
356711
|
}).strict();
|
|
356521
|
-
var slotSchema =
|
|
356712
|
+
var slotSchema = z21.object({
|
|
356522
356713
|
reference: ref7,
|
|
356523
356714
|
cardId: token4,
|
|
356524
356715
|
cardContract: digest5,
|
|
@@ -356527,61 +356718,61 @@ var slotSchema = z20.object({
|
|
|
356527
356718
|
mutationSequence: integer5,
|
|
356528
356719
|
workspaceRevision: digest5
|
|
356529
356720
|
}).strict();
|
|
356530
|
-
var operationSchema =
|
|
356721
|
+
var operationSchema = z21.object({
|
|
356531
356722
|
binding: bindingSchema,
|
|
356532
356723
|
actorId: token4,
|
|
356533
356724
|
toolName: token4,
|
|
356534
356725
|
command: token4.optional(),
|
|
356535
|
-
effect:
|
|
356536
|
-
state:
|
|
356726
|
+
effect: z21.enum(["read_only", "local_mutation", "external_effect"]),
|
|
356727
|
+
state: z21.enum(["pending", "interrupted"]),
|
|
356537
356728
|
mutationSequence: integer5,
|
|
356538
356729
|
workspaceRevision: digest5
|
|
356539
356730
|
}).strict();
|
|
356540
|
-
var resultSchema =
|
|
356731
|
+
var resultSchema = z21.object({
|
|
356541
356732
|
binding: bindingSchema,
|
|
356542
356733
|
actorId: token4,
|
|
356543
|
-
success:
|
|
356734
|
+
success: z21.boolean(),
|
|
356544
356735
|
receiptReference: ref7,
|
|
356545
|
-
reviewDisposition:
|
|
356736
|
+
reviewDisposition: z21.enum(["approved", "changes_requested"]).optional(),
|
|
356546
356737
|
childReceipt: childSchema.optional(),
|
|
356547
|
-
commandReceipt:
|
|
356738
|
+
commandReceipt: z21.unknown().optional(),
|
|
356548
356739
|
childReportReference: ref7.optional(),
|
|
356549
|
-
blockers:
|
|
356550
|
-
unresolvedQuestions:
|
|
356740
|
+
blockers: z21.array(token4).max(96),
|
|
356741
|
+
unresolvedQuestions: z21.array(token4).max(32),
|
|
356551
356742
|
mutationSequence: integer5,
|
|
356552
356743
|
workspaceRevision: digest5
|
|
356553
356744
|
}).strict();
|
|
356554
|
-
var commandReceiptSchema =
|
|
356555
|
-
schema:
|
|
356745
|
+
var commandReceiptSchema = z21.object({
|
|
356746
|
+
schema: z21.literal("omnius.command-evidence-receipt.v1"),
|
|
356556
356747
|
command: token4,
|
|
356557
356748
|
canonicalCommand: token4,
|
|
356558
356749
|
cwd: token4,
|
|
356559
|
-
pipefail:
|
|
356560
|
-
timedOut:
|
|
356561
|
-
cancelled:
|
|
356562
|
-
startedAtIso:
|
|
356563
|
-
finishedAtIso:
|
|
356564
|
-
exitCode:
|
|
356565
|
-
primaryExitCode:
|
|
356750
|
+
pipefail: z21.boolean(),
|
|
356751
|
+
timedOut: z21.boolean(),
|
|
356752
|
+
cancelled: z21.boolean().optional(),
|
|
356753
|
+
startedAtIso: z21.string().datetime(),
|
|
356754
|
+
finishedAtIso: z21.string().datetime(),
|
|
356755
|
+
exitCode: z21.number().int().nullable().optional(),
|
|
356756
|
+
primaryExitCode: z21.number().int().nullable().optional()
|
|
356566
356757
|
}).passthrough();
|
|
356567
|
-
var checkpointSchema =
|
|
356568
|
-
schema:
|
|
356758
|
+
var checkpointSchema = z21.object({
|
|
356759
|
+
schema: z21.literal(SCHEMA2),
|
|
356569
356760
|
identity: identitySchema2,
|
|
356570
356761
|
boardRunId: token4,
|
|
356571
356762
|
planReference: ref7,
|
|
356572
356763
|
sequence: integer5,
|
|
356573
356764
|
mutationSequence: integer5,
|
|
356574
|
-
slots:
|
|
356575
|
-
operations:
|
|
356576
|
-
results:
|
|
356577
|
-
recentSettlements:
|
|
356578
|
-
retired:
|
|
356765
|
+
slots: z21.record(token4, slotSchema),
|
|
356766
|
+
operations: z21.record(token4, operationSchema),
|
|
356767
|
+
results: z21.record(token4, resultSchema),
|
|
356768
|
+
recentSettlements: z21.array(z21.object({ operationId: token4, resultHash: digest5 }).strict()).max(256),
|
|
356769
|
+
retired: z21.object({
|
|
356579
356770
|
reason: token4,
|
|
356580
|
-
at:
|
|
356771
|
+
at: z21.string().datetime(),
|
|
356581
356772
|
toEpoch: integer5.optional()
|
|
356582
356773
|
}).strict().optional(),
|
|
356583
356774
|
workingDir: token4,
|
|
356584
|
-
adoptions:
|
|
356775
|
+
adoptions: z21.array(z21.object({
|
|
356585
356776
|
from: identitySchema2,
|
|
356586
356777
|
to: identitySchema2,
|
|
356587
356778
|
sourceCheckpointReference: ref7,
|
|
@@ -356858,8 +357049,8 @@ var FeatureWorkflowController = class {
|
|
|
356858
357049
|
return this.state;
|
|
356859
357050
|
}
|
|
356860
357051
|
assertCurrentSelector() {
|
|
356861
|
-
const actual = existsSync32(this.selectorPath) ?
|
|
356862
|
-
schema:
|
|
357052
|
+
const actual = existsSync32(this.selectorPath) ? z21.object({
|
|
357053
|
+
schema: z21.literal(SELECTOR_SCHEMA),
|
|
356863
357054
|
checkpointReference: ref7
|
|
356864
357055
|
}).strict().parse(JSON.parse(readFileSync36(this.selectorPath, "utf8"))).checkpointReference : null;
|
|
356865
357056
|
if (actual !== this.selectorReference) {
|
|
@@ -356995,8 +357186,8 @@ var FeatureWorkflowController = class {
|
|
|
356995
357186
|
try {
|
|
356996
357187
|
if (!existsSync32(this.selectorPath)) {
|
|
356997
357188
|
const matches = this.selectorCandidates().filter((file) => {
|
|
356998
|
-
const selector2 =
|
|
356999
|
-
schema:
|
|
357189
|
+
const selector2 = z21.object({
|
|
357190
|
+
schema: z21.literal(SELECTOR_SCHEMA),
|
|
357000
357191
|
checkpointReference: ref7
|
|
357001
357192
|
}).strict().parse(JSON.parse(readFileSync36(join42(dirname24(this.selectorPath), file), "utf8")));
|
|
357002
357193
|
const state2 = checkpointSchema.parse(JSON.parse(this.store.read(selector2.checkpointReference).content));
|
|
@@ -357008,8 +357199,8 @@ var FeatureWorkflowController = class {
|
|
|
357008
357199
|
fail3("same_run_checkpoint_not_unique");
|
|
357009
357200
|
this.selectorPath = join42(dirname24(this.selectorPath), matches[0]);
|
|
357010
357201
|
}
|
|
357011
|
-
const selector =
|
|
357012
|
-
schema:
|
|
357202
|
+
const selector = z21.object({
|
|
357203
|
+
schema: z21.literal(SELECTOR_SCHEMA),
|
|
357013
357204
|
checkpointReference: ref7
|
|
357014
357205
|
}).strict().parse(JSON.parse(readFileSync36(this.selectorPath, "utf8")));
|
|
357015
357206
|
const state = checkpointSchema.parse(JSON.parse(this.store.read(selector.checkpointReference).content));
|
|
@@ -357063,8 +357254,8 @@ var FeatureWorkflowController = class {
|
|
|
357063
357254
|
return [];
|
|
357064
357255
|
const results = [];
|
|
357065
357256
|
for (const file of this.selectorCandidates()) {
|
|
357066
|
-
const selector =
|
|
357067
|
-
schema:
|
|
357257
|
+
const selector = z21.object({
|
|
357258
|
+
schema: z21.literal(SELECTOR_SCHEMA),
|
|
357068
357259
|
checkpointReference: ref7
|
|
357069
357260
|
}).strict().parse(JSON.parse(readFileSync36(join42(directory, file), "utf8")));
|
|
357070
357261
|
const state = checkpointSchema.parse(JSON.parse(this.store.read(selector.checkpointReference).content));
|
|
@@ -357091,8 +357282,8 @@ var FeatureWorkflowController = class {
|
|
|
357091
357282
|
fail3("continuation_not_found");
|
|
357092
357283
|
const matches = [];
|
|
357093
357284
|
for (const file of this.selectorCandidates()) {
|
|
357094
|
-
const selector =
|
|
357095
|
-
schema:
|
|
357285
|
+
const selector = z21.object({
|
|
357286
|
+
schema: z21.literal(SELECTOR_SCHEMA),
|
|
357096
357287
|
checkpointReference: ref7
|
|
357097
357288
|
}).strict().parse(JSON.parse(readFileSync36(join42(directory, file), "utf8")));
|
|
357098
357289
|
const state = checkpointSchema.parse(JSON.parse(this.store.read(selector.checkpointReference).content));
|
|
@@ -357145,7 +357336,7 @@ var FeatureWorkflowController = class {
|
|
|
357145
357336
|
if (card.phase === "implementation" && !card.ownedFiles.some((path7) => failed.verifier.targetPaths.some((target2) => resolve27(this.options.workingDir, path7) === resolve27(this.options.workingDir, target2))))
|
|
357146
357337
|
fail3("repair_not_failed_verifier_target");
|
|
357147
357338
|
}
|
|
357148
|
-
const reason =
|
|
357339
|
+
const reason = z21.string().trim().min(1).max(4e3).parse(input.reason);
|
|
357149
357340
|
const affected = /* @__PURE__ */ new Set([card.id]);
|
|
357150
357341
|
for (const item of compileFeatureWorkflow(plan).cards) {
|
|
357151
357342
|
const candidate = plan.cards.find((c) => featureWorkflowCardId(plan, c.id) === item.id);
|
|
@@ -359177,7 +359368,7 @@ function checkDoomLoop(context) {
|
|
|
359177
359368
|
// packages/orchestrator/dist/steeringIntake.js
|
|
359178
359369
|
import { appendFileSync as appendFileSync4, existsSync as existsSync34, mkdirSync as mkdirSync28, readFileSync as readFileSync39 } from "node:fs";
|
|
359179
359370
|
import { join as join44 } from "node:path";
|
|
359180
|
-
import { z as
|
|
359371
|
+
import { z as z22 } from "zod";
|
|
359181
359372
|
function classifySteeringIntent(content, requestedIntent) {
|
|
359182
359373
|
void content;
|
|
359183
359374
|
return requestedIntent ?? "context_only";
|
|
@@ -359189,12 +359380,12 @@ function steeringGatesOldPlan(intent) {
|
|
|
359189
359380
|
return intent !== "cancel";
|
|
359190
359381
|
}
|
|
359191
359382
|
var LEDGER_FILE = "steering-ledger.jsonl";
|
|
359192
|
-
var SteeringInterpretationSchema =
|
|
359193
|
-
inference:
|
|
359194
|
-
runnerInstruction:
|
|
359195
|
-
conflicts:
|
|
359196
|
-
alternatives:
|
|
359197
|
-
memoryNote:
|
|
359383
|
+
var SteeringInterpretationSchema = z22.object({
|
|
359384
|
+
inference: z22.string().trim().min(1),
|
|
359385
|
+
runnerInstruction: z22.string().trim().min(1),
|
|
359386
|
+
conflicts: z22.array(z22.string().trim().min(1)).optional().default([]),
|
|
359387
|
+
alternatives: z22.array(z22.string().trim().min(1)).optional().default([]),
|
|
359388
|
+
memoryNote: z22.string().trim().min(1).optional()
|
|
359198
359389
|
});
|
|
359199
359390
|
function appendSteeringLedgerEntry(repoRoot, entry) {
|
|
359200
359391
|
try {
|
|
@@ -359207,13 +359398,17 @@ function appendSteeringLedgerEntry(repoRoot, entry) {
|
|
|
359207
359398
|
}
|
|
359208
359399
|
|
|
359209
359400
|
// packages/orchestrator/dist/steeringEvidence.js
|
|
359210
|
-
import { z as
|
|
359401
|
+
import { z as z23 } from "zod";
|
|
359211
359402
|
|
|
359212
359403
|
// packages/orchestrator/dist/typed-model-output.js
|
|
359213
359404
|
var STEERING_RECONCILIATION_REGION = "steering_reconciliation";
|
|
359214
359405
|
var OPEN = "[STEERING_RECONCILIATION";
|
|
359215
359406
|
var CLOSE = "[/STEERING_RECONCILIATION";
|
|
359216
359407
|
var RESERVED_INTERNAL_LINE_MARKERS = [
|
|
359408
|
+
"[ADJUDICATION_ARGUMENT_REPAIR]",
|
|
359409
|
+
"[ADJUDICATION_INVALID_REPLAY]",
|
|
359410
|
+
"[HUMAN_RESPONSE_REQUIRED]",
|
|
359411
|
+
"[HUMAN_RESPONSE_TURN_REQUIRED]",
|
|
359217
359412
|
"[STEERING_RECONCILIATION_REQUIRED]",
|
|
359218
359413
|
"[STEERING_REPLAN_TURN_REQUIRED]",
|
|
359219
359414
|
"[STEERING_CLARIFICATION_REQUIRED]",
|
|
@@ -359621,38 +359816,38 @@ ${marker}`);
|
|
|
359621
359816
|
|
|
359622
359817
|
// packages/orchestrator/dist/steeringEvidence.js
|
|
359623
359818
|
var STEERING_CHECKPOINT_SCHEMA = "omnius.steering-checkpoint.v1";
|
|
359624
|
-
var identity =
|
|
359625
|
-
var epoch =
|
|
359626
|
-
var intake =
|
|
359819
|
+
var identity = z23.string().min(1).max(500).refine((value) => value === value.trim());
|
|
359820
|
+
var epoch = z23.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
359821
|
+
var intake = z23.object({
|
|
359627
359822
|
inputId: identity,
|
|
359628
|
-
content:
|
|
359629
|
-
source:
|
|
359630
|
-
receivedAt:
|
|
359631
|
-
intent:
|
|
359632
|
-
state:
|
|
359633
|
-
allowTaskReplacement:
|
|
359823
|
+
content: z23.string().min(1),
|
|
359824
|
+
source: z23.string().min(1),
|
|
359825
|
+
receivedAt: z23.string().datetime(),
|
|
359826
|
+
intent: z23.enum(["clarify", "append", "context_only", "constraint", "priority_change", "redirect", "replace", "cancel"]),
|
|
359827
|
+
state: z23.enum(["received", "queued", "acknowledged", "visible_in_request", "reconciliation_required", "reconciled", "first_affected_action", "consumed", "superseded", "cancelled"]),
|
|
359828
|
+
allowTaskReplacement: z23.boolean().optional(),
|
|
359634
359829
|
taskEpoch: epoch
|
|
359635
359830
|
});
|
|
359636
|
-
var call =
|
|
359831
|
+
var call = z23.object({
|
|
359637
359832
|
id: identity,
|
|
359638
359833
|
name: identity,
|
|
359639
|
-
arguments:
|
|
359640
|
-
executionArguments:
|
|
359641
|
-
state:
|
|
359642
|
-
success:
|
|
359834
|
+
arguments: z23.record(z23.string(), z23.unknown()),
|
|
359835
|
+
executionArguments: z23.record(z23.string(), z23.unknown()).optional(),
|
|
359836
|
+
state: z23.enum(["pending", "running", "completed"]),
|
|
359837
|
+
success: z23.boolean().optional()
|
|
359643
359838
|
}).refine((value) => value.state === "completed" === (value.success !== void 0));
|
|
359644
|
-
var activeSchema =
|
|
359839
|
+
var activeSchema = z23.object({
|
|
359645
359840
|
input: intake,
|
|
359646
|
-
relatedInputs:
|
|
359841
|
+
relatedInputs: z23.array(intake).max(127).optional(),
|
|
359647
359842
|
historyStartIndex: epoch.optional(),
|
|
359648
359843
|
appliedTurn: epoch,
|
|
359649
|
-
requiresReconciliation:
|
|
359650
|
-
gatesOldPlan:
|
|
359651
|
-
visibleRequestTurns:
|
|
359652
|
-
reconciliation:
|
|
359844
|
+
requiresReconciliation: z23.boolean(),
|
|
359845
|
+
gatesOldPlan: z23.boolean(),
|
|
359846
|
+
visibleRequestTurns: z23.array(epoch),
|
|
359847
|
+
reconciliation: z23.unknown().optional(),
|
|
359653
359848
|
reconciledTurn: epoch.optional(),
|
|
359654
|
-
firstAffectedAction:
|
|
359655
|
-
evidence:
|
|
359849
|
+
firstAffectedAction: z23.object({ toolName: identity, turn: epoch }).optional(),
|
|
359850
|
+
evidence: z23.object({ phases: z23.number().int().min(1).max(3), calls: z23.array(call).min(1).max(12) }).optional()
|
|
359656
359851
|
});
|
|
359657
359852
|
function isSteeringScopeResolved(active) {
|
|
359658
359853
|
const decision2 = active.reconciliation;
|
|
@@ -359667,7 +359862,7 @@ function renderSteeringReconciliationProtocol(inputId) {
|
|
|
359667
359862
|
taskDisposition: "continue"
|
|
359668
359863
|
});
|
|
359669
359864
|
return [
|
|
359670
|
-
"
|
|
359865
|
+
"First answer the latest user briefly in ordinary visible prose; then include exactly one internal structured reconciliation. Include no tool calls in that response:",
|
|
359671
359866
|
"[STEERING_RECONCILIATION]",
|
|
359672
359867
|
template,
|
|
359673
359868
|
"[/STEERING_RECONCILIATION]",
|
|
@@ -359686,14 +359881,14 @@ function steeringEvidenceArgumentsKey(value) {
|
|
|
359686
359881
|
return JSON.stringify(value) ?? "undefined";
|
|
359687
359882
|
}
|
|
359688
359883
|
function validateSteeringCheckpoint(value, expected) {
|
|
359689
|
-
const parsed =
|
|
359690
|
-
schema:
|
|
359884
|
+
const parsed = z23.object({
|
|
359885
|
+
schema: z23.literal(STEERING_CHECKPOINT_SCHEMA),
|
|
359691
359886
|
runId: identity,
|
|
359692
359887
|
sessionId: identity,
|
|
359693
359888
|
taskEpoch: epoch,
|
|
359694
359889
|
active: activeSchema,
|
|
359695
|
-
goal:
|
|
359696
|
-
messages:
|
|
359890
|
+
goal: z23.string().min(1).max(16e3),
|
|
359891
|
+
messages: z23.array(z23.unknown()).min(1).max(1e5)
|
|
359697
359892
|
}).parse(value);
|
|
359698
359893
|
if (parsed.runId !== expected.runId || parsed.sessionId !== expected.sessionId || parsed.taskEpoch !== expected.taskEpoch)
|
|
359699
359894
|
throw new Error("steering_checkpoint_identity_mismatch");
|
|
@@ -365409,7 +365604,7 @@ function reconcileShellExecutionOutcome(command, result) {
|
|
|
365409
365604
|
}
|
|
365410
365605
|
|
|
365411
365606
|
// packages/orchestrator/dist/agenticRunner.js
|
|
365412
|
-
import { z as
|
|
365607
|
+
import { z as z25 } from "zod";
|
|
365413
365608
|
init_ollama_pool();
|
|
365414
365609
|
|
|
365415
365610
|
// packages/orchestrator/dist/personality.js
|
|
@@ -366153,7 +366348,7 @@ function buildPhaseSkillGuidance(input) {
|
|
|
366153
366348
|
import { createHash as createHash87 } from "node:crypto";
|
|
366154
366349
|
import { existsSync as existsSync40, readFileSync as readFileSync46 } from "node:fs";
|
|
366155
366350
|
import { join as join50 } from "node:path";
|
|
366156
|
-
import { z as
|
|
366351
|
+
import { z as z24 } from "zod";
|
|
366157
366352
|
var deliveryRealityStates = [
|
|
366158
366353
|
"simulation_only",
|
|
366159
366354
|
"hardware_integrated",
|
|
@@ -366169,70 +366364,70 @@ var acceptanceLayers = [
|
|
|
366169
366364
|
"hardware_in_loop",
|
|
366170
366365
|
"documentation"
|
|
366171
366366
|
];
|
|
366172
|
-
var sourceSchema =
|
|
366173
|
-
id:
|
|
366174
|
-
kind:
|
|
366175
|
-
pathOrUrl:
|
|
366176
|
-
revision:
|
|
366177
|
-
hash:
|
|
366367
|
+
var sourceSchema = z24.object({
|
|
366368
|
+
id: z24.string().min(1),
|
|
366369
|
+
kind: z24.enum(["local_contract", "official_vendor", "third_party", "generated"]),
|
|
366370
|
+
pathOrUrl: z24.string().min(1),
|
|
366371
|
+
revision: z24.string().min(1).optional(),
|
|
366372
|
+
hash: z24.string().min(8).optional()
|
|
366178
366373
|
});
|
|
366179
|
-
var contractSchema =
|
|
366180
|
-
id:
|
|
366181
|
-
productSeries:
|
|
366182
|
-
sourceId:
|
|
366183
|
-
declaredCommands:
|
|
366184
|
-
declaredParameters:
|
|
366185
|
-
declaredModelFormats:
|
|
366374
|
+
var contractSchema = z24.object({
|
|
366375
|
+
id: z24.string().min(1),
|
|
366376
|
+
productSeries: z24.string().min(1),
|
|
366377
|
+
sourceId: z24.string().min(1),
|
|
366378
|
+
declaredCommands: z24.array(z24.string().min(1)).default([]),
|
|
366379
|
+
declaredParameters: z24.array(z24.string().min(1)).default([]),
|
|
366380
|
+
declaredModelFormats: z24.array(z24.string().min(1)).default([])
|
|
366186
366381
|
});
|
|
366187
|
-
var acceptanceSchema =
|
|
366188
|
-
id:
|
|
366189
|
-
layer:
|
|
366190
|
-
requiredFor:
|
|
366382
|
+
var acceptanceSchema = z24.object({
|
|
366383
|
+
id: z24.string().min(1),
|
|
366384
|
+
layer: z24.enum(acceptanceLayers),
|
|
366385
|
+
requiredFor: z24.array(z24.enum(deliveryRealityStates)).min(1),
|
|
366191
366386
|
/** Canonical commands whose successful receipts prove this layer ran. */
|
|
366192
|
-
verificationCommands:
|
|
366193
|
-
safetyInterlock:
|
|
366387
|
+
verificationCommands: z24.array(z24.string().min(1)).min(1),
|
|
366388
|
+
safetyInterlock: z24.string().min(1).optional()
|
|
366194
366389
|
});
|
|
366195
|
-
var inspectionSchema =
|
|
366196
|
-
id:
|
|
366197
|
-
boundary:
|
|
366198
|
-
targetPaths:
|
|
366199
|
-
proves:
|
|
366390
|
+
var inspectionSchema = z24.object({
|
|
366391
|
+
id: z24.string().min(1),
|
|
366392
|
+
boundary: z24.string().min(1),
|
|
366393
|
+
targetPaths: z24.array(z24.string().min(1)).min(1),
|
|
366394
|
+
proves: z24.string().min(1)
|
|
366200
366395
|
});
|
|
366201
|
-
var contradictionCheckSchema =
|
|
366202
|
-
id:
|
|
366203
|
-
question:
|
|
366204
|
-
inspectionIds:
|
|
366396
|
+
var contradictionCheckSchema = z24.object({
|
|
366397
|
+
id: z24.string().min(1),
|
|
366398
|
+
question: z24.string().min(1),
|
|
366399
|
+
inspectionIds: z24.array(z24.string().min(1)).min(1)
|
|
366205
366400
|
});
|
|
366206
|
-
var subjectSchema =
|
|
366207
|
-
productSeries:
|
|
366208
|
-
commands:
|
|
366209
|
-
parameters:
|
|
366210
|
-
modelFormats:
|
|
366401
|
+
var subjectSchema = z24.object({
|
|
366402
|
+
productSeries: z24.string().min(1),
|
|
366403
|
+
commands: z24.array(z24.string().min(1)).default([]),
|
|
366404
|
+
parameters: z24.array(z24.string().min(1)).default([]),
|
|
366405
|
+
modelFormats: z24.array(z24.string().min(1)).default([])
|
|
366211
366406
|
});
|
|
366212
|
-
var claimSchema =
|
|
366213
|
-
id:
|
|
366214
|
-
subjects:
|
|
366215
|
-
state:
|
|
366216
|
-
contractId:
|
|
366217
|
-
sourceIds:
|
|
366218
|
-
evidenceIds:
|
|
366219
|
-
requiredAcceptanceIds:
|
|
366407
|
+
var claimSchema = z24.object({
|
|
366408
|
+
id: z24.string().min(1),
|
|
366409
|
+
subjects: z24.array(subjectSchema).min(1),
|
|
366410
|
+
state: z24.enum(deliveryRealityStates),
|
|
366411
|
+
contractId: z24.string().min(1).optional(),
|
|
366412
|
+
sourceIds: z24.array(z24.string().min(1)).min(1),
|
|
366413
|
+
evidenceIds: z24.array(z24.string().min(1)).default([]),
|
|
366414
|
+
requiredAcceptanceIds: z24.array(z24.string().min(1)).default([]),
|
|
366220
366415
|
/** Source boundaries that must be freshly read before this claim is true. */
|
|
366221
|
-
requiredInspectionIds:
|
|
366416
|
+
requiredInspectionIds: z24.array(z24.string().min(1)).default([]),
|
|
366222
366417
|
/** Falsification checks that must be grounded in those source inspections. */
|
|
366223
|
-
requiredContradictionCheckIds:
|
|
366224
|
-
blockedReason:
|
|
366418
|
+
requiredContradictionCheckIds: z24.array(z24.string().min(1)).default([]),
|
|
366419
|
+
blockedReason: z24.string().min(1).optional()
|
|
366225
366420
|
});
|
|
366226
|
-
var deliveryCoverageManifestSchema =
|
|
366421
|
+
var deliveryCoverageManifestSchema = z24.object({
|
|
366227
366422
|
// Version 1 remains readable for existing workspaces. Version 2 activates
|
|
366228
366423
|
// claim-driven source inspection and falsification gates.
|
|
366229
|
-
schemaVersion:
|
|
366230
|
-
sources:
|
|
366231
|
-
contracts:
|
|
366232
|
-
acceptance:
|
|
366233
|
-
inspections:
|
|
366234
|
-
contradictionChecks:
|
|
366235
|
-
claims:
|
|
366424
|
+
schemaVersion: z24.union([z24.literal(1), z24.literal(2)]),
|
|
366425
|
+
sources: z24.array(sourceSchema),
|
|
366426
|
+
contracts: z24.array(contractSchema),
|
|
366427
|
+
acceptance: z24.array(acceptanceSchema),
|
|
366428
|
+
inspections: z24.array(inspectionSchema).default([]),
|
|
366429
|
+
contradictionChecks: z24.array(contradictionCheckSchema).default([]),
|
|
366430
|
+
claims: z24.array(claimSchema)
|
|
366236
366431
|
});
|
|
366237
366432
|
function canonicalPath(path7) {
|
|
366238
366433
|
return String(path7 ?? "").trim().replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/+/g, "/");
|
|
@@ -388296,6 +388491,10 @@ var AgenticRunner = class _AgenticRunner {
|
|
|
388296
388491
|
*/
|
|
388297
388492
|
_immediateSteeringWakeInputId = null;
|
|
388298
388493
|
_steeringSequence = 0;
|
|
388494
|
+
/** Explicit foreground human input is answered before optional advice/actions. */
|
|
388495
|
+
_pendingSteeringReply = null;
|
|
388496
|
+
_steeringReplyTurn = null;
|
|
388497
|
+
_adjudicationArgumentRepair = null;
|
|
388299
388498
|
_taskEpoch = 0;
|
|
388300
388499
|
_exclusiveTaskOwner = null;
|
|
388301
388500
|
_hasStartedTask = false;
|
|
@@ -388470,6 +388669,8 @@ var AgenticRunner = class _AgenticRunner {
|
|
|
388470
388669
|
_desktopVerificationObservation = null;
|
|
388471
388670
|
_desktopVerificationPending = null;
|
|
388472
388671
|
_trajectoryGeneratedGrounding = null;
|
|
388672
|
+
_trajectoryGroundingRequest = null;
|
|
388673
|
+
_virtualContextRequest = null;
|
|
388473
388674
|
_taskWorkOperationBindings = /* @__PURE__ */ new Map();
|
|
388474
388675
|
_taskWorkDispatchUnits = /* @__PURE__ */ new Map();
|
|
388475
388676
|
// -- File State Registry (SWE-agent inspired) --
|
|
@@ -392946,7 +393147,7 @@ ${read.content}`;
|
|
|
392946
393147
|
request.maxTokens = Math.min(outputIntent, configuredCeiling);
|
|
392947
393148
|
}
|
|
392948
393149
|
const steering = this._activeSteering;
|
|
392949
|
-
const maskSteeringTools = Boolean(steering?.input.taskEpoch === this._taskEpoch && steering.gatesOldPlan && steering.requiresReconciliation && !steering.reconciliation && this._requestCarriesCurrentSteering(request, steering));
|
|
393150
|
+
const maskSteeringTools = Boolean(this._currentSteeringReplyPending() || steering?.input.taskEpoch === this._taskEpoch && steering.gatesOldPlan && steering.requiresReconciliation && !steering.reconciliation && this._requestCarriesCurrentSteering(request, steering));
|
|
392950
393151
|
const contracts = JSON.stringify([...this._canonicalToolExposureContracts]);
|
|
392951
393152
|
let toolIntent = this._contextAdmissionToolIntents.get(request);
|
|
392952
393153
|
if (toolIntent && (toolIntent.runId !== this._activeRunId || toolIntent.taskEpoch !== this._taskEpoch || toolIntent.contracts !== contracts || toolIntent.registry.some((entry) => this.tools.get(entry.name) !== entry.tool))) {
|
|
@@ -393525,6 +393726,15 @@ ${read.content}`;
|
|
|
393525
393726
|
});
|
|
393526
393727
|
}
|
|
393527
393728
|
}
|
|
393729
|
+
const argumentRepair = this._currentAdjudicationArgumentRepair(turn);
|
|
393730
|
+
if (argumentRepair)
|
|
393731
|
+
latest.set("adjudication-argument-repair", {
|
|
393732
|
+
slot: "next_action",
|
|
393733
|
+
source: "runtime.adjudication-argument-repair",
|
|
393734
|
+
priority: 100,
|
|
393735
|
+
protection: ["active_requirement"],
|
|
393736
|
+
content: this._adjudicationArgumentRepairGuidance(argumentRepair)
|
|
393737
|
+
});
|
|
393528
393738
|
return [...latest.entries()].map(([id5, signal]) => ({
|
|
393529
393739
|
id: `canonical-late:${id5}`,
|
|
393530
393740
|
slot: signal.slot,
|
|
@@ -396739,6 +396949,52 @@ ${content}`)].join("\n\n");
|
|
|
396739
396949
|
_hasUnresolvedCurrentSteeringInputs() {
|
|
396740
396950
|
return this._nativeRequirementInterpretationHolds.size > 0 || this.pendingSteeringInputs.some((input) => (input.taskEpoch === void 0 || input.taskEpoch === this._taskEpoch) && (input.state === "received" || input.state === "queued" || input.state === "acknowledged" || input.state === "visible_in_request" || input.state === "reconciliation_required"));
|
|
396741
396951
|
}
|
|
396952
|
+
_currentSteeringReplyPending() {
|
|
396953
|
+
const pending = this._pendingSteeringReply;
|
|
396954
|
+
return pending && pending.runId === this.currentArtifactRunId() && pending.ownerId === this._interruptionOwnerId && pending.input.taskEpoch === this._taskEpoch && !["cancelled", "superseded", "consumed"].includes(pending.input.state) ? pending : null;
|
|
396955
|
+
}
|
|
396956
|
+
_adjudicationArgumentRepairIsCurrent(repair) {
|
|
396957
|
+
const tool = this.lookupRegisteredTool(ADJUDICATION_TOOL_NAME)?.tool;
|
|
396958
|
+
return repair.runId === this.currentArtifactRunId() && repair.taskEpoch === this._taskEpoch && repair.ownerId === this._interruptionOwnerId && repair.tool === tool && repair.schema === tool?.inputSchema && repair.parameters === JSON.stringify(tool?.parameters);
|
|
396959
|
+
}
|
|
396960
|
+
_currentAdjudicationArgumentRepair(turn) {
|
|
396961
|
+
const repair = this._adjudicationArgumentRepair;
|
|
396962
|
+
return repair && this._adjudicationArgumentRepairIsCurrent(repair) && (turn === void 0 || repair.settled && turn === repair.turn + 1) ? repair : null;
|
|
396963
|
+
}
|
|
396964
|
+
_adjudicationArgumentRepairGuidance(repair) {
|
|
396965
|
+
return (repair.repeats ? "[ADJUDICATION_INVALID_REPLAY] Identical known-invalid arguments were refused without execution. Correct the named values before retrying.\n" : "") + formatAdjudicationArgumentRepair(repair.error, repair.contract.args_sha256);
|
|
396966
|
+
}
|
|
396967
|
+
_observePrimarySteeringReply(content, turn, emitMixedReply = false) {
|
|
396968
|
+
const pending = this._currentSteeringReplyPending();
|
|
396969
|
+
const visible = content ? partitionTypedModelOutput(content).visibleText.trim() : "";
|
|
396970
|
+
let fence2;
|
|
396971
|
+
const hasProse = visible.split(/\r?\n/).some((line) => {
|
|
396972
|
+
const boundary2 = /^\s*(`{3,}|~{3,})(.*)$/.exec(line);
|
|
396973
|
+
if (boundary2) {
|
|
396974
|
+
if (!fence2)
|
|
396975
|
+
fence2 = { marker: boundary2[1][0], length: boundary2[1].length };
|
|
396976
|
+
else if (boundary2[1][0] === fence2.marker && boundary2[1].length >= fence2.length && !boundary2[2].trim())
|
|
396977
|
+
fence2 = void 0;
|
|
396978
|
+
return false;
|
|
396979
|
+
}
|
|
396980
|
+
return !fence2 && Boolean(line.trim());
|
|
396981
|
+
});
|
|
396982
|
+
const carried = Boolean(pending?.visibleRequestTurns.includes(turn));
|
|
396983
|
+
const active = this._activeSteering;
|
|
396984
|
+
if (emitMixedReply && hasProse && (carried || active?.input.taskEpoch === this._taskEpoch && active.requiresReconciliation && active.visibleRequestTurns.includes(turn))) {
|
|
396985
|
+
this.emit({ type: "assistant_text", content: visible, turn, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
396986
|
+
this._assistantTextEmitted = true;
|
|
396987
|
+
}
|
|
396988
|
+
if (carried && hasProse) {
|
|
396989
|
+
this._pendingSteeringReply = null;
|
|
396990
|
+
this._steeringReplyTurn = {
|
|
396991
|
+
runId: this.currentArtifactRunId(),
|
|
396992
|
+
taskEpoch: this._taskEpoch,
|
|
396993
|
+
ownerId: this._interruptionOwnerId,
|
|
396994
|
+
turn
|
|
396995
|
+
};
|
|
396996
|
+
}
|
|
396997
|
+
}
|
|
396742
396998
|
_objectiveReadBatchAuxiliaryEligible() {
|
|
396743
396999
|
const continuation = this._objectiveReadBatchContinuation;
|
|
396744
397000
|
const batch = this.options.objectiveReadBatch;
|
|
@@ -396827,6 +397083,8 @@ ${content}`)].join("\n\n");
|
|
|
396827
397083
|
const configuredPinnedBudget = this.options.virtualContext?.pinnedMemoryTokenBudget;
|
|
396828
397084
|
const pinnedTokenBudget = Math.max(0, Math.min(physicalInputBudget, Number.isFinite(configuredPinnedBudget) && (configuredPinnedBudget ?? 0) > 0 ? Math.floor(configuredPinnedBudget) : adaptiveBudget.pinnedState));
|
|
396829
397085
|
const pinnedMessages = this._pinnedStructuredMemoryMessages(pinnedTokenBudget, physicalInputBudget, turn);
|
|
397086
|
+
if (this._currentAdjudicationArgumentRepair(turn) || this._currentSteeringReplyPending() || this._hasUnresolvedCurrentSteeringInputs())
|
|
397087
|
+
return pinnedMessages;
|
|
396830
397088
|
const residentInputTokens = estimateConservativeRequestInputTokens({
|
|
396831
397089
|
messages: messages2.map((message) => ({ ...message })),
|
|
396832
397090
|
tools,
|
|
@@ -396935,11 +397193,34 @@ ${content}`)].join("\n\n");
|
|
|
396935
397193
|
}))
|
|
396936
397194
|
];
|
|
396937
397195
|
}
|
|
397196
|
+
const projectionRequest = {
|
|
397197
|
+
controller: new AbortController(),
|
|
397198
|
+
runId: this.currentArtifactRunId(),
|
|
397199
|
+
taskEpoch: this._taskEpoch,
|
|
397200
|
+
ownerId: this._interruptionOwnerId,
|
|
397201
|
+
generation: this._modelRequestGeneration
|
|
397202
|
+
};
|
|
397203
|
+
this._virtualContextRequest = projectionRequest;
|
|
397204
|
+
const signal = AbortSignal.any([
|
|
397205
|
+
projectionRequest.controller.signal,
|
|
397206
|
+
this._abortController.signal,
|
|
397207
|
+
this._turnAbortController.signal,
|
|
397208
|
+
this._inputWaitBoundaryController.signal
|
|
397209
|
+
]);
|
|
397210
|
+
const isCurrent = () => !signal.aborted && this._virtualContextRequest === projectionRequest && projectionRequest.runId === this.currentArtifactRunId() && projectionRequest.taskEpoch === this._taskEpoch && projectionRequest.ownerId === this._interruptionOwnerId && projectionRequest.generation === this._modelRequestGeneration;
|
|
397211
|
+
const assertCurrent = () => {
|
|
397212
|
+
if (!isCurrent())
|
|
397213
|
+
throw new InputWaitInterruption();
|
|
397214
|
+
};
|
|
396938
397215
|
try {
|
|
396939
397216
|
const timeoutMs = this.options.requestTimeoutMs === 0 ? 0 : Number.isFinite(this.options.requestTimeoutMs) && (this.options.requestTimeoutMs ?? 0) > 0 ? this.options.requestTimeoutMs : 3e5;
|
|
396940
|
-
|
|
397217
|
+
assertCurrent();
|
|
397218
|
+
const projection = await withInputWaitCancellation(signal, () => buildLiveVirtualContextProjection({
|
|
396941
397219
|
store,
|
|
396942
|
-
archiveDocument: (document) =>
|
|
397220
|
+
archiveDocument: (document) => {
|
|
397221
|
+
assertCurrent();
|
|
397222
|
+
return this._archiveVirtualEvidenceDocument(document);
|
|
397223
|
+
},
|
|
396943
397224
|
...this._structuredMemoryStore ? { memoryStore: this._structuredMemoryStore } : {},
|
|
396944
397225
|
query,
|
|
396945
397226
|
scopeId: this._sessionId,
|
|
@@ -396952,9 +397233,11 @@ ${content}`)].join("\n\n");
|
|
|
396952
397233
|
auxiliaryContextWindowTokens: physicalWindow,
|
|
396953
397234
|
auxiliaryMaxOutputTokens: this._explicitGenerationMaxTokens || this.options.maxTokens !== 16384 ? this._generationOutputCeiling() : void 0,
|
|
396954
397235
|
maxRetrievalRounds: this.options.virtualContext?.maxRetrievalRounds,
|
|
396955
|
-
signal
|
|
397236
|
+
signal,
|
|
396956
397237
|
requestTimeoutMs: timeoutMs > 0 ? Math.min(timeoutMs, 3e4) : 3e4,
|
|
396957
397238
|
onTrace: (event) => {
|
|
397239
|
+
if (!isCurrent())
|
|
397240
|
+
return;
|
|
396958
397241
|
this._recordLiveVirtualContextTrace(event, turn);
|
|
396959
397242
|
this.emit({
|
|
396960
397243
|
type: "status",
|
|
@@ -396965,9 +397248,11 @@ ${content}`)].join("\n\n");
|
|
|
396965
397248
|
});
|
|
396966
397249
|
},
|
|
396967
397250
|
infer: async (request) => {
|
|
397251
|
+
assertCurrent();
|
|
396968
397252
|
this._emitModelResolutionTelemetry(`virtual_memory_${request.stage}`, turn);
|
|
396969
|
-
const response = await this._auxInferenceBackend({
|
|
396970
|
-
dumpStage: `virtual_memory_${request.stage}
|
|
397253
|
+
const response = await withInputWaitCancellation(request.signal, () => this._auxInferenceBackend({
|
|
397254
|
+
dumpStage: `virtual_memory_${request.stage}`,
|
|
397255
|
+
assertCurrent
|
|
396971
397256
|
}).chatCompletion({
|
|
396972
397257
|
messages: [
|
|
396973
397258
|
{ role: "system", content: request.system },
|
|
@@ -396981,10 +397266,12 @@ ${content}`)].join("\n\n");
|
|
|
396981
397266
|
think: false,
|
|
396982
397267
|
workloadClass: this.options.workloadClass,
|
|
396983
397268
|
logicalRequestId: this._modelTurnRequestId(turn, `virtual-memory:${request.stage}`)
|
|
396984
|
-
});
|
|
397269
|
+
}));
|
|
397270
|
+
assertCurrent();
|
|
396985
397271
|
return response.choices?.[0]?.message?.content ?? "";
|
|
396986
397272
|
}
|
|
396987
|
-
});
|
|
397273
|
+
}));
|
|
397274
|
+
assertCurrent();
|
|
396988
397275
|
this._liveVirtualContextAttempt = { semanticKey, turn };
|
|
396989
397276
|
if (!projection)
|
|
396990
397277
|
return pinnedMessages;
|
|
@@ -397011,6 +397298,8 @@ ${content}`)].join("\n\n");
|
|
|
397011
397298
|
}))
|
|
397012
397299
|
];
|
|
397013
397300
|
} catch (error) {
|
|
397301
|
+
if (!isCurrent() || error instanceof InputWaitInterruption)
|
|
397302
|
+
return pinnedMessages;
|
|
397014
397303
|
if (this._turnAbortController.signal.aborted)
|
|
397015
397304
|
throw error;
|
|
397016
397305
|
this._liveVirtualContextAttempt = { semanticKey, turn };
|
|
@@ -397022,6 +397311,9 @@ ${content}`)].join("\n\n");
|
|
|
397022
397311
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
397023
397312
|
});
|
|
397024
397313
|
return pinnedMessages;
|
|
397314
|
+
} finally {
|
|
397315
|
+
if (this._virtualContextRequest === projectionRequest)
|
|
397316
|
+
this._virtualContextRequest = null;
|
|
397025
397317
|
}
|
|
397026
397318
|
}
|
|
397027
397319
|
_pinnedStructuredMemoryMessages(defaultTokenBudget, physicalInputBudget, turn) {
|
|
@@ -397816,7 +398108,7 @@ ${currentIntent.trim().slice(0, 6e3)}`,
|
|
|
397816
398108
|
request: r
|
|
397817
398109
|
});
|
|
397818
398110
|
}
|
|
397819
|
-
return this._dispatchInterruptionOwnedModelRequest(b, r, `model:aux:${opts?.dumpStage ?? "aux_inference"}`, { assertCurrent: opts?.assertCurrent });
|
|
398111
|
+
return this._dispatchInterruptionOwnedModelRequest(b, r, `model:aux:${opts?.dumpStage ?? "aux_inference"}`, { assertCurrent: opts?.assertCurrent, signal: r.signal });
|
|
397820
398112
|
}
|
|
397821
398113
|
};
|
|
397822
398114
|
}
|
|
@@ -400166,12 +400458,12 @@ ${modelVisible}` : modelVisible || result.error || displayOutput || "";
|
|
|
400166
400458
|
if (!candidate)
|
|
400167
400459
|
return { quality: "not_candidate", summary: "not a validation command" };
|
|
400168
400460
|
if (!commandReliablySatisfiesVerifyCommand(command, command, result.executionReceipt)) {
|
|
400169
|
-
const
|
|
400461
|
+
const shape3 = describeUntrustedVerificationCommand(command, result.executionReceipt);
|
|
400170
400462
|
return {
|
|
400171
400463
|
quality: "rejected_untrusted",
|
|
400172
|
-
summary: `validation command is not receipt-authoritative: ${
|
|
400173
|
-
reason: `Repair the execution shape: ${
|
|
400174
|
-
nextAction: `Run the canonical validation with a receipt-authoritative shape; current issue: ${
|
|
400464
|
+
summary: `validation command is not receipt-authoritative: ${shape3}`,
|
|
400465
|
+
reason: `Repair the execution shape: ${shape3}.`,
|
|
400466
|
+
nextAction: `Run the canonical validation with a receipt-authoritative shape; current issue: ${shape3}.`
|
|
400175
400467
|
};
|
|
400176
400468
|
}
|
|
400177
400469
|
if (result.success !== true) {
|
|
@@ -405802,7 +406094,16 @@ ${findingsBody}`;
|
|
|
405802
406094
|
}
|
|
405803
406095
|
return null;
|
|
405804
406096
|
}
|
|
405805
|
-
buildToolArgumentRepairFeedback(toolName, args, tool, validationError) {
|
|
406097
|
+
buildToolArgumentRepairFeedback(toolName, args, tool, validationError, admittedRepair) {
|
|
406098
|
+
if (tool.name === ADJUDICATION_TOOL_NAME) {
|
|
406099
|
+
const argsKey = this._buildExactArgsKey(args);
|
|
406100
|
+
const candidate = admittedRepair ?? this._currentAdjudicationArgumentRepair();
|
|
406101
|
+
const repair = candidate && this._adjudicationArgumentRepairIsCurrent(candidate) && candidate.argsKey === argsKey ? candidate : null;
|
|
406102
|
+
const guidance = repair ? this._adjudicationArgumentRepairGuidance(repair) : formatAdjudicationArgumentRepair(validationError, _createHash("sha256").update(argsKey).digest("hex"));
|
|
406103
|
+
const message = `Invalid arguments for ${toolName}.
|
|
406104
|
+
${guidance}`;
|
|
406105
|
+
return { error: message, llmContent: message, systemGuidance: guidance };
|
|
406106
|
+
}
|
|
405806
406107
|
const parameters = tool.parameters ?? {};
|
|
405807
406108
|
const props = this.schemaProperties(parameters);
|
|
405808
406109
|
const required = this.schemaRequired(parameters);
|
|
@@ -406002,28 +406303,12 @@ ${findingsBody}`;
|
|
|
406002
406303
|
return corrected;
|
|
406003
406304
|
}
|
|
406004
406305
|
findSiblingToolSchemaMatches(requestedToolName, providedKeys) {
|
|
406005
|
-
|
|
406006
|
-
|
|
406007
|
-
|
|
406008
|
-
|
|
406009
|
-
|
|
406010
|
-
|
|
406011
|
-
continue;
|
|
406012
|
-
const props = this.schemaProperties(candidate.parameters ?? {});
|
|
406013
|
-
if (props.size === 0)
|
|
406014
|
-
continue;
|
|
406015
|
-
const required = this.schemaRequired(candidate.parameters ?? {});
|
|
406016
|
-
const matched = providedKeys.filter((key) => props.has(key)).length;
|
|
406017
|
-
if (matched === 0)
|
|
406018
|
-
continue;
|
|
406019
|
-
const requiredPresent = required.filter((key) => provided.has(key)).length;
|
|
406020
|
-
const requiredSatisfied = required.length === 0 || requiredPresent === required.length;
|
|
406021
|
-
const score = matched * 2 + requiredPresent * 3 + (requiredSatisfied ? 3 : 0) - Math.max(0, required.length - requiredPresent);
|
|
406022
|
-
if (score >= 5 || matched >= 2 && requiredSatisfied) {
|
|
406023
|
-
matches.push({ name: candidate.name, score });
|
|
406024
|
-
}
|
|
406025
|
-
}
|
|
406026
|
-
return matches.sort((a, b) => b.score - a.score).slice(0, 3).map((match2) => match2.name);
|
|
406306
|
+
return findBetterToolSchemaMatches({
|
|
406307
|
+
requestedToolName,
|
|
406308
|
+
requestedParameters: this.lookupRegisteredTool(requestedToolName)?.tool.parameters ?? {},
|
|
406309
|
+
providedKeys,
|
|
406310
|
+
candidates: this.tools.values()
|
|
406311
|
+
});
|
|
406027
406312
|
}
|
|
406028
406313
|
unknownToolError(name) {
|
|
406029
406314
|
const names = Array.from(this.tools.values()).map((tool) => tool.aliases?.length ? `${tool.name} (aliases: ${tool.aliases.join("|")})` : tool.name).sort();
|
|
@@ -406435,6 +406720,14 @@ ${notice}`;
|
|
|
406435
406720
|
this._emitSteeringLifecycle(record9, !content ? "empty steering input rejected" : "replacement exceeds host intake authority");
|
|
406436
406721
|
return this._steeringReceipt(record9);
|
|
406437
406722
|
}
|
|
406723
|
+
if ((record9.source === "tui-work-intake" || record9.source === "tui") && record9.intent !== "cancel") {
|
|
406724
|
+
this._pendingSteeringReply = {
|
|
406725
|
+
input: record9,
|
|
406726
|
+
runId: this.currentArtifactRunId(),
|
|
406727
|
+
ownerId: this._interruptionOwnerId,
|
|
406728
|
+
visibleRequestTurns: []
|
|
406729
|
+
};
|
|
406730
|
+
}
|
|
406438
406731
|
record9.state = "queued";
|
|
406439
406732
|
this._emitSteeringLifecycle(record9, "queued for next safe turn boundary");
|
|
406440
406733
|
if (steeringGatesOldPlan(record9.intent)) {
|
|
@@ -406444,6 +406737,13 @@ ${notice}`;
|
|
|
406444
406737
|
this._requestSteeringPreemption(record9);
|
|
406445
406738
|
}
|
|
406446
406739
|
this._trajectoryDirtyCauses.add("user_steering");
|
|
406740
|
+
const grounding = this._trajectoryGroundingRequest;
|
|
406741
|
+
if (grounding?.runId === this.currentArtifactRunId() && grounding.taskEpoch === this._taskEpoch) {
|
|
406742
|
+
grounding.controller.abort(new InputWaitInterruption());
|
|
406743
|
+
}
|
|
406744
|
+
const projection = this._virtualContextRequest;
|
|
406745
|
+
if (projection?.runId === this.currentArtifactRunId() && projection.taskEpoch === this._taskEpoch && projection.ownerId === this._interruptionOwnerId)
|
|
406746
|
+
projection.controller.abort(new InputWaitInterruption());
|
|
406447
406747
|
return this._steeringReceipt(record9);
|
|
406448
406748
|
}
|
|
406449
406749
|
/**
|
|
@@ -407302,6 +407602,11 @@ The previous reviewer response failed exact candidate-quote serialization. Host
|
|
|
407302
407602
|
this._pendingSteeringPreemption = null;
|
|
407303
407603
|
}
|
|
407304
407604
|
this._emitSteeringLifecycle(record9, "retracted before admission at a safe boundary");
|
|
407605
|
+
if (this._activeSteering) {
|
|
407606
|
+
this._activeSteering.relatedInputs = this._activeSteering.relatedInputs?.filter((input) => input !== record9);
|
|
407607
|
+
if (this._activeSteering.input === record9 && !this._activeSteering.relatedInputs?.length)
|
|
407608
|
+
this._activeSteering = null;
|
|
407609
|
+
}
|
|
407305
407610
|
return record9.content;
|
|
407306
407611
|
}
|
|
407307
407612
|
/** Abort the current task run through the generation-bound stop lineage. */
|
|
@@ -408769,7 +409074,7 @@ issuer=${predecessor.runId}; evidence=${receipt.id}; raw_ref=${receipt.rawRef ??
|
|
|
408769
409074
|
if (!active)
|
|
408770
409075
|
return null;
|
|
408771
409076
|
const { input, reconciliation } = active;
|
|
408772
|
-
if (isSteeringScopeResolved(active))
|
|
409077
|
+
if (isSteeringScopeResolved(active) && !this._currentSteeringReplyPending())
|
|
408773
409078
|
return null;
|
|
408774
409079
|
const sources = [input, ...active.relatedInputs ?? []];
|
|
408775
409080
|
const exactSourcesPresent = this.effectiveContextWindow() > 0 && this.effectiveContextWindow() <= 8192 && input.taskEpoch === this._taskEpoch && sources.every((source) => source.taskEpoch === this._taskEpoch && source.state !== "cancelled" && source.state !== "superseded" && sourceMessages?.some((message) => message.role === "user" && message.content === source.content && message.requiredSourceEvidence?.schema === "omnius.required-source-evidence.v1" && message.requiredSourceEvidence.scope === this._steeringAuthorityScope(source)));
|
|
@@ -408782,6 +409087,8 @@ issuer=${predecessor.runId}; evidence=${receipt.id}; raw_ref=${receipt.rawRef ??
|
|
|
408782
409087
|
`kind=${input.intent}`,
|
|
408783
409088
|
`admission=${active.gatesOldPlan ? "old_plan_gated" : "context_active"}`,
|
|
408784
409089
|
"This is current user authority, not historical transcript context.",
|
|
409090
|
+
"Answer the latest user's question or briefly state the concrete effect of their change first, in ordinary visible prose. Then reconcile the current instruction internally before deeper planning or tools. Do not announce steering, reconciliation, or internal reviews.",
|
|
409091
|
+
isSteeringScopeResolved(active) && this._currentSteeringReplyPending() ? "The internal scope decision is already stored. Give the actual user-facing answer now; do not repeat the internal reconciliation, call tools, or replace the original objective." : null,
|
|
408785
409092
|
input.intent === "redirect" || input.intent === "replace" ? "The prior task epoch is historical evidence only. Do not continue its plan, todos, recovery cards, or completion contract." : null,
|
|
408786
409093
|
needsClarification ? "You requested clarification. Do not call tools or resume the old plan; ask the user one concise question." : active.requiresReconciliation ? [
|
|
408787
409094
|
renderSteeringReconciliationProtocol(input.inputId),
|
|
@@ -408807,9 +409114,13 @@ ${exactSourcesPresent ? exactSourcePointer(related) : related.content}`),
|
|
|
408807
409114
|
}
|
|
408808
409115
|
_markActiveSteeringVisible(turn) {
|
|
408809
409116
|
const active = this._activeSteering;
|
|
408810
|
-
|
|
409117
|
+
const pendingReply = this._currentSteeringReplyPending();
|
|
409118
|
+
if (pendingReply && active && [active.input, ...active.relatedInputs ?? []].includes(pendingReply.input) && !pendingReply.visibleRequestTurns.includes(turn))
|
|
409119
|
+
pendingReply.visibleRequestTurns.push(turn);
|
|
409120
|
+
if (!active || isSteeringScopeResolved(active) || active.visibleRequestTurns.includes(turn) && ![active.input, ...active.relatedInputs ?? []].some((input) => input.state === "queued" || input.state === "acknowledged"))
|
|
408811
409121
|
return;
|
|
408812
|
-
active.visibleRequestTurns.
|
|
409122
|
+
if (!active.visibleRequestTurns.includes(turn))
|
|
409123
|
+
active.visibleRequestTurns.push(turn);
|
|
408813
409124
|
for (const input of [active.input, ...active.relatedInputs ?? []]) {
|
|
408814
409125
|
input.state = "visible_in_request";
|
|
408815
409126
|
this._emitSteeringLifecycle(input, `visible in model request at turn ${turn}`);
|
|
@@ -408953,6 +409264,11 @@ ${exactSourcesPresent ? exactSourcePointer(related) : related.content}`),
|
|
|
408953
409264
|
if (this.taskRequirementInterpretationPending)
|
|
408954
409265
|
return "native_requirement_interpretation_pending: the host is reviewing the latest authenticated human instruction; no new action or completion is admitted until its canonical requirements are durably resolved.";
|
|
408955
409266
|
const active = this._activeSteering;
|
|
409267
|
+
const replyTurn = this._steeringReplyTurn;
|
|
409268
|
+
if (replyTurn?.runId === this.currentArtifactRunId() && replyTurn.taskEpoch === this._taskEpoch && replyTurn.ownerId === this._interruptionOwnerId && replyTurn.turn === turn)
|
|
409269
|
+
return "[HUMAN_RESPONSE_TURN_REQUIRED] The current response answers the user. Wait for the next model decision before executing tools.";
|
|
409270
|
+
if (this._currentSteeringReplyPending() && (!active || isSteeringScopeResolved(active)))
|
|
409271
|
+
return "[HUMAN_RESPONSE_REQUIRED] Answer the current user's question or change briefly in visible prose before further tools or planning. Its internal scope decision is already stored.";
|
|
408956
409272
|
if (!active)
|
|
408957
409273
|
return null;
|
|
408958
409274
|
if (active.input.taskEpoch === this._taskEpoch && active.reconciliation && active.reconciliation.status !== "needs_clarification" && active.reconciledTurn === turn) {
|
|
@@ -408973,7 +409289,7 @@ The steering reconciliation was emitted this turn. Wait for the next model decis
|
|
|
408973
409289
|
return [
|
|
408974
409290
|
`[STEERING_RECONCILIATION_REQUIRED]
|
|
408975
409291
|
input_id=${active.input.inputId}`,
|
|
408976
|
-
"Do not execute the old-plan tool call.
|
|
409292
|
+
"Do not execute the old-plan tool call. Answer the current user briefly in visible prose first, then emit the internal steering reconciliation, with no tool calls in that response.",
|
|
408977
409293
|
priorRefusals > 0 ? `You have already been refused this exact call ${priorRefusals} time(s). Repeating it will keep being refused. Emit the reconciliation now, or take a different concrete action.` : null,
|
|
408978
409294
|
renderSteeringReconciliationProtocol(active.input.inputId)
|
|
408979
409295
|
].filter(Boolean).join("\n");
|
|
@@ -409011,7 +409327,7 @@ Only the exact pending declared read tickets may execute. Old-plan mutations and
|
|
|
409011
409327
|
authoritySlot: "[ACTIVE USER STEERING]",
|
|
409012
409328
|
priorRefusals
|
|
409013
409329
|
}),
|
|
409014
|
-
"Do not execute or retry old-plan tools.
|
|
409330
|
+
"Do not execute or retry old-plan tools. Answer the current user briefly in visible prose, then emit [STEERING_RECONCILIATION] with no tool calls; follow the complete protocol and user instruction in [ACTIVE USER STEERING]."
|
|
409015
409331
|
].join("\n");
|
|
409016
409332
|
}
|
|
409017
409333
|
_markFirstSteeringAffectedAction(toolName, turn) {
|
|
@@ -411269,6 +411585,8 @@ ${rawTask}`;
|
|
|
411269
411585
|
if (this.options.trajectoryCheckpoint === "shadow" || this.options.trajectoryGrounding === "off") {
|
|
411270
411586
|
return null;
|
|
411271
411587
|
}
|
|
411588
|
+
if (this._hasUnresolvedCurrentSteeringInputs() || this._currentSteeringReplyPending() || this._currentAdjudicationArgumentRepair(turn))
|
|
411589
|
+
return null;
|
|
411272
411590
|
const { id: _id, revision: _revision, turn: _turn, ...base } = checkpoint;
|
|
411273
411591
|
const semanticKey = this._loopRecoveryAdvisoryKey();
|
|
411274
411592
|
const baseFingerprint = `${trajectoryCheckpointFingerprint(base)}:${semanticKey}`;
|
|
@@ -411344,12 +411662,29 @@ ${rawTask}`;
|
|
|
411344
411662
|
this._trajectoryGroundingAttemptedFingerprint = baseFingerprint;
|
|
411345
411663
|
this._trajectoryGroundingMaterial = materialFingerprint;
|
|
411346
411664
|
const review = this._beginRecoveryReview("trajectory");
|
|
411665
|
+
const grounding = { controller: new AbortController(), runId: this.currentArtifactRunId(), taskEpoch: this._taskEpoch };
|
|
411666
|
+
this._trajectoryGroundingRequest = grounding;
|
|
411667
|
+
const signal = AbortSignal.any([
|
|
411668
|
+
grounding.controller.signal,
|
|
411669
|
+
this._abortController.signal,
|
|
411670
|
+
this._turnAbortController.signal,
|
|
411671
|
+
this._inputWaitBoundaryController.signal
|
|
411672
|
+
]);
|
|
411673
|
+
const owner = this._interruptionOwnerId;
|
|
411674
|
+
const requestGeneration = this._modelRequestGeneration;
|
|
411675
|
+
const assertCurrent = () => {
|
|
411676
|
+
signal.throwIfAborted();
|
|
411677
|
+
if (grounding.runId !== this.currentArtifactRunId() || grounding.taskEpoch !== this._taskEpoch || owner !== this._interruptionOwnerId || requestGeneration !== this._modelRequestGeneration || !this._recoveryReviewIsCurrent(review) || this._hasUnresolvedCurrentSteeringInputs())
|
|
411678
|
+
throw new InputWaitInterruption();
|
|
411679
|
+
};
|
|
411347
411680
|
try {
|
|
411681
|
+
assertCurrent();
|
|
411348
411682
|
this._emitModelResolutionTelemetry("trajectory_grounding", turn);
|
|
411349
411683
|
const backend = this._auxInferenceBackend({
|
|
411350
|
-
dumpStage: "trajectory_grounding"
|
|
411684
|
+
dumpStage: "trajectory_grounding",
|
|
411685
|
+
assertCurrent
|
|
411351
411686
|
});
|
|
411352
|
-
const response = await backend.chatCompletion({
|
|
411687
|
+
const response = await withInputWaitCancellation(signal, () => backend.chatCompletion({
|
|
411353
411688
|
messages: [
|
|
411354
411689
|
{
|
|
411355
411690
|
role: "system",
|
|
@@ -411368,8 +411703,10 @@ ${rawTask}`;
|
|
|
411368
411703
|
timeoutMs: this.options.requestTimeoutMs,
|
|
411369
411704
|
// The output is an explicit concise assessment, not a hidden-think
|
|
411370
411705
|
// transcript. Keep Qwen's structured response path reliable.
|
|
411371
|
-
think: false
|
|
411372
|
-
|
|
411706
|
+
think: false,
|
|
411707
|
+
signal
|
|
411708
|
+
}));
|
|
411709
|
+
assertCurrent();
|
|
411373
411710
|
const generated = parseTrajectoryGeneratedGrounding(response.choices?.[0]?.message?.content ?? "", checkpoint.groundedFacts.map((fact) => fact.evidence));
|
|
411374
411711
|
if (!this._recoveryReviewIsCurrent(review))
|
|
411375
411712
|
return null;
|
|
@@ -411425,7 +411762,9 @@ ${rawTask}`;
|
|
|
411425
411762
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
411426
411763
|
});
|
|
411427
411764
|
return generated;
|
|
411428
|
-
} catch {
|
|
411765
|
+
} catch (error) {
|
|
411766
|
+
if (signal.aborted || error instanceof InputWaitInterruption || !this._recoveryReviewIsCurrent(review))
|
|
411767
|
+
return null;
|
|
411429
411768
|
this.emit({
|
|
411430
411769
|
type: "status",
|
|
411431
411770
|
content: "Trajectory grounding unavailable; retaining deterministic safety orientation",
|
|
@@ -411433,6 +411772,9 @@ ${rawTask}`;
|
|
|
411433
411772
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
411434
411773
|
});
|
|
411435
411774
|
return null;
|
|
411775
|
+
} finally {
|
|
411776
|
+
if (this._trajectoryGroundingRequest === grounding)
|
|
411777
|
+
this._trajectoryGroundingRequest = null;
|
|
411436
411778
|
}
|
|
411437
411779
|
}
|
|
411438
411780
|
/**
|
|
@@ -413875,12 +414217,16 @@ ${lastCompletionGateFeedback.trim().slice(0, 4e3)}` : ""
|
|
|
413875
414217
|
};
|
|
413876
414218
|
const preparedToolArguments = /* @__PURE__ */ new WeakMap();
|
|
413877
414219
|
const originalToolArguments = /* @__PURE__ */ new WeakMap();
|
|
414220
|
+
const preparedAdjudicationRepairs = /* @__PURE__ */ new WeakMap();
|
|
413878
414221
|
const prepareToolArguments = async (tc, toolTurn) => {
|
|
413879
414222
|
if (preparedToolArguments.has(tc))
|
|
413880
414223
|
return preparedToolArguments.get(tc);
|
|
413881
414224
|
originalToolArguments.set(tc, structuredClone(tc.arguments ?? {}));
|
|
414225
|
+
const preparationScope = { runId: this.currentArtifactRunId(), taskEpoch: this._taskEpoch, ownerId: this._interruptionOwnerId };
|
|
414226
|
+
const preparationIsCurrent = () => preparationScope.runId === this.currentArtifactRunId() && preparationScope.taskEpoch === this._taskEpoch && preparationScope.ownerId === this._interruptionOwnerId;
|
|
413882
414227
|
const resolved = this.lookupRegisteredTool(tc.name);
|
|
413883
414228
|
let error = null;
|
|
414229
|
+
let adjudicationArgs;
|
|
413884
414230
|
if (resolved && !(tc.arguments && "_raw" in tc.arguments)) {
|
|
413885
414231
|
try {
|
|
413886
414232
|
const workflow = extractFeatureWorkflowToolBinding(tc.arguments ?? {});
|
|
@@ -413894,6 +414240,18 @@ ${lastCompletionGateFeedback.trim().slice(0, 4e3)}` : ""
|
|
|
413894
414240
|
args = this._autoDeriveDelegationMutationScope(resolved.name, args, toolTurn);
|
|
413895
414241
|
args = await this._enrichDelegationToolArgs(resolved.name, args, messages2, toolTurn);
|
|
413896
414242
|
}
|
|
414243
|
+
if (resolved.name === ADJUDICATION_TOOL_NAME) {
|
|
414244
|
+
adjudicationArgs = args;
|
|
414245
|
+
tc.arguments = args;
|
|
414246
|
+
const prior = preparationIsCurrent() ? this._currentAdjudicationArgumentRepair() : null;
|
|
414247
|
+
if (prior?.argsKey === this._buildExactArgsKey(args)) {
|
|
414248
|
+
const replay = { ...prior, turn: toolTurn, repeats: prior.repeats + 1, settled: false };
|
|
414249
|
+
preparedAdjudicationRepairs.set(tc, replay);
|
|
414250
|
+
this._adjudicationArgumentRepair = replay;
|
|
414251
|
+
preparedToolArguments.set(tc, prior.error);
|
|
414252
|
+
return prior.error;
|
|
414253
|
+
}
|
|
414254
|
+
}
|
|
413897
414255
|
if (resolved.tool.inputSchema)
|
|
413898
414256
|
args = this._parsedToolArgumentRecord(resolved.tool.inputSchema.parse(args));
|
|
413899
414257
|
else {
|
|
@@ -413906,6 +414264,22 @@ ${lastCompletionGateFeedback.trim().slice(0, 4e3)}` : ""
|
|
|
413906
414264
|
this._featureWorkflowBindings.set(args, workflow.cardId);
|
|
413907
414265
|
} catch (caught) {
|
|
413908
414266
|
error = caught instanceof Error ? caught.message : String(caught);
|
|
414267
|
+
if (resolved.name === ADJUDICATION_TOOL_NAME && adjudicationArgs && preparationIsCurrent()) {
|
|
414268
|
+
const repair = {
|
|
414269
|
+
...preparationScope,
|
|
414270
|
+
tool: resolved.tool,
|
|
414271
|
+
schema: resolved.tool.inputSchema,
|
|
414272
|
+
parameters: JSON.stringify(resolved.tool.parameters),
|
|
414273
|
+
argsKey: this._buildExactArgsKey(adjudicationArgs),
|
|
414274
|
+
contract: adjudicationArgumentRepairContract(error, _createHash("sha256").update(this._buildExactArgsKey(adjudicationArgs)).digest("hex")),
|
|
414275
|
+
error,
|
|
414276
|
+
turn: toolTurn,
|
|
414277
|
+
repeats: 0,
|
|
414278
|
+
settled: false
|
|
414279
|
+
};
|
|
414280
|
+
preparedAdjudicationRepairs.set(tc, repair);
|
|
414281
|
+
this._adjudicationArgumentRepair = repair;
|
|
414282
|
+
}
|
|
413909
414283
|
}
|
|
413910
414284
|
}
|
|
413911
414285
|
preparedToolArguments.set(tc, error);
|
|
@@ -414891,7 +415265,8 @@ ${cachedResult}`,
|
|
|
414891
415265
|
if (resolvedTool && !this._isToolExposedForModelCall(resolvedTool.name) && !this._admitDeferredDirectCall(resolvedTool.name, turn)) {
|
|
414892
415266
|
result = this._missingCapabilityResult(resolvedTool.name, turn);
|
|
414893
415267
|
} else if (preparedArgumentError && tool) {
|
|
414894
|
-
const
|
|
415268
|
+
const admittedRepair = preparedAdjudicationRepairs.get(tc);
|
|
415269
|
+
const repair = this.buildToolArgumentRepairFeedback(tc.name, tc.arguments, tool, preparedArgumentError, admittedRepair);
|
|
414895
415270
|
runtimeSystemGuidance = repair.systemGuidance;
|
|
414896
415271
|
result = {
|
|
414897
415272
|
success: false,
|
|
@@ -414900,6 +415275,21 @@ ${cachedResult}`,
|
|
|
414900
415275
|
llmContent: repair.llmContent,
|
|
414901
415276
|
runtimeAuthored: true
|
|
414902
415277
|
};
|
|
415278
|
+
const argumentRepair = admittedRepair && this._adjudicationArgumentRepairIsCurrent(admittedRepair) && admittedRepair.argsKey === this._buildExactArgsKey(tc.arguments) ? admittedRepair : null;
|
|
415279
|
+
if (argumentRepair) {
|
|
415280
|
+
argumentRepair.settled = true;
|
|
415281
|
+
this._adjudicationArgumentRepair = argumentRepair;
|
|
415282
|
+
result.data = { kind: "adjudication_argument_repair", contract: argumentRepair.contract };
|
|
415283
|
+
result.failure = { kind: "schema_validation", field: argumentRepair.contract.fields[0]?.path };
|
|
415284
|
+
result.failureDiagnosis = {
|
|
415285
|
+
...classifyRuntimeFailure({ toolName: resolvedTool.name, failure: result.failure, errorText: repair.error }),
|
|
415286
|
+
retryable: false,
|
|
415287
|
+
createRecoveryCard: false,
|
|
415288
|
+
guidance: repair.systemGuidance
|
|
415289
|
+
};
|
|
415290
|
+
if (argumentRepair.repeats)
|
|
415291
|
+
repeatShortCircuit = result;
|
|
415292
|
+
}
|
|
414903
415293
|
} else if (repeatShortCircuit) {
|
|
414904
415294
|
result = repeatShortCircuit;
|
|
414905
415295
|
} else if (tc.arguments && "_raw" in tc.arguments) {
|
|
@@ -416484,6 +416874,8 @@ ${bookkeepingGuidance}` : bookkeepingGuidance;
|
|
|
416484
416874
|
}
|
|
416485
416875
|
if (result.success) {
|
|
416486
416876
|
delete result.failureDiagnosis;
|
|
416877
|
+
if (result.runtimeAuthored !== true && this._currentAdjudicationArgumentRepair()?.settled)
|
|
416878
|
+
this._adjudicationArgumentRepair = null;
|
|
416487
416879
|
} else if (!processWasStopped && !completionReviewIsPending && !this._isPdfTerminalFeedback(result)) {
|
|
416488
416880
|
this._diagnoseToolFailure(tc.name, tc.arguments, result);
|
|
416489
416881
|
const staleHashRetryGuidance = this._buildStaleHashRetryGuidance(tc.name, tc.arguments, result);
|
|
@@ -418850,7 +419242,12 @@ ${memoryLines.join("\n")}`
|
|
|
418850
419242
|
}
|
|
418851
419243
|
const { maxOutputTokens: effectiveMaxTokens } = this.contextLimits();
|
|
418852
419244
|
this.gcSystemMessages(requestMessages2);
|
|
419245
|
+
const steeringBeforeVirtualContext = new Set(this.pendingSteeringInputs);
|
|
418853
419246
|
const virtualEvidenceMessages = await this._buildLiveVirtualContextMessages(task, requestMessages2, turn, toolDefs);
|
|
419247
|
+
if (this.pendingSteeringInputs.some((input) => !steeringBeforeVirtualContext.has(input) && !["cancelled", "superseded", "consumed"].includes(input.state))) {
|
|
419248
|
+
--localTurn;
|
|
419249
|
+
continue;
|
|
419250
|
+
}
|
|
418854
419251
|
if (virtualEvidenceMessages.length > 0) {
|
|
418855
419252
|
const insertionIndex = requestMessages2[0]?.role === "system" ? 1 : 0;
|
|
418856
419253
|
requestMessages2.splice(insertionIndex, 0, ...virtualEvidenceMessages);
|
|
@@ -419423,6 +419820,7 @@ ${transportFailure2}` : transportFailure2;
|
|
|
419423
419820
|
if (!choice)
|
|
419424
419821
|
break;
|
|
419425
419822
|
const msg = choice.message;
|
|
419823
|
+
this._observePrimarySteeringReply(response["_rawTypedModelContent"] ?? msg.content, turn, !this.options.streamEnabled && Boolean(msg.toolCalls?.length));
|
|
419426
419824
|
this._reconcileActiveSteeringFromModel(response["_rawTypedModelContent"] ?? msg.content, turn, messages2);
|
|
419427
419825
|
if (this._preparedTaskScopeBoundary && this._pendingSteeringPreemption) {
|
|
419428
419826
|
await this._applySteeringAtSafeBoundary(messages2, turn);
|
|
@@ -420457,7 +420855,12 @@ ${this.options.maxTurns && this.options.maxTurns > 0 ? `You have ${this.options.
|
|
|
420457
420855
|
}
|
|
420458
420856
|
this._insertContextFrame(compactedMsgs, await this._buildTurnContextFrame(turn, compactedMsgs, void 0, bfEnvironmentBlock));
|
|
420459
420857
|
this.gcSystemMessages(compactedMsgs);
|
|
420858
|
+
const steeringBeforeVirtualContext = new Set(this.pendingSteeringInputs);
|
|
420460
420859
|
const virtualEvidenceMessages = await this._buildLiveVirtualContextMessages(persistentTaskGoal, compactedMsgs, turn, toolDefs);
|
|
420860
|
+
if (this.pendingSteeringInputs.some((input) => !steeringBeforeVirtualContext.has(input) && !["cancelled", "superseded", "consumed"].includes(input.state))) {
|
|
420861
|
+
--localTurn;
|
|
420862
|
+
continue;
|
|
420863
|
+
}
|
|
420461
420864
|
const bfRequestMessages = compactedMsgs.map((message) => ({
|
|
420462
420865
|
...message
|
|
420463
420866
|
}));
|
|
@@ -420777,6 +421180,7 @@ ${diagnosis}` : diagnosis;
|
|
|
420777
421180
|
if (!choice)
|
|
420778
421181
|
break;
|
|
420779
421182
|
const msg = choice.message;
|
|
421183
|
+
this._observePrimarySteeringReply(response["_rawTypedModelContent"] ?? msg.content, turn, !this.options.streamEnabled && Boolean(msg.toolCalls?.length));
|
|
420780
421184
|
this._reconcileActiveSteeringFromModel(response["_rawTypedModelContent"] ?? msg.content, turn, messages2);
|
|
420781
421185
|
if (this._preparedTaskScopeBoundary && this._pendingSteeringPreemption) {
|
|
420782
421186
|
await this._applySteeringAtSafeBoundary(messages2, turn);
|
|
@@ -429166,6 +429570,9 @@ var OllamaAgenticBackend = class _OllamaAgenticBackend {
|
|
|
429166
429570
|
if (enabledGpuUuids !== void 0) {
|
|
429167
429571
|
headers["X-Ollama-Unify-GPU-UUIDs"] = enabledGpuUuids.length > 0 ? enabledGpuUuids.join(",") : "none";
|
|
429168
429572
|
}
|
|
429573
|
+
if (cpuOffloadAllowedFromEnv()) {
|
|
429574
|
+
headers["X-Ollama-Unify-CPU-Offload"] = "allow";
|
|
429575
|
+
}
|
|
429169
429576
|
const envOverride = process.env["OMNIUS_OLLAMA_BROKER_ADMISSION_WAIT_MS"];
|
|
429170
429577
|
const classDefault = workloadClass === "background" ? 500 : workloadClass === "interactive-control" ? 3e4 : void 0;
|
|
429171
429578
|
const configured = Number.parseInt(String(request?.brokerAdmissionWaitMs ?? envOverride ?? classDefault ?? 0), 10);
|
|
@@ -430321,114 +430728,6 @@ init_dist3();
|
|
|
430321
430728
|
init_ollama_pool();
|
|
430322
430729
|
init_ollama_pool_cleanup();
|
|
430323
430730
|
|
|
430324
|
-
// packages/orchestrator/dist/adjudication.js
|
|
430325
|
-
import { z as z25 } from "zod";
|
|
430326
|
-
var IdSchema = z25.string().trim().min(1).max(96).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/, "use a stable identifier without whitespace");
|
|
430327
|
-
var AdjudicationEvidenceSchema = z25.object({
|
|
430328
|
-
id: IdSchema,
|
|
430329
|
-
content: z25.string().trim().min(1).max(32e3),
|
|
430330
|
-
source: z25.string().trim().min(1).max(500),
|
|
430331
|
-
kind: z25.enum([
|
|
430332
|
-
"fact",
|
|
430333
|
-
"observation",
|
|
430334
|
-
"artifact",
|
|
430335
|
-
"test_result",
|
|
430336
|
-
"testimony",
|
|
430337
|
-
"constraint",
|
|
430338
|
-
"precedent"
|
|
430339
|
-
]).default("observation"),
|
|
430340
|
-
observedAt: z25.string().trim().max(80).optional(),
|
|
430341
|
-
sha256: z25.string().trim().regex(/^[a-fA-F0-9]{64}$/).optional(),
|
|
430342
|
-
reliability: z25.number().min(0).max(1).optional()
|
|
430343
|
-
});
|
|
430344
|
-
var AdjudicationArgumentSchema = z25.object({
|
|
430345
|
-
id: IdSchema,
|
|
430346
|
-
position: z25.string().trim().min(1).max(160),
|
|
430347
|
-
claim: z25.string().trim().min(1).max(4e3),
|
|
430348
|
-
citedEvidenceIds: z25.array(IdSchema).min(1).max(64),
|
|
430349
|
-
submittedBy: z25.string().trim().max(160).optional()
|
|
430350
|
-
});
|
|
430351
|
-
var AdjudicationConstituentInputSchema = z25.object({
|
|
430352
|
-
id: IdSchema.optional(),
|
|
430353
|
-
label: z25.string().trim().min(1).max(120),
|
|
430354
|
-
question: z25.string().trim().min(1).max(2e3),
|
|
430355
|
-
instructions: z25.string().trim().max(2e3).optional(),
|
|
430356
|
-
evidenceIds: z25.array(IdSchema).min(1).max(128).optional(),
|
|
430357
|
-
argumentIds: z25.array(IdSchema).max(64).optional(),
|
|
430358
|
-
decisionRuleIds: z25.array(IdSchema).max(32).optional()
|
|
430359
|
-
});
|
|
430360
|
-
var AdjudicationInputSchema = z25.object({
|
|
430361
|
-
caseId: IdSchema.optional(),
|
|
430362
|
-
question: z25.string().trim().min(1).max(4e3),
|
|
430363
|
-
context: z25.string().trim().max(8e3).optional(),
|
|
430364
|
-
exclusions: z25.array(z25.string().trim().min(1).max(2e3)).max(32).default([]),
|
|
430365
|
-
allowedOutcomes: z25.array(IdSchema).min(2).max(12),
|
|
430366
|
-
decisionRules: z25.array(z25.string().trim().min(1).max(2e3)).max(24).default([]),
|
|
430367
|
-
burdenOfProof: z25.enum([
|
|
430368
|
-
"best_supported",
|
|
430369
|
-
"preponderance",
|
|
430370
|
-
"clear_and_convincing",
|
|
430371
|
-
"beyond_reasonable_doubt",
|
|
430372
|
-
"risk_averse"
|
|
430373
|
-
]).default("best_supported"),
|
|
430374
|
-
evidence: z25.array(AdjudicationEvidenceSchema).min(1).max(128),
|
|
430375
|
-
arguments: z25.array(AdjudicationArgumentSchema).max(64).default([]),
|
|
430376
|
-
constituents: z25.array(AdjudicationConstituentInputSchema).min(2).max(6).optional(),
|
|
430377
|
-
panelSize: z25.number().int().min(2).max(6).default(3),
|
|
430378
|
-
maxConcurrency: z25.number().int().min(1).max(6).default(3),
|
|
430379
|
-
quorum: z25.number().int().min(2).max(6).optional(),
|
|
430380
|
-
constituentExecution: z25.enum(["auto", "full_sub_agent", "direct"]).default("auto"),
|
|
430381
|
-
timeoutMs: z25.number().int().min(5e3).max(6e5).default(12e4),
|
|
430382
|
-
maxTokensPerConstituent: z25.number().int().min(512).max(8192).default(2048),
|
|
430383
|
-
maxJudgeTokens: z25.number().int().min(768).max(12288).default(3072)
|
|
430384
|
-
});
|
|
430385
|
-
var PlannerResponseSchema = z25.object({
|
|
430386
|
-
schemaVersion: z25.literal(1),
|
|
430387
|
-
caseId: IdSchema,
|
|
430388
|
-
assignments: z25.array(z25.object({
|
|
430389
|
-
id: IdSchema,
|
|
430390
|
-
label: z25.string().trim().min(1).max(120),
|
|
430391
|
-
question: z25.string().trim().min(1).max(2e3),
|
|
430392
|
-
instructions: z25.string().trim().max(2e3).default(""),
|
|
430393
|
-
evidenceIds: z25.array(IdSchema).min(1).max(128),
|
|
430394
|
-
argumentIds: z25.array(IdSchema).max(64).default([]),
|
|
430395
|
-
decisionRuleIds: z25.array(IdSchema).min(1).max(32)
|
|
430396
|
-
})).min(2).max(6)
|
|
430397
|
-
});
|
|
430398
|
-
var ConstituentResponseSchema = z25.object({
|
|
430399
|
-
schemaVersion: z25.literal(1),
|
|
430400
|
-
caseId: IdSchema,
|
|
430401
|
-
constituentId: IdSchema,
|
|
430402
|
-
assessment: z25.string().trim().min(20).max(8e3),
|
|
430403
|
-
recommendation: IdSchema,
|
|
430404
|
-
confidence: z25.number().min(0).max(1),
|
|
430405
|
-
citedEvidenceIds: z25.array(IdSchema).min(1).max(128),
|
|
430406
|
-
claims: z25.array(z25.object({
|
|
430407
|
-
claim: z25.string().trim().min(1).max(2e3),
|
|
430408
|
-
evidenceIds: z25.array(IdSchema).min(1).max(64)
|
|
430409
|
-
})).min(1).max(24),
|
|
430410
|
-
counterarguments: z25.array(z25.string().trim().min(1).max(2e3)).max(16).default([]),
|
|
430411
|
-
uncertainties: z25.array(z25.string().trim().min(1).max(2e3)).max(16).default([])
|
|
430412
|
-
});
|
|
430413
|
-
var JudgeResponseSchema = z25.object({
|
|
430414
|
-
schemaVersion: z25.literal(1),
|
|
430415
|
-
caseId: IdSchema,
|
|
430416
|
-
verdict: IdSchema,
|
|
430417
|
-
confidence: z25.number().min(0).max(1),
|
|
430418
|
-
rationale: z25.string().trim().min(30).max(12e3),
|
|
430419
|
-
citedEvidenceIds: z25.array(IdSchema).min(1).max(128),
|
|
430420
|
-
consideredConstituentIds: z25.array(IdSchema).min(2).max(6),
|
|
430421
|
-
acceptedFindingIds: z25.array(IdSchema).max(144),
|
|
430422
|
-
rejectedFindingIds: z25.array(IdSchema).max(144),
|
|
430423
|
-
dissent: z25.array(z25.object({
|
|
430424
|
-
constituentId: IdSchema,
|
|
430425
|
-
recommendation: IdSchema,
|
|
430426
|
-
summary: z25.string().trim().min(1).max(2e3)
|
|
430427
|
-
})).max(6).default([]),
|
|
430428
|
-
unresolvedQuestions: z25.array(z25.string().trim().min(1).max(2e3)).max(24).default([]),
|
|
430429
|
-
nextAction: z25.string().trim().min(1).max(4e3)
|
|
430430
|
-
});
|
|
430431
|
-
|
|
430432
430731
|
// packages/orchestrator/dist/agent-types.js
|
|
430433
430732
|
var READ_ONLY_TOOLS = [
|
|
430434
430733
|
"file_read",
|