@feltdb/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.
Files changed (184) hide show
  1. package/dist/agent-engine.d.ts +93 -0
  2. package/dist/agent-engine.js +40 -0
  3. package/dist/agent-engine.js.map +1 -0
  4. package/dist/app.d.ts +306 -7
  5. package/dist/app.js +289 -28
  6. package/dist/app.js.map +1 -1
  7. package/dist/appboundry/build.d.ts +7 -0
  8. package/dist/appboundry/build.js +25 -1
  9. package/dist/appboundry/build.js.map +1 -1
  10. package/dist/appboundry/guest.js +8 -0
  11. package/dist/appboundry/guest.js.map +1 -1
  12. package/dist/appboundry/host.d.ts +21 -0
  13. package/dist/appboundry/host.js +25 -0
  14. package/dist/appboundry/host.js.map +1 -1
  15. package/dist/appboundry/runtime.js +1 -0
  16. package/dist/appboundry/runtime.js.map +1 -1
  17. package/dist/boards/index.d.ts +1258 -0
  18. package/dist/boards/index.js +1410 -0
  19. package/dist/boards/index.js.map +1 -0
  20. package/dist/boards/model.d.ts +177 -0
  21. package/dist/boards/model.js +177 -0
  22. package/dist/boards/model.js.map +1 -0
  23. package/dist/boards/react.d.ts +18 -0
  24. package/dist/boards/react.js +339 -0
  25. package/dist/boards/react.js.map +1 -0
  26. package/dist/cli/deploy-appboundry-self-hosted.js +2 -2
  27. package/dist/cli/deploy.js +19 -6
  28. package/dist/cli/deploy.js.map +1 -1
  29. package/dist/cli/main.js +70 -5
  30. package/dist/cli/main.js.map +1 -1
  31. package/dist/client/index.d.ts +454 -4
  32. package/dist/client/index.js +371 -3
  33. package/dist/client/index.js.map +1 -1
  34. package/dist/clock.d.ts +24 -0
  35. package/dist/clock.js +49 -0
  36. package/dist/clock.js.map +1 -0
  37. package/dist/cron.d.ts +18 -0
  38. package/dist/cron.js +67 -0
  39. package/dist/cron.js.map +1 -0
  40. package/dist/dashboard/assets/index-iIj7SL77.js +15 -0
  41. package/dist/dashboard/index.html +1 -1
  42. package/dist/docs.d.ts +1 -1
  43. package/dist/docs.js +4 -0
  44. package/dist/docs.js.map +1 -1
  45. package/dist/eve/index.d.ts +77 -0
  46. package/dist/eve/index.js +128 -0
  47. package/dist/eve/index.js.map +1 -0
  48. package/dist/event-stage.js +2 -0
  49. package/dist/event-stage.js.map +1 -1
  50. package/dist/index.d.ts +17 -2
  51. package/dist/index.js +3 -1
  52. package/dist/index.js.map +1 -1
  53. package/dist/native/build.d.ts +112 -0
  54. package/dist/native/build.js +472 -0
  55. package/dist/native/build.js.map +1 -0
  56. package/dist/native/index.d.ts +67 -0
  57. package/dist/native/index.js +113 -0
  58. package/dist/native/index.js.map +1 -0
  59. package/dist/native/instance.d.ts +3 -0
  60. package/dist/native/instance.js +18 -0
  61. package/dist/native/instance.js.map +1 -0
  62. package/dist/policy.d.ts +9 -1
  63. package/dist/policy.js +16 -3
  64. package/dist/policy.js.map +1 -1
  65. package/dist/presence.d.ts +85 -0
  66. package/dist/presence.js +37 -0
  67. package/dist/presence.js.map +1 -0
  68. package/dist/quota.d.ts +72 -0
  69. package/dist/quota.js +143 -0
  70. package/dist/quota.js.map +1 -0
  71. package/dist/react/agent-control.d.ts +191 -0
  72. package/dist/react/agent-control.js +366 -0
  73. package/dist/react/agent-control.js.map +1 -0
  74. package/dist/react/auth.d.ts +15 -1
  75. package/dist/react/auth.js +28 -5
  76. package/dist/react/auth.js.map +1 -1
  77. package/dist/react/hooks.d.ts +88 -0
  78. package/dist/react/hooks.js +188 -0
  79. package/dist/react/hooks.js.map +1 -0
  80. package/dist/react/index.d.ts +5 -75
  81. package/dist/react/index.js +4 -145
  82. package/dist/react/index.js.map +1 -1
  83. package/dist/runtime/activity.d.ts +8 -0
  84. package/dist/runtime/activity.js.map +1 -1
  85. package/dist/runtime/agent-control.d.ts +28 -0
  86. package/dist/runtime/agent-control.js +43 -2
  87. package/dist/runtime/agent-control.js.map +1 -1
  88. package/dist/runtime/agent-run.d.ts +166 -0
  89. package/dist/runtime/agent-run.js +431 -0
  90. package/dist/runtime/agent-run.js.map +1 -0
  91. package/dist/runtime/agent.d.ts +158 -1
  92. package/dist/runtime/agent.js +345 -12
  93. package/dist/runtime/agent.js.map +1 -1
  94. package/dist/runtime/assemble.js +15 -2
  95. package/dist/runtime/assemble.js.map +1 -1
  96. package/dist/runtime/authority.d.ts +47 -0
  97. package/dist/runtime/authority.js +13 -2
  98. package/dist/runtime/authority.js.map +1 -1
  99. package/dist/runtime/capabilities.js +2 -1
  100. package/dist/runtime/capabilities.js.map +1 -1
  101. package/dist/runtime/changes.d.ts +17 -0
  102. package/dist/runtime/changes.js +65 -2
  103. package/dist/runtime/changes.js.map +1 -1
  104. package/dist/runtime/context.d.ts +123 -0
  105. package/dist/runtime/contract.js +9 -3
  106. package/dist/runtime/contract.js.map +1 -1
  107. package/dist/runtime/events.js +17 -1
  108. package/dist/runtime/events.js.map +1 -1
  109. package/dist/runtime/integrations.js +7 -7
  110. package/dist/runtime/integrations.js.map +1 -1
  111. package/dist/runtime/invocations.d.ts +19 -2
  112. package/dist/runtime/invocations.js +16 -3
  113. package/dist/runtime/invocations.js.map +1 -1
  114. package/dist/runtime/policies.d.ts +5 -2
  115. package/dist/runtime/policies.js.map +1 -1
  116. package/dist/runtime/presence-host.d.ts +84 -0
  117. package/dist/runtime/presence-host.js +303 -0
  118. package/dist/runtime/presence-host.js.map +1 -0
  119. package/dist/runtime/providers.d.ts +5 -1
  120. package/dist/runtime/providers.js +11 -5
  121. package/dist/runtime/providers.js.map +1 -1
  122. package/dist/runtime/required-capabilities.d.ts +73 -0
  123. package/dist/runtime/required-capabilities.js +69 -0
  124. package/dist/runtime/required-capabilities.js.map +1 -0
  125. package/dist/runtime/resource-access.d.ts +137 -0
  126. package/dist/runtime/resource-access.js +177 -0
  127. package/dist/runtime/resource-access.js.map +1 -0
  128. package/dist/runtime/runtime.d.ts +143 -1
  129. package/dist/runtime/runtime.js +853 -44
  130. package/dist/runtime/runtime.js.map +1 -1
  131. package/dist/runtime/sessions.d.ts +12 -0
  132. package/dist/runtime/sessions.js +16 -1
  133. package/dist/runtime/sessions.js.map +1 -1
  134. package/dist/runtime/tenancy.d.ts +68 -1
  135. package/dist/runtime/tenancy.js +150 -0
  136. package/dist/runtime/tenancy.js.map +1 -1
  137. package/dist/runtime/transactions.d.ts +3 -1
  138. package/dist/runtime/transactions.js.map +1 -1
  139. package/dist/runtime/workers.d.ts +123 -0
  140. package/dist/runtime/workers.js +291 -0
  141. package/dist/runtime/workers.js.map +1 -0
  142. package/dist/server/eve.d.ts +287 -0
  143. package/dist/server/eve.js +1071 -0
  144. package/dist/server/eve.js.map +1 -0
  145. package/dist/server/index.d.ts +2 -19
  146. package/dist/server/index.js +102 -5
  147. package/dist/server/index.js.map +1 -1
  148. package/dist/server/mcp.d.ts +15 -22
  149. package/dist/server/mcp.js +40 -3
  150. package/dist/server/mcp.js.map +1 -1
  151. package/dist/server/project.js +26 -8
  152. package/dist/server/project.js.map +1 -1
  153. package/dist/server/tenancy.d.ts +9 -0
  154. package/dist/server/tenancy.js +62 -1
  155. package/dist/server/tenancy.js.map +1 -1
  156. package/dist/server/watch.d.ts +10 -0
  157. package/dist/server/watch.js +88 -0
  158. package/dist/server/watch.js.map +1 -0
  159. package/dist/testing/index.d.ts +4 -5
  160. package/dist/testing/index.js +3 -2
  161. package/dist/testing/index.js.map +1 -1
  162. package/docs/AGENT-CONTROL.md +166 -4
  163. package/docs/APPBOUNDRY.md +73 -0
  164. package/docs/ARCHITECTURE.md +6 -2
  165. package/docs/AUTH.md +37 -0
  166. package/docs/COMPONENTS.md +71 -0
  167. package/docs/EVE-COMPOSITION.md +75 -0
  168. package/docs/GUARANTEES.md +4 -4
  169. package/docs/NATIVE-AGENTS.md +353 -0
  170. package/docs/NATIVE.md +137 -0
  171. package/docs/PRESENCE-AND-SIGNALING-PROPOSAL.md +152 -0
  172. package/docs/README.md +6 -2
  173. package/docs/SECURITY.md +71 -3
  174. package/docs/TRANSACTIONS.md +48 -0
  175. package/docs/UPSTREAM-GAPS.md +16 -2
  176. package/package.json +42 -16
  177. package/skills/.claude-plugin/marketplace.json +1 -1
  178. package/skills/.claude-plugin/plugin.json +1 -1
  179. package/skills/feltkit-agent/SKILL.md +1 -1
  180. package/skills/feltkit-build/SKILL.md +11 -1
  181. package/skills/feltkit-data/SKILL.md +1 -1
  182. package/skills/feltkit-operations/SKILL.md +1 -1
  183. package/skills/feltkit-services/SKILL.md +1 -1
  184. package/dist/dashboard/assets/index-BhxrvY37.js +0 -15
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Watching `feltkit/` for `feltkit dev`'s reloads.
3
+ *
4
+ * Not `fs.watch(dir, { recursive: true })`: on Linux, Node implements a recursive watch by watching
5
+ * each file it found, by inode. A file replaced by a rename (an editor's atomic save, `cp` through a
6
+ * temporary file, `git checkout`, restoring a backup) is a new inode, so after that replacement no
7
+ * further change to the file was reported, `touch` included: the old code kept serving until a
8
+ * restart (docs/PRESENCE-AND-SIGNALING-PROPOSAL.md, "Also found"; test/dev-watch.test.ts reproduces
9
+ * it). A directory's own watch reports every change, create, rename and delete of its entries by
10
+ * name, whatever happens to their inodes, so this watches each directory (non-recursively) and
11
+ * starts watching subdirectories as they appear.
12
+ */
13
+ import { existsSync, readdirSync, statSync, watch } from "node:fs";
14
+ import { join, relative, sep } from "node:path";
15
+ /**
16
+ * Call `onChange(path)` (relative to `root`) for every change under `root`. `ignore(relative)` skips
17
+ * entries (files and whole directories).
18
+ */
19
+ export function watchTree(root, onChange, options = {}) {
20
+ const watchers = new Map();
21
+ const ignored = (path) => {
22
+ const rel = relative(root, path);
23
+ return rel !== "" && (options.ignore?.(rel.split(sep).join("/")) ?? false);
24
+ };
25
+ let closed = false;
26
+ const add = (dir) => {
27
+ if (closed || watchers.has(dir) || ignored(dir))
28
+ return;
29
+ let watcher;
30
+ try {
31
+ watcher = watch(dir, { persistent: true }, (_event, name) => {
32
+ if (closed)
33
+ return;
34
+ const path = name ? join(dir, String(name)) : dir;
35
+ if (ignored(path))
36
+ return;
37
+ // A new (or renamed-in) directory: watch it and what it holds.
38
+ try {
39
+ if (name && existsSync(path) && statSync(path).isDirectory())
40
+ scan(path);
41
+ }
42
+ catch {
43
+ /* gone again */
44
+ }
45
+ onChange(relative(root, path).split(sep).join("/"));
46
+ });
47
+ }
48
+ catch {
49
+ return; // removed before it could be watched
50
+ }
51
+ watcher.on("error", () => {
52
+ // The directory itself went away: forget it (a parent's watch reports its return).
53
+ watcher.close();
54
+ watchers.delete(dir);
55
+ });
56
+ watchers.set(dir, watcher);
57
+ };
58
+ const scan = (dir) => {
59
+ add(dir);
60
+ let entries = [];
61
+ try {
62
+ entries = readdirSync(dir);
63
+ }
64
+ catch {
65
+ return;
66
+ }
67
+ for (const entry of entries) {
68
+ const path = join(dir, entry);
69
+ try {
70
+ if (statSync(path).isDirectory())
71
+ scan(path);
72
+ }
73
+ catch {
74
+ /* removed while scanning */
75
+ }
76
+ }
77
+ };
78
+ scan(root);
79
+ return {
80
+ close() {
81
+ closed = true;
82
+ for (const watcher of watchers.values())
83
+ watcher.close();
84
+ watchers.clear();
85
+ },
86
+ };
87
+ }
88
+ //# sourceMappingURL=watch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/server/watch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAkB,MAAM,SAAS,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAMhD;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,QAAgC,EAAE,OAAO,GAA2C,EAAE;IAC5H,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC9C,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE;QAC/B,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,IAA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C,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACvB,mFAAmF;YACnF,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC7B,CAAC,CAAC;IACF,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;QAC3B,GAAG,CAAC,GAAG,CAAC,CAAC;QACT,IAAI,OAAO,GAAa,EAAE,CAAC;QAC3B,IAAI,CAAC;YACH,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC9B,IAAI,CAAC;gBACH,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE;oBAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/C,CAAC;YAAC,MAAM,CAAC;gBACP,4BAA4B;YAC9B,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,CAAC;IACX,OAAO;QACL,KAAK;YACH,MAAM,GAAG,IAAI,CAAC;YACd,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE;gBAAE,OAAO,CAAC,KAAK,EAAE,CAAC;YACzD,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -59,9 +59,11 @@ export interface TestApp extends Caller {
59
59
  restart(): Promise<void>;
60
60
  close(): Promise<void>;
61
61
  }
62
+ export { manualClock, type ManualClock, type Clock } from "../clock.js";
62
63
  export declare function createTestApp(options?: {
63
64
  projectDir?: string;
64
- storage?: StorageDescriptor;
65
+ storage?: StorageDescriptor; /** Time for leases and quotas (manualClock()). */
66
+ clock?: import("../clock.js").Clock;
65
67
  }): Promise<TestApp>;
66
68
  export interface ArtifactTestApp extends Caller {
67
69
  /** The host the artifact runs in: its manifest, and what it recorded (notifications, files, jobs, webhook events). */
@@ -117,7 +119,4 @@ export interface ArtifactTestApp extends Caller {
117
119
  * artifact can be opened on the same records: its schema is installed only when they satisfy
118
120
  * it). `configuration` seeds the Configuration service's variables. Close it when done.
119
121
  */
120
- export declare function createArtifactTestApp(path: string, options?: {
121
- configuration?: Record<string, string>;
122
- stateDir?: string;
123
- }): Promise<ArtifactTestApp>;
122
+ export declare function createArtifactTestApp(path: string, options?: import("../appboundry/host.js").ArtifactHostOptions): Promise<ArtifactTestApp>;
@@ -23,13 +23,14 @@ import { resolveEnvironment } from "../runtime/environment.js";
23
23
  import { InstanceFactory } from "../runtime/instance.js";
24
24
  import { loadSources } from "../runtime/loader.js";
25
25
  import { FeltKitRuntime, silentLogger } from "../runtime/runtime.js";
26
+ export { manualClock } from "../clock.js";
26
27
  export async function createTestApp(options = {}) {
27
28
  const projectDir = resolve(options.projectDir ?? process.cwd());
28
29
  const factory = new InstanceFactory();
29
30
  let project = await loadSources(projectDir);
30
31
  const environment = resolveEnvironment({ projectDir, appName: project.app.name, name: "test", env: {}, ...(options.storage ? { storage: options.storage } : {}) });
31
32
  // Durable service work runs when a test asks for it: await app.runtime.runServices().
32
- let runtime = await FeltKitRuntime.start({ project, environment, factory, logger: silentLogger, workerIntervalMs: 0 });
33
+ let runtime = await FeltKitRuntime.start({ project, environment, factory, logger: silentLogger, workerIntervalMs: 0, ...(options.clock ? { clock: options.clock } : {}) });
33
34
  const principalFor = (who) => {
34
35
  if (who === null)
35
36
  return null;
@@ -110,7 +111,7 @@ export async function createTestApp(options = {}) {
110
111
  async restart() {
111
112
  await runtime.close();
112
113
  project = await loadSources(projectDir);
113
- runtime = await FeltKitRuntime.start({ project, environment, factory, logger: silentLogger, workerIntervalMs: 0 });
114
+ runtime = await FeltKitRuntime.start({ project, environment, factory, logger: silentLogger, workerIntervalMs: 0, ...(options.clock ? { clock: options.clock } : {}) });
114
115
  },
115
116
  close: () => runtime.close(),
116
117
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAkB,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAA0B,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAoB,MAAM,uBAAuB,CAAC;AA+CvF,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAO,GAAyD,EAAE;IACpG,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAChE,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;IACtC,IAAI,OAAO,GAAG,MAAM,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,kBAAkB,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACnK,sFAAsF;IACtF,IAAI,OAAO,GAAG,MAAM,cAAc,CAAC,KAAK,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CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC;QAChE,OAAO,EAAE;YACP,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO;gBAChC,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;gBACpC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;gBAC9D,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,SAAkB,EAAE,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,IAAI,CAAU,EAAE,CAAC,CAAC;YACtG,CAAC;YACD,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,eAAe,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAc,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAU;SACzH;QACD,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE;KAC1B,CAAC;AACJ,CAAC"}
@@ -43,7 +43,8 @@ control gate first. New work is refused with `CONFLICT` and a `details.reason` w
43
43
  A *signaled* update (no text yet) never blocks: the agent keeps working while the person types.
44
44
 
45
45
  The reasoner calls **checkpoint** between steps. It returns `proceed` (false while paused or interrupted), the updates to take into account
46
- now (oldest first), and how many are still signaled. Delivering marks updates `delivered` with the checkpoint version, once. A delivered
46
+ now (oldest first), and how many are still signaled. While the task is held, a checkpoint hands over nothing new: received updates stay
47
+ received (and withdrawable) until the first checkpoint after a resume. Delivering marks updates `delivered` with the checkpoint version, once. A delivered
47
48
  update that is not acknowledged (the reasoner's process died) is returned again by the next checkpoint and is never re-delivered as new.
48
49
 
49
50
  Approving a proposed action also runs it, so approval is refused while the task is paused or interrupted. **Complete** is refused while any
@@ -93,10 +94,39 @@ The lifecycle is implemented once, in `AgentControl`; each surface is a thin cal
93
94
  | Live state | `GET /api/agent/tasks/:id/control/events` (SSE, event `control`): the whole state on connect and after every change | — |
94
95
  | MCP | — | `feltkit_agent_checkpoint`, `feltkit_agent_acknowledge` |
95
96
  | AppPort | `appport.agent.{state,signal,submit,withdraw,pause,resume,interrupt,stop}` | `appport.agent.{checkpoint,acknowledge}` |
97
+ | AppPort event | `appport.agent.changed@1`, scope `agentTaskScope(taskId)` (below) | — |
96
98
 
97
99
  The SSE stream is level-triggered: every frame is the full state (with a `revision`), read back from FeltDB. A lost frame or a reconnect
98
100
  loses nothing.
99
101
 
102
+ ### The change event: `appport.agent.changed@1`
103
+
104
+ After every durable change (signal, submit, withdraw, pause, resume, interrupt, stop, a checkpoint that delivers updates, an
105
+ acknowledgment, and in-flight work ending while a person holds the task), AgentControl publishes AppPort's change event
106
+ (spec/agent-control-1.md §7) with `scope: agentTaskScope(taskId)`:
107
+
108
+ ```json
109
+ { "taskId": "task-…", "revision": "e82d8943…", "sequence": 4, "phase": "paused", "mode": "paused", "changes": ["mode", "phase"] }
110
+ ```
111
+
112
+ - **`sequence`** starts at 1 and grows by exactly 1 per change, per task. It is a durable counter (`_feltkit_sequences`,
113
+ compare-and-set), so it continues after a restart; `view()` and `appport.agent.state` carry the latest as `state.sequence`.
114
+ - **`revision`** is the state's revision read after the change is durable: equal to what `appport.agent.state` answers then.
115
+ - **Observation follows reading the task**: a subscriber needs `feltkit.agent.read` and must be able to read the task (its workspace;
116
+ a non-person only its own task). A subscription without a task scope is refused.
117
+ - It is a notification and a cursor, not the state, and AppPort delivers events at most once: a consumer that sees a gap, or reconnects,
118
+ reads `appport.agent.state`.
119
+ - `runAgentChangedEventConformance` (@appport/testing) passes: `test/conformance/agent-events.test.ts`; FeltKit's own scenarios are in
120
+ `test/agent-changed.test.ts`.
121
+
122
+ ### Live state on a FeltDB server
123
+
124
+ FeltKit's change feed takes FeltDB's commit notices (`db.onCommit`, FeltDB 0.23, where `db.capabilities().commitListener`): a write to
125
+ agent state is reported as it commits, on a FeltDB server too (feltdb-server 0.7.0 announces every commit's collections). Before, the
126
+ remote feed polled FeltKit's `_feltkit_collections` markers, which agent-state writes never stamp, so on a server the SSE stream above
127
+ did not move on a steering change. The poll remains as the fallback (`FELTKIT_CHANGE_POLL_MS`; 1 s embedded and 5 s on a server with
128
+ notices, 150 ms and 1 s without them).
129
+
100
130
  ## A reasoner loop
101
131
 
102
132
  ```ts
@@ -121,6 +151,119 @@ export const run = app.action({
121
151
 
122
152
  `test/fixtures/steering/feltkit/work.ts` is a complete, tested version, including resuming after a restart without repeating a step.
123
153
 
154
+ ## In the browser and React
155
+
156
+ The client (`@feltdb/feltkit/client`) has one method per operation and a live subscription:
157
+
158
+ | Method | HTTP |
159
+ |---|---|
160
+ | `client.agentControl(taskId)` | `GET …/control` |
161
+ | `client.signalAgentUpdate(taskId, { note?, idempotencyKey? })` | `POST …/control/signal` |
162
+ | `client.submitAgentUpdate(taskId, text, { instructionId?, idempotencyKey? })` | `POST …/control/submit` |
163
+ | `client.withdrawAgentUpdate(taskId, instructionId, reason?)` | `POST …/control/withdraw` |
164
+ | `client.controlAgent(taskId, "pause" \| "resume" \| "interrupt" \| "stop", reason?)` | `POST …/control/<op>` |
165
+ | `client.watchAgentControl(taskId, listener, onError?)` | `GET …/control/events` (SSE) |
166
+
167
+ `watchAgentControl` is level-triggered: every frame replaces the local state. A frame that repeats the last revision,
168
+ or that is older than the last one shown (a lower checkpoint count or record sequence, `controlRevisions()`), is
169
+ dropped. It reconnects after a dropped stream and stops on a refusal (signed out, no access, no such task).
170
+
171
+ `@feltdb/feltkit/react`:
172
+
173
+ ```tsx
174
+ const control = useAgentControl(taskId); // or "skip"
175
+ // control.state, .phase, .updates, .buttons, .pending[op], .errors[op], .error
176
+ // control.signal(), .submit(text, { instructionId?, idempotencyKey? }), .withdraw(id), .pause(), .resume(), .interrupt(), .stop(reason?)
177
+
178
+ <AgentControlBar taskId={taskId} /> // icons with aria-label and title; labels shows text
179
+ <AgentControlBar taskId={taskId} labels confirmStop={false} />
180
+ <AgentUpdateComposer taskId={taskId} /> // "Tell the agent what changed", the bar, and send (↑)
181
+ ```
182
+
183
+ - **Server state only.** Every button reflects the phase the server last reported; the only local state is which
184
+ operation is in flight (`pending`). Before the first frame, everything is disabled.
185
+ - **One update per draft.** `submit` sends an idempotency key, one per draft text, kept until it is sent: a double
186
+ click is one in-flight request, and a retry of the same text is the same update on the server.
187
+ - **Typed refusals.** Operations throw `AgentControlError` with `kind`: `conflict` (with `reason`: `AGENT_PAUSED`,
188
+ `CONCURRENT_CHANGE`, `INSTRUCTIONS_OPEN`, …), `idempotency-key-reused`, `forbidden`, `unauthorized`, `not-found`,
189
+ `other`. The components show the last refusal in an `role="alert"` line.
190
+ - **The composer** signals "an update is coming" once when the person focuses or types (`signalOnType={false}` turns
191
+ it off), fills that signal on send (`instructionId`), and shows each update's state (signaled, received, delivered,
192
+ incorporated, conflict, withdrawn, abandoned), the agent's resolution note, and Withdraw for signaled and received
193
+ updates. Its helper text follows the phase ("The agent knows an update is coming and keeps working. It takes your
194
+ update at its next checkpoint." after signalling).
195
+ - **Styling.** `fk-agent-*` classes with the same `--fk-*` variables as the auth screens, `className` on every
196
+ component, `unstyled`, and `<FeltKitAgentControlStyles disabled />`. Icons are inline SVG (pencil, pause, play,
197
+ bolt, stop, arrow-up); no runtime dependencies.
198
+
199
+ Which buttons are enabled, from the reported phase (`agentControlButtons(state)`):
200
+
201
+ | Phase | Update coming | Pause / Resume | Interrupt | Stop |
202
+ |---|---|---|---|---|
203
+ | running | yes | Pause | yes | yes |
204
+ | blocked (waiting for an approval) | yes | Pause | only while a model generation runs | yes |
205
+ | pausing (work still in flight) | yes | Resume | only while a model generation runs (interrupt cancels it) | yes |
206
+ | paused | yes | Resume | no: nothing is running to cancel | yes |
207
+ | interrupted | yes | Resume | no: already interrupted | yes |
208
+ | completed, stopped | no | no | no | no |
209
+
210
+ Interrupt differs from pause only in cancelling a running model generation now; an action is never aborted. So where
211
+ no generation is in flight it is disabled, with the reason in its title. Stop asks for confirmation
212
+ (`confirmStop={false}` or a custom message).
213
+
214
+ ### Approving a proposal
215
+
216
+ `useOwnActions` and the client's `approveAction` / `rejectAction` already existed; two components sit on them:
217
+
218
+ ```tsx
219
+ <PendingApprovals /> // your agents' proposals, live (useOwnActions({ state: "proposed" }))
220
+ <ActionApproval action={action} approve={approve} reject={reject} /> // one proposal
221
+ ```
222
+
223
+ `ActionApproval` shows the operation and its exact input, approves with the action's `inputDigest` (so the approval
224
+ binds to that input; a changed input is refused by the server), rejects with an optional reason, and shows the state
225
+ the server reported. A proposal past its `expiresAt` shows "Expired" and never offers Approve (`approvalOptions`).
226
+
227
+ Tests: `test/agent-control-client.test.ts` (the client against a real server: every operation, idempotent submit,
228
+ typed refusals, SSE frames, stale frames dropped; the components rendered with react-dom/server: the matrix per phase,
229
+ labels, the composer, and one request per double-clicked submit).
230
+
231
+ ## Project agents (`app.agent(name, { project })`)
232
+
233
+ An agent that runs on the agent runtime from its own project is a reasoner like any other: each of its sessions is
234
+ one agent task (`taskId` in `client.agent(name).sessions()`), opened by FeltKit with the session, and every operation
235
+ above works on it over HTTP, AppPort and MCP. The agent opts in with one field, and FeltKit's build refuses it without:
236
+
237
+ ```ts
238
+ // agent/agent.ts
239
+ export default defineAgent({
240
+ model,
241
+ control: feltkitControl(), // checkpoint before each model step and before tool calls
242
+ experimental: { workflow: { world: "@appport/eve-world-feltdb", retention: "default" } }, // sessions are evidence
243
+ });
244
+ ```
245
+
246
+ - **Who.** Starting work with the agent and steering it need `feltkit.agent.write` in the workspace (reading it,
247
+ `feltkit.agent.read`). Activating it (making it a member) needs `feltkit.workers.write`. The work grant a person
248
+ gives the agent covers only capabilities they may call themselves.
249
+ - **Boundaries.** The runtime records a hold as the session fact `turn.held` and continues only on `resume`.
250
+ Interrupt cancels the running turn; Stop ends the session and FeltKit reports success only once the runtime has
251
+ recorded the end. Every FeltKit capability call is refused at the bridge while the task is held.
252
+ - **Approval is not control.** Approving a proposal while the task is paused or interrupted is refused (`CONFLICT`,
253
+ `details.reason: AGENT_PAUSED` / `AGENT_INTERRUPTED`); after resume it runs once.
254
+ - **Evidence.** `GET /api/eve/<agent>/sessions/<id>/evidence` (`client.agent(name).evidence(id)`) answers what the
255
+ session was asked, what it did and what is waiting, from the runtime's session record and FeltKit's control record:
256
+ `state` (`idle`, `submitted`, `running`, `model`, `tool`, `approval`, `pausing`, `paused`, `interrupting`,
257
+ `interrupted`, `resuming`, `completed`, `failed`, `stopped`), the `updates` with how far each got (received,
258
+ delivered, incorporated, and the outcome of the turn it went into), `answers` (who approved or denied what),
259
+ `controlHistory`, and a `timeline` of messages, model steps, holds, approvals and tool calls. A tool call's `effect`
260
+ is `changed` (it ran and the application recorded the change), `attempted` (it ran and failed), `not-run` (it
261
+ never started: its approval was denied or ended with the session), `read`, `outside` (not the application's to
262
+ confirm) or `unknown`. It never contains the model's reasoning. It stays readable after Stop.
263
+ - **Retention.** Without `retention: "default"` the runtime deletes a private session's history when it ends, and
264
+ Stop would destroy the evidence; with it, sessions are kept in the application's FeltDB until the application
265
+ deletes them. Erasure of a person's sessions is the application's to provide.
266
+
124
267
  ## What is tested (`test/agent-control.test.ts`)
125
268
 
126
269
  The acceptance scenario (signal while a tool runs, type, submit, incorporate at the next checkpoint, continue, full history); pause during
@@ -128,15 +271,34 @@ an in-flight tool and resume; multiple updates, ordering and duplicate delivery;
128
271
  during a dispatched tool; restart with a paused task and a pending update; redelivery after a restart; stop with pending updates;
129
272
  authority; concurrent people; the HTTP endpoints and SSE stream with reconnect; an external agent over MCP; the AppPort capabilities.
130
273
 
274
+ ## Who owns the agent loop (decision, 0.4.0)
275
+
276
+ A product that hands work to agent workers (Handoff: coding work to separately running runners) needs two
277
+ different things. FeltKit owns the first and leaves the second to the product:
278
+
279
+ | Reusable execution integration: FeltKit owns it | Delegation policy: the product owns it |
280
+ |---|---|
281
+ | **Who a worker is**: a registered worker principal (`ctx.grants.registerWorker`), its token, independent revocation, refused on its next call once revoked (docs/SECURITY.md) | which runner gets which work, how many at once, priorities and queues |
282
+ | **What it may do**: a work grant (AppPort delegated authority) for capabilities, one actor and one work item, checked on every surface | which capabilities a kind of work needs, and for how long |
283
+ | **Lease and claim of work**: platform invocations (`ctx.invocations.start` / `progress` / `transition`), a claim with a lease, fenced writes, an expired claim reclaimed as a new attempt; a worker whose grant names the invocation claims it as itself (`attribution.worker: "authenticated"`) | when to give up on a worker, re-assignment, escalation to a person |
284
+ | **Checkpoints**: `ctx.agent.checkpoint` / `acknowledge`, the gate on generations and proposals, pause/resume/interrupt/stop | what an update means for the plan (the model and the product's prompt) |
285
+ | **Resume by key**: `ctx.agent.openTask({ key })` returns the same task; proposals keyed per step never run twice; a job's or a keyed call's external effect (`ctx.effect`) is never begun twice | how a run is restarted (a scheduler, a queue consumer, the runner's own supervisor) |
286
+ | **Approvals of exact calls** (`ctx.grants.approve`), **effects and reconciliation** (`ctx.effect`, `appport.invocation.status`) | who approves what, and the review UI |
287
+
288
+ What FeltKit still does not do: run the loop. A reasoner is application code (an action) or an external runner; a
289
+ runner that stops must be started again by something the product runs. Owning that would mean a FeltKit
290
+ scheduler and process supervisor (a new execution system), which the pieces above make unnecessary: re-running
291
+ a step with the same keys is safe, so any at-least-once restarter (a job retry, a queue redelivery, a runner's
292
+ supervisor) is enough. Implemented in 0.4.0: workers, work grants, invocation claims by workers, and approvals
293
+ (`test/workers.test.ts`); nothing product-specific.
294
+
131
295
  ## Limits
132
296
 
133
- - **FeltKit has no agent loop runner.** Steering takes effect at the reasoner's boundaries. A reasoner that dies (process restart) leaves
297
+ - **FeltKit has no agent loop runner** (see "Who owns the agent loop"). Steering takes effect at the reasoner's boundaries. A reasoner that dies (process restart) leaves
134
298
  durable, unambiguous state, but something must start it again: re-calling the action with the same key, as the fixture does, or an MCP
135
299
  agent reconnecting.
136
300
  - **Pause and interrupt are not preemption of external work.** A dispatched action finishes or times out; only model generations are
137
301
  cancelled immediately.
138
302
  - FeltDB 0.22 has no paused execution status; FeltKit keeps the mode in its control record and leaves FeltDB's execution status as the
139
303
  action lifecycle sets it.
140
- - The AppPort change event `appport.agent.changed@1` is not emitted yet; live state is FeltKit's SSE stream. AppPort's
141
- `lintAgentControlSupport` reports this as a warning.
142
304
  - The AppPort capability schemas are written in FeltKit until a published `@appport/protocol` carries the contract module.
@@ -138,6 +138,42 @@ AppBoundry host does not serve (FK-GAP-013). The build warns and declares `ident
138
138
  the host refuses the artifact unless its operator accepts that people get sessions only from an
139
139
  operator. See [AUTH.md](AUTH.md#appboundry).
140
140
 
141
+ ## Other applications' capabilities (capabilities@1)
142
+
143
+ An artifact has no network, but it can use what other applications provide. Declare what the application needs,
144
+ by AppPort name and integer version range; never a provider, an endpoint or a credential:
145
+
146
+ ```ts
147
+ export const app = feltkit({
148
+ name: "month-end",
149
+ requires: [{ name: "quickbooks.invoices.create", versions: "1", purpose: "post approved invoices" }],
150
+ });
151
+
152
+ export const post = app.mutation({
153
+ access: "invoices.write",
154
+ args: { key: s.string(), amount: s.number() },
155
+ handler: async (ctx, { key, amount }) => {
156
+ const result = await ctx.capabilities.invoke("quickbooks.invoices.create", { amount }, { idempotencyKey: key });
157
+ // result.outcome: "succeeded" | "failed" | "unknown" | "refused" — returned, never thrown
158
+ },
159
+ });
160
+ ```
161
+
162
+ - **Build.** `requires` becomes the manifest's `requires`, and the artifact requires the host interface
163
+ `capabilities@1`. The module still imports nothing; `permissions.network` stays `"none"`.
164
+ - **`ctx.capabilities.list()`** (queries and mutations): each requirement as `granted`, `offered` (a provider, no
165
+ grant) or `unavailable`, with the provider's description and schemas. Discovery is not authority.
166
+ - **`ctx.capabilities.invoke(name, input, { idempotencyKey })`** (mutations only; a declared name only). The host
167
+ binds the requirement to a provider (its operator's `appboundry run --capabilities`), authorizes it against the
168
+ grant, commits the attempt to its own state before sending, and invokes the provider over AppPort.
169
+ - `unknown` means the request was sent and no answer came: it may have taken effect. Reconcile with the provider
170
+ before deciding to resend. A resend with the same key carries the same AppPort idempotency key.
171
+ - A recorded success is replayed for the same key without sending.
172
+ - **Tests.** `createArtifactTestApp(path, { capabilities: { list, invoke } })` stands in for the operator's
173
+ providers; `t.host.capabilityCalls` records each invocation.
174
+ - **On FeltKit's own runtime** `ctx.capabilities` refuses with `CONFIGURATION`: there it has no provider yet.
175
+ - **Host.** AppBoundry's `capabilities@1` (`rkendel1/appboundry`, unreleased).
176
+
141
177
  ## Schema lifecycle in an artifact
142
178
 
143
179
  `manifest.json` carries `state.contract`: the FeltDB state contract the application's
@@ -247,6 +283,11 @@ artifact that behaves differently from your application:
247
283
  | `Intl`, `toLocaleString` / `toLocaleDateString` / `toLocaleTimeString`, `localeCompare` | the guest engine has no locale data (see below), so they would give different output than under `feltkit dev` |
248
284
  | Node APIs (`node:*`, `fs`, …) in backend code | the artifact runs without Node |
249
285
  | imports of `@feltdb/feltkit/<subpath>` in backend code | only `@feltdb/feltkit` exists in the guest |
286
+ | `app.action(...)` | it runs outside a transaction (model calls, external effects, streaming); an artifact runs transactions only (AppBoundry B1, `actions@1` proposed) |
287
+ | `feltkit({ providers })` | a provider reaches external systems and serves channels; an artifact has no network access |
288
+ | `resource: { guests, agents }`, `app.channel`, `app.presence` | resolved per call, delivered per recipient, or expired on FeltKit's runtime (K1, K2, K4, K6) |
289
+ | `visibility` other than `"public"` (0.4.0) | the host dispatches every function in the manifest on `/api`, `/appport` and `/mcp` and knows no internal calls, workers or service principals: an internal function would be public there |
290
+ | `ctx.grants`, `ctx.invocations`, `ctx.integrations`, `ctx.authority`, `ctx.presence`, `ctx.channels` (0.4.0) | FeltKit runtime services with no host interface: workers, work grants and approvals; the invocation store; outbound calls; AuthBoundry; leases; channels. The guest also refuses them at run time with `CONFIGURATION`, instead of an undefined property |
250
291
 
251
292
  Only the handler context is checked: `ctx.agent` (or the first parameter of a `handler`,
252
293
  whatever it is named, and `({ agent })` destructured) is refused, while `roles.agent` or
@@ -285,6 +326,38 @@ compiled by esbuild (`target: es2022`). What differs from Node:
285
326
  Format numbers and dates for people in the frontend, or with explicit code (`toFixed`,
286
327
  your own digit grouping).
287
328
 
329
+ ## Portability audit: what keeps a FeltKit application off AppBoundry (0.4.0, against AppBoundry `0515c5a`)
330
+
331
+ Read against AppBoundry's source at `0515c5a` (`packages/appboundry-host/src/manifest.ts`: `SUPPORTED_INTERFACES` =
332
+ `collections`, `services`, `identity`, `web`, `migrations`, `transactions`, `crypto`, `events`, `components`, `tenancy`,
333
+ each `@1`; `docs/artifact-runtime.md`; `docs/COMPLETE-APPLICATION-GAP-REGISTER.md`) and FeltKit's artifact build
334
+ (`src/appboundry/build.ts`, `guest.ts`). Classes: **AppBoundry runtime limitation** (the host has no interface for it;
335
+ FeltKit refuses at build), **FeltKit portability issue** (FeltKit's to fix), **app-specific** (the application chose
336
+ something an artifact cannot be).
337
+
338
+ | # | Finding | Where | Class | Status |
339
+ |---|---|---|---|---|
340
+ | 1 | No non-transactional function kind: `app.action` (model calls, streaming, external effects, 0.4.0 `ctx.effect` and action capabilities) cannot be built | host manifest allows `query`/`mutation` only; AppBoundry gap register B1; FeltKit `build.ts` `ACTION_WHY` | AppBoundry runtime limitation | refused at build; needs `actions@1` |
341
+ | 2 | No network egress: `app.integration`, `feltkit({ providers })`, `ctx.integrations`, webhook delivery | guest imports nothing; `permissions.network: "none"`; gap register A1 | AppBoundry runtime limitation (by design: the guest stays socket-less) | refused at build; host-performed declared egress proposed (A1) |
342
+ | 3 | `app.agent` (FK-GAP-013's sibling, K8): code run after a commit as another principal | the guest ABI runs code only inside a call, as its caller; no agents interface | AppBoundry runtime limitation | **not in 0.4.0** (K8 was not implemented in either round; `git log` has no K8 commit); refused at build |
343
+ | 4 | `ctx.agent`, agent control, `appport.agent.changed@1`, FeltKit's agent tools on `/mcp` | FeltDB agent state is served by FeltKit's runtime; gap register D3 | AppBoundry runtime limitation | refused at build (`ctx.agent`); omitted from the manifest |
344
+ | 5 | Presence and channels (K1, K2): a lease expires on a clock, a channel decides each recipient at delivery | host has no timer for guest code and no per-recipient receive rule (events@1 decides at observe) | AppBoundry runtime limitation | refused at build |
345
+ | 6 | Guests, agent grants, workers, work grants and approvals (K4, K6, 0.4.0 P0) | resolved per call from `_feltkit_resource_access` by FeltKit's runtime; identity@1 has operator-issued sessions only | AppBoundry runtime limitation | refused at build (bindings, `ctx.grants`) |
346
+ | 7 | Built-in accounts (`auth.accounts`) | `identity-host-interface.md` (`accounts@1` proposed) | AppBoundry runtime limitation | declared in `identity`; host refuses unless the operator accepts operator sessions |
347
+ | 8 | `visibility` (0.4.0): an internal function in the manifest would be callable by anyone holding its `access` on `/api`, `/appport`, `/mcp` | the manifest carries no visibility and the guest did not check it | **FeltKit portability issue** | **fixed**: the build refuses it (`test/appboundry.test.ts`) |
348
+ | 9 | `ctx.grants`, `ctx.invocations`, `ctx.integrations`, `ctx.authority`, `ctx.presence`, `ctx.channels` built into an artifact failed only at run time, as `undefined` property access | `guest.ts` ctx has none of them; the build checked only bindings | **FeltKit portability issue** | **fixed**: refused at build with the line, and a `CONFIGURATION` refusal in the guest |
349
+ | 10 | Node APIs, a filesystem, ports, processes, long-lived connections in backend code | the guest is a WASM sandbox with no imports; the host owns HTTP, SSE (`/api/events`) and the clock | AppBoundry runtime limitation (by design) | refused at build (`node:*`, `fs`, …); FeltKit's runtime features that need them (the dev server, Studio, file links, image variants, schedules, the services worker for jobs) are FeltKit's server's, listed in `omitted` |
350
+ | 11 | Locale data (`Intl`, `toLocale*`, `localeCompare`) | Boa built without `intl` | AppBoundry runtime limitation (engine size) | refused at build and at run time |
351
+ | 12 | `feltkit({ auth: { authenticate } })` | the identity hook runs on FeltKit's server | FeltKit portability issue (not small: needs an identity host operation) | refused at build; not changed |
352
+ | 13 | An application whose value is in actions, agents or integrations (Handoff: workers opening pull requests) | — | app-specific | runs on FeltKit's runtime; an artifact can hold its transactional part only |
353
+
354
+ What a FeltKit app artifact can be today: queries and mutations over declared collections, AppPort Services
355
+ (files, notifications, configuration, jobs, recorded webhooks), sequences and after-commit effects
356
+ (`transactions@1`), `app.event` (`events@1`), migrations, tenancy (`tenancy@1`), `ctx.crypto.token`,
357
+ `approval: "required"` for people's direct calls, the audit trail, and companion components where an operator
358
+ enables them. Nothing above needs a FeltKit compiler or a second execution system: each runtime limitation is a
359
+ host interface AppBoundry would add (`actions@1`, declared egress, an agents interface, a timer for leases).
360
+
288
361
  ## What is not in the artifact
289
362
 
290
363
  The build lists these (`omitted` in the manifest) instead of pretending to carry them:
@@ -37,6 +37,10 @@ shortest correct path:
37
37
  | `runtime/content.ts` | File bytes in `_feltkit_file_content`: stored before the file record, verified on read, removed with the file (FeltDB's content store is not used yet: no deletion, no memory runtime). File links (`_feltkit_file_links`, token digests; cacheable links derive their token by HMAC). Image variants in `_feltkit_file_variants`, keyed by the original's storage key, released with its bytes. |
38
38
  | `runtime/image-variants.ts` | Deriving a declared image variant (`services.files.variants`) with pure-JavaScript codecs (`jpeg-js`, `pngjs`): sniff, header size check, EXIF orientation, area-average downscale. Loaded on first use. |
39
39
  | `runtime/runtime.ts` | Lifecycle, hot reload, `call()`, AppPort application construction. |
40
+ | `runtime/presence-host.ts` | `ctx.presence`, the live-lease read view, expiry by a timer on the runtime's clock, leases ending with their session (src/presence.ts declares them). |
41
+ | `runtime/resource-access.ts` | Guest links and agent grants (`_feltkit_resource_access`), the resource gate (guests and granted agents) at the execution boundary. |
42
+ | `quota.ts`, `clock.ts` | Call quotas (sliding windows, in the process) and the injectable clock leases and quotas read. |
43
+ | `server/watch.ts` | `feltkit dev`'s watcher: one non-recursive watch per directory (a recursive watch loses files replaced by a rename). |
40
44
  | `runtime/loader.ts` | Loads `feltkit/` (tsx in development, the esbuild bundle in production). |
41
45
  | `server/` | HTTP server, AppPort binding, MCP endpoint (application tools + `feltkit_agent_*`), admin API, dev/build/start/deploy workflows. |
42
46
  | `server/management.ts` | AppPort Services' `createManagementRouter`: embedded in the admin API for Studio's Services screens (as a dev identity), and the services console on a loopback origin, authenticated by FeltKit sessions. |
@@ -110,8 +114,8 @@ installed Services release does not take `@feltdb/core` as a peer dependency.
110
114
 
111
115
  ## Request lifecycle of a mutation
112
116
 
113
- 1. Parse and validate arguments against the function's `args` schema.
114
- 2. Authorize: AppPort's authorizer evaluates the caller's roles against `access`.
117
+ 1. Authorize: AppPort's authorizer evaluates the caller's roles against `access`.
118
+ 2. Parse and validate arguments against the function's `args` schema, then admit the call under its quotas.
115
119
  3. Run the handler with a `Writer`. Reads see pending writes; writes are validated and buffered.
116
120
  4. Validate the return value against `returns`, if declared.
117
121
  5. Commit one FeltDB transaction: inserts as `requireAbsent`, updates/deletes with
package/docs/AUTH.md CHANGED
@@ -161,6 +161,41 @@ under the clients' control: the platform ends the authority and tells every othe
161
161
  live queries, at once; a participant whose own client ignores that can only be cut off by the others closing
162
162
  their side, or by a server in the media path.
163
163
 
164
+ ## Guests
165
+
166
+ People without an account can join one thing (a meeting) through a link a host issues:
167
+
168
+ ```ts
169
+ feltkit({ roles: { guest: ["meetings.join", "meetings.chat"], … }, auth: { guests: { roles: ["guest"], ttlMs: 24 * 3_600_000 } } });
170
+
171
+ export const invite = app.mutation({ access: "meetings.host", args: { meetingId: s.string() },
172
+ handler: (ctx, { meetingId }) => ctx.grants.guestLink(meetings, meetingId, { label: "external" }) }); // { id, token, url, role, expiresAt }
173
+
174
+ export const join = app.mutation({ access: "meetings.join", args: { code: s.string() },
175
+ resource: { collection: meetings, id: "code", by: "code", guests: true, agents: "grant" }, handler: … });
176
+ ```
177
+
178
+ - **Redeem:** `POST /api/auth/guest { token, displayName }` answers a session (a cookie for the browser client, else a
179
+ token) for `guest:<random>` with the link's role and `principal.guest = { link, resource, expiresAt }`; it lasts until
180
+ the link expires (at most 12 h).
181
+ - **Scope:** a guest reaches only functions declaring `resource` with `guests: true`, and only for its own record
182
+ (another is NOT_FOUND). Everything else (other functions, actions, tenancy) is refused. `ctx.auth.principal.guest`
183
+ tells a function it is serving a guest.
184
+ - **Revocation and expiry:** `ctx.grants.revoke(meetings, id, linkId)`. The guest session is resolved from its link on
185
+ every request, so revoking or expiry ends it at once.
186
+ - **Agents:** `ctx.grants.admitAgent(meetings, id, "scribe-bot")` admits a named agent (an `app.agent`, a component,
187
+ or an identity with an operator-issued session) to one record; with `agents: "grant"` every other agent or service
188
+ is refused there.
189
+ - Only a signed-in person issues links and grants (the issuing function's `access` decides which person).
190
+
191
+ ## A tenant's public face (branding before sign-in)
192
+
193
+ `POST /api/tenants/current/public { slug?, domains?, branding? }` (needs `tenant.update`) sets a workspace's slug
194
+ (`acme`), custom domains (`meet.acme.com`) and branding (`displayName`, `logoUrl`, `primaryColor`, `accentColor`,
195
+ `backgroundColor`, `tagline`). Slugs and domains are unique across workspaces. A join or sign-in page brands itself
196
+ before anyone signs in with `GET /api/tenants/resolve?slug=acme` (or `?domain=…`, or no parameter: the request's own
197
+ host), `client.resolveTenant({ slug })`: the answer is `{ slug, branding }` and nothing else about the workspace.
198
+
164
199
  ## Workspaces (tenancy)
165
200
 
166
201
  A tenant ("workspace", or whatever `tenant.name` says) has members.
@@ -182,6 +217,8 @@ A tenant ("workspace", or whatever `tenant.name` says) has members.
182
217
  | Invite, list, withdraw | `POST`/`GET …/invitations`, `POST …/invitations/revoke` | `tenant.members.manage` |
183
218
  | What an invitation is for | `POST /api/invitations/preview { token }` | its holder |
184
219
  | Accept | `POST /api/invitations/accept { token }` | the invited, verified address |
220
+ | Decline | `POST /api/invitations/decline { token }` (`client.declineInvitation`) | the link's holder, no sign-in; final, and the address can be invited again |
221
+ | View as (preview a lower role, read-only) | `POST /api/tenants/current/preview { role }` (`client.previewRole`, `useAuth().preview`, `<RolePreview />`); `{ role: null }` stops | a member, for roles below their own; while it lasts the server answers as that role (with the accounts' base roles only) and refuses every change (`FORBIDDEN`, `hint: "PREVIEW"`) |
185
222
 
186
223
  Rules the server enforces:
187
224
  - **The tenant is the session's.** A tenant id in a request is only ever a request to switch, checked against your memberships. A tenant you are not a member of does not exist for you (`NOT_FOUND`).