@prestack/thread 0.1.21 → 0.1.23

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 (138) hide show
  1. package/CHANGELOG.md +227 -0
  2. package/dist/core/attach.js +21 -0
  3. package/dist/core/descend.js +6 -3
  4. package/dist/core/generators/commit.js +55 -3
  5. package/dist/core/generators/dev.d.ts +1 -0
  6. package/dist/core/generators/dev.js +69 -0
  7. package/dist/derivation/generators/build.d.ts +3 -1
  8. package/dist/derivation/generators/build.js +104 -22
  9. package/dist/derivation/generators/release.js +74 -25
  10. package/dist/derivation/release.js +3 -3
  11. package/dist/integrations/cli.d.ts +0 -1
  12. package/dist/integrations/cli.js +69 -11
  13. package/dist/integrations/declared.d.ts +2 -0
  14. package/dist/integrations/declared.js +6 -1
  15. package/dist/integrations/pglite.js +13 -3
  16. package/dist/integrations/target.d.ts +3 -0
  17. package/dist/integrity/attach.js +1 -5
  18. package/dist/integrity/slopnators/sl_stale_path.js +10 -0
  19. package/dist/operations/access.js +3 -2
  20. package/dist/operations/capabilities.d.ts +2 -0
  21. package/dist/operations/capabilities.js +2 -0
  22. package/dist/operations/generators/capability.js +237 -24
  23. package/dist/operations/generators/compile.js +150 -50
  24. package/dist/operations/generators/seed.d.ts +3 -0
  25. package/dist/operations/generators/seed.js +25 -3
  26. package/dist/operations/nodes.d.ts +2 -2
  27. package/package.json +1 -1
  28. package/dist/core/actor.ts +0 -21
  29. package/dist/core/attach.ts +0 -613
  30. package/dist/core/chain.ts +0 -145
  31. package/dist/core/condition.ts +0 -227
  32. package/dist/core/descend.ts +0 -1185
  33. package/dist/core/errors/catalogue.ts +0 -314
  34. package/dist/core/errors/classes.ts +0 -51
  35. package/dist/core/errors/error.ts +0 -152
  36. package/dist/core/errors/namespaces.ts +0 -19
  37. package/dist/core/finding.ts +0 -37
  38. package/dist/core/generators/commit.ts +0 -157
  39. package/dist/core/init.ts +0 -222
  40. package/dist/core/invoked.ts +0 -52
  41. package/dist/core/round.ts +0 -74
  42. package/dist/core/rows.ts +0 -506
  43. package/dist/core/scope.ts +0 -20
  44. package/dist/core/thread.ts +0 -29
  45. package/dist/core/tree.ts +0 -90
  46. package/dist/core/types.ts +0 -351
  47. package/dist/derivation/attach.ts +0 -57
  48. package/dist/derivation/generators/build.ts +0 -371
  49. package/dist/derivation/generators/check.ts +0 -118
  50. package/dist/derivation/generators/determinism.ts +0 -145
  51. package/dist/derivation/generators/release.ts +0 -236
  52. package/dist/derivation/release.ts +0 -43
  53. package/dist/integrations/attach.ts +0 -187
  54. package/dist/integrations/cli.ts +0 -606
  55. package/dist/integrations/declared.ts +0 -34
  56. package/dist/integrations/disk.ts +0 -466
  57. package/dist/integrations/generators/read.ts +0 -127
  58. package/dist/integrations/generators/vault.ts +0 -210
  59. package/dist/integrations/https.ts +0 -216
  60. package/dist/integrations/pglite.ts +0 -206
  61. package/dist/integrations/secret.ts +0 -54
  62. package/dist/integrations/target.ts +0 -672
  63. package/dist/integrations/vault.ts +0 -148
  64. package/dist/integrity/attach.ts +0 -150
  65. package/dist/integrity/check-threads.ts +0 -166
  66. package/dist/integrity/constraint.ts +0 -1246
  67. package/dist/integrity/generators/compiler.ts +0 -138
  68. package/dist/integrity/generators/gate.ts +0 -227
  69. package/dist/integrity/generators/issues.ts +0 -160
  70. package/dist/integrity/generators/publish.ts +0 -233
  71. package/dist/integrity/generators/trial.ts +0 -359
  72. package/dist/integrity/lint.ts +0 -214
  73. package/dist/integrity/lsp/bin.ts +0 -44
  74. package/dist/integrity/lsp/diagnostics.ts +0 -92
  75. package/dist/integrity/lsp/findings.ts +0 -63
  76. package/dist/integrity/lsp/lint.ts +0 -124
  77. package/dist/integrity/lsp/protocol.ts +0 -78
  78. package/dist/integrity/lsp/server.ts +0 -224
  79. package/dist/integrity/slopnator.ts +0 -324
  80. package/dist/integrity/slopnators/sl_broken_lineage.ts +0 -38
  81. package/dist/integrity/slopnators/sl_declared_elsewhere.ts +0 -60
  82. package/dist/integrity/slopnators/sl_derived_drift.ts +0 -101
  83. package/dist/integrity/slopnators/sl_door_in_a_node.ts +0 -250
  84. package/dist/integrity/slopnators/sl_hardcoded_style.ts +0 -55
  85. package/dist/integrity/slopnators/sl_inert_island.ts +0 -84
  86. package/dist/integrity/slopnators/sl_inert_slopnator.ts +0 -93
  87. package/dist/integrity/slopnators/sl_missing_row.ts +0 -140
  88. package/dist/integrity/slopnators/sl_no_barrel.ts +0 -48
  89. package/dist/integrity/slopnators/sl_no_child_process.ts +0 -100
  90. package/dist/integrity/slopnators/sl_no_comment.ts +0 -43
  91. package/dist/integrity/slopnators/sl_no_dispatch_bypass.ts +0 -276
  92. package/dist/integrity/slopnators/sl_no_import_cycle.ts +0 -66
  93. package/dist/integrity/slopnators/sl_no_such_command.ts +0 -81
  94. package/dist/integrity/slopnators/sl_only_takes_a_literal.ts +0 -63
  95. package/dist/integrity/slopnators/sl_outside_an_operation.ts +0 -25
  96. package/dist/integrity/slopnators/sl_screen_holds_only_declared.ts +0 -70
  97. package/dist/integrity/slopnators/sl_secret_literal.ts +0 -68
  98. package/dist/integrity/slopnators/sl_stale_path.ts +0 -178
  99. package/dist/integrity/slopnators/sl_twice_meant.ts +0 -57
  100. package/dist/integrity/slopnators/sl_twice_parented.ts +0 -82
  101. package/dist/integrity/slopnators/sl_undeclared_crossing.ts +0 -481
  102. package/dist/integrity/slopnators/sl_undeclared_destination.ts +0 -113
  103. package/dist/integrity/slopnators/sl_undeclared_element.ts +0 -44
  104. package/dist/integrity/slopnators/sl_undeclared_list.ts +0 -358
  105. package/dist/integrity/slopnators/sl_undeclared_node.ts +0 -75
  106. package/dist/integrity/slopnators/sl_undeclared_operation.ts +0 -257
  107. package/dist/integrity/slopnators/sl_undeclared_variant.ts +0 -152
  108. package/dist/integrity/slopnators/sl_undeclared_webhook.ts +0 -108
  109. package/dist/integrity/slopnators/sl_underived_route.ts +0 -72
  110. package/dist/integrity/slopnators/sl_undescribed.ts +0 -65
  111. package/dist/integrity/slopnators/sl_ungoverned_island.ts +0 -60
  112. package/dist/integrity/slopnators/sl_unlisted_program.ts +0 -46
  113. package/dist/integrity/slopnators/sl_unnamed_island.ts +0 -41
  114. package/dist/integrity/slopnators/sl_unpaired_member.ts +0 -139
  115. package/dist/integrity/slopnators/sl_unpaired_slopnator.ts +0 -71
  116. package/dist/integrity/slopnators/sl_unprefixed_member.ts +0 -110
  117. package/dist/integrity/slopnators/sl_unthreaded.ts +0 -421
  118. package/dist/integrity/slopnators/sl_untranslated_key.ts +0 -140
  119. package/dist/integrity/slopnators/sl_unvaulted_secret.ts +0 -132
  120. package/dist/integrity/slopnators/sl_unversioned.ts +0 -52
  121. package/dist/integrity/sweep.ts +0 -395
  122. package/dist/knowledge/attach.ts +0 -327
  123. package/dist/knowledge/generators/docsgen.ts +0 -186
  124. package/dist/knowledge/generators/glossary.ts +0 -73
  125. package/dist/knowledge/glossary.ts +0 -6
  126. package/dist/operations/access.ts +0 -131
  127. package/dist/operations/attach.ts +0 -408
  128. package/dist/operations/capabilities.ts +0 -88
  129. package/dist/operations/dispatch.ts +0 -294
  130. package/dist/operations/error-results.ts +0 -31
  131. package/dist/operations/generators/capability.ts +0 -1054
  132. package/dist/operations/generators/compile.ts +0 -701
  133. package/dist/operations/generators/permits.ts +0 -229
  134. package/dist/operations/generators/seed.ts +0 -359
  135. package/dist/operations/generators/trial.ts +0 -666
  136. package/dist/operations/nodes.ts +0 -53
  137. package/dist/operations/operations.ts +0 -91
  138. 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 {}