create-feltkit 0.3.37 → 0.5.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/bin/create.js +3 -3
- package/package.json +4 -4
- package/scaffold.d.ts +1 -1
- package/scaffold.js +8 -5
- package/template/README.md +72 -177
- package/template/_gitignore +4 -0
- package/template/agent/agent.ts +28 -0
- package/template/agent/channels/eve.ts +6 -0
- package/template/agent/instructions.md +24 -0
- package/template/agent/lib/deterministic.ts +46 -0
- package/template/agent/lib/feltkit-capabilities.json +294 -0
- package/template/agent/tools/crew_artifacts_create.ts +4 -0
- package/template/agent/tools/crew_context_read.ts +4 -0
- package/template/agent/tools/crew_context_record.ts +4 -0
- package/template/agent/tools/crew_context_search.ts +4 -0
- package/template/agent/tools/crew_decisions_propose.ts +4 -0
- package/template/agent/tools/crew_tasks_add.ts +6 -0
- package/template/agent/tools/crew_tasks_list.ts +4 -0
- package/template/agent/tools/crew_tasks_note.ts +4 -0
- package/template/agent/tools/crew_workspace_overview.ts +4 -0
- package/template/agent/tools/crew_workstreams_update.ts +6 -0
- package/template/agent/tools/web_fetch.ts +1 -0
- package/template/agent/tools/web_search.ts +3 -0
- package/template/feltkit/_generated/api.ts +8 -4
- package/template/feltkit/activity.ts +26 -0
- package/template/feltkit/app.ts +147 -54
- package/template/feltkit/boards.ts +10 -0
- package/template/feltkit/decisions.ts +99 -0
- package/template/feltkit/knowledge.ts +119 -0
- package/template/feltkit/model.ts +96 -0
- package/template/feltkit/work.ts +45 -0
- package/template/feltkit/workspace.ts +171 -0
- package/template/index.html +1 -1
- package/template/native/App.tsx +249 -0
- package/template/package.json +11 -5
- package/template/shared/rules.ts +23 -0
- package/template/src/App.tsx +177 -528
- package/template/src/screens/activity.tsx +66 -0
- package/template/src/screens/agent.tsx +188 -0
- package/template/src/screens/context.tsx +71 -0
- package/template/src/screens/decisions.tsx +89 -0
- package/template/src/screens/home.tsx +140 -0
- package/template/src/screens/team.tsx +13 -0
- package/template/src/screens/work.tsx +149 -0
- package/template/src/styles.css +201 -118
- package/template/src/ui.tsx +179 -0
- package/template/tests/crew.test.ts +111 -0
- package/template/tsconfig.json +18 -3
- package/template-managed/Dockerfile +2 -2
- package/template-managed/README.md +1 -1
- package/template-managed/package.json +3 -3
- package/template-tasks/README.md +383 -0
- package/template-tasks/_gitignore +12 -0
- package/template-tasks/feltkit/_generated/api.ts +10 -0
- package/template-tasks/feltkit/app.ts +73 -0
- package/template-tasks/index.html +17 -0
- package/template-tasks/native/App.tsx +220 -0
- package/template-tasks/native/native.json +5 -0
- package/template-tasks/package.json +30 -0
- package/template-tasks/public/apple-touch-icon.png +0 -0
- package/template-tasks/public/favicon.png +0 -0
- package/template-tasks/public/theme.js +7 -0
- package/template-tasks/shared/rules.ts +18 -0
- package/template-tasks/src/App.tsx +557 -0
- package/template-tasks/src/main.tsx +17 -0
- package/template-tasks/src/styles.css +134 -0
- package/template-tasks/src/theme.tsx +58 -0
- package/template-tasks/tsconfig.json +16 -0
- package/template-tasks/vite.config.ts +6 -0
- /package/{template → template-tasks}/feltkit/inbox.ts +0 -0
- /package/{template → template-tasks}/feltkit/projects.ts +0 -0
- /package/{template → template-tasks}/feltkit/tasks.ts +0 -0
- /package/{template → template-tasks}/public/feltkit-mark.png +0 -0
- /package/{template → template-tasks}/tests/tasks.test.ts +0 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
{
|
|
2
|
+
"crew.artifacts.create": {
|
|
3
|
+
"capability": "crew.artifacts.create",
|
|
4
|
+
"tool": "crew_artifacts_create",
|
|
5
|
+
"description": "Create a document artifact (Markdown, text or CSV) such as a plan, brief, guide or analysis, stored as a file in the workspace with a summary.",
|
|
6
|
+
"inputSchema": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"title": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"minLength": 1,
|
|
12
|
+
"maxLength": 160
|
|
13
|
+
},
|
|
14
|
+
"filename": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"minLength": 1,
|
|
17
|
+
"maxLength": 120,
|
|
18
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9 ._-]*\\.(md|txt|csv)$"
|
|
19
|
+
},
|
|
20
|
+
"content": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"minLength": 1,
|
|
23
|
+
"maxLength": 200000
|
|
24
|
+
},
|
|
25
|
+
"summary": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"minLength": 1,
|
|
28
|
+
"maxLength": 2000
|
|
29
|
+
},
|
|
30
|
+
"workstreamId": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"additionalProperties": false,
|
|
35
|
+
"required": [
|
|
36
|
+
"title",
|
|
37
|
+
"filename",
|
|
38
|
+
"content",
|
|
39
|
+
"summary"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"approval": "none"
|
|
43
|
+
},
|
|
44
|
+
"crew.context.read": {
|
|
45
|
+
"capability": "crew.context.read",
|
|
46
|
+
"tool": "crew_context_read",
|
|
47
|
+
"description": "Read one context item in full: its text, source, standing and links.",
|
|
48
|
+
"inputSchema": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"properties": {
|
|
51
|
+
"id": {
|
|
52
|
+
"type": "string"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"additionalProperties": false,
|
|
56
|
+
"required": [
|
|
57
|
+
"id"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"approval": "none"
|
|
61
|
+
},
|
|
62
|
+
"crew.context.record": {
|
|
63
|
+
"capability": "crew.context.record",
|
|
64
|
+
"tool": "crew_context_record",
|
|
65
|
+
"description": "Record a finding, research, reference, note or progress report in the workspace's shared context. Name the source URL for external information. It is stored as unverified until a person verifies it.",
|
|
66
|
+
"inputSchema": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"properties": {
|
|
69
|
+
"kind": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"enum": [
|
|
72
|
+
"note",
|
|
73
|
+
"finding",
|
|
74
|
+
"research",
|
|
75
|
+
"reference",
|
|
76
|
+
"report"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"title": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"minLength": 1,
|
|
82
|
+
"maxLength": 160
|
|
83
|
+
},
|
|
84
|
+
"body": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"minLength": 1,
|
|
87
|
+
"maxLength": 20000
|
|
88
|
+
},
|
|
89
|
+
"url": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"maxLength": 2000
|
|
92
|
+
},
|
|
93
|
+
"workstreamId": {
|
|
94
|
+
"type": "string"
|
|
95
|
+
},
|
|
96
|
+
"threadId": {
|
|
97
|
+
"type": "string"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"additionalProperties": false,
|
|
101
|
+
"required": [
|
|
102
|
+
"kind",
|
|
103
|
+
"title",
|
|
104
|
+
"body"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"approval": "none"
|
|
108
|
+
},
|
|
109
|
+
"crew.context.search": {
|
|
110
|
+
"capability": "crew.context.search",
|
|
111
|
+
"tool": "crew_context_search",
|
|
112
|
+
"description": "Search the workspace's context (notes, research, findings, references, reports, artifacts) by text. Each result says its source and whether it is a hypothesis, unverified, or verified.",
|
|
113
|
+
"inputSchema": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"properties": {
|
|
116
|
+
"text": {
|
|
117
|
+
"type": "string",
|
|
118
|
+
"minLength": 1,
|
|
119
|
+
"maxLength": 200
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"additionalProperties": false,
|
|
123
|
+
"required": [
|
|
124
|
+
"text"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"approval": "none"
|
|
128
|
+
},
|
|
129
|
+
"crew.decisions.propose": {
|
|
130
|
+
"capability": "crew.decisions.propose",
|
|
131
|
+
"tool": "crew_decisions_propose",
|
|
132
|
+
"description": "Propose a decision for the workspace: the question, your recommendation, the rationale, alternatives considered, and context items as evidence. A person decides it.",
|
|
133
|
+
"inputSchema": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"properties": {
|
|
136
|
+
"question": {
|
|
137
|
+
"type": "string",
|
|
138
|
+
"minLength": 1,
|
|
139
|
+
"maxLength": 300
|
|
140
|
+
},
|
|
141
|
+
"recommendation": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"maxLength": 2000
|
|
144
|
+
},
|
|
145
|
+
"rationale": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"maxLength": 4000
|
|
148
|
+
},
|
|
149
|
+
"alternatives": {
|
|
150
|
+
"type": "array",
|
|
151
|
+
"items": {
|
|
152
|
+
"type": "string",
|
|
153
|
+
"maxLength": 400
|
|
154
|
+
},
|
|
155
|
+
"maxItems": 10
|
|
156
|
+
},
|
|
157
|
+
"evidence": {
|
|
158
|
+
"type": "array",
|
|
159
|
+
"items": {
|
|
160
|
+
"type": "string"
|
|
161
|
+
},
|
|
162
|
+
"maxItems": 20
|
|
163
|
+
},
|
|
164
|
+
"workstreamId": {
|
|
165
|
+
"type": "string"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"additionalProperties": false,
|
|
169
|
+
"required": [
|
|
170
|
+
"question"
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
"approval": "none"
|
|
174
|
+
},
|
|
175
|
+
"crew.tasks.add": {
|
|
176
|
+
"capability": "crew.tasks.add",
|
|
177
|
+
"tool": "crew_tasks_add",
|
|
178
|
+
"description": "Add a task to a workstream's plan. A person approves it before it is added.",
|
|
179
|
+
"inputSchema": {
|
|
180
|
+
"type": "object",
|
|
181
|
+
"properties": {
|
|
182
|
+
"workstreamId": {
|
|
183
|
+
"type": "string"
|
|
184
|
+
},
|
|
185
|
+
"title": {
|
|
186
|
+
"type": "string",
|
|
187
|
+
"minLength": 1,
|
|
188
|
+
"maxLength": 200
|
|
189
|
+
},
|
|
190
|
+
"details": {
|
|
191
|
+
"type": "string",
|
|
192
|
+
"maxLength": 4000
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"additionalProperties": false,
|
|
196
|
+
"required": [
|
|
197
|
+
"workstreamId",
|
|
198
|
+
"title"
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
"approval": "required"
|
|
202
|
+
},
|
|
203
|
+
"crew.tasks.list": {
|
|
204
|
+
"capability": "crew.tasks.list",
|
|
205
|
+
"tool": "crew_tasks_list",
|
|
206
|
+
"description": "The tasks in a workstream with their status (open, ready, blocked, claimed, in_progress, completed, failed, cancelled).",
|
|
207
|
+
"inputSchema": {
|
|
208
|
+
"type": "object",
|
|
209
|
+
"properties": {
|
|
210
|
+
"workstreamId": {
|
|
211
|
+
"type": "string"
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"additionalProperties": false,
|
|
215
|
+
"required": [
|
|
216
|
+
"workstreamId"
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
"approval": "none"
|
|
220
|
+
},
|
|
221
|
+
"crew.tasks.note": {
|
|
222
|
+
"capability": "crew.tasks.note",
|
|
223
|
+
"tool": "crew_tasks_note",
|
|
224
|
+
"description": "Post a progress note on a task: what was done, what was found, what is next.",
|
|
225
|
+
"inputSchema": {
|
|
226
|
+
"type": "object",
|
|
227
|
+
"properties": {
|
|
228
|
+
"taskId": {
|
|
229
|
+
"type": "string"
|
|
230
|
+
},
|
|
231
|
+
"text": {
|
|
232
|
+
"type": "string",
|
|
233
|
+
"minLength": 1,
|
|
234
|
+
"maxLength": 8000
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"additionalProperties": false,
|
|
238
|
+
"required": [
|
|
239
|
+
"taskId",
|
|
240
|
+
"text"
|
|
241
|
+
]
|
|
242
|
+
},
|
|
243
|
+
"approval": "none"
|
|
244
|
+
},
|
|
245
|
+
"crew.workspace.overview": {
|
|
246
|
+
"capability": "crew.workspace.overview",
|
|
247
|
+
"tool": "crew_workspace_overview",
|
|
248
|
+
"description": "The workspace: mission, stage, workstreams with status and task counts, pending decisions, recent findings, what needs attention, and the operator's standing guidance for the agent (guidance).",
|
|
249
|
+
"inputSchema": {
|
|
250
|
+
"type": "object",
|
|
251
|
+
"properties": {},
|
|
252
|
+
"additionalProperties": false
|
|
253
|
+
},
|
|
254
|
+
"approval": "none"
|
|
255
|
+
},
|
|
256
|
+
"crew.workstreams.update": {
|
|
257
|
+
"capability": "crew.workstreams.update",
|
|
258
|
+
"tool": "crew_workstreams_update",
|
|
259
|
+
"description": "Change a workstream's status (not-started, on-track, at-risk, blocked, done), with the reason. A person approves it.",
|
|
260
|
+
"inputSchema": {
|
|
261
|
+
"type": "object",
|
|
262
|
+
"properties": {
|
|
263
|
+
"workstreamId": {
|
|
264
|
+
"type": "string"
|
|
265
|
+
},
|
|
266
|
+
"status": {
|
|
267
|
+
"type": "string",
|
|
268
|
+
"enum": [
|
|
269
|
+
"not-started",
|
|
270
|
+
"on-track",
|
|
271
|
+
"at-risk",
|
|
272
|
+
"blocked",
|
|
273
|
+
"done"
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
"note": {
|
|
277
|
+
"type": "string",
|
|
278
|
+
"minLength": 1,
|
|
279
|
+
"maxLength": 1000
|
|
280
|
+
},
|
|
281
|
+
"version": {
|
|
282
|
+
"type": "number"
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
"additionalProperties": false,
|
|
286
|
+
"required": [
|
|
287
|
+
"workstreamId",
|
|
288
|
+
"status",
|
|
289
|
+
"note"
|
|
290
|
+
]
|
|
291
|
+
},
|
|
292
|
+
"approval": "required"
|
|
293
|
+
}
|
|
294
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { feltkitCapability } from "@feltdb/feltkit/eve";
|
|
2
|
+
import capabilities from "../lib/feltkit-capabilities.json" with { type: "json" };
|
|
3
|
+
|
|
4
|
+
export default feltkitCapability(capabilities["crew.tasks.add"], {
|
|
5
|
+
prompt: (input) => `Add the task "${String(input.title)}" to the plan?`,
|
|
6
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { feltkitCapability } from "@feltdb/feltkit/eve";
|
|
2
|
+
import capabilities from "../lib/feltkit-capabilities.json" with { type: "json" };
|
|
3
|
+
|
|
4
|
+
export default feltkitCapability(capabilities["crew.workstreams.update"], {
|
|
5
|
+
prompt: (input) => `Mark the workstream ${String(input.status)}? ${String(input.note ?? "")}`.trim(),
|
|
6
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "eve/tools/web_fetch";
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/* Generated by `feltkit dev` / `feltkit codegen`. Do not edit; it is rewritten when feltkit/ changes. */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
import { createApi } from "@feltdb/feltkit/client";
|
|
4
|
+
import type * as activity_module from "../activity.js";
|
|
4
5
|
import type * as app_module from "../app.js";
|
|
5
|
-
import type * as
|
|
6
|
-
import type * as
|
|
7
|
-
import type * as
|
|
6
|
+
import type * as boards_module from "../boards.js";
|
|
7
|
+
import type * as decisions_module from "../decisions.js";
|
|
8
|
+
import type * as knowledge_module from "../knowledge.js";
|
|
9
|
+
import type * as model_module from "../model.js";
|
|
10
|
+
import type * as work_module from "../work.js";
|
|
11
|
+
import type * as workspace_module from "../workspace.js";
|
|
8
12
|
|
|
9
13
|
/** Typed references to every query and mutation. Type-only imports: no backend code reaches the browser. */
|
|
10
|
-
export const api = createApi<{ "app": typeof app_module; "
|
|
14
|
+
export const api = createApi<{ "activity": typeof activity_module; "app": typeof app_module; "boards": typeof boards_module; "decisions": typeof decisions_module; "knowledge": typeof knowledge_module; "model": typeof model_module; "work": typeof work_module; "workspace": typeof workspace_module }>();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workspace's timeline: its own history (app.auditTrail: missions, context, decisions, workstreams, the
|
|
3
|
+
* agent's contributions) and its work's history (Boards: tasks created, claimed, started, completed, messages,
|
|
4
|
+
* follow-ups), merged newest first. Each entry is a record FeltKit or Boards wrote when the change committed;
|
|
5
|
+
* nothing here is composed after the fact.
|
|
6
|
+
*/
|
|
7
|
+
import { s } from "@feltdb/feltkit";
|
|
8
|
+
import { app, missions, trail } from "./app.js";
|
|
9
|
+
import { boards } from "./boards.js";
|
|
10
|
+
|
|
11
|
+
export const timeline = app.query({
|
|
12
|
+
access: "crew.read",
|
|
13
|
+
args: { limit: s.optional(s.integer({ minimum: 1, maximum: 200 })) },
|
|
14
|
+
handler: async (ctx, { limit }) => {
|
|
15
|
+
const [m] = await ctx.db.find(missions, {}, { limit: 1 });
|
|
16
|
+
if (!m) return [];
|
|
17
|
+
const take = limit ?? 60;
|
|
18
|
+
const own = (await trail.history(ctx, "workspace", m.id, { limit: take })) as Array<{ type: string; actor: string; actorType: string; at: string | number; seq: number; data?: Record<string, unknown> }>;
|
|
19
|
+
const work = (await boards.run(ctx, "activity", { boardId: m.boardId, limit: take })) as Array<{ id: string; type: string; at: number; actor?: { id: string; type: string; name?: string }; threadId?: string; data?: Record<string, unknown> }>;
|
|
20
|
+
const entries = [
|
|
21
|
+
...own.map((e) => ({ id: `w${e.seq}`, origin: "workspace", type: e.type, at: typeof e.at === "number" ? e.at : Date.parse(e.at), actor: { id: e.actor, type: e.actorType }, data: e.data ?? {} })),
|
|
22
|
+
...work.map((e) => ({ id: `b${e.id}`, origin: "work", type: e.type, at: e.at, actor: e.actor ?? { id: "system", type: "system" }, data: { ...(e.data ?? {}), ...(e.threadId ? { threadId: e.threadId } : {}) } })),
|
|
23
|
+
];
|
|
24
|
+
return entries.sort((a, b) => b.at - a.at).slice(0, take);
|
|
25
|
+
},
|
|
26
|
+
});
|
package/template/feltkit/app.ts
CHANGED
|
@@ -1,73 +1,166 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Crew: a shared workspace where people and an agent work toward an outcome.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* What FeltKit gives this application, and where each piece lives:
|
|
5
|
+
* - Workspaces, members, roles, invitations auth.tenant (every crew collection is per workspace)
|
|
6
|
+
* - Workstreams, tasks, discussions, claims,
|
|
7
|
+
* dependencies, follow-ups, work history FeltKit Boards (feltkit/work.ts), one open board per workspace
|
|
8
|
+
* - Mission, context, decisions, activity this file's collections, and app.auditTrail
|
|
9
|
+
* - The workspace agent an eve agent (agent/), run and supervised by FeltKit, acting
|
|
10
|
+
* only through the capabilities below, as a workspace member,
|
|
11
|
+
* under the person's work grant, with approvals of exact calls
|
|
12
|
+
* - Durable background work the agent's sessions (eve, stored in FeltDB) and AppPort
|
|
13
|
+
* Services jobs (follow-ups and reminders)
|
|
14
|
+
*
|
|
15
|
+
* Everything is stored in this application's FeltDB instance (.feltkit/<environment>/state; the agent's sessions
|
|
16
|
+
* under .feltkit/<environment>/eve). `npx feltkit inspect` shows it.
|
|
6
17
|
*/
|
|
7
18
|
import { feltkit, s } from "@feltdb/feltkit";
|
|
8
19
|
|
|
20
|
+
/** Account e-mail (sign-in links and codes) where it can be delivered: development's local inbox, or a transport. */
|
|
21
|
+
const MAIL = Boolean(process.env.MAILPORT_URL) || process.env.NODE_ENV !== "production";
|
|
22
|
+
|
|
9
23
|
export const app = feltkit({
|
|
10
|
-
name: "
|
|
11
|
-
description: "A
|
|
12
|
-
// Roles grant AppPort permissions. "tasks.*" grants every tasks.<x> permission.
|
|
24
|
+
name: "crew",
|
|
25
|
+
description: "A shared workspace where people and agents get things done together.",
|
|
13
26
|
roles: {
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
// Every account: create a workspace or accept an invitation. Everything else comes with a workspace role.
|
|
28
|
+
person: [],
|
|
29
|
+
// The application's operators (not a workspace role): configuration, credentials, the model and services for the
|
|
30
|
+
// whole environment, in Studio. In development, Ada; in production, `npx feltkit operator grant`.
|
|
31
|
+
operator: ["configuration.*", "credential.*", "intelligence.*", "apikeys.*", "webhooks.*", "jobs.*", "schedules.*", "files.read", "notifications.read", "feltkit.operations.*"],
|
|
32
|
+
// Workspace roles (auth.tenant.roles), highest first.
|
|
33
|
+
owner: ["crew.*", "boards.*", "tenant.*", "feltkit.agent.read", "feltkit.agent.write", "configuration.read", "feltkit.workers.write", "files.*", "notifications.*", "jobs.create", "jobs.execute"],
|
|
34
|
+
admin: ["crew.*", "boards.*", "tenant.members.manage", "feltkit.agent.read", "feltkit.agent.write", "configuration.read", "feltkit.workers.write", "files.*", "notifications.*", "jobs.create", "jobs.execute"],
|
|
35
|
+
member: ["crew.read", "configuration.read", "feltkit.agent.read", "feltkit.agent.write", "crew.write", "crew.decide", "crew.contribute", "crew.plan", "boards.read", "boards.post", "boards.work", "boards.manage", "files.*", "notifications.*", "jobs.create", "jobs.execute"],
|
|
36
|
+
viewer: ["crew.read", "configuration.read", "boards.read", "files.read", "notifications.read"],
|
|
37
|
+
// The workspace agent's role: it reads, records findings and artifacts, proposes decisions, reports progress,
|
|
38
|
+
// and (with a person's approval of the exact call) adds work and changes a workstream's status.
|
|
39
|
+
agent: ["crew.read", "configuration.read", "crew.contribute", "crew.plan", "feltkit.agent.write", "boards.read", "boards.post", "boards.work", "files.read", "files.write"],
|
|
40
|
+
},
|
|
41
|
+
auth: {
|
|
42
|
+
// People sign up and sign in with an e-mail address and a password, a one-time link or code by e-mail, or GitHub
|
|
43
|
+
// or Google through FeltKit's sign-in broker (no OAuth app to register, no client secret to keep). An account is
|
|
44
|
+
// a person; what they may do comes from their role in each workspace. In development, e-mail goes to a local
|
|
45
|
+
// inbox that `feltkit dev` prints; in production the e-mail options appear once a mail transport is set
|
|
46
|
+
// (MAILPORT_URL, CREW_MAIL_FROM; docs: AUTH.md), so a first deploy needs no mail service.
|
|
47
|
+
accounts: { roles: ["person"], ...(MAIL ? { magicLink: true, email: { from: process.env.CREW_MAIL_FROM ?? "crew@example.com" } } : {}) },
|
|
48
|
+
providers: { github: { broker: true }, google: { broker: true } },
|
|
49
|
+
tenant: { name: "workspace", roles: ["owner", "admin", "member", "viewer", "agent"], create: "anyone", invitations: { ttlMs: 7 * 24 * 3_600_000 } },
|
|
29
50
|
},
|
|
30
|
-
// People sign up and sign in with an e-mail address and a password (stored in this app's FeltDB;
|
|
31
|
-
// only a hash of the password). A new account is a member.
|
|
32
|
-
auth: { accounts: { roles: ["member"] } },
|
|
33
|
-
// Development-only identities. Sign in as them from the app or the dashboard.
|
|
34
51
|
dev: {
|
|
35
52
|
users: [
|
|
36
|
-
{ id: "ada", name: "Ada Lovelace", roles: ["
|
|
37
|
-
{ id: "
|
|
53
|
+
{ id: "ada", name: "Ada Lovelace", roles: ["person", "operator"] },
|
|
54
|
+
{ id: "lin", name: "Lin Chen", roles: ["person"] },
|
|
38
55
|
],
|
|
39
56
|
},
|
|
40
|
-
// AppPort Services, stored in this app's FeltDB instance, each configured in Studio →
|
|
41
|
-
// Services. Intelligence is the model the agent decides with (Studio → Models).
|
|
42
57
|
services: {
|
|
43
|
-
files:
|
|
44
|
-
//
|
|
45
|
-
|
|
58
|
+
files: { maxBytes: 5 * 1024 * 1024 },
|
|
59
|
+
// Variables an operator changes in Studio → Services → Configuration, live, with no redeploy. Crew reads
|
|
60
|
+
// `AGENT_GUIDANCE`: standing instructions for the workspace agent (e.g. "Cite two independent sources").
|
|
46
61
|
configuration: true,
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
// The events this app emits (feltkit/tasks.ts); Studio offers them when you register an endpoint.
|
|
50
|
-
webhooks: { events: ["task.created", "task.completed"] },
|
|
51
|
-
// Job type → the mutation that runs it, as the principal that queued it, with retries.
|
|
52
|
-
jobs: { handlers: { "projects.clear-completed": "projects:clearCompleted" } },
|
|
53
|
-
schedules: true,
|
|
62
|
+
// The model Studio's own agent and any FeltKit model call use, chosen in Studio → Models (provider, model, key
|
|
63
|
+
// in FeltKit's custody), per environment, with no redeploy. The workspace agent's model is agent/agent.ts's.
|
|
54
64
|
intelligence: true,
|
|
65
|
+
notifications: { types: ["crew.decision"] },
|
|
66
|
+
jobs: { handlers: { "boards.followup": "boards:runFollowup" } },
|
|
67
|
+
},
|
|
68
|
+
// The workspace agent (agent/): an eve agent FeltKit builds and runs. In a workspace it is a member with the
|
|
69
|
+
// "agent" role, activated by an owner or admin. It can call exactly these capabilities, and only those the
|
|
70
|
+
// person working with it may call themselves.
|
|
71
|
+
eve: {
|
|
72
|
+
crew: {
|
|
73
|
+
displayName: "Crew agent",
|
|
74
|
+
roles: ["agent"],
|
|
75
|
+
tenantRole: "agent",
|
|
76
|
+
capabilities: ["crew.*"],
|
|
77
|
+
},
|
|
55
78
|
},
|
|
56
79
|
});
|
|
57
80
|
|
|
58
|
-
|
|
59
|
-
name: s.string({ minLength: 1, maxLength: 80 }),
|
|
60
|
-
createdAt: s.number(),
|
|
61
|
-
createdBy: s.string(),
|
|
62
|
-
});
|
|
81
|
+
const actor = s.object({ id: s.string(), type: s.string(), name: s.optional(s.string()) });
|
|
63
82
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
83
|
+
/** The workspace's mission: one record per workspace. */
|
|
84
|
+
export const missions = app.collection(
|
|
85
|
+
"missions",
|
|
86
|
+
{
|
|
87
|
+
title: s.string({ minLength: 1, maxLength: 120 }),
|
|
88
|
+
outcome: s.string({ minLength: 1, maxLength: 2000 }),
|
|
89
|
+
stage: s.enum(["defining", "validating", "building", "launching", "operating"]),
|
|
90
|
+
boardId: s.string(),
|
|
91
|
+
template: s.optional(s.string()),
|
|
92
|
+
createdBy: actor,
|
|
93
|
+
createdAt: s.number(),
|
|
94
|
+
updatedAt: s.number(),
|
|
95
|
+
},
|
|
96
|
+
{ tenant: true },
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
/** A workstream's outcome and health, beside its Boards channel (which holds its tasks and discussions). */
|
|
100
|
+
export const workstreams = app.collection(
|
|
101
|
+
"workstreams",
|
|
102
|
+
{
|
|
103
|
+
channelId: s.string(),
|
|
104
|
+
name: s.string({ minLength: 1, maxLength: 80 }),
|
|
105
|
+
outcome: s.string({ maxLength: 1000 }),
|
|
106
|
+
status: s.enum(["not-started", "on-track", "at-risk", "blocked", "done"]),
|
|
107
|
+
owner: s.optional(s.string()),
|
|
108
|
+
position: s.number(),
|
|
109
|
+
updatedAt: s.number(),
|
|
110
|
+
updatedBy: actor,
|
|
111
|
+
},
|
|
112
|
+
{ tenant: true, unique: [["channelId"]] },
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Shared context: what the workspace knows, and where it came from. `source` is who or what it came from;
|
|
117
|
+
* `confidence` is what it is worth: a hypothesis or an example to test, an unverified finding, or verified
|
|
118
|
+
* evidence (verified by a person, recorded with who and when).
|
|
119
|
+
*/
|
|
120
|
+
export const context = app.collection(
|
|
121
|
+
"context",
|
|
122
|
+
{
|
|
123
|
+
kind: s.enum(["note", "finding", "research", "reference", "artifact", "report"]),
|
|
124
|
+
title: s.string({ minLength: 1, maxLength: 160 }),
|
|
125
|
+
body: s.string({ maxLength: 20000 }),
|
|
126
|
+
source: s.enum(["person", "agent", "external", "starter"]),
|
|
127
|
+
confidence: s.enum(["hypothesis", "unverified", "verified"]),
|
|
128
|
+
url: s.optional(s.string({ maxLength: 2000 })),
|
|
129
|
+
fileId: s.optional(s.string()),
|
|
130
|
+
workstreamId: s.optional(s.string()),
|
|
131
|
+
threadId: s.optional(s.string()),
|
|
132
|
+
createdBy: actor,
|
|
133
|
+
createdAt: s.number(),
|
|
134
|
+
verifiedBy: s.optional(actor),
|
|
135
|
+
verifiedAt: s.optional(s.number()),
|
|
136
|
+
},
|
|
137
|
+
{ tenant: true, search: ["title", "body"], indexes: [{ fields: ["workstreamId"] }] },
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The decision log. A decision is never edited away: revisiting one records a new decision that supersedes it,
|
|
142
|
+
* and the earlier one keeps its question, answer, rationale and who decided.
|
|
143
|
+
*/
|
|
144
|
+
export const decisions = app.collection(
|
|
145
|
+
"decisions",
|
|
146
|
+
{
|
|
147
|
+
question: s.string({ minLength: 1, maxLength: 300 }),
|
|
148
|
+
status: s.enum(["proposed", "decided", "superseded", "declined"]),
|
|
149
|
+
decision: s.optional(s.string({ maxLength: 2000 })),
|
|
150
|
+
rationale: s.optional(s.string({ maxLength: 4000 })),
|
|
151
|
+
alternatives: s.array(s.string({ maxLength: 400 }), { maxItems: 10 }),
|
|
152
|
+
evidence: s.array(s.string(), { maxItems: 20 }),
|
|
153
|
+
workstreamId: s.optional(s.string()),
|
|
154
|
+
threadId: s.optional(s.string()),
|
|
155
|
+
supersedes: s.optional(s.string()),
|
|
156
|
+
supersededBy: s.optional(s.string()),
|
|
157
|
+
proposedBy: actor,
|
|
158
|
+
proposedAt: s.number(),
|
|
159
|
+
decidedBy: s.optional(actor),
|
|
160
|
+
decidedAt: s.optional(s.number()),
|
|
161
|
+
},
|
|
162
|
+
{ tenant: true, indexes: [{ fields: ["status"] }] },
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
/** The workspace's history of its own records (missions, context, decisions, the agent); Boards keeps the work's. */
|
|
166
|
+
export const trail = app.auditTrail("crew", { subjects: ["workspace"] as const, tenant: true });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workspace's work: FeltKit Boards, per workspace. Workstreams are channels; tasks and discussions are
|
|
3
|
+
* threads; claims, dependencies, progress, results, follow-ups and the work's history are Boards'. Every
|
|
4
|
+
* operation is a function `boards:<op>` (the browser calls them through `api.boards`), and the agent-facing ones
|
|
5
|
+
* are AppPort capabilities `boards.*`. docs: node_modules/@feltdb/feltkit/docs/BOARDS.md.
|
|
6
|
+
*/
|
|
7
|
+
import { defineBoards } from "@feltdb/feltkit/boards";
|
|
8
|
+
import { app } from "./app.js";
|
|
9
|
+
|
|
10
|
+
export const boards = defineBoards(app, { tenant: true, claimTtlMs: 30 * 60_000 });
|