theokit 0.62.0 → 0.62.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/{actions-virtual-module-PBYOQTLB.js → actions-virtual-module-AT6HNADR.js} +3 -3
- package/dist/{actions-virtual-module-LXENSB3L.js → actions-virtual-module-XJ6J6T4C.js} +3 -3
- package/dist/adapters/agent-mount.js +2 -2
- package/dist/{agent-YNHEKPD6.js → agent-G525PHCO.js} +3 -3
- package/dist/{app-typed-client-VZN2ISQX.js → app-typed-client-5B3IOU45.js} +3 -3
- package/dist/{app-typed-client-Z5AKRLSU.js → app-typed-client-NTNYNJTW.js} +3 -3
- package/dist/{build-TFH2T26B.js → build-CZAM7K6J.js} +2 -2
- package/dist/{chunk-CY5WKIM5.js → chunk-2BYN7WTW.js} +2 -2
- package/dist/{chunk-BAXPERIV.js → chunk-DRLYKXDD.js} +3 -3
- package/dist/{chunk-PGYYVOM3.js → chunk-DVJRDY3H.js} +8 -8
- package/dist/{chunk-UK2WVX5G.js → chunk-EB5TYC2Y.js} +7 -7
- package/dist/{chunk-4LQKAWZJ.js → chunk-F2LYXOHK.js} +3 -3
- package/dist/{chunk-JI365DWM.js → chunk-ICXXHV4V.js} +3 -2
- package/dist/{chunk-JI365DWM.js.map → chunk-ICXXHV4V.js.map} +1 -1
- package/dist/{chunk-YVHQ35RT.js → chunk-UETVDZBE.js} +3 -2
- package/dist/{chunk-YVHQ35RT.js.map → chunk-UETVDZBE.js.map} +1 -1
- package/dist/{chunk-UZFOWYAQ.js → chunk-USN554EK.js} +2 -2
- package/dist/cli/index.js +6 -6
- package/dist/{dev-FUQFN7PQ.js → dev-GQ2CDBW2.js} +5 -5
- package/dist/index.js +3 -3
- package/dist/{internal-api-D4LIZ3S6.js → internal-api-G25P4TP2.js} +3 -3
- package/dist/{internal-api-HXKRFUXR.js → internal-api-UBBHEPVE.js} +3 -3
- package/dist/{mcp-7MSZDEKX.js → mcp-W2UGY4II.js} +3 -3
- package/dist/{preview-CCL7SKCG.js → preview-3TLURUAL.js} +3 -3
- package/dist/server/agent/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/{server-boundary-QHWMBDKT.js → server-boundary-A5JNZ4ND.js} +3 -3
- package/dist/{server-boundary-6PGQB5XT.js → server-boundary-JP6VHXAX.js} +3 -3
- package/dist/{start-K4O5J7JA.js → start-JEYOON64.js} +4 -4
- package/dist/vite-plugin/index.js +3 -3
- package/dist/{vite-plugin-675YOCHV.js → vite-plugin-VLDOBVIS.js} +5 -5
- package/package.json +3 -3
- /package/dist/{actions-virtual-module-PBYOQTLB.js.map → actions-virtual-module-AT6HNADR.js.map} +0 -0
- /package/dist/{actions-virtual-module-LXENSB3L.js.map → actions-virtual-module-XJ6J6T4C.js.map} +0 -0
- /package/dist/{agent-YNHEKPD6.js.map → agent-G525PHCO.js.map} +0 -0
- /package/dist/{app-typed-client-VZN2ISQX.js.map → app-typed-client-5B3IOU45.js.map} +0 -0
- /package/dist/{app-typed-client-Z5AKRLSU.js.map → app-typed-client-NTNYNJTW.js.map} +0 -0
- /package/dist/{build-TFH2T26B.js.map → build-CZAM7K6J.js.map} +0 -0
- /package/dist/{chunk-CY5WKIM5.js.map → chunk-2BYN7WTW.js.map} +0 -0
- /package/dist/{chunk-BAXPERIV.js.map → chunk-DRLYKXDD.js.map} +0 -0
- /package/dist/{chunk-PGYYVOM3.js.map → chunk-DVJRDY3H.js.map} +0 -0
- /package/dist/{chunk-UK2WVX5G.js.map → chunk-EB5TYC2Y.js.map} +0 -0
- /package/dist/{chunk-4LQKAWZJ.js.map → chunk-F2LYXOHK.js.map} +0 -0
- /package/dist/{chunk-UZFOWYAQ.js.map → chunk-USN554EK.js.map} +0 -0
- /package/dist/{dev-FUQFN7PQ.js.map → dev-GQ2CDBW2.js.map} +0 -0
- /package/dist/{internal-api-D4LIZ3S6.js.map → internal-api-G25P4TP2.js.map} +0 -0
- /package/dist/{internal-api-HXKRFUXR.js.map → internal-api-UBBHEPVE.js.map} +0 -0
- /package/dist/{mcp-7MSZDEKX.js.map → mcp-W2UGY4II.js.map} +0 -0
- /package/dist/{preview-CCL7SKCG.js.map → preview-3TLURUAL.js.map} +0 -0
- /package/dist/{server-boundary-QHWMBDKT.js.map → server-boundary-A5JNZ4ND.js.map} +0 -0
- /package/dist/{server-boundary-6PGQB5XT.js.map → server-boundary-JP6VHXAX.js.map} +0 -0
- /package/dist/{start-K4O5J7JA.js.map → start-JEYOON64.js.map} +0 -0
- /package/dist/{vite-plugin-675YOCHV.js.map → vite-plugin-VLDOBVIS.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./chunk-Q3UE7WIM.js";
|
|
2
|
-
import "./chunk-
|
|
2
|
+
import "./chunk-2BYN7WTW.js";
|
|
3
3
|
import "./chunk-EYRWD2AB.js";
|
|
4
4
|
import "./chunk-5GZROLDV.js";
|
|
5
5
|
import "./chunk-5AGNZXHJ.js";
|
|
@@ -24,7 +24,7 @@ import "./chunk-DV34VG3N.js";
|
|
|
24
24
|
import "./chunk-V6Y2SMRG.js";
|
|
25
25
|
import "./chunk-ACKBVBUI.js";
|
|
26
26
|
import "./chunk-IZ3TIL6K.js";
|
|
27
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-ICXXHV4V.js";
|
|
28
28
|
import "./chunk-YSJOZEI6.js";
|
|
29
29
|
import "./chunk-Z4PJMZLM.js";
|
|
30
30
|
import "./chunk-UMNXCU3K.js";
|
|
@@ -234,4 +234,4 @@ export const actions = manifest
|
|
|
234
234
|
export {
|
|
235
235
|
actionsVirtualModule
|
|
236
236
|
};
|
|
237
|
-
//# sourceMappingURL=actions-virtual-module-
|
|
237
|
+
//# sourceMappingURL=actions-virtual-module-AT6HNADR.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "tsx/esm";
|
|
3
|
-
import "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
import "./chunk-USN554EK.js";
|
|
4
|
+
import "./chunk-UETVDZBE.js";
|
|
5
5
|
import "./chunk-L4TB6FXQ.js";
|
|
6
6
|
import "./chunk-VV2VU3LJ.js";
|
|
7
7
|
import "./chunk-5VLP3GQ2.js";
|
|
@@ -218,4 +218,4 @@ export const actions = manifest
|
|
|
218
218
|
export {
|
|
219
219
|
actionsVirtualModule
|
|
220
220
|
};
|
|
221
|
-
//# sourceMappingURL=actions-virtual-module-
|
|
221
|
+
//# sourceMappingURL=actions-virtual-module-XJ6J6T4C.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mountAgent
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-2BYN7WTW.js";
|
|
4
4
|
import "../chunk-P6OS7652.js";
|
|
5
5
|
import "../chunk-ENRT6DAU.js";
|
|
6
6
|
import "../chunk-PVNMLZ5G.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "../chunk-KDP2HURW.js";
|
|
13
13
|
import {
|
|
14
14
|
resolveProvider
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-ICXXHV4V.js";
|
|
16
16
|
import "../chunk-UMNXCU3K.js";
|
|
17
17
|
import "../chunk-SOYOYGWY.js";
|
|
18
18
|
import "../chunk-ZWN3AODA.js";
|
|
@@ -3,8 +3,8 @@ import "tsx/esm";
|
|
|
3
3
|
import {
|
|
4
4
|
agentCommand,
|
|
5
5
|
createAgentSsrLoader
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-F2LYXOHK.js";
|
|
7
|
+
import "./chunk-UETVDZBE.js";
|
|
8
8
|
import "./chunk-5NNFO7R7.js";
|
|
9
9
|
import "./chunk-Z7CJHDLS.js";
|
|
10
10
|
import "./chunk-3QPVEJ7D.js";
|
|
@@ -12,4 +12,4 @@ export {
|
|
|
12
12
|
agentCommand,
|
|
13
13
|
createAgentSsrLoader
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=agent-
|
|
15
|
+
//# sourceMappingURL=agent-G525PHCO.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
scanControllerModules
|
|
3
3
|
} from "./chunk-Q3UE7WIM.js";
|
|
4
|
-
import "./chunk-
|
|
4
|
+
import "./chunk-2BYN7WTW.js";
|
|
5
5
|
import "./chunk-EYRWD2AB.js";
|
|
6
6
|
import "./chunk-5GZROLDV.js";
|
|
7
7
|
import "./chunk-5AGNZXHJ.js";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
import "./chunk-V6Y2SMRG.js";
|
|
29
29
|
import "./chunk-ACKBVBUI.js";
|
|
30
30
|
import "./chunk-IZ3TIL6K.js";
|
|
31
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-ICXXHV4V.js";
|
|
32
32
|
import "./chunk-YSJOZEI6.js";
|
|
33
33
|
import "./chunk-Z4PJMZLM.js";
|
|
34
34
|
import "./chunk-UMNXCU3K.js";
|
|
@@ -427,4 +427,4 @@ export {
|
|
|
427
427
|
generateClientDts,
|
|
428
428
|
shouldReemitForFile
|
|
429
429
|
};
|
|
430
|
-
//# sourceMappingURL=app-typed-client-
|
|
430
|
+
//# sourceMappingURL=app-typed-client-5B3IOU45.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "tsx/esm";
|
|
3
|
-
import "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
import "./chunk-USN554EK.js";
|
|
4
|
+
import "./chunk-UETVDZBE.js";
|
|
5
5
|
import {
|
|
6
6
|
scanControllerModules
|
|
7
7
|
} from "./chunk-L4TB6FXQ.js";
|
|
@@ -411,4 +411,4 @@ export {
|
|
|
411
411
|
generateClientDts,
|
|
412
412
|
shouldReemitForFile
|
|
413
413
|
};
|
|
414
|
-
//# sourceMappingURL=app-typed-client-
|
|
414
|
+
//# sourceMappingURL=app-typed-client-NTNYNJTW.js.map
|
|
@@ -554,7 +554,7 @@ async function buildCommand(options) {
|
|
|
554
554
|
`);
|
|
555
555
|
}
|
|
556
556
|
async function runAdapterBuild(target, config, cwd) {
|
|
557
|
-
const { theoPluginAsync } = await import("./vite-plugin-
|
|
557
|
+
const { theoPluginAsync } = await import("./vite-plugin-VLDOBVIS.js");
|
|
558
558
|
const { default: react } = await import("@vitejs/plugin-react");
|
|
559
559
|
const ctx = {
|
|
560
560
|
// `react()` may return Plugin or Plugin[] depending on version; spread the
|
|
@@ -676,4 +676,4 @@ function relativize3(absPath, root) {
|
|
|
676
676
|
export {
|
|
677
677
|
buildCommand
|
|
678
678
|
};
|
|
679
|
-
//# sourceMappingURL=build-
|
|
679
|
+
//# sourceMappingURL=build-CZAM7K6J.js.map
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-ZDCCILMP.js";
|
|
16
16
|
import {
|
|
17
17
|
processSingleton
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ICXXHV4V.js";
|
|
19
19
|
import {
|
|
20
20
|
newSpanId,
|
|
21
21
|
newTraceId
|
|
@@ -817,4 +817,4 @@ export {
|
|
|
817
817
|
parseAgentRequestBody,
|
|
818
818
|
mountAgent
|
|
819
819
|
};
|
|
820
|
-
//# sourceMappingURL=chunk-
|
|
820
|
+
//# sourceMappingURL=chunk-2BYN7WTW.js.map
|
|
@@ -25,10 +25,10 @@ import {
|
|
|
25
25
|
parseAgentRequestBody,
|
|
26
26
|
readAgentPolicy,
|
|
27
27
|
subjectFromContext
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-USN554EK.js";
|
|
29
29
|
import {
|
|
30
30
|
getApprovalRegistry
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-UETVDZBE.js";
|
|
32
32
|
import {
|
|
33
33
|
sendError,
|
|
34
34
|
validateCsrfRequest
|
|
@@ -867,4 +867,4 @@ export {
|
|
|
867
867
|
applyNonceToInlineScripts,
|
|
868
868
|
setupSsrDevMiddleware
|
|
869
869
|
};
|
|
870
|
-
//# sourceMappingURL=chunk-
|
|
870
|
+
//# sourceMappingURL=chunk-DRLYKXDD.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
serveMatchedAuxRoute,
|
|
13
13
|
serveThroughPluginLifecycle,
|
|
14
14
|
setupSsrDevMiddleware
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-DRLYKXDD.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveTheoRootDir
|
|
18
18
|
} from "./chunk-FDOOBTXJ.js";
|
|
@@ -38,11 +38,11 @@ import {
|
|
|
38
38
|
mountAgent,
|
|
39
39
|
readAgentPolicy,
|
|
40
40
|
writeWebResponseToServerResponse
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-USN554EK.js";
|
|
42
42
|
import {
|
|
43
43
|
getApprovalRegistry,
|
|
44
44
|
resolveProvider
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-UETVDZBE.js";
|
|
46
46
|
import {
|
|
47
47
|
createWebRequestSource,
|
|
48
48
|
dispatchControllerRequest,
|
|
@@ -2179,19 +2179,19 @@ async function theoPluginAsync(rootOrOptions) {
|
|
|
2179
2179
|
})
|
|
2180
2180
|
);
|
|
2181
2181
|
}
|
|
2182
|
-
const { appTypedClientPlugin } = await import("./app-typed-client-
|
|
2182
|
+
const { appTypedClientPlugin } = await import("./app-typed-client-NTNYNJTW.js");
|
|
2183
2183
|
const appClientPlugin = appTypedClientPlugin({
|
|
2184
2184
|
cwd: projectRoot,
|
|
2185
2185
|
serverDir: serverDirAbs,
|
|
2186
2186
|
distDir: resolve5(projectRoot, ".theokit")
|
|
2187
2187
|
});
|
|
2188
|
-
const { actionsVirtualModule } = await import("./actions-virtual-module-
|
|
2188
|
+
const { actionsVirtualModule } = await import("./actions-virtual-module-XJ6J6T4C.js");
|
|
2189
2189
|
const actionsPlugin = actionsVirtualModule({
|
|
2190
2190
|
serverDir: serverDirAbs,
|
|
2191
2191
|
distDir: resolve5(projectRoot, ".theokit")
|
|
2192
2192
|
});
|
|
2193
2193
|
const { agentsTypedClientPlugin } = await import("./agents-typed-client-D4OA2TXB.js");
|
|
2194
|
-
const { generateManifest } = await import("./internal-api-
|
|
2194
|
+
const { generateManifest } = await import("./internal-api-UBBHEPVE.js");
|
|
2195
2195
|
const agentsClientPlugin = agentsTypedClientPlugin({
|
|
2196
2196
|
projectRoot,
|
|
2197
2197
|
agentsDir: agentsDirName,
|
|
@@ -2208,7 +2208,7 @@ async function theoPluginAsync(rootOrOptions) {
|
|
|
2208
2208
|
const controllerTransformPlugin = controllerSwcTransformPlugin({
|
|
2209
2209
|
serverDir: serverDirAbs
|
|
2210
2210
|
});
|
|
2211
|
-
const { serverOnlyImportBoundary } = await import("./server-boundary-
|
|
2211
|
+
const { serverOnlyImportBoundary } = await import("./server-boundary-JP6VHXAX.js");
|
|
2212
2212
|
const serverBoundaryPlugin = serverOnlyImportBoundary({
|
|
2213
2213
|
projectRoot,
|
|
2214
2214
|
serverDir: serverDirAbs
|
|
@@ -2383,4 +2383,4 @@ export {
|
|
|
2383
2383
|
theoPluginAsync,
|
|
2384
2384
|
theoPlugin
|
|
2385
2385
|
};
|
|
2386
|
-
//# sourceMappingURL=chunk-
|
|
2386
|
+
//# sourceMappingURL=chunk-DVJRDY3H.js.map
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
securitySchema,
|
|
33
33
|
storageSchema,
|
|
34
34
|
uploadSchema
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-2BYN7WTW.js";
|
|
36
36
|
import {
|
|
37
37
|
broadcastToDevtools
|
|
38
38
|
} from "./chunk-OIGJOYX6.js";
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
} from "./chunk-YOIVCCZT.js";
|
|
101
101
|
import {
|
|
102
102
|
resolveProvider
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-ICXXHV4V.js";
|
|
104
104
|
import {
|
|
105
105
|
generateNonce
|
|
106
106
|
} from "./chunk-Z4PJMZLM.js";
|
|
@@ -3507,19 +3507,19 @@ async function theoPluginAsync(rootOrOptions) {
|
|
|
3507
3507
|
})
|
|
3508
3508
|
);
|
|
3509
3509
|
}
|
|
3510
|
-
const { appTypedClientPlugin } = await import("./app-typed-client-
|
|
3510
|
+
const { appTypedClientPlugin } = await import("./app-typed-client-5B3IOU45.js");
|
|
3511
3511
|
const appClientPlugin = appTypedClientPlugin({
|
|
3512
3512
|
cwd: projectRoot,
|
|
3513
3513
|
serverDir: serverDirAbs,
|
|
3514
3514
|
distDir: resolve10(projectRoot, ".theokit")
|
|
3515
3515
|
});
|
|
3516
|
-
const { actionsVirtualModule } = await import("./actions-virtual-module-
|
|
3516
|
+
const { actionsVirtualModule } = await import("./actions-virtual-module-AT6HNADR.js");
|
|
3517
3517
|
const actionsPlugin = actionsVirtualModule({
|
|
3518
3518
|
serverDir: serverDirAbs,
|
|
3519
3519
|
distDir: resolve10(projectRoot, ".theokit")
|
|
3520
3520
|
});
|
|
3521
3521
|
const { agentsTypedClientPlugin } = await import("./agents-typed-client-PVUZU65B.js");
|
|
3522
|
-
const { generateManifest } = await import("./internal-api-
|
|
3522
|
+
const { generateManifest } = await import("./internal-api-G25P4TP2.js");
|
|
3523
3523
|
const agentsClientPlugin = agentsTypedClientPlugin({
|
|
3524
3524
|
projectRoot,
|
|
3525
3525
|
agentsDir: agentsDirName,
|
|
@@ -3536,7 +3536,7 @@ async function theoPluginAsync(rootOrOptions) {
|
|
|
3536
3536
|
const controllerTransformPlugin = controllerSwcTransformPlugin({
|
|
3537
3537
|
serverDir: serverDirAbs
|
|
3538
3538
|
});
|
|
3539
|
-
const { serverOnlyImportBoundary } = await import("./server-boundary-
|
|
3539
|
+
const { serverOnlyImportBoundary } = await import("./server-boundary-A5JNZ4ND.js");
|
|
3540
3540
|
const serverBoundaryPlugin = serverOnlyImportBoundary({
|
|
3541
3541
|
projectRoot,
|
|
3542
3542
|
serverDir: serverDirAbs
|
|
@@ -3719,4 +3719,4 @@ export {
|
|
|
3719
3719
|
theoPluginAsync,
|
|
3720
3720
|
theoPlugin
|
|
3721
3721
|
};
|
|
3722
|
-
//# sourceMappingURL=chunk-
|
|
3722
|
+
//# sourceMappingURL=chunk-EB5TYC2Y.js.map
|
|
@@ -3,7 +3,7 @@ import "tsx/esm";
|
|
|
3
3
|
import {
|
|
4
4
|
getApprovalRegistry,
|
|
5
5
|
resolveProvider
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UETVDZBE.js";
|
|
7
7
|
import {
|
|
8
8
|
scanAgents
|
|
9
9
|
} from "./chunk-5NNFO7R7.js";
|
|
@@ -178,7 +178,7 @@ async function agentCommand(name, message, deps = {}) {
|
|
|
178
178
|
async function createAgentSsrLoader(projectRoot) {
|
|
179
179
|
const { createServer } = await import("vite");
|
|
180
180
|
const react = (await import("@vitejs/plugin-react")).default;
|
|
181
|
-
const { theoPluginAsync } = await import("./vite-plugin-
|
|
181
|
+
const { theoPluginAsync } = await import("./vite-plugin-VLDOBVIS.js");
|
|
182
182
|
const { loadConfig } = await import("./load-config-VMKOV44Y.js");
|
|
183
183
|
const config = await loadConfig(projectRoot);
|
|
184
184
|
const theoPlugins = await theoPluginAsync({
|
|
@@ -212,4 +212,4 @@ export {
|
|
|
212
212
|
agentCommand,
|
|
213
213
|
createAgentSsrLoader
|
|
214
214
|
};
|
|
215
|
-
//# sourceMappingURL=chunk-
|
|
215
|
+
//# sourceMappingURL=chunk-F2LYXOHK.js.map
|
|
@@ -104,9 +104,10 @@ function declaredPluginProviderFor(modelId, plugins) {
|
|
|
104
104
|
const profile = modelProviderProfileOf(plugin);
|
|
105
105
|
if (profile === void 0) continue;
|
|
106
106
|
if (profile.name !== prefix && !(profile.aliases ?? []).includes(prefix)) continue;
|
|
107
|
+
const needsCredential = profile.authType !== "none" && profile.envVars.length > 0;
|
|
107
108
|
return {
|
|
108
109
|
name: profile.name,
|
|
109
|
-
...
|
|
110
|
+
...needsCredential ? { envKey: profile.envVars[0] } : {},
|
|
110
111
|
baseUrl: profile.baseUrl,
|
|
111
112
|
// Last in the priority walk, and reachable only through the declared branch anyway: a plugin
|
|
112
113
|
// provider must never win a BARE model id away from an entry this project declares.
|
|
@@ -182,4 +183,4 @@ export {
|
|
|
182
183
|
resolveProvider,
|
|
183
184
|
tryResolveProvider
|
|
184
185
|
};
|
|
185
|
-
//# sourceMappingURL=chunk-
|
|
186
|
+
//# sourceMappingURL=chunk-ICXXHV4V.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server/_internal/process-singleton.ts","../src/server/agent/provider-resolver.ts"],"mappings":";AAgCA,IAAM,YAAY;AASX,SAAS,iBAAmC,KAAa,SAAqB;AACnF,QAAM,OAAO,uBAAO,IAAI,YAAY,GAAG;AACvC,QAAM,OAAO;AAEb,QAAM,WAAW,KAAK,IAAI;AAC1B,MAAI,aAAa,OAAW,QAAO;AAEnC,QAAM,UAAU,QAAQ;AACxB,OAAK,IAAI,IAAI;AACb,SAAO;AACT;;;ACuDA,IAAM,mBAAyC;AAAA,EAC7C;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,IACT,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,UAAU;AAAA,EACZ;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAME,MAAM;AAAA,IACN,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AACF;AAYA,SAAS,aAAmC;AAC1C,SAAO,iBAAiB,qBAAqB,MAAM,CAAC,GAAG,gBAAgB,CAAC;AAC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AA,IACnE;AAAA,EACF;AAcA,QAAM,qBAAqB,aAAa,SAAY,iBAAiB,OAAO,IAAI;AAChF,MAAI,uBAAuB,QAAW;AACpC,UAAM,IAAI;AAAA,MACR,UAAU,OAAO,OAAO,CAAC,wBAAwB,kBAAkB,qDACxC,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC,gDACf,kBAAkB;AAAA,IACpE;AAAA,EACF;AAIA,QAAM,eAAe,OAAO,OAAO,eAAe;AAElD,aAAW,QAAQ,cAAc;AAC/B,UAAM,SAAS,QAAQ,IAAI,KAAK,MAAM;AACtC,QAAI,UAAU,OAAO,SAAS,GAAG;AAC/B,eAAS,MAAM,mBAAmB,OAAO;AACzC,aAAO;AAAA,QACL,MAAM,KAAK;AAAA,QACX;AAAA,QACA,SAAS,UAAU,IAAI;AAAA,MACzB;AAAA,IACF;AAAA,EACF;AAQA,QAAM,UAAU,aAAa,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,MAAM;AAC7D,QAAM,IAAI;AAAA,IACR,6DAA6D,OAAO;AAAA,EAEtE;AACF;AAQO,SAAS,mBAAmB,SAA2C;AAC5E,MAAI;AACF,WAAO,gBAAgB,OAAO;AAAA,EAChC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -93,9 +93,10 @@ function declaredPluginProviderFor(modelId, plugins) {
|
|
|
93
93
|
const profile = modelProviderProfileOf(plugin);
|
|
94
94
|
if (profile === void 0) continue;
|
|
95
95
|
if (profile.name !== prefix && !(profile.aliases ?? []).includes(prefix)) continue;
|
|
96
|
+
const needsCredential = profile.authType !== "none" && profile.envVars.length > 0;
|
|
96
97
|
return {
|
|
97
98
|
name: profile.name,
|
|
98
|
-
...
|
|
99
|
+
...needsCredential ? { envKey: profile.envVars[0] } : {},
|
|
99
100
|
baseUrl: profile.baseUrl,
|
|
100
101
|
// Last in the priority walk, and reachable only through the declared branch anyway: a plugin
|
|
101
102
|
// provider must never win a BARE model id away from an entry this project declares.
|
|
@@ -217,4 +218,4 @@ export {
|
|
|
217
218
|
getApprovalRegistry,
|
|
218
219
|
resolveProvider
|
|
219
220
|
};
|
|
220
|
-
//# sourceMappingURL=chunk-
|
|
221
|
+
//# sourceMappingURL=chunk-UETVDZBE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server/_internal/process-singleton.ts","../src/server/agent/provider-resolver.ts","../src/server/agent/approval-registry.ts"],"sourcesContent":["/**\n * One object per PROCESS, whatever the bundler did to the module holding it.\n *\n * ## The defect this exists to remove\n *\n * A module-level `let x` gives one instance per **module instance**, and a bundler is free to place\n * the same source in more than one chunk. When it does, each chunk gets its own `x` and any state\n * written through one is invisible through the other.\n *\n * Measured in this repository's own `dist` (usetheokit/theokit#401) by grepping the built chunks for\n * each module's marker: `provider-resolver` lands in two chunks, and `approval-registry` in two.\n * Neither copy is redundant — one of the provider chunks is tree-shaken to `resolveProvider` and\n * does not carry `resetProviderRegistry` at all, which is precisely how the halves diverge: an\n * application calling `registerProvider` — public API, with a documented self-hosting example —\n * mutated the array in one chunk while `theokit start` resolved against the array in the other.\n *\n * The second is worse in kind, because `approval-registry.ts` states the requirement in its own\n * source: *\"the approval a request awaits and the approval the route resolves MUST be the same\n * object, so a single instance per process is not a convenience but a correctness requirement.\"* A\n * chunk boundary can break that silently, and the symptom would be a HITL pause that never resumes.\n *\n * ## Why `globalThis` and not better chunking\n *\n * Chunking is a bundler heuristic that changes between versions and with the shape of the import\n * graph. A fix that depends on tsup continuing to place this module in exactly one chunk is a fix\n * that holds until someone adds an import. `Symbol.for` gives a key that is equal across every\n * module instance in the realm, so identity stops depending on the build at all.\n *\n * @internal\n */\n\n/** Namespaced so a key cannot collide with an unrelated global. */\nconst NAMESPACE = 'theokit.singleton.'\n\n/**\n * The object registered under `key`, creating it with `factory` the first time.\n *\n * `factory` runs at most once per process. A later call with the same key returns what the first\n * call built and never replaces it — replacing it is the same defect wearing a different hat, since\n * two callers would again hold different objects.\n */\nexport function processSingleton<T extends object>(key: string, factory: () => T): T {\n const slot = Symbol.for(NAMESPACE + key)\n const host = globalThis as unknown as Record<symbol, T | undefined>\n\n const existing = host[slot]\n if (existing !== undefined) return existing\n\n const created = factory()\n host[slot] = created\n return created\n}\n","import { processSingleton } from '../_internal/process-singleton.js'\n\n/**\n * Provider Resolver — Strategy + Registry pattern (FAANG-grade).\n *\n * Inspiration: Dapr Conversation Registry (`dapr/pkg/components/conversation/registry.go`)\n * + Encore Manager provider array (`encore/runtimes/go/pubsub/manager_internal.go`).\n *\n * Principle: provider routing is the FRAMEWORK's responsibility, not the consumer's — but the\n * consumer still gets to SAY which provider it wants, and it says so in the model id.\n *\n * `provider/model` is the convention every agent in this ecosystem already writes\n * (`anthropic/claude-sonnet-4-6`, `openrouter/anthropic/claude-haiku-4.5`), and it is the one the\n * SDK routes on. Until theokit#326 this resolver ignored it entirely and picked by env-var\n * priority, so an agent that declared `anthropic/...` was handed an OpenRouter key whenever one\n * happened to be present — and every turn failed with `auth_failed (HTTP 401)` against a provider\n * nobody asked for. The declared provider now wins; priority is the fallback for a bare model id.\n *\n * Wire protocol: OpenAI Chat Completions (universal — implemented by every\n * os providers: OpenRouter, Groq, Mistral, Together, Anthropic via proxy, etc).\n *\n * Resolution by priority (FIRST match wins):\n * 1. OPENROUTER_API_KEY → baseUrl=openrouter.ai (multi-model gateway)\n * 2. OPENAI_API_KEY → baseUrl=api.openai.com\n * 3. ANTHROPIC_API_KEY → direct Anthropic (Messages API, not OpenAI-compat)\n *\n * Escape hatch: an explicit `options.apiKey` OVERRIDES auto-resolution\n * (the consumer can force a specific provider if it wants to).\n */\n\n/**\n * Provider configuration descriptor — Registry entry shape.\n *\n * @public\n */\nexport interface ProviderDescriptor {\n /** Stable name used internally — not exposed on the wire. */\n name: string\n /**\n * Environment variable that holds the API key for this provider.\n *\n * **Absent means the provider needs no credential** — a model running on the developer's own\n * machine has nothing to authenticate against. Such a provider is reachable ONLY when a model id\n * names it (`ollama/llama3.2`); it never participates in the priority walk, because the walk\n * reads \"this variable is set\" as \"a human configured this provider\", and a keyless entry offers\n * no equivalent signal. Including it would route every bare model id to localhost the moment no\n * cloud key was set (usetheokit/theokit#407).\n */\n envKey?: string\n /** Base URL for the provider's OpenAI-compatible (or native) API. */\n baseUrl: string\n /**\n * Environment variable that OVERRIDES {@link baseUrl} when set.\n *\n * Scoped honestly: every caller inside this framework takes `.apiKey` from the resolved provider\n * and discards `.baseUrl` (`cli/commands/start/handlers.ts`, `vite-plugin/api-middleware.ts`,\n * `cli/commands/agent.ts`), so the endpoint a request actually reaches is chosen by the SDK, from\n * its own profile — which reads `OLLAMA_HOST` itself. This field therefore does not redirect\n * traffic today.\n *\n * It exists so that the `baseUrl` this function REPORTS agrees with where the request goes, for\n * the consumers that read it — `resolveProvider` is public API, and a reported endpoint that\n * contradicts the real one is a debugging trap rather than a harmless inaccuracy.\n */\n baseUrlEnv?: string\n /**\n * True when this provider is a GATEWAY — it serves other providers' catalogs under their own\n * model ids, reachable by prefixing its name (`openrouter/openai/gpt-4o-mini`).\n *\n * It changes nothing about resolution. It exists so the refusal below can name a model id that\n * would work instead of only the variable that is missing (#554): a scaffold shipping\n * `openai/gpt-4o-mini` and an `.env.example` asking for `OPENROUTER_API_KEY` produced an error\n * naming `OPENAI_API_KEY` — the one key the reader was never told to get — while the key they had\n * serves that exact id through the gateway.\n *\n * Deliberately NOT a licence to substitute. Every caller here takes `.apiKey` and discards\n * `.baseUrl`; the SDK picks the endpoint from the model id (measured: `openai/gpt-4o-mini` →\n * `api.openai.com`, `openrouter/openai/gpt-4o-mini` → `openrouter.ai`). Handing an OpenRouter key\n * to a request bound for OpenAI is #326 exactly, so the caller changes the id and the routing\n * follows — the framework does not change it for them.\n */\n gateway?: boolean\n /** Resolution priority (lower = higher priority). FIRST match wins. */\n priority: number\n}\n\n/**\n * Resolved provider configuration — output of `resolveProvider()`.\n *\n * @public\n */\nexport interface ResolvedProvider {\n name: string\n apiKey: string\n baseUrl: string\n}\n\n/**\n * Default provider registry. Order = priority (first = highest).\n *\n * Adding a new provider:\n * 1. Append entry below (or register via `registerProvider()`).\n * 2. Set `envKey` matching the user's env var convention.\n * 3. Set `baseUrl` to the OpenAI-compat endpoint (or native if not compat).\n * 4. Provider name used in telemetry/logs only — never wire-exposed.\n */\nconst DEFAULT_REGISTRY: ProviderDescriptor[] = [\n {\n name: 'openrouter',\n envKey: 'OPENROUTER_API_KEY',\n baseUrl: 'https://openrouter.ai/api/v1',\n gateway: true,\n priority: 1,\n },\n {\n name: 'openai',\n envKey: 'OPENAI_API_KEY',\n baseUrl: 'https://api.openai.com/v1',\n priority: 2,\n },\n {\n name: 'anthropic',\n envKey: 'ANTHROPIC_API_KEY',\n baseUrl: 'https://api.anthropic.com',\n priority: 3,\n },\n {\n // Mirrors the profile `@theokit/sdk` already ships for this provider — same default host, same\n // override variable — so the two cannot disagree about where ollama is listening. The SDK is\n // what dials it (see `baseUrlEnv`); this entry's job is to stop the resolver from rejecting the\n // model before the SDK is ever reached. No `envKey`: see that field's doc comment for why the\n // absence also keeps this entry out of the priority walk.\n name: 'ollama',\n baseUrl: 'http://localhost:11434',\n baseUrlEnv: 'OLLAMA_HOST',\n priority: 100,\n },\n]\n\n/**\n * Runtime registry — copy of DEFAULT_REGISTRY mutable via registerProvider().\n * Sorted by priority on every resolve (stable, O(n log n) — n <= ~10 providers).\n *\n * Held per PROCESS rather than per module instance (usetheokit/theokit#401). As a module-level\n * `const` it was one array per chunk, and the bundler emits this module into two of them: an\n * application calling `registerProvider` mutated one array while `theokit start` resolved against\n * another, so the call had no effect and the resulting error listed the defaults while the\n * registered provider sat in an object nobody read.\n */\nfunction registryOf(): ProviderDescriptor[] {\n return processSingleton('provider-registry', () => [...DEFAULT_REGISTRY])\n}\n\n/**\n * Providers already announced, so a boot line does not become a per-request line.\n *\n * theokit#326 — resolution was silent on success. `resolveProvider` returns `{ name, apiKey,\n * baseUrl }` and every call site consumes only the key, so an operator could only learn which\n * provider was selected from an error message: exactly when it has already failed, and never in\n * the case that hurts most — a stale key that resolves cleanly and 401s at the provider.\n */\nconst announced = new Set<string>()\n\n/** Test-only reset, so announcement state does not leak between cases. @public */\nexport function resetProviderAnnouncements(): void {\n announced.clear()\n}\n\n/** Where the announcement goes, and what it may contain. @public */\nexport interface ResolveOptions {\n /** Receives one line per provider, at most once. NEVER receives the key. */\n announce?: (line: string) => void\n /**\n * The plugins the agent declared (`compiled.plugins`), consulted for a `model-provider` one when\n * this project's registry does not know the model's prefix (#579).\n *\n * Absent ⇒ registry-only, byte-unchanged. This is what keeps `.plugins(Provider.builtins())`\n * meaning something at resolution time without making every SDK builtin nameable by every app.\n */\n plugins?: readonly unknown[]\n}\n\n/**\n * Register a new provider (Registry pattern — runtime extension point).\n * Useful for self-hosted endpoints or custom providers without touching theokit src.\n *\n * @example\n * registerProvider({\n * name: 'self-hosted',\n * envKey: 'SELF_HOSTED_API_KEY',\n * baseUrl: 'https://llm.internal.acme.com/v1',\n * priority: 0, // highest priority\n * })\n *\n * @public\n */\nexport function registerProvider(descriptor: ProviderDescriptor): void {\n // Idempotent — replace existing by name.\n const registry = registryOf()\n const idx = registry.findIndex((p) => p.name === descriptor.name)\n if (idx >= 0) registry[idx] = descriptor\n else registry.push(descriptor)\n}\n\n/**\n * Reset registry to DEFAULT_REGISTRY (test-only / dev escape hatch).\n *\n * @public\n */\nexport function resetProviderRegistry(): void {\n const registry = registryOf()\n registry.length = 0\n registry.push(...DEFAULT_REGISTRY)\n}\n\n/**\n * Get current registry snapshot (read-only — inspection).\n *\n * @public\n */\nexport function listProviders(): readonly ProviderDescriptor[] {\n return [...registryOf()].sort((a, b) => a.priority - b.priority)\n}\n\n/**\n * Says which provider was selected, once.\n *\n * Carries the provider, HOW it was chosen, and the variable the credential came from — never the\n * credential. Which env var holds it is what an operator needs to fix a mis-selection; the value\n * is what a log must never hold.\n */\nfunction announce(\n desc: ProviderDescriptor,\n how: 'declared by the model' | 'by env priority',\n options: ResolveOptions | undefined,\n): void {\n if (announced.has(desc.name)) return\n announced.add(desc.name)\n const source = desc.envKey ?? 'none (this provider takes no credential)'\n const line = `[theokit] provider=${desc.name} (${how}) source=${source} baseUrl=${baseUrlOf(desc)}`\n if (options?.announce) options.announce(line)\n // `warn` rather than `info` because the repo's lint rule allows only `warn`/`error` — and this\n // line is closer to a warning in spirit anyway: it is the one chance an operator gets to notice\n // that the provider serving their agents is not the one they expected.\n else console.warn(line)\n}\n\n/**\n * Where this provider is listening, after any environment override.\n *\n * One function so the announcement line and the resolved config can never name different hosts —\n * an operator reading a log to find out where requests went must be reading the truth.\n */\nfunction baseUrlOf(desc: ProviderDescriptor): string {\n if (desc.baseUrlEnv === undefined) return desc.baseUrl\n const override = process.env[desc.baseUrlEnv]\n return override !== undefined && override.length > 0 ? override : desc.baseUrl\n}\n\n/**\n * The provider a model id declares, or `undefined` when it declares none.\n *\n * `provider/model` and `gateway/provider/model` both resolve on the FIRST segment: a gateway is a\n * provider from the framework's point of view (it holds the credential), and everything after it\n * is the upstream namespace the gateway itself routes on.\n *\n * A bare id (`gpt-4o-mini`, `qwen2.5:3b`) declares nothing, and an unregistered prefix is treated\n * the same way rather than as an error — a project may legitimately point a custom id at a\n * registered provider's endpoint, and refusing it here would break that before it reached the SDK.\n */\nfunction providerOf(\n modelId: string | undefined,\n registered: readonly ProviderDescriptor[],\n): ProviderDescriptor | undefined {\n const prefix = declaredPrefixOf(modelId)\n if (prefix === undefined) return undefined\n return registered.find((p) => p.name === prefix)\n}\n\n/**\n * The provider name a model id declares, registered or not.\n *\n * Split out of {@link providerOf} because the two questions differ exactly where the error message\n * used to go wrong: \"which registered provider is this?\" answers `undefined` both for a bare id and\n * for `groq/…`, and the resolver needs to tell those apart to say something true about the second.\n */\nfunction declaredPrefixOf(modelId: string | undefined): string | undefined {\n if (modelId === undefined) return undefined\n const slash = modelId.indexOf('/')\n if (slash <= 0) return undefined\n return modelId.slice(0, slash)\n}\n\n/**\n * The rest of the refusal: how to reach this model with a credential that IS present.\n *\n * A credentialed gateway serves the declared provider's catalog under the same id, so prefixing it\n * turns an unreachable model into a reachable one — and that string is what the reader needs, not\n * the abstract advice to \"change the prefix\". When no gateway is credentialed the sentence stays\n * exactly as it was: naming a gateway with no key would trade one dead end for another.\n *\n * A gateway is never offered for a model already routed through one — `openrouter/openrouter/…` is\n * not a thing — which is what excluding `declared` itself accomplishes.\n */\nfunction gatewayHint(\n declared: ProviderDescriptor,\n modelId: string,\n registered: readonly ProviderDescriptor[],\n): string {\n const gateway = registered.find(\n (p) =>\n p.gateway === true &&\n p.name !== declared.name &&\n p.envKey !== undefined &&\n (process.env[p.envKey] ?? '').length > 0,\n )\n if (gateway?.envKey === undefined) return `, or change the model's provider prefix`\n return (\n `, or use \"${gateway.name}/${modelId}\" to route it through ${gateway.name} ` +\n `(${gateway.envKey} is set, and ${gateway.name} serves this model id)`\n )\n}\n\n/** A provider that authenticates — the only kind the priority walk may select. */\ntype CredentialedProvider = ProviderDescriptor & { envKey: string }\n\nfunction takesCredential(desc: ProviderDescriptor): desc is CredentialedProvider {\n return desc.envKey !== undefined\n}\n\n/**\n * Resolve the provider for a model.\n *\n * When `modelId` declares a registered provider (`anthropic/…`), THAT provider's key is\n * required — no substitution. Otherwise the registry is walked by priority, first match wins.\n *\n * @returns ResolvedProvider with apiKey + baseUrl + name\n * @throws Error if NO provider env var is set (actionable message)\n *\n * @public\n */\n/**\n * What a keyless provider reports as its key.\n *\n * This was `''` until #501, on the reasoning that an empty string is the honest value for a\n * provider that needs no credential. The reasoning was sound and the value was wrong: the SDK's\n * `createLocalAgent` calls `resolveApiKey`, which treats `''` as ABSENT, falls back to\n * `THEOKIT_API_KEY` — which nobody sets for a local model — and throws `missing_api_key` before it\n * ever looks at the provider. So #407 opened the registry door and every keyless provider,\n * including the builtin `ollama`, still could not serve a turn.\n *\n * `'local'` is the SDK's own sentinel (`LOCAL_RUNTIME_MOCK_KEY`, `internal/auth/api-key-validator`).\n * It is not a placeholder credential and does not become one: `validateApiKeyShape` short-circuits\n * on it, and `mergeExplicitApiKey` excludes it from the credential pools, so it never reaches a\n * provider as an `authorization` header. That was the objection the old comment raised against any\n * non-empty value, and it is the reason this specific value is the one that answers it — measured\n * against @theokit/sdk 4.52.1, where `apiKey: ''` throws `missing_api_key` and `apiKey: 'local'`\n * builds the agent.\n */\nconst KEYLESS_API_KEY = 'local'\n\n/**\n * The provider a MODEL-PROVIDER PLUGIN THE AGENT DECLARED serves `modelId` with (#579).\n *\n * ## Why the agent's plugins and not the SDK's catalogue\n *\n * The first version of this asked `Provider.forModel` — the SDK's global builtin lookup — and that\n * is wrong in a way the suite caught immediately: `tests/unit/unregistered-prefix-is-refused-not-\n * rerouted.test.ts` uses `openai-chatgpt/gpt-5.4` as its example of a prefix that MUST be refused\n * (#503), because a turn must never succeed against a provider nobody named. Consulting the\n * catalogue makes every one of the SDK's 44 builtins nameable by any app, whether or not it asked\n * for them — the exact permissiveness #503 exists to forbid, reintroduced one level down.\n *\n * `.plugins(Provider.builtins())` IS the app naming them. So the question is not \"does the SDK know\n * this prefix\" but \"did this agent declare a provider that serves it\", and the answer is already in\n * `compiled.plugins`, which the caller passes in. An app that declared nothing keeps getting the\n * refusal, unchanged.\n *\n * ## The shape it reads\n *\n * A `model-provider` plugin carries `profile: { name, envVars, baseUrl }`. `envVars[0]` is the\n * credential when the profile names one; naming none means the provider does not authenticate by\n * environment — Codex refreshes OAuth per request inside the profile's own `transform.fetch` — and\n * that is the keyless class `ProviderDescriptor.envKey` already describes for `ollama` (#407).\n *\n * Structural, never imported: `@theokit/sdk` is an optional peer, and this module must keep\n * resolving its own four entries without it. The plugins arrive as `unknown` and are narrowed here.\n */\nfunction declaredPluginProviderFor(\n modelId: string,\n plugins: readonly unknown[] | undefined,\n): ProviderDescriptor | undefined {\n if (plugins === undefined) return undefined\n const prefix = declaredPrefixOf(modelId)\n if (prefix === undefined) return undefined\n\n for (const plugin of plugins) {\n const profile = modelProviderProfileOf(plugin)\n if (profile === undefined) continue\n // The profile's own name, plus the aliases it declares — the SDK routes on both, and reading\n // only `name` would refuse `codex/...` for a profile that lists it as an alias of itself.\n if (profile.name !== prefix && !(profile.aliases ?? []).includes(prefix)) continue\n return {\n name: profile.name,\n ...(profile.envVars.length > 0 ? { envKey: profile.envVars[0] } : {}),\n baseUrl: profile.baseUrl,\n // Last in the priority walk, and reachable only through the declared branch anyway: a plugin\n // provider must never win a BARE model id away from an entry this project declares.\n priority: Number.MAX_SAFE_INTEGER,\n }\n }\n return undefined\n}\n\n/** The `profile` of a value that is a model-provider plugin, or `undefined` for anything else. */\nfunction modelProviderProfileOf(plugin: unknown): ProviderProfileLike | undefined {\n if (typeof plugin !== 'object' || plugin === null) return undefined\n const candidate = plugin as { kind?: unknown; profile?: unknown }\n if (candidate.kind !== 'model-provider') return undefined\n const profile = candidate.profile\n if (typeof profile !== 'object' || profile === null) return undefined\n const shape = profile as Partial<ProviderProfileLike>\n if (typeof shape.name !== 'string' || typeof shape.baseUrl !== 'string') return undefined\n if (!Array.isArray(shape.envVars)) return undefined\n return shape as ProviderProfileLike\n}\n\n/**\n * The fields of the SDK's `ProviderProfile` this module reads.\n *\n * Structural rather than imported: importing the SDK's type would make an optional peer a\n * build-time dependency of a module that must work without it.\n */\ninterface ProviderProfileLike {\n name: string\n envVars: readonly string[]\n baseUrl: string\n aliases?: readonly string[]\n}\n\nexport function resolveProvider(modelId?: string, options?: ResolveOptions): ResolvedProvider {\n const sorted = [...registryOf()].sort((a, b) => a.priority - b.priority)\n\n // The local registry first, the SDK's builtins as the fallback for a prefix it does not know.\n const declared =\n modelId === undefined\n ? undefined\n : (providerOf(modelId, sorted) ?? declaredPluginProviderFor(modelId, options?.plugins))\n if (declared !== undefined && modelId !== undefined) {\n if (declared.envKey === undefined) {\n announce(declared, 'declared by the model', options)\n return { name: declared.name, apiKey: KEYLESS_API_KEY, baseUrl: baseUrlOf(declared) }\n }\n const apiKey = process.env[declared.envKey]\n if (apiKey && apiKey.length > 0) {\n announce(declared, 'declared by the model', options)\n return { name: declared.name, apiKey, baseUrl: baseUrlOf(declared) }\n }\n // Deliberately NOT falling back to another provider's key. Silently substituting one is how\n // theokit#326 produced a 401 nobody could attribute: the request went somewhere the agent\n // never named. Say which variable is missing and stop.\n //\n // #554 — but say it usefully. \"change the model's provider prefix\" is true and unactionable:\n // it does not say which prefix, and the reader may already hold a key that serves this model.\n throw new Error(\n `Model \"${modelId}\" declares provider \"${declared.name}\", but ${declared.envKey} is not set. ` +\n `Set ${declared.envKey}${gatewayHint(declared, modelId, sorted)}.`,\n )\n }\n\n // A prefix the registry does not know is a CHOICE, not a silence — refuse before the walk.\n //\n // `providerOf` returns `undefined` for an unregistered prefix, which is indistinguishable from a\n // bare model id, so the priority walk below used to claim the turn and the \"not registered\" error\n // further down became unreachable for anyone holding a key. The visible cost was a confusing\n // message; the real one was a turn that SUCCEEDED against a provider nobody named — different\n // endpoint, different account billed, prompt delivered to a vendor the operator had routed away\n // from, announced only by a `console.warn` that fires once per process (#503).\n //\n // #326 settled the principle for a registered provider: declared wins, priority is the fallback\n // for a bare model id. This extends it to the case #326 did not reach — an unregistered prefix is\n // not a bare model id either.\n const unregisteredPrefix = declared === undefined ? declaredPrefixOf(modelId) : undefined\n if (unregisteredPrefix !== undefined) {\n throw new Error(\n `Model \"${String(modelId)}\" declares provider \"${unregisteredPrefix}\", which is not registered. ` +\n `Registered providers: ${sorted.map((p) => p.name).join(', ')}. ` +\n `Register it with registerProvider({ name: '${unregisteredPrefix}', … }), or use a registered prefix.`,\n )\n }\n\n // Only providers that take a credential. A keyless entry is reachable exclusively through the\n // declared branch above; see `ProviderDescriptor.envKey` for why the walk cannot include it.\n const credentialed = sorted.filter(takesCredential)\n\n for (const desc of credentialed) {\n const apiKey = process.env[desc.envKey]\n if (apiKey && apiKey.length > 0) {\n announce(desc, 'by env priority', options)\n return {\n name: desc.name,\n apiKey,\n baseUrl: baseUrlOf(desc),\n }\n }\n }\n\n // Nothing resolved, and the model id declared nothing — the unregistered-prefix case was refused\n // above the walk, which is where it belongs (#503). This message is for the bare-id case only.\n //\n // It used to live here and it was the right message in the wrong place: reachable exactly when\n // the operator had no keys at all, which is the case that needed it least (usetheokit/theokit#407\n // is why the message exists; #503 is why it moved).\n const envKeys = credentialed.map((p) => p.envKey).join(' OR ')\n throw new Error(\n `No LLM provider API key found in environment. Set one of: ${envKeys}. ` +\n `Get a free OpenRouter key at https://openrouter.ai/keys (recommended — one key, many models).`,\n )\n}\n\n/**\n * Try to resolve — does NOT throw. Returns null if no provider available.\n * Useful for graceful degradation (e.g., mock mode).\n *\n * @public\n */\nexport function tryResolveProvider(modelId?: string): ResolvedProvider | null {\n try {\n return resolveProvider(modelId)\n } catch {\n return null\n }\n}\n","/**\n * M4 (theokit-ai-first) — the in-process HITL approval registry.\n *\n * The HITL plugin's `awaitApproval` calls `register(approvalId)` and awaits the returned Promise\n * (this is what genuinely PAUSES the SDK run — the SDK `pre_tool_call` hook is awaited). The\n * approve route calls `resolve(approvalId, approved)` to settle it. A per-approval timeout settles\n * the Promise deterministically per the `@HumanInTheLoop` `onTimeout` policy so a hung approval\n * never leaks the paused stream.\n *\n * Single-process contract (ADR 0038 / plan Drawback 2): a multi-instance deploy needs a shared\n * registry — the interface is injectable so a durable impl (Redis, etc.) slots in without touching\n * the harness. We do NOT build a durable store now (YAGNI).\n */\n// The timeout policy vocabulary is owned by the `@HumanInTheLoop` decorator (DRY / G12) — reuse it\n// rather than re-declaring the union, so the two can never drift.\nimport type { TimeoutAction } from '@theokit/agents'\n\nimport { processSingleton } from '../_internal/process-singleton.js'\n\nexport interface RegisterOptions {\n /** Milliseconds before the approval auto-settles per `onTimeout`. */\n timeoutMs: number\n /**\n * What a timeout means. Only `'proceed'` auto-approves; `'abort'` and `'retry'` both deny — the\n * registry does NOT implement retry semantics (a timed-out `'retry'` is a deny, not a re-prompt).\n */\n onTimeout: TimeoutAction\n /** M14 — the gated tool name, surfaced by `list()` (optional; absent for legacy callers). */\n toolName?: string\n /** M14 — the approval question, surfaced by `list()` (optional). */\n question?: string\n /**\n * Who the run belongs to — the `RouteSubject.id` admitted for it (B-016).\n *\n * Absent when the run had no identity to record, which is the `'public'` agent path:\n * `admitAgentRequest` deliberately does not resolve a subject when the policy is absent or\n * `'public'`, so there is nothing to attribute the approval to. Absent therefore means \"no owner\n * was established\", never \"anyone\", and the caller must branch on the difference — a rule that\n * refused when it is absent would start turning public agents away.\n *\n * Deliberately NOT surfaced by `list()`: that listing feeds a UI, and owner ids are identity.\n */\n owner?: string\n /**\n * M20 — an optional JSON-schema descriptor of the custom payload the approver may attach. Carried\n * verbatim into `list()` + the `approval_required` event so the UI knows what to collect. Kept as\n * a plain JSON object (not a live Zod schema) so the registry stays serializable and SDK-free.\n */\n payloadSchema?: Record<string, unknown>\n}\n\n/**\n * M20 — a settled HITL decision. `approved` is the allow/deny bit (backward-compatible with the\n * legacy boolean); `reason` + `payload` are the optional approver-attached extras that surface to\n * the model (on denial, via the veto message) and to the app/UI.\n */\nexport interface ApprovalDecision {\n approved: boolean\n reason?: string\n payload?: unknown\n /**\n * What settled this, when it was not a person (usetheokit/theokit#393).\n *\n * Absent means the decision arrived through `resolve()` — a human, or whatever the application\n * wired to that route. `'timeout'` means the window closed with nobody deciding and `onTimeout`\n * was applied.\n *\n * The distinction is the whole point of a HITL gate: without it an expired approval and an\n * explicit deny are byte-identical on the wire, and the sentence the caller gets — \"denied by\n * human approver\" — asserts a fact that did not happen. It is marked on the ALLOW side too:\n * `onTimeout: 'proceed'` permits the tool BECAUSE nobody answered, and recording that as a plain\n * approval is the same fabrication with the opposite sign.\n *\n * One member rather than `timedOut: boolean`, because the question is what settled it; a second\n * cause (a cancel, a shutdown) joins the union instead of adding another boolean.\n */\n settledBy?: 'timeout'\n}\n\n/** M14 — a pending approval as surfaced by {@link ApprovalRegistry.list}. */\nexport interface PendingApproval {\n approvalId: string\n toolName?: string\n question?: string\n /** Epoch millis when the pending approval auto-settles (registeredAt + timeoutMs). */\n expiresAt: number\n /** M20 — the declared custom-payload schema, if the gated tool declares one. */\n payloadSchema?: Record<string, unknown>\n}\n\nexport interface ApprovalRegistry {\n /**\n * Register a pending approval; the returned Promise settles with the full {@link ApprovalDecision}\n * on `resolve` or timeout (M20 — was a bare boolean pre-M20).\n */\n register(approvalId: string, opts: RegisterOptions): Promise<ApprovalDecision>\n /**\n * Settle a pending approval. Accepts a full {@link ApprovalDecision} OR a bare boolean (coerced to\n * `{ approved }` — backward-compatible). Returns false if the id is unknown or already settled.\n */\n resolve(approvalId: string, decision: boolean | ApprovalDecision): boolean\n /** M14 — list the currently-pending approvals (process-wide; single-process contract). */\n list(): PendingApproval[]\n /**\n * Who owns the pending approval `approvalId`, or `undefined` (B-016).\n *\n * `undefined` covers three cases the caller treats identically — never registered, already\n * settled, and registered without an owner — because in all three there is nothing to compare a\n * caller against.\n */\n ownerOf(approvalId: string): string | undefined\n}\n\ninterface Pending {\n settle: (decision: ApprovalDecision) => void\n timer: ReturnType<typeof setTimeout>\n info: PendingApproval\n /** Held beside `info` rather than inside it, so `list()` cannot leak it (B-016). */\n owner?: string\n}\n\n/**\n * The one process-wide registry the stream mount (`mountAgent`) and the approve route share.\n *\n * The in-process impl holds LIVE Promise resolvers in memory — the approval a request awaits and\n * the approval the route resolves MUST be the same object, so a single instance per process is not\n * a convenience but a correctness requirement. Lazily created; a durable/multi-instance deploy\n * swaps this accessor for a shared-store impl (ADR 0038 / plan Drawback 2) without touching callers.\n * Tests use {@link createInProcessApprovalRegistry} directly — never this singleton.\n */\nexport function getApprovalRegistry(): ApprovalRegistry {\n // Per PROCESS, not per module instance (usetheokit/theokit#401). The paragraph above calls a\n // single instance \"not a convenience but a correctness requirement\", and a module-level `let`\n // does not deliver that: it gives one instance per MODULE INSTANCE, and this module is emitted\n // into two chunks of the published bundle. A run awaiting an approval and the route resolving it\n // could hold different objects, and the symptom would be a HITL pause that never resumes.\n return processSingleton('approval-registry', () => createInProcessApprovalRegistry())\n}\n\nexport function createInProcessApprovalRegistry(): ApprovalRegistry {\n const pending = new Map<string, Pending>()\n\n return {\n register(approvalId, opts) {\n return new Promise<ApprovalDecision>((resolve) => {\n const settle = (decision: ApprovalDecision): void => {\n const entry = pending.get(approvalId)\n if (!entry) return\n clearTimeout(entry.timer)\n pending.delete(approvalId)\n resolve(decision)\n }\n // 'proceed' → allow on timeout; 'abort'/'retry' → deny on timeout.\n const timer = setTimeout(() => {\n settle({\n approved: opts.onTimeout === 'proceed',\n settledBy: 'timeout',\n // Every value in this sentence was already here and none of it used to survive the\n // settle. `onTimeout` is named because all three of its values reach this line and two\n // of them deny — an operator who wrote `'retry'` and got a denial had nothing to read\n // that mentioned retry.\n reason: `no decision within ${String(opts.timeoutMs)} ms; onTimeout: '${opts.onTimeout}' was applied`,\n })\n }, opts.timeoutMs)\n const info: PendingApproval = {\n approvalId,\n toolName: opts.toolName,\n question: opts.question,\n expiresAt: Date.now() + opts.timeoutMs,\n ...(opts.payloadSchema !== undefined ? { payloadSchema: opts.payloadSchema } : {}),\n }\n pending.set(approvalId, {\n settle,\n timer,\n info,\n ...(opts.owner !== undefined ? { owner: opts.owner } : {}),\n })\n })\n },\n resolve(approvalId, decision) {\n const entry = pending.get(approvalId)\n if (!entry) return false\n // M20 — coerce the legacy bare-boolean form to a decision object.\n entry.settle(typeof decision === 'boolean' ? { approved: decision } : decision)\n return true\n },\n list() {\n return [...pending.values()].map((p) => p.info)\n },\n ownerOf(approvalId) {\n // `settle` deletes the entry, so an approval that has been answered or timed out reports no\n // owner — which is what stops a later registration of the same id from inheriting one.\n return pending.get(approvalId)?.owner\n },\n }\n}\n"],"mappings":";;;;AAgCA,IAAM,YAAY;AASX,SAAS,iBAAmC,KAAa,SAAqB;AACnF,QAAM,OAAO,uBAAO,IAAI,YAAY,GAAG;AACvC,QAAM,OAAO;AAEb,QAAM,WAAW,KAAK,IAAI;AAC1B,MAAI,aAAa,OAAW,QAAO;AAEnC,QAAM,UAAU,QAAQ;AACxB,OAAK,IAAI,IA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K,cAAc,IAAI,CAAC;AAAA,QAClF;AACA,gBAAQ,IAAI,YAAY;AAAA,UACtB;AAAA,UACA;AAAA,UACA;AAAA,UACA,GAAI,KAAK,UAAU,SAAY,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;AAAA,QAC1D,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,IACA,QAAQ,YAAY,UAAU;AAC5B,YAAM,QAAQ,QAAQ,IAAI,UAAU;AACpC,UAAI,CAAC,MAAO,QAAO;AAEnB,YAAM,OAAO,OAAO,aAAa,YAAY,EAAE,UAAU,SAAS,IAAI,QAAQ;AAC9E,aAAO;AAAA,IACT;AAAA,IACA,OAAO;AACL,aAAO,CAAC,GAAG,QAAQ,OAAO,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI;AAAA,IAChD;AAAA,IACA,QAAQ,YAAY;AAGlB,aAAO,QAAQ,IAAI,UAAU,GAAG;AAAA,IAClC;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/server/_internal/process-singleton.ts","../src/server/agent/provider-resolver.ts","../src/server/agent/approval-registry.ts"],"sourcesContent":["/**\n * One object per PROCESS, whatever the bundler did to the module holding it.\n *\n * ## The defect this exists to remove\n *\n * A module-level `let x` gives one instance per **module instance**, and a bundler is free to place\n * the same source in more than one chunk. When it does, each chunk gets its own `x` and any state\n * written through one is invisible through the other.\n *\n * Measured in this repository's own `dist` (usetheokit/theokit#401) by grepping the built chunks for\n * each module's marker: `provider-resolver` lands in two chunks, and `approval-registry` in two.\n * Neither copy is redundant — one of the provider chunks is tree-shaken to `resolveProvider` and\n * does not carry `resetProviderRegistry` at all, which is precisely how the halves diverge: an\n * application calling `registerProvider` — public API, with a documented self-hosting example —\n * mutated the array in one chunk while `theokit start` resolved against the array in the other.\n *\n * The second is worse in kind, because `approval-registry.ts` states the requirement in its own\n * source: *\"the approval a request awaits and the approval the route resolves MUST be the same\n * object, so a single instance per process is not a convenience but a correctness requirement.\"* A\n * chunk boundary can break that silently, and the symptom would be a HITL pause that never resumes.\n *\n * ## Why `globalThis` and not better chunking\n *\n * Chunking is a bundler heuristic that changes between versions and with the shape of the import\n * graph. A fix that depends on tsup continuing to place this module in exactly one chunk is a fix\n * that holds until someone adds an import. `Symbol.for` gives a key that is equal across every\n * module instance in the realm, so identity stops depending on the build at all.\n *\n * @internal\n */\n\n/** Namespaced so a key cannot collide with an unrelated global. */\nconst NAMESPACE = 'theokit.singleton.'\n\n/**\n * The object registered under `key`, creating it with `factory` the first time.\n *\n * `factory` runs at most once per process. A later call with the same key returns what the first\n * call built and never replaces it — replacing it is the same defect wearing a different hat, since\n * two callers would again hold different objects.\n */\nexport function processSingleton<T extends object>(key: string, factory: () => T): T {\n const slot = Symbol.for(NAMESPACE + key)\n const host = globalThis as unknown as Record<symbol, T | undefined>\n\n const existing = host[slot]\n if (existing !== undefined) return existing\n\n const created = factory()\n host[slot] = created\n return created\n}\n","import { processSingleton } from '../_internal/process-singleton.js'\n\n/**\n * Provider Resolver — Strategy + Registry pattern (FAANG-grade).\n *\n * Inspiration: Dapr Conversation Registry (`dapr/pkg/components/conversation/registry.go`)\n * + Encore Manager provider array (`encore/runtimes/go/pubsub/manager_internal.go`).\n *\n * Principle: provider routing is the FRAMEWORK's responsibility, not the consumer's — but the\n * consumer still gets to SAY which provider it wants, and it says so in the model id.\n *\n * `provider/model` is the convention every agent in this ecosystem already writes\n * (`anthropic/claude-sonnet-4-6`, `openrouter/anthropic/claude-haiku-4.5`), and it is the one the\n * SDK routes on. Until theokit#326 this resolver ignored it entirely and picked by env-var\n * priority, so an agent that declared `anthropic/...` was handed an OpenRouter key whenever one\n * happened to be present — and every turn failed with `auth_failed (HTTP 401)` against a provider\n * nobody asked for. The declared provider now wins; priority is the fallback for a bare model id.\n *\n * Wire protocol: OpenAI Chat Completions (universal — implemented by every\n * os providers: OpenRouter, Groq, Mistral, Together, Anthropic via proxy, etc).\n *\n * Resolution by priority (FIRST match wins):\n * 1. OPENROUTER_API_KEY → baseUrl=openrouter.ai (multi-model gateway)\n * 2. OPENAI_API_KEY → baseUrl=api.openai.com\n * 3. ANTHROPIC_API_KEY → direct Anthropic (Messages API, not OpenAI-compat)\n *\n * Escape hatch: an explicit `options.apiKey` OVERRIDES auto-resolution\n * (the consumer can force a specific provider if it wants to).\n */\n\n/**\n * Provider configuration descriptor — Registry entry shape.\n *\n * @public\n */\nexport interface ProviderDescriptor {\n /** Stable name used internally — not exposed on the wire. */\n name: string\n /**\n * Environment variable that holds the API key for this provider.\n *\n * **Absent means the provider needs no credential** — a model running on the developer's own\n * machine has nothing to authenticate against. Such a provider is reachable ONLY when a model id\n * names it (`ollama/llama3.2`); it never participates in the priority walk, because the walk\n * reads \"this variable is set\" as \"a human configured this provider\", and a keyless entry offers\n * no equivalent signal. Including it would route every bare model id to localhost the moment no\n * cloud key was set (usetheokit/theokit#407).\n */\n envKey?: string\n /** Base URL for the provider's OpenAI-compatible (or native) API. */\n baseUrl: string\n /**\n * Environment variable that OVERRIDES {@link baseUrl} when set.\n *\n * Scoped honestly: every caller inside this framework takes `.apiKey` from the resolved provider\n * and discards `.baseUrl` (`cli/commands/start/handlers.ts`, `vite-plugin/api-middleware.ts`,\n * `cli/commands/agent.ts`), so the endpoint a request actually reaches is chosen by the SDK, from\n * its own profile — which reads `OLLAMA_HOST` itself. This field therefore does not redirect\n * traffic today.\n *\n * It exists so that the `baseUrl` this function REPORTS agrees with where the request goes, for\n * the consumers that read it — `resolveProvider` is public API, and a reported endpoint that\n * contradicts the real one is a debugging trap rather than a harmless inaccuracy.\n */\n baseUrlEnv?: string\n /**\n * True when this provider is a GATEWAY — it serves other providers' catalogs under their own\n * model ids, reachable by prefixing its name (`openrouter/openai/gpt-4o-mini`).\n *\n * It changes nothing about resolution. It exists so the refusal below can name a model id that\n * would work instead of only the variable that is missing (#554): a scaffold shipping\n * `openai/gpt-4o-mini` and an `.env.example` asking for `OPENROUTER_API_KEY` produced an error\n * naming `OPENAI_API_KEY` — the one key the reader was never told to get — while the key they had\n * serves that exact id through the gateway.\n *\n * Deliberately NOT a licence to substitute. Every caller here takes `.apiKey` and discards\n * `.baseUrl`; the SDK picks the endpoint from the model id (measured: `openai/gpt-4o-mini` →\n * `api.openai.com`, `openrouter/openai/gpt-4o-mini` → `openrouter.ai`). Handing an OpenRouter key\n * to a request bound for OpenAI is #326 exactly, so the caller changes the id and the routing\n * follows — the framework does not change it for them.\n */\n gateway?: boolean\n /** Resolution priority (lower = higher priority). FIRST match wins. */\n priority: number\n}\n\n/**\n * Resolved provider configuration — output of `resolveProvider()`.\n *\n * @public\n */\nexport interface ResolvedProvider {\n name: string\n apiKey: string\n baseUrl: string\n}\n\n/**\n * Default provider registry. Order = priority (first = highest).\n *\n * Adding a new provider:\n * 1. Append entry below (or register via `registerProvider()`).\n * 2. Set `envKey` matching the user's env var convention.\n * 3. Set `baseUrl` to the OpenAI-compat endpoint (or native if not compat).\n * 4. Provider name used in telemetry/logs only — never wire-exposed.\n */\nconst DEFAULT_REGISTRY: ProviderDescriptor[] = [\n {\n name: 'openrouter',\n envKey: 'OPENROUTER_API_KEY',\n baseUrl: 'https://openrouter.ai/api/v1',\n gateway: true,\n priority: 1,\n },\n {\n name: 'openai',\n envKey: 'OPENAI_API_KEY',\n baseUrl: 'https://api.openai.com/v1',\n priority: 2,\n },\n {\n name: 'anthropic',\n envKey: 'ANTHROPIC_API_KEY',\n baseUrl: 'https://api.anthropic.com',\n priority: 3,\n },\n {\n // Mirrors the profile `@theokit/sdk` already ships for this provider — same default host, same\n // override variable — so the two cannot disagree about where ollama is listening. The SDK is\n // what dials it (see `baseUrlEnv`); this entry's job is to stop the resolver from rejecting the\n // model before the SDK is ever reached. No `envKey`: see that field's doc comment for why the\n // absence also keeps this entry out of the priority walk.\n name: 'ollama',\n baseUrl: 'http://localhost:11434',\n baseUrlEnv: 'OLLAMA_HOST',\n priority: 100,\n },\n]\n\n/**\n * Runtime registry — copy of DEFAULT_REGISTRY mutable via registerProvider().\n * Sorted by priority on every resolve (stable, O(n log n) — n <= ~10 providers).\n *\n * Held per PROCESS rather than per module instance (usetheokit/theokit#401). As a module-level\n * `const` it was one array per chunk, and the bundler emits this module into two of them: an\n * application calling `registerProvider` mutated one array while `theokit start` resolved against\n * another, so the call had no effect and the resulting error listed the defaults while the\n * registered provider sat in an object nobody read.\n */\nfunction registryOf(): ProviderDescriptor[] {\n return processSingleton('provider-registry', () => [...DEFAULT_REGISTRY])\n}\n\n/**\n * Providers already announced, so a boot line does not become a per-request line.\n *\n * theokit#326 — resolution was silent on success. `resolveProvider` returns `{ name, apiKey,\n * baseUrl }` and every call site consumes only the key, so an operator could only learn which\n * provider was selected from an error message: exactly when it has already failed, and never in\n * the case that hurts most — a stale key that resolves cleanly and 401s at the provider.\n */\nconst announced = new Set<string>()\n\n/** Test-only reset, so announcement state does not leak between cases. @public */\nexport function resetProviderAnnouncements(): void {\n announced.clear()\n}\n\n/** Where the announcement goes, and what it may contain. @public */\nexport interface ResolveOptions {\n /** Receives one line per provider, at most once. NEVER receives the key. */\n announce?: (line: string) => void\n /**\n * The plugins the agent declared (`compiled.plugins`), consulted for a `model-provider` one when\n * this project's registry does not know the model's prefix (#579).\n *\n * Absent ⇒ registry-only, byte-unchanged. This is what keeps `.plugins(Provider.builtins())`\n * meaning something at resolution time without making every SDK builtin nameable by every app.\n */\n plugins?: readonly unknown[]\n}\n\n/**\n * Register a new provider (Registry pattern — runtime extension point).\n * Useful for self-hosted endpoints or custom providers without touching theokit src.\n *\n * @example\n * registerProvider({\n * name: 'self-hosted',\n * envKey: 'SELF_HOSTED_API_KEY',\n * baseUrl: 'https://llm.internal.acme.com/v1',\n * priority: 0, // highest priority\n * })\n *\n * @public\n */\nexport function registerProvider(descriptor: ProviderDescriptor): void {\n // Idempotent — replace existing by name.\n const registry = registryOf()\n const idx = registry.findIndex((p) => p.name === descriptor.name)\n if (idx >= 0) registry[idx] = descriptor\n else registry.push(descriptor)\n}\n\n/**\n * Reset registry to DEFAULT_REGISTRY (test-only / dev escape hatch).\n *\n * @public\n */\nexport function resetProviderRegistry(): void {\n const registry = registryOf()\n registry.length = 0\n registry.push(...DEFAULT_REGISTRY)\n}\n\n/**\n * Get current registry snapshot (read-only — inspection).\n *\n * @public\n */\nexport function listProviders(): readonly ProviderDescriptor[] {\n return [...registryOf()].sort((a, b) => a.priority - b.priority)\n}\n\n/**\n * Says which provider was selected, once.\n *\n * Carries the provider, HOW it was chosen, and the variable the credential came from — never the\n * credential. Which env var holds it is what an operator needs to fix a mis-selection; the value\n * is what a log must never hold.\n */\nfunction announce(\n desc: ProviderDescriptor,\n how: 'declared by the model' | 'by env priority',\n options: ResolveOptions | undefined,\n): void {\n if (announced.has(desc.name)) return\n announced.add(desc.name)\n const source = desc.envKey ?? 'none (this provider takes no credential)'\n const line = `[theokit] provider=${desc.name} (${how}) source=${source} baseUrl=${baseUrlOf(desc)}`\n if (options?.announce) options.announce(line)\n // `warn` rather than `info` because the repo's lint rule allows only `warn`/`error` — and this\n // line is closer to a warning in spirit anyway: it is the one chance an operator gets to notice\n // that the provider serving their agents is not the one they expected.\n else console.warn(line)\n}\n\n/**\n * Where this provider is listening, after any environment override.\n *\n * One function so the announcement line and the resolved config can never name different hosts —\n * an operator reading a log to find out where requests went must be reading the truth.\n */\nfunction baseUrlOf(desc: ProviderDescriptor): string {\n if (desc.baseUrlEnv === undefined) return desc.baseUrl\n const override = process.env[desc.baseUrlEnv]\n return override !== undefined && override.length > 0 ? override : desc.baseUrl\n}\n\n/**\n * The provider a model id declares, or `undefined` when it declares none.\n *\n * `provider/model` and `gateway/provider/model` both resolve on the FIRST segment: a gateway is a\n * provider from the framework's point of view (it holds the credential), and everything after it\n * is the upstream namespace the gateway itself routes on.\n *\n * A bare id (`gpt-4o-mini`, `qwen2.5:3b`) declares nothing, and an unregistered prefix is treated\n * the same way rather than as an error — a project may legitimately point a custom id at a\n * registered provider's endpoint, and refusing it here would break that before it reached the SDK.\n */\nfunction providerOf(\n modelId: string | undefined,\n registered: readonly ProviderDescriptor[],\n): ProviderDescriptor | undefined {\n const prefix = declaredPrefixOf(modelId)\n if (prefix === undefined) return undefined\n return registered.find((p) => p.name === prefix)\n}\n\n/**\n * The provider name a model id declares, registered or not.\n *\n * Split out of {@link providerOf} because the two questions differ exactly where the error message\n * used to go wrong: \"which registered provider is this?\" answers `undefined` both for a bare id and\n * for `groq/…`, and the resolver needs to tell those apart to say something true about the second.\n */\nfunction declaredPrefixOf(modelId: string | undefined): string | undefined {\n if (modelId === undefined) return undefined\n const slash = modelId.indexOf('/')\n if (slash <= 0) return undefined\n return modelId.slice(0, slash)\n}\n\n/**\n * The rest of the refusal: how to reach this model with a credential that IS present.\n *\n * A credentialed gateway serves the declared provider's catalog under the same id, so prefixing it\n * turns an unreachable model into a reachable one — and that string is what the reader needs, not\n * the abstract advice to \"change the prefix\". When no gateway is credentialed the sentence stays\n * exactly as it was: naming a gateway with no key would trade one dead end for another.\n *\n * A gateway is never offered for a model already routed through one — `openrouter/openrouter/…` is\n * not a thing — which is what excluding `declared` itself accomplishes.\n */\nfunction gatewayHint(\n declared: ProviderDescriptor,\n modelId: string,\n registered: readonly ProviderDescriptor[],\n): string {\n const gateway = registered.find(\n (p) =>\n p.gateway === true &&\n p.name !== declared.name &&\n p.envKey !== undefined &&\n (process.env[p.envKey] ?? '').length > 0,\n )\n if (gateway?.envKey === undefined) return `, or change the model's provider prefix`\n return (\n `, or use \"${gateway.name}/${modelId}\" to route it through ${gateway.name} ` +\n `(${gateway.envKey} is set, and ${gateway.name} serves this model id)`\n )\n}\n\n/** A provider that authenticates — the only kind the priority walk may select. */\ntype CredentialedProvider = ProviderDescriptor & { envKey: string }\n\nfunction takesCredential(desc: ProviderDescriptor): desc is CredentialedProvider {\n return desc.envKey !== undefined\n}\n\n/**\n * Resolve the provider for a model.\n *\n * When `modelId` declares a registered provider (`anthropic/…`), THAT provider's key is\n * required — no substitution. Otherwise the registry is walked by priority, first match wins.\n *\n * @returns ResolvedProvider with apiKey + baseUrl + name\n * @throws Error if NO provider env var is set (actionable message)\n *\n * @public\n */\n/**\n * What a keyless provider reports as its key.\n *\n * This was `''` until #501, on the reasoning that an empty string is the honest value for a\n * provider that needs no credential. The reasoning was sound and the value was wrong: the SDK's\n * `createLocalAgent` calls `resolveApiKey`, which treats `''` as ABSENT, falls back to\n * `THEOKIT_API_KEY` — which nobody sets for a local model — and throws `missing_api_key` before it\n * ever looks at the provider. So #407 opened the registry door and every keyless provider,\n * including the builtin `ollama`, still could not serve a turn.\n *\n * `'local'` is the SDK's own sentinel (`LOCAL_RUNTIME_MOCK_KEY`, `internal/auth/api-key-validator`).\n * It is not a placeholder credential and does not become one: `validateApiKeyShape` short-circuits\n * on it, and `mergeExplicitApiKey` excludes it from the credential pools, so it never reaches a\n * provider as an `authorization` header. That was the objection the old comment raised against any\n * non-empty value, and it is the reason this specific value is the one that answers it — measured\n * against @theokit/sdk 4.52.1, where `apiKey: ''` throws `missing_api_key` and `apiKey: 'local'`\n * builds the agent.\n */\nconst KEYLESS_API_KEY = 'local'\n\n/**\n * The provider a MODEL-PROVIDER PLUGIN THE AGENT DECLARED serves `modelId` with (#579).\n *\n * ## Why the agent's plugins and not the SDK's catalogue\n *\n * The first version of this asked `Provider.forModel` — the SDK's global builtin lookup — and that\n * is wrong in a way the suite caught immediately: `tests/unit/unregistered-prefix-is-refused-not-\n * rerouted.test.ts` uses `openai-chatgpt/gpt-5.4` as its example of a prefix that MUST be refused\n * (#503), because a turn must never succeed against a provider nobody named. Consulting the\n * catalogue makes every one of the SDK's 44 builtins nameable by any app, whether or not it asked\n * for them — the exact permissiveness #503 exists to forbid, reintroduced one level down.\n *\n * `.plugins(Provider.builtins())` IS the app naming them. So the question is not \"does the SDK know\n * this prefix\" but \"did this agent declare a provider that serves it\", and the answer is already in\n * `compiled.plugins`, which the caller passes in. An app that declared nothing keeps getting the\n * refusal, unchanged.\n *\n * ## The shape it reads\n *\n * A `model-provider` plugin carries `profile: { name, envVars, baseUrl }`. `envVars[0]` is the\n * credential when the profile names one; naming none means the provider does not authenticate by\n * environment — Codex refreshes OAuth per request inside the profile's own `transform.fetch` — and\n * that is the keyless class `ProviderDescriptor.envKey` already describes for `ollama` (#407).\n *\n * Structural, never imported: `@theokit/sdk` is an optional peer, and this module must keep\n * resolving its own four entries without it. The plugins arrive as `unknown` and are narrowed here.\n */\nfunction declaredPluginProviderFor(\n modelId: string,\n plugins: readonly unknown[] | undefined,\n): ProviderDescriptor | undefined {\n if (plugins === undefined) return undefined\n const prefix = declaredPrefixOf(modelId)\n if (prefix === undefined) return undefined\n\n for (const plugin of plugins) {\n const profile = modelProviderProfileOf(plugin)\n if (profile === undefined) continue\n // The profile's own name, plus the aliases it declares — the SDK routes on both, and reading\n // only `name` would refuse `codex/...` for a profile that lists it as an alias of itself.\n if (profile.name !== prefix && !(profile.aliases ?? []).includes(prefix)) continue\n // `authType`, not the length of `envVars` — see the docblock above (#585).\n const needsCredential = profile.authType !== 'none' && profile.envVars.length > 0\n return {\n name: profile.name,\n ...(needsCredential ? { envKey: profile.envVars[0] } : {}),\n baseUrl: profile.baseUrl,\n // Last in the priority walk, and reachable only through the declared branch anyway: a plugin\n // provider must never win a BARE model id away from an entry this project declares.\n priority: Number.MAX_SAFE_INTEGER,\n }\n }\n return undefined\n}\n\n/** The `profile` of a value that is a model-provider plugin, or `undefined` for anything else. */\nfunction modelProviderProfileOf(plugin: unknown): ProviderProfileLike | undefined {\n if (typeof plugin !== 'object' || plugin === null) return undefined\n const candidate = plugin as { kind?: unknown; profile?: unknown }\n if (candidate.kind !== 'model-provider') return undefined\n const profile = candidate.profile\n if (typeof profile !== 'object' || profile === null) return undefined\n const shape = profile as Partial<ProviderProfileLike>\n if (typeof shape.name !== 'string' || typeof shape.baseUrl !== 'string') return undefined\n if (!Array.isArray(shape.envVars)) return undefined\n return shape as ProviderProfileLike\n}\n\n/**\n * The fields of the SDK's `ProviderProfile` this module reads.\n *\n * Structural rather than imported: importing the SDK's type would make an optional peer a\n * build-time dependency of a module that must work without it.\n */\ninterface ProviderProfileLike {\n name: string\n envVars: readonly string[]\n baseUrl: string\n aliases?: readonly string[]\n /**\n * How the provider authenticates. `'none'` means it does not, whatever `envVars` names (#585).\n *\n * Optional here although the SDK's own type requires it: this module narrows a plugin from\n * `unknown`, so a value arriving without the field is representable and must not be assumed.\n */\n authType?: string\n}\n\nexport function resolveProvider(modelId?: string, options?: ResolveOptions): ResolvedProvider {\n const sorted = [...registryOf()].sort((a, b) => a.priority - b.priority)\n\n // The local registry first, the SDK's builtins as the fallback for a prefix it does not know.\n const declared =\n modelId === undefined\n ? undefined\n : (providerOf(modelId, sorted) ?? declaredPluginProviderFor(modelId, options?.plugins))\n if (declared !== undefined && modelId !== undefined) {\n if (declared.envKey === undefined) {\n announce(declared, 'declared by the model', options)\n return { name: declared.name, apiKey: KEYLESS_API_KEY, baseUrl: baseUrlOf(declared) }\n }\n const apiKey = process.env[declared.envKey]\n if (apiKey && apiKey.length > 0) {\n announce(declared, 'declared by the model', options)\n return { name: declared.name, apiKey, baseUrl: baseUrlOf(declared) }\n }\n // Deliberately NOT falling back to another provider's key. Silently substituting one is how\n // theokit#326 produced a 401 nobody could attribute: the request went somewhere the agent\n // never named. Say which variable is missing and stop.\n //\n // #554 — but say it usefully. \"change the model's provider prefix\" is true and unactionable:\n // it does not say which prefix, and the reader may already hold a key that serves this model.\n throw new Error(\n `Model \"${modelId}\" declares provider \"${declared.name}\", but ${declared.envKey} is not set. ` +\n `Set ${declared.envKey}${gatewayHint(declared, modelId, sorted)}.`,\n )\n }\n\n // A prefix the registry does not know is a CHOICE, not a silence — refuse before the walk.\n //\n // `providerOf` returns `undefined` for an unregistered prefix, which is indistinguishable from a\n // bare model id, so the priority walk below used to claim the turn and the \"not registered\" error\n // further down became unreachable for anyone holding a key. The visible cost was a confusing\n // message; the real one was a turn that SUCCEEDED against a provider nobody named — different\n // endpoint, different account billed, prompt delivered to a vendor the operator had routed away\n // from, announced only by a `console.warn` that fires once per process (#503).\n //\n // #326 settled the principle for a registered provider: declared wins, priority is the fallback\n // for a bare model id. This extends it to the case #326 did not reach — an unregistered prefix is\n // not a bare model id either.\n const unregisteredPrefix = declared === undefined ? declaredPrefixOf(modelId) : undefined\n if (unregisteredPrefix !== undefined) {\n throw new Error(\n `Model \"${String(modelId)}\" declares provider \"${unregisteredPrefix}\", which is not registered. ` +\n `Registered providers: ${sorted.map((p) => p.name).join(', ')}. ` +\n `Register it with registerProvider({ name: '${unregisteredPrefix}', … }), or use a registered prefix.`,\n )\n }\n\n // Only providers that take a credential. A keyless entry is reachable exclusively through the\n // declared branch above; see `ProviderDescriptor.envKey` for why the walk cannot include it.\n const credentialed = sorted.filter(takesCredential)\n\n for (const desc of credentialed) {\n const apiKey = process.env[desc.envKey]\n if (apiKey && apiKey.length > 0) {\n announce(desc, 'by env priority', options)\n return {\n name: desc.name,\n apiKey,\n baseUrl: baseUrlOf(desc),\n }\n }\n }\n\n // Nothing resolved, and the model id declared nothing — the unregistered-prefix case was refused\n // above the walk, which is where it belongs (#503). This message is for the bare-id case only.\n //\n // It used to live here and it was the right message in the wrong place: reachable exactly when\n // the operator had no keys at all, which is the case that needed it least (usetheokit/theokit#407\n // is why the message exists; #503 is why it moved).\n const envKeys = credentialed.map((p) => p.envKey).join(' OR ')\n throw new Error(\n `No LLM provider API key found in environment. Set one of: ${envKeys}. ` +\n `Get a free OpenRouter key at https://openrouter.ai/keys (recommended — one key, many models).`,\n )\n}\n\n/**\n * Try to resolve — does NOT throw. Returns null if no provider available.\n * Useful for graceful degradation (e.g., mock mode).\n *\n * @public\n */\nexport function tryResolveProvider(modelId?: string): ResolvedProvider | null {\n try {\n return resolveProvider(modelId)\n } catch {\n return null\n }\n}\n","/**\n * M4 (theokit-ai-first) — the in-process HITL approval registry.\n *\n * The HITL plugin's `awaitApproval` calls `register(approvalId)` and awaits the returned Promise\n * (this is what genuinely PAUSES the SDK run — the SDK `pre_tool_call` hook is awaited). The\n * approve route calls `resolve(approvalId, approved)` to settle it. A per-approval timeout settles\n * the Promise deterministically per the `@HumanInTheLoop` `onTimeout` policy so a hung approval\n * never leaks the paused stream.\n *\n * Single-process contract (ADR 0038 / plan Drawback 2): a multi-instance deploy needs a shared\n * registry — the interface is injectable so a durable impl (Redis, etc.) slots in without touching\n * the harness. We do NOT build a durable store now (YAGNI).\n */\n// The timeout policy vocabulary is owned by the `@HumanInTheLoop` decorator (DRY / G12) — reuse it\n// rather than re-declaring the union, so the two can never drift.\nimport type { TimeoutAction } from '@theokit/agents'\n\nimport { processSingleton } from '../_internal/process-singleton.js'\n\nexport interface RegisterOptions {\n /** Milliseconds before the approval auto-settles per `onTimeout`. */\n timeoutMs: number\n /**\n * What a timeout means. Only `'proceed'` auto-approves; `'abort'` and `'retry'` both deny — the\n * registry does NOT implement retry semantics (a timed-out `'retry'` is a deny, not a re-prompt).\n */\n onTimeout: TimeoutAction\n /** M14 — the gated tool name, surfaced by `list()` (optional; absent for legacy callers). */\n toolName?: string\n /** M14 — the approval question, surfaced by `list()` (optional). */\n question?: string\n /**\n * Who the run belongs to — the `RouteSubject.id` admitted for it (B-016).\n *\n * Absent when the run had no identity to record, which is the `'public'` agent path:\n * `admitAgentRequest` deliberately does not resolve a subject when the policy is absent or\n * `'public'`, so there is nothing to attribute the approval to. Absent therefore means \"no owner\n * was established\", never \"anyone\", and the caller must branch on the difference — a rule that\n * refused when it is absent would start turning public agents away.\n *\n * Deliberately NOT surfaced by `list()`: that listing feeds a UI, and owner ids are identity.\n */\n owner?: string\n /**\n * M20 — an optional JSON-schema descriptor of the custom payload the approver may attach. Carried\n * verbatim into `list()` + the `approval_required` event so the UI knows what to collect. Kept as\n * a plain JSON object (not a live Zod schema) so the registry stays serializable and SDK-free.\n */\n payloadSchema?: Record<string, unknown>\n}\n\n/**\n * M20 — a settled HITL decision. `approved` is the allow/deny bit (backward-compatible with the\n * legacy boolean); `reason` + `payload` are the optional approver-attached extras that surface to\n * the model (on denial, via the veto message) and to the app/UI.\n */\nexport interface ApprovalDecision {\n approved: boolean\n reason?: string\n payload?: unknown\n /**\n * What settled this, when it was not a person (usetheokit/theokit#393).\n *\n * Absent means the decision arrived through `resolve()` — a human, or whatever the application\n * wired to that route. `'timeout'` means the window closed with nobody deciding and `onTimeout`\n * was applied.\n *\n * The distinction is the whole point of a HITL gate: without it an expired approval and an\n * explicit deny are byte-identical on the wire, and the sentence the caller gets — \"denied by\n * human approver\" — asserts a fact that did not happen. It is marked on the ALLOW side too:\n * `onTimeout: 'proceed'` permits the tool BECAUSE nobody answered, and recording that as a plain\n * approval is the same fabrication with the opposite sign.\n *\n * One member rather than `timedOut: boolean`, because the question is what settled it; a second\n * cause (a cancel, a shutdown) joins the union instead of adding another boolean.\n */\n settledBy?: 'timeout'\n}\n\n/** M14 — a pending approval as surfaced by {@link ApprovalRegistry.list}. */\nexport interface PendingApproval {\n approvalId: string\n toolName?: string\n question?: string\n /** Epoch millis when the pending approval auto-settles (registeredAt + timeoutMs). */\n expiresAt: number\n /** M20 — the declared custom-payload schema, if the gated tool declares one. */\n payloadSchema?: Record<string, unknown>\n}\n\nexport interface ApprovalRegistry {\n /**\n * Register a pending approval; the returned Promise settles with the full {@link ApprovalDecision}\n * on `resolve` or timeout (M20 — was a bare boolean pre-M20).\n */\n register(approvalId: string, opts: RegisterOptions): Promise<ApprovalDecision>\n /**\n * Settle a pending approval. Accepts a full {@link ApprovalDecision} OR a bare boolean (coerced to\n * `{ approved }` — backward-compatible). Returns false if the id is unknown or already settled.\n */\n resolve(approvalId: string, decision: boolean | ApprovalDecision): boolean\n /** M14 — list the currently-pending approvals (process-wide; single-process contract). */\n list(): PendingApproval[]\n /**\n * Who owns the pending approval `approvalId`, or `undefined` (B-016).\n *\n * `undefined` covers three cases the caller treats identically — never registered, already\n * settled, and registered without an owner — because in all three there is nothing to compare a\n * caller against.\n */\n ownerOf(approvalId: string): string | undefined\n}\n\ninterface Pending {\n settle: (decision: ApprovalDecision) => void\n timer: ReturnType<typeof setTimeout>\n info: PendingApproval\n /** Held beside `info` rather than inside it, so `list()` cannot leak it (B-016). */\n owner?: string\n}\n\n/**\n * The one process-wide registry the stream mount (`mountAgent`) and the approve route share.\n *\n * The in-process impl holds LIVE Promise resolvers in memory — the approval a request awaits and\n * the approval the route resolves MUST be the same object, so a single instance per process is not\n * a convenience but a correctness requirement. Lazily created; a durable/multi-instance deploy\n * swaps this accessor for a shared-store impl (ADR 0038 / plan Drawback 2) without touching callers.\n * Tests use {@link createInProcessApprovalRegistry} directly — never this singleton.\n */\nexport function getApprovalRegistry(): ApprovalRegistry {\n // Per PROCESS, not per module instance (usetheokit/theokit#401). The paragraph above calls a\n // single instance \"not a convenience but a correctness requirement\", and a module-level `let`\n // does not deliver that: it gives one instance per MODULE INSTANCE, and this module is emitted\n // into two chunks of the published bundle. A run awaiting an approval and the route resolving it\n // could hold different objects, and the symptom would be a HITL pause that never resumes.\n return processSingleton('approval-registry', () => createInProcessApprovalRegistry())\n}\n\nexport function createInProcessApprovalRegistry(): ApprovalRegistry {\n const pending = new Map<string, Pending>()\n\n return {\n register(approvalId, opts) {\n return new Promise<ApprovalDecision>((resolve) => {\n const settle = (decision: ApprovalDecision): void => {\n const entry = pending.get(approvalId)\n if (!entry) return\n clearTimeout(entry.timer)\n pending.delete(approvalId)\n resolve(decision)\n }\n // 'proceed' → allow on timeout; 'abort'/'retry' → deny on timeout.\n const timer = setTimeout(() => {\n settle({\n approved: opts.onTimeout === 'proceed',\n settledBy: 'timeout',\n // Every value in this sentence was already here and none of it used to survive the\n // settle. `onTimeout` is named because all three of its values reach this line and two\n // of them deny — an operator who wrote `'retry'` and got a denial had nothing to read\n // that mentioned retry.\n reason: `no decision within ${String(opts.timeoutMs)} ms; onTimeout: '${opts.onTimeout}' was applied`,\n })\n }, opts.timeoutMs)\n const info: PendingApproval = {\n approvalId,\n toolName: opts.toolName,\n question: opts.question,\n expiresAt: Date.now() + opts.timeoutMs,\n ...(opts.payloadSchema !== undefined ? { payloadSchema: opts.payloadSchema } : {}),\n }\n pending.set(approvalId, {\n settle,\n timer,\n info,\n ...(opts.owner !== undefined ? { owner: opts.owner } : {}),\n })\n })\n },\n resolve(approvalId, decision) {\n const entry = pending.get(approvalId)\n if (!entry) return false\n // M20 — coerce the legacy bare-boolean form to a decision object.\n entry.settle(typeof decision === 'boolean' ? { approved: decision } : decision)\n return true\n },\n list() {\n return [...pending.values()].map((p) => p.info)\n },\n ownerOf(approvalId) {\n // `settle` deletes the entry, so an approval that has been answered or timed out reports no\n // owner — which is what stops a later registration of the same id from inheriting one.\n return pending.get(approvalId)?.owner\n },\n }\n}\n"],"mappings":";;;;AAgCA,IAAM,YAAY;AASX,SAAS,iBAAmC,KAAa,SAAqB;AACnF,QAAM,OAAO,uBAAO,IAAI,YAAY,GAAG;AACvC,QAAM,OAAO;AAEb,QAAM,WAAW,KAAK,IAAI;AAC1B,MAAI,aAAa,OAAW,QAAO;AAEnC,QAAM,UAAU,QAAQ;AACxB,OAAK,IAAI,IAAI;AACb,SAAO;AACT;;;ACuDA,IAAM,mBAAyC;AAAA,EAC7C;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,IACT,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,UAAU;AAAA,EACZ;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAME,MAAM;AAAA,IACN,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AACF;AAYA,SAAS,aAAmC;AAC1C,SAAO,iBAAiB,qBAAqB,MAAM,CAAC,GAAG,gBAAgB,CAAC;AAC1E;AAUA,IAAM,YAAY,oBAAI,IAAY;AAsElC,SAAS,SACP,MACA,KACA,SACM;AACN,MAAI,UAAU,IAA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;AACF;","names":[]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "tsx/esm";
|
|
3
3
|
import {
|
|
4
4
|
getApprovalRegistry
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UETVDZBE.js";
|
|
6
6
|
import {
|
|
7
7
|
createWebRequestSource,
|
|
8
8
|
dispatchCsrfWarn,
|
|
@@ -2633,4 +2633,4 @@ export {
|
|
|
2633
2633
|
CsrfReadinessStore,
|
|
2634
2634
|
applySecurityHeaders
|
|
2635
2635
|
};
|
|
2636
|
-
//# sourceMappingURL=chunk-
|
|
2636
|
+
//# sourceMappingURL=chunk-USN554EK.js.map
|
package/dist/cli/index.js
CHANGED
|
@@ -15,12 +15,12 @@ function cliVersion() {
|
|
|
15
15
|
// src/cli/index.ts
|
|
16
16
|
var cli = cac("theokit");
|
|
17
17
|
cli.command("dev", "Start development server").option("--port <port>", "Port number").action(async (options) => {
|
|
18
|
-
const { devCommand } = await import("../dev-
|
|
18
|
+
const { devCommand } = await import("../dev-GQ2CDBW2.js");
|
|
19
19
|
await devCommand({ port: options.port ? Number(options.port) : void 0 });
|
|
20
20
|
});
|
|
21
21
|
cli.command("build", "Build for production").option("--target <target>", "Deploy target (node, vercel, cloudflare)").action(async (options) => {
|
|
22
22
|
try {
|
|
23
|
-
const { buildCommand } = await import("../build-
|
|
23
|
+
const { buildCommand } = await import("../build-CZAM7K6J.js");
|
|
24
24
|
await buildCommand({ target: options.target });
|
|
25
25
|
} catch (err) {
|
|
26
26
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -32,7 +32,7 @@ cli.command("build", "Build for production").option("--target <target>", "Deploy
|
|
|
32
32
|
});
|
|
33
33
|
cli.command("start", "Start production server").option("--port <port>", "Port number").action(async (options) => {
|
|
34
34
|
try {
|
|
35
|
-
const { startCommand } = await import("../start-
|
|
35
|
+
const { startCommand } = await import("../start-JEYOON64.js");
|
|
36
36
|
await startCommand({ port: options.port ? Number(options.port) : void 0 });
|
|
37
37
|
} catch (err) {
|
|
38
38
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -44,7 +44,7 @@ cli.command("start", "Start production server").option("--port <port>", "Port nu
|
|
|
44
44
|
});
|
|
45
45
|
cli.command("preview", "Build for production, then serve it \u2014 one step (B-030)").option("--port <port>", "Port number").option("--target <target>", "Deploy target (node, vercel, cloudflare)").action(async (options) => {
|
|
46
46
|
try {
|
|
47
|
-
const { previewCommand } = await import("../preview-
|
|
47
|
+
const { previewCommand } = await import("../preview-3TLURUAL.js");
|
|
48
48
|
await previewCommand({
|
|
49
49
|
port: options.port ? Number(options.port) : void 0,
|
|
50
50
|
target: options.target
|
|
@@ -77,7 +77,7 @@ cli.command(
|
|
|
77
77
|
"Run an agent in the terminal (stream + tool calls + approval)"
|
|
78
78
|
).action(async (name, message) => {
|
|
79
79
|
try {
|
|
80
|
-
const { agentCommand } = await import("../agent-
|
|
80
|
+
const { agentCommand } = await import("../agent-G525PHCO.js");
|
|
81
81
|
const { sawError } = await agentCommand(name, message);
|
|
82
82
|
if (sawError) process.exit(1);
|
|
83
83
|
} catch (err) {
|
|
@@ -108,7 +108,7 @@ cli.command("agent sessions gc", "Collect old transcripts for this project (dry
|
|
|
108
108
|
});
|
|
109
109
|
cli.command("mcp <agent>", "Serve an agent as an MCP server over stdio (for desktop MCP clients)").action(async (agent) => {
|
|
110
110
|
try {
|
|
111
|
-
const { mcpCommand } = await import("../mcp-
|
|
111
|
+
const { mcpCommand } = await import("../mcp-W2UGY4II.js");
|
|
112
112
|
await mcpCommand(agent);
|
|
113
113
|
} catch (err) {
|
|
114
114
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
} from "./chunk-KTMQUYED.js";
|
|
12
12
|
import {
|
|
13
13
|
theoPluginAsync
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-DVJRDY3H.js";
|
|
15
|
+
import "./chunk-DRLYKXDD.js";
|
|
16
16
|
import "./chunk-2CVV6CNN.js";
|
|
17
17
|
import "./chunk-3PWQQWT6.js";
|
|
18
18
|
import "./chunk-FDOOBTXJ.js";
|
|
19
19
|
import "./chunk-47MM2JUK.js";
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-USN554EK.js";
|
|
21
|
+
import "./chunk-UETVDZBE.js";
|
|
22
22
|
import "./chunk-L4TB6FXQ.js";
|
|
23
23
|
import "./chunk-VV2VU3LJ.js";
|
|
24
24
|
import "./chunk-5VLP3GQ2.js";
|
|
@@ -128,4 +128,4 @@ export {
|
|
|
128
128
|
devCommand,
|
|
129
129
|
startDevServer
|
|
130
130
|
};
|
|
131
|
-
//# sourceMappingURL=dev-
|
|
131
|
+
//# sourceMappingURL=dev-GQ2CDBW2.js.map
|
package/dist/index.js
CHANGED
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
scanRoutes,
|
|
9
9
|
theoConfigSchema,
|
|
10
10
|
theoPlugin
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-EB5TYC2Y.js";
|
|
12
12
|
import "./chunk-7NRFZBAL.js";
|
|
13
13
|
import "./chunk-SSYDEKWF.js";
|
|
14
14
|
import "./chunk-Q3UE7WIM.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-2BYN7WTW.js";
|
|
16
16
|
import "./chunk-OIGJOYX6.js";
|
|
17
17
|
import "./chunk-U3SPBLJF.js";
|
|
18
18
|
import "./chunk-EYRWD2AB.js";
|
|
@@ -39,7 +39,7 @@ import "./chunk-V6Y2SMRG.js";
|
|
|
39
39
|
import "./chunk-ACKBVBUI.js";
|
|
40
40
|
import "./chunk-IZ3TIL6K.js";
|
|
41
41
|
import "./chunk-YOIVCCZT.js";
|
|
42
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-ICXXHV4V.js";
|
|
43
43
|
import "./chunk-YSJOZEI6.js";
|
|
44
44
|
import "./chunk-Z4PJMZLM.js";
|
|
45
45
|
import "./chunk-UMNXCU3K.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-Q3UE7WIM.js";
|
|
4
4
|
import {
|
|
5
5
|
mountAgent
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2BYN7WTW.js";
|
|
7
7
|
import {
|
|
8
8
|
CSP_REPORT_PATH,
|
|
9
9
|
CsrfReadinessStore,
|
|
@@ -64,7 +64,7 @@ import "./chunk-ACKBVBUI.js";
|
|
|
64
64
|
import "./chunk-IZ3TIL6K.js";
|
|
65
65
|
import {
|
|
66
66
|
resolveProvider
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-ICXXHV4V.js";
|
|
68
68
|
import "./chunk-YSJOZEI6.js";
|
|
69
69
|
import {
|
|
70
70
|
generateNonce
|
|
@@ -107,4 +107,4 @@ export {
|
|
|
107
107
|
scanWebSocketRoutes,
|
|
108
108
|
sendError
|
|
109
109
|
};
|
|
110
|
-
//# sourceMappingURL=internal-api-
|
|
110
|
+
//# sourceMappingURL=internal-api-G25P4TP2.js.map
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
handleCspReport,
|
|
17
17
|
handleCsrfReadiness,
|
|
18
18
|
mountAgent
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-USN554EK.js";
|
|
20
20
|
import {
|
|
21
21
|
resolveProvider
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-UETVDZBE.js";
|
|
23
23
|
import {
|
|
24
24
|
dispatchControllerRequest,
|
|
25
25
|
incomingMessageToHandlerRequest,
|
|
@@ -87,4 +87,4 @@ export {
|
|
|
87
87
|
scanWebSocketRoutes,
|
|
88
88
|
sendError
|
|
89
89
|
};
|
|
90
|
-
//# sourceMappingURL=internal-api-
|
|
90
|
+
//# sourceMappingURL=internal-api-UBBHEPVE.js.map
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import "tsx/esm";
|
|
3
3
|
import {
|
|
4
4
|
createAgentSsrLoader
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-F2LYXOHK.js";
|
|
6
6
|
import {
|
|
7
7
|
extractAppResources,
|
|
8
8
|
handleMcpJsonRpc
|
|
9
9
|
} from "./chunk-2CVV6CNN.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-UETVDZBE.js";
|
|
11
11
|
import {
|
|
12
12
|
scanAgents
|
|
13
13
|
} from "./chunk-5NNFO7R7.js";
|
|
@@ -75,4 +75,4 @@ async function mcpCommand(name, deps = {}) {
|
|
|
75
75
|
export {
|
|
76
76
|
mcpCommand
|
|
77
77
|
};
|
|
78
|
-
//# sourceMappingURL=mcp-
|
|
78
|
+
//# sourceMappingURL=mcp-W2UGY4II.js.map
|
|
@@ -4,8 +4,8 @@ import "tsx/esm";
|
|
|
4
4
|
// src/cli/commands/preview.ts
|
|
5
5
|
async function defaultSteps() {
|
|
6
6
|
const [{ buildCommand }, { startCommand }] = await Promise.all([
|
|
7
|
-
import("./build-
|
|
8
|
-
import("./start-
|
|
7
|
+
import("./build-CZAM7K6J.js"),
|
|
8
|
+
import("./start-JEYOON64.js")
|
|
9
9
|
]);
|
|
10
10
|
return {
|
|
11
11
|
build: (opts) => buildCommand(opts),
|
|
@@ -20,4 +20,4 @@ async function previewCommand(options = {}, steps) {
|
|
|
20
20
|
export {
|
|
21
21
|
previewCommand
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=preview-
|
|
23
|
+
//# sourceMappingURL=preview-3TLURUAL.js.map
|
package/dist/server/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
resolveTheoRootDir
|
|
3
3
|
} from "./chunk-7NRFZBAL.js";
|
|
4
4
|
import "./chunk-Q3UE7WIM.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-2BYN7WTW.js";
|
|
6
6
|
import "./chunk-EYRWD2AB.js";
|
|
7
7
|
import "./chunk-5GZROLDV.js";
|
|
8
8
|
import "./chunk-5AGNZXHJ.js";
|
|
@@ -27,7 +27,7 @@ import "./chunk-DV34VG3N.js";
|
|
|
27
27
|
import "./chunk-V6Y2SMRG.js";
|
|
28
28
|
import "./chunk-ACKBVBUI.js";
|
|
29
29
|
import "./chunk-IZ3TIL6K.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-ICXXHV4V.js";
|
|
31
31
|
import "./chunk-YSJOZEI6.js";
|
|
32
32
|
import "./chunk-Z4PJMZLM.js";
|
|
33
33
|
import "./chunk-UMNXCU3K.js";
|
|
@@ -147,4 +147,4 @@ export {
|
|
|
147
147
|
ServerOnlyImportError,
|
|
148
148
|
serverOnlyImportBoundary
|
|
149
149
|
};
|
|
150
|
-
//# sourceMappingURL=server-boundary-
|
|
150
|
+
//# sourceMappingURL=server-boundary-A5JNZ4ND.js.map
|
|
@@ -3,8 +3,8 @@ import "tsx/esm";
|
|
|
3
3
|
import {
|
|
4
4
|
resolveTheoRootDir
|
|
5
5
|
} from "./chunk-FDOOBTXJ.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-USN554EK.js";
|
|
7
|
+
import "./chunk-UETVDZBE.js";
|
|
8
8
|
import "./chunk-L4TB6FXQ.js";
|
|
9
9
|
import "./chunk-VV2VU3LJ.js";
|
|
10
10
|
import "./chunk-5VLP3GQ2.js";
|
|
@@ -131,4 +131,4 @@ export {
|
|
|
131
131
|
ServerOnlyImportError,
|
|
132
132
|
serverOnlyImportBoundary
|
|
133
133
|
};
|
|
134
|
-
//# sourceMappingURL=server-boundary-
|
|
134
|
+
//# sourceMappingURL=server-boundary-JP6VHXAX.js.map
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
resolveTransformer,
|
|
26
26
|
serveMatchedAuxRoute,
|
|
27
27
|
serveThroughPluginLifecycle
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-DRLYKXDD.js";
|
|
29
29
|
import "./chunk-2CVV6CNN.js";
|
|
30
30
|
import {
|
|
31
31
|
findRootDiv
|
|
@@ -41,11 +41,11 @@ import {
|
|
|
41
41
|
mountAgent,
|
|
42
42
|
readAgentPolicy,
|
|
43
43
|
writeWebResponseToServerResponse
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-USN554EK.js";
|
|
45
45
|
import {
|
|
46
46
|
getApprovalRegistry,
|
|
47
47
|
resolveProvider
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-UETVDZBE.js";
|
|
49
49
|
import {
|
|
50
50
|
createWebRequestSource,
|
|
51
51
|
dispatchControllerRequest,
|
|
@@ -1396,4 +1396,4 @@ export {
|
|
|
1396
1396
|
resolveSsrEntry,
|
|
1397
1397
|
startCommand
|
|
1398
1398
|
};
|
|
1399
|
-
//# sourceMappingURL=start-
|
|
1399
|
+
//# sourceMappingURL=start-JEYOON64.js.map
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
defineTheoIntegration,
|
|
6
6
|
theoPlugin,
|
|
7
7
|
theoPluginAsync
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-EB5TYC2Y.js";
|
|
9
9
|
import "../chunk-7NRFZBAL.js";
|
|
10
10
|
import "../chunk-SSYDEKWF.js";
|
|
11
11
|
import "../chunk-Q3UE7WIM.js";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-2BYN7WTW.js";
|
|
13
13
|
import "../chunk-OIGJOYX6.js";
|
|
14
14
|
import "../chunk-U3SPBLJF.js";
|
|
15
15
|
import "../chunk-EYRWD2AB.js";
|
|
@@ -36,7 +36,7 @@ import "../chunk-V6Y2SMRG.js";
|
|
|
36
36
|
import "../chunk-ACKBVBUI.js";
|
|
37
37
|
import "../chunk-IZ3TIL6K.js";
|
|
38
38
|
import "../chunk-YOIVCCZT.js";
|
|
39
|
-
import "../chunk-
|
|
39
|
+
import "../chunk-ICXXHV4V.js";
|
|
40
40
|
import "../chunk-YSJOZEI6.js";
|
|
41
41
|
import "../chunk-Z4PJMZLM.js";
|
|
42
42
|
import "../chunk-UMNXCU3K.js";
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
defineTheoIntegration,
|
|
8
8
|
theoPlugin,
|
|
9
9
|
theoPluginAsync
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-DVJRDY3H.js";
|
|
11
|
+
import "./chunk-DRLYKXDD.js";
|
|
12
12
|
import "./chunk-2CVV6CNN.js";
|
|
13
13
|
import "./chunk-3PWQQWT6.js";
|
|
14
14
|
import "./chunk-FDOOBTXJ.js";
|
|
15
15
|
import "./chunk-47MM2JUK.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-USN554EK.js";
|
|
17
|
+
import "./chunk-UETVDZBE.js";
|
|
18
18
|
import "./chunk-L4TB6FXQ.js";
|
|
19
19
|
import "./chunk-VV2VU3LJ.js";
|
|
20
20
|
import "./chunk-5VLP3GQ2.js";
|
|
@@ -40,4 +40,4 @@ export {
|
|
|
40
40
|
theoPlugin,
|
|
41
41
|
theoPluginAsync
|
|
42
42
|
};
|
|
43
|
-
//# sourceMappingURL=vite-plugin-
|
|
43
|
+
//# sourceMappingURL=vite-plugin-VLDOBVIS.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "theokit",
|
|
3
|
-
"version": "0.62.
|
|
3
|
+
"version": "0.62.1",
|
|
4
4
|
"description": "The TheoKit web framework — file-based routing, typed server surfaces, the Vite plugin, the CLI and the deploy adapters, around agents served from agents/*.ts.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -150,8 +150,8 @@
|
|
|
150
150
|
"typescript": "^5.9.3",
|
|
151
151
|
"vite": "^7.0.0",
|
|
152
152
|
"@theokit/agents": "^12.1.0",
|
|
153
|
-
"@theokit/
|
|
154
|
-
"@theokit/
|
|
153
|
+
"@theokit/presenter": "^0.8.0",
|
|
154
|
+
"@theokit/http": "^1.2.0"
|
|
155
155
|
},
|
|
156
156
|
"peerDependencies": {
|
|
157
157
|
"@theokit/sdk": "^4.52.1",
|
/package/dist/{actions-virtual-module-PBYOQTLB.js.map → actions-virtual-module-AT6HNADR.js.map}
RENAMED
|
File without changes
|
/package/dist/{actions-virtual-module-LXENSB3L.js.map → actions-virtual-module-XJ6J6T4C.js.map}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|