@feltdb/feltkit 0.3.12 → 0.3.14

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 (108) hide show
  1. package/README.md +4 -3
  2. package/dist/app.d.ts +27 -1
  3. package/dist/app.js +22 -0
  4. package/dist/app.js.map +1 -1
  5. package/dist/appboundry/build.js +10 -2
  6. package/dist/appboundry/build.js.map +1 -1
  7. package/dist/appboundry/host.js +2 -2
  8. package/dist/appboundry/host.js.map +1 -1
  9. package/dist/cli/deploy.js +9 -3
  10. package/dist/cli/deploy.js.map +1 -1
  11. package/dist/cli/main.d.ts +5 -0
  12. package/dist/cli/main.js +141 -40
  13. package/dist/cli/main.js.map +1 -1
  14. package/dist/client/index.d.ts +3 -0
  15. package/dist/client/index.js +3 -0
  16. package/dist/client/index.js.map +1 -1
  17. package/dist/dashboard/assets/{index-91I1zDK-.css → index-BXTNQAg1.css} +1 -1
  18. package/dist/dashboard/assets/index-DnIOVGF-.js +15 -0
  19. package/dist/dashboard/index.html +3 -3
  20. package/dist/docs.d.ts +12 -0
  21. package/dist/docs.js +43 -0
  22. package/dist/docs.js.map +1 -0
  23. package/dist/errors.d.ts +15 -0
  24. package/dist/errors.js +9 -0
  25. package/dist/errors.js.map +1 -1
  26. package/dist/index.d.ts +1 -0
  27. package/dist/platform/changes.js +4 -2
  28. package/dist/platform/changes.js.map +1 -1
  29. package/dist/platform/deployments.js +8 -6
  30. package/dist/platform/deployments.js.map +1 -1
  31. package/dist/runtime/activity.d.ts +25 -0
  32. package/dist/runtime/activity.js +38 -12
  33. package/dist/runtime/activity.js.map +1 -1
  34. package/dist/runtime/agent.d.ts +16 -0
  35. package/dist/runtime/agent.js +97 -30
  36. package/dist/runtime/agent.js.map +1 -1
  37. package/dist/runtime/backup-environment.d.ts +8 -1
  38. package/dist/runtime/backup-environment.js +44 -12
  39. package/dist/runtime/backup-environment.js.map +1 -1
  40. package/dist/runtime/backup.d.ts +45 -3
  41. package/dist/runtime/backup.js +237 -68
  42. package/dist/runtime/backup.js.map +1 -1
  43. package/dist/runtime/capabilities.js +4 -2
  44. package/dist/runtime/capabilities.js.map +1 -1
  45. package/dist/runtime/changes.js +2 -2
  46. package/dist/runtime/changes.js.map +1 -1
  47. package/dist/runtime/contract.d.ts +10 -0
  48. package/dist/runtime/contract.js +37 -15
  49. package/dist/runtime/contract.js.map +1 -1
  50. package/dist/runtime/data.d.ts +30 -3
  51. package/dist/runtime/data.js +136 -32
  52. package/dist/runtime/data.js.map +1 -1
  53. package/dist/runtime/decisions.d.ts +41 -3
  54. package/dist/runtime/decisions.js +159 -1
  55. package/dist/runtime/decisions.js.map +1 -1
  56. package/dist/runtime/integrations.js +14 -6
  57. package/dist/runtime/integrations.js.map +1 -1
  58. package/dist/runtime/loader.js +22 -2
  59. package/dist/runtime/loader.js.map +1 -1
  60. package/dist/runtime/readiness.js +6 -1
  61. package/dist/runtime/readiness.js.map +1 -1
  62. package/dist/runtime/runtime.d.ts +24 -6
  63. package/dist/runtime/runtime.js +77 -20
  64. package/dist/runtime/runtime.js.map +1 -1
  65. package/dist/runtime/services.d.ts +19 -5
  66. package/dist/runtime/services.js +14 -4
  67. package/dist/runtime/services.js.map +1 -1
  68. package/dist/runtime/sessions.js +4 -3
  69. package/dist/runtime/sessions.js.map +1 -1
  70. package/dist/runtime/state-contract.js +3 -3
  71. package/dist/runtime/state-contract.js.map +1 -1
  72. package/dist/runtime/targets.d.ts +6 -1
  73. package/dist/runtime/targets.js +8 -0
  74. package/dist/runtime/targets.js.map +1 -1
  75. package/dist/server/admin.d.ts +2 -2
  76. package/dist/server/admin.js +37 -12
  77. package/dist/server/admin.js.map +1 -1
  78. package/dist/server/index.d.ts +2 -1
  79. package/dist/server/index.js +45 -8
  80. package/dist/server/index.js.map +1 -1
  81. package/dist/server/mcp.js +1 -1
  82. package/dist/server/mcp.js.map +1 -1
  83. package/dist/testing/index.d.ts +6 -2
  84. package/dist/testing/index.js +28 -4
  85. package/dist/testing/index.js.map +1 -1
  86. package/docs/AGENT-OPERATIONS.md +515 -0
  87. package/docs/APPBOUNDRY.md +240 -0
  88. package/docs/ARCHITECTURE.md +126 -0
  89. package/docs/BACKUP.md +115 -0
  90. package/docs/GUARANTEES.md +460 -0
  91. package/docs/PATH-TO-PRODUCTION.md +117 -0
  92. package/docs/README.md +16 -0
  93. package/docs/RESOLVER.md +167 -0
  94. package/docs/SECURITY.md +182 -0
  95. package/docs/TRANSACTIONS.md +216 -0
  96. package/docs/UPSTREAM-GAPS.md +270 -0
  97. package/docs/WHY-FELTKIT.md +64 -0
  98. package/docs/assets/feltkit-logo-dark.png +0 -0
  99. package/docs/assets/feltkit-logo.png +0 -0
  100. package/package.json +11 -8
  101. package/skills/.claude-plugin/marketplace.json +1 -1
  102. package/skills/.claude-plugin/plugin.json +3 -3
  103. package/skills/feltkit-agent/SKILL.md +9 -5
  104. package/skills/feltkit-build/SKILL.md +10 -1
  105. package/skills/feltkit-data/SKILL.md +9 -3
  106. package/skills/feltkit-services/SKILL.md +8 -4
  107. package/dist/dashboard/assets/index-BhFOquA7.js +0 -15
  108. package/dist/dashboard/theme.js +0 -11
@@ -0,0 +1,460 @@
1
+ # Guarantees and known limitations
2
+
3
+ This page states what FeltKit guarantees, what it inherits from FeltDB, AppPort, and
4
+ AppPort Services, and what it does not do yet.
5
+
6
+ ## State
7
+
8
+ | Guarantee | Scope |
9
+ |---|---|
10
+ | One FeltDB instance per environment per process | Enforced by `InstanceFactory`; verified by `shared-instance.test.ts` |
11
+ | Mutations are atomic | All writes through `ctx.db` in one mutation commit in one FeltDB transaction, or none do |
12
+ | Durability | The local runtime persists each commit before returning (FeltDB's file runtime). Verified across restarts. |
13
+ | Schema validation | Every write through `ctx.db` and the dashboard, with the full FeltKit schema. |
14
+ | Schema enforcement | On local and memory state, FeltDB enforces the state contract the collections compile to (types, required fields, no undeclared fields or collections, `s.ref` references with restrict on delete, unique constraints), on every write from any component. See "Schema lifecycle". |
15
+
16
+ ### Schema lifecycle
17
+
18
+ `runtime/state-contract.ts`; tests `schema-lifecycle.test.ts` (local state, across restarts)
19
+ and `schema-lifecycle-artifact.test.ts` (artifacts).
20
+
21
+ **Guaranteed:**
22
+
23
+ - **The installed contract is the declared one, or calls are refused.** At start and reload,
24
+ the store's active contract is compared with what `feltkit/` declares. When they differ
25
+ and the change can't be installed, no function runs: stored records are never handed to
26
+ code that declares a different schema.
27
+ - **A change is installed only over records that satisfy it.** FeltDB re-validates every
28
+ governed record (fields, references, unique constraints) inside one transaction. That
29
+ transaction holds the pending `app.migration()` writes, each conditioned on the version
30
+ of the record it read, plus the history record. It is refused as a whole otherwise.
31
+ - **A refused change leaves everything as it was.** The previous contract stays active, the
32
+ data is untouched, and code declaring the previous schema keeps working.
33
+ - **Removing a collection that still holds records is refused.** FeltDB itself would
34
+ accept it and leave the records unreachable (UPSTREAM-GAPS F18). Moving records out of a
35
+ collection being removed takes two evolutions:
36
+ 1. The new schema plus the collection, with every migration write.
37
+ 2. Drop the collection, now empty.
38
+
39
+ A stop between them leaves a valid, enforced schema, and the next start finishes the job.
40
+ - **Each migration runs once per store.** It is recorded by name in `_feltkit_migrations`,
41
+ in the same transaction as its writes.
42
+ - **Adoption.** A store written before schemas were enforced is adopted at the first start
43
+ when its records satisfy the declared schema; nothing is rewritten.
44
+
45
+ **Not guaranteed:**
46
+
47
+ - **Large migrations.** An evolution is one transaction, so a migration over a large
48
+ collection is bounded by what one transaction can hold. Split it: install an optional
49
+ field, backfill in batches, then require it.
50
+ - **A store whose old records do not satisfy the declared schema keeps serving without
51
+ enforcement.** It is flagged `unverified` in `feltkit dev`, readiness, `inspect` and
52
+ `feltkit migrate`, rather than taking an upgraded app down.
53
+ - **The structural subset only.** Length, range and nested-shape rules are FeltKit's
54
+ write-time validation, not the contract's.
55
+ - **FeltDB servers and Managed FeltDB** enforce the contract published to them; FeltKit
56
+ does not install it there. The contract `feltkit contract` writes declares the same fields,
57
+ required/nullable, enums, references, unique constraints and indexes as the local contract
58
+ (`test/contract-parity.test.ts`). A contract written by a release before that parity fix
59
+ lacks them, and the app refuses to start against it until the current one is published.
60
+
61
+ ### Mutation isolation
62
+
63
+ A mutation commits only if everything it read is still as it read it. FeltDB checks
64
+ this inside its commit lock; a failed check rejects the whole transaction with
65
+ `CONFLICT` and nothing is written.
66
+
67
+ | Read inside a mutation | How it is checked at commit | Detects |
68
+ |---|---|---|
69
+ | `get(id)` | `ifVersion` / `requireAbsent` precondition on that record | The record changed, appeared, or was deleted |
70
+ | `find(filter)`, `count(filter)` with at least one field | FeltDB read basis on the equality predicate, captured before the read | Any matching record changed, appeared (phantom), disappeared, or stopped matching — by any writer |
71
+ | `query({ where })` with some `eq` clauses | Read basis on the `eq` clauses only (range clauses dropped) | Same as above, for a superset of the read: may report conflicts the range would have excluded, never misses one |
72
+ | `find()`/`count()` with no filter, or `query` with only range clauses | The collection's change marker (`_feltkit_collections`), touched by every commit made through `ctx.db` or the dashboard | Any commit to the collection through FeltKit. **Not** writes made through `ctx.unsafe.feltdb`. |
73
+ | Records the mutation wrote | `ifVersion` on updates and deletes, at the version the mutation **first read** (a `get` before the `patch`); `requireAbsent` on inserts | Lost updates, including a change committed between the handler's read and its write |
74
+
75
+ Records `ctx.db` returns (`get`, `find`, `query`, and the results of `patch`/`replace`) are
76
+ the handler's own copies, and so are the values it passes to `insert`, `patch` and
77
+ `replace`. Changing a returned record changes nothing stored and nothing another request
78
+ reads; only a write does. (Before this change `find` and `query` returned FeltDB's stored objects
79
+ on the local runtimes: changing one changed later reads in the process without a write and
80
+ failed the mutation's own read fence with a false `CONFLICT`.) Tests:
81
+ `packages/sdk/test/data-isolation.test.ts`.
82
+
83
+ Demonstrated in `packages/sdk/test/isolation.test.ts` with interleaved mutations:
84
+ lost update, phantom on a uniqueness check, write skew over a predicate, range and
85
+ unfiltered reads, a conflicting mutation writing nothing, and the corresponding cases
86
+ that must commit (disjoint predicates, concurrent blind inserts).
87
+
88
+ **What this is:** within FeltDB, a committed mutation's reads were all current at
89
+ commit time (optimistic concurrency with predicate fencing).
90
+
91
+ **What this is not:**
92
+
93
+ - A consistent snapshot across reads *while* the handler runs. Two reads in one
94
+ handler can observe different committed states; if either changed, the commit fails.
95
+ - Checked for read-only mutations. A mutation that writes nothing commits nothing, so
96
+ nothing is checked. Queries are never checked.
97
+ - Retried. A `CONFLICT` writes nothing; FeltKit leaves retries to the caller because
98
+ handlers may have side effects. A read-set conflict says `retryable: true` and can be retried as is. One with
99
+ `details.feltdbCode: REVISION_NOT_ACTIVE` means a FeltDB contract was promoted: the
100
+ request was built for the previous contract, so decide whether it still makes sense first.
101
+ - Conflict-free under contention. Fences are conservative: whole-collection reads
102
+ conflict with any concurrent commit to that collection.
103
+
104
+ ### Sequences
105
+
106
+ `ctx.db.sequence(name)` reads the sequence's committed value (`_feltkit_sequences`) and
107
+ writes the new one in the mutation's transaction, conditioned on the version it read. So:
108
+
109
+ - Two commits never get the same number, on any runtime and across processes: the second
110
+ of two mutations that read the same value fails with `CONFLICT` and writes nothing.
111
+ - Numbers follow commit order, and call order within one mutation, with no gaps; a
112
+ mutation that throws, is refused, or writes nothing else consumes none.
113
+ - Order is per stream (the name); there is no order between streams, and different streams
114
+ never contend.
115
+ - Not guaranteed: throughput under contention on one stream. Mutations drawing from one
116
+ stream serialize: the later gets `CONFLICT`, or is re-run when it opted in
117
+ (`retry: { sequenceConflicts }`) and used no `ctx.services`.
118
+ - The same on FeltKit's runtime and in AppBoundry artifacts (transactions@1, AppBoundry 1.5.0).
119
+
120
+ ### After-commit effects
121
+
122
+ `ctx.afterCommit.{notifications.send, webhooks.emit, jobs.enqueue}` writes an outbox record
123
+ (`_feltkit_outbox`) in the mutation's transaction:
124
+
125
+ - No effect for a mutation that threw or whose commit was refused.
126
+ - An effect for every committed mutation. It is performed right after the commit as the
127
+ caller, and otherwise by the services worker (as the caller's current principal) once a record
128
+ has been pending for 30 s, or performing for 5 min. A record is claimed with a version-checked
129
+ write, so two processes do not perform it together.
130
+ - A job or webhook delivery is created in the same FeltDB transaction that records the effect
131
+ done, so it exists once per committed effect, whatever stops when. Notifications carry the
132
+ outbox id as their idempotency key, so a repeat is not delivered twice.
133
+ - Creation is exactly once, not execution: a job's run and a webhook's delivery to its endpoint
134
+ are AppPort Services' own retries (at least once).
135
+ - The effect's own failure (a refused permission, a disabled service) does not undo the
136
+ commit: the record is `failed` with the error, and the log says so. A failed record is
137
+ never retried on its own; an operator retries it (`feltkit outbox retry <id>`, AppBoundry
138
+ `admin outbox retry <id>`), keeping its attempts.
139
+ - The same on FeltKit's runtime and in AppBoundry artifacts. Details: TRANSACTIONS.md.
140
+
141
+ ### Not guaranteed
142
+
143
+ - Service effects (`ctx.services.*`) and activity entries are separate commits from
144
+ the mutation's transaction. A mutation that uploads a file and then fails leaves the file.
145
+ Use `ctx.afterCommit` for notifications, webhook events and jobs that must not outlive a
146
+ failed mutation.
147
+ - Nothing is atomic across FeltDB and external systems.
148
+ - `ctx.unsafe.feltdb` writes are not validated, not transactional with the mutation,
149
+ not attributed to it in the activity log, and invisible to whole-collection fences.
150
+ - File bytes are stored in the same FeltDB instance (`_feltkit_file_content`, with
151
+ their SHA-256, re-hashed on every read) before the file record is committed, so a
152
+ record never points at bytes that were not stored; if the record cannot be committed
153
+ the bytes are removed. Deleting a file removes its bytes. FeltDB 0.15's content store
154
+ is not used: it cannot delete content, and the memory runtime has none (UPSTREAM-GAPS
155
+ F6, F8, F9).
156
+ - Files are capped at 1 MiB by default (`services.files.maxBytes`).
157
+ - A mutation called with an idempotency key commits under a FeltDB transaction id
158
+ derived from that key. If its commit is unconfirmed, a same-key retry is refused with
159
+ `OUTCOME_UNKNOWN` (`committed: true` when FeltDB shows the first attempt committed)
160
+ rather than written again; a retry with a new key is a new request.
161
+ - A FeltDB server that cannot issue read bases makes every mutation that uses
162
+ `find`/`query`/`count` fail with `UNAVAILABLE` rather than commit unchecked.
163
+
164
+ ## Errors
165
+
166
+ Every failure that reaches a caller has a stable `code`, the same HTTP status on FeltKit's
167
+ function API (`/api`) and on AppPort (`/appport`), and an explicit retry answer: `retryable:
168
+ true` in the error when sending the same request again can succeed without anything else
169
+ changing; absent (FeltKit) or `false` (AppPort) otherwise. MCP tool errors carry the AppPort
170
+ code in their text. `FeltKitClientError` exposes `code` and `retryable`.
171
+
172
+ | Failure | `/api` code | AppPort / MCP code | HTTP | Retryable |
173
+ | --- | --- | --- | --- | --- |
174
+ | Malformed input | `INVALID_ARGUMENT` | `INVALID_INPUT` | 400 | no |
175
+ | No or invalid session | `UNAUTHORIZED` | `UNAUTHORIZED` | 401 | no |
176
+ | The caller lacks the permission | `FORBIDDEN` | `FORBIDDEN` | 403 | no |
177
+ | A record or function of this app is missing | `NOT_FOUND` | `NOT_FOUND` | 404 | no |
178
+ | The current state does not allow it | `FAILED_PRECONDITION` | `feltkit.FAILED_PRECONDITION` | 409 | no |
179
+ | A record this mutation read changed before commit | `CONFLICT` | `CONFLICT` | 409 | **yes** |
180
+ | Any other state conflict (duplicate unique value, already applied) | `CONFLICT` | `CONFLICT` | 409 | no |
181
+ | An external API (`app.integration`) refused the request (4xx) | `UPSTREAM_REJECTED` | `UPSTREAM_REJECTED`, `details.status` = the API's status | 502 | no |
182
+ | The request was sent; the outcome is not known | `OUTCOME_UNKNOWN` | `OUTCOME_UNKNOWN` | 502 | no: verify it |
183
+ | A dependency is unreachable | `UNAVAILABLE` | `UNAVAILABLE` | 503 | **yes** |
184
+ | A credential or URL an operator must provide is missing | `CONFIGURATION` | `NOT_CONFIGURED` (`details.hint`) | 503 | no |
185
+ | Unexpected | `INTERNAL` | `INTERNAL_ERROR` | 500 | no |
186
+
187
+ An external API's 401 or 404 is `UPSTREAM_REJECTED`: it is about FeltKit's credential for that
188
+ API or the API's own records, never the caller's session or this application's data, so it is
189
+ never `UNAUTHORIZED`, `NOT_FOUND` or a retryable `CONFLICT`. It is the code the operation's
190
+ published contract declares (`appport.integration/1` `failures`). Tests:
191
+ `packages/sdk/test/error-contract.test.ts`.
192
+
193
+ ## Topology
194
+
195
+ - The local FeltDB runtime is a single-host, single-process store. FeltDB takes an
196
+ exclusive owner lock (`owner.lock` in the state directory) when FeltKit opens it; any
197
+ other process — a second `feltkit dev`/`start`, a CLI command, a script — is refused
198
+ with `DUPLICATE_INSTANCE` naming the owner, and nothing is read or written. FeltKit
199
+ never opens state in FeltDB's shared mode. CLI commands find a running server through
200
+ `.feltkit/<env>/runtime.json` and go through its admin API instead of opening the
201
+ state. Verified in `feltdb-release.test.ts` (F5) with a second real process.
202
+ - Production with a FeltDB server (`FELTDB_URL`) uses FeltDB's remote runtime. FeltKit's
203
+ change feed reads the instance's operation journal; whether a remote authority exposes
204
+ it fully is FeltDB's contract, and live updates across multiple FeltKit processes are
205
+ not provided.
206
+
207
+ ## Live queries
208
+
209
+ - The change stream requires a session unless the application has a public query.
210
+ - Within one server process, every committed write produces a change notification
211
+ naming its collection, at least once, typically within 150 ms. Notifications carry
212
+ collection names only; data is always re-read through the authorized query endpoint.
213
+ - After a reconnect, clients re-run every watched query.
214
+ - Queries are re-run per collection, not per record or predicate.
215
+
216
+ ## Queries
217
+
218
+ - Queries cannot write through `ctx.db`. FeltKit does not sandbox handlers, so a query
219
+ can still make network calls or other side effects; FeltKit does not claim purity.
220
+ - `count` reads all matching records.
221
+
222
+ ## Identity
223
+
224
+ - No built-in password or OAuth sign-in. Development sign-in exists only in
225
+ `development`/`test`. Production uses `auth.authenticate` (your identity provider) or
226
+ tokens from `feltkit session create`.
227
+ - Roles are fixed per session at issue time; permissions are resolved from the current
228
+ policy on every call.
229
+ - Session tokens are bearer tokens: anyone holding one acts as its principal until it
230
+ expires or is revoked.
231
+
232
+ ## AppPort Services
233
+
234
+ Services run on the application's FeltDB instance (`createServices({ db })`,
235
+ `@appport/services` 0.9.1). FeltKit refuses to start unless `services.usesInstance()`
236
+ confirms that instance. Service state is the package's own `health()`; effect evidence is
237
+ looked up with `services.evidence.findByRunId()`, and an effect with a `started` record and
238
+ no completion is reported as outcome unknown, never as success or failure. Enable each in
239
+ `feltkit({ services })`.
240
+
241
+ | Service | What runs | Verified (packages/sdk/test) |
242
+ |---|---|---|
243
+ | Files | records with audit; bytes in the same instance | persistence, authorization, upload/read/delete, restart (`services`) |
244
+ | Notifications | in-app channel, delivered inline; recipient-only | persistence, delivery, recipient-only access, restart (`services`) |
245
+ | Configuration | variables and credential references for the running environment | persistence, environment separation; the console page edits the environment the application reads (`services`, `console`) |
246
+ | API keys | created, rotated, revoked on the package's page; accepted on `/appport` and `/mcp` with `services.apiKeys.roles` | secret shown once, never listed, revocation → 401, survives restart (`console`) |
247
+ | Webhooks | signed delivery to registered endpoints; history | signed with the environment's secret, delivered as the emitter, secret in no record or log (`console`) |
248
+ | Jobs | job type → FeltKit function, run as the enqueuer, retries | executed as the enqueuer, refused for a weaker role, failure recorded, retry, refused after the enqueuer signs out (`console`) |
249
+ | Schedules | recurring jobs (needs jobs) | constructed and reported; not exercised end to end |
250
+ | Intelligence | provider/model configuration only (the package never runs a model) | selection + key stored through `credential.store` + Test against a local OpenAI-compatible and Anthropic-compatible server that checks the key header (`credential-custody`) |
251
+
252
+ - **States.** Each service is reported `unavailable` (cannot run here), `available` (not
253
+ enabled), `unconfigured`, `configured`, or `unhealthy` (its store failed a check, a
254
+ required secret does not resolve, or recent work failed), from the services' own
255
+ records. Nothing is shown as working because it is enabled.
256
+ - **Durable work.** Jobs, schedules, and deliveries re-authorize every attempt as the
257
+ principal that created them: an API key that still exists and is not revoked, or the
258
+ most recent active session. With neither, the work is refused (`DENIED`), never run
259
+ with less checking. Durable work is driven by the runtime's worker (every second) or
260
+ `runtime.runServices()`.
261
+ - **Secrets.** Services hold `credential-ref:<id>` only. Values are kept by FeltKit's
262
+ credential custody (below), resolved inside the effect, and are never stored in FeltDB,
263
+ logged, returned, or given to the agent.
264
+ - **The console** is development-only and loopback-only. It is the package's own
265
+ `createManagementRouter`; FeltKit supplies authentication and nothing else.
266
+ - FeltKit is single-tenant per application: the Services tenant is the application
267
+ name. Configuration environments map `development`/`test` → `development`,
268
+ `production` → `production`.
269
+ - Files are application-shared: any principal with `files.read` reads every file.
270
+
271
+ ## Agents
272
+
273
+ The FeltKit agent is FeltDB's agent runtime and agent state on the shared instance
274
+ (`runtime/agent.ts`). Verified in `packages/sdk/test/agent.test.ts`,
275
+ `agent-lifecycle.test.ts` (refusal, rejection, duplicates, concurrency, failure and
276
+ retry, timeout, cancellation, crashes, restart recovery), and, in a browser,
277
+ `studio.test.ts`.
278
+
279
+ | Guarantee | How |
280
+ |---|---|
281
+ | Durable | Tasks, checkpoints, actions, and handoffs are FeltDB agent state; each task has a FeltDB execution record. Every action state change is persisted before the next step. |
282
+ | Acts only through AppPort | Application capabilities via the application's dispatch pipeline; service operations via AppPort Services' `invoke()` and gateway. No other access to state. |
283
+ | Same authority as every interface | Actions run as the task owner. Before an approval changes anything, the owner is resolved and both the approver and the owner must be permitted to perform the action; otherwise the approval is refused, the reason is recorded in the action's history, and the action stays proposed. If the owner cannot be resolved (no session, not a dev identity), approval fails closed; no identity is substituted. |
284
+ | Approval | Consequential actions (AppPort's and AppPort Services' effect classes) wait for a person (`type: "user"`) who may perform them; agents cannot approve; there is no approve tool. |
285
+ | Mandatory approval | A mutation declared `approval: "required"` cannot be run directly by an agent, service or API key on any interface: FeltKit's HTTP API, AppPort, MCP, a job or schedule it queued. The refusal is `FORBIDDEN` with `details.approval: "required"`, recorded as a denial, before arguments are checked. It runs only inside the execution of an approved action for exactly that capability (an in-process context that no header, envelope field or transport name can set), as the proposer, whose own `access` is still checked, after a person who may perform it approves. The run's activity entry carries `authority.approval` (task, action, approver). People (`type: "user"`) call it directly. Discovery says so: the capability's description, and `feltkit_context` (`approval: "required"`, `invoke: "propose"`). An AppBoundry build refuses it. Tests: `packages/sdk/test/approval-required.test.ts`. |
286
+ | One run per approval | Each action state change is a compare-and-swap on the action's record (FeltDB `supersede` with the expected revision). Of concurrent or repeated approvals one wins; the others return the current state and run nothing. |
287
+ | Attribution | Each action records who proposed it, who approved or rejected it, the principal it ran as, the request id, timestamps, the outcome and how it was determined, and a history of every transition with its actor. Agent activity entries carry the owner as principal and the proposer and approver in their detail. |
288
+ | Evidence | Each action's activity record and its final action record are cited by a checkpoint and verified by FeltDB at commit. Pending work is rebuilt from the open actions at every checkpoint. |
289
+ | No secrets | Results are redacted before they are recorded or returned. |
290
+
291
+ **Action states.** `proposed → approved → executing → succeeded | failed | interrupted`;
292
+ `proposed → rejected | cancelled`; `approved → cancelled`; `interrupted → succeeded |
293
+ failed` (from evidence or a person); `failed → proposed` (retry, a new attempt).
294
+ `succeeded`, `rejected`, and `cancelled` are final. Other transitions are refused.
295
+
296
+ **Idempotency.** Every application mutation declares AppPort idempotency (an integration
297
+ operation does when it declares `idempotencyHeader`), and AppPort's idempotency entries
298
+ are kept in FeltDB (`_feltkit_idempotency`, 24 h). Before the handler runs, AppPort writes
299
+ a durable in-progress claim (key, request id, request digest, caller); FeltKit's store
300
+ makes it an atomic create-if-absent with a FeltDB transaction guard, so of concurrent
301
+ claimers exactly one runs. The completed record replaces the claim. A replay of the key
302
+ returns the stored response without running the handler; a replay that finds a claim
303
+ with no response (the original crashed, timed out, or is still running) is refused with
304
+ `CONFLICT` / `details.reason: "IDEMPOTENCY_OUTCOME_UNKNOWN"` and `details.requestId`, and
305
+ is not run again. The claim is released when the outcome is known (the handler threw or
306
+ never started) and otherwise kept until it expires or is resolved. A different request
307
+ under the same key is `IDEMPOTENCY_KEY_REUSED`. In development, a key sent to a capability
308
+ without idempotency support is refused (`INVALID_REQUEST` /
309
+ `IDEMPOTENCY_KEY_UNSUPPORTED`); production runs it and logs a warning. Each application
310
+ action attempt sends a stable key (`feltkit-agent:<task>:<action>:<attempt>`) to a
311
+ capability that supports it. AppPort Services' gateway records its effect evidence under
312
+ the action's request id. This is at-most-once per key, not exactly-once.
313
+
314
+ **Outcome unknown.** An action is `interrupted` when its outcome cannot be established:
315
+ it timed out (30 s by default) or was cancelled while running (FeltKit functions do not
316
+ observe the abort, so the call may still complete), or the process stopped after it
317
+ started. Interrupted actions are never replayed automatically. They keep the task
318
+ blocked until they are settled, from evidence or by a person (`resolve`, Studio "It
319
+ succeeded" / "It did not take effect"), who must be permitted to perform the action.
320
+
321
+ **Retry.** Only a `failed` action can be retried, by the owner or a person. A retry is a
322
+ new attempt with a new key and needs approval again. Nothing is retried automatically.
323
+
324
+ **Restart recovery.** When the runtime opens, it examines every open task once (FeltDB's
325
+ `listTasks`, paged)
326
+ (`agent.reconcile()`, also callable):
327
+ - `approved` with no execution started → back to `proposed`; the approval must be repeated.
328
+ - `executing` or `interrupted` → settled only from evidence of this exact request:
329
+ AppPort's idempotency record, the function's activity entry, or AppPort Services'
330
+ effect evidence (every effect completed). Without evidence: `interrupted`.
331
+
332
+ Recovery never runs an action. An AppPort claim without a response is not evidence
333
+ either way. **Not guaranteed:** an effect that committed but whose idempotency record,
334
+ activity entry, or service evidence was not written before a crash is reported as
335
+ interrupted, not as succeeded (a replay of its key is refused as outcome unknown). A
336
+ FeltKit mutation whose FeltDB commit fails reports an error, so AppPort releases its claim;
337
+ with a FeltDB server, a commit that failed in transit may still have applied. Cancelling a task cancels its queued
338
+ actions and aborts its running ones; while any action is interrupted, the cancellation is
339
+ refused until that action is settled. A cancelled task's FeltDB execution ends `Cancelled` with
340
+ the reason (`cancelReason`); a completed one `Completed`.
341
+
342
+ Not provided: a planner. Decisions are a playbook's (capabilities chosen by code), a
343
+ model's choice among options code built (below), or an external coding agent's, proposed
344
+ over MCP (`feltkit_agent_*` tools).
345
+
346
+ ## Model decisions
347
+
348
+ A `decide` task asks the environment's model to choose among options the application
349
+ built (`ctx.agent.start({ decision })` from a mutation, or `createTask`). Implemented in
350
+ `runtime/decisions.ts` and `runtime/agent.ts`; verified in
351
+ `packages/sdk/test/decisions.test.ts` and `examples/invoices/tests`.
352
+
353
+ | Guarantee | How |
354
+ |---|---|
355
+ | One contract | Every model is a FeltDB `DecisionRuntime` (`@feltdb/core`). Built in: OpenAI chat completions (OpenAI and any compatible server: Ollama, vLLM, llama.cpp) and Anthropic messages. Any other `DecisionRuntime` (e.g. `@feltdb/webllm`) is passed as `feltkit({ agent: { decisions } })`. |
356
+ | One selection | The environment's model is AppPort Services Intelligence's selection (`{ provider, model, endpoint }` + a credential reference). FeltKit adds no registry of its own. `feltkit model show`, Studio → Models, and `GET /_feltkit/api/models` report the source, the runtime's capabilities, whether the credential resolves, and each problem with its fix. |
357
+ | Bounded by authority | Options whose capability the task owner may not perform are removed before the model sees them, and recorded as excluded. "Escalate to a person" is always offered. A choice outside the offered labels is refused (`malformed`), never mapped to the nearest option. |
358
+ | A proposal, not proof | The choice is stored as memory kind `decision` with its runtime, provider, and model, and becomes a proposal in the action lifecycle (Agents, above). It is never evidence that anything happened. A consequential option still waits for a person. |
359
+ | No silent fallback | Any failure (not configured, credential missing or refused, unknown protocol, timeout — 20 s by default, `agent.decisionTimeoutMs` — unavailable, provider error, malformed answer, unsupported decision) blocks the task with the reason and the fix; nothing is proposed, no other model is tried. `decide(taskId)` (Studio "Ask the model again") asks again once fixed. |
360
+ | Credentials | Entered once (Studio → Models' API key field, `feltkit model set --api-key-stdin`, `feltkit credential set`), kept by FeltKit's credential custody, resolved only for the request; never in the selection, responses, checkpoints, activity, or logs. |
361
+
362
+ Not provided: multi-turn agents, tool calling by the model, streaming, or probability
363
+ distributions from the built-in runtimes (`capabilities()` reports what each supports).
364
+
365
+ ## Credential custody
366
+
367
+ AppPort Services (0.8.0) owns the collection contract for a credential value
368
+ (`credential.store`: authorized through its gateway as the caller, permission
369
+ `credential.store`; audited and versioned without the value; effect evidence records the
370
+ reference and version only; `credential.status` reports state without the value). It
371
+ contains no secret store: FeltKit is the host that keeps the material
372
+ (`runtime/credentials.ts`, a `SecretCustody`). Verified in
373
+ `packages/sdk/test/credentials.test.ts` and `credential-custody.test.ts`.
374
+
375
+ | Guarantee | How |
376
+ |---|---|
377
+ | One place to type a key | Studio → Models (Provider, Model, **API key**; the reference defaults to `credential-ref:<provider>` under "Advanced"), Studio → Integrations → **Set key**, Studio → Services → Credentials (set, replace, remove), `feltkit credential set <ref\|provider>` and `feltkit model set … --api-key-stdin` (hidden prompt or stdin; a value on the command line is refused). After saving, Studio shows "set (local encrypted vault, version N)", never the value. |
378
+ | Where it lives | `FELTKIT_CREDENTIAL_<ID>` wins when set (that reference is then read-only: `CUSTODY_READ_ONLY` names the variable). Otherwise, in development and test, `.feltkit/<env>/credentials.vault`: the whole document AES-256-GCM-encrypted (reference names too), bound to the application and environment, with one random 32-byte key in `.feltkit/<env>/credentials.key`; both 0600, written atomically (temporary file, fsync, rename) under a lock file shared by the server and the CLI. `.feltkit/` is gitignored and never part of `feltkit build`/`deploy` output. The test environment's vault sits beside its temporary state. |
379
+ | Production | Environment variables only: storing refuses with `CUSTODY_READ_ONLY` and says what to set. An operator may opt in to a vault with `FELTKIT_CREDENTIAL_VAULT=1` and `FELTKIT_CREDENTIAL_VAULT_KEY` (32 bytes, base64, from the host's secret manager; never written to disk; vault directory `FELTKIT_CREDENTIAL_VAULT_DIR`, else `.feltkit/production`). Then operators holding `feltkit.operations.write` and `credential.store` may store from Studio. |
380
+ | Never echoed | The value is not in FeltDB (any collection), activity, AppPort Services evidence or audit, the configuration export, server output, admin API responses, errors, or the dashboard bundle (scanned after storing through Studio and the CLI). Errors from the write path are scrubbed of the value before they are recorded or returned. A key pasted into a reference field is moved to the key field by Studio and refused by the server without being echoed. |
381
+ | Authorized | Studio stores as the chosen dev identity (`credential.store`, then `intelligence.write` for the selection); a viewer or agent role is refused. The CLI on the host stores as FeltKit's host custody principal (a system principal holding only `credential.store`/`credential.status`). Removing a stored value needs the same permission (AppPort Services 0.8.0 has no capability for it; FeltKit authorizes it with the application's policy and records it as activity). |
382
+ | Versions | Each store is a new version; earlier values are not kept (version numbers and times are). Remove erases the value and the reference reports `revoked`. |
383
+
384
+ ## Integrations
385
+
386
+ `app.integration(name, { baseUrl, credential, operations })` connects an existing HTTP
387
+ API. Implemented in `runtime/integrations.ts`; verified in
388
+ `packages/sdk/test/integrations.test.ts` and `examples/invoices/tests`.
389
+
390
+ | Guarantee | How |
391
+ |---|---|
392
+ | One protocol | Each operation is the AppPort capability `<name>.<operation>`: schemas, effect class, the permission that may invoke it (required, never public), idempotency, and an `appport.integration/1` descriptor (effects, verification, failure modes with `retry` and `effect`). AppPort validates and authorizes around the call. Discovery over AppPort or MCP shows the contract, never a credential; it grants nothing. |
393
+ | Recorded before sent | A call record (`_feltkit_integration_calls`, keyed by request id) is written `started` before the request leaves, then `succeeded` / `failed` / `unknown` with the HTTP status, redacted input, output, and how the outcome was determined (`response`, `verification`, `person`). Activity kind `integration`. |
394
+ | Honest classification | Unreachable before sending, or a 4xx other than 408 → `failed`. A consequential request with no answer (10 s default `timeoutMs`), a dropped connection, a 408, a 5xx, or a 2xx without a JSON body → `unknown` (`OUTCOME_UNKNOWN`). An agent action whose call is unknown is `interrupted`. |
395
+ | No automatic repeat | An unknown call is never re-sent. An idempotent operation sends the caller's idempotency key in its declared header. A replay of that key is never sent again while the earlier call is `started` or `unknown`, or was settled only by verification: AppPort answers it from its claim after a crash, and FeltKit from the call record otherwise (AppPort releases its claim when the handler reports `OUTCOME_UNKNOWN`), both as `CONFLICT` / `IDEMPOTENCY_OUTCOME_UNKNOWN`. Verification that finds no effect releases a claim a crash left. |
396
+ | Settled from the API's records | `verify` runs the declared probe (an observation of the same API) as the caller, through AppPort; `@appport/integration` evaluates it. Verified → `succeeded`; NOT_FOUND → `failed`; anything else stays `unknown`. The agent's restart recovery and `resolve` consult this evidence first. |
397
+ | Credentials | A reference (`credential-ref:<id>`), resolved only for the request; never recorded, returned, or logged (an error mentioning it is redacted). |
398
+ | Configuration | `baseUrl` is a literal, an environment variable, or a development default. Production never uses the development default; readiness fails a missing, non-HTTPS, or loopback production URL. |
399
+
400
+ **`onOutcome`.** When a call's outcome becomes known (from the response or verification),
401
+ the declared mutation runs as the original caller with the call record. It is a
402
+ notification, not part of the call: it can run more than once for the same call (e.g. a
403
+ verify after a restart), so make it idempotent (the example sets the invoice's status from
404
+ the call's state). A failing hook is logged; the call record stays authoritative.
405
+
406
+ Not provided: non-HTTP transports, OAuth flows, pagination, webhooks into integrations, or
407
+ a marketplace of connectors.
408
+
409
+ ## Production operations
410
+
411
+ Studio in production (`FELTKIT_DASHBOARD=1`) answers verified operators only
412
+ (docs/SECURITY.md, "Production operators"). Verified over HTTP and in a browser in
413
+ `packages/sdk/test/production-ops.test.ts`.
414
+
415
+ | Route (`/_feltkit/api`) | Needs | Notes |
416
+ |---|---|---|
417
+ | `GET /operator/session`, `POST /operator/signin`, `POST /operator/signout` | — / a grant / an operator | Sign-in is single-use per grant |
418
+ | `GET /overview`, `/capabilities`, `/services`, `/services/jobs`, `/services/deliveries`, `/agent`, `/agent/tasks/:id`, `/activity`, `/activity/:id`, `/events` | `feltkit.operations.read` | Credential references are shown with whether they resolve, never values |
419
+ | `POST /services/jobs`, `POST /services/webhooks` | `feltkit.operations.write` + `jobs.create` / `webhooks.register` | Queue a job of a declared type, or register a webhook endpoint, through AppPort Services' own invoke as the signed-in operator; the job runs as them. Recorded as activity. Webhook destinations on private networks need `FELTKIT_WEBHOOK_PRIVATE_NETWORKS=1` outside development |
420
+ | `POST /services/jobs/:id/retry` | `feltkit.operations.write` + `jobs.retry` | Failed jobs with a registered handler only; authorized and recorded as the operator; the job keeps its owner and runs as them, re-authorized. Concurrent retries: one wins, the other gets 409 |
421
+ | `POST /agent/tasks/:id/approve`, `/reject`, `/retry`, `/resolve` | `feltkit.operations.write` + the lifecycle's own checks | The action lifecycle (Agents, above) applies unchanged; additionally, in production the person who proposed an action cannot approve it |
422
+ | `GET /readiness`, `/models`, `/integrations` | `feltkit.operations.read` | Readiness checks, the model status (no credential value), integration contracts, configuration, and calls |
423
+ | `POST /models/test`, `/agent/tasks/:id/decide` | `feltkit.operations.write` (+ the agent's own checks for `decide`) | A test decision; asking the model again for a blocked review |
424
+ | `POST /integrations/:name/check`, `/integrations/calls/:id/verify` | `feltkit.operations.write` | The health path; verification runs the probe as the operator, who must hold its permission |
425
+
426
+ Intentionally **not available in production**:
427
+ - **Webhook replay.** AppPort Services makes the person replaying a delivery its new
428
+ owner and replays deliveries that already succeeded, so the original owner's authority
429
+ would not be preserved (docs/UPSTREAM-GAPS.md).
430
+ - **Selecting a model** (`POST /models`). Production's model is selected on the host
431
+ (`feltkit model set --env production`).
432
+ - Data browsing and editing, function runs, capability invocation, session management,
433
+ creating, completing, or cancelling agent tasks, "run due work now", and the AppPort
434
+ Services console (its pages need their own origin; upstream gap S7).
435
+
436
+ Settling an action whose outcome is unknown (`resolve`) always needs a note. Evidence
437
+ of that exact request (AppPort's idempotency record, the function's activity entry, the
438
+ services' effect evidence) is consulted first: if it exists, it decides the outcome and
439
+ a contradicting claim is refused (409). Without evidence, the outcome is recorded as the
440
+ person's decision (`determinedBy: "person"`, with their name and note), never as
441
+ execution evidence.
442
+
443
+ **Environment.** A production server opens only the production instance. Writes must
444
+ name the environment (`x-feltkit-environment`); a mismatch changes nothing. Ambiguous
445
+ configuration fails at startup: both `FELTDB_URL` and `FELTKIT_STATE_DIR`, or an
446
+ explicit environment that differs from `FELTKIT_ENV`. Operator sessions live in the
447
+ environment's own instance and operator keys are per environment, so neither carries
448
+ across environments. Nothing is copied from development.
449
+
450
+ ## Activity log
451
+
452
+ - Recorded after the operation; a crash between commit and recording can lose an entry
453
+ (FeltDB's commit is still durable). Recording failures are surfaced in `inspect` and
454
+ the dashboard, never thrown at callers.
455
+ - Keeps the most recent 2000 entries. Records argument names, never values.
456
+ - In production, successful queries are not recorded by default (`activity.record`).
457
+
458
+ ## Deployment
459
+
460
+ - `feltkit deploy` produces an artifact and verifies it boots; FeltKit does not host.
@@ -0,0 +1,117 @@
1
+ # From a local app to production
2
+
3
+ The path, what FeltKit does at each step, and what remains yours. `npx feltkit readiness`
4
+ (and Studio → Readiness) checks every step that can be checked; nothing here is reported as
5
+ done because a build passed.
6
+
7
+ ## 1. Create
8
+
9
+ ```bash
10
+ npm create feltkit@latest my-app && cd my-app && npm install && npm run dev
11
+ ```
12
+
13
+ ## 2. Configure a model
14
+
15
+ Decisions use the environment's model, selected in AppPort Services Intelligence (enable it
16
+ with `services: { intelligence: true }`):
17
+
18
+ ```bash
19
+ npx feltkit model set --provider ollama --model llama3.2 --endpoint http://localhost:11434/v1
20
+ npx feltkit model set --provider openai --model gpt-4o-mini --credential credential-ref:openai
21
+ npx feltkit model show
22
+ ```
23
+
24
+ Providers: `openai`, `anthropic`, `opencode`, `ollama`, `custom` (any OpenAI-compatible
25
+ endpoint). A credential is a reference; its value goes in `FELTKIT_CREDENTIAL_<ID>` in that
26
+ environment's process. Studio → Models shows what the runtime can decide (FeltDB
27
+ `DecisionRuntime` capabilities) and **Test** calls it. Or pass any `DecisionRuntime` as
28
+ `feltkit({ agent: { decisions } })`.
29
+
30
+ ## 3. Connect a tool
31
+
32
+ ```ts
33
+ export const payments = app.integration("payments", {
34
+ baseUrl: { env: "PAYMENTS_URL", development: "http://127.0.0.1:4010" },
35
+ credential: "credential-ref:payments",
36
+ operations: {
37
+ create: { method: "POST", path: "/payments", input: { … }, output: …, effect: "consequential",
38
+ access: "payments.write", idempotencyHeader: "Idempotency-Key",
39
+ verify: { operation: "lookup", input: { invoiceId: { $input: "/invoiceId" } }, expect: [ … ] } },
40
+ lookup: { method: "GET", path: "/payments/by-invoice/{invoiceId}", output: …, effect: "observation", access: "payments.read" },
41
+ },
42
+ });
43
+ ```
44
+
45
+ Studio → Integrations shows the published contract, configuration, **Check** (the health
46
+ path), and every call. Readiness warns about consequential operations that declare neither
47
+ idempotency nor verification.
48
+
49
+ ## 4. Build a workflow
50
+
51
+ Durable steps are application state, `ctx.services.jobs`, and agent tasks. From a mutation,
52
+ `ctx.agent.start({ objective, decision: { question, options, context } })` opens a review
53
+ task after commit; the model's choice becomes a proposal that waits for approval. See
54
+ `examples/invoices`.
55
+
56
+ ## 5. Test
57
+
58
+ ```bash
59
+ npx feltkit test # each test app gets its own FeltDB instance
60
+ ```
61
+
62
+ Use deterministic fixtures for models and APIs (`examples/invoices/fixtures`). No test
63
+ needs a paid account.
64
+
65
+ ## 6. Review readiness
66
+
67
+ ```bash
68
+ npx feltkit readiness --env production # on the production host, server stopped; exit 1 on failures
69
+ ```
70
+
71
+ It checks storage, every credential reference, end-user sign-in, wildcard roles, Studio
72
+ operators, the model selection, each integration's configuration (production never uses a
73
+ development default, HTTPS, no loopback), uncertain-outcome handling, open unknown
74
+ outcomes, background work, and the build. Failures say how to fix them.
75
+
76
+ ## 7. Deploy (supported path)
77
+
78
+ ```bash
79
+ npx feltkit deploy --out ./artifact # builds, boots the build against a temporary state, verifies health
80
+ cd artifact && npm ci --omit=dev
81
+ ```
82
+
83
+ Run it with the production environment:
84
+
85
+ | Variable | Purpose |
86
+ |---|---|
87
+ | `PORT` | listen port |
88
+ | `FELTDB_URL` + `FELTDB_TOKEN` | a FeltDB server, **or** `FELTKIT_STATE_DIR` for local state (setting both fails) |
89
+ | `FELTDB_APPLICATION_ID` (+ `FELTDB_ENVIRONMENT`) | Managed FeltDB: the application and environment, under the contract `feltkit contract` writes and `feltdb publish --contract` promotes. See the managed starter ([`examples/managed`](../examples/managed/README.md)) |
90
+ | `FELTKIT_API_KEY_VERIFIER_KEY` | required when API keys are enabled |
91
+ | `FELTKIT_CREDENTIAL_<ID>` | every credential reference (readiness lists them) |
92
+ | integration base URLs (e.g. `PAYMENTS_URL`) | production endpoints (HTTPS) |
93
+ | `FELTKIT_DASHBOARD=1` + `FELTKIT_OPERATOR_KEY` | production Studio for operators (`feltkit operator grant`) |
94
+
95
+ Select the production model on the host: `npx feltkit model set --env production …`.
96
+
97
+ ## 8. Operate
98
+
99
+ Production Studio (operators only): inspect jobs, deliveries, agent tasks, integrations,
100
+ readiness; approve, reject, retry, settle; verify unknown integration calls; ask a model
101
+ again. Development tools are not served in production (docs/GUARANTEES.md).
102
+
103
+ ## What FeltKit does not provide
104
+
105
+ These are listed by readiness as "outside FeltKit" and are yours:
106
+
107
+ - **TLS and a reverse proxy.** FeltKit serves HTTP. Production Studio's cookie is `Secure`,
108
+ so it needs HTTPS. Set `Host` / `X-Forwarded-Host` to the public host.
109
+ - **Rate limiting.** In the proxy or platform.
110
+ - **Backups and restore.** Of the state directory or the FeltDB server. Test restores.
111
+ - **Monitoring and alerting.** FeltKit offers `/_feltkit/health`, stdout logs, and the
112
+ activity log; no metrics endpoint or alerts.
113
+ - **Secret provisioning.** From a secret manager into the process environment.
114
+ - **Network access to `/_feltkit/`.** Allow-list or proxy rules, in addition to operator
115
+ sign-in.
116
+ - **Hosting, scaling, and high availability.** One process per environment; the local
117
+ runtime is single-host.
package/docs/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # FeltKit 0.3.14 documentation
2
+
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.14/docs/README.md
5
+
6
+ - [ARCHITECTURE.md](ARCHITECTURE.md): How FeltKit is put together: one FeltDB instance, AppPort, AppPort Services
7
+ - [GUARANTEES.md](GUARANTEES.md): What FeltKit guarantees, and its known limitations
8
+ - [TRANSACTIONS.md](TRANSACTIONS.md): Mutations, ctx.db.sequence and ctx.afterCommit: the transaction contract
9
+ - [SECURITY.md](SECURITY.md): Authorization, sessions, credentials, and production Studio
10
+ - [AGENT-OPERATIONS.md](AGENT-OPERATIONS.md): Agents: MCP, tasks, proposals, approvals, and evidence
11
+ - [RESOLVER.md](RESOLVER.md): Model references: change the model a deployed app uses through Resolver, without a redeploy
12
+ - [PATH-TO-PRODUCTION.md](PATH-TO-PRODUCTION.md): From a local app to production: deploy targets and what you must provide
13
+ - [BACKUP.md](BACKUP.md): Backing up and restoring an environment's state
14
+ - [APPBOUNDRY.md](APPBOUNDRY.md): The AppBoundry artifact target
15
+ - [WHY-FELTKIT.md](WHY-FELTKIT.md): Design choices, compared with Convex
16
+ - [UPSTREAM-GAPS.md](UPSTREAM-GAPS.md): Known gaps in FeltDB, AppPort and AppPort Services, and their status