@sanity/workflow-engine 0.34.0 → 0.35.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @sanity/workflow-engine
2
2
 
3
+ ## 0.35.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7e24e4a: **BREAKING:** Every engine telemetry event payload now carries the engine's own view of its caller as two fields, `executionRuntime` and `executionKind`, and every event's `version` moves from `1` to `2`. Anything that pins an engine event version, or that constructs an engine event payload by hand to emit through its own `@sanity/telemetry` logger, breaks until it is updated: the payload types now require `executionRuntime`. `definitionDeployedData` returns the structural half of the deploy payload rather than the whole payload — its result no longer satisfies `WorkflowDefinitionDeployedData`, and the emit site supplies the stamp separately.
8
+
9
+ `executionRuntime` is the runtime the engine infers for itself (`browser`, `node`, `worker`, `edge`, `deno`, `bun`, `unknown`) and matches the `executionContext.runtime` the same operation stamps on its history entries. The declared `id` is never reported.
10
+
11
+ `executionKind` answers where the operation came from, which is narrower than the vocabulary a host can declare. `studio`, `sdk`, `cli`, `mcp`, and `server` report themselves. `drainer` reports `server`, because a drain runtime is a server host and that it is draining is what its own events say. `interactive`, `script`, and `test` name a role rather than a host and report `other`, as does any value outside the vocabulary. The field is absent when the host declared no kind. The exported `ReportedExecutionKind` type is that closed set, so the reported vocabulary is visible in the type rather than only in prose.
12
+
13
+ `EXECUTION_KINDS.sdkApp` now carries the value `sdk` rather than `sdk-app`, so one spelling names the App SDK across the whole Workflows event family — the engine's `executionKind`, the session event's `host`, and the shell's `surface` user property. A host that declared `sdk-app` as a literal rather than through `EXECUTION_KINDS` should switch to the constant; nothing Sanity ships ever set the old value, so no stored history carries it.
14
+
15
+ Emitting the fields is not the same as being able to query them. Analytics ingestion maps event payload keys to a fixed set of columns, so caller-based breakdowns stay unavailable until `data_execution_runtime` and `data_execution_kind` exist downstream; upgrade for the emission, and expect the analytics read to follow separately.
16
+
17
+ Hosts that pass `executionContext` to `createEngine` need no action, with one exception: a host that declared the App SDK kind as the literal `sdk-app` rather than through `EXECUTION_KINDS` now falls outside the vocabulary and reports `other`, so it should switch to the constant or to `sdk`. Every other declared kind is reported under the projection described above. A host that declares nothing emits a runtime with no kind, so declare `executionContext: {kind, id}` at `createEngine` to make its activity distinguishable in analytics. Anyone matching on event versions or hand-building payloads must update to version `2` and set the two fields themselves.
18
+
19
+ One projection is currently unexercised: the Blueprint-generated function shells declare their execution context but pass no telemetry logger, so nothing emits from the server tier and no `server` row exists yet.
20
+
21
+ **Docs impact:** Update the telemetry reference for all 13 engine events to list the two payload fields and their version `2`, and give `ReportedExecutionKind` its own entry naming each reported value and what declares it. Document the `DerivedEventData` return type that the payload builders now return. In the engine host guidance, say that declaring `executionContext` at `createEngine` is what makes a host's events attributable, and that the reference docs currently describe that field only as a history stamp. Release guidance should carry the version bump and the hand-built-payload migration.
22
+
23
+ ### Patch Changes
24
+
25
+ - ab8754a: `deployDefinitions` now derives the reader model its submitted definitions require through one named engine function that parses each definition and measures the parsed shape, rather than inlining that sequence at the call site. Anything that needs to predict the deploy's acknowledgement verdict offline derives the floor through the same function, so an offline check and the deploy cannot reach different answers. The verdict itself is unchanged: the same definitions produce the same required floor and the same `ReaderModelAcknowledgementError`.
26
+
27
+ The data-model change rules also now state that raising any feature's reader floor raises every deployment acknowledgement whose definitions then require the higher floor, in the same change, and that a floor raised without moving those `expectedMinReaderModel` literals fails the affected definition deploys until it is. A deployment whose definitions still require less keeps its literal. The rule names the confirmation step it depends on: the runtimes sharing each workflow resource must read the new model first.
28
+
29
+ **No upgrade action required.** No engine behavior, persisted shape, or supported API changes; `DATA_MODEL_VERSION` stays at 10 and no feature floor moves. The package entry point gains one `@internal` export carrying that shared derivation, which is unsupported outside the Workflows packages and is omitted from the generated reference. Anyone maintaining their own `sanity.workflow.ts` deployments can read the rule as the sequence to follow when a Workflows upgrade raises a floor their definitions require.
30
+
31
+ **Docs impact:** The reader-floor rollout guide (`docs/reader-model-rollout.md`) carries the matching step, including how a config-declared acknowledgement is proven offline against the deploy's own derivation and why an acknowledgement passed directly to `deployDefinitions` is not; mirror that rollout sequence wherever published prerelease guidance describes `expectedMinReaderModel`.
32
+
3
33
  ## 0.34.0
4
34
 
5
35
  ## 0.33.0
package/DATAMODEL.md CHANGED
@@ -288,6 +288,19 @@ retained model-4 baseline.
288
288
  ledger instead of opening a new number, so one release carries one model.
289
289
  Reworking a ledger that has not shipped is the one exception to
290
290
  append-only; once a model is released its entry and ledger are frozen.
291
+ 10. **Raising any feature's reader floor raises every acknowledgement whose
292
+ definitions now require it, in the same change.** Each app under `apps/*` that deploys
293
+ definitions submits them with a reviewed `expectedMinReaderModel` literal,
294
+ so a feature whose floor those definitions now require breaks that app's
295
+ definition deploy until the literal moves with it. Raise every affected
296
+ literal in the same pull request, after confirming the runtimes sharing
297
+ that workflow resource read the new model. `pnpm test` proves it for every
298
+ app that declares its deployments in a `sanity.workflow.ts`: each runs an
299
+ offline guard deriving the required floor over its own definitions and
300
+ fails when its literal is below it. A script passing an acknowledgement
301
+ directly to `deployDefinitions` follows the same rule with no guard
302
+ covering it. The rollout order and the guard's wiring are in
303
+ `docs/reader-model-rollout.md`.
291
304
 
292
305
  ## Model log
293
306
 
@@ -81,11 +81,433 @@ function rethrowWithContext(err, context) {
81
81
  });
82
82
  }
83
83
 
84
+ const WORKFLOW_INSTANCE_TYPE = "sanity.workflow.instance";
85
+
86
+ function terminalState(instance) {
87
+ return instance.abortedAt !== void 0 ? "aborted" : instance.completedAt !== void 0 ? "completed" : "in-flight";
88
+ }
89
+
90
+ function isUnprimed(instance) {
91
+ return instance.stages.length === 0 && terminalState(instance) === "in-flight";
92
+ }
93
+
94
+ function parseDefinitionSnapshotValue(instance) {
95
+ try {
96
+ return normalizeLegacyActivityRequirements(JSON.parse(instance.definitionSnapshot));
97
+ } catch (err) {
98
+ rethrowWithContext(err, `Failed to parse definitionSnapshot on instance "${instance._id}"`);
99
+ }
100
+ }
101
+
102
+ function normalizeLegacyActivityRequirements(value) {
103
+ for (const stage of arrayMember(value, "stages")) for (const activity of arrayMember(stage, "activities")) normalizeLegacyRequirementMap(activity);
104
+ return value;
105
+ }
106
+
107
+ function arrayMember(value, key) {
108
+ if (typeof value != "object" || value === null) return [];
109
+ const member = value[key];
110
+ return Array.isArray(member) ? member : [];
111
+ }
112
+
113
+ function normalizeLegacyRequirementMap(value) {
114
+ if (typeof value != "object" || value === null) return;
115
+ const activity = value, requirements = activity.requirements;
116
+ typeof requirements != "object" || requirements === null || Array.isArray(requirements) || (activity.requirements = Object.entries(requirements).map(([name, query]) => ({
117
+ type: "groq",
118
+ name: name,
119
+ query: query
120
+ })));
121
+ }
122
+
123
+ function parseDefinitionSnapshot(instance) {
124
+ return parseDefinitionSnapshotValue(instance);
125
+ }
126
+
127
+ function parentRef(instance) {
128
+ return instance.ancestors.at(-1);
129
+ }
130
+
84
131
  function andConditions(parts) {
85
132
  const present = parts.filter(p => p !== void 0);
86
133
  if (present.length !== 0) return present.length === 1 ? present[0] : present.map(p => `(${p})`).join(" && ");
87
134
  }
88
135
 
136
+ function effectiveEditable(baseline, override) {
137
+ if (baseline === void 0) return;
138
+ if (override === void 0) return baseline;
139
+ if (baseline === !0 && override === !0) return !0;
140
+ const parts = [ baseline, override ].map(e => e === !0 ? void 0 : e);
141
+ return andConditions(parts) ?? !0;
142
+ }
143
+
144
+ const DEFAULT_EDIT_MODE = "set";
145
+
146
+ function _fieldTargetLabel(target) {
147
+ return [ target.scope, target.activity, target.field ].filter(Boolean).join(".");
148
+ }
149
+
150
+ function fieldSites(definition, stage) {
151
+ const sites = [];
152
+ for (const entry of definition.fields ?? []) sites.push({
153
+ scope: "workflow",
154
+ entry: entry
155
+ });
156
+ for (const entry of stage.fields ?? []) sites.push({
157
+ scope: "stage",
158
+ entry: entry
159
+ });
160
+ for (const activity of stage.activities ?? []) for (const entry of activity.fields ?? []) sites.push({
161
+ scope: "activity",
162
+ activity: activity.name,
163
+ entry: entry
164
+ });
165
+ return sites;
166
+ }
167
+
168
+ function resolveFieldSite(site, stage) {
169
+ return {
170
+ scope: site.scope,
171
+ ...site.activity !== void 0 ? {
172
+ activity: site.activity
173
+ } : {},
174
+ name: site.entry.name,
175
+ type: site.entry.type,
176
+ ...site.entry.title !== void 0 ? {
177
+ title: site.entry.title
178
+ } : {},
179
+ ...site.entry.validation !== void 0 ? {
180
+ validation: site.entry.validation
181
+ } : {},
182
+ ...site.entry.roles !== void 0 ? {
183
+ roles: site.entry.roles
184
+ } : {},
185
+ ref: {
186
+ scope: site.scope,
187
+ field: site.entry.name
188
+ },
189
+ effective: effectiveEditable(site.entry.editable, stage.editable?.[site.entry.name])
190
+ };
191
+ }
192
+
193
+ function editableFieldsInStage(definition, stage) {
194
+ return fieldSites(definition, stage).filter(site => site.entry.editable !== void 0).map(site => resolveFieldSite(site, stage));
195
+ }
196
+
197
+ function editTargetMatches(site, target) {
198
+ return site.name !== target.field ? !1 : target.activity !== void 0 ? site.scope === "activity" && site.activity === target.activity : target.scope !== void 0 ? site.scope === target.scope : !0;
199
+ }
200
+
201
+ const SCOPE_PRECEDENCE = {
202
+ activity: 0,
203
+ stage: 1,
204
+ workflow: 2
205
+ };
206
+
207
+ function resolveEditTarget(args) {
208
+ const {definition: definition, stage: stage, target: target} = args, found = fieldSites(definition, stage).filter(site => editTargetMatches({
209
+ scope: site.scope,
210
+ name: site.entry.name,
211
+ ...site.activity !== void 0 ? {
212
+ activity: site.activity
213
+ } : {}
214
+ }, target)).sort((a, b) => SCOPE_PRECEDENCE[a.scope] - SCOPE_PRECEDENCE[b.scope])[0];
215
+ return found ? resolveFieldSite(found, stage) : void 0;
216
+ }
217
+
218
+ function fieldWindowOpen(instance, site) {
219
+ const terminal = terminalState(instance);
220
+ if (terminal !== "in-flight") return {
221
+ open: !1,
222
+ detail: `instance ${terminal}`
223
+ };
224
+ if (site.scope !== "activity") return {
225
+ open: !0
226
+ };
227
+ const status = findCurrentActivityEntry(instance, site.activity)?.status;
228
+ return status === "active" ? {
229
+ open: !0
230
+ } : {
231
+ open: !1,
232
+ detail: `activity "${site.activity}" is ${status ?? "not active"}`
233
+ };
234
+ }
235
+
236
+ function readFieldValue(instance, site) {
237
+ return resolveFieldEntry(instance, site)?.value;
238
+ }
239
+
240
+ function resolveFieldEntry(instance, site) {
241
+ return fieldEntryHost(instance, site)?.find(e => e.name === site.name);
242
+ }
243
+
244
+ function fieldEntryHost(instance, site) {
245
+ if (site.scope === "workflow") return instance.fields;
246
+ const stageEntry = findOpenStageEntry(instance);
247
+ return site.scope === "stage" ? stageEntry?.fields : stageEntry?.activities.find(t => t.name === site.activity)?.fields;
248
+ }
249
+
250
+ function fieldProvenance(instance, ref) {
251
+ let latest;
252
+ for (const entry of instance.history) entry._type === "opApplied" && (entry.target?.scope !== ref.scope || entry.target.field !== ref.field || (latest = {
253
+ at: entry.at,
254
+ ...entry.actor !== void 0 ? {
255
+ actor: entry.actor
256
+ } : {}
257
+ }));
258
+ return latest === void 0 ? {} : {
259
+ ...latest.actor !== void 0 ? {
260
+ setBy: latest.actor
261
+ } : {},
262
+ setAt: latest.at
263
+ };
264
+ }
265
+
266
+ function editDisabledReason(args) {
267
+ const {effective: effective, instance: instance, window: window, guardDenial: guardDenial, predicateSatisfied: predicateSatisfied} = args;
268
+ if (effective === void 0) return {
269
+ kind: "not-editable"
270
+ };
271
+ if (!window.open) {
272
+ const terminalReason = instanceTerminalReason(instance);
273
+ return terminalReason !== void 0 ? terminalReason : {
274
+ kind: "edit-window-closed",
275
+ detail: window.detail ?? "closed"
276
+ };
277
+ }
278
+ if (guardDenial !== void 0) return guardDenial;
279
+ if (!predicateSatisfied) return {
280
+ kind: "editor-not-permitted",
281
+ predicate: effective === !0 ? "true" : effective
282
+ };
283
+ }
284
+
285
+ function instanceTerminalReason(instance) {
286
+ const terminal = terminalState(instance);
287
+ if (terminal === "aborted" && instance.abortedAt !== void 0) return {
288
+ kind: "instance-aborted",
289
+ abortedAt: instance.abortedAt
290
+ };
291
+ if (terminal === "completed" && instance.completedAt !== void 0) return {
292
+ kind: "instance-completed",
293
+ completedAt: instance.completedAt
294
+ };
295
+ }
296
+
297
+ function defineWorkflowEvent(options) {
298
+ return {
299
+ type: "log",
300
+ ...options
301
+ };
302
+ }
303
+
304
+ const noopTelemetry = {
305
+ log: () => {}
306
+ };
307
+
308
+ function resolveTelemetry(telemetry) {
309
+ return telemetry === void 0 ? noopTelemetry : {
310
+ log: (event, data) => {
311
+ try {
312
+ telemetry.log(event, data);
313
+ } catch (error) {
314
+ console.warn(`[workflow-engine] telemetry logger threw while logging "${event.name}" — event dropped`, error);
315
+ }
316
+ }
317
+ };
318
+ }
319
+
320
+ const HIGH_FREQUENCY_SAMPLE_MS = 6e4, WorkflowDefinitionDeployed = defineWorkflowEvent({
321
+ name: "Workflows Definition Deployed",
322
+ version: 2,
323
+ description: "A definition went through a deploy — status distinguishes a newly minted version from an unchanged redeploy"
324
+ }), WorkflowInstanceStarted = defineWorkflowEvent({
325
+ name: "Workflows Instance Started",
326
+ version: 2,
327
+ description: "A workflow instance was started from a deployed definition"
328
+ }), WorkflowStageTransitioned = defineWorkflowEvent({
329
+ name: "Workflows Stage Transitioned",
330
+ version: 2,
331
+ description: "A committed stage move — one event per hop, cascades included, whichever verb drove it. Unsampled: funnel and dwell reads need complete counts, and volume is bounded by actual movement"
332
+ }), WorkflowActionFired = defineWorkflowEvent({
333
+ name: "Workflows Action Fired",
334
+ version: 2,
335
+ description: "An action was fired against an activity"
336
+ }), WorkflowFieldEdited = defineWorkflowEvent({
337
+ name: "Workflows Field Edited",
338
+ version: 2,
339
+ description: "A declared-editable field was edited through the generic edit seam",
340
+ maxSampleRate: HIGH_FREQUENCY_SAMPLE_MS
341
+ }), WorkflowInstanceTicked = defineWorkflowEvent({
342
+ name: "Workflows Instance Ticked",
343
+ version: 2,
344
+ description: "An instance was re-evaluated for auto-transitions and due waits",
345
+ maxSampleRate: HIGH_FREQUENCY_SAMPLE_MS
346
+ }), WorkflowEffectsDrained = defineWorkflowEvent({
347
+ name: "Workflows Effects Drained",
348
+ version: 2,
349
+ description: "A drain pass ran — drainedCount/drainedEffects report the successful dispatches. Unsampled when non-empty (outcome counts must be complete; volume is bounded by real effect work); empty polls are machine-cadence noise, throttled engine-side to at most one per minute"
350
+ }), WorkflowEffectStateReported = defineWorkflowEvent({
351
+ name: "Workflows Effect State Reported",
352
+ version: 2,
353
+ description: "A running effect handler committed mid-dispatch field state through commitEffectOps. Sampled (high-frequency by design — a dispatch may report many times): an adoption and usage signal, not an exact per-run report count",
354
+ maxSampleRate: HIGH_FREQUENCY_SAMPLE_MS
355
+ }), WorkflowEffectCompleted = defineWorkflowEvent({
356
+ name: "Workflows Effect Completed",
357
+ version: 2,
358
+ description: "An effect outcome was recorded — reported directly through completeEffect, or cancelled by the abort verb (external runtimes; engine-drained effects surface via Workflows Effects Drained instead — each outcome counts once)"
359
+ }), WorkflowInstanceAborted = defineWorkflowEvent({
360
+ name: "Workflows Instance Aborted",
361
+ version: 2,
362
+ description: "The abort admin override was invoked (changed: false = instance already terminal)"
363
+ }), WorkflowStageSet = defineWorkflowEvent({
364
+ name: "Workflows Stage Set",
365
+ version: 2,
366
+ description: "The set-stage admin override was invoked (changed: false = already at the target stage)"
367
+ }), WorkflowActivityReset = defineWorkflowEvent({
368
+ name: "Workflows Activity Reset",
369
+ version: 2,
370
+ description: "The reset-activity admin override was invoked (changed: false = already at the target status, or the instance was terminal)"
371
+ }), WorkflowDefinitionDeleted = defineWorkflowEvent({
372
+ name: "Workflows Definition Deleted",
373
+ version: 2,
374
+ description: "A deployed definition (or one version of it) was removed via the admin verb"
375
+ });
376
+
377
+ function definitionDeployedData(definition, outcome) {
378
+ const stages = definition.stages, activities = stages.flatMap(stage => stage.activities ?? []), actions = activities.flatMap(activity => activity.actions ?? []), transitions = stages.flatMap(stage => stage.transitions ?? []), fieldEntries = [ ...definition.fields ?? [], ...stages.flatMap(stage => stage.fields ?? []), ...activities.flatMap(activity => activity.fields ?? []) ];
379
+ return {
380
+ contentHash: outcome.contentHash,
381
+ status: outcome.status,
382
+ deployId: outcome.deployId,
383
+ stageCount: stages.length,
384
+ activityCount: activities.length,
385
+ actionCount: actions.length,
386
+ transitionCount: transitions.length,
387
+ fieldCount: fieldEntries.length,
388
+ activityKinds: [ ...new Set(activities.map(deriveActivityKind)) ].sort(),
389
+ fieldKinds: [ ...new Set(fieldEntries.map(entry => entry.type)) ].sort(),
390
+ guardCount: stages.reduce((n, stage) => n + (stage.guards ?? []).length, 0),
391
+ effectCount: actions.reduce((n, action) => n + (action.effects ?? []).length, 0),
392
+ subworkflowCount: actions.filter(action => action.spawn !== void 0).length,
393
+ lifecycle: definition.lifecycle ?? "standalone"
394
+ };
395
+ }
396
+
397
+ function definitionHashFragment(contentHash) {
398
+ return contentHash !== void 0 ? {
399
+ definitionContentHash: contentHash
400
+ } : {};
401
+ }
402
+
403
+ const REPORTED_BY_DECLARED_KIND = {
404
+ studio: "studio",
405
+ sdk: "sdk",
406
+ cli: "cli",
407
+ mcp: "mcp",
408
+ server: "server",
409
+ drainer: "server",
410
+ interactive: "other",
411
+ script: "other",
412
+ test: "other"
413
+ }, REPORTED_KIND_LOOKUP = new Map(Object.entries(REPORTED_BY_DECLARED_KIND));
414
+
415
+ function executionContextFragment(context) {
416
+ return context.kind === void 0 ? {
417
+ executionRuntime: context.runtime
418
+ } : {
419
+ executionRuntime: context.runtime,
420
+ executionKind: REPORTED_KIND_LOOKUP.get(context.kind) ?? "other"
421
+ };
422
+ }
423
+
424
+ function instanceStartedData(args) {
425
+ return {
426
+ ...definitionHashFragment(args.definition.contentHash),
427
+ instanceId: args.instanceId,
428
+ initialFieldCount: args.initialFieldCount,
429
+ viaSpawn: args.viaSpawn,
430
+ lifecycle: args.definition.lifecycle ?? "standalone"
431
+ };
432
+ }
433
+
434
+ function instanceStartedDataFor(args) {
435
+ return instanceStartedData({
436
+ definition: {
437
+ ...parseDefinitionSnapshot(args.instance),
438
+ ...args.instance.pinnedContentHash !== void 0 ? {
439
+ contentHash: args.instance.pinnedContentHash
440
+ } : {}
441
+ },
442
+ instanceId: args.instance._id,
443
+ initialFieldCount: args.initialFieldCount,
444
+ viaSpawn: args.viaSpawn
445
+ });
446
+ }
447
+
448
+ function stageTransitionedData(args) {
449
+ const stageIndex = name => args.definition.stages.findIndex(stage => stage.name === name), openEntry = findOpenStageEntry(args.instance), dwellMs = openEntry !== void 0 ? Date.parse(args.at) - Date.parse(openEntry.enteredAt) : Number.NaN;
450
+ return {
451
+ ...definitionHashFragment(args.instance.pinnedContentHash),
452
+ instanceId: args.instance._id,
453
+ fromStageIndex: stageIndex(args.instance.currentStage),
454
+ toStageIndex: stageIndex(args.toStage),
455
+ toIsTerminal: args.toIsTerminal,
456
+ isRevisit: args.instance.stages.some(entry => entry.name === args.toStage),
457
+ ...Number.isFinite(dwellMs) ? {
458
+ dwellMs: dwellMs
459
+ } : {},
460
+ via: args.via
461
+ };
462
+ }
463
+
464
+ function openStage(instance) {
465
+ const definition = parseDefinitionSnapshot(instance);
466
+ return {
467
+ definition: definition,
468
+ stage: definition.stages.find(s => s.name === instance.currentStage)
469
+ };
470
+ }
471
+
472
+ function firedActivityKind(instance, activity) {
473
+ const node = openStage(instance).stage?.activities?.find(a => a.name === activity);
474
+ return node === void 0 ? void 0 : deriveActivityKind(node);
475
+ }
476
+
477
+ function editedFieldKind(instance, target) {
478
+ const {definition: definition, stage: stage} = openStage(instance);
479
+ return stage === void 0 ? void 0 : resolveEditTarget({
480
+ definition: definition,
481
+ stage: stage,
482
+ target: target
483
+ })?.type;
484
+ }
485
+
486
+ function actionFiredData(args) {
487
+ const kind = firedActivityKind(args.instance, args.activity);
488
+ return {
489
+ ...definitionHashFragment(args.instance.pinnedContentHash),
490
+ instanceId: args.instance._id,
491
+ ...kind !== void 0 ? {
492
+ activityKind: kind
493
+ } : {},
494
+ hasParams: args.params !== void 0,
495
+ cascaded: args.cascaded
496
+ };
497
+ }
498
+
499
+ function fieldEditedData(args) {
500
+ const kind = editedFieldKind(args.instance, args.target);
501
+ return {
502
+ ...definitionHashFragment(args.instance.pinnedContentHash),
503
+ instanceId: args.instance._id,
504
+ ...kind !== void 0 ? {
505
+ fieldKind: kind
506
+ } : {},
507
+ mode: args.mode ?? DEFAULT_EDIT_MODE
508
+ };
509
+ }
510
+
89
511
  const KNOWN_SCHEMES = /* @__PURE__ */ new Set([ "dataset", "canvas", "media-library", "dashboard" ]), KNOWN_SCHEMES_TEXT = [ ...KNOWN_SCHEMES ].join(", ");
90
512
 
91
513
  class VersionSpecificDatasetGdrError extends Error {
@@ -4192,6 +4614,8 @@ exports.ContractViolationError = ContractViolationError;
4192
4614
 
4193
4615
  exports.DECISION_SEMANTICS = DECISION_SEMANTICS;
4194
4616
 
4617
+ exports.DEFAULT_EDIT_MODE = DEFAULT_EDIT_MODE;
4618
+
4195
4619
  exports.DEFAULT_TRANSITION_WHEN = DEFAULT_TRANSITION_WHEN;
4196
4620
 
4197
4621
  exports.DOCUMENT_VALUE_PERMISSIONS = DOCUMENT_VALUE_PERMISSIONS;
@@ -4246,6 +4670,8 @@ exports.RESERVED_CONDITION_VARS = RESERVED_CONDITION_VARS;
4246
4670
 
4247
4671
  exports.RESOURCE_ALIAS_NAME_SOURCE = RESOURCE_ALIAS_NAME_SOURCE;
4248
4672
 
4673
+ exports.SCOPE_PRECEDENCE = SCOPE_PRECEDENCE;
4674
+
4249
4675
  exports.SIGNAL_SEMANTICS = SIGNAL_SEMANTICS;
4250
4676
 
4251
4677
  exports.START_FILTER_VARS = START_FILTER_VARS;
@@ -4264,18 +4690,48 @@ exports.VersionSpecificDatasetGdrError = VersionSpecificDatasetGdrError;
4264
4690
 
4265
4691
  exports.WORKFLOW_DEFINITION_TYPE = WORKFLOW_DEFINITION_TYPE;
4266
4692
 
4693
+ exports.WORKFLOW_INSTANCE_TYPE = WORKFLOW_INSTANCE_TYPE;
4694
+
4695
+ exports.WorkflowActionFired = WorkflowActionFired;
4696
+
4697
+ exports.WorkflowActivityReset = WorkflowActivityReset;
4698
+
4267
4699
  exports.WorkflowConfigSchema = WorkflowConfigSchema;
4268
4700
 
4701
+ exports.WorkflowDefinitionDeleted = WorkflowDefinitionDeleted;
4702
+
4703
+ exports.WorkflowDefinitionDeployed = WorkflowDefinitionDeployed;
4704
+
4705
+ exports.WorkflowEffectCompleted = WorkflowEffectCompleted;
4706
+
4707
+ exports.WorkflowEffectStateReported = WorkflowEffectStateReported;
4708
+
4709
+ exports.WorkflowEffectsDrained = WorkflowEffectsDrained;
4710
+
4269
4711
  exports.WorkflowError = WorkflowError;
4270
4712
 
4713
+ exports.WorkflowFieldEdited = WorkflowFieldEdited;
4714
+
4715
+ exports.WorkflowInstanceAborted = WorkflowInstanceAborted;
4716
+
4717
+ exports.WorkflowInstanceStarted = WorkflowInstanceStarted;
4718
+
4719
+ exports.WorkflowInstanceTicked = WorkflowInstanceTicked;
4720
+
4721
+ exports.WorkflowStageSet = WorkflowStageSet;
4722
+
4723
+ exports.WorkflowStageTransitioned = WorkflowStageTransitioned;
4724
+
4725
+ exports._fieldTargetLabel = _fieldTargetLabel;
4726
+
4727
+ exports.actionFiredData = actionFiredData;
4728
+
4271
4729
  exports.activeAssignmentMembers = activeAssignmentMembers;
4272
4730
 
4273
4731
  exports.actorFulfillsRole = actorFulfillsRole;
4274
4732
 
4275
4733
  exports.actorMatchesAssignment = actorMatchesAssignment;
4276
4734
 
4277
- exports.andConditions = andConditions;
4278
-
4279
4735
  exports.assignmentKindAcceptsRoles = assignmentKindAcceptsRoles;
4280
4736
 
4281
4737
  exports.assignmentMatch = assignmentMatch;
@@ -4308,8 +4764,12 @@ exports.conditionSyntaxIssues = conditionSyntaxIssues;
4308
4764
 
4309
4765
  exports.datasetResourceParts = datasetResourceParts;
4310
4766
 
4767
+ exports.definitionDeployedData = definitionDeployedData;
4768
+
4311
4769
  exports.definitionDocId = definitionDocId;
4312
4770
 
4771
+ exports.definitionHashFragment = definitionHashFragment;
4772
+
4313
4773
  exports.deriveActivityKind = deriveActivityKind;
4314
4774
 
4315
4775
  exports.deriveExecutorClassification = deriveExecutorClassification;
@@ -4320,6 +4780,12 @@ exports.directoryBridgeId = directoryBridgeId;
4320
4780
 
4321
4781
  exports.driverKind = driverKind;
4322
4782
 
4783
+ exports.editDisabledReason = editDisabledReason;
4784
+
4785
+ exports.editTargetMatches = editTargetMatches;
4786
+
4787
+ exports.editableFieldsInStage = editableFieldsInStage;
4788
+
4323
4789
  exports.effectBackoffMs = effectBackoffMs;
4324
4790
 
4325
4791
  exports.errorMessage = errorMessage;
@@ -4330,10 +4796,18 @@ exports.evaluateConditionOutcome = evaluateConditionOutcome;
4330
4796
 
4331
4797
  exports.evaluatePredicates = evaluatePredicates;
4332
4798
 
4799
+ exports.executionContextFragment = executionContextFragment;
4800
+
4333
4801
  exports.extractDocumentId = extractDocumentId;
4334
4802
 
4803
+ exports.fieldEditedData = fieldEditedData;
4804
+
4805
+ exports.fieldProvenance = fieldProvenance;
4806
+
4335
4807
  exports.fieldValueSchemas = fieldValueSchemas;
4336
4808
 
4809
+ exports.fieldWindowOpen = fieldWindowOpen;
4810
+
4337
4811
  exports.findCurrentActivityEntry = findCurrentActivityEntry;
4338
4812
 
4339
4813
  exports.findOpenStageEntry = findOpenStageEntry;
@@ -4362,6 +4836,12 @@ exports.identityMatchesAssignment = identityMatchesAssignment;
4362
4836
 
4363
4837
  exports.instanceAssignmentStateCounts = instanceAssignmentStateCounts;
4364
4838
 
4839
+ exports.instanceStartedData = instanceStartedData;
4840
+
4841
+ exports.instanceStartedDataFor = instanceStartedDataFor;
4842
+
4843
+ exports.instanceTerminalReason = instanceTerminalReason;
4844
+
4365
4845
  exports.isAlwaysArrayFieldKind = isAlwaysArrayFieldKind;
4366
4846
 
4367
4847
  exports.isAssignmentFieldEntry = isAssignmentFieldEntry;
@@ -4404,6 +4884,8 @@ exports.isTodoListItem = isTodoListItem;
4404
4884
 
4405
4885
  exports.isUnevaluable = isUnevaluable;
4406
4886
 
4887
+ exports.isUnprimed = isUnprimed;
4888
+
4407
4889
  exports.labelFor = labelFor;
4408
4890
 
4409
4891
  exports.lakePrincipalId = lakePrincipalId;
@@ -4414,10 +4896,18 @@ exports.mutationGuardActionIdSpace = mutationGuardActionIdSpace;
4414
4896
 
4415
4897
  exports.mutationGuardRequiresSplitEmission = mutationGuardRequiresSplitEmission;
4416
4898
 
4899
+ exports.noopTelemetry = noopTelemetry;
4900
+
4417
4901
  exports.normalizeAssignmentMembers = normalizeAssignmentMembers;
4418
4902
 
4419
4903
  exports.openActivityAssignments = openActivityAssignments;
4420
4904
 
4905
+ exports.parentRef = parentRef;
4906
+
4907
+ exports.parseDefinitionSnapshot = parseDefinitionSnapshot;
4908
+
4909
+ exports.parseDefinitionSnapshotValue = parseDefinitionSnapshotValue;
4910
+
4421
4911
  exports.parseFieldValue = parseFieldValue;
4422
4912
 
4423
4913
  exports.parseGdr = parseGdr;
@@ -4430,6 +4920,8 @@ exports.parseResourceGdr = parseResourceGdr;
4430
4920
 
4431
4921
  exports.parseStoredDefinition = parseStoredDefinition;
4432
4922
 
4923
+ exports.readFieldValue = readFieldValue;
4924
+
4433
4925
  exports.readsRootDocument = readsRootDocument;
4434
4926
 
4435
4927
  exports.refCanvas = refCanvas;
@@ -4450,6 +4942,12 @@ exports.releaseDocId = releaseDocId;
4450
4942
 
4451
4943
  exports.releaseRef = releaseRef;
4452
4944
 
4945
+ exports.resolveEditTarget = resolveEditTarget;
4946
+
4947
+ exports.resolveFieldEntry = resolveFieldEntry;
4948
+
4949
+ exports.resolveTelemetry = resolveTelemetry;
4950
+
4453
4951
  exports.resolvedChildStatus = resolvedChildStatus;
4454
4952
 
4455
4953
  exports.resourceAliasesToMap = resourceAliasesToMap;
@@ -4472,10 +4970,14 @@ exports.schemaTreeShape = schemaTreeShape;
4472
4970
 
4473
4971
  exports.selfGdr = selfGdr;
4474
4972
 
4973
+ exports.stageTransitionedData = stageTransitionedData;
4974
+
4475
4975
  exports.startKindOf = startKindOf;
4476
4976
 
4477
4977
  exports.tagScopeFilter = tagScopeFilter;
4478
4978
 
4979
+ exports.terminalState = terminalState;
4980
+
4479
4981
  exports.toBareId = toBareId;
4480
4982
 
4481
4983
  exports.toPhysicalGdr = toPhysicalGdr;