@feltdb/feltkit 0.3.23 → 0.3.25

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 (58) hide show
  1. package/dist/app.d.ts +75 -0
  2. package/dist/app.js +69 -1
  3. package/dist/app.js.map +1 -1
  4. package/dist/appboundry/build.d.ts +1 -1
  5. package/dist/appboundry/build.js +18 -4
  6. package/dist/appboundry/build.js.map +1 -1
  7. package/dist/appboundry/guest.d.ts +11 -0
  8. package/dist/appboundry/guest.js +20 -0
  9. package/dist/appboundry/guest.js.map +1 -1
  10. package/dist/cli/deploy-appboundry.d.ts +26 -0
  11. package/dist/cli/deploy-appboundry.js +1 -1
  12. package/dist/cli/deploy-appboundry.js.map +1 -1
  13. package/dist/cli/main.js +68 -3
  14. package/dist/cli/main.js.map +1 -1
  15. package/dist/client/index.js +52 -10
  16. package/dist/client/index.js.map +1 -1
  17. package/dist/docs.d.ts +1 -1
  18. package/dist/docs.js +2 -0
  19. package/dist/docs.js.map +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/measure/index.d.ts +117 -0
  22. package/dist/measure/index.js +479 -0
  23. package/dist/measure/index.js.map +1 -0
  24. package/dist/platform/managed.d.ts +43 -0
  25. package/dist/platform/managed.js +137 -0
  26. package/dist/platform/managed.js.map +1 -0
  27. package/dist/platform/platform.d.ts +23 -0
  28. package/dist/platform/platform.js +22 -2
  29. package/dist/platform/platform.js.map +1 -1
  30. package/dist/platform/releases.d.ts +40 -0
  31. package/dist/platform/releases.js +129 -6
  32. package/dist/platform/releases.js.map +1 -1
  33. package/dist/platform/workspace-operations.js +18 -3
  34. package/dist/platform/workspace-operations.js.map +1 -1
  35. package/dist/runtime/authboundry.d.ts +53 -0
  36. package/dist/runtime/authboundry.js +82 -0
  37. package/dist/runtime/authboundry.js.map +1 -0
  38. package/dist/runtime/runtime.js +0 -7
  39. package/dist/runtime/runtime.js.map +1 -1
  40. package/dist/runtime/transactions.js +10 -2
  41. package/dist/runtime/transactions.js.map +1 -1
  42. package/dist/server/index.js +49 -3
  43. package/dist/server/index.js.map +1 -1
  44. package/dist/server/project.d.ts +2 -0
  45. package/dist/server/project.js +9 -5
  46. package/dist/server/project.js.map +1 -1
  47. package/dist/server/tenancy.js +1 -1
  48. package/dist/server/tenancy.js.map +1 -1
  49. package/docs/AUTH.md +1 -0
  50. package/docs/EXTENSION-HOSTS.md +52 -0
  51. package/docs/MEASURE.md +144 -0
  52. package/docs/README.md +4 -2
  53. package/docs/TRANSACTIONS.md +42 -0
  54. package/docs/UPSTREAM-GAPS.md +1 -1
  55. package/package.json +6 -6
  56. package/skills/.claude-plugin/marketplace.json +1 -1
  57. package/skills/.claude-plugin/plugin.json +1 -1
  58. package/skills/feltkit-build/SKILL.md +14 -2
@@ -28,7 +28,7 @@ export async function handleTenancy(http, request, response, pathname) {
28
28
  const base = fromAppPortPrincipal(session?.principal);
29
29
  const attributes = (session?.attributes ?? {});
30
30
  if (!session || !base)
31
- throw new FeltKitError("UNAUTHORIZED", "The session ended. Sign in again.");
31
+ throw new FeltKitError("UNAUTHORIZED", "The session ended. Sign in again.", { hint: "SESSION" });
32
32
  if (tenantId)
33
33
  await tenancy.touch(tenantId, base.id);
34
34
  const issued = await runtime.issueSession(base, {
@@ -1 +1 @@
1
- {"version":3,"file":"tenancy.js","sourceRoot":"","sources":["../../src/server/tenancy.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAkB,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,aAAa,EAAsB,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAQ/C,8DAA8D;AA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AAE,GAAG,MAAM,OAAO,CAAC,MAAM,CACvC,IAAI,CAAC,KAAK,EACV,EAAE,GAAG,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EACpG,EAAE,eAAe,EAAE,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,CACjE,CAAC;QACF,OAAO,CAAC,UAAU,CAAC,4BAA4B,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC1E,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,YAAY,CAAC,WAAW,EAAE,mBAAmB,MAAM,IAAI,QAAQ,GAAG,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,IAAI,CAAC,QAAwB,EAAE,MAAc,EAAE,IAAa;IACnE,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC;AACd,CAAC"}
package/docs/AUTH.md CHANGED
@@ -116,6 +116,7 @@ Your own text: `accounts.email.templates[purpose](input) → { subject, text, ht
116
116
  - Signing out deletes the session and clears the cookie.
117
117
  - `GET /api/auth/sessions` lists your sessions.
118
118
  - `POST /api/auth/sessions/revoke` takes `{ ref }` for one, or `{ all: true, keepCurrent }` for all of them.
119
+ - **A session that ends, ends everywhere.** A refusal because the token no longer exists (signed out, revoked, expired) is `UNAUTHORIZED` with `hint: "SESSION"`. Open streams (`/api/events`, `/api/agent/actions/events`) re-check their session every `FELTKIT_SESSION_RECHECK_MS` (default 15 s); once it has ended, they send that error and close. The client applies one rule to every channel: on that answer to the token it sent, it clears the token (never a newer one) and fires `onSessionChange` once. An event subscription refused with 401 stops instead of retrying. See [EXTENSION-HOSTS.md](EXTENSION-HOSTS.md).
119
120
  - **Rotation.** A password change, and switching, creating, leaving or joining a workspace, replace the session (a new token; the old one ends).
120
121
  - **Always current.** An account session is resolved again on every request: the account as it is now, plus the live membership in its workspace. Changed roles, a disabled account, a removed membership or a changed role in a workspace take effect on the next request, not at expiry. Roles are never trusted as copied at sign-in. Dev, CLI and agent sessions carry the roles their issuer gave them.
121
122
  - **Trusted proxies.** `auth.session.trustProxy` is the number of reverse proxies in front that append to `X-Forwarded-For` and set `X-Forwarded-Proto`. With the default (0) both headers are ignored, because a client could forge them; the client address used for throttling is then the socket's.
@@ -0,0 +1,52 @@
1
+ # Browser extensions as a FeltKit host
2
+
3
+ A FeltKit application can run inside a browser extension, such as a Chrome MV3 side panel. It is the same application: the same React app, the same client, the same functions, authorization and data. It is not a second app architecture. The extension is a **host** for the app's existing client, pointed at a deployed instance with a bearer session.
4
+
5
+ The reference implementation is PersonalOS (`extension/`; acceptance in `e2e/extension.mjs`).
6
+
7
+ ## Who owns what
8
+
9
+ | Concern | Owner | How |
10
+ |---|---|---|
11
+ | Functions, authorization, data, model, approvals | **The app's server** (unchanged) | The extension calls the same `/api/*` endpoints as the web app. Nothing is trusted from the extension. |
12
+ | Sessions: issue, lifetime, revocation, end-of-session signalling | **FeltKit** | Bearer sessions (`fks_…`, `auth.sessionTtlMs`). A session that ends is answered with `UNAUTHORIZED` + `hint: "SESSION"` on every channel, and open streams close ([AUTH.md](AUTH.md)). |
13
+ | Client transport | **FeltKit** | `createClient({ url, session: "bearer", tokens })`. Every channel sends `Authorization: Bearer`: requests, streamed actions, `/api/events`, `/api/agent/actions/events`, `/appport/events`. There is no `EventSource`, and no token in any URL. File links use `fkf_` capability paths. |
14
+ | Where the token is kept | **The host adapter** (the app's `extension/`) | A synchronous `TokenStore` (`get`, `set`) backed by memory and written through to `chrome.storage.local`, with storage locked to trusted contexts (see Security). |
15
+ | Which instance; the host permission | **The host adapter** | The person enters the instance URL. The adapter requests `optional_host_permissions` for that one origin and checks `/api/session` names the expected `application`. |
16
+ | Extension-only UI (page bar, context menu) | **The app** | Product features that call the app's own functions. |
17
+ | Visual system | **stack-ui** | The app's UI layer. A narrow-host navigation pattern (a menu) belongs in stack-ui's Shell, not in each app. |
18
+
19
+ FeltKit adds **no extension-specific API**. The contract is the bearer client, plus the session-end rule that any long-lived client needs.
20
+
21
+ ## Security
22
+
23
+ - **CORS.** An extension page with a host permission for the instance origin is exempt from CORS in Chrome; this was verified against FeltKit, which serves no CORS headers. A web page on another origin is not exempt, and FeltKit still grants no CORS.
24
+ - **CSRF.** Bearer requests carry no ambient credential, so they are CSRF-exempt by design.
25
+ - **Token storage.** `chrome.storage.local` is readable by the extension's content scripts, which run inside web pages, unless `chrome.storage.local.setAccessLevel({ accessLevel: "TRUSTED_CONTEXTS" })` is set. The adapter sets it in the service worker on every start, and in the panel before it reads the session. This was verified in Chromium: a content script gets "Access to storage is not allowed from this context".
26
+ - **No credentials in URLs, logs or the console.** Checked across all requests in the acceptance run.
27
+ - **Least privilege.** Host access is requested for the one instance origin at connect time (`optional_host_permissions`). The service worker holds no session and never calls the instance.
28
+ - **Revocation and expiry.** Either one, on any session, is noticed by an open panel with no user action: the stream re-check closes the stream, and the client clears the token. Measured: 0.7 s after revocation with `FELTKIT_SESSION_RECHECK_MS=1000`. With FeltKit 0.3.23 an open panel kept a revoked or expired token indefinitely.
29
+
30
+ ## Lifecycle (verified)
31
+
32
+ | Event | Behaviour |
33
+ |---|---|
34
+ | Panel closed mid-stream, then reopened | Still signed in (token from storage). The interrupted turn's message is in the conversation history, and existing data is intact. |
35
+ | Stop during a stream | The reply stops; the next message streams normally. |
36
+ | Browser restart | Still signed in, with the same session. |
37
+ | Extension update | The new version keeps the session, and storage stays locked. |
38
+ | Session revoked or expired | Streams close and the token is cleared. The app shows its signed-out state. |
39
+
40
+ ## Gap register
41
+
42
+ | # | Gap | Owner | Status |
43
+ |---|---|---|---|
44
+ | X1 | Open streams outlived their session (revocation, sign-out, expiry) | FeltKit server | **Fixed.** Re-check on an interval; `error` + close. Test-verified (`session-end.test.ts`) and browser-verified. |
45
+ | X2 | Client cleared the token on only one channel, matched by message text | FeltKit client | **Fixed.** One rule keyed on `hint: "SESSION"`; the legacy message is still accepted from older servers. Test-verified and browser-verified. |
46
+ | X3 | `subscribe()` retried forever on 401 | FeltKit client | **Fixed.** Stops. Test-verified. |
47
+ | X4 | `/appport/events` kept an open stream after its session ended | AppPort (`@appport/server`) | **Security follow-up, fix in review** (rkendel1/appport#290): the binding re-identifies open streams (`reidentifyMs`, default 15 s) and ends them with `UNAUTHORIZED`. Test-verified in AppPort (fails before the fix), and end-to-end through FeltKit with a local build (closed 14.8 s after revocation; published 1.3.1 still open at 20 s). Until AppPort is released and FeltKit's dependency bumped, FeltKit refuses a dead token on connect and the client stops, but an already-open AppPort stream lasts until it drops. |
48
+ | X5 | No session refresh; 7-day absolute lifetime | FeltKit | By design for now. The person signs in again; documented. |
49
+ | X6 | OAuth providers and e-mail links return to the web origin, not into the extension | FeltKit / app | Open. Use password or dev sign-in in the panel, or sign in on the web and use an operator-issued session. A `chrome.identity.launchWebAuthFlow` handoff would be an adapter feature built on the existing session API. |
50
+ | X7 | A streamed action is not resumed after the panel reconnects | FeltKit | Open (P2). The generation record persists, and the conversation shows it as interrupted. |
51
+ | X8 | No CORS | — | Not needed for extensions (verified). Unchanged. |
52
+ | X9 | Narrow-host navigation (a hamburger menu) is not in stack-ui's Shell | stack-ui | **In review** (rkendel1/stack-ui#21): opt-in `narrowNavigation: 'menu'`, strip stays the default; PersonalOS adopts it (rkendel1/personalos#4). |
@@ -0,0 +1,144 @@
1
+ # Measuring an application: `feltkit measure`
2
+
3
+ `feltkit measure` reports what an application's repository is made of: which code expresses the
4
+ application, which code is plumbing it wrote for itself, what tools wrote, what the platform provides,
5
+ and how much of FeltKit it actually uses. It measures the repository. It doesn't load or run the app,
6
+ use the network, or estimate.
7
+
8
+ ```bash
9
+ npx feltkit measure # a Markdown summary
10
+ npx feltkit measure --json # the feltkit.measure/1 report
11
+ npx feltkit measure --write # keep the report in a file (see "report" below)
12
+ npx feltkit measure --check # for CI: fails on stale generated code, stale declarations,
13
+ # unclassified code, or a kept report that no longer matches
14
+ npx feltkit measure --compare a.json b.json c.json # several applications side by side
15
+ ```
16
+
17
+ Add it to `package.json` as `"measure": "feltkit measure"`, and `feltkit measure --check` to CI.
18
+
19
+ ## Classes
20
+
21
+ Every file gets exactly one class, and the **basis** for it, so every number traces back to files.
22
+
23
+ | Class | What it is |
24
+ |---|---|
25
+ | `domain` | Server code that expresses the application: collections, rules, queries, mutations, actions (`feltkit/`). |
26
+ | `experience` | What people see and use: UI, styles, HTML, a browser extension. |
27
+ | `infrastructure` | Plumbing the application wrote for itself: scripts, servers, adapters, an app-built audit trail or queue. |
28
+ | `generated` | Written by a tool and unchanged: codegen output, or scaffolded files still identical to the template. |
29
+ | `configuration` | Build, package, deployment and tool configuration. |
30
+ | `tests` | Tests, fixtures and acceptance scripts. |
31
+ | `third-party` | Code vendored from another project (`vendor/`). |
32
+ | `platform` | Files the platform installs and keeps current (FeltKit Agent Skills in `.claude/skills/`). |
33
+ | `excluded` | Not code: documentation, images, fonts, lockfiles, licences. Counted, with 0 lines. |
34
+ | `unclassified` | No rule applies. A code file here fails `--check` until it is declared. |
35
+
36
+ **Authored** = domain + experience + infrastructure + configuration: what the application's team writes
37
+ and maintains. Tests are reported beside it.
38
+
39
+ A line of code is a line that isn't blank and isn't only a comment. JSON, YAML and TOML count
40
+ non-blank lines. The files are `git ls-files` (tracked files, plus untracked files that aren't
41
+ ignored). `node_modules`, `dist`, `.feltkit` and `.git` are never counted.
42
+
43
+ ## How a file is classified
44
+
45
+ The strongest evidence wins:
46
+
47
+ 1. **A declaration** in `feltkit.measure.json`, which must give a reason.
48
+ 2. **Provenance:**
49
+ - `feltkit/_generated/api.ts` is compared with what `feltkit codegen` would write now, so a
50
+ hand edit or a stale file shows up.
51
+ - `feltkit.scaffold.json`, which `create-feltkit` writes, holds a SHA-256 of every file it
52
+ scaffolded. A file still identical to it is `generated`. A changed one keeps its normal class
53
+ and is marked `scaffold: "modified"`.
54
+ - Agent Skills installed by `feltkit skills` are `platform` and are compared with the skills in
55
+ the installed FeltKit.
56
+ 3. **Path conventions** of a FeltKit project: `feltkit/` is domain, `src/` and `public/` are
57
+ experience, `scripts/` is infrastructure, `tests/` and `e2e/` are tests, `vendor/` is third-party.
58
+
59
+ An application created before `create-feltkit` wrote `feltkit.scaffold.json` can reconstruct one. Run
60
+ the same create-feltkit version's scaffold with the app's name into an empty directory, and commit the
61
+ manifest it records with a note saying so. Without a manifest, scaffolded files are counted by path,
62
+ and the report says so.
63
+
64
+ ## `feltkit.measure.json`
65
+
66
+ ```json
67
+ {
68
+ "report": "measure.json",
69
+ "classify": [
70
+ { "path": "feltkit/_audit.ts", "class": "infrastructure", "reason": "business audit trail, until FeltKit has one" },
71
+ { "path": "scripts/**", "class": "tests", "reason": "acceptance scripts" }
72
+ ],
73
+ "acknowledged": {
74
+ "audit-trail:feltkit/app.ts": "the events collection is the app's audit trail"
75
+ }
76
+ }
77
+ ```
78
+
79
+ - `report`: where `--write` keeps the report and `--check` compares it. The file isn't measured itself.
80
+ - `classify`: a path or glob (`*` within a segment, `**` across segments; a directory covers
81
+ everything under it), a class, and a reason. A declaration that matches no file fails `--check`.
82
+ - `acknowledged`: findings (`<id>:<file>`) the team has reviewed and keeps, with why. An entry whose
83
+ finding no longer exists fails `--check`.
84
+ - `scaffold`: the manifest's path, if not `feltkit.scaffold.json`.
85
+
86
+ ## Platform consumption
87
+
88
+ These are static call sites, in authored code and tests:
89
+
90
+ - `ctx.<area>` (`ctx.db`, `ctx.auth`, `ctx.model`, `ctx.agent`, …), counted only in `feltkit/`,
91
+ where `ctx` is FeltKit's function context.
92
+ - `ctx.afterCommit.<effect>` and `ctx.services.<service>`.
93
+ - Every name imported from `@feltdb/feltkit`, `/react`, `/client` or `/testing`, counted where it's
94
+ used.
95
+
96
+ `definitions` counts `app.<method>(` calls in `feltkit/` (collections, queries, mutations, actions,
97
+ agents) and lists collection names.
98
+
99
+ ## Infrastructure findings
100
+
101
+ These are static patterns in authored code that suggest the application built something the platform
102
+ provides, or something the platform does not provide yet. Each finding names its file and line, the
103
+ evidence, and the platform alternative. `platform: null` means FeltKit has none yet: **a platform gap
104
+ candidate**. A finding is a candidate for review, not a verdict, and findings don't fail `--check`.
105
+
106
+ | id | Looks for |
107
+ |---|---|
108
+ | `http-server` | express, fastify, koa, hono, `createServer(` |
109
+ | `realtime-server` | a WebSocket server or a `text/event-stream` response in app code |
110
+ | `queue-or-scheduler` | queue or cron libraries, or `setInterval(` in server code |
111
+ | `model-sdk` | a model provider's SDK imported directly |
112
+ | `auth-library` | password hashing, JWT or session libraries |
113
+ | `hand-rolled-api-client` | `fetch("/api/…")` in the UI instead of the generated api |
114
+ | `sql` | `CREATE TABLE` / `ALTER TABLE` |
115
+ | `audit-trail` | a collection named audit, events, activity, actions or history (`app.auditTrail` does this) |
116
+ | `counter-collection` | a collection named counters or sequences (`ctx.db.sequence` does this) |
117
+
118
+ ## The report (`feltkit.measure/1`)
119
+
120
+ The report is deterministic, with no timestamps, so it can be committed. Its git history is the trend.
121
+ The TypeScript type is `MeasureReport` in the SDK (`src/measure/index.ts`).
122
+
123
+ | Field | Contents |
124
+ |---|---|
125
+ | `schema` | `"feltkit.measure/1"`. A breaking change gets a new version. |
126
+ | `app` | `name`, the declared `feltkit` dependency, and the `installed` version (null when not installed). |
127
+ | `method` | How files, lines, consumption and findings were measured, in words. |
128
+ | `provenance` | `scaffold` (generator, version, template, files, unmodified, modified, missing), `generated` (file, current), `skills` (name, installedBy, current). |
129
+ | `totals` | For each class, `{ files, lines }`. |
130
+ | `authored` | `{ files, lines }` for domain + experience + infrastructure + configuration. |
131
+ | `definitions` | `app` (method → count) and `collections` (names). |
132
+ | `consumption` | `[{ api, callSites, files }]`, the most-used first. |
133
+ | `findings` | `[{ id, title, file, line, evidence, platform, acknowledged? }]` |
134
+ | `checks` | `[{ name, ok, detail, fix? }]`. `--check` fails when any is false, or when the kept report differs. |
135
+ | `files` | `[{ path, class, basis, lines, scaffold? }]`: every file, so every total can be verified. |
136
+
137
+ ## What it doesn't do
138
+
139
+ - **It doesn't judge quality, and doesn't compare against a "without FeltKit" estimate.** Lines
140
+ written are measured; lines not written are not.
141
+ - **Its consumption figures are static.** They show where the app calls the platform, not how often
142
+ those calls run.
143
+ - **The boundary between domain and infrastructure inside `feltkit/` comes from declarations and
144
+ findings.** Path conventions alone can't draw it.
package/docs/README.md CHANGED
@@ -1,13 +1,14 @@
1
- # FeltKit 0.3.23 documentation
1
+ # FeltKit 0.3.25 documentation
2
2
 
3
3
  Shipped with `@feltdb/feltkit`. In a project: `node_modules/@feltdb/feltkit/docs/`, or run `npx feltkit docs`.
4
- Public copy: https://cdn.jsdelivr.net/npm/@feltdb/feltkit@0.3.23/docs/README.md
4
+ Public copy: https://cdn.jsdelivr.net/npm/@feltdb/feltkit@0.3.25/docs/README.md
5
5
 
6
6
  - [ARCHITECTURE.md](ARCHITECTURE.md): How FeltKit is put together: one FeltDB instance, AppPort, AppPort Services
7
7
  - [GUARANTEES.md](GUARANTEES.md): What FeltKit guarantees, and its known limitations
8
8
  - [TRANSACTIONS.md](TRANSACTIONS.md): Mutations, ctx.db.sequence and ctx.afterCommit: the transaction contract
9
9
  - [SECURITY.md](SECURITY.md): Authorization, sessions, credentials, and production Studio
10
10
  - [AUTH.md](AUTH.md): Accounts, sessions, workspaces (tenancy), invitations, and the React sign-in and workspace screens
11
+ - [EXTENSION-HOSTS.md](EXTENSION-HOSTS.md): Running the app in a browser extension: ownership, token storage, session end, lifecycle, gaps
11
12
  - [AGENT-OPERATIONS.md](AGENT-OPERATIONS.md): Agents: MCP, tasks, proposals, approvals, and evidence
12
13
  - [GENERATION.md](GENERATION.md): Model generation in an application: actions, streaming, tools as proposals, in-app approvals, caller context
13
14
  - [RESOLVER.md](RESOLVER.md): Model references: change the model a deployed app uses through Resolver, without a redeploy
@@ -18,3 +19,4 @@ Public copy: https://cdn.jsdelivr.net/npm/@feltdb/feltkit@0.3.23/docs/README.md
18
19
  - [APPBOUNDRY-DEPLOY-CONTRACT.md](APPBOUNDRY-DEPLOY-CONTRACT.md): The deployment contract FeltKit expects from AppBoundry (proposed)
19
20
  - [WHY-FELTKIT.md](WHY-FELTKIT.md): Design choices, compared with Convex
20
21
  - [UPSTREAM-GAPS.md](UPSTREAM-GAPS.md): Known gaps in FeltDB, AppPort and AppPort Services, and their status
22
+ - [MEASURE.md](MEASURE.md): feltkit measure: what an application is made of, its provenance, platform use and app-built infrastructure
@@ -118,6 +118,15 @@ sequence name rule and encoding, and the outbox state machine and recovery polic
118
118
  shared module with no Node imports. FeltKit's runtime and the artifact guest (through the
119
119
  host) both use it.
120
120
 
121
+ **Anonymous callers.** An effect runs as the caller. A function called without a signed-in caller
122
+ (`access: "public"`, such as a contact form) has no one to run it as, so staging a notification,
123
+ webhook or job refuses with `UNAUTHORIZED`, and the mutation doesn't commit. The refusal names the
124
+ function and the supported path: declare an agent (`app.agent`, §8) and stage
125
+ `ctx.afterCommit.agent(name, input)`. The agent runs after the commit as its own declared principal and
126
+ can send the notification. In an AppBoundry artifact, where application agents can't run, the refusal
127
+ says so instead. Giving effects a declared identity of their own is an open design question (TA-1 in
128
+ docs/platform/GAP-REGISTER.md).
129
+
121
130
  **AppBoundry: host interface `transactions@1`.** It is required only by artifacts that use
122
131
  these features:
123
132
 
@@ -311,3 +320,36 @@ retry runs it; a run repeated after its writes committed writes nothing again; a
311
320
  triggers nothing; an `app.event` in `on` triggers it; tenancy (non-member → no tenant; member → its
312
321
  tenant with its own role); a pending run survives a restart and the next process performs it;
313
322
  declarations are checked; an AppBoundry build refuses `app.agent`.
323
+
324
+ ## 9. Business audit trail (`app.auditTrail`)
325
+
326
+ SupplyDesk and TableOS each wrote the same thing: a collection of events about their own subjects,
327
+ written in the same transaction as each change, with the actor and the request id. FeltKit provides it:
328
+
329
+ ```ts
330
+ export const events = app.auditTrail("events", { subjects: ["invoice", "vendor"] as const });
331
+
332
+ // in a mutation, next to the change it describes:
333
+ await events.record(ctx, { subject: "invoice", id, type: "invoice.approved", data: { amount } });
334
+
335
+ // anywhere (a query, a mutation):
336
+ const history = await events.history(ctx, "invoice", id); // in order
337
+ ```
338
+
339
+ | Field | |
340
+ |---|---|
341
+ | `subjectType`, `subjectId` | What the event is about (`subjects` is the closed list). |
342
+ | `type`, `data` | The app's event name and details. |
343
+ | `actor`, `actorType` | The caller, or `anonymous` for a public call: an event never refuses a public form. |
344
+ | `at` | Wall-clock time, for display. |
345
+ | `seq` | **The order**: a FeltDB sequence per subject, allocated in the writing transaction (1, 2, 3…, no repeats or gaps among committed events), never a clock. |
346
+ | `requestId` | The request that caused it: the link to FeltKit's activity log (capability, authorization decision, writes). |
347
+
348
+ - **Atomicity.** If the mutation fails or its commit is refused, the event isn't written either.
349
+ - **Reading it.** The trail is an ordinary declared collection (with `tenant` if the app is
350
+ multi-tenant), so queries can read it with `ctx.db`. Who may read it is decided by the functions that
351
+ read it.
352
+ - **Append-only** is the helper's contract, not enforced storage: the app shouldn't patch or delete
353
+ events.
354
+ - **Where it runs.** It works in FeltKit and in AppBoundry artifacts. An artifact with a trail requires
355
+ `transactions@1`, because of the sequence.
@@ -93,7 +93,7 @@ A1–A4 are closed by the released `@appport/core` 1.4.0 / `@appport/sdk` 1.4.0
93
93
  | A7 | `HttpBinding` (mapped mode) answers 500 for any code outside AppPort's standard set, including namespaced extension codes and codes a capability's integration contract declares (`failures[].code`), with no way for the application to give them a status | — | FeltKit wraps the binding and sets the status for the codes it returns itself (`FELTKIT_APPPORT_STATUS`: `feltkit.FAILED_PRECONDITION` 409, `UPSTREAM_REJECTED`/`OUTCOME_UNKNOWN` 502, `UNAVAILABLE`/`NOT_CONFIGURED` 503), from the same table as its own HTTP API; `packages/sdk/test/error-contract.test.ts` | Open (found 2026-11-03). Ask: an option mapping extension codes to statuses, or using a declared failure's class |
94
94
  | A8 | Subscriptions are not authorized by the application's `Authorizer`. `server/src/connection.ts#subscribe` checks the event's declared permissions against `session.permissions` only: a connection identified by a principal (FeltKit's are; FeltKit grants from its policy, never from `session.permissions`) cannot subscribe to any permissioned event, and **a subscription to `*` requires nothing and receives every event, including events the session may not observe** (spec §21.7 says it must not be delivered). Events also have no scope, so a per-tenant event (presence in one workspace) reaches every subscriber | — | FeltKit does not use AppPort events yet (FK-GAP-004 is blocked on this). Reproduction: `packages/server/test/subscriptions.test.ts` on `rkendel1/appport` branch `claude/scoped-event-authorization` | Open (found 2026-11-05). Ask: authorize subscribe *and each delivery* through the application's `Authorizer` (event ref as the capability, `{ scope }` as input), and an optional `scope` on events and subscriptions |
95
95
  | A9 | `AuthorizationDecision` can deny only with `UNAUTHORIZED` or `FORBIDDEN`. A policy that hides what exists (an unknown id and a forbidden one answered alike, as `NOT_FOUND`) cannot say so in a decision | — | `feltkit({ authorize })` lets the hook throw `fail("NOT_FOUND", …)`, recorded as a denial (`authority.resource`) | Open (found 2026-11-05). Ask: an optional `NOT_FOUND` denial code (or a `conceal: true` flag) on the decision |
96
- | A10 | The HTTP event stream (`GET /appport/events`) names every subscription `sub_sse_<index>` (`@appport/server` 1.2.0 and 1.3.0, `http.ts#events`), and the application's event bus keys subscriptions by that id across connections. A second client's subscription replaces the first's, which silently stops receiving events | — | FeltKit gives each subscription its own bus id (`runtime.ts`, wrapping `application.subscribe`); the connection still echoes the client's id. `test/events.test.ts` (two clients, one scope) | Open (found 2026-11-05). Ask: a unique id per HTTP stream subscription (the connection's id), or a bus keyed per connection |
96
+ | A10 | The HTTP event stream (`GET /appport/events`) names every subscription `sub_sse_<index>` (`@appport/server` 1.2.0 and 1.3.0, `http.ts#events`), and the application's event bus keys subscriptions by that id across connections. A second client's subscription replaces the first's, which silently stops receiving events | — | FeltKit gives each subscription its own bus id (`runtime.ts`, wrapping `application.subscribe`); the connection still echoes the client's id. `test/events.test.ts` (two clients, one scope) | **Closed upstream; workaround removed.** `@appport/server` registers each subscription under a connection-scoped id (`connection.js`: `${connection}:${subscriptionId}`). FeltKit's wrapper is deleted; `test/events.test.ts` (several clients, one scope) passes on 1.3.2 without it |
97
97
 
98
98
  ## AppPort Services (`rkendel1/appport-services`)
99
99
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feltdb/feltkit",
3
- "version": "0.3.23",
3
+ "version": "0.3.25",
4
4
  "description": "FeltKit: one application, one FeltDB instance, one developer experience. SDK, runtime, CLI, and dashboard.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,13 +57,13 @@
57
57
  "@appport/authorization": "1.1.1",
58
58
  "@appport/integration": "1.2.5",
59
59
  "@appport/protocol": "1.5.0",
60
- "@appport/resolver-client": "0.2.3",
60
+ "@appport/resolver-client": "0.2.4",
61
61
  "@appport/schema": "1.1.6",
62
- "@appport/sdk": "1.8.0",
63
- "@appport/server": "1.3.1",
62
+ "@appport/sdk": "1.8.1",
63
+ "@appport/server": "1.3.2",
64
64
  "@appport/services": ">=0.16.0 <1.0.0",
65
65
  "@feltdb/core": ">=0.21.0 <1.0.0",
66
- "create-feltkit": "0.3.23",
66
+ "create-feltkit": "0.3.25",
67
67
  "esbuild": "0.25.12",
68
68
  "express": "4.22.3",
69
69
  "mailerport": ">=0.1.0 <1.0.0",
@@ -82,7 +82,7 @@
82
82
  }
83
83
  },
84
84
  "devDependencies": {
85
- "@appport/testing": "1.2.4",
85
+ "@appport/testing": "1.2.5",
86
86
  "@mailerport/service": "0.1.0",
87
87
  "@feltdb/webllm": ">=0.20.0 <1.0.0",
88
88
  "@modelcontextprotocol/sdk": "1.32.2",
@@ -10,7 +10,7 @@
10
10
  "name": "feltkit",
11
11
  "source": "./",
12
12
  "description": "Skills for building and operating FeltKit applications.",
13
- "version": "0.3.23"
13
+ "version": "0.3.25"
14
14
  }
15
15
  ]
16
16
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://anthropic.com/claude-code/plugin.schema.json",
3
3
  "name": "feltkit",
4
- "version": "0.3.23",
4
+ "version": "0.3.25",
5
5
  "description": "Skills for building and operating FeltKit applications: project structure and SDK, AppPort Services, FeltDB data and consistency, the FeltKit agent over MCP, and operations. Guidance only: they grant no permission.",
6
6
  "author": {
7
7
  "name": "FeltKit"
@@ -99,7 +99,11 @@ validation and the transaction: do not use it unless the user asks and understan
99
99
  - **Effects that announce the change**: `ctx.afterCommit.notifications.send(...)`, `.webhooks.emit(...)`,
100
100
  `.jobs.enqueue(...)` happen only if the mutation commits (recorded in its transaction, performed after it).
101
101
  `ctx.services.*` effects happen even if the commit is later refused.
102
- - **Ordering an append-only log** written in the same transaction (audit events): ``seq: await ctx.db.sequence(`audit:${invoiceId}`)``
102
+ - **A business audit trail**: `export const events = app.auditTrail("events", { subjects: ["invoice"] as const })`,
103
+ then `await events.record(ctx, { subject: "invoice", id, type: "invoice.approved", data })` next to the change, and
104
+ `events.history(ctx, "invoice", id)` to read it in order. Each event has the actor (or `anonymous`), the request
105
+ id and a per-subject `seq`, and commits with the change. Don't build your own (docs/TRANSACTIONS.md §9).
106
+ - **Ordering any other append-only log** written in the same transaction: ``seq: await ctx.db.sequence(`audit:${invoiceId}`)``
103
107
  and `orderBy: [{ field: "seq", direction: "asc" }]`. Never order by `Date.now()`: several writes share a millisecond.
104
108
  Order is per stream (the name): one stream per subject, so unrelated writers never contend. Writers to one stream
105
109
  serialize (`CONFLICT`); add `retry: { sequenceConflicts: 3 }` to the mutation to have it re-run instead, if its
@@ -176,6 +180,13 @@ test("a member completes a task", async () => {
176
180
 
177
181
  Each test app gets an isolated FeltDB instance. Test denials too (`app.as("viewer")` should be refused writes).
178
182
 
183
+ **Callers in tests.** `app.query(...)` / `app.mutation(...)` on the test app itself are **anonymous**: no session,
184
+ like a visitor on a public page. Use that for `access: "public"` functions. `app.as({ id, type: "user", roles: [] })`
185
+ is a *signed-in* account with no roles, a different caller: a staff-only function refuses it with FORBIDDEN, while
186
+ it refuses an anonymous caller with UNAUTHORIZED. `app.as(who, { session: false })` is a known principal without a
187
+ session. An anonymous mutation can't stage `ctx.afterCommit.notifications/webhooks/jobs` (they run as the caller);
188
+ stage `ctx.afterCommit.agent(name, input)` for a declared `app.agent` instead.
189
+
179
190
  ## Portability (AppBoundry)
180
191
 
181
192
  `npx feltkit build --target appboundry` compiles the app into `<name>.app` (runs without the project or FeltKit). It
@@ -184,7 +195,8 @@ refuses, naming file and line: `ctx.agent`, `ctx.unsafe`, `app.integration`,
184
195
  artifact has no locale data; format for people in the frontend). It omits Studio, `/mcp`, API keys, schedules and
185
196
  webhook delivery. A plain `feltkit build` prints the same list as a warning. If the user wants the artifact, avoid
186
197
  these from the start, and test it with `createArtifactTestApp("<name>.app")` from `@feltdb/feltkit/testing` (same
187
- `as(who).query/mutation` calls). No npm release of AppBoundry runs the format yet; it is built from its repository.
198
+ `as(who).query/mutation` calls). Serve it with `npx @appport/appboundry run <name>.app` (an app with built-in accounts
199
+ also needs `--accounts operator-sessions`: people then get sessions from the operator).
188
200
 
189
201
  ## When to stop and ask
190
202