@amalgm/shell 0.1.126 → 0.1.128

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,149 @@
1
+ ---
2
+ name: shell
3
+ description: Install, authenticate, run, inspect, and integrate the @amalgm/shell machine runtime. Use when enrolling a computer, starting or diagnosing the local Amalgm runtime, recovering its device key, registering or materializing Files workspaces, embedding Shell host composition, or determining which published product versions make up a machine release.
4
+ ---
5
+
6
+ # Amalgm Shell
7
+
8
+ Shell is the installable Amalgm machine runtime. It composes exact published
9
+ versions of the product SDKs with the operating-system, network, SQLite, and
10
+ cloud effects they need. The products own their laws and data; Shell owns boot,
11
+ host adapters, authenticated routing, process lifetime, and the tested version
12
+ combination that ships to a machine.
13
+
14
+ ## Installation and first login
15
+
16
+ Shell requires Node.js 20.19 or newer and installs the `amalgm` command:
17
+
18
+ ```bash
19
+ npx --package @amalgm/shell amalgm login --no-open
20
+ ```
21
+
22
+ Login enrolls the computer, obtains browser approval or redeems a setup code,
23
+ persists the installation identity, converges the user's portable ground, and
24
+ starts the runtime. Omit `--no-open` to let the command open the approval page,
25
+ or pass `--setup-code CODE` when you already have a setup code.
26
+
27
+ Private device keys use the native macOS Keychain or Windows DPAPI where
28
+ available, with a verified mode-0600 file fallback. Key material is never put
29
+ in a process argument. Missing, corrupt, or rejected keys fail closed instead
30
+ of silently changing the machine's identity.
31
+
32
+ ## Run and inspect the runtime
33
+
34
+ ```bash
35
+ # Start or resume one enrolled user.
36
+ npx --package @amalgm/shell amalgm run --user person@example.com
37
+
38
+ # Read registration and authenticated runtime health without starting it.
39
+ npx --package @amalgm/shell amalgm status --user person@example.com
40
+ ```
41
+
42
+ Use `--user` when a machine has more than one enrolled Amalgm user. Other
43
+ global options include `--app-url URL`, `--amalgm-root PATH`, `--home PATH`,
44
+ and `--name NAME`.
45
+
46
+ The running host publishes an authenticated loopback boundary. Every protected
47
+ HTTP or WebSocket request crosses the shared Core token and routing laws;
48
+ narrowly exempt routes must establish their own session-scoped authority before
49
+ an effect runs.
50
+
51
+ ## Recover a device key
52
+
53
+ Recovery is explicit and preserves machine identity:
54
+
55
+ ```bash
56
+ npx --package @amalgm/shell amalgm auth recover --user person@example.com
57
+ ```
58
+
59
+ Shell stages a separate candidate key, requires browser approval or a setup
60
+ code, proves possession of the candidate, and promotes it only after the
61
+ control plane accepts it. A failed recovery leaves the previous identity and a
62
+ clean retry boundary.
63
+
64
+ ## Register and materialize Files workspaces
65
+
66
+ Files commands execute inside the already-running runtime so registration,
67
+ SQLite state, cloud transfer, and Watch share one lifecycle:
68
+
69
+ ```bash
70
+ # Declare, capture, upload, and watch an external workspace.
71
+ npx --package @amalgm/shell amalgm files register ./project \
72
+ --user person@example.com
73
+
74
+ # Materialize an owned cloud workspace into the current directory and watch it.
75
+ npx --package @amalgm/shell amalgm files add <workspace-id> \
76
+ --user person@example.com
77
+ ```
78
+
79
+ `files register` waits until the graph is reconciled, watcher coverage is
80
+ healthy, required immutable content is uploaded, and the graph head commits.
81
+ `files add` proves the selected ready machine and asks that runtime to download
82
+ the workspace; it does not perform a second login or create a second watcher.
83
+
84
+ Live owns the portable Files and transfer decisions. Shell supplies the real
85
+ filesystem, Git, watcher, cache, authenticated wire, and object-storage effects.
86
+ Ordinary file content, symlinks, and Git repositories keep their distinct
87
+ transfer contracts, and portable state remains separate from machine-only
88
+ control state.
89
+
90
+ ## What a Shell release contains
91
+
92
+ Every `@amalgm/*` dependency is pinned to one exact registry version. A Shell
93
+ release therefore identifies one combination that was built and tested
94
+ together rather than allowing product versions to drift independently on a
95
+ user's machine.
96
+
97
+ The current signed baseline starts Core, Files, Agents, Tools, and Chat.
98
+ Shell also carries the published Apps, Automations, Browser, Channels, and Live
99
+ SDKs needed for routed, lazy, hosted, or direct product integrations. A package
100
+ being installed is not by itself proof that it is a baseline boot service: the
101
+ verified release catalog is the authority for that graph.
102
+
103
+ Products projected into the Toolbox keep their own ownership:
104
+
105
+ - Agents owns agent identities, installations, and immutable revisions.
106
+ - Apps owns versioned application releases, deployments, and supervision.
107
+ - Automations owns schedules, event triggers, leases, action plans, and run
108
+ journals.
109
+ - Browser owns persistent, observable browser operation.
110
+ - Channels owns durable notification delivery.
111
+ - Chat owns durable conversations, turns, reconnect, and interrupt.
112
+ - Tools owns tool identity, immutable deployments, loadouts, and execution.
113
+ - Live owns portable entities, Files convergence, transfer, and presence law.
114
+
115
+ Shell projects or routes those capabilities; it does not become their data
116
+ owner.
117
+
118
+ Hosted Automations uses `https://automations.amalgm.ai`. Machine authorization
119
+ proofs are bound to that exact canonical origin; do not substitute the Fly
120
+ deployment hostname. A queued `chat.chat_agent_run` step resolves the installed
121
+ agent on this machine, starts its own durable Chat conversation, and rejoins
122
+ that same turn when Automations retries the step.
123
+
124
+ ## Embedding Shell
125
+
126
+ Install the package when building a host or an examination around the same
127
+ composition:
128
+
129
+ ```bash
130
+ npm install @amalgm/shell
131
+ ```
132
+
133
+ The root export includes `bootShell`, `composeShell`, `createGateway`,
134
+ `MachineHost`, `UserGroundHost`, `NodeWatchHost`, `WireClient`, the signed
135
+ `shellReleaseCatalog`, and their public types. Authorization helpers are also
136
+ available from the focused `@amalgm/shell/authorization` entry point.
137
+
138
+ Use `bootShell` for the complete host, `composeShell` for an injected
139
+ composition, and `createGateway` when mounting authenticated brick routes in a
140
+ custom host. Host effects should be created once and injected; product code
141
+ should continue to live in its owning package.
142
+
143
+ ## Historical Engine reference
144
+
145
+ `amalgm-engine` is deprecated. It remains useful as read-only historical
146
+ evidence for parity, migration, and contract archaeology, but Shell never
147
+ starts it beside a released service and never falls back to its implementation
148
+ at runtime. Current behavior is determined by the published product packages,
149
+ Shell's code, tests, and verified release catalog.
@@ -1,9 +0,0 @@
1
- import { type AutomationEventsApiConfig } from "@amalgm/automations";
2
- import type { BrickMount } from "./gateway.js";
3
- export type AutomationEventsHostConfig = AutomationEventsApiConfig;
4
- /**
5
- * Node HTTP transport for the Automations brick's /events Fetch API. Target
6
- * identity and delivery capabilities are injected; all ingress decisions stay
7
- * in @amalgm/automations.
8
- */
9
- export declare function automationEventsMount(config: AutomationEventsHostConfig): BrickMount;
@@ -1,34 +0,0 @@
1
- import { Readable } from "node:stream";
2
- import { createAutomationEventsApi, } from "@amalgm/automations";
3
- /**
4
- * Node HTTP transport for the Automations brick's /events Fetch API. Target
5
- * identity and delivery capabilities are injected; all ingress decisions stay
6
- * in @amalgm/automations.
7
- */
8
- export function automationEventsMount(config) {
9
- const api = createAutomationEventsApi(config);
10
- return {
11
- prefix: "/events",
12
- stream: async (req, res, pathname) => {
13
- const source = new URL(req.url ?? pathname, "http://localhost");
14
- const headers = new Headers();
15
- for (const [name, value] of Object.entries(req.headers)) {
16
- if (Array.isArray(value))
17
- headers.set(name, value.join(", "));
18
- else if (value !== undefined)
19
- headers.set(name, value);
20
- }
21
- const method = req.method ?? "GET";
22
- const init = { method, headers };
23
- if (method !== "GET" && method !== "HEAD") {
24
- init.body = Readable.toWeb(req);
25
- init.duplex = "half";
26
- }
27
- const request = new Request(`http://automations.local${pathname}${source.search}`, init);
28
- const response = await api(request);
29
- res.writeHead(response.status, Object.fromEntries(response.headers.entries()));
30
- res.end(Buffer.from(await response.arrayBuffer()));
31
- },
32
- };
33
- }
34
- //# sourceMappingURL=events-host.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"events-host.js","sourceRoot":"","sources":["../src/events-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EACL,yBAAyB,GAE1B,MAAM,qBAAqB,CAAC;AAM7B;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAkC;IACtE,MAAM,GAAG,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAC9C,OAAO;QACL,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE;YACnC,MAAM,MAAM,GAAG,IAAI,G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