@feltdb/feltkit 0.3.17 → 0.3.19
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 +246 -13
- package/dist/app.js +215 -6
- package/dist/app.js.map +1 -1
- package/dist/appboundry/build.d.ts +70 -0
- package/dist/appboundry/build.js +62 -2
- package/dist/appboundry/build.js.map +1 -1
- package/dist/appboundry/guest.js +57 -3
- package/dist/appboundry/guest.js.map +1 -1
- package/dist/appboundry/host.js +7 -0
- package/dist/appboundry/host.js.map +1 -1
- package/dist/authorize.js +1 -0
- package/dist/authorize.js.map +1 -1
- package/dist/cli/compose.d.ts +31 -0
- package/dist/cli/compose.js +274 -0
- package/dist/cli/compose.js.map +1 -0
- package/dist/cli/create.d.ts +201 -0
- package/dist/cli/create.js +1139 -0
- package/dist/cli/create.js.map +1 -0
- package/dist/cli/deploy-appboundry-self-hosted.d.ts +2 -0
- package/dist/cli/deploy-appboundry-self-hosted.js +1 -1
- package/dist/cli/deploy-appboundry-self-hosted.js.map +1 -1
- package/dist/cli/deploy-appboundry.js +3 -0
- package/dist/cli/deploy-appboundry.js.map +1 -1
- package/dist/cli/deploy.d.ts +1 -0
- package/dist/cli/deploy.js +66 -6
- package/dist/cli/deploy.js.map +1 -1
- package/dist/cli/domain.d.ts +174 -0
- package/dist/cli/domain.js +1119 -0
- package/dist/cli/domain.js.map +1 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +141 -7
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/shell.d.ts +7 -0
- package/dist/cli/shell.js +59 -0
- package/dist/cli/shell.js.map +1 -0
- package/dist/client/index.d.ts +192 -5
- package/dist/client/index.js +301 -28
- package/dist/client/index.js.map +1 -1
- package/dist/component.d.ts +174 -0
- package/dist/component.js +77 -0
- package/dist/component.js.map +1 -0
- package/dist/composition/catalog.d.ts +3 -0
- package/dist/composition/catalog.js +217 -0
- package/dist/composition/catalog.js.map +1 -0
- package/dist/composition/contract.d.ts +165 -0
- package/dist/composition/contract.js +12 -0
- package/dist/composition/contract.js.map +1 -0
- package/dist/composition/execute.d.ts +110 -0
- package/dist/composition/execute.js +350 -0
- package/dist/composition/execute.js.map +1 -0
- package/dist/composition/generate.d.ts +105 -0
- package/dist/composition/generate.js +274 -0
- package/dist/composition/generate.js.map +1 -0
- package/dist/composition/plan.d.ts +131 -0
- package/dist/composition/plan.js +558 -0
- package/dist/composition/plan.js.map +1 -0
- package/dist/composition/profiles.d.ts +20 -0
- package/dist/composition/profiles.js +81 -0
- package/dist/composition/profiles.js.map +1 -0
- package/dist/composition/reconcile.d.ts +153 -0
- package/dist/composition/reconcile.js +282 -0
- package/dist/composition/reconcile.js.map +1 -0
- package/dist/composition/recover.d.ts +89 -0
- package/dist/composition/recover.js +407 -0
- package/dist/composition/recover.js.map +1 -0
- package/dist/composition/resolve.d.ts +2 -0
- package/dist/composition/resolve.js +208 -0
- package/dist/composition/resolve.js.map +1 -0
- package/dist/dashboard/assets/{index-DnIOVGF-.js → index-BrC1AtZ1.js} +5 -5
- package/dist/dashboard/index.html +1 -1
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +2 -0
- package/dist/docs.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/react/auth.d.ts +131 -0
- package/dist/react/auth.js +830 -0
- package/dist/react/auth.js.map +1 -0
- package/dist/react/context.d.ts +8 -0
- package/dist/react/context.js +14 -0
- package/dist/react/context.js.map +1 -0
- package/dist/react/index.d.ts +3 -18
- package/dist/react/index.js +5 -13
- package/dist/react/index.js.map +1 -1
- package/dist/runtime/accounts.d.ts +33 -2
- package/dist/runtime/accounts.js +167 -27
- package/dist/runtime/accounts.js.map +1 -1
- package/dist/runtime/activity.d.ts +8 -1
- package/dist/runtime/activity.js.map +1 -1
- package/dist/runtime/audit.d.ts +43 -0
- package/dist/runtime/audit.js +52 -0
- package/dist/runtime/audit.js.map +1 -0
- package/dist/runtime/authority.d.ts +8 -1
- package/dist/runtime/authority.js +11 -2
- package/dist/runtime/authority.js.map +1 -1
- package/dist/runtime/challenges.d.ts +51 -0
- package/dist/runtime/challenges.js +121 -0
- package/dist/runtime/challenges.js.map +1 -0
- package/dist/runtime/changes.d.ts +22 -0
- package/dist/runtime/changes.js +51 -3
- package/dist/runtime/changes.js.map +1 -1
- package/dist/runtime/claims.d.ts +76 -0
- package/dist/runtime/claims.js +100 -0
- package/dist/runtime/claims.js.map +1 -0
- package/dist/runtime/context.d.ts +47 -5
- package/dist/runtime/contract.js +17 -3
- package/dist/runtime/contract.js.map +1 -1
- package/dist/runtime/data.d.ts +50 -4
- package/dist/runtime/data.js +113 -35
- package/dist/runtime/data.js.map +1 -1
- package/dist/runtime/escape-hatch.d.ts +37 -0
- package/dist/runtime/escape-hatch.js +76 -0
- package/dist/runtime/escape-hatch.js.map +1 -0
- package/dist/runtime/instance.js +2 -1
- package/dist/runtime/instance.js.map +1 -1
- package/dist/runtime/live.d.ts +48 -0
- package/dist/runtime/live.js +154 -0
- package/dist/runtime/live.js.map +1 -0
- package/dist/runtime/outbox.js +6 -0
- package/dist/runtime/outbox.js.map +1 -1
- package/dist/runtime/runtime.d.ts +103 -5
- package/dist/runtime/runtime.js +411 -41
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/search.d.ts +54 -0
- package/dist/runtime/search.js +66 -0
- package/dist/runtime/search.js.map +1 -0
- package/dist/runtime/services-rules.d.ts +12 -0
- package/dist/runtime/services-rules.js +8 -0
- package/dist/runtime/services-rules.js.map +1 -0
- package/dist/runtime/services.js +5 -3
- package/dist/runtime/services.js.map +1 -1
- package/dist/runtime/sessions.d.ts +16 -2
- package/dist/runtime/sessions.js +40 -4
- package/dist/runtime/sessions.js.map +1 -1
- package/dist/runtime/tenancy.d.ts +198 -0
- package/dist/runtime/tenancy.js +397 -0
- package/dist/runtime/tenancy.js.map +1 -0
- package/dist/runtime/tenant-scope.d.ts +9 -0
- package/dist/runtime/tenant-scope.js +127 -0
- package/dist/runtime/tenant-scope.js.map +1 -0
- package/dist/runtime/transactions.d.ts +83 -3
- package/dist/runtime/transactions.js +53 -11
- package/dist/runtime/transactions.js.map +1 -1
- package/dist/server/admin.js +52 -0
- package/dist/server/admin.js.map +1 -1
- package/dist/server/components.d.ts +44 -0
- package/dist/server/components.js +212 -0
- package/dist/server/components.js.map +1 -0
- package/dist/server/index.d.ts +4 -1
- package/dist/server/index.js +324 -63
- package/dist/server/index.js.map +1 -1
- package/dist/server/mcp.js +6 -3
- package/dist/server/mcp.js.map +1 -1
- package/dist/server/project.d.ts +27 -0
- package/dist/server/project.js +63 -0
- package/dist/server/project.js.map +1 -1
- package/dist/server/public.d.ts +2 -0
- package/dist/server/public.js +2 -0
- package/dist/server/public.js.map +1 -1
- package/dist/server/session-http.d.ts +48 -0
- package/dist/server/session-http.js +116 -0
- package/dist/server/session-http.js.map +1 -0
- package/dist/server/tenancy.d.ts +40 -0
- package/dist/server/tenancy.js +191 -0
- package/dist/server/tenancy.js.map +1 -0
- package/dist/testing/index.d.ts +19 -0
- package/dist/testing/index.js +22 -2
- package/dist/testing/index.js.map +1 -1
- package/docs/AGENT-OPERATIONS.md +1 -0
- package/docs/APPBOUNDRY.md +11 -1
- package/docs/ARCHITECTURE.md +5 -3
- package/docs/AUTH.md +267 -0
- package/docs/COMPONENTS.md +91 -0
- package/docs/GUARANTEES.md +74 -7
- package/docs/README.md +4 -2
- package/docs/RESOLVER.md +4 -2
- package/docs/SECURITY.md +5 -4
- package/docs/TRANSACTIONS.md +98 -1
- package/docs/UPSTREAM-GAPS.md +2 -0
- package/package.json +15 -12
- package/skills/.claude-plugin/marketplace.json +1 -1
- package/skills/.claude-plugin/plugin.json +1 -1
- package/skills/feltkit-data/SKILL.md +6 -0
- package/skills/feltkit-services/SKILL.md +1 -1
- package/dist/runtime/account-links.d.ts +0 -19
- package/dist/runtime/account-links.js +0 -45
- package/dist/runtime/account-links.js.map +0 -1
package/docs/TRANSACTIONS.md
CHANGED
|
@@ -180,7 +180,7 @@ Creation, not execution: a job's run and a webhook's delivery to its endpoint st
|
|
|
180
180
|
source build and the packed package (extending `tests/e2e/state-contract-parity.test.mjs`).
|
|
181
181
|
- Existing applications keep their ordering: `test/sequence.test.ts` passes unchanged.
|
|
182
182
|
|
|
183
|
-
## 7. Evidence
|
|
183
|
+
## 7. Evidence (sequences and after-commit effects)
|
|
184
184
|
|
|
185
185
|
- `packages/sdk/test/transactions.test.ts` (FeltKit runtime, local state directory) covers:
|
|
186
186
|
- 10 concurrent streams, 3 rounds, all committed and each `[1, 2, 3]`;
|
|
@@ -214,3 +214,100 @@ Creation, not execution: a job's run and a webhook's delivery to its endpoint st
|
|
|
214
214
|
- `tests/e2e/transactions-parity.test.mjs` runs one FeltKit application on FeltKit's runtime,
|
|
215
215
|
AppBoundry's source build and the packed 1.5.0, each on persisted state, with concurrent calls
|
|
216
216
|
and a restart. All three must give the same results.
|
|
217
|
+
|
|
218
|
+
## 8. Application agents (`app.agent`)
|
|
219
|
+
|
|
220
|
+
Added for FK-GAP-008 ("@assistant mention → the agent reads the conversation and acts, as itself,
|
|
221
|
+
through the app's capabilities"). It is one more after-commit effect, not a second agent runtime and
|
|
222
|
+
not a new worker: the outbox above is the queue, the services worker is the executor, and the
|
|
223
|
+
handler is ordinary application code run through the runtime's call path.
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
export const assistant = app.agent("assistant", {
|
|
227
|
+
principal: { id: "assistant", displayName: "Assistant" }, // type "agent"
|
|
228
|
+
roles: ["assistant"], // declared in feltkit({ roles }): its whole authority
|
|
229
|
+
access: "messages.write", // checked against those roles; required (no default)
|
|
230
|
+
on: mentioned, // optional: app.event(s) that trigger it
|
|
231
|
+
retry: { maxAttempts: 5, backoffMs: 1000 }, // defaults
|
|
232
|
+
leaseMs: 300_000, // default
|
|
233
|
+
handler: async (ctx, input) => {
|
|
234
|
+
// ctx is a mutation's context, as the agent; ctx.trigger = { agent, idempotencyKey, attempt, by, event?, requestedTenantId? }
|
|
235
|
+
const recent = await ctx.db.find(messages, { roomId: input.roomId });
|
|
236
|
+
await ctx.db.insert(messages, { roomId: input.roomId, author: ctx.auth.principal!.id, text: summarize(recent) });
|
|
237
|
+
// a model decision among options: ctx.agent.start({ objective, decision }) (FeltKit's agent, as this principal)
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// In a mutation: the app decides when (deterministic, testable).
|
|
242
|
+
if (text.includes("@assistant")) ctx.afterCommit.agent("assistant", { roomId });
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Triggers, and why these two
|
|
246
|
+
|
|
247
|
+
- **`ctx.afterCommit.agent(name, input)`** is the general one. The application decides, in the
|
|
248
|
+
mutation that made the change, whether an agent should act (a mention, a status change), with
|
|
249
|
+
exactly the input it needs. It is staged like every other after-commit effect, so it inherits the
|
|
250
|
+
outbox's guarantee: recorded if and only if the mutation commits.
|
|
251
|
+
- **`on: event`** is sugar over an existing primitive: when a mutation publishes an `app.event` named
|
|
252
|
+
in an agent's `on`, the run is staged at that moment, in the same transaction. The handler's input
|
|
253
|
+
is `{ event, payload, scope? }` and `ctx.trigger.event` names the event. The event itself stays
|
|
254
|
+
ephemeral (at most once, to current subscribers); the agent's run is durable.
|
|
255
|
+
|
|
256
|
+
Data-change triggers ("whenever a record matches X") are not offered: they would need a durable
|
|
257
|
+
change feed with its own cursor and ordering, which is the control plane this design avoids. A
|
|
258
|
+
mutation that writes the record can call `ctx.afterCommit.agent` itself.
|
|
259
|
+
|
|
260
|
+
### Execution
|
|
261
|
+
|
|
262
|
+
| Step | Behavior |
|
|
263
|
+
|---|---|
|
|
264
|
+
| Staging | An `_feltkit_outbox` record (`effect: { service: "agent", method: "run", agent, input, tenantId?, event? }`), `principalId` = the caller (or `anonymous`), in the mutation's transaction. An unknown agent name is INVALID_ARGUMENT in the mutation. |
|
|
265
|
+
| Rollback | A handler that throws, or a refused commit: no record, no run. |
|
|
266
|
+
| After commit | The runtime starts the run at once, detached: the caller's response does not wait for it, and the caller's services binding is not used. |
|
|
267
|
+
| Claim (lease) | `pending → performing`, version-checked (one performer at a time). A claim older than the agent's `leaseMs` is taken over by the services worker. |
|
|
268
|
+
| Identity | `{ id: principal.id, type: "agent", roles }`, plus a tenant only by its own membership (below). The triggering caller's roles, session and tenant role are never used. |
|
|
269
|
+
| Authority | `Runtime#call("agent/<name>", input, { principal, via: "agent" })`: roles → `access` → `feltkit({ authorize })` (it sees `function: "agent/<name>"`), then the handler with a mutation's `ctx` (`db`, `services`, `afterCommit`, `events`, `agent`) plus `ctx.trigger`. Nobody can call `agent/<name>` by name from outside. |
|
|
270
|
+
| Writes | Commit under a FeltDB transaction id derived from the record (`agent:<outboxId>`). An attempt repeated after an earlier one committed (the done mark was lost) is refused by FeltDB's transaction-id binding and recorded done with `result.committedEarlier`: **the run's writes commit at most once per trigger.** |
|
|
271
|
+
| Success | `done`, `result: { requestId, tenantId? }`; the activity entry carries `detail.agentRun` (agent, idempotency key, attempt, who triggered it, from which function, event). |
|
|
272
|
+
| Failure | `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `INVALID_ARGUMENT`, `FUNCTION_NOT_FOUND`: `failed` at once (retrying cannot change an authority decision). Anything else: back to `pending` with `error` and `notBefore = now + backoffMs·2^(attempt−1)` (at most 10 min), until `maxAttempts`, then `failed`. A run whose claim expired more than `maxAttempts` times is failed as abandoned. |
|
|
273
|
+
| Recovery | The services worker (`runServices`, every second by default) performs due agent records: `pending` past `notBefore` (or 30 s after creation if never started), and `performing` past the lease. Records are FeltDB records: they survive restarts. |
|
|
274
|
+
| Operator | `feltkit outbox list` shows them (`agent <name>`); `feltkit outbox retry <id>` runs a failed one again at once. |
|
|
275
|
+
|
|
276
|
+
**Delivery is at least once.** The handler can run more than once for one trigger (a retry, a
|
|
277
|
+
lease taken over from a slow or stopped process). FeltKit makes the run's own FeltDB writes
|
|
278
|
+
commit at most once; anything else the handler does (a model call, `ctx.services.*`, an
|
|
279
|
+
integration) should be keyed by `ctx.trigger.idempotencyKey`, which is the same on every attempt.
|
|
280
|
+
`ctx.afterCommit.*` inside the handler is part of its transaction, so it follows the writes.
|
|
281
|
+
|
|
282
|
+
### Tenancy
|
|
283
|
+
|
|
284
|
+
The record keeps the tenant the triggering call worked in (`effect.tenantId`;
|
|
285
|
+
`ctx.trigger.requestedTenantId`). When the run starts, the agent works in that tenant **only if
|
|
286
|
+
the agent's own principal is an active member there** (`TenancyStore.context`, the same check as
|
|
287
|
+
any session, via `runtime.withTenant`): it then holds its membership's role in addition to its
|
|
288
|
+
declared roles. Otherwise it runs with **no tenant**: `ctx.auth.tenant` is null and tenant-scoped
|
|
289
|
+
collections are closed to it. Add an agent to a workspace like any agent
|
|
290
|
+
(`TenancyStore.addPrincipal`, a manager's action). The trigger never carries the caller's tenant
|
|
291
|
+
role to the agent.
|
|
292
|
+
|
|
293
|
+
### Limits
|
|
294
|
+
|
|
295
|
+
- **AppBoundry artifacts cannot run application agents.** The guest/host protocol runs guest code
|
|
296
|
+
only inside a call, as that call's principal; running a handler later as another principal needs a
|
|
297
|
+
host interface AppBoundry does not have. `feltkit build --target appboundry` refuses `app.agent`
|
|
298
|
+
(naming the agents), the guest's `ctx.afterCommit.agent` answers CONFIGURATION, and FeltKit's
|
|
299
|
+
reference host refuses an `agent` effect. Run such an application on FeltKit's runtime.
|
|
300
|
+
- An agent that triggers itself (directly or through an event it publishes) loops; FeltKit does not
|
|
301
|
+
detect it.
|
|
302
|
+
- Order between runs is not guaranteed (as for every after-commit effect).
|
|
303
|
+
- The lease bounds how long one attempt may run before another process may start it again; set
|
|
304
|
+
`leaseMs` above the handler's longest run (model calls included).
|
|
305
|
+
|
|
306
|
+
Evidence: `packages/sdk/test/agents.test.ts`: a mention runs the agent once, as the agent, writing with
|
|
307
|
+
its own authority (principal id, type and roles, activity entry, record done, no re-run, not callable
|
|
308
|
+
by name); refused without the permission and by the authorize hook (failed, nothing written); a failed
|
|
309
|
+
attempt is retried with the same key and succeeds, `maxAttempts` failures are recorded and an operator
|
|
310
|
+
retry runs it; a run repeated after its writes committed writes nothing again; a failed mutation
|
|
311
|
+
triggers nothing; an `app.event` in `on` triggers it; tenancy (non-member → no tenant; member → its
|
|
312
|
+
tenant with its own role); a pending run survives a restart and the next process performs it;
|
|
313
|
+
declarations are checked; an AppBoundry build refuses `app.agent`.
|
package/docs/UPSTREAM-GAPS.md
CHANGED
|
@@ -76,6 +76,8 @@ Per-candidate mapping, removed code and verification: `packages/sdk/test/feltdb-
|
|
|
76
76
|
| F21 | `AgentStateStore.recallForTask` returns at most the 100 newest active memories per scope and has no cursor | Open (found 2026-11-03) | FeltKit read a task's actions and decision request through it, so a task with more than 100 active memories lost its oldest actions: proposed actions awaiting approval disappeared from the task (measured: 105 proposed, 100 listed). FeltKit now pages `recall({ scope: task })` (`runtime/agent.ts` `#taskMemories`). Test: "a task with more than 100 active memories…" in `test/agent-lifecycle.test.ts`. Ask: a cursor on `recallForTask`, or a documented cap |
|
|
77
77
|
| F22 | On the local runtimes, `collection.find()` and `db.query()` return the stored objects, not copies (`collection.get()` copies). A caller that changes a returned record changes what every later read in the process sees, with no write, version or commit | Open (found 2026-11-03, FeltDB 0.20.0) | Found by the SupplyDesk evaluation as a false `CONFLICT`: the change also altered the read basis FeltKit fences at commit. FeltKit's `ctx.db` now returns its own copies and copies values written (`runtime/data.ts` `owned`); `packages/sdk/test/data-isolation.test.ts` shows a query's change no longer leaks. Ask: copy in `find`/`query` (or freeze). |
|
|
78
78
|
|
|
79
|
+
| F23 | No text search: `db.query` takes only `eq`/`neq`/`lt`/`lte`/`gt`/`gte` (the query planner's `contains`/`startsWith` are internal, not part of `AuthorityQueryRequest`), and there is no text index | Open (found 2026-11-05, @feltdb/core 0.21.0) | `ctx.db.search` (FK-GAP-006, `runtime/search.ts`) pushes the equality `where` down and scans its matches page by page in FeltKit, testing normalized substrings, until `limit` match; at most 50,000 records are examined. Cost is linear in the `where` matches. Ask: a declared text index (normalized tokens, per collection and field) and a `contains`/`matches` clause on `db.query` that uses it, with the same cursor paging |
|
|
80
|
+
|
|
79
81
|
## AppPort (`rkendel1/appport`)
|
|
80
82
|
|
|
81
83
|
A1–A4 are closed by the released `@appport/core` 1.4.0 / `@appport/sdk` 1.4.0 / `@appport/testing` 1.2.0, which FeltKit pins. Two gaps remain: A5, found while adopting them, and A6 (rkendel1/feltkit#27). Per-candidate evidence: the AppPort rows of the migration audit and `packages/sdk/test/appport-idempotency.test.ts`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feltdb/feltkit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
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",
|
|
@@ -48,22 +48,24 @@
|
|
|
48
48
|
],
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rm -rf dist && tsc -p tsconfig.json && node scripts/build-dashboard.mjs && node scripts/copy-docs.mjs",
|
|
51
|
-
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p dashboard/tsconfig.json --noEmit",
|
|
51
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p dashboard/tsconfig.json --noEmit && tsc -p test/tsconfig.composition.json",
|
|
52
52
|
"test": "node --import tsx --test --test-concurrency=1 test/*.test.ts && npm run test:conformance",
|
|
53
53
|
"test:conformance": "vitest run",
|
|
54
|
+
"test:composition-coverage": "node --import tsx --test --test-concurrency=1 --test-timeout=900000 test/coverage/*.test.ts",
|
|
55
|
+
"matrix": "node --import tsx test/matrix/run.ts",
|
|
54
56
|
"prepack": "npm run build"
|
|
55
57
|
},
|
|
56
58
|
"dependencies": {
|
|
57
|
-
"@appport/authorization": "1.
|
|
58
|
-
"@appport/integration": "1.2.
|
|
59
|
-
"@appport/protocol": "1.
|
|
60
|
-
"@appport/resolver-client": "0.2.
|
|
61
|
-
"@appport/schema": "1.1.
|
|
62
|
-
"@appport/sdk": "1.
|
|
63
|
-
"@appport/server": "1.
|
|
64
|
-
"@appport/services": ">=0.
|
|
59
|
+
"@appport/authorization": "1.1.1",
|
|
60
|
+
"@appport/integration": "1.2.5",
|
|
61
|
+
"@appport/protocol": "1.5.0",
|
|
62
|
+
"@appport/resolver-client": "0.2.3",
|
|
63
|
+
"@appport/schema": "1.1.6",
|
|
64
|
+
"@appport/sdk": "1.8.0",
|
|
65
|
+
"@appport/server": "1.3.1",
|
|
66
|
+
"@appport/services": ">=0.16.0 <1.0.0",
|
|
65
67
|
"@feltdb/core": ">=0.21.0 <1.0.0",
|
|
66
|
-
"create-feltkit": "0.3.
|
|
68
|
+
"create-feltkit": "0.3.19",
|
|
67
69
|
"esbuild": "0.25.12",
|
|
68
70
|
"express": "4.22.3",
|
|
69
71
|
"mailerport": ">=0.1.0 <1.0.0",
|
|
@@ -82,7 +84,8 @@
|
|
|
82
84
|
}
|
|
83
85
|
},
|
|
84
86
|
"devDependencies": {
|
|
85
|
-
"@appport/testing": "1.2.
|
|
87
|
+
"@appport/testing": "1.2.4",
|
|
88
|
+
"@mailerport/service": "0.1.0",
|
|
86
89
|
"@feltdb/webllm": ">=0.20.0 <1.0.0",
|
|
87
90
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
88
91
|
"@stack-ui/core": "file:dashboard/vendor/stack-ui/core",
|
|
@@ -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.
|
|
4
|
+
"version": "0.3.19",
|
|
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"
|
|
@@ -42,8 +42,14 @@ await ctx.db.find(contacts, { stage: "lead" }, { orderBy: [{ field: "name", dire
|
|
|
42
42
|
await ctx.db.count(contacts, { ownerId });
|
|
43
43
|
const page = await ctx.db.query(contacts, { where: [{ field: "stage", eq: "lead" }], orderBy: [{ field: "name", direction: "asc" }], limit: 25, cursor });
|
|
44
44
|
// page.records, page.nextCursor, page.exhausted
|
|
45
|
+
await ctx.db.search(messages, { text: "deploy café", where: { channelId }, limit: 20 }); // needs { search: ["text"] } on the collection
|
|
45
46
|
```
|
|
46
47
|
|
|
48
|
+
`search` returns records whose declared `search` fields contain every word (case- and accent-insensitive),
|
|
49
|
+
newest first, at most `limit` (≤ 100). It scans the records matching `where`, so always narrow it with an
|
|
50
|
+
equality `where` on large collections. For live queries, filter by `id`, indexed, unique, reference or
|
|
51
|
+
tenant fields: a query that reads `find(messages, { channelId })` re-runs only when that channel changes.
|
|
52
|
+
|
|
47
53
|
`find` returns **every** match unless you pass `limit` (FeltKit reads FeltDB's pages for you), and `count`
|
|
48
54
|
counts every match. `query` returns **one page** of at most 1,000 records: follow `nextCursor` until it
|
|
49
55
|
is absent. For a large collection, page with `query` on a request path rather than `find` everything.
|
|
@@ -143,6 +143,6 @@ affect other systems. Confirm with the user before doing any of them.
|
|
|
143
143
|
|
|
144
144
|
## Compatibility
|
|
145
145
|
|
|
146
|
-
`@feltdb/feltkit` 0.3.x with `@appport/services` 0.
|
|
146
|
+
`@feltdb/feltkit` 0.3.x with `@appport/services` 0.16.0 (shared instance; transactional job and webhook creation; `credential.store` / `credential.status`; `servicesContract` for Managed FeltDB).
|
|
147
147
|
The console is development-only.
|
|
148
148
|
Verified in Claude Code only.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type LinkPurpose = "verify" | "reset";
|
|
2
|
-
/** How long a link works. */
|
|
3
|
-
export declare const LINK_TTL_MS: Record<LinkPurpose, number>;
|
|
4
|
-
export declare function signLink(key: string, input: {
|
|
5
|
-
purpose: LinkPurpose;
|
|
6
|
-
accountId: string;
|
|
7
|
-
bind: string;
|
|
8
|
-
now?: number;
|
|
9
|
-
}): string;
|
|
10
|
-
/** The account a link names, before its MAC is checked against that account's state. */
|
|
11
|
-
export declare function readLink(token: unknown, purpose: LinkPurpose, now?: number): {
|
|
12
|
-
accountId: string;
|
|
13
|
-
payload: string;
|
|
14
|
-
mac: Buffer;
|
|
15
|
-
};
|
|
16
|
-
export declare function checkLink(key: string, link: {
|
|
17
|
-
payload: string;
|
|
18
|
-
mac: Buffer;
|
|
19
|
-
}, purpose: LinkPurpose, bind: string): boolean;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Signed account links: verify an e-mail address, reset a password.
|
|
3
|
-
*
|
|
4
|
-
* A link is stateless: `<payload>.<mac>`, the payload naming the purpose, the account and the
|
|
5
|
-
* expiry, and the MAC an HMAC-SHA256 under the environment's auth secret (FELTKIT_AUTH_SECRET)
|
|
6
|
-
* over the payload and the account state the link is bound to. A reset link is bound to the
|
|
7
|
-
* account's current password hash, so it works once: setting the password changes the hash and
|
|
8
|
-
* every earlier reset link stops working. A verification link is bound to the address. Nothing
|
|
9
|
-
* secret is stored: the notification that carries the e-mail holds only the account and the
|
|
10
|
-
* purpose, and the link is computed when the e-mail is delivered.
|
|
11
|
-
*/
|
|
12
|
-
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
13
|
-
import { FeltKitError } from "../errors.js";
|
|
14
|
-
/** How long a link works. */
|
|
15
|
-
export const LINK_TTL_MS = { verify: 7 * 24 * 3_600_000, reset: 60 * 60_000 };
|
|
16
|
-
const b64 = (value) => Buffer.from(value).toString("base64url");
|
|
17
|
-
const mac = (key, purpose, payload, bind) => createHmac("sha256", key).update(`feltkit.account-link.v1\n${purpose}\n${payload}\n${bind}`).digest();
|
|
18
|
-
export function signLink(key, input) {
|
|
19
|
-
const payload = b64(JSON.stringify({ p: input.purpose, a: input.accountId, e: (input.now ?? Date.now()) + LINK_TTL_MS[input.purpose] }));
|
|
20
|
-
return `${payload}.${b64(mac(key, input.purpose, payload, input.bind))}`;
|
|
21
|
-
}
|
|
22
|
-
/** The account a link names, before its MAC is checked against that account's state. */
|
|
23
|
-
export function readLink(token, purpose, now = Date.now()) {
|
|
24
|
-
const invalid = () => new FeltKitError("INVALID_ARGUMENT", purpose === "reset" ? "This password reset link is invalid or has expired. Ask for a new one." : "This verification link is invalid or has expired. Ask for a new one.");
|
|
25
|
-
if (typeof token !== "string" || token.length > 600)
|
|
26
|
-
throw invalid();
|
|
27
|
-
const [payload, signature, extra] = token.split(".");
|
|
28
|
-
if (!payload || !signature || extra !== undefined)
|
|
29
|
-
throw invalid();
|
|
30
|
-
let body;
|
|
31
|
-
try {
|
|
32
|
-
body = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
throw invalid();
|
|
36
|
-
}
|
|
37
|
-
if (body.p !== purpose || typeof body.a !== "string" || typeof body.e !== "number" || body.e < now)
|
|
38
|
-
throw invalid();
|
|
39
|
-
return { accountId: body.a, payload, mac: Buffer.from(signature, "base64url") };
|
|
40
|
-
}
|
|
41
|
-
export function checkLink(key, link, purpose, bind) {
|
|
42
|
-
const expected = mac(key, purpose, link.payload, bind);
|
|
43
|
-
return link.mac.length === expected.length && timingSafeEqual(link.mac, expected);
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=account-links.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account-links.js","sourceRoot":"","sources":["../../src/runtime/account-links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,6BAA6B;AAC7B,MAAM,CAAC,MAAM,WAAW,GAAgC,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,SAAS,EAAE,KAAK,EAAE,EAAE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