@feltdb/feltkit 0.3.37 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.d.ts +153 -3
- package/dist/app.js +159 -7
- package/dist/app.js.map +1 -1
- package/dist/appboundry/build.js +21 -0
- package/dist/appboundry/build.js.map +1 -1
- package/dist/appboundry/guest.js +4 -0
- package/dist/appboundry/guest.js.map +1 -1
- package/dist/client/index.d.ts +189 -0
- package/dist/client/index.js +201 -0
- package/dist/client/index.js.map +1 -1
- package/dist/clock.d.ts +24 -0
- package/dist/clock.js +49 -0
- package/dist/clock.js.map +1 -0
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +1 -0
- package/dist/docs.js.map +1 -1
- package/dist/event-stage.js +2 -0
- package/dist/event-stage.js.map +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/policy.d.ts +9 -1
- package/dist/policy.js +16 -3
- package/dist/policy.js.map +1 -1
- package/dist/presence.d.ts +85 -0
- package/dist/presence.js +37 -0
- package/dist/presence.js.map +1 -0
- package/dist/quota.d.ts +72 -0
- package/dist/quota.js +143 -0
- package/dist/quota.js.map +1 -0
- package/dist/react/agent-control.d.ts +189 -0
- package/dist/react/agent-control.js +366 -0
- package/dist/react/agent-control.js.map +1 -0
- package/dist/react/index.d.ts +14 -1
- package/dist/react/index.js +41 -0
- package/dist/react/index.js.map +1 -1
- package/dist/runtime/activity.d.ts +8 -0
- package/dist/runtime/activity.js.map +1 -1
- package/dist/runtime/agent-control.d.ts +18 -0
- package/dist/runtime/agent-control.js +34 -1
- package/dist/runtime/agent-control.js.map +1 -1
- package/dist/runtime/agent.js +16 -4
- package/dist/runtime/agent.js.map +1 -1
- package/dist/runtime/assemble.js +1 -1
- package/dist/runtime/assemble.js.map +1 -1
- package/dist/runtime/authority.d.ts +38 -0
- package/dist/runtime/authority.js +13 -2
- package/dist/runtime/authority.js.map +1 -1
- package/dist/runtime/capabilities.js +2 -1
- package/dist/runtime/capabilities.js.map +1 -1
- package/dist/runtime/changes.d.ts +17 -0
- package/dist/runtime/changes.js +65 -2
- package/dist/runtime/changes.js.map +1 -1
- package/dist/runtime/context.d.ts +114 -0
- package/dist/runtime/contract.js +9 -3
- package/dist/runtime/contract.js.map +1 -1
- package/dist/runtime/events.js +17 -1
- package/dist/runtime/events.js.map +1 -1
- package/dist/runtime/integrations.js +7 -7
- package/dist/runtime/integrations.js.map +1 -1
- package/dist/runtime/invocations.d.ts +19 -2
- package/dist/runtime/invocations.js +16 -3
- package/dist/runtime/invocations.js.map +1 -1
- package/dist/runtime/policies.d.ts +5 -2
- package/dist/runtime/policies.js.map +1 -1
- package/dist/runtime/presence-host.d.ts +84 -0
- package/dist/runtime/presence-host.js +303 -0
- package/dist/runtime/presence-host.js.map +1 -0
- package/dist/runtime/providers.d.ts +5 -1
- package/dist/runtime/providers.js +11 -5
- package/dist/runtime/providers.js.map +1 -1
- package/dist/runtime/resource-access.d.ts +137 -0
- package/dist/runtime/resource-access.js +177 -0
- package/dist/runtime/resource-access.js.map +1 -0
- package/dist/runtime/runtime.d.ts +73 -0
- package/dist/runtime/runtime.js +594 -37
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/sessions.d.ts +11 -0
- package/dist/runtime/sessions.js +15 -0
- package/dist/runtime/sessions.js.map +1 -1
- package/dist/runtime/tenancy.d.ts +59 -0
- package/dist/runtime/tenancy.js +128 -0
- package/dist/runtime/tenancy.js.map +1 -1
- package/dist/runtime/workers.d.ts +123 -0
- package/dist/runtime/workers.js +291 -0
- package/dist/runtime/workers.js.map +1 -0
- package/dist/server/index.d.ts +0 -19
- package/dist/server/index.js +44 -4
- package/dist/server/index.js.map +1 -1
- package/dist/server/mcp.d.ts +8 -15
- package/dist/server/mcp.js +40 -3
- package/dist/server/mcp.js.map +1 -1
- package/dist/server/project.js +6 -5
- package/dist/server/project.js.map +1 -1
- package/dist/server/tenancy.d.ts +7 -0
- package/dist/server/tenancy.js +31 -0
- package/dist/server/tenancy.js.map +1 -1
- package/dist/server/watch.d.ts +10 -0
- package/dist/server/watch.js +88 -0
- package/dist/server/watch.js.map +1 -0
- package/dist/testing/index.d.ts +3 -1
- package/dist/testing/index.js +3 -2
- package/dist/testing/index.js.map +1 -1
- package/docs/AGENT-CONTROL.md +130 -4
- package/docs/APPBOUNDRY.md +37 -0
- package/docs/ARCHITECTURE.md +6 -2
- package/docs/AUTH.md +35 -0
- package/docs/COMPONENTS.md +71 -0
- package/docs/GUARANTEES.md +4 -4
- package/docs/PRESENCE-AND-SIGNALING-PROPOSAL.md +152 -0
- package/docs/README.md +3 -2
- package/docs/SECURITY.md +71 -3
- package/docs/TRANSACTIONS.md +48 -0
- package/docs/UPSTREAM-GAPS.md +16 -2
- package/package.json +13 -13
- package/skills/.claude-plugin/marketplace.json +1 -1
- package/skills/.claude-plugin/plugin.json +1 -1
- package/skills/feltkit-agent/SKILL.md +1 -1
- package/skills/feltkit-build/SKILL.md +11 -1
- package/skills/feltkit-data/SKILL.md +1 -1
- package/skills/feltkit-operations/SKILL.md +1 -1
- package/skills/feltkit-services/SKILL.md +1 -1
package/docs/SECURITY.md
CHANGED
|
@@ -229,10 +229,75 @@ bounded). It is null when nothing was evaluated. It is evidence only, never an i
|
|
|
229
229
|
keeps `Content-Security-Policy: …; sandbox`; reasons in `X-FeltKit-Variant-Reason` are FeltKit's own
|
|
230
230
|
text, reduced to printable ASCII.
|
|
231
231
|
|
|
232
|
+
## Quotas (rate limits)
|
|
233
|
+
|
|
234
|
+
- **Functions.** `quota: { per, limit, windowMs }` on a function, and `feltkit({ quotas })` for every function, limit
|
|
235
|
+
how often a caller runs it: per principal, per function (everyone together), per argument value (`arg:<name>`), or
|
|
236
|
+
per principal and argument. Checked at the execution boundary every interface shares (HTTP, AppPort, MCP, agents,
|
|
237
|
+
jobs, components), after the role check and argument validation and before the policies, the authorize hook and
|
|
238
|
+
the handler, so a refused call reads nothing and writes nothing. Refusal: `RATE_LIMITED` with
|
|
239
|
+
`details.retryAfterMs` and the quota that refused; HTTP 429 with `Retry-After` on `/api` and `/appport`; an MCP tool
|
|
240
|
+
error. Recorded in the activity log as a denial (not as a durable decision record: an abusive caller must not be
|
|
241
|
+
able to make the server write).
|
|
242
|
+
- **Channels** (`app.channel`) take the same `quota` per sender.
|
|
243
|
+
- **Public routes.** Guest sign-in (`POST /api/auth/guest`, 30/min) and tenant resolution
|
|
244
|
+
(`GET /api/tenants/resolve`, 120/min) are limited per client address; password sign-in and e-mail challenges keep
|
|
245
|
+
their own limits (docs/AUTH.md).
|
|
246
|
+
- **Counting.** Sliding windows in the server process (src/quota.ts): exact within a process, never above the limit
|
|
247
|
+
under concurrency, empty after a restart, and per process (two processes behind a balancer each allow `limit`).
|
|
248
|
+
Anonymous callers count per client address (`auth.session.trustProxy` decides which header is believed).
|
|
249
|
+
- **Not covered:** FeltKit's other routes (static files, Studio, `/appport/events` streams) and volumetric attacks.
|
|
250
|
+
Keep a reverse proxy or platform limit in front of production for those.
|
|
251
|
+
|
|
252
|
+
## Guests, agent grants and transient messages
|
|
253
|
+
|
|
254
|
+
- **Guests** (`auth.guests`, docs/AUTH.md "Guests"): a guest link's token is 256 bits, stored as a SHA-256 digest,
|
|
255
|
+
shown once. A guest session is resolved from its link on every request: a withdrawn or expired link is a 401 on the
|
|
256
|
+
next request. A guest holds only its link's role (from `auth.guests.roles`), reaches only functions that declare
|
|
257
|
+
`resource: { …, guests: true }` and only for its record (another record is NOT_FOUND), never actions, tenancy or
|
|
258
|
+
durable work (work it queued does not run as it). Its display name is its own words.
|
|
259
|
+
- **Agent grants**: a function with `resource: { …, agents: "grant" }` refuses every agent and service without a live
|
|
260
|
+
grant for that record. Only a person issues grants; revocation applies on the next call.
|
|
261
|
+
- **Channels**: the sender is checked (permission, send rule, size, quota) before the message is accepted; each
|
|
262
|
+
recipient is checked by the channel's receive rule at subscribe and before every delivery, wildcard subscriptions
|
|
263
|
+
included. Messages are never written to FeltDB or logged.
|
|
264
|
+
- **Public tenant resolution** answers a slug's or domain's branding only (presentation fields validated on write); it
|
|
265
|
+
reveals that a slug exists, which is what a public address is.
|
|
266
|
+
|
|
267
|
+
Every refusal by these layers is durable decision evidence (`_feltkit_decisions`, layers `resource` and `channel`).
|
|
268
|
+
|
|
269
|
+
## Workers, work grants, approvals and visibility (0.4.0)
|
|
270
|
+
|
|
271
|
+
- **Workers** (`ctx.grants.registerWorker`): a runner's own principal `worker:<name>` (type `agent`), never a person
|
|
272
|
+
or the service that registered it. Registering needs `feltkit.workers.write` and gives the worker no permission the
|
|
273
|
+
registrar does not hold. Its token is a session resolved from the registration on every request: revoking the
|
|
274
|
+
worker (`ctx.grants.revokeWorker`) ends its sessions and grants, and its very next call is a 401.
|
|
275
|
+
- **Work grants** (AppPort delegated authority, spec §12.5): a worker calls nothing without a live grant it names
|
|
276
|
+
(`x-appport-grant`, the AppPort envelope's `invocation.grantRef`, MCP `_meta["dev.appport/invocation"]`), issued to
|
|
277
|
+
it, covering the capability, for one actor and optionally one work item. AppPort's `delegatedAuthorityAuthorizer`
|
|
278
|
+
checks it on `/appport` and `/mcp`, and FeltKit checks the same records with the same rules at its execution
|
|
279
|
+
boundary on `/api`, so no surface skips it. Refusals are FORBIDDEN with `details.reason` (`GRANT_REQUIRED`,
|
|
280
|
+
`GRANT_REVOKED`, `GRANT_WORK_ITEM_MISMATCH`, `GRANT_ACTOR_MISMATCH`, …). A grant scoped to a work item reaches only
|
|
281
|
+
that record on a function bound to one (`resource`), and only that platform invocation. A person grants only for
|
|
282
|
+
themselves and only what they may call; a service names the actor. Handlers read `ctx.auth.invocation.verified`,
|
|
283
|
+
never the claim; the verified actor is recorded with the worker in activity and the audit record.
|
|
284
|
+
- **Approvals of exact calls** (`ctx.grants.approve`): only a signed-in person who may make the call approves it, for
|
|
285
|
+
one capability and exactly one input (`actionDigest`), optionally for one worker and work item. A non-person runs an
|
|
286
|
+
`approval: "required"` function only with such an approval (`x-appport-approval`); a changed input
|
|
287
|
+
(`APPROVAL_NOT_COVERED`), a revoked or expired approval, or another worker's use of it is refused. People still
|
|
288
|
+
call these functions directly, as before.
|
|
289
|
+
- **Visibility**: `internal` functions answer FUNCTION_NOT_FOUND on every surface and are never published; `worker` and
|
|
290
|
+
`service` functions refuse every other caller (layer `visibility`). An AppBoundry build refuses visibility, since
|
|
291
|
+
its host would dispatch them to anyone.
|
|
292
|
+
|
|
293
|
+
Refusals are durable decision evidence (layers `grant` and `visibility`). Grants, approvals and registrations live in
|
|
294
|
+
`_feltkit_resource_access`; there is no secret in them (a worker's token is a session, stored as the session store
|
|
295
|
+
stores every session).
|
|
296
|
+
|
|
232
297
|
## Known gaps
|
|
233
298
|
|
|
234
|
-
-
|
|
235
|
-
production deployments.
|
|
299
|
+
- Rate limits cover functions, channels and the public guest and tenant routes (above), counted per process. Other
|
|
300
|
+
routes have none: put a reverse proxy in front of production deployments.
|
|
236
301
|
- Session tokens in the browser are kept in `localStorage`; an XSS in your frontend can
|
|
237
302
|
read them.
|
|
238
303
|
- CORS is not enabled: the API is same-origin. Cross-origin clients need a proxy.
|
|
@@ -244,7 +309,10 @@ bounded). It is null when nothing was evaluated. It is evidence only, never an i
|
|
|
244
309
|
production.
|
|
245
310
|
- Production operator sessions cannot be listed or revoked from Studio; there is no MFA
|
|
246
311
|
and no external identity-provider integration beyond the `auth.authenticate` hook.
|
|
247
|
-
- Production Studio has no rate limiting of its own
|
|
312
|
+
- Production Studio has no rate limiting of its own.
|
|
313
|
+
- Workers are registered by application code; there is no Studio screen or CLI for them yet, and a worker's
|
|
314
|
+
registration lives at most 30 days (register it again). An approval binds the capability and its input, and
|
|
315
|
+
resources only through the input that names them.
|
|
248
316
|
- The first download of an image variant decodes on the server's event loop. With a large
|
|
249
317
|
`maxVariantPixels`, many first downloads at once slow other requests; the default (24 MP) and the files
|
|
250
318
|
byte cap (1 MiB by default) bound it.
|
package/docs/TRANSACTIONS.md
CHANGED
|
@@ -361,3 +361,51 @@ const history = await events.history(ctx, "invoice", id); // in order
|
|
|
361
361
|
history by `at` as well, or move it before switching. An anonymous caller is recorded as actor `anonymous`.
|
|
362
362
|
- **Where it runs.** It works in FeltKit and in AppBoundry artifacts. An artifact with a trail requires
|
|
363
363
|
`transactions@1`, because of the sequence.
|
|
364
|
+
|
|
365
|
+
## 10. Across boundaries: app writes, dispatch intent, and external effects through a crash
|
|
366
|
+
|
|
367
|
+
Sections 4–8 give each mechanism's own contract. This is what holds when a process stops (or a commit or a
|
|
368
|
+
call is lost) at each boundary between them, for the shape an application uses to make an external effect
|
|
369
|
+
from a state change: a mutation writes and stages the dispatch (`ctx.afterCommit.jobs.enqueue`), a job runs
|
|
370
|
+
an action, the action records and makes the effect (`ctx.effect`, below), and writes what came of it.
|
|
371
|
+
|
|
372
|
+
```
|
|
373
|
+
mutation ──commit──▶ outbox pending ──perform──▶ job created ──run──▶ action ──begin()──▶ effect ──▶ outcome ──▶ follow-up write
|
|
374
|
+
(1) (2) (3) (4) (5) (6) (7) (8)
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
| Stop or loss at | What is durable afterwards | What recovery does | Guarantee | Evidence |
|
|
378
|
+
|---|---|---|---|---|
|
|
379
|
+
| (1) before or during the mutation's commit | nothing: no writes, no outbox record, no sequence number | nothing to recover | atomic: all or nothing | §7; `test/transactions.test.ts`, `test/outbox.test.ts` |
|
|
380
|
+
| (1) the commit landed, its answer was lost | the writes, the outbox record | a same-key retry is answered from AppPort's record (`EFFECT_OUTCOME_UNKNOWN`) or refused by FeltDB's transaction-id binding | the writes commit once | `test/appport-adoption.test.ts` (A5) |
|
|
381
|
+
| (2) committed, the outbox record not yet performed | `pending` | the services worker performs it (30 s) | created once (Decision C) | `test/outbox.test.ts`, `tests/e2e/outbox-lifecycle.test.mjs` |
|
|
382
|
+
| (3) the record claimed, the job not yet created | `performing` | taken over after 300 s; creation and the done mark are one transaction | created once | as above |
|
|
383
|
+
| (4) the job's action stops before `begin()` | the job (Services retries it) | the job runs again | at least once, which is safe: nothing began | `test/action-effects.test.ts` |
|
|
384
|
+
| (5)–(6) after `begin()`, before or during the effect | `_feltkit_provider_calls` record `started`, no outcome | the job's next attempt **does not begin the effect again** (one record per job: `OUTCOME_UNKNOWN`); after `FELTKIT_PROVIDER_STRANDED_AFTER_SECONDS` the call is stranded, listed and settleable | at most once; the outcome is unknown until verified or settled | `test/action-effects.test.ts` ("a process that stops between begin() and the outcome…") |
|
|
385
|
+
| (6) the effect gave no definite answer | `unknown` | never repeated: a keyed AppPort retry gets the recorded answer, a retried job is refused at `begin()` | at most once | `test/action-effects.test.ts`, `test/integrations.test.ts` |
|
|
386
|
+
| (7) the effect failed (`effectFailed(...)`) | `failed` | an AppPort retry with the same key runs again (the key is released) | a known failure is retryable | `test/action-effects.test.ts` |
|
|
387
|
+
| (8) the effect succeeded, the follow-up write did not commit | `succeeded` (or `started`, if the stop came first) | the job's retry is refused at `begin()` (the effect is not repeated); the follow-up is not redone | **the effect is never repeated; the follow-up write may be missing** | below |
|
|
388
|
+
|
|
389
|
+
`ctx.effect` (an action's external effect, ActionCtx.effect) is AppPort's `runEffectful` over the same recorder
|
|
390
|
+
as providers' calls: `begin()` records `started` durably before the effect, and the outcome after it. Its record
|
|
391
|
+
id is the AppPort request id for a capability call (AppPort's idempotency answers retries), and one id per job
|
|
392
|
+
for a job's action, so a job's attempts share one record. `appport.invocation.status@1` answers "what happened
|
|
393
|
+
to my call?" from these records for the caller's own calls, and a person who may make the call settles it
|
|
394
|
+
(`client.settleCall`, `/api/provider-calls`).
|
|
395
|
+
|
|
396
|
+
**Found and fixed (0.4.0):** a mutation that opted into `retry: { sequenceConflicts }` was re-run on a sequence
|
|
397
|
+
conflict when it had used no `ctx.services`, even if it had called out through `ctx.integrations.invoke`: the
|
|
398
|
+
external call was then made again by every re-run. An attempt that calls `ctx.integrations` is now never re-run,
|
|
399
|
+
as for `ctx.services` (`test/transactions.test.ts`: without the fix all ten concurrent calls re-ran and committed).
|
|
400
|
+
|
|
401
|
+
**Not solved, by design (reported):**
|
|
402
|
+
- *An effect made inside a mutation.* `ctx.integrations.invoke` from a mutation runs while its transaction is
|
|
403
|
+
open: if the commit is then refused, the effect happened and the writes did not. It is recorded
|
|
404
|
+
(`_feltkit_integration_calls`), but nothing reconciles it with the refused writes. Make effects from an action,
|
|
405
|
+
dispatched with `ctx.afterCommit.jobs.enqueue`. Refusing it would break existing applications; FeltKit
|
|
406
|
+
documents it instead.
|
|
407
|
+
- *(8), a lost follow-up write.* After a stop between a successful effect and the action's own write of what came
|
|
408
|
+
of it, FeltKit keeps the effect from repeating but cannot redo the write: the action's output was never recorded.
|
|
409
|
+
The application finds such calls with `appport.invocation.status` (`succeeded`) or the call board and writes
|
|
410
|
+
the result then; an effect whose result is needed later should be looked up from the external system by a key
|
|
411
|
+
the action chose (the job id), not inferred from FeltKit's records.
|
package/docs/UPSTREAM-GAPS.md
CHANGED
|
@@ -88,9 +88,9 @@ A1–A4 are closed by the released `@appport/core` 1.4.0 / `@appport/sdk` 1.4.0
|
|
|
88
88
|
| A2 | A key sent to a capability without `idempotency: "supported"` was silently dropped | Refused in development (`IDEMPOTENCY_KEY_UNSUPPORTED`), logged in production (`unsupportedIdempotencyKey`) | The agent sends its attempt key only to capabilities that declare support (it used to send one to every consequential application capability, which development now refuses). Mutations keep declaring `"supported"`: that is the feature, not a workaround | Closed |
|
|
89
89
|
| A3 | Idempotency types not re-exported by `@appport/sdk`; no lookup by request id | Types, helpers, errors and `SessionStore` exported from `@appport/sdk`; optional `findByRequestId` | The structural `IdempotencyRecord` and `SessionStore` / `CreateSessionInput` copies are deleted; the stores implement the published interfaces | Closed |
|
|
90
90
|
| A4 | Only memory stores ship | By design no database-backed stores; `runIdempotencyStoreConformance` / `runSessionStoreConformance` | FeltKit keeps its FeltDB stores and runs both suites against them on local and memory FeltDB storage, with `requireClaims` and `requireFindByRequestId` (`npm run test:conformance -w @feltdb/feltkit`) | Closed |
|
|
91
|
-
| A5 | A handler cannot report "outcome unknown" itself. Any error it throws releases the claim, so when an integration handler throws `OUTCOME_UNKNOWN` (the API gave no definite answer), or a mutation's FeltDB commit is unconfirmed (`COMMIT_OUTCOME_UNKNOWN`), a same-key replay reaches the handler again | — | Integrations: `runtime/integrations.ts` refuses that replay from its own call record (`_feltkit_integration_calls`) with AppPort's `IdempotencyOutcomeUnknownError`; the call record stays, it is also the evidence of the external request. Mutations: the FeltDB transaction id is derived from AppPort's replay key (`idempotencyStorageKey`), so FeltDB's transaction-id binding refuses the replay (`IDEMPOTENCY_CONFLICT` → FeltKit `OUTCOME_UNKNOWN`, `committed: true`) instead of writing again; tests "A5: …" in `test/appport-adoption.test.ts` | Open. Ask: a way for a handler to end a request with its claim kept, e.g. an error flag (`keepIdempotencyClaim`) or a documented error reason the runtime treats as unknown |
|
|
91
|
+
| A5 | A handler cannot report "outcome unknown" itself. Any error it throws releases the claim, so when an integration handler throws `OUTCOME_UNKNOWN` (the API gave no definite answer), or a mutation's FeltDB commit is unconfirmed (`COMMIT_OUTCOME_UNKNOWN`), a same-key replay reaches the handler again | — | Integrations: `runtime/integrations.ts` refuses that replay from its own call record (`_feltkit_integration_calls`) with AppPort's `IdempotencyOutcomeUnknownError`; the call record stays, it is also the evidence of the external request. Mutations: the FeltDB transaction id is derived from AppPort's replay key (`idempotencyStorageKey`), so FeltDB's transaction-id binding refuses the replay (`IDEMPOTENCY_CONFLICT` → FeltKit `OUTCOME_UNKNOWN`, `committed: true`) instead of writing again; tests "A5: …" in `test/appport-adoption.test.ts` | Open. Ask: a way for a handler to end a request with its claim kept, e.g. an error flag (`keepIdempotencyClaim`) or a documented error reason the runtime treats as unknown Resolved for FeltKit in 0.4.0 with `@appport/core` 1.13: FeltKit throws `outcomeUnknown()`, which AppPort records under the key (a replay gets the same answer); `test/appport-adoption.test.ts` (A5). |
|
|
92
92
|
| A6 | `handleRequest` validates a request's input before it asks the authorizer, so a caller without the capability's permission and with invalid input gets `INVALID_INPUT` (learning the input contract) instead of `FORBIDDEN`, and the refusal is not a denial | — | The capability's input schema, which FeltKit supplies (`runtime/capabilities.ts`), runs FeltKit's policy check first: `handleRequest` / `handleStreamRequest` are wrapped to carry the caller (AsyncLocalStorage), and the gate throws AppPort's `FORBIDDEN` / `UNAUTHORIZED` from `validate()`, which AppPort answers and reports as a denial. FeltKit's own call path authorizes again. Test: "authority before arguments on AppPort too" in `test/auth.test.ts` | Open. Ask: authorize before validating input when `authorization` does not depend on the input (or an authorizer flag to be consulted first) |
|
|
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
|
|
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, `feltkit.UPSTREAM_REJECTED` 502, `feltkit.UNAVAILABLE`/`feltkit.NOT_CONFIGURED` 503; an unknown outcome is AppPort's own `CONFLICT`), 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
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 |
|
|
@@ -273,3 +273,17 @@ AppBoundry host**: an artifact's `ctx.db.find`/`count` are answered by AppBoundr
|
|
|
273
273
|
`createArtifactTestApp` host is fixed here; whether AppBoundry's host reads FeltDB with `find()` (and so
|
|
274
274
|
truncates at 100 on 0.18 or refuses past 1,000 on 0.20) is not verified. Ask AppBoundry to run the
|
|
275
275
|
1,001-record scenarios of `test/large-collections.test.ts` against its host.
|
|
276
|
+
|
|
277
|
+
## 0.4.0: what FeltKit built on the pinned releases, to move onto upstream work in progress
|
|
278
|
+
|
|
279
|
+
These were implemented on the currently pinned `@feltdb/core`, `@appport/*` and `@appport/services`, with their
|
|
280
|
+
contracts kept so the storage or transport can move without an application change.
|
|
281
|
+
|
|
282
|
+
| FeltKit (0.4.0) | Built on today | Moves to | What changes |
|
|
283
|
+
|---|---|---|---|
|
|
284
|
+
| Presence leases (`app.presence`) | An ordinary collection with lease fields; expiry ended by a timer on the runtime's clock; session ends from `_feltkit_session_ends` | FeltDB record TTL (D1) and ephemeral collections (D2) | Live leases become expiring ephemeral records; the end becomes FeltDB's TTL event (no timer, and no journal entry for a renew). Reasons, `onEnd` and history stay. |
|
|
285
|
+
| Quota counters | Sliding windows in the process | FeltDB expiring records (D1) | Counters span processes and survive restarts (the one P3 regression still `todo`). |
|
|
286
|
+
| Channels (`app.channel`) | AppPort events; the channel's receive rule evaluated in FeltKit's Authorizer, which AppPort 1.11 already calls at subscribe and per delivery | AppPort Authorizer-authorized subscriptions | The receive rule can be declared to AppPort itself; FeltKit keeps the send side. |
|
|
287
|
+
| Agent control live state | FeltKit's own SSE (`…/control/events`) | AppPort `appport.agent.changed@1` / MCP resource notifications | Clients could follow control state over AppPort or MCP. |
|
|
288
|
+
| Agent grants and component work | `_feltkit_resource_access`; `ctx.afterCommit.work` claimed by components | AppPort Services service-principal jobs | A media worker's durable work could run as a Services job under the component's service principal. |
|
|
289
|
+
| `app.agent` on AppBoundry (FK-GAP-013) | Not implemented: the host protocol cannot run guest code as another principal after a call | An AppBoundry host interface for that | The build keeps refusing `app.agent` (and presence, channels, guest and agent bindings) until then. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feltdb/feltkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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",
|
|
@@ -54,17 +54,17 @@
|
|
|
54
54
|
"prepack": "npm run build"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@appport/authorization": "1.
|
|
58
|
-
"@appport/core": "1.
|
|
59
|
-
"@appport/integration": "1.2.
|
|
60
|
-
"@appport/protocol": "1.
|
|
57
|
+
"@appport/authorization": "1.4.0",
|
|
58
|
+
"@appport/core": "1.13.0",
|
|
59
|
+
"@appport/integration": "1.2.8",
|
|
60
|
+
"@appport/protocol": "1.8.0",
|
|
61
61
|
"@appport/resolver-client": "0.3.0",
|
|
62
|
-
"@appport/schema": "1.2.
|
|
63
|
-
"@appport/sdk": "1.
|
|
64
|
-
"@appport/server": "1.
|
|
65
|
-
"@appport/services": ">=0.
|
|
66
|
-
"@feltdb/core": ">=0.
|
|
67
|
-
"create-feltkit": "0.
|
|
62
|
+
"@appport/schema": "1.2.2",
|
|
63
|
+
"@appport/sdk": "1.13.0",
|
|
64
|
+
"@appport/server": "1.5.0",
|
|
65
|
+
"@appport/services": ">=0.21.0 <1.0.0",
|
|
66
|
+
"@feltdb/core": ">=0.23.0 <1.0.0",
|
|
67
|
+
"create-feltkit": "0.4.0",
|
|
68
68
|
"esbuild": "0.28.2",
|
|
69
69
|
"express": "4.22.3",
|
|
70
70
|
"jpeg-js": "0.4.4",
|
|
@@ -89,10 +89,10 @@
|
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@appport/testing": "1.
|
|
92
|
+
"@appport/testing": "1.6.0",
|
|
93
93
|
"@authboundry/local": "0.1.1",
|
|
94
94
|
"@mailerport/service": "0.1.0",
|
|
95
|
-
"@feltdb/webllm": ">=0.
|
|
95
|
+
"@feltdb/webllm": ">=0.23.0 <1.0.0",
|
|
96
96
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
97
97
|
"@stack-ui/core": "0.10.0",
|
|
98
98
|
"@stack-ui/react": "0.10.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://anthropic.com/claude-code/plugin.schema.json",
|
|
3
3
|
"name": "feltkit",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
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"
|
|
@@ -93,6 +93,6 @@ the source, run `npx feltkit test`, and let the user review. Record what you cha
|
|
|
93
93
|
|
|
94
94
|
## Compatibility
|
|
95
95
|
|
|
96
|
-
`@feltdb/feltkit` 0.
|
|
96
|
+
`@feltdb/feltkit` 0.4.x, development server. FeltDB 0.23.0 agent state. There is no planner: decisions are yours, a
|
|
97
97
|
playbook's, or the environment's model choosing among options the application built (a `decide` task); a model's
|
|
98
98
|
choice is a proposal like yours. Verified in Claude Code only.
|
|
@@ -92,6 +92,16 @@ validation and the transaction: do not use it unless the user asks and understan
|
|
|
92
92
|
- **Approval.** `app.mutation({ access: "payments.send", approval: "required", ... })`: agents, services and API keys
|
|
93
93
|
holding the permission can only propose it; it runs after a person who may perform it approves, as the proposer.
|
|
94
94
|
People call it directly. Use it for irreversible effects you would not let an agent take alone.
|
|
95
|
+
- **External effects from an action.** Publish the action (`app.action({ capability: "pr.open", approval?, ... })`) and
|
|
96
|
+
call `await ctx.effect.begin(detail)` right before the effect: it is recorded first, an unknown outcome
|
|
97
|
+
(`OUTCOME_UNKNOWN`) is never repeated by a keyed retry or a retried job, and callers ask what happened with
|
|
98
|
+
`client.invocationStatus` (`appport.invocation.status@1`). From a mutation, dispatch it with
|
|
99
|
+
`ctx.afterCommit.jobs.enqueue`; never make an external call inside a mutation.
|
|
100
|
+
- **Workers and visibility.** A separate runner is a worker (`ctx.grants.registerWorker`, needs
|
|
101
|
+
`feltkit.workers.write`) acting only under a work grant (`ctx.grants.workGrant({ worker, capabilities, workItemId })`,
|
|
102
|
+
named as `x-appport-grant`); a person approves one exact call with `ctx.grants.approve({ capability, input })`.
|
|
103
|
+
`visibility: "internal"` keeps a function off every surface (only `ctx.runMutation`, jobs and hooks call it);
|
|
104
|
+
`"worker"` / `"service"` limit it to those callers.
|
|
95
105
|
- **Authority first.** A caller without a function's `access` gets `FORBIDDEN` before its arguments are checked. An
|
|
96
106
|
agent that gets `FORBIDDEN` lacks the authority: hand the step to a person; do not retry with other input.
|
|
97
107
|
- **Services run as the caller.** Every role that calls a function needs the service permissions the function uses
|
|
@@ -216,5 +226,5 @@ a hash or memory router when `location.protocol === "chrome-extension:"` (a `Bro
|
|
|
216
226
|
|
|
217
227
|
## Compatibility
|
|
218
228
|
|
|
219
|
-
Written for `@feltdb/feltkit` 0.
|
|
229
|
+
Written for `@feltdb/feltkit` 0.4.x (Node 20.11+). Commands: `feltkit create`, `dev`, `build`, `start`, `test`,
|
|
220
230
|
`inspect`, `deploy`, `session`, `operator`, `readiness`, `model`, `credential`, `config`, `codegen`, `doctor`, `skills`, `docs`. Verified in Claude Code only.
|
|
@@ -111,4 +111,4 @@ Deleting records, bulk changes, schema changes that drop fields, or anything in
|
|
|
111
111
|
|
|
112
112
|
## Compatibility
|
|
113
113
|
|
|
114
|
-
`@feltdb/feltkit` 0.
|
|
114
|
+
`@feltdb/feltkit` 0.4.x on `@feltdb/core` 0.23.0. Details: `npx feltkit docs guarantees` (node_modules/@feltdb/feltkit/docs/GUARANTEES.md). Verified in Claude Code only.
|
|
@@ -156,6 +156,6 @@ affect other systems. Confirm with the user before doing any of them.
|
|
|
156
156
|
|
|
157
157
|
## Compatibility
|
|
158
158
|
|
|
159
|
-
`@feltdb/feltkit` 0.
|
|
159
|
+
`@feltdb/feltkit` 0.4.x with `@appport/services` 0.21.0 (shared instance; transactional job and webhook creation; `credential.store` / `credential.status`; `servicesContract` for Managed FeltDB; the inbound event lifecycle and inbound integration management).
|
|
160
160
|
The console is development-only.
|
|
161
161
|
Verified in Claude Code only.
|