deepline 0.3.44 → 0.3.46

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 (99) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +2 -3
  2. package/dist/bundling-sources/sdk/src/errors.ts +2 -2
  3. package/dist/bundling-sources/sdk/src/http.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/play.ts +7 -10
  5. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +3 -3
  6. package/dist/bundling-sources/sdk/src/release.ts +3 -3
  7. package/dist/bundling-sources/sdk/src/version.ts +2 -2
  8. package/dist/bundling-sources/shared_libs/play-data-plane/contracts.ts +25 -0
  9. package/dist/bundling-sources/shared_libs/play-data-plane/index.ts +1 -0
  10. package/dist/bundling-sources/shared_libs/play-data-plane/sheet-contract.ts +1 -1
  11. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +19 -19
  12. package/dist/bundling-sources/shared_libs/play-runtime/backend.ts +5 -6
  13. package/dist/bundling-sources/shared_libs/play-runtime/cell-staleness.ts +1 -66
  14. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +1551 -276
  15. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +14 -3
  16. package/dist/bundling-sources/shared_libs/play-runtime/dataset-id.ts +4 -3
  17. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +3 -4
  18. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +2 -2
  19. package/dist/bundling-sources/shared_libs/play-runtime/email-status.ts +1 -275
  20. package/dist/bundling-sources/shared_libs/play-runtime/execution-ledger-store.ts +1 -1
  21. package/dist/bundling-sources/shared_libs/play-runtime/extractor-targets.ts +1 -106
  22. package/dist/bundling-sources/shared_libs/play-runtime/gateway-postgres-admission.ts +1 -2
  23. package/dist/bundling-sources/shared_libs/play-runtime/governor/in-memory-rate-state-backend.ts +13 -4
  24. package/dist/bundling-sources/shared_libs/play-runtime/live-events.ts +1 -5
  25. package/dist/bundling-sources/shared_libs/play-runtime/map-row-identity.ts +2 -3
  26. package/dist/bundling-sources/shared_libs/play-runtime/map-row-outcome.ts +2 -1
  27. package/dist/bundling-sources/shared_libs/play-runtime/modal-runtime-config.ts +1 -1
  28. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +1 -1
  29. package/dist/bundling-sources/shared_libs/play-runtime/projection.ts +5 -5
  30. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -3
  31. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +1 -1
  32. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +1 -1
  33. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +4 -4
  34. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-modal-fallback.ts +3 -3
  35. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +8 -8
  36. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +11 -1
  37. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +26 -8
  38. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts +7 -7
  39. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +23 -11
  40. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/bundle.ts +13 -2
  41. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/index.ts +2 -2
  42. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runner-events.ts +1 -1
  43. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +1 -1
  44. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +58 -2
  45. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +1 -1
  46. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +6 -3
  47. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +1 -1
  48. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constraints.ts +1 -2
  49. package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +55 -0
  50. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +418 -0
  51. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts +452 -0
  52. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +304 -0
  53. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/testkit.ts +83 -0
  54. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runtime-limits.ts +1 -109
  55. package/dist/bundling-sources/shared_libs/play-runtime/step-program-dataset-builder.ts +1 -1
  56. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +1 -1
  57. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/always-fresh-adapter.ts +50 -0
  58. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/contract.ts +135 -0
  59. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/index.ts +291 -0
  60. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/native-batch.ts +335 -0
  61. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/receipt-cohort.ts +904 -0
  62. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts +522 -0
  63. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/testkit.ts +165 -0
  64. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +1 -1
  65. package/dist/bundling-sources/shared_libs/play-runtime/tool-execution-outcome.ts +6 -5
  66. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +1 -1
  67. package/dist/bundling-sources/shared_libs/play-runtime/tool-result-types.ts +1 -206
  68. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +10 -7
  69. package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +1 -1
  70. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +8 -3
  71. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +4 -4
  72. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +3 -6
  73. package/dist/bundling-sources/shared_libs/plays/cell-staleness.ts +66 -0
  74. package/dist/bundling-sources/shared_libs/plays/compiler-manifest.ts +1 -1
  75. package/dist/bundling-sources/shared_libs/plays/contracts.ts +2 -2
  76. package/dist/bundling-sources/shared_libs/plays/core.ts +466 -0
  77. package/dist/bundling-sources/shared_libs/plays/email-status.ts +287 -0
  78. package/dist/bundling-sources/shared_libs/plays/extractor-targets.ts +106 -0
  79. package/dist/bundling-sources/shared_libs/plays/row-identity.ts +1 -3
  80. package/dist/bundling-sources/shared_libs/plays/runtime-constraints.ts +2 -0
  81. package/dist/bundling-sources/shared_libs/plays/runtime-validation.ts +4 -2
  82. package/dist/bundling-sources/shared_libs/plays/sandbox-runtime-limits.ts +109 -0
  83. package/dist/bundling-sources/shared_libs/plays/tool-execution-error.ts +624 -0
  84. package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +206 -0
  85. package/dist/bundling-sources/shared_libs/security/safe-outbound-fetch.ts +1 -1
  86. package/dist/cli/index.js +174 -168
  87. package/dist/cli/index.mjs +182 -169
  88. package/dist/{compiler-manifest-DwYe2C2S.d.mts → compiler-manifest-BuoqasqI.d.mts} +585 -540
  89. package/dist/{compiler-manifest-DwYe2C2S.d.ts → compiler-manifest-BuoqasqI.d.ts} +585 -540
  90. package/dist/index.d.mts +9 -2
  91. package/dist/index.d.ts +9 -2
  92. package/dist/index.js +47 -40
  93. package/dist/index.mjs +47 -40
  94. package/dist/install-integrity.json +24 -3
  95. package/dist/plays/bundle-play-file.d.mts +4 -61
  96. package/dist/plays/bundle-play-file.d.ts +4 -61
  97. package/dist/plays/bundle-play-file.mjs +157 -155
  98. package/package.json +9 -6
  99. /package/dist/bundling-sources/shared_libs/{play-runtime → plays}/tool-response-contract.ts +0 -0
@@ -39,7 +39,7 @@ import type { DocflowObservationUpsert } from './docflow-observation';
39
39
  import type { RuntimeMapMemoryLimits } from './map-memory-limits';
40
40
  import type { AnyBatchOperationStrategy } from './batching-types';
41
41
  import type { ToolResultMetadataInput } from './tool-result';
42
- import type { PreviousCell } from './cell-staleness';
42
+ import type { PreviousCell } from '../plays/cell-staleness';
43
43
  import type { MapRowOutcome } from './durability-store';
44
44
  import type { WorkReceiptFailureKind } from './work-receipts';
45
45
  import type { RunExecutionScope } from './run-execution-scope';
@@ -49,9 +49,9 @@ import type { PlayActivityEvent } from './activity-observation';
49
49
  import type {
50
50
  ToolExecutionErrorSchemaVersion,
51
51
  ToolExecutionFailureV1,
52
- } from '../tool-execution-error';
52
+ } from '../plays/tool-execution-error';
53
53
  import type { FixtureBehavior } from './fixture-behavior';
54
- import type { ToolResponseContract } from './tool-response-contract';
54
+ import type { ToolResponseContract } from '../plays/tool-response-contract';
55
55
 
56
56
  export interface RowState {
57
57
  results: Map<string, unknown>;
@@ -59,6 +59,11 @@ export interface RowState {
59
59
 
60
60
  export interface ToolCallRequest {
61
61
  callId: string;
62
+ /**
63
+ * Stable per-run call identity used to fence a forced provider operation
64
+ * when receipt coordination deliberately has no active lease.
65
+ */
66
+ logicalCallId?: string;
62
67
  cacheKey: string;
63
68
  /** Stable external-operation identity, independent of receipt serialization. */
64
69
  providerIdempotencyKeyBase?: string | null;
@@ -723,6 +728,12 @@ export interface ContextOptions {
723
728
  }) => Promise<void | {
724
729
  updated: number;
725
730
  staleDroppedKeys?: string[];
731
+ /**
732
+ * Keys initially fenced by a terminal write but verified by the
733
+ * runner-owned sheet session as terminal rows for this same run. These are
734
+ * idempotent settlements, not output that belongs to a newer run.
735
+ */
736
+ recoveredStaleKeys?: string[];
726
737
  }>;
727
738
  /**
728
739
  * Persists coalesced, non-terminal row patches before a map suspends.
@@ -10,7 +10,8 @@ export function createRuntimeDatasetId(
10
10
  ): string {
11
11
  const normalizedPlayName = normalizePlayNameForSheet(playName);
12
12
  const normalizedTableNamespace = normalizeTableNamespace(tableNamespace);
13
- return sha256Hex(
14
- `${normalizedPlayName}:${normalizedTableNamespace}`,
15
- ).slice(0, 40);
13
+ return sha256Hex(`${normalizedPlayName}:${normalizedTableNamespace}`).slice(
14
+ 0,
15
+ 40,
16
+ );
16
17
  }
@@ -2,12 +2,11 @@ import {
2
2
  normalizeTableNamespace,
3
3
  sha256Hex,
4
4
  stableStringify,
5
- // Relative (not '@shared_libs/...') because this file ships inside the
6
- // packed SDK's dist/bundling-sources graph, where only relative imports
7
- // resolve.
5
+ // The SDK pack adapter rewrites this workspace import to the preserved
6
+ // relative dist/bundling-sources layout.
8
7
  } from '../plays/row-identity';
9
8
  import { resolveDurableCallCachePolicy } from './durable-call-policy';
10
- import { normalizeToolResponseReceiptRevision } from './tool-response-contract';
9
+ import { normalizeToolResponseReceiptRevision } from '../plays/tool-response-contract';
11
10
 
12
11
  export {
13
12
  DURABLE_CALL_STALE_AFTER_SECONDS_ERROR,
@@ -22,11 +22,11 @@ import {
22
22
  deserializeToolExecutionFailure,
23
23
  serializeToolExecutionFailure,
24
24
  TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
25
- } from '../tool-execution-error';
25
+ } from '../plays/tool-execution-error';
26
26
  import type {
27
27
  ToolExecutionErrorSchemaVersion,
28
28
  ToolExecutionFailureV1,
29
- } from '../tool-execution-error';
29
+ } from '../plays/tool-execution-error';
30
30
 
31
31
  export const DURABLE_RECEIPT_WAIT_MAX_ATTEMPTS = 240;
32
32
  export const DURABLE_RECEIPT_WAIT_DELAY_MS = 250;
@@ -1,275 +1 @@
1
- export type EmailStatusVerdict =
2
- | 'send'
3
- | 'send_with_caution'
4
- | 'verify_next'
5
- | 'hold'
6
- | 'drop';
7
-
8
- export type EmailStatusValue =
9
- | 'valid'
10
- | 'invalid'
11
- | 'catch_all'
12
- | 'valid_catch_all'
13
- | 'unknown'
14
- | 'do_not_mail'
15
- | 'spamtrap'
16
- | 'abuse'
17
- | 'disposable';
18
-
19
- export type EmailDeliverability = 'high' | 'medium' | 'low' | 'unknown';
20
-
21
- export type EmailMxClass =
22
- | 'consumer_mailbox'
23
- | 'workspace_mailbox'
24
- | 'security_gateway'
25
- | 'on_prem'
26
- | 'unknown';
27
-
28
- export type EmailStatus = {
29
- verdict: EmailStatusVerdict;
30
- status: EmailStatusValue;
31
- verified: boolean;
32
- confidence: number | null;
33
- reasons: string[];
34
- signals: {
35
- catch_all: boolean | null;
36
- deliverability: EmailDeliverability;
37
- mx_class: EmailMxClass;
38
- mx_provider: string | null;
39
- mx_record: string | null;
40
- fraud_score: number | null;
41
- disposable: boolean | null;
42
- role_based: boolean | null;
43
- free_email: boolean | null;
44
- abuse: boolean | null;
45
- spamtrap: boolean | null;
46
- suspect: boolean | null;
47
- valid: boolean | null;
48
- };
49
- provider: {
50
- name: string;
51
- raw_status: string | boolean | number | null;
52
- raw_score: number | null;
53
- };
54
- };
55
-
56
- export type EmailStatusMapEntry = {
57
- status: EmailStatusValue;
58
- verdict?: EmailStatusVerdict;
59
- verified?: boolean;
60
- reason?: string;
61
- };
62
-
63
- export type EmailStatusRule = EmailStatusMapEntry & {
64
- when: Record<string, string | number | boolean | null>;
65
- };
66
-
67
- export type EmailStatusExtractorConfig = {
68
- provider: string;
69
- rawStatus?: string[];
70
- rawScore?: string[];
71
- valid?: string[];
72
- deliverability?: string[];
73
- catchAll?: string[];
74
- mxProvider?: string[];
75
- mxRecord?: string[];
76
- fraudScore?: string[];
77
- disposable?: string[];
78
- roleBased?: string[];
79
- freeEmail?: string[];
80
- abuse?: string[];
81
- spamtrap?: string[];
82
- suspect?: string[];
83
- statusMap?: Record<string, EmailStatusMapEntry>;
84
- rules?: EmailStatusRule[];
85
- };
86
-
87
- export type EmailStatusBuildInput = {
88
- config: EmailStatusExtractorConfig;
89
- values: Record<string, unknown>;
90
- };
91
-
92
- // There is intentionally NO shared default status map. Each provider must
93
- // declare its own `statusMap` / `rules` for the raw status strings it emits
94
- // (see the provider registries under src/lib/integrations/**). A coarse global
95
- // map silently coerced provider-specific strings ("deliverable", "accept_all",
96
- // etc.) into canonical verdicts and let validators depend on guesses instead of
97
- // documented behavior. With it gone, an unmapped raw status falls through to
98
- // the typed signal inference below (and ultimately to `unknown`/`hold`) rather
99
- // than being normalized by a global lookup — loud and provider-declared over
100
- // silent and implicit.
101
-
102
- function normalizeKey(value: unknown): string | null {
103
- if (value == null) return null;
104
- if (typeof value === 'boolean') return String(value);
105
- const normalized = String(value).trim().toLowerCase().replace(/\s+/g, '_');
106
- return normalized || null;
107
- }
108
-
109
- function boolish(value: unknown): boolean | null {
110
- if (typeof value === 'boolean') return value;
111
- if (typeof value === 'number') return value === 1 ? true : value === 0 ? false : null;
112
- if (typeof value !== 'string') return null;
113
- const normalized = value.trim().toLowerCase();
114
- if (['true', 'yes', 'y', '1'].includes(normalized)) return true;
115
- if (['false', 'no', 'n', '0'].includes(normalized)) return false;
116
- return null;
117
- }
118
-
119
- function numberish(value: unknown): number | null {
120
- if (typeof value === 'number' && Number.isFinite(value)) return value;
121
- if (typeof value !== 'string' || value.trim() === '') return null;
122
- const parsed = Number(value);
123
- return Number.isFinite(parsed) ? parsed : null;
124
- }
125
-
126
- function stringish(value: unknown): string | null {
127
- return typeof value === 'string' && value.trim() ? value.trim() : null;
128
- }
129
-
130
- function deliverability(value: unknown): EmailDeliverability {
131
- const normalized = normalizeKey(value);
132
- return normalized === 'high' || normalized === 'medium' || normalized === 'low'
133
- ? normalized
134
- : 'unknown';
135
- }
136
-
137
- function mxClass(mxProvider: unknown, mxRecord: unknown): EmailMxClass {
138
- const haystack = `${stringish(mxProvider) ?? ''} ${stringish(mxRecord) ?? ''}`.toLowerCase();
139
- if (!haystack.trim()) return 'unknown';
140
- if (
141
- /proofpoint|pphosted|mimecast|barracuda|ess\.barracudanetworks|ironport|cisco|iphmx|messagelabs|symantec/.test(
142
- haystack,
143
- )
144
- ) {
145
- return 'security_gateway';
146
- }
147
- if (/aspmx\.l\.google|google|g-suite|google workspace/.test(haystack)) {
148
- return 'workspace_mailbox';
149
- }
150
- if (/protection\.outlook|office365|microsoft|outlook|exchange online/.test(haystack)) {
151
- return 'workspace_mailbox';
152
- }
153
- if (/gmail|yahoo|icloud|aol|hotmail/.test(haystack)) return 'consumer_mailbox';
154
- if (/postfix|exim|sendmail|zimbra|plesk|cpanel|mail\./.test(haystack)) return 'on_prem';
155
- return 'unknown';
156
- }
157
-
158
- function entryForStatus(
159
- key: string | null,
160
- map: Record<string, EmailStatusMapEntry> | undefined,
161
- ): EmailStatusMapEntry | null {
162
- if (!key) return null;
163
- return map?.[key] ?? null;
164
- }
165
-
166
- function read(values: Record<string, unknown>, name: string): unknown {
167
- return values[name];
168
- }
169
-
170
- function matchesRule(
171
- rule: EmailStatusRule,
172
- values: Record<string, unknown>,
173
- ): boolean {
174
- return Object.entries(rule.when).every(([key, expected]) => {
175
- const actual = read(values, key);
176
- if (key.endsWith('Lt')) {
177
- const source = numberish(read(values, key.slice(0, -2)));
178
- return typeof expected === 'number' && source != null && source < expected;
179
- }
180
- if (typeof expected === 'boolean') return boolish(actual) === expected;
181
- if (typeof expected === 'number') return numberish(actual) === expected;
182
- return normalizeKey(actual) === normalizeKey(expected);
183
- });
184
- }
185
-
186
- export function buildEmailStatus({
187
- config,
188
- values,
189
- }: EmailStatusBuildInput): EmailStatus {
190
- const rawStatus = read(values, 'rawStatus');
191
- const rawScore = numberish(read(values, 'rawScore'));
192
- const valid = boolish(read(values, 'valid'));
193
- const catchAll = boolish(read(values, 'catchAll'));
194
- const disposable = boolish(read(values, 'disposable'));
195
- const abuse = boolish(read(values, 'abuse'));
196
- const spamtrap = boolish(read(values, 'spamtrap'));
197
- const suspect = boolish(read(values, 'suspect'));
198
- const rawKey = normalizeKey(rawStatus);
199
- const mapped =
200
- config.rules?.find((rule) => matchesRule(rule, values)) ??
201
- entryForStatus(rawKey, config.statusMap) ??
202
- entryForStatus(valid == null ? null : String(valid), config.statusMap);
203
-
204
- const status =
205
- mapped?.status ??
206
- (disposable
207
- ? 'disposable'
208
- : abuse
209
- ? 'abuse'
210
- : spamtrap
211
- ? 'spamtrap'
212
- : catchAll
213
- ? 'catch_all'
214
- : valid === true
215
- ? 'valid'
216
- : valid === false
217
- ? 'invalid'
218
- : 'unknown');
219
- const defaultVerdict: EmailStatusVerdict =
220
- status === 'valid'
221
- ? 'send'
222
- : status === 'valid_catch_all'
223
- ? 'send_with_caution'
224
- : status === 'catch_all'
225
- ? 'verify_next'
226
- : status === 'unknown'
227
- ? 'hold'
228
- : 'drop';
229
- const verdict = mapped?.verdict ?? defaultVerdict;
230
- const verified =
231
- mapped?.verified ??
232
- (status === 'valid' || status === 'valid_catch_all' || verdict === 'send');
233
- const reasons = [
234
- mapped?.reason,
235
- catchAll ? 'catch_all_domain' : null,
236
- mxClass(read(values, 'mxProvider'), read(values, 'mxRecord')) ===
237
- 'security_gateway'
238
- ? 'security_gateway_mx'
239
- : null,
240
- suspect ? 'provider_marked_suspect' : null,
241
- ].filter((reason): reason is string => typeof reason === 'string');
242
-
243
- return {
244
- verdict,
245
- status,
246
- verified,
247
- confidence: rawScore,
248
- reasons,
249
- signals: {
250
- catch_all: catchAll,
251
- deliverability: deliverability(read(values, 'deliverability')),
252
- mx_class: mxClass(read(values, 'mxProvider'), read(values, 'mxRecord')),
253
- mx_provider: stringish(read(values, 'mxProvider')),
254
- mx_record: stringish(read(values, 'mxRecord')),
255
- fraud_score: numberish(read(values, 'fraudScore')),
256
- disposable,
257
- role_based: boolish(read(values, 'roleBased')),
258
- free_email: boolish(read(values, 'freeEmail')),
259
- abuse,
260
- spamtrap,
261
- suspect,
262
- valid,
263
- },
264
- provider: {
265
- name: config.provider,
266
- raw_status:
267
- typeof rawStatus === 'string' ||
268
- typeof rawStatus === 'boolean' ||
269
- typeof rawStatus === 'number'
270
- ? rawStatus
271
- : null,
272
- raw_score: rawScore,
273
- },
274
- };
275
- }
1
+ export * from '../plays/email-status';
@@ -9,7 +9,7 @@ import type {
9
9
  WorkReceiptFailureKind,
10
10
  WorkReceiptGetCommand,
11
11
  } from './work-receipts';
12
- import type { ToolExecutionFailureV1 } from '../tool-execution-error';
12
+ import type { ToolExecutionFailureV1 } from '../plays/tool-execution-error';
13
13
 
14
14
  export type WorkReceiptBatchGetCommand = {
15
15
  playName: string;
@@ -1,106 +1 @@
1
- import type { EmailStatus } from './email-status';
2
-
3
- export const JOB_CHANGE_STATUS_VALUES = [
4
- 'moved',
5
- 'no_change',
6
- 'left_company',
7
- 'unknown',
8
- 'profile_unavailable',
9
- 'no_new_company',
10
- ] as const;
11
-
12
- export type JobChangeStatus = (typeof JOB_CHANGE_STATUS_VALUES)[number];
13
-
14
- export type JobChangeGetterValue = {
15
- status: JobChangeStatus;
16
- date: string | null;
17
- new_company: string | null;
18
- new_title: string | null;
19
- };
20
-
21
- export const PHONE_STATUS_VALUES = ['valid', 'invalid', 'unknown'] as const;
22
-
23
- export type PhoneStatus = (typeof PHONE_STATUS_VALUES)[number];
24
-
25
- export const DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS = {
26
- id: { identity: true, valueKind: 'string' },
27
- name: { identity: true, valueKind: 'string' },
28
- email: { identity: true, valueKind: 'string' },
29
- personal_email: { identity: true, valueKind: 'string' },
30
- phone: { identity: true, valueKind: 'string' },
31
- linkedin: { identity: true, valueKind: 'string' },
32
- linkedin_url: { identity: true, valueKind: 'string' },
33
- domain: { identity: true, valueKind: 'string' },
34
- website: { identity: true, valueKind: 'string' },
35
- first_name: { identity: true, valueKind: 'string' },
36
- last_name: { identity: true, valueKind: 'string' },
37
- full_name: { identity: true, valueKind: 'string' },
38
- company: { identity: true, valueKind: 'string' },
39
- company_name: { identity: true, valueKind: 'string' },
40
- organization_name: { identity: true, valueKind: 'string' },
41
- company_domain: { identity: true, valueKind: 'string' },
42
- company_website: { identity: true, valueKind: 'string' },
43
- company_linkedin_url: { identity: true, valueKind: 'string' },
44
- title: { identity: false, valueKind: 'string' },
45
- industry: { identity: false, valueKind: 'string' },
46
- status: { identity: false, valueKind: 'string' },
47
- job_change: { identity: false, valueKind: 'job_change' },
48
- job_change_status: {
49
- identity: false,
50
- valueKind: 'job_change_status',
51
- enum: JOB_CHANGE_STATUS_VALUES,
52
- },
53
- email_status: { identity: false, valueKind: 'email_status' },
54
- phone_status: {
55
- identity: false,
56
- valueKind: 'phone_status',
57
- enum: PHONE_STATUS_VALUES,
58
- },
59
- } as const;
60
-
61
- export type DeeplineExtractorTarget =
62
- keyof typeof DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS;
63
-
64
- export const DEEPLINE_EXTRACTOR_TARGETS = Object.keys(
65
- DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS,
66
- ) as DeeplineExtractorTarget[];
67
-
68
- export type DeeplineEmailStatusGetterValue = EmailStatus;
69
-
70
- export type DeeplineGetterValueMap = {
71
- id: string;
72
- name: string;
73
- email: string;
74
- personal_email: string;
75
- phone: string;
76
- linkedin: string;
77
- linkedin_url: string;
78
- domain: string;
79
- website: string;
80
- first_name: string;
81
- last_name: string;
82
- full_name: string;
83
- company: string;
84
- company_name: string;
85
- organization_name: string;
86
- company_domain: string;
87
- company_website: string;
88
- company_linkedin_url: string;
89
- title: string;
90
- industry: string;
91
- status: string;
92
- job_change: JobChangeGetterValue;
93
- job_change_status: JobChangeStatus;
94
- email_status: EmailStatus;
95
- phone_status: PhoneStatus;
96
- };
97
-
98
- export type DeeplineGetterValue<
99
- TTarget extends DeeplineExtractorTarget = DeeplineExtractorTarget,
100
- > = DeeplineGetterValueMap[TTarget];
101
-
102
- export function isDeeplineExtractorTarget(
103
- value: string,
104
- ): value is DeeplineExtractorTarget {
105
- return value in DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS;
106
- }
1
+ export * from '../plays/extractor-targets';
@@ -104,8 +104,7 @@ export class GatewayPostgresAdmission {
104
104
  #canGrant(lane: GatewayPostgresLane): boolean {
105
105
  if (this.#activeTotal() >= this.#maxTotalActive()) return false;
106
106
  return (
107
- lane === 'commit' ||
108
- this.#ordinaryActive < this.#maxOrdinaryActive()
107
+ lane === 'commit' || this.#ordinaryActive < this.#maxOrdinaryActive()
109
108
  );
110
109
  }
111
110
 
@@ -70,14 +70,21 @@ export class InMemoryRateStateBackend implements RateStateBackend {
70
70
  const state = this.getRuleState(bucketId, rule, now);
71
71
  this.resetExpiredWindow(state, rule.windowMs, now);
72
72
  if (state.startedInWindow >= rule.requestsPerWindow) {
73
- waitMs = Math.max(waitMs, state.windowStartedAt + rule.windowMs - now);
73
+ waitMs = Math.max(
74
+ waitMs,
75
+ state.windowStartedAt + rule.windowMs - now,
76
+ );
74
77
  }
75
- if (rule.maxConcurrency != null && state.activeCount >= rule.maxConcurrency) {
78
+ if (
79
+ rule.maxConcurrency != null &&
80
+ state.activeCount >= rule.maxConcurrency
81
+ ) {
76
82
  waitMs = Math.max(waitMs, MIN_CONCURRENCY_WAIT_MS);
77
83
  }
78
84
  }
79
85
 
80
- if (waitMs > 0) return { acquired: false, waitMs: Math.max(1, waitMs) } as const;
86
+ if (waitMs > 0)
87
+ return { acquired: false, waitMs: Math.max(1, waitMs) } as const;
81
88
 
82
89
  for (const rule of ordered) {
83
90
  const state = this.getRuleState(bucketId, rule, now);
@@ -99,7 +106,9 @@ export class InMemoryRateStateBackend implements RateStateBackend {
99
106
  void this.withLock(() => {
100
107
  for (const rule of ordered) {
101
108
  if (rule.maxConcurrency == null) continue;
102
- const state = this.ruleStates.get(this.key(bucketId, rule.ruleId));
109
+ const state = this.ruleStates.get(
110
+ this.key(bucketId, rule.ruleId),
111
+ );
103
112
  if (state && state.activeCount > 0) state.activeCount -= 1;
104
113
  }
105
114
  });
@@ -1,8 +1,4 @@
1
- export type PlayLiveEventSource =
2
- | 'worker'
3
- | 'convex'
4
- | 'play'
5
- | 'system';
1
+ export type PlayLiveEventSource = 'worker' | 'convex' | 'play' | 'system';
6
2
  export type PlayRunTimelineEventType =
7
3
  | 'play.run.status'
8
4
  | 'play.run.snapshot'
@@ -1,9 +1,8 @@
1
1
  import {
2
2
  derivePlayRowIdentity,
3
3
  derivePlayRowIdentityFromKey,
4
- // Relative (not '@shared_libs/...') because this file ships inside the
5
- // packed SDK's dist/bundling-sources graph (reachable from the
6
- // packaged runner entry), where only relative imports resolve.
4
+ // The SDK pack adapter rewrites this workspace import to the preserved
5
+ // relative dist/bundling-sources layout.
7
6
  } from '../plays/row-identity';
8
7
  import type { MapExecutionScope } from './ctx-types';
9
8
 
@@ -39,7 +39,8 @@ export function mapRowOutcomeRuntimeFields(input: {
39
39
  }): Record<string, unknown> {
40
40
  return {
41
41
  [MAP_ROW_OUTCOME_RUNTIME_FIELDS.rowKey]: input.key,
42
- ...(typeof input.inputIndex === 'number' && Number.isFinite(input.inputIndex)
42
+ ...(typeof input.inputIndex === 'number' &&
43
+ Number.isFinite(input.inputIndex)
43
44
  ? { [MAP_ROW_OUTCOME_RUNTIME_FIELDS.inputIndex]: input.inputIndex }
44
45
  : {}),
45
46
  ...(input.cellMetaPatch
@@ -4,7 +4,7 @@ import {
4
4
  STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS,
5
5
  validatePlaySandboxRuntimeLimits,
6
6
  type PlaySandboxRuntimeLimits,
7
- } from './sandbox-runtime-limits';
7
+ } from '../plays/sandbox-runtime-limits';
8
8
 
9
9
  export const MODAL_RUNNER_APP_NAME = 'deepline-play-runner';
10
10
  export const MODAL_RUNNER_IMAGE = 'node:20-bookworm-slim';
@@ -1,7 +1,7 @@
1
1
  import type {
2
2
  ToolExecutionErrorCategory,
3
3
  ToolExecutionErrorOrigin,
4
- } from '../tool-execution-error';
4
+ } from '../plays/tool-execution-error';
5
5
 
6
6
  /**
7
7
  * The durable terminal envelope carries the complete 5 MiB authored return
@@ -14,13 +14,13 @@
14
14
  // See docs/extractor-projection-unification.md and CONTEXT.md ("Provider Email
15
15
  // Status Contract").
16
16
 
17
- import { buildEmailStatus } from './email-status';
18
- import type { EmailStatusExtractorConfig } from './email-status';
17
+ import { buildEmailStatus } from '../plays/email-status';
18
+ import type { EmailStatusExtractorConfig } from '../plays/email-status';
19
19
  import {
20
20
  JOB_CHANGE_STATUS_VALUES,
21
21
  type JobChangeGetterValue,
22
22
  type JobChangeStatus,
23
- } from './extractor-targets';
23
+ } from '../plays/extractor-targets';
24
24
 
25
25
  /** A located value (value + the concrete path it came from), or null on miss. */
26
26
  export type ProjectionHit = { value: unknown; path: string } | null;
@@ -130,12 +130,12 @@ function normalizeJobChange(value: unknown): JobChangeGetterValue {
130
130
  return {
131
131
  status,
132
132
  date: moved
133
- ? normalizeString(
133
+ ? (normalizeString(
134
134
  output.date ??
135
135
  output.job_change_date ??
136
136
  output.change_date ??
137
137
  output.changed_at,
138
- ) ?? firstExperienceDate(person.experiences)
138
+ ) ?? firstExperienceDate(person.experiences))
139
139
  : null,
140
140
  new_company: moved
141
141
  ? normalizeString(
@@ -11,11 +11,11 @@ import type { PlayLiveEventSource } from './live-events';
11
11
  import type { PreloadedRuntimeDbSession } from './db-session';
12
12
  import type { PacingRule } from './governor/rate-state-backend';
13
13
  import type { GovernanceSnapshot } from './governor/governor';
14
- import type { PlaySandboxRuntimeLimits } from './sandbox-runtime-limits';
14
+ import type { PlaySandboxRuntimeLimits } from '../plays/sandbox-runtime-limits';
15
15
  import type { PlayRunInputPayload } from './play-input';
16
16
  import type { PlayRunFailureDetails } from './run-failure';
17
- import type { ToolExecutionErrorSchemaVersion } from '../tool-execution-error';
18
- import type { ToolResponseContract } from './tool-response-contract';
17
+ import type { ToolExecutionErrorSchemaVersion } from '../plays/tool-execution-error';
18
+ import type { ToolResponseContract } from '../plays/tool-response-contract';
19
19
  import type { FixtureBehavior } from './fixture-behavior';
20
20
 
21
21
  export type PlayRunnerRateStateBackendConfig =
@@ -2,7 +2,7 @@ import {
2
2
  ToolExecutionError,
3
3
  type ToolExecutionErrorCategory,
4
4
  type ToolExecutionErrorOrigin,
5
- } from '../tool-execution-error';
5
+ } from '../plays/tool-execution-error';
6
6
 
7
7
  const CLOUDFLARE_DURABLE_OBJECT_RESET_RE =
8
8
  /Durable Object.*(?:code (?:was|has been) updated|storage caused object)/;
@@ -29,7 +29,7 @@ import {
29
29
  * the live snapshot shape, plus the differ that turns successive snapshots
30
30
  * into incremental `play.*` live events. This module is shared between the
31
31
  * Vercel app (legacy SSE shim, dashboard) and the SDK subscription transport
32
- * (`sdk/src/runs/observe-transport.ts`), so both watchers render identical
32
+ * (`packages/sdk/src/runs/observe-transport.ts`), so both watchers render identical
33
33
  * event streams from the same Convex Run Snapshot. See ADR-0008.
34
34
  */
35
35