@feltdb/feltkit 0.3.17 → 0.3.19

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 (188) hide show
  1. package/dist/app.d.ts +246 -13
  2. package/dist/app.js +215 -6
  3. package/dist/app.js.map +1 -1
  4. package/dist/appboundry/build.d.ts +70 -0
  5. package/dist/appboundry/build.js +62 -2
  6. package/dist/appboundry/build.js.map +1 -1
  7. package/dist/appboundry/guest.js +57 -3
  8. package/dist/appboundry/guest.js.map +1 -1
  9. package/dist/appboundry/host.js +7 -0
  10. package/dist/appboundry/host.js.map +1 -1
  11. package/dist/authorize.js +1 -0
  12. package/dist/authorize.js.map +1 -1
  13. package/dist/cli/compose.d.ts +31 -0
  14. package/dist/cli/compose.js +274 -0
  15. package/dist/cli/compose.js.map +1 -0
  16. package/dist/cli/create.d.ts +201 -0
  17. package/dist/cli/create.js +1139 -0
  18. package/dist/cli/create.js.map +1 -0
  19. package/dist/cli/deploy-appboundry-self-hosted.d.ts +2 -0
  20. package/dist/cli/deploy-appboundry-self-hosted.js +1 -1
  21. package/dist/cli/deploy-appboundry-self-hosted.js.map +1 -1
  22. package/dist/cli/deploy-appboundry.js +3 -0
  23. package/dist/cli/deploy-appboundry.js.map +1 -1
  24. package/dist/cli/deploy.d.ts +1 -0
  25. package/dist/cli/deploy.js +66 -6
  26. package/dist/cli/deploy.js.map +1 -1
  27. package/dist/cli/domain.d.ts +174 -0
  28. package/dist/cli/domain.js +1119 -0
  29. package/dist/cli/domain.js.map +1 -0
  30. package/dist/cli/main.d.ts +2 -0
  31. package/dist/cli/main.js +141 -7
  32. package/dist/cli/main.js.map +1 -1
  33. package/dist/cli/shell.d.ts +7 -0
  34. package/dist/cli/shell.js +59 -0
  35. package/dist/cli/shell.js.map +1 -0
  36. package/dist/client/index.d.ts +192 -5
  37. package/dist/client/index.js +301 -28
  38. package/dist/client/index.js.map +1 -1
  39. package/dist/component.d.ts +174 -0
  40. package/dist/component.js +77 -0
  41. package/dist/component.js.map +1 -0
  42. package/dist/composition/catalog.d.ts +3 -0
  43. package/dist/composition/catalog.js +217 -0
  44. package/dist/composition/catalog.js.map +1 -0
  45. package/dist/composition/contract.d.ts +165 -0
  46. package/dist/composition/contract.js +12 -0
  47. package/dist/composition/contract.js.map +1 -0
  48. package/dist/composition/execute.d.ts +110 -0
  49. package/dist/composition/execute.js +350 -0
  50. package/dist/composition/execute.js.map +1 -0
  51. package/dist/composition/generate.d.ts +105 -0
  52. package/dist/composition/generate.js +274 -0
  53. package/dist/composition/generate.js.map +1 -0
  54. package/dist/composition/plan.d.ts +131 -0
  55. package/dist/composition/plan.js +558 -0
  56. package/dist/composition/plan.js.map +1 -0
  57. package/dist/composition/profiles.d.ts +20 -0
  58. package/dist/composition/profiles.js +81 -0
  59. package/dist/composition/profiles.js.map +1 -0
  60. package/dist/composition/reconcile.d.ts +153 -0
  61. package/dist/composition/reconcile.js +282 -0
  62. package/dist/composition/reconcile.js.map +1 -0
  63. package/dist/composition/recover.d.ts +89 -0
  64. package/dist/composition/recover.js +407 -0
  65. package/dist/composition/recover.js.map +1 -0
  66. package/dist/composition/resolve.d.ts +2 -0
  67. package/dist/composition/resolve.js +208 -0
  68. package/dist/composition/resolve.js.map +1 -0
  69. package/dist/dashboard/assets/{index-DnIOVGF-.js → index-BrC1AtZ1.js} +5 -5
  70. package/dist/dashboard/index.html +1 -1
  71. package/dist/docs.d.ts +1 -1
  72. package/dist/docs.js +2 -0
  73. package/dist/docs.js.map +1 -1
  74. package/dist/index.d.ts +7 -3
  75. package/dist/index.js +2 -0
  76. package/dist/index.js.map +1 -1
  77. package/dist/react/auth.d.ts +131 -0
  78. package/dist/react/auth.js +830 -0
  79. package/dist/react/auth.js.map +1 -0
  80. package/dist/react/context.d.ts +8 -0
  81. package/dist/react/context.js +14 -0
  82. package/dist/react/context.js.map +1 -0
  83. package/dist/react/index.d.ts +3 -18
  84. package/dist/react/index.js +5 -13
  85. package/dist/react/index.js.map +1 -1
  86. package/dist/runtime/accounts.d.ts +33 -2
  87. package/dist/runtime/accounts.js +167 -27
  88. package/dist/runtime/accounts.js.map +1 -1
  89. package/dist/runtime/activity.d.ts +8 -1
  90. package/dist/runtime/activity.js.map +1 -1
  91. package/dist/runtime/audit.d.ts +43 -0
  92. package/dist/runtime/audit.js +52 -0
  93. package/dist/runtime/audit.js.map +1 -0
  94. package/dist/runtime/authority.d.ts +8 -1
  95. package/dist/runtime/authority.js +11 -2
  96. package/dist/runtime/authority.js.map +1 -1
  97. package/dist/runtime/challenges.d.ts +51 -0
  98. package/dist/runtime/challenges.js +121 -0
  99. package/dist/runtime/challenges.js.map +1 -0
  100. package/dist/runtime/changes.d.ts +22 -0
  101. package/dist/runtime/changes.js +51 -3
  102. package/dist/runtime/changes.js.map +1 -1
  103. package/dist/runtime/claims.d.ts +76 -0
  104. package/dist/runtime/claims.js +100 -0
  105. package/dist/runtime/claims.js.map +1 -0
  106. package/dist/runtime/context.d.ts +47 -5
  107. package/dist/runtime/contract.js +17 -3
  108. package/dist/runtime/contract.js.map +1 -1
  109. package/dist/runtime/data.d.ts +50 -4
  110. package/dist/runtime/data.js +113 -35
  111. package/dist/runtime/data.js.map +1 -1
  112. package/dist/runtime/escape-hatch.d.ts +37 -0
  113. package/dist/runtime/escape-hatch.js +76 -0
  114. package/dist/runtime/escape-hatch.js.map +1 -0
  115. package/dist/runtime/instance.js +2 -1
  116. package/dist/runtime/instance.js.map +1 -1
  117. package/dist/runtime/live.d.ts +48 -0
  118. package/dist/runtime/live.js +154 -0
  119. package/dist/runtime/live.js.map +1 -0
  120. package/dist/runtime/outbox.js +6 -0
  121. package/dist/runtime/outbox.js.map +1 -1
  122. package/dist/runtime/runtime.d.ts +103 -5
  123. package/dist/runtime/runtime.js +411 -41
  124. package/dist/runtime/runtime.js.map +1 -1
  125. package/dist/runtime/search.d.ts +54 -0
  126. package/dist/runtime/search.js +66 -0
  127. package/dist/runtime/search.js.map +1 -0
  128. package/dist/runtime/services-rules.d.ts +12 -0
  129. package/dist/runtime/services-rules.js +8 -0
  130. package/dist/runtime/services-rules.js.map +1 -0
  131. package/dist/runtime/services.js +5 -3
  132. package/dist/runtime/services.js.map +1 -1
  133. package/dist/runtime/sessions.d.ts +16 -2
  134. package/dist/runtime/sessions.js +40 -4
  135. package/dist/runtime/sessions.js.map +1 -1
  136. package/dist/runtime/tenancy.d.ts +198 -0
  137. package/dist/runtime/tenancy.js +397 -0
  138. package/dist/runtime/tenancy.js.map +1 -0
  139. package/dist/runtime/tenant-scope.d.ts +9 -0
  140. package/dist/runtime/tenant-scope.js +127 -0
  141. package/dist/runtime/tenant-scope.js.map +1 -0
  142. package/dist/runtime/transactions.d.ts +83 -3
  143. package/dist/runtime/transactions.js +53 -11
  144. package/dist/runtime/transactions.js.map +1 -1
  145. package/dist/server/admin.js +52 -0
  146. package/dist/server/admin.js.map +1 -1
  147. package/dist/server/components.d.ts +44 -0
  148. package/dist/server/components.js +212 -0
  149. package/dist/server/components.js.map +1 -0
  150. package/dist/server/index.d.ts +4 -1
  151. package/dist/server/index.js +324 -63
  152. package/dist/server/index.js.map +1 -1
  153. package/dist/server/mcp.js +6 -3
  154. package/dist/server/mcp.js.map +1 -1
  155. package/dist/server/project.d.ts +27 -0
  156. package/dist/server/project.js +63 -0
  157. package/dist/server/project.js.map +1 -1
  158. package/dist/server/public.d.ts +2 -0
  159. package/dist/server/public.js +2 -0
  160. package/dist/server/public.js.map +1 -1
  161. package/dist/server/session-http.d.ts +48 -0
  162. package/dist/server/session-http.js +116 -0
  163. package/dist/server/session-http.js.map +1 -0
  164. package/dist/server/tenancy.d.ts +40 -0
  165. package/dist/server/tenancy.js +191 -0
  166. package/dist/server/tenancy.js.map +1 -0
  167. package/dist/testing/index.d.ts +19 -0
  168. package/dist/testing/index.js +22 -2
  169. package/dist/testing/index.js.map +1 -1
  170. package/docs/AGENT-OPERATIONS.md +1 -0
  171. package/docs/APPBOUNDRY.md +11 -1
  172. package/docs/ARCHITECTURE.md +5 -3
  173. package/docs/AUTH.md +267 -0
  174. package/docs/COMPONENTS.md +91 -0
  175. package/docs/GUARANTEES.md +74 -7
  176. package/docs/README.md +4 -2
  177. package/docs/RESOLVER.md +4 -2
  178. package/docs/SECURITY.md +5 -4
  179. package/docs/TRANSACTIONS.md +98 -1
  180. package/docs/UPSTREAM-GAPS.md +2 -0
  181. package/package.json +15 -12
  182. package/skills/.claude-plugin/marketplace.json +1 -1
  183. package/skills/.claude-plugin/plugin.json +1 -1
  184. package/skills/feltkit-data/SKILL.md +6 -0
  185. package/skills/feltkit-services/SKILL.md +1 -1
  186. package/dist/runtime/account-links.d.ts +0 -19
  187. package/dist/runtime/account-links.js +0 -45
  188. package/dist/runtime/account-links.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"instance.js","sourceRoot":"","sources":["../../src/runtime/instance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,qBAAqB,EAAqB,MAAM,cAAc,CAAC;AAC3H,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AA2BlD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAElD,iGAAiG;AACjG,SAAS,gBAAgB,CAAC,KAAc;IACtC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI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AAS,cAAc,CAAC,EAAgB;IACtC,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,UAAU,EAAE,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,mEAAmE;AACnE,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,eAAe,EAAE,CAAC"}
@@ -0,0 +1,48 @@
1
+ import type { CollectionDefinition } from "../app.js";
2
+ /** Values of a changed record's keyed fields, before and after one committed write. */
3
+ export interface ChangedRecord {
4
+ id: string;
5
+ /** Keyed field values before the write (absent for an insert). */
6
+ before?: Record<string, unknown>;
7
+ /** Keyed field values after the write (absent for a delete). */
8
+ after?: Record<string, unknown>;
9
+ }
10
+ /** One equality predicate a read used. */
11
+ export interface ReadPredicate {
12
+ field: string;
13
+ value: unknown;
14
+ }
15
+ /** The fields of `definition` whose values change events describe (see the file comment). */
16
+ export declare function keyedFields(definition: CollectionDefinition): ReadonlySet<string>;
17
+ /** The keyed field values of a record (missing fields read as null, as an equality read sees them). */
18
+ export declare function keyedValues(definition: CollectionDefinition, record: Record<string, unknown>): Record<string, unknown>;
19
+ /**
20
+ * The one predicate that stands for an equality read, or null when none can (the read then counts
21
+ * as reading the whole collection). A record matching the read matches every one of its clauses,
22
+ * so any single keyed clause is a sound over-approximation; the most selective is preferred: `id`,
23
+ * then any other keyed field, then the tenant field (which every record of the tenant shares).
24
+ */
25
+ export declare function representative(definition: CollectionDefinition, clauses: Array<{
26
+ field: string;
27
+ eq?: unknown;
28
+ }>): ReadPredicate | null;
29
+ /** The opaque key for `collection.field = value`. Equal inputs give equal keys within one process. */
30
+ export declare function liveKey(collection: string, field: string, value: unknown): string;
31
+ /** Every key a changed record contributes (its keyed values before and after the write). */
32
+ export declare function changeKeys(collection: string, record: ChangedRecord): string[];
33
+ /**
34
+ * Collection reads, as a Set of names (what `reads` always was), that also remembers which
35
+ * collections were read only through predicates. A name added any other way (AppPort Services'
36
+ * bindings add theirs directly) counts as a whole-collection read.
37
+ */
38
+ export declare class ReadSet extends Set<string> {
39
+ #private;
40
+ add(collection: string): this;
41
+ /** A read of `collection` limited to `predicate` (null: the whole collection). */
42
+ record(collection: string, predicate: ReadPredicate | null): void;
43
+ /**
44
+ * The read set as `reads` reports it: every collection name (clients that know only names keep
45
+ * working), then `collection#key` for each predicate of a collection read only through predicates.
46
+ */
47
+ report(): string[];
48
+ }
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Live-query invalidation by predicate (FK-GAP-005).
3
+ *
4
+ * A query's result records the equality predicates it read (`collection.field = value`, from
5
+ * `get` by id and from the equality clauses of `find`/`count`/`query`/`search`). A change event
6
+ * carries, per collection, opaque keys for the values the changed records had on their *keyed
7
+ * fields*, before and after the write. A watched query re-runs when a change's keys meet its
8
+ * predicates, or when a collection it read without a usable predicate changed.
9
+ *
10
+ * Keyed fields are the fields a query is expected to filter by: `id`, every field of a declared
11
+ * index or unique constraint, every reference (`s.ref`) and the tenant field. Values of other
12
+ * fields never leave the server, not even as a digest; a predicate on them reads as "the whole
13
+ * collection" (coarse, as before).
14
+ *
15
+ * Keys are `HMAC-SHA256(K, collection ‖ field ‖ JSON(value))`, truncated to 128 bits, with K a
16
+ * random key drawn once per server process and never sent anywhere. The client only compares
17
+ * strings it was given (in `reads`, and in change events); it cannot compute a key, so it cannot
18
+ * test a guessed value offline against the change stream. The stream is further filtered by the
19
+ * server: a tenant-scoped collection's changes reach only subscribers working in that tenant
20
+ * (server/index.ts). What a key still reveals, to a subscriber that holds the same key from one of
21
+ * its own query results, is that a record with that keyed value changed: no more than re-running
22
+ * that query would show it, except for timing of changes the query itself filters out (an
23
+ * `authorize` check that hides the records, for example). docs/GUARANTEES.md "Live queries".
24
+ *
25
+ * A process-wide key is enough: local state has one writing process, and on a FeltDB server the
26
+ * change feed is collection-level (no keys), so keys from different processes are never compared.
27
+ * A restart draws a new key; the client re-runs every query when its stream reconnects.
28
+ */
29
+ import { createHmac, randomBytes } from "node:crypto";
30
+ import { REFERENCE_KEYWORD } from "../schema.js";
31
+ const PROCESS_KEY = randomBytes(32);
32
+ const keyedCache = new WeakMap();
33
+ /** The fields of `definition` whose values change events describe (see the file comment). */
34
+ export function keyedFields(definition) {
35
+ const cached = keyedCache.get(definition);
36
+ if (cached)
37
+ return cached;
38
+ const fields = new Set(["id"]);
39
+ for (const index of definition.indexes ?? [])
40
+ for (const field of index.fields)
41
+ fields.add(field);
42
+ for (const unique of definition.unique ?? [])
43
+ for (const field of Array.isArray(unique) ? unique : unique.fields)
44
+ fields.add(field);
45
+ if (definition.tenant)
46
+ fields.add(definition.tenant.field);
47
+ try {
48
+ const json = definition.schema.toJSONSchema();
49
+ for (const [field, schema] of Object.entries(json.properties ?? {})) {
50
+ const variants = Array.isArray(schema.anyOf) ? schema.anyOf : [schema];
51
+ if (variants.some((v) => typeof v?.[REFERENCE_KEYWORD] === "string"))
52
+ fields.add(field);
53
+ }
54
+ }
55
+ catch {
56
+ /* a schema without JSON Schema: indexes, unique fields and the tenant field still count */
57
+ }
58
+ keyedCache.set(definition, fields);
59
+ return fields;
60
+ }
61
+ function scalar(value) {
62
+ return value === null || value === undefined || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
63
+ }
64
+ /** The keyed field values of a record (missing fields read as null, as an equality read sees them). */
65
+ export function keyedValues(definition, record) {
66
+ const out = {};
67
+ for (const field of keyedFields(definition)) {
68
+ const value = record[field];
69
+ if (scalar(value))
70
+ out[field] = value ?? null;
71
+ }
72
+ return out;
73
+ }
74
+ /**
75
+ * The one predicate that stands for an equality read, or null when none can (the read then counts
76
+ * as reading the whole collection). A record matching the read matches every one of its clauses,
77
+ * so any single keyed clause is a sound over-approximation; the most selective is preferred: `id`,
78
+ * then any other keyed field, then the tenant field (which every record of the tenant shares).
79
+ */
80
+ export function representative(definition, clauses) {
81
+ const keyed = keyedFields(definition);
82
+ const usable = clauses.filter((c) => "eq" in c && c.eq !== undefined && scalar(c.eq) && keyed.has(c.field));
83
+ if (!usable.length)
84
+ return null;
85
+ const rank = (field) => (field === "id" ? 0 : field === definition.tenant?.field ? 2 : 1);
86
+ const best = [...usable].sort((a, b) => rank(a.field) - rank(b.field) || a.field.localeCompare(b.field))[0];
87
+ return { field: best.field, value: best.eq };
88
+ }
89
+ /** The opaque key for `collection.field = value`. Equal inputs give equal keys within one process. */
90
+ export function liveKey(collection, field, value) {
91
+ return createHmac("sha256", PROCESS_KEY)
92
+ .update(`${collection}\u0000${field}\u0000${JSON.stringify(value ?? null)}`)
93
+ .digest("base64url")
94
+ .slice(0, 22);
95
+ }
96
+ /** Every key a changed record contributes (its keyed values before and after the write). */
97
+ export function changeKeys(collection, record) {
98
+ const keys = new Set();
99
+ for (const values of [record.before, record.after]) {
100
+ if (!values)
101
+ continue;
102
+ for (const [field, value] of Object.entries(values))
103
+ keys.add(liveKey(collection, field, value));
104
+ }
105
+ return [...keys];
106
+ }
107
+ /**
108
+ * Collection reads, as a Set of names (what `reads` always was), that also remembers which
109
+ * collections were read only through predicates. A name added any other way (AppPort Services'
110
+ * bindings add theirs directly) counts as a whole-collection read.
111
+ */
112
+ export class ReadSet extends Set {
113
+ #predicates = new Map();
114
+ #whole = new Set();
115
+ #quiet = false;
116
+ add(collection) {
117
+ if (!this.#quiet)
118
+ this.#whole.add(collection);
119
+ return super.add(collection);
120
+ }
121
+ /** A read of `collection` limited to `predicate` (null: the whole collection). */
122
+ record(collection, predicate) {
123
+ if (!predicate) {
124
+ this.add(collection);
125
+ return;
126
+ }
127
+ this.#quiet = true;
128
+ try {
129
+ super.add(collection);
130
+ }
131
+ finally {
132
+ this.#quiet = false;
133
+ }
134
+ let map = this.#predicates.get(collection);
135
+ if (!map)
136
+ this.#predicates.set(collection, (map = new Map()));
137
+ map.set(`${predicate.field}\u0000${JSON.stringify(predicate.value ?? null)}`, predicate);
138
+ }
139
+ /**
140
+ * The read set as `reads` reports it: every collection name (clients that know only names keep
141
+ * working), then `collection#key` for each predicate of a collection read only through predicates.
142
+ */
143
+ report() {
144
+ const out = [...this];
145
+ for (const collection of this) {
146
+ if (this.#whole.has(collection))
147
+ continue;
148
+ for (const predicate of this.#predicates.get(collection)?.values() ?? [])
149
+ out.push(`${collection}#${liveKey(collection, predicate.field, predicate.value)}`);
150
+ }
151
+ return out;
152
+ }
153
+ }
154
+ //# sourceMappingURL=live.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live.js","sourceRoot":"","sources":["../../src/runtime/live.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;AAiBpC,MAAM,UAAU,GAAG,IAAI,OAAO,EAA6C,CAAC;AAE5E,6FAA6F;AAC7F,MAAM,UAAU,WAAW,CAAC,UAAgC;IAC1D,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC1C,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,MAAM,MAAM,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,OAAO,IAAI,EAAE;QAAE,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM;YAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAClG,KAAK,MAAM,MAAM,IAAI,UAAU,CAAC,MAAM,IAAI,EAAE;QAAE,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,MAA4B,CAAC,CAAC,CAAE,MAAwC,CAAC,MAAM;YAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9L,IAAI,UAAU,CAAC,MAAM;QAAE,MAAM,C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;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC;YACH,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACxB,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACtB,CAAC;QACD,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC3C,IAAI,CAAC,GAAG;YAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC;QAC9D,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,KAAK,SAAS,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IAC3F,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;QACtB,KAAK,MAAM,UAAU,IAAI,IAAI,EAAE,CAAC;YAC9B,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;gBAAE,SAAS;YAC1C,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,UAAU,IAAI,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC/J,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
@@ -38,6 +38,12 @@ export async function performEffect(services, record) {
38
38
  throw new FeltKitError("CONFIGURATION", "The Webhooks service is not enabled.");
39
39
  return { deliveries: (await services.webhooks.emit(effect.type, effect.payload)).deliveries };
40
40
  }
41
+ else if (effect.service === "agent") {
42
+ throw new FeltKitError("INTERNAL", "An agent run is performed by the runtime, not through services.");
43
+ }
44
+ else if (effect.service === "component") {
45
+ throw new FeltKitError("INTERNAL", "Component work is claimed and performed by its component, not through services.");
46
+ }
41
47
  else {
42
48
  if (!services.jobs)
43
49
  throw new FeltKitError("CONFIGURATION", "The Jobs service is not enabled.");
@@ -1 +1 @@
1
- {"version":3,"file":"outbox.js","sourceRoot":"","sources":["../../src/runtime/outbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C,uFAAuF;AACvF,6CAA6C;AAC7C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,0BAA0B,EAA0D,MAAM,mBAAmB,CAAC;AAE7L,+CAA+C;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAG,GAAW,EAAE,CAAC,UAAU,UAAU,EAAE,EAAE,CAAC;AAElE,8DAA8D;AAC9D,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAuB,EAAE,MAAoB;IAC/E,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7B,IAAI,MAAM,CAAC,OAAO,KAAK,eAAe,EAAE,CAAC;QACvC,wEAAwE;QACxE,MAAM,IAAI,GAAG,CAAC,MAAO,QAAQ,CAAC,aAAqC,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,CAAC,KAAK,CAAC,cAAc,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC,CAAgC,CAAC;QACxL,OAAO,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACrD,CAAC;SAAM,IAAI,MAAM,CAAC,OAAO,KAAK,UA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AC;AACH,CAAC"}
@@ -1,13 +1,13 @@
1
1
  import { type Authorizer } from "@appport/sdk";
2
2
  import type { AppPortApplication } from "@appport/sdk";
3
- import type { FeltKitApp, FunctionDefinition, PrincipalInput } from "../app.js";
3
+ import { type AgentDefinition, type FeltKitApp, type FunctionDefinition, type PrincipalInput } from "../app.js";
4
4
  import { IntegrationHost } from "./integrations.js";
5
5
  import { type BackupHeader, type BackupSink } from "./backup.js";
6
6
  import { type FeltKitErrorJSON } from "../errors.js";
7
7
  import { ActivityLog, type ActivityVia } from "./activity.js";
8
8
  import { Authority, type Principal } from "./authority.js";
9
9
  import { ChangeFeed } from "./changes.js";
10
- import type { Logger } from "./context.js";
10
+ import type { AgentTrigger, Logger } from "./context.js";
11
11
  import { ModelHost } from "./decisions.js";
12
12
  import { type EnvironmentDescriptor } from "./environment.js";
13
13
  import { type InstanceFactory, type StateInstance } from "./instance.js";
@@ -18,9 +18,11 @@ import { type HostCredentials } from "./credentials.js";
18
18
  import { AgentHost, type AgentHooks } from "./agent.js";
19
19
  import { FeltDbIdempotencyStore } from "./idempotency.js";
20
20
  import { FeltDbSessionStore } from "./sessions.js";
21
+ import { type AuditRecord } from "./audit.js";
21
22
  import { AccountStore } from "./accounts.js";
22
23
  import { type AccountMail } from "./mail.js";
23
- import { type LinkPurpose } from "./account-links.js";
24
+ import { ChallengeStore, type ChallengePurpose } from "./challenges.js";
25
+ import { TenancyStore } from "./tenancy.js";
24
26
  export interface LoadedProject {
25
27
  app: FeltKitApp;
26
28
  /** "module:export" → definition */
@@ -36,6 +38,8 @@ export interface ApprovedAction {
36
38
  /** The person who approved it: "user:<id>". */
37
39
  approvedBy: string;
38
40
  }
41
+ import type { ComponentWorkItem, ComponentWorkOutcome } from "../component.js";
42
+ export type { ComponentWorkItem, ComponentWorkOutcome };
39
43
  export interface CallOptions {
40
44
  principal: Principal | null;
41
45
  via: ActivityVia;
@@ -54,6 +58,11 @@ export interface CallOptions {
54
58
  * again. AppPort releases its own claim when the handler throws, whatever the error (A5).
55
59
  */
56
60
  idempotencyReplayKey?: string;
61
+ /** @internal An application agent's run (`app.agent`): the only way its handler is called. */
62
+ agentRun?: {
63
+ definition: AgentDefinition;
64
+ trigger: AgentTrigger;
65
+ };
57
66
  }
58
67
  export type CallResult = {
59
68
  ok: true;
@@ -136,6 +145,10 @@ export declare class FeltKitRuntime {
136
145
  readonly sessions: FeltDbSessionStore;
137
146
  /** Built-in accounts (`auth.accounts`), or null when the app does not use them. */
138
147
  accounts: AccountStore | null;
148
+ /** Account e-mail challenges (verify, reset, magic link, address change). Null without accounts. */
149
+ challenges: ChallengeStore | null;
150
+ /** Tenants, memberships and invitations (`auth.tenant`). Null without tenancy. */
151
+ tenancy: TenancyStore | null;
139
152
  /** Account e-mail (auth.accounts.email) through Mailerport, or null (none declared, or production without MAILPORT_URL). */
140
153
  mail: AccountMail | null;
141
154
  /** This server's own URL, set by the HTTP server: development's fallback for links. */
@@ -199,6 +212,11 @@ export declare class FeltKitRuntime {
199
212
  * expired, and revoked credentials resolve to null.
200
213
  */
201
214
  principalForToken(token: string | undefined): Promise<Principal | null>;
215
+ /**
216
+ * The principal working in a tenant: the live membership's role joins its roles, and its claims
217
+ * come along. No active membership (removed, or never a member) means no tenant and no tenant role.
218
+ */
219
+ withTenant(principal: Principal, tenantId: string | undefined): Promise<Principal>;
202
220
  /**
203
221
  * A principal as it is now, by id: a live API key, else the most recent active session.
204
222
  * With `devUsers`, development also resolves declared dev identities (the agent's
@@ -207,13 +225,43 @@ export declare class FeltKitRuntime {
207
225
  resolvePrincipal(subjectId: string, options?: {
208
226
  devUsers?: boolean;
209
227
  }): Promise<Principal | null>;
228
+ /**
229
+ * Identities the application itself declares — its app agents and its runtime components — are what the
230
+ * declaration says, with no session: their durable work resolves the same after a restart or a session's
231
+ * expiry. Their tenant authority is still their live membership (withTenant), so revoking it is immediate.
232
+ */
233
+ declaredPrincipal(subjectId: string): Principal | null;
210
234
  /**
211
235
  * After-commit effects whose process stopped before performing them (pending past
212
236
  * OUTBOX_RECOVER_AFTER_MS, or performing past OUTBOX_PERFORMING_STALE_MS), performed as the
213
237
  * caller's current principal. A caller that can no longer be resolved fails the record.
214
238
  */
215
239
  recoverOutbox(now?: number): Promise<number>;
240
+ /**
241
+ * Claim due work for runtime component `component`: pending work that is due, and work whose
242
+ * previous claim's lease expired (`resumed`: an earlier attempt may have partly happened). Each claim
243
+ * is a version-checked write, so two performers never hold the same item.
244
+ */
245
+ claimComponentWork(component: string, options?: {
246
+ kinds?: readonly string[];
247
+ limit?: number;
248
+ leaseMs?: number;
249
+ }, now?: number): Promise<ComponentWorkItem[]>;
250
+ /**
251
+ * Settle a claimed work item, fenced on the claim: a performer whose lease was taken over cannot settle
252
+ * it (CONFLICT). done → `result` is the receipt; retry → pending again after a backoff, until maxAttempts
253
+ * (then failed); failed; unknown → terminal, for a person to resolve (`feltkit outbox retry`).
254
+ */
255
+ finishComponentWork(component: string, item: {
256
+ id: string;
257
+ version: number;
258
+ }, outcome: ComponentWorkOutcome, now?: number): Promise<OutboxRecord["state"]>;
216
259
  /** After-commit effects, newest first (optionally only those in `state`). */
260
+ /** The audit trail: one record per committed mutation, oldest first (runtime/audit.ts). */
261
+ auditTrail(filter?: {
262
+ tenantId?: string;
263
+ principalId?: string;
264
+ }): Promise<AuditRecord[]>;
217
265
  listOutbox(filter?: {
218
266
  state?: OutboxRecord["state"];
219
267
  limit?: number;
@@ -223,6 +271,8 @@ export declare class FeltKitRuntime {
223
271
  * kept), then performed now as its caller, or by the worker if that caller cannot be resolved.
224
272
  */
225
273
  retryOutbox(id: string, by: string): Promise<OutboxRecord>;
274
+ /** Wait for the agent runs started so far (and any they start) to finish their current attempt. */
275
+ settleAgents(): Promise<void>;
226
276
  /** Drive durable service work once (jobs, schedules, webhook deliveries, recovered after-commit effects). */
227
277
  runServices(): Promise<ServiceTick>;
228
278
  /**
@@ -244,8 +294,21 @@ export declare class FeltKitRuntime {
244
294
  * it, never a request's Host header (which a caller chooses).
245
295
  */
246
296
  publicUrl(): string;
247
- /** A signed account link (verify an address, reset a password) for this app. */
248
- accountLink(purpose: LinkPurpose, accountId: string, bind: string): string;
297
+ /**
298
+ * Issue an account e-mail challenge and send it through AppPort Services' notifications (and
299
+ * Mailerport). Returns false when nothing was sent (no account e-mail, or the subject's hourly
300
+ * limit was reached); callers answer the same either way.
301
+ */
302
+ /** The link that accepts an invitation: on the app's public URL (relative when that is not configured). */
303
+ invitationLink(token: string): string;
304
+ /** E-mail a workspace invitation (when the app sends account e-mail). False when nothing was sent. */
305
+ sendInvitation(invitationId: string, email: string): Promise<boolean>;
306
+ sendChallenge(input: {
307
+ purpose: ChallengePurpose;
308
+ subject: string;
309
+ recipient: string;
310
+ data?: Record<string, string>;
311
+ }): Promise<boolean>;
249
312
  /**
250
313
  * The key that signs account links and sign-in provider state: FELTKIT_AUTH_SECRET, else
251
314
  * (development, test, and production with local state) a key generated once and kept beside
@@ -260,11 +323,25 @@ export declare class FeltKitRuntime {
260
323
  ttlMs?: number;
261
324
  via: ActivityVia;
262
325
  actor?: Principal | null;
326
+ tenantId?: string | null;
263
327
  }): Promise<{
264
328
  token: string;
265
329
  principal: Principal;
266
330
  expiresAt: string | undefined;
267
331
  }>;
332
+ /**
333
+ * An agent or service identity this app knows: one holding an active session (operator-issued:
334
+ * `feltkit session create --type agent`), an application agent the app declares (`app.agent`), or a
335
+ * declared development agent in development. Null for people (they join tenants by invitation) and
336
+ * for unknown ids.
337
+ */
338
+ knownNonPersonPrincipal(id: string): Promise<{
339
+ id: string;
340
+ type: "agent" | "service";
341
+ displayName?: string;
342
+ } | null>;
343
+ /** Record an authentication event (sign-in failures, revocations, membership changes) in the activity log. */
344
+ recordAuth(name: string, principal: Principal | null, detail: Record<string, unknown>, outcome?: "success" | "denied" | "error", via?: ActivityVia): void;
268
345
  /** Run a query or mutation as `principal`. Authority is checked before the handler runs. */
269
346
  call(name: string, rawArgs: unknown, options: CallOptions): Promise<CallResult>;
270
347
  /** An MCP tool surface for one agent identity, backed by AppPort's MCP bridge. */
@@ -344,3 +421,24 @@ export declare class FeltKitRuntime {
344
421
  * so /api and /appport answer the same status for the same failure.
345
422
  */
346
423
  export declare const FELTKIT_APPPORT_STATUS: Readonly<Record<string, number>>;
424
+ /** What an account e-mail template receives. */
425
+ export interface AccountMailInput {
426
+ app: string;
427
+ link: string;
428
+ /** 8 digits, for typing on another device (magic link); the link is enough otherwise. */
429
+ code: string;
430
+ /** The address being confirmed (address change); "" otherwise. */
431
+ email: string;
432
+ expiresInMinutes: number;
433
+ }
434
+ /** What the invitation e-mail template receives. */
435
+ export interface InvitationMailInput {
436
+ app: string;
437
+ link: string;
438
+ /** The tenant's name, and what the app calls tenants ("workspace"). */
439
+ tenant: string;
440
+ word: string;
441
+ role: string;
442
+ inviter: string;
443
+ expiresInDays: number;
444
+ }