@oomol-lab/open-flow 0.1.0-beta.62 → 0.1.0-beta.64

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 (55) hide show
  1. package/dist/browser/{createResourceDialog-DZgJsr3e.js → createResourceDialog-BAJXbzNH.js} +20 -7
  2. package/dist/browser/flow-authoring.js +8 -7
  3. package/dist/browser/flow-change-schema.d.ts +1 -0
  4. package/dist/browser/flow-change.d.ts +1 -0
  5. package/dist/browser/flow-change.js +8 -7
  6. package/dist/browser/flow-notifications.d.ts +6 -0
  7. package/dist/browser/{flowChanges-CzYIVevI.js → flowChanges-BAMkSaKF.js} +1771 -1331
  8. package/dist/browser/{flowRunInputEditorStore-Dsxyfwae.js → flowRunInputEditorStore-B2Rw4VsT.js} +1 -1
  9. package/dist/browser/{flowWorkspace-BgZaFKZm.js → flowWorkspace-DxLc1Ybv.js} +429 -205
  10. package/dist/browser/{icons-CajfDpy_.js → icons-Db2Jb2iX.js} +30 -10
  11. package/dist/browser/preview.css +40 -52
  12. package/dist/browser/preview.js +7752 -7452
  13. package/dist/browser/theme.css +4 -0
  14. package/dist/browser/{typeScriptSession-fXPMFGjW.js → typeScriptSession-D0bjYDeg.js} +1 -1
  15. package/dist/browser/ui.css +39 -51
  16. package/dist/browser/ui.js +5 -5
  17. package/dist/browser/{value-DL_poNiC.js → value-BADHeZ9I.js} +12 -1
  18. package/dist/browser/workbench-contract.d.ts +10 -0
  19. package/dist/browser/workbench.css +43 -59
  20. package/dist/browser/workbench.d.ts +5 -3
  21. package/dist/browser/workbench.js +255 -216
  22. package/dist/browser/{workbenchSelect-H9wzEFkH.js → workbenchSelect-C-jf6NIM.js} +1 -1
  23. package/dist/command/index.js +49 -48
  24. package/dist/common/authoringSchema.d.ts +1 -0
  25. package/dist/common/canvas-commands.d.ts +19 -0
  26. package/dist/common/connector-action.d.ts +1 -0
  27. package/dist/common/connector-action.js +15 -12
  28. package/dist/common/control-api-conformance.js +127 -8
  29. package/dist/common/control-api.d.ts +16 -0
  30. package/dist/common/control-api.js +67 -8
  31. package/dist/common/control-requests.d.ts +23 -0
  32. package/dist/common/control-requests.js +64 -19
  33. package/dist/common/decision.js +8 -7
  34. package/dist/common/flow-connectionUsage.d.ts +1 -0
  35. package/dist/common/flow-encoding.d.ts +1 -0
  36. package/dist/common/flow-encoding.js +202 -10
  37. package/dist/common/flow-notifications.d.ts +6 -0
  38. package/dist/common/flow-semantics.js +64 -46
  39. package/dist/common/flow-workflowFile.d.ts +23 -0
  40. package/dist/common/integration-trigger.js +8 -7
  41. package/dist/common/localization.d.ts +1 -0
  42. package/dist/common/localization.js +12 -1
  43. package/dist/common/mcp.d.ts +103 -0
  44. package/dist/common/mcp.js +135 -11
  45. package/dist/common/openapi.js +8 -7
  46. package/dist/common/poll-trigger.js +8 -7
  47. package/dist/common/runtime-contract.js +1 -1
  48. package/dist/common/scheduler.d.ts +22 -2
  49. package/dist/common/scheduler.js +354 -83
  50. package/dist/common/trigger-config.d.ts +2 -0
  51. package/dist/common/webhook-trigger.js +8 -7
  52. package/dist/index.d.ts +2 -2
  53. package/package.json +1 -1
  54. package/skills/open-flow/SKILL.md +1 -1
  55. package/skills/open-flow/references/flow-authoring.md +49 -0
@@ -5852,6 +5852,23 @@ function preprocess(fn, schema) {
5852
5852
  out: schema
5853
5853
  });
5854
5854
  }
5855
+ /** Transient operations on each connected canvas's own viewport. */
5856
+ var canvasCommandSchema = discriminatedUnion("type", [
5857
+ strictObject({
5858
+ type: literal("focus"),
5859
+ nodeId: string().min(1)
5860
+ }),
5861
+ strictObject({
5862
+ type: literal("zoom"),
5863
+ zoom: number().min(.1).max(3)
5864
+ }),
5865
+ strictObject({
5866
+ type: literal("pan"),
5867
+ dx: number(),
5868
+ dy: number()
5869
+ }),
5870
+ strictObject({ type: literal("fit") })
5871
+ ]);
5855
5872
  //#endregion
5856
5873
  //#region ../../node_modules/.bun/dequal@2.0.3/node_modules/dequal/lite/index.mjs
5857
5874
  var has = Object.prototype.hasOwnProperty;
@@ -8360,10 +8377,10 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
8360
8377
  }
8361
8378
  if (compiledEnum.length === 0) recordWarn(context, "all of elements from list is rejected by currently schema object", "enum");
8362
8379
  }
8363
- if (constValue && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
8380
+ if (constValue !== void 0 && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
8364
8381
  if (compiledEnum) {
8365
8382
  if (compiledEnum.length === 0) isNever = true;
8366
- else if (constValue) {
8383
+ else if (constValue !== void 0) {
8367
8384
  let foundEquals = false;
8368
8385
  for (const enumValue of compiledEnum) if (isDeepEquals(enumValue, constValue)) {
8369
8386
  foundEquals = true;
@@ -8376,7 +8393,7 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
8376
8393
  const compiledSchema = {};
8377
8394
  if (schema.type) compiledSchema.type = schema.type;
8378
8395
  if (compiledEnum) compiledSchema.enum = compiledEnum;
8379
- if (constValue) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
8396
+ if (constValue !== void 0) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
8380
8397
  return wrapCompiledSchema(kind, compiledSchema, context.delegate, context.path);
8381
8398
  }
8382
8399
  //#endregion
@@ -8771,7 +8788,7 @@ function compileSchema(context, schema) {
8771
8788
  let targetSchema = schema;
8772
8789
  let shouldHandleEnumAndConst = false;
8773
8790
  const { enum: enumList, const: constValue } = schema;
8774
- if (enumList || constValue) {
8791
+ if (enumList || constValue !== void 0) {
8775
8792
  const { enum: _0, const: _1, ...rest } = schema;
8776
8793
  targetSchema = rest;
8777
8794
  shouldHandleEnumAndConst = true;
@@ -9361,7 +9378,7 @@ function schemaEqualsChecker(extendsContext) {
9361
9378
  }
9362
9379
  function isValueEquals(value1, value2) {
9363
9380
  if (value1 === value2) return true;
9364
- if (value1 === null) return false;
9381
+ if (value1 === null || value2 === null) return false;
9365
9382
  if (typeof value1 !== "object") return false;
9366
9383
  if (typeof value1 !== typeof value2) return false;
9367
9384
  if (isCompiledSchema(value1) && isCompiledSchema(value2)) return isCompiledSchemaEquals(value1, value2);
@@ -9927,7 +9944,7 @@ function findMismatchPath(source, target) {
9927
9944
  if ((sourceSchema.maxProperties ?? Number.POSITIVE_INFINITY) > (targetSchema.maxProperties ?? Number.POSITIVE_INFINITY)) return [...targetPath, "maxProperties"];
9928
9945
  break;
9929
9946
  }
9930
- case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const == null ? "enum" : "const"];
9947
+ case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const === void 0 ? "enum" : "const"];
9931
9948
  }
9932
9949
  return targetPath;
9933
9950
  }
@@ -10464,7 +10481,8 @@ var managedFields = object$1({
10464
10481
  object$1({
10465
10482
  kind: literal("connector"),
10466
10483
  action: text$1,
10467
- connectionId: text$1.optional()
10484
+ connectionId: text$1.optional(),
10485
+ outputMode: literal("value").optional()
10468
10486
  }),
10469
10487
  object$1({
10470
10488
  kind: literal("openapi"),
@@ -11613,7 +11631,7 @@ var authoringConfigurations = {
11613
11631
  outputs: outputFields,
11614
11632
  capabilities: authoringDefinitionSchemas.capabilities.optional()
11615
11633
  }),
11616
- connector: authoringDefinitionSchemas.connector.strict(),
11634
+ connector: authoringDefinitionSchemas.connector.omit({ outputMode: true }).strict(),
11617
11635
  openapi: authoringOpenApiSchema,
11618
11636
  agent: authoringDefinitionSchemas.agent.omit({
11619
11637
  prompt: true,
@@ -12019,6 +12037,13 @@ var authoringSearchResponse = object$1({
12019
12037
  version: literal(1)
12020
12038
  });
12021
12039
  //#endregion
12040
+ //#region src/connector/common/actionSchema.ts
12041
+ function connectorOutputMode(schema) {
12042
+ const root = toPlainObject(schema);
12043
+ const properties = toPlainObject(root?.properties);
12044
+ return properties != null && Object.keys(properties).length > 0 || root?.type == "object" && root.additionalProperties === false ? "fields" : "value";
12045
+ }
12046
+ //#endregion
12022
12047
  //#region src/trigger/common/contract.ts
12023
12048
  var errorOutputs = [
12024
12049
  {
@@ -12920,6 +12945,9 @@ function authoringNode(content, ref) {
12920
12945
  const { inputDefinitions: _definitions, ...noticeSettings } = notification;
12921
12946
  config.notification = noticeSettings;
12922
12947
  }
12948
+ } else if (task.executor.kind == "connector") {
12949
+ const { kind: _kind, outputMode: _outputMode, ...settings } = task.executor;
12950
+ config = settings;
12923
12951
  } else if (task.executor.kind == "llm") config = {
12924
12952
  ...llmConfigurationView(task),
12925
12953
  inputs: fieldsView([...task.inputs, ...node.kind == "task" ? node.additionalInputs ?? [] : []].filter((port) => !("handle" in port) || !llmReservedInputs.includes(port.handle)))
@@ -13168,7 +13196,8 @@ async function compileAuthoring(base, request, host) {
13168
13196
  executor: {
13169
13197
  kind: "connector",
13170
13198
  action: action.actionId,
13171
- ...config.connectionId == null ? {} : { connectionId: String(config.connectionId) }
13199
+ ...config.connectionId == null ? {} : { connectionId: String(config.connectionId) },
13200
+ ...action.outputSchema !== void 0 && connectorOutputMode(action.outputSchema) == "value" ? { outputMode: "value" } : {}
13172
13201
  },
13173
13202
  inputs: Object.entries(action.inputs).map(([handle, port]) => Object.assign({ handle }, port)),
13174
13203
  outputs: Object.entries(action.outputs).map(([handle, port]) => Object.assign({ handle }, port))
@@ -13236,15 +13265,19 @@ async function compileAuthoring(base, request, host) {
13236
13265
  } else if (node.kind == "task" && "executor" in node.task) {
13237
13266
  const before = node.task;
13238
13267
  let task;
13239
- if (type == "connector") task = config.action == (before.executor.kind == "connector" ? before.executor.action : "") ? {
13240
- ...before,
13241
- name: String(update.name),
13242
- executor: {
13243
- kind: "connector",
13244
- ...config
13245
- }
13246
- } : await connectorTask(config, String(update.name));
13247
- else if (type == "decision") task = decisionTask(config.questions, String(update.name));
13268
+ if (type == "connector") {
13269
+ if (before.executor.kind == "connector" && config.action == before.executor.action) {
13270
+ const { connectionId: _connectionId, ...executor } = before.executor;
13271
+ task = {
13272
+ ...before,
13273
+ name: String(update.name),
13274
+ executor: {
13275
+ ...executor,
13276
+ ...config
13277
+ }
13278
+ };
13279
+ } else task = await connectorTask(config, String(update.name));
13280
+ } else if (type == "decision") task = decisionTask(config.questions, String(update.name));
13248
13281
  else if (type == "openapi") task = await prepareOpenApiTask(config, before, (url) => host.openapi(url), String(update.name), {
13249
13282
  authentication: explicit("authentication"),
13250
13283
  serverUrl: explicit("serverUrl")
@@ -13996,6 +14029,10 @@ var trigger = strictObject({
13996
14029
  outputs: record$3(string(), json)
13997
14030
  });
13998
14031
  var schemas = {
14032
+ canvas: strictObject({
14033
+ command: canvasCommandSchema,
14034
+ version
14035
+ }),
13999
14036
  authoringCheck: authoringCheckSchema,
14000
14037
  authoringEdit: authoringRequestSchema,
14001
14038
  authoringRead: authoringReadSchema,
@@ -14008,6 +14045,12 @@ var schemas = {
14008
14045
  createEventSource: createEventSourceSchema,
14009
14046
  updateEventSource: updateEventSourceSchema,
14010
14047
  eventSourceRevision: eventSourceRevisionSchema,
14048
+ importFlow: strictObject({
14049
+ file: json,
14050
+ name: flowName.optional(),
14051
+ teamId: id.optional(),
14052
+ version
14053
+ }),
14011
14054
  createFlow: strictObject({
14012
14055
  name: flowName,
14013
14056
  teamId: id.optional(),
@@ -14101,6 +14144,7 @@ function decoder(schema) {
14101
14144
  return (value) => schema.parse(value);
14102
14145
  }
14103
14146
  var controlRequests = {
14147
+ canvas: decoder(schemas.canvas),
14104
14148
  authoringCheck: decoder(schemas.authoringCheck),
14105
14149
  authoringEdit: decoder(schemas.authoringEdit),
14106
14150
  authoringRead: decoder(schemas.authoringRead),
@@ -14110,6 +14154,7 @@ var controlRequests = {
14110
14154
  createEventSource: decoder(schemas.createEventSource),
14111
14155
  updateEventSource: decoder(schemas.updateEventSource),
14112
14156
  eventSourceRevision: decoder(schemas.eventSourceRevision),
14157
+ importFlow: decoder(schemas.importFlow),
14113
14158
  createFlow: decoder(schemas.createFlow),
14114
14159
  renameFlow: decoder(schemas.renameFlow),
14115
14160
  changeDraft(value) {
@@ -14148,4 +14193,4 @@ function controlRequestSchema(name) {
14148
14193
  return schema;
14149
14194
  }
14150
14195
  //#endregion
14151
- export { AuthoringError, authoringCheckResponse, authoringCheckSchema, authoringConfigurations, authoringDiagnosticSchema, authoringDiagnostics, authoringEditResponse, authoringEditSchema, authoringExample, authoringExamples, authoringNode, authoringReadResponse, authoringReadSchema, authoringRequestContract, authoringRequestSchema, authoringSchema, authoringSchemaQuery, authoringSearchResponse, authoringSearchSchema, authoringSourceSchema, authoringTypes, compileAuthoring, controlRequestSchema, controlRequests, decodeDraftOperations, draftOperationsSchema, readAuthoring, resolveDraftOperations, searchAuthoring, waitActionBodySchema };
14196
+ export { AuthoringError, authoringCheckResponse, authoringCheckSchema, authoringConfigurations, authoringDiagnosticSchema, authoringDiagnostics, authoringEditResponse, authoringEditSchema, authoringExample, authoringExamples, authoringNode, authoringReadResponse, authoringReadSchema, authoringRequestContract, authoringRequestSchema, authoringSchema, authoringSchemaQuery, authoringSearchResponse, authoringSearchSchema, authoringSourceSchema, authoringTypes, canvasCommandSchema, compileAuthoring, controlRequestSchema, controlRequests, decodeDraftOperations, draftOperationsSchema, readAuthoring, resolveDraftOperations, searchAuthoring, waitActionBodySchema };
@@ -6711,7 +6711,8 @@ var managedFields = object({
6711
6711
  object({
6712
6712
  kind: literal("connector"),
6713
6713
  action: text,
6714
- connectionId: text.optional()
6714
+ connectionId: text.optional(),
6715
+ outputMode: literal("value").optional()
6715
6716
  }),
6716
6717
  object({
6717
6718
  kind: literal("openapi"),
@@ -8096,10 +8097,10 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
8096
8097
  }
8097
8098
  if (compiledEnum.length === 0) recordWarn(context, "all of elements from list is rejected by currently schema object", "enum");
8098
8099
  }
8099
- if (constValue && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
8100
+ if (constValue !== void 0 && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
8100
8101
  if (compiledEnum) {
8101
8102
  if (compiledEnum.length === 0) isNever = true;
8102
- else if (constValue) {
8103
+ else if (constValue !== void 0) {
8103
8104
  let foundEquals = false;
8104
8105
  for (const enumValue of compiledEnum) if (isDeepEquals(enumValue, constValue)) {
8105
8106
  foundEquals = true;
@@ -8112,7 +8113,7 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
8112
8113
  const compiledSchema = {};
8113
8114
  if (schema.type) compiledSchema.type = schema.type;
8114
8115
  if (compiledEnum) compiledSchema.enum = compiledEnum;
8115
- if (constValue) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
8116
+ if (constValue !== void 0) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
8116
8117
  return wrapCompiledSchema(kind, compiledSchema, context.delegate, context.path);
8117
8118
  }
8118
8119
  //#endregion
@@ -8507,7 +8508,7 @@ function compileSchema(context, schema) {
8507
8508
  let targetSchema = schema;
8508
8509
  let shouldHandleEnumAndConst = false;
8509
8510
  const { enum: enumList, const: constValue } = schema;
8510
- if (enumList || constValue) {
8511
+ if (enumList || constValue !== void 0) {
8511
8512
  const { enum: _0, const: _1, ...rest } = schema;
8512
8513
  targetSchema = rest;
8513
8514
  shouldHandleEnumAndConst = true;
@@ -9097,7 +9098,7 @@ function schemaEqualsChecker(extendsContext) {
9097
9098
  }
9098
9099
  function isValueEquals(value1, value2) {
9099
9100
  if (value1 === value2) return true;
9100
- if (value1 === null) return false;
9101
+ if (value1 === null || value2 === null) return false;
9101
9102
  if (typeof value1 !== "object") return false;
9102
9103
  if (typeof value1 !== typeof value2) return false;
9103
9104
  if (isCompiledSchema(value1) && isCompiledSchema(value2)) return isCompiledSchemaEquals(value1, value2);
@@ -9663,7 +9664,7 @@ function findMismatchPath(source, target) {
9663
9664
  if ((sourceSchema.maxProperties ?? Number.POSITIVE_INFINITY) > (targetSchema.maxProperties ?? Number.POSITIVE_INFINITY)) return [...targetPath, "maxProperties"];
9664
9665
  break;
9665
9666
  }
9666
- case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const == null ? "enum" : "const"];
9667
+ case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const === void 0 ? "enum" : "const"];
9667
9668
  }
9668
9669
  return targetPath;
9669
9670
  }
@@ -10,3 +10,4 @@ export interface ConnectionUsage {
10
10
  }
11
11
  export declare function connectionUsage(document: FlowDocument): readonly ConnectionUsage[];
12
12
  export declare function removeConnectionUsage(content: RevisionContent, connectionId: string): RevisionContent;
13
+ export declare function clearNodeConnections(graph: FlowDocument['graph'], connectionId?: string): FlowDocument['graph'];
@@ -1,4 +1,5 @@
1
1
  import type { CodeModule, FlowDocument, Graph, Group, InputPort, JsonValue, ManagedTaskDefinition, Port, RevisionContent, TriggerNode } from '@oomol-lab/open-flow/flow-change';
2
+ export * from './flow-workflowFile.js';
2
3
  export { maxJsonDepth } from './flow-json.js';
3
4
  export { decodeFlowDocument, decodeRevisionContent } from '../browser/flow-change-schema.js';
4
5
  export declare function canonicalJsonBytes(value: JsonValue): Uint8Array;
@@ -6649,10 +6649,10 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
6649
6649
  }
6650
6650
  if (compiledEnum.length === 0) recordWarn(context, "all of elements from list is rejected by currently schema object", "enum");
6651
6651
  }
6652
- if (constValue && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
6652
+ if (constValue !== void 0 && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
6653
6653
  if (compiledEnum) {
6654
6654
  if (compiledEnum.length === 0) isNever = true;
6655
- else if (constValue) {
6655
+ else if (constValue !== void 0) {
6656
6656
  let foundEquals = false;
6657
6657
  for (const enumValue of compiledEnum) if (isDeepEquals(enumValue, constValue)) {
6658
6658
  foundEquals = true;
@@ -6665,7 +6665,7 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
6665
6665
  const compiledSchema = {};
6666
6666
  if (schema.type) compiledSchema.type = schema.type;
6667
6667
  if (compiledEnum) compiledSchema.enum = compiledEnum;
6668
- if (constValue) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
6668
+ if (constValue !== void 0) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
6669
6669
  return wrapCompiledSchema(kind, compiledSchema, context.delegate, context.path);
6670
6670
  }
6671
6671
  //#endregion
@@ -7060,7 +7060,7 @@ function compileSchema(context, schema) {
7060
7060
  let targetSchema = schema;
7061
7061
  let shouldHandleEnumAndConst = false;
7062
7062
  const { enum: enumList, const: constValue } = schema;
7063
- if (enumList || constValue) {
7063
+ if (enumList || constValue !== void 0) {
7064
7064
  const { enum: _0, const: _1, ...rest } = schema;
7065
7065
  targetSchema = rest;
7066
7066
  shouldHandleEnumAndConst = true;
@@ -7650,7 +7650,7 @@ function schemaEqualsChecker(extendsContext) {
7650
7650
  }
7651
7651
  function isValueEquals(value1, value2) {
7652
7652
  if (value1 === value2) return true;
7653
- if (value1 === null) return false;
7653
+ if (value1 === null || value2 === null) return false;
7654
7654
  if (typeof value1 !== "object") return false;
7655
7655
  if (typeof value1 !== typeof value2) return false;
7656
7656
  if (isCompiledSchema(value1) && isCompiledSchema(value2)) return isCompiledSchemaEquals(value1, value2);
@@ -8216,7 +8216,7 @@ function findMismatchPath(source, target) {
8216
8216
  if ((sourceSchema.maxProperties ?? Number.POSITIVE_INFINITY) > (targetSchema.maxProperties ?? Number.POSITIVE_INFINITY)) return [...targetPath, "maxProperties"];
8217
8217
  break;
8218
8218
  }
8219
- case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const == null ? "enum" : "const"];
8219
+ case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const === void 0 ? "enum" : "const"];
8220
8220
  }
8221
8221
  return targetPath;
8222
8222
  }
@@ -8693,7 +8693,8 @@ var managedFields = object({
8693
8693
  object({
8694
8694
  kind: literal("connector"),
8695
8695
  action: text,
8696
- connectionId: text.optional()
8696
+ connectionId: text.optional(),
8697
+ outputMode: literal("value").optional()
8697
8698
  }),
8698
8699
  object({
8699
8700
  kind: literal("openapi"),
@@ -8961,7 +8962,7 @@ var revision = object({
8961
8962
  document,
8962
8963
  modules: record$1(text, module)
8963
8964
  });
8964
- var envelope = revision.extend({
8965
+ var envelope$1 = revision.extend({
8965
8966
  kind: literal("open-flow-flow-revision"),
8966
8967
  version: literal(1)
8967
8968
  });
@@ -9186,7 +9187,7 @@ function decodeRevisionEnvelope(value) {
9186
9187
  ...revisionSource,
9187
9188
  document: upgradeLegacyDocument(revisionSource.document)
9188
9189
  } : value;
9189
- const content = envelope.parse(candidate);
9190
+ const content = envelope$1.parse(candidate);
9190
9191
  checkModelVersion(content);
9191
9192
  assertOpenApiAuthBindings(content.document);
9192
9193
  return {
@@ -9352,6 +9353,197 @@ function checkModelVersion(content) {
9352
9353
  if (content.modelVersion < 5 && Object.values(content.document.graph.nodes).some((itemNode) => itemNode.kind == "error")) throw new TypeError("Error workflows require Flow model version 5.");
9353
9354
  }
9354
9355
  //#endregion
9356
+ //#region src/flow/common/condition.ts
9357
+ function clearConditionBinding(operand) {
9358
+ return operand.kind == "source" && operand.source.kind == "binding" ? { kind: "value" } : operand;
9359
+ }
9360
+ function clearConditionBindings(node) {
9361
+ return {
9362
+ ...node,
9363
+ cases: node.cases.map((item) => ({
9364
+ ...item,
9365
+ groups: item.groups.map((group) => ({
9366
+ ...group,
9367
+ expressions: group.expressions.map((expression) => ({
9368
+ ...expression,
9369
+ left: clearConditionBinding(expression.left),
9370
+ ...expression.right == null ? {} : { right: clearConditionBinding(expression.right) }
9371
+ }))
9372
+ }))
9373
+ }))
9374
+ };
9375
+ }
9376
+ //#endregion
9377
+ //#region src/trigger/common/config.ts
9378
+ /** Deployment-bound selections owned by the Trigger configuration contract. */
9379
+ function clearTriggerExternalConfig(key, config) {
9380
+ const fields = key == "feishu_app_bot.on_event" ? [
9381
+ "sourceId",
9382
+ "eventTypes",
9383
+ "resource",
9384
+ "chatIds"
9385
+ ] : key == "linear.on_issue_changed" ? ["teamId", "stateIds"] : [];
9386
+ return {
9387
+ ...config,
9388
+ ...Object.fromEntries(fields.map((field) => [field, { kind: "unset" }]))
9389
+ };
9390
+ }
9391
+ //#endregion
9392
+ //#region src/flow/common/connectionUsage.ts
9393
+ function clearNodeConnections(graph, connectionId) {
9394
+ return {
9395
+ ...graph,
9396
+ nodes: Object.fromEntries(Object.entries(graph.nodes).map(([id, node]) => {
9397
+ if ((node.kind == "poll" || node.kind == "integration") && (connectionId == null || node.connectionId == connectionId)) {
9398
+ const { connectionId: _, ...remaining } = node;
9399
+ return [id, remaining];
9400
+ }
9401
+ if (node.kind != "task") return [id, node];
9402
+ if ("executor" in node.task) {
9403
+ const executor = node.task.executor;
9404
+ const clear = (value) => {
9405
+ if (connectionId != null && value.connectionId != connectionId) return value;
9406
+ const { connectionId: _, ...rest } = value;
9407
+ return rest;
9408
+ };
9409
+ if (executor.kind == "connector") return [id, {
9410
+ ...node,
9411
+ task: {
9412
+ ...node.task,
9413
+ executor: clear(executor)
9414
+ }
9415
+ }];
9416
+ if (executor.kind == "agent") return [id, {
9417
+ ...node,
9418
+ task: {
9419
+ ...node.task,
9420
+ executor: {
9421
+ ...executor,
9422
+ tools: executor.tools.map(clear),
9423
+ ...executor.notification == null ? {} : { notification: clear(executor.notification) }
9424
+ }
9425
+ }
9426
+ }];
9427
+ return [id, node];
9428
+ }
9429
+ const capabilities = node.task.capabilities?.map((capability) => {
9430
+ if (!("mode" in capability)) {
9431
+ if ("action" in capability) {
9432
+ const { connectionId: selected, ...rest } = capability;
9433
+ return {
9434
+ ...rest,
9435
+ connections: capability.connections.filter((item) => connectionId != null && item.connectionId != connectionId),
9436
+ ...selected != null && connectionId != null && selected != connectionId ? { connectionId: selected } : {}
9437
+ };
9438
+ }
9439
+ return {
9440
+ ...capability,
9441
+ ...connectionId == null && (capability.connectionHints?.length ?? 0) > 0 ? { actionHints: [.../* @__PURE__ */ new Set([...capability.actionHints ?? [], ...capability.connectionHints.map((hint) => hint.action)])] } : {},
9442
+ ...capability.connectionHints == null ? {} : { connectionHints: capability.connectionHints.filter((item) => connectionId != null && item.connectionId != connectionId) }
9443
+ };
9444
+ }
9445
+ if (capability.mode != "independent") return capability;
9446
+ return {
9447
+ ...capability,
9448
+ actions: capability.actions.map((action) => {
9449
+ if (connectionId != null && action.connectionId != connectionId) return action;
9450
+ const { connectionId: _, ...remaining } = action;
9451
+ return remaining;
9452
+ })
9453
+ };
9454
+ });
9455
+ return [id, capabilities == null ? node : {
9456
+ ...node,
9457
+ task: {
9458
+ ...node.task,
9459
+ capabilities
9460
+ }
9461
+ }];
9462
+ }))
9463
+ };
9464
+ }
9465
+ //#endregion
9466
+ //#region src/flow/common/workflowFile.ts
9467
+ var envelope = strictObject({
9468
+ kind: literal("open-flow-workflow"),
9469
+ version: literal(1),
9470
+ name: string().optional(),
9471
+ content: unknown(),
9472
+ presentation: record$1(string(), json$1()).optional()
9473
+ });
9474
+ /** Structural decoding only: incomplete drafts are supported, repair is never attempted. */
9475
+ function decodeWorkflowFile(value) {
9476
+ checkJsonDepth(value, -1);
9477
+ const file = envelope.parse(value);
9478
+ return {
9479
+ ...file,
9480
+ content: decodeRevisionContent(file.content)
9481
+ };
9482
+ }
9483
+ function parseWorkflowFile(text) {
9484
+ return decodeWorkflowFile(JSON.parse(text));
9485
+ }
9486
+ function cleanInput(input) {
9487
+ if (input.kind != "sources" || !input.sources.some((source) => source.kind == "binding")) return input;
9488
+ const sources = input.sources.filter((source) => source.kind != "binding");
9489
+ return sources.length == 0 ? { kind: "unset" } : {
9490
+ kind: "sources",
9491
+ sources
9492
+ };
9493
+ }
9494
+ /** Clear only owned structured references, never strings in code or business values. */
9495
+ function cleanWorkflowFile(value) {
9496
+ const file = decodeWorkflowFile(value);
9497
+ const original = file.content.document.graph;
9498
+ const graph = clearNodeConnections(original);
9499
+ const nodes = Object.fromEntries(Object.entries(graph.nodes).map(([id, source]) => {
9500
+ let node = source;
9501
+ if ("inputs" in node) node = {
9502
+ ...node,
9503
+ inputs: Object.fromEntries(Object.entries(node.inputs).map(([key, input]) => [key, cleanInput(input)]))
9504
+ };
9505
+ if (node.kind == "condition") node = clearConditionBindings(node);
9506
+ if (node.kind == "error" && node.sourceFlowIds != null) node = {
9507
+ ...node,
9508
+ sourceFlowIds: []
9509
+ };
9510
+ if (node.kind == "poll" || node.kind == "integration") node = {
9511
+ ...node,
9512
+ config: clearTriggerExternalConfig(node.definition.key, node.config)
9513
+ };
9514
+ return [id, node];
9515
+ }));
9516
+ return {
9517
+ file: {
9518
+ ...file,
9519
+ content: {
9520
+ ...file.content,
9521
+ document: {
9522
+ ...file.content.document,
9523
+ bindings: {},
9524
+ graph: {
9525
+ ...graph,
9526
+ nodes
9527
+ }
9528
+ }
9529
+ }
9530
+ },
9531
+ summary: {
9532
+ changedNodeIds: Object.keys(nodes).filter((id) => !dequal(nodes[id], original.nodes[id])),
9533
+ removedBindings: Object.keys(file.content.document.bindings).length
9534
+ }
9535
+ };
9536
+ }
9537
+ function encodeWorkflowFile(file) {
9538
+ return `${JSON.stringify(cleanWorkflowFile(file).file, null, 2)}\n`;
9539
+ }
9540
+ function workflowFileName(name) {
9541
+ return `${name.replace(/[<>:"/\\|?*\u0000-\u001f]/g, "_").replace(/[. ]+$/g, "") || "workflow"}.openflow.json`;
9542
+ }
9543
+ function workflowNameFromFile(name) {
9544
+ return name.replace(/(?:\.openflow)?\.json$/i, "");
9545
+ }
9546
+ //#endregion
9355
9547
  //#region src/flow/common/encoding.ts
9356
9548
  var encoder = new TextEncoder();
9357
9549
  function canonicalText(value) {
@@ -9700,4 +9892,4 @@ function repairRevision(bytes) {
9700
9892
  return repairRevisionEnvelope(revisionValue(bytes));
9701
9893
  }
9702
9894
  //#endregion
9703
- export { canonicalDocument, canonicalGraph, canonicalJsonBytes, canonicalModule, canonicalPorts, canonicalRevisionGraph, canonicalTask, decodeFlowDocument, decodeRevision, decodeRevisionContent, digestBytes, encodeRevision, maxJsonDepth, repairRevision, revisionRepairKind, triggerRuntimeJson };
9895
+ export { canonicalDocument, canonicalGraph, canonicalJsonBytes, canonicalModule, canonicalPorts, canonicalRevisionGraph, canonicalTask, cleanWorkflowFile, decodeFlowDocument, decodeRevision, decodeRevisionContent, decodeWorkflowFile, digestBytes, encodeRevision, encodeWorkflowFile, maxJsonDepth, parseWorkflowFile, repairRevision, revisionRepairKind, triggerRuntimeJson, workflowFileName, workflowNameFromFile };
@@ -1,3 +1,4 @@
1
+ import type { CanvasCommand } from '../common/canvas-commands.js';
1
2
  export type FlowCatalogEvent = {
2
3
  readonly kind: 'flows.changed';
3
4
  readonly version: 1;
@@ -7,6 +8,11 @@ export type FlowCatalogEvent = {
7
8
  readonly version: 1;
8
9
  };
9
10
  export type FlowChangeEvent = {
11
+ readonly kind: 'canvas.command';
12
+ readonly flowId: string;
13
+ readonly command: CanvasCommand;
14
+ readonly version: 1;
15
+ } | {
10
16
  readonly accessRevision: number;
11
17
  readonly flowId: string;
12
18
  readonly kind: 'access.changed';