@amalgm/shell 0.1.152 → 0.1.154
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/PURPOSE.md +21 -2
- package/README.md +7 -0
- package/dist/automations-cli-host.d.ts +4 -0
- package/dist/automations-cli-host.js +12 -0
- package/dist/automations-cli-host.js.map +1 -0
- package/dist/cli.js +31 -2
- package/dist/cli.js.map +1 -1
- package/dist/detection/portable.js +27 -16
- package/dist/detection/portable.js.map +1 -1
- package/dist/machine-host.d.ts +3 -0
- package/dist/machine-host.js +15 -4
- package/dist/machine-host.js.map +1 -1
- package/dist/platform-product-host.d.ts +2 -1
- package/dist/platform-product-host.js +1 -1
- package/dist/platform-product-host.js.map +1 -1
- package/dist/runtime-command-host.d.ts +6 -0
- package/dist/runtime-command-host.js +19 -2
- package/dist/runtime-command-host.js.map +1 -1
- package/dist/user-ground-host.d.ts +9 -1
- package/dist/user-ground-host.js +38 -11
- package/dist/user-ground-host.js.map +1 -1
- package/npm-shrinkwrap.json +10 -11
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-product-host.js","sourceRoot":"","sources":["../src/platform-product-host.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,6BAA6B,EAC7B,uBAAuB,
|
|
1
|
+
{"version":3,"file":"platform-product-host.js","sourceRoot":"","sources":["../src/platform-product-host.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,6BAA6B,EAC7B,uBAAuB,GAIxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAuC,MAAM,kBAAkB,CAAC;AAyB7F,MAAM,UAAU,yBAAyB,CAAC,OAAmC;IAC3E,MAAM,WAAW,GAAG,sBAAsB,CAAC;QACzC,OAAO,EAAE,OAAO,CAAC,kBAAkB;QACnC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,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AAE,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACrD,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ;WAC7C,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,SAAS;WACjD,MAAM,CAAC,MAAM,CAAC,KAAgC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -14,6 +14,10 @@ export interface RuntimeCommandStatus {
|
|
|
14
14
|
readonly pid: number | null;
|
|
15
15
|
readonly port: number | null;
|
|
16
16
|
}
|
|
17
|
+
export interface RuntimeCommandConnection {
|
|
18
|
+
readonly runtimeUrl: string;
|
|
19
|
+
readonly runtimeToken: string;
|
|
20
|
+
}
|
|
17
21
|
/** Publish the loopback address only after the watching runtime is ready. */
|
|
18
22
|
export declare function publishRuntimeCommands(input: RuntimeCommandPublication): void;
|
|
19
23
|
/** Remove only the discovery document owned by this exact runtime token. */
|
|
@@ -23,5 +27,7 @@ export declare function unpublishRuntimeCommands(input: RuntimeCommandPublicatio
|
|
|
23
27
|
* composed services are accepting requests. This probe is read-only so a UI
|
|
24
28
|
* may adopt a runtime it did not start. */
|
|
25
29
|
export declare function inspectRuntimeCommands(input: RuntimeCommandAddress): Promise<RuntimeCommandStatus>;
|
|
30
|
+
/** Resolve the authenticated loopback endpoint for a service-owned CLI adapter. */
|
|
31
|
+
export declare function runtimeCommandConnection(input: RuntimeCommandAddress): RuntimeCommandConnection;
|
|
26
32
|
/** Call the one running Files runtime. The CLI owns no Files effects. */
|
|
27
33
|
export declare function callRuntimeCommand(input: RuntimeCommandAddress, path: "/entities/register" | "/entities/add", body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
@@ -61,6 +61,20 @@ export async function inspectRuntimeCommands(input) {
|
|
|
61
61
|
return { published: true, running: false, pid, port };
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
+
/** Resolve the authenticated loopback endpoint for a service-owned CLI adapter. */
|
|
65
|
+
export function runtimeCommandConnection(input) {
|
|
66
|
+
const files = commandFiles(input);
|
|
67
|
+
const state = readJson(files.state);
|
|
68
|
+
const label = coerceRuntimeLabel(input.runtimeLabel);
|
|
69
|
+
if (!state
|
|
70
|
+
|| state.runtime_label !== label
|
|
71
|
+
|| state.user_scope !== input.userScope) {
|
|
72
|
+
throw runtimeUnavailable(input.userScope);
|
|
73
|
+
}
|
|
74
|
+
const port = validPort(state.ports?.[FILES_PORT]);
|
|
75
|
+
const runtimeToken = required(readJson(files.token)?.token, "runtime token");
|
|
76
|
+
return { runtimeUrl: `http://127.0.0.1:${port}`, runtimeToken };
|
|
77
|
+
}
|
|
64
78
|
/** Call the one running Files runtime. The CLI owns no Files effects. */
|
|
65
79
|
export async function callRuntimeCommand(input, path, body) {
|
|
66
80
|
const files = commandFiles(input);
|
|
@@ -69,7 +83,7 @@ export async function callRuntimeCommand(input, path, body) {
|
|
|
69
83
|
if (!state
|
|
70
84
|
|| state.runtime_label !== label
|
|
71
85
|
|| state.user_scope !== input.userScope) {
|
|
72
|
-
throw
|
|
86
|
+
throw runtimeUnavailable(input.userScope);
|
|
73
87
|
}
|
|
74
88
|
const token = required(readJson(files.token)?.token, "runtime token");
|
|
75
89
|
const port = validPort(state.ports?.[FILES_PORT]);
|
|
@@ -78,7 +92,7 @@ export async function callRuntimeCommand(input, path, body) {
|
|
|
78
92
|
response = await postRuntimeCommand(port, path, token, body);
|
|
79
93
|
}
|
|
80
94
|
catch {
|
|
81
|
-
throw
|
|
95
|
+
throw runtimeUnavailable(input.userScope);
|
|
82
96
|
}
|
|
83
97
|
let payload = null;
|
|
84
98
|
try {
|
|
@@ -177,4 +191,7 @@ function required(value, label) {
|
|
|
177
191
|
throw new Error(`${label} is missing`);
|
|
178
192
|
return text;
|
|
179
193
|
}
|
|
194
|
+
function runtimeUnavailable(userScope) {
|
|
195
|
+
return new Error(`Amalgm runtime is not running for ${userScope}. Start it with \`amalgm run --user ${userScope}\`.`);
|
|
196
|
+
}
|
|
180
197
|
//# sourceMappingURL=runtime-command-host.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-command-host.js","sourceRoot":"","sources":["../src/runtime-command-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,UAAU,GAAG,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime-command-host.js","sourceRoot":"","sources":["../src/runtime-command-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,UAAU,GAAG,YAAY,CAAC;AAqChC,6EAA6E;AAC7E,MAAM,UAAU,sBAAsB,CAAC,KAAgC;IACrE,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACrD,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,eAAe,CAAC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K,EAAE,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC;AACpF,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,MAAM,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,KAAa;IAC7C,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,aAAa,CAAC,CAAC;IAClD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,kBAAkB,CAAC,SAAiB;IAC3C,OAAO,IAAI,KAAK,CAAC,qCAAqC,SAAS,uCAAuC,SAAS,KAAK,CAAC,CAAC;AACxH,CAAC"}
|
|
@@ -210,7 +210,15 @@ export declare class UserGroundHost {
|
|
|
210
210
|
* contains only through delivered results may still file unchanged
|
|
211
211
|
* descendants under the root that used to hold it, so that root's records
|
|
212
212
|
* join the base and the fold reruns until no probe widens it. Leaf results
|
|
213
|
-
* travel whole and never probe.
|
|
213
|
+
* travel whole and never probe.
|
|
214
|
+
*
|
|
215
|
+
* The published base is already the repository parcel projection; the tail
|
|
216
|
+
* is not. A result that turns a container into a repository says nothing
|
|
217
|
+
* about that container's snapshot children, which now ride in its parcel.
|
|
218
|
+
* Probing reads the unprojected fold so a spine the tail moved still widens
|
|
219
|
+
* through its old root, and the settled fold then passes through the one
|
|
220
|
+
* projection publication uses — no reader ever selects a graph the parcel
|
|
221
|
+
* law would not publish. */
|
|
214
222
|
private foldScopedPrefix;
|
|
215
223
|
/** Read one graph page by identity: cached pages come off local disk, the
|
|
216
224
|
* rest are fetched straight from content storage and cached on the way in.
|
package/dist/user-ground-host.js
CHANGED
|
@@ -3,7 +3,7 @@ import { existsSync, lstatSync, realpathSync, readFileSync, readdirSync, readlin
|
|
|
3
3
|
import { open, readFile } from "node:fs/promises";
|
|
4
4
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
5
5
|
import { buildUserHomeManifest, buildUserManifest, liveMachineStateDir, scopedAmalgmDir, shippedUserHomeDeclaration, } from "@amalgm/core/identity";
|
|
6
|
-
import { CHUNK_BYTES, CONTENT_CONTRACT, INLINE_CARGO_MAX_BYTES, ENTITY_CLOUD_CONTRACT, ENTITY_CLOUD_SCHEMA_VERSION, artifactForRecord, canonicalVersion, checkContentManifest, classifyDirectory, classifyFile, classifyRegisteredRoot, containedRecords, createLocalEntityRecord, createEntityRecordAuthorityPort, convergeUserGround, decodeAcceptedEntityRecord, deriveUploadManifest, createUserGroundEnrollmentPolicy, isRepositoryMetadataEntry, indexRepositoryTerritory, downloadAll as downloadAllArtifacts, encodeEntityRecord, EntityApplyRail, EntityRecordRail, membershipHash, materializedSlotNames, pathIsSuspect, CONTENT_REFS_BATCH_OBJECTS, privateEntityResourceId, repositoryIdentityHash, sameRecords, snapshotFromRecords, stableJson, streamCargo, travelingRecords, upload as uploadArtifact, userGroundRecords, portableFileMode, GRAPH_HEAD_OPERATION_KIND, } from "@amalgm/live";
|
|
6
|
+
import { CHUNK_BYTES, CONTENT_CONTRACT, INLINE_CARGO_MAX_BYTES, ENTITY_CLOUD_CONTRACT, ENTITY_CLOUD_SCHEMA_VERSION, artifactForRecord, canonicalVersion, checkContentManifest, classifyDirectory, classifyFile, classifyRegisteredRoot, containedRecords, ContentPlacementChangedError, createLocalEntityRecord, createEntityRecordAuthorityPort, convergeUserGround, decodeAcceptedEntityRecord, deriveUploadManifest, createUserGroundEnrollmentPolicy, isRepositoryMetadataEntry, indexRepositoryTerritory, downloadAll as downloadAllArtifacts, encodeEntityRecord, EntityApplyRail, EntityRecordRail, membershipHash, materializedSlotNames, pathIsSuspect, CONTENT_REFS_BATCH_OBJECTS, privateEntityResourceId, repositoryIdentityHash, sameRecords, snapshotFromRecords, stableJson, streamCargo, travelingRecords, travelingRecordUUIDs, upload as uploadArtifact, userGroundRecords, portableFileMode, GRAPH_HEAD_OPERATION_KIND, } from "@amalgm/live";
|
|
7
7
|
import Database from "better-sqlite3";
|
|
8
8
|
import { atomicCopy, atomicWrite, ensurePrivateDir, ensureUserDir } from "./filesystem.js";
|
|
9
9
|
import { emitFilesStage, } from "./files-observability.js";
|
|
@@ -1324,7 +1324,15 @@ export class UserGroundHost {
|
|
|
1324
1324
|
* contains only through delivered results may still file unchanged
|
|
1325
1325
|
* descendants under the root that used to hold it, so that root's records
|
|
1326
1326
|
* join the base and the fold reruns until no probe widens it. Leaf results
|
|
1327
|
-
* travel whole and never probe.
|
|
1327
|
+
* travel whole and never probe.
|
|
1328
|
+
*
|
|
1329
|
+
* The published base is already the repository parcel projection; the tail
|
|
1330
|
+
* is not. A result that turns a container into a repository says nothing
|
|
1331
|
+
* about that container's snapshot children, which now ride in its parcel.
|
|
1332
|
+
* Probing reads the unprojected fold so a spine the tail moved still widens
|
|
1333
|
+
* through its old root, and the settled fold then passes through the one
|
|
1334
|
+
* projection publication uses — no reader ever selects a graph the parcel
|
|
1335
|
+
* law would not publish. */
|
|
1328
1336
|
async foldScopedPrefix(base, accepted, boundaryId) {
|
|
1329
1337
|
if (accepted.length === 0)
|
|
1330
1338
|
return base;
|
|
@@ -1333,14 +1341,14 @@ export class UserGroundHost {
|
|
|
1333
1341
|
throw new Error("cloud state is unavailable for a registry lookup");
|
|
1334
1342
|
const probed = new Set(base.map((record) => record.uuid));
|
|
1335
1343
|
let widened = base;
|
|
1344
|
+
let folded = recordsAtDeliveryPrefix(widened, accepted);
|
|
1336
1345
|
for (;;) {
|
|
1337
|
-
const folded = recordsAtDeliveryPrefix(widened, accepted);
|
|
1338
1346
|
const probes = containedRecords(folded, boundaryId)
|
|
1339
1347
|
.filter((record) => !probed.has(record.uuid)
|
|
1340
1348
|
&& (record.type === "workspace" || record.type === "folder" || record.type === "repo.git"))
|
|
1341
1349
|
.map((record) => record.uuid);
|
|
1342
1350
|
if (probes.length === 0)
|
|
1343
|
-
|
|
1351
|
+
break;
|
|
1344
1352
|
for (const uuid of probes)
|
|
1345
1353
|
probed.add(uuid);
|
|
1346
1354
|
const located = await graph.membership(new Set(probes));
|
|
@@ -1351,9 +1359,11 @@ export class UserGroundHost {
|
|
|
1351
1359
|
}
|
|
1352
1360
|
}
|
|
1353
1361
|
if (merged.size === widened.length)
|
|
1354
|
-
|
|
1362
|
+
break;
|
|
1355
1363
|
widened = [...merged.values()];
|
|
1364
|
+
folded = recordsAtDeliveryPrefix(widened, accepted);
|
|
1356
1365
|
}
|
|
1366
|
+
return travelingRecords(folded, sha256Hex);
|
|
1357
1367
|
}
|
|
1358
1368
|
/** Read one graph page by identity: cached pages come off local disk, the
|
|
1359
1369
|
* rest are fetched straight from content storage and cached on the way in.
|
|
@@ -1913,8 +1923,9 @@ export class UserGroundHost {
|
|
|
1913
1923
|
// straight from content storage over a presigned URL and opened
|
|
1914
1924
|
// locally; the engine plans whole waves against these primitives, so
|
|
1915
1925
|
// the wire carries only the key handoff and batched refs requests. A
|
|
1916
|
-
// retried read refreshes its URL
|
|
1917
|
-
//
|
|
1926
|
+
// retried read refreshes its URL in place. If physical placement moved,
|
|
1927
|
+
// Live discards every ref derived from that stale geometry and boundedly
|
|
1928
|
+
// replans the unresolved set; content identity remains immutable.
|
|
1918
1929
|
const { receipts, shape } = await downloadAllArtifacts([...unique.values()].map((want) => want.artifact), {
|
|
1919
1930
|
sha256Hex: timedSha256Hex,
|
|
1920
1931
|
localManifest: (artifact) => legs.timeSync("planMs", () => {
|
|
@@ -1937,9 +1948,12 @@ export class UserGroundHost {
|
|
|
1937
1948
|
signed = await refresh();
|
|
1938
1949
|
}
|
|
1939
1950
|
catch (error) {
|
|
1940
|
-
// A moved placement
|
|
1941
|
-
//
|
|
1942
|
-
//
|
|
1951
|
+
// A moved placement is a set-planning signal owned by Live,
|
|
1952
|
+
// not a permanent wire failure. Preserve it across the host
|
|
1953
|
+
// retry boundary so the whole unresolved set can replan.
|
|
1954
|
+
if (error instanceof ContentPlacementChangedError)
|
|
1955
|
+
throw error;
|
|
1956
|
+
// A refused re-resolution is not a transient byte fetch.
|
|
1943
1957
|
throw new WireRequestError({
|
|
1944
1958
|
type: "shared.error",
|
|
1945
1959
|
code: "entity_content_moved",
|
|
@@ -5481,11 +5495,20 @@ async function reconcileRoot(input) {
|
|
|
5481
5495
|
.map((row) => row.uuid);
|
|
5482
5496
|
const before = existingRows.map(portableRecord);
|
|
5483
5497
|
const beforeByUuid = new Map(before.map((record) => [record.uuid, record]));
|
|
5498
|
+
const afterLogicalRecords = [
|
|
5499
|
+
...rows.map((row) => row.record),
|
|
5500
|
+
...retainedMissingRows.map(portableRecord),
|
|
5501
|
+
];
|
|
5502
|
+
const beforeTraveling = travelingRecordUUIDs(before);
|
|
5503
|
+
const afterTraveling = travelingRecordUUIDs(afterLogicalRecords);
|
|
5484
5504
|
const entryByUuid = new Map(entries.map((entry) => [entry.uuid, entry]));
|
|
5485
5505
|
// Replays exist to mint Send records; a scan that plans none builds none —
|
|
5486
5506
|
// and its walk staged no cache bytes for replays to read.
|
|
5487
5507
|
const detected = !plansSendRecords ? [] : rows.map((row) => {
|
|
5488
|
-
const
|
|
5508
|
+
const localBase = beforeByUuid.get(row.record.uuid) ?? null;
|
|
5509
|
+
const becameTraveling = !beforeTraveling.has(row.record.uuid)
|
|
5510
|
+
&& afterTraveling.has(row.record.uuid);
|
|
5511
|
+
const base = becameTraveling ? null : localBase;
|
|
5489
5512
|
const entry = entryByUuid.get(row.record.uuid);
|
|
5490
5513
|
if (row.record.type !== "repo.git" && entry && territory.ownerOf(entry)) {
|
|
5491
5514
|
return {
|
|
@@ -6530,6 +6553,10 @@ async function retryContent(operation, eventualNotFound = false, attempts = 10)
|
|
|
6530
6553
|
}
|
|
6531
6554
|
catch (error) {
|
|
6532
6555
|
last = error;
|
|
6556
|
+
// Physical geometry moved. The current fetch unit and every sibling ref
|
|
6557
|
+
// came from one stale plan, so only Live's outer set loop may retry it.
|
|
6558
|
+
if (error instanceof ContentPlacementChangedError)
|
|
6559
|
+
throw error;
|
|
6533
6560
|
if (error instanceof WireRequestError
|
|
6534
6561
|
&& !error.retryable
|
|
6535
6562
|
&& !(eventualNotFound && error.code === "entity_content_not_found"))
|