@amalgm/apps 0.1.3-preview.34176078280 → 0.1.3-preview.34545378804

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.
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Declarative command inputs. One field shape per command feeds every
3
+ * adapter: the MCP tool schema, the CLI flag parser, and the validation
4
+ * every surface runs before the SDK is touched.
5
+ */
6
+ function string(description, required = false) {
7
+ return { type: 'string', description, required };
8
+ }
9
+ function integer(description, required = false) {
10
+ return { type: 'integer', description, required };
11
+ }
12
+ function boolean(description) {
13
+ return { type: 'boolean', description };
14
+ }
15
+ function object(description, required = false) {
16
+ return { type: 'object', description, required };
17
+ }
18
+ function jsonSchema(shape) {
19
+ return {
20
+ type: 'object',
21
+ additionalProperties: false,
22
+ required: Object.entries(shape).filter(([, field]) => field.required).map(([name]) => name),
23
+ properties: Object.fromEntries(Object.entries(shape).map(([name, field]) => ([name, { type: field.type, description: field.description }]))),
24
+ };
25
+ }
26
+ function accepts(field, value) {
27
+ switch (field.type) {
28
+ case 'string': return typeof value === 'string';
29
+ case 'integer': return Number.isInteger(value);
30
+ case 'boolean': return typeof value === 'boolean';
31
+ case 'object': return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
32
+ }
33
+ }
34
+ function parseInput(shape, value) {
35
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
36
+ throw new Error('Command input must be a JSON object');
37
+ }
38
+ const input = value;
39
+ const unknownFields = Object.keys(input).filter((name) => !(name in shape));
40
+ if (unknownFields.length)
41
+ throw new Error(`Unknown input field: ${unknownFields.join(', ')}`);
42
+ const parsed = {};
43
+ for (const [name, field] of Object.entries(shape)) {
44
+ const supplied = input[name];
45
+ if (supplied === undefined || supplied === null) {
46
+ if (field.required)
47
+ throw new Error(`${name} is required`);
48
+ continue;
49
+ }
50
+ if (!accepts(field, supplied))
51
+ throw new Error(`${name} must be ${article(field.type)}`);
52
+ if (field.type === 'string' && !supplied.trim())
53
+ throw new Error(`${name} must not be empty`);
54
+ parsed[name] = supplied;
55
+ }
56
+ return parsed;
57
+ }
58
+ function article(type) {
59
+ return type === 'integer' || type === 'object' ? `an ${type}` : `a ${type}`;
60
+ }
61
+ export { boolean, integer, jsonSchema, object, parseInput, string };
62
+ //# sourceMappingURL=command-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-input.js","sourceRoot":"","sources":["../src/command-input.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoBH,SAAS,MAAM,CAAC,WAAmB,EAAE,QAAQ,GAAG,KAAK;IACnD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AACnD,CAAC;AAED,SAAS,OAAO,CAAC,WAAmB,EAAE,QAAQ,GAAG,KAAK;IACpD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AACpD,CAAC;AAED,SAAS,OAAO,CAAC,WAAmB;IAClC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AAC1C,CAAC;AAED,SAAS,MAAM,CAAC,WAAmB,EAAE,QAAQ,GAAG,KAAK;IACnD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AACnD,CAAC;AAED,SAAS,UAAU,CAAC,KAAiB;IACnC,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC;QAC3F,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,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M,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YAChD,IAAI,KAAK,CAAC,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,cAAc,CAAC,CAAC;YAC3D,SAAS;QACX,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,YAAY,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzF,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAE,QAAmB,CAAC,IAAI,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,oBAAoB,CAAC,CAAC;QAC1G,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IAC1B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,OAAO,CAAC,IAAe;IAC9B,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;AAC9E,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The one Apps command surface. Every adapter (CLI, MCP, and any later API)
3
+ * consumes this list: the same names, the same inputs, the same annotations,
4
+ * and the same SDK calls. Nothing here spawns, stores, or supervises.
5
+ */
6
+ import type { Apps } from './apps.js';
7
+ import type { FieldShape, JsonObjectSchema } from './command-input.js';
8
+ type AppCommandName = 'create' | 'list' | 'get' | 'update' | 'delete' | 'start' | 'stop' | 'deploy' | 'rollback' | 'versions' | 'deployments' | 'logs' | 'validate' | 'routes' | 'export' | 'install';
9
+ interface AppCommandAnnotations {
10
+ readOnlyHint: boolean;
11
+ destructiveHint: boolean;
12
+ idempotentHint: boolean;
13
+ openWorldHint: boolean;
14
+ }
15
+ interface AppCommandDefinition {
16
+ name: AppCommandName;
17
+ mcpName: `amalgm_apps_${string}`;
18
+ title: string;
19
+ description: string;
20
+ inputShape: FieldShape;
21
+ /** Input fields the CLI fills from bare arguments, in order. */
22
+ positional: readonly string[];
23
+ annotations: AppCommandAnnotations;
24
+ inputSchema(): JsonObjectSchema;
25
+ invoke(apps: Apps, input: unknown): Promise<unknown>;
26
+ }
27
+ interface AppCommands {
28
+ execute(name: AppCommandName, input?: unknown): Promise<unknown>;
29
+ }
30
+ declare const appCommandDefinitions: readonly AppCommandDefinition[];
31
+ declare function createAppCommands(apps: Apps): AppCommands;
32
+ declare function appCommandDefinition(name: string): AppCommandDefinition;
33
+ export { appCommandDefinition, appCommandDefinitions, createAppCommands };
34
+ export type { AppCommandAnnotations, AppCommandDefinition, AppCommandName, AppCommands };
@@ -0,0 +1,237 @@
1
+ /**
2
+ * The one Apps command surface. Every adapter (CLI, MCP, and any later API)
3
+ * consumes this list: the same names, the same inputs, the same annotations,
4
+ * and the same SDK calls. Nothing here spawns, stores, or supervises.
5
+ */
6
+ import { boolean, integer, jsonSchema, object, parseInput, string } from './command-input.js';
7
+ const appId = { app_id: string('Stable app id', true) };
8
+ const cwd = { cwd: string('Directory containing amalgm.app.json', true) };
9
+ const definitions = [
10
+ define({
11
+ name: 'create',
12
+ title: 'Create app',
13
+ description: 'Create an app from a directory containing amalgm.app.json: validate, build an immutable release, and start it.',
14
+ shape: {
15
+ ...cwd,
16
+ port: integer('Pin a local port instead of allocating one'),
17
+ connect_dns: boolean('Publish the app on the public route table (default true)'),
18
+ autostart: boolean('Start the app whenever the machine runtime boots (default true)'),
19
+ keep_alive: boolean('Restart the app after crashes (default true)'),
20
+ },
21
+ positional: ['cwd'],
22
+ annotations: write(false),
23
+ run: (apps, input) => apps.register({
24
+ cwd: input.cwd,
25
+ port: input.port,
26
+ connectDns: input.connect_dns,
27
+ autostart: input.autostart,
28
+ keepAlive: input.keep_alive,
29
+ }),
30
+ }),
31
+ define({
32
+ name: 'list',
33
+ title: 'List apps',
34
+ description: 'List registered apps with their active releases, status, and health.',
35
+ shape: {},
36
+ positional: [],
37
+ annotations: read(),
38
+ run: async (apps) => apps.list(),
39
+ }),
40
+ define({
41
+ name: 'get',
42
+ title: 'Get app',
43
+ description: 'Get one registered app in full.',
44
+ shape: appId,
45
+ positional: ['app_id'],
46
+ annotations: read(),
47
+ run: async (apps, input) => found(apps, input.app_id),
48
+ }),
49
+ define({
50
+ name: 'update',
51
+ title: 'Update app settings',
52
+ description: 'Change app settings without touching its id, route, releases, or running process: name, description, autostart, keep-alive, and route publication.',
53
+ shape: {
54
+ ...appId,
55
+ name: string('New display name'),
56
+ description: string('New description'),
57
+ autostart: boolean('Start the app whenever the machine runtime boots'),
58
+ keep_alive: boolean('Restart the app after crashes'),
59
+ dns_connected: boolean('Publish the app on the public route table'),
60
+ },
61
+ positional: ['app_id'],
62
+ annotations: write(true),
63
+ run: (apps, input) => apps.update(input.app_id, settings(input)),
64
+ }),
65
+ define({
66
+ name: 'delete',
67
+ title: 'Delete app',
68
+ description: 'Stop and delete an app together with its releases, deployments, logs, and data.',
69
+ shape: appId,
70
+ positional: ['app_id'],
71
+ annotations: destructive(),
72
+ run: (apps, input) => apps.delete(input.app_id),
73
+ }),
74
+ define({
75
+ name: 'start',
76
+ title: 'Start app',
77
+ description: 'Start the active deployment and keep it running.',
78
+ shape: appId,
79
+ positional: ['app_id'],
80
+ annotations: write(true),
81
+ run: (apps, input) => apps.start(input.app_id),
82
+ }),
83
+ define({
84
+ name: 'stop',
85
+ title: 'Stop app',
86
+ description: 'Stop an app and preserve its releases.',
87
+ shape: appId,
88
+ positional: ['app_id'],
89
+ annotations: write(true),
90
+ run: (apps, input) => apps.stop(input.app_id),
91
+ }),
92
+ define({
93
+ name: 'deploy',
94
+ title: 'Deploy app',
95
+ description: 'Build an immutable release from the source directory and activate it. The current process stays up through the build.',
96
+ shape: { ...appId, cwd: string('Build from this directory instead of the registered source') },
97
+ positional: ['app_id', 'cwd'],
98
+ annotations: write(false),
99
+ run: (apps, input) => apps.deploy(input.app_id, { cwd: input.cwd }),
100
+ }),
101
+ define({
102
+ name: 'rollback',
103
+ title: 'Roll back app',
104
+ description: 'Activate an earlier immutable release as a new deployment. Without release_id the previous deployment is restored.',
105
+ shape: { ...appId, release_id: string('Release to activate') },
106
+ positional: ['app_id', 'release_id'],
107
+ annotations: write(false),
108
+ run: (apps, input) => apps.rollback(input.app_id, { releaseId: input.release_id }),
109
+ }),
110
+ define({
111
+ name: 'versions',
112
+ title: 'List releases',
113
+ description: 'List the immutable releases of an app.',
114
+ shape: appId,
115
+ positional: ['app_id'],
116
+ annotations: read(),
117
+ run: async (apps, input) => apps.versions(input.app_id),
118
+ }),
119
+ define({
120
+ name: 'deployments',
121
+ title: 'List deployments',
122
+ description: 'List the append-only deployment history of an app.',
123
+ shape: appId,
124
+ positional: ['app_id'],
125
+ annotations: read(),
126
+ run: async (apps, input) => apps.deployments(input.app_id),
127
+ }),
128
+ define({
129
+ name: 'logs',
130
+ title: 'Read app logs',
131
+ description: 'Read the last lines of the app process log.',
132
+ shape: { ...appId, lines: integer('How many trailing lines to return (default 200)') },
133
+ positional: ['app_id', 'lines'],
134
+ annotations: read(),
135
+ run: async (apps, input) => apps.logs(input.app_id, input.lines),
136
+ }),
137
+ define({
138
+ name: 'validate',
139
+ title: 'Validate app package',
140
+ description: 'Inspect a directory as an app package without changing state: manifest, digest, and packaged files.',
141
+ shape: cwd,
142
+ positional: ['cwd'],
143
+ annotations: read(),
144
+ run: async (apps, input) => apps.validate(input.cwd),
145
+ }),
146
+ define({
147
+ name: 'routes',
148
+ title: 'List routes',
149
+ description: 'List the routes of running, healthy apps that are published on the route table.',
150
+ shape: {},
151
+ positional: [],
152
+ annotations: read(),
153
+ run: async (apps) => apps.routes(),
154
+ }),
155
+ define({
156
+ name: 'export',
157
+ title: 'Export app',
158
+ description: 'Export an app as a portable package: its manifest, packed source files, and tool ids. This is what sharing sends.',
159
+ shape: appId,
160
+ positional: ['app_id'],
161
+ annotations: read(),
162
+ run: async (apps, input) => apps.export(input.app_id),
163
+ }),
164
+ define({
165
+ name: 'install',
166
+ title: 'Install app',
167
+ description: 'Install a portable app on this machine: materialize its files under the local state directory and create it as a new app here.',
168
+ shape: {
169
+ app: object('A portable app as produced by export', true),
170
+ autostart: boolean('Start the app whenever the machine runtime boots (default from the package)'),
171
+ keep_alive: boolean('Restart the app after crashes (default from the package)'),
172
+ },
173
+ positional: [],
174
+ annotations: write(false),
175
+ run: (apps, input) => apps.install(input.app, {
176
+ autostart: input.autostart,
177
+ keepAlive: input.keep_alive,
178
+ }),
179
+ }),
180
+ ];
181
+ const appCommandDefinitions = Object.freeze(definitions);
182
+ function createAppCommands(apps) {
183
+ return Object.freeze({
184
+ execute(name, input = {}) {
185
+ return appCommandDefinition(name).invoke(apps, input);
186
+ },
187
+ });
188
+ }
189
+ function appCommandDefinition(name) {
190
+ const definition = appCommandDefinitions.find((candidate) => candidate.name === name);
191
+ if (!definition)
192
+ throw new Error(`Unknown Apps command: ${name}`);
193
+ return definition;
194
+ }
195
+ function found(apps, id) {
196
+ const app = apps.get(id);
197
+ if (!app)
198
+ throw new Error(`App not found: ${id}`);
199
+ return app;
200
+ }
201
+ function settings(input) {
202
+ return {
203
+ name: input.name,
204
+ description: input.description,
205
+ autostart: input.autostart,
206
+ keepAlive: input.keep_alive,
207
+ dnsConnected: input.dns_connected,
208
+ };
209
+ }
210
+ function define(input) {
211
+ for (const field of input.positional) {
212
+ if (!(field in input.shape))
213
+ throw new Error(`${input.name}: positional field ${field} is not an input`);
214
+ }
215
+ return Object.freeze({
216
+ name: input.name,
217
+ mcpName: `amalgm_apps_${input.name}`,
218
+ title: input.title,
219
+ description: input.description,
220
+ inputShape: input.shape,
221
+ positional: input.positional,
222
+ annotations: input.annotations,
223
+ inputSchema: () => jsonSchema(input.shape),
224
+ invoke: (apps, value) => input.run(apps, parseInput(input.shape, value)),
225
+ });
226
+ }
227
+ function read() {
228
+ return Object.freeze({ readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false });
229
+ }
230
+ function write(idempotentHint) {
231
+ return Object.freeze({ readOnlyHint: false, destructiveHint: false, idempotentHint, openWorldHint: false });
232
+ }
233
+ function destructive() {
234
+ return Object.freeze({ readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false });
235
+ }
236
+ export { appCommandDefinition, appCommandDefinitions, createAppCommands };
237
+ //# sourceMappingURL=command-surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-surface.js","sourceRoot":"","sources":["../src/command-surface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAkC9F,MAAM,KAAK,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC,EAAE,CAAC;AACxD,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,sCAAsC,EAAE,IAAI,CAAC,EAAE,CAAC;AAE1E,MAAM,WAAW,GAAG;IAClB,MAAM,CAAC;QACL,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,gHAAgH;QAC7H,KAAK,EAAE;YACL,GAAG,GAAG;YACN,IAAI,EAAE,OAAO,CAAC,4CAA4C,CAAC;YAC3D,WAAW,EAAE,OAAO,CAAC,0DAA0D,CAAC;YAChF,SAAS,EAAE,OAAO,CAAC,iEAAiE,CAA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AAC,KAAK;QACvB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,WAAW,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC;QAC1C,MAAM,EAAE,CAAC,IAAU,EAAE,KAAc,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;KACxF,CAAC,CAAC;AACL,CAAC;AAED,SAAS,IAAI;IACX,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC;AACnH,CAAC;AAED,SAAS,KAAK,CAAC,cAAuB;IACpC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC;AAC9G,CAAC;AAED,SAAS,WAAW;IAClB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC;AACpH,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  export { Apps, defaultStateDir } from './apps.js';
2
2
  export { runCli } from './cli.js';
3
+ export { appCommandDefinition, appCommandDefinitions, createAppCommands } from './command-surface.js';
4
+ export type { AppCommandAnnotations, AppCommandDefinition, AppCommandName, AppCommands, } from './command-surface.js';
5
+ export { exportApp, installApp } from './portable.js';
6
+ export { linkedToolEnvironment } from './presentation.js';
3
7
  export * from './lease.js';
4
8
  export { normalizeManifest, readManifest } from './manifest.js';
5
9
  export { createMcpTools } from './mcp.js';
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  export { Apps, defaultStateDir } from './apps.js';
2
2
  export { runCli } from './cli.js';
3
+ export { appCommandDefinition, appCommandDefinitions, createAppCommands } from './command-surface.js';
4
+ export { exportApp, installApp } from './portable.js';
5
+ export { linkedToolEnvironment } from './presentation.js';
3
6
  export * from './lease.js';
4
7
  export { normalizeManifest, readManifest } from './manifest.js';
5
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,eAAe,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAChE,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,EACL,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,oBAAoB,GACrB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAOtG,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAChE,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,EACL,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,oBAAoB,GACrB,MAAM,cAAc,CAAC"}
package/dist/mcp.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * MCP adapter over the Apps command surface: one tool per command, with the
3
+ * command's own schema and annotations. Results are the command result as
4
+ * JSON text; failures are error text with isError set.
5
+ */
1
6
  import type { Apps } from './apps.js';
2
7
  import type { McpTool } from './types.js';
3
8
  declare function createMcpTools(apps: Apps): McpTool[];
package/dist/mcp.js CHANGED
@@ -1,171 +1,31 @@
1
+ /**
2
+ * MCP adapter over the Apps command surface: one tool per command, with the
3
+ * command's own schema and annotations. Results are the command result as
4
+ * JSON text; failures are error text with isError set.
5
+ */
6
+ import { appCommandDefinitions, createAppCommands } from './command-surface.js';
1
7
  function text(value) {
2
8
  return {
3
9
  content: [{ type: 'text', text: typeof value === 'string' ? value : JSON.stringify(value, null, 2) }],
4
10
  };
5
11
  }
6
12
  function createMcpTools(apps) {
7
- const action = (definition, handler) => ({
8
- ...definition,
13
+ const commands = createAppCommands(apps);
14
+ return appCommandDefinitions.map((definition) => ({
15
+ name: definition.mcpName,
16
+ title: definition.title,
17
+ description: definition.description,
18
+ inputSchema: definition.inputSchema(),
19
+ annotations: definition.annotations,
9
20
  async handler(args = {}) {
10
21
  try {
11
- return text(await handler(args));
22
+ return text(await commands.execute(definition.name, args));
12
23
  }
13
24
  catch (error) {
14
25
  return { ...text(error instanceof Error ? error.message : String(error)), isError: true };
15
26
  }
16
27
  },
17
- });
18
- const id = {
19
- app_id: { type: 'string', description: 'Stable app id' },
20
- };
21
- return [
22
- action({
23
- name: 'apps_register',
24
- description: 'Register, build, and start an app from a directory containing amalgm.app.json.',
25
- inputSchema: {
26
- type: 'object',
27
- additionalProperties: false,
28
- required: ['cwd'],
29
- properties: {
30
- cwd: { type: 'string' },
31
- port: { type: 'integer' },
32
- connect_dns: { type: 'boolean' },
33
- autostart: { type: 'boolean' },
34
- keep_alive: { type: 'boolean' },
35
- },
36
- },
37
- }, (args) => apps.register(args)),
38
- action({
39
- name: 'apps_validate',
40
- description: 'Validate and inspect an app package without changing state.',
41
- inputSchema: {
42
- type: 'object',
43
- additionalProperties: false,
44
- required: ['cwd'],
45
- properties: { cwd: { type: 'string' } },
46
- },
47
- }, ({ cwd }) => apps.validate(cwd)),
48
- action({
49
- name: 'apps_list',
50
- description: 'List registered apps and their active releases.',
51
- inputSchema: { type: 'object', additionalProperties: false, properties: {} },
52
- }, () => apps.list()),
53
- action({
54
- name: 'apps_show',
55
- description: 'Get one registered app.',
56
- inputSchema: {
57
- type: 'object',
58
- additionalProperties: false,
59
- required: ['app_id'],
60
- properties: id,
61
- },
62
- }, ({ app_id }) => {
63
- const app = apps.get(app_id);
64
- if (!app)
65
- throw new Error(`App not found: ${app_id}`);
66
- return app;
67
- }),
68
- action({
69
- name: 'apps_deploy',
70
- description: 'Build an immutable release and activate it. The current process stays up through the build.',
71
- inputSchema: {
72
- type: 'object',
73
- additionalProperties: false,
74
- required: ['app_id'],
75
- properties: { ...id, cwd: { type: 'string' } },
76
- },
77
- }, ({ app_id, cwd }) => apps.deploy(app_id, { cwd })),
78
- action({
79
- name: 'apps_versions',
80
- description: 'List immutable releases for an app.',
81
- inputSchema: {
82
- type: 'object',
83
- additionalProperties: false,
84
- required: ['app_id'],
85
- properties: id,
86
- },
87
- }, ({ app_id }) => apps.versions(app_id)),
88
- action({
89
- name: 'apps_deployments',
90
- description: 'List append-only deployment history for an app.',
91
- inputSchema: {
92
- type: 'object',
93
- additionalProperties: false,
94
- required: ['app_id'],
95
- properties: id,
96
- },
97
- }, ({ app_id }) => apps.deployments(app_id)),
98
- action({
99
- name: 'apps_rollback',
100
- description: 'Activate an earlier immutable release as a new deployment.',
101
- inputSchema: {
102
- type: 'object',
103
- additionalProperties: false,
104
- required: ['app_id'],
105
- properties: { ...id, release_id: { type: 'string' } },
106
- },
107
- }, ({ app_id, release_id }) => apps.rollback(app_id, { releaseId: release_id })),
108
- action({
109
- name: 'apps_rename',
110
- description: 'Rename an app without changing its id, route, or releases.',
111
- inputSchema: {
112
- type: 'object',
113
- additionalProperties: false,
114
- required: ['app_id', 'name'],
115
- properties: { ...id, name: { type: 'string' } },
116
- },
117
- }, ({ app_id, name }) => apps.rename(app_id, name)),
118
- action({
119
- name: 'apps_start',
120
- description: 'Start the active deployment.',
121
- inputSchema: {
122
- type: 'object',
123
- additionalProperties: false,
124
- required: ['app_id'],
125
- properties: id,
126
- },
127
- }, ({ app_id }) => apps.start(app_id)),
128
- action({
129
- name: 'apps_stop',
130
- description: 'Stop an app and preserve its releases.',
131
- inputSchema: {
132
- type: 'object',
133
- additionalProperties: false,
134
- required: ['app_id'],
135
- properties: id,
136
- },
137
- }, ({ app_id }) => apps.stop(app_id)),
138
- action({
139
- name: 'apps_connect_dns',
140
- description: 'Make a running healthy app eligible for route publication.',
141
- inputSchema: {
142
- type: 'object',
143
- additionalProperties: false,
144
- required: ['app_id'],
145
- properties: id,
146
- },
147
- }, ({ app_id }) => apps.connectDns(app_id)),
148
- action({
149
- name: 'apps_disconnect_dns',
150
- description: 'Remove route eligibility without stopping the app.',
151
- inputSchema: {
152
- type: 'object',
153
- additionalProperties: false,
154
- required: ['app_id'],
155
- properties: id,
156
- },
157
- }, ({ app_id }) => apps.disconnectDns(app_id)),
158
- action({
159
- name: 'apps_delete',
160
- description: 'Stop and delete an app, its releases, deployments, logs, and data.',
161
- inputSchema: {
162
- type: 'object',
163
- additionalProperties: false,
164
- required: ['app_id'],
165
- properties: id,
166
- },
167
- }, ({ app_id }) => apps.delete(app_id)),
168
- ];
28
+ }));
169
29
  }
170
30
  export { createMcpTools };
171
31
  //# sourceMappingURL=mcp.js.map
package/dist/mcp.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAGA,SAAS,IAAI,CAAC,KAAc;IAC1B,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KACtG,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,IAAU;IAChC,MAAM,MAAM,GAAG,CACb,UAAoC,EACpC,OAAkE,EACzD,EAAE,CAAC,CAAC;QACb,GAAG,UAAU;QACb,KAAK,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE;YACrB,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;YACnC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAC5F,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IACH,MAAM,EAAE,GAAG;QACT,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE;KACzD,CAAC;IAEF,OAAO;QACL,MAAM,CAAC;YACL,IAAI,EAAE,eAAe;YACrB,WAAW,EAAE,gFAAgF;YAC7F,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,oBAAoB,EAAE,KAAK;gBAC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Portable apps: the export/install port every sharing layer builds on. An
3
+ * exported app is the packed source plus the manifest facts an installer
4
+ * needs to show before it registers anything. Installing materializes the
5
+ * package under the local state directory and registers it as a new app on
6
+ * this machine. Lineage (`sourceAppId`) is carried, never enforced: a
7
+ * sharing layer that publishes an untethered copy strips it.
8
+ */
9
+ import type { Apps } from './apps.js';
10
+ import type { AppView, InstallAppOptions, PortableApp } from './types.js';
11
+ declare function exportApp(apps: Apps, appId: string): PortableApp;
12
+ declare function installApp(apps: Apps, entry: PortableApp, options?: InstallAppOptions): Promise<AppView>;
13
+ export { exportApp, installApp };