@inhuman.tools/turn 0.0.0-stage → 0.2.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/LICENSE.md +7 -0
- package/dist/agent-calls/acceptance.d.ts +12 -0
- package/dist/agent-calls/acceptance.d.ts.map +1 -0
- package/dist/agent-calls/acceptance.js +64 -0
- package/dist/agent-calls/acceptance.js.map +1 -0
- package/dist/agent-calls/callbacks.d.ts +14 -0
- package/dist/agent-calls/callbacks.d.ts.map +1 -0
- package/dist/agent-calls/callbacks.js +59 -0
- package/dist/agent-calls/callbacks.js.map +1 -0
- package/dist/agent-calls/delivery.d.ts +7 -0
- package/dist/agent-calls/delivery.d.ts.map +1 -0
- package/dist/agent-calls/delivery.js +16 -0
- package/dist/agent-calls/delivery.js.map +1 -0
- package/dist/agent-calls/index.d.ts +7 -0
- package/dist/agent-calls/index.d.ts.map +1 -0
- package/dist/agent-calls/index.js +6 -0
- package/dist/agent-calls/index.js.map +1 -0
- package/dist/agent-calls/operator.d.ts +21 -0
- package/dist/agent-calls/operator.d.ts.map +1 -0
- package/dist/agent-calls/operator.js +78 -0
- package/dist/agent-calls/operator.js.map +1 -0
- package/dist/agent-calls/runtime.d.ts +99 -0
- package/dist/agent-calls/runtime.d.ts.map +1 -0
- package/dist/agent-calls/runtime.js +245 -0
- package/dist/agent-calls/runtime.js.map +1 -0
- package/dist/agent-calls/types.d.ts +31 -0
- package/dist/agent-calls/types.d.ts.map +1 -0
- package/dist/agent-calls/types.js +2 -0
- package/dist/agent-calls/types.js.map +1 -0
- package/dist/context/compact-floors.d.ts +43 -0
- package/dist/context/compact-floors.d.ts.map +1 -0
- package/dist/context/compact-floors.js +52 -0
- package/dist/context/compact-floors.js.map +1 -0
- package/dist/context/compact.d.ts +42 -0
- package/dist/context/compact.d.ts.map +1 -0
- package/dist/context/compact.js +155 -0
- package/dist/context/compact.js.map +1 -0
- package/dist/context/delivery.d.ts +13 -0
- package/dist/context/delivery.d.ts.map +1 -0
- package/dist/context/delivery.js +6 -0
- package/dist/context/delivery.js.map +1 -0
- package/dist/context/history.d.ts +66 -0
- package/dist/context/history.d.ts.map +1 -0
- package/dist/context/history.js +573 -0
- package/dist/context/history.js.map +1 -0
- package/dist/context/index.d.ts +10 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +10 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/observations.d.ts +7 -0
- package/dist/context/observations.d.ts.map +1 -0
- package/dist/context/observations.js +11 -0
- package/dist/context/observations.js.map +1 -0
- package/dist/context/retention/defaults.d.ts +10 -0
- package/dist/context/retention/defaults.d.ts.map +1 -0
- package/dist/context/retention/defaults.js +47 -0
- package/dist/context/retention/defaults.js.map +1 -0
- package/dist/context/retention/index.d.ts +14 -0
- package/dist/context/retention/index.d.ts.map +1 -0
- package/dist/context/retention/index.js +21 -0
- package/dist/context/retention/index.js.map +1 -0
- package/dist/context/retention/narrow.d.ts +22 -0
- package/dist/context/retention/narrow.d.ts.map +1 -0
- package/dist/context/retention/narrow.js +140 -0
- package/dist/context/retention/narrow.js.map +1 -0
- package/dist/context/retention/render.d.ts +37 -0
- package/dist/context/retention/render.d.ts.map +1 -0
- package/dist/context/retention/render.js +149 -0
- package/dist/context/retention/render.js.map +1 -0
- package/dist/context/retention/resolve.d.ts +51 -0
- package/dist/context/retention/resolve.d.ts.map +1 -0
- package/dist/context/retention/resolve.js +254 -0
- package/dist/context/retention/resolve.js.map +1 -0
- package/dist/context/retention/schema.d.ts +345 -0
- package/dist/context/retention/schema.d.ts.map +1 -0
- package/dist/context/retention/schema.js +149 -0
- package/dist/context/retention/schema.js.map +1 -0
- package/dist/context/retention/stamp.d.ts +25 -0
- package/dist/context/retention/stamp.d.ts.map +1 -0
- package/dist/context/retention/stamp.js +103 -0
- package/dist/context/retention/stamp.js.map +1 -0
- package/dist/context/retention/step.d.ts +33 -0
- package/dist/context/retention/step.d.ts.map +1 -0
- package/dist/context/retention/step.js +74 -0
- package/dist/context/retention/step.js.map +1 -0
- package/dist/context/retention/view.d.ts +57 -0
- package/dist/context/retention/view.d.ts.map +1 -0
- package/dist/context/retention/view.js +121 -0
- package/dist/context/retention/view.js.map +1 -0
- package/dist/context/squeeze.d.ts +45 -0
- package/dist/context/squeeze.d.ts.map +1 -0
- package/dist/context/squeeze.js +182 -0
- package/dist/context/squeeze.js.map +1 -0
- package/dist/context/tools.d.ts +16 -0
- package/dist/context/tools.d.ts.map +1 -0
- package/dist/context/tools.js +73 -0
- package/dist/context/tools.js.map +1 -0
- package/dist/context/transcript.d.ts +151 -0
- package/dist/context/transcript.d.ts.map +1 -0
- package/dist/context/transcript.js +659 -0
- package/dist/context/transcript.js.map +1 -0
- package/dist/policy-processor/bypass.d.ts +95 -0
- package/dist/policy-processor/bypass.d.ts.map +1 -0
- package/dist/policy-processor/bypass.js +188 -0
- package/dist/policy-processor/bypass.js.map +1 -0
- package/dist/policy-processor/classifier.d.ts +47 -0
- package/dist/policy-processor/classifier.d.ts.map +1 -0
- package/dist/policy-processor/classifier.js +671 -0
- package/dist/policy-processor/classifier.js.map +1 -0
- package/dist/policy-processor/cluster.d.ts +7 -0
- package/dist/policy-processor/cluster.d.ts.map +1 -0
- package/dist/policy-processor/cluster.js +32 -0
- package/dist/policy-processor/cluster.js.map +1 -0
- package/dist/policy-processor/evidence.d.ts +26 -0
- package/dist/policy-processor/evidence.d.ts.map +1 -0
- package/dist/policy-processor/evidence.js +204 -0
- package/dist/policy-processor/evidence.js.map +1 -0
- package/dist/policy-processor/explain.d.ts +59 -0
- package/dist/policy-processor/explain.d.ts.map +1 -0
- package/dist/policy-processor/explain.js +224 -0
- package/dist/policy-processor/explain.js.map +1 -0
- package/dist/policy-processor/index.d.ts +6 -0
- package/dist/policy-processor/index.d.ts.map +1 -0
- package/dist/policy-processor/index.js +6 -0
- package/dist/policy-processor/index.js.map +1 -0
- package/dist/policy-processor/license.d.ts +23 -0
- package/dist/policy-processor/license.d.ts.map +1 -0
- package/dist/policy-processor/license.js +47 -0
- package/dist/policy-processor/license.js.map +1 -0
- package/dist/policy-processor/peel-cwd.d.ts +2 -0
- package/dist/policy-processor/peel-cwd.d.ts.map +1 -0
- package/dist/policy-processor/peel-cwd.js +2 -0
- package/dist/policy-processor/peel-cwd.js.map +1 -0
- package/dist/policy-processor/real-path.d.ts +7 -0
- package/dist/policy-processor/real-path.d.ts.map +1 -0
- package/dist/policy-processor/real-path.js +42 -0
- package/dist/policy-processor/real-path.js.map +1 -0
- package/dist/policy-processor/scope.d.ts +111 -0
- package/dist/policy-processor/scope.d.ts.map +1 -0
- package/dist/policy-processor/scope.js +629 -0
- package/dist/policy-processor/scope.js.map +1 -0
- package/dist/policy-processor/self-protect.d.ts +10 -0
- package/dist/policy-processor/self-protect.d.ts.map +1 -0
- package/dist/policy-processor/self-protect.js +48 -0
- package/dist/policy-processor/self-protect.js.map +1 -0
- package/dist/policy-processor/soft-deny.d.ts +75 -0
- package/dist/policy-processor/soft-deny.d.ts.map +1 -0
- package/dist/policy-processor/soft-deny.js +185 -0
- package/dist/policy-processor/soft-deny.js.map +1 -0
- package/dist/policy-processor/unattended-guard.d.ts +28 -0
- package/dist/policy-processor/unattended-guard.d.ts.map +1 -0
- package/dist/policy-processor/unattended-guard.js +145 -0
- package/dist/policy-processor/unattended-guard.js.map +1 -0
- package/dist/session/cancel.d.ts +14 -0
- package/dist/session/cancel.d.ts.map +1 -0
- package/dist/session/cancel.js +32 -0
- package/dist/session/cancel.js.map +1 -0
- package/dist/session/commands.d.ts +41 -0
- package/dist/session/commands.d.ts.map +1 -0
- package/dist/session/commands.js +241 -0
- package/dist/session/commands.js.map +1 -0
- package/dist/session/compact-actor.d.ts +23 -0
- package/dist/session/compact-actor.d.ts.map +1 -0
- package/dist/session/compact-actor.js +91 -0
- package/dist/session/compact-actor.js.map +1 -0
- package/dist/session/compact-env.d.ts +54 -0
- package/dist/session/compact-env.d.ts.map +1 -0
- package/dist/session/compact-env.js +345 -0
- package/dist/session/compact-env.js.map +1 -0
- package/dist/session/compact.d.ts +42 -0
- package/dist/session/compact.d.ts.map +1 -0
- package/dist/session/compact.js +68 -0
- package/dist/session/compact.js.map +1 -0
- package/dist/session/index.d.ts +9 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +8 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/park.d.ts +16 -0
- package/dist/session/park.d.ts.map +1 -0
- package/dist/session/park.js +73 -0
- package/dist/session/park.js.map +1 -0
- package/dist/session/side-channel-reminder.d.ts +41 -0
- package/dist/session/side-channel-reminder.d.ts.map +1 -0
- package/dist/session/side-channel-reminder.js +132 -0
- package/dist/session/side-channel-reminder.js.map +1 -0
- package/dist/session/types.d.ts +44 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +2 -0
- package/dist/session/types.js.map +1 -0
- package/dist/tool-catalog/catalog.d.ts +77 -0
- package/dist/tool-catalog/catalog.d.ts.map +1 -0
- package/dist/tool-catalog/catalog.js +380 -0
- package/dist/tool-catalog/catalog.js.map +1 -0
- package/dist/tool-catalog/index.d.ts +4 -0
- package/dist/tool-catalog/index.d.ts.map +1 -0
- package/dist/tool-catalog/index.js +3 -0
- package/dist/tool-catalog/index.js.map +1 -0
- package/dist/tool-catalog/recipes.d.ts +36 -0
- package/dist/tool-catalog/recipes.d.ts.map +1 -0
- package/dist/tool-catalog/recipes.js +121 -0
- package/dist/tool-catalog/recipes.js.map +1 -0
- package/dist/tool-catalog/types.d.ts +103 -0
- package/dist/tool-catalog/types.d.ts.map +1 -0
- package/dist/tool-catalog/types.js +5 -0
- package/dist/tool-catalog/types.js.map +1 -0
- package/dist/tool-runtime/approval/approved.d.ts +13 -0
- package/dist/tool-runtime/approval/approved.d.ts.map +1 -0
- package/dist/tool-runtime/approval/approved.js +20 -0
- package/dist/tool-runtime/approval/approved.js.map +1 -0
- package/dist/tool-runtime/approval/dist.d.ts +6 -0
- package/dist/tool-runtime/approval/dist.d.ts.map +1 -0
- package/dist/tool-runtime/approval/dist.js +28 -0
- package/dist/tool-runtime/approval/dist.js.map +1 -0
- package/dist/tool-runtime/approval/inbound.d.ts +7 -0
- package/dist/tool-runtime/approval/inbound.d.ts.map +1 -0
- package/dist/tool-runtime/approval/inbound.js +48 -0
- package/dist/tool-runtime/approval/inbound.js.map +1 -0
- package/dist/tool-runtime/approval/unattended.d.ts +8 -0
- package/dist/tool-runtime/approval/unattended.d.ts.map +1 -0
- package/dist/tool-runtime/approval/unattended.js +23 -0
- package/dist/tool-runtime/approval/unattended.js.map +1 -0
- package/dist/tool-runtime/blob-port.d.ts +46 -0
- package/dist/tool-runtime/blob-port.d.ts.map +1 -0
- package/dist/tool-runtime/blob-port.js +47 -0
- package/dist/tool-runtime/blob-port.js.map +1 -0
- package/dist/tool-runtime/extra-root.d.ts +3 -0
- package/dist/tool-runtime/extra-root.d.ts.map +1 -0
- package/dist/tool-runtime/extra-root.js +14 -0
- package/dist/tool-runtime/extra-root.js.map +1 -0
- package/dist/tool-runtime/handler.d.ts +29 -0
- package/dist/tool-runtime/handler.d.ts.map +1 -0
- package/dist/tool-runtime/handler.js +460 -0
- package/dist/tool-runtime/handler.js.map +1 -0
- package/dist/tool-runtime/index.d.ts +14 -0
- package/dist/tool-runtime/index.d.ts.map +1 -0
- package/dist/tool-runtime/index.js +14 -0
- package/dist/tool-runtime/index.js.map +1 -0
- package/dist/tool-runtime/peel.d.ts +19 -0
- package/dist/tool-runtime/peel.d.ts.map +1 -0
- package/dist/tool-runtime/peel.js +74 -0
- package/dist/tool-runtime/peel.js.map +1 -0
- package/dist/tool-runtime/plugin-context.d.ts +13 -0
- package/dist/tool-runtime/plugin-context.d.ts.map +1 -0
- package/dist/tool-runtime/plugin-context.js +55 -0
- package/dist/tool-runtime/plugin-context.js.map +1 -0
- package/dist/tool-runtime/recall.d.ts +18 -0
- package/dist/tool-runtime/recall.d.ts.map +1 -0
- package/dist/tool-runtime/recall.js +100 -0
- package/dist/tool-runtime/recall.js.map +1 -0
- package/dist/tool-runtime/run-system-tool.d.ts +13 -0
- package/dist/tool-runtime/run-system-tool.d.ts.map +1 -0
- package/dist/tool-runtime/run-system-tool.js +230 -0
- package/dist/tool-runtime/run-system-tool.js.map +1 -0
- package/dist/tool-runtime/tool-error.d.ts +6 -0
- package/dist/tool-runtime/tool-error.d.ts.map +1 -0
- package/dist/tool-runtime/tool-error.js +6 -0
- package/dist/tool-runtime/tool-error.js.map +1 -0
- package/dist/tool-runtime/worker-tools.d.ts +8 -0
- package/dist/tool-runtime/worker-tools.d.ts.map +1 -0
- package/dist/tool-runtime/worker-tools.js +65 -0
- package/dist/tool-runtime/worker-tools.js.map +1 -0
- package/dist/tool-runtime/write-admit.d.ts +21 -0
- package/dist/tool-runtime/write-admit.d.ts.map +1 -0
- package/dist/tool-runtime/write-admit.js +89 -0
- package/dist/tool-runtime/write-admit.js.map +1 -0
- package/package.json +114 -3
- package/policy/auto-mode-ask.scm +201 -0
- package/policy/bypass-detect.prompt +55 -0
- package/policy/classifier-bash-incomplete.prompt +46 -0
- package/policy/classifier-bash.prompt +45 -0
- package/policy/classifier-mcp.prompt +45 -0
- package/policy/classifier-read.prompt +44 -0
- package/policy/classifier-write-outside.prompt +46 -0
- package/policy/classifier-write-risky.prompt +45 -0
- package/policy/classifier-write-workspace.prompt +46 -0
- package/policy/classifier-write.prompt +45 -0
- package/policy/soft-deny-round1.prompt +51 -0
- package/policy/soft-deny-round2.prompt +60 -0
- package/src/agent-calls/acceptance.ts +71 -0
- package/src/agent-calls/callbacks.ts +75 -0
- package/src/agent-calls/delivery.ts +15 -0
- package/src/agent-calls/index.ts +16 -0
- package/src/agent-calls/operator.ts +99 -0
- package/src/agent-calls/runtime.ts +310 -0
- package/src/agent-calls/types.ts +33 -0
- package/src/context/compact-floors.ts +76 -0
- package/src/context/compact.ts +176 -0
- package/src/context/delivery.ts +15 -0
- package/src/context/history.ts +725 -0
- package/src/context/index.ts +35 -0
- package/src/context/observations.ts +13 -0
- package/src/context/retention/defaults.ts +58 -0
- package/src/context/retention/index.ts +45 -0
- package/src/context/retention/narrow.ts +123 -0
- package/src/context/retention/render.ts +177 -0
- package/src/context/retention/resolve.ts +306 -0
- package/src/context/retention/schema.ts +173 -0
- package/src/context/retention/stamp.ts +121 -0
- package/src/context/retention/step.ts +85 -0
- package/src/context/retention/view.ts +161 -0
- package/src/context/squeeze.ts +218 -0
- package/src/context/tools.ts +92 -0
- package/src/context/transcript.ts +705 -0
- package/src/policy-processor/README.md +43 -0
- package/src/policy-processor/bypass.ts +246 -0
- package/src/policy-processor/classifier.ts +711 -0
- package/src/policy-processor/cluster.ts +31 -0
- package/src/policy-processor/evidence.ts +214 -0
- package/src/policy-processor/explain.ts +310 -0
- package/src/policy-processor/index.ts +6 -0
- package/src/policy-processor/license.ts +45 -0
- package/src/policy-processor/peel-cwd.ts +1 -0
- package/src/policy-processor/real-path.ts +41 -0
- package/src/policy-processor/scope.ts +655 -0
- package/src/policy-processor/self-protect.ts +46 -0
- package/src/policy-processor/soft-deny.ts +225 -0
- package/src/policy-processor/unattended-guard.ts +158 -0
- package/src/session/cancel.ts +34 -0
- package/src/session/commands.ts +292 -0
- package/src/session/compact-actor.ts +132 -0
- package/src/session/compact-env.ts +539 -0
- package/src/session/compact.ts +95 -0
- package/src/session/index.ts +18 -0
- package/src/session/park.ts +73 -0
- package/src/session/side-channel-reminder.ts +148 -0
- package/src/session/types.ts +50 -0
- package/src/tool-catalog/catalog.ts +282 -0
- package/src/tool-catalog/index.ts +26 -0
- package/src/tool-catalog/recipes.ts +154 -0
- package/src/tool-catalog/types.ts +110 -0
- package/src/tool-runtime/approval/approved.ts +20 -0
- package/src/tool-runtime/approval/dist.ts +29 -0
- package/src/tool-runtime/approval/inbound.ts +50 -0
- package/src/tool-runtime/approval/unattended.ts +24 -0
- package/src/tool-runtime/blob-port.ts +64 -0
- package/src/tool-runtime/extra-root.ts +16 -0
- package/src/tool-runtime/handler.ts +576 -0
- package/src/tool-runtime/index.ts +21 -0
- package/src/tool-runtime/peel.ts +91 -0
- package/src/tool-runtime/plugin-context.ts +68 -0
- package/src/tool-runtime/recall.ts +104 -0
- package/src/tool-runtime/run-system-tool.ts +273 -0
- package/src/tool-runtime/tool-error.ts +6 -0
- package/src/tool-runtime/worker-tools.ts +76 -0
- package/src/tool-runtime/write-admit.ts +90 -0
- package/README.md +0 -3
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
36
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
37
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Per-instance tool catalog.
|
|
41
|
+
*
|
|
42
|
+
* catalog = registered ∪ expand(connection)
|
|
43
|
+
* Registered entries and recipes are contributions from outside this package.
|
|
44
|
+
* Connection entries come from a host attached as `connectionHost`.
|
|
45
|
+
*
|
|
46
|
+
* wireName — model tools[] projection (regenerate freely).
|
|
47
|
+
* connection source — kernel ConnectionSpec map key + server tool; never re-parse wireName.
|
|
48
|
+
*/
|
|
49
|
+
import { DisposableClass, disposableGuard, prompt } from "@inhuman.tools/harness-commons";
|
|
50
|
+
import { action, computed, observable } from "mobx";
|
|
51
|
+
import invariant from "tiny-invariant";
|
|
52
|
+
import { dedupeRecipes, findRecipe, invokeCyclePath } from "./recipes.js";
|
|
53
|
+
import { PLAIN_WORKER_HOST } from "./types.js";
|
|
54
|
+
let KernelToolCatalog = (() => {
|
|
55
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
56
|
+
let _classSuper = DisposableClass;
|
|
57
|
+
let _instanceExtraInitializers = [];
|
|
58
|
+
let _packEntries_decorators;
|
|
59
|
+
let _packEntries_initializers = [];
|
|
60
|
+
let _packEntries_extraInitializers = [];
|
|
61
|
+
let _recipes_decorators;
|
|
62
|
+
let _recipes_initializers = [];
|
|
63
|
+
let _recipes_extraInitializers = [];
|
|
64
|
+
let _compiledRecipes_decorators;
|
|
65
|
+
let _compiledRecipes_initializers = [];
|
|
66
|
+
let _compiledRecipes_extraInitializers = [];
|
|
67
|
+
let _surfaceRecipes_decorators;
|
|
68
|
+
let _surfaceRecipes_initializers = [];
|
|
69
|
+
let _surfaceRecipes_extraInitializers = [];
|
|
70
|
+
let _botRevisions_decorators;
|
|
71
|
+
let _botRevisions_initializers = [];
|
|
72
|
+
let _botRevisions_extraInitializers = [];
|
|
73
|
+
let _projectRecipes_decorators;
|
|
74
|
+
let _projectRecipes_initializers = [];
|
|
75
|
+
let _projectRecipes_extraInitializers = [];
|
|
76
|
+
let _connectionHost_decorators;
|
|
77
|
+
let _connectionHost_initializers = [];
|
|
78
|
+
let _connectionHost_extraInitializers = [];
|
|
79
|
+
let _privateWorkerEntries_decorators;
|
|
80
|
+
let _privateWorkerEntries_initializers = [];
|
|
81
|
+
let _privateWorkerEntries_extraInitializers = [];
|
|
82
|
+
let _behaviorEntries_decorators;
|
|
83
|
+
let _behaviorEntries_initializers = [];
|
|
84
|
+
let _behaviorEntries_extraInitializers = [];
|
|
85
|
+
let _get_connectionEntries_decorators;
|
|
86
|
+
let _private_get_byWire_decorators;
|
|
87
|
+
let _private_get_byWire_descriptor;
|
|
88
|
+
let _replaceCompiledPlugins_decorators;
|
|
89
|
+
let _replaceSurfaceRecipes_decorators;
|
|
90
|
+
let _replaceRecipes_decorators;
|
|
91
|
+
let _replacePack_decorators;
|
|
92
|
+
let _bindProjectRecipes_decorators;
|
|
93
|
+
let _view_decorators;
|
|
94
|
+
return class KernelToolCatalog extends _classSuper {
|
|
95
|
+
static {
|
|
96
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
97
|
+
_packEntries_decorators = [(_a = observable).shallow.bind(_a)];
|
|
98
|
+
_recipes_decorators = [(_b = observable).shallow.bind(_b)];
|
|
99
|
+
_compiledRecipes_decorators = [(_c = observable).shallow.bind(_c)];
|
|
100
|
+
_surfaceRecipes_decorators = [(_d = observable).shallow.bind(_d)];
|
|
101
|
+
_botRevisions_decorators = [(_e = observable).ref.bind(_e)];
|
|
102
|
+
_projectRecipes_decorators = [(_f = observable).shallow.bind(_f)];
|
|
103
|
+
_connectionHost_decorators = [(_g = observable).ref.bind(_g)];
|
|
104
|
+
_privateWorkerEntries_decorators = [(_h = observable).shallow.bind(_h)];
|
|
105
|
+
_behaviorEntries_decorators = [(_j = observable).shallow.bind(_j)];
|
|
106
|
+
_get_connectionEntries_decorators = [computed];
|
|
107
|
+
_private_get_byWire_decorators = [computed];
|
|
108
|
+
_replaceCompiledPlugins_decorators = [action, disposableGuard];
|
|
109
|
+
_replaceSurfaceRecipes_decorators = [action, disposableGuard];
|
|
110
|
+
_replaceRecipes_decorators = [action, disposableGuard];
|
|
111
|
+
_replacePack_decorators = [action, disposableGuard];
|
|
112
|
+
_bindProjectRecipes_decorators = [disposableGuard];
|
|
113
|
+
_view_decorators = [disposableGuard];
|
|
114
|
+
__esDecorate(this, null, _packEntries_decorators, { kind: "accessor", name: "packEntries", static: false, private: false, access: { has: obj => "packEntries" in obj, get: obj => obj.packEntries, set: (obj, value) => { obj.packEntries = value; } }, metadata: _metadata }, _packEntries_initializers, _packEntries_extraInitializers);
|
|
115
|
+
__esDecorate(this, null, _recipes_decorators, { kind: "accessor", name: "recipes", static: false, private: false, access: { has: obj => "recipes" in obj, get: obj => obj.recipes, set: (obj, value) => { obj.recipes = value; } }, metadata: _metadata }, _recipes_initializers, _recipes_extraInitializers);
|
|
116
|
+
__esDecorate(this, null, _compiledRecipes_decorators, { kind: "accessor", name: "compiledRecipes", static: false, private: false, access: { has: obj => "compiledRecipes" in obj, get: obj => obj.compiledRecipes, set: (obj, value) => { obj.compiledRecipes = value; } }, metadata: _metadata }, _compiledRecipes_initializers, _compiledRecipes_extraInitializers);
|
|
117
|
+
__esDecorate(this, null, _surfaceRecipes_decorators, { kind: "accessor", name: "surfaceRecipes", static: false, private: false, access: { has: obj => "surfaceRecipes" in obj, get: obj => obj.surfaceRecipes, set: (obj, value) => { obj.surfaceRecipes = value; } }, metadata: _metadata }, _surfaceRecipes_initializers, _surfaceRecipes_extraInitializers);
|
|
118
|
+
__esDecorate(this, null, _botRevisions_decorators, { kind: "accessor", name: "botRevisions", static: false, private: false, access: { has: obj => "botRevisions" in obj, get: obj => obj.botRevisions, set: (obj, value) => { obj.botRevisions = value; } }, metadata: _metadata }, _botRevisions_initializers, _botRevisions_extraInitializers);
|
|
119
|
+
__esDecorate(this, null, _projectRecipes_decorators, { kind: "accessor", name: "projectRecipes", static: false, private: false, access: { has: obj => "projectRecipes" in obj, get: obj => obj.projectRecipes, set: (obj, value) => { obj.projectRecipes = value; } }, metadata: _metadata }, _projectRecipes_initializers, _projectRecipes_extraInitializers);
|
|
120
|
+
__esDecorate(this, null, _connectionHost_decorators, { kind: "accessor", name: "connectionHost", static: false, private: false, access: { has: obj => "connectionHost" in obj, get: obj => obj.connectionHost, set: (obj, value) => { obj.connectionHost = value; } }, metadata: _metadata }, _connectionHost_initializers, _connectionHost_extraInitializers);
|
|
121
|
+
__esDecorate(this, null, _privateWorkerEntries_decorators, { kind: "accessor", name: "privateWorkerEntries", static: false, private: false, access: { has: obj => "privateWorkerEntries" in obj, get: obj => obj.privateWorkerEntries, set: (obj, value) => { obj.privateWorkerEntries = value; } }, metadata: _metadata }, _privateWorkerEntries_initializers, _privateWorkerEntries_extraInitializers);
|
|
122
|
+
__esDecorate(this, null, _behaviorEntries_decorators, { kind: "accessor", name: "behaviorEntries", static: false, private: false, access: { has: obj => "behaviorEntries" in obj, get: obj => obj.behaviorEntries, set: (obj, value) => { obj.behaviorEntries = value; } }, metadata: _metadata }, _behaviorEntries_initializers, _behaviorEntries_extraInitializers);
|
|
123
|
+
__esDecorate(this, null, _get_connectionEntries_decorators, { kind: "getter", name: "connectionEntries", static: false, private: false, access: { has: obj => "connectionEntries" in obj, get: obj => obj.connectionEntries }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
124
|
+
__esDecorate(this, _private_get_byWire_descriptor = { get: __setFunctionName(function () {
|
|
125
|
+
const map = new Map();
|
|
126
|
+
if (this.source != null) {
|
|
127
|
+
for (const entry of this.source.catalogEntries()) {
|
|
128
|
+
if (this.permits?.(entry.wireName) !== false)
|
|
129
|
+
map.set(entry.wireName, entry);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
for (const entry of this.packEntries)
|
|
134
|
+
map.set(entry.wireName, entry);
|
|
135
|
+
for (const entry of this.connectionEntries)
|
|
136
|
+
map.set(entry.wireName, entry);
|
|
137
|
+
for (const entry of this.privateWorkerEntries)
|
|
138
|
+
map.set(entry.wireName, entry);
|
|
139
|
+
}
|
|
140
|
+
for (const entry of this.behaviorEntries) {
|
|
141
|
+
if (!map.has(entry.wireName))
|
|
142
|
+
map.set(entry.wireName, entry);
|
|
143
|
+
}
|
|
144
|
+
return map;
|
|
145
|
+
}, "#byWire", "get") }, _private_get_byWire_decorators, { kind: "getter", name: "#byWire", static: false, private: true, access: { has: obj => #byWire in obj, get: obj => obj.#byWire }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
146
|
+
__esDecorate(this, null, _replaceCompiledPlugins_decorators, { kind: "method", name: "replaceCompiledPlugins", static: false, private: false, access: { has: obj => "replaceCompiledPlugins" in obj, get: obj => obj.replaceCompiledPlugins }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
147
|
+
__esDecorate(this, null, _replaceSurfaceRecipes_decorators, { kind: "method", name: "replaceSurfaceRecipes", static: false, private: false, access: { has: obj => "replaceSurfaceRecipes" in obj, get: obj => obj.replaceSurfaceRecipes }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
148
|
+
__esDecorate(this, null, _replaceRecipes_decorators, { kind: "method", name: "replaceRecipes", static: false, private: false, access: { has: obj => "replaceRecipes" in obj, get: obj => obj.replaceRecipes }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
149
|
+
__esDecorate(this, null, _replacePack_decorators, { kind: "method", name: "replacePack", static: false, private: false, access: { has: obj => "replacePack" in obj, get: obj => obj.replacePack }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
150
|
+
__esDecorate(this, null, _bindProjectRecipes_decorators, { kind: "method", name: "bindProjectRecipes", static: false, private: false, access: { has: obj => "bindProjectRecipes" in obj, get: obj => obj.bindProjectRecipes }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
151
|
+
__esDecorate(this, null, _view_decorators, { kind: "method", name: "view", static: false, private: false, access: { has: obj => "view" in obj, get: obj => obj.view }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
152
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
153
|
+
}
|
|
154
|
+
source = __runInitializers(this, _instanceExtraInitializers);
|
|
155
|
+
permits;
|
|
156
|
+
constructor(source, permits) {
|
|
157
|
+
super();
|
|
158
|
+
this.source = source;
|
|
159
|
+
this.permits = permits;
|
|
160
|
+
if (source != null) {
|
|
161
|
+
this.TOOLS_SYSTEM_ADDENDUM = source.TOOLS_SYSTEM_ADDENDUM;
|
|
162
|
+
this.workerHost = source.workerHost;
|
|
163
|
+
this.recipes = source.recipes;
|
|
164
|
+
this.compiledRecipes = source.compiledRecipes;
|
|
165
|
+
this.surfaceRecipes = source.surfaceRecipes;
|
|
166
|
+
this.botRevisions = source.botRevisions;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Product composition may replace this. Empty until a roster is registered —
|
|
171
|
+
* this package does not name host tools.
|
|
172
|
+
*/
|
|
173
|
+
TOOLS_SYSTEM_ADDENDUM = prompt.system ``;
|
|
174
|
+
/** Set by the host. Views inherit it from their source. */
|
|
175
|
+
workerHost = PLAIN_WORKER_HOST;
|
|
176
|
+
#packEntries_accessor_storage = __runInitializers(this, _packEntries_initializers, []);
|
|
177
|
+
get packEntries() { return this.#packEntries_accessor_storage; }
|
|
178
|
+
set packEntries(value) { this.#packEntries_accessor_storage = value; }
|
|
179
|
+
#recipes_accessor_storage = (__runInitializers(this, _packEntries_extraInitializers), __runInitializers(this, _recipes_initializers, []));
|
|
180
|
+
/** Named-agent recipes authored on KernelRoot.bots / ProjectRoot.bots. */
|
|
181
|
+
get recipes() { return this.#recipes_accessor_storage; }
|
|
182
|
+
set recipes(value) { this.#recipes_accessor_storage = value; }
|
|
183
|
+
#compiledRecipes_accessor_storage = (__runInitializers(this, _recipes_extraInitializers), __runInitializers(this, _compiledRecipes_initializers, []));
|
|
184
|
+
/** Plugin-compiled bot recipes. Not written to KernelRoot.bots. */
|
|
185
|
+
get compiledRecipes() { return this.#compiledRecipes_accessor_storage; }
|
|
186
|
+
set compiledRecipes(value) { this.#compiledRecipes_accessor_storage = value; }
|
|
187
|
+
#surfaceRecipes_accessor_storage = (__runInitializers(this, _compiledRecipes_extraInitializers), __runInitializers(this, _surfaceRecipes_initializers, []));
|
|
188
|
+
/** Installed plugins' `.prompt` bots. An authored or compiled recipe of the same name wins. */
|
|
189
|
+
get surfaceRecipes() { return this.#surfaceRecipes_accessor_storage; }
|
|
190
|
+
set surfaceRecipes(value) { this.#surfaceRecipes_accessor_storage = value; }
|
|
191
|
+
#botRevisions_accessor_storage = (__runInitializers(this, _surfaceRecipes_extraInitializers), __runInitializers(this, _botRevisions_initializers, new Map()));
|
|
192
|
+
/**
|
|
193
|
+
* Program revision of each enabled plugin bot, keyed by bot name. A behavior
|
|
194
|
+
* plugin has no compiled install, so this is the revision `isCallPaused`
|
|
195
|
+
* compares a call against. Empty while no behavior has been pinned.
|
|
196
|
+
*/
|
|
197
|
+
get botRevisions() { return this.#botRevisions_accessor_storage; }
|
|
198
|
+
set botRevisions(value) { this.#botRevisions_accessor_storage = value; }
|
|
199
|
+
#projectRecipes_accessor_storage = (__runInitializers(this, _botRevisions_extraInitializers), __runInitializers(this, _projectRecipes_initializers, []));
|
|
200
|
+
/** Project-dir overlay copied onto session views. Kernel catalog field stays empty. */
|
|
201
|
+
get projectRecipes() { return this.#projectRecipes_accessor_storage; }
|
|
202
|
+
set projectRecipes(value) { this.#projectRecipes_accessor_storage = value; }
|
|
203
|
+
#connectionHost_accessor_storage = (__runInitializers(this, _projectRecipes_extraInitializers), __runInitializers(this, _connectionHost_initializers, undefined));
|
|
204
|
+
get connectionHost() { return this.#connectionHost_accessor_storage; }
|
|
205
|
+
set connectionHost(value) { this.#connectionHost_accessor_storage = value; }
|
|
206
|
+
#privateWorkerEntries_accessor_storage = (__runInitializers(this, _connectionHost_extraInitializers), __runInitializers(this, _privateWorkerEntries_initializers, []));
|
|
207
|
+
/** Worker-only private bundled MCP tools (not in foreground catalog). */
|
|
208
|
+
get privateWorkerEntries() { return this.#privateWorkerEntries_accessor_storage; }
|
|
209
|
+
set privateWorkerEntries(value) { this.#privateWorkerEntries_accessor_storage = value; }
|
|
210
|
+
#behaviorEntries_accessor_storage = (__runInitializers(this, _privateWorkerEntries_extraInitializers), __runInitializers(this, _behaviorEntries_initializers, []));
|
|
211
|
+
/** Tools declared by this agent's pinned behavior. The behavior is their grant. */
|
|
212
|
+
get behaviorEntries() { return this.#behaviorEntries_accessor_storage; }
|
|
213
|
+
set behaviorEntries(value) { this.#behaviorEntries_accessor_storage = value; }
|
|
214
|
+
/** Per-instance project overlay. Not a process table keyed only by path string. */
|
|
215
|
+
#projectRecipesByPath = (__runInitializers(this, _behaviorEntries_extraInitializers), new Map());
|
|
216
|
+
get connectionEntries() {
|
|
217
|
+
return this.connectionHost?.connectionEntries ?? [];
|
|
218
|
+
}
|
|
219
|
+
get #byWire() { return _private_get_byWire_descriptor.get.call(this); }
|
|
220
|
+
recipe(name) {
|
|
221
|
+
return (findRecipe(this.projectRecipes, name) ??
|
|
222
|
+
findRecipe(this.recipes, name) ??
|
|
223
|
+
findRecipe(this.compiledRecipes, name) ??
|
|
224
|
+
findRecipe(this.surfaceRecipes, name));
|
|
225
|
+
}
|
|
226
|
+
allRecipes() {
|
|
227
|
+
return dedupeRecipes([...this.projectRecipes, ...this.recipes, ...this.compiledRecipes, ...this.surfaceRecipes]);
|
|
228
|
+
}
|
|
229
|
+
replaceCompiledPlugins(state) {
|
|
230
|
+
const occupied = new Set(this.recipes.map((recipe) => recipe.spec.name));
|
|
231
|
+
for (const recipe of state.compiledRecipes) {
|
|
232
|
+
if (recipe.category === "internal")
|
|
233
|
+
continue;
|
|
234
|
+
invariant(!occupied.has(recipe.spec.name), `replaceCompiledPlugins: compiled bot "${recipe.spec.name}" collides with an authored recipe`);
|
|
235
|
+
}
|
|
236
|
+
const merged = [...this.recipes, ...state.compiledRecipes];
|
|
237
|
+
const cycle = invokeCyclePath(merged);
|
|
238
|
+
invariant(cycle == null, `replaceCompiledPlugins: invoke cycle ${cycle?.join(" → ")}`);
|
|
239
|
+
this.compiledRecipes = [...state.compiledRecipes];
|
|
240
|
+
}
|
|
241
|
+
/** Returns the bots skipped because another recipe already owns the name. */
|
|
242
|
+
replaceSurfaceRecipes(recipes) {
|
|
243
|
+
const taken = new Set([...this.recipes, ...this.compiledRecipes].map((recipe) => recipe.spec.name));
|
|
244
|
+
this.surfaceRecipes = recipes.filter((recipe) => !taken.has(recipe.spec.name));
|
|
245
|
+
return recipes.filter((recipe) => taken.has(recipe.spec.name)).map((recipe) => recipe.spec.name);
|
|
246
|
+
}
|
|
247
|
+
replaceRecipes(recipes) {
|
|
248
|
+
const seen = new Set();
|
|
249
|
+
const names = new Set([
|
|
250
|
+
...this.compiledRecipes.map((recipe) => recipe.spec.name),
|
|
251
|
+
...recipes.map((recipe) => recipe.spec.name),
|
|
252
|
+
]);
|
|
253
|
+
for (const recipe of recipes) {
|
|
254
|
+
const name = recipe.spec.name;
|
|
255
|
+
invariant(name.trim() !== "", "replaceRecipes: recipe name required");
|
|
256
|
+
invariant(!name.includes("__"), `replaceRecipes: recipe "${name}" cannot contain __`);
|
|
257
|
+
invariant(!seen.has(name), `replaceRecipes: recipe "${name}" collides`);
|
|
258
|
+
seen.add(name);
|
|
259
|
+
const caps = new Set();
|
|
260
|
+
for (const capability of recipe.capabilities) {
|
|
261
|
+
invariant(capability.name.trim() !== "" && !capability.name.includes("__"), `replaceRecipes: ${name} capability "${capability.name}" is illegal`);
|
|
262
|
+
invariant(!caps.has(capability.name), `replaceRecipes: ${name} capability "${capability.name}" collides`);
|
|
263
|
+
caps.add(capability.name);
|
|
264
|
+
}
|
|
265
|
+
for (const target of recipe.spec.invokes) {
|
|
266
|
+
invariant(names.has(target), `replaceRecipes: ${name} invokes unknown "${target}"`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const cycle = invokeCyclePath([
|
|
270
|
+
...this.compiledRecipes.filter((recipe) => !seen.has(recipe.spec.name)),
|
|
271
|
+
...recipes,
|
|
272
|
+
]);
|
|
273
|
+
invariant(cycle == null, `replaceRecipes: invoke cycle ${cycle?.join(" → ")}`);
|
|
274
|
+
this.recipes = [...recipes];
|
|
275
|
+
}
|
|
276
|
+
catalogEntry(wireName) {
|
|
277
|
+
return this.#byWire.get(wireName);
|
|
278
|
+
}
|
|
279
|
+
catalogEntries() {
|
|
280
|
+
return [...this.#byWire.values()];
|
|
281
|
+
}
|
|
282
|
+
catalogWireNames() {
|
|
283
|
+
return [...this.#byWire.keys()];
|
|
284
|
+
}
|
|
285
|
+
replacePack(entries) {
|
|
286
|
+
for (const entry of entries) {
|
|
287
|
+
invariant(entry.source.kind === "pack", `replacePack: entry ${entry.wireName} has kind ${entry.source.kind}`);
|
|
288
|
+
}
|
|
289
|
+
this.packEntries = [...entries];
|
|
290
|
+
}
|
|
291
|
+
bindProjectRecipes(workspacePath, recipes) {
|
|
292
|
+
if (workspacePath === "")
|
|
293
|
+
return;
|
|
294
|
+
this.#projectRecipesByPath.set(workspacePath, recipes);
|
|
295
|
+
}
|
|
296
|
+
unbindProjectRecipes(workspacePath) {
|
|
297
|
+
this.#projectRecipesByPath.delete(workspacePath);
|
|
298
|
+
}
|
|
299
|
+
projectRecipesOf(workspacePath) {
|
|
300
|
+
if (workspacePath == null || workspacePath === "")
|
|
301
|
+
return [];
|
|
302
|
+
return this.#projectRecipesByPath.get(workspacePath) ?? [];
|
|
303
|
+
}
|
|
304
|
+
/** Filtered view of this catalog. Recipe fields are shared; overlay fields stay on the caller. */
|
|
305
|
+
view(permits) {
|
|
306
|
+
return new KernelToolCatalog(this, permits);
|
|
307
|
+
}
|
|
308
|
+
dispose() {
|
|
309
|
+
this.#projectRecipesByPath.clear();
|
|
310
|
+
this.packEntries = [];
|
|
311
|
+
this.recipes = [];
|
|
312
|
+
this.compiledRecipes = [];
|
|
313
|
+
this.surfaceRecipes = [];
|
|
314
|
+
this.projectRecipes = [];
|
|
315
|
+
this.privateWorkerEntries = [];
|
|
316
|
+
this.behaviorEntries = [];
|
|
317
|
+
this.connectionHost = undefined;
|
|
318
|
+
this.botRevisions = new Map();
|
|
319
|
+
const roots = rootsByCatalog.get(this);
|
|
320
|
+
if (roots == null)
|
|
321
|
+
return;
|
|
322
|
+
for (const root of roots) {
|
|
323
|
+
if (catalogsByRoot.get(root) === this)
|
|
324
|
+
catalogsByRoot.delete(root);
|
|
325
|
+
}
|
|
326
|
+
roots.clear();
|
|
327
|
+
rootsByCatalog.delete(this);
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
})();
|
|
331
|
+
export { KernelToolCatalog };
|
|
332
|
+
export function catalogTriggersReactLoop(catalog, wire) {
|
|
333
|
+
const entry = catalog.catalogEntry(wire);
|
|
334
|
+
if (entry?.triggersReactLoop === false)
|
|
335
|
+
return false;
|
|
336
|
+
if (entry?.triggersReactLoop === true)
|
|
337
|
+
return true;
|
|
338
|
+
return entry?.isSideChannel !== true;
|
|
339
|
+
}
|
|
340
|
+
export function requireCatalog(catalog, what) {
|
|
341
|
+
if (catalog === undefined)
|
|
342
|
+
throw new Error(`${what}: kernel tool catalog is missing`);
|
|
343
|
+
return catalog;
|
|
344
|
+
}
|
|
345
|
+
const catalogsByRoot = new WeakMap();
|
|
346
|
+
const rootsByCatalog = new WeakMap();
|
|
347
|
+
const behaviorEntriesByRoot = observable.map(new Map(), { deep: false });
|
|
348
|
+
/** Tools the session's pinned behavior declares. Replaced whenever the pin reattaches. */
|
|
349
|
+
export const bindBehaviorEntries = action((root, entries) => {
|
|
350
|
+
if (entries.length === 0)
|
|
351
|
+
behaviorEntriesByRoot.delete(root);
|
|
352
|
+
else
|
|
353
|
+
behaviorEntriesByRoot.set(root, entries);
|
|
354
|
+
});
|
|
355
|
+
export function behaviorEntriesOf(root) {
|
|
356
|
+
return root == null ? [] : (behaviorEntriesByRoot.get(root) ?? []);
|
|
357
|
+
}
|
|
358
|
+
/** Bind a session (or test) root to a kernel catalog. */
|
|
359
|
+
export function bindSessionCatalog(root, catalog) {
|
|
360
|
+
invariant(!catalog.disposed, "bindSessionCatalog: catalog is disposed");
|
|
361
|
+
const prior = catalogsByRoot.get(root);
|
|
362
|
+
if (prior != null && prior !== catalog)
|
|
363
|
+
rootsByCatalog.get(prior)?.delete(root);
|
|
364
|
+
catalogsByRoot.set(root, catalog);
|
|
365
|
+
let roots = rootsByCatalog.get(catalog);
|
|
366
|
+
if (roots == null) {
|
|
367
|
+
roots = new Set();
|
|
368
|
+
rootsByCatalog.set(catalog, roots);
|
|
369
|
+
}
|
|
370
|
+
roots.add(root);
|
|
371
|
+
}
|
|
372
|
+
export function catalogOf(root) {
|
|
373
|
+
if (root == null)
|
|
374
|
+
return undefined;
|
|
375
|
+
const catalog = catalogsByRoot.get(root);
|
|
376
|
+
if (catalog == null || catalog.disposed)
|
|
377
|
+
return undefined;
|
|
378
|
+
return catalog;
|
|
379
|
+
}
|
|
380
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","s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AI,IAAI,IAAI,IAAI;QAAE,OAAO,SAAS,CAAC;IACnC,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC1D,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { type CatalogEntry, type CatalogSource, type PackToolMeta, type RecipeGrantSpec, type ToolRepresentation, type WorkerToolHost, } from "./types.js";
|
|
2
|
+
export { behaviorEntriesOf, bindBehaviorEntries, bindSessionCatalog, catalogOf, catalogTriggersReactLoop, KernelToolCatalog, requireCatalog, } from "./catalog.js";
|
|
3
|
+
export { agentCallSupportsNotify, catalogRecipe, type CatalogRecipe, edgeCreatesCycle, invokeCyclePath, invokeDenied, type RecipeScope, } from "./recipes.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tool-catalog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,SAAS,EACT,wBAAwB,EACxB,iBAAiB,EACjB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,KAAK,aAAa,EAClB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { behaviorEntriesOf, bindBehaviorEntries, bindSessionCatalog, catalogOf, catalogTriggersReactLoop, KernelToolCatalog, requireCatalog, } from "./catalog.js";
|
|
2
|
+
export { agentCallSupportsNotify, catalogRecipe, edgeCreatesCycle, invokeCyclePath, invokeDenied, } from "./recipes.js";
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tool-catalog/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,SAAS,EACT,wBAAwB,EACxB,iBAAiB,EACjB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,uBAAuB,EACvB,aAAa,EAEb,gBAAgB,EAChB,eAAe,EACf,YAAY,GAEb,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BotSpec, type RecipeScope, type ReasoningEffort } from "@inhuman.tools/harness-model";
|
|
2
|
+
import { CallsCatalog } from "../agent-calls/types.js";
|
|
3
|
+
export type { RecipeScope } from "@inhuman.tools/harness-model";
|
|
4
|
+
export type RecipeCapability = {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly description?: string;
|
|
7
|
+
readonly supportsNotify?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type CatalogRecipe = {
|
|
10
|
+
readonly spec: BotSpec;
|
|
11
|
+
readonly category: "plugin" | "internal";
|
|
12
|
+
readonly capabilities: readonly RecipeCapability[];
|
|
13
|
+
};
|
|
14
|
+
export declare function catalogRecipe(init: {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly category: CatalogRecipe["category"];
|
|
17
|
+
readonly recipeScope?: RecipeScope;
|
|
18
|
+
readonly keepAlive?: boolean;
|
|
19
|
+
readonly description?: string;
|
|
20
|
+
readonly instructions?: string;
|
|
21
|
+
readonly tools?: readonly string[];
|
|
22
|
+
readonly invokes?: readonly string[];
|
|
23
|
+
readonly reasoningEffort?: ReasoningEffort;
|
|
24
|
+
readonly modelPreferences?: readonly string[];
|
|
25
|
+
readonly skills?: readonly string[];
|
|
26
|
+
readonly capabilities?: readonly RecipeCapability[];
|
|
27
|
+
}): CatalogRecipe;
|
|
28
|
+
export declare function findRecipe(recipes: readonly CatalogRecipe[], name: string): CatalogRecipe | undefined;
|
|
29
|
+
export declare function agentCallSupportsNotify(catalog: CallsCatalog, callName: string): boolean;
|
|
30
|
+
/** Foreground (no recipe name) may invoke any known recipe. A worker may only invoke declared edges. */
|
|
31
|
+
export declare function invokeDenied(recipes: readonly CatalogRecipe[], invokerName: string, targetName: string): string | undefined;
|
|
32
|
+
/** First cycle path (including return to the start), or null if the DAG is sound. */
|
|
33
|
+
export declare function invokeCyclePath(recipes: readonly CatalogRecipe[]): readonly string[] | null;
|
|
34
|
+
export declare function edgeCreatesCycle(recipes: readonly CatalogRecipe[], from: string, to: string): boolean;
|
|
35
|
+
export declare function dedupeRecipes(recipes: readonly CatalogRecipe[]): CatalogRecipe[];
|
|
36
|
+
//# sourceMappingURL=recipes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipes.d.ts","sourceRoot":"","sources":["../../src/tool-catalog/recipes.ts"],"names":[],"mappings":"AAKA,OAAO,EAAyB,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEtH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,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EAAE,GAAG,SAAS,MAAM,EAAE,GAAG,IAAI,CA+B3F;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CA0BrG;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,aAAa,EAAE,CAShF"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bot recipes. Standing bots go through `bot/send` / `bot/ask` —
|
|
3
|
+
* not per-recipe catalog rows. No execute bodies.
|
|
4
|
+
*/
|
|
5
|
+
import { asSystemPrompt } from "@inhuman.tools/harness-commons";
|
|
6
|
+
import { AGENT_ASK, AGENT_SEND, BotSpec } from "@inhuman.tools/harness-model";
|
|
7
|
+
export function catalogRecipe(init) {
|
|
8
|
+
return {
|
|
9
|
+
spec: new BotSpec({
|
|
10
|
+
name: init.name,
|
|
11
|
+
recipeScope: init.recipeScope ?? "session",
|
|
12
|
+
keepAlive: init.keepAlive === true,
|
|
13
|
+
description: init.description ?? "",
|
|
14
|
+
instructions: asSystemPrompt(init.instructions ?? ""),
|
|
15
|
+
tools: init.tools ? [...init.tools] : [],
|
|
16
|
+
invokes: init.invokes ? [...init.invokes] : [],
|
|
17
|
+
reasoningEffort: init.reasoningEffort ?? null,
|
|
18
|
+
modelPreferences: init.modelPreferences ? [...init.modelPreferences] : [],
|
|
19
|
+
skills: init.skills ? [...init.skills] : [],
|
|
20
|
+
}),
|
|
21
|
+
category: init.category,
|
|
22
|
+
capabilities: init.capabilities ?? [],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function findRecipe(recipes, name) {
|
|
26
|
+
return recipes.find((recipe) => recipe.spec.name === name);
|
|
27
|
+
}
|
|
28
|
+
export function agentCallSupportsNotify(catalog, callName) {
|
|
29
|
+
if (callName === AGENT_SEND || callName === AGENT_ASK)
|
|
30
|
+
return true;
|
|
31
|
+
const entry = catalog.catalogEntry(callName);
|
|
32
|
+
if (entry?.packMeta?.kind === "bot-call") {
|
|
33
|
+
return entry.packMeta.supportsNotify === true;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
/** Foreground (no recipe name) may invoke any known recipe. A worker may only invoke declared edges. */
|
|
38
|
+
export function invokeDenied(recipes, invokerName, targetName) {
|
|
39
|
+
if (invokerName === "")
|
|
40
|
+
return undefined;
|
|
41
|
+
const invoker = findRecipe(recipes, invokerName);
|
|
42
|
+
if (invoker == null)
|
|
43
|
+
return `unknown invoker recipe ${invokerName}`;
|
|
44
|
+
if (!invoker.spec.invokes.includes(targetName))
|
|
45
|
+
return `${invokerName} cannot invoke ${targetName}`;
|
|
46
|
+
if (edgeCreatesCycle(recipes, invokerName, targetName))
|
|
47
|
+
return `invoke cycle ${invokerName} → ${targetName}`;
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
/** First cycle path (including return to the start), or null if the DAG is sound. */
|
|
51
|
+
export function invokeCyclePath(recipes) {
|
|
52
|
+
const edges = new Map(recipes.map((recipe) => [recipe.spec.name, recipe.spec.invokes]));
|
|
53
|
+
const names = new Set(recipes.map((recipe) => recipe.spec.name));
|
|
54
|
+
const visiting = new Set();
|
|
55
|
+
const seen = new Set();
|
|
56
|
+
const stack = [];
|
|
57
|
+
const visit = (node) => {
|
|
58
|
+
if (visiting.has(node)) {
|
|
59
|
+
const at = stack.indexOf(node);
|
|
60
|
+
return at === -1 ? [node, node] : [...stack.slice(at), node];
|
|
61
|
+
}
|
|
62
|
+
if (seen.has(node))
|
|
63
|
+
return null;
|
|
64
|
+
visiting.add(node);
|
|
65
|
+
stack.push(node);
|
|
66
|
+
for (const next of edges.get(node) ?? []) {
|
|
67
|
+
if (!names.has(next))
|
|
68
|
+
continue;
|
|
69
|
+
const cycle = visit(next);
|
|
70
|
+
if (cycle != null)
|
|
71
|
+
return cycle;
|
|
72
|
+
}
|
|
73
|
+
stack.pop();
|
|
74
|
+
visiting.delete(node);
|
|
75
|
+
seen.add(node);
|
|
76
|
+
return null;
|
|
77
|
+
};
|
|
78
|
+
for (const name of names) {
|
|
79
|
+
const cycle = visit(name);
|
|
80
|
+
if (cycle != null)
|
|
81
|
+
return cycle;
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
export function edgeCreatesCycle(recipes, from, to) {
|
|
86
|
+
if (from === to)
|
|
87
|
+
return true;
|
|
88
|
+
return (invokeCyclePath(recipes.map((recipe) => {
|
|
89
|
+
if (recipe.spec.name !== from)
|
|
90
|
+
return recipe;
|
|
91
|
+
const spec = recipe.spec;
|
|
92
|
+
return {
|
|
93
|
+
...recipe,
|
|
94
|
+
spec: new BotSpec({
|
|
95
|
+
name: spec.name,
|
|
96
|
+
description: spec.description,
|
|
97
|
+
recipeScope: spec.recipeScope,
|
|
98
|
+
keepAlive: spec.keepAlive,
|
|
99
|
+
instructions: spec.instructions,
|
|
100
|
+
tools: [...spec.tools],
|
|
101
|
+
invokes: [...spec.invokes, to],
|
|
102
|
+
reasoningEffort: spec.reasoningEffort,
|
|
103
|
+
skills: [...spec.skills],
|
|
104
|
+
modelPreferences: [...spec.modelPreferences],
|
|
105
|
+
error: spec.error,
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
})) != null);
|
|
109
|
+
}
|
|
110
|
+
export function dedupeRecipes(recipes) {
|
|
111
|
+
const seen = new Set();
|
|
112
|
+
const out = [];
|
|
113
|
+
for (const recipe of recipes) {
|
|
114
|
+
if (seen.has(recipe.spec.name))
|
|
115
|
+
continue;
|
|
116
|
+
seen.add(recipe.spec.name);
|
|
117
|
+
out.push(recipe);
|
|
118
|
+
}
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=recipes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipes.js","sourceRoot":"","sources":["../../src/tool-catalog/recipes.ts"],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