@crewhaus/target-batch-worker 0.5.8 → 0.6.0
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 +10 -14
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@ import { CrewhausError } from "@crewhaus/errors";
|
|
|
34
34
|
import { renderControlDrain, renderControlImports, renderControlLane, renderControlPlaneBoot, renderControlStart, renderControlTimer, } from "@crewhaus/gateway-protocol/control-codegen";
|
|
35
35
|
import { escapeJsonString } from "@crewhaus/infra-utils";
|
|
36
36
|
import { renderBundleReadme, } from "@crewhaus/ir";
|
|
37
|
+
import { HYBRID_FAMILIES_BY_SHAPE, HYBRID_WIRING_IMPORT, renderHybridWiringFields, renderModelWiringFields, } from "@crewhaus/model-service";
|
|
37
38
|
export class TargetEmitError extends CrewhausError {
|
|
38
39
|
name = "TargetEmitError";
|
|
39
40
|
constructor(message, cause) {
|
|
@@ -140,18 +141,6 @@ function renderApprovalFields(ir, indent) {
|
|
|
140
141
|
return (`\n${indent}askMode: ${escapeJsonString(ir.permissions.askMode ?? "pause")},` +
|
|
141
142
|
`\n${indent}approvals: { store: __approvals, surface: "batch" },`);
|
|
142
143
|
}
|
|
143
|
-
/**
|
|
144
|
-
* Adaptive model routing — render the `modelPool` runChatLoop field.
|
|
145
|
-
* JSON.stringify safely quotes the validated pool object (mirroring
|
|
146
|
-
* target-cli's renderModelFailoverFields; keep the pipeline/research/batch/
|
|
147
|
-
* browser copies in sync). Empty when the spec omits `model_pool`, keeping
|
|
148
|
-
* bundles byte-identical.
|
|
149
|
-
*/
|
|
150
|
-
function poolField(ir, indent) {
|
|
151
|
-
return ir.agent.modelPool !== undefined
|
|
152
|
-
? `\n${indent}modelPool: ${JSON.stringify(ir.agent.modelPool)},`
|
|
153
|
-
: "";
|
|
154
|
-
}
|
|
155
144
|
/**
|
|
156
145
|
* Section 55 / item 23 — render the `failureTaxonomy` runChatLoop field.
|
|
157
146
|
* Empty when the spec omits the block (mirror: target-cli +
|
|
@@ -431,6 +420,13 @@ export function emitBatchWorker(ir, opts = {}) {
|
|
|
431
420
|
return { files };
|
|
432
421
|
}
|
|
433
422
|
function renderAgent(ir) {
|
|
423
|
+
// 0.6.0 PR 9f (§11.3) — the closure half of the pool: Consult / Escalate,
|
|
424
|
+
// the route classifier, the guide / shadow lanes. Rendered onto the ONE
|
|
425
|
+
// per-job `runChatLoop`, so every pulled job gets the same closures the
|
|
426
|
+
// interpreter builds. "" — and no import — when the pool declares none of
|
|
427
|
+
// them, so pre-0.6.0 batch bundles stay byte-identical.
|
|
428
|
+
const hybridFields = renderHybridWiringFields(ir.agent, " ", ir.name, HYBRID_FAMILIES_BY_SHAPE.batch);
|
|
429
|
+
const hybridImport = hybridFields.length > 0 ? `${HYBRID_WIRING_IMPORT}\n` : "";
|
|
434
430
|
const { imports: builtinImports, inits, registrations } = resolveTools(ir.tools, ir.toolConfigs);
|
|
435
431
|
const importBlock = builtinImports.length > 0 ? `${builtinImports.join("\n")}\n` : "";
|
|
436
432
|
const initLines = inits.length > 0 ? `${inits.join("\n")}\n` : "";
|
|
@@ -597,7 +593,7 @@ import { loadRetentionConfig } from "@crewhaus/data-retention-engine";
|
|
|
597
593
|
import { createJanitor, runChatLoop } from "@crewhaus/runtime-core";
|
|
598
594
|
import { createPendingApprovalStore, resolveSessionRootDir } from "@crewhaus/runtime-core";
|
|
599
595
|
import { createRunContext } from "@crewhaus/run-context";
|
|
600
|
-
import { defaultCatalog } from "@crewhaus/tool-catalog";
|
|
596
|
+
${hybridImport}import { defaultCatalog } from "@crewhaus/tool-catalog";
|
|
601
597
|
${permImport}${hooksImport}${scheduleImport}${mcpImportBlock}${importBlock}
|
|
602
598
|
|
|
603
599
|
${initLines}${registrationBlock}
|
|
@@ -693,7 +689,7 @@ ${mcpBoot} // G11 — a compiled bundle is NON-INTERACTIVE: a tool that lands o
|
|
|
693
689
|
const runContext = createRunContext();
|
|
694
690
|
const reply = await runChatLoop({
|
|
695
691
|
model: SPEC_MODEL,
|
|
696
|
-
instructions: SPEC_INSTRUCTIONS,${
|
|
692
|
+
instructions: SPEC_INSTRUCTIONS,${renderModelWiringFields(ir.agent, " ")}${hybridFields}${taxonomyField(ir, " ")}
|
|
697
693
|
runContext,
|
|
698
694
|
sessionName: SPEC_NAME,
|
|
699
695
|
sessionTarget: "batch",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewhaus/target-batch-worker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Codegen for the BATCH target — emits a queue-consumer daemon (Section 23 BATCH)",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
"test": "bun test src"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@crewhaus/errors": "0.
|
|
19
|
-
"@crewhaus/gateway-protocol": "0.
|
|
20
|
-
"@crewhaus/infra-utils": "0.
|
|
21
|
-
"@crewhaus/ir": "0.
|
|
18
|
+
"@crewhaus/errors": "0.6.0",
|
|
19
|
+
"@crewhaus/gateway-protocol": "0.6.0",
|
|
20
|
+
"@crewhaus/infra-utils": "0.6.0",
|
|
21
|
+
"@crewhaus/ir": "0.6.0",
|
|
22
|
+
"@crewhaus/model-service": "0.6.0"
|
|
22
23
|
},
|
|
23
24
|
"license": "Apache-2.0",
|
|
24
25
|
"author": {
|