create-feltkit 0.4.0 → 0.5.1

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 (74) hide show
  1. package/bin/create.js +3 -3
  2. package/package.json +4 -4
  3. package/scaffold.d.ts +1 -1
  4. package/scaffold.js +8 -5
  5. package/template/README.md +72 -177
  6. package/template/_gitignore +4 -0
  7. package/template/agent/agent.ts +28 -0
  8. package/template/agent/channels/eve.ts +6 -0
  9. package/template/agent/instructions.md +24 -0
  10. package/template/agent/lib/deterministic.ts +46 -0
  11. package/template/agent/lib/feltkit-capabilities.json +294 -0
  12. package/template/agent/tools/crew_artifacts_create.ts +4 -0
  13. package/template/agent/tools/crew_context_read.ts +4 -0
  14. package/template/agent/tools/crew_context_record.ts +4 -0
  15. package/template/agent/tools/crew_context_search.ts +4 -0
  16. package/template/agent/tools/crew_decisions_propose.ts +4 -0
  17. package/template/agent/tools/crew_tasks_add.ts +6 -0
  18. package/template/agent/tools/crew_tasks_list.ts +4 -0
  19. package/template/agent/tools/crew_tasks_note.ts +4 -0
  20. package/template/agent/tools/crew_workspace_overview.ts +4 -0
  21. package/template/agent/tools/crew_workstreams_update.ts +6 -0
  22. package/template/agent/tools/web_fetch.ts +1 -0
  23. package/template/agent/tools/web_search.ts +3 -0
  24. package/template/feltkit/_generated/api.ts +8 -4
  25. package/template/feltkit/activity.ts +26 -0
  26. package/template/feltkit/app.ts +147 -54
  27. package/template/feltkit/boards.ts +10 -0
  28. package/template/feltkit/decisions.ts +99 -0
  29. package/template/feltkit/knowledge.ts +119 -0
  30. package/template/feltkit/model.ts +96 -0
  31. package/template/feltkit/work.ts +45 -0
  32. package/template/feltkit/workspace.ts +171 -0
  33. package/template/index.html +1 -1
  34. package/template/native/App.tsx +249 -0
  35. package/template/package.json +13 -7
  36. package/template/shared/rules.ts +23 -0
  37. package/template/src/App.tsx +177 -528
  38. package/template/src/screens/activity.tsx +66 -0
  39. package/template/src/screens/agent.tsx +188 -0
  40. package/template/src/screens/context.tsx +71 -0
  41. package/template/src/screens/decisions.tsx +89 -0
  42. package/template/src/screens/home.tsx +140 -0
  43. package/template/src/screens/team.tsx +13 -0
  44. package/template/src/screens/work.tsx +149 -0
  45. package/template/src/styles.css +201 -118
  46. package/template/src/ui.tsx +179 -0
  47. package/template/tests/crew.test.ts +111 -0
  48. package/template/tsconfig.json +18 -3
  49. package/template-managed/Dockerfile +2 -2
  50. package/template-managed/README.md +1 -1
  51. package/template-managed/package.json +3 -3
  52. package/template-tasks/README.md +383 -0
  53. package/template-tasks/_gitignore +12 -0
  54. package/template-tasks/feltkit/_generated/api.ts +10 -0
  55. package/template-tasks/feltkit/app.ts +73 -0
  56. package/template-tasks/index.html +17 -0
  57. package/template-tasks/native/App.tsx +220 -0
  58. package/template-tasks/native/native.json +5 -0
  59. package/template-tasks/package.json +30 -0
  60. package/template-tasks/public/apple-touch-icon.png +0 -0
  61. package/template-tasks/public/favicon.png +0 -0
  62. package/template-tasks/public/theme.js +7 -0
  63. package/template-tasks/shared/rules.ts +18 -0
  64. package/template-tasks/src/App.tsx +557 -0
  65. package/template-tasks/src/main.tsx +17 -0
  66. package/template-tasks/src/styles.css +134 -0
  67. package/template-tasks/src/theme.tsx +58 -0
  68. package/template-tasks/tsconfig.json +16 -0
  69. package/template-tasks/vite.config.ts +6 -0
  70. /package/{template → template-tasks}/feltkit/inbox.ts +0 -0
  71. /package/{template → template-tasks}/feltkit/projects.ts +0 -0
  72. /package/{template → template-tasks}/feltkit/tasks.ts +0 -0
  73. /package/{template → template-tasks}/public/feltkit-mark.png +0 -0
  74. /package/{template → template-tasks}/tests/tasks.test.ts +0 -0
package/bin/create.js CHANGED
@@ -28,7 +28,7 @@ Creates a complete, working FeltKit application. Run it straight away:
28
28
  Starters (--template), each a whole application you can read and change:
29
29
  ${Object.entries(TEMPLATES).map(([name, { description }]) => ` ${name.padEnd(9)}${description}`).join("\n")}
30
30
 
31
- --managed is short for --template managed. tasks is the default.`);
31
+ --managed is short for --template managed. crew is the default.`);
32
32
  process.exit(0);
33
33
  }
34
34
  if (args.includes("--version")) {
@@ -42,7 +42,7 @@ const valueOf = (flag) => {
42
42
  return index >= 0 ? args[index + 1] : undefined;
43
43
  };
44
44
 
45
- const template = args.includes("--managed") ? "managed" : valueOf("--template") ?? "tasks";
45
+ const template = args.includes("--managed") ? "managed" : valueOf("--template") ?? "crew";
46
46
  // The destination is the first argument that is neither a flag nor a flag's value, so a `--name my-app` whose
47
47
  // value happens to equal the directory still works.
48
48
  const dir = args.find((a, i) => !a.startsWith("-") && !VALUE_FLAGS.includes(args[i - 1])) ?? "my-feltkit-app";
@@ -50,7 +50,7 @@ const name = valueOf("--name");
50
50
 
51
51
  try {
52
52
  const result = scaffold({ target: resolve(process.cwd(), dir), template, ...(name ? { name } : {}) });
53
- console.log(`${green("✓")} Created ${bold(result.name)} in ${result.dir}${template === "tasks" ? "" : ` (${template} starter)`}\n`);
53
+ console.log(`${green("✓")} Created ${bold(result.name)} in ${result.dir}${template === "crew" ? "" : ` (${template} starter)`}\n`);
54
54
  console.log(` cd ${dir}`);
55
55
  console.log(" npm install");
56
56
  if (template === "managed") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-feltkit",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Create a FeltKit application: npm create feltkit@latest my-app (add -- --template managed for Managed FeltDB)",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -10,7 +10,7 @@
10
10
  "directory": "packages/create"
11
11
  },
12
12
  "engines": {
13
- "node": ">=20.11"
13
+ "node": ">=26"
14
14
  },
15
15
  "bin": {
16
16
  "create-feltkit": "bin/create.js"
@@ -26,8 +26,8 @@
26
26
  "scaffold.js",
27
27
  "scaffold.d.ts",
28
28
  "template",
29
+ "template-tasks",
29
30
  "template-managed",
30
- "template-foundation",
31
31
  "README.md"
32
32
  ],
33
33
  "scripts": {
@@ -37,6 +37,6 @@
37
37
  },
38
38
  "homepage": "https://www.npmjs.com/package/create-feltkit",
39
39
  "dependencies": {
40
- "@feltdb/feltkit": "0.4.0"
40
+ "@feltdb/feltkit": "0.5.1"
41
41
  }
42
42
  }
package/scaffold.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type TemplateName = "tasks" | "managed" | "foundation";
1
+ export type TemplateName = "crew" | "tasks" | "managed";
2
2
  export interface ScaffoldOptions {
3
3
  /** Directory to create. Must not exist or be empty. */
4
4
  target: string;
package/scaffold.js CHANGED
@@ -7,15 +7,18 @@ import { fileURLToPath } from "node:url";
7
7
  export const VERSION = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")).version;
8
8
 
9
9
  /**
10
- * The starters. All are the same FeltKit; they differ in where state lives and how it is deployed.
10
+ * The starters. All are the same FeltKit; they differ in what they build and where state lives.
11
+ * crew a shared workspace where people and an agent work toward a mission: workspaces, members and
12
+ * invitations, Boards, context, decisions, history, and an eve agent FeltKit runs (the default).
11
13
  * tasks a task manager with a React frontend, AppPort Services (files, intelligence) and an agent;
12
- * state in local FeltDB (`.feltkit/<env>/state`), or a FeltDB server you run.
14
+ * state in local FeltDB (`.feltkit/<env>/state`), or a FeltDB server you run. Builds for AppBoundry.
13
15
  * managed an inventory API whose state lives in Managed FeltDB: no AppPort Services (Managed FeltDB
14
16
  * stores only what the application's contract declares), the contract checked in, keys from
15
17
  * the FeltDB CLI, and a Dockerfile, compose file and Fly.io configuration.
16
18
  */
17
19
  export const TEMPLATES = Object.freeze({
18
- tasks: { dir: "template", description: "Task manager with a frontend; local FeltDB (default)" },
20
+ crew: { dir: "template", description: "Shared workspace for people and an agent: workspaces, work, decisions, an eve agent (default)" },
21
+ tasks: { dir: "template-tasks", description: "Task manager with a frontend; local FeltDB; builds for AppBoundry" },
19
22
  managed: { dir: "template-managed", description: "Inventory API on Managed FeltDB; contract, keys and deployment as code" },
20
23
  });
21
24
 
@@ -28,7 +31,7 @@ export class ScaffoldError extends Error {
28
31
  }
29
32
  }
30
33
 
31
- export function templateDir(template = "tasks") {
34
+ export function templateDir(template = "crew") {
32
35
  const entry = TEMPLATES[template];
33
36
  if (!entry) {
34
37
  throw new ScaffoldError("TEMPLATE_UNKNOWN", `There is no "${template}" starter.`, `Choose one of: ${Object.keys(TEMPLATES).join(", ")}.`);
@@ -51,7 +54,7 @@ export function toAppName(input) {
51
54
  return name || "my-app";
52
55
  }
53
56
 
54
- export function scaffold({ target, name, sdkSpec, template = "tasks" }) {
57
+ export function scaffold({ target, name, sdkSpec, template = "crew" }) {
55
58
  const source = templateDir(template);
56
59
  if (existsSync(target) && readdirSync(target).filter((f) => f !== ".git" && f !== ".DS_Store").length > 0) {
57
60
  throw new ScaffoldError("TARGET_NOT_EMPTY", `${target} already exists and is not empty. FeltKit will not write over existing files.`, "Choose a new directory name.");
@@ -1,8 +1,11 @@
1
- # tasks
1
+ # crew
2
2
 
3
- A FeltKit application: a small task manager with projects, tasks and notes, roles, live
4
- queries, AppPort Services, an agent, and a development dashboard (Studio). Each
5
- environment keeps all of its state in one FeltDB instance.
3
+ A FeltKit application: a shared workspace where people and an agent work together toward a mission.
4
+ It starts from **Launch a Business** (five workstreams from customer discovery to go-to-market, with starter
5
+ tasks and hypotheses to test) and shows what FeltKit gives an application: workspaces, members and invitations,
6
+ live shared state, work on Boards, a durable knowledge and decision log, a history of every change, and an agent
7
+ that does real work under the workspace's rules and asks before it changes the plan. Each environment keeps all of
8
+ its state in one FeltDB instance, the agent's sessions included.
6
9
 
7
10
  ## Quick start
8
11
 
@@ -11,150 +14,69 @@ npm install
11
14
  npm run dev
12
15
  ```
13
16
 
14
- `npm run dev` prints:
17
+ `npm run dev` prints the app's address (port 3000 unless it is taken), Studio's link, and the agent's state:
15
18
 
16
19
  ```
17
20
  App http://localhost:3000
18
21
  Dashboard http://localhost:3000/_feltkit/#token=…
19
- AppPort http://localhost:3000/appport
20
- MCP http://localhost:3000/mcp
21
22
  State …/.feltkit/development/state
23
+ [eve:crew] server listening …
22
24
  ```
23
25
 
24
- The port is 3000 unless something already uses it: another FeltKit app (or anything else) on 3000
25
- moves this one to the next free port, and the line above shows the one it got. To choose it:
26
- `npm run dev -- --port 3001`, or `FELTKIT_PORT=3001 npm run dev` (or `PORT`). A port you choose is
27
- used exactly or the server does not start; `--port 0` takes any free port.
26
+ - Sign in as a development user (**Ada**, **Lin**), with an e-mail address and a password, or with a one-time
27
+ link or code: in development, e-mail goes to a local inbox that `feltkit dev` prints.
28
+ - Create a workspace, start from **Launch a Business**, then follow **Next** on the home screen: activate the
29
+ agent, invite someone (open the invitation link in another browser or a private window and sign in as Lin),
30
+ and ask the agent for something.
31
+ - **The agent's model.** By default it uses `openai/gpt-5-mini` through Vercel AI Gateway: set
32
+ `AI_GATEWAY_API_KEY` before `npm run dev` (or change the model in `agent/agent.ts`). Without a key, run it with
33
+ `CREW_AGENT_MODEL=deterministic npm run dev`: a scripted test model that makes fixed choices through the same
34
+ tools, authorization and approvals, and says so in what it records.
28
35
 
29
- - **App**: you are signed in as a development user. **Ada** (`member`, `admin`) can do
30
- everything; **Grace** (`viewer`) can only read. Switch between them from the app's header.
31
- - **Dashboard** (Studio): your data, functions, capabilities, services, agent, models and
32
- every operation that ran. Keep the link private: the token in it is this environment's
33
- admin token.
34
- - Edit anything in `feltkit/`. The backend reloads in place and keeps its state, sessions and
35
- history. The frontend in `src/` hot-reloads.
36
-
37
- Development state lives in `.feltkit/development/` (ignored by git). Delete that folder to
38
- start over.
36
+ Development state lives in `.feltkit/development/` (ignored by git). Delete that folder to start over.
39
37
 
40
38
  ## What's in the project
41
39
 
42
- | Path | What it is |
40
+ | Path | What |
43
41
  |---|---|
44
- | `feltkit/app.ts` | The application: its name, roles and permissions, dev users, enabled services, collections |
45
- | `feltkit/projects.ts`, `feltkit/tasks.ts` | Functions: queries (read) and mutations (write). A function is `<module>:<export>`, e.g. `tasks:create` |
46
- | `feltkit/_*.ts` | Helpers shared by function modules (business rules, formatting). A file whose name starts with `_` is not loaded as a function module |
47
- | `feltkit/_generated/api.ts` | Typed references to every function. Regenerated by `feltkit dev` and `feltkit codegen`; don't edit it |
48
- | `src/` | The React frontend. Colors are tokens in `src/styles.css`, each `light-dark(light, dark)`; the top bar's switch (`src/theme.tsx`) picks light, dark, or the system setting, remembered per browser and applied before first paint by `public/theme.js` |
49
- | `tests/` | Tests, each against a fresh FeltDB instance |
50
- | `.feltkit/` | Local state, keys and builds, per environment. Never commit it |
42
+ | `feltkit/app.ts` | Roles, workspaces (`auth.tenant`), sign-in, services, the agent (`eve`), the collections |
43
+ | `feltkit/workspace.ts` | Setup and the mission, workstreams, Mission Control (`overview`) and its next-step rules |
44
+ | `feltkit/boards.ts` | The work: FeltKit Boards, one board per workspace (workstreams are channels, tasks are threads) |
45
+ | `feltkit/knowledge.ts`, `decisions.ts` | Context with its source and standing; the decision log (revisits supersede, never erase) |
46
+ | `feltkit/work.ts` | The agent's view of the work (adding a task needs a person's approval) |
47
+ | `feltkit/activity.ts` | The timeline: the workspace's audit trail and Boards' history, merged |
48
+ | `agent/` | The workspace agent (eve): `agent.ts`, `instructions.md`, its tools (one per capability), `channels/eve.ts` |
49
+ | `src/` | The web app (React): Home, Work, Context, Decisions, Agent, Activity, Team |
50
+ | `native/` | The iOS and Android app (React Native, `npx feltkit build ios`) |
51
+ | `shared/rules.ts` | What both UIs decide (permissions, error wording) |
52
+ | `tests/` | Tests against real FeltDB, real authorization |
51
53
 
52
54
  ## How it works
53
55
 
54
- **Data.** Collections are declared in `feltkit/app.ts` with a schema; every write is
55
- validated against it.
56
-
57
- ```ts
58
- export const tasks = app.collection("tasks", {
59
- projectId: s.string(),
60
- title: s.string({ minLength: 1, maxLength: 200 }),
61
- done: s.boolean(),
62
- });
63
- ```
64
-
65
- **Functions.** A query reads, a mutation writes. Writes in one mutation commit together, or
66
- not at all. `access` is the permission the caller needs; `capability` publishes the
67
- function through AppPort, so agents can use it too.
68
-
69
- ```ts
70
- export const create = app.mutation({
71
- access: "tasks.write",
72
- args: { projectId: s.string(), title: s.string({ minLength: 1 }) },
73
- capability: { name: "tasks.create", description: "Add a task to a project." },
74
- handler: async (ctx, { projectId, title }) =>
75
- ctx.db.insert(tasks, { projectId, title, done: false, createdAt: Date.now(), createdBy: ctx.auth.requirePrincipal().id }),
76
- });
77
- ```
78
-
79
- **Roles.** `roles` in `feltkit/app.ts` grant permissions; `"tasks.*"` grants every
80
- `tasks.<x>`. The server checks them on every call, whatever the frontend shows.
81
-
82
- **Frontend.** Queries are live: they update when the data changes.
83
-
84
- ```tsx
85
- import { useMutation, useQueryState } from "@feltdb/feltkit/react";
86
- import { api } from "../feltkit/_generated/api";
87
-
88
- const tasks = useQueryState(api.tasks.list, { projectId });
89
- const create = useMutation(api.tasks.create);
90
- ```
91
-
92
- ## Services
93
-
94
- Every AppPort Service is enabled in `feltkit/app.ts` and stored in the same FeltDB instance:
95
- Files, Notifications, Configuration, API keys, Webhooks, Jobs, Schedules and Intelligence.
96
- Configure each one in **Studio → Services**: every service has its own screen, and each
97
- operation there is authorized as the dev user you choose with **Act as**. From a function:
98
-
99
- ```ts
100
- // Effects that announce this mutation's change: performed only if it commits (mutations only).
101
- ctx.afterCommit.webhooks.emit("task.created", { id });
102
- ctx.afterCommit.notifications.send({ recipient: "grace", type: "task.completed", title: "Done" });
103
- ctx.afterCommit.jobs.enqueue("projects.clear-completed", {});
104
- // Reads and stored files, right away:
105
- await ctx.services.files.upload({ name: "notes.txt", content: text });
106
- const greeting = await ctx.services.configuration.get("GREETING");
107
- ```
108
-
109
- Use `ctx.afterCommit` for anything that tells the world about the mutation's change. The same
110
- calls on `ctx.services` (`ctx.services.webhooks.emit`, `…notifications.send`, `…jobs.enqueue`)
111
- happen immediately and stay done even if the mutation then fails (a `CONFLICT` at commit), so
112
- receivers would hear about a change that never happened. `npx feltkit outbox list` shows every
113
- after-commit effect and its state.
114
-
115
- The starter already uses them: creating and completing a task emits `task.created` and
116
- `task.completed` to any registered webhook endpoint; completing someone else's task notifies
117
- its creator; and the job `projects.clear-completed` runs `projects:clearCompleted`.
118
-
119
- Declare what your app sends in `feltkit/app.ts`, so Studio's forms offer it in dropdowns:
120
-
121
- ```ts
122
- services: {
123
- notifications: { types: ["task.completed"] },
124
- webhooks: { events: ["task.created", "task.completed"] },
125
- jobs: { handlers: { "projects.clear-completed": "projects:clearCompleted" } },
126
- // …
127
- }
128
- ```
129
-
130
- A job type runs the mutation you name, as the user who queued it, with retries. To turn a
131
- service off, remove it from `services`.
132
-
133
- ## Connecting an API
134
-
135
- **Studio → Integrations → Connect an API** reads an OpenAPI document (JSON) or lets you
136
- describe the operations yourself, then writes `feltkit/<name>.ts` and grants `<name>.*` to the
137
- roles you choose. Each operation becomes an AppPort capability (`<name>.<operation>`) with its
138
- permission, and every call is recorded. It is called through AppPort, not from a query or
139
- mutation: by the agent (MCP tools, proposals), by other apps and scripts (`POST /appport`), and by
140
- your frontend with an AppPort request carrying the session token. To act on the result inside
141
- your app, name a mutation in the operation's `onOutcome`: it runs as the caller with the call's
142
- record when the call finishes (success or failure). The API key is
143
- stored in FeltKit's custody; in production set `<NAME>_URL` and `FELTKIT_CREDENTIAL_<NAME>`.
144
- Then narrow each operation's `output` schema in that file to what the API returns.
145
-
146
- ## Choosing a model for the agent
147
-
148
- Open **Studio → Models**, pick a provider and model, type its API key, then **Save and use**
149
- and **Test**. **Save for later** keeps more models (other providers too) under **Saved
150
- models**, each with its own key; **Use** switches the agent to one. Or from a terminal:
151
-
152
- ```bash
153
- npx feltkit model set --provider anthropic --model <model> --api-key-stdin
154
- ```
155
-
156
- The key is stored encrypted outside FeltDB (`.feltkit/development/credentials.vault`) and is
157
- never shown again. Never put a key in `feltkit/`, `src/`, tests or a committed file.
56
+ - **Everything belongs to a workspace.** Every collection is per workspace (`{ tenant: true }`): a member sees
57
+ exactly their workspace, and a removed member is refused on their next call. Roles are per workspace: owners and
58
+ admins manage people and the agent, members work, viewers read.
59
+ - **Shared, live, and safe to change together.** The screens are live queries: a change by anyone (or the agent)
60
+ re-renders every member's screen. A write that read something another member changed since is refused
61
+ (`CONFLICT`), never silently overwritten; the mission and workstreams also take the `version` you saw.
62
+ - **Evidence, not percentages.** Progress on Home is a count of records: verified findings, decisions in force,
63
+ tasks done with their result. Starter content is labelled as hypotheses and examples and cannot be verified;
64
+ only a person verifies what was found, and the record says who and when.
65
+ - **The agent works, under rules.** It is an [eve](https://www.npmjs.com/package/@appport/eve) agent that FeltKit
66
+ builds, runs and supervises (`feltkit({ eve })`); its sessions are stored in FeltDB and survive restarts. In a
67
+ workspace it is a member with the `agent` role, activated by an owner or admin. It acts only through this app's
68
+ capabilities (`agent/lib/feltkit-capabilities.json`, generated), as itself, under a grant from the person it
69
+ works with: it can never do what that person could not. Adding a task or changing a workstream's status is
70
+ `approval: "required"`: the agent pauses (durably), any member who may make that change approves the exact call,
71
+ and AppPort records the approval.
72
+ - **Change behaviour in the dashboard, not the code.** Studio (the Dashboard link `npm run dev` prints) is where
73
+ an operator configures the environment: Services → Configuration holds variables (Crew reads `AGENT_GUIDANCE`,
74
+ standing instructions the agent follows from its next turn), Models picks the provider and model for FeltKit's
75
+ own agent features, and Credentials keeps keys in FeltKit's custody. None of it needs a code change or a
76
+ redeploy. Operators hold the app-level `operator` role (Ada in development; `npx feltkit operator grant` in
77
+ production); workspace owners cannot change the whole environment.
78
+ - **History is recorded as it happens.** The timeline is the workspace's audit trail (`app.auditTrail`) and
79
+ Boards' event log, written in the same transaction as each change.
158
80
 
159
81
  ## Testing
160
82
 
@@ -162,13 +84,12 @@ never shown again. Never put a key in `feltkit/`, `src/`, tests or a committed f
162
84
  npm test
163
85
  ```
164
86
 
165
- runs `tests/**/*.test.ts`. Each `createTestApp()` gets its own temporary FeltDB instance,
166
- and `t.as("ada")` calls functions as a dev user:
87
+ runs `tests/**/*.test.ts`. Each `createTestApp()` gets its own temporary FeltDB instance:
167
88
 
168
89
  ```ts
169
90
  const t = await createTestApp();
170
- const projectId = await t.as("ada").mutation(api.projects.create, { name: "Launch" });
171
- await assert.rejects(t.as("grace").mutation(api.tasks.create, { projectId, title: "x" }), { code: "FORBIDDEN" });
91
+ const { id: tenant } = await t.provisionTenant("Launch", { id: "ada", roles: ["person"] });
92
+ await t.as("ada", { tenant }).mutation(api.workspace.setup, { title: "Launch", outcome: "…", template: "blank" });
172
93
  await t.close();
173
94
  ```
174
95
 
@@ -231,7 +152,7 @@ without their FeltDB settings.
231
152
  --runtime-scopes minimal`), put `FELTDB_URL`, `FELTDB_APPLICATION_ID` and `FELTDB_TOKEN` in
232
153
  `.feltkit/deploy/.env`, then run the same `docker compose` command. With your own FeltDB
233
154
  server (`--target self-hosted`), create a key for the app's namespace (`feltdb-server keys
234
- create --keys <keys.json> --name tasks --namespace tasks --scope state:read,state:write`) and
155
+ create --keys <keys.json> --name crew --namespace crew --scope state:read,state:write`) and
235
156
  put `FELTDB_URL` and `FELTDB_TOKEN` in `.env`. On Vercel (`--target vercel`), create the app in
236
157
  Managed FeltDB (`npx feltdb init-managed --contract .feltkit/deploy/feltdb.contract.json
237
158
  --runtime-scopes minimal`, which writes `.env.local`), then run `npx feltkit vercel deploy`. It links
@@ -244,31 +165,20 @@ without their FeltDB settings.
244
165
 
245
166
  Open <http://localhost:3000>.
246
167
 
247
- 4. **Sign in.** Production has no development sign-in (Ada and Grace are for development). The
248
- app has built-in accounts (`auth: { accounts: { roles: ["member"] } }` in `feltkit/app.ts`):
249
- open it and create your account with an e-mail address and a password; anyone you share the
250
- link with can do the same, and a new account is a member. Passwords are stored only as a
251
- scrypt hash, in the app's own FeltDB. To close sign-up once your people have accounts, set
252
- `signUp: false`. To give someone admin, or to use your own login instead, see
253
- `auth.authenticate` and production Studio below.
254
-
255
- The sign-in screen grows with configuration: add `email: { from: "auth@yourdomain" }` to
256
- `auth.accounts` for "Forgot your password?" and address verification (development prints each
257
- e-mail; production sends through your Mailerport service, `MAILPORT_URL` and
258
- `MAILPORT_API_KEY`), and `auth.providers` for "Continue with Google / GitHub" (client id in
259
- `feltkit/app.ts`, client secret as `FELTKIT_CREDENTIAL_<ID>_CLIENT_SECRET`).
260
-
261
- **On AppBoundry** (`npx feltkit build --target appboundry`, then
262
- `npx @appport/appboundry@^1.3.0 run tasks.app`; to test the artifact itself, use
263
- `createArtifactTestApp("tasks.app")` from `@feltdb/feltkit/testing`), AppBoundry's operators
264
- create users with your app's roles and issue their sessions:
168
+ 4. **Sign in.** Production has no development sign-in (Ada and Lin are for development). Anyone can create an
169
+ account (`auth.accounts` in `feltkit/app.ts`); an account is a `person`, and what a person may do comes from
170
+ their role in each workspace: whoever creates a workspace owns it, and owners and admins invite others as
171
+ admin, member or viewer. Passwords are stored only as a scrypt hash, in the app's own FeltDB. To close
172
+ sign-up, set `signUp: false`; to use your own login instead, see `auth.authenticate`.
265
173
 
266
- ```bash
267
- appboundry admin users add you --role member --state <installation>
268
- appboundry admin sessions issue --user you --state <installation>
269
- ```
174
+ Sign-in in production: e-mail and password, and GitHub or Google through FeltKit's sign-in broker, work as
175
+ they are. The e-mailed link and code appear once mail can be delivered: set `MAILPORT_URL` (and
176
+ `MAILPORT_API_KEY`) for your Mailerport service, and `CREW_MAIL_FROM` for the sender.
270
177
 
271
- See AppBoundry's production operations guide for bootstrapping the first operator.
178
+ The agent runs in the same container, supervised by FeltKit, with its sessions under the same state
179
+ volume. Give it its model key (`AI_GATEWAY_API_KEY` for the default model), or set
180
+ `CREW_AGENT_MODEL=deterministic` to run the scripted test model. Crew does not build for AppBoundry: its
181
+ agent, Boards and presence need the FeltKit server.
272
182
 
273
183
  Operators and scripts can still get a session token without an account:
274
184
  `npx feltkit session create --env production --type user --id <id> --role <role>` in the
@@ -277,7 +187,7 @@ without their FeltDB settings.
277
187
  is stopped:
278
188
 
279
189
  ```bash
280
- docker run --rm -v tasks-data:/data tasks node node_modules/@feltdb/feltkit/bin/feltkit.js session create --env production --type user --id you --role member
190
+ docker run --rm -v crew-data:/data crew node node_modules/@feltdb/feltkit/bin/feltkit.js session create --env production --type user --id you --role person
281
191
  ```
282
192
 
283
193
  5. **Manage it.** On Vercel, production Studio is on (at `/_feltkit/` of your app). Run
@@ -309,21 +219,6 @@ To move non-secret configuration between environments, use
309
219
  To deploy on Managed FeltDB, where no host keeps state, start from
310
220
  `npm create feltkit@latest <dir> -- --template managed`; its README walks through setup.
311
221
 
312
- ## Portability (AppBoundry)
313
-
314
- `npx feltkit build --target appboundry` compiles the app into `tasks.app`, which runs without
315
- this project or FeltKit. A plain `npx feltkit build` warns about anything that would block it.
316
- An artifact refuses (the build names the file and line):
317
-
318
- - `ctx.agent`, `ctx.unsafe`, `ctx.afterCommit`, `ctx.db.sequence`: they need the FeltKit server;
319
- - `app.integration(...)` and `auth.authenticate`;
320
- - Node built-ins in `feltkit/`;
321
- - `Intl`, `toLocaleString`, `localeCompare`: the artifact has no locale data, so format for
322
- people in the frontend.
323
-
324
- It also leaves out Studio, `/mcp`, API keys, schedules and webhook delivery. To run your tests
325
- against the artifact itself: `createArtifactTestApp("tasks.app")` from `@feltdb/feltkit/testing`.
326
-
327
222
  ## Commands
328
223
 
329
224
  npm scripts:
@@ -10,3 +10,7 @@ dist/
10
10
  !.env.example
11
11
  .feltdb/
12
12
  *.app/
13
+
14
+ # eve: the agent build and its local state
15
+ .output/
16
+ .eve/
@@ -0,0 +1,28 @@
1
+ import { defineAgent } from "eve";
2
+ import { defineDynamic } from "eve/models";
3
+ import { feltkitControl } from "@feltdb/feltkit/agent";
4
+ import { deterministicModel } from "./lib/deterministic";
5
+
6
+ // The workspace agent. Its sessions are stored in FeltDB through the FeltDB World, under this application's
7
+ // state (FeltKit sets EVE_FELTDB_PATH when it runs the agent). It has no shell or sandbox: it reads the web and
8
+ // works on the workspace only through the application's capabilities (agent/tools/crew_*.ts).
9
+ //
10
+ // The model goes through Vercel AI Gateway (AI_GATEWAY_API_KEY); change it here, eve accepts any AI SDK model.
11
+ // CREW_AGENT_MODEL=deterministic runs a scripted test model instead (agent/lib/deterministic.ts): the same
12
+ // tools, authorization, approvals and storage, with the model's choices fixed, for tests, CI and demos without
13
+ // a model key. What it records says so.
14
+ const MODEL = "openai/gpt-5-mini";
15
+
16
+ export default defineAgent({
17
+ model: defineDynamic(async () =>
18
+ process.env.CREW_AGENT_MODEL === "deterministic"
19
+ ? { model: deterministicModel, modelContextWindowTokens: 1_000_000 }
20
+ : { model: process.env.CREW_AGENT_MODEL || MODEL },
21
+ ),
22
+ defaultTools: false,
23
+ // People steer the agent (pause, resume, interrupt, stop, updates) through FeltKit, over HTTP, AppPort and MCP.
24
+ control: feltkitControl(),
25
+ // Sessions are evidence: ending one stops it, and its history (what was asked, done and decided) stays in this
26
+ // application's FeltDB. Without "default", private sessions are deleted when they end.
27
+ experimental: { workflow: { world: "@appport/eve-world-feltdb", retention: "default" } },
28
+ });
@@ -0,0 +1,6 @@
1
+ import { eveChannel } from "eve/channels/eve";
2
+ import { feltkitAuth } from "@feltdb/feltkit/eve";
3
+
4
+ // Only people FeltKit has signed in reach this agent, through the application (/eve/crew/…), each with their
5
+ // workspace and a work grant. There is no other way in.
6
+ export default eveChannel({ auth: [feltkitAuth()] });
@@ -0,0 +1,24 @@
1
+ You are the Crew agent: a member of a shared workspace where people work toward a mission. Several people
2
+ work here; any of them may talk to you, and everything you record is visible to all of them.
3
+
4
+ How you work:
5
+ - The overview's `guidance` is the operator's standing instruction for you (set in the application's dashboard).
6
+ Follow it in everything you do, and say so when it changes what you would otherwise do.
7
+ - Start by reading the workspace (`crew_workspace_overview`) so you know the mission, the workstreams and what
8
+ needs attention. Search the workspace's context (`crew_context_search`) before researching something it may
9
+ already know.
10
+ - Research with `web_search` and `web_fetch`. Record what you learn with `crew_context_record`: one finding per
11
+ record, a specific title, the facts with numbers where you have them, and the source URL. Say plainly when a
12
+ source is weak or old.
13
+ - Never present a hypothesis, an example or your own estimate as verified. Only a person verifies evidence.
14
+ Starter content in the workspace is hypotheses and examples, not evidence.
15
+ - Write longer outputs (a brief, an interview guide, a comparison) as an artifact (`crew_artifacts_create`) and
16
+ say what it is for.
17
+ - When a question needs a decision, propose it (`crew_decisions_propose`) with your recommendation, rationale,
18
+ alternatives and the context items that support it. People decide.
19
+ - To change the plan, add a task (`crew_tasks_add`) or change a workstream's status (`crew_workstreams_update`).
20
+ A person approves these before they happen; say why you are asking.
21
+ - Note progress on the task you worked on (`crew_tasks_note`).
22
+ - If a tool is refused, say what was refused and why; do not try to work around it.
23
+
24
+ Answer briefly: what you did, what you found (with the records you created), and the next step you recommend.
@@ -0,0 +1,46 @@
1
+ import { mockModel } from "eve/evals";
2
+
3
+ /**
4
+ * A scripted model for deterministic runs (CREW_AGENT_MODEL=deterministic). It makes the same choices every
5
+ * time, through the agent's real tools, so a run exercises everything except reasoning: FeltKit's authorization,
6
+ * the person's work grant, the approval of an exact call, durable pauses and FeltDB storage. On a session's
7
+ * first turn it reads the workspace, records one finding (labelled as test output, never research), and asks to
8
+ * add a task to the first workstream, which waits for a person's approval. Afterwards it reports what it did.
9
+ */
10
+ type Overview = { workstreams?: Array<{ id: string; name: string }>; guidance?: string | null };
11
+
12
+ export const deterministicModel = mockModel({
13
+ modelId: "crew-deterministic",
14
+ provider: "crew",
15
+ respond: ({ toolResults }) => {
16
+ const done = (name: string) => toolResults.find((r) => r.name === name);
17
+ const overview = done("crew_workspace_overview");
18
+ if (!overview) return { toolCalls: [{ name: "crew_workspace_overview", input: {} }] };
19
+ const first = (overview.output as Overview).workstreams?.[0];
20
+ if (!first) return "This workspace has no workstreams yet. Set up the workspace, then ask me again.";
21
+ if (!done("crew_context_record")) {
22
+ return {
23
+ toolCalls: [
24
+ {
25
+ name: "crew_context_record",
26
+ input: {
27
+ kind: "finding",
28
+ title: `Deterministic run: starting point for ${first.name}`,
29
+ body: `Recorded by Crew's deterministic test model, not by research. Next step for ${first.name}: list who you believe the customer is, then interview five of them about the last time the problem came up.`,
30
+ workstreamId: first.id,
31
+ },
32
+ },
33
+ ],
34
+ };
35
+ }
36
+ const added = done("crew_tasks_add");
37
+ if (!added) {
38
+ return { toolCalls: [{ name: "crew_tasks_add", input: { workstreamId: first.id, title: "Interview five target customers", details: "Ask about the last time the problem came up, what they did, and what it cost." } }] };
39
+ }
40
+ const guidance = (overview.output as Overview).guidance;
41
+ const note = guidance ? ` Guidance applied: ${guidance}` : "";
42
+ return added.isError
43
+ ? `I recorded a starting point for ${first.name}. Adding the interview task was not approved, so the plan is unchanged.${note}`
44
+ : `I recorded a starting point for ${first.name} and added "Interview five target customers" to its plan, as approved.${note}`;
45
+ },
46
+ });