deepline 0.2.53 → 0.2.55
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.
- package/dist/bundling-sources/sdk/src/client.ts +17 -1
- package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +1 -1
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +43 -1
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +30 -1
- package/dist/bundling-sources/shared_libs/play-runtime/cell-provenance.ts +231 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +1094 -128
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +178 -9
- package/dist/bundling-sources/shared_libs/play-runtime/docflow-node-io.ts +634 -0
- package/dist/bundling-sources/shared_libs/play-runtime/docflow-observation.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-runtime/dynamic-worker-version.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/live-state-contract.ts +33 -0
- package/dist/bundling-sources/shared_libs/play-runtime/log-provenance.ts +251 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-node-scope.ts +160 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +27 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +43 -5
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts +26 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +83 -0
- package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +3 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +49 -1
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +375 -29
- package/dist/bundling-sources/shared_libs/plays/docflow-binding-owner.ts +636 -0
- package/dist/bundling-sources/shared_libs/plays/docflow-binding.ts +598 -0
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +1645 -0
- package/dist/bundling-sources/shared_libs/plays/play-exports.ts +202 -0
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +16 -1
- package/dist/bundling-sources/shared_libs/plays/ts-ast.ts +48 -0
- package/dist/cli/index.js +994 -312
- package/dist/cli/index.mjs +994 -312
- package/dist/{compiler-manifest-Cj3--4ZJ.d.mts → compiler-manifest-Bl8kmLx9.d.mts} +118 -0
- package/dist/{compiler-manifest-Cj3--4ZJ.d.ts → compiler-manifest-Bl8kmLx9.d.ts} +118 -0
- package/dist/index.d.mts +47 -2
- package/dist/index.d.ts +47 -2
- package/dist/index.js +419 -59
- package/dist/index.mjs +419 -59
- package/dist/install-integrity.json +12 -2
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/dist/plays/bundle-play-file.mjs +1361 -45
- package/package.json +1 -1
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
// Core types for PlayContext.
|
|
2
|
+
import type {
|
|
3
|
+
PlayCellReadRef,
|
|
4
|
+
PlayCellDecision,
|
|
5
|
+
PlayDatasetBornFrom,
|
|
6
|
+
PlayRowMeta,
|
|
7
|
+
} from './cell-provenance';
|
|
2
8
|
import type { PlayBundleArtifact } from '../plays/artifact-types';
|
|
3
9
|
import type { PlayRunContractSnapshot } from '../plays/contracts';
|
|
4
10
|
import type { PlayStructuredDefinition } from '../plays/definition';
|
|
@@ -29,6 +35,7 @@ import type {
|
|
|
29
35
|
PlayExecutionGovernor,
|
|
30
36
|
} from './governor/governor';
|
|
31
37
|
import type { BudgetStateBackend } from './governor/budget-state-backend';
|
|
38
|
+
import type { DocflowObservationUpsert } from './docflow-observation';
|
|
32
39
|
import type { RuntimeMapMemoryLimits } from './map-memory-limits';
|
|
33
40
|
import type { AnyBatchOperationStrategy } from './batching-types';
|
|
34
41
|
import type { ToolResultMetadataInput } from './tool-result';
|
|
@@ -37,6 +44,7 @@ import type { MapRowOutcome } from './durability-store';
|
|
|
37
44
|
import type { WorkReceiptFailureKind } from './work-receipts';
|
|
38
45
|
import type { RunExecutionScope } from './run-execution-scope';
|
|
39
46
|
import type { PlayCallExecution } from './play-call-execution';
|
|
47
|
+
import type { PlayDocflowNodeIoPreviewMap } from './docflow-node-io';
|
|
40
48
|
import type { PlayActivityEvent } from './activity-observation';
|
|
41
49
|
import type {
|
|
42
50
|
ToolExecutionErrorSchemaVersion,
|
|
@@ -61,6 +69,8 @@ export interface ToolCallRequest {
|
|
|
61
69
|
requiresExecutionFence?: boolean;
|
|
62
70
|
rowId: number;
|
|
63
71
|
fieldName?: string;
|
|
72
|
+
/** The author-supplied `ctx.tools.execute(<id>, ...)` key (ADR 0018). */
|
|
73
|
+
contextKey?: string;
|
|
64
74
|
toolId: string;
|
|
65
75
|
input: Record<string, unknown>;
|
|
66
76
|
timeoutMs?: number;
|
|
@@ -276,6 +286,17 @@ export interface RuntimeDatasetOptions<TItem = Record<string, unknown>> {
|
|
|
276
286
|
* ordinary CSV enrichment reruns.
|
|
277
287
|
*/
|
|
278
288
|
mode?: 'upsert' | 'net_new';
|
|
289
|
+
/**
|
|
290
|
+
* Columns this dataset computes that the authored `@mermaid` diagram
|
|
291
|
+
* deliberately does not draw.
|
|
292
|
+
*
|
|
293
|
+
* A Play that authors a diagram must account for every column it computes:
|
|
294
|
+
* draw the column inside the dataset's `subgraph` loop region, or name it
|
|
295
|
+
* here. `plays check` fails otherwise, and it echoes these names back so an
|
|
296
|
+
* opt-out is always visible. Purely a documentation contract — it changes no
|
|
297
|
+
* execution behavior.
|
|
298
|
+
*/
|
|
299
|
+
undrawnColumns?: readonly string[];
|
|
279
300
|
}
|
|
280
301
|
|
|
281
302
|
export type RuntimeDatasetDefinitionOptions<TItem = Record<string, unknown>> =
|
|
@@ -283,7 +304,7 @@ export type RuntimeDatasetDefinitionOptions<TItem = Record<string, unknown>> =
|
|
|
283
304
|
|
|
284
305
|
export type RuntimeDatasetRunOptions<TItem = Record<string, unknown>> = Pick<
|
|
285
306
|
RuntimeDatasetOptions<TItem>,
|
|
286
|
-
'description' | 'key' | 'onRowError' | 'mode'
|
|
307
|
+
'description' | 'key' | 'onRowError' | 'mode' | 'undrawnColumns'
|
|
287
308
|
>;
|
|
288
309
|
|
|
289
310
|
export type ToolCallOptions = PlayToolCallOptions;
|
|
@@ -360,6 +381,64 @@ export interface MapExecutionScope {
|
|
|
360
381
|
|
|
361
382
|
export type PlayExecutionEvent =
|
|
362
383
|
| PlayActivityEvent
|
|
384
|
+
| {
|
|
385
|
+
type: 'docflow.node.hit';
|
|
386
|
+
nodeId: string;
|
|
387
|
+
at: number;
|
|
388
|
+
}
|
|
389
|
+
| {
|
|
390
|
+
type: 'docflow.node.started';
|
|
391
|
+
nodeId: string;
|
|
392
|
+
attempt: number;
|
|
393
|
+
invocationId: string;
|
|
394
|
+
inputs: PlayDocflowNodeIoPreviewMap;
|
|
395
|
+
inputsTruncated?: boolean;
|
|
396
|
+
at: number;
|
|
397
|
+
}
|
|
398
|
+
| {
|
|
399
|
+
type: 'docflow.node.completed';
|
|
400
|
+
nodeId: string;
|
|
401
|
+
attempt: number;
|
|
402
|
+
invocationId: string;
|
|
403
|
+
inputs: PlayDocflowNodeIoPreviewMap;
|
|
404
|
+
inputsTruncated?: boolean;
|
|
405
|
+
outputs: PlayDocflowNodeIoPreviewMap;
|
|
406
|
+
outputsTruncated?: boolean;
|
|
407
|
+
at: number;
|
|
408
|
+
}
|
|
409
|
+
| {
|
|
410
|
+
type: 'docflow.node.failed';
|
|
411
|
+
nodeId: string;
|
|
412
|
+
attempt: number;
|
|
413
|
+
invocationId: string;
|
|
414
|
+
inputs: PlayDocflowNodeIoPreviewMap;
|
|
415
|
+
inputsTruncated?: boolean;
|
|
416
|
+
error: string;
|
|
417
|
+
at: number;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Explicit tool-node lifecycle (ADR 0018). Emitted only for tool calls that
|
|
421
|
+
* are NOT row-scoped, i.e. the same call sites that used to be inferred by
|
|
422
|
+
* matching `Calling tool: <id>` against runner stdout. Row-scoped calls stay
|
|
423
|
+
* out of the ledger on purpose (ADR 0001 forbids row-heavy Run Events); their
|
|
424
|
+
* attribution is the Runtime Sheet `_cell_meta.producers` trace plus the
|
|
425
|
+
* node-scoped usage events.
|
|
426
|
+
*/
|
|
427
|
+
| {
|
|
428
|
+
type: 'tool.call.started';
|
|
429
|
+
toolId: string;
|
|
430
|
+
callKey?: string | null;
|
|
431
|
+
at: number;
|
|
432
|
+
}
|
|
433
|
+
| {
|
|
434
|
+
type: 'tool.call.settled';
|
|
435
|
+
toolId: string;
|
|
436
|
+
callKey?: string | null;
|
|
437
|
+
outcome: 'completed' | 'no_result' | 'failed' | 'cached';
|
|
438
|
+
durationMs?: number | null;
|
|
439
|
+
error?: string | null;
|
|
440
|
+
at: number;
|
|
441
|
+
}
|
|
363
442
|
| {
|
|
364
443
|
type: 'dataset.lifecycle';
|
|
365
444
|
datasetId: string;
|
|
@@ -370,6 +449,13 @@ export type PlayExecutionEvent =
|
|
|
370
449
|
succeededRows?: number;
|
|
371
450
|
failedRows?: number;
|
|
372
451
|
complete?: boolean;
|
|
452
|
+
/**
|
|
453
|
+
* Dataset-grain row birth (ADR 0019). Rows entered this dataset from
|
|
454
|
+
* play-body code, so the runtime witnessed how many rows arrived at which
|
|
455
|
+
* step but no per-row source mapping. Stated once per dataset here rather
|
|
456
|
+
* than repeated — or invented — per row.
|
|
457
|
+
*/
|
|
458
|
+
bornFrom?: PlayDatasetBornFrom;
|
|
373
459
|
at: number;
|
|
374
460
|
}
|
|
375
461
|
| {
|
|
@@ -513,6 +599,12 @@ export interface ContextOptions {
|
|
|
513
599
|
vercelProtectionBypassToken?: string | null;
|
|
514
600
|
/** Optional per-run integration execution mode for provider calls. */
|
|
515
601
|
integrationMode?: 'live' | 'eval_stub' | 'fixture';
|
|
602
|
+
/**
|
|
603
|
+
* Docflow rollout answer for this run, decided at admission (see
|
|
604
|
+
* `RuntimeAuthorityDescriptor.docflowEnabled`). Absent means OFF, so a run
|
|
605
|
+
* whose launch predates the field captures exactly what it captured before.
|
|
606
|
+
*/
|
|
607
|
+
docflowEnabled?: boolean;
|
|
516
608
|
/** Internal fixture-only simulation of provider response residence. */
|
|
517
609
|
fixtureBehavior?: FixtureBehavior | null;
|
|
518
610
|
/** Preview/dev test seam that applies provider pacing to fixture responses. */
|
|
@@ -558,6 +650,18 @@ export interface ContextOptions {
|
|
|
558
650
|
onRowUpdate?: (update: PlayRowUpdate) => void | Promise<void>;
|
|
559
651
|
/** Structured execution events emitted from explicit dataset scopes. */
|
|
560
652
|
onExecutionEvent?: (event: PlayExecutionEvent) => void | Promise<void>;
|
|
653
|
+
/**
|
|
654
|
+
* Durable docflow observation sink (ADR 0016 rule 2). Present ONLY for
|
|
655
|
+
* instrumented (diagrammed) plays: the compiler injects the observation
|
|
656
|
+
* wrapper only when an `@mermaid` block exists, and the runtime wires this
|
|
657
|
+
* sink to the receipt gateway's `observe` action. The wrapper posts to it
|
|
658
|
+
* fire-and-forget alongside the live event emission — it must NEVER fail or
|
|
659
|
+
* slow the play body. Absent means observations are not persisted (the live
|
|
660
|
+
* `onExecutionEvent` stream is unchanged either way).
|
|
661
|
+
*/
|
|
662
|
+
onDocflowObservation?: (
|
|
663
|
+
observation: DocflowObservationUpsert,
|
|
664
|
+
) => void | Promise<void>;
|
|
561
665
|
/**
|
|
562
666
|
* Called when ctx.dataset() starts — inserts items into the sheet and returns
|
|
563
667
|
* the pending/completed split. If not provided, all items are processed.
|
|
@@ -1036,6 +1140,45 @@ export type PlayStepRowResult = PlayStepRowResultFields &
|
|
|
1036
1140
|
| { status: 'failed' | 'missed' | 'skipped'; success: false }
|
|
1037
1141
|
);
|
|
1038
1142
|
|
|
1143
|
+
/** The producer credited with a cell's kept value. */
|
|
1144
|
+
export interface PlaySheetCellProducer {
|
|
1145
|
+
kind: 'play' | 'tool' | 'code';
|
|
1146
|
+
id?: string | null;
|
|
1147
|
+
displayName?: string | null;
|
|
1148
|
+
playId?: string | null;
|
|
1149
|
+
toolId?: string | null;
|
|
1150
|
+
runId?: string | null;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* One attempted producer for a runtime sheet cell (ADR 0018).
|
|
1155
|
+
*
|
|
1156
|
+
* `durationMs` is the wall time of the logical invocation as observed by the
|
|
1157
|
+
* runtime: it includes batching/queue wait, so summing it across a node is an
|
|
1158
|
+
* upper bound on provider time, not a wall-clock span for the node.
|
|
1159
|
+
*/
|
|
1160
|
+
export interface PlayCellProducerAttempt {
|
|
1161
|
+
kind: 'play' | 'tool' | 'code';
|
|
1162
|
+
id?: string | null;
|
|
1163
|
+
toolId?: string | null;
|
|
1164
|
+
displayName?: string | null;
|
|
1165
|
+
/** Attempt start, epoch ms. */
|
|
1166
|
+
at: number;
|
|
1167
|
+
outcome: 'running' | 'completed' | 'no_result' | 'failed' | 'cached';
|
|
1168
|
+
durationMs?: number | null;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
/** Cell-level provenance shapes (ADR 0019). Defined in `cell-provenance`. */
|
|
1172
|
+
export type {
|
|
1173
|
+
PlayCellReadRef,
|
|
1174
|
+
PlayCellDecision,
|
|
1175
|
+
PlayRowBornFrom,
|
|
1176
|
+
PlayRowBornFromRow,
|
|
1177
|
+
PlayDatasetBornFrom,
|
|
1178
|
+
PlayRowReadOrder,
|
|
1179
|
+
PlayRowMeta,
|
|
1180
|
+
} from './cell-provenance';
|
|
1181
|
+
|
|
1039
1182
|
export interface PlayRowUpdate {
|
|
1040
1183
|
key: string;
|
|
1041
1184
|
rowId: number;
|
|
@@ -1050,6 +1193,12 @@ export interface PlayRowUpdate {
|
|
|
1050
1193
|
provider?: string | null;
|
|
1051
1194
|
error?: string | null;
|
|
1052
1195
|
dataPatch?: Record<string, unknown>;
|
|
1196
|
+
/**
|
|
1197
|
+
* Row-grain provenance (ADR 0019), stored under the reserved `_cell_meta._row`
|
|
1198
|
+
* key. It is a separate field rather than a `cellMetaPatch` entry because it
|
|
1199
|
+
* is not a cell: it has no status, no producer, and no lifecycle.
|
|
1200
|
+
*/
|
|
1201
|
+
rowMetaPatch?: PlayRowMeta;
|
|
1053
1202
|
cellMetaPatch?: Record<
|
|
1054
1203
|
string,
|
|
1055
1204
|
{
|
|
@@ -1061,17 +1210,37 @@ export interface PlayRowUpdate {
|
|
|
1061
1210
|
| 'cached'
|
|
1062
1211
|
| 'missed'
|
|
1063
1212
|
| 'skipped';
|
|
1213
|
+
/**
|
|
1214
|
+
* Run that produced this cell. Stamped at the emit site so a run-scoped
|
|
1215
|
+
* read never has to infer ownership from the row's current `_run_id`,
|
|
1216
|
+
* which a later run overwrites (ADR 0018).
|
|
1217
|
+
*/
|
|
1218
|
+
runId?: string;
|
|
1064
1219
|
stage?: string | null;
|
|
1065
1220
|
provider?: string | null;
|
|
1066
1221
|
error?: string | null;
|
|
1067
|
-
producer?:
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1222
|
+
producer?: PlaySheetCellProducer | null;
|
|
1223
|
+
/**
|
|
1224
|
+
* Every producer attempted for this cell during the run, oldest first.
|
|
1225
|
+
* `producer` is patch-merged and therefore only ever holds the last leg;
|
|
1226
|
+
* a waterfall's losing legs exist nowhere else (a failed tool call writes
|
|
1227
|
+
* no durable receipt). See ADR 0018.
|
|
1228
|
+
*/
|
|
1229
|
+
producers?: PlayCellProducerAttempt[] | null;
|
|
1230
|
+
/**
|
|
1231
|
+
* Attempts the per-cell cap dropped (ADR 0018/0019). Present only when
|
|
1232
|
+
* the trace is a floor, so a capped cell cannot read as a complete count.
|
|
1233
|
+
*/
|
|
1234
|
+
attemptsDropped?: number;
|
|
1235
|
+
/**
|
|
1236
|
+
* Explicit per-cell read trace (ADR 0019). Only nested step-program cells
|
|
1237
|
+
* carry one, because their read-set includes sibling steps that the row's
|
|
1238
|
+
* column order does not describe. Dataset columns resolve their reads
|
|
1239
|
+
* through `_cell_meta._row.reads` instead of repeating a list per cell.
|
|
1240
|
+
*/
|
|
1241
|
+
reads?: PlayCellReadRef[] | null;
|
|
1242
|
+
/** Branch selected by a per-row conditional for this cell (ADR 0019). */
|
|
1243
|
+
decide?: PlayCellDecision | null;
|
|
1075
1244
|
reused?: boolean;
|
|
1076
1245
|
completedAt?: number;
|
|
1077
1246
|
staleAt?: number | null;
|