theokit 0.78.1 → 0.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/adapters/agent-mount.js +2 -2
- package/dist/{agent-IBDE65UJ.js → agent-OM47ZAIN.js} +2 -2
- package/dist/{build-WBQZWGED.js → build-TQAYRHJH.js} +4 -4
- package/dist/{chunk-3GM4GACM.js → chunk-2Z3GHQ64.js} +22 -9
- package/dist/{chunk-3GM4GACM.js.map → chunk-2Z3GHQ64.js.map} +1 -1
- package/dist/{chunk-7MCEJVGV.js → chunk-APUYC5BE.js} +2 -2
- package/dist/{chunk-ZWIKURA5.js → chunk-C5H2JHDW.js} +24 -11
- package/dist/chunk-C5H2JHDW.js.map +1 -0
- package/dist/{chunk-YM6ONZYE.js → chunk-CFJN5JHJ.js} +3 -3
- package/dist/{chunk-5UJRZC4J.js → chunk-H7Y4C2DO.js} +2 -2
- package/dist/{chunk-RAUYMVUO.js → chunk-JUJI3FZM.js} +81 -111
- package/dist/chunk-JUJI3FZM.js.map +1 -0
- package/dist/{chunk-PQWVT6JC.js → chunk-OS55GAM5.js} +9 -2
- package/dist/{chunk-PQWVT6JC.js.map → chunk-OS55GAM5.js.map} +1 -1
- package/dist/{chunk-IBZITTK7.js → chunk-QEVTZ3IH.js} +10 -3
- package/dist/chunk-QEVTZ3IH.js.map +1 -0
- package/dist/{chunk-FCBRWSBH.js → chunk-QKWBT7IY.js} +4 -4
- package/dist/{chunk-TQEE36VD.js → chunk-RN5NDLUS.js} +57 -45
- package/dist/{chunk-TQEE36VD.js.map → chunk-RN5NDLUS.js.map} +1 -1
- package/dist/{chunk-BDH5GKFZ.js → chunk-TF44PW3F.js} +43 -44
- package/dist/chunk-TF44PW3F.js.map +1 -0
- package/dist/{chunk-VSK5Y4ET.js → chunk-W55B6BRC.js} +2 -2
- package/dist/cli/index.js +12 -12
- package/dist/db-OHFGYI5J.js +120 -0
- package/dist/db-OHFGYI5J.js.map +1 -0
- package/dist/{dev-SCS6SPET.js → dev-CDCYJTDM.js} +7 -7
- package/dist/{docker-3ARABEZ2.js → docker-ED6W4ILB.js} +14 -9
- package/dist/docker-ED6W4ILB.js.map +1 -0
- package/dist/{generate-DAVXE5RV.js → generate-PFIEBKJC.js} +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -3
- package/dist/{info-AYTNH6YT.js → info-WP55WIB5.js} +3 -3
- package/dist/{load-config-YU5E76DL.js → load-config-2ND2LIRV.js} +3 -3
- package/dist/{mcp-UBGNYDMW.js → mcp-4OM4QSYT.js} +9 -6
- package/dist/mcp-4OM4QSYT.js.map +1 -0
- package/dist/{openapi-ICJB2RBE.js → openapi-POPJFXGI.js} +3 -3
- package/dist/{preview-USC6FF55.js → preview-C52WW62N.js} +3 -3
- package/dist/{routes-XYXXR72Z.js → routes-U6QTLLFA.js} +3 -3
- package/dist/{schema-2EAIJFWA.js → schema-YGNNE4H6.js} +2 -2
- package/dist/server/agent/index.d.ts +33 -69
- package/dist/server/agent/index.js +6 -2
- package/dist/server/cron/index.js +1 -1
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +7 -3
- package/dist/server/index.js.map +1 -1
- package/dist/{start-QCGCORTH.js → start-4NBJTPCR.js} +12 -10
- package/dist/start-4NBJTPCR.js.map +1 -0
- package/dist/vite-plugin/index.js +3 -3
- package/dist/{vite-plugin-JMWUVMP3.js → vite-plugin-CK5E4PA5.js} +6 -6
- package/package.json +6 -6
- package/dist/chunk-BDH5GKFZ.js.map +0 -1
- package/dist/chunk-IBZITTK7.js.map +0 -1
- package/dist/chunk-RAUYMVUO.js.map +0 -1
- package/dist/chunk-ZWIKURA5.js.map +0 -1
- package/dist/db-72T47G5S.js +0 -86
- package/dist/db-72T47G5S.js.map +0 -1
- package/dist/docker-3ARABEZ2.js.map +0 -1
- package/dist/mcp-UBGNYDMW.js.map +0 -1
- package/dist/start-QCGCORTH.js.map +0 -1
- /package/dist/{agent-IBDE65UJ.js.map → agent-OM47ZAIN.js.map} +0 -0
- /package/dist/{build-WBQZWGED.js.map → build-TQAYRHJH.js.map} +0 -0
- /package/dist/{chunk-7MCEJVGV.js.map → chunk-APUYC5BE.js.map} +0 -0
- /package/dist/{chunk-YM6ONZYE.js.map → chunk-CFJN5JHJ.js.map} +0 -0
- /package/dist/{chunk-5UJRZC4J.js.map → chunk-H7Y4C2DO.js.map} +0 -0
- /package/dist/{chunk-FCBRWSBH.js.map → chunk-QKWBT7IY.js.map} +0 -0
- /package/dist/{chunk-VSK5Y4ET.js.map → chunk-W55B6BRC.js.map} +0 -0
- /package/dist/{dev-SCS6SPET.js.map → dev-CDCYJTDM.js.map} +0 -0
- /package/dist/{generate-DAVXE5RV.js.map → generate-PFIEBKJC.js.map} +0 -0
- /package/dist/{info-AYTNH6YT.js.map → info-WP55WIB5.js.map} +0 -0
- /package/dist/{load-config-YU5E76DL.js.map → load-config-2ND2LIRV.js.map} +0 -0
- /package/dist/{openapi-ICJB2RBE.js.map → openapi-POPJFXGI.js.map} +0 -0
- /package/dist/{preview-USC6FF55.js.map → preview-C52WW62N.js.map} +0 -0
- /package/dist/{routes-XYXXR72Z.js.map → routes-U6QTLLFA.js.map} +0 -0
- /package/dist/{schema-2EAIJFWA.js.map → schema-YGNNE4H6.js.map} +0 -0
- /package/dist/{vite-plugin-JMWUVMP3.js.map → vite-plugin-CK5E4PA5.js.map} +0 -0
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
defineAgentTool
|
|
3
3
|
} from "./chunk-DVUJLMTF.js";
|
|
4
4
|
import {
|
|
5
|
-
handleMcpJsonRpc
|
|
6
|
-
|
|
5
|
+
handleMcpJsonRpc,
|
|
6
|
+
handleMcpToolsJsonRpc
|
|
7
|
+
} from "./chunk-RN5NDLUS.js";
|
|
7
8
|
|
|
8
9
|
// src/server/agent/workflow-tool.ts
|
|
9
10
|
import { z } from "zod";
|
|
@@ -53,14 +54,19 @@ var SIGKILL_WAIT_MS = 2e3;
|
|
|
53
54
|
var GROUP_POLL_MS = 20;
|
|
54
55
|
var OWN_PROCESS_GROUP = process.platform !== "win32";
|
|
55
56
|
var NodeAcpTransport = class {
|
|
56
|
-
constructor(command, args = [], cwd) {
|
|
57
|
+
constructor(command, args = [], cwd, env, onStderr) {
|
|
57
58
|
this.command = command;
|
|
58
59
|
this.proc = spawn(command, args, {
|
|
59
60
|
cwd,
|
|
60
|
-
|
|
61
|
+
...env === void 0 ? {} : { env },
|
|
62
|
+
stdio: ["pipe", "pipe", onStderr === void 0 ? "inherit" : "pipe"],
|
|
61
63
|
detached: OWN_PROCESS_GROUP
|
|
62
64
|
});
|
|
63
65
|
this.proc.stdout.setEncoding("utf8");
|
|
66
|
+
if (onStderr !== void 0 && this.proc.stderr !== null) {
|
|
67
|
+
this.proc.stderr.setEncoding("utf8");
|
|
68
|
+
this.proc.stderr.on("data", onStderr);
|
|
69
|
+
}
|
|
64
70
|
this.exited = new Promise((resolve2) => {
|
|
65
71
|
this.proc.once("exit", () => {
|
|
66
72
|
resolve2();
|
|
@@ -77,7 +83,7 @@ var NodeAcpTransport = class {
|
|
|
77
83
|
});
|
|
78
84
|
}
|
|
79
85
|
command;
|
|
80
|
-
// stdin=pipe, stdout=pipe, stderr=inherit
|
|
86
|
+
// stdin=pipe, stdout=pipe, stderr=inherit (null) or pipe (to the caller's sink).
|
|
81
87
|
proc;
|
|
82
88
|
closed;
|
|
83
89
|
listeners = [];
|
|
@@ -108,6 +114,7 @@ var NodeAcpTransport = class {
|
|
|
108
114
|
} finally {
|
|
109
115
|
this.proc.stdin.destroy();
|
|
110
116
|
this.proc.stdout.destroy();
|
|
117
|
+
this.proc.stderr?.destroy();
|
|
111
118
|
this.proc.unref();
|
|
112
119
|
}
|
|
113
120
|
}
|
|
@@ -210,7 +217,7 @@ var AcpTurnStoppedError = class extends Error {
|
|
|
210
217
|
};
|
|
211
218
|
var DEFAULT_ACP_TIMEOUT_MS = 6e5;
|
|
212
219
|
function defaultTransport(config) {
|
|
213
|
-
return new NodeAcpTransport(config.command, config.args, config.cwd);
|
|
220
|
+
return new NodeAcpTransport(config.command, config.args, config.cwd, config.env, config.onStderr);
|
|
214
221
|
}
|
|
215
222
|
var ACP_PROTOCOL_VERSION = 1;
|
|
216
223
|
function isRecord(value) {
|
|
@@ -228,11 +235,14 @@ function toAcpPermissionResponse(params, decision) {
|
|
|
228
235
|
return { outcome: { outcome: "cancelled" } };
|
|
229
236
|
}
|
|
230
237
|
function agentTextChunk(params, sessionId) {
|
|
231
|
-
if (!isRecord(params) || params.sessionId !== sessionId
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
238
|
+
if (!isRecord(params) || params.sessionId !== sessionId) return void 0;
|
|
239
|
+
return chunkText(params.update);
|
|
240
|
+
}
|
|
241
|
+
function chunkText(update) {
|
|
242
|
+
if (!isRecord(update) || update.sessionUpdate !== "agent_message_chunk") return void 0;
|
|
243
|
+
const { content } = update;
|
|
244
|
+
if (!isRecord(content) || content.type !== "text") return void 0;
|
|
245
|
+
return typeof content.text === "string" ? content.text : void 0;
|
|
236
246
|
}
|
|
237
247
|
function stepFailure(method, cause) {
|
|
238
248
|
if (cause instanceof AcpConnectionClosedError) {
|
|
@@ -292,18 +302,51 @@ async function runTurn(turn, cwd, message) {
|
|
|
292
302
|
if (stopReason !== "end_turn") throw new AcpTurnStoppedError(turn.command, stopReason, reply);
|
|
293
303
|
return reply;
|
|
294
304
|
}
|
|
295
|
-
function
|
|
296
|
-
if (typeof config.onPermissionRequest !== "function") {
|
|
297
|
-
throw new Error(
|
|
298
|
-
"[theokit] createACPTool requires onPermissionRequest (security by default \u2014 no default-allow)"
|
|
299
|
-
);
|
|
300
|
-
}
|
|
305
|
+
function resolveTimeoutMs(config) {
|
|
301
306
|
const timeoutMs = config.timeoutMs ?? DEFAULT_ACP_TIMEOUT_MS;
|
|
302
307
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
303
308
|
throw new RangeError(
|
|
304
309
|
`[theokit] createACPTool: timeoutMs must be a positive finite number of milliseconds (got ${String(timeoutMs)})`
|
|
305
310
|
);
|
|
306
311
|
}
|
|
312
|
+
return timeoutMs;
|
|
313
|
+
}
|
|
314
|
+
function linkAbort(turn, signal) {
|
|
315
|
+
const onAbort = () => turn.abort?.(signal?.reason);
|
|
316
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
317
|
+
return () => signal?.removeEventListener("abort", onAbort);
|
|
318
|
+
}
|
|
319
|
+
async function callAcpAgent(config, makeTransport, timeoutMs, input, ctx) {
|
|
320
|
+
const message = typeof input.message === "string" ? input.message : "";
|
|
321
|
+
const signal = ctx?.signal;
|
|
322
|
+
signal?.throwIfAborted();
|
|
323
|
+
const transport = makeTransport(config);
|
|
324
|
+
let unlink;
|
|
325
|
+
try {
|
|
326
|
+
const turn = {
|
|
327
|
+
client: new AcpClient(transport),
|
|
328
|
+
command: config.command,
|
|
329
|
+
timeoutMs,
|
|
330
|
+
signal
|
|
331
|
+
};
|
|
332
|
+
unlink = linkAbort(turn, signal);
|
|
333
|
+
turn.client.onRequest(
|
|
334
|
+
"session/request_permission",
|
|
335
|
+
async (params) => toAcpPermissionResponse(params, await config.onPermissionRequest(params))
|
|
336
|
+
);
|
|
337
|
+
return await runTurn(turn, resolve(config.cwd ?? process.cwd()), message);
|
|
338
|
+
} finally {
|
|
339
|
+
unlink?.();
|
|
340
|
+
await transport.close?.();
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function createACPTool(config) {
|
|
344
|
+
if (typeof config.onPermissionRequest !== "function") {
|
|
345
|
+
throw new Error(
|
|
346
|
+
"[theokit] createACPTool requires onPermissionRequest (security by default \u2014 no default-allow)"
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
const timeoutMs = resolveTimeoutMs(config);
|
|
307
350
|
const makeTransport = config.transportFactory ?? defaultTransport;
|
|
308
351
|
return {
|
|
309
352
|
name: config.name,
|
|
@@ -315,31 +358,7 @@ function createACPTool(config) {
|
|
|
315
358
|
},
|
|
316
359
|
required: ["message"]
|
|
317
360
|
},
|
|
318
|
-
handler:
|
|
319
|
-
const message = typeof input.message === "string" ? input.message : "";
|
|
320
|
-
const signal = ctx?.signal;
|
|
321
|
-
signal?.throwIfAborted();
|
|
322
|
-
const transport = makeTransport(config);
|
|
323
|
-
let onAbort;
|
|
324
|
-
try {
|
|
325
|
-
const turn = {
|
|
326
|
-
client: new AcpClient(transport),
|
|
327
|
-
command: config.command,
|
|
328
|
-
timeoutMs,
|
|
329
|
-
signal
|
|
330
|
-
};
|
|
331
|
-
onAbort = () => turn.abort?.(signal?.reason);
|
|
332
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
333
|
-
turn.client.onRequest(
|
|
334
|
-
"session/request_permission",
|
|
335
|
-
async (params) => toAcpPermissionResponse(params, await config.onPermissionRequest(params))
|
|
336
|
-
);
|
|
337
|
-
return await runTurn(turn, resolve(config.cwd ?? process.cwd()), message);
|
|
338
|
-
} finally {
|
|
339
|
-
if (onAbort !== void 0) signal?.removeEventListener("abort", onAbort);
|
|
340
|
-
await transport.close?.();
|
|
341
|
-
}
|
|
342
|
-
}
|
|
361
|
+
handler: (input, ctx) => callAcpAgent(config, makeTransport, timeoutMs, input, ctx)
|
|
343
362
|
};
|
|
344
363
|
}
|
|
345
364
|
|
|
@@ -384,72 +403,10 @@ function createVendorAgentTool(config) {
|
|
|
384
403
|
}
|
|
385
404
|
|
|
386
405
|
// src/server/agent/code-mode.ts
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
this.name = "CodeModePermissionDeniedError";
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
function describeToolInput(inputSchema) {
|
|
395
|
-
const props = inputSchema.properties ?? {};
|
|
396
|
-
const required = new Set(inputSchema.required ?? []);
|
|
397
|
-
const entries = Object.entries(props).map(([key, spec]) => {
|
|
398
|
-
const type = typeof spec.type === "string" ? spec.type : "unknown";
|
|
399
|
-
return `${key}${required.has(key) ? "" : "?"}: ${type}`;
|
|
400
|
-
});
|
|
401
|
-
return entries.length > 0 ? `{ ${entries.join(", ")} }` : "{}";
|
|
402
|
-
}
|
|
403
|
-
function generateCodeModeInstructions(tools, toolName) {
|
|
404
|
-
const calls = tools.map((t) => `- \`await api.${t.name}(${describeToolInput(t.inputSchema)})\` \u2014 ${t.description}`).join("\n");
|
|
405
|
-
return [
|
|
406
|
-
`The \`${toolName}\` tool runs your code in a sandbox. Your code may call ONLY these functions (each bridges to a real, validated tool on the host):`,
|
|
407
|
-
calls,
|
|
408
|
-
"Write an async function body that composes these calls and return exactly ONE structured result. Prefer `Promise.all` for independent calls; do arithmetic and aggregation in code, not in prose."
|
|
409
|
-
].join("\n\n");
|
|
410
|
-
}
|
|
411
|
-
function createCodeMode(config) {
|
|
412
|
-
if (typeof config.onPermissionRequest !== "function") {
|
|
413
|
-
throw new Error(
|
|
414
|
-
"createCodeMode requires onPermissionRequest (security by default \u2014 no default-allow for any tool)."
|
|
415
|
-
);
|
|
416
|
-
}
|
|
417
|
-
const sandboxRun = config.sandbox?.run;
|
|
418
|
-
if (typeof sandboxRun !== "function") {
|
|
419
|
-
throw new Error(
|
|
420
|
-
"createCodeMode requires an injected `sandbox` with a run() method (a vetted isolation boundary \u2014 never node:vm)."
|
|
421
|
-
);
|
|
422
|
-
}
|
|
423
|
-
if (config.tools.length === 0) {
|
|
424
|
-
throw new Error(
|
|
425
|
-
"createCodeMode requires a non-empty tools[] \u2014 the restricted API would be empty."
|
|
426
|
-
);
|
|
427
|
-
}
|
|
428
|
-
const api = {};
|
|
429
|
-
for (const tool2 of config.tools) {
|
|
430
|
-
api[tool2.name] = async (args) => {
|
|
431
|
-
const decision = await config.onPermissionRequest({ tool: tool2.name, args });
|
|
432
|
-
if (!decision.granted) throw new CodeModePermissionDeniedError(tool2.name, decision.reason);
|
|
433
|
-
return tool2.handler(args);
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
const name = config.name ?? "run_code";
|
|
437
|
-
const tool = {
|
|
438
|
-
name,
|
|
439
|
-
description: config.description ?? "Run code that composes the available tools. Only the declared tools are callable.",
|
|
440
|
-
inputSchema: {
|
|
441
|
-
type: "object",
|
|
442
|
-
properties: { code: { type: "string", description: "The code to run in the sandbox." } },
|
|
443
|
-
required: ["code"]
|
|
444
|
-
},
|
|
445
|
-
handler: async (input) => {
|
|
446
|
-
const code = typeof input.code === "string" ? input.code : "";
|
|
447
|
-
const result = await config.sandbox.run(code, api);
|
|
448
|
-
return typeof result === "string" ? result : JSON.stringify(result);
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
return { tool, instructions: generateCodeModeInstructions(config.tools, name) };
|
|
452
|
-
}
|
|
406
|
+
import {
|
|
407
|
+
CodeModePermissionDeniedError,
|
|
408
|
+
createCodeMode
|
|
409
|
+
} from "@theokit/agents/code-mode";
|
|
453
410
|
|
|
454
411
|
// src/server/agent/channel-webhook.ts
|
|
455
412
|
var CHANNEL_PATH = /^\/api\/agents\/([^/]+)\/channels\/([^/]+)\/webhook$/;
|
|
@@ -528,7 +485,7 @@ async function handleChannelWebhook(request, urlPath, config) {
|
|
|
528
485
|
import { streamAgentTurnInProcess, InProcessApprovalRequiredError } from "@theokit/agents";
|
|
529
486
|
|
|
530
487
|
// src/server/agent/mcp-stdio.ts
|
|
531
|
-
async function
|
|
488
|
+
async function answerLine(line, respond) {
|
|
532
489
|
const trimmed = line.trim();
|
|
533
490
|
if (trimmed.length === 0) return null;
|
|
534
491
|
let body;
|
|
@@ -541,10 +498,13 @@ async function handleMcpStdioLine(line, mod, name, appResources = []) {
|
|
|
541
498
|
error: { code: -32700, message: "Parse error" }
|
|
542
499
|
});
|
|
543
500
|
}
|
|
544
|
-
const response = await
|
|
501
|
+
const response = await respond(body);
|
|
545
502
|
const payload = await response.json();
|
|
546
503
|
return JSON.stringify(payload);
|
|
547
504
|
}
|
|
505
|
+
function handleMcpStdioLine(line, mod, name, appResources = []) {
|
|
506
|
+
return answerLine(line, (body) => handleMcpJsonRpc(mod, name, body, appResources));
|
|
507
|
+
}
|
|
548
508
|
async function serveMcpStdio(mod, name, appResources, streams) {
|
|
549
509
|
for await (const line of streams.lines) {
|
|
550
510
|
const out = await handleMcpStdioLine(line, mod, name, appResources);
|
|
@@ -552,6 +512,15 @@ async function serveMcpStdio(mod, name, appResources, streams) {
|
|
|
552
512
|
`);
|
|
553
513
|
}
|
|
554
514
|
}
|
|
515
|
+
async function serveMcpToolsStdio(tools, name, streams) {
|
|
516
|
+
const respond = (body) => handleMcpToolsJsonRpc(tools, name, body);
|
|
517
|
+
await respond(null);
|
|
518
|
+
for await (const line of streams.lines) {
|
|
519
|
+
const out = await answerLine(line, respond);
|
|
520
|
+
if (out !== null) streams.write(`${out}
|
|
521
|
+
`);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
555
524
|
|
|
556
525
|
export {
|
|
557
526
|
createWorkflowTool,
|
|
@@ -569,7 +538,8 @@ export {
|
|
|
569
538
|
handleChannelWebhook,
|
|
570
539
|
handleMcpStdioLine,
|
|
571
540
|
serveMcpStdio,
|
|
541
|
+
serveMcpToolsStdio,
|
|
572
542
|
streamAgentTurnInProcess,
|
|
573
543
|
InProcessApprovalRequiredError
|
|
574
544
|
};
|
|
575
|
-
//# sourceMappingURL=chunk-
|
|
545
|
+
//# sourceMappingURL=chunk-JUJI3FZM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server/agent/workflow-tool.ts","../src/server/agent/acp-tool.ts","../src/server/agent/node-acp-transport.ts","../src/server/agent/vendor-agent-tool.ts","../src/server/agent/code-mode.ts","../src/server/agent/channel-webhook.ts","../src/server/agent/index.ts","../src/server/agent/mcp-stdio.ts"],"mappings":";;;;;;;;;AASA,SAAS,SAAS;AAuBlB,IAAM,mBAAmB,oBAAI,IAAI,CAAC,UAAU,SAAS,aAAa,UAAU,CAAC;AAOtE,SAAS,mBAAmB,UAAwB,QAAwC;AACjG,QAAM,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AChD,CAAC;AACH;;;ACzHA,SAAS,0BAA0B,sCAAsC;;;AClBzE,eAAe,WACb,MACA,SACwB;AACxB,QAAM,UAAU,KAAK,KAAK;AAC1B,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,MAAI;AACJ,MAAI;AACF,WAAO,KAAK,MAAM,OAAO;AAAA,EAC3B,QAAQ;AACN,WAAO,KAAK,UAAU;AAAA,MACpB,SAAS;AAAA,MACT,IAAI;AAAA,MACJ,OAAO,EAAE,MAAM,QAAQ,SAAS,cAAc;AAAA,IAChD,CAAC;AAAA,EACH;AACA,QAAM,WAAW,MAAM,QAAQ,IAAI;AACnC,QAAM,UAAmB,MAAM,SAAS,KAAK;AAC7C,SAAO,KAAK,UAAU,OAAO;AAC/B;AAOO,SAAS,mBACd,MACA,KACA,MACA,eAAuC,CAAC,GAChB;AACxB,SAAO,WAAW,MAAM,CAAC,SAAS,iBAAiB,KAAK,MAAM,MAAM,YAAY,CAAC;AACnF;AAcA,eAAsB,cACpB,KACA,MACA,cACA,SACe;AACf,mBAAiB,QAAQ,QAAQ,OAAO;AACtC,UAAM,MAAM,MAAM,mBAAmB,MAAM,KAAK,MAAM,YAAY;AAClE,QAAI,QAAQ,KAAM,SAAQ,MAAM,GAAG,GAAG;AAAA,CAAI;AAAA,EAC5C;AACF;AAOA,eAAsB,mBACpB,OACA,MACA,SACe;AACf,QAAM,UAAU,CAAC,SAAqC,sBAAsB,OAAO,MAAM,IAAI;AAE7F,QAAM,QAAQ,IAAI;AAClB,mBAAiB,QAAQ,QAAQ,OAAO;AACtC,UAAM,MAAM,MAAM,WAAW,MAAM,OAAO;AAC1C,QAAI,QAAQ,KAAM,SAAQ,MAAM,GAAG,GAAG;AAAA,CAAI;AAAA,EAC5C;AACF;","names":["resolve","resolve"]}
|
|
@@ -257,7 +257,14 @@ var theoConfigSchema = z.object({
|
|
|
257
257
|
/** Jobs leased per poll. */
|
|
258
258
|
batchSize: z.number().int().positive().default(10),
|
|
259
259
|
/** Lease duration per job; a job still running after it can be leased again. */
|
|
260
|
-
lockSeconds: z.number().int().positive().default(30)
|
|
260
|
+
lockSeconds: z.number().int().positive().default(30),
|
|
261
|
+
/**
|
|
262
|
+
* How long SIGTERM waits for the job in progress to finish before `theokit start`
|
|
263
|
+
* closes its storage and exits (usetheokit/theokit#1292). Raise it for jobs that run
|
|
264
|
+
* longer than 20 seconds, and give the process manager a longer grace period too
|
|
265
|
+
* (systemd `TimeoutStopSec`, Kubernetes `terminationGracePeriodSeconds`).
|
|
266
|
+
*/
|
|
267
|
+
shutdownTimeoutMs: z.number().int().positive().default(2e4)
|
|
261
268
|
}).prefault({})
|
|
262
269
|
}).optional(),
|
|
263
270
|
/**
|
|
@@ -357,4 +364,4 @@ var theoConfigSchema = z.object({
|
|
|
357
364
|
export {
|
|
358
365
|
theoConfigSchema
|
|
359
366
|
};
|
|
360
|
-
//# sourceMappingURL=chunk-
|
|
367
|
+
//# sourceMappingURL=chunk-OS55GAM5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config/schema.ts","../src/core/contracts/theo-ui-theme.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { THEME_NAME_PATTERN } from '../core/contracts/theo-ui-theme.js'\nimport { servicesConfigSchema } from '../services/index.js'\n\nimport {\n cacheSchema,\n loggingSchema,\n observabilitySchema,\n rateLimitSchema,\n securitySchema,\n storageSchema,\n uploadSchema,\n type FormatErrorContext,\n type FormatErrorHook,\n} from './schemas/index.js'\n\n// Re-export per-concern schemas + types so downstream consumers\n// (`adapters/*`, vite-plugin, generators) keep their existing imports valid.\n// Per plan T2.3 — pure structural split; zero behavior change at the call site.\n//\n// `rateLimitSchema` and `securitySchema` are NOT re-exported: they are composed into\n// `theoConfigSchema` below and nothing imports them from here. They remain available at their\n// source of truth, `./schemas/index.js`.\nexport { cacheSchema, corsSchema, securityHeadersSchema, storageSchema } from './schemas/index.js'\n\nexport type { StorageConfig } from './schemas/index.js'\n\n/** The methods `executeRoute` and the job worker call on `jobs.backend`. */\nconst JOB_BACKEND_METHODS = ['enqueue', 'dequeue', 'ack', 'nack'] as const\n\nfunction isJobBackendShaped(value: unknown): value is object {\n if (typeof value !== 'object' || value === null) return false\n const candidate = value as Record<string, unknown>\n return JOB_BACKEND_METHODS.every((m) => typeof candidate[m] === 'function')\n}\n\nfunction isCronLockShaped(value: unknown): value is object {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as { acquire?: unknown }).acquire === 'function'\n )\n}\n\n/**\n * Root `theo.config.ts` schema — composer assembled from the per-concern\n * primitives re-exported above.\n *\n * Embedded blocks that exist ONLY as part of the root config (`agents`,\n * `ui`, `devtools`, `jobs`, `openapi`) stay inline below. They have no\n * external consumers; splitting them would create lonely files (M5\n * smell) without comprehension benefit.\n */\nexport const theoConfigSchema = z\n .object({\n /**\n * Plan v1.2 T2.1 — project identifier propagated into\n * `.theokit/services.json` v2 `project` field. DNS-1123 compatible (drives\n * Gitea repo + ArgoCD App naming on TheoCloud). When omitted, the build\n * emits services.json v1 with the legacy `services-bundle` fallback\n * (ADR D10) and logs a deprecation warning.\n */\n name: z\n .string()\n .max(63)\n .refine(\n // DNS-1123 equivalent expressed as explicit single-char anchors so\n // security/detect-unsafe-regex stays clean (no backtracking).\n (value) =>\n value.length > 0 &&\n /^[a-z0-9-]+$/u.test(value) &&\n !value.startsWith('-') &&\n !value.endsWith('-'),\n 'name must match DNS-1123 (lowercase alphanumeric+hyphens, 1-63 chars, no leading/trailing hyphen)',\n )\n .optional(),\n appDir: z.string().default('app'),\n serverDir: z.string().default('server'),\n /**\n * Directory (relative to the project root) holding `agents/<name>.ts` definitions, scanned by\n * dev/build/terminal/mcp. Defaults to `\"agents\"` — apps that keep the canonical layout are\n * unaffected. Set to e.g. `\"core/agents\"` to organize agents under a domain root (#95 follow-up).\n */\n agentsDir: z.string().default('agents'),\n /**\n * T2.2 / EC-4 — Build output directory. Must be a relative path inside\n * the project root. Refused absolute or parent-relative paths to prevent\n * `cleanOutDir` from wiping arbitrary locations (defense-in-depth on\n * top of cleanOutDir's runtime EC-3 guard).\n */\n distDir: z\n .string()\n .default('.theokit')\n .refine(\n (d) => !/^([A-Za-z]:)?[/\\\\]/.test(d) && !d.startsWith('..'),\n 'distDir must be a relative path inside the project root (e.g., \".theokit\")',\n ),\n /**\n * Agent runtime configuration.\n *\n * - `maxRegistries` (T2.3, legacy): dev-mode cleanup of stale\n * `.theokit/agents/<id>/` dirs by mtime. Now superseded by SDK's\n * native registry GC but kept for backward-compat.\n * - `registry` (Phase 6, Production-Readiness #2): forwarded to\n * `Agent.registry.configure()` lazily on first request.\n * * `maxAgents` — LRU cap. MUST be ≥ max-concurrent-active-conversations\n * (EC-17 DOCUMENT): with maxAgents:1 and 2 concurrent chats, LRU evicts\n * mid-stream → SDK aborts with code:'aborted'. Default 100 covers\n * indie/small-team; tune up for high-traffic.\n * * `idleTimeoutMs` — auto-evict idle agents (default 30 min). 0 disables\n * idle eviction (LRU only).\n */\n agents: z\n .object({\n maxRegistries: z.number().int().positive().default(100),\n registry: z\n .object({\n /** LRU cap — MUST be ≥ max-concurrent-active-conversations. */\n maxAgents: z.number().int().positive().max(10_000).default(100),\n /** Idle eviction window in ms. 0 disables idle eviction (LRU only). */\n idleTimeoutMs: z\n .number()\n .int()\n .nonnegative()\n .default(30 * 60_000),\n })\n .optional(),\n })\n .optional(),\n port: z.number().int().min(1).max(65535).default(3000),\n /** Listen on all addresses (0.0.0.0) for LAN/mobile testing. */\n /**\n * Deliberately NOT defaulted. `resolveListenTarget` ranks an explicit `host` above `HOST`,\n * because a value written into the project is a decision and an environment variable is a\n * deployment detail — and a default applied here made every app look like it had decided.\n * `HOST` was therefore inert everywhere, which is the opposite of what it was added for\n * (containers, #402). The loopback default lives in `resolveListenTarget`, where \"nobody said\"\n * is still distinguishable from \"somebody said localhost\".\n */\n host: z.union([z.string(), z.boolean()]).optional(),\n /**\n * Hostnames `theokit dev` will answer for, beyond the loopback names Vite permits out of the\n * box — Vite's `server.allowedHosts` (#555).\n *\n * This is NOT {@link host}. That one is the bind ADDRESS; this one is the `Host` header check\n * that runs after the connection is accepted, so binding `0.0.0.0` does not make a tunnelled\n * request pass. Developing against any webhook platform needs a public URL, which means a\n * tunnel or a reverse proxy, which means a `Host` the check refuses by default — and a\n * scaffolded app has no `vite.config.ts` in which to allow it.\n *\n * Vite's own matching rules apply, not globs: a leading dot allows a domain and its\n * subdomains (`.trycloudflare.com`), and anything else is compared literally.\n *\n * `true` disables the check. It is here because a tunnel that mints a fresh random hostname\n * per run cannot be listed, and the alternative — editing config between runs — is what makes\n * people reach for the production server instead. It also removes the protection against\n * DNS-rebinding that the check exists to provide, so prefer the list whenever the hostname is\n * knowable. `theokit start` is unaffected either way: this is dev-server-only.\n *\n * Deliberately NOT defaulted — an empty array is a decision that blocks every host including\n * the loopback names, so \"nobody said\" has to stay distinguishable from \"somebody said none\".\n */\n allowedHosts: z.union([z.array(z.string()), z.literal(true)]).optional(),\n /** Automatically open browser on `theokit dev`. */\n open: z.union([z.boolean(), z.string()]).default(false),\n /** Exit if port is already in use instead of trying next available. */\n strictPort: z.boolean().default(false),\n /** Forward browser console/errors to terminal — useful for AI agent dev. */\n forwardConsole: z\n .union([\n z.boolean(),\n z.object({\n unhandledErrors: z.boolean().optional(),\n logLevels: z.array(z.enum(['error', 'warn', 'info', 'log', 'debug'])).optional(),\n }),\n ])\n .default(false),\n /** Pre-transform files on startup for faster first page load. */\n warmup: z\n .object({\n clientFiles: z.array(z.string()).optional(),\n ssrFiles: z.array(z.string()).optional(),\n })\n .optional(),\n ssr: z.boolean().default(false),\n /** When true (and ssr === true), use renderToPipeableStream with progressive\n * shell flush instead of single-shot renderToString. Opt-in for streaming\n * SSR; default false preserves the current behavior. */\n ssrStreaming: z.boolean().default(false),\n rateLimit: rateLimitSchema.optional(),\n upload: uploadSchema.optional(),\n logging: loggingSchema.optional(),\n security: securitySchema.optional(),\n serialization: z.enum(['json', 'superjson']).default('json'),\n // Plugins are validated structurally at runtime by createPluginRunnerFromConfig.\n // Zod only checks the shape minimally (must be array). Type-level safety is\n // provided through defineConfig at the user surface.\n //\n // #425 — an entry MAY also be a module SPECIFIER (a string), resolved to that module's default\n // export by `config/resolve-plugin-specifiers.ts`. A constructed plugin closes over state and\n // therefore has no literal, so it is the string form — and only the string form — that a\n // generated deploy entry can carry. Both shapes are accepted here for the same reason they are\n // accepted at runtime: one declaration has to serve the local server and the deployed one.\n plugins: z.array(z.unknown()).optional(),\n /** Enable client-side batching of theoFetch calls and the\n * /api/__theo_batch__ server endpoint. */\n batching: z\n .union([z.boolean(), z.object({ max: z.number().int().positive().optional() })])\n .optional(),\n /** T4.1 — Audit log. When `logger` is provided, framework events\n * (csrf.warn, rate-limit.exceeded, session.rotated, csp.violation) are\n * emitted to it. Default: noop. */\n audit: z\n .object({\n logger: z.unknown().optional(),\n })\n .optional(),\n /** TheoUI auto-wire (T2.1). `false` = opt-out; object = explicit theme/fonts;\n * undefined = enabled when @theokit/ui is detected in node_modules. */\n ui: z\n .union([\n z.literal(false),\n z.object({\n // Any theme @theokit/ui knows — built-in or from `defineTheme()`. This was a closed\n // enum of `violet-forge | noir | paper`, two of which never existed in @theokit/ui, so\n // the only accepted value was the default and every real theme was rejected. The pattern\n // mirrors what @theokit/ui's ThemeProvider enforces, and it is load-bearing: the value is\n // interpolated into the generated entry and into a CSS selector.\n theme: z\n .string()\n .regex(\n THEME_NAME_PATTERN,\n 'must start with a letter and contain only lowercase letters, digits and hyphens',\n )\n .optional(),\n fonts: z.enum(['bundled', 'cdn']).optional(),\n }),\n ])\n .optional(),\n /**\n * Cache subsystem (caching-and-revalidation-plan).\n * Default `undefined` keeps caching disabled (backward compatible).\n * Pass `cache: {}` to opt in with defaults.\n */\n cache: cacheSchema.optional(),\n /**\n * Observability (#353). Default `undefined` keeps telemetry off. Present and\n * not `enabled: false` opts in; `provider` overrides the environment-derived\n * adapter, which is the priority `adapter-registry.ts` has always documented.\n */\n observability: observabilitySchema.optional(),\n /**\n * Devtools overlay (Phase 0.4.0+ —\n *\n * - `undefined` (default): devtools auto-injects in `pnpm dev`, NEVER in `vite build`.\n * - `false`: devtools disabled entirely (Vite plugin skips injection even in dev).\n * - `{ ... }`: devtools enabled with explicit defaults (position, theme).\n *\n * Tree-shaken to noop in prod via the dual-export pattern in\n * `packages/theo/src/devtools/index.ts` (EC-17 positive prod check).\n */\n devtools: z\n .union([\n z.literal(false),\n z.object({\n position: z.enum(['top-left', 'top-right', 'bottom-left', 'bottom-right']).optional(),\n theme: z.enum(['light', 'dark', 'system']).optional(),\n }),\n ])\n .optional(),\n /**\n * Informative list of deploy adapters the app supports. Does NOT\n * trigger per-build translations — only the `--target` CLI flag does\n * (EC-201 / ADR D2). If `config.adapters` includes a target NOT\n * matching `--target`, `theokit build` emits a cross-reference note.\n */\n adapters: z.array(z.string()).optional(),\n /**\n * Extra package names to pre-bundle via Vite's `optimizeDeps.include`.\n *\n * Framework auto-includes `@theokit/ui` and `lucide-react` when present.\n * Apps adding plugin peer-deps that rely on a runtime `import('<pkg>')`\n * (dynamic specifier) — e.g. `@theokit/plugin-canvas` consumers\n * installing `mermaid` for Mermaid SVG rendering — must declare those\n * here so Vite can resolve the literal in dev mode without\n * \"Failed to resolve module specifier\" errors. Production builds use\n * tsup/esbuild bundling and are not affected.\n *\n * Example:\n * viteOptimizeDeps: ['mermaid']\n */\n viteOptimizeDeps: z.array(z.string()).optional(),\n /**\n * Jobs backend (T2.1). When configured, every route handler gets `ctx.queue.enqueue`, wired\n * through the per-request outbox, under both `theokit start` and `theokit dev`. Pass a\n * `JobBackend` instance (`InMemoryJobBackend`, `PostgresJobBackend`, or your own).\n *\n * The value is checked for the four methods the framework calls, because a wrong value used to\n * be accepted here and then ignored (usetheokit/theokit#1009).\n */\n jobs: z\n .object({\n backend: z.custom<object>(isJobBackendShaped, {\n message:\n 'jobs.backend must be a JobBackend: an object with enqueue, dequeue, ack and nack ' +\n 'methods, such as new InMemoryJobBackend() or new PostgresJobBackend({ pool }) ' +\n \"from 'theokit/server/jobs'\",\n }),\n /**\n * The in-process job worker `theokit start` and `theokit dev` run when jobs are declared\n * under `server/jobs/` (usetheokit/theokit#1010). Set `enabled: false` in a process that\n * should only serve requests, for example from an env var, and run the worker elsewhere.\n */\n worker: z\n .object({\n enabled: z.boolean().default(true),\n /** Wait after a poll that found no job. */\n pollIntervalMs: z.number().int().positive().default(1000),\n /** Jobs leased per poll. */\n batchSize: z.number().int().positive().default(10),\n /** Lease duration per job; a job still running after it can be leased again. */\n lockSeconds: z.number().int().positive().default(30),\n })\n .prefault({}),\n })\n .optional(),\n /**\n * StorageManager configuration (T1.1 / ADR-0007).\n *\n * Declares Postgres servers + databases + Redis servers. Consumed by\n * `getStorageManager().configure()` at boot via `start.ts`.\n *\n * Default `undefined` means manager exists but is not configured — adapters\n * relying on the manager (PostgresJobBackend.fromStorageManager, etc.) will\n * throw with an actionable error on first use.\n */\n storage: storageSchema.optional(),\n /**\n * The in-process cron scheduler (`<serverDir>/crons`, `<agentsDir>/schedules`).\n *\n * `lock` decides which process runs each tick when several run `theokit start`\n * (usetheokit/theokit#1016). Unset, a `PostgresJobBackend` in `jobs.backend` provides one on\n * its pool; any other setup fires every cron in every process. Pass a `CronLock` (for example\n * `createPostgresCronLock(pool)` from `theokit/server/cron`) to choose, or `false` to opt out.\n */\n cron: z\n .object({\n lock: z\n .union([\n z.literal(false),\n z.custom<object>(isCronLockShaped, {\n message:\n 'cron.lock must be a CronLock (an object with an acquire(name, scheduledAt) ' +\n \"method, such as createPostgresCronLock(pool) from 'theokit/server/cron') or false\",\n }),\n ])\n .optional(),\n })\n .optional(),\n /**\n * Wave 2 — Polyglot services orchestration (T1.1 / ADR-0012/0013/0014/0015).\n *\n * Declarative external sidecar processes (Python FastAPI / Node Hono)\n * that boot alongside the TheoKit TS app. Empty `services: {}` is the\n * default and preserves Wave 1 behavior.\n */\n services: servicesConfigSchema,\n /**\n * G2 — OpenAPI emit (build-time only).\n *\n * When present, `theokit build` writes a generated `openapi.json` from\n * every `defineRoute()` body/query/params Zod schema. `undefined` keeps\n * the framework backward-compatible (no emit). Pass `openapi: {}` to\n * opt in with defaults.\n *\n * Defaults: spec 3.1.0 · servers `http://localhost:3000` · title\n * \"TheoKit App\" · version \"0.0.0\" · outDir \".theokit\" (next to dist).\n *\n * The env var `THEOKIT_OPENAPI_SERVERS` (CSV of URLs) overrides\n * `servers[].url` at emit time without rebuilding the config.\n */\n openapi: z\n .object({\n servers: z\n .array(\n z.object({\n url: z.url(),\n description: z.string().optional(),\n }),\n )\n .default([{ url: 'http://localhost:3000', description: 'Local development' }]),\n specVersion: z.enum(['3.1.0', '3.0.3']).default('3.1.0'),\n title: z.string().default('TheoKit App'),\n version: z.string().default('0.0.0'),\n outDir: z.string().default('.theokit'),\n })\n .optional(),\n /**\n * G5 T1.3 — error envelope transformer hook (blueprint ADR D3).\n *\n * When present, runs at framework error-boundary time to enrich the\n * envelope with consumer-defined extensions (`hint`, custom telemetry\n * tags, etc.) BEFORE the envelope is serialized to the client. The\n * function signature is preserved via the explicit `FormatErrorHook`\n * type — TS inference flows from `theo.config.ts` into `@theo/client`\n * codegen and `@theokit/ui` AgentErrorCard consumers.\n *\n * Use `z.custom<FormatErrorHook>(...)` because Zod's built-in\n * `z.function()` discards its TS signature after parse; `z.custom`\n * with a function-typed runtime guard preserves the call-site type\n * without trading off Zod runtime validation.\n */\n formatError: z\n .custom<FormatErrorHook>((val) => typeof val === 'function', {\n message: 'formatError must be a function',\n })\n .optional(),\n /**\n * Readiness probe for `GET /__theo/ready` under `theokit start` and `theokit dev`. Resolve\n * `true` when the app's dependencies are up; `false`, a throw or a rejection answers 503. A\n * configured `jobs.backend` that can be pinged (`PostgresJobBackend`) is probed as well, so its\n * database being down answers 503 without this key. Before usetheokit/theokit#1071 nothing\n * could register a probe and the route always answered 200.\n */\n ready: z\n .custom<() => boolean | Promise<boolean>>((val) => typeof val === 'function', {\n message: 'ready must be a function returning a boolean or a Promise of one',\n })\n .optional(),\n })\n // EC-2 fix: cross-config refine — no service may share TheoKit's web port.\n .refine((cfg) => !Object.values(cfg.services).some((s) => s.port === cfg.port), {\n message: 'service.port collides with TheoKit web port — change one of them',\n path: ['services'],\n })\n\nexport type TheoConfig = z.infer<typeof theoConfigSchema>\n\n// Silence unused-import warnings for type-only re-exports — TS strips at compile,\n// but exports above re-introduce them for downstream consumers.\ntype _FormatErrorContext = FormatErrorContext\n","/**\n * The `@theokit/ui` theme name — a contract shared by the config schema, the entry generators and\n * the Vite plugin's detector.\n *\n * It lives in `core/contracts/` because those three sit in different modules that may not depend on\n * one another: `config/` and `router/` are allowed to reach into `core/` only. Before this file the\n * union was written out separately in all three places, and all three drifted from what the design\n * system actually ships.\n */\n\n/**\n * Theme names `@theokit/ui` ships today — an autocomplete hint, NOT the accepted set.\n *\n * The accepted set used to be exactly `'violet-forge' | 'noir' | 'paper'`, and two of those three\n * were never real: the design system has no `noir` and no `paper`. So the only value config\n * validation accepted was the default, and every genuine theme — plus anything from\n * `defineTheme()` — was rejected.\n *\n * A closed union here is a copy of another package's catalogue; it rots the moment that package\n * ships a theme. This list is therefore advisory, and {@link TheoUiTheme} stays open. The\n * authoritative list is `builtinThemes`, exported by `@theokit/ui`.\n */\nexport type BuiltinThemeName =\n | 'violet-forge'\n | 'falcon-red'\n | 'classic-paper'\n | 'aurora-terminal'\n | 'vercel-mono'\n | 'github-dark'\n | 'dracula'\n | 'one-dark'\n | 'anthropic-style'\n | 'openai-style'\n | 'linear-glass'\n\n/**\n * A theme name. Built-ins autocomplete; a custom theme from `defineTheme()` is equally valid.\n *\n * `(string & {})` is the idiomatic way to keep literal suggestions on an open union — without it\n * TypeScript widens the whole type to `string` and the hints disappear.\n */\nexport type TheoUiTheme = BuiltinThemeName | (string & {})\n\n/** How fonts are delivered — bundled with the app, or fetched from a CDN. */\nexport type TheoUiFonts = 'bundled' | 'cdn'\n\n/**\n * The shape a theme name must have — mirrors the pattern `@theokit/ui`'s `ThemeProvider` enforces\n * before it writes `[data-theme=\"<name>\"]`.\n *\n * Validating here is not cosmetic. The value is interpolated into the generated entry\n * (`defaultTheme: '<name>'`) and into a CSS selector, so an unchecked name is a code-injection\n * vector — and anything this rejects would be rejected by the provider anyway, so the developer\n * gets the error at config time instead of at render time.\n */\nexport const THEME_NAME_PATTERN = /^[a-z][a-z0-9-]*$/\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;;;ACuDX,IAAM,qBAAqB;;;AD1BlC,IAAM,sBAAsB,CAAC,WAAW,WAAW,OAAO,MAAM;AAEhE,SAAS,mBAAmB,OAAiC;AAC3D,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SAAO,oBAAoB,MAAM,CAAC,MAAM,OAAO,UAAU,CAAC,MAAM,UAAU;AAC5E;AAEA,SAAS,iBAAiB,OAAiC;AACzD,SACE,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAAgC,YAAY;AAExD;AAWO,IAAM,mBAAmB,EAC7B,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQN,MAAM,EACH,OAAO,EACP,IAAI,EAAE,EACN;AAAA;AAAA;AAAA,IAGC,CAAC,UACC,MAAM,SAAS,KACf,gBAAgB,KAAK,KAAK,KAC1B,CAAC,MAAM,WAAW,GAAG,KACrB,CAAC,MAAM,SAAS,GAAG;AAAA,IACrB;AAAA,EACF,EACC,SAAS;AAAA,EACZ,QAAQ,EAAE,OAAO,EAAE,QAAQ,KAAK;AAAA,EAChC,WAAW,EAAE,OAAO,EAAE,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtC,WAAW,EAAE,OAAO,EAAE,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOtC,SAAS,EACN,OAAO,EACP,QAAQ,UAAU,EAClB;AAAA,IACC,CAAC,MAAM,CAAC,qBAAqB,KAAK,CAAC,KAAK,CA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AU;AAAA,EACvC,CAAC,EACA,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBZ,aAAa,EACV,OAAwB,CAAC,QAAQ,OAAO,QAAQ,YAAY;AAAA,IAC3D,SAAS;AAAA,EACX,CAAC,EACA,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQZ,OAAO,EACJ,OAAyC,CAAC,QAAQ,OAAO,QAAQ,YAAY;AAAA,IAC5E,SAAS;AAAA,EACX,CAAC,EACA,SAAS;AACd,CAAC,EAEA,OAAO,CAAC,QAAQ,CAAC,OAAO,OAAO,IAAI,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI,IAAI,GAAG;AAAA,EAC9E,SAAS;AAAA,EACT,MAAM,CAAC,UAAU;AACnB,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/config/schema.ts","../src/core/contracts/theo-ui-theme.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { THEME_NAME_PATTERN } from '../core/contracts/theo-ui-theme.js'\nimport { servicesConfigSchema } from '../services/index.js'\n\nimport {\n cacheSchema,\n loggingSchema,\n observabilitySchema,\n rateLimitSchema,\n securitySchema,\n storageSchema,\n uploadSchema,\n type FormatErrorContext,\n type FormatErrorHook,\n} from './schemas/index.js'\n\n// Re-export per-concern schemas + types so downstream consumers\n// (`adapters/*`, vite-plugin, generators) keep their existing imports valid.\n// Per plan T2.3 — pure structural split; zero behavior change at the call site.\n//\n// `rateLimitSchema` and `securitySchema` are NOT re-exported: they are composed into\n// `theoConfigSchema` below and nothing imports them from here. They remain available at their\n// source of truth, `./schemas/index.js`.\nexport { cacheSchema, corsSchema, securityHeadersSchema, storageSchema } from './schemas/index.js'\n\nexport type { StorageConfig } from './schemas/index.js'\n\n/** The methods `executeRoute` and the job worker call on `jobs.backend`. */\nconst JOB_BACKEND_METHODS = ['enqueue', 'dequeue', 'ack', 'nack'] as const\n\nfunction isJobBackendShaped(value: unknown): value is object {\n if (typeof value !== 'object' || value === null) return false\n const candidate = value as Record<string, unknown>\n return JOB_BACKEND_METHODS.every((m) => typeof candidate[m] === 'function')\n}\n\nfunction isCronLockShaped(value: unknown): value is object {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as { acquire?: unknown }).acquire === 'function'\n )\n}\n\n/**\n * Root `theo.config.ts` schema — composer assembled from the per-concern\n * primitives re-exported above.\n *\n * Embedded blocks that exist ONLY as part of the root config (`agents`,\n * `ui`, `devtools`, `jobs`, `openapi`) stay inline below. They have no\n * external consumers; splitting them would create lonely files (M5\n * smell) without comprehension benefit.\n */\nexport const theoConfigSchema = z\n .object({\n /**\n * Plan v1.2 T2.1 — project identifier propagated into\n * `.theokit/services.json` v2 `project` field. DNS-1123 compatible (drives\n * Gitea repo + ArgoCD App naming on TheoCloud). When omitted, the build\n * emits services.json v1 with the legacy `services-bundle` fallback\n * (ADR D10) and logs a deprecation warning.\n */\n name: z\n .string()\n .max(63)\n .refine(\n // DNS-1123 equivalent expressed as explicit single-char anchors so\n // security/detect-unsafe-regex stays clean (no backtracking).\n (value) =>\n value.length > 0 &&\n /^[a-z0-9-]+$/u.test(value) &&\n !value.startsWith('-') &&\n !value.endsWith('-'),\n 'name must match DNS-1123 (lowercase alphanumeric+hyphens, 1-63 chars, no leading/trailing hyphen)',\n )\n .optional(),\n appDir: z.string().default('app'),\n serverDir: z.string().default('server'),\n /**\n * Directory (relative to the project root) holding `agents/<name>.ts` definitions, scanned by\n * dev/build/terminal/mcp. Defaults to `\"agents\"` — apps that keep the canonical layout are\n * unaffected. Set to e.g. `\"core/agents\"` to organize agents under a domain root (#95 follow-up).\n */\n agentsDir: z.string().default('agents'),\n /**\n * T2.2 / EC-4 — Build output directory. Must be a relative path inside\n * the project root. Refused absolute or parent-relative paths to prevent\n * `cleanOutDir` from wiping arbitrary locations (defense-in-depth on\n * top of cleanOutDir's runtime EC-3 guard).\n */\n distDir: z\n .string()\n .default('.theokit')\n .refine(\n (d) => !/^([A-Za-z]:)?[/\\\\]/.test(d) && !d.startsWith('..'),\n 'distDir must be a relative path inside the project root (e.g., \".theokit\")',\n ),\n /**\n * Agent runtime configuration.\n *\n * - `maxRegistries` (T2.3, legacy): dev-mode cleanup of stale\n * `.theokit/agents/<id>/` dirs by mtime. Now superseded by SDK's\n * native registry GC but kept for backward-compat.\n * - `registry` (Phase 6, Production-Readiness #2): forwarded to\n * `Agent.registry.configure()` lazily on first request.\n * * `maxAgents` — LRU cap. MUST be ≥ max-concurrent-active-conversations\n * (EC-17 DOCUMENT): with maxAgents:1 and 2 concurrent chats, LRU evicts\n * mid-stream → SDK aborts with code:'aborted'. Default 100 covers\n * indie/small-team; tune up for high-traffic.\n * * `idleTimeoutMs` — auto-evict idle agents (default 30 min). 0 disables\n * idle eviction (LRU only).\n */\n agents: z\n .object({\n maxRegistries: z.number().int().positive().default(100),\n registry: z\n .object({\n /** LRU cap — MUST be ≥ max-concurrent-active-conversations. */\n maxAgents: z.number().int().positive().max(10_000).default(100),\n /** Idle eviction window in ms. 0 disables idle eviction (LRU only). */\n idleTimeoutMs: z\n .number()\n .int()\n .nonnegative()\n .default(30 * 60_000),\n })\n .optional(),\n })\n .optional(),\n port: z.number().int().min(1).max(65535).default(3000),\n /** Listen on all addresses (0.0.0.0) for LAN/mobile testing. */\n /**\n * Deliberately NOT defaulted. `resolveListenTarget` ranks an explicit `host` above `HOST`,\n * because a value written into the project is a decision and an environment variable is a\n * deployment detail — and a default applied here made every app look like it had decided.\n * `HOST` was therefore inert everywhere, which is the opposite of what it was added for\n * (containers, #402). The loopback default lives in `resolveListenTarget`, where \"nobody said\"\n * is still distinguishable from \"somebody said localhost\".\n */\n host: z.union([z.string(), z.boolean()]).optional(),\n /**\n * Hostnames `theokit dev` will answer for, beyond the loopback names Vite permits out of the\n * box — Vite's `server.allowedHosts` (#555).\n *\n * This is NOT {@link host}. That one is the bind ADDRESS; this one is the `Host` header check\n * that runs after the connection is accepted, so binding `0.0.0.0` does not make a tunnelled\n * request pass. Developing against any webhook platform needs a public URL, which means a\n * tunnel or a reverse proxy, which means a `Host` the check refuses by default — and a\n * scaffolded app has no `vite.config.ts` in which to allow it.\n *\n * Vite's own matching rules apply, not globs: a leading dot allows a domain and its\n * subdomains (`.trycloudflare.com`), and anything else is compared literally.\n *\n * `true` disables the check. It is here because a tunnel that mints a fresh random hostname\n * per run cannot be listed, and the alternative — editing config between runs — is what makes\n * people reach for the production server instead. It also removes the protection against\n * DNS-rebinding that the check exists to provide, so prefer the list whenever the hostname is\n * knowable. `theokit start` is unaffected either way: this is dev-server-only.\n *\n * Deliberately NOT defaulted — an empty array is a decision that blocks every host including\n * the loopback names, so \"nobody said\" has to stay distinguishable from \"somebody said none\".\n */\n allowedHosts: z.union([z.array(z.string()), z.literal(true)]).optional(),\n /** Automatically open browser on `theokit dev`. */\n open: z.union([z.boolean(), z.string()]).default(false),\n /** Exit if port is already in use instead of trying next available. */\n strictPort: z.boolean().default(false),\n /** Forward browser console/errors to terminal — useful for AI agent dev. */\n forwardConsole: z\n .union([\n z.boolean(),\n z.object({\n unhandledErrors: z.boolean().optional(),\n logLevels: z.array(z.enum(['error', 'warn', 'info', 'log', 'debug'])).optional(),\n }),\n ])\n .default(false),\n /** Pre-transform files on startup for faster first page load. */\n warmup: z\n .object({\n clientFiles: z.array(z.string()).optional(),\n ssrFiles: z.array(z.string()).optional(),\n })\n .optional(),\n ssr: z.boolean().default(false),\n /** When true (and ssr === true), use renderToPipeableStream with progressive\n * shell flush instead of single-shot renderToString. Opt-in for streaming\n * SSR; default false preserves the current behavior. */\n ssrStreaming: z.boolean().default(false),\n rateLimit: rateLimitSchema.optional(),\n upload: uploadSchema.optional(),\n logging: loggingSchema.optional(),\n security: securitySchema.optional(),\n serialization: z.enum(['json', 'superjson']).default('json'),\n // Plugins are validated structurally at runtime by createPluginRunnerFromConfig.\n // Zod only checks the shape minimally (must be array). Type-level safety is\n // provided through defineConfig at the user surface.\n //\n // #425 — an entry MAY also be a module SPECIFIER (a string), resolved to that module's default\n // export by `config/resolve-plugin-specifiers.ts`. A constructed plugin closes over state and\n // therefore has no literal, so it is the string form — and only the string form — that a\n // generated deploy entry can carry. Both shapes are accepted here for the same reason they are\n // accepted at runtime: one declaration has to serve the local server and the deployed one.\n plugins: z.array(z.unknown()).optional(),\n /** Enable client-side batching of theoFetch calls and the\n * /api/__theo_batch__ server endpoint. */\n batching: z\n .union([z.boolean(), z.object({ max: z.number().int().positive().optional() })])\n .optional(),\n /** T4.1 — Audit log. When `logger` is provided, framework events\n * (csrf.warn, rate-limit.exceeded, session.rotated, csp.violation) are\n * emitted to it. Default: noop. */\n audit: z\n .object({\n logger: z.unknown().optional(),\n })\n .optional(),\n /** TheoUI auto-wire (T2.1). `false` = opt-out; object = explicit theme/fonts;\n * undefined = enabled when @theokit/ui is detected in node_modules. */\n ui: z\n .union([\n z.literal(false),\n z.object({\n // Any theme @theokit/ui knows — built-in or from `defineTheme()`. This was a closed\n // enum of `violet-forge | noir | paper`, two of which never existed in @theokit/ui, so\n // the only accepted value was the default and every real theme was rejected. The pattern\n // mirrors what @theokit/ui's ThemeProvider enforces, and it is load-bearing: the value is\n // interpolated into the generated entry and into a CSS selector.\n theme: z\n .string()\n .regex(\n THEME_NAME_PATTERN,\n 'must start with a letter and contain only lowercase letters, digits and hyphens',\n )\n .optional(),\n fonts: z.enum(['bundled', 'cdn']).optional(),\n }),\n ])\n .optional(),\n /**\n * Cache subsystem (caching-and-revalidation-plan).\n * Default `undefined` keeps caching disabled (backward compatible).\n * Pass `cache: {}` to opt in with defaults.\n */\n cache: cacheSchema.optional(),\n /**\n * Observability (#353). Default `undefined` keeps telemetry off. Present and\n * not `enabled: false` opts in; `provider` overrides the environment-derived\n * adapter, which is the priority `adapter-registry.ts` has always documented.\n */\n observability: observabilitySchema.optional(),\n /**\n * Devtools overlay (Phase 0.4.0+ —\n *\n * - `undefined` (default): devtools auto-injects in `pnpm dev`, NEVER in `vite build`.\n * - `false`: devtools disabled entirely (Vite plugin skips injection even in dev).\n * - `{ ... }`: devtools enabled with explicit defaults (position, theme).\n *\n * Tree-shaken to noop in prod via the dual-export pattern in\n * `packages/theo/src/devtools/index.ts` (EC-17 positive prod check).\n */\n devtools: z\n .union([\n z.literal(false),\n z.object({\n position: z.enum(['top-left', 'top-right', 'bottom-left', 'bottom-right']).optional(),\n theme: z.enum(['light', 'dark', 'system']).optional(),\n }),\n ])\n .optional(),\n /**\n * Informative list of deploy adapters the app supports. Does NOT\n * trigger per-build translations — only the `--target` CLI flag does\n * (EC-201 / ADR D2). If `config.adapters` includes a target NOT\n * matching `--target`, `theokit build` emits a cross-reference note.\n */\n adapters: z.array(z.string()).optional(),\n /**\n * Extra package names to pre-bundle via Vite's `optimizeDeps.include`.\n *\n * Framework auto-includes `@theokit/ui` and `lucide-react` when present.\n * Apps adding plugin peer-deps that rely on a runtime `import('<pkg>')`\n * (dynamic specifier) — e.g. `@theokit/plugin-canvas` consumers\n * installing `mermaid` for Mermaid SVG rendering — must declare those\n * here so Vite can resolve the literal in dev mode without\n * \"Failed to resolve module specifier\" errors. Production builds use\n * tsup/esbuild bundling and are not affected.\n *\n * Example:\n * viteOptimizeDeps: ['mermaid']\n */\n viteOptimizeDeps: z.array(z.string()).optional(),\n /**\n * Jobs backend (T2.1). When configured, every route handler gets `ctx.queue.enqueue`, wired\n * through the per-request outbox, under both `theokit start` and `theokit dev`. Pass a\n * `JobBackend` instance (`InMemoryJobBackend`, `PostgresJobBackend`, or your own).\n *\n * The value is checked for the four methods the framework calls, because a wrong value used to\n * be accepted here and then ignored (usetheokit/theokit#1009).\n */\n jobs: z\n .object({\n backend: z.custom<object>(isJobBackendShaped, {\n message:\n 'jobs.backend must be a JobBackend: an object with enqueue, dequeue, ack and nack ' +\n 'methods, such as new InMemoryJobBackend() or new PostgresJobBackend({ pool }) ' +\n \"from 'theokit/server/jobs'\",\n }),\n /**\n * The in-process job worker `theokit start` and `theokit dev` run when jobs are declared\n * under `server/jobs/` (usetheokit/theokit#1010). Set `enabled: false` in a process that\n * should only serve requests, for example from an env var, and run the worker elsewhere.\n */\n worker: z\n .object({\n enabled: z.boolean().default(true),\n /** Wait after a poll that found no job. */\n pollIntervalMs: z.number().int().positive().default(1000),\n /** Jobs leased per poll. */\n batchSize: z.number().int().positive().default(10),\n /** Lease duration per job; a job still running after it can be leased again. */\n lockSeconds: z.number().int().positive().default(30),\n /**\n * How long SIGTERM waits for the job in progress to finish before `theokit start`\n * closes its storage and exits (usetheokit/theokit#1292). Raise it for jobs that run\n * longer than 20 seconds, and give the process manager a longer grace period too\n * (systemd `TimeoutStopSec`, Kubernetes `terminationGracePeriodSeconds`).\n */\n shutdownTimeoutMs: z.number().int().positive().default(20_000),\n })\n .prefault({}),\n })\n .optional(),\n /**\n * StorageManager configuration (T1.1 / ADR-0007).\n *\n * Declares Postgres servers + databases + Redis servers. Consumed by\n * `getStorageManager().configure()` at boot via `start.ts`.\n *\n * Default `undefined` means manager exists but is not configured — adapters\n * relying on the manager (PostgresJobBackend.fromStorageManager, etc.) will\n * throw with an actionable error on first use.\n */\n storage: storageSchema.optional(),\n /**\n * The in-process cron scheduler (`<serverDir>/crons`, `<agentsDir>/schedules`).\n *\n * `lock` decides which process runs each tick when several run `theokit start`\n * (usetheokit/theokit#1016). Unset, a `PostgresJobBackend` in `jobs.backend` provides one on\n * its pool; any other setup fires every cron in every process. Pass a `CronLock` (for example\n * `createPostgresCronLock(pool)` from `theokit/server/cron`) to choose, or `false` to opt out.\n */\n cron: z\n .object({\n lock: z\n .union([\n z.literal(false),\n z.custom<object>(isCronLockShaped, {\n message:\n 'cron.lock must be a CronLock (an object with an acquire(name, scheduledAt) ' +\n \"method, such as createPostgresCronLock(pool) from 'theokit/server/cron') or false\",\n }),\n ])\n .optional(),\n })\n .optional(),\n /**\n * Wave 2 — Polyglot services orchestration (T1.1 / ADR-0012/0013/0014/0015).\n *\n * Declarative external sidecar processes (Python FastAPI / Node Hono)\n * that boot alongside the TheoKit TS app. Empty `services: {}` is the\n * default and preserves Wave 1 behavior.\n */\n services: servicesConfigSchema,\n /**\n * G2 — OpenAPI emit (build-time only).\n *\n * When present, `theokit build` writes a generated `openapi.json` from\n * every `defineRoute()` body/query/params Zod schema. `undefined` keeps\n * the framework backward-compatible (no emit). Pass `openapi: {}` to\n * opt in with defaults.\n *\n * Defaults: spec 3.1.0 · servers `http://localhost:3000` · title\n * \"TheoKit App\" · version \"0.0.0\" · outDir \".theokit\" (next to dist).\n *\n * The env var `THEOKIT_OPENAPI_SERVERS` (CSV of URLs) overrides\n * `servers[].url` at emit time without rebuilding the config.\n */\n openapi: z\n .object({\n servers: z\n .array(\n z.object({\n url: z.url(),\n description: z.string().optional(),\n }),\n )\n .default([{ url: 'http://localhost:3000', description: 'Local development' }]),\n specVersion: z.enum(['3.1.0', '3.0.3']).default('3.1.0'),\n title: z.string().default('TheoKit App'),\n version: z.string().default('0.0.0'),\n outDir: z.string().default('.theokit'),\n })\n .optional(),\n /**\n * G5 T1.3 — error envelope transformer hook (blueprint ADR D3).\n *\n * When present, runs at framework error-boundary time to enrich the\n * envelope with consumer-defined extensions (`hint`, custom telemetry\n * tags, etc.) BEFORE the envelope is serialized to the client. The\n * function signature is preserved via the explicit `FormatErrorHook`\n * type — TS inference flows from `theo.config.ts` into `@theo/client`\n * codegen and `@theokit/ui` AgentErrorCard consumers.\n *\n * Use `z.custom<FormatErrorHook>(...)` because Zod's built-in\n * `z.function()` discards its TS signature after parse; `z.custom`\n * with a function-typed runtime guard preserves the call-site type\n * without trading off Zod runtime validation.\n */\n formatError: z\n .custom<FormatErrorHook>((val) => typeof val === 'function', {\n message: 'formatError must be a function',\n })\n .optional(),\n /**\n * Readiness probe for `GET /__theo/ready` under `theokit start` and `theokit dev`. Resolve\n * `true` when the app's dependencies are up; `false`, a throw or a rejection answers 503. A\n * configured `jobs.backend` that can be pinged (`PostgresJobBackend`) is probed as well, so its\n * database being down answers 503 without this key. Before usetheokit/theokit#1071 nothing\n * could register a probe and the route always answered 200.\n */\n ready: z\n .custom<() => boolean | Promise<boolean>>((val) => typeof val === 'function', {\n message: 'ready must be a function returning a boolean or a Promise of one',\n })\n .optional(),\n })\n // EC-2 fix: cross-config refine — no service may share TheoKit's web port.\n .refine((cfg) => !Object.values(cfg.services).some((s) => s.port === cfg.port), {\n message: 'service.port collides with TheoKit web port — change one of them',\n path: ['services'],\n })\n\nexport type TheoConfig = z.infer<typeof theoConfigSchema>\n\n// Silence unused-import warnings for type-only re-exports — TS strips at compile,\n// but exports above re-introduce them for downstream consumers.\ntype _FormatErrorContext = FormatErrorContext\n","/**\n * The `@theokit/ui` theme name — a contract shared by the config schema, the entry generators and\n * the Vite plugin's detector.\n *\n * It lives in `core/contracts/` because those three sit in different modules that may not depend on\n * one another: `config/` and `router/` are allowed to reach into `core/` only. Before this file the\n * union was written out separately in all three places, and all three drifted from what the design\n * system actually ships.\n */\n\n/**\n * Theme names `@theokit/ui` ships today — an autocomplete hint, NOT the accepted set.\n *\n * The accepted set used to be exactly `'violet-forge' | 'noir' | 'paper'`, and two of those three\n * were never real: the design system has no `noir` and no `paper`. So the only value config\n * validation accepted was the default, and every genuine theme — plus anything from\n * `defineTheme()` — was rejected.\n *\n * A closed union here is a copy of another package's catalogue; it rots the moment that package\n * ships a theme. This list is therefore advisory, and {@link TheoUiTheme} stays open. The\n * authoritative list is `builtinThemes`, exported by `@theokit/ui`.\n */\nexport type BuiltinThemeName =\n | 'violet-forge'\n | 'falcon-red'\n | 'classic-paper'\n | 'aurora-terminal'\n | 'vercel-mono'\n | 'github-dark'\n | 'dracula'\n | 'one-dark'\n | 'anthropic-style'\n | 'openai-style'\n | 'linear-glass'\n\n/**\n * A theme name. Built-ins autocomplete; a custom theme from `defineTheme()` is equally valid.\n *\n * `(string & {})` is the idiomatic way to keep literal suggestions on an open union — without it\n * TypeScript widens the whole type to `string` and the hints disappear.\n */\nexport type TheoUiTheme = BuiltinThemeName | (string & {})\n\n/** How fonts are delivered — bundled with the app, or fetched from a CDN. */\nexport type TheoUiFonts = 'bundled' | 'cdn'\n\n/**\n * The shape a theme name must have — mirrors the pattern `@theokit/ui`'s `ThemeProvider` enforces\n * before it writes `[data-theme=\"<name>\"]`.\n *\n * Validating here is not cosmetic. The value is interpolated into the generated entry\n * (`defaultTheme: '<name>'`) and into a CSS selector, so an unchecked name is a code-injection\n * vector — and anything this rejects would be rejected by the provider anyway, so the developer\n * gets the error at config time instead of at render time.\n */\nexport const THEME_NAME_PATTERN = /^[a-z][a-z0-9-]*$/\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;;;ACuDX,IAAM,qBAAqB;;;AD1BlC,IAAM,sBAAsB,CAAC,WAAW,WAAW,OAAO,MAAM;AAEhE,SAAS,mBAAmB,OAAiC;AAC3D,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SAAO,oBAAoB,MAAM,CAAC,MAAM,OAAO,UAAU,CAAC,MAAM,UAAU;AAC5E;AAEA,SAAS,iBAAiB,OAAiC;AACzD,SACE,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAAgC,YAAY;AAExD;AAWO,IAAM,mBAAmB,EAC7B,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQN,MAAM,EACH,OAAO,EACP,IAAI,EAAE,EACN;AAAA;AAAA;AAAA,IAGC,CAAC,UACC,MAAM,SAAS,KACf,gBAAgB,KAAK,KAAK,KAC1B,CAAC,MAAM,WAAW,GAAG,KACrB,CAAC,MAAM,SAAS,GAAG;AAAA,IACrB;AAAA,EACF,EACC,SAAS;AAAA,EACZ,QAAQ,EAAE,OAAO,EAAE,QAAQ,KAAK;AAAA,EAChC,WAAW,EAAE,OAAO,EAAE,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtC,WAAW,EAAE,OAAO,EAAE,QAAQ,QAA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AAE,KAAK,yBAAyB,aAAa,oBAAoB,CAAC,CAAC;AAAA,IAC/E,aAAa,EAAE,KAAK,CAAC,SAAS,OAAO,CAAC,EAAE,QAAQ,OAAO;AAAA,IACvD,OAAO,EAAE,OAAO,EAAE,QAAQ,aAAa;AAAA,IACvC,SAAS,EAAE,OAAO,EAAE,QAAQ,OAAO;AAAA,IACnC,QAAQ,EAAE,OAAO,EAAE,QAAQ,UAAU;AAAA,EACvC,CAAC,EACA,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBZ,aAAa,EACV,OAAwB,CAAC,QAAQ,OAAO,QAAQ,YAAY;AAAA,IAC3D,SAAS;AAAA,EACX,CAAC,EACA,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQZ,OAAO,EACJ,OAAyC,CAAC,QAAQ,OAAO,QAAQ,YAAY;AAAA,IAC5E,SAAS;AAAA,EACX,CAAC,EACA,SAAS;AACd,CAAC,EAEA,OAAO,CAAC,QAAQ,CAAC,OAAO,OAAO,IAAI,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI,IAAI,GAAG;AAAA,EAC9E,SAAS;AAAA,EACT,MAAM,CAAC,UAAU;AACnB,CAAC;","names":[]}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
isAgentCardPath,
|
|
14
14
|
matchAgentAuxRoute,
|
|
15
15
|
serveMatchedAuxRoute
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-APUYC5BE.js";
|
|
17
17
|
import {
|
|
18
18
|
admitAgentRequest,
|
|
19
19
|
agentAccessDenied,
|
|
@@ -488,7 +488,14 @@ var theoConfigSchema = z.object({
|
|
|
488
488
|
/** Jobs leased per poll. */
|
|
489
489
|
batchSize: z.number().int().positive().default(10),
|
|
490
490
|
/** Lease duration per job; a job still running after it can be leased again. */
|
|
491
|
-
lockSeconds: z.number().int().positive().default(30)
|
|
491
|
+
lockSeconds: z.number().int().positive().default(30),
|
|
492
|
+
/**
|
|
493
|
+
* How long SIGTERM waits for the job in progress to finish before `theokit start`
|
|
494
|
+
* closes its storage and exits (usetheokit/theokit#1292). Raise it for jobs that run
|
|
495
|
+
* longer than 20 seconds, and give the process manager a longer grace period too
|
|
496
|
+
* (systemd `TimeoutStopSec`, Kubernetes `terminationGracePeriodSeconds`).
|
|
497
|
+
*/
|
|
498
|
+
shutdownTimeoutMs: z.number().int().positive().default(2e4)
|
|
492
499
|
}).prefault({})
|
|
493
500
|
}).optional(),
|
|
494
501
|
/**
|
|
@@ -3430,4 +3437,4 @@ export {
|
|
|
3430
3437
|
buildOptimizeDepsInclude,
|
|
3431
3438
|
theoPlugin
|
|
3432
3439
|
};
|
|
3433
|
-
//# sourceMappingURL=chunk-
|
|
3440
|
+
//# sourceMappingURL=chunk-QEVTZ3IH.js.map
|