@cotal-ai/manager 0.171.2 → 0.171.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/broker-transport.d.ts +126 -0
- package/dist/broker-transport.d.ts.map +1 -0
- package/dist/broker-transport.js +263 -0
- package/dist/broker-transport.js.map +1 -0
- package/dist/command-dispatch.d.ts +206 -0
- package/dist/command-dispatch.d.ts.map +1 -0
- package/dist/command-dispatch.js +471 -0
- package/dist/command-dispatch.js.map +1 -0
- package/dist/connector-inventory.d.ts +37 -0
- package/dist/connector-inventory.d.ts.map +1 -0
- package/dist/connector-inventory.js +73 -0
- package/dist/connector-inventory.js.map +1 -0
- package/dist/harness-resolution.d.ts +71 -0
- package/dist/harness-resolution.d.ts.map +1 -0
- package/dist/harness-resolution.js +111 -0
- package/dist/harness-resolution.js.map +1 -0
- package/dist/manager.d.ts +91 -375
- package/dist/manager.d.ts.map +1 -1
- package/dist/manager.js +400 -2811
- package/dist/manager.js.map +1 -1
- package/dist/persona-catalog.d.ts +86 -0
- package/dist/persona-catalog.d.ts.map +1 -0
- package/dist/persona-catalog.js +325 -0
- package/dist/persona-catalog.js.map +1 -0
- package/dist/preservation.d.ts +157 -0
- package/dist/preservation.d.ts.map +1 -0
- package/dist/preservation.js +583 -0
- package/dist/preservation.js.map +1 -0
- package/dist/readiness-wait.d.ts +64 -0
- package/dist/readiness-wait.d.ts.map +1 -0
- package/dist/readiness-wait.js +244 -0
- package/dist/readiness-wait.js.map +1 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +22 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/service-adapter.d.ts.map +1 -1
- package/dist/service-adapter.js +6 -0
- package/dist/service-adapter.js.map +1 -1
- package/dist/spawn-goal.d.ts +77 -0
- package/dist/spawn-goal.d.ts.map +1 -0
- package/dist/spawn-goal.js +357 -0
- package/dist/spawn-goal.js.map +1 -0
- package/dist/start-doors.d.ts +51 -0
- package/dist/start-doors.d.ts.map +1 -0
- package/dist/start-doors.js +187 -0
- package/dist/start-doors.js.map +1 -0
- package/dist/status-and-models.d.ts +155 -0
- package/dist/status-and-models.d.ts.map +1 -0
- package/dist/status-and-models.js +290 -0
- package/dist/status-and-models.js.map +1 -0
- package/dist/terminal-input.d.ts +82 -0
- package/dist/terminal-input.d.ts.map +1 -0
- package/dist/terminal-input.js +266 -0
- package/dist/terminal-input.js.map +1 -0
- package/package.json +12 -12
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { EpEnvelopeError, rejectionText, resolveAuthProvider } from "@cotal-ai/core";
|
|
2
|
+
import { agentAuthState, agentLifecycleSecretFilePaths, userAuthStateDir } from "@cotal-ai/workspace";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { hostname } from "node:os";
|
|
6
|
+
// Capture the loaded package version before an installation can replace its files.
|
|
7
|
+
export const MANAGER_VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
8
|
+
/** Sentinel owner-filter value that matches NO agent's `userOwner` (owner tokens never contain a
|
|
9
|
+
* dash) — what {@link Manager.psOwnerFilter} returns for an unparseable caller so a malformed
|
|
10
|
+
* principal fail-closes to an empty `ps` instead of an unbounded one. */
|
|
11
|
+
const NO_OWNER_MATCHES = "-no-owner-";
|
|
12
|
+
/** What the manager reports about itself: status, the seat list and its owner filter, local seat facts, and the model catalog. */
|
|
13
|
+
export class StatusAndModels {
|
|
14
|
+
deps;
|
|
15
|
+
constructor(deps) {
|
|
16
|
+
this.deps = deps;
|
|
17
|
+
}
|
|
18
|
+
// The Manager members these bodies read, under their Manager names. Each reads through its dep at
|
|
19
|
+
// use, so a field the Manager assigns later is current and a method a test replaces on the Manager
|
|
20
|
+
// is the one that runs.
|
|
21
|
+
get agents() { return this.deps.agents(); }
|
|
22
|
+
get auth() { return this.deps.auth(); }
|
|
23
|
+
get connectorStatuses() { return this.deps.connectorStatuses(); }
|
|
24
|
+
get ep() { return this.deps.ep(); }
|
|
25
|
+
get execution() { return this.deps.execution(); }
|
|
26
|
+
get leaseStopping() { return this.deps.leaseStopping(); }
|
|
27
|
+
get lifecycleInFlight() { return this.deps.lifecycleInFlight(); }
|
|
28
|
+
get maintenanceState() { return this.deps.maintenanceState(); }
|
|
29
|
+
get managerInstanceId() { return this.deps.managerInstanceId(); }
|
|
30
|
+
get managerLifecycleUid() { return this.deps.managerLifecycleUid(); }
|
|
31
|
+
get namesCapacity() { return this.deps.namesCapacity(); }
|
|
32
|
+
get preservationAttemptId() { return this.deps.preservationAttemptId(); }
|
|
33
|
+
get preservationInventory() { return this.deps.preservationInventory(); }
|
|
34
|
+
get remoteAuthority() { return this.deps.remoteAuthority(); }
|
|
35
|
+
get requiredRuntime() { return this.deps.requiredRuntime(); }
|
|
36
|
+
get resumeRequired() { return this.deps.resumeRequired(); }
|
|
37
|
+
get retirement() { return this.deps.retirement(); }
|
|
38
|
+
get runtimeKind() { return this.deps.runtimeKind(); }
|
|
39
|
+
get space() { return this.deps.space(); }
|
|
40
|
+
get startedAtMs() { return this.deps.startedAtMs(); }
|
|
41
|
+
get staticLifecycle() { return this.deps.staticLifecycle(); }
|
|
42
|
+
get userMode() { return this.deps.userMode(); }
|
|
43
|
+
get workspaceRoot() { return this.deps.workspaceRoot(); }
|
|
44
|
+
classSpawnEnabled(...args) { return this.deps.classSpawnEnabled(...args); }
|
|
45
|
+
connectorNames(...args) { return this.deps.connectorNames(...args); }
|
|
46
|
+
epAdminReach(...args) { return this.deps.epAdminReach(...args); }
|
|
47
|
+
executionRefusal(...args) { return this.deps.executionRefusal(...args); }
|
|
48
|
+
forkProvenance(...args) { return this.deps.forkProvenance(...args); }
|
|
49
|
+
isOwnPresence(a, p) { return this.deps.isOwnPresence(a, p); }
|
|
50
|
+
isProcessBoundSeat(...args) { return this.deps.isProcessBoundSeat(...args); }
|
|
51
|
+
launchHarness(...args) { return this.deps.launchHarness(...args); }
|
|
52
|
+
refreshUnavailableConnectors(...args) { return this.deps.refreshUnavailableConnectors(...args); }
|
|
53
|
+
resolveConnector(...args) { return this.deps.resolveConnector(...args); }
|
|
54
|
+
staticReconciliationStatus(...args) { return this.deps.staticReconciliationStatus(...args); }
|
|
55
|
+
/** Return connector-provided model catalogs for selector UIs. Optional by connector: a host with no
|
|
56
|
+
* local model-list API reports `supported:false` rather than blocking the manager. A connector that
|
|
57
|
+
* fails to import shows an `error:` row (from manifest enumeration) and never blocks the others. */
|
|
58
|
+
async opModels(args) {
|
|
59
|
+
if (this.execution === "none")
|
|
60
|
+
throw new EpEnvelopeError("unimplemented", this.executionRefusal());
|
|
61
|
+
const requested = String(args.agent ?? "").trim();
|
|
62
|
+
const refresh = args.refresh === true;
|
|
63
|
+
const one = async (connector) => {
|
|
64
|
+
await this.refreshUnavailableConnectors(connector.name, true);
|
|
65
|
+
const harness = this.launchHarness(connector);
|
|
66
|
+
if (!connector.listModels)
|
|
67
|
+
return { agent: connector.name, supported: false, models: [] };
|
|
68
|
+
if ("refusal" in harness)
|
|
69
|
+
return { agent: connector.name, supported: true, models: [], error: harness.refusal };
|
|
70
|
+
try {
|
|
71
|
+
const catalog = await connector.listModels({ refresh, resolvedBinaries: harness.binaries });
|
|
72
|
+
return { agent: connector.name, supported: catalog.unavailable === undefined, ...catalog };
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
return { agent: connector.name, supported: true, models: [], error: rejectionText(e) };
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
if (requested) {
|
|
79
|
+
let connector;
|
|
80
|
+
try {
|
|
81
|
+
connector = await this.resolveConnector(requested);
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
return { ok: false, error: rejectionText(e) };
|
|
85
|
+
}
|
|
86
|
+
const result = await one(connector);
|
|
87
|
+
return result.error ? { ok: false, error: result.error } : { ok: true, data: result };
|
|
88
|
+
}
|
|
89
|
+
// Enumerate from the manifest (published binary) so a connector that fails to import still gets
|
|
90
|
+
// a row — `registry.all` can't list one that never registered. Each resolves lazily; an import
|
|
91
|
+
// failure becomes an `error:` catalog row and never blocks the healthy ones.
|
|
92
|
+
const catalogs = await Promise.all(this.connectorNames().map(async (name) => {
|
|
93
|
+
let connector;
|
|
94
|
+
try {
|
|
95
|
+
connector = await this.resolveConnector(name);
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
return { agent: name, supported: false, models: [], error: rejectionText(e) };
|
|
99
|
+
}
|
|
100
|
+
return one(connector);
|
|
101
|
+
}));
|
|
102
|
+
return { ok: true, data: catalogs };
|
|
103
|
+
}
|
|
104
|
+
/** The owner-domain bound on `ps`/`status` metadata: on a USER mesh, a privileged-tier caller
|
|
105
|
+
* sees only agents under its OWN subject-pinned owner. Two ways to see ALL owners: the admin
|
|
106
|
+
* TIER (operator), or a fresh ledger `admin` SCOPE on the caller's row — the SAME authority that
|
|
107
|
+
* lets `stop`/`attach` reach cross-owner agents ({@link authorizeNamedControl}). Without this the
|
|
108
|
+
* two surfaces disagree: an admin operator could cross-owner stop an agent it could not list.
|
|
109
|
+
* Read fresh so a revoked admin loses visibility on its next call; a read failure and an
|
|
110
|
+
* unparseable caller both fall closed (own-owner / matches-nothing). Static meshes are unbounded. */
|
|
111
|
+
async psOwnerFilter(caller, admin) {
|
|
112
|
+
if (!this.userMode || admin)
|
|
113
|
+
return undefined;
|
|
114
|
+
if (this.remoteAuthority)
|
|
115
|
+
return (await this.epAdminReach(caller)) ? undefined : caller.owner;
|
|
116
|
+
try {
|
|
117
|
+
const scope = await resolveAuthProvider().actorScope({
|
|
118
|
+
dir: userAuthStateDir(this.workspaceRoot, this.space),
|
|
119
|
+
owner: caller.owner,
|
|
120
|
+
actor: caller.actor,
|
|
121
|
+
});
|
|
122
|
+
if (scope?.includes("admin"))
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
/* unreadable ledger authorizes nothing extra: fall through to the own-owner bound */
|
|
127
|
+
}
|
|
128
|
+
return caller.owner;
|
|
129
|
+
}
|
|
130
|
+
/** Parent-local inventory read. It does not enter maintenance or change admission. */
|
|
131
|
+
hostedSeatCount() { return this.agents.size; }
|
|
132
|
+
/** Public local-seat facts for the owning machine daemon. No mesh or secret reads. */
|
|
133
|
+
hostedAgents() {
|
|
134
|
+
if (this.agents.size > 50)
|
|
135
|
+
throw new Error("local agent inventory exceeds its bound");
|
|
136
|
+
return [...this.agents.values()].map(a => ({
|
|
137
|
+
name: a.name, application: a.agent, ...(a.launch.model ? { model: a.launch.model } : {}),
|
|
138
|
+
cwd: a.launch.cwd, startedAt: new Date(a.startedAt).toISOString(), state: a.handle.status(),
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
/** The served manager-level health summary. Given an owner, `agentCount` counts only that owner's
|
|
142
|
+
* seats, as `ps` lists them ({@link psOwnerFilter}), so a person reading a shared Manager does not
|
|
143
|
+
* learn how many seats other owners hold on it. */
|
|
144
|
+
managerStatusData(ownerFilter, setupClaude = false) {
|
|
145
|
+
this.refreshUnavailableConnectors(undefined, setupClaude);
|
|
146
|
+
return {
|
|
147
|
+
instanceId: this.managerInstanceId,
|
|
148
|
+
lifecycleUid: this.managerLifecycleUid,
|
|
149
|
+
host: hostname(),
|
|
150
|
+
version: MANAGER_VERSION,
|
|
151
|
+
execution: this.execution,
|
|
152
|
+
runtime: this.runtimeKind,
|
|
153
|
+
custody: this.execution === "none" ? "none" : this.requiredRuntime.kind === "pty" && this.requiredRuntime.supportsRelease === true ? "custodied" : "legacy",
|
|
154
|
+
runHosting: this.execution !== "none" && (this.remoteAuthority ? this.remoteAuthority.runHosting !== undefined : !this.userMode && this.auth !== undefined),
|
|
155
|
+
terminalSessions: this.execution !== "none",
|
|
156
|
+
agentCount: ownerFilter === undefined ? this.agents.size : [...this.agents.values()].filter((a) => a.userOwner === ownerFilter).length,
|
|
157
|
+
uptimeMs: Date.now() - this.startedAtMs,
|
|
158
|
+
connectors: this.connectorStatuses.map((row) => ({ ...row, binaries: { ...row.binaries } })),
|
|
159
|
+
classSpawn: this.classSpawnEnabled(),
|
|
160
|
+
staticReconciliation: this.staticReconciliationStatus(),
|
|
161
|
+
stopImpact: {
|
|
162
|
+
agentScope: ownerFilter === undefined ? "manager" : "owner-filtered",
|
|
163
|
+
observedAt: new Date().toISOString(),
|
|
164
|
+
maintenance: this.maintenanceState,
|
|
165
|
+
resumeRequired: this.resumeRequired,
|
|
166
|
+
stopping: this.leaseStopping,
|
|
167
|
+
lifecycleInFlight: this.lifecycleInFlight,
|
|
168
|
+
reservedLaunches: this.namesCapacity.reservedCount,
|
|
169
|
+
retirementsPending: this.retirement.pendingCount,
|
|
170
|
+
deprovisioningInFlight: this.retirement.inFlightCount,
|
|
171
|
+
staticReconciliationInFlight: this.staticLifecycle.sweepsInFlight,
|
|
172
|
+
agents: [...this.agents.values()]
|
|
173
|
+
.filter((a) => ownerFilter === undefined || a.userOwner === ownerFilter)
|
|
174
|
+
.map((a) => ({
|
|
175
|
+
name: a.name,
|
|
176
|
+
id: a.id,
|
|
177
|
+
lifecycleUid: a.lifecycleUid,
|
|
178
|
+
mode: a.handle.kind,
|
|
179
|
+
defaultAction: this.maintenanceState !== "active" || this.resumeRequired
|
|
180
|
+
? "stop-retaining-state" : this.isProcessBoundSeat(a) ? "stop" : "release-custody",
|
|
181
|
+
withAgentsAction: this.maintenanceState !== "active" || this.resumeRequired ? "stop-retaining-state" : "stop",
|
|
182
|
+
})),
|
|
183
|
+
// The same digest form `opResumePreserved` binds, so a preserved-exit stop and the later
|
|
184
|
+
// resume name one inventory.
|
|
185
|
+
...(this.maintenanceState !== "active" && this.preservationAttemptId && this.preservationInventory
|
|
186
|
+
? { preservation: { attemptId: this.preservationAttemptId, inventorySha256: createHash("sha256").update(JSON.stringify(this.preservationInventory)).digest("hex") } }
|
|
187
|
+
: {}),
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/** Managed agents cross-referenced with live presence (the manager sees the roster).
|
|
192
|
+
*
|
|
193
|
+
* `ownerFilter`: restrict to agents whose spawn-time stored `userOwner` equals it (the ps/status
|
|
194
|
+
* owner-domain bound); undefined = unbounded. {@link NO_OWNER_MATCHES} matches nothing. */
|
|
195
|
+
list(ownerFilter) {
|
|
196
|
+
const roster = new Map(this.ep.getRoster().map((p) => [p.card.name, p]));
|
|
197
|
+
const observedAt = Date.now();
|
|
198
|
+
// The roster is only evidence while THIS observer's presence watch is fresh. A stale view
|
|
199
|
+
// (whole-bucket silence past TTL) or an unpopulated one (snapshot not yet replayed) cannot
|
|
200
|
+
// support "offline" or "absent" for anyone: a live deployment on 2026-09-09 rendered every live seat as
|
|
201
|
+
// one of those for hours after the presence stream was recreated under a still-open watch.
|
|
202
|
+
// Carry the view state on the row so the renderer can say "unknown" instead of a verdict.
|
|
203
|
+
// An endpoint that reports no view (test doubles built on `getRoster` alone) is read as
|
|
204
|
+
// `current`: that is exactly what every row meant before the field existed.
|
|
205
|
+
const view = typeof this.ep.presenceView === "function" ? this.ep.presenceView() : { state: "current" };
|
|
206
|
+
return [...this.agents.values()].filter((a) => ownerFilter === undefined || a.userOwner === ownerFilter).map((a) => {
|
|
207
|
+
// USER MODE: a detached agent's bearer-refresh death is silent everywhere except here — its
|
|
208
|
+
// bearer command writes each attempt's outcome to the health file, and `ps` renders it
|
|
209
|
+
// FAIL-CLOSED: a failed record is the failure + repair sentence; a missing/malformed or
|
|
210
|
+
// stale record on a live agent is auth-unknown/auth-stale, NEVER silently healthy.
|
|
211
|
+
const health = a.userOwner
|
|
212
|
+
? agentAuthState(a.secretPaths?.health ?? agentLifecycleSecretFilePaths(this.workspaceRoot, this.space, a.name, a.lifecycleUid).health)
|
|
213
|
+
: undefined;
|
|
214
|
+
// The connector-reported provider from presence (#785): the live roster card's `meta.provider`,
|
|
215
|
+
// when it is a non-empty string. Absent when the connector reported none — never fabricated.
|
|
216
|
+
const seen = roster.get(a.name);
|
|
217
|
+
const presenceIdentityVerified = this.isOwnPresence(a, seen);
|
|
218
|
+
const providerMeta = seen?.card.meta?.provider;
|
|
219
|
+
const provider = typeof providerMeta === "string" && providerMeta ? providerMeta : undefined;
|
|
220
|
+
// The harness-reported condition beside the mesh status (#618): a turn that died upstream reads
|
|
221
|
+
// `waiting` with `rate_limit` here, not a bare `waiting`. Absent when the connector reported none.
|
|
222
|
+
// Projected field by field like `provider`: a malformed peer row must not fail this reply's schema.
|
|
223
|
+
const reported = roster.get(a.name)?.condition;
|
|
224
|
+
const condition = reported && typeof reported.code === "string" && reported.code
|
|
225
|
+
? {
|
|
226
|
+
code: reported.code,
|
|
227
|
+
...(typeof reported.source === "string" ? { source: reported.source } : {}),
|
|
228
|
+
...(typeof reported.message === "string" ? { message: reported.message } : {}),
|
|
229
|
+
...(typeof reported.since === "number" && Number.isFinite(reported.since) ? { since: reported.since } : {}),
|
|
230
|
+
}
|
|
231
|
+
: undefined;
|
|
232
|
+
// The seat's last harness-reported work progress (#618). `ts` is only its heartbeat, so a turn
|
|
233
|
+
// that stopped advancing reads as an old `activeAt` beside a live process. Absent when none was reported.
|
|
234
|
+
const activeAtReported = roster.get(a.name)?.activeAt;
|
|
235
|
+
const activeAt = typeof activeAtReported === "number" && Number.isFinite(activeAtReported) ? activeAtReported : undefined;
|
|
236
|
+
// How long an offline verdict has stood (#1208): the seat's last heartbeat before it went
|
|
237
|
+
// offline. Only beside a verdict, since a stale or unpopulated view dates nothing, only from the
|
|
238
|
+
// seat's own record, since `seen` is matched by name and a same-named foreign peer or an older
|
|
239
|
+
// incarnation must not date this seat, and only when the seat's unvalidated `ts` fits the row
|
|
240
|
+
// schema, so one odd record cannot fail the reply.
|
|
241
|
+
const offlineSince = view.state === "current" && this.isOwnPresence(a, seen) && seen.status === "offline" && Number.isSafeInteger(seen.ts) && seen.ts >= 0
|
|
242
|
+
? seen.ts
|
|
243
|
+
: undefined;
|
|
244
|
+
return {
|
|
245
|
+
name: a.name,
|
|
246
|
+
// The spawned agent's id (nkey, or the user-mode principal) — lets an operator tool (e.g.
|
|
247
|
+
// `cotal down -f`) match a ledger entry by name AND id before stopping, so it never stops a
|
|
248
|
+
// same-named foreign agent.
|
|
249
|
+
id: a.id,
|
|
250
|
+
role: a.role,
|
|
251
|
+
agent: a.agent,
|
|
252
|
+
space: this.space,
|
|
253
|
+
mode: a.handle.kind,
|
|
254
|
+
status: a.handle.status(),
|
|
255
|
+
uptimeMs: Date.now() - a.startedAt,
|
|
256
|
+
mesh: seen?.status ?? "absent",
|
|
257
|
+
...(a.joinIssue ? { joinHealth: { state: "degraded", reason: a.joinIssue } } : {}),
|
|
258
|
+
...(condition ? { condition } : {}),
|
|
259
|
+
...(a.startupNotice !== undefined ? { startupNotice: a.startupNotice } : {}),
|
|
260
|
+
...(activeAt !== undefined ? { activeAt } : {}),
|
|
261
|
+
// `current` is the only state in which `mesh` is a verdict; the other two are the
|
|
262
|
+
// observer's own condition and travel on the row (older CLIs ignore the field).
|
|
263
|
+
meshView: view.state,
|
|
264
|
+
presenceIdentityVerified,
|
|
265
|
+
...(view.state === "current" && presenceIdentityVerified ? { presenceObservedAt: observedAt } : {}),
|
|
266
|
+
...(offlineSince !== undefined ? { offlineSince } : {}),
|
|
267
|
+
// The incarnation coordinate (SPEC 13.1) — with `id`, exactly what a v0.4 caller needs to
|
|
268
|
+
// build a targeted (`despawn`/`attach`) request against THIS incarnation.
|
|
269
|
+
lifecycleUid: a.lifecycleUid,
|
|
270
|
+
// #651 enrichment: per-seat facts the manager ALREADY holds, carried on the row so `ps
|
|
271
|
+
// --wide`/`--json` can surface them without a new collection path. All optional in the row
|
|
272
|
+
// schema: a fact this backend did not record serializes absent, never fabricated (the
|
|
273
|
+
// pid is absent on runtimes that do not own a real process; a launch may pin no model).
|
|
274
|
+
model: a.launch.model,
|
|
275
|
+
variant: a.launch.variant,
|
|
276
|
+
...(provider ? { provider } : {}),
|
|
277
|
+
cwd: a.launch.cwd,
|
|
278
|
+
pid: a.handle.pid,
|
|
279
|
+
spawner: a.spawner,
|
|
280
|
+
instanceId: this.managerInstanceId,
|
|
281
|
+
host: hostname(),
|
|
282
|
+
// #1500: the session a `--resume` seat forked, with its title and transcript hash once the
|
|
283
|
+
// seat has recorded them.
|
|
284
|
+
...(a.launch.forkSource ? { resume: this.forkProvenance(a) ?? { source: a.launch.forkSource } } : {}),
|
|
285
|
+
...(health && health.state !== "ok" ? { authHealth: health.state, authReason: health.reason } : {}),
|
|
286
|
+
};
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
//# sourceMappingURL=status-and-models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-and-models.js","sourceRoot":"","sources":["../src/status-and-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErF,OAAO,EAAE,cAAc,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtG,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKnC,mFAAmF;AACnF,MAAM,CAAC,MAAM,eAAe,GAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAyB,CAAC,OAAO,CAAC;AAE9I;;0EAE0E;AAC1E,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAyCtC,kIAAkI;AAClI,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,IAAyB;QAAzB,SAAI,GAAJ,IAAI,CAAqB;IAAG,CAAC;IAE1D,kGAAkG;IAClG,mGAAmG;IACnG,wBAAwB;IACxB,IAAY,MAAM,KAAK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CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvD,0FAA0F;gBAC1F,0EAA0E;gBAC1E,YAAY,EAAE,CAAC,CAAC,YAAY;gBAC5B,uFAAuF;gBACvF,2FAA2F;gBAC3F,sFAAsF;gBACtF,wFAAwF;gBACxF,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;gBACrB,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO;gBACzB,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG;gBACjB,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG;gBACjB,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,UAAU,EAAE,IAAI,CAAC,iBAAiB;gBAClC,IAAI,EAAE,QAAQ,EAAE;gBAChB,2FAA2F;gBAC3F,0BAA0B;gBAC1B,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrG,GAAG,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACpG,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { ControlReply } from "@cotal-ai/core";
|
|
2
|
+
import type { SessionEstablishment } from "./attach-endpoint.js";
|
|
3
|
+
import type { Manager } from "./manager.js";
|
|
4
|
+
import type { ManagedAgent } from "./seat-types.js";
|
|
5
|
+
/** Bracketed-paste delimiters (DECSET 2004). `input` wraps a seat's text in these so the return it
|
|
6
|
+
* writes afterwards is a KEYSTROKE rather than the newline trailing a pasted block: a TUI that
|
|
7
|
+
* classifies a fast burst as a paste consumes that trailing newline and the text sits unsubmitted
|
|
8
|
+
* in the composer until the next call's return (issue #1649). Framing, never content - these bytes
|
|
9
|
+
* are not counted into the receipt, so `bytes` still reports what the caller asked to deliver. */
|
|
10
|
+
export declare const PASTE_START = "\u001B[200~";
|
|
11
|
+
export declare const PASTE_END = "\u001B[201~";
|
|
12
|
+
/** `details[].kind` on an `attach` refusal raised because the seat's runtime opens no terminal
|
|
13
|
+
* stream. The message carries that runtime's own guidance, which is operator copy and changes; this
|
|
14
|
+
* marker is the contract a caller keys on so it can act without reading the wording. */
|
|
15
|
+
export declare const RUNTIME_NO_TERMINAL_DETAIL = "ai.cotal.manager.runtime-no-terminal";
|
|
16
|
+
/** What {@link TerminalInput} reads from the Manager. Every entry is read at use, so a field the Manager
|
|
17
|
+
* assigns after construction is always current, and a Manager method a test replaces is the one that runs. */
|
|
18
|
+
export interface TerminalInputDeps {
|
|
19
|
+
agents: () => Manager["agents"];
|
|
20
|
+
auth: () => Manager["auth"];
|
|
21
|
+
managerLifecycleUid: () => Manager["managerLifecycleUid"];
|
|
22
|
+
sessionPlane: () => Manager["sessionPlane"];
|
|
23
|
+
wsPort: () => Manager["wsPort"];
|
|
24
|
+
runtimeFor: (...args: Parameters<Manager["runtimeFor"]>) => ReturnType<Manager["runtimeFor"]>;
|
|
25
|
+
}
|
|
26
|
+
/** Typing into a seat's terminal and opening an attach or console session on it, after authorization. */
|
|
27
|
+
export declare class TerminalInput {
|
|
28
|
+
private readonly deps;
|
|
29
|
+
constructor(deps: TerminalInputDeps);
|
|
30
|
+
private get agents();
|
|
31
|
+
private get auth();
|
|
32
|
+
private get managerLifecycleUid();
|
|
33
|
+
private get sessionPlane();
|
|
34
|
+
private get wsPort();
|
|
35
|
+
private runtimeFor;
|
|
36
|
+
/** The post-authorization `input` effect (C3): type `text` into the seat's terminal as if a human
|
|
37
|
+
* had. The single call an external UI needs to deliver a harness command (`/compact`, `/clear`,
|
|
38
|
+
* `/model`) without holding a terminal open on the caller's side.
|
|
39
|
+
*
|
|
40
|
+
* Why the runtime HANDLE and not an attach session: a session is a stream (backlog, subscriber
|
|
41
|
+
* set, a lifetime the session plane accounts for and caps). Opening and discarding one per
|
|
42
|
+
* keystroke line would burn a session slot for a write, and would put a capacity refusal in the
|
|
43
|
+
* path of an operation that has no capacity cost. {@link AgentHandle.write} is the one-shot
|
|
44
|
+
* sibling of `interrupt()`, which already writes into the same pty.
|
|
45
|
+
*
|
|
46
|
+
* Three refusals, each for a different reason and each with its own code, so a caller can tell
|
|
47
|
+
* "never going to work" from "not right now":
|
|
48
|
+
* - the name was refilled while authorization awaited: act on the incarnation the caller was
|
|
49
|
+
* authorized for or on nothing at all (the same guard {@link attachAuthorized} carries, for
|
|
50
|
+
* the same reason: a name is a reusable slot and `authorizeNamed` can await a ledger read);
|
|
51
|
+
* - the agent is not running: there is no terminal to type into;
|
|
52
|
+
* - the runtime cannot write (tmux/cmux/orca/herdr attach to an externally-owned process, so
|
|
53
|
+
* they own no input stream for it): `unimplemented`, named by runtime kind. NOT a fallback
|
|
54
|
+
* to an attach session and NOT a silent success - a dropped keystroke would leave the caller
|
|
55
|
+
* believing a command was delivered that never was.
|
|
56
|
+
*
|
|
57
|
+
* `enter` defaults to true: a harness command typed but not submitted has not been delivered.
|
|
58
|
+
* Nothing is echoed back; the caller reads the resulting turns from the event plane. */
|
|
59
|
+
inputAuthorized(a: ManagedAgent, args: Record<string, unknown>): Promise<{
|
|
60
|
+
name: string;
|
|
61
|
+
bytes: number;
|
|
62
|
+
}>;
|
|
63
|
+
/** The post-authorization attach effect: mint the holder-bound §13.6 offer, redeem it
|
|
64
|
+
* through the ONE session plane (one-use CAS + presenter-equality), and stand up the PTY bridge —
|
|
65
|
+
* atomically. The reply is the SIGNED grant (no ws:// URL, non-bearer, never logged); the caller
|
|
66
|
+
* redeems it over the mesh with a per-session rails-only cred it mints itself. Only streamable
|
|
67
|
+
* backends (pty/host) attach; an external runtime's attach() throws with per-runtime guidance. */
|
|
68
|
+
attachAuthorized(a: ManagedAgent, caller: {
|
|
69
|
+
owner: string;
|
|
70
|
+
actor: string;
|
|
71
|
+
uid: string;
|
|
72
|
+
}): Promise<ControlReply>;
|
|
73
|
+
/** The console's mesh §13.6 session establisher (backing `POST /session/<name>` on the
|
|
74
|
+
* loopback face). Drives THE ONE plane — same establishAttach as the ep `attach` command — with
|
|
75
|
+
* the loopback OPERATOR as holder (same-host trust boundary), then hands the browser everything it
|
|
76
|
+
* needs to open the caller rail over the broker ws listener: the holder-bound grant, a per-session
|
|
77
|
+
* RAILS-ONLY caller cred (static mints from the seed, TTL-bound to the session; an open mesh has no
|
|
78
|
+
* credential system so the browser connects bare), and the ws URL. NO 127.0.0.1 terminal transport
|
|
79
|
+
* — the terminal rides the mesh session. Injected only when a wsPort exists (see the constructor). */
|
|
80
|
+
establishConsoleSession(name: string): Promise<SessionEstablishment>;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=terminal-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-input.d.ts","sourceRoot":"","sources":["../src/terminal-input.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AASpD;;;;kGAIkG;AAClG,eAAO,MAAM,WAAW,gBAAc,CAAC;AAEvC,eAAO,MAAM,SAAS,gBAAc,CAAC;AAErC;;wFAEwF;AACxF,eAAO,MAAM,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