@gitroll/tacitt-cli 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-setup-CQRWVUWR.mjs → agent-setup-Cb_spmGb.mjs} +1 -1
- package/dist/agent-setup-worker.mjs +4 -4
- package/dist/cli.mjs +49 -21
- package/dist/codex-title-worker.mjs +1 -1
- package/dist/configured-preview-worker.mjs +4 -4
- package/dist/configured-session-worker.mjs +4 -4
- package/dist/{heap-BaTNC9kf.mjs → heap-eZTo0VYj.mjs} +2 -2
- package/dist/inspection-worker.mjs +3 -3
- package/dist/{job-DrcpSL_9.mjs → job-Bi57uRU-.mjs} +2 -2
- package/dist/{model-D7UnGeag.mjs → model-BDrntocp.mjs} +1 -1
- package/dist/operation-executor.mjs +2 -2
- package/dist/preview-worker.mjs +1 -1
- package/dist/{query-ByD0Rp_o.mjs → query-7uY266qY.mjs} +70 -31
- package/dist/{run-3UIkr7GZ.mjs → run-CV6Io7CS.mjs} +2 -2
- package/dist/{src-DES7hBAP.mjs → src-BESjwh7X.mjs} +168 -40
- package/dist/{src-CmP73EcD.mjs → src-DIuh0LHk.mjs} +58 -15
- package/dist/{src-DNn7SifS.mjs → src-DSDRF7i6.mjs} +1 -1
- package/dist/store-database-worker.mjs +1 -1
- package/dist/web/assets/{index-Clg6Pfv_.css → index-D5DEG5Ue.css} +1 -1
- package/dist/web/assets/index-Dh4iG6x2.js +69 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/skills/tacitt/SKILL.md +1 -1
- package/skills/tacitt/references/commands.md +2 -0
- package/skills/tacitt/scripts/INDEX.md +36 -36
- package/skills/tacitt/scripts/review.mjs +74 -4
- package/dist/web/assets/index-BkuUI3Eu.js +0 -67
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { An as nativeBoolean, Hn as defaultLimits, In as retainedMainTextNodes, Mn as nativeItems, Nn as nativeText, Qt as sourceSnapshotId, Tn as parseNativeRecord, Zt as observeSource, jn as nativeField, nr as ProcessingError, vn as walkNativeFields } from "./locate-U3-nkird.mjs";
|
|
2
|
-
import { Ot as nativeAdapterVersions, ni as gitMetadataBudgetBytes, tt as reviewInventory } from "./src-
|
|
3
|
-
import { a as isRecord, i as errorCode, n as checkDiscoveryAbort, o as unresolvedMetadata, r as discoveryBounds, t as DiscoveryWarnings } from "./model-
|
|
4
|
-
import { c as previewLimits, d as checkOpenSource, f as checkSource, h as openSource, i as pageFits, l as previewSourceVersion, m as noSymlinks, p as fileSnapshot, r as previewHeapLimits, s as previewMessageSchema, u as createZstdFrameCheck } from "./run-
|
|
2
|
+
import { Ot as nativeAdapterVersions, ni as gitMetadataBudgetBytes, tt as reviewInventory } from "./src-DSDRF7i6.mjs";
|
|
3
|
+
import { a as isRecord, i as errorCode, n as checkDiscoveryAbort, o as unresolvedMetadata, r as discoveryBounds, t as DiscoveryWarnings } from "./model-BDrntocp.mjs";
|
|
4
|
+
import { c as previewLimits, d as checkOpenSource, f as checkSource, h as openSource, i as pageFits, l as previewSourceVersion, m as noSymlinks, p as fileSnapshot, r as previewHeapLimits, s as previewMessageSchema, u as createZstdFrameCheck } from "./run-CV6Io7CS.mjs";
|
|
5
5
|
import { a as titleHintLimits, n as titleHeapLimits, o as titleInputSchema, r as decodeTitleError, s as titleReplySchema } from "./heap-1FYhGds4.mjs";
|
|
6
6
|
import { constants } from "node:fs";
|
|
7
7
|
import { lstat, open, opendir, readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
@@ -672,13 +672,18 @@ const excludedRecords = /* @__PURE__ */ new Set([
|
|
|
672
672
|
"tools-used"
|
|
673
673
|
]);
|
|
674
674
|
/** Prove every conversational carrier, rather than trusting a deduplicated diagnostic node. */
|
|
675
|
-
function claudeMainProseComplete(root, selection) {
|
|
675
|
+
function claudeMainProseComplete(root, selection, onAnomaly) {
|
|
676
676
|
if (root.kind !== "object" || selection.diagnostics.some((item) => item.code === "unknown-source-role")) return false;
|
|
677
677
|
const type = nativeText(nativeField(root, "type"));
|
|
678
|
+
const skipped = (shape) => {
|
|
679
|
+
onAnomaly?.(shape);
|
|
680
|
+
return true;
|
|
681
|
+
};
|
|
678
682
|
if (excludedRecords.has(type ?? "")) return true;
|
|
679
683
|
const metaContext = nativeBoolean(nativeField(root, "isMeta")) === true || nativeBoolean(nativeField(root, "isCompactSummary")) === true || type === "assistant";
|
|
680
684
|
const text = (node) => {
|
|
681
685
|
if (node?.kind !== "string") return false;
|
|
686
|
+
if (selection.omitRecord === true) return true;
|
|
682
687
|
const edit = selection.edits.find((item) => item.nodeId === node.id);
|
|
683
688
|
if (!edit) return false;
|
|
684
689
|
const remainder = edit.replacement ?? (edit.mode.kind === "remove" ? "" : node.value);
|
|
@@ -691,32 +696,40 @@ function claudeMainProseComplete(root, selection) {
|
|
|
691
696
|
"command-input"
|
|
692
697
|
].includes(edit.role);
|
|
693
698
|
};
|
|
694
|
-
const content = (node, role) => {
|
|
699
|
+
const content = (node, role, queued = false) => {
|
|
695
700
|
if (node?.kind === "string") return text(node);
|
|
696
701
|
if (node?.kind !== "array") return false;
|
|
697
702
|
return node.items.every((block) => {
|
|
698
703
|
if (block.kind !== "object") return false;
|
|
699
704
|
const kind = nativeText(nativeField(block, "type"));
|
|
700
705
|
if (kind === "text") return text(nativeField(block, "text"));
|
|
701
|
-
if (role === "user") return [
|
|
706
|
+
if (role === "user" && (queued || nativeBoolean(nativeField(root, "isSidechain")) !== true)) return [
|
|
702
707
|
"tool_result",
|
|
703
708
|
"image",
|
|
704
709
|
"document"
|
|
705
710
|
].includes(kind ?? "");
|
|
706
|
-
|
|
711
|
+
if ((role === "user" ? [
|
|
712
|
+
"tool_result",
|
|
713
|
+
"image",
|
|
714
|
+
"document"
|
|
715
|
+
] : [
|
|
707
716
|
"tool_use",
|
|
708
717
|
"thinking",
|
|
709
718
|
"redacted_thinking"
|
|
710
|
-
].includes(kind ?? "");
|
|
719
|
+
]).includes(kind ?? "")) return true;
|
|
720
|
+
return skipped("claude-block");
|
|
711
721
|
});
|
|
712
722
|
};
|
|
713
723
|
if (type === "attachment") {
|
|
714
|
-
if (selection.omitRecord === true) return true;
|
|
715
724
|
const attachment = nativeField(root, "attachment");
|
|
716
|
-
if (nativeText(nativeField(attachment, "type"))
|
|
717
|
-
|
|
725
|
+
if (nativeText(nativeField(attachment, "type")) === "queued_command") return selection.omitRecord === true || content(nativeField(attachment, "prompt"), "user", true);
|
|
726
|
+
if (nativeField(root, "message") || nativeText(nativeField(nativeField(root, "origin"), "kind")) === "human" || nativeText(nativeField(nativeField(attachment, "origin"), "kind")) === "human") return false;
|
|
727
|
+
return selection.omitRecord === true;
|
|
728
|
+
}
|
|
729
|
+
if (type !== "user" && type !== "assistant") {
|
|
730
|
+
if (!type || nativeField(root, "message") || nativeText(nativeField(nativeField(root, "origin"), "kind")) === "human" || type === "queued_command") return false;
|
|
731
|
+
return skipped("claude-row");
|
|
718
732
|
}
|
|
719
|
-
if (type !== "user" && type !== "assistant") return false;
|
|
720
733
|
const message = nativeField(root, "message");
|
|
721
734
|
const role = nativeField(message, "role");
|
|
722
735
|
if (message?.kind !== "object" || role && nativeText(role) !== type) return false;
|
|
@@ -774,8 +787,29 @@ const excludedCompleted = /* @__PURE__ */ new Set([
|
|
|
774
787
|
]);
|
|
775
788
|
const typeOf = (node) => nativeText(nativeField(node, "type"));
|
|
776
789
|
/** Every conversational carrier must be accounted for, including later blocks and runtime copies. */
|
|
777
|
-
function codexMainProseComplete(root, selection) {
|
|
790
|
+
function codexMainProseComplete(root, selection, onAnomaly) {
|
|
778
791
|
if (root.kind !== "object" || selection.diagnostics.some((item) => item.code === "unknown-source-role")) return false;
|
|
792
|
+
const skipped = (shape) => {
|
|
793
|
+
onAnomaly?.(shape);
|
|
794
|
+
return true;
|
|
795
|
+
};
|
|
796
|
+
const topType = typeOf(root);
|
|
797
|
+
if (!topType) return false;
|
|
798
|
+
if (![
|
|
799
|
+
"session_meta",
|
|
800
|
+
"turn_context",
|
|
801
|
+
"world_state",
|
|
802
|
+
"token_usage_record",
|
|
803
|
+
"inter_agent_communication_metadata",
|
|
804
|
+
"retained_context",
|
|
805
|
+
"response_item",
|
|
806
|
+
"compacted",
|
|
807
|
+
"event_msg"
|
|
808
|
+
].includes(topType)) return [
|
|
809
|
+
"message",
|
|
810
|
+
"user_message",
|
|
811
|
+
"UserMessage"
|
|
812
|
+
].includes(topType) ? false : skipped("codex-row");
|
|
779
813
|
const payload = nativeField(root, "payload");
|
|
780
814
|
if (payload?.kind !== "object") return false;
|
|
781
815
|
const text = (node) => {
|
|
@@ -839,10 +873,12 @@ function codexMainProseComplete(root, selection) {
|
|
|
839
873
|
const item = (node) => {
|
|
840
874
|
if (node.kind !== "object") return false;
|
|
841
875
|
const type = typeOf(node);
|
|
876
|
+
if (!type) return false;
|
|
842
877
|
if (type === "message") return message(node);
|
|
843
878
|
if (type === "agent_message") return message(node, "assistant");
|
|
844
879
|
if (type === "configuration_update") return !selection.diagnostics.some((diagnostic) => diagnostic.code === "unsupported-native-shape" && diagnostic.nodeId === node.id);
|
|
845
|
-
|
|
880
|
+
if (["user_message", "UserMessage"].includes(type ?? "")) return false;
|
|
881
|
+
return excludedItems.has(type ?? "") || skipped("codex-item");
|
|
846
882
|
};
|
|
847
883
|
const type = typeOf(root);
|
|
848
884
|
if (type === "session_meta") return !selection.diagnostics.some((item) => item.code === "unsupported-native-shape");
|
|
@@ -860,16 +896,18 @@ function codexMainProseComplete(root, selection) {
|
|
|
860
896
|
}
|
|
861
897
|
if (type !== "event_msg") return false;
|
|
862
898
|
const event = typeOf(payload);
|
|
899
|
+
if (!event) return false;
|
|
863
900
|
if (event === "user_message" || event === "agent_message") return message(payload, event === "user_message" ? "user" : "assistant");
|
|
864
901
|
if (event === "task_complete") {
|
|
865
902
|
const last = nativeField(payload, "last_agent_message");
|
|
866
903
|
return !last || last.kind === "literal" && last.raw === "null" || content(last);
|
|
867
904
|
}
|
|
868
905
|
if (event === "thread_goal_updated") return content(nativeField(nativeField(payload, "goal"), "objective"));
|
|
869
|
-
if (event !== "item_completed" && event !== "item_started") return excludedRuntime.has(event ?? "");
|
|
906
|
+
if (event !== "item_completed" && event !== "item_started") return ["message", "UserMessage"].includes(event ?? "") ? false : excludedRuntime.has(event ?? "") || skipped("codex-event");
|
|
870
907
|
const completed = nativeField(payload, "item");
|
|
871
908
|
if (completed?.kind !== "object") return false;
|
|
872
909
|
const completedType = typeOf(completed);
|
|
910
|
+
if (!completedType) return false;
|
|
873
911
|
if (completedType === "AgentMessage") {
|
|
874
912
|
const body = nativeField(completed, "content");
|
|
875
913
|
const questions = nativeField(completed, "questions");
|
|
@@ -877,12 +915,17 @@ function codexMainProseComplete(root, selection) {
|
|
|
877
915
|
}
|
|
878
916
|
if (completedType === "UserMessage") return content(nativeField(completed, "content"), true);
|
|
879
917
|
if (completedType === "Plan") return content(nativeField(completed, "text"));
|
|
880
|
-
if (completedType === "Extension")
|
|
881
|
-
"
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
918
|
+
if (completedType === "Extension") {
|
|
919
|
+
const kind = nativeText(nativeField(completed, "kind"));
|
|
920
|
+
if (!kind) return false;
|
|
921
|
+
return [
|
|
922
|
+
"web.search",
|
|
923
|
+
"image_gen.generation",
|
|
924
|
+
"clock.sleep"
|
|
925
|
+
].includes(kind) || skipped("codex-extension");
|
|
926
|
+
}
|
|
927
|
+
if (["message", "user_message"].includes(completedType ?? "")) return false;
|
|
928
|
+
return excludedCompleted.has(completedType ?? "") || skipped("codex-item");
|
|
886
929
|
}
|
|
887
930
|
//#endregion
|
|
888
931
|
//#region packages/harnesses/src/retention/claude/source.ts
|
|
@@ -2178,6 +2221,55 @@ function messageText(text, selection, worker, compact, user) {
|
|
|
2178
2221
|
}
|
|
2179
2222
|
if (user && browserContextAmbiguous(value, typed ?? value)) selection.diagnose("inseparable-context", text);
|
|
2180
2223
|
}
|
|
2224
|
+
const blockKeys = {
|
|
2225
|
+
text: [
|
|
2226
|
+
"type",
|
|
2227
|
+
"text",
|
|
2228
|
+
"citations",
|
|
2229
|
+
"cache_control"
|
|
2230
|
+
],
|
|
2231
|
+
thinking: [
|
|
2232
|
+
"type",
|
|
2233
|
+
"thinking",
|
|
2234
|
+
"signature"
|
|
2235
|
+
],
|
|
2236
|
+
redacted_thinking: ["type", "data"],
|
|
2237
|
+
tool_use: [
|
|
2238
|
+
"type",
|
|
2239
|
+
"id",
|
|
2240
|
+
"name",
|
|
2241
|
+
"input",
|
|
2242
|
+
"cache_control"
|
|
2243
|
+
],
|
|
2244
|
+
tool_result: [
|
|
2245
|
+
"type",
|
|
2246
|
+
"tool_use_id",
|
|
2247
|
+
"content",
|
|
2248
|
+
"is_error",
|
|
2249
|
+
"cache_control"
|
|
2250
|
+
],
|
|
2251
|
+
image: [
|
|
2252
|
+
"type",
|
|
2253
|
+
"source",
|
|
2254
|
+
"cache_control"
|
|
2255
|
+
],
|
|
2256
|
+
document: [
|
|
2257
|
+
"type",
|
|
2258
|
+
"source",
|
|
2259
|
+
"title",
|
|
2260
|
+
"context",
|
|
2261
|
+
"citations",
|
|
2262
|
+
"cache_control"
|
|
2263
|
+
]
|
|
2264
|
+
};
|
|
2265
|
+
/** Only call for harness blocks; person-text carriers keep their strict gate. */
|
|
2266
|
+
function skipBlockDrift(block, selection) {
|
|
2267
|
+
if (block.kind !== "object") return;
|
|
2268
|
+
const kind = nativeText(nativeField(block, "type"));
|
|
2269
|
+
const keys = kind !== void 0 && Object.hasOwn(blockKeys, kind) ? blockKeys[kind] : void 0;
|
|
2270
|
+
if (!keys) return;
|
|
2271
|
+
for (const property of block.properties) if (!keys.includes(property.key.value)) selection.injected(property.value, "derived");
|
|
2272
|
+
}
|
|
2181
2273
|
//#endregion
|
|
2182
2274
|
//#region packages/harnesses/src/retention/claude/sidecar.ts
|
|
2183
2275
|
function patchBody(node, selection) {
|
|
@@ -2487,7 +2579,14 @@ function createClaudeRetention(options) {
|
|
|
2487
2579
|
if (type === "attachment") return attachment(root, recordSettings.sourceRole === "worker", selection);
|
|
2488
2580
|
if (!type || !metadataTypes$1.has(type) && type !== "user" && type !== "assistant") {
|
|
2489
2581
|
selection.diagnose("unsupported-native-shape", root);
|
|
2490
|
-
|
|
2582
|
+
const result = selection.result();
|
|
2583
|
+
let tolerated = false;
|
|
2584
|
+
return claudeMainProseComplete(root, result, () => {
|
|
2585
|
+
tolerated = true;
|
|
2586
|
+
}) && tolerated ? {
|
|
2587
|
+
...result,
|
|
2588
|
+
omitRecord: true
|
|
2589
|
+
} : result;
|
|
2491
2590
|
}
|
|
2492
2591
|
association.checkSource(root);
|
|
2493
2592
|
if (skills.apply(root, association, selection)) return selection.result();
|
|
@@ -2522,8 +2621,9 @@ function attachment(root, worker, selection) {
|
|
|
2522
2621
|
else selection.diagnose("unsupported-native-shape", block);
|
|
2523
2622
|
}
|
|
2524
2623
|
else messageText(prompt, selection, worker, false, true);
|
|
2525
|
-
|
|
2526
|
-
|
|
2624
|
+
if (root.kind === "object") {
|
|
2625
|
+
for (const property of root.properties) if (property.key.value.startsWith("rendered")) selection.injected(property.value, "derived");
|
|
2626
|
+
}
|
|
2527
2627
|
selection.injected(nativeField(origin, "body"), "instructions");
|
|
2528
2628
|
return selection.result();
|
|
2529
2629
|
}
|
|
@@ -2558,6 +2658,7 @@ function message$1(root, type, association, options, selection) {
|
|
|
2558
2658
|
}
|
|
2559
2659
|
for (const block of nativeItems(content)) {
|
|
2560
2660
|
const kind = nativeText(nativeField(block, "type"));
|
|
2661
|
+
if (kind === "tool_use" || nativeBoolean(nativeField(root, "isSidechain")) === true || kind === "tool_result") skipBlockDrift(block, selection);
|
|
2561
2662
|
if (kind === "text") messageText(nativeField(block, "text"), selection, options.sourceRole === "worker", compact, type === "user");
|
|
2562
2663
|
else if (kind === "thinking" && type === "assistant") {
|
|
2563
2664
|
selection.text(nativeField(block, "thinking"), "reasoning");
|
|
@@ -2569,7 +2670,10 @@ function message$1(root, type, association, options, selection) {
|
|
|
2569
2670
|
const name = association.register(block, selection);
|
|
2570
2671
|
if (name) generatedInput(name, block, selection);
|
|
2571
2672
|
} else if (kind === "tool_result" && type === "user") result$1(block, results.length === 1 ? sidecar : void 0, association, options, selection);
|
|
2572
|
-
else
|
|
2673
|
+
else {
|
|
2674
|
+
selection.diagnose("unsupported-native-shape", block);
|
|
2675
|
+
if (type === "assistant" || nativeBoolean(nativeField(root, "isSidechain")) === true) selection.injected(block, "derived");
|
|
2676
|
+
}
|
|
2573
2677
|
}
|
|
2574
2678
|
}
|
|
2575
2679
|
function result$1(block, sidecar, association, options, selection) {
|
|
@@ -3602,7 +3706,13 @@ function createCodexRetention(options) {
|
|
|
3602
3706
|
const retained = nativeField(nativeField(payload, "retained_context"), "user_messages");
|
|
3603
3707
|
for (const item of nativeItems(retained)) browserContextCopy(context, nativeField(item, "text"));
|
|
3604
3708
|
} else if (type !== "token_usage_record" && type !== "inter_agent_communication_metadata") unsupported(context, root);
|
|
3605
|
-
|
|
3709
|
+
let tolerated = false;
|
|
3710
|
+
return codexMainProseComplete(root, context, () => {
|
|
3711
|
+
tolerated = true;
|
|
3712
|
+
}) && tolerated ? {
|
|
3713
|
+
...context,
|
|
3714
|
+
omitRecord: true
|
|
3715
|
+
} : context;
|
|
3606
3716
|
};
|
|
3607
3717
|
}
|
|
3608
3718
|
//#endregion
|
|
@@ -3625,8 +3735,14 @@ const metadataTypes = /* @__PURE__ */ new Set(["summary", "file-history-snapshot
|
|
|
3625
3735
|
function claudeMetadataRecord(root) {
|
|
3626
3736
|
return metadataTypes.has(nativeText(nativeField(root, "type")) ?? "");
|
|
3627
3737
|
}
|
|
3738
|
+
function claudeIdentityType(type) {
|
|
3739
|
+
return typeof type === "string" && nativeTypes.has(type);
|
|
3740
|
+
}
|
|
3741
|
+
function claudeIdentityRecord(root) {
|
|
3742
|
+
return claudeIdentityType(nativeText(nativeField(root, "type")));
|
|
3743
|
+
}
|
|
3628
3744
|
function claudeIdentity(root) {
|
|
3629
|
-
if (!
|
|
3745
|
+
if (!claudeIdentityRecord(root)) return unknownIdentity();
|
|
3630
3746
|
const marker = nativeField(root, "isSidechain");
|
|
3631
3747
|
const sidechain = nativeBoolean(marker);
|
|
3632
3748
|
if (marker !== void 0 && sidechain === void 0) throw new ProcessingError("PROCESSING_UNSUPPORTED");
|
|
@@ -3761,14 +3877,14 @@ function codex(source, subagent) {
|
|
|
3761
3877
|
/** Decoded discovery record; undefined until a record names the launch surface. */
|
|
3762
3878
|
function recordLaunch(value, harness) {
|
|
3763
3879
|
if (!isRecord(value)) return void 0;
|
|
3764
|
-
if (harness === "claude") return claude(value["entrypoint"]);
|
|
3880
|
+
if (harness === "claude") return claudeIdentityType(value["type"]) ? claude(value["entrypoint"]) : void 0;
|
|
3765
3881
|
const payload = value["payload"];
|
|
3766
3882
|
if (value["type"] !== "session_meta" || !isRecord(payload)) return void 0;
|
|
3767
3883
|
const source = payload["source"];
|
|
3768
3884
|
return codex(source, isRecord(source) && "subagent" in source);
|
|
3769
3885
|
}
|
|
3770
3886
|
function claudeLaunch(root) {
|
|
3771
|
-
return claude(nativeText(nativeField(root, "entrypoint")));
|
|
3887
|
+
return claudeIdentityRecord(root) ? claude(nativeText(nativeField(root, "entrypoint"))) : void 0;
|
|
3772
3888
|
}
|
|
3773
3889
|
function codexLaunch(root) {
|
|
3774
3890
|
const payload = nativeField(root, "payload");
|
|
@@ -4258,6 +4374,7 @@ function createNativeAdapters() {
|
|
|
4258
4374
|
claude: Object.freeze({
|
|
4259
4375
|
version: nativeAdapterVersions.claude,
|
|
4260
4376
|
source: claudeSourceInspector,
|
|
4377
|
+
identityRecord: claudeIdentityRecord,
|
|
4261
4378
|
retention: createClaudeRetention,
|
|
4262
4379
|
mainProseComplete: claudeMainProseComplete,
|
|
4263
4380
|
annotations: describeClaudeRecord,
|
|
@@ -4273,6 +4390,7 @@ function createNativeAdapters() {
|
|
|
4273
4390
|
codex: Object.freeze({
|
|
4274
4391
|
version: nativeAdapterVersions.codex,
|
|
4275
4392
|
source: codexSourceInspector,
|
|
4393
|
+
identityRecord: (root) => nativeText(nativeField(root, "type")) === "session_meta",
|
|
4276
4394
|
retention: createCodexRetention,
|
|
4277
4395
|
mainProseComplete: codexMainProseComplete,
|
|
4278
4396
|
annotations: codexAnnotations,
|
|
@@ -4356,25 +4474,31 @@ function nativeEvidence(part, harness, signal) {
|
|
|
4356
4474
|
//#endregion
|
|
4357
4475
|
//#region packages/harnesses/src/metadata/launch-probe.ts
|
|
4358
4476
|
const markers = {
|
|
4359
|
-
claude: Buffer.from("\"
|
|
4477
|
+
claude: Buffer.from("\"sessionId\""),
|
|
4360
4478
|
codex: Buffer.from("\"session_meta\"")
|
|
4361
4479
|
};
|
|
4362
|
-
function lineLaunch(line, harness) {
|
|
4480
|
+
function lineLaunch(line, harness, inspector, signal) {
|
|
4363
4481
|
if (!line.includes(markers[harness])) return void 0;
|
|
4364
4482
|
try {
|
|
4365
|
-
const
|
|
4366
|
-
|
|
4483
|
+
const text = line.toString("utf8");
|
|
4484
|
+
const value = JSON.parse(text);
|
|
4485
|
+
if (!boundedDepth(value)) return void 0;
|
|
4486
|
+
inspector.inspect(parseNativeRecord(text, defaultLimits, signal));
|
|
4487
|
+
const launch = recordLaunch(value, harness);
|
|
4488
|
+
return inspector.current().sessionId === null || launch === void 0 ? void 0 : { launch };
|
|
4367
4489
|
} catch {
|
|
4368
4490
|
return;
|
|
4369
4491
|
}
|
|
4370
4492
|
}
|
|
4371
4493
|
/**
|
|
4372
4494
|
* Launch-only continuation of a plain JSONL head that hit its byte allowance before any
|
|
4373
|
-
* record
|
|
4374
|
-
* can
|
|
4495
|
+
* record established native identity. It reads up to the discovered size and parses only records
|
|
4496
|
+
* that can name native identity, so oversized leading records cannot hide an automation launch from
|
|
4375
4497
|
* classification. Records above the native record bound are skipped, never buffered.
|
|
4376
4498
|
*/
|
|
4377
4499
|
async function probeLaunch(part, harness, signal) {
|
|
4500
|
+
const inspector = createNativeAdapters()[harness].source(part);
|
|
4501
|
+
const activeSignal = signal ?? new AbortController().signal;
|
|
4378
4502
|
const handle = await openSource(part, "append");
|
|
4379
4503
|
try {
|
|
4380
4504
|
const chunk = new Uint8Array(discoveryBounds.chunkBytes);
|
|
@@ -4390,8 +4514,8 @@ async function probeLaunch(part, harness, signal) {
|
|
|
4390
4514
|
let view = Buffer.from(chunk.subarray(0, bytesRead));
|
|
4391
4515
|
for (let newline = view.indexOf(10); newline >= 0; newline = view.indexOf(10)) {
|
|
4392
4516
|
if (!skipping) {
|
|
4393
|
-
const
|
|
4394
|
-
if (
|
|
4517
|
+
const result = lineLaunch(Buffer.concat([...pending, view.subarray(0, newline)]), harness, inspector, activeSignal);
|
|
4518
|
+
if (result !== void 0) return result.launch;
|
|
4395
4519
|
}
|
|
4396
4520
|
pending = [];
|
|
4397
4521
|
pendingBytes = 0;
|
|
@@ -4406,7 +4530,7 @@ async function probeLaunch(part, harness, signal) {
|
|
|
4406
4530
|
skipping = true;
|
|
4407
4531
|
} else pending.push(view);
|
|
4408
4532
|
}
|
|
4409
|
-
return skipping ? void 0 : lineLaunch(Buffer.concat(pending), harness);
|
|
4533
|
+
return skipping ? void 0 : lineLaunch(Buffer.concat(pending), harness, inspector, activeSignal)?.launch;
|
|
4410
4534
|
} finally {
|
|
4411
4535
|
try {
|
|
4412
4536
|
await checkOpenSource(part, handle, "append");
|
|
@@ -4495,6 +4619,7 @@ async function metadataStream(part, harness, options) {
|
|
|
4495
4619
|
let journalOnly = journalPath;
|
|
4496
4620
|
let journalRecords = 0;
|
|
4497
4621
|
let launch;
|
|
4622
|
+
let launchKnown = false;
|
|
4498
4623
|
let headExhausted = false;
|
|
4499
4624
|
const sufficient = () => fields.cwd !== null && fields.sourceSessionId !== null && fields.createdAt !== null;
|
|
4500
4625
|
const parseHeadTitle = (line) => {
|
|
@@ -4533,7 +4658,10 @@ async function metadataStream(part, harness, options) {
|
|
|
4533
4658
|
return;
|
|
4534
4659
|
}
|
|
4535
4660
|
readFields(value, harness, fields);
|
|
4536
|
-
|
|
4661
|
+
if (!launchKnown && native.sourceSessionId() !== null) {
|
|
4662
|
+
launch = recordLaunch(value, harness);
|
|
4663
|
+
launchKnown = launch !== void 0;
|
|
4664
|
+
}
|
|
4537
4665
|
readTitleRecord(text, value, harness, titles, true, fields.sourceSessionId, options.signal);
|
|
4538
4666
|
const interaction = interactionTime(value, harness);
|
|
4539
4667
|
if (interaction.kind === "interaction") lastInteractionAt = interaction.timestamp;
|
|
@@ -4599,7 +4727,7 @@ async function metadataStream(part, harness, options) {
|
|
|
4599
4727
|
}
|
|
4600
4728
|
}
|
|
4601
4729
|
checkDiscoveryAbort(options.signal);
|
|
4602
|
-
if (headExhausted &&
|
|
4730
|
+
if (headExhausted && !launchKnown && readMode === "append") launch = await probeLaunch(part, harness, options.signal);
|
|
4603
4731
|
const workflowJournal = journalOnly && journalRecords > 0 && !stopped;
|
|
4604
4732
|
const complete = !stopped && !incompleteRecord && unchanged;
|
|
4605
4733
|
if (journalPath && !workflowJournal) warnings.add("UNCONFIRMED_WORKFLOW_JOURNAL");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Bn as validatePlan, Cn as sessionNonce, Dn as entityDictionaryVersion, En as cleanupImplementationVersion, Fn as frameRecords, Gn as detectStatic, H as codePointLength, Hn as defaultLimits, Ht as ApplicationError, In as retainedMainTextNodes, Jn as jsonSpans, Jt as reviewFamilies, Ln as validateProfile, Mn as nativeItems, Nn as nativeText, On as nativeParserVersion, Pn as transformRecords, Qt as sourceSnapshotId, Sn as createReplacementKey, Tn as parseNativeRecord, Un as recordPointerLimits, V as bDigest, Wn as resolveLimits, Wt as safeCode, Xn as createEntityMatcher, Xt as sourceKey, Yn as agentContextLocation, an as withMandatoryCustomTerms, c as textDigest, cn as mainReviewRole, dn as renderNative, fn as createSessionPreparation, gn as createDetectionSummary, in as nativeSourceIdentitySchema, ir as isProcessingCode, j as bDuplicateShift, jn as nativeField, k as bBindingCap, kn as redactionImplementationVersion, ln as reviewRoles, nr as ProcessingError, o as reviewDigest, on as processNativeRecord, pn as bindInspection, qt as familySelected, rr as fail$1, sn as projectNativeReviewInput, tr as defaultDetectionLimits, un as createSentenceContext, vn as walkNativeFields, wn as projectNativeRecord, x as createBAnalysisUnits, zn as buildPlan } from "./locate-U3-nkird.mjs";
|
|
2
2
|
import { t as createZstdFrameCheck } from "./frame-waS5FnN5.mjs";
|
|
3
|
-
import { An as bContainment, Dt as metadataProcessingVersion, F as withSourceEvidence, I as agentSetupKey, Mr as agentSourceSchema, P as sourceIdentityEvidence, Pn as bWordBounded, ai as sourceChangePolicy, fi as staticCatalogRef, it as defaultAgentSetupInclusion, jn as bExceptionRanges, jr as agentSourcePathSegment, rt as classifyAgentSetup, si as approvedTreatmentSchema, ur as resolveSourceSelection } from "./src-
|
|
3
|
+
import { An as bContainment, Dt as metadataProcessingVersion, F as withSourceEvidence, I as agentSetupKey, Mr as agentSourceSchema, P as sourceIdentityEvidence, Pn as bWordBounded, ai as sourceChangePolicy, fi as staticCatalogRef, it as defaultAgentSetupInclusion, jn as bExceptionRanges, jr as agentSourcePathSegment, rt as classifyAgentSetup, si as approvedTreatmentSchema, ur as resolveSourceSelection } from "./src-DSDRF7i6.mjs";
|
|
4
4
|
import { constants } from "node:fs";
|
|
5
5
|
import { link, lstat, mkdir, open, readFile, readdir, realpath, rm, rmdir, stat, unlink } from "node:fs/promises";
|
|
6
6
|
import { execFile, fork, spawn } from "node:child_process";
|
|
@@ -3227,21 +3227,23 @@ async function inspectInput(input, part, adapter, signal, overrides, complete =
|
|
|
3227
3227
|
const inspector = adapter.source(part);
|
|
3228
3228
|
const limits = resolveLimits(overrides);
|
|
3229
3229
|
let records = 0;
|
|
3230
|
+
let identityRecords = 0;
|
|
3230
3231
|
let readingRecords = true;
|
|
3231
3232
|
const cleanup = createCleanup();
|
|
3232
3233
|
try {
|
|
3233
3234
|
for await (const text of frameRecords(input.chunks, "jsonl", limits.maxRecordBytes, signal)) {
|
|
3234
3235
|
const root = parseNativeRecord(text, limits, signal);
|
|
3235
3236
|
inspector.inspect(root);
|
|
3236
|
-
observe?.(root);
|
|
3237
3237
|
const native = inspector.current();
|
|
3238
|
+
observe?.(root, native);
|
|
3238
3239
|
if (!complete && native.role !== "unknown" && native.sessionId !== null) {
|
|
3239
3240
|
const identity = inspector.finish();
|
|
3240
3241
|
checkNativeEvidence(part, identity);
|
|
3241
3242
|
return identity;
|
|
3242
3243
|
}
|
|
3243
3244
|
records += 1;
|
|
3244
|
-
if (
|
|
3245
|
+
if (adapter.identityRecord?.(root) !== false) identityRecords += 1;
|
|
3246
|
+
if (!complete && identityRecords >= 256) break;
|
|
3245
3247
|
}
|
|
3246
3248
|
readingRecords = false;
|
|
3247
3249
|
if (complete) await (input.finish ?? fail("ARTIFACT_PROCESSING_FAILED"))();
|
|
@@ -3272,20 +3274,24 @@ async function inspectCompleteCapturedSourceIdentity(part, captured, adapter, si
|
|
|
3272
3274
|
return inspectInput(await openCapturedConfiguredSource(part, captured, signal), part, adapter, signal, overrides, true, observe);
|
|
3273
3275
|
}
|
|
3274
3276
|
/**
|
|
3275
|
-
*
|
|
3276
|
-
*
|
|
3277
|
+
* Launch on the first identity-bearing record that names a launch, matching admission. Later per-record launch
|
|
3278
|
+
* metadata cannot redefine session admission; absent launch retains legacy behavior.
|
|
3277
3279
|
*/
|
|
3278
3280
|
async function capturedLaunch(part, captured, adapter, signal, overrides) {
|
|
3279
3281
|
const launch = adapter.launch;
|
|
3280
3282
|
if (!launch) return void 0;
|
|
3283
|
+
const inspector = adapter.source(part);
|
|
3281
3284
|
const limits = resolveLimits(overrides);
|
|
3282
3285
|
const input = await openCapturedConfiguredSource(part, captured, signal);
|
|
3283
3286
|
let records = 0;
|
|
3284
3287
|
const cleanup = createCleanup();
|
|
3285
3288
|
try {
|
|
3286
3289
|
for await (const text of frameRecords(input.chunks, "jsonl", limits.maxRecordBytes, signal)) {
|
|
3287
|
-
const
|
|
3288
|
-
|
|
3290
|
+
const root = parseNativeRecord(text, limits, signal);
|
|
3291
|
+
inspector.inspect(root);
|
|
3292
|
+
const identity = inspector.current();
|
|
3293
|
+
const value = launch(root);
|
|
3294
|
+
if (identity.sessionId !== null && adapter.identityRecord?.(root) !== false && value !== void 0) return value;
|
|
3289
3295
|
records += 1;
|
|
3290
3296
|
}
|
|
3291
3297
|
return;
|
|
@@ -3974,11 +3980,11 @@ function configuredSelection(selection, treatment) {
|
|
|
3974
3980
|
if (modes !== void 0 && !object(modes)) return fail("ARTIFACT_INVALID_APPROVAL");
|
|
3975
3981
|
const guardians = new Set(selection.diagnostics.filter((diagnostic) => diagnostic.code === "guardian-excluded").map((diagnostic) => diagnostic.nodeId));
|
|
3976
3982
|
if (cleanup.ref.id === "native-evidence") {
|
|
3977
|
-
if (selection.omitRecord && guardians.has(void 0)) return selection;
|
|
3983
|
+
if (selection.omitRecord && (guardians.has(void 0) || selection.diagnostics.some((item) => item.code === "unsupported-native-shape"))) return selection;
|
|
3978
3984
|
return {
|
|
3979
3985
|
diagnostics: selection.diagnostics,
|
|
3980
3986
|
edits: selection.edits.map((edit) => {
|
|
3981
|
-
if (guardians.has(edit.nodeId)) return edit;
|
|
3987
|
+
if (guardians.has(edit.nodeId) || edit.alwaysApply && edit.role === "derived") return edit;
|
|
3982
3988
|
const { replacement: _replacement, retainAs: _retainAs, replacementOrigin, replacementSourceRanges: _replacementSourceRanges, replacementTargetRanges: _replacementTargetRanges, ...original } = edit;
|
|
3983
3989
|
return {
|
|
3984
3990
|
...original,
|
|
@@ -13026,10 +13032,11 @@ async function admitConfiguredSources(approval, processing, signal, hooks, isola
|
|
|
13026
13032
|
const adapter = processing.adapters[session.harness];
|
|
13027
13033
|
const launch = adapter.launch;
|
|
13028
13034
|
let launchKnown = false;
|
|
13029
|
-
const observe = launch && ((root) => {
|
|
13030
|
-
if (launchKnown) return;
|
|
13035
|
+
const observe = launch && ((root, identity) => {
|
|
13036
|
+
if (launchKnown || identity.sessionId === null || adapter.identityRecord?.(root) === false) return;
|
|
13031
13037
|
const value = launch(root);
|
|
13032
|
-
|
|
13038
|
+
if (value === void 0) return;
|
|
13039
|
+
launchKnown = true;
|
|
13033
13040
|
if (value === "interactive") interactive.add(id);
|
|
13034
13041
|
if (value === "automation" && assessedOnly.has(session.id)) automated.add(id);
|
|
13035
13042
|
});
|
|
@@ -15594,6 +15601,7 @@ async function runConfiguredScanJob(job, processing, signal, onSourceProgress, o
|
|
|
15594
15601
|
requireCurrentCleanup(job.cleanup);
|
|
15595
15602
|
const owner = createOwner(request);
|
|
15596
15603
|
const buffered = [];
|
|
15604
|
+
const toleratedDrift = /* @__PURE__ */ new Map();
|
|
15597
15605
|
const verified = /* @__PURE__ */ new Map();
|
|
15598
15606
|
let bufferedUtf16 = 0, mainRecords = 0, emptyEligible = true;
|
|
15599
15607
|
try {
|
|
@@ -15615,6 +15623,12 @@ async function runConfiguredScanJob(job, processing, signal, onSourceProgress, o
|
|
|
15615
15623
|
const inspector = adapter.source(source.source);
|
|
15616
15624
|
const input = await owner.open(source);
|
|
15617
15625
|
let ordinal = 0;
|
|
15626
|
+
let identitySeen = false;
|
|
15627
|
+
const tolerate = (shape) => {
|
|
15628
|
+
const counts = toleratedDrift.get(source.id) ?? {};
|
|
15629
|
+
counts[shape] = (counts[shape] ?? 0) + 1;
|
|
15630
|
+
toleratedDrift.set(source.id, counts);
|
|
15631
|
+
};
|
|
15618
15632
|
let reading = true;
|
|
15619
15633
|
try {
|
|
15620
15634
|
for await (const record of roots(input, owner.limits, owner.signal)) {
|
|
@@ -15624,7 +15638,15 @@ async function runConfiguredScanJob(job, processing, signal, onSourceProgress, o
|
|
|
15624
15638
|
const original = retain(root);
|
|
15625
15639
|
const annotations = adapter.annotations(root, nativeOptions, original);
|
|
15626
15640
|
prepareOriginals(root, original, annotations, owner.preparation, owner.limits, owner.signal);
|
|
15627
|
-
if (adapter.mainProseComplete?.(root, original) !== true
|
|
15641
|
+
if (adapter.mainProseComplete?.(root, original, tolerate) !== true) fail("ARTIFACT_PROCESSING_UNSUPPORTED");
|
|
15642
|
+
const native = inspector.current();
|
|
15643
|
+
const launch = adapter.launch?.(root);
|
|
15644
|
+
const identityRecord = native.sessionId !== null && adapter.identityRecord?.(root) !== false && launch !== void 0;
|
|
15645
|
+
if (launch === "automation") {
|
|
15646
|
+
if (!identitySeen && identityRecord) fail("ARTIFACT_PROCESSING_UNSUPPORTED");
|
|
15647
|
+
tolerate("launch");
|
|
15648
|
+
}
|
|
15649
|
+
identitySeen ||= identityRecord;
|
|
15628
15650
|
const id = recordId(source.id, capture.facts, ordinal);
|
|
15629
15651
|
const projection = projectNativeReviewInput({
|
|
15630
15652
|
root,
|
|
@@ -15745,8 +15767,18 @@ async function runConfiguredScanJob(job, processing, signal, onSourceProgress, o
|
|
|
15745
15767
|
input: {
|
|
15746
15768
|
...metadataRow,
|
|
15747
15769
|
file: await fields.finish()
|
|
15748
|
-
}
|
|
15770
|
+
},
|
|
15771
|
+
toleratedDrift: [...toleratedDrift].map(([sourceId, driftCounts]) => ({
|
|
15772
|
+
sourceId,
|
|
15773
|
+
count: Object.values(driftCounts).reduce((sum, count) => sum + count, 0),
|
|
15774
|
+
driftCounts
|
|
15775
|
+
}))
|
|
15749
15776
|
};
|
|
15777
|
+
for (const { sourceId, driftCounts } of result.toleratedDrift ?? []) processing.onAnomaly?.({
|
|
15778
|
+
code: "tolerated-harness-drift",
|
|
15779
|
+
sourceId,
|
|
15780
|
+
driftCounts
|
|
15781
|
+
});
|
|
15750
15782
|
success = true;
|
|
15751
15783
|
return result;
|
|
15752
15784
|
} finally {
|
|
@@ -15866,6 +15898,17 @@ async function scanPreparedSession(production, sessionId, directory, hooks, canc
|
|
|
15866
15898
|
const capture = captures.find((row) => row.partId === source.source.id);
|
|
15867
15899
|
if (capture && JSON.stringify(actual.facts) !== JSON.stringify(capture.facts)) fail("ARTIFACT_SOURCE_CHANGED");
|
|
15868
15900
|
}
|
|
15901
|
+
const drift = settled.toleratedDrift ?? [];
|
|
15902
|
+
if (parallel && parallel.size > 1) for (const { sourceId, driftCounts } of drift) production.processing.onAnomaly?.({
|
|
15903
|
+
code: "tolerated-harness-drift",
|
|
15904
|
+
sourceId,
|
|
15905
|
+
driftCounts
|
|
15906
|
+
});
|
|
15907
|
+
hooks.onTiming?.({
|
|
15908
|
+
scope: "preparation",
|
|
15909
|
+
phases: {},
|
|
15910
|
+
volumes: { scanToleratedDrift: drift.reduce((sum, row) => sum + row.count, 0) }
|
|
15911
|
+
});
|
|
15869
15912
|
return settled;
|
|
15870
15913
|
} catch (error) {
|
|
15871
15914
|
const id = error instanceof SessionWorkerError ? error.sourceId : recordSourceId(error);
|
|
@@ -16452,7 +16495,7 @@ function createWorkPieces() {
|
|
|
16452
16495
|
const occurrences = /* @__PURE__ */ new Map();
|
|
16453
16496
|
for (const { field, row } of fields) for (const spec of cut(fieldOutline(field), repeated)) {
|
|
16454
16497
|
if (taken.has(spec.id)) continue;
|
|
16455
|
-
const text = field.text.slice(spec.utf16Start, spec.utf16End);
|
|
16498
|
+
const text = Buffer.from(field.text.slice(spec.utf16Start, spec.utf16End), "utf16le").toString("utf16le");
|
|
16456
16499
|
if (spec.key) {
|
|
16457
16500
|
texts.set(spec.key, text);
|
|
16458
16501
|
occurrences.set(spec.key, (occurrences.get(spec.key) ?? 0) + 1);
|
|
@@ -5760,7 +5760,7 @@ async function readGroupItems(storage, value) {
|
|
|
5760
5760
|
//#region packages/application/src/export/versions.ts
|
|
5761
5761
|
/** Current built-in admission, annotation and retention contracts; implementations share these. */
|
|
5762
5762
|
const nativeAdapterVersions = Object.freeze({
|
|
5763
|
-
claude: "claude-native-export-
|
|
5763
|
+
claude: "claude-native-export-v19",
|
|
5764
5764
|
codex: "codex-native-export-v16"
|
|
5765
5765
|
});
|
|
5766
5766
|
/** Shared metadata annotation/preparation semantics, independent of serialization formats. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as createExecutor, t as assertStoreHeap } from "./heap-
|
|
1
|
+
import { i as createExecutor, t as assertStoreHeap } from "./heap-eZTo0VYj.mjs";
|
|
2
2
|
import { parentPort } from "node:worker_threads";
|
|
3
3
|
//#region packages/local-host/src/store/worker/entry.ts
|
|
4
4
|
if (!parentPort) throw new Error("STORE_WORKER_REQUIRED");
|