@neta-art/cohub-cli 10.24.0 → 10.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cohub.js +4 -1
- package/dist/board-gpu/page.js +1566 -71230
- package/dist/bootstrap.js +67 -27
- package/dist/build.json +1 -1
- package/dist/{board-kernel/FilterPipe.js → chunks/Geometry.js} +10447 -10469
- package/dist/chunks/about.js +102 -0
- package/dist/chunks/app-realtime.js +2216 -0
- package/dist/chunks/app-realtime2.js +2 -0
- package/dist/chunks/app-ref.js +88 -0
- package/dist/chunks/apps.js +1423 -0
- package/dist/chunks/auth.js +175 -0
- package/dist/chunks/avatar.js +146 -0
- package/dist/chunks/binary-pins.js +5 -0
- package/dist/chunks/board-export-resources.js +232 -0
- package/dist/chunks/board-export.js +874 -0
- package/dist/chunks/board-export2.js +2 -0
- package/dist/{board-kernel.js → chunks/board-kernel.js} +18032 -28512
- package/dist/chunks/board-kernel2.js +4 -0
- package/dist/chunks/board-profile.js +69 -0
- package/dist/chunks/board-simulate.js +315 -0
- package/dist/chunks/board-time.js +34 -0
- package/dist/chunks/boards.js +1943 -0
- package/dist/{board-kernel → chunks}/browserAll.js +9 -8
- package/dist/chunks/channels.js +64 -0
- package/dist/chunks/client.js +12606 -0
- package/dist/chunks/command-input.js +17 -0
- package/dist/chunks/commander.js +2962 -0
- package/dist/chunks/cron-jobs.js +163 -0
- package/dist/chunks/daemon.js +545 -0
- package/dist/chunks/daemon2.js +2 -0
- package/dist/chunks/desktop.js +172 -0
- package/dist/chunks/endpoint-options.js +26 -0
- package/dist/chunks/env-proxy.js +35 -0
- package/dist/chunks/environment.js +154 -0
- package/dist/chunks/feedback.js +120 -0
- package/dist/chunks/generations.js +379 -0
- package/dist/chunks/host.js +9 -0
- package/dist/chunks/http-put.js +131 -0
- package/dist/chunks/id.js +2416 -0
- package/dist/{board-kernel → chunks}/init.js +1 -1
- package/dist/chunks/install.js +11959 -0
- package/dist/chunks/launch.js +374 -0
- package/dist/chunks/local-media.js +47 -0
- package/dist/chunks/me.js +134 -0
- package/dist/chunks/media.js +315 -0
- package/dist/chunks/models.js +242 -0
- package/dist/chunks/operands.js +46 -0
- package/dist/chunks/package-paths.js +13 -0
- package/dist/chunks/policy.js +221 -0
- package/dist/chunks/preferences.js +29 -0
- package/dist/chunks/profile.js +64 -0
- package/dist/chunks/prompts.js +41 -0
- package/dist/chunks/public.js +2 -0
- package/dist/chunks/public2.js +244 -0
- package/dist/chunks/references.js +197 -0
- package/dist/chunks/referrals.js +90 -0
- package/dist/chunks/rolldown-runtime.js +26 -0
- package/dist/chunks/rooms-connect.js +2 -0
- package/dist/chunks/rooms-connect2.js +151 -0
- package/dist/chunks/rooms-rtc.js +311 -0
- package/dist/chunks/rooms.js +211 -0
- package/dist/chunks/run.js +220 -0
- package/dist/chunks/runtime.js +638 -0
- package/dist/chunks/runtime2.js +286 -0
- package/dist/chunks/runtimes.js +48 -0
- package/dist/chunks/safe-remote-image.js +198 -0
- package/dist/chunks/schemas.js +6017 -0
- package/dist/chunks/search.js +113 -0
- package/dist/chunks/self-update.js +238 -0
- package/dist/chunks/serve.js +1246 -0
- package/dist/chunks/session-status.js +24 -0
- package/dist/chunks/skills.js +35 -0
- package/dist/chunks/spaces.js +5080 -0
- package/dist/chunks/src.js +405 -0
- package/dist/chunks/supervisor.js +2513 -0
- package/dist/chunks/supervisor2.js +2 -0
- package/dist/chunks/tasks.js +82 -0
- package/dist/chunks/themes.js +2898 -0
- package/dist/chunks/version.js +2 -0
- package/dist/chunks/version2.js +22 -0
- package/dist/chunks/version3.js +18 -0
- package/dist/chunks/web.js +7 -0
- package/dist/{board-kernel → chunks}/webworkerAll.js +1 -1
- package/dist/runtime/native/pi-extension.js +174 -166
- package/dist/runtime/worker.js +27 -16
- package/package.json +8 -9
- package/dist/about.d.ts +0 -2
- package/dist/about.js +0 -71
- package/dist/app-download.d.ts +0 -11
- package/dist/app-download.js +0 -252
- package/dist/app-ref.d.ts +0 -5
- package/dist/app-ref.js +0 -8
- package/dist/app-target.d.ts +0 -26
- package/dist/app-target.js +0 -55
- package/dist/auth.d.ts +0 -45
- package/dist/auth.js +0 -307
- package/dist/avatar.d.ts +0 -55
- package/dist/avatar.js +0 -104
- package/dist/board-command-support.d.ts +0 -6
- package/dist/board-command-support.js +0 -88
- package/dist/board-export-resources.d.ts +0 -12
- package/dist/board-export-resources.js +0 -51
- package/dist/board-export.d.ts +0 -110
- package/dist/board-export.js +0 -592
- package/dist/board-fonts.d.ts +0 -11
- package/dist/board-fonts.js +0 -10
- package/dist/board-gpu/daemon.d.ts +0 -11
- package/dist/board-gpu/daemon.js +0 -295
- package/dist/board-gpu/index.d.ts +0 -33
- package/dist/board-gpu/index.js +0 -189
- package/dist/board-gpu/protocol.d.ts +0 -77
- package/dist/board-gpu/protocol.js +0 -1
- package/dist/board-kernel.d.ts +0 -5
- package/dist/board-media-export.d.ts +0 -17
- package/dist/board-media-export.js +0 -164
- package/dist/board-media.d.ts +0 -5
- package/dist/board-media.js +0 -66
- package/dist/board-profile.d.ts +0 -21
- package/dist/board-profile.js +0 -67
- package/dist/board-simulate.d.ts +0 -67
- package/dist/board-simulate.js +0 -259
- package/dist/board-time.d.ts +0 -3
- package/dist/board-time.js +0 -34
- package/dist/bootstrap.d.ts +0 -2
- package/dist/client.d.ts +0 -5
- package/dist/client.js +0 -24
- package/dist/command-input.d.ts +0 -4
- package/dist/command-input.js +0 -16
- package/dist/commands/app-commerce.d.ts +0 -2
- package/dist/commands/app-commerce.js +0 -228
- package/dist/commands/app-domains.d.ts +0 -2
- package/dist/commands/app-domains.js +0 -133
- package/dist/commands/apps.d.ts +0 -4
- package/dist/commands/apps.js +0 -827
- package/dist/commands/auth.d.ts +0 -2
- package/dist/commands/auth.js +0 -186
- package/dist/commands/boards/authoring.d.ts +0 -2
- package/dist/commands/boards/authoring.js +0 -166
- package/dist/commands/boards/examples.d.ts +0 -10
- package/dist/commands/boards/examples.js +0 -118
- package/dist/commands/boards.d.ts +0 -13
- package/dist/commands/boards.js +0 -836
- package/dist/commands/channels.d.ts +0 -2
- package/dist/commands/channels.js +0 -74
- package/dist/commands/cron-jobs.d.ts +0 -2
- package/dist/commands/cron-jobs.js +0 -155
- package/dist/commands/decision.d.ts +0 -4
- package/dist/commands/decision.js +0 -113
- package/dist/commands/desktop.d.ts +0 -10
- package/dist/commands/desktop.js +0 -233
- package/dist/commands/feedback.d.ts +0 -2
- package/dist/commands/feedback.js +0 -131
- package/dist/commands/generations.d.ts +0 -2
- package/dist/commands/generations.js +0 -427
- package/dist/commands/host.d.ts +0 -2
- package/dist/commands/host.js +0 -11
- package/dist/commands/me.d.ts +0 -2
- package/dist/commands/me.js +0 -121
- package/dist/commands/models.d.ts +0 -28
- package/dist/commands/models.js +0 -271
- package/dist/commands/profile.d.ts +0 -2
- package/dist/commands/profile.js +0 -81
- package/dist/commands/prompts.d.ts +0 -2
- package/dist/commands/prompts.js +0 -37
- package/dist/commands/public.d.ts +0 -20
- package/dist/commands/public.js +0 -291
- package/dist/commands/references.d.ts +0 -2
- package/dist/commands/references.js +0 -193
- package/dist/commands/referrals.d.ts +0 -2
- package/dist/commands/referrals.js +0 -88
- package/dist/commands/rooms-connect.d.ts +0 -17
- package/dist/commands/rooms-connect.js +0 -140
- package/dist/commands/rooms-rtc-binary.d.ts +0 -2
- package/dist/commands/rooms-rtc-binary.js +0 -107
- package/dist/commands/rooms-rtc.d.ts +0 -21
- package/dist/commands/rooms-rtc.js +0 -171
- package/dist/commands/rooms.d.ts +0 -3
- package/dist/commands/rooms.js +0 -277
- package/dist/commands/run.d.ts +0 -13
- package/dist/commands/run.js +0 -246
- package/dist/commands/runtime.d.ts +0 -3
- package/dist/commands/runtime.js +0 -320
- package/dist/commands/sandboxd-binary.d.ts +0 -11
- package/dist/commands/sandboxd-binary.js +0 -238
- package/dist/commands/search.d.ts +0 -2
- package/dist/commands/search.js +0 -114
- package/dist/commands/session-access.d.ts +0 -2
- package/dist/commands/session-access.js +0 -70
- package/dist/commands/skills.d.ts +0 -2
- package/dist/commands/skills.js +0 -34
- package/dist/commands/space-activity.d.ts +0 -26
- package/dist/commands/space-activity.js +0 -147
- package/dist/commands/space-commerce.d.ts +0 -2
- package/dist/commands/space-commerce.js +0 -514
- package/dist/commands/space-displays.d.ts +0 -2
- package/dist/commands/space-displays.js +0 -620
- package/dist/commands/space-files.d.ts +0 -5
- package/dist/commands/space-files.js +0 -215
- package/dist/commands/space-invitations.d.ts +0 -29
- package/dist/commands/space-invitations.js +0 -189
- package/dist/commands/space-turns.d.ts +0 -49
- package/dist/commands/space-turns.js +0 -205
- package/dist/commands/space-wallet.d.ts +0 -2
- package/dist/commands/space-wallet.js +0 -141
- package/dist/commands/space-webhooks.d.ts +0 -7
- package/dist/commands/space-webhooks.js +0 -73
- package/dist/commands/spaces.d.ts +0 -25
- package/dist/commands/spaces.js +0 -2170
- package/dist/commands/tasks.d.ts +0 -8
- package/dist/commands/tasks.js +0 -80
- package/dist/commands/version.d.ts +0 -2
- package/dist/commands/version.js +0 -21
- package/dist/endpoint-options.d.ts +0 -4
- package/dist/endpoint-options.js +0 -26
- package/dist/env-proxy.d.ts +0 -5
- package/dist/env-proxy.js +0 -20
- package/dist/help-path.d.ts +0 -18
- package/dist/help-path.js +0 -223
- package/dist/host/auth.d.ts +0 -20
- package/dist/host/auth.js +0 -119
- package/dist/host/login-env.d.ts +0 -1
- package/dist/host/login-env.js +0 -31
- package/dist/host/runtime.d.ts +0 -35
- package/dist/host/runtime.js +0 -395
- package/dist/host/runtimes.d.ts +0 -9
- package/dist/host/runtimes.js +0 -42
- package/dist/host/serve.d.ts +0 -2
- package/dist/host/serve.js +0 -117
- package/dist/host/workspaces.d.ts +0 -2
- package/dist/host/workspaces.js +0 -18
- package/dist/http-put.d.ts +0 -25
- package/dist/http-put.js +0 -132
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -129
- package/dist/launcher.d.ts +0 -4
- package/dist/launcher.js +0 -38
- package/dist/local-media.d.ts +0 -2
- package/dist/local-media.js +0 -30
- package/dist/network-error.d.ts +0 -3
- package/dist/network-error.js +0 -22
- package/dist/output.d.ts +0 -46
- package/dist/output.js +0 -244
- package/dist/runtime/archive-store.d.ts +0 -54
- package/dist/runtime/archive-store.js +0 -379
- package/dist/runtime/cli-path.d.ts +0 -5
- package/dist/runtime/cli-path.js +0 -27
- package/dist/runtime/codex-usage.d.ts +0 -7
- package/dist/runtime/codex-usage.js +0 -11
- package/dist/runtime/connection.d.ts +0 -42
- package/dist/runtime/connection.js +0 -789
- package/dist/runtime/diagnostics.d.ts +0 -107
- package/dist/runtime/diagnostics.js +0 -392
- package/dist/runtime/harnesses/chained-projection.d.ts +0 -40
- package/dist/runtime/harnesses/chained-projection.js +0 -95
- package/dist/runtime/harnesses/chained-transcript.d.ts +0 -24
- package/dist/runtime/harnesses/chained-transcript.js +0 -62
- package/dist/runtime/harnesses/claude-approval.d.ts +0 -34
- package/dist/runtime/harnesses/claude-approval.js +0 -124
- package/dist/runtime/harnesses/claude-transcript.d.ts +0 -8
- package/dist/runtime/harnesses/claude-transcript.js +0 -138
- package/dist/runtime/harnesses/claude.d.ts +0 -8
- package/dist/runtime/harnesses/claude.js +0 -225
- package/dist/runtime/harnesses/codex-approval.d.ts +0 -25
- package/dist/runtime/harnesses/codex-approval.js +0 -69
- package/dist/runtime/harnesses/codex.d.ts +0 -4
- package/dist/runtime/harnesses/codex.js +0 -269
- package/dist/runtime/harnesses/cursor-transcript.d.ts +0 -37
- package/dist/runtime/harnesses/cursor-transcript.js +0 -183
- package/dist/runtime/harnesses/cursor.d.ts +0 -24
- package/dist/runtime/harnesses/cursor.js +0 -620
- package/dist/runtime/harnesses/index.d.ts +0 -16
- package/dist/runtime/harnesses/index.js +0 -73
- package/dist/runtime/harnesses/pi.d.ts +0 -4
- package/dist/runtime/harnesses/pi.js +0 -247
- package/dist/runtime/harnesses/process.d.ts +0 -31
- package/dist/runtime/harnesses/process.js +0 -75
- package/dist/runtime/harnesses/stream-json.d.ts +0 -48
- package/dist/runtime/harnesses/stream-json.js +0 -336
- package/dist/runtime/harnesses/types.d.ts +0 -117
- package/dist/runtime/harnesses/types.js +0 -1
- package/dist/runtime/harnesses/workbuddy-transcript.d.ts +0 -8
- package/dist/runtime/harnesses/workbuddy-transcript.js +0 -127
- package/dist/runtime/harnesses/workbuddy.d.ts +0 -21
- package/dist/runtime/harnesses/workbuddy.js +0 -123
- package/dist/runtime/instance.d.ts +0 -20
- package/dist/runtime/instance.js +0 -247
- package/dist/runtime/json-rpc.d.ts +0 -53
- package/dist/runtime/json-rpc.js +0 -212
- package/dist/runtime/launch.d.ts +0 -25
- package/dist/runtime/launch.js +0 -247
- package/dist/runtime/local-workspace.d.ts +0 -15
- package/dist/runtime/local-workspace.js +0 -52
- package/dist/runtime/model-catalog.d.ts +0 -12
- package/dist/runtime/model-catalog.js +0 -84
- package/dist/runtime/native/adapters.d.ts +0 -15
- package/dist/runtime/native/adapters.js +0 -11
- package/dist/runtime/native/approvals.d.ts +0 -18
- package/dist/runtime/native/approvals.js +0 -54
- package/dist/runtime/native/archive.d.ts +0 -19
- package/dist/runtime/native/archive.js +0 -142
- package/dist/runtime/native/attach.d.ts +0 -36
- package/dist/runtime/native/attach.js +0 -128
- package/dist/runtime/native/codex-link.d.ts +0 -60
- package/dist/runtime/native/codex-link.js +0 -322
- package/dist/runtime/native/config.d.ts +0 -16
- package/dist/runtime/native/config.js +0 -24
- package/dist/runtime/native/daemon.d.ts +0 -92
- package/dist/runtime/native/daemon.js +0 -380
- package/dist/runtime/native/execution.d.ts +0 -26
- package/dist/runtime/native/execution.js +0 -34
- package/dist/runtime/native/identity.d.ts +0 -9
- package/dist/runtime/native/identity.js +0 -15
- package/dist/runtime/native/ingest.d.ts +0 -263
- package/dist/runtime/native/ingest.js +0 -884
- package/dist/runtime/native/install.d.ts +0 -9
- package/dist/runtime/native/install.js +0 -113
- package/dist/runtime/native/paths.d.ts +0 -2
- package/dist/runtime/native/paths.js +0 -7
- package/dist/runtime/native/pi-extension.d.ts +0 -36
- package/dist/runtime/native/pi-link.d.ts +0 -69
- package/dist/runtime/native/pi-link.js +0 -269
- package/dist/runtime/native/results.d.ts +0 -41
- package/dist/runtime/native/results.js +0 -128
- package/dist/runtime/native/sessions.d.ts +0 -45
- package/dist/runtime/native/sessions.js +0 -87
- package/dist/runtime/native/transcript.d.ts +0 -89
- package/dist/runtime/native/transcript.js +0 -656
- package/dist/runtime/native/translate.d.ts +0 -46
- package/dist/runtime/native/translate.js +0 -299
- package/dist/runtime/native/transport.d.ts +0 -7
- package/dist/runtime/native/transport.js +0 -16
- package/dist/runtime/native/version.d.ts +0 -5
- package/dist/runtime/native/version.js +0 -21
- package/dist/runtime/preferences.d.ts +0 -7
- package/dist/runtime/preferences.js +0 -22
- package/dist/runtime/presentation.d.ts +0 -32
- package/dist/runtime/presentation.js +0 -124
- package/dist/runtime/process-group.d.ts +0 -5
- package/dist/runtime/process-group.js +0 -161
- package/dist/runtime/projection-store.d.ts +0 -27
- package/dist/runtime/projection-store.js +0 -30
- package/dist/runtime/space-binding.d.ts +0 -48
- package/dist/runtime/space-binding.js +0 -342
- package/dist/runtime/supervisor.d.ts +0 -19
- package/dist/runtime/supervisor.js +0 -441
- package/dist/runtime/turn-projection.d.ts +0 -41
- package/dist/runtime/turn-projection.js +0 -120
- package/dist/runtime/worker.d.ts +0 -1
- package/dist/safe-remote-image.d.ts +0 -36
- package/dist/safe-remote-image.js +0 -191
- package/dist/self-update.d.ts +0 -7
- package/dist/self-update.js +0 -202
- package/dist/session-status.d.ts +0 -10
- package/dist/session-status.js +0 -25
- package/dist/space-files/limit.d.ts +0 -2
- package/dist/space-files/limit.js +0 -16
- package/dist/space-files/operands.d.ts +0 -17
- package/dist/space-files/operands.js +0 -33
- package/dist/space-files/transfer.d.ts +0 -53
- package/dist/space-files/transfer.js +0 -297
- package/dist/space-files/upload.d.ts +0 -17
- package/dist/space-files/upload.js +0 -76
- package/dist/space.d.ts +0 -44
- package/dist/space.js +0 -192
- package/dist/version.d.ts +0 -2
- package/dist/version.js +0 -17
- package/dist/web.d.ts +0 -1
- package/dist/web.js +0 -4
- /package/dist/{board-kernel → chunks}/lexer.js +0 -0
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
import { S as _isoDateTime, _ as union, a as array, b as uuid, c as discriminatedUnion, d as literal, f as number, h as string, m as record, n as _enum, p as object, s as boolean, t as ZodISODateTime, u as lazy, v as unknown, y as url } from "./schemas.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/iso.js
|
|
3
|
+
function datetime(params) {
|
|
4
|
+
return _isoDateTime(ZodISODateTime, params);
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region ../protocol/src/model/thinking.ts
|
|
8
|
+
/** Every thinking level a Harness or model can declare, in ascending order. */
|
|
9
|
+
const MODEL_THINKING_LEVELS = [
|
|
10
|
+
"off",
|
|
11
|
+
"minimal",
|
|
12
|
+
"low",
|
|
13
|
+
"medium",
|
|
14
|
+
"high",
|
|
15
|
+
"xhigh",
|
|
16
|
+
"max",
|
|
17
|
+
"ultra"
|
|
18
|
+
];
|
|
19
|
+
/** Offered only when the model's `thinkingLevelMap` names them. */
|
|
20
|
+
const OPT_IN_THINKING_LEVELS = /* @__PURE__ */ new Set([
|
|
21
|
+
"xhigh",
|
|
22
|
+
"max",
|
|
23
|
+
"ultra"
|
|
24
|
+
]);
|
|
25
|
+
const modelThinkingLevelSchema = _enum(MODEL_THINKING_LEVELS);
|
|
26
|
+
/**
|
|
27
|
+
* A `thinkingLevelMap` from a Harness's native value per level: `null` when unsupported, `undefined` to leave
|
|
28
|
+
* the level out. An unsupported opt-in level is left out too: absent already means unsupported, and readers
|
|
29
|
+
* that predate the level accept the map.
|
|
30
|
+
*/
|
|
31
|
+
function thinkingLevelMapFor(native) {
|
|
32
|
+
return Object.fromEntries(MODEL_THINKING_LEVELS.flatMap((level) => {
|
|
33
|
+
const value = native(level);
|
|
34
|
+
return value === void 0 || value === null && OPT_IN_THINKING_LEVELS.has(level) ? [] : [[level, value]];
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
const isModelThinkingLevel = (value) => typeof value === "string" && MODEL_THINKING_LEVELS.includes(value);
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region ../protocol/src/core/content-schema.ts
|
|
40
|
+
const meta = record(string(), unknown());
|
|
41
|
+
const contentBlockSchema = lazy(() => discriminatedUnion("type", [
|
|
42
|
+
object({
|
|
43
|
+
type: literal("text"),
|
|
44
|
+
text: string(),
|
|
45
|
+
_meta: meta.optional()
|
|
46
|
+
}),
|
|
47
|
+
object({
|
|
48
|
+
type: literal("thinking"),
|
|
49
|
+
thinking: string(),
|
|
50
|
+
signature: string().optional(),
|
|
51
|
+
_meta: meta.optional()
|
|
52
|
+
}),
|
|
53
|
+
object({
|
|
54
|
+
type: literal("image"),
|
|
55
|
+
source: union([object({
|
|
56
|
+
type: literal("url"),
|
|
57
|
+
url: string().url()
|
|
58
|
+
}), object({
|
|
59
|
+
type: literal("base64"),
|
|
60
|
+
media_type: string(),
|
|
61
|
+
data: string()
|
|
62
|
+
})]),
|
|
63
|
+
_meta: meta.optional()
|
|
64
|
+
}),
|
|
65
|
+
object({
|
|
66
|
+
type: literal("shell_command"),
|
|
67
|
+
command: string(),
|
|
68
|
+
rawText: string(),
|
|
69
|
+
_meta: meta.optional()
|
|
70
|
+
}),
|
|
71
|
+
object({
|
|
72
|
+
type: literal("tool_use"),
|
|
73
|
+
id: string().min(1),
|
|
74
|
+
name: string().min(1),
|
|
75
|
+
input: record(string(), unknown()),
|
|
76
|
+
_meta: meta.optional()
|
|
77
|
+
}),
|
|
78
|
+
object({
|
|
79
|
+
type: literal("tool_result"),
|
|
80
|
+
tool_use_id: string().min(1),
|
|
81
|
+
content: union([string(), array(contentBlockSchema)]),
|
|
82
|
+
is_error: boolean().optional(),
|
|
83
|
+
_meta: meta.optional()
|
|
84
|
+
}),
|
|
85
|
+
object({
|
|
86
|
+
type: literal("system_note"),
|
|
87
|
+
note_type: _enum([
|
|
88
|
+
"session_created",
|
|
89
|
+
"forked",
|
|
90
|
+
"compacted",
|
|
91
|
+
"info"
|
|
92
|
+
]),
|
|
93
|
+
text: string(),
|
|
94
|
+
_meta: meta.optional()
|
|
95
|
+
})
|
|
96
|
+
]));
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region ../protocol/src/runtime/harnesses.ts
|
|
99
|
+
/** Single source of truth for local Harness identities. Adding a Harness starts here. */
|
|
100
|
+
const LOCAL_HARNESSES = [
|
|
101
|
+
"pi",
|
|
102
|
+
"codex",
|
|
103
|
+
"claude",
|
|
104
|
+
"workbuddy",
|
|
105
|
+
"cursor"
|
|
106
|
+
];
|
|
107
|
+
const LOCAL_HARNESS_SPECS = {
|
|
108
|
+
pi: {
|
|
109
|
+
label: "Pi",
|
|
110
|
+
nativeFormat: "pi.jsonl",
|
|
111
|
+
readOnly: false
|
|
112
|
+
},
|
|
113
|
+
codex: {
|
|
114
|
+
label: "Codex",
|
|
115
|
+
nativeFormat: "codex.rollout",
|
|
116
|
+
readOnly: true
|
|
117
|
+
},
|
|
118
|
+
claude: {
|
|
119
|
+
label: "Claude Code",
|
|
120
|
+
nativeFormat: "claude.jsonl",
|
|
121
|
+
readOnly: true
|
|
122
|
+
},
|
|
123
|
+
workbuddy: {
|
|
124
|
+
label: "WorkBuddy",
|
|
125
|
+
nativeFormat: "codebuddy.jsonl",
|
|
126
|
+
readOnly: true
|
|
127
|
+
},
|
|
128
|
+
cursor: {
|
|
129
|
+
label: "Cursor",
|
|
130
|
+
nativeFormat: "cursor.jsonl",
|
|
131
|
+
readOnly: false
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const localHarnessSchema = _enum(LOCAL_HARNESSES);
|
|
135
|
+
const harnessSchema = _enum(["cohub", ...LOCAL_HARNESSES]);
|
|
136
|
+
const isLocalHarness = (value) => LOCAL_HARNESSES.includes(value);
|
|
137
|
+
const assertHarnessAccess = (harness, accessMode) => {
|
|
138
|
+
if (accessMode === "read_only" && isLocalHarness(harness) && !LOCAL_HARNESS_SPECS[harness].readOnly) throw new Error(`${LOCAL_HARNESS_SPECS[harness].label} cannot enforce read-only access`);
|
|
139
|
+
};
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region ../protocol/src/runtime/archive.ts
|
|
142
|
+
const nativeFormats = LOCAL_HARNESSES.map((harness) => LOCAL_HARNESS_SPECS[harness].nativeFormat);
|
|
143
|
+
const RUNTIME_ARCHIVE_SEGMENT_BYTES = 4194304;
|
|
144
|
+
const digest = string().regex(/^[a-f0-9]{64}$/);
|
|
145
|
+
const runtimeArchiveSegmentSchema = object({
|
|
146
|
+
offset: number().int().safe().nonnegative(),
|
|
147
|
+
sizeBytes: number().int().min(1).max(RUNTIME_ARCHIVE_SEGMENT_BYTES),
|
|
148
|
+
sha256: digest,
|
|
149
|
+
md5: string().regex(/^[a-f0-9]{32}$/)
|
|
150
|
+
}).strict();
|
|
151
|
+
const harnessArchiveSchema = object({
|
|
152
|
+
sessionId: string().uuid(),
|
|
153
|
+
turnId: string().uuid(),
|
|
154
|
+
harness: localHarnessSchema
|
|
155
|
+
}).strict();
|
|
156
|
+
const harnessArchiveIndexSchema = harnessArchiveSchema.extend({
|
|
157
|
+
version: literal(1),
|
|
158
|
+
nativeFormat: _enum(nativeFormats),
|
|
159
|
+
nativeSessionId: string().min(1).max(255),
|
|
160
|
+
parentTurnId: string().uuid().nullable(),
|
|
161
|
+
sizeBytes: number().int().safe().positive(),
|
|
162
|
+
sha256: digest,
|
|
163
|
+
segments: array(runtimeArchiveSegmentSchema).max(256)
|
|
164
|
+
}).strict().refine((value) => value.nativeFormat === LOCAL_HARNESS_SPECS[value.harness].nativeFormat, "Native format mismatch");
|
|
165
|
+
function validateArchiveBoundary(index, parent) {
|
|
166
|
+
if (index.parentTurnId !== (parent?.turnId ?? null)) throw new Error("Archive parent mismatch");
|
|
167
|
+
if (parent && (parent.sessionId !== index.sessionId || parent.harness !== index.harness || parent.nativeSessionId !== index.nativeSessionId)) throw new Error("Archive identity mismatch");
|
|
168
|
+
let offset = parent?.sizeBytes ?? 0;
|
|
169
|
+
for (const segment of index.segments) {
|
|
170
|
+
if (segment.offset !== offset) throw new Error("Archive segments are not contiguous");
|
|
171
|
+
offset += segment.sizeBytes;
|
|
172
|
+
}
|
|
173
|
+
if (offset !== index.sizeBytes || !parent && !index.segments.length) throw new Error("Archive is incomplete");
|
|
174
|
+
if (!index.segments.length && parent?.sha256 !== index.sha256) throw new Error("Unchanged archive checksum mismatch");
|
|
175
|
+
}
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region ../protocol/src/runtime/native.ts
|
|
178
|
+
const id$1 = uuid();
|
|
179
|
+
const content$1 = array(contentBlockSchema).max(1e4);
|
|
180
|
+
const count$1 = number().finite().nonnegative().optional();
|
|
181
|
+
const usage = object({
|
|
182
|
+
input: count$1,
|
|
183
|
+
output: count$1,
|
|
184
|
+
cacheRead: count$1,
|
|
185
|
+
cacheWrite: count$1,
|
|
186
|
+
totalTokens: count$1,
|
|
187
|
+
cost: object({
|
|
188
|
+
input: count$1,
|
|
189
|
+
output: count$1,
|
|
190
|
+
cacheRead: count$1,
|
|
191
|
+
cacheWrite: count$1,
|
|
192
|
+
total: count$1
|
|
193
|
+
}).nullable().optional()
|
|
194
|
+
});
|
|
195
|
+
const nativeOrigin = _enum(["local_import"]);
|
|
196
|
+
object({
|
|
197
|
+
turnId: id$1,
|
|
198
|
+
sessionId: id$1.nullable(),
|
|
199
|
+
parentTurnId: id$1.nullable(),
|
|
200
|
+
branchSessionId: id$1,
|
|
201
|
+
harness: localHarnessSchema,
|
|
202
|
+
nativeSessionId: string().min(1).max(255),
|
|
203
|
+
userContent: content$1,
|
|
204
|
+
startedAt: datetime(),
|
|
205
|
+
sessionStartedAt: datetime().optional(),
|
|
206
|
+
origin: nativeOrigin.optional(),
|
|
207
|
+
controllable: boolean().optional()
|
|
208
|
+
}).strict().refine((value) => value.sessionId !== null || value.parentTurnId === null, "A parent Turn requires a Session");
|
|
209
|
+
const nativeTurnMessageSchema = object({
|
|
210
|
+
content: content$1,
|
|
211
|
+
provider: string().max(100).nullable().optional(),
|
|
212
|
+
model: string().max(255).nullable().optional(),
|
|
213
|
+
usage: usage.nullable().optional(),
|
|
214
|
+
stopReason: string().max(64).nullable().optional(),
|
|
215
|
+
errorMessage: string().max(16384).nullable().optional()
|
|
216
|
+
}).strict();
|
|
217
|
+
/** Ephemeral display state within a Turn; never a fork or persistence boundary. */
|
|
218
|
+
const nativeTurnProgressSchema = object({
|
|
219
|
+
revision: number().int().safe().positive(),
|
|
220
|
+
from: number().int().nonnegative().max(1e4).optional(),
|
|
221
|
+
messages: array(nativeTurnMessageSchema).max(1e4)
|
|
222
|
+
}).strict();
|
|
223
|
+
/** Final, immutable Turn receipt. Native bytes are archived separately, without lossy normalization. */
|
|
224
|
+
const nativeTurnCompleteSchema = object({
|
|
225
|
+
messages: array(nativeTurnMessageSchema).max(1e4),
|
|
226
|
+
status: _enum([
|
|
227
|
+
"completed",
|
|
228
|
+
"failed",
|
|
229
|
+
"interrupted"
|
|
230
|
+
]),
|
|
231
|
+
completedAt: datetime()
|
|
232
|
+
}).strict();
|
|
233
|
+
/** Durable ingest of one transcript's Turns. */
|
|
234
|
+
const nativeIngestTurnSchema = object({
|
|
235
|
+
turnId: id$1,
|
|
236
|
+
parentTurnId: id$1.nullable(),
|
|
237
|
+
userContent: content$1,
|
|
238
|
+
startedAt: datetime(),
|
|
239
|
+
origin: nativeOrigin.optional(),
|
|
240
|
+
result: nativeTurnCompleteSchema.nullable(),
|
|
241
|
+
controllable: boolean().optional()
|
|
242
|
+
}).strict();
|
|
243
|
+
/** Turn states that end a Turn; a native Turn in one of them is settled on both sides. */
|
|
244
|
+
const SETTLED_TURN_STATUSES = [
|
|
245
|
+
"completed",
|
|
246
|
+
"failed",
|
|
247
|
+
"interrupted",
|
|
248
|
+
"cancelled",
|
|
249
|
+
"merged"
|
|
250
|
+
];
|
|
251
|
+
const nativeIngestSchema = object({
|
|
252
|
+
harness: localHarnessSchema,
|
|
253
|
+
nativeSessionId: string().min(1).max(255),
|
|
254
|
+
turns: array(nativeIngestTurnSchema).min(1).max(500)
|
|
255
|
+
}).strict();
|
|
256
|
+
/** Which of these Turns the Space already recorded; lets a restart resume without local receipts. */
|
|
257
|
+
const nativeKnownSchema = object({ turnIds: array(id$1).min(1).max(500) }).strict();
|
|
258
|
+
const APPROVAL_DECISIONS = [
|
|
259
|
+
"accept",
|
|
260
|
+
"accept_for_session",
|
|
261
|
+
"decline"
|
|
262
|
+
];
|
|
263
|
+
const approvalDecisionSchema = _enum(APPROVAL_DECISIONS);
|
|
264
|
+
/** What a local Harness asks before acting; shown as a card until decided, withdrawn or expired. */
|
|
265
|
+
const runtimeApprovalSchema = object({
|
|
266
|
+
id: id$1,
|
|
267
|
+
kind: _enum(["command", "file_change"]),
|
|
268
|
+
command: string().max(16384).optional(),
|
|
269
|
+
cwd: string().max(4096).optional(),
|
|
270
|
+
reason: string().max(4096).optional(),
|
|
271
|
+
paths: array(string().max(4096)).max(100).optional(),
|
|
272
|
+
decisions: array(approvalDecisionSchema).min(1).max(APPROVAL_DECISIONS.length),
|
|
273
|
+
requestedAt: datetime(),
|
|
274
|
+
expiresAt: datetime()
|
|
275
|
+
}).strict();
|
|
276
|
+
const nativeRuntimeEventSchema = discriminatedUnion("type", [
|
|
277
|
+
object({
|
|
278
|
+
type: literal("ingest"),
|
|
279
|
+
input: nativeIngestSchema
|
|
280
|
+
}).strict(),
|
|
281
|
+
object({
|
|
282
|
+
type: literal("known"),
|
|
283
|
+
input: nativeKnownSchema
|
|
284
|
+
}).strict(),
|
|
285
|
+
object({
|
|
286
|
+
type: literal("progress"),
|
|
287
|
+
sessionId: id$1,
|
|
288
|
+
turnId: id$1,
|
|
289
|
+
progress: nativeTurnProgressSchema
|
|
290
|
+
}).strict(),
|
|
291
|
+
object({
|
|
292
|
+
type: literal("status"),
|
|
293
|
+
sessionId: id$1,
|
|
294
|
+
turnId: id$1,
|
|
295
|
+
controllable: boolean().optional()
|
|
296
|
+
}).strict(),
|
|
297
|
+
object({
|
|
298
|
+
type: literal("approval"),
|
|
299
|
+
sessionId: id$1,
|
|
300
|
+
turnId: id$1,
|
|
301
|
+
approval: runtimeApprovalSchema
|
|
302
|
+
}).strict(),
|
|
303
|
+
object({
|
|
304
|
+
type: literal("approval.closed"),
|
|
305
|
+
sessionId: id$1,
|
|
306
|
+
turnId: id$1,
|
|
307
|
+
approvalId: id$1
|
|
308
|
+
}).strict()
|
|
309
|
+
]);
|
|
310
|
+
/** Pushed to the Runtime: stop a running native Turn, as the web's stop button asks. */
|
|
311
|
+
const runtimeNativeStopSchema = object({
|
|
312
|
+
type: literal("runtime.native.stop"),
|
|
313
|
+
spaceId: id$1,
|
|
314
|
+
sessionId: id$1,
|
|
315
|
+
turnId: id$1
|
|
316
|
+
}).strict();
|
|
317
|
+
/** Pushed to the Runtime: a person's answer to an approval card. */
|
|
318
|
+
const runtimeApprovalDecisionSchema = object({
|
|
319
|
+
type: literal("runtime.approval.decision"),
|
|
320
|
+
spaceId: id$1,
|
|
321
|
+
sessionId: id$1,
|
|
322
|
+
turnId: id$1,
|
|
323
|
+
approvalId: id$1,
|
|
324
|
+
decision: approvalDecisionSchema
|
|
325
|
+
}).strict();
|
|
326
|
+
const RUNTIME_MAX_FRAME_BYTES = 33554432;
|
|
327
|
+
object({
|
|
328
|
+
runtimeId: string().uuid(),
|
|
329
|
+
connectionId: string().uuid(),
|
|
330
|
+
observedAt: datetime()
|
|
331
|
+
});
|
|
332
|
+
const runtimeServiceTierIdSchema = string().min(1).max(100);
|
|
333
|
+
const runtimeServiceTierSchema = object({
|
|
334
|
+
id: runtimeServiceTierIdSchema,
|
|
335
|
+
name: string().max(255),
|
|
336
|
+
description: string().max(2e3).optional()
|
|
337
|
+
});
|
|
338
|
+
/**
|
|
339
|
+
* How far a local Turn may act without asking. Absent leaves the Harness's own settings untouched;
|
|
340
|
+
* `inherit` explicitly restores them. Interactive approval is never offered: an unattended Turn refuses.
|
|
341
|
+
*/
|
|
342
|
+
const APPROVAL_MODES = [
|
|
343
|
+
"inherit",
|
|
344
|
+
"auto",
|
|
345
|
+
"full_access",
|
|
346
|
+
"read_only"
|
|
347
|
+
];
|
|
348
|
+
const approvalModeSchema = _enum(APPROVAL_MODES);
|
|
349
|
+
const isApprovalMode = (value) => APPROVAL_MODES.includes(value);
|
|
350
|
+
const runtimeCapabilitiesSchema = object({
|
|
351
|
+
harnesses: array(localHarnessSchema).max(LOCAL_HARNESSES.length),
|
|
352
|
+
/** Approval modes each Harness enforces. Unknown Harnesses and modes are dropped, not rejected. */
|
|
353
|
+
approvalModes: record(string().max(32), array(string().max(32)).max(16)).refine((map) => Object.keys(map).length <= 16, "Too many Harnesses").transform((map) => Object.fromEntries(Object.entries(map).flatMap(([harness, modes]) => isLocalHarness(harness) ? [[harness, [...new Set(modes.filter(isApprovalMode))]]] : []))).optional().catch(void 0),
|
|
354
|
+
models: array(object({
|
|
355
|
+
harness: localHarnessSchema,
|
|
356
|
+
provider: string().max(100),
|
|
357
|
+
id: string().min(1).max(255),
|
|
358
|
+
name: string().max(255),
|
|
359
|
+
/** The model the Harness runs when none is requested; at most one per Harness. */
|
|
360
|
+
isDefault: boolean().optional(),
|
|
361
|
+
reasoning: boolean().optional(),
|
|
362
|
+
defaultThinkingLevel: modelThinkingLevelSchema.optional().catch(void 0),
|
|
363
|
+
thinkingLevelMap: record(string().max(32), string().max(100).nullable()).refine((map) => Object.keys(map).length <= 32, "Too many thinking levels").transform((map) => Object.fromEntries(Object.entries(map).filter(([level]) => isModelThinkingLevel(level)))).optional(),
|
|
364
|
+
/** Selectable service (speed) tiers; `id` is the Harness's own request value. */
|
|
365
|
+
serviceTiers: array(runtimeServiceTierSchema).max(20).optional(),
|
|
366
|
+
defaultServiceTier: runtimeServiceTierIdSchema.optional()
|
|
367
|
+
})).max(2e3)
|
|
368
|
+
});
|
|
369
|
+
/** Levels every Gateway accepts in `runtime.hello`; later levels reach the registration through `runtime.capabilities`. */
|
|
370
|
+
const RUNTIME_HELLO_THINKING_LEVELS = /* @__PURE__ */ new Set([
|
|
371
|
+
"off",
|
|
372
|
+
"minimal",
|
|
373
|
+
"low",
|
|
374
|
+
"medium",
|
|
375
|
+
"high",
|
|
376
|
+
"xhigh",
|
|
377
|
+
"max"
|
|
378
|
+
]);
|
|
379
|
+
function runtimeHelloCapabilities(capabilities) {
|
|
380
|
+
return {
|
|
381
|
+
...capabilities,
|
|
382
|
+
models: capabilities.models.map(({ defaultThinkingLevel, thinkingLevelMap, ...model }) => ({
|
|
383
|
+
...model,
|
|
384
|
+
...defaultThinkingLevel && RUNTIME_HELLO_THINKING_LEVELS.has(defaultThinkingLevel) ? { defaultThinkingLevel } : {},
|
|
385
|
+
...thinkingLevelMap ? { thinkingLevelMap: Object.fromEntries(Object.entries(thinkingLevelMap).filter(([level]) => RUNTIME_HELLO_THINKING_LEVELS.has(level))) } : {}
|
|
386
|
+
}))
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
/** Explicitly the standard tier, overriding a default (such as Codex `service_tier`) that is faster. */
|
|
390
|
+
const STANDARD_SERVICE_TIER = "default";
|
|
391
|
+
const runtimePendingExecutionSchema = object({
|
|
392
|
+
sessionId: string().uuid(),
|
|
393
|
+
turnId: string().uuid(),
|
|
394
|
+
harness: localHarnessSchema
|
|
395
|
+
}).strict();
|
|
396
|
+
const runtimeClientSchema = object({
|
|
397
|
+
name: string().min(1).max(32),
|
|
398
|
+
version: string().min(1).max(64)
|
|
399
|
+
});
|
|
400
|
+
object({
|
|
401
|
+
connectionId: string().uuid(),
|
|
402
|
+
runtimeId: string().uuid().optional(),
|
|
403
|
+
endpoint: url({ protocol: /^wss?$/ }),
|
|
404
|
+
ownerUserId: string().min(1),
|
|
405
|
+
capabilities: runtimeCapabilitiesSchema,
|
|
406
|
+
client: runtimeClientSchema.optional()
|
|
407
|
+
});
|
|
408
|
+
const runtimeReadySchema = object({
|
|
409
|
+
type: literal("runtime.ready"),
|
|
410
|
+
connectionId: string().uuid(),
|
|
411
|
+
features: array(string()).optional()
|
|
412
|
+
});
|
|
413
|
+
const runtimeTraceContextSchema = object({
|
|
414
|
+
requestId: string().regex(/^[a-zA-Z0-9._:-]{1,128}$/).optional(),
|
|
415
|
+
traceId: string().regex(/^[0-9a-f]{32}$/i).nullable().optional(),
|
|
416
|
+
spanId: string().regex(/^[0-9a-f]{16}$/i).nullable().optional(),
|
|
417
|
+
traceparent: string().regex(/^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$/i).nullable().optional()
|
|
418
|
+
}).strict();
|
|
419
|
+
object({
|
|
420
|
+
backend: _enum([
|
|
421
|
+
"fsevents",
|
|
422
|
+
"readdcw",
|
|
423
|
+
"fsnotify",
|
|
424
|
+
"scan",
|
|
425
|
+
"none"
|
|
426
|
+
]),
|
|
427
|
+
state: _enum([
|
|
428
|
+
"running",
|
|
429
|
+
"degraded",
|
|
430
|
+
"unavailable"
|
|
431
|
+
]),
|
|
432
|
+
reason: _enum([
|
|
433
|
+
"polling",
|
|
434
|
+
"watch_error",
|
|
435
|
+
"start_failed",
|
|
436
|
+
"coverage_incomplete",
|
|
437
|
+
"root_changed"
|
|
438
|
+
]).optional(),
|
|
439
|
+
observedAt: datetime()
|
|
440
|
+
});
|
|
441
|
+
object({
|
|
442
|
+
expectedTurnId: string().uuid(),
|
|
443
|
+
revision: string().min(1),
|
|
444
|
+
confirmed: literal(true)
|
|
445
|
+
}).strict();
|
|
446
|
+
const id = string().uuid();
|
|
447
|
+
const ordinal = number().int().min(0).max(1e5);
|
|
448
|
+
const content = array(contentBlockSchema).max(1e5);
|
|
449
|
+
const count = number().finite().nonnegative().optional();
|
|
450
|
+
const usageSchema = object({
|
|
451
|
+
input: count,
|
|
452
|
+
output: count,
|
|
453
|
+
cacheRead: count,
|
|
454
|
+
cacheWrite: count,
|
|
455
|
+
totalTokens: count,
|
|
456
|
+
cost: object({
|
|
457
|
+
input: count,
|
|
458
|
+
output: count,
|
|
459
|
+
cacheRead: count,
|
|
460
|
+
cacheWrite: count,
|
|
461
|
+
total: count
|
|
462
|
+
}).nullable().optional()
|
|
463
|
+
});
|
|
464
|
+
const runtimeMessageSchema = object({
|
|
465
|
+
ordinal,
|
|
466
|
+
content,
|
|
467
|
+
provider: string().nullable().optional(),
|
|
468
|
+
model: string().nullable().optional(),
|
|
469
|
+
usage: usageSchema.nullable().optional(),
|
|
470
|
+
stopReason: string().max(64).nullable().optional(),
|
|
471
|
+
errorMessage: string().max(16384).nullable().optional()
|
|
472
|
+
});
|
|
473
|
+
const runtimeEventSchema = discriminatedUnion("type", [
|
|
474
|
+
object({
|
|
475
|
+
type: literal("message.start"),
|
|
476
|
+
ordinal
|
|
477
|
+
}),
|
|
478
|
+
object({
|
|
479
|
+
type: literal("text.delta"),
|
|
480
|
+
ordinal,
|
|
481
|
+
index: ordinal,
|
|
482
|
+
kind: _enum(["text", "thinking"]),
|
|
483
|
+
delta: string()
|
|
484
|
+
}),
|
|
485
|
+
object({
|
|
486
|
+
type: literal("content.replace"),
|
|
487
|
+
ordinal,
|
|
488
|
+
content
|
|
489
|
+
}),
|
|
490
|
+
object({
|
|
491
|
+
type: literal("message.commit"),
|
|
492
|
+
message: runtimeMessageSchema
|
|
493
|
+
}),
|
|
494
|
+
object({
|
|
495
|
+
type: literal("turn.end"),
|
|
496
|
+
message: runtimeMessageSchema,
|
|
497
|
+
archive: harnessArchiveSchema.nullable().optional(),
|
|
498
|
+
resume: _enum([
|
|
499
|
+
"native",
|
|
500
|
+
"restored",
|
|
501
|
+
"handoff",
|
|
502
|
+
"new"
|
|
503
|
+
])
|
|
504
|
+
}),
|
|
505
|
+
object({
|
|
506
|
+
type: literal("context.required"),
|
|
507
|
+
pendingTurnIds: array(id).max(LOCAL_HARNESSES.length).optional()
|
|
508
|
+
}),
|
|
509
|
+
object({ type: literal("turn.acknowledged") }),
|
|
510
|
+
object({
|
|
511
|
+
type: literal("turn.error"),
|
|
512
|
+
message: string().max(16384),
|
|
513
|
+
uncertain: boolean().optional()
|
|
514
|
+
})
|
|
515
|
+
]);
|
|
516
|
+
discriminatedUnion("type", [
|
|
517
|
+
object({
|
|
518
|
+
type: literal("runtime.hello"),
|
|
519
|
+
version: literal(1),
|
|
520
|
+
spaceId: id,
|
|
521
|
+
token: string().min(1).max(16384),
|
|
522
|
+
capabilities: runtimeCapabilitiesSchema,
|
|
523
|
+
client: runtimeClientSchema.optional()
|
|
524
|
+
}).strict(),
|
|
525
|
+
object({
|
|
526
|
+
type: literal("runtime.capabilities"),
|
|
527
|
+
capabilities: runtimeCapabilitiesSchema
|
|
528
|
+
}).strict(),
|
|
529
|
+
object({
|
|
530
|
+
type: literal("runtime.recovery"),
|
|
531
|
+
executions: array(runtimePendingExecutionSchema).min(1).max(64)
|
|
532
|
+
}).strict(),
|
|
533
|
+
object({ type: literal("runtime.heartbeat") }),
|
|
534
|
+
object({
|
|
535
|
+
type: literal("runtime.auth"),
|
|
536
|
+
token: string().min(1).max(16384)
|
|
537
|
+
}),
|
|
538
|
+
object({
|
|
539
|
+
type: literal("runtime.event"),
|
|
540
|
+
requestId: id,
|
|
541
|
+
event: runtimeEventSchema
|
|
542
|
+
}),
|
|
543
|
+
object({
|
|
544
|
+
type: literal("runtime.native"),
|
|
545
|
+
requestId: id,
|
|
546
|
+
event: nativeRuntimeEventSchema
|
|
547
|
+
})
|
|
548
|
+
]);
|
|
549
|
+
object({
|
|
550
|
+
type: literal("runtime.native.result"),
|
|
551
|
+
requestId: id,
|
|
552
|
+
result: unknown(),
|
|
553
|
+
error: string().optional()
|
|
554
|
+
}).strict();
|
|
555
|
+
const runtimeContextSchema = object({
|
|
556
|
+
complete: boolean().optional(),
|
|
557
|
+
revision: string(),
|
|
558
|
+
throughTurnId: id.nullable(),
|
|
559
|
+
messages: array(object({
|
|
560
|
+
id: string(),
|
|
561
|
+
turnId: id,
|
|
562
|
+
role: _enum([
|
|
563
|
+
"user",
|
|
564
|
+
"assistant",
|
|
565
|
+
"system"
|
|
566
|
+
]),
|
|
567
|
+
content,
|
|
568
|
+
provider: string().nullable().optional(),
|
|
569
|
+
model: string().nullable().optional(),
|
|
570
|
+
usage: usageSchema.nullable().optional(),
|
|
571
|
+
stopReason: string().nullable().optional(),
|
|
572
|
+
errorMessage: string().nullable().optional(),
|
|
573
|
+
meta: record(string(), unknown()).nullable().optional()
|
|
574
|
+
})),
|
|
575
|
+
archive: harnessArchiveSchema.nullable().optional(),
|
|
576
|
+
resolvedTurnIds: array(id).max(LOCAL_HARNESSES.length).optional(),
|
|
577
|
+
settledTurnIds: array(id).max(LOCAL_HARNESSES.length).optional()
|
|
578
|
+
});
|
|
579
|
+
const runtimeCommandSchema = discriminatedUnion("type", [
|
|
580
|
+
object({
|
|
581
|
+
type: literal("turn.recover"),
|
|
582
|
+
requestId: id,
|
|
583
|
+
execution: object({
|
|
584
|
+
spaceId: id,
|
|
585
|
+
sessionId: id,
|
|
586
|
+
turnId: id,
|
|
587
|
+
harness: localHarnessSchema
|
|
588
|
+
}),
|
|
589
|
+
traceContext: runtimeTraceContextSchema.optional()
|
|
590
|
+
}),
|
|
591
|
+
object({
|
|
592
|
+
type: literal("turn.start"),
|
|
593
|
+
requestId: id,
|
|
594
|
+
resumeOnly: boolean().optional(),
|
|
595
|
+
input: object({
|
|
596
|
+
spaceId: id,
|
|
597
|
+
sessionId: id,
|
|
598
|
+
turnId: id,
|
|
599
|
+
userMessageId: id,
|
|
600
|
+
harness: localHarnessSchema,
|
|
601
|
+
messages: array(object({
|
|
602
|
+
turnId: id,
|
|
603
|
+
userMessageId: id,
|
|
604
|
+
userId: string().nullable(),
|
|
605
|
+
content
|
|
606
|
+
})).min(1).max(64),
|
|
607
|
+
context: runtimeContextSchema,
|
|
608
|
+
provider: string().nullable().optional(),
|
|
609
|
+
model: string().nullable().optional(),
|
|
610
|
+
thinkingLevel: string().nullable().optional(),
|
|
611
|
+
approvalMode: approvalModeSchema.optional(),
|
|
612
|
+
serviceTier: runtimeServiceTierIdSchema.nullable().optional(),
|
|
613
|
+
requestId: string().regex(/^[a-zA-Z0-9._:-]{1,128}$/).nullable().optional(),
|
|
614
|
+
traceContext: runtimeTraceContextSchema.optional(),
|
|
615
|
+
accessMode: _enum(["read_only", "full_access"])
|
|
616
|
+
}).refine((input) => {
|
|
617
|
+
const owner = input.messages.at(-1);
|
|
618
|
+
return owner?.turnId === input.turnId && owner.userMessageId === input.userMessageId && new Set(input.messages.map((message) => message.turnId)).size === input.messages.length && new Set(input.messages.map((message) => message.userMessageId)).size === input.messages.length;
|
|
619
|
+
}, "Runtime batch owner or message identity mismatch")
|
|
620
|
+
}),
|
|
621
|
+
object({
|
|
622
|
+
type: literal("session.context"),
|
|
623
|
+
requestId: id,
|
|
624
|
+
context: runtimeContextSchema
|
|
625
|
+
}),
|
|
626
|
+
object({
|
|
627
|
+
type: literal("turn.abort"),
|
|
628
|
+
requestId: id
|
|
629
|
+
}),
|
|
630
|
+
object({
|
|
631
|
+
type: literal("turn.ack"),
|
|
632
|
+
requestId: id,
|
|
633
|
+
revision: string(),
|
|
634
|
+
turnId: id
|
|
635
|
+
})
|
|
636
|
+
]);
|
|
637
|
+
//#endregion
|
|
638
|
+
export { MODEL_THINKING_LEVELS as C, isLocalHarness as S, thinkingLevelMapFor as T, validateArchiveBoundary as _, runtimeCapabilitiesSchema as a, assertHarnessAccess as b, runtimeHelloCapabilities as c, APPROVAL_DECISIONS as d, SETTLED_TURN_STATUSES as f, harnessArchiveIndexSchema as g, RUNTIME_ARCHIVE_SEGMENT_BYTES as h, isApprovalMode as i, runtimeReadySchema as l, runtimeNativeStopSchema as m, RUNTIME_MAX_FRAME_BYTES as n, runtimeCommandSchema as o, runtimeApprovalDecisionSchema as p, STANDARD_SERVICE_TIER as r, runtimeEventSchema as s, APPROVAL_MODES as t, runtimeServiceTierSchema as u, LOCAL_HARNESSES as v, isModelThinkingLevel as w, harnessSchema as x, LOCAL_HARNESS_SPECS as y };
|