@feltdb/feltkit 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.d.ts +106 -10
- package/dist/app.js +51 -0
- package/dist/app.js.map +1 -1
- package/dist/cli/deploy.js +9 -0
- package/dist/cli/deploy.js.map +1 -1
- package/dist/cli/main.js +339 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/skills.d.ts +39 -0
- package/dist/cli/skills.js +125 -0
- package/dist/cli/skills.js.map +1 -0
- package/dist/dashboard/assets/{index-BLnBFDJs.css → index--1Tqbv_A.css} +1 -1
- package/dist/dashboard/assets/index-D9529PVz.js +15 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/errors.d.ts +5 -1
- package/dist/errors.js +3 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/runtime/activity.d.ts +21 -8
- package/dist/runtime/activity.js +17 -3
- package/dist/runtime/activity.js.map +1 -1
- package/dist/runtime/agent.d.ts +353 -0
- package/dist/runtime/agent.js +1345 -0
- package/dist/runtime/agent.js.map +1 -0
- package/dist/runtime/authority.d.ts +24 -3
- package/dist/runtime/authority.js +72 -5
- package/dist/runtime/authority.js.map +1 -1
- package/dist/runtime/changes.d.ts +16 -8
- package/dist/runtime/changes.js.map +1 -1
- package/dist/runtime/content.d.ts +33 -0
- package/dist/runtime/content.js +46 -0
- package/dist/runtime/content.js.map +1 -0
- package/dist/runtime/context.d.ts +26 -1
- package/dist/runtime/credentials.d.ts +174 -0
- package/dist/runtime/credentials.js +407 -0
- package/dist/runtime/credentials.js.map +1 -0
- package/dist/runtime/data.d.ts +8 -2
- package/dist/runtime/data.js +74 -9
- package/dist/runtime/data.js.map +1 -1
- package/dist/runtime/decisions.d.ts +141 -0
- package/dist/runtime/decisions.js +330 -0
- package/dist/runtime/decisions.js.map +1 -0
- package/dist/runtime/environment.js +11 -0
- package/dist/runtime/environment.js.map +1 -1
- package/dist/runtime/idempotency.d.ts +37 -0
- package/dist/runtime/idempotency.js +88 -0
- package/dist/runtime/idempotency.js.map +1 -0
- package/dist/runtime/instance.d.ts +8 -3
- package/dist/runtime/instance.js +27 -4
- package/dist/runtime/instance.js.map +1 -1
- package/dist/runtime/integrations.d.ts +125 -0
- package/dist/runtime/integrations.js +429 -0
- package/dist/runtime/integrations.js.map +1 -0
- package/dist/runtime/loader.d.ts +5 -1
- package/dist/runtime/loader.js +35 -13
- package/dist/runtime/loader.js.map +1 -1
- package/dist/runtime/projects.d.ts +1 -0
- package/dist/runtime/projects.js +6 -4
- package/dist/runtime/projects.js.map +1 -1
- package/dist/runtime/readiness.d.ts +29 -0
- package/dist/runtime/readiness.js +154 -0
- package/dist/runtime/readiness.js.map +1 -0
- package/dist/runtime/runtime.d.ts +53 -1
- package/dist/runtime/runtime.js +252 -9
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/services.d.ts +205 -36
- package/dist/runtime/services.js +479 -152
- package/dist/runtime/services.js.map +1 -1
- package/dist/runtime/sessions.d.ts +7 -18
- package/dist/runtime/sessions.js +7 -5
- package/dist/runtime/sessions.js.map +1 -1
- package/dist/server/admin.d.ts +80 -0
- package/dist/server/admin.js +677 -8
- package/dist/server/admin.js.map +1 -1
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +13 -4
- package/dist/server/index.js.map +1 -1
- package/dist/server/management.d.ts +12 -0
- package/dist/server/management.js +177 -0
- package/dist/server/management.js.map +1 -0
- package/dist/server/mcp.d.ts +202 -0
- package/dist/server/mcp.js +62 -4
- package/dist/server/mcp.js.map +1 -1
- package/dist/server/operators.d.ts +77 -0
- package/dist/server/operators.js +162 -0
- package/dist/server/operators.js.map +1 -0
- package/dist/server/project.js +17 -4
- package/dist/server/project.js.map +1 -1
- package/dist/testing/index.js +3 -2
- package/dist/testing/index.js.map +1 -1
- package/package.json +18 -11
- package/skills/.claude-plugin/marketplace.json +16 -0
- package/skills/.claude-plugin/plugin.json +24 -0
- package/skills/README.md +44 -0
- package/skills/feltkit-agent/SKILL.md +84 -0
- package/skills/feltkit-build/SKILL.md +153 -0
- package/skills/feltkit-data/SKILL.md +79 -0
- package/skills/feltkit-operations/SKILL.md +72 -0
- package/skills/feltkit-services/SKILL.md +124 -0
- package/dist/dashboard/assets/index-CxJGCspE.js +0 -15
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: feltkit-operations
|
|
3
|
+
description: Diagnose, build, test, deploy, and recover FeltKit applications — feltkit doctor, inspect, build, test, deploy, start, sessions, environments, state locations, production configuration (FELTDB_URL, FELTDB_TOKEN, FELTKIT_STATE_DIR), and release. Use when something will not start, a port or instance is already in use, the user wants to ship or deploy, rotate access, or recover state.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# FeltKit: operations
|
|
7
|
+
|
|
8
|
+
## Diagnose first
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npx feltkit doctor --json # Node, project, dependencies, one FeltDB copy, frontend tooling, dev server
|
|
12
|
+
npx feltkit inspect --json # application, environment, instance, functions, services, recent activity
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`inspect` reads the running server when there is one, otherwise opens the environment directly. It never prints the
|
|
16
|
+
admin token. Share findings, not tokens.
|
|
17
|
+
|
|
18
|
+
| Problem | Meaning | Fix |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| `DUPLICATE_INSTANCE` / "already running" | Another process owns this environment's FeltDB instance | Stop it, or use that server; never point two processes at the same state |
|
|
21
|
+
| `Port … is already in use` | — | `--port <n>` |
|
|
22
|
+
| "Two copies of @feltdb/core" (doctor) | Mismatched dependency versions | Reinstall; pins must agree (doctor prints the fix) |
|
|
23
|
+
| `CONFIGURATION: FELTDB_URL is set for production but FELTDB_TOKEN is not` | — | Set the token from the secret manager |
|
|
24
|
+
| A function fails only in production | Production hides internal error messages | Read the server logs and Studio's Activity for the request id |
|
|
25
|
+
|
|
26
|
+
## Environments and state
|
|
27
|
+
|
|
28
|
+
| Environment | State |
|
|
29
|
+
|---|---|
|
|
30
|
+
| development | `.feltkit/development/state` (local FeltDB) |
|
|
31
|
+
| test | a fresh temporary directory per test runtime |
|
|
32
|
+
| production | `FELTDB_URL` + `FELTDB_TOKEN` (a FeltDB server), else `FELTKIT_STATE_DIR`, else `.feltkit/production/state` |
|
|
33
|
+
|
|
34
|
+
`.feltkit/` holds state and the admin token (mode 0600). Never commit it, never paste the token. Back up state by
|
|
35
|
+
copying the stopped state directory; restore by putting it back before starting.
|
|
36
|
+
|
|
37
|
+
## Build, test, deploy
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npx feltkit test # node --test on tests/**/*.test.ts, isolated FeltDB per runtime
|
|
41
|
+
npx feltkit build # bundles feltkit/, builds the frontend, loads the bundle to verify it
|
|
42
|
+
npx feltkit deploy --out dist-deploy # verified, self-contained directory with a Dockerfile and DEPLOY.md
|
|
43
|
+
npx feltkit start --port 8080 --host 0.0.0.0 # production runtime (the dashboard is not served)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`build` refuses to ship a frontend that contains secrets (FELTDB_TOKEN, FeltKit tokens, server code).
|
|
47
|
+
|
|
48
|
+
## Access
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
npx feltkit session create --id ci-bot --role <role> --type agent --ttl 24
|
|
52
|
+
npx feltkit session list
|
|
53
|
+
npx feltkit session revoke <ref>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Revoking a session stops its durable work too (jobs and deliveries it created are refused). API keys are managed on
|
|
57
|
+
the API keys page (Studio → Services → Manage). Production API keys need `FELTKIT_API_KEY_VERIFIER_KEY`.
|
|
58
|
+
|
|
59
|
+
## Recover
|
|
60
|
+
|
|
61
|
+
- A failed job or delivery: see the feltkit-services skill; retry or replay after fixing the cause.
|
|
62
|
+
- A `CONFLICT` storm: two writers contend; retry with a bound, or narrow what the mutation reads.
|
|
63
|
+
- The agent cannot act for a task: its owner has no active session or key; create one or reassign the work.
|
|
64
|
+
|
|
65
|
+
## Requires approval
|
|
66
|
+
|
|
67
|
+
Anything in production; deleting or restoring state; revoking sessions or keys; rotating
|
|
68
|
+
`FELTKIT_API_KEY_VERIFIER_KEY`; publishing packages (`npm run publish:packages` in the FeltKit repository).
|
|
69
|
+
|
|
70
|
+
## Compatibility
|
|
71
|
+
|
|
72
|
+
`@feltdb/feltkit` 0.1.x. Verified in Claude Code only.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: feltkit-services
|
|
3
|
+
description: Configure, use, and troubleshoot AppPort Services in a FeltKit application — files, notifications, configuration and secrets, API keys, webhooks, jobs, schedules, intelligence. Use when the user wants to enable a service, send a notification, enqueue background work, emit or debug a webhook, issue or revoke an API key, set a configuration variable or secret, or asks why a job or delivery failed.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# FeltKit: services
|
|
7
|
+
|
|
8
|
+
Services are AppPort Services running on the application's own FeltDB instance. Every service effect is
|
|
9
|
+
authorized by AppPort Services' gateway with the application's roles, as the caller. **This skill grants no
|
|
10
|
+
permission and stores no secret.**
|
|
11
|
+
|
|
12
|
+
## Enable a service
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
// feltkit/app.ts
|
|
16
|
+
export const app = feltkit({
|
|
17
|
+
name: "shop",
|
|
18
|
+
roles: { admin: ["*"], ops: ["jobs.*", "webhooks.*", "orders.*"] },
|
|
19
|
+
services: {
|
|
20
|
+
files: true,
|
|
21
|
+
notifications: true,
|
|
22
|
+
configuration: true,
|
|
23
|
+
apiKeys: { roles: ["machine"] }, // requests with an API key hold these roles
|
|
24
|
+
webhooks: true,
|
|
25
|
+
jobs: { handlers: { "invoice.send": "billing:sendInvoice" } }, // job type → "<module>:<function>"
|
|
26
|
+
schedules: true, // needs jobs
|
|
27
|
+
intelligence: true, // the environment's model; agent decisions use it (feltkit model set)
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The permission for each operation is its AppPort Services capability name (`jobs.create`, `webhooks.register`,
|
|
33
|
+
`apikeys.create`, `configuration.write`, `credential.attach`, `credential.store`, `intelligence.write`, …). Grant them to roles like any permission.
|
|
34
|
+
|
|
35
|
+
## Use a service from a function
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
export const checkout = app.mutation({
|
|
39
|
+
access: "orders.write",
|
|
40
|
+
args: { orderId: s.string() },
|
|
41
|
+
handler: async (ctx, { orderId }) => {
|
|
42
|
+
await ctx.services.jobs.enqueue("invoice.send", { orderId }); // runs later, as this caller
|
|
43
|
+
await ctx.services.webhooks.emit("order.paid", { orderId }); // to subscribed endpoints
|
|
44
|
+
await ctx.services.notifications.send({ recipient: "ada", type: "order", title: "Paid" });
|
|
45
|
+
const region = await ctx.services.configuration.get("REGION");
|
|
46
|
+
return { region };
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Service effects commit on their own: they are not part of the mutation's transaction.
|
|
52
|
+
|
|
53
|
+
## Configure a service
|
|
54
|
+
|
|
55
|
+
Configuration happens in AppPort Services' own pages, opened from FeltKit Studio: **Services → Manage**, acting as a
|
|
56
|
+
declared dev identity (development only). Those pages are the package's; FeltKit only signs you in. Do not write a
|
|
57
|
+
second configuration form or store settings elsewhere.
|
|
58
|
+
|
|
59
|
+
**Secrets and API keys for providers.** Services and configuration store only references: `credential-ref:<id>`.
|
|
60
|
+
The value is kept by FeltKit's credential custody, never in FeltDB, configuration, code, or a commit:
|
|
61
|
+
|
|
62
|
+
- `FELTKIT_CREDENTIAL_<ID>` (non-alphanumerics → `_`, upper-cased) wins when it is set; that reference is then
|
|
63
|
+
read-only in Studio. Example: `credential-ref:stripe-signing` → `FELTKIT_CREDENTIAL_STRIPE_SIGNING`.
|
|
64
|
+
- Otherwise, in development and test, the local encrypted vault `.feltkit/<env>/credentials.vault` (AES-256-GCM,
|
|
65
|
+
key in `.feltkit/<env>/credentials.key`, both 0600, gitignored, never in a build or deploy).
|
|
66
|
+
- Production uses environment variables only; storing a value there fails with `CUSTODY_READ_ONLY` unless the
|
|
67
|
+
operator opted in with `FELTKIT_CREDENTIAL_VAULT=1` and `FELTKIT_CREDENTIAL_VAULT_KEY` (32 bytes from their
|
|
68
|
+
secret manager).
|
|
69
|
+
|
|
70
|
+
Where a person enters a key (it goes through AppPort Services' `credential.store`, authorized as them, audited
|
|
71
|
+
without the value, and is never shown again): **Studio → Models** (API key field next to provider and model),
|
|
72
|
+
**Studio → Integrations → Set key**, **Studio → Services → Credentials** (set, replace, remove), or on the host
|
|
73
|
+
`npx feltkit credential set <provider|credential-ref:id>` (hidden prompt, or piped on stdin) and
|
|
74
|
+
`npx feltkit model set --provider … --model … --api-key-stdin`. `npx feltkit credential status` lists every
|
|
75
|
+
reference, what uses it, whether it is set, where, and its version.
|
|
76
|
+
|
|
77
|
+
As an agent: **never ask the user to paste a key into the chat, and never put one in a command line, a file, a
|
|
78
|
+
configuration variable, or a reply.** Tell them where to enter it (the Models screen, or `feltkit credential set`
|
|
79
|
+
in their own terminal). If a key appears in the conversation anyway, do not repeat it; tell the user to rotate it.
|
|
80
|
+
A value in a reference field is refused by Studio and the server. Storing needs the `credential.store` permission
|
|
81
|
+
(the starter's `admin` role grants `credential.*`).
|
|
82
|
+
|
|
83
|
+
**API keys** are shown once when created (or rotated). FeltKit accepts them on `/appport` and `/mcp` as an identity
|
|
84
|
+
holding `services.apiKeys.roles`. In production `FELTKIT_API_KEY_VERIFIER_KEY` (≥ 32 bytes) must be set; changing it
|
|
85
|
+
invalidates every key.
|
|
86
|
+
|
|
87
|
+
**Moving configuration to production.** `feltkit config export --out config.json` writes development's variables,
|
|
88
|
+
credential binding names and references, active webhook endpoints, and enabled schedules (never a secret value).
|
|
89
|
+
`feltkit config import config.json --env production --dry-run` shows the plan; run it again without `--dry-run`,
|
|
90
|
+
on the host with the server stopped, to apply it. Imports never create credential bindings: attach each one it
|
|
91
|
+
lists and have the user set its `FELTKIT_CREDENTIAL_<ID>`. Schedules are listed, not imported.
|
|
92
|
+
|
|
93
|
+
## Troubleshoot
|
|
94
|
+
|
|
95
|
+
Service states in Studio and `npx feltkit inspect --json`: `available` (not enabled), `unconfigured`, `configured`,
|
|
96
|
+
`unhealthy` (store check failed, a required secret is missing, or recent work failed), `unavailable`.
|
|
97
|
+
|
|
98
|
+
| Symptom | Look at | Usual cause |
|
|
99
|
+
|---|---|---|
|
|
100
|
+
| Job `failed` | Services → Job runs (`lastError`), Activity filtered to `via: job` | The handler function threw; or `DENIED` — the enqueuer no longer has an active session or key |
|
|
101
|
+
| Job never runs | `services.jobs.handlers` | No handler for the type (enqueue refuses unknown types) |
|
|
102
|
+
| Delivery `failed` | Services → Webhook deliveries (`lastStatusCode`, `lastError`), Credentials | Signing credential not set; receiver returned 4xx (not retried); destination did not resolve |
|
|
103
|
+
| Endpoint rejected on registration | the error | Private/loopback URLs are refused outside development |
|
|
104
|
+
| Variable set in the page is missing in code | the environment | The page edits the running environment's scope; check `ctx.environment.name` |
|
|
105
|
+
| Models: "No API key is stored for credential-ref:…" | Studio → Models, `feltkit credential status` | Enter the key in the Models API key field (or `feltkit credential set <provider>`); production: set the variable on the host |
|
|
106
|
+
| `CUSTODY_READ_ONLY` | the message names the variable | The value comes from the host (`FELTKIT_CREDENTIAL_<ID>` is set, or production without the vault opt-in): change it there |
|
|
107
|
+
| `FORBIDDEN … credential.store` / `intelligence.write` | the dev identity's roles | Save as a dev user whose role grants `credential.*` and `intelligence.*` (the starter's Ada) |
|
|
108
|
+
|
|
109
|
+
Durable work (jobs, schedules, deliveries) re-authorizes every attempt **as the principal that created it**. If
|
|
110
|
+
that principal signs out everywhere or its key is revoked, its pending work is refused — by design.
|
|
111
|
+
|
|
112
|
+
Retry or replay from Studio (Job runs → Retry, Deliveries → Replay), or ask the FeltKit agent to diagnose it
|
|
113
|
+
(see the feltkit-agent skill). In tests, drive due work explicitly: `await app.runtime.runServices()`.
|
|
114
|
+
|
|
115
|
+
## Requires approval
|
|
116
|
+
|
|
117
|
+
Revoking or rotating API keys, disabling endpoints, deleting configuration or secrets, and replaying deliveries
|
|
118
|
+
affect other systems. Confirm with the user before doing any of them.
|
|
119
|
+
|
|
120
|
+
## Compatibility
|
|
121
|
+
|
|
122
|
+
`@feltdb/feltkit` 0.3.x with `@appport/services` 0.8.0 (shared instance; `credential.store` / `credential.status`).
|
|
123
|
+
The console is development-only.
|
|
124
|
+
Verified in Claude Code only.
|