@astrale-os/adapter-cloudflare 0.2.0 → 0.3.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.
Files changed (65) hide show
  1. package/dist/build.d.ts +2 -1
  2. package/dist/build.d.ts.map +1 -1
  3. package/dist/build.js +1 -1
  4. package/dist/build.js.map +1 -1
  5. package/dist/client.d.ts +14 -13
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +25 -18
  8. package/dist/client.js.map +1 -1
  9. package/dist/cloudflare.d.ts +4 -1
  10. package/dist/cloudflare.d.ts.map +1 -1
  11. package/dist/cloudflare.js +40 -18
  12. package/dist/cloudflare.js.map +1 -1
  13. package/dist/codegen/worker.d.ts +3 -3
  14. package/dist/codegen/worker.d.ts.map +1 -1
  15. package/dist/codegen/worker.js +19 -8
  16. package/dist/codegen/worker.js.map +1 -1
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +2 -2
  19. package/dist/params.d.ts +3 -0
  20. package/dist/params.d.ts.map +1 -1
  21. package/package.json +2 -2
  22. package/src/build.ts +2 -1
  23. package/src/client.ts +43 -18
  24. package/src/cloudflare.ts +41 -14
  25. package/src/codegen/worker.ts +19 -8
  26. package/src/index.ts +2 -2
  27. package/src/params.ts +4 -0
  28. package/template/CLAUDE.md +24 -0
  29. package/template/README.md +24 -15
  30. package/template/astrale.config.ts +4 -4
  31. package/template/client/README.md +9 -9
  32. package/template/client/__tests__/app.test.tsx +58 -19
  33. package/template/client/__tests__/harness.ts +16 -0
  34. package/template/client/__tests__/kernel.test.ts +23 -3
  35. package/template/client/src/shell/use-async.ts +4 -1
  36. package/template/client/src/status/components/StatusCard.tsx +115 -5
  37. package/template/client/src/status/hooks/useCheckable.query.ts +48 -40
  38. package/template/client/src/status/index.ts +2 -2
  39. package/template/client/src/status/status.api.ts +18 -1
  40. package/template/client/src/status/status.mappers.ts +89 -6
  41. package/template/client/src/status/status.types.ts +17 -2
  42. package/template/client/src/styles.css +235 -14
  43. package/template/client/src/views/status.tsx +1 -1
  44. package/template/core/monitor/index.ts +2 -2
  45. package/template/core/monitor/node.ts +12 -6
  46. package/template/domain.ts +6 -4
  47. package/template/functions/index.ts +31 -7
  48. package/template/package.json +2 -2
  49. package/template/pnpm-lock.yaml +57 -43
  50. package/template/pnpm-workspace.yaml +2 -0
  51. package/template/runtime/index.ts +8 -17
  52. package/template/runtime/monitoring/index.ts +8 -0
  53. package/template/runtime/{monitor → monitoring/monitor}/check.ts +3 -3
  54. package/template/runtime/{monitor → monitoring/monitor}/index.ts +3 -2
  55. package/template/runtime/{monitor → monitoring/monitor}/seed.ts +19 -10
  56. package/template/runtime/{monitor → monitoring/monitor}/watch.ts +5 -5
  57. package/template/runtime/{status-page → monitoring/page}/add.ts +2 -2
  58. package/template/runtime/{status-page → monitoring/page}/check.ts +2 -2
  59. package/template/runtime/{status-page → monitoring/page}/create.ts +3 -3
  60. package/template/runtime/monitoring/page/index.ts +9 -0
  61. package/template/schema/monitor.ts +6 -8
  62. package/template/views/index.ts +1 -1
  63. package/template/.agents/skills/astrale-cli/SKILL.md +0 -458
  64. package/template/.agents/skills/astrale-domain/SKILL.md +0 -371
  65. package/template/runtime/status-page/index.ts +0 -8
@@ -1,371 +0,0 @@
1
- ---
2
- name: Astrale Domain
3
- description: Develop, deploy, and iterate an Astrale domain end-to-end — schema modeling (classes, interfaces, edges, methods), handler implementation, calling the kernel and other domains from handlers, integrating external APIs (the core use case — DI, secrets, idempotency, sagas), views, testing, and the deploy/install loop with the cloudflare or astrale adapter. Use whenever creating a domain, adding classes/methods/views, structuring external API calls, or debugging install/dispatch/permission errors. Pairs with the astrale-cli skill (CLI ops) — together they cover working an Astrale instance autonomously.
4
- ---
5
-
6
- # Astrale Domain — the authoring bible
7
-
8
- An Astrale **domain** is a typed contract installed into a kernel's graph plus a
9
- **worker you own** that executes it. The kernel stores the schema (classes,
10
- edges, function contracts), enforces permissions, and routes calls; every
11
- method body runs on YOUR worker (Cloudflare worker or Astrale-managed service).
12
- The graph is the database AND the bus: domains read/write nodes+edges through
13
- the kernel and call each other's functions through it.
14
-
15
- **Mental model:** schema = what exists and what's callable · graph = state ·
16
- worker = behavior · kernel = router + authorizer. You never run a database or
17
- an RPC layer; you declare a contract and implement handlers.
18
-
19
- ## 0 · Start
20
-
21
- ```bash
22
- npx -y create-astrale-domain@latest my-domain --yes --instance <slug> # scaffold
23
- # managed `astrale` adapter is the DEFAULT; `--instance` stamps the
24
- # target instance into prod (`--adapter cloudflare` = your own CF account)
25
- cd my-domain && pnpm install
26
- pnpm dev # local wrangler dev (prints a URL; install it on an instance to test)
27
- # port 8787 taken? dev AUTO-PICKS a free one and prints it —
28
- # always trust the printed URL, and `curl <url>/meta` must name
29
- # YOUR domain (an orphan wrangler answers on stolen ports).
30
- pnpm dev --port 8899 # pin a port explicitly (disables auto-pick)
31
- pnpm dev --host https://my-box.preview.dev # dev behind a tunnel/sandbox preview:
32
- # binds 0.0.0.0 + pins WORKER_URL so iss doesn't drift
33
- pnpm prod # deploy + (astrale adapter) auto-install on your instance
34
- ```
35
-
36
- Project anatomy (the scaffold is the reference — read its comments):
37
-
38
- ```
39
- domain.ts # THE manifest — wires it ALL: defineDomain({ schema, methods,
40
- # deps, views, functions, client }) + origin/postInstall.
41
- # Modules are imported & passed EXPLICITLY (no folder magic);
42
- # a renamed module is a compile error here, not a missing route.
43
- astrale.config.ts # binds the domain to its deploy adapter (deploy(domain, …)) — node-only
44
- schema/ # classes/interfaces/edges — the contract (zod props, fn signatures)
45
- # + index.ts exports D = compileDomain(schema) (resolved paths/keys)
46
- core/<context>/ # pure, transport-agnostic logic per bounded context (e.g. core/monitor: keys/health/node)
47
- integrations/ # external-API ports + adapters + a lazy registry (see §4) — what deps is built from
48
- runtime/index.ts # composition root: the methods map; each execute resolves deps → calls core logic
49
- functions/ # standalone remote functions (webhook-shaped endpoints)
50
- views/ # iframe-mountable UI declarations (defineView)
51
- client/ # the SPA served under /ui (vite)
52
- deps.ts # env → typed Deps container (the seam defineDomain({ deps }) mounts)
53
- env.ts # typed worker env — config + secrets arrive here, mapped by deps.ts → ctx.deps
54
- ```
55
-
56
- Iteration loop: edit → `pnpm prod` → call it. Managed redeploys keep the same
57
- service URL and reinstall the contract; schema changes are merge/reconcile
58
- (removed entries can leave old nodes behind — see the astrale-live-domain-edit
59
- skill for graph-level cleanup).
60
-
61
- ## 1 · Schema modeling
62
-
63
- ```ts
64
- import { KernelSchema, defineSchema, edgeClass, nodeClass, nodeInterface } from '@astrale-os/kernel-core'
65
- import { fn } from '@astrale-os/kernel-dsl'
66
- import { z } from 'zod'
67
-
68
- export const ContactOps = nodeInterface({ // interface = shared contract
69
- methods: { createContact: fn({ static: true, params: {...}, returns: ... }) },
70
- })
71
- export const Contact = nodeClass({
72
- implements: [ContactOps, KernelSchema.interfaces.Container], // Container → can hold children
73
- props: { email: z.string(), company: z.string().optional() },
74
- methods: { assign: fn({ params: { project: z.string(), role: z.string() }, returns: ... }) },
75
- })
76
- export const works_on = edgeClass( // edges are CLASSES with PROPS
77
- { as: 'contact', types: [Contact] },
78
- { as: 'project', types: [Project] },
79
- { props: { role: z.string() } },
80
- )
81
- export const schema = defineSchema('my-domain.example.dev', {
82
- interfaces: { ContactOps },
83
- classes: { Contact, Project, works_on }, // EDGE classes register under `classes` too
84
- imports: [KernelSchema],
85
- })
86
- ```
87
-
88
- Conventions and rules:
89
- - Naming: classes/interfaces `PascalCase`, methods `camelCase`, **edges `snake_case`**.
90
- - `static: true` = called on the class (`/origin/class.X/method`); otherwise
91
- instance-dispatched (`/path/to/node::method`, handler gets `self`). Statics
92
- work on classes AND interfaces, wired through the same `method()` /
93
- `classMethods()` helpers (the scaffold's `seed` is a class-hosted static).
94
- - Model relations as **edges with props** (not foreign-key strings): create via
95
- `::link {edgeClass, target, props}`, walk via `::getLinks`. Prefer FLAT nodes
96
- + edges for peer resources; use Folders (Container) only for list-able
97
- hierarchies (`::listChildren` works on Folders).
98
- - Props are zod; they land in the graph under QUALIFIED keys
99
- (`origin:class.X.property.y`). Never hand-write key strings — derive them
100
- from the compiled schema: `D.Contact.email.key`, `K.Named.name.key`.
101
- - Known sharp edges: `::update` currently drops `z.enum()` props silently
102
- (create is fine — track status as plain string if you must update it); edge
103
- prop accessors exist at runtime but not in types yet (cast).
104
-
105
- ## 2 · Handlers
106
-
107
- Separate LOGIC from WIRING. Logic = plain async functions in `core/` taking the
108
- kernel client + ports + params (testable with fakes). Wiring = `method()` /
109
- `classMethods()` / `interfaceMethods()` in `runtime/index.ts` (the composition
110
- root — the only place request context + `deps` meet the `core/` logic):
111
-
112
- ```ts
113
- const kickoff = method(schema, 'Project', 'kickoff', {
114
- authorize: async () => undefined, // see §6 for real authorization
115
- execute: ({ kernel, self, params, deps }) => {
116
- if (!kernel) throw new Error('kickoff requires a kernel credential')
117
- return kickoffLogic(kernel, createWeatherClient(deps), self.path.raw, params)
118
- },
119
- })
120
- ```
121
-
122
- Handler context: `kernel` (callback client bound to the composed credential —
123
- caller's delegated authority ∪ this function's own), `self` (instance methods),
124
- `params` (zod-validated), `deps` (your typed `Deps` from `deps.ts`; raw `Env` if
125
- you omit the mapper), `auth` (principal, verified claims). Resolve ports from
126
- `deps` per request (`deps.prober()` — the registry builds + caches them per
127
- isolate) — NEVER construct external clients at module load (workers must be
128
- import-side-effect-free).
129
-
130
- ## 3 · Talking to the kernel (and other domains)
131
-
132
- Everything is `kernel.call(path, params)`. Addressing forms:
133
-
134
- | Form | Example | Use |
135
- |---|---|---|
136
- | tree path + `::method` | `/projects/apollo::get` | instance dispatch on a node |
137
- | static slash form | `/origin/class.X/method` | static class/interface methods |
138
- | colon MethodPath | `/:origin:class.X:method` | canonical form; REQUIRED in postInstall |
139
- | `@<uuid>::method` | `@4548…::get` | by graph id (NOT slugs/paths) |
140
-
141
- Core ops from handlers (all proven patterns):
142
-
143
- ```ts
144
- await kernel.call(K.Node.createNode.path.method.raw, { class: D.Contact.path.class.raw, path, props })
145
- await kernel.call(`${path}::update`, { props: { [D.Project.title.key]: 'New' } })
146
- // Edge props use QUALIFIED keys; the edge-prop TYPE accessor is missing today — use this cast:
147
- const ROLE_KEY = (D.works_on as unknown as { role: { key: string } }).role.key
148
- await kernel.call(`${path}::link`, { edgeClass: D.works_on.path.class.raw, target, props: { [ROLE_KEY]: role } })
149
- const links = await kernel.call(`${path}::getLinks`, {}) // filter by edge class
150
- await kernel.call('/other.domain/class.Echo/echo', { message }) // ANOTHER domain's function
151
- ```
152
-
153
- - **Cross-function calls work** (same- or cross-domain): the kernel redirects
154
- to the target worker and your worker mints a next-hop delegation as ITSELF —
155
- the receiver sees your function as the caller, with the original caller's
156
- authority threaded through the grant chain. Design service-to-service flows
157
- on this; no direct HTTP between workers.
158
- - Upsert idiom: try `createNode`, on path-conflict fall back to `::update`.
159
- - A missing parent yields `Permission denied: EDIT on /<parent>` — read that
160
- error as "does the parent exist?" first. Seed required folders in postInstall.
161
-
162
- ## 4 · External APIs — the core pattern
163
-
164
- Almost every real domain wraps an external API (payment, calendar, LLM
165
- gateway, cloud provider). The shape (see admin/domain for the full-scale
166
- example — Scaleway/WorkOS/KV):
167
-
168
- 1. **Port** — a narrow interface in `integrations/<feature>/port.ts` declaring
169
- only what the logic needs (`WeatherClient { forecast(city) }`, the scaffold's
170
- `Prober { probe(url) }`). `core/` logic depends on the port, never
171
- on fetch/SDKs/env.
172
- 2. **Adapter(s) + registry** — `createXClient(config)` in
173
- `integrations/<feature>/` (one per backend), plus a `registry.ts` that reads
174
- config + secrets from `env`, validates LOUDLY (`if (!env.X_API_KEY) throw`),
175
- sets base URLs (overridable so tests point at a stub), timeouts
176
- (`AbortSignal.timeout`), and maps upstream failures to errors with the
177
- upstream detail in `cause`. The registry builds the chosen adapter LAZILY +
178
- caches it per isolate (a worker never validates an unused backend's env).
179
- 3. **Wiring** — `deps.ts` mounts the registry (`defineDomain({ deps })`); the
180
- `execute` hook resolves the PORT from `deps` (`deps.prober()`) per
181
- request and passes it to the `core/` logic.
182
-
183
- Secrets & config:
184
- - Declare every var as a typed field on `Env` in `env.ts`. Secrets ship via
185
- the adapter's `secrets: '.env.dev' / '.env.prod'` (cloudflare adapter) —
186
- never committed, never defaulted. Fail fast for root-of-trust values; allow
187
- multi-name fallbacks only for developer convenience, never silently in prod.
188
- - Both adapters ship secrets from `secrets: '.env.<env>'` — cloudflare via
189
- wrangler secrets, astrale (managed) via the encrypted per-install store.
190
-
191
- Reliability rules (learned from the admin provisioning engine):
192
- - **Order effects**: external call FIRST, graph write AFTER when possible — a
193
- failed upstream then leaves nothing to clean up. When you must write first
194
- (reservations), write an INTENT record (state: 'provisioning'), make the
195
- external call idempotent (tags/external ids so re-entry ADOPTS instead of
196
- duplicating), and compensate on failure.
197
- - **Sagas for multi-step flows**: ordered phases; record state transitions on
198
- nodes (`provisioning → ready | failed`); compensation runs best-effort in
199
- reverse and NEVER throws (each step returns ok/skipped/error). Document
200
- which phases are safe to re-enter.
201
- - **Idempotency before mutation**: check existing state before writing; design
202
- re-runs of any handler to converge, not duplicate (postInstall seeds
203
- especially — they re-run on every reinstall).
204
-
205
- Anti-patterns (all observed in production code — don't):
206
- - constructing clients at module load, or monkey-patching `globalThis.fetch`;
207
- - scattering kernel-error message matching — the kernel exposes no stable
208
- error codes to handlers yet, so when you must match (the PATH_CONFLICT
209
- upsert), isolate it in ONE helper (the scaffold's `isPathConflict`) and
210
- treat it as tech debt;
211
- - god persistence files — split graph CRUD by entity;
212
- - leaving state fields mid-transition with no failure path (`'installing'`
213
- forever after a crash);
214
- - stringly-typed prop keys or class paths (always compiled accessors).
215
-
216
- ## 5 · Views & standalone functions (webhooks)
217
-
218
- - `defineView({ auth, mount: '/ui/contact', viewFor: selfOf(Contact) })` in
219
- `views/`, collected into the `views` map in `views/index.ts`, which
220
- `astrale.config.ts` imports and passes to `defineDomain({ views })`. The MAP
221
- KEY is the view's node slug (`'ui-contact'` → `/<origin>/core/views/ui-contact`).
222
- Installs a View
223
- node whose binding URL = `<serving url><mount>` (managed:
224
- `https://<slug>.svc.<region>.astrale.ai/ui/contact`). The client/ SPA
225
- serves `/ui/*` — BOTH adapters ship it (cloudflare via Workers Assets;
226
- managed via the platform's per-version asset archive); the SPA must handle
227
- any `/ui/<route>` via its fallback (the scaffold's vite config does).
228
- - Discovery: clients/GUIs find a node's views via
229
- `kernel.call('/kernel.astrale.ai/class.View/resolve', { node: <path> })` →
230
- `[{ path, url, name, origin }]` — `url` is the mounted iframe target.
231
- - `functions/` declares standalone callables (`defineRemoteFunction`) not
232
- attached to a class — each serves at `POST <worker>/functions/<slug>` and
233
- materializes a Function node under `/<origin>/core/functions/`. This is the
234
- INBOUND integration surface (webhooks).
235
-
236
- **The webhook-that-writes pattern** (validated): keep `auth: 'required'` and
237
- configure the external system's auth header with a minted delegation token —
238
- `astrale token --audience <service url> --ttl <seconds> --raw` (use a
239
- dedicated, attenuated identity: grant it only what the webhook needs).
240
- For `auth: 'public'` upstreams that can't carry a header (HMAC-signature
241
- webhooks, Stripe-style): `kernel` is null, but `ctx.selfKernel()` gives a
242
- session authenticated as THE FUNCTION'S OWN identity (its grants only) —
243
- VERIFY THE UPSTREAM SIGNATURE FIRST, then act as yourself. Needs
244
- `deps.INSTANCE_KERNEL_URL` (managed deploys set it) and the function identity
245
- granted exactly what it writes (e.g. EDIT on the target folder + USE on
246
- createNode + USE on the class — narrow, never root).
247
-
248
- **A PUBLIC view that reads the graph** (e.g. a server-rendered list page):
249
- the render ctx exposes `ctx.selfKernel()` (sdk ≥0.1.5) — a session as THE
250
- VIEW'S OWN identity. Read with it directly in `render`, template to HTML:
251
- `const k = await ctx.selfKernel(); const rows = await k.call('/messages::listChildren', {})`.
252
- Grant the view's function identity the READ-side minimum in your seed —
253
- the grant call is dispatched ON the identity node, with a bitmask:
254
- ```ts
255
- import { READ, USE, toMask } from '@astrale-os/kernel-core'
256
- await kernel.call('/<origin>/core/views/<view-slug>::grantPerm', { node: '/messages', perms: toMask(READ) })
257
- await kernel.call('/<origin>/core/views/<view-slug>::grantPerm', { node: '/:kernel.astrale.ai:interface.Container:listChildren', perms: toMask(USE) })
258
- ```
259
- Needs `deps.INSTANCE_KERNEL_URL` — managed deploys set it automatically; on
260
- the cloudflare adapter set it yourself: the instance's kernel API base is
261
- `https://<instance-slug>.eu.astrale.ai/api` (a vars entry or secret).
262
- Public-input
263
- hygiene: HTML-escape every stored string at render. (Prefer `selfKernel`
264
- over the `SELF` service binding for graph reads — `SELF` exists on both
265
- cloudflare and current managed runtimes, but it costs an extra HTTP hop and
266
- older hosts omit it.)
267
-
268
- **Calling a remote function over raw HTTP**: the response wraps your return
269
- value in an envelope — `{ result: <your value> }` (errors: `{ error }`).
270
-
271
- **Webhook idempotency** (senders retry — design for replays): derive a
272
- DETERMINISTIC node path from the sender's id (`/contacts/lead-<externalId>`),
273
- and make that key BOTH the existence check AND the write target. The classic
274
- bug is checking one key and writing another (random-suffixed) — the replay
275
- then duplicates. Custom `binding` supports REST-ish routes + header/body
276
- capture when the sender's shape is fixed (see distribution's proxy functions).
277
-
278
- ## 6 · Identity, auth, permissions
279
-
280
- - Your worker IS an identity: at install, every callable gets `(iss = serving
281
- URL, sub = function path)` stamped in the graph; the kernel verifies your
282
- worker's signatures against your live JWKS. `astrale.config.ts` origin =
283
- `schema.domain` (aliasing another origin triggers a DANGER prompt).
284
- - Inbound calls carry a delegation of the caller; your handler's `kernel` acts
285
- with `union(caller's delegated authority, your function's own grants)` —
286
- attenuation is automatic (you can't exceed what the caller + you hold).
287
- - `authorize` hook: return `undefined` to allow (relying on kernel-level
288
- checks downstream), or assert claims/perms before `execute` runs.
289
- - Permissions are bitmasks (READ/EDIT/USE/SHARE) on `has_perm` edges; grants
290
- on a node cascade down the tree. Function identities get USE on
291
- `mintDelegationCredential` at install (enables cross-function calls).
292
-
293
- ## 7 · Deploy & install
294
-
295
- Adapter choice in `astrale.config.ts` (each adapter is its OWN package — swap
296
- BOTH the import and the call):
297
- - `cloudflare({...})` from `@astrale-os/adapter-cloudflare` — your CF account;
298
- `dev` (wrangler dev), `prod` (route or workers.dev); ships secrets + SPA
299
- assets; extra bindings via a deep-merged `wrangler` block.
300
- - `astrale({ dev: {...}, prod: { instance: '<slug>' } })` from
301
- `@astrale-os/adapter-astrale` — managed (the scaffold's DEFAULT): publishes
302
- the bundle THROUGH the platform and installs it as a host-local service next
303
- to your instance (`https://<name>-<hash>.svc.<region>.astrale.ai`). No CF
304
- account; auth = your `astrale auth login` session. Ships the client SPA
305
- (`/ui` serves managed) and author secrets (`prod.secrets: '.env.prod'` —
306
- encrypted at rest platform-side, re-applied on redeploys; omit = keep,
307
- `{}` = clear; platform keys always win).
308
-
309
- The first deploy generates `.astrale/identity.ts` — the domain's SIGNING
310
- IDENTITY (its private key). Losing or regenerating it breaks reinstalls under
311
- the same origin; back it up (or commit it knowingly for throwaway domains).
312
-
313
- Dev-loop reality: `pnpm dev` serves on localhost — a REMOTE instance's kernel
314
- cannot fetch its install bundle. Local URL installs only work against a kernel
315
- that can reach you (local kernel, or a tunnel). Against a managed/remote
316
- instance, iterate with `pnpm prod` (the managed loop is ~25s and keeps the
317
- service URL stable).
318
-
319
- `postInstall` runs after every install — MUST be a colon MethodPath
320
- (`/:origin:class.X:seed`; tree paths are rejected) and MUST be idempotent
321
- (catch path-conflicts). Seed folders, defaults, and demo data here.
322
-
323
- Manual install of any served domain: `astrale domain install <url> --direct`.
324
-
325
- The managed catalog surface (what `pnpm prod` shells into) is callable
326
- directly — useful for recovery and inspection:
327
- `/admin/domains/<name>::install {instanceId, source:{kind:'package'}}` ·
328
- `::uninstall {instanceId}` (the un-wedge recipe before a retry) ·
329
- `::installations` · `::versions` — all on the admin instance (`-i admin`).
330
-
331
- ## 8 · Testing
332
-
333
- - **Logic**: unit-test with fake ports (the DI in §4 exists for this) and a
334
- fake kernel — an in-memory `{ call(path, params) }` that records calls /
335
- returns canned nodes. Assert call ORDER and failure paths (best-effort
336
- flows: one failing step must not block the rest).
337
- - **Wiring/contract**: typecheck is the contract test (`pnpm typecheck` /
338
- `tsgo --noEmit`); the schema drives param validation at runtime.
339
- - **Live smoke** (always finish with this): deploy, then drive the REAL surface
340
- with the CLI — create a node, call an instance method, walk an edge, call a
341
- cross-domain function. Fixture-green alone proves nothing about dispatch,
342
- identity, or bindings.
343
-
344
- ## 9 · Debugging quick table
345
-
346
- | Symptom | Likely cause |
347
- |---|---|
348
- | any managed-service 500 — `{"error":{"code":5000,"message":"internal error; reference = …"}}` | `astrale logs <service-slug>` tails the service's runtime buffer (console output, 5xx accesses, uncaught exception stacks) — the slug is the first label of the `…svc.<region>.astrale.ai` URL `pnpm prod` printed. Services deployed before log capture need one redeploy first. |
349
- | `Permission denied: EDIT on /x (param-target)` | `/x` doesn't exist — seed the parent |
350
- | `method "x" not found … call it as "/:o:class.C/x"` | instance form used for a static method |
351
- | `Delegation mint failed for <url>` | check `--debug` cause chain; worker→worker call machinery |
352
- | postInstall `not within origin` | tree path used — switch to `/:origin:class.X:method` |
353
- | install: `missing remote binding` | a callable lacks `binding.remoteUrl` — build via the adapter, not hand-rolled specs |
354
- | `ERR_PNPM_IGNORED_BUILDS` / approve-builds on `pnpm run` | template's pnpm-workspace.yaml needs `ignoredBuiltDependencies` + `verifyDepsBeforeRun: false` (recent scaffolds have it) |
355
- | stale/broken package versions on scaffold | clear pnpm metadata cache; check template floors are current |
356
- | TS: "Types of property '__brand' are incompatible" in untouched files | TWO copies of kernel-core/dsl in the tree (mixed link:/registry/override resolution) — unify versions, then `pnpm dedupe` |
357
- | runtime 500: `MISSING_DEF: Def at path "…" is not registered` | SAME dual-copy disease at runtime (defineSchema wrote copy A, compile read copy B) — and on managed installs it presents as the service never turning ready / install stuck `installing`. Unify + dedupe. |
358
- | managed install stuck at `installing` | check the SERVICE first: `curl <svc>/meta` (500 = the bundle itself is broken — run it locally with wrangler to see the real error); then `…::uninstall {instanceId}` and re-run the install |
359
- | `Path not found: /admin/instances/<uuid>` on install | `instanceId` takes the instance SLUG, not the node UUID (`astrale instance status <slug>` shows both) |
360
- | deploy: `Export named 'X' not found` from an @astrale-os module | a transitive dep resolved below its REAL floor — `pnpm add @astrale-os/<pkg>@<needed>` then `pnpm dedupe` |
361
-
362
- Use `astrale call <path> --describe` for any callable's schema, `--debug` for
363
- the full error chain, `curl <worker>/meta` for what a worker serves
364
- (domainName, schemaHash), and `astrale logs <service-slug> [--tail N]` for a
365
- managed service's runtime logs.
366
-
367
- ## Related skills
368
- - **astrale-cli** — every CLI command (auth, instances, calls, install).
369
- - **astrale-live-domain-edit** — graph-level schema surgery on a live kernel
370
- (no worker changes): temp specs, reinstall semantics, minimum class/method
371
- graph material.
@@ -1,8 +0,0 @@
1
- /**
2
- * StatusPage operations — one file per method, assembled here for the
3
- * composition root (`runtime/index.ts`). Transport-agnostic logic over a
4
- * `CallableKernel`, delegating the roll-up decision to `core/monitor`.
5
- */
6
- export { add } from './add'
7
- export { check } from './check'
8
- export { create } from './create'