@amalgm/apps 0.1.3-preview.34562094191 → 0.1.3-preview.35153911192
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/README.md +2 -0
- package/dist/apps.d.ts +11 -4
- package/dist/apps.js +57 -64
- package/dist/apps.js.map +1 -1
- package/dist/cli.js +0 -2
- package/dist/cli.js.map +1 -1
- package/dist/command-input.d.ts +2 -3
- package/dist/command-input.js +2 -6
- package/dist/command-input.js.map +1 -1
- package/dist/command-surface.d.ts +1 -1
- package/dist/command-surface.js +1 -26
- package/dist/command-surface.js.map +1 -1
- package/dist/construct-surface.d.ts +31 -0
- package/dist/construct-surface.js +128 -0
- package/dist/construct-surface.js.map +1 -0
- package/dist/construct.d.ts +90 -0
- package/dist/construct.js +75 -0
- package/dist/construct.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/releases.d.ts +8 -1
- package/dist/releases.js +39 -1
- package/dist/releases.js.map +1 -1
- package/dist/schema.js +10 -0
- package/dist/schema.js.map +1 -1
- package/dist/store.d.ts +2 -2
- package/dist/store.js +2 -0
- package/dist/store.js.map +1 -1
- package/dist/types.d.ts +5 -21
- package/docs/STATUS.md +73 -0
- package/package.json +4 -4
- package/dist/portable.d.ts +0 -15
- package/dist/portable.js +0 -78
- package/dist/portable.js.map +0 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rails seam for apps: the access verbs sharing calls, and the Apply half
|
|
3
|
+
* the host drives when a version arrives. One object, because both halves are
|
|
4
|
+
* the same question — what this computer holds for an app UUID, and what it
|
|
5
|
+
* does when that changes. Everything here is the product's own call; the
|
|
6
|
+
* rails decide when to ask, never how an app is built or run.
|
|
7
|
+
*/
|
|
8
|
+
import fs from 'node:fs';
|
|
9
|
+
import { packPackage, unpackPackage } from './package.js';
|
|
10
|
+
import { allocateImportDir, constructIdentity, decodeConstructPayload, dependencyUuids, encodeConstructPayload, isImportedSource, } from './construct.js';
|
|
11
|
+
export function appConstructSurface(service) {
|
|
12
|
+
return Object.freeze({
|
|
13
|
+
resolve: async (ref) => resolve(service, ref),
|
|
14
|
+
dependencies: async (appId) => dependencies(service, appId),
|
|
15
|
+
copy: (appId) => copy(service, appId),
|
|
16
|
+
trash: (appId) => service.delete(appId).then(() => undefined),
|
|
17
|
+
inspect: async (entityId) => holding(service, entityId),
|
|
18
|
+
payloadDependencies: async (payloadFile) => payloadDependencies(payloadFile),
|
|
19
|
+
switchTo: (input) => switchTo(service, input),
|
|
20
|
+
applyStructure: (input) => applyStructure(service, input),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** Name one app as a person does: by its UUID, or by its display name. */
|
|
24
|
+
function resolve(service, ref) {
|
|
25
|
+
const byId = service.store.getApp(ref);
|
|
26
|
+
if (byId)
|
|
27
|
+
return constructIdentity(byId);
|
|
28
|
+
const named = service.store.listApps().filter((app) => app.name === ref);
|
|
29
|
+
if (named.length > 1)
|
|
30
|
+
throw new Error(`More than one app is named ${ref}; name it by id`);
|
|
31
|
+
if (!named[0])
|
|
32
|
+
throw new Error(`App not found: ${ref}`);
|
|
33
|
+
return constructIdentity(named[0]);
|
|
34
|
+
}
|
|
35
|
+
/** The constructs this app needs: the tools its running manifest names. */
|
|
36
|
+
function dependencies(service, appId) {
|
|
37
|
+
const app = service.store.getApp(appId);
|
|
38
|
+
if (!app)
|
|
39
|
+
throw new Error(`App not found: ${appId}`);
|
|
40
|
+
const release = app.activeReleaseId ? service.store.getRelease(app.activeReleaseId) : null;
|
|
41
|
+
return release ? dependencyUuids(release.manifest) : [];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The app again under a fresh UUID, recorded here as a new app of its own. A
|
|
45
|
+
* copy exists to be sent, not to run twice on this computer, so it is left
|
|
46
|
+
* stopped and off the route table. Its closure is the tool constructs its
|
|
47
|
+
* manifest names, and a tool carries a slug until tools are constructs
|
|
48
|
+
* themselves, so today there is nothing below the head to re-mint.
|
|
49
|
+
*/
|
|
50
|
+
async function copy(service, appId) {
|
|
51
|
+
const app = service.store.getApp(appId);
|
|
52
|
+
if (!app)
|
|
53
|
+
throw new Error(`App not found: ${appId}`);
|
|
54
|
+
const directory = allocateImportDir(service.stateDir, app.name);
|
|
55
|
+
unpackPackage(packPackage(app.sourceDir), directory);
|
|
56
|
+
const copied = await service.create({ cwd: directory, autostart: false, connectDns: false }, { intentional: true });
|
|
57
|
+
await service.stop(copied.id);
|
|
58
|
+
return constructIdentity(copied);
|
|
59
|
+
}
|
|
60
|
+
/** What this computer runs for one construct: the only Apply truth. */
|
|
61
|
+
function holding(service, entityId) {
|
|
62
|
+
const app = service.store.getApp(entityId);
|
|
63
|
+
return { version: app?.constructVersion ?? null, present: Boolean(app) };
|
|
64
|
+
}
|
|
65
|
+
/** The UUIDs a received payload names, before this computer may run it. */
|
|
66
|
+
function payloadDependencies(payloadFile) {
|
|
67
|
+
return dependencyUuids(decodeConstructPayload(fs.readFileSync(payloadFile)).manifest);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Run a version that arrived on the rails. The switch is this product's call
|
|
71
|
+
* to make; the change itself is its owner's deliberate act, already recorded
|
|
72
|
+
* by them, so nothing here reaches the door again.
|
|
73
|
+
*/
|
|
74
|
+
async function switchTo(service, input) {
|
|
75
|
+
const received = decodeConstructPayload(fs.readFileSync(input.payloadFile));
|
|
76
|
+
const existing = service.store.getApp(input.entityId);
|
|
77
|
+
const directory = existing && isImportedSource(service.stateDir, existing.sourceDir)
|
|
78
|
+
? existing.sourceDir
|
|
79
|
+
: allocateImportDir(service.stateDir, received.manifest.name);
|
|
80
|
+
unpackPackage(received, directory);
|
|
81
|
+
const origin = { received: input.version };
|
|
82
|
+
// Nothing is answered here: what this computer now runs is a question for
|
|
83
|
+
// the product, and the host asks it again when it verifies the switch.
|
|
84
|
+
if (!existing) {
|
|
85
|
+
await service.create({ id: input.entityId, cwd: directory }, origin);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
await service.operations.run(input.entityId, 'deploy', () => (service.deployFrom(input.entityId, directory, origin)));
|
|
89
|
+
}
|
|
90
|
+
/** A received change where only the named fields moved. */
|
|
91
|
+
async function applyStructure(service, input) {
|
|
92
|
+
const app = service.store.getApp(input.entityId);
|
|
93
|
+
// Nothing here holds it, so a delete is already true and a rename has
|
|
94
|
+
// nothing to rename; the payload that arrives later carries the name.
|
|
95
|
+
if (!app)
|
|
96
|
+
return;
|
|
97
|
+
if (input.status === 'deleted') {
|
|
98
|
+
await service.operations.run(input.entityId, 'delete', () => service.remove(input.entityId));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (app.name !== input.name) {
|
|
102
|
+
service.changed(service.store.updateApp(input.entityId, { name: input.name }));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Name the version this app now runs, and record the deliberate change that
|
|
107
|
+
* made it. The version is stored before the door is called, so this
|
|
108
|
+
* computer's report of what it runs is true even if the record cannot be
|
|
109
|
+
* written; a received version records nothing, because the act was not here.
|
|
110
|
+
*/
|
|
111
|
+
export async function promoteConstruct(service, app, cwd, origin) {
|
|
112
|
+
if ('received' in origin)
|
|
113
|
+
return ranVersion(service, app.id, origin.received);
|
|
114
|
+
const payload = encodeConstructPayload(packPackage(cwd));
|
|
115
|
+
const promoted = ranVersion(service, app.id, payload.version);
|
|
116
|
+
await recordConstruct(service, {
|
|
117
|
+
entityId: app.id, name: promoted.name, status: 'active', payload,
|
|
118
|
+
});
|
|
119
|
+
return promoted;
|
|
120
|
+
}
|
|
121
|
+
function ranVersion(service, appId, version) {
|
|
122
|
+
return service.store.updateApp(appId, { constructVersion: version });
|
|
123
|
+
}
|
|
124
|
+
/** The host's intentional door, when a signed-in runtime holds the rails. */
|
|
125
|
+
export async function recordConstruct(service, change) {
|
|
126
|
+
await service.options.recordConstruct?.(change);
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=construct-surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"construct-surface.js","sourceRoot":"","sources":["../src/construct-surface.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAuBxB,MAAM,UAAU,mBAAmB,CAAC,OAAa;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,KAAK,EAAE,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;QACrD,YAAY,EAAE,KAAK,EAAE,KAAa,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;QACnE,IAAI,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC;QAC7C,KAAK,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;QACrE,OAAO,EAAE,KAAK,EAAE,QAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC/D,mBAAmB,EAAE,KAAK,EAAE,WAAmB,EAAE,EAAE,CAAC,mBAAmB,CAAC,WAAW,CAAC;QACpF,QAAQ,EAAE,CAAC,KAAsB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;QAC9D,cAAc,EAAE,CAAC,KAAwB,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC;KAC7E,CAAC,CAAC;AACL,CAAC;AAED,0EA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AAM,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An app as a construct on the rails.
|
|
3
|
+
*
|
|
4
|
+
* An app is an entity whose UUID is its id: the same id names the app here,
|
|
5
|
+
* the permission scope, and the realtime channel. Its payload is this
|
|
6
|
+
* product's own serialization — the packed package, exactly the files a
|
|
7
|
+
* machine needs to run it — and the payload version is the hash of those
|
|
8
|
+
* bytes, so the same source always names the same version and the rails can
|
|
9
|
+
* address the bytes by content. The rails never open the payload; Apps does.
|
|
10
|
+
*/
|
|
11
|
+
import type { AppManifest, PackedPackage } from './types.js';
|
|
12
|
+
/** The serialized app, and the version naming those exact bytes. */
|
|
13
|
+
export interface ConstructPayload {
|
|
14
|
+
readonly bytes: Buffer;
|
|
15
|
+
readonly version: string;
|
|
16
|
+
}
|
|
17
|
+
/** What a received payload carries: the app, ready to materialize. */
|
|
18
|
+
export interface ConstructPackage {
|
|
19
|
+
readonly manifest: AppManifest;
|
|
20
|
+
readonly files: PackedPackage['files'];
|
|
21
|
+
}
|
|
22
|
+
/** One deliberate change to one app, as the intentional door needs it. */
|
|
23
|
+
export interface ConstructChange {
|
|
24
|
+
/** The app's id, which is the entity UUID. */
|
|
25
|
+
readonly entityId: string;
|
|
26
|
+
readonly name: string;
|
|
27
|
+
/** `deleted` is a tombstone; Apps keeps no trashed state of its own. */
|
|
28
|
+
readonly status: 'active' | 'deleted';
|
|
29
|
+
/** Null when only the named fields moved, so no bytes need to travel. */
|
|
30
|
+
readonly payload: ConstructPayload | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The host's intentional-change door. Apps calls it once per deliberate act
|
|
34
|
+
* and never writes a record itself. It is absent until a signed-in runtime
|
|
35
|
+
* holds the rails; an app created without one is local to this computer.
|
|
36
|
+
*/
|
|
37
|
+
export type RecordConstruct = (change: ConstructChange) => Promise<void>;
|
|
38
|
+
/** An app as the access commands name it. */
|
|
39
|
+
export interface ConstructIdentity {
|
|
40
|
+
readonly kind: 'app';
|
|
41
|
+
readonly id: string;
|
|
42
|
+
readonly name: string;
|
|
43
|
+
}
|
|
44
|
+
/** Name one app the way the access commands do. */
|
|
45
|
+
export declare function constructIdentity(app: {
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly name: string;
|
|
48
|
+
}): ConstructIdentity;
|
|
49
|
+
/** A received payload this computer is asked to switch to. */
|
|
50
|
+
export interface ConstructSwitch {
|
|
51
|
+
readonly entityId: string;
|
|
52
|
+
/** The proven cache file the host fetched the payload into. */
|
|
53
|
+
readonly payloadFile: string;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
/** The version the record names: what this computer will be running. */
|
|
56
|
+
readonly version: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Where a version came from. An intentional change is packed from a source
|
|
60
|
+
* directory here and recorded on the rails; a received one already is, and
|
|
61
|
+
* carries the version its owner recorded.
|
|
62
|
+
*/
|
|
63
|
+
export type ConstructOrigin = {
|
|
64
|
+
readonly intentional: true;
|
|
65
|
+
} | {
|
|
66
|
+
readonly received: string;
|
|
67
|
+
};
|
|
68
|
+
/** A received change where only the named fields moved. */
|
|
69
|
+
export interface SwitchedStructure {
|
|
70
|
+
readonly entityId: string;
|
|
71
|
+
readonly name: string;
|
|
72
|
+
readonly status: 'active' | 'deleted';
|
|
73
|
+
}
|
|
74
|
+
/** What this computer is running for one construct: the only Apply truth. */
|
|
75
|
+
export interface ConstructHolding {
|
|
76
|
+
/** The payload version this computer runs; null when it holds none. */
|
|
77
|
+
readonly version: string | null;
|
|
78
|
+
readonly present: boolean;
|
|
79
|
+
}
|
|
80
|
+
/** Serialize a packed app into the bytes the rails carry. */
|
|
81
|
+
export declare function encodeConstructPayload(packed: PackedPackage): ConstructPayload;
|
|
82
|
+
/** Read a received payload. Its files are proven again when materialized. */
|
|
83
|
+
export declare function decodeConstructPayload(bytes: Uint8Array | string): ConstructPackage;
|
|
84
|
+
/** The UUIDs this app depends on: the tool constructs its manifest names. */
|
|
85
|
+
export declare function dependencyUuids(manifest: AppManifest): string[];
|
|
86
|
+
/** Where a received app's files live. A created app's source is the user's own. */
|
|
87
|
+
export declare function importsRoot(stateDir: string): string;
|
|
88
|
+
/** An imported source leaves with its app; the user's own directory never does. */
|
|
89
|
+
export declare function isImportedSource(stateDir: string, sourceDir: string): boolean;
|
|
90
|
+
export declare function allocateImportDir(stateDir: string, name: unknown): string;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An app as a construct on the rails.
|
|
3
|
+
*
|
|
4
|
+
* An app is an entity whose UUID is its id: the same id names the app here,
|
|
5
|
+
* the permission scope, and the realtime channel. Its payload is this
|
|
6
|
+
* product's own serialization — the packed package, exactly the files a
|
|
7
|
+
* machine needs to run it — and the payload version is the hash of those
|
|
8
|
+
* bytes, so the same source always names the same version and the rails can
|
|
9
|
+
* address the bytes by content. The rails never open the payload; Apps does.
|
|
10
|
+
*/
|
|
11
|
+
import crypto from 'node:crypto';
|
|
12
|
+
import fs from 'node:fs';
|
|
13
|
+
import path from 'node:path';
|
|
14
|
+
const PAYLOAD_SCHEMA = 1;
|
|
15
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
16
|
+
/** Name one app the way the access commands do. */
|
|
17
|
+
export function constructIdentity(app) {
|
|
18
|
+
return { kind: 'app', id: app.id, name: app.name };
|
|
19
|
+
}
|
|
20
|
+
/** Serialize a packed app into the bytes the rails carry. */
|
|
21
|
+
export function encodeConstructPayload(packed) {
|
|
22
|
+
// Written field by field so the bytes are a function of the package alone.
|
|
23
|
+
const bytes = Buffer.from(`${JSON.stringify({
|
|
24
|
+
schema: PAYLOAD_SCHEMA,
|
|
25
|
+
manifest: packed.manifest,
|
|
26
|
+
files: packed.files.map((file) => ({
|
|
27
|
+
path: file.path,
|
|
28
|
+
executable: file.executable,
|
|
29
|
+
size: file.size,
|
|
30
|
+
sha256: file.sha256,
|
|
31
|
+
encoding: file.encoding,
|
|
32
|
+
content: file.content,
|
|
33
|
+
})),
|
|
34
|
+
})}\n`, 'utf8');
|
|
35
|
+
return { bytes, version: crypto.createHash('sha256').update(bytes).digest('hex') };
|
|
36
|
+
}
|
|
37
|
+
/** Read a received payload. Its files are proven again when materialized. */
|
|
38
|
+
export function decodeConstructPayload(bytes) {
|
|
39
|
+
const parsed = JSON.parse(typeof bytes === 'string' ? bytes : Buffer.from(bytes).toString('utf8'));
|
|
40
|
+
if (!parsed || parsed.schema !== PAYLOAD_SCHEMA) {
|
|
41
|
+
throw new Error(`Unsupported app payload schema: ${String(parsed?.schema)}`);
|
|
42
|
+
}
|
|
43
|
+
if (!parsed.manifest || typeof parsed.manifest.name !== 'string') {
|
|
44
|
+
throw new Error('App payload carries no manifest');
|
|
45
|
+
}
|
|
46
|
+
if (!Array.isArray(parsed.files) || parsed.files.length === 0) {
|
|
47
|
+
throw new Error('App payload carries no files');
|
|
48
|
+
}
|
|
49
|
+
return { manifest: parsed.manifest, files: parsed.files };
|
|
50
|
+
}
|
|
51
|
+
/** The UUIDs this app depends on: the tool constructs its manifest names. */
|
|
52
|
+
export function dependencyUuids(manifest) {
|
|
53
|
+
return manifest.toolIds.filter((id) => UUID.test(id));
|
|
54
|
+
}
|
|
55
|
+
/** Where a received app's files live. A created app's source is the user's own. */
|
|
56
|
+
export function importsRoot(stateDir) {
|
|
57
|
+
return path.join(stateDir, 'imports');
|
|
58
|
+
}
|
|
59
|
+
/** An imported source leaves with its app; the user's own directory never does. */
|
|
60
|
+
export function isImportedSource(stateDir, sourceDir) {
|
|
61
|
+
return path.dirname(path.resolve(sourceDir)) === importsRoot(stateDir);
|
|
62
|
+
}
|
|
63
|
+
export function allocateImportDir(stateDir, name) {
|
|
64
|
+
const root = importsRoot(stateDir);
|
|
65
|
+
fs.mkdirSync(root, { recursive: true });
|
|
66
|
+
const base = String(name || 'app').toLowerCase().replace(/[^a-z0-9._-]+/g, '-')
|
|
67
|
+
.replace(/^-+|-+$/g, '').slice(0, 60) || 'app';
|
|
68
|
+
for (let index = 0; index < 1000; index += 1) {
|
|
69
|
+
const candidate = path.join(root, index ? `${base}-${index + 1}` : base);
|
|
70
|
+
if (!fs.existsSync(candidate))
|
|
71
|
+
return candidate;
|
|
72
|
+
}
|
|
73
|
+
throw new Error(`Could not allocate an install directory for app: ${String(name)}`);
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=construct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"construct.js","sourceRoot":"","sources":["../src/construct.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,gEAAgE,CAAC;AAuC9E,mDAAmD;AACnD,MAAM,UAAU,iBAAiB,CAAC,GAAmD;IACnF,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;AACrD,CAAC;AAiCD,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CAAC,MAAqB;IAC1D,2EAA2E;IAC3E,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QAC1C,MAAM,EAAE,cAAc;QACtB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACjC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IA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AAO,SAAS,CAAC;IAClD,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,oDAAoD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ export { Apps } from './apps.js';
|
|
|
2
2
|
export { runCli } from './cli.js';
|
|
3
3
|
export { appCommandDefinition, appCommandDefinitions, createAppCommands } from './command-surface.js';
|
|
4
4
|
export type { AppCommandAnnotations, AppCommandDefinition, AppCommandName, AppCommands } from './command-surface.js';
|
|
5
|
+
export { appConstructSurface } from './construct-surface.js';
|
|
6
|
+
export type { AppConstructSurface } from './construct-surface.js';
|
|
7
|
+
export { decodeConstructPayload, encodeConstructPayload } from './construct.js';
|
|
8
|
+
export type { ConstructChange, ConstructHolding, ConstructIdentity, ConstructPayload, ConstructSwitch, RecordConstruct, SwitchedStructure, } from './construct.js';
|
|
5
9
|
export { linkedToolEnvironment } from './presentation.js';
|
|
6
10
|
export * from './lease.js';
|
|
7
11
|
export { createMcpTools } from './mcp.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { Apps } from './apps.js';
|
|
2
2
|
export { runCli } from './cli.js';
|
|
3
3
|
export { appCommandDefinition, appCommandDefinitions, createAppCommands } from './command-surface.js';
|
|
4
|
+
export { appConstructSurface } from './construct-surface.js';
|
|
5
|
+
export { decodeConstructPayload, encodeConstructPayload } from './construct.js';
|
|
4
6
|
export { linkedToolEnvironment } from './presentation.js';
|
|
5
7
|
export * from './lease.js';
|
|
6
8
|
export { createMcpTools } from './mcp.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAKhF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/releases.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Apps } from './apps.js';
|
|
1
2
|
import type { Store } from './store.js';
|
|
2
3
|
import type { AppRecord, Deployment, Release, RunCommand } from './types.js';
|
|
3
4
|
interface ReleasesOptions {
|
|
@@ -22,5 +23,11 @@ declare class Releases {
|
|
|
22
23
|
createDeployment(app: AppRecord, release: Release, reason: string): Promise<Deployment>;
|
|
23
24
|
removeDeployment(deployment: Deployment | null | undefined): void;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Make a release the app's running deployment. The previous deployment is the
|
|
28
|
+
* fallback: if the new one cannot start, it is restored, so a failed version
|
|
29
|
+
* never leaves the app down.
|
|
30
|
+
*/
|
|
31
|
+
declare function activateRelease(service: Apps, app: AppRecord, release: Release, reason: string): Promise<AppRecord>;
|
|
32
|
+
export { Releases, activateRelease, releaseId };
|
|
26
33
|
export type { ReleasesOptions };
|
package/dist/releases.js
CHANGED
|
@@ -104,5 +104,43 @@ class Releases {
|
|
|
104
104
|
fs.rmSync(deployment.directory, { recursive: true, force: true });
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Make a release the app's running deployment. The previous deployment is the
|
|
109
|
+
* fallback: if the new one cannot start, it is restored, so a failed version
|
|
110
|
+
* never leaves the app down.
|
|
111
|
+
*/
|
|
112
|
+
async function activateRelease(service, app, release, reason) {
|
|
113
|
+
const previous = app.activeDeploymentId
|
|
114
|
+
? service.store.getDeployment(app.activeDeploymentId)
|
|
115
|
+
: null;
|
|
116
|
+
const deployment = await service.releases.createDeployment(app, release, reason);
|
|
117
|
+
if (previous)
|
|
118
|
+
await service.supervisor.stop(app.id, { preserveDesiredState: true });
|
|
119
|
+
service.health.forget(app.id);
|
|
120
|
+
service.store.activate(app.id, deployment.id);
|
|
121
|
+
try {
|
|
122
|
+
const activated = await service.supervisor.start(app.id);
|
|
123
|
+
if (previous)
|
|
124
|
+
service.releases.removeDeployment(previous);
|
|
125
|
+
return activated;
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
service.store.failDeployment(deployment.id, errorMessage(error));
|
|
129
|
+
service.releases.removeDeployment(deployment);
|
|
130
|
+
if (previous) {
|
|
131
|
+
service.store.activate(app.id, previous.id);
|
|
132
|
+
try {
|
|
133
|
+
await service.supervisor.start(app.id);
|
|
134
|
+
}
|
|
135
|
+
catch (restoreError) {
|
|
136
|
+
service.store.updateApp(app.id, {
|
|
137
|
+
status: 'error',
|
|
138
|
+
error: `Activation failed: ${errorMessage(error)}; restore failed: ${errorMessage(restoreError)}`,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
throw new Error(`Activation failed: ${errorMessage(error)}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
export { Releases, activateRelease, releaseId };
|
|
108
146
|
//# sourceMappingURL=releases.js.map
|
package/dist/releases.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"releases.js","sourceRoot":"","sources":["../src/releases.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"releases.js","sourceRoot":"","sources":["../src/releases.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,SAAS,SAAS,CAAC,KAAa,EAAE,MAAc;IAC9C,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,KAAK,MAAM,EAAE,CAAC,CAAC,MAA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AAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,sBAAsB,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/schema.js
CHANGED
|
@@ -23,6 +23,7 @@ function migrate(db) {
|
|
|
23
23
|
ready_at TEXT,
|
|
24
24
|
last_heartbeat_at TEXT,
|
|
25
25
|
heartbeat_interval_ms INTEGER,
|
|
26
|
+
construct_version TEXT,
|
|
26
27
|
created_at TEXT NOT NULL,
|
|
27
28
|
updated_at TEXT NOT NULL
|
|
28
29
|
);
|
|
@@ -68,6 +69,15 @@ function migrate(db) {
|
|
|
68
69
|
CREATE INDEX IF NOT EXISTS generations_app_sequence
|
|
69
70
|
ON process_generations(app_id, sequence DESC);
|
|
70
71
|
`);
|
|
72
|
+
// An installation that predates constructs has apps but no version column;
|
|
73
|
+
// its apps hold no recorded version until their next deliberate change.
|
|
74
|
+
addColumn(db, 'apps', 'construct_version', 'TEXT');
|
|
75
|
+
}
|
|
76
|
+
function addColumn(db, table, column, type) {
|
|
77
|
+
const columns = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
78
|
+
if (columns.some((existing) => existing.name === column))
|
|
79
|
+
return;
|
|
80
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${type}`);
|
|
71
81
|
}
|
|
72
82
|
export { migrate };
|
|
73
83
|
//# sourceMappingURL=schema.js.map
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAIb,SAAS,OAAO,CAAC,EAAqB;IACpC,EAAE,CAAC,IAAI,CAAC
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAIb,SAAS,OAAO,CAAC,EAAqB;IACpC,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEP,CAAC,CAAC;IACH,2EAA2E;IAC3E,wEAAwE;IACxE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,SAAS,CAAC,EAAqB,EAAE,KAAa,EAAE,MAAc,EAAE,IAAY;IACnF,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,qBAAqB,KAAK,GAAG,CAAC,CAAC,GAAG,EAA6B,CAAC;IAC3F,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC;QAAE,OAAO;IACjE,EAAE,CAAC,IAAI,CAAC,eAAe,KAAK,eAAe,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/store.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Generations } from './generations.js';
|
|
2
2
|
import type DatabaseType from 'better-sqlite3';
|
|
3
3
|
import type { AppRecord, Deployment, Release } from './types.js';
|
|
4
|
-
type AppPatch = Partial<Pick<AppRecord, 'name' | 'description' | 'sourceDir' | 'activeReleaseId' | 'activeDeploymentId' | 'activeGenerationId' | 'desiredState' | 'status' | 'pid' | 'dnsConnected' | 'autostart' | 'keepAlive' | 'error' | 'readyAt' | 'lastHeartbeatAt' | 'heartbeatIntervalMs'>>;
|
|
5
|
-
type NewApp = Omit<AppRecord, 'activeReleaseId' | 'activeDeploymentId' | 'activeGenerationId' | 'error' | 'pid' | 'readyAt' | 'lastHeartbeatAt' | 'heartbeatIntervalMs'> & Partial<Pick<AppRecord, 'description' | 'desiredState' | 'status' | 'dnsConnected' | 'autostart' | 'keepAlive'>>;
|
|
4
|
+
type AppPatch = Partial<Pick<AppRecord, 'name' | 'description' | 'sourceDir' | 'activeReleaseId' | 'activeDeploymentId' | 'activeGenerationId' | 'desiredState' | 'status' | 'pid' | 'dnsConnected' | 'autostart' | 'keepAlive' | 'error' | 'readyAt' | 'lastHeartbeatAt' | 'heartbeatIntervalMs' | 'constructVersion'>>;
|
|
5
|
+
type NewApp = Omit<AppRecord, 'activeReleaseId' | 'activeDeploymentId' | 'activeGenerationId' | 'error' | 'pid' | 'readyAt' | 'lastHeartbeatAt' | 'heartbeatIntervalMs' | 'constructVersion'> & Partial<Pick<AppRecord, 'description' | 'desiredState' | 'status' | 'dnsConnected' | 'autostart' | 'keepAlive'>>;
|
|
6
6
|
type NewRelease = Release;
|
|
7
7
|
type NewDeployment = Omit<Deployment, 'sequence' | 'status' | 'error' | 'activatedAt'>;
|
|
8
8
|
declare class Store {
|
package/dist/store.js
CHANGED
|
@@ -20,6 +20,7 @@ const APP_COLUMNS = new Map([
|
|
|
20
20
|
['readyAt', 'ready_at'],
|
|
21
21
|
['lastHeartbeatAt', 'last_heartbeat_at'],
|
|
22
22
|
['heartbeatIntervalMs', 'heartbeat_interval_ms'],
|
|
23
|
+
['constructVersion', 'construct_version'],
|
|
23
24
|
]);
|
|
24
25
|
function boolean(value) {
|
|
25
26
|
return Boolean(value);
|
|
@@ -49,6 +50,7 @@ function appRow(row) {
|
|
|
49
50
|
readyAt: row.ready_at,
|
|
50
51
|
lastHeartbeatAt: row.last_heartbeat_at,
|
|
51
52
|
heartbeatIntervalMs: row.heartbeat_interval_ms,
|
|
53
|
+
constructVersion: row.construct_version,
|
|
52
54
|
createdAt: row.created_at,
|
|
53
55
|
updatedAt: row.updated_at,
|
|
54
56
|
};
|
package/dist/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,O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CAAC,UAAU,EAAE,YAAY,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAC1D,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,cAAc,CAAC,EAAU,EAAE,KAAc;QACvC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;;KAEf,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,kBAAkB,CAAC,KAAa,EAAE,eAA8B;QAC9D,OAAO,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;;;;;KAKpC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC;IAClC,CAAC;IAED,KAAK;QACH,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;CACF;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface AppManifest {
|
|
|
16
16
|
export type DesiredState = 'running' | 'stopped';
|
|
17
17
|
export type { AppStatus };
|
|
18
18
|
export interface AppRecord {
|
|
19
|
+
/** The app's id is its construct UUID: one identity on this computer and on the rails. */
|
|
19
20
|
id: string;
|
|
20
21
|
name: string;
|
|
21
22
|
description: string;
|
|
@@ -37,6 +38,8 @@ export interface AppRecord {
|
|
|
37
38
|
readyAt: string | null;
|
|
38
39
|
lastHeartbeatAt: string | null;
|
|
39
40
|
heartbeatIntervalMs: number | null;
|
|
41
|
+
/** The payload version this computer runs, null until one is recorded. */
|
|
42
|
+
constructVersion: string | null;
|
|
40
43
|
createdAt: string;
|
|
41
44
|
updatedAt: string;
|
|
42
45
|
}
|
|
@@ -180,6 +183,8 @@ export interface AppsOptions {
|
|
|
180
183
|
spawn?: SpawnProcess;
|
|
181
184
|
store?: import('./store.js').Store;
|
|
182
185
|
ownership?: import('./ownership.js').Ownership;
|
|
186
|
+
/** The host's intentional-change door; absent until a runtime holds the rails. */
|
|
187
|
+
recordConstruct?: import('./construct.js').RecordConstruct;
|
|
183
188
|
}
|
|
184
189
|
export interface RegisterInput {
|
|
185
190
|
id?: string;
|
|
@@ -207,27 +212,6 @@ export interface AppLogs {
|
|
|
207
212
|
path: string;
|
|
208
213
|
lines: string[];
|
|
209
214
|
}
|
|
210
|
-
/** The export/install port shape. `sourceAppId` is lineage a sharing layer may strip. */
|
|
211
|
-
export interface PortableApp {
|
|
212
|
-
sourceAppId?: string;
|
|
213
|
-
manifest: AppManifest;
|
|
214
|
-
app: {
|
|
215
|
-
name: string;
|
|
216
|
-
description: string;
|
|
217
|
-
buildCommand: string | null;
|
|
218
|
-
startCommand: string;
|
|
219
|
-
autostart: boolean;
|
|
220
|
-
keepAlive: boolean;
|
|
221
|
-
};
|
|
222
|
-
toolIds: string[];
|
|
223
|
-
files: PackedPackage['files'];
|
|
224
|
-
totalBytes: number;
|
|
225
|
-
skipped: ExcludedPackageFile[];
|
|
226
|
-
}
|
|
227
|
-
export interface InstallAppOptions {
|
|
228
|
-
autostart?: boolean;
|
|
229
|
-
keepAlive?: boolean;
|
|
230
|
-
}
|
|
231
215
|
export interface ReadyOptions {
|
|
232
216
|
heartbeatIntervalMs?: number;
|
|
233
217
|
}
|