@feltdb/feltkit 0.3.31 → 0.3.32
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 +40 -2
- package/dist/app.js +22 -0
- package/dist/app.js.map +1 -1
- package/dist/broker/assertion.d.ts +68 -0
- package/dist/broker/assertion.js +104 -0
- package/dist/broker/assertion.js.map +1 -0
- package/dist/broker/keys.d.ts +9 -0
- package/dist/broker/keys.js +47 -0
- package/dist/broker/keys.js.map +1 -0
- package/dist/broker/server.d.ts +54 -0
- package/dist/broker/server.js +305 -0
- package/dist/broker/server.js.map +1 -0
- package/dist/cli/broker.d.ts +11 -0
- package/dist/cli/broker.js +72 -0
- package/dist/cli/broker.js.map +1 -0
- package/dist/cli/deploy.js +6 -0
- package/dist/cli/deploy.js.map +1 -1
- package/dist/cli/main.js +123 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/client/index.d.ts +8 -2
- package/dist/client/index.js +45 -1
- package/dist/client/index.js.map +1 -1
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +2 -0
- package/dist/docs.js.map +1 -1
- package/dist/extension/build.d.ts +50 -0
- package/dist/extension/build.js +205 -0
- package/dist/extension/build.js.map +1 -0
- package/dist/extension/client-shim.d.ts +7 -0
- package/dist/extension/client-shim.js +13 -0
- package/dist/extension/client-shim.js.map +1 -0
- package/dist/extension/connect-ui.d.ts +24 -0
- package/dist/extension/connect-ui.js +67 -0
- package/dist/extension/connect-ui.js.map +1 -0
- package/dist/extension/connection.d.ts +109 -0
- package/dist/extension/connection.js +190 -0
- package/dist/extension/connection.js.map +1 -0
- package/dist/extension/host-core.d.ts +36 -0
- package/dist/extension/host-core.js +50 -0
- package/dist/extension/host-core.js.map +1 -0
- package/dist/extension/host.d.ts +1 -0
- package/dist/extension/host.js +8 -0
- package/dist/extension/host.js.map +1 -0
- package/dist/extension/icons.d.ts +13 -0
- package/dist/extension/icons.js +75 -0
- package/dist/extension/icons.js.map +1 -0
- package/dist/extension/identity.d.ts +40 -0
- package/dist/extension/identity.js +110 -0
- package/dist/extension/identity.js.map +1 -0
- package/dist/extension/options.d.ts +1 -0
- package/dist/extension/options.js +57 -0
- package/dist/extension/options.js.map +1 -0
- package/dist/extension/service-worker.d.ts +1 -0
- package/dist/extension/service-worker.js +38 -0
- package/dist/extension/service-worker.js.map +1 -0
- package/dist/extension/validate.d.ts +7 -0
- package/dist/extension/validate.js +143 -0
- package/dist/extension/validate.js.map +1 -0
- package/dist/extension/zip.d.ts +7 -0
- package/dist/extension/zip.js +94 -0
- package/dist/extension/zip.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js.map +1 -1
- package/dist/policy.d.ts +7 -0
- package/dist/policy.js +2 -2
- package/dist/policy.js.map +1 -1
- package/dist/runtime/application-authority.d.ts +10 -10
- package/dist/runtime/application-authority.js +40 -14
- package/dist/runtime/application-authority.js.map +1 -1
- package/dist/runtime/authority-contract.d.ts +55 -0
- package/dist/runtime/authority-contract.js +60 -0
- package/dist/runtime/authority-contract.js.map +1 -0
- package/dist/runtime/context.d.ts +24 -0
- package/dist/runtime/integrations.d.ts +2 -0
- package/dist/runtime/integrations.js +9 -4
- package/dist/runtime/integrations.js.map +1 -1
- package/dist/runtime/invocations.d.ts +3 -0
- package/dist/runtime/invocations.js +1 -1
- package/dist/runtime/invocations.js.map +1 -1
- package/dist/runtime/local-authority.d.ts +43 -10
- package/dist/runtime/local-authority.js +84 -21
- package/dist/runtime/local-authority.js.map +1 -1
- package/dist/runtime/readiness.js +31 -1
- package/dist/runtime/readiness.js.map +1 -1
- package/dist/runtime/runtime.d.ts +2 -0
- package/dist/runtime/runtime.js +9 -4
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/server/oauth.d.ts +32 -2
- package/dist/server/oauth.js +130 -23
- package/dist/server/oauth.js.map +1 -1
- package/dist/server/project.d.ts +3 -0
- package/dist/server/project.js +2 -2
- package/dist/server/project.js.map +1 -1
- package/docs/CONNECTIONS.md +10 -3
- package/docs/EXTENSION-HOSTS.md +64 -5
- package/docs/GUARANTEES.md +4 -2
- package/docs/LOCAL-AUTHORITY.md +118 -0
- package/docs/POLICIES.md +1 -1
- package/docs/README.md +4 -2
- package/docs/SECURITY.md +39 -0
- package/docs/SIGN-IN-BROKER.md +77 -0
- package/package.json +6 -6
- 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 +10 -0
- package/skills/feltkit-data/SKILL.md +13 -1
- package/skills/feltkit-services/SKILL.md +14 -1
package/docs/GUARANTEES.md
CHANGED
|
@@ -687,8 +687,10 @@ across environments. Nothing is copied from development.
|
|
|
687
687
|
|
|
688
688
|
| Primitive | Guarantee | Verified by |
|
|
689
689
|
|---|---|---|
|
|
690
|
-
| `ctx.authority.decide({ capability, onBehalfOf?, agent?, resource?, context? })` | AuthBoundry through the same `authBoundryAuthority` the platform uses. The asking principal is
|
|
691
|
-
| Per-agent delegation (`authority.local`) | Every `app.agent` is an AuthBoundry agent of the application (`agent:<id>`), registered at each start with its own credential in custody; agents registered at run time (`ctx.authority.agents.register`, needs `feltkit.authority.agents`, never by an agent) are registered again too. A grant may name an agent (`grants.grant({ agent })`) and then allows only that agent. **An agent caller decides as itself, always**, with its own credential: a grant to another agent or to the executor never allows it, and naming another agent is a deny. Anyone else decides as the executor unless it names a registered agent. An unregistered agent is a deny. Revoking a grant stops that grant only; revoking an agent stops all of its grants. With a hosted AuthBoundry, agent callers decide as the executor (no per-agent credentials) | `test/local-authority.test.ts` (real local AuthBoundry) |
|
|
690
|
+
| `ctx.authority.decide({ capability, onBehalfOf?, agent?, resource?, context? })` | AuthBoundry through the same `authBoundryAuthority` the platform uses. The asking principal is `feltkit({ authority }).executor`, except where an agent decides as itself (the per-agent row below; `authorityMode` says which); `onBehalfOf` names the requester, and an allow for it must echo that requester and a `delegation_id`. `onBehalfOf` is mapped as `ctx.authority.grants` maps the delegator (FRAME-GAP-11): an application principal id (no `:`, e.g. `"ada"`) goes through `authority.principal` (default `user:<id>`); an AuthBoundry principal (`<type>:<id>`, e.g. `"user:ada"`) is sent unchanged; `{ person }` always maps and `{ principal }` never does, for ids that break that rule. The decision's `onBehalfOf` is the principal asked about. Fails closed (unconfigured, unreachable, slow, malformed, inexact, missing credential). Credentials are custody references resolved per decision; each decision is in the activity log with its ids, never a credential | `test/application-platform.test.ts`, `test/local-authority.test.ts` (both forms against a real local AuthBoundry) |
|
|
691
|
+
| Per-agent delegation (`authority.local`) | Every `app.agent` is an AuthBoundry agent of the application (`agent:<id>`), registered at each start with its own credential in custody; agents registered at run time (`ctx.authority.agents.register`, needs `feltkit.authority.agents`, never by an agent) are registered again too. A grant may name an agent (`grants.grant({ agent })`) and then allows only that agent. **An agent caller decides as itself, always**, with its own credential: a grant to another agent or to the executor never allows it, and naming another agent is a deny. Anyone else decides as the executor unless it names a registered agent. An unregistered agent is a deny. Revoking a grant stops that grant only; revoking an agent stops all of its grants. With a hosted AuthBoundry (no `authority.local`, or an authority url that resolves), agent callers decide as the executor, with its grants (no per-agent credentials; `authorityMode: "hosted-executor-grants"`); `agentCallers` does not govern hosted authority. With an `@authboundry/local` without per-agent delegation (0.1.0), an agent caller is `unavailable` (`lasting`), unless the owner set `authority.local.agentCallers: "executor-grants"`: then an agent caller naming no agent decides as the executor with its grants (wider authority, as through 0.3.30; `authorityMode: "local-executor-grants-opt-in"`), with a readiness warning; naming an agent is `unavailable` either way. "Per-agent delegation installed" means the started authority offers `registerAgent`, `revokeAgent`, `agentCredentialOf` and `agents` (`runtime/authority-contract.ts`, also used by the release gate) | `test/local-authority.test.ts` (real local AuthBoundry), `test/authority-compat.test.ts` (never skipped) |
|
|
692
|
+
| Authority evaluation evidence (`authorityMode`) | Every authority decision says how it was evaluated: `local-executor`, `local-per-agent`, `local-executor-grants-opt-in`, `hosted-executor` or `hosted-executor-grants` (null when FeltKit evaluated nothing: no address, a local authority not running, an invalid request, an unreadable credential; when AuthBoundry is unreachable the mode says how the decision was being evaluated). It is in the returned decision and in each record FeltKit keeps of it, with that record's own durability: policy decision records (`delegations[].authorityMode`, with the refusal's `reason`; durable for every refusal and for allows of policies with `evidence: "durable"`), integration call records (`authority.authorityMode`; durable for every call that was sent; a refused call is not an integration call record, its decision is in the activity log and, during an invocation attempt, in its decision notes), the invocation attempt's decision notes (decisions made while an attempt runs), and the activity log (`authority.decide`, every decision including refusals FeltKit makes itself; best effort and bounded: a failed write only warns, `mode: "errors"` keeps no allows, the newest entries are kept). It is evidence only: nothing reads it to authorize | `test/authority-compat.test.ts`, `test/executor-proof.test.ts`, `test/connections.test.ts` |
|
|
693
|
+
| Readiness `authority.agent-callers` | Reports the mode in effect, never assumed from configuration: hosted (pass, the hosted contract), not yet started (warn: not known), failed start or no authority address (fail), per-agent installed (pass), refused (warn), shared executor grants (warn) | `test/authority-compat.test.ts` |
|
|
692
694
|
| `ctx.integrations.invoke(capability, input)` | A declared integration operation from application code, as the caller, under the operation's own `access`; the input is validated against the operation's declared schema before anything is sent (`INVALID_ARGUMENT`), as AppPort validates a capability call; its credential resolved for the request only; the call recorded before and after; never in results, records or errors; rotation applies to the next call; a removed credential fails the call | `test/application-platform.test.ts` |
|
|
693
695
|
| The agent's catalog (`ctx.agent.catalog()` in actions, `runtime.agent.tools(principal)`; `ctx.agent.tools()` is its allowed subset, shaped as model tools) | Every capability the application and its services offer, not a model's tool list: for each, whether this principal may use it (`allowed`, the policy's decision) and how (`invoke`); for an integration operation, its `integration`, its input schema, and `readiness` (not ready while the base URL or the credential's value is missing, with what to fix; never a value). Permission and readiness are separate answers | `test/application-platform.test.ts` |
|
|
694
696
|
| Integration exposure (`expose: false`, per operation or integration) | The operation is not an AppPort capability: no session can call it on `/appport`, whatever it holds; application code still can, under `access`. A `verify` probe must stay exposed (verification runs it through AppPort), checked when the app is defined | `test/application-platform.test.ts` |
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# A private AuthBoundry for your application
|
|
2
|
+
|
|
3
|
+
`authority: { local: true }` gives your application an AuthBoundry that needs no setup. FeltKit starts it,
|
|
4
|
+
sets it up and supervises it, so the people who use the application never see AuthBoundry.
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
feltkit({
|
|
8
|
+
authority: {
|
|
9
|
+
local: true,
|
|
10
|
+
url: { env: "AUTHBOUNDRY_URL" }, // optional: a hosted AuthBoundry, when set, is used instead
|
|
11
|
+
application: "myapp",
|
|
12
|
+
checkCredential: "credential-ref:authboundry-check",
|
|
13
|
+
executor: { principal: "agent:myapp" },
|
|
14
|
+
capabilities: ["tasks.create", "notes.write"],
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @authboundry/local
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## What FeltKit does
|
|
24
|
+
|
|
25
|
+
- **Starts it.** If no `url` resolves, FeltKit starts `@authboundry/local` (the AuthBoundry server, Linux and
|
|
26
|
+
macOS) on loopback. Its state lives in `authority.local.dataDir`, else `FELTKIT_AUTHORITY_DIR`, else
|
|
27
|
+
beside `FELTKIT_STATE_DIR` (`<state>.authority`), else `.feltkit/<env>/authority`.
|
|
28
|
+
- **Keeps its secrets in FeltKit's custody (the vault).** The administrator's secret
|
|
29
|
+
(`credential-ref:authboundry-local-admin`) is generated once. The check credential is issued once and
|
|
30
|
+
kept, then reissued only if it stops working.
|
|
31
|
+
- **Sets it up on every start.** This covers the application, its capability contract (a new version only
|
|
32
|
+
when `capabilities` change), the executor agent, and each person's policy. Running it again changes
|
|
33
|
+
nothing.
|
|
34
|
+
- **Decides through it.** `ctx.authority.decide` works exactly as with a hosted AuthBoundry: the same
|
|
35
|
+
contract, and the same fail-closed rules. If the local authority isn't running, every decision is
|
|
36
|
+
refused and readiness says why.
|
|
37
|
+
- **Restarts it if it exits, and stops it with the application.**
|
|
38
|
+
- **In the test environment it starts on first use** (a decision or a grant), not with every test
|
|
39
|
+
application. Starting takes most of a second, and most tests never ask.
|
|
40
|
+
|
|
41
|
+
## Grants: what a person lets your application do for them
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
await ctx.authority.grants.grant({ capabilities: ["tasks.create"], expiresAt });
|
|
45
|
+
await ctx.authority.grants.list();
|
|
46
|
+
await ctx.authority.grants.revoke(id);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- **Only the signed-in person's own grants.** The delegator is always the caller; it's never an argument.
|
|
50
|
+
Another person's grant doesn't exist for them, and a service or agent can't grant.
|
|
51
|
+
- **Decisions on someone's behalf** (`decide({ capability, onBehalfOf: "<id>" })`) are allowed only by
|
|
52
|
+
that person's grants. `onBehalfOf` is the person's application id (`"ada"`), mapped through
|
|
53
|
+
`authority.principal` exactly as grants map the delegator, or the AuthBoundry principal (`"user:ada"`),
|
|
54
|
+
sent unchanged: a value with a `:` is taken as already mapped. `{ person: id }` and `{ principal }`
|
|
55
|
+
say which explicitly (an application id containing `:`, or a custom `authority.principal` whose
|
|
56
|
+
principals have none).
|
|
57
|
+
- **Recorded.** Grants and revocations are activity in FeltKit and evidence in AuthBoundry.
|
|
58
|
+
|
|
59
|
+
## Several agents: a grant for one agent
|
|
60
|
+
|
|
61
|
+
Needs `@authboundry/local` 0.1.1 or later (per-agent delegation). Without it (0.1.0), grants and decisions that
|
|
62
|
+
name an agent are refused, naming that release, and agent callers are denied.
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
await ctx.authority.grants.grant({ capabilities: ["posts.read"], agent: "scout" }); // Scout only
|
|
66
|
+
await ctx.authority.grants.list(); // each grant: { id, agent: "agent:scout" | null, ... }
|
|
67
|
+
await ctx.authority.decide({ capability: "posts.read", onBehalfOf: "ada" }); // in Scout's handler: as Scout
|
|
68
|
+
await ctx.authority.decide({ capability: "posts.read", onBehalfOf: "ada", agent: "scout" }); // from a person's function
|
|
69
|
+
await ctx.authority.agents.register({ id: "mcp-bot" }); // an agent that arrives at run time (operator only)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- **Every `app.agent` is an agent of the application at the authority**, `agent:<principal id>` (or the id
|
|
73
|
+
itself if it has a `:`), registered at every start with its own agent credential. FeltKit keeps each
|
|
74
|
+
credential in custody (`credential-ref:authboundry-local-agent:<agent>`), never in a record, and gives it
|
|
75
|
+
back at the next start; the authority renews it while it runs.
|
|
76
|
+
- **A grant names the agent it is for**, or none (the executor, as before). It allows only that agent: a
|
|
77
|
+
grant to Scout never allows Concierge or the executor, and the executor's grants never allow an agent.
|
|
78
|
+
Revoking a grant stops that grant; `agents.revoke(id)` stops the agent for good.
|
|
79
|
+
- **An agent decides as itself, always.** When the caller is an agent (an `app.agent` run, or an agent
|
|
80
|
+
session such as an MCP client authenticated as an agent), `decide` uses that agent's own credential;
|
|
81
|
+
`agent` may only name itself, and naming another agent (or wanting the executor) is a deny.
|
|
82
|
+
- Why not the executor by default: the person granted *that agent*. If an agent's handler used the
|
|
83
|
+
executor, every agent of the application would share every executor grant, which is what per-agent
|
|
84
|
+
grants exist to prevent. The executor remains the default for everyone who is not an agent: a
|
|
85
|
+
person's or a service's function, a job.
|
|
86
|
+
- A person's function may name an agent (`agent: "scout"`), to ask "may Scout do this for me?".
|
|
87
|
+
- An agent that is not registered is a deny (`not an agent registered with this application's
|
|
88
|
+
authority`), never an error.
|
|
89
|
+
- **Without per-agent delegation installed** (`@authboundry/local` 0.1.0; 0.1.1 and later have it) no agent can be
|
|
90
|
+
registered and no grant can name an agent. By default an agent caller is then refused (`unavailable`): it may
|
|
91
|
+
decide only as itself, and here it cannot. That is deliberate: falling back to the executor would let every agent
|
|
92
|
+
use every grant people gave the executor.
|
|
93
|
+
- **Opt-in, an owner's decision:** `authority: { local: { agentCallers: "executor-grants" } }` lets an agent caller
|
|
94
|
+
that names no agent be decided as the executor, with the executor's grants, as through FeltKit 0.3.30. This
|
|
95
|
+
widens authority and is not equivalent to per-agent delegation. Each such decision records
|
|
96
|
+
`authorityMode: "local-executor-grants-opt-in"` (in the decision and the records kept of it; SECURITY.md, "Evidence"),
|
|
97
|
+
and readiness warns (`authority.agent-callers`). A decision that names an agent is still `unavailable`.
|
|
98
|
+
- **Hosted AuthBoundry is different:** with an authority url that resolves, agent callers are decided as the
|
|
99
|
+
executor (`hosted-executor-grants`), the documented hosted contract; `agentCallers` does not govern it.
|
|
100
|
+
- **Moving to per-agent delegation:** install an `@authboundry/local` with `registerAgent`, register agents (an
|
|
101
|
+
operator's act; `app.agent`s register at each start), have people grant each agent, then remove `agentCallers`
|
|
102
|
+
(it has no effect once per-agent delegation is installed; readiness says so).
|
|
103
|
+
- **Agents that arrive at run time** (`ctx.authority.agents.register({ id, name? })`, `list()`,
|
|
104
|
+
`revoke(id)`): only a caller holding `feltkit.authority.agents`, and never an agent, itself included
|
|
105
|
+
(registration is an operator's act, as AuthBoundry's own rule says; an agent able to register itself or
|
|
106
|
+
others could make principals no operator decided on). Registering grants nothing: a person still
|
|
107
|
+
grants the agent. The authority keeps registered agents across restarts and FeltKit registers each
|
|
108
|
+
active one again at every start, with its kept credential.
|
|
109
|
+
- **With a hosted AuthBoundry** FeltKit holds no agent credentials: agent callers decide as the executor,
|
|
110
|
+
as before, and naming an agent is refused (`unavailable`).
|
|
111
|
+
|
|
112
|
+
## Limits
|
|
113
|
+
|
|
114
|
+
- **One machine.** The local authority's state is on that machine. For several machines, use a hosted
|
|
115
|
+
AuthBoundry (`AUTHBOUNDRY_URL`).
|
|
116
|
+
- **Server version.** It needs a server that keeps granted policy across restarts: after
|
|
117
|
+
`@authboundry/core` 1.17.3.
|
|
118
|
+
- **No move to a hosted AuthBoundry yet.** Nothing exports grants from the local authority to a hosted one.
|
package/docs/POLICIES.md
CHANGED
|
@@ -48,7 +48,7 @@ Conditions:
|
|
|
48
48
|
| `{ arg: "<a>", …same operators }` | the validated argument compares as given |
|
|
49
49
|
| `{ role: r \| [r…] }` | the caller holds the application role |
|
|
50
50
|
| `{ tenantRole: r \| [r…] }` | the caller's role in their current workspace is one of these |
|
|
51
|
-
| `{ delegated: { capability, onBehalfOf: { field, via? } \| { arg } } }` | the caller is an agent or service, and AuthBoundry allows
|
|
51
|
+
| `{ delegated: { capability, onBehalfOf: { field, via? } \| { arg } } }` | the caller is an agent or service, and AuthBoundry allows it to exercise `capability` for that person (a delegation that exists, is in force, and covers it). A service is decided as the application's executor. An agent caller is decided as itself with a local authority (`authority.local`): only a grant to that agent counts; without per-agent delegation installed it is refused, unless the owner set `authority.local.agentCallers: "executor-grants"` (then the executor's grants). With a hosted AuthBoundry an agent caller is decided as the executor, with its grants. The durable decision record keeps how each was evaluated (`delegations[].authorityMode`; SECURITY.md) |
|
|
52
52
|
| `{ any: [...] }`, `{ not: c }` | composition |
|
|
53
53
|
|
|
54
54
|
`principals` limits which callers a rule applies to: `types`, `roles`, and `anonymous: true`.
|
package/docs/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# FeltKit 0.3.
|
|
1
|
+
# FeltKit 0.3.32 documentation
|
|
2
2
|
|
|
3
3
|
Shipped with `@feltdb/feltkit`. In a project: `node_modules/@feltdb/feltkit/docs/`, or run `npx feltkit docs`.
|
|
4
|
-
Public copy: https://cdn.jsdelivr.net/npm/@feltdb/feltkit@0.3.
|
|
4
|
+
Public copy: https://cdn.jsdelivr.net/npm/@feltdb/feltkit@0.3.32/docs/README.md
|
|
5
5
|
|
|
6
6
|
- [ARCHITECTURE.md](ARCHITECTURE.md): How FeltKit is put together: one FeltDB instance, AppPort, AppPort Services
|
|
7
7
|
- [GUARANTEES.md](GUARANTEES.md): What FeltKit guarantees, and its known limitations
|
|
@@ -9,9 +9,11 @@ Public copy: https://cdn.jsdelivr.net/npm/@feltdb/feltkit@0.3.31/docs/README.md
|
|
|
9
9
|
- [SECURITY.md](SECURITY.md): Authorization, sessions, credentials, and production Studio
|
|
10
10
|
- [AUTH.md](AUTH.md): Accounts, sessions, workspaces (tenancy), invitations, and the React sign-in and workspace screens
|
|
11
11
|
- [POLICIES.md](POLICIES.md): Declarative policies (owner, sharing, state, input, roles, delegation), managed versions without a redeploy, simulation, decision evidence
|
|
12
|
+
- [SIGN-IN-BROKER.md](SIGN-IN-BROKER.md): Sign in with GitHub and Google with nothing to register: the FeltKit broker, the assertion it signs, the extension flow, running and rotating it
|
|
12
13
|
- [EXTENSION-HOSTS.md](EXTENSION-HOSTS.md): Running the app in a browser extension: ownership, token storage, session end, lifecycle, gaps
|
|
13
14
|
- [INVOCATIONS.md](INVOCATIONS.md): Surfaces and invocations: registering entry points, the feltkit.invocation/1 contract, the durable lifecycle, dispatch and recovery
|
|
14
15
|
- [EXECUTION.md](EXECUTION.md): Placement-neutral execution: the control plane and execution environments, the execution contract, adapters, placement, authority and evidence
|
|
16
|
+
- [LOCAL-AUTHORITY.md](LOCAL-AUTHORITY.md): The private AuthBoundry beside the application (authority.local): grants, agents, per-agent delegation and the agentCallers opt-in
|
|
15
17
|
- [CONNECTIONS.md](CONNECTIONS.md): People's own connections to integrations (credential.owner: person): connecting, isolation, AuthBoundry at every call (reference implementation)
|
|
16
18
|
- [AGENT-OPERATIONS.md](AGENT-OPERATIONS.md): Agents: MCP, tasks, proposals, approvals, and evidence
|
|
17
19
|
- [GENERATION.md](GENERATION.md): Model generation in an application: actions, streaming, tools as proposals, in-app approvals, caller context
|
package/docs/SECURITY.md
CHANGED
|
@@ -168,6 +168,45 @@ Every entry point was exercised by `packages/sdk/test/auth.test.ts`.
|
|
|
168
168
|
`integrations.test.ts` (discovery without authority, no credential in records),
|
|
169
169
|
`platform.test.ts` (production routes).
|
|
170
170
|
|
|
171
|
+
## Agent callers and per-agent delegation (FK-16, 0.3.32)
|
|
172
|
+
|
|
173
|
+
How an agent caller (an `app.agent` run, an agent session such as an MCP client) is decided depends on which
|
|
174
|
+
authority the application uses. Every decision records which applied (`authorityMode`); readiness
|
|
175
|
+
(`authority.agent-callers`) reports the mode in effect.
|
|
176
|
+
|
|
177
|
+
**Local authority (`authority.local`).** An agent caller asks AuthBoundry **as itself**: only what a person granted
|
|
178
|
+
*that agent* allows it (`local-per-agent`). That needs an `@authboundry/local` with per-agent delegation
|
|
179
|
+
(`registerAgent`, `revokeAgent`, `agentCredentialOf`, `agents` on the started authority). `@authboundry/local` 0.1.1 and later have
|
|
180
|
+
them; 0.1.0 has none.
|
|
181
|
+
|
|
182
|
+
- **Default: fail closed.** Without per-agent delegation installed, every decision by an agent caller is
|
|
183
|
+
`unavailable` (marked `lasting`: retrying does not change it). People's and services' decisions are unaffected
|
|
184
|
+
(`local-executor`). FeltKit does not fall back to the executor on its own: that would let every agent of the
|
|
185
|
+
application use every grant people gave the executor.
|
|
186
|
+
- **Opt-in: `authority: { local: { agentCallers: "executor-grants" } }`.** The application owner may choose the
|
|
187
|
+
model FeltKit had through 0.3.30: an agent caller that names no agent is decided as the executor, with the
|
|
188
|
+
executor's grants (`local-executor-grants-opt-in`). **This widens authority** and is not equivalent to
|
|
189
|
+
per-agent delegation: one person's grant to the application is usable by every agent. Readiness warns, so
|
|
190
|
+
operators see it without reading logs. An invalid `agentCallers` fails when the app is defined.
|
|
191
|
+
- **Never widened by the opt-in:** a decision that names an agent stays `unavailable`; an agent can never decide
|
|
192
|
+
as another agent; grants naming an agent and `ctx.authority.agents` stay refused without per-agent delegation.
|
|
193
|
+
- **Once per-agent delegation is installed** the setting has no effect (readiness says so): agents decide as
|
|
194
|
+
themselves. To move: install it, register agents (an operator's act; `app.agent`s register at start), have
|
|
195
|
+
people grant each agent (`grants.grant({ agent })`), then remove `agentCallers`.
|
|
196
|
+
|
|
197
|
+
**Hosted AuthBoundry** (no `authority.local`, or an authority url that resolves in this environment). An agent
|
|
198
|
+
caller is decided as the application's executor, with the executor's grants (`hosted-executor-grants`), as
|
|
199
|
+
documented since before 0.3.31: a hosted AuthBoundry holds no per-agent credentials for FeltKit. This is wider
|
|
200
|
+
than per-agent delegation, and `authority.local.agentCallers` does **not** govern it. Naming an agent there is
|
|
201
|
+
`unavailable`. A later minor release is expected to give hosted and local authority one explicit opt-in policy,
|
|
202
|
+
with a migration path; 0.3.32 does not change the hosted contract.
|
|
203
|
+
|
|
204
|
+
**Evidence.** `authorityMode` is in the returned decision and in each record FeltKit keeps of it, each with its own
|
|
205
|
+
durability: policy decision records (`delegations[].authorityMode`; durable for refusals, and for allows with
|
|
206
|
+
`evidence: "durable"`), integration call records (`authority.authorityMode`; every call sent), invocation attempt
|
|
207
|
+
decision notes (while an attempt runs), and the activity log (`authority.decide`, refusals included; best effort and
|
|
208
|
+
bounded). It is null when nothing was evaluated. It is evidence only, never an input to authorization.
|
|
209
|
+
|
|
171
210
|
## File links
|
|
172
211
|
|
|
173
212
|
- A file link is a capability: holding it downloads that file until it expires (≤ 1 hour). The function
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Sign in with GitHub and Google, with nothing to register
|
|
2
|
+
|
|
3
|
+
A FeltKit app can sign people in with GitHub or Google by naming the provider and nothing else:
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
feltkit({
|
|
7
|
+
auth: {
|
|
8
|
+
accounts: { roles: ["member"] },
|
|
9
|
+
providers: { github: { broker: true }, google: { broker: true } },
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
There is no OAuth client to register, no client secret to keep, and no redirect URI to configure at the provider. The same works in the app's [browser extension](EXTENSION-HOSTS.md). An app that wants its own client, its own consent screen, or any other OpenID Connect issuer keeps using `{ clientId, clientSecret }` and `oidc`: nothing about that changes.
|
|
15
|
+
|
|
16
|
+
## What happens
|
|
17
|
+
|
|
18
|
+
FeltKit runs one **broker**: one GitHub app and one Google client with fixed callback URLs on the broker's own address. It does one job and keeps nothing.
|
|
19
|
+
|
|
20
|
+
1. The person clicks "Sign in with GitHub". The app's own server sends the browser to the broker, naming itself (its sign-in callback), a one-time `state`, and a one-time `nonce`.
|
|
21
|
+
2. The broker shows a page that says **which site is asking** and what it receives (the person's name and verified e-mail address), and asks the person to continue. Then it sends them to the provider with *its own* client.
|
|
22
|
+
3. The provider signs the person in and returns to the broker. The broker reads who they are, **only if the provider calls the e-mail address verified**, and signs a short statement of it.
|
|
23
|
+
4. The browser returns to the app's callback with that statement. The app checks the signature against the keys the broker publishes, makes (or finds) the account for that verified address, and issues **its own session**.
|
|
24
|
+
|
|
25
|
+
The statement (an *assertion*, a compact EdDSA-signed token) says: who vouches (`iss`), the one origin it is for (`aud`), the provider and the provider's own id for the person (`provider`, `sub`), the verified e-mail (`email`), the app's one-time value for this attempt (`nonce`), and that it expires within a minute. An app refuses an assertion that is for another site, another provider, another attempt, from another issuer, signed by a key the broker does not publish, expired, or missing. An assertion cannot be carried to another sign-in or another app.
|
|
26
|
+
|
|
27
|
+
### What the broker is trusted with, and what it is not
|
|
28
|
+
|
|
29
|
+
| | |
|
|
30
|
+
|---|---|
|
|
31
|
+
| Sees | That a person signed in to a given site, and their provider id, name and verified e-mail, for the length of one redirect. |
|
|
32
|
+
| Keeps | Nothing. Its only state is a signed, short-lived cookie in the browser that is signing in. |
|
|
33
|
+
| Issues | Assertions. Never a session: every session is the app's own. |
|
|
34
|
+
| Holds | The GitHub and Google client secrets, and its signing key. **No app ever holds a provider secret.** |
|
|
35
|
+
| Cannot | Sign anyone in to an app on its own: the app's own checks (state cookie, nonce, audience) must pass. |
|
|
36
|
+
|
|
37
|
+
The broker only sends an assertion to an instance's own sign-in callback (`https://<host>/api/auth/providers/<provider>/callback`): https (http only for this machine in development), no other path, no query, no credentials in the address, no IP address. If the app is not who the person thought, the consent page names the host before the provider is ever shown.
|
|
38
|
+
|
|
39
|
+
## In the app's browser extension
|
|
40
|
+
|
|
41
|
+
`feltkit target:browser-extension` gives the extension a **stable ID**: its public key is in the manifest, so Chrome derives the same ID on every machine and every build. That ID makes `https://<id>.chromiumapp.org/` a fixed OAuth return address (`chrome.identity.getRedirectURL()`), and the app trusts exactly that origin.
|
|
42
|
+
|
|
43
|
+
In an extension page, `client.signInWith("github")` opens Chrome's sign-in window (`chrome.identity.launchWebAuthFlow`) at the app, which sends it through the broker as above. At the end the app returns the session to `https://<id>.chromiumapp.org/…`, where Chrome hands it to that extension and no one else, and `signInWith` resolves `{ kind: "signed-in" }` (or `{ kind: "error", message }`). In a web page `signInWith` is unchanged: it leaves the page and the session comes back in the URL fragment.
|
|
44
|
+
|
|
45
|
+
**Which extensions an app trusts.** An app trusts the identity its project keeps in `extension/identity.json` (made on the first build, committed, and carried into the deployed artifact), and any ID listed in `auth.extensions`. A sign-in that asks to return to any other extension ID, or to anything that only looks like a trusted address, returns to the app's own page instead: the session is never sent to an address the app has not named. If you publish to the Chrome Web Store, the store assigns the published ID: build once with `--public-key` (Package → View public key in the dashboard) so the unpacked and published extensions share one ID, or list the published ID in `auth.extensions`.
|
|
46
|
+
|
|
47
|
+
## Running the broker
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
npx feltkit broker keygen --out ./broker-keys # Ed25519 signing key (PEM, 0600), its id, and a secret
|
|
51
|
+
npx feltkit broker serve # configured by the environment, below
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
| Variable | |
|
|
55
|
+
|---|---|
|
|
56
|
+
| `FELTKIT_BROKER_URL` | The public address with its path. Default `https://getfeltkit.com/broker`. |
|
|
57
|
+
| `FELTKIT_BROKER_SIGNING_KEY`, `FELTKIT_BROKER_KID` | The private key (PEM text, or the path of the file) and its id, from `keygen`. |
|
|
58
|
+
| `FELTKIT_BROKER_SECRET` | 32 or more random bytes, as text: signs the broker's cookies and request tokens. |
|
|
59
|
+
| `FELTKIT_BROKER_GITHUB_CLIENT_ID` / `_SECRET` | The GitHub OAuth app registered for this broker. |
|
|
60
|
+
| `FELTKIT_BROKER_GOOGLE_CLIENT_ID` / `_SECRET` | The Google OAuth client registered for this broker. |
|
|
61
|
+
| `FELTKIT_BROKER_RETIRED_KEYS` | A JSON array of earlier public keys, still published while apps' caches turn over. |
|
|
62
|
+
|
|
63
|
+
`serve` prints the callback URL to register at each provider: `<FELTKIT_BROKER_URL>/v1/callback/github` and `…/google`. It listens on `--port` (or `PORT`, default 8787) and answers only under its address's path, so route `https://getfeltkit.com/broker/*` to it with the path kept. Register the apps with the provider's callback exactly as printed; the broker needs at least one provider.
|
|
64
|
+
|
|
65
|
+
The broker publishes its public keys at `<issuer>/.well-known/feltkit-broker-keys.json` (cached five minutes by an app; looked up once more when an assertion names a key the cache does not have). **To rotate**: `keygen` a new key, move the old public key into `FELTKIT_BROKER_RETIRED_KEYS`, set the new `SIGNING_KEY` and `KID`, restart; later drop the retired key. A broker that is down stops brokered sign-in only: apps keep their cached keys, and every other way of signing in keeps working.
|
|
66
|
+
|
|
67
|
+
### Pointing an app at another broker
|
|
68
|
+
|
|
69
|
+
`providers: { github: { broker: { issuer: "https://auth.example.com/broker" } } }`, or `FELTKIT_BROKER_URL` in the app's environment. An app may pin the broker's public keys with `broker: { issuer, keys: [...] }` instead of fetching them. The issuer must be https (an `http://localhost` issuer only outside production).
|
|
70
|
+
|
|
71
|
+
## Guarantees and limits
|
|
72
|
+
|
|
73
|
+
- Only an e-mail address the provider calls verified becomes an account (GitHub's primary verified address; Google's `email_verified`). An account made through the broker and one made with an app's own client for the same provider are the same account: the provider's own id is the subject either way.
|
|
74
|
+
- The broker is rate-limited per address (60 requests a minute by default), and its pages cannot be framed.
|
|
75
|
+
- Sessions, roles and everything after sign-in are the app's: the broker has no say in them and no way to revoke them.
|
|
76
|
+
- The consent page is the person's one chance to see which site receives their identity; the broker cannot know whether the site is trustworthy, only that it is a FeltKit-shaped callback on https.
|
|
77
|
+
- E-mail links (magic link, verification, password reset, invitations) are separate from provider sign-in and are not handled by the broker; see [Browser extensions as a FeltKit host](EXTENSION-HOSTS.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feltdb/feltkit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.32",
|
|
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",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"@appport/schema": "1.1.6",
|
|
62
62
|
"@appport/sdk": "1.9.0",
|
|
63
63
|
"@appport/server": "1.3.3",
|
|
64
|
-
"@appport/services": ">=0.
|
|
65
|
-
"@feltdb/core": ">=0.
|
|
66
|
-
"create-feltkit": "0.3.
|
|
64
|
+
"@appport/services": ">=0.20.0 <1.0.0",
|
|
65
|
+
"@feltdb/core": ">=0.22.0 <1.0.0",
|
|
66
|
+
"create-feltkit": "0.3.32",
|
|
67
67
|
"esbuild": "0.28.2",
|
|
68
68
|
"express": "4.22.3",
|
|
69
69
|
"jpeg-js": "0.4.4",
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@appport/testing": "1.2.6",
|
|
92
|
-
"@authboundry/local": "0.1.
|
|
92
|
+
"@authboundry/local": "0.1.1",
|
|
93
93
|
"@mailerport/service": "0.1.0",
|
|
94
|
-
"@feltdb/webllm": ">=0.
|
|
94
|
+
"@feltdb/webllm": ">=0.22.0 <1.0.0",
|
|
95
95
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
96
96
|
"@stack-ui/core": "0.9.0",
|
|
97
97
|
"@stack-ui/react": "0.9.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.3.
|
|
4
|
+
"version": "0.3.32",
|
|
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.3.x, development server. FeltDB 0.
|
|
96
|
+
`@feltdb/feltkit` 0.3.x, development server. FeltDB 0.22.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.
|
|
@@ -198,6 +198,16 @@ these from the start, and test it with `createArtifactTestApp("<name>.app")` fro
|
|
|
198
198
|
`as(who).query/mutation` calls). Serve it with `npx @appport/appboundry run <name>.app` (an app with built-in accounts
|
|
199
199
|
also needs `--accounts operator-sessions`: people then get sessions from the operator).
|
|
200
200
|
|
|
201
|
+
## Browser extension
|
|
202
|
+
|
|
203
|
+
`npx feltkit target:browser-extension` builds the frontend into a Manifest V3 Chrome extension (`dist/extension`, to
|
|
204
|
+
Load unpacked, plus a Web Store ZIP). The same `createClient()` calls run in it against the user's instance with a
|
|
205
|
+
bearer session; nothing of the backend is in it. `--instance <url>` bakes one instance in; `--surface sidepanel|popup|tab`;
|
|
206
|
+
`--check [<dir>]` validates an extension. The extension has a stable ID (its key is in `extension/identity.json`: commit it); `client.signInWith("github")` works in it, with `auth.providers: { github: { broker: true } }` needing no OAuth app of the app's own (`npx feltkit docs sign-in-broker`). It fails when the result is not compliant. If the user wants it, write the
|
|
207
|
+
frontend for it from the start: talk to the instance only through FeltKit's client (no raw same-origin `fetch`), and use
|
|
208
|
+
a hash or memory router when `location.protocol === "chrome-extension:"` (a `BrowserRouter` finds no route there). Read
|
|
209
|
+
`npx feltkit docs extension-hosts` before changing how the app signs in inside it.
|
|
210
|
+
|
|
201
211
|
## When to stop and ask
|
|
202
212
|
|
|
203
213
|
- Changing roles or `access` (it changes who can do what everywhere, including agents and API keys).
|
|
@@ -45,6 +45,18 @@ const page = await ctx.db.query(contacts, { where: [{ field: "stage", eq: "lead"
|
|
|
45
45
|
await ctx.db.search(messages, { text: "deploy café", where: { channelId }, limit: 20 }); // needs { search: ["text"] } on the collection
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
**Set membership.** `in` matches a field equal to any of up to 256 values (strings, finite numbers, booleans, null; an
|
|
49
|
+
empty list matches nothing). Declare an ordered index and a feed (`in` plus `orderBy` newest first) reads about one page
|
|
50
|
+
of records, not the collection:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
// in the collection's declaration: indexes: [{ fields: ["authorId", "createdAt"], directions: ["asc", "desc"] }]
|
|
54
|
+
const feed = await ctx.db.query(posts, { where: [{ field: "authorId", in: followingIds }], orderBy: [{ field: "createdAt", direction: "desc" }], limit: 20, cursor });
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
In a mutation the read is fenced per value: a write to a record in the set conflicts, one outside it does not. A live
|
|
58
|
+
query on an `in` re-runs only when a record in the set changes.
|
|
59
|
+
|
|
48
60
|
`search` returns records whose declared `search` fields contain every word (case- and accent-insensitive),
|
|
49
61
|
newest first, at most `limit` (≤ 100). It scans the records matching `where`, so always narrow it with an
|
|
50
62
|
equality `where` on large collections. For live queries, filter by `id`, indexed, unique, reference or
|
|
@@ -99,4 +111,4 @@ Deleting records, bulk changes, schema changes that drop fields, or anything in
|
|
|
99
111
|
|
|
100
112
|
## Compatibility
|
|
101
113
|
|
|
102
|
-
`@feltdb/feltkit` 0.3.x on `@feltdb/core` 0.
|
|
114
|
+
`@feltdb/feltkit` 0.3.x on `@feltdb/core` 0.22.0. Details: `npx feltkit docs guarantees` (node_modules/@feltdb/feltkit/docs/GUARANTEES.md). Verified in Claude Code only.
|
|
@@ -68,6 +68,19 @@ ctx.afterCommit.jobs.enqueue("invoice.send", { orderId });
|
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
Each is recorded in the mutation's transaction (`_feltkit_outbox`) and performed after the commit, as the caller.
|
|
71
|
+
|
|
72
|
+
**Reading the caller's inbox** pages through the recipient's own notifications, newest first, bounded and index-backed
|
|
73
|
+
(a page reads about `limit` records, never the tenant's history):
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
const inbox = await ctx.services.notifications.page({ unread: true, limit: 20, cursor }); // { items, nextCursor? }
|
|
77
|
+
const { count, complete } = await ctx.services.notifications.unreadCount({ max: 100 }); // complete: false means "at least"
|
|
78
|
+
await ctx.services.notifications.markAllRead(); // mutations: { marked, complete }; at most 1,000 per call
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`limit` is 1 to 100 (default 50). A cursor is opaque and bound to the recipient, filters and limit: another's is
|
|
82
|
+
refused. With `unread`, a page can be short or empty and still carry `nextCursor`; only a page without one is the end.
|
|
83
|
+
`markAllRead` is not atomic across notifications: `complete: false` means call again.
|
|
71
84
|
If the process stops in between, the services worker performs it later. A job or webhook delivery is created in
|
|
72
85
|
the transaction that marks the effect done, so it exists once per committed effect; notifications are deduplicated
|
|
73
86
|
by their idempotency key. Running the job and delivering the webhook are retried by the services (at least once). A failed effect stays `failed` with
|
|
@@ -143,6 +156,6 @@ affect other systems. Confirm with the user before doing any of them.
|
|
|
143
156
|
|
|
144
157
|
## Compatibility
|
|
145
158
|
|
|
146
|
-
`@feltdb/feltkit` 0.3.x with `@appport/services` 0.
|
|
159
|
+
`@feltdb/feltkit` 0.3.x with `@appport/services` 0.20.0 (shared instance; transactional job and webhook creation; `credential.store` / `credential.status`; `servicesContract` for Managed FeltDB; the inbound event lifecycle and inbound integration management).
|
|
147
160
|
The console is development-only.
|
|
148
161
|
Verified in Claude Code only.
|