@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
@@ -0,0 +1,274 @@
1
+ /**
2
+ * `feltkit compose`: write the generator-owned foundation files, or check them.
3
+ *
4
+ * It reads and writes only the three generated paths (composition/generate.ts). It never loads the
5
+ * application (feltkit/app.ts imports the generated declaration, so loading it first would be circular)
6
+ * and never reads or writes any other file. A generated file that differs from its lock is refused, not
7
+ * overwritten: the developer decides what happens to the change.
8
+ */
9
+ import { mkdirSync, renameSync, writeFileSync } from "node:fs";
10
+ import { dirname, join } from "node:path";
11
+ import { FeltKitError } from "../errors.js";
12
+ import { GENERATED_PATHS, RECORD_PATH, checkFoundation, generateFoundation, } from "../composition/generate.js";
13
+ import { readGeneratedState, reconcile } from "../composition/reconcile.js";
14
+ import { planComposition } from "../composition/plan.js";
15
+ import { executePlan } from "../composition/execute.js";
16
+ import { inspectRecovery } from "../composition/recover.js";
17
+ export { readGeneratedState };
18
+ import { c, line, symbols } from "./output.js";
19
+ /** Problems that mean a generated file is not what the generator wrote: never overwritten. */
20
+ const REFUSE = new Set(["GENERATED_FILE_MODIFIED", "RECORD_MODIFIED", "RECORD_MALFORMED", "LOCK_MALFORMED", "UNTRACKED_GENERATED_FILE"]);
21
+ export function parseParams(values) {
22
+ const params = {};
23
+ for (const raw of values) {
24
+ const eq = raw.indexOf("=");
25
+ const key = eq < 0 ? raw : raw.slice(0, eq);
26
+ const dot = key.lastIndexOf(".");
27
+ if (eq < 0 || dot <= 0 || dot === key.length - 1) {
28
+ throw new FeltKitError("INVALID_ARGUMENT", `--param ${raw} is not <capability>.<parameter>=<value>.`, { hint: "For example --param identity.accounts.emailFrom=auth@example.com" });
29
+ }
30
+ const text = raw.slice(eq + 1);
31
+ let value = text;
32
+ try {
33
+ value = JSON.parse(text);
34
+ }
35
+ catch {
36
+ // Not JSON: the string itself.
37
+ }
38
+ const capability = key.slice(0, dot);
39
+ const parameter = key.slice(dot + 1);
40
+ const own = (params[capability] ??= {});
41
+ if (parameter in own)
42
+ throw new FeltKitError("INVALID_ARGUMENT", `--param ${key} was given more than once; give it once.`);
43
+ own[parameter] = value;
44
+ }
45
+ return params;
46
+ }
47
+ function printProblem(p) {
48
+ line(`${symbols.fail} ${p.code}${p.file ? ` ${p.file}` : ""}: ${p.message}`);
49
+ if (p.expected !== undefined)
50
+ line(` expected ${p.expected}`);
51
+ if (p.observed !== undefined)
52
+ line(` observed ${p.observed}`);
53
+ for (const r of p.recovery)
54
+ line(c.dim(` - ${r}`));
55
+ }
56
+ /** Write atomically (temporary file, then rename), so an interrupted run never leaves half a file. */
57
+ function write(projectDir, path, text) {
58
+ const file = join(projectDir, path);
59
+ mkdirSync(dirname(file), { recursive: true });
60
+ const temporary = `${file}.${process.pid}.tmp`;
61
+ writeFileSync(temporary, text);
62
+ renameSync(temporary, file);
63
+ }
64
+ export function compose(projectDir, options) {
65
+ const state = readGeneratedState(projectDir);
66
+ const check = checkFoundation(state);
67
+ if (options.check) {
68
+ if (options.json)
69
+ line(JSON.stringify({ ok: check.ok, problems: check.problems }, null, 2));
70
+ else if (check.ok)
71
+ line(`${symbols.ok} The generated foundation is current: ${GENERATED_PATHS.join(", ")} match ${RECORD_PATH} and FeltKit's definitions.`);
72
+ else
73
+ check.problems.forEach(printProblem);
74
+ return check.ok ? 0 : 1;
75
+ }
76
+ // Refuse before anything is written: a changed generated file stays exactly as the developer left it.
77
+ const refused = check.problems.filter((p) => REFUSE.has(p.code));
78
+ if (refused.length) {
79
+ refused.forEach(printProblem);
80
+ line(`${symbols.fail} Nothing was written. \`feltkit compose\` never overwrites a generated file that was changed after it wrote it.`);
81
+ return 1;
82
+ }
83
+ const fresh = options.profile !== undefined || options.include.length > 0 || options.params.length > 0;
84
+ let inputs;
85
+ if (fresh) {
86
+ if (!options.profile)
87
+ throw new FeltKitError("INVALID_ARGUMENT", "Name the profile: feltkit compose --profile <collaborative-workspace|individual-accounts> [--param identity.accounts.emailFrom=<sender>]");
88
+ inputs = { profile: options.profile, include: options.include, params: parseParams(options.params) };
89
+ }
90
+ else if (check.record) {
91
+ inputs = { profile: check.record.profile.id, include: check.record.include, params: check.record.params };
92
+ }
93
+ else {
94
+ throw new FeltKitError("INVALID_ARGUMENT", `There is no ${RECORD_PATH} to compose from.`, { hint: "Start one: feltkit compose --profile <collaborative-workspace|individual-accounts> [--param identity.accounts.emailFrom=<sender>]" });
95
+ }
96
+ const result = generateFoundation(inputs);
97
+ if (!result.ok) {
98
+ for (const e of result.errors) {
99
+ line(`${symbols.fail} ${e.code}${e.capability ? ` ${e.capability}${e.parameter ? `.${e.parameter}` : ""}` : ""}: ${e.message}`);
100
+ line(c.dim(` ${e.hint}`));
101
+ }
102
+ line(`${symbols.fail} Nothing was written.`);
103
+ return 1;
104
+ }
105
+ const written = [];
106
+ for (const path of GENERATED_PATHS) {
107
+ if (state[path] === result.files[path])
108
+ continue;
109
+ write(projectDir, path, result.files[path]);
110
+ written.push(path);
111
+ }
112
+ if (options.json) {
113
+ line(JSON.stringify({ ok: true, written, composition: result.record.composition, capabilities: result.record.capabilities, limitations: result.record.limitations }, null, 2));
114
+ return 0;
115
+ }
116
+ if (!written.length)
117
+ line(`${symbols.ok} The generated foundation is already current (${result.record.composition.slice(0, 19)}…). Nothing was written.`);
118
+ else
119
+ for (const path of written)
120
+ line(`${symbols.ok} ${path} written`);
121
+ line(c.dim(` ${result.record.profile.id} v${result.record.profile.version}: ${result.record.capabilities.map((x) => `${x.id}@${x.version}`).join(", ")}`));
122
+ if (result.record.limitations.length)
123
+ line(c.dim(` The application's own tests must uphold: ${result.record.limitations.join(", ")}`));
124
+ if (written.includes(GENERATED_PATHS[0]))
125
+ line(c.dim(" feltkit/app.ts is yours: import { foundation } from \"./_foundation/declaration.js\" and spread it into feltkit({...})."));
126
+ return 0;
127
+ }
128
+ // ── Reconciliation (read-only) ───────────────────────────────────────────────
129
+ function printFinding(f) {
130
+ line(`${symbols.fail} ${f.state} · ${f.code}${f.paths.length ? ` ${f.paths.join(", ")}` : ""}${f.confidence === "uncertain" ? c.dim(" (needs a person)") : ""}`);
131
+ line(` ${f.what}`);
132
+ line(c.dim(` ${f.why}`));
133
+ if (f.expected !== undefined)
134
+ line(` expected ${f.expected}`);
135
+ if (f.observed !== undefined)
136
+ line(` observed ${f.observed}`);
137
+ for (const n of f.next)
138
+ line(c.dim(` - ${n}`));
139
+ }
140
+ /** `feltkit compose reconcile`: report, never change. */
141
+ export async function reconcileCommand(projectDir, json) {
142
+ const report = await reconcile(projectDir);
143
+ if (json) {
144
+ line(JSON.stringify(report, null, 2));
145
+ return report.ok ? 0 : 1;
146
+ }
147
+ if (report.ok) {
148
+ line(`${symbols.ok} CURRENT: the generated foundation is what the recorded composition produces with this FeltKit, and ${report.application.file} consumes it.`);
149
+ }
150
+ else {
151
+ line(`${report.state} (${report.findings.length} finding${report.findings.length === 1 ? "" : "s"})`);
152
+ report.findings.forEach(printFinding);
153
+ }
154
+ const r = report.recorded;
155
+ if (r.profile)
156
+ line(c.dim(` Recorded: ${r.profile.id} v${r.profile.version}; ${r.capabilities.map((x) => `${x.id}@${x.version}`).join(", ")}; ${r.generator}; FeltKit ${r.sdk}; composition ${r.composition?.slice(0, 19)}…`));
157
+ line(c.dim(` Installed: ${report.installed.generator}; FeltKit ${report.installed.sdk}`));
158
+ const a = report.application;
159
+ if (a.status === "analyzed") {
160
+ const counts = Object.values(a.consumption ?? {}).reduce((n, k) => ({ ...n, [k]: (n[k] ?? 0) + 1 }), {});
161
+ line(c.dim(` ${a.file}: imports the foundation: ${a.imports ? "yes" : "no"}; paths ${Object.entries(counts).map(([k, n]) => `${n} ${k}`).join(", ")}${a.additions?.length ? `; application additions: ${a.additions.join(", ")}` : ""}`));
162
+ }
163
+ else
164
+ line(c.dim(` ${a.file}: not analyzed (${a.reason})`));
165
+ line(c.dim(" Nothing was written: reconciliation only reports."));
166
+ return report.ok ? 0 : 1;
167
+ }
168
+ const MARK = { DETERMINISTIC: symbols.ok, REVIEW_REQUIRED: "?", BLOCKED: symbols.fail, UNSUPPORTED: symbols.fail };
169
+ function printOperation(o) {
170
+ line(`${MARK[o.classification]} ${o.id} ${c.dim(`[${o.classification}, ${o.boundary}]`)}`);
171
+ if (o.current !== undefined || o.proposed !== undefined)
172
+ line(` ${o.current ?? "—"} → ${o.proposed ?? "—"}`);
173
+ line(c.dim(` ${o.reason}`));
174
+ if (o.decision)
175
+ line(` ${o.classification === "REVIEW_REQUIRED" ? "decide" : "blocked"}: ${o.decision}`);
176
+ if (o.dependsOn.length)
177
+ line(c.dim(` after ${o.dependsOn.join(", ")}`));
178
+ }
179
+ /** `feltkit compose plan`: show what would change, never change it. */
180
+ export async function planCommand(projectDir, options) {
181
+ const plan = await planComposition(projectDir, {
182
+ ...(options.profile !== undefined ? { profile: options.profile } : {}),
183
+ include: options.include,
184
+ exclude: options.exclude,
185
+ params: parseParams(options.params),
186
+ });
187
+ const failed = plan.status === "BLOCKED" || plan.status === "UNSUPPORTED";
188
+ if (options.json) {
189
+ line(JSON.stringify(plan, null, 2));
190
+ return failed ? 1 : 0;
191
+ }
192
+ line(`${plan.status} ${c.dim(`plan ${plan.id.slice(0, 19)}… · target ${plan.target.source}: ${plan.target.inputs.profile}${plan.target.inputs.include.length ? ` + ${plan.target.inputs.include.join(", ")}` : ""}`)}`);
193
+ if (plan.status === "NO_CHANGE")
194
+ line(`${symbols.ok} The recorded composition is what the installed definitions produce; nothing would change.`);
195
+ const byId = new Map(plan.operations.map((o) => [o.id, o]));
196
+ for (const id of plan.order)
197
+ printOperation(byId.get(id));
198
+ if (plan.affected.files.length)
199
+ line(c.dim(` Files: ${plan.affected.files.join(", ")}`));
200
+ if (plan.affected.paths.length)
201
+ line(c.dim(` Declaration paths: ${plan.affected.paths.join(", ")}`));
202
+ if (plan.decisions.length)
203
+ line(` ${plan.decisions.length} decision(s) before this can be applied.`);
204
+ if (plan.blockers.length)
205
+ line(` ${plan.blockers.length} blocker(s).`);
206
+ if (plan.unsupported.length)
207
+ line(` ${plan.unsupported.length} unsupported target change(s).`);
208
+ line(c.dim(" Nothing was written: a plan only shows the change. `feltkit compose --profile … --param …` applies one."));
209
+ return failed ? 1 : 0;
210
+ }
211
+ /** `feltkit compose apply`: execute exactly one approved plan, and show the evidence. */
212
+ export async function applyCommand(projectDir, options) {
213
+ const result = await executePlan(projectDir, {
214
+ ...(options.profile !== undefined ? { profile: options.profile } : {}),
215
+ include: options.include,
216
+ exclude: options.exclude,
217
+ params: parseParams(options.params),
218
+ ...(options.approve !== undefined ? { approve: options.approve } : {}),
219
+ });
220
+ if (options.json) {
221
+ line(JSON.stringify(result, null, 2));
222
+ return result.ok ? 0 : 1;
223
+ }
224
+ line(`${result.ok ? symbols.ok : symbols.fail} ${result.code} ${c.dim(result.plan.id ? `plan ${result.plan.id.slice(0, 19)}…` : "")}`);
225
+ line(` ${result.message}`);
226
+ for (const r of result.operations.refused)
227
+ line(c.dim(` refused ${r.id}: ${r.reason}`));
228
+ for (const [path, f] of Object.entries(result.files))
229
+ if (f.written || f.before !== f.after)
230
+ line(` ${f.written ? "written" : "changed"} ${path}: ${f.before?.slice(0, 19) ?? "absent"}… → ${f.after?.slice(0, 19) ?? "absent"}…`);
231
+ if (result.operations.executed.length)
232
+ line(c.dim(` executed ${result.operations.executed.length} operation(s): ${result.operations.executed.join(", ")}`));
233
+ if (result.postconditions.length)
234
+ line(c.dim(` verified: ${result.postconditions.join("; ")}`));
235
+ for (const e of result.evidence)
236
+ line(c.dim(` · ${e}`));
237
+ if (result.transaction.outcome === "interrupted" || result.code === "POSTCONDITION_FAILED")
238
+ line(` Journal: ${result.transaction.journal}`);
239
+ return result.ok ? 0 : 1;
240
+ }
241
+ // ── Recovery inspection (reads only) ─────────────────────────────────────────
242
+ /** `feltkit compose recover --inspect`: explain an interrupted transaction; change nothing. */
243
+ export async function recoverCommand(projectDir, json) {
244
+ const report = await inspectRecovery(projectDir);
245
+ if (json) {
246
+ line(JSON.stringify(report, null, 2));
247
+ return report.ok ? 0 : 1;
248
+ }
249
+ line(`${report.ok ? symbols.ok : symbols.fail} ${report.state}${report.journal.present ? c.dim(` journal ${report.journal.path} (${report.journal.valid ? `phase ${report.journal.phase}, plan ${report.journal.plan?.slice(0, 19)}…` : "invalid"})`) : c.dim(" no journal")}`);
250
+ for (const p of report.journal.problems)
251
+ line(` journal: ${p}`);
252
+ for (const f of report.files) {
253
+ line(` ${f.class.padEnd(10)} ${f.path}${f.committed ? c.dim(" (journaled as replaced)") : ""}`);
254
+ line(c.dim(` ${f.reason}`));
255
+ line(c.dim(` prior ${f.prior ?? "absent"} · expected ${f.expected} · observed ${f.observed ?? "absent"}`));
256
+ if (f.priorSources.length || f.expectedSources.length)
257
+ line(c.dim(` prior bytes: ${f.priorSources.join(", ") || "no verified source"} · expected bytes: ${f.expectedSources.join(", ") || "no verified source"}`));
258
+ }
259
+ for (const s of report.staged)
260
+ line(c.dim(` staged temporary ${s.path} (${s.sha256 ?? "unreadable"}${s.matches ? `, for ${s.matches}` : ""}): not an output`));
261
+ for (const cand of report.candidates)
262
+ line(` ${cand.state} state: ${cand.complete ? "complete" : cand.restorable ? `restorable (${cand.differing.map((d) => d.path).join(", ")} differ)` : `not restorable from verified sources (${cand.differing.filter((d) => !d.sources.length).map((d) => d.path).join(", ")} have none)`}`);
263
+ if (report.verification.integrity !== null)
264
+ line(c.dim(` as the files are: \`feltkit compose --check\` ${report.verification.integrity ? "passes" : `fails (${report.verification.integrityProblems.join(", ")})`}${report.verification.reconciliation ? `; reconciliation ${report.verification.reconciliation}` : ""}`));
265
+ for (const g of report.evidenceGaps)
266
+ line(` evidence gap: ${g}`);
267
+ if (report.actions.length) {
268
+ line(" What to do:");
269
+ report.actions.forEach((a, i) => line(` ${i + 1}. ${a}`));
270
+ }
271
+ line(c.dim(` This inspection will not: ${report.willNot.join("; ")}.`));
272
+ return report.ok ? 0 : 1;
273
+ }
274
+ //# sourceMappingURL=compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.js","sourceRoot":"","sources":["../../src/cli/compose.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,WAAW,EACX,eAAe,EACf,kBAAkB,GAGnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAA2C,MAAM,6BAA6B,CAAC;AACrH,OAAO,EAAE,eAAe,EAAwC,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAwB,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAuB,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAW/C,8FAA8F;AAC9F,MAAM,MAAM,GAAG,IAAI,GAAG,CAA2B,CAAC,yBAAyB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,0BAA0B,CAAC,CAAC,CAAC;AAEnK,MAAM,UAAU,WAAW,CAAC,M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,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACzE,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,201 @@
1
+ import type { CapabilityId } from "../composition/contract.js";
2
+ import { DECLARATION_PATH, LOCK_PATH, RECORD_PATH, type GenerateResult } from "../composition/generate.js";
3
+ import type { Profile } from "../composition/contract.js";
4
+ import { type Entity, type Tenancy } from "./domain.js";
5
+ export type { Entity, Tenancy } from "./domain.js";
6
+ export type AppKind = "business" | "portal" | "collaboration" | "marketplace" | "operations" | "personal" | "custom";
7
+ export type Participant = "customers" | "staff" | "administrators" | "partners" | "collaborators" | "agents";
8
+ /** `workspaces`: the kind's data belongs to organizations people join (the default answer); `individuals`: to each person. */
9
+ export declare const APP_KINDS: ReadonlyArray<{
10
+ value: AppKind;
11
+ label: string;
12
+ hint: string;
13
+ tenancy: Tenancy;
14
+ }>;
15
+ /** `needs`: a participant that exists only with workspaces (membership, invitation into one). */
16
+ export declare const PARTICIPANTS: ReadonlyArray<{
17
+ value: Participant;
18
+ label: string;
19
+ hint: string;
20
+ needs?: Tenancy;
21
+ }>;
22
+ /** The two foundations, as the requirement a developer states. The profile follows from the answer; nothing else selects it. */
23
+ export declare const TENANCIES: ReadonlyArray<{
24
+ value: Tenancy;
25
+ label: string;
26
+ hint: string;
27
+ profile: Profile;
28
+ }>;
29
+ /** A catalog capability, explained for a developer who does not know the platform. Every id is a real catalog entry. */
30
+ export interface CapabilityGuide {
31
+ readonly id: CapabilityId;
32
+ readonly label: string;
33
+ readonly provides: string;
34
+ readonly addresses: string;
35
+ readonly constraints: string;
36
+ readonly applicationOwned: string;
37
+ /** Offered only when it fits the participants chosen; always offered when absent. */
38
+ readonly offeredFor?: readonly Participant[];
39
+ }
40
+ export declare const CAPABILITY_GUIDE: readonly CapabilityGuide[];
41
+ /** Needs people ask for that no catalog capability composes today. Each line is what the SDK offers instead, verified in source. */
42
+ export declare const NOT_COMPOSABLE: ReadonlyArray<{
43
+ id: string;
44
+ label: string;
45
+ status: string;
46
+ }>;
47
+ export interface Answers {
48
+ dir: string;
49
+ name: string;
50
+ description: string;
51
+ kind: AppKind;
52
+ participants: Participant[];
53
+ /** Optional capabilities the developer selected (profile-required ones are never listed here). */
54
+ include: CapabilityId[];
55
+ params: Record<string, Record<string, unknown>>;
56
+ entities: Entity[];
57
+ workflows: string[];
58
+ /** Needs selected from NOT_COMPOSABLE: recorded as application-owned work, never as capabilities. */
59
+ notComposable: string[];
60
+ /** Permissions the agent role holds (application-owned; only with agents.membership). */
61
+ agentPermissions: string[];
62
+ /** Whether the application's data belongs to organizations people join. Decides the profile. */
63
+ tenancy: Tenancy;
64
+ /** With individuals: the application's roles beyond the base one, highest first (application-owned, declared in feltkit/app.ts). */
65
+ roles: string[];
66
+ /** With individuals: which of `roles` may change anyone's shared records. */
67
+ managers: string[];
68
+ }
69
+ /** The profile the answers select: a function of the stated requirement, not of a flag. */
70
+ export declare function profileFor(a: Pick<Answers, "tenancy">): Profile;
71
+ export interface Choice {
72
+ readonly value: string;
73
+ readonly label: string;
74
+ readonly hint?: string;
75
+ /** Always selected; shown, not askable. */
76
+ readonly locked?: boolean;
77
+ }
78
+ /** How the composer talks to the developer. The terminal implementation is below; tests script one. */
79
+ export interface Prompter {
80
+ say(text: string): void;
81
+ text(prompt: string, options?: {
82
+ default?: string;
83
+ required?: boolean;
84
+ validate?: (value: string) => string | null;
85
+ }): Promise<string>;
86
+ choose(prompt: string, choices: readonly Choice[], options?: {
87
+ default?: string;
88
+ }): Promise<string>;
89
+ multi(prompt: string, choices: readonly Choice[], options?: {
90
+ default?: readonly string[];
91
+ }): Promise<string[]>;
92
+ confirm(prompt: string, defaultValue: boolean): Promise<boolean>;
93
+ }
94
+ export declare class Cancelled extends Error {
95
+ constructor();
96
+ }
97
+ /**
98
+ * The terminal prompter: numbered choices, comma-separated multiple choices, y/n; an empty required
99
+ * answer asks again; "q" cancels; end of input cancels. Lines are queued as they arrive, so answers
100
+ * piped in all at once (a script, a test) are not lost between questions.
101
+ */
102
+ export declare function terminalPrompter(input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream): Prompter & {
103
+ close(): void;
104
+ };
105
+ export declare function defaultAnswers(dir: string, name: string): Answers;
106
+ type Section = "basics" | "kind" | "participants" | "capabilities" | "details" | "data";
107
+ /**
108
+ * Ask, section by section, adapting to earlier answers. Returns the answers, or throws Cancelled.
109
+ * `sections` limits a pass to what the developer wants to change (the review loop).
110
+ */
111
+ export declare function interview(io: Prompter, start: Answers, sections?: readonly Section[]): Promise<Answers>;
112
+ /** The composition request the answers translate to: the inputs `feltkit compose` records. */
113
+ export declare function compositionInputs(a: Answers): {
114
+ profile: string;
115
+ include: string[];
116
+ params: Record<string, Record<string, unknown>>;
117
+ };
118
+ export interface Preview {
119
+ readonly profile: Profile;
120
+ readonly inputs: ReturnType<typeof compositionInputs>;
121
+ readonly result: GenerateResult;
122
+ readonly explicit: readonly CapabilityId[];
123
+ readonly implied: ReadonlyArray<{
124
+ id: CapabilityId;
125
+ because: string;
126
+ }>;
127
+ readonly entities: readonly Entity[];
128
+ readonly roles: Readonly<Record<string, readonly string[]>>;
129
+ readonly notComposable: ReadonlyArray<{
130
+ label: string;
131
+ status: string;
132
+ }>;
133
+ readonly applicationOwned: readonly string[];
134
+ }
135
+ /** What the composition would be: the resolver's own output, plus what the application adds and what stays its own. */
136
+ export declare function preview(a: Answers): Preview;
137
+ /**
138
+ * Who may do what with an entity, operation by operation, from the resolved roles (what the application's roles will
139
+ * really grant) and the generated functions' rules: the roles holding each permission, "anyone" for a public read, and
140
+ * the ownership or scope rule the function applies after the permission. A description of generated behavior, proven by
141
+ * the generated tests; the permission check itself is the runtime's.
142
+ */
143
+ export declare function authorizationLines(a: Answers, p: Preview, e: Entity): string[];
144
+ export declare function renderPreview(a: Answers, p: Preview): string[];
145
+ export interface Created {
146
+ readonly dir: string;
147
+ readonly files: readonly string[];
148
+ readonly composition: string | null;
149
+ readonly integrity: boolean;
150
+ readonly reconciliation: string | null;
151
+ readonly next: readonly string[];
152
+ }
153
+ /** feltkit/app.ts for the answers: application-owned, written once, never touched by composition again. */
154
+ export declare function renderAppModule(a: Answers, p: Preview): string;
155
+ /** Scaffold the shell, write the application-owned app.ts, compose the foundation with `feltkit compose`, verify. */
156
+ export declare function createApplication(a: Answers, p: Preview): Promise<Created>;
157
+ export interface CreateOptions {
158
+ dir?: string;
159
+ name?: string;
160
+ description?: string;
161
+ kind?: string;
162
+ participants: string[];
163
+ include: string[];
164
+ params: string[];
165
+ /** `workspaces` or `individuals`: who the data belongs to (the requirement that selects the foundation). Default: the kind's. */
166
+ tenancy?: string;
167
+ /** With individuals: application roles beyond the base one, highest first. */
168
+ roles: string[];
169
+ /** With individuals: which of `roles` manage shared data. */
170
+ managers: string[];
171
+ /** `name[:workspace|shared|personal][:description]` */
172
+ entities: string[];
173
+ /** `entity.field:type[?]` (see domain.ts parseFields) */
174
+ fields: string[];
175
+ /** `entity.field->target[?]` */
176
+ refs: string[];
177
+ /** Entities owned by their creator. */
178
+ owned: string[];
179
+ /** Shared entities anyone may read without signing in (list and get public). */
180
+ public: string[];
181
+ /** Entities whose records carry file attachments (implies services.files). */
182
+ attach: string[];
183
+ /** Membership claims, `name:type[=default]` (workspaces only; see domain.ts parseClaims). */
184
+ claims?: string[];
185
+ /** `entity:claim=value[|value]`: the entity's functions require the membership claim. */
186
+ require?: string[];
187
+ /** `entity.f1,f2` */
188
+ unique: string[];
189
+ workflows: string[];
190
+ yes: boolean;
191
+ interactive: boolean;
192
+ dryRun: boolean;
193
+ json: boolean;
194
+ /** Replaceable in tests. */
195
+ prompter?: Prompter;
196
+ stdinIsTTY?: boolean;
197
+ }
198
+ /** Answers from flags alone (the machine-usable form); what is missing is named. */
199
+ export declare function answersFromOptions(o: CreateOptions): Answers;
200
+ export declare function createCommand(o: CreateOptions): Promise<number>;
201
+ export { DECLARATION_PATH, LOCK_PATH, RECORD_PATH };