@puddle-code/cli 0.3.14 → 0.4.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/CHANGELOG.md +4 -4
- package/README.md +31 -19
- package/dist/host-control.mjs +1980 -133
- package/dist/index.js +4341 -970
- package/dist/install.sh +401 -40
- package/dist/public/assets/App-CB0Bm55u.js +9 -0
- package/dist/public/assets/{CompilationCommandForm-8ipw9M-Z.js → CompilationCommandForm-vv5bglnl.js} +1 -1
- package/dist/public/assets/Dashboard-BQd42kix.js +1 -0
- package/dist/public/assets/{EditorTabClose-o1L4BgTN.js → EditorTabClose-D3LwFFHd.js} +1 -1
- package/dist/public/assets/{LazyTerminal-Crwcrh-K.js → LazyTerminal-CfuC3bjp.js} +2 -2
- package/dist/public/assets/{ModelRefcount-0o8MEOUT.js → ModelRefcount-DtJdNeW7.js} +1 -1
- package/dist/public/assets/NewProjectDialog-DYn30yon.js +1 -0
- package/dist/public/assets/{NotebookWidget-Ci7TAuWd.js → NotebookWidget-BntkgqbM.js} +1 -1
- package/dist/public/assets/PaneEditorBody-ChNwAz96.js +284 -0
- package/dist/public/assets/{PdfViewer-BoFsXAue.js → PdfViewer-DYmz05py.js} +1 -1
- package/dist/public/assets/ReleaseNotesDialog-D2kA6oIr.js +1 -0
- package/dist/public/assets/SettingsDialog-BWWWn7I0.js +8 -0
- package/dist/public/assets/{Terminal-B3Iw783s.js → Terminal-BQHSZc8Q.js} +5 -5
- package/dist/public/assets/Workspace-DVTqrQNf.js +20 -0
- package/dist/public/assets/api-BOuyloUi.js +1 -0
- package/dist/public/assets/auth-olLlgxc3.js +64 -0
- package/dist/public/assets/{buffer-store-B2nYD11t.js → buffer-store-BWLcD39y.js} +1 -1
- package/dist/public/assets/{context-CwZ4epwz.js → context-C3-WejyN.js} +1 -1
- package/dist/public/assets/{forward-link-C-8Xn8gf.js → forward-link-DMvLf0Xw.js} +1 -1
- package/dist/public/assets/{hotkeys-DOpJ1a7g.js → hotkeys-Cu0t6sbz.js} +1 -1
- package/dist/public/assets/index--5A6_BeN.css +2 -0
- package/dist/public/assets/{index-B9DFgBft.js → index-BUAoYe1o.js} +3 -3
- package/dist/public/assets/markdown-CMSzQtLp.js +8 -0
- package/dist/public/assets/markdown-it-CWoG9_Dn.js +13 -0
- package/dist/public/assets/{markdown-mermaid-CZnHoKN5.js → markdown-mermaid-BCXEEB98.js} +1 -1
- package/dist/public/assets/media-refresh-store-BplHZVs4.js +1 -0
- package/dist/public/assets/notification-delivery-CDWhS_kj.js +1 -0
- package/dist/public/assets/protocol-support-CsLR9u7d.js +1 -0
- package/dist/public/assets/queue-BlrQxHDl.js +3 -0
- package/dist/public/assets/{scroll-restoration-gKZDDamc.js → scroll-restoration-CwXbvZvT.js} +1 -1
- package/dist/public/assets/selection-actions-B2XIuCoH.js +1 -0
- package/dist/public/assets/{session-order-SN_zG4Us.js → session-order-unCbOqgk.js} +1 -1
- package/dist/public/assets/{switch-iVuj74VW.js → switch-DVo2TkMf.js} +1 -1
- package/dist/public/assets/{use-ui-state-CQp93ZE4.js → use-ui-state-i7N5-9dI.js} +1 -1
- package/dist/public/assets/{view-state-store-CVAUWqnG.js → view-state-store-Cy9sQJoZ.js} +1 -1
- package/dist/public/assets/ws-BX1iQbeP.js +1 -0
- package/dist/public/index.html +3 -3
- package/dist/pudl.js +1996 -183
- package/package.json +1 -1
- package/dist/public/assets/App-5QiKmUI_.js +0 -2
- package/dist/public/assets/Dashboard-B9v8mQKk.js +0 -1
- package/dist/public/assets/NewProjectDialog-qFDLTphH.js +0 -1
- package/dist/public/assets/PaneEditorBody-C8uTV9yU.js +0 -303
- package/dist/public/assets/SettingsDialog-tW18Y_Wr.js +0 -8
- package/dist/public/assets/Workspace-D2IYXJV2.js +0 -20
- package/dist/public/assets/api-CfmzEbQ_.js +0 -1
- package/dist/public/assets/auth-CIb9G2C5.js +0 -64
- package/dist/public/assets/errors-DTaodZDR.js +0 -1
- package/dist/public/assets/index-DwtrJj9v.css +0 -2
- package/dist/public/assets/media-refresh-store-DDvrEM5K.js +0 -1
- package/dist/public/assets/notification-delivery-DdTD40aA.js +0 -1
- package/dist/public/assets/protocol-support-BGk73LFk.js +0 -1
- package/dist/public/assets/selection-actions-BjVj7hXw.js +0 -1
- package/dist/public/assets/ws-CspBmo8M.js +0 -1
package/dist/pudl.js
CHANGED
|
@@ -2,19 +2,22 @@
|
|
|
2
2
|
import { createRequire as __puddleCreateRequire } from 'node:module';
|
|
3
3
|
const require = __puddleCreateRequire(import.meta.url);
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
|
-
var __export = (
|
|
5
|
+
var __export = (target2, all) => {
|
|
6
6
|
for (var name in all)
|
|
7
|
-
__defProp(
|
|
7
|
+
__defProp(target2, name, { get: all[name], enumerable: true });
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
// src/pudl.ts
|
|
11
11
|
import { readFile, stat } from "node:fs/promises";
|
|
12
|
-
import { randomUUID } from "node:crypto";
|
|
12
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
13
13
|
import { parseArgs } from "node:util";
|
|
14
14
|
import { setTimeout as delay } from "node:timers/promises";
|
|
15
15
|
|
|
16
16
|
// ../shared/src/protocol.ts
|
|
17
|
-
var PROTOCOL_VERSION = { major:
|
|
17
|
+
var PROTOCOL_VERSION = { major: 26, minor: 1 };
|
|
18
|
+
function supportsApplicationFeature(peer, introduced, client = PROTOCOL_VERSION) {
|
|
19
|
+
return peer?.major === client.major && (peer.major > introduced.major || peer.major === introduced.major && peer.minor >= introduced.minor);
|
|
20
|
+
}
|
|
18
21
|
|
|
19
22
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
20
23
|
var external_exports = {};
|
|
@@ -763,8 +766,8 @@ function defineLazy(object2, key, getter) {
|
|
|
763
766
|
function objectClone(obj) {
|
|
764
767
|
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
|
|
765
768
|
}
|
|
766
|
-
function assignProp(
|
|
767
|
-
Object.defineProperty(
|
|
769
|
+
function assignProp(target2, prop, value) {
|
|
770
|
+
Object.defineProperty(target2, prop, {
|
|
768
771
|
value,
|
|
769
772
|
writable: true,
|
|
770
773
|
enumerable: true,
|
|
@@ -782,10 +785,10 @@ function mergeDefs(...defs) {
|
|
|
782
785
|
function cloneDef(schema) {
|
|
783
786
|
return mergeDefs(schema._zod.def);
|
|
784
787
|
}
|
|
785
|
-
function getElementAtPath(obj,
|
|
786
|
-
if (!
|
|
788
|
+
function getElementAtPath(obj, path2) {
|
|
789
|
+
if (!path2)
|
|
787
790
|
return obj;
|
|
788
|
-
return
|
|
791
|
+
return path2.reduce((acc, key) => acc?.[key], obj);
|
|
789
792
|
}
|
|
790
793
|
function promiseAllObject(promisesObj) {
|
|
791
794
|
const keys = Object.keys(promisesObj);
|
|
@@ -947,35 +950,35 @@ function normalizeParams(_params) {
|
|
|
947
950
|
return params;
|
|
948
951
|
}
|
|
949
952
|
function createTransparentProxy(getter) {
|
|
950
|
-
let
|
|
953
|
+
let target2;
|
|
951
954
|
return new Proxy({}, {
|
|
952
955
|
get(_, prop, receiver) {
|
|
953
|
-
|
|
954
|
-
return Reflect.get(
|
|
956
|
+
target2 ?? (target2 = getter());
|
|
957
|
+
return Reflect.get(target2, prop, receiver);
|
|
955
958
|
},
|
|
956
959
|
set(_, prop, value, receiver) {
|
|
957
|
-
|
|
958
|
-
return Reflect.set(
|
|
960
|
+
target2 ?? (target2 = getter());
|
|
961
|
+
return Reflect.set(target2, prop, value, receiver);
|
|
959
962
|
},
|
|
960
963
|
has(_, prop) {
|
|
961
|
-
|
|
962
|
-
return Reflect.has(
|
|
964
|
+
target2 ?? (target2 = getter());
|
|
965
|
+
return Reflect.has(target2, prop);
|
|
963
966
|
},
|
|
964
967
|
deleteProperty(_, prop) {
|
|
965
|
-
|
|
966
|
-
return Reflect.deleteProperty(
|
|
968
|
+
target2 ?? (target2 = getter());
|
|
969
|
+
return Reflect.deleteProperty(target2, prop);
|
|
967
970
|
},
|
|
968
971
|
ownKeys(_) {
|
|
969
|
-
|
|
970
|
-
return Reflect.ownKeys(
|
|
972
|
+
target2 ?? (target2 = getter());
|
|
973
|
+
return Reflect.ownKeys(target2);
|
|
971
974
|
},
|
|
972
975
|
getOwnPropertyDescriptor(_, prop) {
|
|
973
|
-
|
|
974
|
-
return Reflect.getOwnPropertyDescriptor(
|
|
976
|
+
target2 ?? (target2 = getter());
|
|
977
|
+
return Reflect.getOwnPropertyDescriptor(target2, prop);
|
|
975
978
|
},
|
|
976
979
|
defineProperty(_, prop, descriptor) {
|
|
977
|
-
|
|
978
|
-
return Reflect.defineProperty(
|
|
980
|
+
target2 ?? (target2 = getter());
|
|
981
|
+
return Reflect.defineProperty(target2, prop, descriptor);
|
|
979
982
|
}
|
|
980
983
|
});
|
|
981
984
|
}
|
|
@@ -1194,11 +1197,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
1194
1197
|
}
|
|
1195
1198
|
return false;
|
|
1196
1199
|
}
|
|
1197
|
-
function prefixIssues(
|
|
1200
|
+
function prefixIssues(path2, issues) {
|
|
1198
1201
|
return issues.map((iss) => {
|
|
1199
1202
|
var _a3;
|
|
1200
1203
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
1201
|
-
iss.path.unshift(
|
|
1204
|
+
iss.path.unshift(path2);
|
|
1202
1205
|
return iss;
|
|
1203
1206
|
});
|
|
1204
1207
|
}
|
|
@@ -1345,16 +1348,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1345
1348
|
}
|
|
1346
1349
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
1347
1350
|
const fieldErrors = { _errors: [] };
|
|
1348
|
-
const processError = (error52,
|
|
1351
|
+
const processError = (error52, path2 = []) => {
|
|
1349
1352
|
for (const issue2 of error52.issues) {
|
|
1350
1353
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1351
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1354
|
+
issue2.errors.map((issues) => processError({ issues }, [...path2, ...issue2.path]));
|
|
1352
1355
|
} else if (issue2.code === "invalid_key") {
|
|
1353
|
-
processError({ issues: issue2.issues }, [...
|
|
1356
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
1354
1357
|
} else if (issue2.code === "invalid_element") {
|
|
1355
|
-
processError({ issues: issue2.issues }, [...
|
|
1358
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
1356
1359
|
} else {
|
|
1357
|
-
const fullpath = [...
|
|
1360
|
+
const fullpath = [...path2, ...issue2.path];
|
|
1358
1361
|
if (fullpath.length === 0) {
|
|
1359
1362
|
fieldErrors._errors.push(mapper(issue2));
|
|
1360
1363
|
} else {
|
|
@@ -1381,17 +1384,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1381
1384
|
}
|
|
1382
1385
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
1383
1386
|
const result = { errors: [] };
|
|
1384
|
-
const processError = (error52,
|
|
1387
|
+
const processError = (error52, path2 = []) => {
|
|
1385
1388
|
var _a3, _b;
|
|
1386
1389
|
for (const issue2 of error52.issues) {
|
|
1387
1390
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1388
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1391
|
+
issue2.errors.map((issues) => processError({ issues }, [...path2, ...issue2.path]));
|
|
1389
1392
|
} else if (issue2.code === "invalid_key") {
|
|
1390
|
-
processError({ issues: issue2.issues }, [...
|
|
1393
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
1391
1394
|
} else if (issue2.code === "invalid_element") {
|
|
1392
|
-
processError({ issues: issue2.issues }, [...
|
|
1395
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
1393
1396
|
} else {
|
|
1394
|
-
const fullpath = [...
|
|
1397
|
+
const fullpath = [...path2, ...issue2.path];
|
|
1395
1398
|
if (fullpath.length === 0) {
|
|
1396
1399
|
result.errors.push(mapper(issue2));
|
|
1397
1400
|
continue;
|
|
@@ -1423,8 +1426,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1423
1426
|
}
|
|
1424
1427
|
function toDotPath(_path) {
|
|
1425
1428
|
const segs = [];
|
|
1426
|
-
const
|
|
1427
|
-
for (const seg of
|
|
1429
|
+
const path2 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1430
|
+
for (const seg of path2) {
|
|
1428
1431
|
if (typeof seg === "number")
|
|
1429
1432
|
segs.push(`[${seg}]`);
|
|
1430
1433
|
else if (typeof seg === "symbol")
|
|
@@ -1915,8 +1918,8 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
|
|
|
1915
1918
|
});
|
|
1916
1919
|
inst._zod.check = (payload) => {
|
|
1917
1920
|
const input = payload.value;
|
|
1918
|
-
const
|
|
1919
|
-
if (
|
|
1921
|
+
const size2 = input.size;
|
|
1922
|
+
if (size2 <= def.maximum)
|
|
1920
1923
|
return;
|
|
1921
1924
|
payload.issues.push({
|
|
1922
1925
|
origin: getSizableOrigin(input),
|
|
@@ -1943,8 +1946,8 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
|
|
|
1943
1946
|
});
|
|
1944
1947
|
inst._zod.check = (payload) => {
|
|
1945
1948
|
const input = payload.value;
|
|
1946
|
-
const
|
|
1947
|
-
if (
|
|
1949
|
+
const size2 = input.size;
|
|
1950
|
+
if (size2 >= def.minimum)
|
|
1948
1951
|
return;
|
|
1949
1952
|
payload.issues.push({
|
|
1950
1953
|
origin: getSizableOrigin(input),
|
|
@@ -1972,10 +1975,10 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
|
|
|
1972
1975
|
});
|
|
1973
1976
|
inst._zod.check = (payload) => {
|
|
1974
1977
|
const input = payload.value;
|
|
1975
|
-
const
|
|
1976
|
-
if (
|
|
1978
|
+
const size2 = input.size;
|
|
1979
|
+
if (size2 === def.size)
|
|
1977
1980
|
return;
|
|
1978
|
-
const tooBig =
|
|
1981
|
+
const tooBig = size2 > def.size;
|
|
1979
1982
|
payload.issues.push({
|
|
1980
1983
|
origin: getSizableOrigin(input),
|
|
1981
1984
|
...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
|
|
@@ -3108,42 +3111,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3108
3111
|
}
|
|
3109
3112
|
doc.write(`const newResult = {};`);
|
|
3110
3113
|
for (const key of normalized.keys) {
|
|
3111
|
-
const
|
|
3114
|
+
const id3 = ids[key];
|
|
3112
3115
|
const k = esc(key);
|
|
3113
3116
|
const schema = shape[key];
|
|
3114
3117
|
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
3115
3118
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
3116
|
-
doc.write(`const ${
|
|
3119
|
+
doc.write(`const ${id3} = ${parseStr(key)};`);
|
|
3117
3120
|
if (isOptionalIn && isOptionalOut) {
|
|
3118
3121
|
doc.write(`
|
|
3119
|
-
if (${
|
|
3122
|
+
if (${id3}.issues.length) {
|
|
3120
3123
|
if (${k} in input) {
|
|
3121
|
-
payload.issues = payload.issues.concat(${
|
|
3124
|
+
payload.issues = payload.issues.concat(${id3}.issues.map(iss => ({
|
|
3122
3125
|
...iss,
|
|
3123
3126
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3124
3127
|
})));
|
|
3125
3128
|
}
|
|
3126
3129
|
}
|
|
3127
3130
|
|
|
3128
|
-
if (${
|
|
3131
|
+
if (${id3}.value === undefined) {
|
|
3129
3132
|
if (${k} in input) {
|
|
3130
3133
|
newResult[${k}] = undefined;
|
|
3131
3134
|
}
|
|
3132
3135
|
} else {
|
|
3133
|
-
newResult[${k}] = ${
|
|
3136
|
+
newResult[${k}] = ${id3}.value;
|
|
3134
3137
|
}
|
|
3135
3138
|
|
|
3136
3139
|
`);
|
|
3137
3140
|
} else if (!isOptionalIn) {
|
|
3138
3141
|
doc.write(`
|
|
3139
|
-
const ${
|
|
3140
|
-
if (${
|
|
3141
|
-
payload.issues = payload.issues.concat(${
|
|
3142
|
+
const ${id3}_present = ${k} in input;
|
|
3143
|
+
if (${id3}.issues.length) {
|
|
3144
|
+
payload.issues = payload.issues.concat(${id3}.issues.map(iss => ({
|
|
3142
3145
|
...iss,
|
|
3143
3146
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3144
3147
|
})));
|
|
3145
3148
|
}
|
|
3146
|
-
if (!${
|
|
3149
|
+
if (!${id3}_present && !${id3}.issues.length) {
|
|
3147
3150
|
payload.issues.push({
|
|
3148
3151
|
code: "invalid_type",
|
|
3149
3152
|
expected: "nonoptional",
|
|
@@ -3152,30 +3155,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3152
3155
|
});
|
|
3153
3156
|
}
|
|
3154
3157
|
|
|
3155
|
-
if (${
|
|
3156
|
-
if (${
|
|
3158
|
+
if (${id3}_present) {
|
|
3159
|
+
if (${id3}.value === undefined) {
|
|
3157
3160
|
newResult[${k}] = undefined;
|
|
3158
3161
|
} else {
|
|
3159
|
-
newResult[${k}] = ${
|
|
3162
|
+
newResult[${k}] = ${id3}.value;
|
|
3160
3163
|
}
|
|
3161
3164
|
}
|
|
3162
3165
|
|
|
3163
3166
|
`);
|
|
3164
3167
|
} else {
|
|
3165
3168
|
doc.write(`
|
|
3166
|
-
if (${
|
|
3167
|
-
payload.issues = payload.issues.concat(${
|
|
3169
|
+
if (${id3}.issues.length) {
|
|
3170
|
+
payload.issues = payload.issues.concat(${id3}.issues.map(iss => ({
|
|
3168
3171
|
...iss,
|
|
3169
3172
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3170
3173
|
})));
|
|
3171
3174
|
}
|
|
3172
3175
|
|
|
3173
|
-
if (${
|
|
3176
|
+
if (${id3}.value === undefined) {
|
|
3174
3177
|
if (${k} in input) {
|
|
3175
3178
|
newResult[${k}] = undefined;
|
|
3176
3179
|
}
|
|
3177
3180
|
} else {
|
|
3178
|
-
newResult[${k}] = ${
|
|
3181
|
+
newResult[${k}] = ${id3}.value;
|
|
3179
3182
|
}
|
|
3180
3183
|
|
|
3181
3184
|
`);
|
|
@@ -4652,8 +4655,8 @@ function az_default() {
|
|
|
4652
4655
|
}
|
|
4653
4656
|
|
|
4654
4657
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/be.js
|
|
4655
|
-
function getBelarusianPlural(
|
|
4656
|
-
const absCount = Math.abs(
|
|
4658
|
+
function getBelarusianPlural(count2, one, few, many) {
|
|
4659
|
+
const absCount = Math.abs(count2);
|
|
4657
4660
|
const lastDigit = absCount % 10;
|
|
4658
4661
|
const lastTwoDigits = absCount % 100;
|
|
4659
4662
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -6731,8 +6734,8 @@ function hu_default() {
|
|
|
6731
6734
|
}
|
|
6732
6735
|
|
|
6733
6736
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/hy.js
|
|
6734
|
-
function getArmenianPlural(
|
|
6735
|
-
return Math.abs(
|
|
6737
|
+
function getArmenianPlural(count2, one, many) {
|
|
6738
|
+
return Math.abs(count2) === 1 ? one : many;
|
|
6736
6739
|
}
|
|
6737
6740
|
function withDefiniteArticle(word) {
|
|
6738
6741
|
if (!word)
|
|
@@ -7654,8 +7657,8 @@ function ko_default() {
|
|
|
7654
7657
|
}
|
|
7655
7658
|
|
|
7656
7659
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/lt.js
|
|
7657
|
-
var capitalizeFirstCharacter = (
|
|
7658
|
-
return
|
|
7660
|
+
var capitalizeFirstCharacter = (text2) => {
|
|
7661
|
+
return text2.charAt(0).toUpperCase() + text2.slice(1);
|
|
7659
7662
|
};
|
|
7660
7663
|
function getUnitTypeFromNumber(number4) {
|
|
7661
7664
|
const abs = Math.abs(number4);
|
|
@@ -8860,8 +8863,8 @@ function ro_default() {
|
|
|
8860
8863
|
}
|
|
8861
8864
|
|
|
8862
8865
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ru.js
|
|
8863
|
-
function getRussianPlural(
|
|
8864
|
-
const absCount = Math.abs(
|
|
8866
|
+
function getRussianPlural(count2, one, few, many) {
|
|
8867
|
+
const absCount = Math.abs(count2);
|
|
8865
8868
|
const lastDigit = absCount % 10;
|
|
8866
8869
|
const lastTwoDigits = absCount % 100;
|
|
8867
8870
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -10945,11 +10948,11 @@ function _minSize(minimum, params) {
|
|
|
10945
10948
|
});
|
|
10946
10949
|
}
|
|
10947
10950
|
// @__NO_SIDE_EFFECTS__
|
|
10948
|
-
function _size(
|
|
10951
|
+
function _size(size2, params) {
|
|
10949
10952
|
return new $ZodCheckSizeEquals({
|
|
10950
10953
|
check: "size_equals",
|
|
10951
10954
|
...normalizeParams(params),
|
|
10952
|
-
size
|
|
10955
|
+
size: size2
|
|
10953
10956
|
});
|
|
10954
10957
|
}
|
|
10955
10958
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -11427,15 +11430,15 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
|
|
|
11427
11430
|
|
|
11428
11431
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
|
|
11429
11432
|
function initializeContext(params) {
|
|
11430
|
-
let
|
|
11431
|
-
if (
|
|
11432
|
-
|
|
11433
|
-
if (
|
|
11434
|
-
|
|
11433
|
+
let target2 = params?.target ?? "draft-2020-12";
|
|
11434
|
+
if (target2 === "draft-4")
|
|
11435
|
+
target2 = "draft-04";
|
|
11436
|
+
if (target2 === "draft-7")
|
|
11437
|
+
target2 = "draft-07";
|
|
11435
11438
|
return {
|
|
11436
11439
|
processors: params.processors ?? {},
|
|
11437
11440
|
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
11438
|
-
target,
|
|
11441
|
+
target: target2,
|
|
11439
11442
|
unrepresentable: params?.unrepresentable ?? "throw",
|
|
11440
11443
|
override: params?.override ?? (() => {
|
|
11441
11444
|
}),
|
|
@@ -11502,33 +11505,33 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
11502
11505
|
return _result.schema;
|
|
11503
11506
|
}
|
|
11504
11507
|
function extractDefs(ctx, schema) {
|
|
11505
|
-
const
|
|
11506
|
-
if (!
|
|
11508
|
+
const root2 = ctx.seen.get(schema);
|
|
11509
|
+
if (!root2)
|
|
11507
11510
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
11508
11511
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
11509
11512
|
for (const entry of ctx.seen.entries()) {
|
|
11510
|
-
const
|
|
11511
|
-
if (
|
|
11512
|
-
const existing = idToSchema.get(
|
|
11513
|
+
const id3 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
11514
|
+
if (id3) {
|
|
11515
|
+
const existing = idToSchema.get(id3);
|
|
11513
11516
|
if (existing && existing !== entry[0]) {
|
|
11514
|
-
throw new Error(`Duplicate schema id "${
|
|
11517
|
+
throw new Error(`Duplicate schema id "${id3}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
11515
11518
|
}
|
|
11516
|
-
idToSchema.set(
|
|
11519
|
+
idToSchema.set(id3, entry[0]);
|
|
11517
11520
|
}
|
|
11518
11521
|
}
|
|
11519
11522
|
const makeURI = (entry) => {
|
|
11520
11523
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
11521
11524
|
if (ctx.external) {
|
|
11522
11525
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
11523
|
-
const uriGenerator = ctx.external.uri ?? ((
|
|
11526
|
+
const uriGenerator = ctx.external.uri ?? ((id4) => id4);
|
|
11524
11527
|
if (externalId) {
|
|
11525
11528
|
return { ref: uriGenerator(externalId) };
|
|
11526
11529
|
}
|
|
11527
|
-
const
|
|
11528
|
-
entry[1].defId =
|
|
11529
|
-
return { defId:
|
|
11530
|
+
const id3 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
11531
|
+
entry[1].defId = id3;
|
|
11532
|
+
return { defId: id3, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id3}` };
|
|
11530
11533
|
}
|
|
11531
|
-
if (entry[1] ===
|
|
11534
|
+
if (entry[1] === root2) {
|
|
11532
11535
|
return { ref: "#" };
|
|
11533
11536
|
}
|
|
11534
11537
|
const uriPrefix = `#`;
|
|
@@ -11574,8 +11577,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11574
11577
|
continue;
|
|
11575
11578
|
}
|
|
11576
11579
|
}
|
|
11577
|
-
const
|
|
11578
|
-
if (
|
|
11580
|
+
const id3 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
11581
|
+
if (id3) {
|
|
11579
11582
|
extractToDef(entry);
|
|
11580
11583
|
continue;
|
|
11581
11584
|
}
|
|
@@ -11592,8 +11595,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11592
11595
|
}
|
|
11593
11596
|
}
|
|
11594
11597
|
function finalize(ctx, schema) {
|
|
11595
|
-
const
|
|
11596
|
-
if (!
|
|
11598
|
+
const root2 = ctx.seen.get(schema);
|
|
11599
|
+
if (!root2)
|
|
11597
11600
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
11598
11601
|
const flattenRef = (zodSchema) => {
|
|
11599
11602
|
const seen = ctx.seen.get(zodSchema);
|
|
@@ -11671,12 +11674,12 @@ function finalize(ctx, schema) {
|
|
|
11671
11674
|
} else {
|
|
11672
11675
|
}
|
|
11673
11676
|
if (ctx.external?.uri) {
|
|
11674
|
-
const
|
|
11675
|
-
if (!
|
|
11677
|
+
const id3 = ctx.external.registry.get(schema)?.id;
|
|
11678
|
+
if (!id3)
|
|
11676
11679
|
throw new Error("Schema is missing an `id` property");
|
|
11677
|
-
result.$id = ctx.external.uri(
|
|
11680
|
+
result.$id = ctx.external.uri(id3);
|
|
11678
11681
|
}
|
|
11679
|
-
Object.assign(result,
|
|
11682
|
+
Object.assign(result, root2.def ?? root2.schema);
|
|
11680
11683
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
11681
11684
|
if (rootMetaId !== void 0 && result.id === rootMetaId)
|
|
11682
11685
|
delete result.id;
|
|
@@ -11777,8 +11780,8 @@ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
11777
11780
|
return finalize(ctx, schema);
|
|
11778
11781
|
};
|
|
11779
11782
|
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
11780
|
-
const { libraryOptions, target } = params ?? {};
|
|
11781
|
-
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
11783
|
+
const { libraryOptions, target: target2 } = params ?? {};
|
|
11784
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target: target2, io, processors });
|
|
11782
11785
|
process2(schema, ctx);
|
|
11783
11786
|
extractDefs(ctx, schema);
|
|
11784
11787
|
return finalize(ctx, schema);
|
|
@@ -12837,8 +12840,8 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
12837
12840
|
catch(params) {
|
|
12838
12841
|
return _catch2(this, params);
|
|
12839
12842
|
},
|
|
12840
|
-
pipe(
|
|
12841
|
-
return pipe(this,
|
|
12843
|
+
pipe(target2) {
|
|
12844
|
+
return pipe(this, target2);
|
|
12842
12845
|
},
|
|
12843
12846
|
readonly() {
|
|
12844
12847
|
return readonly(this);
|
|
@@ -13665,8 +13668,8 @@ var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
|
13665
13668
|
$ZodFile.init(inst, def);
|
|
13666
13669
|
ZodType.init(inst, def);
|
|
13667
13670
|
inst._zod.processJSONSchema = (ctx, json3, params) => fileProcessor(inst, ctx, json3, params);
|
|
13668
|
-
inst.min = (
|
|
13669
|
-
inst.max = (
|
|
13671
|
+
inst.min = (size2, params) => inst.check(_minSize(size2, params));
|
|
13672
|
+
inst.max = (size2, params) => inst.check(_maxSize(size2, params));
|
|
13670
13673
|
inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
|
|
13671
13674
|
});
|
|
13672
13675
|
function file(params) {
|
|
@@ -14116,13 +14119,13 @@ function resolveRef(ref, ctx) {
|
|
|
14116
14119
|
if (!ref.startsWith("#")) {
|
|
14117
14120
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14118
14121
|
}
|
|
14119
|
-
const
|
|
14120
|
-
if (
|
|
14122
|
+
const path2 = ref.slice(1).split("/").filter(Boolean);
|
|
14123
|
+
if (path2.length === 0) {
|
|
14121
14124
|
return ctx.rootSchema;
|
|
14122
14125
|
}
|
|
14123
14126
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14124
|
-
if (
|
|
14125
|
-
const key =
|
|
14127
|
+
if (path2[0] === defsKey) {
|
|
14128
|
+
const key = path2[1];
|
|
14126
14129
|
if (!key || !ctx.defs[key]) {
|
|
14127
14130
|
throw new Error(`Reference not found: ${ref}`);
|
|
14128
14131
|
}
|
|
@@ -14589,12 +14592,307 @@ var versionResponseSchema = external_exports.object({
|
|
|
14589
14592
|
remote_notifications: external_exports.boolean().optional(),
|
|
14590
14593
|
remote_notification_previews: external_exports.boolean().optional(),
|
|
14591
14594
|
remote_image_uploads: external_exports.boolean().optional(),
|
|
14595
|
+
/** Exact admitted device has a current host-approved maintenance grant (application 26). */
|
|
14596
|
+
remote_host_updates: external_exports.boolean().optional(),
|
|
14592
14597
|
protocol: external_exports.object({
|
|
14593
14598
|
major: external_exports.number().int().nonnegative(),
|
|
14594
14599
|
minor: external_exports.number().int().nonnegative()
|
|
14595
14600
|
})
|
|
14596
14601
|
});
|
|
14597
14602
|
|
|
14603
|
+
// ../shared/src/api/connection/release-notes.ts
|
|
14604
|
+
var RELEASE_NOTES_MAX_BYTES = 256 * 1024;
|
|
14605
|
+
var releaseNotesSchema = external_exports.object({
|
|
14606
|
+
releases: external_exports.array(
|
|
14607
|
+
external_exports.object({
|
|
14608
|
+
component: external_exports.enum(["daemon", "runtime"]),
|
|
14609
|
+
version: external_exports.string().min(1).max(128),
|
|
14610
|
+
markdown: external_exports.string().min(1).max(RELEASE_NOTES_MAX_BYTES).refine((value) => new TextEncoder().encode(value).length <= RELEASE_NOTES_MAX_BYTES)
|
|
14611
|
+
})
|
|
14612
|
+
).max(2).refine((entries) => new Set(entries.map((entry) => entry.component)).size === entries.length)
|
|
14613
|
+
});
|
|
14614
|
+
|
|
14615
|
+
// ../shared/src/installation/version.ts
|
|
14616
|
+
function parseHostReleaseVersion(value) {
|
|
14617
|
+
const version2 = value.trim();
|
|
14618
|
+
return value.length <= 129 && version2.length <= 128 && /^[0-9]+\.[0-9]+\.[0-9]+([+-][A-Za-z0-9.-]+)?$/.test(version2) ? version2 : void 0;
|
|
14619
|
+
}
|
|
14620
|
+
|
|
14621
|
+
// ../shared/src/installation/stage.ts
|
|
14622
|
+
var hostStageRecordSchema = external_exports.object({
|
|
14623
|
+
format: external_exports.literal(1),
|
|
14624
|
+
component: external_exports.enum(["daemon", "runtime"]),
|
|
14625
|
+
generation: external_exports.string().max(135).regex(/^[A-Za-z0-9.+-]+~[A-Za-z0-9]{6}$/),
|
|
14626
|
+
version: external_exports.string().max(128).refine((value) => parseHostReleaseVersion(value) === value),
|
|
14627
|
+
protocol: external_exports.object({
|
|
14628
|
+
major: external_exports.number().int().nonnegative().safe(),
|
|
14629
|
+
minor: external_exports.number().int().nonnegative().safe()
|
|
14630
|
+
}).strict(),
|
|
14631
|
+
archive_sha256: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
14632
|
+
tree_sha256: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
14633
|
+
checksum_verified: external_exports.boolean()
|
|
14634
|
+
}).strict().refine((record2) => record2.generation.startsWith(`${record2.version}~`));
|
|
14635
|
+
var hostStageReceiptSchema = external_exports.object({
|
|
14636
|
+
record: hostStageRecordSchema,
|
|
14637
|
+
digest: external_exports.string().regex(/^[0-9a-f]{64}$/)
|
|
14638
|
+
}).strict();
|
|
14639
|
+
|
|
14640
|
+
// ../shared/src/installation/update.ts
|
|
14641
|
+
var fingerprint = external_exports.string().regex(/^[0-9a-f]{64}$/);
|
|
14642
|
+
var timestamp = external_exports.number().int().nonnegative().safe();
|
|
14643
|
+
var hostUpdateTargetsSchema = external_exports.array(
|
|
14644
|
+
external_exports.object({
|
|
14645
|
+
component: hostStageRecordSchema.shape.component,
|
|
14646
|
+
version: hostStageRecordSchema.shape.version
|
|
14647
|
+
}).strict()
|
|
14648
|
+
).min(1).max(2).refine((targets) => new Set(targets.map((target2) => target2.component)).size === targets.length);
|
|
14649
|
+
var hostUpdateOperationSchema = external_exports.object({
|
|
14650
|
+
format: external_exports.literal(1),
|
|
14651
|
+
id: external_exports.uuid(),
|
|
14652
|
+
revision: external_exports.number().int().positive().safe(),
|
|
14653
|
+
created_at: timestamp,
|
|
14654
|
+
updated_at: timestamp,
|
|
14655
|
+
phase: external_exports.enum([
|
|
14656
|
+
"checking",
|
|
14657
|
+
"downloading",
|
|
14658
|
+
"staged",
|
|
14659
|
+
"preflight",
|
|
14660
|
+
"approved",
|
|
14661
|
+
"dispatching",
|
|
14662
|
+
"applying",
|
|
14663
|
+
"verifying",
|
|
14664
|
+
"complete",
|
|
14665
|
+
"blocked",
|
|
14666
|
+
"cancelled",
|
|
14667
|
+
"superseded",
|
|
14668
|
+
"failed",
|
|
14669
|
+
"recovery_required",
|
|
14670
|
+
"rolled_back"
|
|
14671
|
+
]),
|
|
14672
|
+
targets: hostUpdateTargetsSchema,
|
|
14673
|
+
stages: external_exports.array(hostStageReceiptSchema).max(2),
|
|
14674
|
+
preflight: fingerprint.nullable(),
|
|
14675
|
+
approved: fingerprint.nullable(),
|
|
14676
|
+
dispatch_id: external_exports.uuid().nullable(),
|
|
14677
|
+
worker_id: external_exports.uuid().nullable(),
|
|
14678
|
+
verification: fingerprint.nullable(),
|
|
14679
|
+
message: external_exports.string().max(1024).nullable()
|
|
14680
|
+
}).strict().superRefine((record2, context) => {
|
|
14681
|
+
const fail = (message) => context.addIssue({ code: "custom", message });
|
|
14682
|
+
if (record2.updated_at < record2.created_at) fail("Update timestamp moved backwards");
|
|
14683
|
+
if (["blocked", "cancelled", "superseded", "failed"].includes(record2.phase) && (record2.dispatch_id !== null || record2.worker_id !== null))
|
|
14684
|
+
fail("A dispatched update requires verified recovery before becoming terminal");
|
|
14685
|
+
const components = /* @__PURE__ */ new Set();
|
|
14686
|
+
for (const stage of record2.stages) {
|
|
14687
|
+
if (!stage.record.checksum_verified || !record2.targets.some(
|
|
14688
|
+
(target2) => target2.component === stage.record.component && target2.version === stage.record.version
|
|
14689
|
+
) || components.has(stage.record.component))
|
|
14690
|
+
fail("Stage does not match a verified update target");
|
|
14691
|
+
components.add(stage.record.component);
|
|
14692
|
+
}
|
|
14693
|
+
const prepared = [
|
|
14694
|
+
"staged",
|
|
14695
|
+
"preflight",
|
|
14696
|
+
"approved",
|
|
14697
|
+
"dispatching",
|
|
14698
|
+
"applying",
|
|
14699
|
+
"verifying",
|
|
14700
|
+
"complete",
|
|
14701
|
+
"recovery_required",
|
|
14702
|
+
"rolled_back"
|
|
14703
|
+
].includes(record2.phase);
|
|
14704
|
+
if (prepared && record2.stages.length !== record2.targets.length)
|
|
14705
|
+
fail("Update is not completely staged");
|
|
14706
|
+
if ([
|
|
14707
|
+
"preflight",
|
|
14708
|
+
"approved",
|
|
14709
|
+
"dispatching",
|
|
14710
|
+
"applying",
|
|
14711
|
+
"verifying",
|
|
14712
|
+
"complete",
|
|
14713
|
+
"recovery_required",
|
|
14714
|
+
"rolled_back"
|
|
14715
|
+
].includes(record2.phase) && !record2.preflight)
|
|
14716
|
+
fail("Update requires preflight evidence");
|
|
14717
|
+
if ([
|
|
14718
|
+
"approved",
|
|
14719
|
+
"dispatching",
|
|
14720
|
+
"applying",
|
|
14721
|
+
"verifying",
|
|
14722
|
+
"complete",
|
|
14723
|
+
"recovery_required",
|
|
14724
|
+
"rolled_back"
|
|
14725
|
+
].includes(record2.phase) && record2.approved !== record2.preflight)
|
|
14726
|
+
fail("Update approval does not match preflight");
|
|
14727
|
+
if ([
|
|
14728
|
+
"dispatching",
|
|
14729
|
+
"applying",
|
|
14730
|
+
"verifying",
|
|
14731
|
+
"complete",
|
|
14732
|
+
"recovery_required",
|
|
14733
|
+
"rolled_back"
|
|
14734
|
+
].includes(record2.phase) && !record2.dispatch_id)
|
|
14735
|
+
fail("Update requires a recorded dispatch");
|
|
14736
|
+
if (["applying", "verifying", "complete"].includes(record2.phase) && !record2.worker_id)
|
|
14737
|
+
fail("Update requires a claimed worker");
|
|
14738
|
+
if (["complete", "rolled_back"].includes(record2.phase) && !record2.verification)
|
|
14739
|
+
fail("Update requires verification evidence");
|
|
14740
|
+
});
|
|
14741
|
+
var HOST_UPDATE_HISTORY_LIMIT = 32;
|
|
14742
|
+
var HOST_UPDATE_RECORD_BYTES = 512 * 1024;
|
|
14743
|
+
var hostUpdateLedgerSchema = external_exports.object({
|
|
14744
|
+
format: external_exports.literal(1),
|
|
14745
|
+
current: hostUpdateOperationSchema.nullable(),
|
|
14746
|
+
history: external_exports.array(hostUpdateOperationSchema).max(HOST_UPDATE_HISTORY_LIMIT)
|
|
14747
|
+
}).strict().superRefine((ledger, context) => {
|
|
14748
|
+
const ids = [ledger.current?.id, ...ledger.history.map((operation2) => operation2.id)].filter(
|
|
14749
|
+
Boolean
|
|
14750
|
+
);
|
|
14751
|
+
if (new Set(ids).size !== ids.length || ledger.history.some((operation2) => !hostUpdateTerminal(operation2.phase)))
|
|
14752
|
+
context.addIssue({ code: "custom", message: "Invalid update history" });
|
|
14753
|
+
});
|
|
14754
|
+
function hostUpdateTerminal(phase) {
|
|
14755
|
+
return ["complete", "blocked", "cancelled", "superseded", "failed", "rolled_back"].includes(
|
|
14756
|
+
phase
|
|
14757
|
+
);
|
|
14758
|
+
}
|
|
14759
|
+
|
|
14760
|
+
// ../shared/src/installation/catalogue.ts
|
|
14761
|
+
var releaseRepositorySchema = external_exports.string().max(201).regex(/^[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9_.-]+$/).refine((value) => ![".", ".."].includes(value.split("/")[1]));
|
|
14762
|
+
var timestamp2 = external_exports.number().int().nonnegative().safe();
|
|
14763
|
+
var hostReleaseCheckSchema = external_exports.object({
|
|
14764
|
+
repository: releaseRepositorySchema.nullable(),
|
|
14765
|
+
state: external_exports.enum(["unconfigured", "checking", "ready", "failed"]),
|
|
14766
|
+
checked_at: timestamp2.nullable(),
|
|
14767
|
+
succeeded_at: timestamp2.nullable(),
|
|
14768
|
+
latest: external_exports.object({
|
|
14769
|
+
version: external_exports.string().max(128).regex(/^[0-9]+\.[0-9]+\.[0-9]+$/),
|
|
14770
|
+
host_asset: external_exports.boolean()
|
|
14771
|
+
}).strict().nullable()
|
|
14772
|
+
}).strict();
|
|
14773
|
+
var component = external_exports.object({
|
|
14774
|
+
version: external_exports.string().min(1).max(128),
|
|
14775
|
+
protocol: hostStageRecordSchema.shape.protocol
|
|
14776
|
+
});
|
|
14777
|
+
var count = external_exports.number().int().nonnegative().max(4096);
|
|
14778
|
+
var hostUpdateCatalogueSchema = external_exports.object({
|
|
14779
|
+
observed_at: timestamp2,
|
|
14780
|
+
daemon_version: external_exports.string().min(1).max(128),
|
|
14781
|
+
runtime_default: component.strict().nullable(),
|
|
14782
|
+
runtimes: external_exports.object({
|
|
14783
|
+
complete: external_exports.boolean(),
|
|
14784
|
+
versions: external_exports.array(component.extend({ running: count, starting: count, unavailable: count }).strict()).max(128)
|
|
14785
|
+
}).strict(),
|
|
14786
|
+
releases: hostReleaseCheckSchema
|
|
14787
|
+
}).strict();
|
|
14788
|
+
|
|
14789
|
+
// ../shared/src/api/connection/host-updates.ts
|
|
14790
|
+
var hostUpdateReferenceSchema = external_exports.object({
|
|
14791
|
+
id: hostUpdateOperationSchema.shape.id,
|
|
14792
|
+
revision: hostUpdateOperationSchema.shape.revision
|
|
14793
|
+
}).strict();
|
|
14794
|
+
var hostUpdateFingerprintSchema = external_exports.string().regex(/^[0-9a-f]{64}$/);
|
|
14795
|
+
var reference = hostUpdateReferenceSchema;
|
|
14796
|
+
var fingerprint2 = hostUpdateFingerprintSchema;
|
|
14797
|
+
var hostUpdateCommandSchema = external_exports.discriminatedUnion("action", [
|
|
14798
|
+
external_exports.object({
|
|
14799
|
+
action: external_exports.literal("status"),
|
|
14800
|
+
id: external_exports.uuid().optional(),
|
|
14801
|
+
/** Fresh private worker observation; never authorises activation. */
|
|
14802
|
+
adoption_nonce: external_exports.uuid().optional(),
|
|
14803
|
+
/** Recorded continuation metadata, capability-detected from application 25.12. */
|
|
14804
|
+
include_recovery: external_exports.literal(true).optional(),
|
|
14805
|
+
/** Host-wide versions and coalesced release discovery (25.14), never admission evidence. */
|
|
14806
|
+
include_catalogue: external_exports.literal(true).optional()
|
|
14807
|
+
}).strict().refine(
|
|
14808
|
+
(command) => !command.adoption_nonce || command.id !== void 0,
|
|
14809
|
+
"Adoption inspection requires an exact operation"
|
|
14810
|
+
),
|
|
14811
|
+
external_exports.object({ action: external_exports.literal("begin"), targets: hostUpdateTargetsSchema }).strict(),
|
|
14812
|
+
external_exports.object({ action: external_exports.literal("stage"), reference, receipt: hostStageReceiptSchema }).strict(),
|
|
14813
|
+
external_exports.object({
|
|
14814
|
+
action: external_exports.literal("recover"),
|
|
14815
|
+
reference,
|
|
14816
|
+
strategy: external_exports.enum(["verify-completion", "continue"])
|
|
14817
|
+
}).strict(),
|
|
14818
|
+
external_exports.object({
|
|
14819
|
+
action: external_exports.literal("inspect"),
|
|
14820
|
+
reference,
|
|
14821
|
+
cockpit: hostStageRecordSchema.shape.protocol
|
|
14822
|
+
}).strict(),
|
|
14823
|
+
external_exports.object({
|
|
14824
|
+
action: external_exports.literal("apply"),
|
|
14825
|
+
reference,
|
|
14826
|
+
cockpit: hostStageRecordSchema.shape.protocol,
|
|
14827
|
+
fingerprint: fingerprint2,
|
|
14828
|
+
/** Explicit consent to the exact reviewed daemon-owned interruption inventory (25.10). */
|
|
14829
|
+
interruption_approval: fingerprint2.optional()
|
|
14830
|
+
}).strict(),
|
|
14831
|
+
external_exports.object({
|
|
14832
|
+
action: external_exports.literal("cancel"),
|
|
14833
|
+
reference,
|
|
14834
|
+
reason: external_exports.enum(["cancelled", "staging_failed"])
|
|
14835
|
+
}).strict()
|
|
14836
|
+
]);
|
|
14837
|
+
var hostUpdateReviewSchema = external_exports.object({
|
|
14838
|
+
fingerprint: fingerprint2.nullable(),
|
|
14839
|
+
can_apply: external_exports.boolean(),
|
|
14840
|
+
/** Never makes can_apply true; only a matching explicit apply approval permits interruption. */
|
|
14841
|
+
interruption_fingerprint: fingerprint2.optional(),
|
|
14842
|
+
blockers: external_exports.array(external_exports.object({ code: external_exports.string().min(1).max(64), target: external_exports.string().max(4096) }).strict()).max(32),
|
|
14843
|
+
more_blockers: external_exports.number().int().nonnegative().safe(),
|
|
14844
|
+
affected: external_exports.object({
|
|
14845
|
+
terminals: external_exports.number().int().nonnegative().safe(),
|
|
14846
|
+
notebooks: external_exports.number().int().nonnegative().safe(),
|
|
14847
|
+
compilation: external_exports.number().int().nonnegative().safe(),
|
|
14848
|
+
programmes: external_exports.number().int().nonnegative().safe()
|
|
14849
|
+
}).strict()
|
|
14850
|
+
}).strict();
|
|
14851
|
+
var hostUpdateRecoveryStatusSchema = external_exports.object({
|
|
14852
|
+
id: external_exports.uuid(),
|
|
14853
|
+
requested_revision: hostUpdateOperationSchema.shape.revision,
|
|
14854
|
+
revision: hostUpdateOperationSchema.shape.revision,
|
|
14855
|
+
/** Durable consumption, not a claim that the worker is still running or completed. */
|
|
14856
|
+
consumed: external_exports.boolean()
|
|
14857
|
+
}).strict();
|
|
14858
|
+
var hostUpdateReplySchema = external_exports.discriminatedUnion("ok", [
|
|
14859
|
+
external_exports.object({
|
|
14860
|
+
ok: external_exports.literal(true),
|
|
14861
|
+
operation: hostUpdateOperationSchema.nullable(),
|
|
14862
|
+
created: external_exports.boolean().optional(),
|
|
14863
|
+
review: hostUpdateReviewSchema.optional(),
|
|
14864
|
+
recovery: hostUpdateRecoveryStatusSchema.optional(),
|
|
14865
|
+
catalogue: hostUpdateCatalogueSchema.optional()
|
|
14866
|
+
}).strict(),
|
|
14867
|
+
external_exports.object({
|
|
14868
|
+
ok: external_exports.literal(false),
|
|
14869
|
+
code: external_exports.enum(["rejected", "unavailable", "unsupported", "conflict", "failed"]),
|
|
14870
|
+
operation: hostUpdateOperationSchema.nullable()
|
|
14871
|
+
}).strict()
|
|
14872
|
+
]);
|
|
14873
|
+
var hostUpdateControlRequestSchema = external_exports.object({ t: external_exports.literal("host-update"), request_id: external_exports.uuid(), command: hostUpdateCommandSchema }).strict();
|
|
14874
|
+
var hostUpdateControlResponseSchema = external_exports.object({
|
|
14875
|
+
t: external_exports.literal("host-update-result"),
|
|
14876
|
+
request_id: external_exports.uuid(),
|
|
14877
|
+
result: hostUpdateReplySchema
|
|
14878
|
+
}).strict();
|
|
14879
|
+
|
|
14880
|
+
// ../shared/src/api/connection/connector-inspection.ts
|
|
14881
|
+
var connectorInspectionRequestSchema = external_exports.object({ t: external_exports.literal("inspect"), nonce: external_exports.uuid() }).strict();
|
|
14882
|
+
var connectorInspectionResponseSchema = external_exports.object({
|
|
14883
|
+
t: external_exports.literal("inspection"),
|
|
14884
|
+
nonce: external_exports.uuid(),
|
|
14885
|
+
instance: external_exports.uuid(),
|
|
14886
|
+
ready: external_exports.boolean(),
|
|
14887
|
+
pid: external_exports.number().int().positive().safe(),
|
|
14888
|
+
version: external_exports.string().min(1).max(128),
|
|
14889
|
+
application: hostStageRecordSchema.shape.protocol,
|
|
14890
|
+
remote: external_exports.number().int().nonnegative().safe(),
|
|
14891
|
+
node_path: external_exports.string().min(1).max(4096),
|
|
14892
|
+
entry_path: external_exports.string().min(1).max(4096),
|
|
14893
|
+
release_path: external_exports.string().min(1).max(4096)
|
|
14894
|
+
}).strip();
|
|
14895
|
+
|
|
14598
14896
|
// ../shared/src/api/agents/agent-signal.ts
|
|
14599
14897
|
var statusSignalSchema = external_exports.object({
|
|
14600
14898
|
nonce: external_exports.string().min(16),
|
|
@@ -15501,7 +15799,7 @@ var notebookKernelsResponseSchema = external_exports.object({
|
|
|
15501
15799
|
error: external_exports.string().optional()
|
|
15502
15800
|
});
|
|
15503
15801
|
var notebookKernelRequestSchema = external_exports.object({ source: compilationFileTargetSchema });
|
|
15504
|
-
var pythonPathSchema = external_exports.string().trim().min(1).max(4096).refine((
|
|
15802
|
+
var pythonPathSchema = external_exports.string().trim().min(1).max(4096).refine((path2) => !path2.includes("\0"));
|
|
15505
15803
|
var notebookEnvironmentSchema = external_exports.object({
|
|
15506
15804
|
python: pythonPathSchema,
|
|
15507
15805
|
label: external_exports.string(),
|
|
@@ -15837,7 +16135,92 @@ var cockpitFileManagerSchema = external_exports.object({
|
|
|
15837
16135
|
name: external_exports.enum(["Finder", "File Explorer", "File Manager"]).nullable()
|
|
15838
16136
|
});
|
|
15839
16137
|
var cockpitRevealRequestSchema = external_exports.object({
|
|
15840
|
-
path: external_exports.string().min(1).max(4096).refine((
|
|
16138
|
+
path: external_exports.string().min(1).max(4096).refine((path2) => !path2.includes("\0"))
|
|
16139
|
+
}).strict();
|
|
16140
|
+
|
|
16141
|
+
// ../shared/src/api/connection/cockpit-updates.ts
|
|
16142
|
+
var onlineHostUpdateRequestSchema = external_exports.discriminatedUnion("action", [
|
|
16143
|
+
external_exports.object({ action: external_exports.literal("prepare"), targets: hostUpdateTargetsSchema }).strict(),
|
|
16144
|
+
external_exports.object({ action: external_exports.literal("inspect"), reference: hostUpdateReferenceSchema }).strict(),
|
|
16145
|
+
external_exports.object({
|
|
16146
|
+
action: external_exports.literal("apply"),
|
|
16147
|
+
reference: hostUpdateReferenceSchema,
|
|
16148
|
+
fingerprint: hostUpdateFingerprintSchema,
|
|
16149
|
+
interruption_approval: hostUpdateFingerprintSchema.optional()
|
|
16150
|
+
}).strict(),
|
|
16151
|
+
external_exports.object({ action: external_exports.literal("cancel"), reference: hostUpdateReferenceSchema }).strict(),
|
|
16152
|
+
external_exports.object({
|
|
16153
|
+
action: external_exports.literal("recover"),
|
|
16154
|
+
reference: hostUpdateReferenceSchema,
|
|
16155
|
+
strategy: external_exports.enum(["verify-completion", "continue"])
|
|
16156
|
+
}).strict()
|
|
16157
|
+
]);
|
|
16158
|
+
var cockpitHostUpdateRequestSchema = external_exports.discriminatedUnion("action", [
|
|
16159
|
+
...onlineHostUpdateRequestSchema.options,
|
|
16160
|
+
external_exports.object({ action: external_exports.literal("continue-offline"), reference: hostUpdateReferenceSchema }).strict()
|
|
16161
|
+
]);
|
|
16162
|
+
var cockpitHostUpdateQuerySchema = external_exports.object({ id: external_exports.uuid().optional() }).strict();
|
|
16163
|
+
var operation = hostUpdateOperationSchema.shape;
|
|
16164
|
+
var cockpitHostUpdateOperationSchema = external_exports.object({
|
|
16165
|
+
id: operation.id,
|
|
16166
|
+
revision: operation.revision,
|
|
16167
|
+
created_at: operation.created_at,
|
|
16168
|
+
updated_at: operation.updated_at,
|
|
16169
|
+
phase: operation.phase,
|
|
16170
|
+
targets: operation.targets,
|
|
16171
|
+
staged: external_exports.boolean(),
|
|
16172
|
+
dispatched: external_exports.boolean(),
|
|
16173
|
+
message: operation.message
|
|
16174
|
+
}).strict();
|
|
16175
|
+
var cockpitHostUpdateReviewSchema = hostUpdateReviewSchema.extend({
|
|
16176
|
+
blockers: external_exports.array(external_exports.object({ code: external_exports.string().min(1).max(64) }).strict()).max(32)
|
|
16177
|
+
});
|
|
16178
|
+
var cockpitHostUpdateReplySchema = external_exports.discriminatedUnion("ok", [
|
|
16179
|
+
external_exports.object({
|
|
16180
|
+
ok: external_exports.literal(true),
|
|
16181
|
+
operation: cockpitHostUpdateOperationSchema.nullable(),
|
|
16182
|
+
review: cockpitHostUpdateReviewSchema.optional(),
|
|
16183
|
+
recovery: hostUpdateRecoveryStatusSchema.optional()
|
|
16184
|
+
}).strict(),
|
|
16185
|
+
external_exports.object({
|
|
16186
|
+
ok: external_exports.literal(false),
|
|
16187
|
+
code: external_exports.enum(["rejected", "unavailable", "unsupported", "conflict", "failed"]),
|
|
16188
|
+
operation: cockpitHostUpdateOperationSchema.nullable()
|
|
16189
|
+
}).strict()
|
|
16190
|
+
]);
|
|
16191
|
+
var cockpitHostUpdateStatusSchema = external_exports.object({
|
|
16192
|
+
availability: external_exports.enum(["ready", "unavailable", "upgrade_required"]),
|
|
16193
|
+
/** Recorded operations do not establish current service health or adoption. */
|
|
16194
|
+
observation: external_exports.enum(["live", "recorded"]).optional(),
|
|
16195
|
+
daemon_version: external_exports.string().max(128).nullable(),
|
|
16196
|
+
capabilities: external_exports.object({
|
|
16197
|
+
interruption_approval: external_exports.boolean(),
|
|
16198
|
+
verify_completion: external_exports.boolean(),
|
|
16199
|
+
continue_recovery: external_exports.boolean(),
|
|
16200
|
+
offline_continuation: external_exports.boolean().optional()
|
|
16201
|
+
}).strict(),
|
|
16202
|
+
result: cockpitHostUpdateReplySchema.nullable(),
|
|
16203
|
+
catalogue: hostUpdateCatalogueSchema.optional()
|
|
16204
|
+
}).strict();
|
|
16205
|
+
|
|
16206
|
+
// ../shared/src/api/connection/host-maintenance.ts
|
|
16207
|
+
var hostMaintenanceCommandSchema = external_exports.discriminatedUnion("action", [
|
|
16208
|
+
external_exports.object({ action: external_exports.literal("status"), id: external_exports.uuid().optional() }).strict(),
|
|
16209
|
+
...onlineHostUpdateRequestSchema.options
|
|
16210
|
+
]);
|
|
16211
|
+
var hostMaintenanceReplySchema = external_exports.discriminatedUnion("kind", [
|
|
16212
|
+
external_exports.object({ kind: external_exports.literal("status"), status: cockpitHostUpdateStatusSchema }).strict(),
|
|
16213
|
+
external_exports.object({ kind: external_exports.literal("result"), result: cockpitHostUpdateReplySchema }).strict()
|
|
16214
|
+
]);
|
|
16215
|
+
var hostMaintenanceControlRequestSchema = external_exports.object({
|
|
16216
|
+
t: external_exports.literal("host-maintenance"),
|
|
16217
|
+
request_id: external_exports.uuid(),
|
|
16218
|
+
command: hostMaintenanceCommandSchema
|
|
16219
|
+
}).strict();
|
|
16220
|
+
var hostMaintenanceControlResponseSchema = external_exports.object({
|
|
16221
|
+
t: external_exports.literal("host-maintenance-result"),
|
|
16222
|
+
request_id: external_exports.uuid(),
|
|
16223
|
+
result: hostMaintenanceReplySchema
|
|
15841
16224
|
}).strict();
|
|
15842
16225
|
|
|
15843
16226
|
// ../shared/src/ws/messages.ts
|
|
@@ -15875,6 +16258,8 @@ var wsClientMessageSchema = external_exports.discriminatedUnion("t", [
|
|
|
15875
16258
|
})
|
|
15876
16259
|
]);
|
|
15877
16260
|
var wsServerMessageSchema = external_exports.discriminatedUnion("t", [
|
|
16261
|
+
/** Host-wide invalidation only; profile-scoped remote leases never receive it. */
|
|
16262
|
+
external_exports.object({ t: external_exports.literal("host-updates-changed") }),
|
|
15878
16263
|
agentNotificationSchema,
|
|
15879
16264
|
external_exports.object({ t: external_exports.literal("authenticated") }),
|
|
15880
16265
|
external_exports.object({ t: external_exports.literal("shell-spawned"), session: external_exports.string(), term: external_exports.string() }),
|
|
@@ -15922,8 +16307,10 @@ var wsServerMessageSchema = external_exports.discriminatedUnion("t", [
|
|
|
15922
16307
|
]);
|
|
15923
16308
|
|
|
15924
16309
|
// ../shared/src/remote/protocol.ts
|
|
15925
|
-
var REMOTE_PROTOCOL_VERSION =
|
|
16310
|
+
var REMOTE_PROTOCOL_VERSION = 5;
|
|
15926
16311
|
var REMOTE_POLICY = {
|
|
16312
|
+
/** Two sequential bounded host stages; participation remains required throughout. */
|
|
16313
|
+
maintenanceRequestMs: 3e5,
|
|
15927
16314
|
chunkBytes: 32 * 1024,
|
|
15928
16315
|
frameBytes: 48 * 1024,
|
|
15929
16316
|
requestBytes: 256 * 1024,
|
|
@@ -15967,6 +16354,7 @@ var relayMessageSchema = external_exports.discriminatedUnion("t", [
|
|
|
15967
16354
|
external_exports.object({ t: external_exports.literal("ready"), connection: remoteIdSchema, account: remoteAccountSchema }).strict()
|
|
15968
16355
|
]);
|
|
15969
16356
|
var remoteDeviceSchema = external_exports.object({
|
|
16357
|
+
maintenance: external_exports.boolean().optional(),
|
|
15970
16358
|
id: remoteIdSchema,
|
|
15971
16359
|
peer: remotePeerSchema,
|
|
15972
16360
|
account: remoteAccountSchema,
|
|
@@ -16043,6 +16431,15 @@ var remoteChunkSchema = external_exports.object({
|
|
|
16043
16431
|
data: external_exports.string().max(REMOTE_POLICY.chunkBytes)
|
|
16044
16432
|
}).strict();
|
|
16045
16433
|
|
|
16434
|
+
// ../shared/src/remote/maintenance.ts
|
|
16435
|
+
var remoteMaintenanceClaimSchema = external_exports.object({
|
|
16436
|
+
device: remoteIdSchema,
|
|
16437
|
+
peer: remotePeerSchema,
|
|
16438
|
+
account: remoteAccountSchema,
|
|
16439
|
+
host: remoteIdSchema,
|
|
16440
|
+
grant: remoteIdSchema
|
|
16441
|
+
}).strict();
|
|
16442
|
+
|
|
16046
16443
|
// ../shared/src/remote/service.ts
|
|
16047
16444
|
var remoteHostSchema = external_exports.object({
|
|
16048
16445
|
id: remoteIdSchema,
|
|
@@ -16107,7 +16504,8 @@ var remoteBrowserHostSchema = external_exports.object({
|
|
|
16107
16504
|
// ../shared/src/api/connection/cockpit-remote.ts
|
|
16108
16505
|
var connectorLocalRequestSchema = external_exports.union([
|
|
16109
16506
|
remoteAdminRequestSchema,
|
|
16110
|
-
external_exports.object({ t: external_exports.literal("delete_registration") }).strict()
|
|
16507
|
+
external_exports.object({ t: external_exports.literal("delete_registration") }).strict(),
|
|
16508
|
+
external_exports.object({ t: external_exports.literal("maintenance"), id: remoteIdSchema, enabled: external_exports.boolean() }).strict()
|
|
16111
16509
|
]);
|
|
16112
16510
|
var cockpitRemoteRequestSchema = external_exports.union([
|
|
16113
16511
|
connectorLocalRequestSchema,
|
|
@@ -16124,6 +16522,7 @@ var cockpitRemoteStatusSchema = external_exports.object({
|
|
|
16124
16522
|
enabled: external_exports.boolean(),
|
|
16125
16523
|
connected: external_exports.boolean(),
|
|
16126
16524
|
canDeleteRegistration: external_exports.boolean().optional(),
|
|
16525
|
+
canManageMaintenance: external_exports.boolean().optional(),
|
|
16127
16526
|
supervisor: external_exports.enum(["systemd", "launchd"]).nullable(),
|
|
16128
16527
|
host: remoteIdSchema.optional(),
|
|
16129
16528
|
peer: remotePeerSchema.optional(),
|
|
@@ -16156,7 +16555,13 @@ var authErrorCodeSchema = external_exports.enum([
|
|
|
16156
16555
|
"protocol_mismatch"
|
|
16157
16556
|
]);
|
|
16158
16557
|
var controlRequestSchema = external_exports.discriminatedUnion("t", [
|
|
16159
|
-
|
|
16558
|
+
hostUpdateControlRequestSchema,
|
|
16559
|
+
hostMaintenanceControlRequestSchema,
|
|
16560
|
+
external_exports.object({
|
|
16561
|
+
t: external_exports.literal("open"),
|
|
16562
|
+
profile: profileId.optional(),
|
|
16563
|
+
maintenance: remoteMaintenanceClaimSchema.optional()
|
|
16564
|
+
}).strict(),
|
|
16160
16565
|
external_exports.object({ t: external_exports.literal("renew"), resources: external_exports.array(resourceIdSchema).max(2048) }).strict(),
|
|
16161
16566
|
external_exports.object({ t: external_exports.literal("close") }).strict()
|
|
16162
16567
|
]);
|
|
@@ -16167,6 +16572,8 @@ var hostInspectionSchema = external_exports.object({
|
|
|
16167
16572
|
liveSessions: external_exports.number().int().nonnegative()
|
|
16168
16573
|
});
|
|
16169
16574
|
var controlResponseSchema = external_exports.discriminatedUnion("t", [
|
|
16575
|
+
hostUpdateControlResponseSchema,
|
|
16576
|
+
hostMaintenanceControlResponseSchema,
|
|
16170
16577
|
external_exports.object({
|
|
16171
16578
|
t: external_exports.literal("authority"),
|
|
16172
16579
|
generation: external_exports.string().uuid(),
|
|
@@ -16388,6 +16795,44 @@ var puddlangContextSchema = external_exports.object({
|
|
|
16388
16795
|
)
|
|
16389
16796
|
});
|
|
16390
16797
|
|
|
16798
|
+
// ../shared/src/api/agents/puddlang-outcomes.ts
|
|
16799
|
+
var puddlangOutcomeOperationSchema = external_exports.number().int().safe();
|
|
16800
|
+
var puddlangOutcomeActionSchema = external_exports.enum(["read", "discard"]);
|
|
16801
|
+
var fingerprint3 = external_exports.string().regex(/^[a-f0-9]{64}$/);
|
|
16802
|
+
var terminalStatus = external_exports.enum(["completed", "failed", "cancelled", "interrupted"]);
|
|
16803
|
+
var puddlangOutcomeDispositionSchema = external_exports.object({
|
|
16804
|
+
action: puddlangOutcomeActionSchema,
|
|
16805
|
+
fingerprint: fingerprint3,
|
|
16806
|
+
at: external_exports.iso.datetime()
|
|
16807
|
+
}).strict();
|
|
16808
|
+
var puddlangOutcomeSchema = external_exports.object({
|
|
16809
|
+
operation_id: puddlangOutcomeOperationSchema,
|
|
16810
|
+
runtime_id: external_exports.uuid(),
|
|
16811
|
+
turn: external_exports.number().int().positive().safe(),
|
|
16812
|
+
status: external_exports.enum(["running", "completed", "failed", "cancelled", "interrupted", "unavailable"]),
|
|
16813
|
+
retained: external_exports.boolean(),
|
|
16814
|
+
consumed: external_exports.boolean().nullable(),
|
|
16815
|
+
fingerprint: fingerprint3.nullable(),
|
|
16816
|
+
disposition: puddlangOutcomeDispositionSchema.nullable()
|
|
16817
|
+
}).strict();
|
|
16818
|
+
var puddlangOutcomesSchema = external_exports.object({
|
|
16819
|
+
outcomes: external_exports.array(puddlangOutcomeSchema).max(50),
|
|
16820
|
+
next_after: puddlangOutcomeOperationSchema.nullable()
|
|
16821
|
+
}).strict();
|
|
16822
|
+
var puddlangOutcomeRequestSchema = external_exports.object({
|
|
16823
|
+
action: puddlangOutcomeActionSchema,
|
|
16824
|
+
fingerprint: fingerprint3
|
|
16825
|
+
}).strict();
|
|
16826
|
+
var puddlangOutcomeResponseSchema = external_exports.object({
|
|
16827
|
+
outcome: puddlangOutcomeSchema,
|
|
16828
|
+
// Explicit reads only. Native references and prompts are never projected here.
|
|
16829
|
+
result: external_exports.object({
|
|
16830
|
+
status: terminalStatus,
|
|
16831
|
+
reply: external_exports.string().max(256 * 1024).optional(),
|
|
16832
|
+
error: external_exports.string().max(4096).optional()
|
|
16833
|
+
}).strict().nullable()
|
|
16834
|
+
}).strict();
|
|
16835
|
+
|
|
16391
16836
|
// ../shared/src/api/agents/puddlang-mcp.ts
|
|
16392
16837
|
var puddlangMcpRequestSchema = external_exports.object({
|
|
16393
16838
|
jsonrpc: external_exports.literal("2.0"),
|
|
@@ -16405,6 +16850,13 @@ var puddlangMcpEventsSchema = puddlangMcpIdSchema.extend({
|
|
|
16405
16850
|
after: external_exports.number().int().nonnegative().default(0)
|
|
16406
16851
|
});
|
|
16407
16852
|
var puddlangMcpEmptySchema = external_exports.object({}).strict();
|
|
16853
|
+
var puddlangMcpOutcomesSchema = puddlangMcpIdSchema.extend({
|
|
16854
|
+
after: puddlangOutcomeOperationSchema.optional()
|
|
16855
|
+
}).strict();
|
|
16856
|
+
var puddlangMcpOutcomeSchema = puddlangOutcomeRequestSchema.extend({
|
|
16857
|
+
id: external_exports.uuid(),
|
|
16858
|
+
operation: puddlangOutcomeOperationSchema
|
|
16859
|
+
}).strict();
|
|
16408
16860
|
var definitions = [
|
|
16409
16861
|
[
|
|
16410
16862
|
"puddlang_context",
|
|
@@ -16435,6 +16887,18 @@ var definitions = [
|
|
|
16435
16887
|
"Cancel a run, interrupt its pending asks, and stop agents it created. Attached agents are retained.",
|
|
16436
16888
|
puddlangMcpIdSchema,
|
|
16437
16889
|
false
|
|
16890
|
+
],
|
|
16891
|
+
[
|
|
16892
|
+
"puddlang_outcomes",
|
|
16893
|
+
"Inspect up to 50 retained outcome identities for a run without reading reply text or releasing retention. Use next_after to paginate. Requires application 26.1+.",
|
|
16894
|
+
puddlangMcpOutcomesSchema,
|
|
16895
|
+
true
|
|
16896
|
+
],
|
|
16897
|
+
[
|
|
16898
|
+
"puddlang_outcome",
|
|
16899
|
+
"Explicitly read or discard one unchanged terminal outcome of a finished programme, using its inspected fingerprint. Both actions release retention for later reclamation and create a metadata-only audit. No programme or prompt is replayed. Repeating the same disposition observes it; a reclaimed reply is unavailable. Requires application 26.1+.",
|
|
16900
|
+
puddlangMcpOutcomeSchema,
|
|
16901
|
+
false
|
|
16438
16902
|
]
|
|
16439
16903
|
];
|
|
16440
16904
|
var puddlangMcpTools = definitions.map(([name, description, schema, readOnlyHint]) => ({
|
|
@@ -16581,6 +17045,1098 @@ var storageStatusSchema = external_exports.object({
|
|
|
16581
17045
|
database_degraded: external_exports.boolean()
|
|
16582
17046
|
});
|
|
16583
17047
|
|
|
17048
|
+
// ../shared/src/runtime/protocol.ts
|
|
17049
|
+
var RUNTIME_PROTOCOL_VERSION = { major: 1, minor: 0 };
|
|
17050
|
+
var RUNTIME_LIMITS = {
|
|
17051
|
+
frameBytes: 8 * 1024 * 1024,
|
|
17052
|
+
inputBytes: 64 * 1024,
|
|
17053
|
+
outputBytes: 256 * 1024,
|
|
17054
|
+
pendingRequests: 64,
|
|
17055
|
+
queuedBytes: 16 * 1024 * 1024,
|
|
17056
|
+
requestMs: 15e3,
|
|
17057
|
+
handshakeMs: 5e3,
|
|
17058
|
+
terminals: 32,
|
|
17059
|
+
journalEvents: 4096,
|
|
17060
|
+
journalBytes: 2 * 1024 * 1024,
|
|
17061
|
+
eventPage: 256,
|
|
17062
|
+
turnPromptBytes: 64 * 1024,
|
|
17063
|
+
turnReplyBytes: 256 * 1024,
|
|
17064
|
+
environmentVariables: 128,
|
|
17065
|
+
environmentValueBytes: 32 * 1024,
|
|
17066
|
+
historySegments: 256,
|
|
17067
|
+
historyLogBytes: 64 * 1024 * 1024,
|
|
17068
|
+
historyLogFiles: 1024,
|
|
17069
|
+
historySnapshotBytes: 64 * 1024 * 1024,
|
|
17070
|
+
pendingCheckpoints: 64,
|
|
17071
|
+
pendingCheckpointBytes: 16 * 1024 * 1024,
|
|
17072
|
+
launchRefs: 16384
|
|
17073
|
+
};
|
|
17074
|
+
var id2 = external_exports.uuid();
|
|
17075
|
+
var sequence = external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
17076
|
+
var text = external_exports.string().max(4096);
|
|
17077
|
+
var path = text.refine(
|
|
17078
|
+
(value) => value.startsWith("/") && !value.includes("\0"),
|
|
17079
|
+
"Absolute host path required"
|
|
17080
|
+
);
|
|
17081
|
+
var protocol = external_exports.object({ major: sequence, minor: sequence });
|
|
17082
|
+
var terminalName = external_exports.string().regex(/^(agent|shell-[1-9][0-9]{0,5})$/);
|
|
17083
|
+
var size = { cols: external_exports.number().int().min(1).max(1e3), rows: external_exports.number().int().min(1).max(1e3) };
|
|
17084
|
+
var environmentName = external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(256);
|
|
17085
|
+
var environmentValue = external_exports.string().max(RUNTIME_LIMITS.environmentValueBytes).refine(
|
|
17086
|
+
(value) => !value.includes("\0") && new TextEncoder().encode(value).length <= RUNTIME_LIMITS.environmentValueBytes
|
|
17087
|
+
);
|
|
17088
|
+
var runtimeEnvDeltaSchema = external_exports.discriminatedUnion("op", [
|
|
17089
|
+
external_exports.object({ op: external_exports.literal("unset"), name: environmentName }),
|
|
17090
|
+
external_exports.object({
|
|
17091
|
+
op: external_exports.literal("set"),
|
|
17092
|
+
name: environmentName,
|
|
17093
|
+
value: environmentValue
|
|
17094
|
+
})
|
|
17095
|
+
]);
|
|
17096
|
+
var runtimeCaptureSchema = external_exports.object({
|
|
17097
|
+
enabled: external_exports.boolean(),
|
|
17098
|
+
values: external_exports.record(environmentName, environmentValue).refine((values) => Object.keys(values).length <= RUNTIME_LIMITS.environmentVariables)
|
|
17099
|
+
});
|
|
17100
|
+
var runtimeEnvironmentStateSchema = external_exports.object({
|
|
17101
|
+
enabled: external_exports.boolean(),
|
|
17102
|
+
count: external_exports.number().int().min(0).max(RUNTIME_LIMITS.environmentVariables)
|
|
17103
|
+
});
|
|
17104
|
+
var runtimeIdentitySchema = external_exports.object({
|
|
17105
|
+
runtime_id: id2,
|
|
17106
|
+
incarnation: id2,
|
|
17107
|
+
launch_id: id2,
|
|
17108
|
+
profile_id: external_exports.string().regex(/^[a-f0-9]{10}$/),
|
|
17109
|
+
project_id: external_exports.string().regex(/^[a-f0-9]{10}$/),
|
|
17110
|
+
session_id: id2,
|
|
17111
|
+
canonical_worktree_path: path
|
|
17112
|
+
});
|
|
17113
|
+
var runtimeTerminalSchema = external_exports.object({
|
|
17114
|
+
term: terminalName,
|
|
17115
|
+
generation: id2,
|
|
17116
|
+
pid: external_exports.number().int().positive().nullable(),
|
|
17117
|
+
exit_code: external_exports.number().int().nullable(),
|
|
17118
|
+
...size
|
|
17119
|
+
});
|
|
17120
|
+
var runtimeThemeSchema = external_exports.object({
|
|
17121
|
+
fg: external_exports.string().regex(/^#[0-9a-fA-F]{6}$/),
|
|
17122
|
+
bg: external_exports.string().regex(/^#[0-9a-fA-F]{6}$/)
|
|
17123
|
+
});
|
|
17124
|
+
var runtimeAttentionSchema = external_exports.object({
|
|
17125
|
+
id: id2,
|
|
17126
|
+
segment_id: id2,
|
|
17127
|
+
reason: external_exports.enum(["waiting_input", "exited"]),
|
|
17128
|
+
created_at: external_exports.iso.datetime().max(32)
|
|
17129
|
+
});
|
|
17130
|
+
var runtimeSegmentSchema = external_exports.object({
|
|
17131
|
+
id: id2,
|
|
17132
|
+
start_cursor: sequence,
|
|
17133
|
+
agent_session_ref: external_exports.string().min(1).max(200).nullable()
|
|
17134
|
+
});
|
|
17135
|
+
var runtimePlacementSchema = external_exports.object({ segment_id: id2, session_id: id2 });
|
|
17136
|
+
var runtimePlacementBindingSchema = runtimePlacementSchema.extend({ through: sequence });
|
|
17137
|
+
var runtimeCheckpointSchema = external_exports.object({
|
|
17138
|
+
format: external_exports.literal(1),
|
|
17139
|
+
identity: runtimeIdentitySchema,
|
|
17140
|
+
segment: runtimeSegmentSchema,
|
|
17141
|
+
through: sequence,
|
|
17142
|
+
terminal: runtimeTerminalSchema,
|
|
17143
|
+
data: external_exports.string().max(RUNTIME_LIMITS.frameBytes)
|
|
17144
|
+
}).refine((value) => value.through >= value.segment.start_cursor);
|
|
17145
|
+
var runtimeCommandSchema = external_exports.object({
|
|
17146
|
+
file: text.min(1).refine((value) => !value.includes("\0")),
|
|
17147
|
+
args: external_exports.array(
|
|
17148
|
+
external_exports.string().max(64 * 1024).refine((value) => !value.includes("\0"))
|
|
17149
|
+
).max(512),
|
|
17150
|
+
cwd: path,
|
|
17151
|
+
env: external_exports.record(
|
|
17152
|
+
external_exports.string().regex(/^[^=\0]+$/).max(256),
|
|
17153
|
+
external_exports.string().max(64 * 1024).refine((value) => !value.includes("\0"))
|
|
17154
|
+
).refine((value) => Object.keys(value).length <= 512, "Too many environment variables"),
|
|
17155
|
+
...size
|
|
17156
|
+
});
|
|
17157
|
+
var runtimeProviderLaunchSchema = external_exports.object({
|
|
17158
|
+
id: external_exports.string().min(1).max(64),
|
|
17159
|
+
config_dir: path,
|
|
17160
|
+
mode: external_exports.enum(["interactive", "headless"]),
|
|
17161
|
+
skip_permissions: external_exports.boolean(),
|
|
17162
|
+
prompt: external_exports.string().max(64 * 1024).optional(),
|
|
17163
|
+
resume_ref: external_exports.string().min(1).max(200).optional(),
|
|
17164
|
+
/** Exact adapter-declared id passed on a new preset-id launch, not a resume. */
|
|
17165
|
+
initial_ref: external_exports.string().min(1).max(200).optional(),
|
|
17166
|
+
/** Existing native ids before a minted-id launch; recovery must exclude them. */
|
|
17167
|
+
prior_refs: external_exports.array(external_exports.string().min(1).max(200)).max(RUNTIME_LIMITS.launchRefs).optional()
|
|
17168
|
+
}).refine(
|
|
17169
|
+
(value) => !(value.resume_ref && (value.initial_ref || value.prior_refs)),
|
|
17170
|
+
"A resume cannot carry new-launch identity evidence"
|
|
17171
|
+
);
|
|
17172
|
+
var runtimeLifecycleSchema = external_exports.object({
|
|
17173
|
+
event: external_exports.enum(["session_start", "session_end"]),
|
|
17174
|
+
agent_session_ref: external_exports.string().min(1).max(200).optional(),
|
|
17175
|
+
cwd: path,
|
|
17176
|
+
source: external_exports.enum(["startup", "resume", "clear", "fork", "compact", "exit", "other"]),
|
|
17177
|
+
parent_agent_session_ref: external_exports.string().min(1).max(200).optional(),
|
|
17178
|
+
native_title: external_exports.string().max(4096).optional(),
|
|
17179
|
+
native_created_at: external_exports.iso.datetime({ offset: true }).optional(),
|
|
17180
|
+
native_updated_at: external_exports.iso.datetime({ offset: true }).optional()
|
|
17181
|
+
}).refine(
|
|
17182
|
+
(value) => value.event !== "session_start" || value.agent_session_ref !== void 0,
|
|
17183
|
+
"A native start requires an exact conversation ref"
|
|
17184
|
+
);
|
|
17185
|
+
var runtimeAgentStateSchema = external_exports.object({
|
|
17186
|
+
provider: external_exports.string().min(1).max(64),
|
|
17187
|
+
native_sync: external_exports.enum(["full", "fallback"]),
|
|
17188
|
+
status: external_exports.enum(["starting", "running", "waiting_input", "exited"]),
|
|
17189
|
+
agent_session_ref: external_exports.string().min(1).max(200).nullable(),
|
|
17190
|
+
control_ready: external_exports.boolean(),
|
|
17191
|
+
sidecar_pids: external_exports.array(external_exports.number().int().positive()).max(32),
|
|
17192
|
+
hidden_ports: external_exports.array(external_exports.number().int().min(1).max(65535)).max(64)
|
|
17193
|
+
});
|
|
17194
|
+
var runtimeTurnSchema = external_exports.object({
|
|
17195
|
+
turn: sequence.refine((value) => value > 0),
|
|
17196
|
+
status: external_exports.enum(["running", "completed", "failed", "cancelled", "interrupted"]),
|
|
17197
|
+
/** Native identity at admission; a new headless conversation may initially have none. */
|
|
17198
|
+
expected_ref: external_exports.string().min(1).max(200).nullable()
|
|
17199
|
+
});
|
|
17200
|
+
var runtimeTurnResultSchema = runtimeTurnSchema.extend({
|
|
17201
|
+
reply: external_exports.string().max(RUNTIME_LIMITS.turnReplyBytes).refine((value) => new TextEncoder().encode(value).length <= RUNTIME_LIMITS.turnReplyBytes).optional(),
|
|
17202
|
+
error: external_exports.string().max(4096).optional()
|
|
17203
|
+
}).refine(
|
|
17204
|
+
(value) => value.status === "completed" ? value.reply !== void 0 && value.error === void 0 : value.reply === void 0 && (value.status === "running" ? value.error === void 0 : value.error !== void 0),
|
|
17205
|
+
"Turn outcome fields do not match its status"
|
|
17206
|
+
);
|
|
17207
|
+
var runtimeRetainedEventSchema = external_exports.discriminatedUnion("t", [
|
|
17208
|
+
external_exports.object({
|
|
17209
|
+
t: external_exports.literal("env-delta"),
|
|
17210
|
+
cursor: sequence,
|
|
17211
|
+
term: terminalName,
|
|
17212
|
+
generation: id2,
|
|
17213
|
+
delta: runtimeEnvDeltaSchema
|
|
17214
|
+
}),
|
|
17215
|
+
external_exports.object({
|
|
17216
|
+
t: external_exports.literal("cwd"),
|
|
17217
|
+
cursor: sequence,
|
|
17218
|
+
term: terminalName,
|
|
17219
|
+
generation: id2,
|
|
17220
|
+
cwd: path
|
|
17221
|
+
}),
|
|
17222
|
+
external_exports.object({ t: external_exports.literal("capture-env"), cursor: sequence, enabled: external_exports.boolean() }),
|
|
17223
|
+
external_exports.object({ t: external_exports.literal("clear-env"), cursor: sequence }),
|
|
17224
|
+
external_exports.object({
|
|
17225
|
+
t: external_exports.literal("turn-started"),
|
|
17226
|
+
cursor: sequence,
|
|
17227
|
+
turn: runtimeTurnSchema.extend({ status: external_exports.literal("running") })
|
|
17228
|
+
}),
|
|
17229
|
+
external_exports.object({
|
|
17230
|
+
t: external_exports.literal("turn-finished"),
|
|
17231
|
+
cursor: sequence,
|
|
17232
|
+
result: runtimeTurnResultSchema.refine(
|
|
17233
|
+
(value) => value.status !== "running",
|
|
17234
|
+
"Turn has not finished"
|
|
17235
|
+
)
|
|
17236
|
+
}),
|
|
17237
|
+
external_exports.object({
|
|
17238
|
+
t: external_exports.literal("native-lifecycle"),
|
|
17239
|
+
cursor: sequence,
|
|
17240
|
+
lifecycle: runtimeLifecycleSchema,
|
|
17241
|
+
segment: runtimeSegmentSchema,
|
|
17242
|
+
previous_segment_id: id2.nullable()
|
|
17243
|
+
}),
|
|
17244
|
+
external_exports.object({
|
|
17245
|
+
t: external_exports.literal("native-collision"),
|
|
17246
|
+
cursor: sequence,
|
|
17247
|
+
agent_session_ref: external_exports.string().min(1).max(200)
|
|
17248
|
+
}),
|
|
17249
|
+
external_exports.object({ t: external_exports.literal("terminal-created"), cursor: sequence, terminal: runtimeTerminalSchema }),
|
|
17250
|
+
external_exports.object({
|
|
17251
|
+
t: external_exports.literal("osc-title"),
|
|
17252
|
+
cursor: sequence,
|
|
17253
|
+
term: external_exports.literal("agent"),
|
|
17254
|
+
generation: id2,
|
|
17255
|
+
segment_id: id2,
|
|
17256
|
+
title: external_exports.string().min(1).max(80)
|
|
17257
|
+
}),
|
|
17258
|
+
external_exports.object({
|
|
17259
|
+
t: external_exports.literal("exit"),
|
|
17260
|
+
cursor: sequence,
|
|
17261
|
+
term: terminalName,
|
|
17262
|
+
generation: id2,
|
|
17263
|
+
exit_code: external_exports.number().int()
|
|
17264
|
+
})
|
|
17265
|
+
]);
|
|
17266
|
+
var runtimeJournalStatusSchema = external_exports.object({
|
|
17267
|
+
cursor: sequence,
|
|
17268
|
+
acknowledged: sequence,
|
|
17269
|
+
lost_through: sequence,
|
|
17270
|
+
persistence_pending: external_exports.boolean()
|
|
17271
|
+
});
|
|
17272
|
+
var runtimeEventPageSchema = external_exports.object({
|
|
17273
|
+
events: external_exports.array(runtimeRetainedEventSchema).max(RUNTIME_LIMITS.eventPage),
|
|
17274
|
+
through: sequence,
|
|
17275
|
+
more: external_exports.boolean(),
|
|
17276
|
+
gap: external_exports.boolean(),
|
|
17277
|
+
journal: runtimeJournalStatusSchema
|
|
17278
|
+
});
|
|
17279
|
+
var runtimeStateSchema = external_exports.object({
|
|
17280
|
+
identity: runtimeIdentitySchema,
|
|
17281
|
+
build: external_exports.string().min(1).max(128),
|
|
17282
|
+
/** Process-group separation does not establish survival of host session teardown. */
|
|
17283
|
+
lifetime: external_exports.enum(["service", "host_session", "unknown"]).optional(),
|
|
17284
|
+
protocol,
|
|
17285
|
+
state: external_exports.enum(["prepared", "running", "exited", "failed"]),
|
|
17286
|
+
terminals: external_exports.array(runtimeTerminalSchema).max(RUNTIME_LIMITS.terminals),
|
|
17287
|
+
event_cursor: sequence,
|
|
17288
|
+
command_cursor: sequence,
|
|
17289
|
+
persistence_pending: external_exports.boolean(),
|
|
17290
|
+
journal: runtimeJournalStatusSchema,
|
|
17291
|
+
agent: runtimeAgentStateSchema.nullable(),
|
|
17292
|
+
turn: runtimeTurnSchema.nullable(),
|
|
17293
|
+
environment: runtimeEnvironmentStateSchema,
|
|
17294
|
+
/** Omitted by older experimental owners; null means no cockpit report yet. */
|
|
17295
|
+
theme: runtimeThemeSchema.nullable().optional(),
|
|
17296
|
+
attention: runtimeAttentionSchema.nullable().optional(),
|
|
17297
|
+
/** Transient foreground hint for a terminal placement; never a native binding. */
|
|
17298
|
+
terminal_agent: external_exports.string().min(1).max(64).nullable().optional(),
|
|
17299
|
+
binding: runtimePlacementBindingSchema.nullable(),
|
|
17300
|
+
history: external_exports.object({
|
|
17301
|
+
current: runtimeSegmentSchema,
|
|
17302
|
+
pending_checkpoints: external_exports.number().int().min(0).max(RUNTIME_LIMITS.pendingCheckpoints),
|
|
17303
|
+
gap: external_exports.boolean()
|
|
17304
|
+
})
|
|
17305
|
+
});
|
|
17306
|
+
var runtimeRequestSchema = external_exports.discriminatedUnion("t", [
|
|
17307
|
+
external_exports.object({
|
|
17308
|
+
t: external_exports.literal("hello"),
|
|
17309
|
+
id: id2,
|
|
17310
|
+
protocol,
|
|
17311
|
+
runtime_id: id2,
|
|
17312
|
+
incarnation: id2,
|
|
17313
|
+
secret: external_exports.string().regex(/^[a-f0-9]{64}$/),
|
|
17314
|
+
controller_id: id2,
|
|
17315
|
+
controller_epoch: sequence
|
|
17316
|
+
}),
|
|
17317
|
+
external_exports.object({ t: external_exports.literal("inspect"), id: id2, sequence }),
|
|
17318
|
+
external_exports.object({
|
|
17319
|
+
t: external_exports.literal("attention-preview"),
|
|
17320
|
+
id: id2,
|
|
17321
|
+
sequence,
|
|
17322
|
+
placement: runtimePlacementSchema,
|
|
17323
|
+
attention_id: id2
|
|
17324
|
+
}),
|
|
17325
|
+
external_exports.object({
|
|
17326
|
+
t: external_exports.literal("theme"),
|
|
17327
|
+
id: id2,
|
|
17328
|
+
sequence,
|
|
17329
|
+
placement: runtimePlacementSchema,
|
|
17330
|
+
colours: runtimeThemeSchema
|
|
17331
|
+
}),
|
|
17332
|
+
external_exports.object({
|
|
17333
|
+
t: external_exports.literal("bind-placement"),
|
|
17334
|
+
id: id2,
|
|
17335
|
+
sequence,
|
|
17336
|
+
binding: runtimePlacementBindingSchema
|
|
17337
|
+
}),
|
|
17338
|
+
external_exports.object({
|
|
17339
|
+
t: external_exports.literal("capture-env"),
|
|
17340
|
+
id: id2,
|
|
17341
|
+
sequence,
|
|
17342
|
+
placement: runtimePlacementSchema,
|
|
17343
|
+
enabled: external_exports.boolean()
|
|
17344
|
+
}),
|
|
17345
|
+
external_exports.object({ t: external_exports.literal("clear-env"), id: id2, sequence, placement: runtimePlacementSchema }),
|
|
17346
|
+
external_exports.object({ t: external_exports.literal("events"), id: id2, sequence, after: sequence }),
|
|
17347
|
+
external_exports.object({ t: external_exports.literal("ack-events"), id: id2, sequence, through: sequence }),
|
|
17348
|
+
external_exports.object({
|
|
17349
|
+
t: external_exports.literal("start-turn"),
|
|
17350
|
+
id: id2,
|
|
17351
|
+
sequence,
|
|
17352
|
+
placement: runtimePlacementSchema,
|
|
17353
|
+
turn: runtimeTurnSchema.shape.turn,
|
|
17354
|
+
expected_ref: runtimeTurnSchema.shape.expected_ref,
|
|
17355
|
+
prompt: external_exports.string().min(1).max(RUNTIME_LIMITS.turnPromptBytes).refine((value) => new TextEncoder().encode(value).length <= RUNTIME_LIMITS.turnPromptBytes),
|
|
17356
|
+
output_schema: external_exports.record(external_exports.string().max(256), external_exports.unknown()).refine(
|
|
17357
|
+
(value) => new TextEncoder().encode(JSON.stringify(value)).length <= 64 * 1024,
|
|
17358
|
+
"Output schema exceeds its byte limit"
|
|
17359
|
+
).optional()
|
|
17360
|
+
}),
|
|
17361
|
+
external_exports.object({ t: external_exports.literal("turn-result"), id: id2, sequence, turn: runtimeTurnSchema.shape.turn }),
|
|
17362
|
+
external_exports.object({
|
|
17363
|
+
t: external_exports.literal("cancel-turn"),
|
|
17364
|
+
id: id2,
|
|
17365
|
+
sequence,
|
|
17366
|
+
placement: runtimePlacementSchema,
|
|
17367
|
+
turn: runtimeTurnSchema.shape.turn
|
|
17368
|
+
}),
|
|
17369
|
+
external_exports.object({ t: external_exports.literal("snapshot"), id: id2, sequence, term: terminalName, generation: id2 }),
|
|
17370
|
+
external_exports.object({
|
|
17371
|
+
t: external_exports.literal("segment-snapshot"),
|
|
17372
|
+
id: id2,
|
|
17373
|
+
sequence,
|
|
17374
|
+
segment_id: id2,
|
|
17375
|
+
term: terminalName,
|
|
17376
|
+
generation: id2
|
|
17377
|
+
}),
|
|
17378
|
+
external_exports.object({
|
|
17379
|
+
t: external_exports.literal("input"),
|
|
17380
|
+
id: id2,
|
|
17381
|
+
sequence,
|
|
17382
|
+
placement: runtimePlacementSchema,
|
|
17383
|
+
term: terminalName,
|
|
17384
|
+
generation: id2,
|
|
17385
|
+
data: external_exports.string().max(RUNTIME_LIMITS.inputBytes),
|
|
17386
|
+
source: external_exports.enum(["human", "script"])
|
|
17387
|
+
}),
|
|
17388
|
+
external_exports.object({
|
|
17389
|
+
t: external_exports.literal("resize"),
|
|
17390
|
+
id: id2,
|
|
17391
|
+
sequence,
|
|
17392
|
+
placement: runtimePlacementSchema,
|
|
17393
|
+
term: terminalName,
|
|
17394
|
+
generation: id2,
|
|
17395
|
+
...size
|
|
17396
|
+
}),
|
|
17397
|
+
external_exports.object({
|
|
17398
|
+
t: external_exports.literal("spawn-shell"),
|
|
17399
|
+
id: id2,
|
|
17400
|
+
sequence,
|
|
17401
|
+
placement: runtimePlacementSchema,
|
|
17402
|
+
term: terminalName.refine((value) => value !== "agent"),
|
|
17403
|
+
command: runtimeCommandSchema
|
|
17404
|
+
}),
|
|
17405
|
+
external_exports.object({
|
|
17406
|
+
t: external_exports.literal("kill-terminal"),
|
|
17407
|
+
id: id2,
|
|
17408
|
+
sequence,
|
|
17409
|
+
placement: runtimePlacementSchema,
|
|
17410
|
+
term: terminalName,
|
|
17411
|
+
generation: id2
|
|
17412
|
+
}),
|
|
17413
|
+
external_exports.object({ t: external_exports.literal("stop"), id: id2, sequence, placement: runtimePlacementSchema })
|
|
17414
|
+
]);
|
|
17415
|
+
var runtimeResponseSchema = external_exports.discriminatedUnion("t", [
|
|
17416
|
+
external_exports.object({ t: external_exports.literal("attention-preview"), id: id2, attention_id: id2, text: external_exports.string().max(4096) }),
|
|
17417
|
+
external_exports.object({ t: external_exports.literal("state"), id: id2, state: runtimeStateSchema }),
|
|
17418
|
+
external_exports.object({ t: external_exports.literal("ok"), id: id2 }),
|
|
17419
|
+
external_exports.object({
|
|
17420
|
+
t: external_exports.literal("env-cleared"),
|
|
17421
|
+
id: id2,
|
|
17422
|
+
through: sequence,
|
|
17423
|
+
cleared: external_exports.number().int().min(0).max(RUNTIME_LIMITS.environmentVariables)
|
|
17424
|
+
}),
|
|
17425
|
+
external_exports.object({ t: external_exports.literal("events"), id: id2, page: runtimeEventPageSchema }),
|
|
17426
|
+
external_exports.object({ t: external_exports.literal("turn"), id: id2, result: runtimeTurnResultSchema }),
|
|
17427
|
+
external_exports.object({ t: external_exports.literal("segment-snapshot"), id: id2, checkpoint: runtimeCheckpointSchema }),
|
|
17428
|
+
external_exports.object({
|
|
17429
|
+
t: external_exports.literal("snapshot"),
|
|
17430
|
+
id: id2,
|
|
17431
|
+
term: terminalName,
|
|
17432
|
+
generation: id2,
|
|
17433
|
+
cursor: sequence,
|
|
17434
|
+
segment_id: id2,
|
|
17435
|
+
data: external_exports.string().max(RUNTIME_LIMITS.frameBytes)
|
|
17436
|
+
}),
|
|
17437
|
+
external_exports.object({
|
|
17438
|
+
t: external_exports.literal("error"),
|
|
17439
|
+
id: id2,
|
|
17440
|
+
code: external_exports.enum([
|
|
17441
|
+
"invalid_request",
|
|
17442
|
+
"incompatible",
|
|
17443
|
+
"unauthorised",
|
|
17444
|
+
"fenced",
|
|
17445
|
+
"busy",
|
|
17446
|
+
"stale_terminal",
|
|
17447
|
+
"stale_placement",
|
|
17448
|
+
"duplicate_request",
|
|
17449
|
+
"result_unavailable",
|
|
17450
|
+
"failed"
|
|
17451
|
+
]),
|
|
17452
|
+
message: external_exports.string().max(1024)
|
|
17453
|
+
})
|
|
17454
|
+
]);
|
|
17455
|
+
var runtimeEventSchema = external_exports.discriminatedUnion("t", [
|
|
17456
|
+
...runtimeRetainedEventSchema.options,
|
|
17457
|
+
external_exports.object({
|
|
17458
|
+
t: external_exports.literal("terminal-agent-state"),
|
|
17459
|
+
cursor: sequence,
|
|
17460
|
+
agent: external_exports.string().min(1).max(64).nullable()
|
|
17461
|
+
}),
|
|
17462
|
+
external_exports.object({
|
|
17463
|
+
t: external_exports.literal("attention-state"),
|
|
17464
|
+
cursor: sequence,
|
|
17465
|
+
attention: runtimeAttentionSchema.nullable()
|
|
17466
|
+
}),
|
|
17467
|
+
external_exports.object({ t: external_exports.literal("agent-state"), cursor: sequence, agent: runtimeAgentStateSchema }),
|
|
17468
|
+
external_exports.object({
|
|
17469
|
+
t: external_exports.literal("output"),
|
|
17470
|
+
cursor: sequence,
|
|
17471
|
+
term: terminalName,
|
|
17472
|
+
generation: id2,
|
|
17473
|
+
segment_id: id2,
|
|
17474
|
+
data: external_exports.string().max(RUNTIME_LIMITS.outputBytes)
|
|
17475
|
+
})
|
|
17476
|
+
]);
|
|
17477
|
+
var runtimeMessageSchema = external_exports.union([runtimeResponseSchema, runtimeEventSchema]);
|
|
17478
|
+
var messageTypes = /* @__PURE__ */ new Set([
|
|
17479
|
+
...runtimeResponseSchema.options.map((schema) => schema.shape.t.value),
|
|
17480
|
+
...runtimeEventSchema.options.map((schema) => schema.shape.t.value)
|
|
17481
|
+
]);
|
|
17482
|
+
var messageEnvelope = external_exports.object({ t: external_exports.string().min(1).max(64) });
|
|
17483
|
+
|
|
17484
|
+
// ../shared/src/api/agents/runtime.ts
|
|
17485
|
+
var software = external_exports.object({
|
|
17486
|
+
version: external_exports.string().min(1).max(128),
|
|
17487
|
+
protocol: hostStageRecordSchema.shape.protocol
|
|
17488
|
+
}).strict();
|
|
17489
|
+
var sessionRuntimeInspectionSchema = external_exports.object({
|
|
17490
|
+
runtime: software.extend({
|
|
17491
|
+
id: external_exports.uuid(),
|
|
17492
|
+
connected: external_exports.boolean(),
|
|
17493
|
+
lifetime: external_exports.enum(["service", "host_session", "unknown"]).optional(),
|
|
17494
|
+
terminals: external_exports.array(external_exports.object({ term: runtimeTerminalSchema.shape.term }).strict()).max(RUNTIME_LIMITS.terminals).nullable()
|
|
17495
|
+
}).strict().nullable(),
|
|
17496
|
+
installed: software.nullable(),
|
|
17497
|
+
restart: external_exports.discriminatedUnion("available", [
|
|
17498
|
+
external_exports.object({ available: external_exports.literal(true), fingerprint: external_exports.string().regex(/^[0-9a-f]{64}$/) }).strict(),
|
|
17499
|
+
external_exports.object({
|
|
17500
|
+
available: external_exports.literal(false),
|
|
17501
|
+
reason: external_exports.enum([
|
|
17502
|
+
"no_live_runtime",
|
|
17503
|
+
"runtime_unavailable",
|
|
17504
|
+
"runtime_changed",
|
|
17505
|
+
"release_unavailable",
|
|
17506
|
+
"conversation_unknown",
|
|
17507
|
+
"resume_unsupported",
|
|
17508
|
+
"worktree_missing",
|
|
17509
|
+
"state_not_saved"
|
|
17510
|
+
])
|
|
17511
|
+
}).strict()
|
|
17512
|
+
])
|
|
17513
|
+
}).strict();
|
|
17514
|
+
var restartSessionRuntimeRequestSchema = external_exports.object({
|
|
17515
|
+
fingerprint: external_exports.string().regex(/^[0-9a-f]{64}$/)
|
|
17516
|
+
}).strict();
|
|
17517
|
+
|
|
17518
|
+
// ../shared/src/runtime/storage.ts
|
|
17519
|
+
var runtimeAssetsSchema = external_exports.object({
|
|
17520
|
+
format: external_exports.literal(1),
|
|
17521
|
+
node_path: external_exports.string().max(4096).refine((value) => value.startsWith("/") && !value.includes("\0")),
|
|
17522
|
+
files: external_exports.record(external_exports.string().regex(/^[a-z0-9][a-z0-9-]*\.(mjs|js)$/), external_exports.string().regex(/^[a-f0-9]{64}$/)).refine((value) => Object.keys(value).length <= 16)
|
|
17523
|
+
});
|
|
17524
|
+
var runtimeJournalSchema = external_exports.object({
|
|
17525
|
+
format: external_exports.literal(1),
|
|
17526
|
+
identity: runtimeIdentitySchema,
|
|
17527
|
+
cursor: runtimeJournalStatusSchema.shape.cursor,
|
|
17528
|
+
acknowledged: runtimeJournalStatusSchema.shape.acknowledged,
|
|
17529
|
+
lost_through: runtimeJournalStatusSchema.shape.lost_through,
|
|
17530
|
+
events: external_exports.array(runtimeRetainedEventSchema).max(RUNTIME_LIMITS.journalEvents)
|
|
17531
|
+
}).superRefine((record2, ctx) => {
|
|
17532
|
+
let previous = record2.acknowledged;
|
|
17533
|
+
if (record2.acknowledged > record2.cursor || record2.lost_through > record2.cursor)
|
|
17534
|
+
ctx.addIssue({ code: "custom", message: "Journal cursor exceeds its head" });
|
|
17535
|
+
for (const event of record2.events) {
|
|
17536
|
+
if (event.cursor <= previous || event.cursor > record2.cursor)
|
|
17537
|
+
ctx.addIssue({ code: "custom", message: "Journal events must be strictly ordered" });
|
|
17538
|
+
previous = event.cursor;
|
|
17539
|
+
}
|
|
17540
|
+
});
|
|
17541
|
+
var runtimeLaunchSchema = external_exports.object({
|
|
17542
|
+
format: external_exports.literal(1),
|
|
17543
|
+
identity: runtimeIdentitySchema,
|
|
17544
|
+
secret: external_exports.string().regex(/^[a-f0-9]{64}$/),
|
|
17545
|
+
/** A queued launch must never execute on a later host boot. */
|
|
17546
|
+
boot_id: external_exports.uuid().optional(),
|
|
17547
|
+
lifetime: external_exports.enum(["service", "host_session"]).optional(),
|
|
17548
|
+
main: runtimeCommandSchema,
|
|
17549
|
+
/** Daemon launch environment, below captured values and command-specific overrides. */
|
|
17550
|
+
environment: runtimeCommandSchema.shape.env.optional(),
|
|
17551
|
+
/** Absence is supported only for older experimental launch records. */
|
|
17552
|
+
shell_hooks: external_exports.literal(true).optional(),
|
|
17553
|
+
provider: runtimeProviderLaunchSchema.optional(),
|
|
17554
|
+
capture_env: runtimeCaptureSchema.optional(),
|
|
17555
|
+
theme: runtimeThemeSchema.optional()
|
|
17556
|
+
});
|
|
17557
|
+
var runtimeRetiredSchema = external_exports.object({
|
|
17558
|
+
format: external_exports.literal(1),
|
|
17559
|
+
identity: runtimeIdentitySchema
|
|
17560
|
+
});
|
|
17561
|
+
var runtimeControllerSchema = external_exports.object({
|
|
17562
|
+
format: external_exports.literal(1),
|
|
17563
|
+
id: external_exports.uuid(),
|
|
17564
|
+
epoch: external_exports.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
17565
|
+
active: external_exports.boolean()
|
|
17566
|
+
});
|
|
17567
|
+
var runtimeSupervisorSchema = external_exports.object({
|
|
17568
|
+
format: external_exports.literal(1),
|
|
17569
|
+
identity: runtimeIdentitySchema,
|
|
17570
|
+
kind: external_exports.enum(["systemd", "launchd", "detached"]),
|
|
17571
|
+
name: external_exports.string().regex(
|
|
17572
|
+
/^(puddler-[a-f0-9]{8}-[a-f0-9-]{36}\.(service|process)|dev\.puddle\.runtime\.[a-f0-9]{8}\.[a-f0-9-]{36})$/
|
|
17573
|
+
),
|
|
17574
|
+
domain: external_exports.string().regex(/^gui\/[0-9]+$/).nullable(),
|
|
17575
|
+
node_path: external_exports.string().max(4096),
|
|
17576
|
+
entry_path: external_exports.string().max(4096),
|
|
17577
|
+
state: external_exports.enum(["dispatching", "dispatched", "removed"])
|
|
17578
|
+
});
|
|
17579
|
+
|
|
17580
|
+
// ../shared/src/installation/collection.ts
|
|
17581
|
+
var HOST_RELEASE_COLLECTION_LIMIT = 32;
|
|
17582
|
+
var HOST_RELEASE_COLLECTION_BYTES = 64 * 1024;
|
|
17583
|
+
var hostReleaseCollectionSchema = external_exports.object({
|
|
17584
|
+
format: external_exports.literal(1),
|
|
17585
|
+
id: external_exports.uuid(),
|
|
17586
|
+
home: external_exports.string().min(1).max(4096),
|
|
17587
|
+
fingerprint: external_exports.string().regex(/^[a-f0-9]{64}$/),
|
|
17588
|
+
releases: external_exports.array(
|
|
17589
|
+
external_exports.object({
|
|
17590
|
+
generation: hostStageRecordSchema.shape.generation,
|
|
17591
|
+
device: external_exports.number().int().nonnegative().safe(),
|
|
17592
|
+
inode: external_exports.number().int().nonnegative().safe(),
|
|
17593
|
+
receipt: external_exports.string().regex(/^[a-f0-9]{64}$/),
|
|
17594
|
+
publishedAt: external_exports.number().nonnegative()
|
|
17595
|
+
}).strict()
|
|
17596
|
+
).min(1).max(HOST_RELEASE_COLLECTION_LIMIT),
|
|
17597
|
+
actions: external_exports.array(
|
|
17598
|
+
external_exports.object({
|
|
17599
|
+
action: hostStageRecordSchema.shape.generation,
|
|
17600
|
+
state: external_exports.enum(["planned", "started", "finished"])
|
|
17601
|
+
}).strict()
|
|
17602
|
+
).min(1).max(HOST_RELEASE_COLLECTION_LIMIT)
|
|
17603
|
+
}).strict().superRefine((record2, context) => {
|
|
17604
|
+
const generations = record2.releases.map(({ generation }) => generation);
|
|
17605
|
+
if (new Set(generations).size !== generations.length || JSON.stringify(generations) !== JSON.stringify(record2.actions.map(({ action }) => action)))
|
|
17606
|
+
context.addIssue({
|
|
17607
|
+
code: "custom",
|
|
17608
|
+
message: "Collection actions do not match the accepted releases"
|
|
17609
|
+
});
|
|
17610
|
+
let unfinished = false;
|
|
17611
|
+
for (const { state } of record2.actions) {
|
|
17612
|
+
if (unfinished && state !== "planned")
|
|
17613
|
+
context.addIssue({ code: "custom", message: "Collection actions are not a serial prefix" });
|
|
17614
|
+
if (state !== "finished") unfinished = true;
|
|
17615
|
+
}
|
|
17616
|
+
});
|
|
17617
|
+
|
|
17618
|
+
// ../shared/src/installation/supervision.ts
|
|
17619
|
+
var hostServiceReplacementSchema = external_exports.object({
|
|
17620
|
+
kind: external_exports.enum(["systemd", "launchd"]),
|
|
17621
|
+
component: external_exports.enum(["daemon", "connector"]).optional(),
|
|
17622
|
+
name: external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$/),
|
|
17623
|
+
domain: external_exports.string().regex(/^gui\/\d+$/).nullable(),
|
|
17624
|
+
pid: external_exports.number().int().positive().safe(),
|
|
17625
|
+
invocation: external_exports.string().regex(/^[0-9a-f]{32}$/).nullable(),
|
|
17626
|
+
controlGroup: external_exports.string().min(1).max(4096).nullable(),
|
|
17627
|
+
definition_path: external_exports.string().min(1).max(4096).nullable(),
|
|
17628
|
+
definition_digest: external_exports.string().regex(/^[0-9a-f]{64}$/)
|
|
17629
|
+
}).strict().refine(
|
|
17630
|
+
(service2) => service2.kind === "systemd" ? service2.name.endsWith(".service") && service2.domain === null && service2.invocation !== null && service2.controlGroup !== null && service2.definition_path === null : service2.domain !== null && service2.invocation === null && service2.controlGroup === null && service2.definition_path !== null,
|
|
17631
|
+
"Inconsistent service replacement evidence"
|
|
17632
|
+
);
|
|
17633
|
+
|
|
17634
|
+
// ../shared/src/installation/connector.ts
|
|
17635
|
+
var hostConnectorReplacementSchema = external_exports.discriminatedUnion("state", [
|
|
17636
|
+
external_exports.object({ state: external_exports.literal("absent") }).strict(),
|
|
17637
|
+
external_exports.object({
|
|
17638
|
+
state: external_exports.literal("running"),
|
|
17639
|
+
identity: connectorInspectionResponseSchema.omit({ t: true, nonce: true }).extend({
|
|
17640
|
+
ready: external_exports.literal(true)
|
|
17641
|
+
}),
|
|
17642
|
+
service: hostServiceReplacementSchema.refine((service2) => service2.component === "connector")
|
|
17643
|
+
}).strict().refine(
|
|
17644
|
+
(value) => value.identity.pid === value.service.pid,
|
|
17645
|
+
"Connector service PID does not match its process"
|
|
17646
|
+
)
|
|
17647
|
+
]);
|
|
17648
|
+
|
|
17649
|
+
// ../shared/src/installation/worker.ts
|
|
17650
|
+
var hostUpdateWorkerSchema = external_exports.object({
|
|
17651
|
+
format: external_exports.literal(1),
|
|
17652
|
+
operation_id: external_exports.uuid(),
|
|
17653
|
+
dispatch_id: external_exports.uuid(),
|
|
17654
|
+
dispatch_revision: external_exports.number().int().positive().safe(),
|
|
17655
|
+
preflight: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
17656
|
+
kind: external_exports.enum(["systemd", "launchd"]),
|
|
17657
|
+
name: external_exports.string().min(1).max(128),
|
|
17658
|
+
domain: external_exports.string().regex(/^gui\/\d+$/).nullable(),
|
|
17659
|
+
release_path: external_exports.string().min(1).max(4096),
|
|
17660
|
+
node_path: external_exports.string().min(1).max(4096),
|
|
17661
|
+
entry_path: external_exports.string().min(1).max(4096),
|
|
17662
|
+
installer_path: external_exports.string().min(1).max(4096),
|
|
17663
|
+
state: external_exports.enum(["dispatching", "dispatched"]),
|
|
17664
|
+
daemon_service: hostServiceReplacementSchema.optional(),
|
|
17665
|
+
connector: hostConnectorReplacementSchema.optional(),
|
|
17666
|
+
/** Explicit consent, bound to the same release and impact as preflight. */
|
|
17667
|
+
interruption_approval: external_exports.string().regex(/^[0-9a-f]{64}$/).optional(),
|
|
17668
|
+
/** Only this outgoing daemon may publish the worker's shutdown checkpoint. */
|
|
17669
|
+
outgoing: external_exports.object({
|
|
17670
|
+
pid: external_exports.number().int().positive().safe(),
|
|
17671
|
+
controller: runtimeControllerSchema.pick({ id: true, epoch: true }).strict()
|
|
17672
|
+
}).strict().optional()
|
|
17673
|
+
}).strict().refine(
|
|
17674
|
+
(record2) => !record2.interruption_approval || !!record2.outgoing && !!record2.daemon_service && record2.interruption_approval === record2.preflight,
|
|
17675
|
+
"Interruption approval does not match the daemon update"
|
|
17676
|
+
);
|
|
17677
|
+
var hostUpdateWorkerLifetimeSchema = external_exports.object({
|
|
17678
|
+
format: external_exports.literal(1),
|
|
17679
|
+
operation_id: external_exports.uuid(),
|
|
17680
|
+
dispatch_id: external_exports.uuid(),
|
|
17681
|
+
worker_id: external_exports.uuid(),
|
|
17682
|
+
preflight: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
17683
|
+
/** The worker must lead this group; its commands are never detached from it. */
|
|
17684
|
+
process_group: external_exports.number().int().positive().max(2 ** 31 - 1)
|
|
17685
|
+
}).strict();
|
|
17686
|
+
|
|
17687
|
+
// ../shared/src/installation/actions.ts
|
|
17688
|
+
var hostUpdateActionSchema = external_exports.enum([
|
|
17689
|
+
"stop-connector",
|
|
17690
|
+
"stop-daemon",
|
|
17691
|
+
"select-daemon",
|
|
17692
|
+
"select-runtime",
|
|
17693
|
+
"start-daemon",
|
|
17694
|
+
"start-connector"
|
|
17695
|
+
]);
|
|
17696
|
+
var hostUpdateActionsSchema = external_exports.object({
|
|
17697
|
+
format: external_exports.literal(1),
|
|
17698
|
+
operation_id: external_exports.uuid(),
|
|
17699
|
+
dispatch_id: external_exports.uuid(),
|
|
17700
|
+
worker_id: external_exports.uuid(),
|
|
17701
|
+
preflight: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
17702
|
+
actions: external_exports.array(
|
|
17703
|
+
external_exports.object({
|
|
17704
|
+
action: hostUpdateActionSchema,
|
|
17705
|
+
state: external_exports.enum(["planned", "started", "finished"])
|
|
17706
|
+
}).strict()
|
|
17707
|
+
).min(1).max(6)
|
|
17708
|
+
}).strict().superRefine((record2, context) => {
|
|
17709
|
+
const names = record2.actions.map(({ action }) => action);
|
|
17710
|
+
if (new Set(names).size !== names.length)
|
|
17711
|
+
context.addIssue({ code: "custom", message: "Duplicate update action" });
|
|
17712
|
+
let unfinished = false;
|
|
17713
|
+
for (const { state } of record2.actions) {
|
|
17714
|
+
if (unfinished && state !== "planned")
|
|
17715
|
+
context.addIssue({ code: "custom", message: "Update actions are not a serial prefix" });
|
|
17716
|
+
if (state !== "finished") unfinished = true;
|
|
17717
|
+
}
|
|
17718
|
+
});
|
|
17719
|
+
|
|
17720
|
+
// ../shared/src/installation/checkpoint.ts
|
|
17721
|
+
var HOST_UPDATE_CHECKPOINT_OWNERS = 4096;
|
|
17722
|
+
var HOST_UPDATE_CHECKPOINT_BYTES = 8 * 1024 * 1024;
|
|
17723
|
+
var hostUpdateCheckpointReferenceSchema = external_exports.object({
|
|
17724
|
+
operation_id: external_exports.uuid(),
|
|
17725
|
+
dispatch_id: external_exports.uuid(),
|
|
17726
|
+
preflight: external_exports.string().regex(/^[0-9a-f]{64}$/)
|
|
17727
|
+
}).strict();
|
|
17728
|
+
var hostUpdateCheckpointSchema = hostUpdateCheckpointReferenceSchema.extend({
|
|
17729
|
+
format: external_exports.literal(1),
|
|
17730
|
+
captured_at: external_exports.number().int().nonnegative().safe(),
|
|
17731
|
+
daemon: external_exports.object({
|
|
17732
|
+
pid: external_exports.number().int().positive().safe(),
|
|
17733
|
+
version: external_exports.string().min(1).max(128),
|
|
17734
|
+
controller: runtimeControllerSchema.pick({ id: true, epoch: true }).strip(),
|
|
17735
|
+
schema_version: external_exports.number().int().nonnegative().safe()
|
|
17736
|
+
}).strip(),
|
|
17737
|
+
owners: external_exports.array(
|
|
17738
|
+
external_exports.object({
|
|
17739
|
+
identity: runtimeIdentitySchema.strip(),
|
|
17740
|
+
build: runtimeStateSchema.shape.build,
|
|
17741
|
+
protocol: runtimeStateSchema.shape.protocol,
|
|
17742
|
+
release_path: runtimeIdentitySchema.shape.canonical_worktree_path,
|
|
17743
|
+
launch_fingerprint: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
17744
|
+
event_cursor: external_exports.number().int().min(-1).safe(),
|
|
17745
|
+
state: external_exports.enum(["prepared", "running", "exited", "failed", "interrupted"])
|
|
17746
|
+
}).strip()
|
|
17747
|
+
).max(HOST_UPDATE_CHECKPOINT_OWNERS)
|
|
17748
|
+
}).strip().refine(
|
|
17749
|
+
(record2) => new Set(record2.owners.map((owner) => owner.identity.runtime_id)).size === record2.owners.length,
|
|
17750
|
+
"Duplicate checkpoint owner"
|
|
17751
|
+
);
|
|
17752
|
+
|
|
17753
|
+
// ../shared/src/installation/recovery.ts
|
|
17754
|
+
var fingerprint4 = external_exports.string().regex(/^[0-9a-f]{64}$/);
|
|
17755
|
+
var revision = external_exports.number().int().positive().safe();
|
|
17756
|
+
var hostUpdateRecoveryJobSchema = external_exports.object({
|
|
17757
|
+
format: external_exports.literal(1),
|
|
17758
|
+
id: external_exports.uuid(),
|
|
17759
|
+
operation_id: external_exports.uuid(),
|
|
17760
|
+
requested_revision: revision,
|
|
17761
|
+
revision,
|
|
17762
|
+
original_dispatch_id: external_exports.uuid(),
|
|
17763
|
+
original_worker_id: external_exports.uuid(),
|
|
17764
|
+
preflight: fingerprint4,
|
|
17765
|
+
original_worker_digest: fingerprint4,
|
|
17766
|
+
actions_digest: fingerprint4,
|
|
17767
|
+
/** New explicit connector start after confirmed loss, bound to its selected service/build. */
|
|
17768
|
+
connector_restart: fingerprint4.optional(),
|
|
17769
|
+
/** Explicit fresh attempt after confirmed daemon loss, bound to current storage and ownership. */
|
|
17770
|
+
daemon_restart: external_exports.object({
|
|
17771
|
+
fingerprint: fingerprint4,
|
|
17772
|
+
database_schema_version: hostUpdateCheckpointSchema.shape.daemon.shape.schema_version,
|
|
17773
|
+
owners: hostUpdateCheckpointSchema.shape.owners
|
|
17774
|
+
}).strict().refine(
|
|
17775
|
+
(record2) => new Set(record2.owners.map(({ identity }) => identity.runtime_id)).size === record2.owners.length,
|
|
17776
|
+
"Duplicate restart runtime"
|
|
17777
|
+
).optional(),
|
|
17778
|
+
service: external_exports.object(hostUpdateWorkerSchema.shape).pick({
|
|
17779
|
+
kind: true,
|
|
17780
|
+
name: true,
|
|
17781
|
+
domain: true,
|
|
17782
|
+
release_path: true,
|
|
17783
|
+
node_path: true,
|
|
17784
|
+
entry_path: true,
|
|
17785
|
+
installer_path: true
|
|
17786
|
+
}).strict()
|
|
17787
|
+
}).strict().refine(
|
|
17788
|
+
(job) => job.revision === job.requested_revision + 1,
|
|
17789
|
+
"Recovery dispatch must fence its requested revision"
|
|
17790
|
+
);
|
|
17791
|
+
var hostUpdateRecoveryAttemptSchema = external_exports.object({
|
|
17792
|
+
job: hostUpdateRecoveryJobSchema,
|
|
17793
|
+
/** Written before any component mutation, while the recovery worker holds execution. */
|
|
17794
|
+
execution: external_exports.object({
|
|
17795
|
+
id: external_exports.uuid(),
|
|
17796
|
+
process_group: hostUpdateWorkerLifetimeSchema.shape.process_group
|
|
17797
|
+
}).strict().nullable()
|
|
17798
|
+
}).strict();
|
|
17799
|
+
var HOST_UPDATE_RECOVERY_ATTEMPTS = 8;
|
|
17800
|
+
var HOST_UPDATE_RECOVERY_BYTES = 256 * 1024;
|
|
17801
|
+
var hostUpdateRecoveryLedgerSchema = external_exports.object({
|
|
17802
|
+
format: external_exports.literal(1),
|
|
17803
|
+
attempts: external_exports.array(hostUpdateRecoveryAttemptSchema).max(HOST_UPDATE_RECOVERY_ATTEMPTS)
|
|
17804
|
+
}).strict().superRefine(({ attempts }, context) => {
|
|
17805
|
+
const ids = /* @__PURE__ */ new Set();
|
|
17806
|
+
let previous = 0;
|
|
17807
|
+
for (const { job } of attempts) {
|
|
17808
|
+
if (ids.has(job.id) || job.requested_revision < previous)
|
|
17809
|
+
context.addIssue({
|
|
17810
|
+
code: "custom",
|
|
17811
|
+
message: "Recovery attempts must have unique identities and ordered revisions"
|
|
17812
|
+
});
|
|
17813
|
+
ids.add(job.id);
|
|
17814
|
+
previous = job.revision;
|
|
17815
|
+
}
|
|
17816
|
+
});
|
|
17817
|
+
|
|
17818
|
+
// ../shared/src/installation/adoption.ts
|
|
17819
|
+
var hostUpdateAdoptionSchema = hostUpdateCheckpointReferenceSchema.extend({
|
|
17820
|
+
format: external_exports.literal(1),
|
|
17821
|
+
nonce: external_exports.uuid(),
|
|
17822
|
+
checkpoint: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
17823
|
+
stage: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
17824
|
+
observed_at: external_exports.number().int().nonnegative().safe(),
|
|
17825
|
+
daemon: hostUpdateCheckpointSchema.shape.daemon.extend({
|
|
17826
|
+
port: external_exports.number().int().min(1).max(65535),
|
|
17827
|
+
protocol: hostStageRecordSchema.shape.protocol,
|
|
17828
|
+
release_path: external_exports.string().min(1).max(4096),
|
|
17829
|
+
node_path: external_exports.string().min(1).max(4096),
|
|
17830
|
+
entry_path: external_exports.string().min(1).max(4096),
|
|
17831
|
+
controller: hostUpdateCheckpointSchema.shape.daemon.shape.controller.strip()
|
|
17832
|
+
}).strip(),
|
|
17833
|
+
owners: external_exports.array(
|
|
17834
|
+
external_exports.object({
|
|
17835
|
+
runtime_id: external_exports.uuid(),
|
|
17836
|
+
event_cursor: external_exports.number().int().nonnegative().safe(),
|
|
17837
|
+
state: external_exports.enum(["running", "exited", "failed"])
|
|
17838
|
+
}).strip()
|
|
17839
|
+
).max(HOST_UPDATE_CHECKPOINT_OWNERS)
|
|
17840
|
+
}).strip().refine(
|
|
17841
|
+
(record2) => new Set(record2.owners.map((owner) => owner.runtime_id)).size === record2.owners.length,
|
|
17842
|
+
"Duplicate adopted owner"
|
|
17843
|
+
);
|
|
17844
|
+
|
|
17845
|
+
// ../shared/src/installation/capabilities.ts
|
|
17846
|
+
var SUPPORTED_RUNTIME_MAJORS = [RUNTIME_PROTOCOL_VERSION.major];
|
|
17847
|
+
var hostReleaseCapabilitiesSchema = external_exports.object({
|
|
17848
|
+
format: external_exports.literal(1),
|
|
17849
|
+
version: external_exports.string().min(1).max(128),
|
|
17850
|
+
application: hostStageRecordSchema.shape.protocol,
|
|
17851
|
+
remote: external_exports.number().int().nonnegative().safe(),
|
|
17852
|
+
runtime: hostStageRecordSchema.shape.protocol,
|
|
17853
|
+
supported_runtime_majors: external_exports.array(external_exports.number().int().nonnegative().safe()).min(1).max(16).refine((values) => new Set(values).size === values.length),
|
|
17854
|
+
/** Existing SQLite migration ceiling, not another protocol or rollback permission. */
|
|
17855
|
+
database_schema_version: external_exports.number().int().nonnegative().max(2 ** 31 - 1).optional()
|
|
17856
|
+
}).strict();
|
|
17857
|
+
|
|
17858
|
+
// ../shared/src/installation/removal/services.ts
|
|
17859
|
+
var service = hostServiceReplacementSchema.shape;
|
|
17860
|
+
var target = external_exports.object({ kind: service.kind, name: service.name, domain: service.domain }).strict();
|
|
17861
|
+
var process3 = target.extend({
|
|
17862
|
+
pid: service.pid,
|
|
17863
|
+
invocation: service.invocation,
|
|
17864
|
+
controlGroup: service.controlGroup
|
|
17865
|
+
});
|
|
17866
|
+
var hostRemovalServiceReviewSchema = external_exports.object({
|
|
17867
|
+
target,
|
|
17868
|
+
component: external_exports.enum(["daemon", "connector"]),
|
|
17869
|
+
definition: external_exports.string().min(1).max(4096),
|
|
17870
|
+
sourceDigest: service.definition_digest,
|
|
17871
|
+
definitionDigest: service.definition_digest,
|
|
17872
|
+
process: process3.nullable()
|
|
17873
|
+
}).strict().superRefine((review, context) => {
|
|
17874
|
+
const observed = review.process;
|
|
17875
|
+
const expected = review.target;
|
|
17876
|
+
if ((expected.kind === "systemd" ? expected.domain !== null || !expected.name.endsWith(".service") : expected.domain === null) || observed && (observed.kind !== expected.kind || observed.name !== expected.name || observed.domain !== expected.domain || (observed.kind === "systemd" ? observed.invocation === null || observed.controlGroup === null : observed.invocation !== null || observed.controlGroup !== null)))
|
|
17877
|
+
context.addIssue({ code: "custom", message: "Inconsistent removal service evidence" });
|
|
17878
|
+
});
|
|
17879
|
+
var hostRemovalServiceActionSchema = external_exports.enum([
|
|
17880
|
+
"disable-remote",
|
|
17881
|
+
"stop-connector",
|
|
17882
|
+
"stop-daemon",
|
|
17883
|
+
"unregister-connector",
|
|
17884
|
+
"unregister-daemon",
|
|
17885
|
+
"unregister-disable-connector",
|
|
17886
|
+
"unregister-disable-daemon",
|
|
17887
|
+
"unregister-reset-connector",
|
|
17888
|
+
"unregister-reset-daemon",
|
|
17889
|
+
"unregister-delete-connector",
|
|
17890
|
+
"unregister-delete-daemon",
|
|
17891
|
+
"unregister-reload-connector",
|
|
17892
|
+
"unregister-reload-daemon"
|
|
17893
|
+
]);
|
|
17894
|
+
function hostRemovalUnregisterPlan(review) {
|
|
17895
|
+
const component2 = review.component;
|
|
17896
|
+
return review.target.kind === "systemd" ? [
|
|
17897
|
+
`unregister-disable-${component2}`,
|
|
17898
|
+
`unregister-reset-${component2}`,
|
|
17899
|
+
`unregister-delete-${component2}`,
|
|
17900
|
+
`unregister-reload-${component2}`
|
|
17901
|
+
] : [`unregister-delete-${component2}`];
|
|
17902
|
+
}
|
|
17903
|
+
var hostRemovalServicesSchema = external_exports.object({
|
|
17904
|
+
format: external_exports.literal(1),
|
|
17905
|
+
id: external_exports.uuid(),
|
|
17906
|
+
release_path: external_exports.string().min(1).max(4096),
|
|
17907
|
+
services: external_exports.array(
|
|
17908
|
+
external_exports.object({
|
|
17909
|
+
review: hostRemovalServiceReviewSchema,
|
|
17910
|
+
// The original may contain environment values. Keep it only in private host storage.
|
|
17911
|
+
source: external_exports.string().min(1).max(87384)
|
|
17912
|
+
}).strict()
|
|
17913
|
+
).min(1).max(2),
|
|
17914
|
+
actions: external_exports.array(
|
|
17915
|
+
external_exports.object({
|
|
17916
|
+
action: hostRemovalServiceActionSchema,
|
|
17917
|
+
state: external_exports.enum(["planned", "started", "finished"])
|
|
17918
|
+
}).strict()
|
|
17919
|
+
).min(2).max(11)
|
|
17920
|
+
}).strict().superRefine((record2, context) => {
|
|
17921
|
+
const components = record2.services.map(({ review }) => review.component);
|
|
17922
|
+
const ordered = ["connector", "daemon"].filter(
|
|
17923
|
+
(component2) => components.includes(component2)
|
|
17924
|
+
);
|
|
17925
|
+
const plan = [
|
|
17926
|
+
...record2.actions[0]?.action === "disable-remote" ? ["disable-remote"] : [],
|
|
17927
|
+
...ordered.map((component2) => `stop-${component2}`),
|
|
17928
|
+
...ordered.flatMap(
|
|
17929
|
+
(component2) => record2.actions.some(({ action }) => action === "unregister-daemon") ? [`unregister-${component2}`] : hostRemovalUnregisterPlan(
|
|
17930
|
+
record2.services.find(({ review }) => review.component === component2).review
|
|
17931
|
+
)
|
|
17932
|
+
)
|
|
17933
|
+
];
|
|
17934
|
+
if (new Set(components).size !== components.length || !components.includes("daemon") || JSON.stringify(record2.actions.map(({ action }) => action)) !== JSON.stringify(plan))
|
|
17935
|
+
context.addIssue({
|
|
17936
|
+
code: "custom",
|
|
17937
|
+
message: "Removal service plan does not match its inventory"
|
|
17938
|
+
});
|
|
17939
|
+
let unfinished = false;
|
|
17940
|
+
for (const { state } of record2.actions) {
|
|
17941
|
+
if (unfinished && state !== "planned")
|
|
17942
|
+
context.addIssue({ code: "custom", message: "Removal actions are not a serial prefix" });
|
|
17943
|
+
if (state !== "finished") unfinished = true;
|
|
17944
|
+
}
|
|
17945
|
+
});
|
|
17946
|
+
var HOST_REMOVAL_SERVICES_BYTES = 256 * 1024;
|
|
17947
|
+
|
|
17948
|
+
// ../shared/src/installation/removal/restore.ts
|
|
17949
|
+
var hostRemovalRestoreActionSchema = external_exports.enum([
|
|
17950
|
+
"restore-connector",
|
|
17951
|
+
"restore-daemon",
|
|
17952
|
+
"reload-services",
|
|
17953
|
+
"enable-connector",
|
|
17954
|
+
"enable-daemon",
|
|
17955
|
+
"restore-supervisor"
|
|
17956
|
+
]);
|
|
17957
|
+
var hostRemovalRestoreSchema = external_exports.object({
|
|
17958
|
+
format: external_exports.literal(1),
|
|
17959
|
+
removal_id: external_exports.uuid(),
|
|
17960
|
+
removal_digest: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
17961
|
+
/** Exact completed purge proof; absent on historical ordinary restoration journals. */
|
|
17962
|
+
purge_digest: external_exports.string().regex(/^[0-9a-f]{64}$/).optional(),
|
|
17963
|
+
actions: external_exports.array(
|
|
17964
|
+
external_exports.object({
|
|
17965
|
+
action: hostRemovalRestoreActionSchema,
|
|
17966
|
+
state: external_exports.enum(["planned", "started", "finished"])
|
|
17967
|
+
}).strict()
|
|
17968
|
+
).min(1).max(6)
|
|
17969
|
+
}).strict().superRefine((record2, context) => {
|
|
17970
|
+
if (Boolean(record2.purge_digest) !== record2.actions.some(({ action }) => action === "restore-supervisor"))
|
|
17971
|
+
context.addIssue({
|
|
17972
|
+
code: "custom",
|
|
17973
|
+
message: "Supervisor restoration requires completed purge evidence"
|
|
17974
|
+
});
|
|
17975
|
+
if (new Set(record2.actions.map(({ action }) => action)).size !== record2.actions.length)
|
|
17976
|
+
context.addIssue({ code: "custom", message: "Duplicate restoration action" });
|
|
17977
|
+
let unfinished = false;
|
|
17978
|
+
for (const { state } of record2.actions) {
|
|
17979
|
+
if (unfinished && state !== "planned")
|
|
17980
|
+
context.addIssue({
|
|
17981
|
+
code: "custom",
|
|
17982
|
+
message: "Restoration actions are not a serial prefix"
|
|
17983
|
+
});
|
|
17984
|
+
if (state !== "finished") unfinished = true;
|
|
17985
|
+
}
|
|
17986
|
+
});
|
|
17987
|
+
|
|
17988
|
+
// ../shared/src/installation/removal/status.ts
|
|
17989
|
+
var hostRemovalStatusSchema = external_exports.discriminatedUnion("state", [
|
|
17990
|
+
external_exports.object({ state: external_exports.literal("none") }).strict(),
|
|
17991
|
+
external_exports.object({
|
|
17992
|
+
state: external_exports.enum(["removing", "removed", "restoring", "restored"]),
|
|
17993
|
+
id: external_exports.uuid()
|
|
17994
|
+
}).strict()
|
|
17995
|
+
]);
|
|
17996
|
+
|
|
17997
|
+
// ../shared/src/installation/removal/runtime.ts
|
|
17998
|
+
var HOST_REMOVAL_RUNTIME_LIMIT = 1024;
|
|
17999
|
+
var fingerprint5 = external_exports.string().regex(/^[0-9a-f]{64}$/);
|
|
18000
|
+
var hostRemovalRuntimeReviewSchema = external_exports.object({
|
|
18001
|
+
id: external_exports.uuid(),
|
|
18002
|
+
fingerprint: fingerprint5,
|
|
18003
|
+
owners: external_exports.array(
|
|
18004
|
+
external_exports.object({
|
|
18005
|
+
id: external_exports.uuid(),
|
|
18006
|
+
session: external_exports.string().min(1).max(128),
|
|
18007
|
+
version: external_exports.string().min(1).max(128),
|
|
18008
|
+
terminals: external_exports.number().int().nonnegative().max(1024).nullable(),
|
|
18009
|
+
stop_blocker: external_exports.enum(["unavailable", "unsaved", "stop_pending"]).nullable()
|
|
18010
|
+
}).strict()
|
|
18011
|
+
).max(HOST_REMOVAL_RUNTIME_LIMIT)
|
|
18012
|
+
}).strict();
|
|
18013
|
+
var hostRemovalFinishSchema = external_exports.object({
|
|
18014
|
+
id: external_exports.uuid(),
|
|
18015
|
+
fingerprint: fingerprint5,
|
|
18016
|
+
attempt_id: external_exports.uuid(),
|
|
18017
|
+
disposition: external_exports.enum(["retain", "stop"])
|
|
18018
|
+
}).strict();
|
|
18019
|
+
|
|
18020
|
+
// ../shared/src/installation/removal/purge.ts
|
|
18021
|
+
var fingerprint6 = external_exports.string().regex(/^[a-f0-9]{64}$/);
|
|
18022
|
+
var HOST_PURGE_RECORD_BYTES = 4 * 1024 * 1024;
|
|
18023
|
+
var HOST_PURGE_ANCHORS = [
|
|
18024
|
+
"bin",
|
|
18025
|
+
"installation",
|
|
18026
|
+
"runtime-claims",
|
|
18027
|
+
"runtime-controller.json",
|
|
18028
|
+
"updates"
|
|
18029
|
+
];
|
|
18030
|
+
var root = external_exports.object({
|
|
18031
|
+
name: external_exports.string().min(1).max(255).refine(
|
|
18032
|
+
(name) => name !== "." && name !== ".." && !/[\\/\0]/.test(name) && !HOST_PURGE_ANCHORS.some((anchor) => anchor === name)
|
|
18033
|
+
),
|
|
18034
|
+
device: external_exports.number().int().nonnegative(),
|
|
18035
|
+
inode: external_exports.number().int().positive(),
|
|
18036
|
+
kind: external_exports.enum(["directory", "file", "symlink"]),
|
|
18037
|
+
state: external_exports.enum(["planned", "detached", "deleted"])
|
|
18038
|
+
}).strict();
|
|
18039
|
+
var worktree = external_exports.object({
|
|
18040
|
+
path: external_exports.string().min(1).max(4096),
|
|
18041
|
+
dirty: external_exports.boolean(),
|
|
18042
|
+
local_only: external_exports.boolean()
|
|
18043
|
+
}).strict();
|
|
18044
|
+
var hostPurgeRecordSchema = external_exports.object({
|
|
18045
|
+
format: external_exports.literal(1),
|
|
18046
|
+
id: external_exports.uuid(),
|
|
18047
|
+
boot_id: external_exports.uuid(),
|
|
18048
|
+
removal_digest: fingerprint6,
|
|
18049
|
+
phase: external_exports.enum(["waiting", "deleting", "complete"]),
|
|
18050
|
+
fingerprint: fingerprint6.nullable(),
|
|
18051
|
+
worktree_fingerprint: fingerprint6.nullable(),
|
|
18052
|
+
roots: external_exports.array(root).max(512),
|
|
18053
|
+
worktrees: external_exports.array(worktree).max(4096),
|
|
18054
|
+
attempt_id: external_exports.uuid().nullable()
|
|
18055
|
+
}).strict().superRefine((record2, context) => {
|
|
18056
|
+
if (new Set(record2.roots.map((root2) => root2.name)).size !== record2.roots.length || record2.phase === "waiting" && (record2.attempt_id !== null || record2.roots.some((root2) => root2.state !== "planned")) || record2.phase !== "waiting" && (!record2.fingerprint || !record2.worktree_fingerprint || !record2.attempt_id) || record2.phase === "complete" && record2.roots.some((root2) => root2.state !== "deleted") || record2.fingerprint === null !== (record2.worktree_fingerprint === null))
|
|
18057
|
+
context.addIssue({ code: "custom", message: "Inconsistent purge progress evidence" });
|
|
18058
|
+
});
|
|
18059
|
+
var hostPurgeReviewSchema = external_exports.object({
|
|
18060
|
+
id: external_exports.uuid(),
|
|
18061
|
+
phase: external_exports.enum(["reboot_required", "ready", "deleting", "complete"]),
|
|
18062
|
+
fingerprint: fingerprint6.nullable(),
|
|
18063
|
+
worktrees: external_exports.array(worktree).max(4096),
|
|
18064
|
+
attempt_id: external_exports.uuid().nullable()
|
|
18065
|
+
}).strict();
|
|
18066
|
+
var hostPurgeApplySchema = external_exports.object({
|
|
18067
|
+
id: external_exports.uuid(),
|
|
18068
|
+
fingerprint: fingerprint6,
|
|
18069
|
+
attempt_id: external_exports.uuid()
|
|
18070
|
+
}).strict();
|
|
18071
|
+
|
|
18072
|
+
// ../shared/src/node/control/update-authority.ts
|
|
18073
|
+
var HostUpdateOnlyScope = class {
|
|
18074
|
+
outgoing;
|
|
18075
|
+
targetVersion;
|
|
18076
|
+
target = null;
|
|
18077
|
+
operation = null;
|
|
18078
|
+
begun = false;
|
|
18079
|
+
observing = false;
|
|
18080
|
+
adopted = false;
|
|
18081
|
+
constructor(input) {
|
|
18082
|
+
const outgoing = versionResponseSchema.parse(input.outgoing);
|
|
18083
|
+
const { major, minor } = outgoing.protocol;
|
|
18084
|
+
if (major >= PROTOCOL_VERSION.major || major < 25 || major === 25 && minor < 7 || !parseHostReleaseVersion(input.targetVersion))
|
|
18085
|
+
throw new Error("Host update migration requires a supported older host and exact target");
|
|
18086
|
+
this.outgoing = { version: outgoing.version, protocol: { ...outgoing.protocol } };
|
|
18087
|
+
this.targetVersion = input.targetVersion;
|
|
18088
|
+
}
|
|
18089
|
+
accepts(peer) {
|
|
18090
|
+
const matches = (expected) => peer.version === expected.version && peer.protocol.major === expected.protocol.major && peer.protocol.minor === expected.protocol.minor;
|
|
18091
|
+
if (this.target && this.observing && matches(this.target)) {
|
|
18092
|
+
this.adopted = true;
|
|
18093
|
+
return true;
|
|
18094
|
+
}
|
|
18095
|
+
return !this.adopted && matches(this.outgoing);
|
|
18096
|
+
}
|
|
18097
|
+
before(command) {
|
|
18098
|
+
if (command.action === "status") {
|
|
18099
|
+
if (command.id && this.operation && command.id !== this.operation)
|
|
18100
|
+
throw new Error("Host update migration is bound to another operation");
|
|
18101
|
+
return;
|
|
18102
|
+
}
|
|
18103
|
+
if (this.observing) throw new Error("Accepted host update migration is observation-only");
|
|
18104
|
+
if (command.action === "begin") {
|
|
18105
|
+
if (this.begun || command.targets.length !== 1 || command.targets[0]?.component !== "daemon" || command.targets[0].version !== this.targetVersion)
|
|
18106
|
+
throw new Error("Host update migration requires one exact daemon target without replay");
|
|
18107
|
+
this.begun = true;
|
|
18108
|
+
return;
|
|
18109
|
+
}
|
|
18110
|
+
if (!this.operation || command.reference.id !== this.operation || !["stage", "inspect", "apply", "cancel"].includes(command.action))
|
|
18111
|
+
throw new Error("Host update migration is bound to another operation or action");
|
|
18112
|
+
if (command.action === "stage" && (command.receipt.record.component !== "daemon" || command.receipt.record.version !== this.targetVersion))
|
|
18113
|
+
throw new Error("Host update migration stage changed its target");
|
|
18114
|
+
if (command.action === "apply") {
|
|
18115
|
+
if (!this.target) throw new Error("Host update migration has no verified staged target");
|
|
18116
|
+
this.observing = true;
|
|
18117
|
+
}
|
|
18118
|
+
}
|
|
18119
|
+
observed(reply) {
|
|
18120
|
+
const operation2 = reply.operation;
|
|
18121
|
+
if (!operation2) return;
|
|
18122
|
+
if (this.operation && operation2.id !== this.operation || operation2.targets.length !== 1 || operation2.targets[0]?.component !== "daemon" || operation2.targets[0].version !== this.targetVersion)
|
|
18123
|
+
throw new Error("Host update migration response changed its operation or target");
|
|
18124
|
+
this.operation = operation2.id;
|
|
18125
|
+
const stage = operation2.stages.find(({ record: record2 }) => record2.component === "daemon");
|
|
18126
|
+
if (stage) {
|
|
18127
|
+
if (stage.record.version !== this.targetVersion)
|
|
18128
|
+
throw new Error("Staged daemon version changed its target");
|
|
18129
|
+
if (stage.record.protocol.major !== PROTOCOL_VERSION.major)
|
|
18130
|
+
throw new Error("Staged daemon is incompatible with the requesting client");
|
|
18131
|
+
const target2 = { version: stage.record.version, protocol: { ...stage.record.protocol } };
|
|
18132
|
+
if (this.target && (target2.version !== this.target.version || target2.protocol.major !== this.target.protocol.major || target2.protocol.minor !== this.target.protocol.minor))
|
|
18133
|
+
throw new Error("Staged daemon identity changed");
|
|
18134
|
+
this.target = target2;
|
|
18135
|
+
}
|
|
18136
|
+
if (operation2.dispatch_id) this.observing = true;
|
|
18137
|
+
}
|
|
18138
|
+
};
|
|
18139
|
+
|
|
16584
18140
|
// ../shared/src/node/security.ts
|
|
16585
18141
|
import { createHash, randomBytes } from "node:crypto";
|
|
16586
18142
|
import {
|
|
@@ -16594,6 +18150,7 @@ import {
|
|
|
16594
18150
|
mkdirSync,
|
|
16595
18151
|
openSync,
|
|
16596
18152
|
readFileSync,
|
|
18153
|
+
readSync,
|
|
16597
18154
|
realpathSync,
|
|
16598
18155
|
renameSync,
|
|
16599
18156
|
rmSync,
|
|
@@ -16602,36 +18159,36 @@ import {
|
|
|
16602
18159
|
import { dirname, join, resolve } from "node:path";
|
|
16603
18160
|
var digest = (value) => createHash("sha256").update(value).digest("hex");
|
|
16604
18161
|
var secret = (prefix = "") => prefix + randomBytes(32).toString("hex");
|
|
16605
|
-
function privatePath(
|
|
16606
|
-
const st = lstatSync(
|
|
18162
|
+
function privatePath(path2, directory = false) {
|
|
18163
|
+
const st = lstatSync(path2);
|
|
16607
18164
|
if (st.isSymbolicLink() || (directory ? !st.isDirectory() : !st.isFile() && !st.isSocket()) || process.getuid && st.uid !== process.getuid() || process.platform !== "win32" && (st.mode & 63) !== 0) {
|
|
16608
18165
|
throw new Error("Puddle authority storage must be private and owned by the current user");
|
|
16609
18166
|
}
|
|
16610
18167
|
}
|
|
16611
|
-
function privateDirectory(
|
|
16612
|
-
mkdirSync(
|
|
16613
|
-
privatePath(
|
|
18168
|
+
function privateDirectory(path2) {
|
|
18169
|
+
mkdirSync(path2, { recursive: true, mode: 448 });
|
|
18170
|
+
privatePath(path2, true);
|
|
16614
18171
|
}
|
|
16615
18172
|
function initialisePrivateHome(home) {
|
|
16616
|
-
const
|
|
16617
|
-
mkdirSync(
|
|
18173
|
+
const path2 = resolve(home);
|
|
18174
|
+
mkdirSync(path2, { recursive: true, mode: 448 });
|
|
16618
18175
|
if (process.platform === "win32") {
|
|
16619
|
-
privatePath(
|
|
18176
|
+
privatePath(path2, true);
|
|
16620
18177
|
return;
|
|
16621
18178
|
}
|
|
16622
|
-
const fd = openSync(
|
|
18179
|
+
const fd = openSync(path2, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW);
|
|
16623
18180
|
try {
|
|
16624
18181
|
const st = fstatSync(fd);
|
|
16625
18182
|
if (!st.isDirectory() || st.uid !== process.getuid() || (st.mode & 18) !== 0) {
|
|
16626
18183
|
throw new Error(
|
|
16627
|
-
`Puddle home must be owned by the current user and not writable by other users: ${
|
|
18184
|
+
`Puddle home must be owned by the current user and not writable by other users: ${path2}`
|
|
16628
18185
|
);
|
|
16629
18186
|
}
|
|
16630
18187
|
if ((st.mode & 63) !== 0) fchmodSync(fd, 448);
|
|
16631
18188
|
} finally {
|
|
16632
18189
|
closeSync(fd);
|
|
16633
18190
|
}
|
|
16634
|
-
privatePath(
|
|
18191
|
+
privatePath(path2, true);
|
|
16635
18192
|
}
|
|
16636
18193
|
function ipcPath(home, scope) {
|
|
16637
18194
|
initialisePrivateHome(home);
|
|
@@ -16641,13 +18198,15 @@ function ipcPath(home, scope) {
|
|
|
16641
18198
|
privateDirectory(dir);
|
|
16642
18199
|
return join(dir, "control.sock");
|
|
16643
18200
|
}
|
|
16644
|
-
function jsonLines(stream, receive, fail) {
|
|
18201
|
+
function jsonLines(stream, receive, fail, maxBytes = CONTROL_MAX_BYTES) {
|
|
18202
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1 || maxBytes > CONTROL_MAX_BYTES)
|
|
18203
|
+
throw new Error("Invalid private message bound");
|
|
16645
18204
|
let buffer = "";
|
|
16646
18205
|
let failed = false;
|
|
16647
18206
|
const onData = (chunk) => {
|
|
16648
18207
|
if (failed) return;
|
|
16649
18208
|
buffer += chunk.toString();
|
|
16650
|
-
if (Buffer.byteLength(buffer) >
|
|
18209
|
+
if (Buffer.byteLength(buffer) > maxBytes) {
|
|
16651
18210
|
failed = true;
|
|
16652
18211
|
fail();
|
|
16653
18212
|
return;
|
|
@@ -16669,13 +18228,108 @@ function jsonLines(stream, receive, fail) {
|
|
|
16669
18228
|
return () => stream.off("data", onData);
|
|
16670
18229
|
}
|
|
16671
18230
|
|
|
18231
|
+
// ../shared/src/node/installation/boot.ts
|
|
18232
|
+
import { execFile } from "node:child_process";
|
|
18233
|
+
import { promisify } from "node:util";
|
|
18234
|
+
var execute = promisify(execFile);
|
|
18235
|
+
|
|
18236
|
+
// ../shared/src/node/releases/github.ts
|
|
18237
|
+
var assetSchema = external_exports.object({
|
|
18238
|
+
name: external_exports.string().min(1).max(256),
|
|
18239
|
+
browser_download_url: external_exports.string().max(2048).url().refine((value) => value.startsWith("https://"))
|
|
18240
|
+
});
|
|
18241
|
+
var releaseSchema = external_exports.object({
|
|
18242
|
+
tag_name: external_exports.string().max(129).regex(/^v?[0-9]+\.[0-9]+\.[0-9]+$/),
|
|
18243
|
+
draft: external_exports.literal(false).optional(),
|
|
18244
|
+
prerelease: external_exports.literal(false).optional(),
|
|
18245
|
+
assets: external_exports.array(assetSchema).max(1024).default([])
|
|
18246
|
+
});
|
|
18247
|
+
|
|
18248
|
+
// ../shared/src/node/control/requests.ts
|
|
18249
|
+
import { randomUUID } from "node:crypto";
|
|
18250
|
+
var HOST_CONTROL_REQUEST_LIMITS = {
|
|
18251
|
+
pending: 4,
|
|
18252
|
+
issued: 1024,
|
|
18253
|
+
timeoutMs: 12e4
|
|
18254
|
+
};
|
|
18255
|
+
var HostControlRequests = class {
|
|
18256
|
+
constructor(channel, options) {
|
|
18257
|
+
this.channel = channel;
|
|
18258
|
+
this.options = options;
|
|
18259
|
+
}
|
|
18260
|
+
pending = /* @__PURE__ */ new Map();
|
|
18261
|
+
expired = /* @__PURE__ */ new Set();
|
|
18262
|
+
issued = 0;
|
|
18263
|
+
closed = false;
|
|
18264
|
+
request(input) {
|
|
18265
|
+
const command = this.options.parse(input);
|
|
18266
|
+
if (this.closed || this.channel.destroyed)
|
|
18267
|
+
return Promise.reject(new Error("Host control is unavailable"));
|
|
18268
|
+
if (this.pending.size >= HOST_CONTROL_REQUEST_LIMITS.pending || this.issued >= HOST_CONTROL_REQUEST_LIMITS.issued)
|
|
18269
|
+
return Promise.reject(new Error("Host update control limit reached"));
|
|
18270
|
+
const request_id = randomUUID();
|
|
18271
|
+
const frame = JSON.stringify({ t: this.options.type, request_id, command }) + "\n";
|
|
18272
|
+
if (Buffer.byteLength(frame) > CONTROL_MAX_BYTES)
|
|
18273
|
+
return Promise.reject(new Error("Host control request exceeds its limit"));
|
|
18274
|
+
this.issued++;
|
|
18275
|
+
return new Promise((resolve2, reject) => {
|
|
18276
|
+
const timer = setTimeout(() => {
|
|
18277
|
+
this.pending.delete(request_id);
|
|
18278
|
+
this.expired.add(request_id);
|
|
18279
|
+
reject(new Error("Host update response timed out; inspect the operation before retrying"));
|
|
18280
|
+
}, this.options.timeoutMs ?? HOST_CONTROL_REQUEST_LIMITS.timeoutMs);
|
|
18281
|
+
timer.unref();
|
|
18282
|
+
this.pending.set(request_id, { resolve: resolve2, reject, timer });
|
|
18283
|
+
try {
|
|
18284
|
+
this.channel.write(frame);
|
|
18285
|
+
} catch {
|
|
18286
|
+
this.close();
|
|
18287
|
+
this.channel.destroy();
|
|
18288
|
+
}
|
|
18289
|
+
});
|
|
18290
|
+
}
|
|
18291
|
+
receive(message) {
|
|
18292
|
+
const pending = this.pending.get(message.request_id);
|
|
18293
|
+
if (!pending) return this.expired.delete(message.request_id);
|
|
18294
|
+
this.pending.delete(message.request_id);
|
|
18295
|
+
clearTimeout(pending.timer);
|
|
18296
|
+
pending.resolve(message.result);
|
|
18297
|
+
return true;
|
|
18298
|
+
}
|
|
18299
|
+
close() {
|
|
18300
|
+
this.closed = true;
|
|
18301
|
+
for (const pending of this.pending.values()) {
|
|
18302
|
+
clearTimeout(pending.timer);
|
|
18303
|
+
pending.reject(new Error("Host control was lost; inspect the operation before retrying"));
|
|
18304
|
+
}
|
|
18305
|
+
this.pending.clear();
|
|
18306
|
+
this.expired.clear();
|
|
18307
|
+
}
|
|
18308
|
+
};
|
|
18309
|
+
|
|
18310
|
+
// ../shared/src/node/control/updates.ts
|
|
18311
|
+
var HostUpdateRequests = class extends HostControlRequests {
|
|
18312
|
+
constructor(channel) {
|
|
18313
|
+
super(channel, { type: "host-update", parse: hostUpdateCommandSchema.parse });
|
|
18314
|
+
}
|
|
18315
|
+
};
|
|
18316
|
+
|
|
16672
18317
|
// ../shared/src/node/host-control.ts
|
|
16673
18318
|
var HostControlClient = class {
|
|
16674
|
-
constructor(openChannel, automatic = true, error51 = (_code, message) => new Error(message), profile) {
|
|
18319
|
+
constructor(openChannel, automatic = true, error51 = (_code, message) => new Error(message), profile, maintenance, updateScope) {
|
|
16675
18320
|
this.openChannel = openChannel;
|
|
16676
18321
|
this.automatic = automatic;
|
|
16677
18322
|
this.error = error51;
|
|
16678
18323
|
this.profile = profile;
|
|
18324
|
+
this.maintenance = maintenance;
|
|
18325
|
+
if (updateScope && (profile || maintenance))
|
|
18326
|
+
throw new Error("Host update migration cannot carry profile or remote authority");
|
|
18327
|
+
this.updateOnly = updateScope ? new HostUpdateOnlyScope(updateScope) : null;
|
|
18328
|
+
if (maintenance) {
|
|
18329
|
+
if (!profile) throw new Error("Remote maintenance requires a profile");
|
|
18330
|
+
this.maintenance = remoteMaintenanceClaimSchema.parse(maintenance);
|
|
18331
|
+
this.automatic = false;
|
|
18332
|
+
}
|
|
16679
18333
|
this.timer = setInterval(() => {
|
|
16680
18334
|
if (this.channel && performance.now() >= this.until)
|
|
16681
18335
|
this.lose(this.channel, "upstream_expired");
|
|
@@ -16703,6 +18357,9 @@ var HostControlClient = class {
|
|
|
16703
18357
|
listeners = /* @__PURE__ */ new Set();
|
|
16704
18358
|
timer;
|
|
16705
18359
|
verifier = null;
|
|
18360
|
+
updates = null;
|
|
18361
|
+
maintenanceRequests = null;
|
|
18362
|
+
updateOnly;
|
|
16706
18363
|
renewControl = null;
|
|
16707
18364
|
setTransportAvailable(available) {
|
|
16708
18365
|
if (!available && this.channel) this.lose(this.channel);
|
|
@@ -16711,25 +18368,71 @@ var HostControlClient = class {
|
|
|
16711
18368
|
}
|
|
16712
18369
|
/** Run after every replacement control generation before reopening the gateway. */
|
|
16713
18370
|
setVerifier(verifier) {
|
|
18371
|
+
if (this.updateOnly)
|
|
18372
|
+
throw new Error("Host update migration cannot open an application gateway");
|
|
16714
18373
|
this.verifier = verifier;
|
|
16715
18374
|
}
|
|
16716
18375
|
credential() {
|
|
18376
|
+
if (this.updateOnly) throw new Error("Host update migration has no application credential");
|
|
16717
18377
|
if (!this.token || performance.now() >= this.until)
|
|
16718
18378
|
throw this.error("daemon_unreachable", "connection authority is unavailable");
|
|
16719
18379
|
return this.token;
|
|
16720
18380
|
}
|
|
18381
|
+
/** Private local/SSH maintenance; renewal remains independently client-participating. */
|
|
18382
|
+
hostUpdate(command) {
|
|
18383
|
+
const protocol2 = this.version?.protocol;
|
|
18384
|
+
if (this.profile || !protocol2 || protocol2.major < 25 || protocol2.major === 25 && protocol2.minor < 7)
|
|
18385
|
+
return Promise.reject(new Error("Host updates are unavailable on this connection"));
|
|
18386
|
+
if (command.action === "status" && command.include_catalogue && protocol2.major === 25 && protocol2.minor < 14)
|
|
18387
|
+
return Promise.reject(new Error("Host update catalogue is unavailable on this connection"));
|
|
18388
|
+
if (command.action === "status" && command.adoption_nonce && protocol2.major === 25 && protocol2.minor < 8)
|
|
18389
|
+
return Promise.reject(
|
|
18390
|
+
new Error("Host adoption inspection is unavailable on this connection")
|
|
18391
|
+
);
|
|
18392
|
+
if (command.action === "apply" && command.interruption_approval && protocol2.major === 25 && protocol2.minor < 10)
|
|
18393
|
+
return Promise.reject(
|
|
18394
|
+
new Error("Host interruption approval is unavailable on this connection")
|
|
18395
|
+
);
|
|
18396
|
+
if (command.action === "recover" && protocol2.major === 25 && protocol2.minor < 11)
|
|
18397
|
+
return Promise.reject(
|
|
18398
|
+
new Error("Host recovery verification is unavailable on this connection")
|
|
18399
|
+
);
|
|
18400
|
+
if ((command.action === "recover" && command.strategy === "continue" || command.action === "status" && command.include_recovery) && protocol2.major === 25 && protocol2.minor < 12)
|
|
18401
|
+
return Promise.reject(
|
|
18402
|
+
new Error("Host update continuation is unavailable on this connection")
|
|
18403
|
+
);
|
|
18404
|
+
if (this.state !== "ready" || !this.updates)
|
|
18405
|
+
return Promise.reject(new Error("Host control is unavailable"));
|
|
18406
|
+
try {
|
|
18407
|
+
this.updateOnly?.before(command);
|
|
18408
|
+
} catch (error51) {
|
|
18409
|
+
return Promise.reject(error51);
|
|
18410
|
+
}
|
|
18411
|
+
return this.updates.request(command).then((reply) => {
|
|
18412
|
+
this.updateOnly?.observed(reply);
|
|
18413
|
+
return reply;
|
|
18414
|
+
});
|
|
18415
|
+
}
|
|
18416
|
+
/** A separate manually participating profile channel; never grants host-wide update access. */
|
|
18417
|
+
hostMaintenance(command) {
|
|
18418
|
+
if (!this.profile || !this.maintenance || !this.version || this.version.protocol.major < 26)
|
|
18419
|
+
return Promise.reject(new Error("Host maintenance is unavailable on this connection"));
|
|
18420
|
+
if (this.state !== "ready" || !this.maintenanceRequests)
|
|
18421
|
+
return Promise.reject(new Error("Host control is unavailable"));
|
|
18422
|
+
return this.maintenanceRequests.request(command);
|
|
18423
|
+
}
|
|
16721
18424
|
resource(close) {
|
|
16722
18425
|
this.credential();
|
|
16723
18426
|
const generation = this.generation;
|
|
16724
|
-
const
|
|
16725
|
-
this.resources.set(
|
|
18427
|
+
const id3 = secret();
|
|
18428
|
+
this.resources.set(id3, close);
|
|
16726
18429
|
return {
|
|
16727
|
-
id:
|
|
18430
|
+
id: id3,
|
|
16728
18431
|
release: () => {
|
|
16729
|
-
this.resources.delete(
|
|
18432
|
+
this.resources.delete(id3);
|
|
16730
18433
|
},
|
|
16731
18434
|
valid: () => {
|
|
16732
|
-
const valid = this.generation === generation && this.resources.has(
|
|
18435
|
+
const valid = this.generation === generation && this.resources.has(id3) && performance.now() < this.until;
|
|
16733
18436
|
if (!valid) close();
|
|
16734
18437
|
return valid;
|
|
16735
18438
|
}
|
|
@@ -16749,6 +18452,17 @@ var HostControlClient = class {
|
|
|
16749
18452
|
return;
|
|
16750
18453
|
}
|
|
16751
18454
|
this.channel = channel;
|
|
18455
|
+
const updates = new HostUpdateRequests(channel);
|
|
18456
|
+
this.updates = updates;
|
|
18457
|
+
const maintenance = new HostControlRequests(
|
|
18458
|
+
channel,
|
|
18459
|
+
{
|
|
18460
|
+
type: "host-maintenance",
|
|
18461
|
+
parse: hostMaintenanceCommandSchema.parse,
|
|
18462
|
+
timeoutMs: REMOTE_POLICY.maintenanceRequestMs
|
|
18463
|
+
}
|
|
18464
|
+
);
|
|
18465
|
+
this.maintenanceRequests = maintenance;
|
|
16752
18466
|
this.until = performance.now() + CONNECTION_POLICY.leaseMs;
|
|
16753
18467
|
await new Promise((resolve2, reject) => {
|
|
16754
18468
|
let pendingAt = null;
|
|
@@ -16760,7 +18474,7 @@ var HostControlClient = class {
|
|
|
16760
18474
|
this.renewControl = (resources, sentAt) => {
|
|
16761
18475
|
if (pendingAt !== null || this.channel !== channel || this.state !== "ready")
|
|
16762
18476
|
return false;
|
|
16763
|
-
if (resources.some((
|
|
18477
|
+
if (resources.some((id3) => !this.resources.has(id3))) return false;
|
|
16764
18478
|
send({ t: "renew", resources }, sentAt);
|
|
16765
18479
|
return true;
|
|
16766
18480
|
};
|
|
@@ -16771,21 +18485,31 @@ var HostControlClient = class {
|
|
|
16771
18485
|
const stop = jsonLines(
|
|
16772
18486
|
channel,
|
|
16773
18487
|
(value) => {
|
|
16774
|
-
if (this.channel !== channel
|
|
18488
|
+
if (this.channel !== channel) return channel.destroy();
|
|
16775
18489
|
const message = controlResponseSchema.parse(value);
|
|
18490
|
+
if (message.t === "host-update-result") {
|
|
18491
|
+
if (!updates.receive(message)) channel.destroy();
|
|
18492
|
+
return;
|
|
18493
|
+
}
|
|
18494
|
+
if (message.t === "host-maintenance-result") {
|
|
18495
|
+
if (!maintenance.receive(message)) channel.destroy();
|
|
18496
|
+
return;
|
|
18497
|
+
}
|
|
18498
|
+
if (pendingAt === null) return channel.destroy();
|
|
16776
18499
|
if (message.t !== "authority") {
|
|
16777
18500
|
channel.destroy();
|
|
16778
18501
|
return;
|
|
16779
18502
|
}
|
|
16780
|
-
if (message.version.protocol.major !== PROTOCOL_VERSION.major) {
|
|
18503
|
+
if (this.updateOnly ? !this.updateOnly.accepts(message.version) : message.version.protocol.major !== PROTOCOL_VERSION.major) {
|
|
16781
18504
|
this.status = "protocol_mismatch";
|
|
16782
18505
|
reject(
|
|
16783
18506
|
this.error(
|
|
16784
18507
|
"protocol_mismatch",
|
|
16785
|
-
`Host protocol ${message.version.protocol.major} does not match client protocol ${PROTOCOL_VERSION.major}`
|
|
18508
|
+
this.updateOnly ? "Host identity changed outside the approved update migration" : `Host protocol ${message.version.protocol.major} does not match client protocol ${PROTOCOL_VERSION.major}`
|
|
16786
18509
|
)
|
|
16787
18510
|
);
|
|
16788
|
-
|
|
18511
|
+
if (this.updateOnly) this.close();
|
|
18512
|
+
else channel.destroy();
|
|
16789
18513
|
return;
|
|
16790
18514
|
}
|
|
16791
18515
|
if (!initial && message.generation !== this.generation) return channel.destroy();
|
|
@@ -16818,7 +18542,11 @@ var HostControlClient = class {
|
|
|
16818
18542
|
channel.once("error", closed);
|
|
16819
18543
|
channel.once("close", closed);
|
|
16820
18544
|
channel.once("end", closed);
|
|
16821
|
-
send({
|
|
18545
|
+
send({
|
|
18546
|
+
t: "open",
|
|
18547
|
+
...this.profile ? { profile: this.profile } : {},
|
|
18548
|
+
...this.maintenance ? { maintenance: this.maintenance } : {}
|
|
18549
|
+
});
|
|
16822
18550
|
});
|
|
16823
18551
|
} finally {
|
|
16824
18552
|
this.connecting = false;
|
|
@@ -16842,6 +18570,10 @@ var HostControlClient = class {
|
|
|
16842
18570
|
if (this.channel !== channel) return;
|
|
16843
18571
|
this.channel = null;
|
|
16844
18572
|
this.renewControl = null;
|
|
18573
|
+
this.updates?.close();
|
|
18574
|
+
this.updates = null;
|
|
18575
|
+
this.maintenanceRequests?.close();
|
|
18576
|
+
this.maintenanceRequests = null;
|
|
16845
18577
|
this.token = null;
|
|
16846
18578
|
this.generation = null;
|
|
16847
18579
|
if (this.status !== "protocol_mismatch") this.status = state;
|
|
@@ -17027,9 +18759,9 @@ var SshTransport = class {
|
|
|
17027
18759
|
timer.unref();
|
|
17028
18760
|
}
|
|
17029
18761
|
child.stdout.on("data", (chunk) => {
|
|
17030
|
-
const
|
|
17031
|
-
stdout +=
|
|
17032
|
-
opts.onStdout?.(
|
|
18762
|
+
const text2 = chunk.toString();
|
|
18763
|
+
stdout += text2;
|
|
18764
|
+
opts.onStdout?.(text2);
|
|
17033
18765
|
});
|
|
17034
18766
|
child.stderr.on("data", (chunk) => stderr += chunk.toString());
|
|
17035
18767
|
child.on("error", (err) => {
|
|
@@ -17071,8 +18803,8 @@ var SshTransport = class {
|
|
|
17071
18803
|
}
|
|
17072
18804
|
};
|
|
17073
18805
|
}
|
|
17074
|
-
async readFile(
|
|
17075
|
-
const result = await this.exec(`cat ${
|
|
18806
|
+
async readFile(path2) {
|
|
18807
|
+
const result = await this.exec(`cat ${path2}`, { timeoutMs: 15e3 });
|
|
17076
18808
|
return result.code === 0 ? result.stdout : null;
|
|
17077
18809
|
}
|
|
17078
18810
|
async copyTo(localPath, destPath) {
|
|
@@ -17108,8 +18840,8 @@ var SshTransport = class {
|
|
|
17108
18840
|
dispose() {
|
|
17109
18841
|
}
|
|
17110
18842
|
};
|
|
17111
|
-
function shellQuote(
|
|
17112
|
-
return `'${
|
|
18843
|
+
function shellQuote(text2) {
|
|
18844
|
+
return `'${text2.replaceAll("'", `'\\''`)}'`;
|
|
17113
18845
|
}
|
|
17114
18846
|
|
|
17115
18847
|
// src/lib/auth/control-channel.ts
|
|
@@ -17154,9 +18886,9 @@ fs.renameSync(tmp, dest);`;
|
|
|
17154
18886
|
}
|
|
17155
18887
|
async function openControlChannel(transport) {
|
|
17156
18888
|
if (transport.kind === "local") {
|
|
17157
|
-
const
|
|
17158
|
-
privatePath(
|
|
17159
|
-
return connect(
|
|
18889
|
+
const path2 = ipcPath(clientHome(), "host");
|
|
18890
|
+
privatePath(path2);
|
|
18891
|
+
return connect(path2);
|
|
17160
18892
|
}
|
|
17161
18893
|
if (!transport.openChannel) throw new Error("Transport has no bidirectional control channel");
|
|
17162
18894
|
return transport.openChannel(await helper(transport));
|
|
@@ -17193,10 +18925,10 @@ var DaemonClient = class {
|
|
|
17193
18925
|
setPort(port) {
|
|
17194
18926
|
this.port = port;
|
|
17195
18927
|
}
|
|
17196
|
-
async get(
|
|
18928
|
+
async get(path2) {
|
|
17197
18929
|
let res;
|
|
17198
18930
|
try {
|
|
17199
|
-
res = await fetch(`http://127.0.0.1:${this.port}${
|
|
18931
|
+
res = await fetch(`http://127.0.0.1:${this.port}${path2}`, {
|
|
17200
18932
|
headers: { authorization: `Bearer ${this.authority.credential()}` },
|
|
17201
18933
|
signal: AbortSignal.timeout(1e4)
|
|
17202
18934
|
});
|
|
@@ -17211,7 +18943,7 @@ var DaemonClient = class {
|
|
|
17211
18943
|
);
|
|
17212
18944
|
}
|
|
17213
18945
|
if (!res.ok) {
|
|
17214
|
-
throw new CliError("daemon_unreachable", `the daemon answered ${res.status} for ${
|
|
18946
|
+
throw new CliError("daemon_unreachable", `the daemon answered ${res.status} for ${path2}`);
|
|
17215
18947
|
}
|
|
17216
18948
|
return res.json();
|
|
17217
18949
|
}
|
|
@@ -17251,9 +18983,9 @@ var LocalTransport = class {
|
|
|
17251
18983
|
timer.unref();
|
|
17252
18984
|
}
|
|
17253
18985
|
child.stdout.on("data", (chunk) => {
|
|
17254
|
-
const
|
|
17255
|
-
stdout +=
|
|
17256
|
-
opts.onStdout?.(
|
|
18986
|
+
const text2 = chunk.toString();
|
|
18987
|
+
stdout += text2;
|
|
18988
|
+
opts.onStdout?.(text2);
|
|
17257
18989
|
});
|
|
17258
18990
|
child.stderr.on("data", (chunk) => stderr += chunk.toString());
|
|
17259
18991
|
child.on("error", (err) => {
|
|
@@ -17270,9 +19002,9 @@ var LocalTransport = class {
|
|
|
17270
19002
|
else child.stdin.end();
|
|
17271
19003
|
});
|
|
17272
19004
|
}
|
|
17273
|
-
readFile(
|
|
19005
|
+
readFile(path2) {
|
|
17274
19006
|
try {
|
|
17275
|
-
return Promise.resolve(readFileSync3(expandHome(
|
|
19007
|
+
return Promise.resolve(readFileSync3(expandHome(path2), "utf8"));
|
|
17276
19008
|
} catch {
|
|
17277
19009
|
return Promise.resolve(null);
|
|
17278
19010
|
}
|
|
@@ -17286,8 +19018,8 @@ var LocalTransport = class {
|
|
|
17286
19018
|
dispose() {
|
|
17287
19019
|
}
|
|
17288
19020
|
};
|
|
17289
|
-
function expandHome(
|
|
17290
|
-
return
|
|
19021
|
+
function expandHome(path2) {
|
|
19022
|
+
return path2.startsWith('"${PUDDLE_HOME:-$HOME/.puddle}"') ? clientHome() + path2.slice('"${PUDDLE_HOME:-$HOME/.puddle}"'.length) : path2;
|
|
17291
19023
|
}
|
|
17292
19024
|
|
|
17293
19025
|
// src/lib/transport/tunnel.ts
|
|
@@ -17482,16 +19214,41 @@ async function openTunnel(ssh, remotePort, opts = {}) {
|
|
|
17482
19214
|
};
|
|
17483
19215
|
}
|
|
17484
19216
|
|
|
19217
|
+
// src/lib/connection/handshake.ts
|
|
19218
|
+
var CLI_UPGRADE_COMMAND = "puddle upgrade cli";
|
|
19219
|
+
function decideHandshake(cli, daemon) {
|
|
19220
|
+
if (daemon.major === cli.major) return { kind: "proceed" };
|
|
19221
|
+
if (daemon.major < cli.major) return { kind: "upgrade-daemon" };
|
|
19222
|
+
return { kind: "refuse-cli-outdated", command: CLI_UPGRADE_COMMAND };
|
|
19223
|
+
}
|
|
19224
|
+
function verifyDaemonVersion(daemon) {
|
|
19225
|
+
const decision = decideHandshake(PROTOCOL_VERSION, daemon.protocol);
|
|
19226
|
+
if (decision.kind === "proceed") return daemon;
|
|
19227
|
+
if (decision.kind === "refuse-cli-outdated") {
|
|
19228
|
+
throw new CliError(
|
|
19229
|
+
"cli_outdated",
|
|
19230
|
+
`the daemon speaks protocol ${daemon.protocol.major}; this client speaks ${PROTOCOL_VERSION.major}`,
|
|
19231
|
+
`update the desktop app, or update the CLI: ${decision.command}`
|
|
19232
|
+
);
|
|
19233
|
+
}
|
|
19234
|
+
throw new CliError(
|
|
19235
|
+
"protocol_mismatch",
|
|
19236
|
+
`the daemon speaks protocol ${daemon.protocol.major}; this client speaks ${PROTOCOL_VERSION.major}`,
|
|
19237
|
+
"reconnect to update the host daemon"
|
|
19238
|
+
);
|
|
19239
|
+
}
|
|
19240
|
+
|
|
17485
19241
|
// src/puddlang/client.ts
|
|
17486
19242
|
var PuddlangClient = class {
|
|
17487
|
-
constructor(port, authority, profile) {
|
|
19243
|
+
constructor(port, authority, profile, protocol2) {
|
|
17488
19244
|
this.port = port;
|
|
17489
19245
|
this.authority = authority;
|
|
17490
19246
|
this.profile = profile;
|
|
19247
|
+
this.protocol = protocol2;
|
|
17491
19248
|
}
|
|
17492
|
-
async request(
|
|
19249
|
+
async request(path2, body) {
|
|
17493
19250
|
const response = await fetch(
|
|
17494
|
-
`http://127.0.0.1:${this.port()}/api/puddlang/${encodeURIComponent(this.profile)}${
|
|
19251
|
+
`http://127.0.0.1:${this.port()}/api/puddlang/${encodeURIComponent(this.profile)}${path2}`,
|
|
17495
19252
|
{
|
|
17496
19253
|
method: body === void 0 ? "GET" : "POST",
|
|
17497
19254
|
headers: {
|
|
@@ -17514,17 +19271,37 @@ var PuddlangClient = class {
|
|
|
17514
19271
|
async start(input) {
|
|
17515
19272
|
return puddlangRunSchema.parse(await this.request("/runs", input));
|
|
17516
19273
|
}
|
|
17517
|
-
async status(
|
|
17518
|
-
return puddlangRunSchema.parse(await this.request(`/runs/${encodeURIComponent(
|
|
19274
|
+
async status(id3) {
|
|
19275
|
+
return puddlangRunSchema.parse(await this.request(`/runs/${encodeURIComponent(id3)}`));
|
|
17519
19276
|
}
|
|
17520
|
-
async events(
|
|
19277
|
+
async events(id3, after = 0) {
|
|
17521
19278
|
return puddlangEventsSchema.parse(
|
|
17522
|
-
await this.request(`/runs/${encodeURIComponent(
|
|
19279
|
+
await this.request(`/runs/${encodeURIComponent(id3)}/events?after=${after}`)
|
|
17523
19280
|
);
|
|
17524
19281
|
}
|
|
17525
|
-
async cancel(
|
|
19282
|
+
async cancel(id3) {
|
|
17526
19283
|
return puddlangRunSchema.parse(
|
|
17527
|
-
await this.request(`/runs/${encodeURIComponent(
|
|
19284
|
+
await this.request(`/runs/${encodeURIComponent(id3)}/cancel`, {})
|
|
19285
|
+
);
|
|
19286
|
+
}
|
|
19287
|
+
requireOutcomes() {
|
|
19288
|
+
if (!supportsApplicationFeature(this.protocol, { major: 26, minor: 1 }))
|
|
19289
|
+
throw new Error(
|
|
19290
|
+
"Programme outcome controls require daemon protocol 26.1 or newer within the current application major"
|
|
19291
|
+
);
|
|
19292
|
+
}
|
|
19293
|
+
async outcomes(id3, after) {
|
|
19294
|
+
this.requireOutcomes();
|
|
19295
|
+
return puddlangOutcomesSchema.parse(
|
|
19296
|
+
await this.request(
|
|
19297
|
+
`/runs/${encodeURIComponent(id3)}/outcomes${after === void 0 ? "" : `?after=${after}`}`
|
|
19298
|
+
)
|
|
19299
|
+
);
|
|
19300
|
+
}
|
|
19301
|
+
async disposeOutcome(id3, operation2, request) {
|
|
19302
|
+
this.requireOutcomes();
|
|
19303
|
+
return puddlangOutcomeResponseSchema.parse(
|
|
19304
|
+
await this.request(`/runs/${encodeURIComponent(id3)}/outcomes/${operation2}`, request)
|
|
17528
19305
|
);
|
|
17529
19306
|
}
|
|
17530
19307
|
};
|
|
@@ -17543,18 +19320,14 @@ async function connectPuddlang(host, selector) {
|
|
|
17543
19320
|
if (transport instanceof SshTransport) tunnel = await openTunnel(transport, authority.port);
|
|
17544
19321
|
const port = () => tunnel?.localPort ?? authority.port;
|
|
17545
19322
|
const daemon = new DaemonClient(port(), authority);
|
|
17546
|
-
const { protocol } = await daemon.version();
|
|
17547
|
-
if (protocol.major !== 24)
|
|
17548
|
-
throw new Error(
|
|
17549
|
-
"This pudl version requires daemon protocol 24.0+ within major 24 for headless mode. Upgrade the daemon with puddle upgrade daemon."
|
|
17550
|
-
);
|
|
19323
|
+
const { protocol: protocol2 } = verifyDaemonVersion(await daemon.version());
|
|
17551
19324
|
const profiles = await daemon.profiles();
|
|
17552
19325
|
const matches = selector ? profiles.filter((p) => p.id === selector || p.name === selector) : profiles;
|
|
17553
19326
|
if (matches.length !== 1)
|
|
17554
19327
|
throw new Error(
|
|
17555
19328
|
`Select --profile on the execution host: ${profiles.map((p) => `${p.name} (${p.id})`).join(", ")}`
|
|
17556
19329
|
);
|
|
17557
|
-
return { client: new PuddlangClient(port, authority, matches[0].id), close };
|
|
19330
|
+
return { client: new PuddlangClient(port, authority, matches[0].id, protocol2), close };
|
|
17558
19331
|
} catch (error51) {
|
|
17559
19332
|
await close();
|
|
17560
19333
|
throw error51;
|
|
@@ -17576,13 +19349,13 @@ async function serveMcp(client, input, output) {
|
|
|
17576
19349
|
write({ jsonrpc: "2.0", id: null, error: { code: -32600, message: "Invalid request" } });
|
|
17577
19350
|
return;
|
|
17578
19351
|
}
|
|
17579
|
-
const { id:
|
|
17580
|
-
if (
|
|
19352
|
+
const { id: id3, method, params } = parsed.data;
|
|
19353
|
+
if (id3 === void 0) {
|
|
17581
19354
|
if (method === "notifications/initialized" && initialised) ready = true;
|
|
17582
19355
|
return;
|
|
17583
19356
|
}
|
|
17584
|
-
const reply = (result) => write({ jsonrpc: "2.0", id:
|
|
17585
|
-
const fail = (code, message) => write({ jsonrpc: "2.0", id:
|
|
19357
|
+
const reply = (result) => write({ jsonrpc: "2.0", id: id3, result });
|
|
19358
|
+
const fail = (code, message) => write({ jsonrpc: "2.0", id: id3, error: { code, message } });
|
|
17586
19359
|
if (method === "initialize") {
|
|
17587
19360
|
if (initialised) {
|
|
17588
19361
|
fail(-32600, "Already initialised");
|
|
@@ -17640,6 +19413,16 @@ async function serveMcp(client, input, output) {
|
|
|
17640
19413
|
case "puddlang_cancel":
|
|
17641
19414
|
result = await client.cancel(puddlangMcpIdSchema.parse(args).id);
|
|
17642
19415
|
break;
|
|
19416
|
+
case "puddlang_outcomes": {
|
|
19417
|
+
const a = puddlangMcpOutcomesSchema.parse(args);
|
|
19418
|
+
result = await client.outcomes(a.id, a.after);
|
|
19419
|
+
break;
|
|
19420
|
+
}
|
|
19421
|
+
case "puddlang_outcome": {
|
|
19422
|
+
const { id: id4, operation: operation2, ...request } = puddlangMcpOutcomeSchema.parse(args);
|
|
19423
|
+
result = await client.disposeOutcome(id4, operation2, request);
|
|
19424
|
+
break;
|
|
19425
|
+
}
|
|
17643
19426
|
default:
|
|
17644
19427
|
fail(-32602, "Unknown tool");
|
|
17645
19428
|
return;
|
|
@@ -17692,13 +19475,17 @@ var help = `pudl \u2014 Puddle's Ultimate Domain Language (puddlang)
|
|
|
17692
19475
|
pudl status <run-id>
|
|
17693
19476
|
pudl logs <run-id> [--after sequence]
|
|
17694
19477
|
pudl cancel <run-id>
|
|
19478
|
+
pudl outcomes <run-id> [--after operation-id]
|
|
19479
|
+
pudl outcome <run-id> <operation-id> --read|--discard --fingerprint fingerprint
|
|
17695
19480
|
pudl mcp
|
|
17696
19481
|
|
|
17697
19482
|
Connection: --host user@host --profile name-or-id
|
|
17698
19483
|
Run options: --id UUID --account agent=label-or-id (repeatable)
|
|
17699
19484
|
--max-turns 50 --max-agents 8 --timeout-ms 3600000
|
|
17700
19485
|
|
|
17701
|
-
Requires a running daemon
|
|
19486
|
+
Requires a running daemon with application protocol major ${PROTOCOL_VERSION.major} and a supported agent on that host.
|
|
19487
|
+
Outcome controls require protocol 26.1+. Read/discard explicitly releases retained
|
|
19488
|
+
outcomes for later reclamation; it never resumes the programme or replays a prompt.
|
|
17702
19489
|
Claude Code, Codex, OpenCode and Gemini CLI support interactive and headless modes.
|
|
17703
19490
|
Profiles/accounts/projects are selected on the execution host. Programs are
|
|
17704
19491
|
trusted host code. Closing the CLI detaches; use cancel to stop a run.
|
|
@@ -17717,7 +19504,10 @@ async function main() {
|
|
|
17717
19504
|
after: { type: "string" },
|
|
17718
19505
|
"max-turns": { type: "string" },
|
|
17719
19506
|
"max-agents": { type: "string" },
|
|
17720
|
-
"timeout-ms": { type: "string" }
|
|
19507
|
+
"timeout-ms": { type: "string" },
|
|
19508
|
+
read: { type: "boolean" },
|
|
19509
|
+
discard: { type: "boolean" },
|
|
19510
|
+
fingerprint: { type: "string" }
|
|
17721
19511
|
}
|
|
17722
19512
|
});
|
|
17723
19513
|
if (values.help || !positionals.length) {
|
|
@@ -17725,10 +19515,24 @@ async function main() {
|
|
|
17725
19515
|
return;
|
|
17726
19516
|
}
|
|
17727
19517
|
const [command, argument] = positionals;
|
|
17728
|
-
if (!["run", "context", "status", "logs", "cancel", "mcp"].includes(command))
|
|
19518
|
+
if (!["run", "context", "status", "logs", "cancel", "mcp", "outcomes", "outcome"].includes(command))
|
|
19519
|
+
throw new Error(help);
|
|
19520
|
+
const needsArgument = ["run", "status", "logs", "cancel", "outcomes"].includes(command);
|
|
19521
|
+
if (positionals.length !== (command === "outcome" ? 3 : needsArgument ? 2 : 1))
|
|
17729
19522
|
throw new Error(help);
|
|
17730
|
-
|
|
17731
|
-
|
|
19523
|
+
if (command !== "outcome" && (values.read || values.discard || values.fingerprint))
|
|
19524
|
+
throw new Error(help);
|
|
19525
|
+
const disposition = command === "outcome" ? (() => {
|
|
19526
|
+
if (Boolean(values.read) === Boolean(values.discard))
|
|
19527
|
+
throw new Error("Choose exactly one of --read or --discard");
|
|
19528
|
+
return {
|
|
19529
|
+
operation: puddlangOutcomeOperationSchema.parse(Number(positionals[2])),
|
|
19530
|
+
request: puddlangOutcomeRequestSchema.parse({
|
|
19531
|
+
action: values.read ? "read" : "discard",
|
|
19532
|
+
fingerprint: values.fingerprint
|
|
19533
|
+
})
|
|
19534
|
+
};
|
|
19535
|
+
})() : null;
|
|
17732
19536
|
let submission;
|
|
17733
19537
|
if (command === "run") {
|
|
17734
19538
|
if ((await stat(argument)).size > PUDDLANG_MAX_SOURCE)
|
|
@@ -17740,7 +19544,7 @@ async function main() {
|
|
|
17740
19544
|
accounts[match[1]] = /^\d+$/.test(match[2]) ? Number(match[2]) : match[2];
|
|
17741
19545
|
}
|
|
17742
19546
|
submission = puddlangStartSchema.parse({
|
|
17743
|
-
id: values.id ??
|
|
19547
|
+
id: values.id ?? randomUUID2(),
|
|
17744
19548
|
source: await readFile(argument, "utf8"),
|
|
17745
19549
|
input: values.input === void 0 ? void 0 : JSON.parse(values.input),
|
|
17746
19550
|
accounts,
|
|
@@ -17777,6 +19581,15 @@ async function main() {
|
|
|
17777
19581
|
print(await client.cancel(argument));
|
|
17778
19582
|
return;
|
|
17779
19583
|
}
|
|
19584
|
+
if (command === "outcomes") {
|
|
19585
|
+
const after = values.after === void 0 ? void 0 : puddlangOutcomeOperationSchema.parse(Number(values.after));
|
|
19586
|
+
print(await client.outcomes(argument, after));
|
|
19587
|
+
return;
|
|
19588
|
+
}
|
|
19589
|
+
if (disposition) {
|
|
19590
|
+
print(await client.disposeOutcome(argument, disposition.operation, disposition.request));
|
|
19591
|
+
return;
|
|
19592
|
+
}
|
|
17780
19593
|
if (command === "logs") {
|
|
17781
19594
|
let after = Number(values.after ?? 0);
|
|
17782
19595
|
if (!Number.isSafeInteger(after) || after < 0)
|