omp-fabric 0.85.0 → 1.0.2
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/CHANGELOG.md +57 -0
- package/dist/agents/manager.d.ts.map +1 -1
- package/dist/agents/transports/process-transport.d.ts.map +1 -1
- package/dist/agents/transports/process-utils.d.ts +6 -1
- package/dist/agents/transports/process-utils.d.ts.map +1 -1
- package/dist/agents/types.d.ts +1 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/audit/details.d.ts +10 -0
- package/dist/audit/details.d.ts.map +1 -1
- package/dist/chunks/{chunk-GKOFZ76R.js → chunk-2LGLDM34.js} +22 -4
- package/dist/chunks/chunk-2LGLDM34.js.map +7 -0
- package/dist/chunks/{chunk-T6OAX4FO.js → chunk-3TWC6XOS.js} +37 -9
- package/dist/chunks/chunk-3TWC6XOS.js.map +7 -0
- package/dist/chunks/{chunk-ZNAJDPT7.js → chunk-B2SQR2JY.js} +32 -24
- package/dist/chunks/{chunk-ZNAJDPT7.js.map → chunk-B2SQR2JY.js.map} +2 -2
- package/dist/chunks/{chunk-SXMWV447.js → chunk-DOKANNFC.js} +206 -3
- package/dist/chunks/chunk-DOKANNFC.js.map +7 -0
- package/dist/chunks/{chunk-UPCARIJP.js → chunk-FFWALVBN.js} +20 -9
- package/dist/chunks/chunk-FFWALVBN.js.map +7 -0
- package/dist/chunks/{chunk-4LEDA76O.js → chunk-HAJPYJPY.js} +3 -3
- package/dist/chunks/{chunk-ROKMBLGN.js → chunk-IFNDRFW7.js} +34 -14
- package/dist/chunks/chunk-IFNDRFW7.js.map +7 -0
- package/dist/chunks/{chunk-ZTM45GH5.js → chunk-JZWLICMS.js} +125 -42
- package/dist/chunks/chunk-JZWLICMS.js.map +7 -0
- package/dist/chunks/{chunk-5GTPD4BA.js → chunk-L2FNMIOW.js} +66 -22
- package/dist/chunks/chunk-L2FNMIOW.js.map +7 -0
- package/dist/chunks/chunk-NX4SNIMR.js +226 -0
- package/dist/chunks/chunk-NX4SNIMR.js.map +7 -0
- package/dist/chunks/{chunk-YZZIKJX6.js → chunk-RBA54WC7.js} +1 -1
- package/dist/chunks/{chunk-YZZIKJX6.js.map → chunk-RBA54WC7.js.map} +1 -1
- package/dist/chunks/{chunk-OPTP4PSE.js → chunk-YPYVUGON.js} +3 -23
- package/dist/chunks/chunk-YPYVUGON.js.map +7 -0
- package/dist/chunks/{chunk-JP4LIZFT.js → chunk-Z6HEQPXX.js} +23 -6
- package/dist/chunks/chunk-Z6HEQPXX.js.map +7 -0
- package/dist/commands/fabric.d.ts.map +1 -1
- package/dist/core/action-registry.d.ts +2 -1
- package/dist/core/action-registry.d.ts.map +1 -1
- package/dist/core/action-registry.js +2 -2
- package/dist/core/compact-controller.d.ts +28 -3
- package/dist/core/compact-controller.d.ts.map +1 -1
- package/dist/core/compact-outcome-store.d.ts +3 -0
- package/dist/core/compact-outcome-store.d.ts.map +1 -0
- package/dist/entropy/index.js +2 -2
- package/dist/entropy/sessions.d.ts.map +1 -1
- package/dist/execution-service.d.ts.map +1 -1
- package/dist/fabric-exec-tool.d.ts.map +1 -1
- package/dist/fabric-runtime-state.d.ts.map +1 -1
- package/dist/fabric-runtime-state.js +883 -367
- package/dist/fabric-runtime-state.js.map +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +116 -18
- package/dist/index.js.map +3 -3
- package/dist/memory/discovery.d.ts +28 -14
- package/dist/memory/discovery.d.ts.map +1 -1
- package/dist/memory/discovery.js +9 -5
- package/dist/protocol.d.ts +5 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +1 -1
- package/dist/providers/mcp-descriptor-cache.d.ts +2 -0
- package/dist/providers/mcp-descriptor-cache.d.ts.map +1 -1
- package/dist/providers/mcp-provider.d.ts +4 -2
- package/dist/providers/mcp-provider.d.ts.map +1 -1
- package/dist/providers/memory-provider.d.ts.map +1 -1
- package/dist/providers/memory-provider.js +2 -2
- package/dist/providers/omp-tools-provider.d.ts +1 -0
- package/dist/providers/omp-tools-provider.d.ts.map +1 -1
- package/dist/residency/host.js +5 -5
- package/dist/residency/omp-entry.js +5 -5
- package/dist/runtime/core-override-guest-types.js +1 -1
- package/dist/runtime/guest-types.d.ts +2 -2
- package/dist/runtime/guest-types.d.ts.map +1 -1
- package/dist/runtime/guest-types.js +1 -1
- package/dist/runtime/node-process-child-source.d.ts.map +1 -1
- package/dist/runtime/node-process-runtime.d.ts.map +1 -1
- package/dist/runtime/node-process-runtime.js +4 -2
- package/dist/runtime/node-process-runtime.js.map +2 -2
- package/dist/runtime/quickjs-runtime.d.ts +6 -1
- package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
- package/dist/runtime/quickjs-runtime.js +1 -1
- package/dist/speculation/guest-args.d.ts +2 -0
- package/dist/speculation/guest-args.d.ts.map +1 -0
- package/dist/speculation/scanner.d.ts.map +1 -1
- package/dist/speculation/scanner.js +312 -14
- package/dist/speculation/scanner.js.map +3 -3
- package/dist/speculation/store.d.ts +2 -0
- package/dist/speculation/store.d.ts.map +1 -1
- package/dist/speculation/stream-tap.d.ts +1 -0
- package/dist/speculation/stream-tap.d.ts.map +1 -1
- package/dist/speculation/summary.d.ts +4 -0
- package/dist/speculation/summary.d.ts.map +1 -0
- package/dist/speculation/types.d.ts +4 -0
- package/dist/speculation/types.d.ts.map +1 -1
- package/dist/speculation/warmup.d.ts +17 -0
- package/dist/speculation/warmup.d.ts.map +1 -0
- package/dist/ui/settings.d.ts.map +1 -1
- package/dist/ui/settings.js +6 -6
- package/dist/ui/settings.js.map +2 -2
- package/docs/agents.md +1 -1
- package/docs/compaction.md +2 -2
- package/docs/configuration.md +26 -12
- package/docs/interface.md +2 -2
- package/docs/speculation.md +11 -6
- package/package.json +3 -2
- package/dist/chunks/chunk-5GTPD4BA.js.map +0 -7
- package/dist/chunks/chunk-7BIA5BJN.js +0 -112
- package/dist/chunks/chunk-7BIA5BJN.js.map +0 -7
- package/dist/chunks/chunk-GKOFZ76R.js.map +0 -7
- package/dist/chunks/chunk-JP4LIZFT.js.map +0 -7
- package/dist/chunks/chunk-OPTP4PSE.js.map +0 -7
- package/dist/chunks/chunk-ROKMBLGN.js.map +0 -7
- package/dist/chunks/chunk-SXMWV447.js.map +0 -7
- package/dist/chunks/chunk-T6OAX4FO.js.map +0 -7
- package/dist/chunks/chunk-UPCARIJP.js.map +0 -7
- package/dist/chunks/chunk-ZTM45GH5.js.map +0 -7
- /package/dist/chunks/{chunk-4LEDA76O.js.map → chunk-HAJPYJPY.js.map} +0 -0
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
} from "./chunk-HDJBUXDX.js";
|
|
7
7
|
import {
|
|
8
8
|
NESTED_TOOL_CALL_ID_PREFIX
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2LGLDM34.js";
|
|
10
10
|
import {
|
|
11
11
|
THINKING_DIGEST_CUSTOM_TYPE,
|
|
12
12
|
buildThinkingDigest,
|
|
13
13
|
snapshotHandoffSession,
|
|
14
14
|
thinkingTransferPolicy
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-YPYVUGON.js";
|
|
16
16
|
import {
|
|
17
17
|
isFabricThinking
|
|
18
18
|
} from "./chunk-JSBTB3P6.js";
|
|
@@ -589,6 +589,207 @@ var runFabricHandoffAtBoundary = async (controller, runner, extension, pending,
|
|
|
589
589
|
}
|
|
590
590
|
};
|
|
591
591
|
|
|
592
|
+
// src/speculation/partial-json.ts
|
|
593
|
+
var CODE_KEY_PATTERN = /"code"\s*:\s*"/;
|
|
594
|
+
var ESCAPES = {
|
|
595
|
+
'"': '"',
|
|
596
|
+
"\\": "\\",
|
|
597
|
+
"/": "/",
|
|
598
|
+
b: "\b",
|
|
599
|
+
f: "\f",
|
|
600
|
+
n: "\n",
|
|
601
|
+
r: "\r",
|
|
602
|
+
t: " "
|
|
603
|
+
};
|
|
604
|
+
var PartialCodeFieldExtractor = class {
|
|
605
|
+
#raw = "";
|
|
606
|
+
#codeStart = -1;
|
|
607
|
+
#cursor = 0;
|
|
608
|
+
#decoded = "";
|
|
609
|
+
#complete = false;
|
|
610
|
+
#failed = false;
|
|
611
|
+
#maxBytes;
|
|
612
|
+
constructor(maxBytes) {
|
|
613
|
+
this.#maxBytes = maxBytes;
|
|
614
|
+
}
|
|
615
|
+
get complete() {
|
|
616
|
+
return this.#complete;
|
|
617
|
+
}
|
|
618
|
+
/** Decoded `code` content so far, or undefined before the key appears. */
|
|
619
|
+
get code() {
|
|
620
|
+
return this.#codeStart === -1 ? void 0 : this.#decoded;
|
|
621
|
+
}
|
|
622
|
+
push(delta) {
|
|
623
|
+
if (this.#complete || this.#failed) return;
|
|
624
|
+
if (this.#raw.length + delta.length > this.#maxBytes) {
|
|
625
|
+
this.#failed = true;
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
this.#raw += delta;
|
|
629
|
+
if (this.#codeStart === -1) {
|
|
630
|
+
const match = CODE_KEY_PATTERN.exec(this.#raw);
|
|
631
|
+
if (!match) return;
|
|
632
|
+
this.#codeStart = match.index + match[0].length;
|
|
633
|
+
this.#cursor = this.#codeStart;
|
|
634
|
+
}
|
|
635
|
+
const raw = this.#raw;
|
|
636
|
+
while (this.#cursor < raw.length) {
|
|
637
|
+
const ch = raw[this.#cursor];
|
|
638
|
+
if (ch === '"') {
|
|
639
|
+
this.#complete = true;
|
|
640
|
+
this.#cursor = raw.length;
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
if (ch === "\\") {
|
|
644
|
+
if (this.#cursor + 1 >= raw.length) return;
|
|
645
|
+
const esc = raw[this.#cursor + 1];
|
|
646
|
+
if (esc === "u") {
|
|
647
|
+
if (this.#cursor + 5 >= raw.length) return;
|
|
648
|
+
const hex = raw.slice(this.#cursor + 2, this.#cursor + 6);
|
|
649
|
+
if (!/^[0-9a-fA-F]{4}$/.test(hex)) {
|
|
650
|
+
this.#failed = true;
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
this.#decoded += String.fromCharCode(parseInt(hex, 16));
|
|
654
|
+
this.#cursor += 6;
|
|
655
|
+
continue;
|
|
656
|
+
}
|
|
657
|
+
const mapped = ESCAPES[esc];
|
|
658
|
+
if (mapped === void 0) {
|
|
659
|
+
this.#failed = true;
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
this.#decoded += mapped;
|
|
663
|
+
this.#cursor += 2;
|
|
664
|
+
continue;
|
|
665
|
+
}
|
|
666
|
+
if (ch < " ") {
|
|
667
|
+
this.#failed = true;
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
this.#decoded += ch;
|
|
671
|
+
this.#cursor += 1;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
// src/speculation/stream-tap.ts
|
|
677
|
+
var toolCallBlock = (partial, contentIndex) => {
|
|
678
|
+
const content = partial?.content;
|
|
679
|
+
if (!Array.isArray(content)) return {};
|
|
680
|
+
const block = content[contentIndex];
|
|
681
|
+
if (!block || typeof block !== "object") return {};
|
|
682
|
+
const record = block;
|
|
683
|
+
if (record.type !== "toolCall") return {};
|
|
684
|
+
return {
|
|
685
|
+
...typeof record.name === "string" && record.name ? { name: record.name } : {},
|
|
686
|
+
...typeof record.id === "string" && record.id ? { id: record.id } : {}
|
|
687
|
+
};
|
|
688
|
+
};
|
|
689
|
+
var streamedToolCallName = (event) => {
|
|
690
|
+
const assistantEvent = event.assistantMessageEvent;
|
|
691
|
+
if (assistantEvent.contentIndex === void 0) return void 0;
|
|
692
|
+
const source = assistantEvent.type === "toolcall_end" ? assistantEvent.toolCall : assistantEvent.partial;
|
|
693
|
+
return toolCallBlock(source, assistantEvent.contentIndex).name;
|
|
694
|
+
};
|
|
695
|
+
var PARSE_INTERVAL_MS = 50;
|
|
696
|
+
var FabricSpeculationStreamTap = class {
|
|
697
|
+
#options;
|
|
698
|
+
#streams = /* @__PURE__ */ new Map();
|
|
699
|
+
// The scanner depends on the TypeScript compiler; the factory arrives through
|
|
700
|
+
// a lazy dynamic import so session startup never pays for it. Streams opened
|
|
701
|
+
// before the factory lands are caught up in full (extractors buffer the
|
|
702
|
+
// whole decoded prefix, so no candidate is lost, only delayed).
|
|
703
|
+
#createScanner;
|
|
704
|
+
#lastParseAt = 0;
|
|
705
|
+
constructor(options) {
|
|
706
|
+
this.#options = options;
|
|
707
|
+
}
|
|
708
|
+
setScannerFactory(factory) {
|
|
709
|
+
this.#createScanner = factory;
|
|
710
|
+
for (const stream of this.#streams.values()) {
|
|
711
|
+
if (stream.scanner) continue;
|
|
712
|
+
stream.scanner = factory();
|
|
713
|
+
const code = stream.extractor.code;
|
|
714
|
+
if (!stream.isFabricExec || code === void 0) continue;
|
|
715
|
+
try {
|
|
716
|
+
for (const candidate of stream.scanner.push(code)) {
|
|
717
|
+
if (this.#options.isEligible(candidate.ref)) {
|
|
718
|
+
this.#pendingCatchUp.push({ stream, candidate });
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
} catch {
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
#pendingCatchUp = [];
|
|
726
|
+
/** Drain candidates recovered while the scanner module loaded. */
|
|
727
|
+
flushCatchUp(context) {
|
|
728
|
+
const pending = this.#pendingCatchUp.splice(0);
|
|
729
|
+
for (const { stream, candidate } of pending) {
|
|
730
|
+
this.#options.launch(stream.toolCallId, candidate, context);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
/** New assistant message: content indices restart. */
|
|
734
|
+
reset() {
|
|
735
|
+
this.#streams.clear();
|
|
736
|
+
}
|
|
737
|
+
handleMessageUpdate(event, context) {
|
|
738
|
+
try {
|
|
739
|
+
if (!this.#options.enabled()) return;
|
|
740
|
+
if (this.#pendingCatchUp.length > 0) this.flushCatchUp(context);
|
|
741
|
+
const assistantEvent = event.assistantMessageEvent;
|
|
742
|
+
if (assistantEvent.type === "toolcall_start") {
|
|
743
|
+
const block = toolCallBlock(assistantEvent.partial, assistantEvent.contentIndex);
|
|
744
|
+
this.#streams.set(assistantEvent.contentIndex, {
|
|
745
|
+
toolCallId: block.id ?? `index-${assistantEvent.contentIndex}`,
|
|
746
|
+
isFabricExec: block.name !== void 0 ? block.name === "fabric_exec" : true,
|
|
747
|
+
extractor: new PartialCodeFieldExtractor(this.#options.maxBufferBytes()),
|
|
748
|
+
...this.#createScanner ? { scanner: this.#createScanner() } : {}
|
|
749
|
+
});
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
if (assistantEvent.type === "toolcall_delta") {
|
|
753
|
+
const stream = this.#streams.get(assistantEvent.contentIndex);
|
|
754
|
+
if (!stream) return;
|
|
755
|
+
const block = toolCallBlock(assistantEvent.partial, assistantEvent.contentIndex);
|
|
756
|
+
if (block.id) stream.toolCallId = block.id;
|
|
757
|
+
if (block.name !== void 0) stream.isFabricExec = block.name === "fabric_exec";
|
|
758
|
+
stream.extractor.push(assistantEvent.delta);
|
|
759
|
+
const code = stream.extractor.code;
|
|
760
|
+
if (!stream.isFabricExec || code === void 0) return;
|
|
761
|
+
this.#scan(stream, code, context, false);
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
if (assistantEvent.type === "toolcall_end") {
|
|
765
|
+
const stream = this.#streams.get(assistantEvent.contentIndex);
|
|
766
|
+
if (!stream) return;
|
|
767
|
+
this.#streams.delete(assistantEvent.contentIndex);
|
|
768
|
+
const block = toolCallBlock(assistantEvent.toolCall, assistantEvent.contentIndex);
|
|
769
|
+
if (block.id) stream.toolCallId = block.id;
|
|
770
|
+
if (block.name !== void 0) stream.isFabricExec = block.name === "fabric_exec";
|
|
771
|
+
const code = stream.extractor.code;
|
|
772
|
+
if (stream.isFabricExec && code !== void 0) {
|
|
773
|
+
this.#scan(stream, code, context, true);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
} catch {
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
#scan(stream, code, context, force) {
|
|
780
|
+
const now = Date.now();
|
|
781
|
+
if (!force && now - this.#lastParseAt < PARSE_INTERVAL_MS) return;
|
|
782
|
+
this.#lastParseAt = now;
|
|
783
|
+
if (!stream.scanner) return;
|
|
784
|
+
const candidates = stream.scanner.push(code);
|
|
785
|
+
for (const candidate of candidates) {
|
|
786
|
+
if (this.#options.isEligible(candidate.ref)) {
|
|
787
|
+
this.#options.launch(stream.toolCallId, candidate, context);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
};
|
|
792
|
+
|
|
592
793
|
// src/core/skill-block.ts
|
|
593
794
|
var escapeXml = (str) => str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
594
795
|
var formatSkillsForPrompt = (skills) => {
|
|
@@ -2425,6 +2626,8 @@ export {
|
|
|
2425
2626
|
claimFabricFsDriftHandoff,
|
|
2426
2627
|
settleInPlacePrewalk,
|
|
2427
2628
|
runFabricHandoffAtBoundary,
|
|
2629
|
+
streamedToolCallName,
|
|
2630
|
+
FabricSpeculationStreamTap,
|
|
2428
2631
|
formatSkillsForPrompt,
|
|
2429
2632
|
expandSkillDirMarkersInSkillBlock,
|
|
2430
2633
|
expandSkillDirMarkersForRead,
|
|
@@ -2442,4 +2645,4 @@ export {
|
|
|
2442
2645
|
resolveFabricIdentity,
|
|
2443
2646
|
MainAgentController
|
|
2444
2647
|
};
|
|
2445
|
-
//# sourceMappingURL=chunk-
|
|
2648
|
+
//# sourceMappingURL=chunk-DOKANNFC.js.map
|