@whittlelabs/sifter 0.11.0 → 0.13.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/bin.js +59 -4
- package/bin.js.map +4 -4
- package/package.json +1 -1
package/bin.js
CHANGED
|
@@ -15728,6 +15728,28 @@ var require_self_update = __commonJS({
|
|
|
15728
15728
|
}
|
|
15729
15729
|
});
|
|
15730
15730
|
|
|
15731
|
+
// ../../packages/shuttle/dist/lifecycle/decommission.js
|
|
15732
|
+
var require_decommission = __commonJS({
|
|
15733
|
+
"../../packages/shuttle/dist/lifecycle/decommission.js"(exports2) {
|
|
15734
|
+
"use strict";
|
|
15735
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
15736
|
+
exports2.readDecommissionDirective = readDecommissionDirective;
|
|
15737
|
+
exports2.shutdownOnDecommission = shutdownOnDecommission;
|
|
15738
|
+
function readDecommissionDirective(directives) {
|
|
15739
|
+
const raw = directives.decommission;
|
|
15740
|
+
if (!raw || typeof raw !== "object")
|
|
15741
|
+
return null;
|
|
15742
|
+
return raw;
|
|
15743
|
+
}
|
|
15744
|
+
async function shutdownOnDecommission(opts) {
|
|
15745
|
+
const { productTitle, directive, logger, hooks } = opts;
|
|
15746
|
+
logger.info(`${productTitle} was decommissioned from the product settings page; draining and exiting.`, directive.decommissioned_at ? { decommissionedAt: directive.decommissioned_at } : void 0);
|
|
15747
|
+
await hooks.stopLoop();
|
|
15748
|
+
(hooks.exit ?? ((code) => process.exit(code)))(0);
|
|
15749
|
+
}
|
|
15750
|
+
}
|
|
15751
|
+
});
|
|
15752
|
+
|
|
15731
15753
|
// ../../packages/loom/dist/runtime/prompt-execution.js
|
|
15732
15754
|
var require_prompt_execution = __commonJS({
|
|
15733
15755
|
"../../packages/loom/dist/runtime/prompt-execution.js"(exports2) {
|
|
@@ -19360,6 +19382,9 @@ var require_claude_code = __commonJS({
|
|
|
19360
19382
|
const model = modelOverride ?? this.config.model;
|
|
19361
19383
|
return new Promise((resolve, reject) => {
|
|
19362
19384
|
const args = ["--print", "--output-format", "stream-json", "--verbose"];
|
|
19385
|
+
if (spec.outputSchema && typeof spec.outputSchema === "object" && Object.keys(spec.outputSchema).length > 0) {
|
|
19386
|
+
args.push("--json-schema", JSON.stringify(spec.outputSchema));
|
|
19387
|
+
}
|
|
19363
19388
|
if (model)
|
|
19364
19389
|
args.push("--model", model);
|
|
19365
19390
|
if (this.config.maxTurns !== void 0)
|
|
@@ -19419,8 +19444,14 @@ var require_claude_code = __commonJS({
|
|
|
19419
19444
|
if (code === 0) {
|
|
19420
19445
|
try {
|
|
19421
19446
|
const stream = parseStreamJson(stdout);
|
|
19447
|
+
if (stream.resultMeta?.isError) {
|
|
19448
|
+
throw new Error(`Claude Code reported ${stream.resultMeta.subtype ?? "an error"} on its terminal event`);
|
|
19449
|
+
}
|
|
19422
19450
|
const answerText = stream.finalText ?? stdout;
|
|
19423
|
-
const parsed = extractJsonObject(answerText);
|
|
19451
|
+
const parsed = stream.structuredOutput ?? extractJsonObject(answerText);
|
|
19452
|
+
if (parsed === void 0 && stream.resultMeta) {
|
|
19453
|
+
throw new Error(`claude's final message contained no JSON object (result subtype=${stream.resultMeta.subtype ?? "unknown"}; message head: ${JSON.stringify(answerText.slice(0, 160))})`);
|
|
19454
|
+
}
|
|
19424
19455
|
(0, validate_output_1.assertOutputValid)(spec, parsed);
|
|
19425
19456
|
settle(() => resolve({
|
|
19426
19457
|
response: {
|
|
@@ -19527,6 +19558,8 @@ var require_claude_code = __commonJS({
|
|
|
19527
19558
|
let finalText = null;
|
|
19528
19559
|
const readPaths = [];
|
|
19529
19560
|
let usage = null;
|
|
19561
|
+
let resultMeta = null;
|
|
19562
|
+
let structuredOutput = null;
|
|
19530
19563
|
for (const line of stdout.split("\n")) {
|
|
19531
19564
|
const trimmed = line.trim();
|
|
19532
19565
|
if (!trimmed.startsWith("{"))
|
|
@@ -19548,8 +19581,17 @@ var require_claude_code = __commonJS({
|
|
|
19548
19581
|
}
|
|
19549
19582
|
}
|
|
19550
19583
|
} else if (event.type === "result") {
|
|
19551
|
-
if (typeof event.result === "string")
|
|
19584
|
+
if (typeof event.result === "string" && event.result.trim().length > 0) {
|
|
19552
19585
|
finalText = event.result;
|
|
19586
|
+
}
|
|
19587
|
+
resultMeta = {
|
|
19588
|
+
subtype: typeof event.subtype === "string" ? event.subtype : null,
|
|
19589
|
+
isError: event.is_error === true
|
|
19590
|
+
};
|
|
19591
|
+
const so = event.structured_output;
|
|
19592
|
+
if (so && typeof so === "object" && !Array.isArray(so)) {
|
|
19593
|
+
structuredOutput = so;
|
|
19594
|
+
}
|
|
19553
19595
|
const u = event.usage;
|
|
19554
19596
|
const cost = event.total_cost_usd;
|
|
19555
19597
|
usage = {
|
|
@@ -19559,7 +19601,7 @@ var require_claude_code = __commonJS({
|
|
|
19559
19601
|
};
|
|
19560
19602
|
}
|
|
19561
19603
|
}
|
|
19562
|
-
return { finalText, readPaths, usage };
|
|
19604
|
+
return { finalText, readPaths, usage, resultMeta, structuredOutput };
|
|
19563
19605
|
}
|
|
19564
19606
|
var MAX_REPORTED_READS = 2e3;
|
|
19565
19607
|
function relativeWorkspaceReads(readPaths, cwd) {
|
|
@@ -20708,6 +20750,7 @@ var require_shuttle = __commonJS({
|
|
|
20708
20750
|
var os_1 = require("os");
|
|
20709
20751
|
var jobs_1 = require_dist2();
|
|
20710
20752
|
var self_update_1 = require_self_update();
|
|
20753
|
+
var decommission_1 = require_decommission();
|
|
20711
20754
|
var loom_1 = require_dist3();
|
|
20712
20755
|
var chain_1 = require_chain();
|
|
20713
20756
|
var keep_1 = require_dist4();
|
|
@@ -20873,6 +20916,18 @@ var require_shuttle = __commonJS({
|
|
|
20873
20916
|
},
|
|
20874
20917
|
onJob,
|
|
20875
20918
|
onDirectives: async (directives) => {
|
|
20919
|
+
const decommission = (0, decommission_1.readDecommissionDirective)(directives);
|
|
20920
|
+
if (decommission) {
|
|
20921
|
+
await (0, decommission_1.shutdownOnDecommission)({
|
|
20922
|
+
productTitle: this.brand.product.title,
|
|
20923
|
+
directive: decommission,
|
|
20924
|
+
logger: subscribeLogger,
|
|
20925
|
+
hooks: {
|
|
20926
|
+
stopLoop: () => this.subscription?.stop() ?? Promise.resolve()
|
|
20927
|
+
}
|
|
20928
|
+
});
|
|
20929
|
+
return;
|
|
20930
|
+
}
|
|
20876
20931
|
const directive = (0, self_update_1.readUpgradeDirective)(directives, this.brand.product.version, attemptedUpgrades);
|
|
20877
20932
|
if (!directive)
|
|
20878
20933
|
return;
|
|
@@ -21484,7 +21539,7 @@ var import_shuttle = __toESM(require_dist5());
|
|
|
21484
21539
|
// package.json
|
|
21485
21540
|
var package_default = {
|
|
21486
21541
|
name: "@whittlelabs/sifter",
|
|
21487
|
-
version: "0.
|
|
21542
|
+
version: "0.13.0",
|
|
21488
21543
|
description: "Whittle Sifter: paired AI reviewer for Whittle Sift job pools.",
|
|
21489
21544
|
bin: {
|
|
21490
21545
|
"whittle-sifter": "./dist/bin.js"
|