@prestack/thread 0.1.3 → 0.1.5

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 (270) hide show
  1. package/CHANGELOG.md +563 -0
  2. package/dist/core/actor.d.ts +1 -1
  3. package/dist/core/actor.js +5 -4
  4. package/dist/core/actor.ts +5 -4
  5. package/dist/core/attach.d.ts +0 -7
  6. package/dist/core/attach.js +38 -67
  7. package/dist/core/attach.ts +34 -80
  8. package/dist/core/chain.js +13 -17
  9. package/dist/core/chain.ts +11 -15
  10. package/dist/core/condition.d.ts +4 -4
  11. package/dist/core/condition.js +2 -2
  12. package/dist/core/descend.d.ts +4 -2
  13. package/dist/core/descend.js +91 -23
  14. package/dist/core/descend.ts +90 -21
  15. package/dist/core/errors/catalogue.d.ts +52 -0
  16. package/dist/{operations/errors/errors.js → core/errors/catalogue.js} +1 -1
  17. package/dist/{operations/errors/errors.ts → core/errors/catalogue.ts} +1 -1
  18. package/dist/{operations/errors/catalog.d.ts → core/errors/error.d.ts} +2 -3
  19. package/dist/{operations/errors/catalog.js → core/errors/error.js} +1 -16
  20. package/dist/{operations/errors/catalog.ts → core/errors/error.ts} +3 -19
  21. package/dist/core/errors/namespaces.d.ts +3 -0
  22. package/dist/core/errors/namespaces.js +15 -0
  23. package/dist/core/errors/namespaces.ts +19 -0
  24. package/dist/core/finding.js +2 -2
  25. package/dist/core/finding.ts +1 -2
  26. package/dist/core/init.d.ts +1 -1
  27. package/dist/core/init.js +51 -5
  28. package/dist/core/init.ts +58 -5
  29. package/dist/core/invoked.d.ts +1 -1
  30. package/dist/core/invoked.js +3 -1
  31. package/dist/core/invoked.ts +5 -2
  32. package/dist/core/round.js +36 -22
  33. package/dist/core/round.ts +26 -9
  34. package/dist/core/rows.d.ts +4 -0
  35. package/dist/core/rows.js +31 -2
  36. package/dist/core/rows.ts +33 -1
  37. package/dist/core/scope.d.ts +1 -0
  38. package/dist/core/scope.js +1 -0
  39. package/dist/core/scope.ts +2 -0
  40. package/dist/core/thread.d.ts +3 -3
  41. package/dist/core/tree.d.ts +4 -1
  42. package/dist/core/tree.js +26 -6
  43. package/dist/core/tree.ts +29 -6
  44. package/dist/core/types.d.ts +3 -3
  45. package/dist/core/types.js +3 -1
  46. package/dist/core/types.ts +2 -1
  47. package/dist/derivation/attach.js +3 -2
  48. package/dist/derivation/attach.ts +2 -1
  49. package/dist/derivation/generators/build.js +6 -6
  50. package/dist/derivation/generators/build.ts +1 -1
  51. package/dist/derivation/generators/check.js +1 -1
  52. package/dist/derivation/generators/determinism.js +1 -1
  53. package/dist/derivation/generators/release.js +60 -47
  54. package/dist/derivation/generators/release.ts +66 -43
  55. package/dist/derivation/release.d.ts +7 -3
  56. package/dist/derivation/release.js +14 -1
  57. package/dist/derivation/release.ts +22 -2
  58. package/dist/integrations/attach.d.ts +4 -0
  59. package/dist/integrations/attach.js +37 -56
  60. package/dist/integrations/attach.ts +54 -60
  61. package/dist/integrations/cli.d.ts +37 -0
  62. package/dist/integrations/cli.js +440 -0
  63. package/dist/integrations/cli.ts +543 -0
  64. package/dist/{core/files.d.ts → integrations/disk.d.ts} +16 -24
  65. package/dist/integrations/disk.js +435 -0
  66. package/dist/integrations/disk.ts +465 -0
  67. package/dist/integrations/generators/read.js +6 -6
  68. package/dist/integrations/generators/read.ts +4 -4
  69. package/dist/integrations/generators/vault.js +10 -11
  70. package/dist/integrations/generators/vault.ts +4 -5
  71. package/dist/{operations/http.d.ts → integrations/https.d.ts} +10 -6
  72. package/dist/integrations/https.js +170 -0
  73. package/dist/integrations/https.ts +216 -0
  74. package/dist/integrations/pglite.d.ts +26 -0
  75. package/dist/integrations/pglite.js +143 -0
  76. package/dist/integrations/pglite.ts +206 -0
  77. package/dist/integrations/secret.d.ts +8 -2
  78. package/dist/integrations/secret.js +3 -5
  79. package/dist/integrations/secret.ts +10 -6
  80. package/dist/integrations/target.d.ts +155 -14
  81. package/dist/integrations/target.js +171 -50
  82. package/dist/integrations/target.ts +377 -61
  83. package/dist/integrations/vault.d.ts +1 -0
  84. package/dist/integrations/vault.js +20 -5
  85. package/dist/integrations/vault.ts +17 -5
  86. package/dist/integrity/attach.js +8 -77
  87. package/dist/integrity/attach.ts +7 -76
  88. package/dist/integrity/check-threads.js +5 -5
  89. package/dist/integrity/check-threads.ts +2 -2
  90. package/dist/integrity/constraint.d.ts +0 -1
  91. package/dist/integrity/constraint.js +267 -366
  92. package/dist/integrity/constraint.ts +267 -375
  93. package/dist/integrity/generators/compiler.js +14 -17
  94. package/dist/integrity/generators/compiler.ts +10 -15
  95. package/dist/integrity/generators/gate.js +15 -15
  96. package/dist/integrity/generators/gate.ts +10 -10
  97. package/dist/integrity/generators/issues.js +7 -7
  98. package/dist/integrity/generators/publish.js +39 -57
  99. package/dist/integrity/generators/publish.ts +44 -55
  100. package/dist/integrity/generators/trial.d.ts +3 -3
  101. package/dist/integrity/generators/trial.js +133 -165
  102. package/dist/integrity/generators/trial.ts +145 -169
  103. package/dist/integrity/lint.js +9 -13
  104. package/dist/integrity/lint.ts +7 -10
  105. package/dist/integrity/lsp/bin.js +5 -4
  106. package/dist/integrity/lsp/bin.ts +3 -1
  107. package/dist/integrity/lsp/diagnostics.js +3 -3
  108. package/dist/integrity/lsp/diagnostics.ts +1 -1
  109. package/dist/integrity/lsp/lint.js +19 -30
  110. package/dist/integrity/lsp/lint.ts +16 -32
  111. package/dist/integrity/lsp/server.js +3 -3
  112. package/dist/integrity/slopnator.d.ts +3 -13
  113. package/dist/integrity/slopnator.js +59 -38
  114. package/dist/integrity/slopnator.ts +54 -38
  115. package/dist/integrity/slopnators/sl_broken_lineage.js +2 -2
  116. package/dist/integrity/slopnators/sl_declared_elsewhere.js +1 -1
  117. package/dist/integrity/slopnators/sl_derived_drift.js +4 -4
  118. package/dist/integrity/slopnators/sl_derived_drift.ts +1 -1
  119. package/dist/integrity/slopnators/sl_door_in_a_node.js +220 -0
  120. package/dist/integrity/slopnators/sl_door_in_a_node.ts +250 -0
  121. package/dist/integrity/slopnators/sl_inert_island.js +10 -8
  122. package/dist/integrity/slopnators/sl_inert_island.ts +8 -6
  123. package/dist/integrity/slopnators/sl_missing_row.js +6 -51
  124. package/dist/integrity/slopnators/sl_missing_row.ts +4 -50
  125. package/dist/integrity/slopnators/sl_no_barrel.js +1 -1
  126. package/dist/integrity/slopnators/sl_no_child_process.js +36 -18
  127. package/dist/integrity/slopnators/sl_no_child_process.ts +44 -18
  128. package/dist/integrity/slopnators/sl_no_dispatch_bypass.js +80 -149
  129. package/dist/integrity/slopnators/sl_no_dispatch_bypass.ts +95 -147
  130. package/dist/integrity/slopnators/sl_no_import_cycle.js +15 -4
  131. package/dist/integrity/slopnators/sl_no_import_cycle.ts +20 -4
  132. package/dist/integrity/slopnators/sl_no_such_command.js +2 -2
  133. package/dist/integrity/slopnators/sl_no_such_command.ts +1 -1
  134. package/dist/integrity/slopnators/sl_outside_an_operation.js +20 -0
  135. package/dist/integrity/slopnators/sl_outside_an_operation.ts +25 -0
  136. package/dist/integrity/slopnators/sl_screen_holds_only_declared.d.ts +2 -0
  137. package/dist/integrity/slopnators/sl_screen_holds_only_declared.js +61 -0
  138. package/dist/integrity/slopnators/sl_screen_holds_only_declared.ts +70 -0
  139. package/dist/integrity/slopnators/sl_secret_literal.js +1 -33
  140. package/dist/integrity/slopnators/sl_secret_literal.ts +1 -33
  141. package/dist/integrity/slopnators/sl_stale_path.js +5 -22
  142. package/dist/integrity/slopnators/sl_stale_path.ts +4 -20
  143. package/dist/integrity/slopnators/sl_twice_meant.js +1 -1
  144. package/dist/integrity/slopnators/sl_twice_parented.js +29 -5
  145. package/dist/integrity/slopnators/sl_twice_parented.ts +28 -4
  146. package/dist/integrity/slopnators/sl_undeclared_crossing.d.ts +4 -1
  147. package/dist/integrity/slopnators/sl_undeclared_crossing.js +426 -62
  148. package/dist/integrity/slopnators/sl_undeclared_crossing.ts +454 -70
  149. package/dist/integrity/slopnators/sl_undeclared_destination.js +59 -25
  150. package/dist/integrity/slopnators/sl_undeclared_destination.ts +69 -21
  151. package/dist/integrity/slopnators/sl_undeclared_list.d.ts +2 -0
  152. package/dist/integrity/slopnators/sl_undeclared_list.js +363 -0
  153. package/dist/integrity/slopnators/sl_undeclared_list.ts +358 -0
  154. package/dist/integrity/slopnators/sl_undeclared_node.js +1 -11
  155. package/dist/integrity/slopnators/sl_undeclared_node.ts +0 -10
  156. package/dist/integrity/slopnators/sl_undeclared_operation.js +111 -29
  157. package/dist/integrity/slopnators/sl_undeclared_operation.ts +134 -26
  158. package/dist/integrity/slopnators/sl_undeclared_variant.js +2 -2
  159. package/dist/integrity/slopnators/sl_undeclared_webhook.d.ts +2 -0
  160. package/dist/integrity/slopnators/sl_undeclared_webhook.js +90 -0
  161. package/dist/integrity/slopnators/sl_undeclared_webhook.ts +108 -0
  162. package/dist/integrity/slopnators/sl_underived_route.d.ts +2 -0
  163. package/dist/integrity/slopnators/sl_underived_route.js +61 -0
  164. package/dist/integrity/slopnators/sl_underived_route.ts +72 -0
  165. package/dist/integrity/slopnators/sl_ungoverned_island.js +3 -3
  166. package/dist/integrity/slopnators/sl_ungoverned_island.ts +1 -1
  167. package/dist/integrity/slopnators/sl_unlisted_program.d.ts +2 -0
  168. package/dist/integrity/slopnators/sl_unlisted_program.js +39 -0
  169. package/dist/integrity/slopnators/sl_unlisted_program.ts +40 -0
  170. package/dist/integrity/slopnators/sl_unnamed_island.js +1 -1
  171. package/dist/integrity/slopnators/sl_unpaired_member.js +3 -3
  172. package/dist/integrity/slopnators/sl_unpaired_member.ts +1 -1
  173. package/dist/integrity/slopnators/sl_unpaired_slopnator.js +4 -4
  174. package/dist/integrity/slopnators/sl_unpaired_slopnator.ts +1 -1
  175. package/dist/integrity/slopnators/sl_unprefixed_member.js +5 -31
  176. package/dist/integrity/slopnators/sl_unprefixed_member.ts +2 -28
  177. package/dist/integrity/slopnators/sl_unthreaded.js +11 -7
  178. package/dist/integrity/slopnators/sl_unthreaded.ts +6 -7
  179. package/dist/integrity/slopnators/sl_untranslated_key.js +2 -25
  180. package/dist/integrity/slopnators/sl_untranslated_key.ts +1 -25
  181. package/dist/integrity/slopnators/sl_unvaulted_secret.d.ts +2 -0
  182. package/dist/integrity/slopnators/sl_unvaulted_secret.js +107 -0
  183. package/dist/integrity/slopnators/sl_unvaulted_secret.ts +132 -0
  184. package/dist/integrity/slopnators/sl_unversioned.js +6 -4
  185. package/dist/integrity/slopnators/sl_unversioned.ts +5 -3
  186. package/dist/integrity/sweep.d.ts +1 -0
  187. package/dist/integrity/sweep.js +105 -42
  188. package/dist/integrity/sweep.ts +115 -42
  189. package/dist/knowledge/attach.js +4 -3
  190. package/dist/knowledge/attach.ts +3 -2
  191. package/dist/knowledge/generators/docsgen.js +8 -6
  192. package/dist/knowledge/generators/docsgen.ts +4 -2
  193. package/dist/knowledge/generators/glossary.js +4 -4
  194. package/dist/knowledge/generators/glossary.ts +1 -1
  195. package/dist/operations/access.d.ts +23 -0
  196. package/dist/operations/access.js +28 -1
  197. package/dist/operations/access.ts +43 -0
  198. package/dist/operations/attach.js +33 -113
  199. package/dist/operations/attach.ts +51 -117
  200. package/dist/operations/capabilities.d.ts +14 -5
  201. package/dist/operations/capabilities.js +13 -4
  202. package/dist/operations/capabilities.ts +27 -8
  203. package/dist/operations/dispatch.d.ts +8 -2
  204. package/dist/operations/dispatch.js +128 -185
  205. package/dist/operations/dispatch.ts +138 -191
  206. package/dist/operations/error-results.d.ts +1 -1
  207. package/dist/operations/error-results.js +2 -2
  208. package/dist/operations/error-results.ts +2 -2
  209. package/dist/operations/generators/capability.d.ts +11 -1
  210. package/dist/operations/generators/capability.js +481 -224
  211. package/dist/operations/generators/capability.ts +562 -233
  212. package/dist/operations/generators/compile.js +66 -39
  213. package/dist/operations/generators/compile.ts +78 -39
  214. package/dist/operations/generators/permits.js +11 -12
  215. package/dist/operations/generators/permits.ts +3 -4
  216. package/dist/operations/generators/seed.d.ts +1 -0
  217. package/dist/operations/generators/seed.js +19 -17
  218. package/dist/operations/generators/seed.ts +22 -14
  219. package/dist/operations/generators/trial.d.ts +6 -8
  220. package/dist/operations/generators/trial.js +200 -70
  221. package/dist/operations/generators/trial.ts +230 -93
  222. package/dist/operations/nodes.d.ts +15 -16
  223. package/dist/operations/nodes.ts +16 -17
  224. package/dist/operations/operations.d.ts +40 -4
  225. package/dist/operations/operations.js +1 -0
  226. package/dist/operations/operations.ts +61 -4
  227. package/dist/operations/result.d.ts +2 -2
  228. package/dist/operations/result.ts +2 -2
  229. package/package.json +1 -4
  230. package/dist/core/answers.d.ts +0 -171
  231. package/dist/core/answers.js +0 -789
  232. package/dist/core/answers.ts +0 -999
  233. package/dist/core/client.d.ts +0 -63
  234. package/dist/core/client.js +0 -249
  235. package/dist/core/client.ts +0 -289
  236. package/dist/core/files.js +0 -171
  237. package/dist/core/files.ts +0 -222
  238. package/dist/integrations/module.d.ts +0 -6
  239. package/dist/integrations/module.js +0 -153
  240. package/dist/integrations/module.ts +0 -191
  241. package/dist/integrity/slopnators/sl_unkept_rows.js +0 -104
  242. package/dist/integrity/slopnators/sl_unkept_rows.ts +0 -111
  243. package/dist/integrity/slopnators/sl_unseamed_reach.js +0 -73
  244. package/dist/integrity/slopnators/sl_unseamed_reach.ts +0 -79
  245. package/dist/operations/cost.d.ts +0 -14
  246. package/dist/operations/cost.js +0 -37
  247. package/dist/operations/cost.ts +0 -58
  248. package/dist/operations/errors/errors.d.ts +0 -52
  249. package/dist/operations/http.js +0 -124
  250. package/dist/operations/http.ts +0 -169
  251. package/dist/operations/memory.d.ts +0 -104
  252. package/dist/operations/memory.js +0 -365
  253. package/dist/operations/memory.ts +0 -470
  254. package/dist/operations/metering.d.ts +0 -55
  255. package/dist/operations/metering.js +0 -247
  256. package/dist/operations/metering.ts +0 -328
  257. package/dist/operations/queue-policy.d.ts +0 -3
  258. package/dist/operations/queue-policy.js +0 -8
  259. package/dist/operations/queue-policy.ts +0 -10
  260. package/dist/operations/seams.d.ts +0 -239
  261. package/dist/operations/seams.js +0 -45
  262. package/dist/operations/seams.ts +0 -364
  263. package/dist/operations/store.d.ts +0 -14
  264. package/dist/operations/store.js +0 -1
  265. package/dist/operations/store.ts +0 -29
  266. /package/dist/{operations → core}/errors/classes.d.ts +0 -0
  267. /package/dist/{operations → core}/errors/classes.js +0 -0
  268. /package/dist/{operations → core}/errors/classes.ts +0 -0
  269. /package/dist/integrity/slopnators/{sl_unkept_rows.d.ts → sl_door_in_a_node.d.ts} +0 -0
  270. /package/dist/integrity/slopnators/{sl_unseamed_reach.d.ts → sl_outside_an_operation.d.ts} +0 -0
@@ -4,7 +4,7 @@ export declare const ROOT: string;
4
4
  export declare const TREE: string;
5
5
  export declare const THREAD_AT: string;
6
6
  export declare function unkept(at: string): boolean;
7
- export declare const LISTS: readonly ["declares", "derives", "seeds"];
7
+ export declare const LISTS: readonly ['declares', 'derives', 'seeds'];
8
8
  export declare const ROW_LISTS: readonly ["declares", "derives", "seeds", "holds"];
9
9
  export interface Row {
10
10
  readonly at?: string;
@@ -59,6 +59,7 @@ export declare function shapeFields(named: string, inside?: string): readonly {
59
59
  readonly map: boolean;
60
60
  readonly worded: boolean;
61
61
  readonly guide: string;
62
+ readonly record: readonly string[];
62
63
  }[];
63
64
  export interface Field {
64
65
  readonly name: string;
@@ -68,9 +69,10 @@ export interface Field {
68
69
  readonly boolean: boolean;
69
70
  readonly worded: boolean;
70
71
  readonly guide: string;
72
+ readonly record: readonly string[];
71
73
  }
72
74
  export declare function listShape(at: string, list: string): string | undefined;
73
- export declare function listFields(at: string, list: string): readonly Field[];
75
+ export declare function listFields(at: string, list: string, within?: number): readonly Field[];
74
76
  export declare function rowShape(at: string, list: string): string | undefined;
75
77
  interface Held {
76
78
  readonly name: string;
@@ -1,10 +1,10 @@
1
- import { spawnSync } from 'node:child_process';
2
- import { attached, existsSync, kind, readdirSync, readFileSync, realpathSync, statSync, writeFileSync } from "./files.js";
1
+ import { starts } from '../integrations/cli.js';
2
+ import { attached, beyond, existsSync, here as answering, kind, readdirSync, readFileSync, realpathSync, statSync, writeFileSync } from '../integrations/disk.js';
3
3
  import { dirname, join, relative, resolve } from 'node:path';
4
4
  import ts from 'typescript';
5
- import { ignored } from "./init.js";
6
- import { NAMED, ORGANISATION } from "./scope.js";
7
- import { findTree } from "./tree.js";
5
+ import { SHAPED, ignored } from './init.js';
6
+ import { ORGANISATION, installed } from './scope.js';
7
+ import { findTree } from './tree.js';
8
8
  const BUILT = new Set(ignored()
9
9
  .split('\n')
10
10
  .map((one) => one.trim())
@@ -32,7 +32,7 @@ function ownIgnores() {
32
32
  if (readIgnores)
33
33
  return ignores;
34
34
  readIgnores = true;
35
- if (!attached() && spawnSync('git', ['rev-parse', '--is-inside-work-tree'], { cwd: ROOT, stdio: 'ignore' }).status === 0) {
35
+ if (!attached() && starts('git', ['rev-parse', '--is-inside-work-tree'], { at: ROOT }).ok) {
36
36
  return ignores;
37
37
  }
38
38
  try {
@@ -55,7 +55,7 @@ export function unkept(at) {
55
55
  return held;
56
56
  const own = ownIgnores();
57
57
  const found = own === undefined
58
- ? spawnSync('git', ['check-ignore', '-q', '--', at], { cwd: ROOT, stdio: 'ignore' }).status === 0
58
+ ? starts('git', ['check-ignore', '-q', '--', at], { at: ROOT }).ok
59
59
  : own.some((one) => at === one || at.startsWith(`${one}/`) || at.split('/').includes(one));
60
60
  asked.set(at, found);
61
61
  return found;
@@ -198,7 +198,7 @@ function listing(at, take, skip, only, deep) {
198
198
  function parsing(from) {
199
199
  return {
200
200
  useCaseSensitiveFileNames: true,
201
- fileExists: (at) => existsSync(at),
201
+ fileExists: (at) => !beyond(at) && existsSync(at),
202
202
  readFile: (at) => {
203
203
  try {
204
204
  return readFileSync(at);
@@ -237,23 +237,34 @@ export function configured() {
237
237
  }
238
238
  return { options: { ...FALLBACK, ...INVARIANT }, from: '' };
239
239
  }
240
+ const libraries = new Map();
241
+ const DEPENDENCIES = '/node_' + 'modules/';
240
242
  export function hosting(options) {
241
243
  const host = ts.createCompilerHost(options, true);
242
244
  const lib = host.getDefaultLibLocation?.();
245
+ const settings = JSON.stringify(options);
243
246
  const toolchain = (at) => lib !== undefined && (at === lib || at.startsWith(`${lib}/`));
247
+ const seen = (at) => (beyond(at) ? 'none' : kind(at));
244
248
  return {
245
249
  ...host,
246
- fileExists: (at) => (toolchain(at) ? host.fileExists(at) : kind(at) === 'file'),
247
- directoryExists: (at) => (toolchain(at) ? (host.directoryExists?.(at) ?? false) : kind(at) === 'folder'),
248
- readFile: (at) => (toolchain(at) ? host.readFile(at) : kind(at) === 'file' ? readFileSync(at) : undefined),
250
+ fileExists: (at) => (toolchain(at) ? host.fileExists(at) : seen(at) === 'file'),
251
+ directoryExists: (at) => (toolchain(at) ? (host.directoryExists?.(at) ?? false) : seen(at) === 'folder'),
252
+ readFile: (at) => (toolchain(at) ? host.readFile(at) : seen(at) === 'file' ? readFileSync(at) : undefined),
249
253
  getSourceFile: (at, version) => {
250
- if (toolchain(at))
251
- return host.getSourceFile(at, version);
252
- if (kind(at) !== 'file')
253
- return undefined;
254
- return ts.createSourceFile(at, readFileSync(at), version, true);
254
+ const lasting = toolchain(at) ? true : at.includes(DEPENDENCIES);
255
+ const key = settings + at + JSON.stringify(version);
256
+ if (lasting && libraries.has(key))
257
+ return libraries.get(key);
258
+ const made = toolchain(at)
259
+ ? host.getSourceFile(at, version)
260
+ : seen(at) === 'file'
261
+ ? ts.createSourceFile(at, readFileSync(at), version, true)
262
+ : undefined;
263
+ if (lasting)
264
+ libraries.set(key, made);
265
+ return made;
255
266
  },
256
- getDirectories: (at) => kind(at) === 'folder' ? readdirSync(at, { withFileTypes: true }).filter((one) => one.isDirectory()).map((one) => one.name) : [],
267
+ getDirectories: (at) => seen(at) === 'folder' ? readdirSync(at, { withFileTypes: true }).filter((one) => one.isDirectory()).map((one) => one.name) : [],
257
268
  realpath: (at) => (toolchain(at) ? (host.realpath?.(at) ?? at) : realpathSync(at)),
258
269
  writeFile: (at, said) => {
259
270
  writeFileSync(at, said);
@@ -328,8 +339,13 @@ export function read(at) {
328
339
  source.set(at, text);
329
340
  return text;
330
341
  }
342
+ const shapes = new WeakMap();
331
343
  export function shapesNamed() {
332
- const { program, checker } = compiled();
344
+ const held = compiled();
345
+ const known = shapes.get(held);
346
+ if (known !== undefined)
347
+ return known;
348
+ const { program, checker } = held;
333
349
  const shape = threadedType(checker, program);
334
350
  const found = new Map();
335
351
  if (shape === undefined)
@@ -368,6 +384,7 @@ export function shapesNamed() {
368
384
  found.set(named, [...where, at]);
369
385
  }
370
386
  }
387
+ shapes.set(held, found);
371
388
  return found;
372
389
  }
373
390
  export function threading() {
@@ -408,13 +425,14 @@ export function shapeFields(named, inside) {
408
425
  map: mapped(kind),
409
426
  worded: (kind.isUnion() ? kind.types : [kind]).some((each) => (each.flags & ts.TypeFlags.StringLike) !== 0),
410
427
  guide: ts.displayPartsToString(one.getDocumentationComment(checker)).trim(),
428
+ record: recordOf(checker, kind),
411
429
  };
412
430
  });
413
431
  }
414
432
  }
415
433
  return [];
416
434
  }
417
- function elementAt(at, list) {
435
+ function elementAt(at, list, within) {
418
436
  const { program, checker } = compiled();
419
437
  const file = program.getSourceFile(resolve(ROOT, at));
420
438
  if (file === undefined)
@@ -424,6 +442,8 @@ function elementAt(at, list) {
424
442
  const consider = (node) => {
425
443
  if (held !== undefined)
426
444
  return;
445
+ if (within !== undefined && node.getStart() !== within)
446
+ return;
427
447
  const wanted = checker.getContextualType(node) ?? checker.getTypeAtLocation(node);
428
448
  const kinds = (wanted.isUnionOrIntersection() ? wanted.types : [wanted])
429
449
  .filter((one) => checker.getIndexTypeOfType(one, ts.IndexKind.Number) !== undefined)
@@ -455,8 +475,8 @@ export function listShape(at, list) {
455
475
  const held = elementAt(at, list);
456
476
  return held === undefined ? undefined : compiled().checker.typeToString(held.type);
457
477
  }
458
- export function listFields(at, list) {
459
- const held = elementAt(at, list);
478
+ export function listFields(at, list, within) {
479
+ const held = elementAt(at, list, within);
460
480
  if (held === undefined)
461
481
  return [];
462
482
  const { checker } = compiled();
@@ -480,12 +500,29 @@ export function listFields(at, list) {
480
500
  boolean: flagged(kind),
481
501
  worded: worded(kind),
482
502
  guide: ts.displayPartsToString(one.getDocumentationComment(checker)).trim(),
503
+ record: recordOf(checker, kind),
483
504
  };
484
505
  });
485
506
  }
486
507
  function elementOf(checker, type) {
487
508
  return checker.getIndexTypeOfType(type, ts.IndexKind.Number) ?? type;
488
509
  }
510
+ function recordOf(checker, type) {
511
+ for (const each of type.isUnion() ? type.types : [type]) {
512
+ if ((each.flags & ts.TypeFlags.StringLike) !== 0 || checker.getIndexTypeOfType(each, ts.IndexKind.Number) === undefined)
513
+ continue;
514
+ const element = elementOf(checker, each);
515
+ if ((element.flags & ts.TypeFlags.Object) === 0)
516
+ return [];
517
+ const fields = checker.getPropertiesOfType(element);
518
+ const worded = fields.every((one) => {
519
+ const kind = checker.getNonNullableType(checker.getTypeOfSymbol(one));
520
+ return (kind.isUnion() ? kind.types : [kind]).every((part) => (part.flags & ts.TypeFlags.StringLike) !== 0);
521
+ });
522
+ return worded ? fields.map((one) => one.getName()) : [];
523
+ }
524
+ return [];
525
+ }
489
526
  export function rowShape(at, list) {
490
527
  const { program, checker } = compiled();
491
528
  const file = program.getSourceFile(resolve(ROOT, at));
@@ -666,7 +703,38 @@ let passed;
666
703
  export function reached() {
667
704
  return [THREAD_AT, ...descend().threaded.keys()];
668
705
  }
706
+ let world = answering();
707
+ const worlds = new WeakMap();
708
+ function kept() {
709
+ const was = { passed, built, scanned, commands, ignores, readIgnores, source: new Map(source), asked: new Map(asked) };
710
+ return () => {
711
+ passed = was.passed;
712
+ built = was.built;
713
+ scanned = was.scanned;
714
+ commands = was.commands;
715
+ ignores = was.ignores;
716
+ readIgnores = was.readIgnores;
717
+ source.clear();
718
+ for (const [at, text] of was.source)
719
+ source.set(at, text);
720
+ asked.clear();
721
+ for (const [at, ignore] of was.asked)
722
+ asked.set(at, ignore);
723
+ };
724
+ }
669
725
  export function forget() {
726
+ const now = answering();
727
+ if (now === world)
728
+ libraries.clear();
729
+ else {
730
+ worlds.set(world, kept());
731
+ world = now;
732
+ const back = worlds.get(now);
733
+ if (back !== undefined) {
734
+ back();
735
+ return;
736
+ }
737
+ }
670
738
  passed = undefined;
671
739
  built = undefined;
672
740
  scanned = undefined;
@@ -712,7 +780,7 @@ export function descend() {
712
780
  broken.push({
713
781
  file: THREAD_AT,
714
782
  detail: 'the root does not resolve `Threaded`, so nothing here can be recognised as a declaration and every file reads as unthreaded',
715
- instead: `import \`Threaded\` from \`${NAMED}/thread\` in the root, or run \`thread init\`. Without the shape there is nothing to hold anything to`,
783
+ instead: `import \`Threaded\` from \`${SHAPED}\` in the root, or run \`thread init\`. Without the shape there is nothing to hold anything to`,
716
784
  });
717
785
  passed = { threaded, mentioned, derived, stated, coined, broken, findings, declarations, rows, sources: sources() };
718
786
  return passed;
@@ -781,7 +849,7 @@ export function descend() {
781
849
  return;
782
850
  }
783
851
  const target = resolve(ROOT, row.at);
784
- if (unkept(row.at)) {
852
+ if (!installed(row.at) && unkept(row.at)) {
785
853
  findings.push({
786
854
  file: at,
787
855
  detail: `\`${names(row)}\` names \`${row.at}\`, which git ignores, so it is on this machine and in no clone of it`,
@@ -1,12 +1,12 @@
1
- import { spawnSync } from 'node:child_process'
2
- import { attached, existsSync, kind, readdirSync, readFileSync, realpathSync, statSync, writeFileSync } from './files.ts'
1
+ import { starts } from '../integrations/cli.ts'
2
+ import { attached, beyond, existsSync, here as answering, kind, readdirSync, readFileSync, realpathSync, statSync, writeFileSync, type Kind } from '../integrations/disk.ts'
3
3
  import { dirname, join, relative, resolve } from 'node:path'
4
4
 
5
5
  import ts from 'typescript'
6
6
 
7
7
  import type { Finding } from './finding.ts'
8
- import { ignored } from './init.ts'
9
- import { NAMED, ORGANISATION } from './scope.ts'
8
+ import { SHAPED, ignored } from './init.ts'
9
+ import { ORGANISATION, installed } from './scope.ts'
10
10
  import { findTree } from './tree.ts'
11
11
 
12
12
  const BUILT: ReadonlySet<string> = new Set(
@@ -41,7 +41,7 @@ let readIgnores = false
41
41
  function ownIgnores(): readonly string[] | undefined {
42
42
  if (readIgnores) return ignores
43
43
  readIgnores = true
44
- if (!attached() && spawnSync('git', ['rev-parse', '--is-inside-work-tree'], { cwd: ROOT, stdio: 'ignore' }).status === 0) {
44
+ if (!attached() && starts('git', ['rev-parse', '--is-inside-work-tree'], { at: ROOT }).ok) {
45
45
  return ignores
46
46
  }
47
47
  try {
@@ -65,7 +65,7 @@ export function unkept(at: string): boolean {
65
65
  const own = ownIgnores()
66
66
  const found =
67
67
  own === undefined
68
- ? spawnSync('git', ['check-ignore', '-q', '--', at], { cwd: ROOT, stdio: 'ignore' }).status === 0
68
+ ? starts('git', ['check-ignore', '-q', '--', at], { at: ROOT }).ok
69
69
  : own.some((one) => at === one || at.startsWith(`${one}/`) || at.split('/').includes(one))
70
70
  asked.set(at, found)
71
71
  return found
@@ -252,7 +252,7 @@ function listing(at: string, take: readonly string[], skip: readonly string[], o
252
252
  function parsing(from: string): ts.ParseConfigHost {
253
253
  return {
254
254
  useCaseSensitiveFileNames: true,
255
- fileExists: (at) => existsSync(at),
255
+ fileExists: (at) => !beyond(at) && existsSync(at),
256
256
  readFile: (at) => {
257
257
  try {
258
258
  return readFileSync(at)
@@ -301,22 +301,35 @@ export function configured(): { readonly options: ts.CompilerOptions; readonly f
301
301
  return { options: { ...FALLBACK, ...INVARIANT }, from: '' }
302
302
  }
303
303
 
304
+ const libraries = new Map<string, ReturnType<ts.CompilerHost['getSourceFile']>>()
305
+
306
+ const DEPENDENCIES = '/node_' + 'modules/'
307
+
304
308
  export function hosting(options: ts.CompilerOptions): ts.CompilerHost {
305
309
  const host = ts.createCompilerHost(options, true)
306
310
  const lib = host.getDefaultLibLocation?.()
311
+ const settings = JSON.stringify(options)
307
312
  const toolchain = (at: string): boolean => lib !== undefined && (at === lib || at.startsWith(`${lib}/`))
313
+ const seen = (at: string): Kind => (beyond(at) ? 'none' : kind(at))
308
314
  return {
309
315
  ...host,
310
- fileExists: (at) => (toolchain(at) ? host.fileExists(at) : kind(at) === 'file'),
311
- directoryExists: (at) => (toolchain(at) ? (host.directoryExists?.(at) ?? false) : kind(at) === 'folder'),
312
- readFile: (at) => (toolchain(at) ? host.readFile(at) : kind(at) === 'file' ? readFileSync(at) : undefined),
316
+ fileExists: (at) => (toolchain(at) ? host.fileExists(at) : seen(at) === 'file'),
317
+ directoryExists: (at) => (toolchain(at) ? (host.directoryExists?.(at) ?? false) : seen(at) === 'folder'),
318
+ readFile: (at) => (toolchain(at) ? host.readFile(at) : seen(at) === 'file' ? readFileSync(at) : undefined),
313
319
  getSourceFile: (at, version) => {
314
- if (toolchain(at)) return host.getSourceFile(at, version)
315
- if (kind(at) !== 'file') return undefined
316
- return ts.createSourceFile(at, readFileSync(at), version, true)
320
+ const lasting = toolchain(at) ? true : at.includes(DEPENDENCIES)
321
+ const key = settings + at + JSON.stringify(version)
322
+ if (lasting && libraries.has(key)) return libraries.get(key)
323
+ const made = toolchain(at)
324
+ ? host.getSourceFile(at, version)
325
+ : seen(at) === 'file'
326
+ ? ts.createSourceFile(at, readFileSync(at), version, true)
327
+ : undefined
328
+ if (lasting) libraries.set(key, made)
329
+ return made
317
330
  },
318
331
  getDirectories: (at) =>
319
- kind(at) === 'folder' ? readdirSync(at, { withFileTypes: true }).filter((one) => one.isDirectory()).map((one) => one.name) : [],
332
+ seen(at) === 'folder' ? readdirSync(at, { withFileTypes: true }).filter((one) => one.isDirectory()).map((one) => one.name) : [],
320
333
  realpath: (at) => (toolchain(at) ? (host.realpath?.(at) ?? at) : realpathSync(at)),
321
334
  writeFile: (at, said) => {
322
335
  writeFileSync(at, said)
@@ -389,8 +402,13 @@ export function read(at: string): string | undefined {
389
402
  return text
390
403
  }
391
404
 
405
+ const shapes = new WeakMap<object, ReadonlyMap<string, readonly string[]>>()
406
+
392
407
  export function shapesNamed(): ReadonlyMap<string, readonly string[]> {
393
- const { program, checker } = compiled()
408
+ const held = compiled()
409
+ const known = shapes.get(held)
410
+ if (known !== undefined) return known
411
+ const { program, checker } = held
394
412
  const shape = threadedType(checker, program)
395
413
  const found = new Map<string, string[]>()
396
414
  if (shape === undefined) return found
@@ -419,6 +437,7 @@ export function shapesNamed(): ReadonlyMap<string, readonly string[]> {
419
437
  found.set(named, [...where, at])
420
438
  }
421
439
  }
440
+ shapes.set(held, found)
422
441
  return found
423
442
  }
424
443
 
@@ -429,7 +448,7 @@ export function threading(): ReadonlySet<string> {
429
448
  export function shapeFields(
430
449
  named: string,
431
450
  inside?: string,
432
- ): readonly { readonly name: string; readonly required: boolean; readonly list: boolean; readonly map: boolean; readonly worded: boolean; readonly guide: string }[] {
451
+ ): readonly { readonly name: string; readonly required: boolean; readonly list: boolean; readonly map: boolean; readonly worded: boolean; readonly guide: string; readonly record: readonly string[] }[] {
433
452
  const { program, checker } = compiled()
434
453
  for (const at of [...sources(), ...shipped()]) {
435
454
  if (!SOURCE.test(at)) continue
@@ -466,6 +485,7 @@ export function shapeFields(
466
485
  map: mapped(kind),
467
486
  worded: (kind.isUnion() ? kind.types : [kind]).some((each) => (each.flags & ts.TypeFlags.StringLike) !== 0),
468
487
  guide: ts.displayPartsToString(one.getDocumentationComment(checker)).trim(),
488
+ record: recordOf(checker, kind),
469
489
  }
470
490
  })
471
491
  }
@@ -481,9 +501,10 @@ export interface Field {
481
501
  readonly boolean: boolean
482
502
  readonly worded: boolean
483
503
  readonly guide: string
504
+ readonly record: readonly string[]
484
505
  }
485
506
 
486
- function elementAt(at: string, list: string): { readonly type: ts.Type; readonly node: ts.Node } | undefined {
507
+ function elementAt(at: string, list: string, within?: number): { readonly type: ts.Type; readonly node: ts.Node } | undefined {
487
508
  const { program, checker } = compiled()
488
509
  const file = program.getSourceFile(resolve(ROOT, at))
489
510
  if (file === undefined) return undefined
@@ -493,6 +514,7 @@ function elementAt(at: string, list: string): { readonly type: ts.Type; readonly
493
514
 
494
515
  const consider = (node: ts.ArrayLiteralExpression): void => {
495
516
  if (held !== undefined) return
517
+ if (within !== undefined && node.getStart() !== within) return
496
518
  const wanted = checker.getContextualType(node) ?? checker.getTypeAtLocation(node)
497
519
  const kinds = (wanted.isUnionOrIntersection() ? wanted.types : [wanted])
498
520
  .filter((one) => checker.getIndexTypeOfType(one, ts.IndexKind.Number) !== undefined)
@@ -525,8 +547,8 @@ export function listShape(at: string, list: string): string | undefined {
525
547
  return held === undefined ? undefined : compiled().checker.typeToString(held.type)
526
548
  }
527
549
 
528
- export function listFields(at: string, list: string): readonly Field[] {
529
- const held = elementAt(at, list)
550
+ export function listFields(at: string, list: string, within?: number): readonly Field[] {
551
+ const held = elementAt(at, list, within)
530
552
  if (held === undefined) return []
531
553
  const { checker } = compiled()
532
554
  const bare = (kind: ts.Type): readonly ts.Type[] =>
@@ -557,6 +579,7 @@ export function listFields(at: string, list: string): readonly Field[] {
557
579
  boolean: flagged(kind),
558
580
  worded: worded(kind),
559
581
  guide: ts.displayPartsToString(one.getDocumentationComment(checker)).trim(),
582
+ record: recordOf(checker, kind),
560
583
  }
561
584
  })
562
585
  }
@@ -565,6 +588,21 @@ function elementOf(checker: ts.TypeChecker, type: ts.Type): ts.Type {
565
588
  return checker.getIndexTypeOfType(type, ts.IndexKind.Number) ?? type
566
589
  }
567
590
 
591
+ function recordOf(checker: ts.TypeChecker, type: ts.Type): readonly string[] {
592
+ for (const each of type.isUnion() ? type.types : [type]) {
593
+ if ((each.flags & ts.TypeFlags.StringLike) !== 0 || checker.getIndexTypeOfType(each, ts.IndexKind.Number) === undefined) continue
594
+ const element = elementOf(checker, each)
595
+ if ((element.flags & ts.TypeFlags.Object) === 0) return []
596
+ const fields = checker.getPropertiesOfType(element)
597
+ const worded = fields.every((one) => {
598
+ const kind = checker.getNonNullableType(checker.getTypeOfSymbol(one))
599
+ return (kind.isUnion() ? kind.types : [kind]).every((part) => (part.flags & ts.TypeFlags.StringLike) !== 0)
600
+ })
601
+ return worded ? fields.map((one) => one.getName()) : []
602
+ }
603
+ return []
604
+ }
605
+
568
606
  export function rowShape(at: string, list: string): string | undefined {
569
607
  const { program, checker } = compiled()
570
608
  const file = program.getSourceFile(resolve(ROOT, at))
@@ -751,7 +789,38 @@ export function reached(): readonly string[] {
751
789
  return [THREAD_AT, ...descend().threaded.keys()]
752
790
  }
753
791
 
792
+ let world: object = answering()
793
+
794
+ const worlds = new WeakMap<object, () => void>()
795
+
796
+ function kept(): () => void {
797
+ const was = { passed, built, scanned, commands, ignores, readIgnores, source: new Map(source), asked: new Map(asked) }
798
+ return () => {
799
+ passed = was.passed
800
+ built = was.built
801
+ scanned = was.scanned
802
+ commands = was.commands
803
+ ignores = was.ignores
804
+ readIgnores = was.readIgnores
805
+ source.clear()
806
+ for (const [at, text] of was.source) source.set(at, text)
807
+ asked.clear()
808
+ for (const [at, ignore] of was.asked) asked.set(at, ignore)
809
+ }
810
+ }
811
+
754
812
  export function forget(): void {
813
+ const now = answering()
814
+ if (now === world) libraries.clear()
815
+ else {
816
+ worlds.set(world, kept())
817
+ world = now
818
+ const back = worlds.get(now)
819
+ if (back !== undefined) {
820
+ back()
821
+ return
822
+ }
823
+ }
755
824
  passed = undefined
756
825
  built = undefined
757
826
  scanned = undefined
@@ -800,7 +869,7 @@ export function descend(): Pass {
800
869
  broken.push({
801
870
  file: THREAD_AT,
802
871
  detail: 'the root does not resolve `Threaded`, so nothing here can be recognised as a declaration and every file reads as unthreaded',
803
- instead: `import \`Threaded\` from \`${NAMED}/thread\` in the root, or run \`thread init\`. Without the shape there is nothing to hold anything to`,
872
+ instead: `import \`Threaded\` from \`${SHAPED}\` in the root, or run \`thread init\`. Without the shape there is nothing to hold anything to`,
804
873
  })
805
874
  passed = { threaded, mentioned, derived, stated, coined, broken, findings, declarations, rows, sources: sources() }
806
875
  return passed
@@ -871,7 +940,7 @@ export function descend(): Pass {
871
940
  }
872
941
 
873
942
  const target = resolve(ROOT, row.at)
874
- if (unkept(row.at)) {
943
+ if (!installed(row.at) && unkept(row.at)) {
875
944
  findings.push({
876
945
  file: at,
877
946
  detail: `\`${names(row)}\` names \`${row.at}\`, which git ignores, so it is on this machine and in no clone of it`,
@@ -0,0 +1,52 @@
1
+ export declare const AuthUnauthenticated: import("./error.ts").ErrorFactory<"auth.unauthenticated">;
2
+ export declare const AuthInvalidCredentials: import("./error.ts").ErrorFactory<"auth.invalid_credentials">;
3
+ export declare const AuthTokenExpired: import("./error.ts").ErrorFactory<"auth.token_expired">;
4
+ export declare const AuthTokenReused: import("./error.ts").ErrorFactory<"auth.token_reused">;
5
+ export declare const AuthSessionRevoked: import("./error.ts").ErrorFactory<"auth.session_revoked">;
6
+ export declare const AuthDenied: import("./error.ts").ErrorFactory<"auth.denied">;
7
+ export declare const QuotaExceeded: import("./error.ts").ErrorFactory<"quota.exceeded">;
8
+ export declare const QuotaReservationExpired: import("./error.ts").ErrorFactory<"quota.reservation_expired">;
9
+ export declare const RateLimitExceeded: import("./error.ts").ErrorFactory<"rate_limit.exceeded">;
10
+ export declare const FeatureNotInPlan: import("./error.ts").ErrorFactory<"feature.not_in_plan">;
11
+ export declare const DbNotFound: import("./error.ts").ErrorFactory<"db.not_found">;
12
+ export declare const DbConstraintViolation: import("./error.ts").ErrorFactory<"db.constraint_violation">;
13
+ export declare const DbAlreadyExists: import("./error.ts").ErrorFactory<"db.already_exists">;
14
+ export declare const DbConflict: import("./error.ts").ErrorFactory<"db.conflict">;
15
+ export declare const DbMigrationChecksumMismatch: import("./error.ts").ErrorFactory<"db.migration_checksum_mismatch">;
16
+ export declare const DbDestructiveWithoutDryRun: import("./error.ts").ErrorFactory<"db.destructive_without_dry_run">;
17
+ export declare const DbRoundTripBudgetExceeded: import("./error.ts").ErrorFactory<"db.round_trip_budget_exceeded">;
18
+ export declare const DbCursorInvalid: import("./error.ts").ErrorFactory<"db.cursor_invalid">;
19
+ export declare const DbCursorExpired: import("./error.ts").ErrorFactory<"db.cursor_expired">;
20
+ export declare const WorkflowNodeFailed: import("./error.ts").ErrorFactory<"workflow.node_failed">;
21
+ export declare const WorkflowInvalidTransition: import("./error.ts").ErrorFactory<"workflow.invalid_transition">;
22
+ export declare const WorkflowCompensationFailed: import("./error.ts").ErrorFactory<"workflow.compensation_failed">;
23
+ export declare const WorkflowAlreadyRunning: import("./error.ts").ErrorFactory<"workflow.already_running">;
24
+ export declare const QueueJobFailed: import("./error.ts").ErrorFactory<"queue.job_failed">;
25
+ export declare const QueueDlqExhausted: import("./error.ts").ErrorFactory<"queue.dlq_exhausted">;
26
+ export declare const AiProviderUnavailable: import("./error.ts").ErrorFactory<"ai.provider_unavailable">;
27
+ export declare const AiSchemaValidationFailed: import("./error.ts").ErrorFactory<"ai.schema_validation_failed">;
28
+ export declare const AiToolNotInMask: import("./error.ts").ErrorFactory<"ai.tool_not_in_mask">;
29
+ export declare const AiNodeCapExceeded: import("./error.ts").ErrorFactory<"ai.node_cap_exceeded">;
30
+ export declare const SearchIndexFailed: import("./error.ts").ErrorFactory<"search.index_failed">;
31
+ export declare const SearchQueryInvalid: import("./error.ts").ErrorFactory<"search.query_invalid">;
32
+ export declare const CommsChannelKindUndeclared: import("./error.ts").ErrorFactory<"comms.channel_kind_undeclared">;
33
+ export declare const CommsChannelKindUndescribed: import("./error.ts").ErrorFactory<"comms.channel_kind_undescribed">;
34
+ export declare const CommsChannelKindUnlabelled: import("./error.ts").ErrorFactory<"comms.channel_kind_unlabelled">;
35
+ export declare const CommsChannelKindUndocumented: import("./error.ts").ErrorFactory<"comms.channel_kind_undocumented">;
36
+ export declare const CommsChannelKindDuplicate: import("./error.ts").ErrorFactory<"comms.channel_kind_duplicate">;
37
+ export declare const ConfigInvalid: import("./error.ts").ErrorFactory<"config.invalid">;
38
+ export declare const ConfigMissingEnv: import("./error.ts").ErrorFactory<"config.missing_env">;
39
+ export declare const ConfigSecretInPublicVar: import("./error.ts").ErrorFactory<"config.secret_in_public_var">;
40
+ export declare const ConfigCredentialInvalid: import("./error.ts").ErrorFactory<"config.credential_invalid">;
41
+ export declare const ConfigScopeMissing: import("./error.ts").ErrorFactory<"config.scope_missing">;
42
+ export declare const ConfigResourceNotFound: import("./error.ts").ErrorFactory<"config.resource_not_found">;
43
+ export declare const ConfigDestinationIncompatible: import("./error.ts").ErrorFactory<"config.destination_incompatible">;
44
+ export declare const ConfigBlocksExit: import("./error.ts").ErrorFactory<"config.blocks_exit">;
45
+ export declare const NetTimeout: import("./error.ts").ErrorFactory<"net.timeout">;
46
+ export declare const NetUpstreamUnavailable: import("./error.ts").ErrorFactory<"net.upstream_unavailable">;
47
+ export declare const NetDestinationRefused: import("./error.ts").ErrorFactory<"net.destination_refused">;
48
+ export declare const InternalUnexpected: import("./error.ts").ErrorFactory<"internal.unexpected">;
49
+ export declare const InternalNotImplemented: import("./error.ts").ErrorFactory<"internal.not_implemented">;
50
+ export declare const InternalInvalidArgument: import("./error.ts").ErrorFactory<"internal.invalid_argument">;
51
+ export declare const PLATFORM_ERRORS: readonly [import("./error.ts").ErrorFactory<"auth.unauthenticated">, import("./error.ts").ErrorFactory<"auth.invalid_credentials">, import("./error.ts").ErrorFactory<"auth.token_expired">, import("./error.ts").ErrorFactory<"auth.token_reused">, import("./error.ts").ErrorFactory<"auth.session_revoked">, import("./error.ts").ErrorFactory<"auth.denied">, import("./error.ts").ErrorFactory<"quota.exceeded">, import("./error.ts").ErrorFactory<"quota.reservation_expired">, import("./error.ts").ErrorFactory<"rate_limit.exceeded">, import("./error.ts").ErrorFactory<"feature.not_in_plan">, import("./error.ts").ErrorFactory<"db.not_found">, import("./error.ts").ErrorFactory<"db.constraint_violation">, import("./error.ts").ErrorFactory<"db.already_exists">, import("./error.ts").ErrorFactory<"db.conflict">, import("./error.ts").ErrorFactory<"db.migration_checksum_mismatch">, import("./error.ts").ErrorFactory<"db.destructive_without_dry_run">, import("./error.ts").ErrorFactory<"db.round_trip_budget_exceeded">, import("./error.ts").ErrorFactory<"db.cursor_invalid">, import("./error.ts").ErrorFactory<"db.cursor_expired">, import("./error.ts").ErrorFactory<"workflow.node_failed">, import("./error.ts").ErrorFactory<"workflow.invalid_transition">, import("./error.ts").ErrorFactory<"workflow.compensation_failed">, import("./error.ts").ErrorFactory<"workflow.already_running">, import("./error.ts").ErrorFactory<"queue.job_failed">, import("./error.ts").ErrorFactory<"queue.dlq_exhausted">, import("./error.ts").ErrorFactory<"ai.provider_unavailable">, import("./error.ts").ErrorFactory<"ai.schema_validation_failed">, import("./error.ts").ErrorFactory<"ai.tool_not_in_mask">, import("./error.ts").ErrorFactory<"ai.node_cap_exceeded">, import("./error.ts").ErrorFactory<"search.index_failed">, import("./error.ts").ErrorFactory<"search.query_invalid">, import("./error.ts").ErrorFactory<"comms.channel_kind_undeclared">, import("./error.ts").ErrorFactory<"comms.channel_kind_undescribed">, import("./error.ts").ErrorFactory<"comms.channel_kind_unlabelled">, import("./error.ts").ErrorFactory<"comms.channel_kind_undocumented">, import("./error.ts").ErrorFactory<"comms.channel_kind_duplicate">, import("./error.ts").ErrorFactory<"config.invalid">, import("./error.ts").ErrorFactory<"config.missing_env">, import("./error.ts").ErrorFactory<"config.secret_in_public_var">, import("./error.ts").ErrorFactory<"config.credential_invalid">, import("./error.ts").ErrorFactory<"config.scope_missing">, import("./error.ts").ErrorFactory<"config.resource_not_found">, import("./error.ts").ErrorFactory<"config.destination_incompatible">, import("./error.ts").ErrorFactory<"config.blocks_exit">, import("./error.ts").ErrorFactory<"net.timeout">, import("./error.ts").ErrorFactory<"net.upstream_unavailable">, import("./error.ts").ErrorFactory<"net.destination_refused">, import("./error.ts").ErrorFactory<"internal.unexpected">, import("./error.ts").ErrorFactory<"internal.not_implemented">, import("./error.ts").ErrorFactory<"internal.invalid_argument">];
52
+ export type PlatformErrorCode = (typeof PLATFORM_ERRORS)[number]['def']['code'];
@@ -1,4 +1,4 @@
1
- import { defineError } from "./catalog.js";
1
+ import { defineError } from './error.js';
2
2
  export const AuthUnauthenticated = defineError({
3
3
  code: 'auth.unauthenticated',
4
4
  class: 'UNAUTHENTICATED',
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- import { defineError } from './catalog.ts'
3
+ import { defineError } from './error.ts'
4
4
 
5
5
  export const AuthUnauthenticated = defineError({
6
6
  code: 'auth.unauthenticated',
@@ -1,7 +1,6 @@
1
1
  import { type ErrorClass } from './classes.ts';
2
- export declare const NAMESPACES: readonly ["auth", "quota", "rate_limit", "feature", "db", "workflow", "queue", "ai", "search", "comms", "config", "net", "internal"];
3
- export type Namespace = (typeof NAMESPACES)[number];
4
- export type ErrorCode = `${Namespace}.${string}`;
2
+ import type { ErrorCode } from './namespaces.ts';
3
+ export type { ErrorCode } from './namespaces.ts';
5
4
  export interface ErrorDef<C extends ErrorCode = ErrorCode> {
6
5
  readonly code: C;
7
6
  readonly class: ErrorClass;
@@ -1,19 +1,4 @@
1
- import { classDef } from "./classes.js";
2
- export const NAMESPACES = [
3
- 'auth',
4
- 'quota',
5
- 'rate_limit',
6
- 'feature',
7
- 'db',
8
- 'workflow',
9
- 'queue',
10
- 'ai',
11
- 'search',
12
- 'comms',
13
- 'config',
14
- 'net',
15
- 'internal',
16
- ];
1
+ import { classDef } from './classes.js';
17
2
  export class PlatformError extends Error {
18
3
  def;
19
4
  detail;
@@ -2,25 +2,9 @@
2
2
 
3
3
  import { classDef, type ErrorClass } from './classes.ts'
4
4
 
5
- export const NAMESPACES = [
6
- 'auth',
7
- 'quota',
8
- 'rate_limit',
9
- 'feature',
10
- 'db',
11
- 'workflow',
12
- 'queue',
13
- 'ai',
14
- 'search',
15
- 'comms',
16
- 'config',
17
- 'net',
18
- 'internal',
19
- ] as const
20
-
21
- export type Namespace = (typeof NAMESPACES)[number]
22
-
23
- export type ErrorCode = `${Namespace}.${string}`
5
+ import type { ErrorCode } from './namespaces.ts'
6
+
7
+ export type { ErrorCode } from './namespaces.ts'
24
8
 
25
9
  export interface ErrorDef<C extends ErrorCode = ErrorCode> {
26
10
  readonly code: C
@@ -0,0 +1,3 @@
1
+ export declare const NAMESPACES: readonly ['auth', 'quota', 'rate_limit', 'feature', 'db', 'workflow', 'queue', 'ai', 'search', 'comms', 'config', 'net', 'internal'];
2
+ export type Namespace = (typeof NAMESPACES)[number];
3
+ export type ErrorCode = `${Namespace}.${string}`;