stitchkit 0.100.2 → 0.101.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/CHANGELOG.md +153 -0
- package/README.md +2 -1
- package/dist/entrypoints/agent-runtime/browser.js +119 -119
- package/dist/entrypoints/agent-runtime/coding-tools.js +15 -20
- package/dist/entrypoints/agent-runtime/harness.js +55 -63
- package/dist/entrypoints/agent-runtime/openrouter.js +6 -6
- package/dist/entrypoints/agent-runtime/sandbox.js +20 -25
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +11 -13
- package/dist/entrypoints/agent-runtime/sqlite/node.js +11 -13
- package/dist/entrypoints/agent-runtime/testing.js +32 -34
- package/dist/entrypoints/agent-runtime.js +395 -402
- package/dist/entrypoints/application/diagnostic-journal.js +26 -27
- package/dist/entrypoints/application/directory-inbox.js +16 -17
- package/dist/entrypoints/application/grammy.js +13 -13
- package/dist/entrypoints/application/opentelemetry.js +13 -13
- package/dist/entrypoints/application/schemas.js +24 -24
- package/dist/entrypoints/application.js +209 -210
- package/dist/entrypoints/bin/upgrade-cli.js +2 -2
- package/dist/entrypoints/cli.js +81 -84
- package/dist/entrypoints/contract.js +54 -57
- package/dist/entrypoints/declaration.js +22 -22
- package/dist/entrypoints/files.js +18 -21
- package/dist/entrypoints/geo.js +7 -8
- package/dist/entrypoints/google.js +2 -2
- package/dist/entrypoints/index.js +150 -154
- package/dist/entrypoints/live.js +45 -47
- package/dist/entrypoints/node.js +68 -74
- package/dist/entrypoints/oauth.js +6 -6
- package/dist/entrypoints/observability.d.ts +1 -0
- package/dist/entrypoints/observability.d.ts.map +1 -1
- package/dist/entrypoints/observability.js +116 -87
- package/dist/entrypoints/primitives.js +35 -35
- package/dist/entrypoints/react/keyboard.d.ts +4 -0
- package/dist/entrypoints/react/keyboard.d.ts.map +1 -0
- package/dist/entrypoints/react/keyboard.js +397 -0
- package/dist/entrypoints/react.js +10 -10
- package/dist/entrypoints/release.js +7 -7
- package/dist/entrypoints/remote.js +15 -17
- package/dist/entrypoints/server.js +198 -200
- package/dist/entrypoints/telegram/html.d.ts +5 -0
- package/dist/entrypoints/telegram/html.d.ts.map +1 -0
- package/dist/entrypoints/telegram/html.js +26 -0
- package/dist/entrypoints/telegram/screens.d.ts +14 -0
- package/dist/entrypoints/telegram/screens.d.ts.map +1 -0
- package/dist/entrypoints/telegram/screens.js +2028 -0
- package/dist/entrypoints/telegram.d.ts +11 -3
- package/dist/entrypoints/telegram.d.ts.map +1 -1
- package/dist/entrypoints/telegram.js +779 -159
- package/dist/entrypoints/testing.js +75 -79
- package/dist/entrypoints/tools/connections.js +30 -32
- package/dist/entrypoints/tools/contract.js +18 -20
- package/dist/entrypoints/tools/invoker.js +12 -17
- package/dist/entrypoints/tools.js +224 -229
- package/dist/entrypoints/tracking/server.js +6 -6
- package/dist/entrypoints/tracking.js +40 -42
- package/dist/entrypoints/voice.js +3 -3
- package/dist/{index-eaysmdtq.js → index-0ndk4555.js} +56 -56
- package/dist/{index-2bxbyab0.js → index-1bx1xv1k.js} +1 -1
- package/dist/{index-p5r7qpdd.js → index-1eeqpadm.js} +4 -4
- package/dist/{index-hadmp193.js → index-3ct7hhq6.js} +210 -210
- package/dist/{index-e01r054k.js → index-45tdvqa3.js} +26 -26
- package/dist/{index-dce5wxcq.js → index-4s0fep5q.js} +8 -8
- package/dist/index-50ejfz75.js +9 -0
- package/dist/{index-m9zn6cpq.js → index-5107q189.js} +12 -12
- package/dist/{index-sbdmyz75.js → index-5cc6r990.js} +3 -3
- package/dist/{index-c6bxbsnc.js → index-7kxw1awn.js} +2 -2
- package/dist/{index-0r0fbk7z.js → index-7z9ym7t8.js} +28 -28
- package/dist/{index-p7hgdyhb.js → index-814xpr6d.js} +2 -2
- package/dist/{index-gtj3zc53.js → index-8kzct1d6.js} +99 -99
- package/dist/{index-1zbbzgfh.js → index-9pw0a51a.js} +4 -4
- package/dist/{index-79z7m7dt.js → index-a9pd417t.js} +35 -35
- package/dist/{index-ham5sz8m.js → index-aaj97r4y.js} +45 -45
- package/dist/{index-s812ycat.js → index-aan6hqb9.js} +3 -3
- package/dist/{index-10x2hbx0.js → index-adhgd4pe.js} +44 -44
- package/dist/{index-2gxzjvyr.js → index-afjvjyck.js} +23 -23
- package/dist/{index-qmy6zq75.js → index-ahvsksw5.js} +16 -16
- package/dist/{index-hr4tzbwq.js → index-ap3gqe56.js} +3 -3
- package/dist/{index-znfs20ss.js → index-b2bz0kdm.js} +16 -16
- package/dist/{index-r066jx76.js → index-c6aagrbd.js} +148 -120
- package/dist/{index-k30h66yd.js → index-ck71tbcf.js} +9 -9
- package/dist/{index-eqqvgdb3.js → index-ct75c3at.js} +2 -2
- package/dist/{index-gw8bmyaj.js → index-djjhhgjk.js} +41 -41
- package/dist/{index-8qt2m66q.js → index-dvwj1f43.js} +43 -43
- package/dist/index-e05cjgtf.js +144 -0
- package/dist/{index-yw4fzmdz.js → index-e6c2spsd.js} +79 -30
- package/dist/{index-fhwqwxe0.js → index-ej331hah.js} +1 -1
- package/dist/{index-9t3dffv2.js → index-ewbaywk5.js} +5 -5
- package/dist/{index-7p1f0vp2.js → index-fyphpknh.js} +25 -25
- package/dist/{index-83bdg97s.js → index-g149e9pk.js} +1 -1
- package/dist/{index-ngfhvfpd.js → index-g6a3na27.js} +4 -4
- package/dist/{index-qwhynv6x.js → index-h124epcf.js} +20 -20
- package/dist/{index-h6eeys1v.js → index-h97tqqp1.js} +9 -9
- package/dist/{index-zcgf3gqf.js → index-hby4qhax.js} +10 -10
- package/dist/{index-5jrd0yng.js → index-j8aw2c0e.js} +4 -4
- package/dist/{index-d8m8zpd8.js → index-jzczzcsb.js} +14 -14
- package/dist/index-kqnd6a85.js +26 -0
- package/dist/{index-35mh5bhj.js → index-kw1ws0cs.js} +12 -12
- package/dist/{index-4gcnakhx.js → index-m38ej7e5.js} +2 -2
- package/dist/{index-ndddxtyx.js → index-m79yr938.js} +19 -19
- package/dist/{index-5p2m7we1.js → index-m9fndta6.js} +11 -11
- package/dist/index-mnkk1ffz.js +150 -0
- package/dist/index-n15jny5b.js +4 -0
- package/dist/{index-2vtcmrj9.js → index-n53mswt3.js} +20 -20
- package/dist/{index-bt14acb5.js → index-n5yqxd3d.js} +21 -21
- package/dist/{index-bm5rx7n6.js → index-n9tyz8z3.js} +12 -12
- package/dist/index-nmaqxdx7.js +463 -0
- package/dist/{index-mqv3b5rh.js → index-nx6eazt0.js} +30 -30
- package/dist/{index-3z73fh2c.js → index-q0th8q0z.js} +9 -9
- package/dist/{index-v260df89.js → index-qjeggp8w.js} +20 -20
- package/dist/{index-zfrhfn82.js → index-r1z0rd9c.js} +20 -20
- package/dist/{index-wqgjfstn.js → index-r5c4fedv.js} +3 -3
- package/dist/{index-cyktc4bp.js → index-r5hsgkz5.js} +118 -118
- package/dist/{index-0b1ess5e.js → index-r7a7r7ha.js} +1 -1
- package/dist/{index-1j8pm5t0.js → index-rfkh44ss.js} +15 -15
- package/dist/index-rz3z13e9.js +47 -0
- package/dist/{index-k6gpggb9.js → index-s80awwsw.js} +35 -35
- package/dist/{index-vqr7f7v8.js → index-ssmd41kh.js} +124 -124
- package/dist/index-sznqf8fx.js +20 -0
- package/dist/{index-ensd0r74.js → index-v14qqmys.js} +41 -41
- package/dist/{index-paz6sgdp.js → index-v4a2fjtk.js} +36 -36
- package/dist/{index-d9pk3td4.js → index-w0eqdhyd.js} +14 -14
- package/dist/{index-5qn1kx34.js → index-w575evhq.js} +29 -29
- package/dist/{index-3gye9wzb.js → index-w5s3xftz.js} +26 -26
- package/dist/{index-tm88avnj.js → index-wykebpn9.js} +3 -3
- package/dist/{index-sh3s86na.js → index-xkhk5d6g.js} +17 -17
- package/dist/{index-6k1937bx.js → index-xqhede6x.js} +4 -4
- package/dist/{index-f4fx2tza.js → index-zs4ms3th.js} +181 -181
- package/dist/{index-k5hsfc3j.js → index-zsvzhjtk.js} +1 -1
- package/dist/internal/secret-shapes.d.ts +21 -0
- package/dist/internal/secret-shapes.d.ts.map +1 -0
- package/dist/observability/bounded-logger.d.ts +2 -0
- package/dist/observability/bounded-logger.d.ts.map +1 -1
- package/dist/observability/sanitize.d.ts +6 -0
- package/dist/observability/sanitize.d.ts.map +1 -1
- package/dist/observability/secret-values.d.ts +25 -0
- package/dist/observability/secret-values.d.ts.map +1 -0
- package/dist/react/keyboard/hooks.d.ts +71 -0
- package/dist/react/keyboard/hooks.d.ts.map +1 -0
- package/dist/react/keyboard/layers.d.ts +98 -0
- package/dist/react/keyboard/layers.d.ts.map +1 -0
- package/dist/react/keyboard/zone.d.ts +139 -0
- package/dist/react/keyboard/zone.d.ts.map +1 -0
- package/dist/telegram/bot-api.d.ts +7 -4
- package/dist/telegram/bot-api.d.ts.map +1 -1
- package/dist/telegram/crypto.d.ts +16 -0
- package/dist/telegram/crypto.d.ts.map +1 -0
- package/dist/telegram/html/check.d.ts +26 -0
- package/dist/telegram/html/check.d.ts.map +1 -0
- package/dist/telegram/html/nodes.d.ts +70 -0
- package/dist/telegram/html/nodes.d.ts.map +1 -0
- package/dist/telegram/html/parse.d.ts +35 -0
- package/dist/telegram/html/parse.d.ts.map +1 -0
- package/dist/telegram/html/render.d.ts +39 -0
- package/dist/telegram/html/render.d.ts.map +1 -0
- package/dist/telegram/init-data.d.ts +3 -44
- package/dist/telegram/init-data.d.ts.map +1 -1
- package/dist/telegram/operator-channel.d.ts +19 -3
- package/dist/telegram/operator-channel.d.ts.map +1 -1
- package/dist/telegram/operator-dedupe.d.ts +44 -0
- package/dist/telegram/operator-dedupe.d.ts.map +1 -0
- package/dist/telegram/screens/callback-codec.d.ts +34 -0
- package/dist/telegram/screens/callback-codec.d.ts.map +1 -0
- package/dist/telegram/screens/dispatch.d.ts +22 -0
- package/dist/telegram/screens/dispatch.d.ts.map +1 -0
- package/dist/telegram/screens/display.d.ts +70 -0
- package/dist/telegram/screens/display.d.ts.map +1 -0
- package/dist/telegram/screens/execute.d.ts +57 -0
- package/dist/telegram/screens/execute.d.ts.map +1 -0
- package/dist/telegram/screens/html.d.ts +36 -0
- package/dist/telegram/screens/html.d.ts.map +1 -0
- package/dist/telegram/screens/outcome.d.ts +74 -0
- package/dist/telegram/screens/outcome.d.ts.map +1 -0
- package/dist/telegram/screens/path.d.ts +29 -0
- package/dist/telegram/screens/path.d.ts.map +1 -0
- package/dist/telegram/screens/reconcile.d.ts +67 -0
- package/dist/telegram/screens/reconcile.d.ts.map +1 -0
- package/dist/telegram/screens/registry.d.ts +23 -0
- package/dist/telegram/screens/registry.d.ts.map +1 -0
- package/dist/telegram/screens/render.d.ts +70 -0
- package/dist/telegram/screens/render.d.ts.map +1 -0
- package/dist/telegram/screens/runtime.d.ts +133 -0
- package/dist/telegram/screens/runtime.d.ts.map +1 -0
- package/dist/telegram/screens/screen-types.d.ts +130 -0
- package/dist/telegram/screens/screen-types.d.ts.map +1 -0
- package/dist/telegram/screens/screen.d.ts +138 -0
- package/dist/telegram/screens/screen.d.ts.map +1 -0
- package/dist/telegram/screens/state.d.ts +115 -0
- package/dist/telegram/screens/state.d.ts.map +1 -0
- package/dist/telegram/screens/telegram-screens.d.ts +18 -0
- package/dist/telegram/screens/telegram-screens.d.ts.map +1 -0
- package/dist/telegram/screens/test-chat-telegram.d.ts +47 -0
- package/dist/telegram/screens/test-chat-telegram.d.ts.map +1 -0
- package/dist/telegram/screens/test-chat.d.ts +66 -0
- package/dist/telegram/screens/test-chat.d.ts.map +1 -0
- package/dist/telegram/screens/view.d.ts +89 -0
- package/dist/telegram/screens/view.d.ts.map +1 -0
- package/dist/telegram/send-failure.d.ts +25 -0
- package/dist/telegram/send-failure.d.ts.map +1 -1
- package/dist/telegram/update-intake.d.ts +82 -0
- package/dist/telegram/update-intake.d.ts.map +1 -0
- package/dist/telegram/update-store-check.d.ts +22 -0
- package/dist/telegram/update-store-check.d.ts.map +1 -0
- package/dist/telegram/update-store-postgres.d.ts +33 -0
- package/dist/telegram/update-store-postgres.d.ts.map +1 -0
- package/dist/telegram/update-store-sqlite.d.ts +26 -0
- package/dist/telegram/update-store-sqlite.d.ts.map +1 -0
- package/dist/telegram/update-store.d.ts +67 -0
- package/dist/telegram/update-store.d.ts.map +1 -0
- package/dist/telegram/user.d.ts +51 -0
- package/dist/telegram/user.d.ts.map +1 -0
- package/dist/telegram/webhook.d.ts +105 -0
- package/dist/telegram/webhook.d.ts.map +1 -0
- package/dist/tools/cli/args-fields.d.ts +8 -0
- package/dist/tools/cli/args-fields.d.ts.map +1 -1
- package/dist/tools/cli/args-route.d.ts.map +1 -1
- package/dist/tools/cli/args.d.ts.map +1 -1
- package/dist/tools/cli/help.d.ts.map +1 -1
- package/llms/cli.txt +8 -2
- package/llms/observability.txt +15 -2
- package/llms/react-keyboard.txt +193 -0
- package/llms/server.4.txt +16 -0
- package/llms/stitchkit.txt +10 -4
- package/llms/telegram-html.txt +35 -0
- package/llms/telegram-screens.txt +365 -0
- package/llms/telegram.txt +245 -11
- package/llms/{upgrading-0.74.0-0.100.0.txt → upgrading-0.74.0-0.101.0.txt} +39 -3
- package/llms/upgrading.txt +1 -1
- package/llms-full.txt +889 -19
- package/llms.txt +12 -7
- package/package.json +17 -2
- package/dist/index-2k4yrqkc.js +0 -9
- package/dist/index-crykmqkr.js +0 -26
- package/dist/index-y64k3s0h.js +0 -150
- package/dist/index-y91ry9h2.js +0 -4
- /package/dist/{index-hffjpmq9.js → index-9jfdm5tg.js} +0 -0
- /package/dist/{index-zjjyynm3.js → index-d4pa2bgs.js} +0 -0
- /package/dist/{index-rxfy4cq7.js → index-dwfv9a85.js} +0 -0
- /package/dist/{index-5jm36zv1.js → index-gfk7nrht.js} +0 -0
- /package/dist/{index-b9aefrqd.js → index-n1dqr7gf.js} +0 -0
- /package/dist/{index-q3pyb9n0.js → index-sykb5ag7.js} +0 -0
- /package/dist/{index-48ffdxgk.js → index-xhzq2qvj.js} +0 -0
- /package/dist/{index-kzfs85xp.js → index-zsarb5xp.js} +0 -0
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
ApplicationSnapshotSchema
|
|
5
|
-
} from "./index-3gye9wzb.js";
|
|
2
|
+
AppError2
|
|
3
|
+
} from "./index-n53mswt3.js";
|
|
6
4
|
import {
|
|
7
|
-
|
|
8
|
-
} from "./index-
|
|
5
|
+
ShutdownOptionsSchema2
|
|
6
|
+
} from "./index-q0th8q0z.js";
|
|
9
7
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
ApplicationIdSchema2,
|
|
9
|
+
ApplicationSnapshotSchema2,
|
|
10
|
+
ApplicationShutdownResultSchema2
|
|
11
|
+
} from "./index-w5s3xftz.js";
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
} from "./index-
|
|
13
|
+
managedResourceDependencyId2
|
|
14
|
+
} from "./index-50ejfz75.js";
|
|
15
15
|
|
|
16
16
|
// src/application/kernel-contract.ts
|
|
17
17
|
import { z } from "zod";
|
|
18
|
-
var
|
|
18
|
+
var ApplicationShutdownOptionsSchema2 = ShutdownOptionsSchema2.pick({
|
|
19
19
|
gracePeriodMs: true,
|
|
20
20
|
forceTimeoutMs: true,
|
|
21
21
|
signal: true
|
|
22
22
|
});
|
|
23
|
-
var
|
|
23
|
+
var ApplicationShutdownBudgetSchema2 = ShutdownOptionsSchema2.pick({
|
|
24
24
|
gracePeriodMs: true,
|
|
25
25
|
forceTimeoutMs: true
|
|
26
26
|
});
|
|
27
|
-
var
|
|
27
|
+
var ApplicationRestartInputSchema2 = z.object({
|
|
28
28
|
resourceId: z.string().min(1),
|
|
29
29
|
gracePeriodMs: z.number().int().nonnegative().optional(),
|
|
30
30
|
forceTimeoutMs: z.number().int().nonnegative().optional()
|
|
31
31
|
}).strict().readonly();
|
|
32
|
-
var
|
|
33
|
-
var
|
|
32
|
+
var ApplicationRestartOutcomeSchema2 = z.enum(["restarted", "failed", "refused"]);
|
|
33
|
+
var ApplicationRestartResultSchema2 = z.object({
|
|
34
34
|
resourceId: z.string(),
|
|
35
35
|
affected: z.array(z.string()).readonly(),
|
|
36
|
-
outcome:
|
|
36
|
+
outcome: ApplicationRestartOutcomeSchema2,
|
|
37
37
|
reason: z.string().optional(),
|
|
38
38
|
durationMs: z.number().int().nonnegative()
|
|
39
39
|
}).strict().readonly();
|
|
40
40
|
|
|
41
|
-
class
|
|
41
|
+
class ApplicationAdmissionError2 extends AppError2 {
|
|
42
42
|
constructor() {
|
|
43
43
|
super("APPLICATION_NOT_ACCEPTING", "Application is not accepting new operations", 503);
|
|
44
44
|
this.name = "ApplicationAdmissionError";
|
|
@@ -49,8 +49,8 @@ class ApplicationAdmissionError extends AppError {
|
|
|
49
49
|
function resolveResourceGraph(resources) {
|
|
50
50
|
const entries = resources.map((resource, declarationIndex) => ({
|
|
51
51
|
resource,
|
|
52
|
-
id:
|
|
53
|
-
dependsOn: [...resource.dependsOn ?? []].map((dependency) =>
|
|
52
|
+
id: ApplicationIdSchema2.parse(resource.id),
|
|
53
|
+
dependsOn: [...resource.dependsOn ?? []].map((dependency) => ApplicationIdSchema2.parse(managedResourceDependencyId2(dependency))),
|
|
54
54
|
required: resource.required ?? true,
|
|
55
55
|
declarationIndex
|
|
56
56
|
}));
|
|
@@ -121,9 +121,9 @@ async function untilDeadline(work, signal) {
|
|
|
121
121
|
return result;
|
|
122
122
|
}
|
|
123
123
|
function createKernelState(config) {
|
|
124
|
-
const id =
|
|
124
|
+
const id = ApplicationIdSchema2.parse(config.id);
|
|
125
125
|
const ordered = resolveResourceGraph(config.resources ?? []);
|
|
126
|
-
const shutdownBudget =
|
|
126
|
+
const shutdownBudget = ApplicationShutdownBudgetSchema2.parse(config.shutdown ?? {});
|
|
127
127
|
const reverse = [...ordered].reverse();
|
|
128
128
|
const records = new Map;
|
|
129
129
|
for (const entry of ordered) {
|
|
@@ -202,7 +202,7 @@ function isReady(state) {
|
|
|
202
202
|
return state.lifecycle === "ready" && [...state.records.values()].every((record) => !record.entry.required || record.state === "ready" && record.health === "healthy");
|
|
203
203
|
}
|
|
204
204
|
function snapshot(state) {
|
|
205
|
-
return
|
|
205
|
+
return ApplicationSnapshotSchema2.parse({
|
|
206
206
|
id: state.id,
|
|
207
207
|
epoch: state.epoch,
|
|
208
208
|
revision: state.revision,
|
|
@@ -276,7 +276,7 @@ function acquire(state) {
|
|
|
276
276
|
async function run(state, work) {
|
|
277
277
|
const lease = acquire(state);
|
|
278
278
|
if (!lease)
|
|
279
|
-
throw new
|
|
279
|
+
throw new ApplicationAdmissionError2;
|
|
280
280
|
try {
|
|
281
281
|
return await work();
|
|
282
282
|
} finally {
|
|
@@ -307,7 +307,7 @@ function acquireWhenAccepting(state, signal) {
|
|
|
307
307
|
}
|
|
308
308
|
if (state.shutdownRequested || state.lifecycle === "failed" || state.lifecycle === "stopped") {
|
|
309
309
|
finish();
|
|
310
|
-
reject(new
|
|
310
|
+
reject(new ApplicationAdmissionError2);
|
|
311
311
|
return true;
|
|
312
312
|
}
|
|
313
313
|
const lease = acquire(state);
|
|
@@ -660,7 +660,7 @@ async function closeOne(state, entry, record, signal, deadlines) {
|
|
|
660
660
|
}
|
|
661
661
|
async function runRestart(state, input) {
|
|
662
662
|
const startedAt = Date.now();
|
|
663
|
-
const parsed =
|
|
663
|
+
const parsed = ApplicationRestartInputSchema2.parse(input);
|
|
664
664
|
const affected = subtreeOf(state, parsed.resourceId);
|
|
665
665
|
const affectedIds = affected.map((entry) => entry.id);
|
|
666
666
|
const refuse = (reason) => ({
|
|
@@ -889,7 +889,7 @@ function shutdownResult(shutdown, mustForce, pendingOperationsAtForce) {
|
|
|
889
889
|
const cleanupComplete = [...state.records.values()].every((record) => !record.attempted || record.closed);
|
|
890
890
|
state.lifecycle = cleanupComplete ? "stopped" : "failed";
|
|
891
891
|
publish(state);
|
|
892
|
-
return
|
|
892
|
+
return ApplicationShutdownResultSchema2.parse({
|
|
893
893
|
outcome: mustForce ? "forced" : "clean",
|
|
894
894
|
...shutdown.forcedReason && { reason: shutdown.forcedReason },
|
|
895
895
|
cleanupComplete,
|
|
@@ -951,7 +951,7 @@ function shutdown(state, options) {
|
|
|
951
951
|
if (state.shutdownPromise)
|
|
952
952
|
return state.shutdownPromise;
|
|
953
953
|
const requested = options ?? {};
|
|
954
|
-
const parsed =
|
|
954
|
+
const parsed = ApplicationShutdownOptionsSchema2.parse({
|
|
955
955
|
gracePeriodMs: requested.gracePeriodMs ?? state.shutdownBudget.gracePeriodMs,
|
|
956
956
|
forceTimeoutMs: requested.forceTimeoutMs ?? state.shutdownBudget.forceTimeoutMs,
|
|
957
957
|
...requested.signal !== undefined && { signal: requested.signal }
|
|
@@ -971,7 +971,7 @@ function shutdown(state, options) {
|
|
|
971
971
|
}
|
|
972
972
|
|
|
973
973
|
// src/application/kernel.ts
|
|
974
|
-
function
|
|
974
|
+
function createApplication2(config) {
|
|
975
975
|
const state = createKernelState(config);
|
|
976
976
|
return {
|
|
977
977
|
id: state.id,
|
|
@@ -991,4 +991,4 @@ function createApplication(config) {
|
|
|
991
991
|
};
|
|
992
992
|
}
|
|
993
993
|
|
|
994
|
-
export {
|
|
994
|
+
export { ApplicationShutdownOptionsSchema2, ApplicationShutdownBudgetSchema2, ApplicationRestartInputSchema2, ApplicationRestartOutcomeSchema2, ApplicationRestartResultSchema2, ApplicationAdmissionError2, createApplication2 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/application/schemas.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var ApplicationIdSchema2 = z.string().min(1).max(128).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]*$/);
|
|
4
|
+
var ApplicationLifecycleSchema2 = z.enum([
|
|
5
5
|
"created",
|
|
6
6
|
"starting",
|
|
7
7
|
"ready",
|
|
@@ -10,8 +10,8 @@ var ApplicationLifecycleSchema = z.enum([
|
|
|
10
10
|
"stopped",
|
|
11
11
|
"failed"
|
|
12
12
|
]);
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var ApplicationHealthSchema2 = z.enum(["unknown", "healthy", "degraded", "unhealthy"]);
|
|
14
|
+
var ManagedResourceStateSchema2 = z.enum([
|
|
15
15
|
"registered",
|
|
16
16
|
"starting",
|
|
17
17
|
"ready",
|
|
@@ -20,37 +20,37 @@ var ManagedResourceStateSchema = z.enum([
|
|
|
20
20
|
"stopped"
|
|
21
21
|
]);
|
|
22
22
|
var NonNegativeIntegerSchema = z.number().int().nonnegative();
|
|
23
|
-
var
|
|
23
|
+
var ApplicationAdmissionSnapshotSchema2 = z.object({
|
|
24
24
|
accepting: z.boolean(),
|
|
25
25
|
accepted: NonNegativeIntegerSchema,
|
|
26
26
|
completed: NonNegativeIntegerSchema,
|
|
27
27
|
pending: NonNegativeIntegerSchema
|
|
28
28
|
}).readonly();
|
|
29
|
-
var
|
|
30
|
-
id:
|
|
29
|
+
var ManagedResourceSnapshotSchema2 = z.object({
|
|
30
|
+
id: ApplicationIdSchema2,
|
|
31
31
|
required: z.boolean(),
|
|
32
|
-
dependsOn: z.array(
|
|
33
|
-
state:
|
|
34
|
-
health:
|
|
32
|
+
dependsOn: z.array(ApplicationIdSchema2).readonly(),
|
|
33
|
+
state: ManagedResourceStateSchema2,
|
|
34
|
+
health: ApplicationHealthSchema2,
|
|
35
35
|
ready: z.boolean()
|
|
36
36
|
}).readonly();
|
|
37
|
-
var
|
|
38
|
-
id:
|
|
37
|
+
var ApplicationSnapshotSchema2 = z.object({
|
|
38
|
+
id: ApplicationIdSchema2,
|
|
39
39
|
epoch: z.string().uuid(),
|
|
40
40
|
revision: NonNegativeIntegerSchema,
|
|
41
|
-
lifecycle:
|
|
42
|
-
health:
|
|
41
|
+
lifecycle: ApplicationLifecycleSchema2,
|
|
42
|
+
health: ApplicationHealthSchema2,
|
|
43
43
|
ready: z.boolean(),
|
|
44
44
|
capturedAt: z.string().datetime({ offset: true }),
|
|
45
45
|
changedAt: z.string().datetime({ offset: true }),
|
|
46
|
-
admission:
|
|
47
|
-
resources: z.array(
|
|
46
|
+
admission: ApplicationAdmissionSnapshotSchema2,
|
|
47
|
+
resources: z.array(ManagedResourceSnapshotSchema2).readonly(),
|
|
48
48
|
restarting: z.array(z.string()).readonly()
|
|
49
49
|
}).readonly();
|
|
50
|
-
var
|
|
51
|
-
id:
|
|
52
|
-
lifecycle:
|
|
53
|
-
health:
|
|
50
|
+
var ApplicationStatusProjectionSchema2 = z.object({
|
|
51
|
+
id: ApplicationIdSchema2,
|
|
52
|
+
lifecycle: ApplicationLifecycleSchema2,
|
|
53
|
+
health: ApplicationHealthSchema2,
|
|
54
54
|
ready: z.boolean(),
|
|
55
55
|
capturedAt: z.string().datetime({ offset: true }),
|
|
56
56
|
resources: z.object({
|
|
@@ -61,7 +61,7 @@ var ApplicationStatusProjectionSchema = z.object({
|
|
|
61
61
|
}).readonly(),
|
|
62
62
|
restarting: NonNegativeIntegerSchema
|
|
63
63
|
}).readonly();
|
|
64
|
-
function
|
|
64
|
+
function projectApplicationStatus2(snapshot) {
|
|
65
65
|
let ready = 0;
|
|
66
66
|
let degraded = 0;
|
|
67
67
|
let failed = 0;
|
|
@@ -83,12 +83,12 @@ function projectApplicationStatus(snapshot) {
|
|
|
83
83
|
restarting: snapshot.restarting.length
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
-
var
|
|
87
|
-
id:
|
|
86
|
+
var ApplicationResourceShutdownSchema2 = z.object({
|
|
87
|
+
id: ApplicationIdSchema2,
|
|
88
88
|
state: z.enum(["not-started", "closed", "force-failed"]),
|
|
89
89
|
failures: z.array(z.enum(["start", "ready", "completion", "admission", "drain", "close", "force"])).readonly()
|
|
90
90
|
}).readonly();
|
|
91
|
-
var
|
|
91
|
+
var ApplicationShutdownResultSchema2 = z.object({
|
|
92
92
|
outcome: z.enum(["clean", "forced"]),
|
|
93
93
|
reason: z.enum(["deadline", "signal"]).optional(),
|
|
94
94
|
cleanupComplete: z.boolean(),
|
|
@@ -96,8 +96,8 @@ var ApplicationShutdownResultSchema = z.object({
|
|
|
96
96
|
completedOperations: NonNegativeIntegerSchema,
|
|
97
97
|
pendingOperations: NonNegativeIntegerSchema,
|
|
98
98
|
pendingOperationsAtForce: NonNegativeIntegerSchema,
|
|
99
|
-
resources: z.array(
|
|
99
|
+
resources: z.array(ApplicationResourceShutdownSchema2).readonly(),
|
|
100
100
|
durationMs: z.number().nonnegative()
|
|
101
101
|
}).readonly();
|
|
102
102
|
|
|
103
|
-
export {
|
|
103
|
+
export { ApplicationIdSchema2, ApplicationLifecycleSchema2, ApplicationHealthSchema2, ManagedResourceStateSchema2, ApplicationAdmissionSnapshotSchema2, ManagedResourceSnapshotSchema2, ApplicationSnapshotSchema2, ApplicationStatusProjectionSchema2, projectApplicationStatus2, ApplicationResourceShutdownSchema2, ApplicationShutdownResultSchema2 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isRecord
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-9jfdm5tg.js";
|
|
4
4
|
|
|
5
5
|
// src/application/file-state-store.ts
|
|
6
6
|
import { mkdir, open, readdir, readFile, rename, stat, unlink } from "node:fs/promises";
|
|
@@ -89,7 +89,7 @@ async function reclaim(lockPath, observed, staleLockMs, abandonedAfterMs) {
|
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function createFileStateStore2(path, options) {
|
|
93
93
|
const lockPath = `${path}.lock`;
|
|
94
94
|
const lockTimeoutMs = options.lockTimeoutMs ?? 1e4;
|
|
95
95
|
const staleLockMs = options.staleLockMs ?? 3000;
|
|
@@ -218,4 +218,4 @@ function createFileStateStore(path, options) {
|
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
export {
|
|
221
|
+
export { createFileStateStore2 };
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
AgentToolError2,
|
|
3
3
|
resolveToolDurability
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-a9pd417t.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
toolResultFromError,
|
|
7
|
+
toolCauseFromResult,
|
|
8
|
+
isToolExecutionControlError2
|
|
9
|
+
} from "./index-dvwj1f43.js";
|
|
8
10
|
import {
|
|
9
11
|
createToolRunner,
|
|
10
12
|
formatToolError
|
|
11
|
-
} from "./index-
|
|
13
|
+
} from "./index-n9tyz8z3.js";
|
|
12
14
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
toolResultFromError
|
|
16
|
-
} from "./index-8qt2m66q.js";
|
|
15
|
+
collectToolSurface
|
|
16
|
+
} from "./index-ewbaywk5.js";
|
|
17
17
|
import {
|
|
18
18
|
isRecord
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-9jfdm5tg.js";
|
|
20
20
|
|
|
21
21
|
// src/tools/agent.ts
|
|
22
22
|
import { jsonSchema, tool } from "ai";
|
|
23
|
-
function
|
|
23
|
+
function mountAgent2(services, config = {}) {
|
|
24
24
|
const serviceList = Array.isArray(services) ? services : [services];
|
|
25
25
|
if (config.registry && config.runtimeTools) {
|
|
26
26
|
throw new Error("mountAgent accepts either runtimeTools or a registry, not both");
|
|
@@ -67,13 +67,13 @@ function mountAgent(services, config = {}) {
|
|
|
67
67
|
onOutputStrip: config.onOutputStrip
|
|
68
68
|
}) : runTool;
|
|
69
69
|
const result = await executeTool(mountable, args, callContext).catch((err) => {
|
|
70
|
-
if (
|
|
70
|
+
if (isToolExecutionControlError2(err))
|
|
71
71
|
throw err;
|
|
72
|
-
throw new
|
|
72
|
+
throw new AgentToolError2(formatToolError(toolResultFromError(err), mountable.name, config.errorHint), err);
|
|
73
73
|
});
|
|
74
74
|
if (result.ok)
|
|
75
75
|
return result.data;
|
|
76
|
-
throw new
|
|
76
|
+
throw new AgentToolError2(formatToolError(result, mountable.name, config.errorHint), toolCauseFromResult(result));
|
|
77
77
|
};
|
|
78
78
|
const presenter = entry.kind === "runtime" ? entry.definition.present?.agent : undefined;
|
|
79
79
|
if (entry.kind === "runtime" && presenter) {
|
|
@@ -112,7 +112,7 @@ function mountAgent(services, config = {}) {
|
|
|
112
112
|
function utf8Length(value) {
|
|
113
113
|
return new TextEncoder().encode(JSON.stringify(value)).byteLength;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function describeToolCatalog2(config) {
|
|
116
116
|
const deferred = new Set(config.deferredNames ?? []);
|
|
117
117
|
const entries = collectToolSurface({
|
|
118
118
|
surface: config,
|
|
@@ -138,7 +138,7 @@ function describeToolCatalog(config) {
|
|
|
138
138
|
}
|
|
139
139
|
return entries;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function buildToolManifest2(config) {
|
|
142
142
|
return collectToolSurface({
|
|
143
143
|
surface: config,
|
|
144
144
|
transport: config.transport,
|
|
@@ -151,4 +151,4 @@ function buildToolManifest(config) {
|
|
|
151
151
|
}));
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
export {
|
|
154
|
+
export { mountAgent2, describeToolCatalog2, buildToolManifest2 };
|
|
@@ -9,12 +9,12 @@ function isManagedFilePath(value) {
|
|
|
9
9
|
const parts = value.split("/");
|
|
10
10
|
return parts.every((part) => part.length > 0 && part !== "." && part !== "..");
|
|
11
11
|
}
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
path:
|
|
12
|
+
var ManagedFilePathSchema2 = z.string().refine(isManagedFilePath, "expected a canonical relative managed-file path");
|
|
13
|
+
var ManagedFileRefSchema2 = z.object({
|
|
14
|
+
path: ManagedFilePathSchema2,
|
|
15
15
|
size: z.number().int().nonnegative(),
|
|
16
16
|
mediaType: z.string().min(1).optional(),
|
|
17
17
|
name: z.string().min(1).optional()
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
export {
|
|
20
|
+
export { ManagedFilePathSchema2, ManagedFileRefSchema2 };
|