@cotal-ai/cli 0.133.12 → 0.135.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/static-session.d.ts +1 -1
- package/dist/chat/static-session.d.ts.map +1 -1
- package/dist/chat/static-session.js +3 -2
- package/dist/chat/static-session.js.map +1 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +2 -2
- package/dist/command.js.map +1 -1
- package/dist/commands/agents.d.ts +1 -117
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +13 -178
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/channel-members.d.ts.map +1 -1
- package/dist/commands/channel-members.js +15 -6
- package/dist/commands/channel-members.js.map +1 -1
- package/dist/commands/console.js +5 -4
- package/dist/commands/console.js.map +1 -1
- package/dist/commands/down-manifest.d.ts.map +1 -1
- package/dist/commands/down-manifest.js +2 -2
- package/dist/commands/down-manifest.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +8 -7
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/history-limit.d.ts +16 -0
- package/dist/commands/history-limit.d.ts.map +1 -0
- package/dist/commands/history-limit.js +152 -0
- package/dist/commands/history-limit.js.map +1 -0
- package/dist/commands/history.d.ts +28 -3
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +30 -8
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/meshes.d.ts.map +1 -1
- package/dist/commands/meshes.js +29 -12
- package/dist/commands/meshes.js.map +1 -1
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +4 -3
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/persona-remote.js +1 -2
- package/dist/commands/persona-remote.js.map +1 -1
- package/dist/commands/setup-start.d.ts.map +1 -1
- package/dist/commands/setup-start.js +7 -1
- package/dist/commands/setup-start.js.map +1 -1
- package/dist/commands/spawn.d.ts +1 -37
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +24 -43
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +4 -3
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/team-agent-apply.d.ts.map +1 -1
- package/dist/commands/team-agent-apply.js +6 -5
- package/dist/commands/team-agent-apply.js.map +1 -1
- package/dist/commands/team-agent-remove.d.ts.map +1 -1
- package/dist/commands/team-agent-remove.js +6 -5
- package/dist/commands/team-agent-remove.js.map +1 -1
- package/dist/commands/team-deploy-apply.d.ts.map +1 -1
- package/dist/commands/team-deploy-apply.js +1 -2
- package/dist/commands/team-deploy-apply.js.map +1 -1
- package/dist/commands/team.d.ts.map +1 -1
- package/dist/commands/team.js +2 -2
- package/dist/commands/team.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +20 -18
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +5 -4
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +5 -17
- package/dist/commands/watch.js.map +1 -1
- package/dist/commands/who.d.ts.map +1 -1
- package/dist/commands/who.js +1 -1
- package/dist/commands/who.js.map +1 -1
- package/dist/console/app.d.ts +1 -1
- package/dist/console/app.d.ts.map +1 -1
- package/dist/console/app.js +6 -5
- package/dist/console/app.js.map +1 -1
- package/dist/console/commands.d.ts +2 -3
- package/dist/console/commands.d.ts.map +1 -1
- package/dist/console/commands.js.map +1 -1
- package/dist/console/launch.d.ts +1 -1
- package/dist/console/launch.d.ts.map +1 -1
- package/dist/console/mesh.d.ts +2 -2
- package/dist/console/mesh.d.ts.map +1 -1
- package/dist/console/mesh.js +2 -2
- package/dist/console/mesh.js.map +1 -1
- package/dist/console/root.d.ts +2 -16
- package/dist/console/root.d.ts.map +1 -1
- package/dist/console/root.js +6 -30
- package/dist/console/root.js.map +1 -1
- package/dist/console/ui/CommandPalette.d.ts +2 -2
- package/dist/console/ui/CommandPalette.d.ts.map +1 -1
- package/dist/console/ui/CommandPalette.js.map +1 -1
- package/dist/console/ui/Dm.d.ts +1 -1
- package/dist/console/ui/Dm.d.ts.map +1 -1
- package/dist/console/ui/Tiles.d.ts +1 -1
- package/dist/console/ui/Tiles.d.ts.map +1 -1
- package/dist/console/ui/topo/Topo.d.ts +1 -0
- package/dist/console/ui/topo/Topo.d.ts.map +1 -1
- package/dist/console/ui/topo/Topo.js +2 -1
- package/dist/console/ui/topo/Topo.js.map +1 -1
- package/dist/console/ui/topo/model.d.ts +3 -0
- package/dist/console/ui/topo/model.d.ts.map +1 -1
- package/dist/console/ui/topo/model.js +12 -4
- package/dist/console/ui/topo/model.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/control.d.ts +5 -280
- package/dist/lib/control.d.ts.map +1 -1
- package/dist/lib/control.js +24 -782
- package/dist/lib/control.js.map +1 -1
- package/dist/lib/controller-preserve.d.ts.map +1 -1
- package/dist/lib/controller-preserve.js +5 -4
- package/dist/lib/controller-preserve.js.map +1 -1
- package/dist/lib/endpoint-errors.d.ts +1 -3
- package/dist/lib/endpoint-errors.d.ts.map +1 -1
- package/dist/lib/endpoint-errors.js +1 -6
- package/dist/lib/endpoint-errors.js.map +1 -1
- package/dist/lib/endpoint-scatter.d.ts.map +1 -1
- package/dist/lib/endpoint-scatter.js +1 -2
- package/dist/lib/endpoint-scatter.js.map +1 -1
- package/dist/lib/manager-choice.d.ts +2 -31
- package/dist/lib/manager-choice.d.ts.map +1 -1
- package/dist/lib/manager-choice.js +10 -61
- package/dist/lib/manager-choice.js.map +1 -1
- package/dist/lib/manifest/live.js +1 -1
- package/dist/lib/manifest/live.js.map +1 -1
- package/dist/lib/manifest/spawn-plan.d.ts.map +1 -1
- package/dist/lib/manifest/spawn-plan.js +2 -2
- package/dist/lib/manifest/spawn-plan.js.map +1 -1
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +34 -5
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/service-census.d.ts +10 -10
- package/dist/lib/service-install-intent.d.ts +2 -2
- package/dist/lib/service-instances.d.ts +1 -1
- package/dist/lib/service-supervision.d.ts +1 -1
- package/dist/lib/service-systemd-attempt-read.d.ts +3 -3
- package/dist/lib/service-uninstall-intent.d.ts +3 -3
- package/dist/lib/space-schema-report.d.ts +5 -5
- package/dist/lib/space-schema-report.d.ts.map +1 -1
- package/dist/lib/space-schema-report.js +1 -0
- package/dist/lib/space-schema-report.js.map +1 -1
- package/dist/lib/stack-runs.d.ts.map +1 -1
- package/dist/lib/stack-runs.js +4 -3
- package/dist/lib/stack-runs.js.map +1 -1
- package/dist/lib/team-channel-removal.js +2 -2
- package/dist/lib/team-channel-removal.js.map +1 -1
- package/dist/lib/team-retained.d.ts.map +1 -1
- package/dist/lib/team-retained.js +4 -3
- package/dist/lib/team-retained.js.map +1 -1
- package/dist/lib/teardown-spare.d.ts.map +1 -1
- package/dist/lib/teardown-spare.js +4 -3
- package/dist/lib/teardown-spare.js.map +1 -1
- package/dist/lib/transient.js +1 -1
- package/dist/lib/transient.js.map +1 -1
- package/dist/render.js +1 -1
- package/dist/render.js.map +1 -1
- package/dist/ui.d.ts +0 -7
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +1 -24
- package/dist/ui.js.map +1 -1
- package/dist/watch-data.d.ts +1 -1
- package/dist/watch-data.d.ts.map +1 -1
- package/dist/watch-json.js +1 -1
- package/dist/watch-json.js.map +1 -1
- package/dist/watch-view.d.ts +1 -1
- package/dist/watch-view.d.ts.map +1 -1
- package/dist/watch-view.js +1 -1
- package/dist/watch-view.js.map +1 -1
- package/package.json +5 -6
- package/dist/console/control.d.ts +0 -141
- package/dist/console/control.d.ts.map +0 -1
- package/dist/console/control.js +0 -191
- package/dist/console/control.js.map +0 -1
- package/dist/lib/dial-retry.d.ts +0 -33
- package/dist/lib/dial-retry.d.ts.map +0 -1
- package/dist/lib/dial-retry.js +0 -70
- package/dist/lib/dial-retry.js.map +0 -1
- package/dist/view/mesh-view.d.ts +0 -213
- package/dist/view/mesh-view.d.ts.map +0 -1
- package/dist/view/mesh-view.js +0 -527
- package/dist/view/mesh-view.js.map +0 -1
package/dist/commands/up.js
CHANGED
|
@@ -60,11 +60,12 @@ import { assertStoreDirArgument, configuredStoreDir, lastServedStore, missingSto
|
|
|
60
60
|
import { extensionNames, preflightRuntime } from "../ext-loader.js";
|
|
61
61
|
import { completingFlagValue } from "../lib/completion.js";
|
|
62
62
|
import { metadataPositionals } from "../lib/command-path.js";
|
|
63
|
-
import { askManager } from "../lib/control.js";
|
|
64
63
|
import { bindPreparedRestoreListener, isManagerCommitResult, isManagerFinalizeResult, isManagerCommittedRestore, markPreparedRestoreActive, markPreparedRestoreDegraded, heldRestoreAttempt, heldClaim, movedFolderRefusal, prepareRestore, preservedSourceState, recordPreparedRestoreManagerCommit, rehydratePreparedRestore, journaledMaxFileStore, journaledRestoredStreams, leftOutNotes, replacePreparedDeadRestoreListener, restoreComposition, restoreNextStep, restoreOnlyCopy, } from "../lib/restore.js";
|
|
65
64
|
import { attemptProcessesGone } from "../lib/isolated-broker.js";
|
|
66
65
|
import { assertEndpointUnreachable } from "../lib/endpoint-cut.js";
|
|
67
66
|
import { addressHolder, brokerListenAddress, listenerBindError } from "../lib/broker-service.js";
|
|
67
|
+
import { askManager } from "@cotal-ai/workspace/control";
|
|
68
|
+
import { cliControl } from "../lib/control.js";
|
|
68
69
|
const pendingRestores = new Map();
|
|
69
70
|
const restoreSinks = new Map();
|
|
70
71
|
/** Run the guarded `up --restore` startup and return its result instead of printing it. The
|
|
@@ -2543,7 +2544,7 @@ function sameRestoreListenerProof(a, b) {
|
|
|
2543
2544
|
a.serverNonce === b.serverNonce && sameProcessOwner(a.processOwner, b.processOwner) &&
|
|
2544
2545
|
a.serverEndpoint === b.serverEndpoint && sameStoreIdentity(a.target, b.target);
|
|
2545
2546
|
}
|
|
2546
|
-
function readNatsInfo(endpoint, timeoutMs = 2_000) {
|
|
2547
|
+
function readNatsInfo(label, endpoint, timeoutMs = 2_000) {
|
|
2547
2548
|
return new Promise((resolveInfo, rejectInfo) => {
|
|
2548
2549
|
let settled = false;
|
|
2549
2550
|
let socket;
|
|
@@ -2562,7 +2563,7 @@ function readNatsInfo(endpoint, timeoutMs = 2_000) {
|
|
|
2562
2563
|
url = new URL(endpoint);
|
|
2563
2564
|
}
|
|
2564
2565
|
catch {
|
|
2565
|
-
rejectInfo(new Error(
|
|
2566
|
+
rejectInfo(new Error(`${label} has an invalid listener endpoint ${endpoint}`));
|
|
2566
2567
|
return;
|
|
2567
2568
|
}
|
|
2568
2569
|
socket = createConnection({ host: url.hostname, port: Number(url.port) || 4222 });
|
|
@@ -2571,14 +2572,14 @@ function readNatsInfo(endpoint, timeoutMs = 2_000) {
|
|
|
2571
2572
|
socket.on("data", (chunk) => {
|
|
2572
2573
|
input += chunk.toString("utf8");
|
|
2573
2574
|
if (input.length > 64 * 1024)
|
|
2574
|
-
return finish(new Error(
|
|
2575
|
+
return finish(new Error(`${label} listener INFO exceeds 64 KiB`));
|
|
2575
2576
|
const newline = input.indexOf("\r\n");
|
|
2576
2577
|
if (newline < 0)
|
|
2577
2578
|
return;
|
|
2578
2579
|
const line = input.slice(0, newline);
|
|
2579
2580
|
const brace = line.indexOf("{");
|
|
2580
2581
|
if (!/^INFO\b/.test(line) || brace < 0)
|
|
2581
|
-
return finish(new Error(
|
|
2582
|
+
return finish(new Error(`${label} listener did not present a NATS INFO greeting`));
|
|
2582
2583
|
try {
|
|
2583
2584
|
const info = JSON.parse(line.slice(brace));
|
|
2584
2585
|
if (!info || typeof info !== "object" || Array.isArray(info))
|
|
@@ -2586,12 +2587,12 @@ function readNatsInfo(endpoint, timeoutMs = 2_000) {
|
|
|
2586
2587
|
finish(undefined, info);
|
|
2587
2588
|
}
|
|
2588
2589
|
catch (error) {
|
|
2589
|
-
finish(new Error(
|
|
2590
|
+
finish(new Error(`${label} listener presented invalid NATS INFO: ${error.message}`));
|
|
2590
2591
|
}
|
|
2591
2592
|
});
|
|
2592
|
-
socket.on("timeout", () => finish(new Error(
|
|
2593
|
-
socket.on("error", (error) => finish(new Error(
|
|
2594
|
-
socket.on("close", () => finish(new Error(
|
|
2593
|
+
socket.on("timeout", () => finish(new Error(`${label} listener INFO timed out`)));
|
|
2594
|
+
socket.on("error", (error) => finish(new Error(`${label} listener INFO failed: ${error.message}`)));
|
|
2595
|
+
socket.on("close", () => finish(new Error(`${label} listener closed before NATS INFO`)));
|
|
2595
2596
|
});
|
|
2596
2597
|
}
|
|
2597
2598
|
/** Prove a recovered attempt's live bound listener IS ours end-to-end before adoption: launch
|
|
@@ -2633,7 +2634,7 @@ async function proveBoundListener(kind, attempt, proof, journalStore, store) {
|
|
|
2633
2634
|
const mesh = findMesh(attempt.space);
|
|
2634
2635
|
if (mesh && (mesh.server !== attempt.server || mesh.root !== attempt.root || mesh.mode !== attempt.mode))
|
|
2635
2636
|
throw new Error(`${label} conflicts with the recorded mesh identity`);
|
|
2636
|
-
const info = await readNatsInfo(proof.serverEndpoint);
|
|
2637
|
+
const info = await readNatsInfo(label, proof.serverEndpoint);
|
|
2637
2638
|
if (info.server_name !== proof.serverName)
|
|
2638
2639
|
throw new Error(`${label} reached a foreign NATS server name/nonce`);
|
|
2639
2640
|
const auth = await resumeControlAuth(attempt.root, attempt.mode);
|
|
@@ -2715,7 +2716,7 @@ async function resumeControllerStack(lock, root, values, restoreSink) {
|
|
|
2715
2716
|
try {
|
|
2716
2717
|
if (journal.state === "resume-intent" || journal.state === "commit-intent") {
|
|
2717
2718
|
await startControllerMembers(lock, root, space, launch.serverName);
|
|
2718
|
-
const brokerInfo = await readNatsInfo(launch.server);
|
|
2719
|
+
const brokerInfo = await readNatsInfo(`${restoring ? "restore" : "resume"} attempt ${attemptId}`, launch.server);
|
|
2719
2720
|
if (brokerInfo.server_name !== launch.serverName)
|
|
2720
2721
|
throw new CommandFailure("unknown", "OPERATION_UNKNOWN", "the resumed broker reports another server name than this attempt recorded; nothing further was started", { target: { root, space } });
|
|
2721
2722
|
bindControllerBroker(lock, root, space, launch);
|
|
@@ -2861,9 +2862,10 @@ function proveOrdinaryResumeListener(pending) {
|
|
|
2861
2862
|
/** Light wire check for a freshly SPAWNED ordinary-resume listener: the greeted server must carry
|
|
2862
2863
|
* the attempt's exact name/nonce (the full seven-point prove is for adopting a survivor). */
|
|
2863
2864
|
async function verifySpawnedOrdinaryListener(pending) {
|
|
2864
|
-
const
|
|
2865
|
+
const label = `resume attempt ${pending.attemptId}`;
|
|
2866
|
+
const info = await readNatsInfo(label, pending.server);
|
|
2865
2867
|
if (info.server_name !== pending.serverName)
|
|
2866
|
-
throw new Error(
|
|
2868
|
+
throw new Error(`${label} spawned listener reports a foreign NATS server name`);
|
|
2867
2869
|
}
|
|
2868
2870
|
/** Adopts a listener its resume or restore attempt has proved over the wire: records the mesh,
|
|
2869
2871
|
* starts delivery and completes the attempt. `storeDir` is the store that listener runs on, and
|
|
@@ -2970,7 +2972,7 @@ async function completeResumeActivation(attemptId, healthy, reason, server, held
|
|
|
2970
2972
|
const auth = await resumeControlAuth(pending.root, pending.mode);
|
|
2971
2973
|
const readinessDeadline = Date.now() + 20_000;
|
|
2972
2974
|
for (;;) {
|
|
2973
|
-
const ready = await askManager(pending.space, server, "ps", undefined, auth, "any", 2_000);
|
|
2975
|
+
const ready = await askManager(cliControl, pending.space, server, "ps", undefined, auth, "any", 2_000);
|
|
2974
2976
|
// Wait only while nothing ANSWERS (the manager is still coming up). Any answer, including a
|
|
2975
2977
|
// refusal, ends the wait: a refusal will not heal by waiting, and the resume call right after
|
|
2976
2978
|
// this fails loud on it with its own message.
|
|
@@ -2999,7 +3001,7 @@ async function completeResumeActivation(attemptId, healthy, reason, server, held
|
|
|
2999
3001
|
throw e;
|
|
3000
3002
|
}
|
|
3001
3003
|
};
|
|
3002
|
-
const resumed = await askManager(pending.space, server, "resumePreserved", {
|
|
3004
|
+
const resumed = await askManager(cliControl, pending.space, server, "resumePreserved", {
|
|
3003
3005
|
attemptId,
|
|
3004
3006
|
inventory: restored?.selection === "registry"
|
|
3005
3007
|
? { ...pending.inventory, agents: [] }
|
|
@@ -3033,7 +3035,7 @@ async function completeResumeActivation(attemptId, healthy, reason, server, held
|
|
|
3033
3035
|
}
|
|
3034
3036
|
}
|
|
3035
3037
|
if (!managerCommit) {
|
|
3036
|
-
const committed = await askManager(pending.space, server, "commitResume", { attemptId }, await askAuth(true), "any", 40_000);
|
|
3038
|
+
const committed = await askManager(cliControl, pending.space, server, "commitResume", { attemptId }, await askAuth(true), "any", 40_000);
|
|
3037
3039
|
if (!committed.ok) {
|
|
3038
3040
|
const message = committed.error ?? "manager resume commit failed";
|
|
3039
3041
|
markPendingResumeDegraded(attemptId, message, heldLock);
|
|
@@ -3064,7 +3066,7 @@ async function completeResumeActivation(attemptId, healthy, reason, server, held
|
|
|
3064
3066
|
process.exit(89);
|
|
3065
3067
|
}
|
|
3066
3068
|
else {
|
|
3067
|
-
const recommitted = await askManager(pending.space, server, "commitResume", { attemptId }, await askAuth(false), "any", 40_000);
|
|
3069
|
+
const recommitted = await askManager(cliControl, pending.space, server, "commitResume", { attemptId }, await askAuth(false), "any", 40_000);
|
|
3068
3070
|
// A surviving manager that already finalized legitimately answers {state:"active"} with the
|
|
3069
3071
|
// exact durable token: accept both committed shapes idempotently, then reissue the token-bound
|
|
3070
3072
|
// finalize (itself idempotent) below.
|
|
@@ -3076,7 +3078,7 @@ async function completeResumeActivation(attemptId, healthy, reason, server, held
|
|
|
3076
3078
|
if (!exactToken)
|
|
3077
3079
|
throw new Error(`replacement manager did not recover the durable commit token for attempt ${attemptId}`);
|
|
3078
3080
|
}
|
|
3079
|
-
const finalized = await askManager(pending.space, server, "finalizeResume", { attemptId, durableCommitToken: managerCommit.durableCommitToken }, await askAuth(false), "any", 40_000);
|
|
3081
|
+
const finalized = await askManager(cliControl, pending.space, server, "finalizeResume", { attemptId, durableCommitToken: managerCommit.durableCommitToken }, await askAuth(false), "any", 40_000);
|
|
3080
3082
|
if (!finalized.ok)
|
|
3081
3083
|
throw new Error(finalized.error ?? `manager resume finalize failed for attempt ${attemptId}`);
|
|
3082
3084
|
if (!isManagerFinalizeResult(finalized.data, attemptId))
|