@amalgm/apps 0.1.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/PURPOSE.md +98 -0
- package/README.md +61 -0
- package/dist/apps.d.ts +58 -0
- package/dist/apps.js +274 -0
- package/dist/apps.js.map +1 -0
- package/dist/bin/apps.d.ts +2 -0
- package/dist/bin/apps.js +6 -0
- package/dist/bin/apps.js.map +1 -0
- package/dist/bin/mcp.d.ts +2 -0
- package/dist/bin/mcp.js +15 -0
- package/dist/bin/mcp.js.map +1 -0
- package/dist/boundaries.d.ts +11 -0
- package/dist/boundaries.js +55 -0
- package/dist/boundaries.js.map +1 -0
- package/dist/changes.d.ts +14 -0
- package/dist/changes.js +23 -0
- package/dist/changes.js.map +1 -0
- package/dist/cli.d.ts +24 -0
- package/dist/cli.js +138 -0
- package/dist/cli.js.map +1 -0
- package/dist/command.d.ts +3 -0
- package/dist/command.js +40 -0
- package/dist/command.js.map +1 -0
- package/dist/faults.d.ts +21 -0
- package/dist/faults.js +59 -0
- package/dist/faults.js.map +1 -0
- package/dist/generations.d.ts +28 -0
- package/dist/generations.js +83 -0
- package/dist/generations.js.map +1 -0
- package/dist/health.d.ts +35 -0
- package/dist/health.js +116 -0
- package/dist/health.js.map +1 -0
- package/dist/identity.d.ts +10 -0
- package/dist/identity.js +59 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/lease.d.ts +30 -0
- package/dist/lease.js +82 -0
- package/dist/lease.js.map +1 -0
- package/dist/logs.d.ts +11 -0
- package/dist/logs.js +40 -0
- package/dist/logs.js.map +1 -0
- package/dist/manifest.d.ts +6 -0
- package/dist/manifest.js +105 -0
- package/dist/manifest.js.map +1 -0
- package/dist/mcp-server.d.ts +3 -0
- package/dist/mcp-server.js +65 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/mcp.d.ts +4 -0
- package/dist/mcp.js +171 -0
- package/dist/mcp.js.map +1 -0
- package/dist/operations.d.ts +10 -0
- package/dist/operations.js +31 -0
- package/dist/operations.js.map +1 -0
- package/dist/ownership.d.ts +11 -0
- package/dist/ownership.js +75 -0
- package/dist/ownership.js.map +1 -0
- package/dist/package.d.ts +20 -0
- package/dist/package.js +204 -0
- package/dist/package.js.map +1 -0
- package/dist/presentation.d.ts +9 -0
- package/dist/presentation.js +63 -0
- package/dist/presentation.js.map +1 -0
- package/dist/process.d.ts +10 -0
- package/dist/process.js +68 -0
- package/dist/process.js.map +1 -0
- package/dist/reconciler.d.ts +27 -0
- package/dist/reconciler.js +103 -0
- package/dist/reconciler.js.map +1 -0
- package/dist/releases.d.ts +26 -0
- package/dist/releases.js +108 -0
- package/dist/releases.js.map +1 -0
- package/dist/restarts.d.ts +40 -0
- package/dist/restarts.js +137 -0
- package/dist/restarts.js.map +1 -0
- package/dist/runtime.d.ts +19 -0
- package/dist/runtime.js +57 -0
- package/dist/runtime.js.map +1 -0
- package/dist/schema.d.ts +3 -0
- package/dist/schema.js +80 -0
- package/dist/schema.js.map +1 -0
- package/dist/source-import.d.ts +4 -0
- package/dist/source-import.js +77 -0
- package/dist/source-import.js.map +1 -0
- package/dist/store.d.ts +29 -0
- package/dist/store.js +221 -0
- package/dist/store.js.map +1 -0
- package/dist/supervisor.d.ts +29 -0
- package/dist/supervisor.js +279 -0
- package/dist/supervisor.js.map +1 -0
- package/dist/types.d.ts +264 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/docs/ENGINE_INTEGRATION.md +68 -0
- package/docs/SUPERVISION.md +73 -0
- package/package.json +59 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor.js","sourceRoot":"","sources":["../src/supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EA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IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YAC3C,KAAK,CAAC,kBAAkB,EAAE,CAAC;YAC3B,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACF;AAED,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import type { ChildProcess, SpawnOptions } from 'node:child_process';
|
|
2
|
+
import type { Readable, Writable } from 'node:stream';
|
|
3
|
+
import type { AppHealthSnapshot, AppStatus } from '@amalgm/core/supervision';
|
|
4
|
+
export interface AppManifest {
|
|
5
|
+
schemaVersion: 1;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
buildCommand: string | null;
|
|
9
|
+
startCommand: string;
|
|
10
|
+
toolIds: string[];
|
|
11
|
+
package: {
|
|
12
|
+
include: string[];
|
|
13
|
+
exclude: string[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export type DesiredState = 'running' | 'stopped';
|
|
17
|
+
export type { AppStatus };
|
|
18
|
+
export interface AppRecord {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
appRef: string;
|
|
23
|
+
publicUrl: string;
|
|
24
|
+
port: number;
|
|
25
|
+
sourceDir: string;
|
|
26
|
+
dataDir: string;
|
|
27
|
+
activeReleaseId: string | null;
|
|
28
|
+
activeDeploymentId: string | null;
|
|
29
|
+
activeGenerationId: string | null;
|
|
30
|
+
desiredState: DesiredState;
|
|
31
|
+
status: AppStatus;
|
|
32
|
+
pid: number | null;
|
|
33
|
+
dnsConnected: boolean;
|
|
34
|
+
autostart: boolean;
|
|
35
|
+
keepAlive: boolean;
|
|
36
|
+
error: string | null;
|
|
37
|
+
readyAt: string | null;
|
|
38
|
+
lastHeartbeatAt: string | null;
|
|
39
|
+
heartbeatIntervalMs: number | null;
|
|
40
|
+
createdAt: string;
|
|
41
|
+
updatedAt: string;
|
|
42
|
+
}
|
|
43
|
+
export type AppHealth = AppHealthSnapshot;
|
|
44
|
+
export interface AppView extends AppRecord {
|
|
45
|
+
manifest: AppManifest | null;
|
|
46
|
+
toolIds: string[];
|
|
47
|
+
health: AppHealth | null;
|
|
48
|
+
}
|
|
49
|
+
export interface Release {
|
|
50
|
+
id: string;
|
|
51
|
+
appId: string;
|
|
52
|
+
digest: string;
|
|
53
|
+
directory: string;
|
|
54
|
+
manifest: AppManifest;
|
|
55
|
+
createdAt: string;
|
|
56
|
+
}
|
|
57
|
+
export type DeploymentStatus = 'prepared' | 'active' | 'superseded' | 'failed';
|
|
58
|
+
export interface Deployment {
|
|
59
|
+
sequence: number;
|
|
60
|
+
id: string;
|
|
61
|
+
appId: string;
|
|
62
|
+
releaseId: string;
|
|
63
|
+
directory: string;
|
|
64
|
+
reason: string;
|
|
65
|
+
status: DeploymentStatus;
|
|
66
|
+
error: string | null;
|
|
67
|
+
createdAt: string;
|
|
68
|
+
activatedAt: string | null;
|
|
69
|
+
}
|
|
70
|
+
export type GenerationStatus = 'starting' | 'running' | 'failed' | 'crashed' | 'exited';
|
|
71
|
+
export interface ProcessGeneration {
|
|
72
|
+
sequence: number;
|
|
73
|
+
id: string;
|
|
74
|
+
appId: string;
|
|
75
|
+
deploymentId: string;
|
|
76
|
+
pid: number | null;
|
|
77
|
+
processIdentity: string | null;
|
|
78
|
+
status: GenerationStatus;
|
|
79
|
+
createdAt: string;
|
|
80
|
+
startedAt: string | null;
|
|
81
|
+
stableAt: string | null;
|
|
82
|
+
exitedAt: string | null;
|
|
83
|
+
exitCode: number | null;
|
|
84
|
+
exitSignal: NodeJS.Signals | null;
|
|
85
|
+
error: string | null;
|
|
86
|
+
}
|
|
87
|
+
export interface AppRoute {
|
|
88
|
+
app_ref: string;
|
|
89
|
+
port: number;
|
|
90
|
+
name: string;
|
|
91
|
+
}
|
|
92
|
+
export interface RestartPolicy {
|
|
93
|
+
maxCrashes: number;
|
|
94
|
+
windowMs: number;
|
|
95
|
+
initialDelayMs: number;
|
|
96
|
+
maxDelayMs: number;
|
|
97
|
+
maxConcurrent: number;
|
|
98
|
+
}
|
|
99
|
+
export interface HealthPolicy {
|
|
100
|
+
defaultIntervalMs: number;
|
|
101
|
+
minIntervalMs: number;
|
|
102
|
+
maxIntervalMs: number;
|
|
103
|
+
missedBeats: number;
|
|
104
|
+
sweepIntervalMs: number;
|
|
105
|
+
}
|
|
106
|
+
export interface CommandOptions {
|
|
107
|
+
cwd?: string;
|
|
108
|
+
env?: NodeJS.ProcessEnv;
|
|
109
|
+
timeoutMs?: number;
|
|
110
|
+
maxOutputBytes?: number;
|
|
111
|
+
}
|
|
112
|
+
export interface CommandResult {
|
|
113
|
+
output: string;
|
|
114
|
+
}
|
|
115
|
+
export type RunCommand = (command: string, options: CommandOptions) => Promise<CommandResult>;
|
|
116
|
+
export type SpawnProcess = (command: string, options: SpawnOptions) => ChildProcess;
|
|
117
|
+
export interface PackageFile {
|
|
118
|
+
path: string;
|
|
119
|
+
content: Buffer | Uint8Array | string;
|
|
120
|
+
encoding?: 'base64' | 'utf8';
|
|
121
|
+
executable?: boolean;
|
|
122
|
+
size?: number;
|
|
123
|
+
sha256?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface MaterializedPackageFile extends PackageFile {
|
|
126
|
+
content: Buffer;
|
|
127
|
+
executable: boolean;
|
|
128
|
+
size: number;
|
|
129
|
+
sha256: string;
|
|
130
|
+
}
|
|
131
|
+
export interface ExcludedPackageFile {
|
|
132
|
+
path: string;
|
|
133
|
+
reason: string;
|
|
134
|
+
}
|
|
135
|
+
export interface CollectedPackage {
|
|
136
|
+
root: string;
|
|
137
|
+
manifest: AppManifest;
|
|
138
|
+
files: MaterializedPackageFile[];
|
|
139
|
+
excluded: ExcludedPackageFile[];
|
|
140
|
+
totalBytes: number;
|
|
141
|
+
}
|
|
142
|
+
export interface PackageLimits {
|
|
143
|
+
manifest?: AppManifest;
|
|
144
|
+
maxFileBytes?: number;
|
|
145
|
+
maxTotalBytes?: number;
|
|
146
|
+
}
|
|
147
|
+
export interface PackageInspection {
|
|
148
|
+
manifest: AppManifest;
|
|
149
|
+
digest: string;
|
|
150
|
+
files: Omit<MaterializedPackageFile, 'content'>[];
|
|
151
|
+
excluded: ExcludedPackageFile[];
|
|
152
|
+
totalBytes: number;
|
|
153
|
+
}
|
|
154
|
+
export interface PackedPackage extends PackageInspection {
|
|
155
|
+
files: Array<Omit<MaterializedPackageFile, 'content'> & {
|
|
156
|
+
encoding: 'base64';
|
|
157
|
+
content: string;
|
|
158
|
+
}>;
|
|
159
|
+
}
|
|
160
|
+
export interface AppsOptions {
|
|
161
|
+
stateDir?: string;
|
|
162
|
+
env?: NodeJS.ProcessEnv;
|
|
163
|
+
domain?: string;
|
|
164
|
+
portMin?: number;
|
|
165
|
+
portMax?: number;
|
|
166
|
+
runtimeUrl?: string;
|
|
167
|
+
chatServerUrl?: string;
|
|
168
|
+
runtimeToken?: string;
|
|
169
|
+
buildTimeoutMs?: number;
|
|
170
|
+
settleMs?: number;
|
|
171
|
+
stopGraceMs?: number;
|
|
172
|
+
killGraceMs?: number;
|
|
173
|
+
reconcileIntervalMs?: number;
|
|
174
|
+
maxLogBytes?: number;
|
|
175
|
+
restartPolicy?: Partial<RestartPolicy>;
|
|
176
|
+
healthPolicy?: Partial<HealthPolicy>;
|
|
177
|
+
environment?: NodeJS.ProcessEnv | ((app: AppRecord) => NodeJS.ProcessEnv);
|
|
178
|
+
publishRoutes?: (routes: AppRoute[], reason: string) => unknown;
|
|
179
|
+
onChange?: (app: AppRecord | {
|
|
180
|
+
id: string;
|
|
181
|
+
deleted: true;
|
|
182
|
+
}) => unknown;
|
|
183
|
+
onError?: (error: Error) => unknown;
|
|
184
|
+
runCommand?: RunCommand;
|
|
185
|
+
spawn?: SpawnProcess;
|
|
186
|
+
store?: import('./store.js').Store;
|
|
187
|
+
ownership?: import('./ownership.js').Ownership;
|
|
188
|
+
}
|
|
189
|
+
export interface RegisterInput {
|
|
190
|
+
id?: string;
|
|
191
|
+
cwd: string;
|
|
192
|
+
port?: number;
|
|
193
|
+
connectDns?: boolean;
|
|
194
|
+
connect_dns?: boolean;
|
|
195
|
+
autostart?: boolean;
|
|
196
|
+
keepAlive?: boolean;
|
|
197
|
+
keep_alive?: boolean;
|
|
198
|
+
}
|
|
199
|
+
export interface DeployInput {
|
|
200
|
+
cwd?: string;
|
|
201
|
+
}
|
|
202
|
+
export interface RollbackInput {
|
|
203
|
+
releaseId?: string;
|
|
204
|
+
versionId?: string;
|
|
205
|
+
}
|
|
206
|
+
export interface ReadyOptions {
|
|
207
|
+
heartbeatIntervalMs?: number;
|
|
208
|
+
}
|
|
209
|
+
export interface CloseOptions {
|
|
210
|
+
stopProcesses?: boolean;
|
|
211
|
+
}
|
|
212
|
+
export type ExistingAppInput = Record<string, any> & {
|
|
213
|
+
id: string;
|
|
214
|
+
cwd: string;
|
|
215
|
+
};
|
|
216
|
+
export interface StartOptions {
|
|
217
|
+
automatic?: boolean;
|
|
218
|
+
}
|
|
219
|
+
export interface StopOptions {
|
|
220
|
+
preserveDesiredState?: boolean;
|
|
221
|
+
}
|
|
222
|
+
export interface SupervisorOptions {
|
|
223
|
+
store: import('./store.js').Store;
|
|
224
|
+
stateDir: string;
|
|
225
|
+
faults: import('./faults.js').Faults;
|
|
226
|
+
environment?: (app: AppRecord) => NodeJS.ProcessEnv;
|
|
227
|
+
changed?: (app: AppRecord) => unknown;
|
|
228
|
+
spawn?: (command: string, options: SpawnOptions) => ChildProcess;
|
|
229
|
+
restart?: (appId: string) => Promise<AppRecord | null>;
|
|
230
|
+
restartPolicy?: Partial<RestartPolicy>;
|
|
231
|
+
settleMs?: number;
|
|
232
|
+
stopGraceMs?: number;
|
|
233
|
+
killGraceMs?: number;
|
|
234
|
+
maxLogBytes?: number;
|
|
235
|
+
reconcileIntervalMs?: number;
|
|
236
|
+
}
|
|
237
|
+
export interface McpTextContent {
|
|
238
|
+
type: 'text';
|
|
239
|
+
text: string;
|
|
240
|
+
}
|
|
241
|
+
export interface McpResult {
|
|
242
|
+
content: McpTextContent[];
|
|
243
|
+
isError?: boolean;
|
|
244
|
+
}
|
|
245
|
+
export interface McpTool {
|
|
246
|
+
name: string;
|
|
247
|
+
description: string;
|
|
248
|
+
inputSchema: Record<string, unknown>;
|
|
249
|
+
handler(args?: Record<string, unknown>): Promise<McpResult>;
|
|
250
|
+
}
|
|
251
|
+
export interface JsonRpcRequest {
|
|
252
|
+
id?: string | number | null;
|
|
253
|
+
method: string;
|
|
254
|
+
params?: Record<string, any>;
|
|
255
|
+
}
|
|
256
|
+
export interface McpServerOptions extends AppsOptions {
|
|
257
|
+
apps?: import('./apps.js').Apps;
|
|
258
|
+
}
|
|
259
|
+
export interface McpServer {
|
|
260
|
+
apps: import('./apps.js').Apps;
|
|
261
|
+
tools: McpTool[];
|
|
262
|
+
handle(message: JsonRpcRequest): Promise<unknown>;
|
|
263
|
+
start(input?: Readable, output?: Writable): Promise<unknown>;
|
|
264
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Engine integration
|
|
2
|
+
|
|
3
|
+
`@amalgm/apps` is the canonical Apps product. Amalgm Engine embeds a generated
|
|
4
|
+
copy so the Engine runtime and the standalone package execute the same service
|
|
5
|
+
implementation.
|
|
6
|
+
|
|
7
|
+
## Ownership boundary
|
|
8
|
+
|
|
9
|
+
Apps owns:
|
|
10
|
+
|
|
11
|
+
- app, release, deployment, process, and health state;
|
|
12
|
+
- validation, packaging, builds, activation, rollback, and supervision;
|
|
13
|
+
- the SDK, CLI commands, MCP tool definitions, and the app-side lease.
|
|
14
|
+
|
|
15
|
+
In the target independently supervised composition, Engine owns:
|
|
16
|
+
|
|
17
|
+
- runtime URLs, authentication, ports, and public route publication;
|
|
18
|
+
- outer service-level availability and restart policy for the Apps product;
|
|
19
|
+
- state-event and UI composition;
|
|
20
|
+
- mechanical projection of Apps records into shared client surfaces;
|
|
21
|
+
- one-time import from Engine's superseded `apps.json` registry.
|
|
22
|
+
|
|
23
|
+
Engine adapters must call the public `Apps` service. They must not write the
|
|
24
|
+
Apps database, deployment directories, or release directories directly.
|
|
25
|
+
Engine's outer supervisor treats Apps as one product service and never starts,
|
|
26
|
+
stops, adopts, or restarts an individual app. The complete hierarchy is in
|
|
27
|
+
[SUPERVISION.md](./SUPERVISION.md).
|
|
28
|
+
|
|
29
|
+
## Source flow
|
|
30
|
+
|
|
31
|
+
From an Engine checkout next to this repository:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npm run apps:sync
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Engine's `scripts/sync-products.mjs apps` builds the canonical TypeScript source,
|
|
38
|
+
then copies `PURPOSE.md`, `package.json`, and generated `dist/` into
|
|
39
|
+
`runtime/products/apps/`. It also writes `SOURCE.json` with the product
|
|
40
|
+
version, source commit, and a deterministic content digest.
|
|
41
|
+
`npm run apps:check` rejects generated drift without rewriting files. The
|
|
42
|
+
Engine npm package copies that generated runtime during its existing runtime
|
|
43
|
+
sync.
|
|
44
|
+
|
|
45
|
+
Make product changes here first, verify them here, then sync Engine. Files
|
|
46
|
+
under Engine's `runtime/products/apps/` are generated artifacts and are not
|
|
47
|
+
edited by hand.
|
|
48
|
+
|
|
49
|
+
## Composition
|
|
50
|
+
|
|
51
|
+
The `amalgm apps ...` command uses the generated product CLI with an HTTP
|
|
52
|
+
client for Engine's long-lived service. This keeps command parsing canonical
|
|
53
|
+
without creating a competing process supervisor. Engine's MCP server mounts
|
|
54
|
+
the product's MCP tool definitions over the same lazily resolved service.
|
|
55
|
+
Engine REST routes adapt their request and response shapes to it.
|
|
56
|
+
|
|
57
|
+
The event tunnel and local gateway use one shared Engine adapter that reads
|
|
58
|
+
routable ports from the product database. Runtime route readers never consult
|
|
59
|
+
the superseded registry.
|
|
60
|
+
|
|
61
|
+
On boot, Engine imports each existing app once while preserving its stable id,
|
|
62
|
+
app ref, public URL, port, desired state, and live process when possible.
|
|
63
|
+
Import progress is recorded independently. Invalid source data blocks cleanup
|
|
64
|
+
and remains recoverable; it never becomes a fallback runtime registry.
|
|
65
|
+
|
|
66
|
+
Apps and Tools may contain references to one another, but neither adapter
|
|
67
|
+
silently rewrites the other product. A workflow that intentionally changes
|
|
68
|
+
both must have an explicit owner outside Core's transport adapters.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Supervision ownership
|
|
2
|
+
|
|
3
|
+
The Apps supervisor stays in `@amalgm/apps`. Standalone use and Amalgm Engine
|
|
4
|
+
composition execute the same supervisor; combining products does not move app
|
|
5
|
+
lifecycle logic into Engine.
|
|
6
|
+
|
|
7
|
+
## Target Engine composition
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
Amalgm Engine
|
|
11
|
+
├── Apps product-service supervisor
|
|
12
|
+
│ └── @amalgm/apps supervisor
|
|
13
|
+
│ ├── App A process generations
|
|
14
|
+
│ └── App B process generations
|
|
15
|
+
├── Events product-service supervisor
|
|
16
|
+
│ └── @amalgm/events supervisor
|
|
17
|
+
└── Realtime product-service supervisor
|
|
18
|
+
└── @amalgm/realtime supervisor
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Each product owns its domain supervisor. Engine composes those supervisors
|
|
22
|
+
side by side and may provide an outer service supervisor for each product.
|
|
23
|
+
The two levels have different authority:
|
|
24
|
+
|
|
25
|
+
| Supervisor | Owns | Does not own |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| Apps supervisor | app desired state, deployments, process generations, health, restart budgets | Engine lifecycle or other products |
|
|
28
|
+
| Apps product-service supervisor | Apps-service availability, service restart budget, shutdown and readiness | individual app processes or the Apps database |
|
|
29
|
+
| Engine composition | identity, transport, UI projection, cross-product relationships | product lifecycle state |
|
|
30
|
+
|
|
31
|
+
There is never a second Apps supervisor in Engine. Engine either instantiates
|
|
32
|
+
the supervisor exported by this product or communicates with a service that
|
|
33
|
+
does. CLI, MCP, HTTP, gateways, and UI code are clients or adapters.
|
|
34
|
+
|
|
35
|
+
## One owner per state directory
|
|
36
|
+
|
|
37
|
+
Exactly one live Apps supervisor may mutate a state directory. That owner is
|
|
38
|
+
responsible for every app process generation until it stops or transfers
|
|
39
|
+
custody through a defined service restart.
|
|
40
|
+
|
|
41
|
+
Other processes must not open the same state directory as lifecycle writers.
|
|
42
|
+
They use the owning service API or a read-only projection. A standalone CLI
|
|
43
|
+
must therefore talk to the active Apps service, acquire sole ownership for
|
|
44
|
+
the complete operation, or refuse the mutation.
|
|
45
|
+
|
|
46
|
+
## Failure direction
|
|
47
|
+
|
|
48
|
+
Failures remain inside the smallest responsible supervisor:
|
|
49
|
+
|
|
50
|
+
- an app crash is handled by the Apps supervisor and changes only that app;
|
|
51
|
+
- an exhausted app restart budget degrades that app, not the Apps service;
|
|
52
|
+
- an Apps-service failure makes Apps unavailable to Engine;
|
|
53
|
+
- Engine may restart or disable the Apps service without restarting Events,
|
|
54
|
+
Realtime, or the rest of the runtime;
|
|
55
|
+
- Engine never repairs an Apps-service failure by editing app process state.
|
|
56
|
+
|
|
57
|
+
This distinction is what allows Amalgm Engine to contain many products without
|
|
58
|
+
recreating a monolithic supervisor.
|
|
59
|
+
|
|
60
|
+
## Lifecycle modes
|
|
61
|
+
|
|
62
|
+
The Apps supervisor owns both product behaviors:
|
|
63
|
+
|
|
64
|
+
- **on demand** — opening starts the active deployment without rebuilding;
|
|
65
|
+
closing or an idle policy stops its process while retaining releases and
|
|
66
|
+
data;
|
|
67
|
+
- **always on** — the supervisor starts the app with the service and applies
|
|
68
|
+
its durable restart budget while the desired state remains running.
|
|
69
|
+
|
|
70
|
+
These are policies of the Apps supervisor. Engine may request a policy change,
|
|
71
|
+
but it does not implement the policy itself. Explicit `start` and `stop`
|
|
72
|
+
already provide the no-rebuild process mechanics; the first-class
|
|
73
|
+
`runtimeMode` and idle policy remain to be implemented.
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@amalgm/apps",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Local-first, versioned application deployment for Amalgm.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"private": false,
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/amalgm-inc/amalgm-apps.git"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "dist/index.js",
|
|
16
|
+
"types": "dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./mcp": "./dist/mcp.js",
|
|
23
|
+
"./lease": {
|
|
24
|
+
"types": "./dist/lease.d.ts",
|
|
25
|
+
"default": "./dist/lease.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"amalgm-apps": "./dist/bin/apps.js",
|
|
30
|
+
"amalgm-apps-mcp": "./dist/bin/mcp.js"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"docs",
|
|
34
|
+
"dist",
|
|
35
|
+
"PURPOSE.md",
|
|
36
|
+
"README.md"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc -p tsconfig.build.json && tsx scripts/mark-executables.ts",
|
|
40
|
+
"check": "tsx scripts/check-tree.ts && tsc -p tsconfig.json && tsc -p tsconfig.test.json",
|
|
41
|
+
"test": "tsx --test --test-concurrency=1 --test-timeout=30000 test/*.test.ts",
|
|
42
|
+
"verify": "npm run check && npm run build && npm test",
|
|
43
|
+
"prepack": "npm run build"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=20"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@amalgm/core": "^0.1.0",
|
|
50
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
51
|
+
"@types/node": "^20.19.43",
|
|
52
|
+
"better-sqlite3": "^12.6.2",
|
|
53
|
+
"minimatch": "^10.0.3"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"tsx": "^4.23.1",
|
|
57
|
+
"typescript": "^5.9.3"
|
|
58
|
+
}
|
|
59
|
+
}
|