@feltdb/feltkit 0.1.1 → 0.2.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/main.js +218 -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-Bm4qCYpv.js +15 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/errors.d.ts +3 -1
- package/dist/errors.js +2 -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 +23 -3
- package/dist/runtime/authority.js +69 -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 +42 -0
- package/dist/runtime/credentials.js +32 -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 +131 -0
- package/dist/runtime/decisions.js +301 -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 +120 -0
- package/dist/runtime/integrations.js +412 -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 +50 -1
- package/dist/runtime/runtime.js +225 -9
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/services.d.ts +186 -36
- package/dist/runtime/services.js +420 -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 +26 -0
- package/dist/server/admin.js +510 -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 +143 -0
- package/skills/feltkit-data/SKILL.md +79 -0
- package/skills/feltkit-operations/SKILL.md +72 -0
- package/skills/feltkit-services/SKILL.md +102 -0
- package/dist/dashboard/assets/index-CxJGCspE.js +0 -15
|
@@ -0,0 +1,102 @@
|
|
|
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`, …). 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.** Services store only references: `credential-ref:<id>`. FeltKit resolves a reference from the
|
|
60
|
+
environment variable `FELTKIT_CREDENTIAL_<ID>` (non-alphanumerics → `_`, upper-cased), inside the one effect that
|
|
61
|
+
needs it. Example: a webhook endpoint with `credential-ref:stripe-signing` signs with `FELTKIT_CREDENTIAL_STRIPE_SIGNING`.
|
|
62
|
+
Never put a secret value in code, configuration variables, a commit, a log, or a reply. Ask the user to set the
|
|
63
|
+
variable themselves. Studio's Services screen shows each reference as set or missing — never its value.
|
|
64
|
+
|
|
65
|
+
**API keys** are shown once when created (or rotated). FeltKit accepts them on `/appport` and `/mcp` as an identity
|
|
66
|
+
holding `services.apiKeys.roles`. In production `FELTKIT_API_KEY_VERIFIER_KEY` (≥ 32 bytes) must be set; changing it
|
|
67
|
+
invalidates every key.
|
|
68
|
+
|
|
69
|
+
**Moving configuration to production.** `feltkit config export --out config.json` writes development's variables,
|
|
70
|
+
credential binding names and references, active webhook endpoints, and enabled schedules (never a secret value).
|
|
71
|
+
`feltkit config import config.json --env production --dry-run` shows the plan; run it again without `--dry-run`,
|
|
72
|
+
on the host with the server stopped, to apply it. Imports never create credential bindings: attach each one it
|
|
73
|
+
lists and have the user set its `FELTKIT_CREDENTIAL_<ID>`. Schedules are listed, not imported.
|
|
74
|
+
|
|
75
|
+
## Troubleshoot
|
|
76
|
+
|
|
77
|
+
Service states in Studio and `npx feltkit inspect --json`: `available` (not enabled), `unconfigured`, `configured`,
|
|
78
|
+
`unhealthy` (store check failed, a required secret is missing, or recent work failed), `unavailable`.
|
|
79
|
+
|
|
80
|
+
| Symptom | Look at | Usual cause |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| 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 |
|
|
83
|
+
| Job never runs | `services.jobs.handlers` | No handler for the type (enqueue refuses unknown types) |
|
|
84
|
+
| Delivery `failed` | Services → Webhook deliveries (`lastStatusCode`, `lastError`), Credentials | Signing credential not set; receiver returned 4xx (not retried); destination did not resolve |
|
|
85
|
+
| Endpoint rejected on registration | the error | Private/loopback URLs are refused outside development |
|
|
86
|
+
| Variable set in the page is missing in code | the environment | The page edits the running environment's scope; check `ctx.environment.name` |
|
|
87
|
+
|
|
88
|
+
Durable work (jobs, schedules, deliveries) re-authorizes every attempt **as the principal that created it**. If
|
|
89
|
+
that principal signs out everywhere or its key is revoked, its pending work is refused — by design.
|
|
90
|
+
|
|
91
|
+
Retry or replay from Studio (Job runs → Retry, Deliveries → Replay), or ask the FeltKit agent to diagnose it
|
|
92
|
+
(see the feltkit-agent skill). In tests, drive due work explicitly: `await app.runtime.runServices()`.
|
|
93
|
+
|
|
94
|
+
## Requires approval
|
|
95
|
+
|
|
96
|
+
Revoking or rotating API keys, disabling endpoints, deleting configuration or secrets, and replaying deliveries
|
|
97
|
+
affect other systems. Confirm with the user before doing any of them.
|
|
98
|
+
|
|
99
|
+
## Compatibility
|
|
100
|
+
|
|
101
|
+
`@feltdb/feltkit` 0.1.x with `@appport/services` 0.7.0 (shared instance). The console is development-only.
|
|
102
|
+
Verified in Claude Code only.
|