@tablation/crew 0.143.3 → 0.143.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +49 -11
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -24424,13 +24424,32 @@ function renderInbox(items, byConnection = false, subject) {
|
|
|
24424
24424
|
var ConnectHttpError = class extends Error {
|
|
24425
24425
|
status;
|
|
24426
24426
|
path;
|
|
24427
|
-
constructor(status2, path, statusText) {
|
|
24428
|
-
super(`${path}: ${status2} ${statusText}`);
|
|
24427
|
+
constructor(status2, path, statusText, detail) {
|
|
24428
|
+
super(`${path}: ${status2} ${statusText}${detail ? ` \u2014 ${detail}` : ""}`);
|
|
24429
24429
|
this.name = "ConnectHttpError";
|
|
24430
24430
|
this.status = status2;
|
|
24431
24431
|
this.path = path;
|
|
24432
24432
|
}
|
|
24433
24433
|
};
|
|
24434
|
+
async function errorDetail(res) {
|
|
24435
|
+
let text2 = "";
|
|
24436
|
+
try {
|
|
24437
|
+
text2 = (await res.text()).trim();
|
|
24438
|
+
} catch {
|
|
24439
|
+
return "";
|
|
24440
|
+
}
|
|
24441
|
+
if (!text2) return "";
|
|
24442
|
+
try {
|
|
24443
|
+
const m = JSON.parse(text2).message;
|
|
24444
|
+
if (typeof m === "string" && m) return m.slice(0, 300);
|
|
24445
|
+
if (Array.isArray(m) && m.length > 0) return m.map(String).join("; ").slice(0, 300);
|
|
24446
|
+
} catch {
|
|
24447
|
+
}
|
|
24448
|
+
return text2.slice(0, 300);
|
|
24449
|
+
}
|
|
24450
|
+
async function httpError(res, path) {
|
|
24451
|
+
return new ConnectHttpError(res.status, path, res.statusText, await errorDetail(res));
|
|
24452
|
+
}
|
|
24434
24453
|
async function get(o, path) {
|
|
24435
24454
|
const res = await fetch(`${o.baseUrl.replace(/\/+$/, "")}/api${path}`, {
|
|
24436
24455
|
headers: {
|
|
@@ -24439,7 +24458,7 @@ async function get(o, path) {
|
|
|
24439
24458
|
"User-Agent": o.userAgent ?? "Mozilla/5.0 TablationCrewAgent/1.0"
|
|
24440
24459
|
}
|
|
24441
24460
|
});
|
|
24442
|
-
if (!res.ok) throw
|
|
24461
|
+
if (!res.ok) throw await httpError(res, path);
|
|
24443
24462
|
return await res.json();
|
|
24444
24463
|
}
|
|
24445
24464
|
async function post2(o, path, body) {
|
|
@@ -24452,7 +24471,7 @@ async function post2(o, path, body) {
|
|
|
24452
24471
|
},
|
|
24453
24472
|
body: JSON.stringify(body)
|
|
24454
24473
|
});
|
|
24455
|
-
if (!res.ok) throw
|
|
24474
|
+
if (!res.ok) throw await httpError(res, path);
|
|
24456
24475
|
return await res.json();
|
|
24457
24476
|
}
|
|
24458
24477
|
async function patch(o, path, body) {
|
|
@@ -24465,7 +24484,7 @@ async function patch(o, path, body) {
|
|
|
24465
24484
|
},
|
|
24466
24485
|
body: JSON.stringify(body)
|
|
24467
24486
|
});
|
|
24468
|
-
if (!res.ok) throw
|
|
24487
|
+
if (!res.ok) throw await httpError(res, path);
|
|
24469
24488
|
return await res.json();
|
|
24470
24489
|
}
|
|
24471
24490
|
async function del(o, path) {
|
|
@@ -24476,7 +24495,7 @@ async function del(o, path) {
|
|
|
24476
24495
|
"User-Agent": o.userAgent ?? "Mozilla/5.0 TablationCrewAgent/1.0"
|
|
24477
24496
|
}
|
|
24478
24497
|
});
|
|
24479
|
-
if (!res.ok) throw
|
|
24498
|
+
if (!res.ok) throw await httpError(res, path);
|
|
24480
24499
|
}
|
|
24481
24500
|
async function provisionReleaseLocks(o, locksModelId, route2, repoNames) {
|
|
24482
24501
|
const scopes = [...new Set(repoNames)].sort().map((r) => releaseLockScope(route2, r));
|
|
@@ -24706,11 +24725,26 @@ async function discover(o) {
|
|
|
24706
24725
|
const hostPassengers = o.ship.hostPassengers ?? false;
|
|
24707
24726
|
const sshPublicKey = o.ship.sshPublicKey;
|
|
24708
24727
|
let shipColumns = /* @__PURE__ */ new Set();
|
|
24728
|
+
const shipOptions = /* @__PURE__ */ new Map();
|
|
24709
24729
|
try {
|
|
24710
24730
|
const shipsModel = await get(o, `/data-models/${out.shipsModelId}`);
|
|
24711
24731
|
shipColumns = new Set((shipsModel.fields ?? []).map((f) => f.columnName));
|
|
24732
|
+
for (const f of shipsModel.fields ?? []) {
|
|
24733
|
+
const opts = f.fieldType?.choiceOptions;
|
|
24734
|
+
if (Array.isArray(opts)) shipOptions.set(f.columnName, new Set(opts.map((x) => x.value)));
|
|
24735
|
+
}
|
|
24712
24736
|
} catch {
|
|
24713
24737
|
}
|
|
24738
|
+
const skippedChoice = /* @__PURE__ */ new Set();
|
|
24739
|
+
const choiceOk = (column, value2) => {
|
|
24740
|
+
const opts = shipOptions.get(column);
|
|
24741
|
+
if (!opts || opts.has(value2)) return true;
|
|
24742
|
+
if (!skippedChoice.has(`${column}=${value2}`)) {
|
|
24743
|
+
skippedChoice.add(`${column}=${value2}`);
|
|
24744
|
+
provisioning.push(`workspace's Ships ${column} type has no "${value2}" option \u2014 left ${column} unset; update the template`);
|
|
24745
|
+
}
|
|
24746
|
+
return false;
|
|
24747
|
+
};
|
|
24714
24748
|
const hostPeriscopes = shipColumns.has("host_periscopes") ? o.ship.hostPeriscopes : void 0;
|
|
24715
24749
|
let ownerId;
|
|
24716
24750
|
if (out.meId) {
|
|
@@ -24755,8 +24789,8 @@ async function discover(o) {
|
|
|
24755
24789
|
if (writeMachineId) patchBody.machine_id = machineId;
|
|
24756
24790
|
if ((mine[0].host_passengers ?? false) !== hostPassengers) patchBody.host_passengers = hostPassengers;
|
|
24757
24791
|
if (hostPeriscopes !== void 0 && (mine[0].host_periscopes ?? false) !== hostPeriscopes) patchBody.host_periscopes = hostPeriscopes;
|
|
24758
|
-
if (o.ship.kind && shipColumns.has("kind") && (mine[0].kind ?? "") !== o.ship.kind) patchBody.kind = o.ship.kind;
|
|
24759
|
-
if (o.ship.instanceClass && shipColumns.has("instance_class") && (mine[0].instance_class ?? "") !== o.ship.instanceClass) patchBody.instance_class = o.ship.instanceClass;
|
|
24792
|
+
if (o.ship.kind && shipColumns.has("kind") && choiceOk("kind", o.ship.kind) && (mine[0].kind ?? "") !== o.ship.kind) patchBody.kind = o.ship.kind;
|
|
24793
|
+
if (o.ship.instanceClass && shipColumns.has("instance_class") && choiceOk("instance_class", o.ship.instanceClass) && (mine[0].instance_class ?? "") !== o.ship.instanceClass) patchBody.instance_class = o.ship.instanceClass;
|
|
24760
24794
|
if (sshPublicKey !== void 0 && (mine[0].ssh_public_key ?? "") !== sshPublicKey) {
|
|
24761
24795
|
patchBody.ssh_public_key = sshPublicKey;
|
|
24762
24796
|
}
|
|
@@ -24769,6 +24803,10 @@ async function discover(o) {
|
|
|
24769
24803
|
if ("owner_id" in patchBody) provisioning.push(`recorded owner on Ships row "${o.ship.name}"`);
|
|
24770
24804
|
}
|
|
24771
24805
|
} else if (mine.length === 0) {
|
|
24806
|
+
if (o.ship.platform && shipOptions.get("platform") && !shipOptions.get("platform").has(o.ship.platform)) {
|
|
24807
|
+
throw new Error(`workspace's Ships platform type has no "${o.ship.platform}" option \u2014 update the template`);
|
|
24808
|
+
}
|
|
24809
|
+
const kindValue = o.ship.kind ?? "developer_machine";
|
|
24772
24810
|
const created = await post2(o, `/data-models/${out.shipsModelId}/records`, {
|
|
24773
24811
|
name: o.ship.name,
|
|
24774
24812
|
...o.ship.platform ? { platform: o.ship.platform } : {},
|
|
@@ -24779,8 +24817,8 @@ async function discover(o) {
|
|
|
24779
24817
|
...writeMachineId ? { machine_id: machineId } : {},
|
|
24780
24818
|
// ISSUE-2791: a ship connecting by hand is a developer machine; the
|
|
24781
24819
|
// column arrives with a template update, so only written when present.
|
|
24782
|
-
...shipColumns.has("kind") ? { kind:
|
|
24783
|
-
...o.ship.instanceClass && shipColumns.has("instance_class") ? { instance_class: o.ship.instanceClass } : {}
|
|
24820
|
+
...shipColumns.has("kind") && choiceOk("kind", kindValue) ? { kind: kindValue } : {},
|
|
24821
|
+
...o.ship.instanceClass && shipColumns.has("instance_class") && choiceOk("instance_class", o.ship.instanceClass) ? { instance_class: o.ship.instanceClass } : {}
|
|
24784
24822
|
});
|
|
24785
24823
|
shipRowId = created.id;
|
|
24786
24824
|
out.shipRow = { id: shipRowId, name: o.ship.name, action: "created", matchedBy };
|
|
@@ -26303,7 +26341,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
26303
26341
|
import { existsSync as existsSync55, readdirSync as readdirSync17, statSync as statSync16 } from "fs";
|
|
26304
26342
|
import { join as join56 } from "path";
|
|
26305
26343
|
function builtVersion() {
|
|
26306
|
-
return true ? "0.143.
|
|
26344
|
+
return true ? "0.143.4" : null;
|
|
26307
26345
|
}
|
|
26308
26346
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
26309
26347
|
function newestMtime(path) {
|
package/package.json
CHANGED