@prestack/thread 0.1.20 → 0.1.22

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 (148) hide show
  1. package/CHANGELOG.md +193 -0
  2. package/dist/core/attach.js +21 -0
  3. package/dist/core/descend.d.ts +2 -0
  4. package/dist/core/descend.js +18 -3
  5. package/dist/core/generators/commit.js +55 -3
  6. package/dist/core/generators/dev.d.ts +1 -0
  7. package/dist/core/generators/dev.js +68 -0
  8. package/dist/core/rows.d.ts +5 -0
  9. package/dist/core/rows.js +45 -0
  10. package/dist/core/tree.d.ts +1 -0
  11. package/dist/core/tree.js +7 -1
  12. package/dist/derivation/generators/build.d.ts +3 -1
  13. package/dist/derivation/generators/build.js +103 -22
  14. package/dist/derivation/generators/release.js +74 -26
  15. package/dist/derivation/release.js +3 -3
  16. package/dist/integrations/cli.d.ts +3 -9
  17. package/dist/integrations/cli.js +96 -36
  18. package/dist/integrations/declared.d.ts +8 -0
  19. package/dist/integrations/declared.js +22 -0
  20. package/dist/integrations/pglite.js +13 -3
  21. package/dist/integrations/target.d.ts +4 -1
  22. package/dist/integrations/target.js +20 -6
  23. package/dist/integrity/attach.js +1 -5
  24. package/dist/integrity/generators/publish.js +2 -1
  25. package/dist/integrity/slopnators/sl_stale_path.js +10 -0
  26. package/dist/integrity/slopnators/sl_unlisted_program.js +2 -2
  27. package/dist/operations/access.js +3 -2
  28. package/dist/operations/capabilities.d.ts +2 -0
  29. package/dist/operations/capabilities.js +2 -0
  30. package/dist/operations/generators/capability.js +234 -24
  31. package/dist/operations/generators/compile.d.ts +21 -0
  32. package/dist/operations/generators/compile.js +151 -51
  33. package/dist/operations/generators/permits.d.ts +2 -1
  34. package/dist/operations/generators/permits.js +52 -47
  35. package/dist/operations/generators/seed.d.ts +3 -0
  36. package/dist/operations/generators/seed.js +25 -3
  37. package/dist/operations/nodes.d.ts +2 -2
  38. package/package.json +1 -1
  39. package/dist/core/actor.ts +0 -21
  40. package/dist/core/attach.ts +0 -613
  41. package/dist/core/chain.ts +0 -145
  42. package/dist/core/condition.ts +0 -227
  43. package/dist/core/descend.ts +0 -1173
  44. package/dist/core/errors/catalogue.ts +0 -314
  45. package/dist/core/errors/classes.ts +0 -51
  46. package/dist/core/errors/error.ts +0 -152
  47. package/dist/core/errors/namespaces.ts +0 -19
  48. package/dist/core/finding.ts +0 -37
  49. package/dist/core/generators/commit.ts +0 -157
  50. package/dist/core/init.ts +0 -222
  51. package/dist/core/invoked.ts +0 -52
  52. package/dist/core/round.ts +0 -74
  53. package/dist/core/rows.ts +0 -459
  54. package/dist/core/scope.ts +0 -20
  55. package/dist/core/thread.ts +0 -29
  56. package/dist/core/tree.ts +0 -90
  57. package/dist/core/types.ts +0 -351
  58. package/dist/derivation/attach.ts +0 -57
  59. package/dist/derivation/generators/build.ts +0 -371
  60. package/dist/derivation/generators/check.ts +0 -118
  61. package/dist/derivation/generators/determinism.ts +0 -145
  62. package/dist/derivation/generators/release.ts +0 -236
  63. package/dist/derivation/release.ts +0 -43
  64. package/dist/integrations/attach.ts +0 -187
  65. package/dist/integrations/cli.ts +0 -615
  66. package/dist/integrations/disk.ts +0 -466
  67. package/dist/integrations/generators/read.ts +0 -127
  68. package/dist/integrations/generators/vault.ts +0 -210
  69. package/dist/integrations/https.ts +0 -216
  70. package/dist/integrations/pglite.ts +0 -206
  71. package/dist/integrations/secret.ts +0 -54
  72. package/dist/integrations/target.ts +0 -656
  73. package/dist/integrations/vault.ts +0 -148
  74. package/dist/integrity/attach.ts +0 -150
  75. package/dist/integrity/check-threads.ts +0 -166
  76. package/dist/integrity/constraint.ts +0 -1246
  77. package/dist/integrity/generators/compiler.ts +0 -138
  78. package/dist/integrity/generators/gate.ts +0 -227
  79. package/dist/integrity/generators/issues.ts +0 -160
  80. package/dist/integrity/generators/publish.ts +0 -232
  81. package/dist/integrity/generators/trial.ts +0 -359
  82. package/dist/integrity/lint.ts +0 -214
  83. package/dist/integrity/lsp/bin.ts +0 -44
  84. package/dist/integrity/lsp/diagnostics.ts +0 -92
  85. package/dist/integrity/lsp/findings.ts +0 -63
  86. package/dist/integrity/lsp/lint.ts +0 -124
  87. package/dist/integrity/lsp/protocol.ts +0 -78
  88. package/dist/integrity/lsp/server.ts +0 -224
  89. package/dist/integrity/slopnator.ts +0 -324
  90. package/dist/integrity/slopnators/sl_broken_lineage.ts +0 -38
  91. package/dist/integrity/slopnators/sl_declared_elsewhere.ts +0 -60
  92. package/dist/integrity/slopnators/sl_derived_drift.ts +0 -101
  93. package/dist/integrity/slopnators/sl_door_in_a_node.ts +0 -250
  94. package/dist/integrity/slopnators/sl_hardcoded_style.ts +0 -55
  95. package/dist/integrity/slopnators/sl_inert_island.ts +0 -84
  96. package/dist/integrity/slopnators/sl_inert_slopnator.ts +0 -93
  97. package/dist/integrity/slopnators/sl_missing_row.ts +0 -140
  98. package/dist/integrity/slopnators/sl_no_barrel.ts +0 -48
  99. package/dist/integrity/slopnators/sl_no_child_process.ts +0 -100
  100. package/dist/integrity/slopnators/sl_no_comment.ts +0 -43
  101. package/dist/integrity/slopnators/sl_no_dispatch_bypass.ts +0 -276
  102. package/dist/integrity/slopnators/sl_no_import_cycle.ts +0 -66
  103. package/dist/integrity/slopnators/sl_no_such_command.ts +0 -81
  104. package/dist/integrity/slopnators/sl_only_takes_a_literal.ts +0 -63
  105. package/dist/integrity/slopnators/sl_outside_an_operation.ts +0 -25
  106. package/dist/integrity/slopnators/sl_screen_holds_only_declared.ts +0 -70
  107. package/dist/integrity/slopnators/sl_secret_literal.ts +0 -68
  108. package/dist/integrity/slopnators/sl_stale_path.ts +0 -178
  109. package/dist/integrity/slopnators/sl_twice_meant.ts +0 -57
  110. package/dist/integrity/slopnators/sl_twice_parented.ts +0 -82
  111. package/dist/integrity/slopnators/sl_undeclared_crossing.ts +0 -481
  112. package/dist/integrity/slopnators/sl_undeclared_destination.ts +0 -113
  113. package/dist/integrity/slopnators/sl_undeclared_element.ts +0 -44
  114. package/dist/integrity/slopnators/sl_undeclared_list.ts +0 -358
  115. package/dist/integrity/slopnators/sl_undeclared_node.ts +0 -75
  116. package/dist/integrity/slopnators/sl_undeclared_operation.ts +0 -257
  117. package/dist/integrity/slopnators/sl_undeclared_variant.ts +0 -152
  118. package/dist/integrity/slopnators/sl_undeclared_webhook.ts +0 -108
  119. package/dist/integrity/slopnators/sl_underived_route.ts +0 -72
  120. package/dist/integrity/slopnators/sl_undescribed.ts +0 -65
  121. package/dist/integrity/slopnators/sl_ungoverned_island.ts +0 -60
  122. package/dist/integrity/slopnators/sl_unlisted_program.ts +0 -46
  123. package/dist/integrity/slopnators/sl_unnamed_island.ts +0 -41
  124. package/dist/integrity/slopnators/sl_unpaired_member.ts +0 -139
  125. package/dist/integrity/slopnators/sl_unpaired_slopnator.ts +0 -71
  126. package/dist/integrity/slopnators/sl_unprefixed_member.ts +0 -110
  127. package/dist/integrity/slopnators/sl_unthreaded.ts +0 -421
  128. package/dist/integrity/slopnators/sl_untranslated_key.ts +0 -140
  129. package/dist/integrity/slopnators/sl_unvaulted_secret.ts +0 -132
  130. package/dist/integrity/slopnators/sl_unversioned.ts +0 -52
  131. package/dist/integrity/sweep.ts +0 -395
  132. package/dist/knowledge/attach.ts +0 -327
  133. package/dist/knowledge/generators/docsgen.ts +0 -186
  134. package/dist/knowledge/generators/glossary.ts +0 -73
  135. package/dist/knowledge/glossary.ts +0 -6
  136. package/dist/operations/access.ts +0 -131
  137. package/dist/operations/attach.ts +0 -408
  138. package/dist/operations/capabilities.ts +0 -88
  139. package/dist/operations/dispatch.ts +0 -294
  140. package/dist/operations/error-results.ts +0 -31
  141. package/dist/operations/generators/capability.ts +0 -1054
  142. package/dist/operations/generators/compile.ts +0 -701
  143. package/dist/operations/generators/permits.ts +0 -224
  144. package/dist/operations/generators/seed.ts +0 -359
  145. package/dist/operations/generators/trial.ts +0 -666
  146. package/dist/operations/nodes.ts +0 -53
  147. package/dist/operations/operations.ts +0 -91
  148. package/dist/operations/result.ts +0 -28
@@ -1,53 +0,0 @@
1
- import type { Threaded } from '../core/thread.ts'
2
-
3
- import type { Opened, Operation, Reads } from './operations.ts'
4
-
5
- export interface Node extends Threaded {
6
- readonly version: number
7
- }
8
-
9
- export type Held<I = unknown> = Parameters<Operation<I>['run']>[1]
10
-
11
- export const STOPPED = Symbol.for('thread.operation.stopped')
12
-
13
- export function stopped(thrown: unknown): { readonly value: unknown } | undefined {
14
- if (typeof thrown !== 'object' || thrown === null) return undefined
15
- if ((thrown as Record<symbol, unknown>)[STOPPED] !== true) return undefined
16
- return { value: (thrown as { readonly value?: unknown }).value }
17
- }
18
-
19
- export const nd_read = <I, R extends string = never>(
20
- block: (opened: Reads<Opened<R>>, held: Held<I>) => Promise<unknown>,
21
- ) => ({ type: 'nd_read' as const })
22
-
23
- export const nd_action = <I, R extends string = never>(
24
- block: (opened: Opened<R>, held: Held<I>) => Promise<unknown>,
25
- ) => ({ type: 'nd_action' as const })
26
-
27
- export const nd_branch = <I, R extends string = never>(
28
- choose: (opened: Reads<Opened<R>>, held: Held<I>) => Promise<string>,
29
- ways: Readonly<Record<string, (opened: Opened<R>, held: Held<I>) => Promise<unknown>>>,
30
- ) => ({ type: 'nd_branch' as const })
31
-
32
- export const nd_each = <I, R extends string = never>(
33
- over: (held: Held<I>) => readonly unknown[],
34
- block: (item: unknown, opened: Opened<R>, held: Held<I>) => Promise<unknown>,
35
- ) => ({ type: 'nd_each' as const })
36
-
37
- export const nd_parallel = <I, R extends string = never>(
38
- blocks: readonly ((opened: Opened<R>, held: Held<I>) => Promise<unknown>)[],
39
- ) => ({ type: 'nd_parallel' as const })
40
-
41
- export const nd_repeat = <I, R extends string = never>(
42
- ceiling: number,
43
- block: (
44
- pass: number,
45
- carried: unknown,
46
- opened: Opened<R>,
47
- held: Held<I>,
48
- ) => Promise<{ readonly done: boolean; readonly value: unknown }>,
49
- ) => ({ type: 'nd_repeat' as const })
50
-
51
- export const nd_stop = <I, R extends string = never>(
52
- block: (opened: Reads<Opened<R>>, held: Held<I>) => Promise<unknown>,
53
- ) => ({ type: 'nd_stop' as const })
@@ -1,91 +0,0 @@
1
- import type { z } from 'zod'
2
-
3
- import type { Actor } from '../core/actor.ts'
4
- import type { Member } from '../core/thread.ts'
5
- import { REACH, type Answering, type Calling, type HttpResponse, type Row, type Running, type Store } from '../integrations/target.ts'
6
-
7
- import type { Surface } from './capabilities.ts'
8
-
9
- export const OPERATIONS_FILE = 'operations.ts'
10
-
11
- export const TRIALS_AT = 'operations/_trials.json'
12
-
13
- export const NODES_FILE = 'nodes.ts'
14
-
15
- export const MEMBERS_LIST = 'MEMBERS'
16
-
17
- export interface Reaching {}
18
-
19
- type CallsOf<K extends string> = K extends keyof Reaching ? (Reaching[K] extends string ? Reaching[K] : string) : string
20
-
21
- export type Opened<R extends string = never> = { readonly actor: Actor; readonly tell: (said: unknown) => void } & {
22
- readonly [K in R]: K extends `${typeof REACH.disk}${string}`
23
- ? Answering
24
- : K extends `${typeof REACH.cli}${string}`
25
- ? Running<CallsOf<K>>
26
- : K extends `${typeof REACH.postgres}${string}` | `${typeof REACH.pglite}${string}` | `${typeof REACH.browser}${string}`
27
- ? Store
28
- : K extends `${typeof REACH.sdk}${string}`
29
- ? Calling<CallsOf<K>>
30
- : Readonly<
31
- Record<
32
- CallsOf<K>,
33
- (given?: {
34
- readonly fills?: Readonly<Record<string, string | number>>
35
- readonly json?: unknown
36
- readonly body?: Uint8Array
37
- readonly contentType?: string
38
- readonly told?: (said: unknown) => void
39
- }) => Promise<HttpResponse>
40
- >
41
- >
42
- }
43
-
44
- export type Reads<H> = { readonly [K in keyof H]: H[K] extends Store ? Pick<Store, 'get' | 'list'> : H[K] }
45
-
46
- export const WINDOWS = ['second', 'minute', 'hour', 'day', 'week', 'month'] as const
47
-
48
- export type Window = (typeof WINDOWS)[number]
49
-
50
- export interface Allowance {
51
- readonly runs: number
52
-
53
- readonly per: Window
54
- }
55
-
56
- export interface Counting {
57
- readonly seen: (key: string, per: Window) => Promise<number>
58
- }
59
-
60
- export interface Operation<I = unknown, R extends string = never> {
61
- readonly id: string
62
-
63
- readonly input: z.ZodType<I>
64
-
65
- readonly requires: readonly string[]
66
-
67
- readonly webhooks?: readonly string[]
68
-
69
- readonly off?: readonly Surface[]
70
-
71
- readonly signed?: boolean
72
-
73
- readonly entitled?: string
74
-
75
- readonly rate?: Allowance
76
-
77
- readonly quota?: Allowance
78
-
79
- readonly run: (
80
- opened: Opened<R>,
81
- held: { readonly input: I } & Readonly<Record<string, unknown>>,
82
- ) => Promise<unknown>
83
-
84
- readonly timeout: number
85
-
86
- readonly resource: (input: I) => Row | null
87
- }
88
-
89
- export type OperationMember = Member & Pick<Operation, 'timeout' | 'webhooks' | 'off' | 'signed' | 'entitled' | 'rate' | 'quota'>
90
-
91
- export const OPERATIONS: readonly Member[] = []
@@ -1,28 +0,0 @@
1
- import type { ErrorCode, ErrorDef } from '../core/errors/error.ts'
2
- import type { ErrorClass } from '../core/errors/classes.ts'
3
-
4
- export type ResultCode = 'denied' | 'invalid' | 'rate_limited' | 'feature_denied' | 'quota_exceeded' | 'error'
5
-
6
- export type FailureIdentity = Pick<ErrorDef, 'code' | 'class'>
7
-
8
- export type Result<O> =
9
- | { ok: true; value: O }
10
- | {
11
- ok: false
12
- code: ResultCode
13
- error: string
14
- because?: string
15
- errorCode?: ErrorCode
16
- errorClass?: ErrorClass
17
- }
18
-
19
- export const ok = <O>(value: O): Result<O> => ({ ok: true, value })
20
- export const fail = <O>(code: ResultCode, error: string, because?: string, identity?: FailureIdentity): Result<O> => ({
21
- ok: false,
22
- code,
23
- error,
24
- because,
25
- ...(identity === undefined ? {} : { errorCode: identity.code, errorClass: identity.class }),
26
- })
27
-
28
- export class ValidationError extends Error {}