@feltdb/feltkit 0.3.13 → 0.3.15

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 (44) hide show
  1. package/dist/app.d.ts +9 -1
  2. package/dist/app.js.map +1 -1
  3. package/dist/appboundry/runtime.d.ts +5 -0
  4. package/dist/appboundry/runtime.js +5 -0
  5. package/dist/appboundry/runtime.js.map +1 -1
  6. package/dist/cli/deploy-appboundry-self-hosted.d.ts +16 -0
  7. package/dist/cli/deploy-appboundry-self-hosted.js +200 -0
  8. package/dist/cli/deploy-appboundry-self-hosted.js.map +1 -0
  9. package/dist/cli/deploy-appboundry.d.ts +106 -0
  10. package/dist/cli/deploy-appboundry.js +226 -0
  11. package/dist/cli/deploy-appboundry.js.map +1 -0
  12. package/dist/cli/deploy.js +9 -3
  13. package/dist/cli/deploy.js.map +1 -1
  14. package/dist/cli/main.js +100 -5
  15. package/dist/cli/main.js.map +1 -1
  16. package/dist/dashboard/assets/{index-BSnW2DC-.js → index-DnIOVGF-.js} +7 -7
  17. package/dist/dashboard/index.html +1 -1
  18. package/dist/docs.d.ts +1 -1
  19. package/dist/docs.js +3 -1
  20. package/dist/docs.js.map +1 -1
  21. package/dist/index.d.ts +1 -0
  22. package/dist/runtime/agent.js +5 -2
  23. package/dist/runtime/agent.js.map +1 -1
  24. package/dist/runtime/contract.d.ts +10 -0
  25. package/dist/runtime/contract.js +37 -15
  26. package/dist/runtime/contract.js.map +1 -1
  27. package/dist/runtime/decisions.d.ts +41 -3
  28. package/dist/runtime/decisions.js +157 -0
  29. package/dist/runtime/decisions.js.map +1 -1
  30. package/dist/runtime/runtime.js +2 -1
  31. package/dist/runtime/runtime.js.map +1 -1
  32. package/dist/runtime/targets.d.ts +6 -1
  33. package/dist/runtime/targets.js +8 -0
  34. package/dist/runtime/targets.js.map +1 -1
  35. package/docs/APPBOUNDRY-DEPLOY-CONTRACT.md +116 -0
  36. package/docs/APPBOUNDRY.md +46 -0
  37. package/docs/ARCHITECTURE.md +1 -1
  38. package/docs/GUARANTEES.md +4 -1
  39. package/docs/README.md +5 -3
  40. package/docs/RESOLVER.md +167 -0
  41. package/package.json +4 -3
  42. package/skills/.claude-plugin/marketplace.json +1 -1
  43. package/skills/.claude-plugin/plugin.json +1 -1
  44. package/skills/feltkit-services/SKILL.md +1 -1
@@ -0,0 +1,167 @@
1
+ # Model references with Resolver
2
+
3
+ Change the model a deployed FeltKit app uses without changing, rebuilding or redeploying the
4
+ app. The app names a stable reference, `ref://prod/chat/model`. [Resolver](https://www.npmjs.com/package/@appport/resolver)
5
+ decides what it points to, now and after every change.
6
+
7
+ ```ts
8
+ // feltkit/app.ts
9
+ export const app = feltkit({
10
+ name: "acme",
11
+ agent: { model: { production: "ref://prod/chat/model", development: "ref://dev/chat/model" } },
12
+ // …
13
+ });
14
+ ```
15
+
16
+ ```bash
17
+ # An operator, in Resolver (the app is not touched):
18
+ resolver set ref://prod/chat/model --value '{"provider":"anthropic","model":"claude-sonnet-5-5","credential":"ref://prod/llm/anthropic-key"}' --reason "cost review"
19
+ ```
20
+
21
+ The agent's next decision runs on the new target, and its record says which revision it used.
22
+
23
+ ## What is in this release
24
+
25
+ The agent's model decisions (`ctx.agent.start`, `playbook: "decide"`) are the one reference type
26
+ supported. Other kinds (endpoints, credentials for integrations, agents, configuration values)
27
+ are listed under [Not yet](#not-yet).
28
+
29
+ ## Who owns what
30
+
31
+ | | Owns | Here |
32
+ |---|---|---|
33
+ | **Resolver** | references, bindings, revisions, history, rollback, grants, secret material (its vault), change notifications | the source of truth for what `ref://…` means; FeltKit never stores a copy of a binding |
34
+ | **FeltKit** | which reference an environment uses (`agent.model`), calling the model, recording what each decision used | `ModelHost` resolves through `@appport/resolver-client`, executes with its OpenAI-chat or Anthropic runtime, records the receipt |
35
+ | **FeltDB** | the app's durable state | the decision record (agent memory) holds the receipt next to the choice |
36
+ | **AppPort** | capabilities and authority | Resolver is an AppPort service; the client calls `resolver.resolve` with this deployment's key, checked by Resolver's own grants |
37
+ | **AppPort Services** | the Intelligence catalog | Resolver checks a model's provider against it when a binding is written; FeltKit picks the protocol and default endpoint from it |
38
+
39
+ There is no second store, permission system or secret vault. Resolver authorizes every
40
+ resolution with its own grants; FeltKit's roles still decide who may start agent work.
41
+
42
+ ## Setting it up
43
+
44
+ 1. **Run Resolver** (`npm install -g @appport/resolver`; `resolver init`, then `resolver serve`).
45
+ See its README for state, vault and multi-instance options.
46
+ 2. **Bind the reference** (as an operator, with an admin key):
47
+ ```bash
48
+ resolver set ref://prod/llm/anthropic-key --kind secret --secret-stdin # the key, on stdin
49
+ resolver set ref://prod/chat/model --kind model --value '{"provider":"anthropic","model":"claude-sonnet-5-5","credential":"ref://prod/llm/anthropic-key"}'
50
+ ```
51
+ The provider must be in the AppPort Services Intelligence catalog (`openai`, `anthropic`,
52
+ `opencode`, `ollama`, `custom`). Resolver refuses a binding that names an unknown provider or
53
+ model, a missing credential, or a credential placed in `options`.
54
+ 3. **Give the deployment its own key**, allowed to read the reference and reveal its credential, and
55
+ nothing else:
56
+ ```bash
57
+ resolver keys create acme-production --grant read:ref://prod/chat/model --grant read,reveal:ref://prod/llm/*
58
+ ```
59
+ 4. **Configure the app**: `agent.model` in `feltkit({ … })`, and in the deployment's environment
60
+ `RESOLVER_URL` (the origin) and `RESOLVER_API_KEY` (the key from step 3). `feltkit deploy` lists
61
+ both in the artifact's `.env.example` and contract when the app names a reference. The values
62
+ are never in the artifact.
63
+
64
+ ## Seeing what is in use
65
+
66
+ - `feltkit model show --env production`: the provider and model the reference resolves to now, the
67
+ reference, its revision and credential reference, and what to fix if it does not resolve.
68
+ - Studio → Models: the same, with the source shown as Resolver.
69
+ - Each agent decision's checkpoint reads `anthropic/claude-sonnet-5-5 (ref://prod/chat/model r7) chose …`,
70
+ in Studio and over MCP (`feltkit_agent_get`). The decision's memory record, cited as evidence,
71
+ holds the full receipt: `ref`, `revision`, `label` (for weighted bindings), `provider`, `model`,
72
+ `endpoint`, `credential` (the reference, never the key), `credentialRevision`, `resolvedAt`.
73
+ - History, diffs and rollback are Resolver's: `resolver history ref://prod/chat/model`.
74
+
75
+ `feltkit model set` and Studio's model picker refuse to change an environment that a reference
76
+ governs (the choice would be stored and never used), and name the `resolver set` command instead.
77
+
78
+ ## When a change takes effect
79
+
80
+ FeltKit connects to Resolver on first use and subscribes to the reference. What the guarantee is:
81
+
82
+ - **Through the change stream.** Resolver notifies connected clients of a change (name and revision
83
+ only). The cached result is dropped, and the next decision resolves again. Measured in the tests:
84
+ within seconds, with a 300 s TTL, across separate processes.
85
+ - **At the latest, the reference's TTL** (`--ttl`, default 30 s). A missed notification (a reconnect,
86
+ another Resolver instance, which polls every second) is bounded by it.
87
+ - **Per decision, one resolution.** A decision's target, credential and receipt come from one answer,
88
+ so a change landing during a call cannot mix two revisions. The call in progress finishes on the
89
+ revision it started with; the receipt says which.
90
+ - **Resolver unreachable:** a result resolved earlier is served for up to 5 minutes, then decisions
91
+ fail. A not-found, revoked or forbidden answer is never covered over: it evicts the cache.
92
+
93
+ A decision that is already running is not interrupted by a change.
94
+
95
+ ## Failure behavior
96
+
97
+ Nothing falls back to another model or to the Intelligence selection. Each failure blocks the
98
+ agent task with what to fix (`problem` in the error's details):
99
+
100
+ | Problem | When |
101
+ |---|---|
102
+ | `not_configured` | `RESOLVER_URL` or `RESOLVER_API_KEY` is not set |
103
+ | `reference_missing` | the reference does not exist or was revoked |
104
+ | `reference_forbidden` | this deployment's key has no `read` grant on it (or `reveal` on its credential) |
105
+ | `reference_invalid` | not a model reference, a provider outside the catalog, or no endpoint |
106
+ | `credential_missing` | the provider needs a key and the binding names no credential |
107
+ | `resolver_unavailable` | Resolver cannot be reached and no cached result is left |
108
+
109
+ ## Secrets
110
+
111
+ The provider key is a `secret` reference held in Resolver's vault. FeltKit's process receives the
112
+ material for one call, in memory (Resolver's client keeps it for at most the reference's TTL), and
113
+ passes it to the provider's API. It is not written to FeltDB, decision records, activity, logs,
114
+ status views, errors, prompts or the deploy artifact. The receipt names the credential's reference
115
+ and revision, never its value. The acceptance test checks every one of those places for the key.
116
+
117
+ An app with `reveal` holds the material in memory while it uses it (Resolver's README, Limits).
118
+ Keep the grant narrow: `reveal` on the provider keys the app uses, not `*`.
119
+
120
+ ## Environments
121
+
122
+ `agent.model` maps environment names to references. An environment it does not name keeps the
123
+ Intelligence selection, so a test environment cannot reach a production reference by accident.
124
+ Use one Resolver key per deployment, granted only its environment's references
125
+ (`ref://prod/*` for production). Resolver tenants and grants keep environments apart. FeltKit
126
+ never rewrites a reference name.
127
+
128
+ ## Proven by
129
+
130
+ - `packages/sdk/test/resolver-model.test.ts`, run against the real Resolver in-process:
131
+ - provider A, then provider B with a credential, with no restart;
132
+ - the change arrives through the change stream, not by TTL expiry;
133
+ - receipts, and the durable decision record;
134
+ - each failure above;
135
+ - per-environment references;
136
+ - the refused `feltkit model set`.
137
+ - `tests/e2e/resolver-switch.test.mjs`:
138
+ - a starter app deployed once (`--target container`);
139
+ - Resolver as its own process (its CLI);
140
+ - A → B with no rebuild, redeploy or restart;
141
+ - the first decision still names A at r1;
142
+ - a restart keeps resolving;
143
+ - the key is in no decision, process output, artifact or state file.
144
+
145
+ The two providers are loopback OpenAI-compatible servers (`ollama`, `custom`); everything else
146
+ is the real software.
147
+
148
+ ## Not yet
149
+
150
+ - **Other reference kinds.** Integration endpoints (`endpoint` refs for `app.integration`),
151
+ integration credentials (`secret` refs in place of `FELTKIT_CREDENTIAL_<ID>`), AppPort agents
152
+ (`agent` refs) and configuration values (`value` refs) all need the same treatment:
153
+ - a typed declaration;
154
+ - resolution inside the existing call path;
155
+ - a receipt.
156
+ - **Weighted bindings with a stable key.** Steering works (the receipt has `label`), but FeltKit
157
+ passes no `key`, so a canary split is per call, not sticky per user or tenant.
158
+ - **Pinning a revision** (`resolve(ref, { revision })`) from the app is not exposed.
159
+ - **Credential custody outside the app process.** The key enters FeltKit's process for the call.
160
+ A provider proxy that holds the key would avoid that; none exists yet.
161
+ - **Managing references from Studio.** Studio shows the reference and its revision. Changes are made
162
+ in Resolver (its CLI or management pages), which owns their authorization and history.
163
+ - **Resolver's own pins.** `@appport/resolver` 0.2.0 pins `@feltdb/core` 0.21.0 and
164
+ `@appport/services` 0.15.0, the same versions FeltKit uses. It is a separate service, so the
165
+ versions never mix in the app; the app depends only on `@appport/resolver-client`. The tests install it the
166
+ same way, outside the workspace (`test/fixtures/resolver-service.mjs`), so FeltKit keeps exactly
167
+ one `@feltdb/core` (the release check).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feltdb/feltkit",
3
- "version": "0.3.13",
3
+ "version": "0.3.15",
4
4
  "description": "FeltKit: one application, one FeltDB instance, one developer experience. SDK, runtime, CLI, and dashboard.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,11 +57,12 @@
57
57
  "@appport/authorization": "1.0.7",
58
58
  "@appport/integration": "1.2.2",
59
59
  "@appport/protocol": "1.3.0",
60
+ "@appport/resolver-client": "0.2.0",
60
61
  "@appport/sdk": "1.4.0",
61
62
  "@appport/server": "1.1.5",
62
- "@appport/services": ">=0.13.1 <1.0.0",
63
+ "@appport/services": ">=0.15.0 <1.0.0",
63
64
  "@feltdb/core": ">=0.21.0 <1.0.0",
64
- "create-feltkit": "0.3.13",
65
+ "create-feltkit": "0.3.15",
65
66
  "esbuild": "0.25.12",
66
67
  "express": "4.22.3",
67
68
  "mailerport": ">=0.1.0 <1.0.0",
@@ -10,7 +10,7 @@
10
10
  "name": "feltkit",
11
11
  "source": "./",
12
12
  "description": "Skills for building and operating FeltKit applications.",
13
- "version": "0.3.13"
13
+ "version": "0.3.15"
14
14
  }
15
15
  ]
16
16
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://anthropic.com/claude-code/plugin.schema.json",
3
3
  "name": "feltkit",
4
- "version": "0.3.13",
4
+ "version": "0.3.15",
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"
@@ -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.13.1 (shared instance; transactional job and webhook creation; `credential.store` / `credential.status`; `servicesContract` for Managed FeltDB).
146
+ `@feltdb/feltkit` 0.3.x with `@appport/services` 0.15.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.