@oomol-lab/open-flow 0.1.0-beta.78 → 0.1.0-beta.79

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 (35) hide show
  1. package/dist/browser/{createResourceDialog-DCGxfKFM.js → createResourceDialog-DkovGogv.js} +2 -2
  2. package/dist/browser/{dialog-WzR4CRFH.js → dialog-CFFuRM8s.js} +27 -6
  3. package/dist/browser/{flowChanges-Bz4dbDN_.js → flowChanges-CN2R-m1M.js} +59 -40
  4. package/dist/browser/{flowWorkspace-BI6L6a4r.js → flowWorkspace-CXVL1FNv.js} +85 -39
  5. package/dist/browser/preview.js +122 -48
  6. package/dist/browser/{typeScriptSession-CRoezJPN.js → typeScriptSession-CoEIptNC.js} +1 -1
  7. package/dist/browser/workbench.js +4 -4
  8. package/dist/browser/{workbenchSelect-DtAd0zc4.js → workbenchSelect-CkOS95gX.js} +1 -1
  9. package/dist/command/index.js +29 -29
  10. package/dist/common/control-api-conformance.js +80 -7
  11. package/dist/common/control-api.d.ts +3 -2
  12. package/dist/common/control-api.js +40 -7
  13. package/dist/common/control-requests.d.ts +5 -0
  14. package/dist/common/control-requests.js +28 -5
  15. package/dist/common/flow-authoring.js +26 -5
  16. package/dist/common/flow-change.js +26 -5
  17. package/dist/common/flow-encoding.js +26 -5
  18. package/dist/common/flow-semantics.js +26 -5
  19. package/dist/common/flow-state.d.ts +33 -4
  20. package/dist/common/flow-state.js +49 -6
  21. package/dist/common/mcp.d.ts +32 -1
  22. package/dist/common/mcp.js +40 -8
  23. package/dist/common/runtime-contract.d.ts +4 -1
  24. package/dist/common/runtime-contract.js +60 -5
  25. package/dist/common/scheduler.js +26 -5
  26. package/dist/index.d.ts +1 -0
  27. package/package.json +1 -1
  28. package/src/control/common/api.ts +16 -4
  29. package/src/control/common/conformance.ts +31 -0
  30. package/src/control/common/mcp.ts +7 -2
  31. package/src/control/common/requests.ts +3 -0
  32. package/src/runtime/common/runtime.ts +39 -5
  33. package/src/state/common/conformance.ts +16 -0
  34. package/src/state/common/state.ts +41 -8
  35. package/src/types/index.ts +1 -0
@@ -59911,13 +59911,24 @@ function httpRequestIssues(config) {
59911
59911
  }
59912
59912
  return issues;
59913
59913
  }
59914
+ //#endregion
59915
+ //#region src/state/common/state.ts
59916
+ var stateReadLimits = {
59917
+ maxKeys: 16,
59918
+ maxBytes: 1048576
59919
+ };
59920
+ var keySchema = string$1().min(1).refine((value) => new TextEncoder().encode(value).length <= 256);
59921
+ strictObject({
59922
+ scope: _enum(["draft", "live"]),
59923
+ values: literal(false).optional()
59924
+ });
59914
59925
  strictObject({
59915
59926
  scope: _enum(["draft", "live"]),
59916
- values: boolean().optional()
59927
+ keys: array(keySchema).min(1).max(stateReadLimits.maxKeys).refine((keys) => new Set(keys).size === keys.length, "State keys must be distinct.")
59917
59928
  });
59918
59929
  strictObject({
59919
59930
  scope: _enum(["draft", "live"]),
59920
- key: string$1().min(1).refine((key) => new TextEncoder().encode(key).length <= 256).optional()
59931
+ key: keySchema.optional()
59921
59932
  });
59922
59933
  strictObject({
59923
59934
  scope: _enum(["draft", "live"]),
@@ -59935,11 +59946,10 @@ object$2({
59935
59946
  maxIdentities: number().positive(),
59936
59947
  maxRunWrites: number().positive()
59937
59948
  }),
59938
- values: array(object$2({
59949
+ values: array(strictObject({
59939
59950
  key: string$1(),
59940
59951
  size: number().nonnegative(),
59941
- updatedAt: number(),
59942
- value: json$4().optional()
59952
+ updatedAt: number()
59943
59953
  })),
59944
59954
  spaces: array(object$2({
59945
59955
  space: string$1(),
@@ -59949,6 +59959,17 @@ object$2({
59949
59959
  updatedAt: number()
59950
59960
  }))
59951
59961
  });
59962
+ object$2({
59963
+ version: literal(1),
59964
+ scope: _enum(["draft", "live"]),
59965
+ values: array(strictObject({
59966
+ key: keySchema,
59967
+ value: json$4()
59968
+ })).min(1).max(stateReadLimits.maxKeys)
59969
+ }).refine((response) => {
59970
+ const encoder = new TextEncoder();
59971
+ return response.values.reduce((bytes, item) => bytes + (item.value === null ? 0 : encoder.encode(JSON.stringify(item.value)).byteLength), 0) <= stateReadLimits.maxBytes;
59972
+ }, "State values exceed the 1 MiB read limit.");
59952
59973
  function checkJsonDepth(value, depth = 0) {
59953
59974
  if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
59954
59975
  if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
@@ -97080,7 +97101,7 @@ function CodeEditor({ ariaDescribedBy, ariaLabel, diagnostics, disabled, errorLa
97080
97101
  darkMode.current = darkMode$;
97081
97102
  setFailed(false);
97082
97103
  setLoading(true);
97083
- const extension = import("./typeScriptSession-CRoezJPN.js").then(({ loadTypeScriptExtension }) => loadTypeScriptExtension(uri, typingRef.current, () => prepareCompletionRef.current?.())).catch(() => void 0);
97104
+ const extension = import("./typeScriptSession-CoEIptNC.js").then(({ loadTypeScriptExtension }) => loadTypeScriptExtension(uri, typingRef.current, () => prepareCompletionRef.current?.())).catch(() => void 0);
97084
97105
  claimEditor(uri).then((nextRelease) => {
97085
97106
  release = nextRelease;
97086
97107
  if (disposed) {
@@ -97167,7 +97188,7 @@ function CodeEditor({ ariaDescribedBy, ariaLabel, diagnostics, disabled, errorLa
97167
97188
  editor.current?.updateOptions({ ariaDescribedBy });
97168
97189
  }, [ariaDescribedBy]);
97169
97190
  useEffect(() => {
97170
- import("./typeScriptSession-CRoezJPN.js").then(({ updateTypeScriptTyping }) => updateTypeScriptTyping(uri, typing)).catch(noop);
97191
+ import("./typeScriptSession-CoEIptNC.js").then(({ updateTypeScriptTyping }) => updateTypeScriptTyping(uri, typing)).catch(noop);
97171
97192
  }, [typing, uri]);
97172
97193
  useEffect(() => {
97173
97194
  if (location != null) editor.current?.revealPosition?.(location.line, location.column);
@@ -103165,7 +103186,8 @@ var resources = {
103165
103186
  "nearLimit": "Flow history is at least 80% full. Clear unused history.",
103166
103187
  "history": "History",
103167
103188
  "scope": "Scope",
103168
- "showValues": "Show values",
103189
+ "showValue": "View value",
103190
+ "hideValue": "Hide value",
103169
103191
  "refresh": "Refresh",
103170
103192
  "confirmLive": "This clears production state immediately. Future Live Runs may process these items again. Continue?",
103171
103193
  "cancel": "Cancel",
@@ -104519,7 +104541,8 @@ var resources = {
104519
104541
  "nearLimit": "该流程的去重记录已使用至少 80%。请清理不再需要的记录。",
104520
104542
  "history": "历史记录",
104521
104543
  "scope": "作用域",
104522
- "showValues": "显示值",
104544
+ "showValue": "查看值",
104545
+ "hideValue": "收起值",
104523
104546
  "refresh": "刷新",
104524
104547
  "confirmLive": "这将立即清空生产状态,后续 Live Run 可能再次处理这些条目。是否继续?",
104525
104548
  "cancel": "取消",
@@ -105873,7 +105896,8 @@ var resources = {
105873
105896
  "nearLimit": "此流程的去重記錄已使用至少 80%。請清理不再需要的記錄。",
105874
105897
  "history": "歷史記錄",
105875
105898
  "scope": "範圍",
105876
- "showValues": "顯示值",
105899
+ "showValue": "檢視值",
105900
+ "hideValue": "收合值",
105877
105901
  "refresh": "重新整理",
105878
105902
  "confirmLive": "這會立即清空正式環境狀態,後續 Live Run 可能再次處理這些項目。是否繼續?",
105879
105903
  "cancel": "取消",
@@ -107227,7 +107251,8 @@ var resources = {
107227
107251
  "nearLimit": "フローの重複履歴が 80% 以上使用されています。不要な履歴を削除してください。",
107228
107252
  "history": "履歴",
107229
107253
  "scope": "スコープ",
107230
- "showValues": "値を表示",
107254
+ "showValue": "値を表示",
107255
+ "hideValue": "値を隠す",
107231
107256
  "refresh": "更新",
107232
107257
  "confirmLive": "本番環境の状態が直ちに消去されます。以降の Live Run で同じ項目が再処理される場合があります。続行しますか?",
107233
107258
  "cancel": "キャンセル",
@@ -108581,7 +108606,8 @@ var resources = {
108581
108606
  "nearLimit": "Flow 중복 기록이 80% 이상 찼습니다. 필요 없는 기록을 지우세요.",
108582
108607
  "history": "기록",
108583
108608
  "scope": "범위",
108584
- "showValues": "값 표시",
108609
+ "showValue": "값 보기",
108610
+ "hideValue": "값 숨기기",
108585
108611
  "refresh": "새로 고침",
108586
108612
  "confirmLive": "운영 상태가 즉시 지워집니다. 이후 Live Run에서 해당 항목을 다시 처리할 수 있습니다. 계속할까요?",
108587
108613
  "cancel": "취소",
@@ -109935,7 +109961,8 @@ var resources = {
109935
109961
  "nearLimit": "История Flow заполнена минимум на 80 %. Удалите ненужные записи.",
109936
109962
  "history": "История",
109937
109963
  "scope": "Область",
109938
- "showValues": "Показать значения",
109964
+ "showValue": "Показать значение",
109965
+ "hideValue": "Скрыть значение",
109939
109966
  "refresh": "Обновить",
109940
109967
  "confirmLive": "Рабочее состояние будет немедленно очищено. Последующие Live Run могут повторно обработать эти элементы. Продолжить?",
109941
109968
  "cancel": "Отмена",
@@ -111289,7 +111316,8 @@ var resources = {
111289
111316
  "nearLimit": "L’historique du Flow est rempli à au moins 80 %. Effacez les entrées inutiles.",
111290
111317
  "history": "Historique",
111291
111318
  "scope": "Portée",
111292
- "showValues": "Afficher les valeurs",
111319
+ "showValue": "Voir la valeur",
111320
+ "hideValue": "Masquer la valeur",
111293
111321
  "refresh": "Actualiser",
111294
111322
  "confirmLive": "L’état de production sera immédiatement effacé. Les prochains Runs Live pourront traiter à nouveau ces éléments. Continuer ?",
111295
111323
  "cancel": "Annuler",
@@ -113287,7 +113315,70 @@ function EventSourceTriggerConfig({ inputs, provider = "feishu_app_bot", fieldLa
113287
113315
  }
113288
113316
  //#endregion
113289
113317
  //#region src/workbench/browser/runtime/editor/flowStatePanel.tsx
113290
- function FlowStatePanel({ value, nodeIds, busy, onClearValues, onClearSpace, space }) {
113318
+ function StateValueRow({ item, client, flowId, scope, busy, onClear }) {
113319
+ const t = useTranslate();
113320
+ const [open, setOpen] = useState(false);
113321
+ const [result, setResult] = useState();
113322
+ const [error, setError] = useState();
113323
+ useEffect(() => {
113324
+ if (!open) return;
113325
+ const controller = new AbortController();
113326
+ setResult(void 0);
113327
+ setError(void 0);
113328
+ client.getFlowStateValues(flowId, scope, [item.key], controller.signal).then((response) => {
113329
+ if (!controller.signal.aborted) setResult(response.values[0]);
113330
+ }, (reason) => {
113331
+ if (!controller.signal.aborted) setError(String(reason));
113332
+ });
113333
+ return () => controller.abort();
113334
+ }, [
113335
+ client,
113336
+ flowId,
113337
+ scope,
113338
+ item.key,
113339
+ item.updatedAt,
113340
+ open
113341
+ ]);
113342
+ return /* @__PURE__ */ jsxs("div", {
113343
+ className: "flex items-start justify-between gap-3 border-b border-border/60 py-2",
113344
+ children: [/* @__PURE__ */ jsxs("div", {
113345
+ className: "min-w-0 flex-1",
113346
+ children: [/* @__PURE__ */ jsx("p", {
113347
+ className: "m-0 break-all font-medium",
113348
+ children: item.key
113349
+ }), open && (result != null ? /* @__PURE__ */ jsx("pre", {
113350
+ className: "max-h-40 overflow-auto whitespace-pre-wrap break-all text-xs",
113351
+ children: JSON.stringify(result.value, null, 2)
113352
+ }) : error != null ? /* @__PURE__ */ jsx("p", {
113353
+ role: "alert",
113354
+ className: "text-destructive text-sm",
113355
+ children: error
113356
+ }) : /* @__PURE__ */ jsx("p", {
113357
+ role: "status",
113358
+ className: "text-muted-foreground text-sm",
113359
+ children: t("flowState.loading")
113360
+ }))]
113361
+ }), /* @__PURE__ */ jsxs("div", {
113362
+ className: "flex shrink-0 gap-2",
113363
+ children: [/* @__PURE__ */ jsx(Button$1, {
113364
+ variant: "outline",
113365
+ size: "sm",
113366
+ disabled: busy,
113367
+ "aria-expanded": open,
113368
+ "aria-label": `${t(open ? "flowState.hideValue" : "flowState.showValue")}: ${item.key}`,
113369
+ onClick: () => setOpen((value) => !value),
113370
+ children: t(open ? "flowState.hideValue" : "flowState.showValue")
113371
+ }), /* @__PURE__ */ jsx(Button$1, {
113372
+ variant: "outline",
113373
+ size: "sm",
113374
+ disabled: busy,
113375
+ onClick: (event) => onClear(item.key, event.currentTarget),
113376
+ children: t("flowState.delete")
113377
+ })]
113378
+ })]
113379
+ });
113380
+ }
113381
+ function FlowStatePanel({ value, client, flowId, nodeIds, busy, onClearValues, onClearSpace, space }) {
113291
113382
  const t = useTranslate();
113292
113383
  const count = value.spaces.reduce((total, item) => total + item.reservedCount, 0);
113293
113384
  const spaces = space == null ? value.spaces : value.spaces.filter((item) => item.space === space);
@@ -113323,24 +113414,13 @@ function FlowStatePanel({ value, nodeIds, busy, onClearValues, onClearSpace, spa
113323
113414
  className: "m-0 text-sm text-muted-foreground",
113324
113415
  children: t("flowState.emptyValues")
113325
113416
  }),
113326
- value.values.map((item) => /* @__PURE__ */ jsxs("div", {
113327
- className: "flex items-start justify-between gap-3 border-b border-border/60 py-2",
113328
- children: [/* @__PURE__ */ jsxs("div", {
113329
- className: "min-w-0",
113330
- children: [/* @__PURE__ */ jsx("p", {
113331
- className: "m-0 break-all font-medium",
113332
- children: item.key
113333
- }), item.value !== void 0 && /* @__PURE__ */ jsx("pre", {
113334
- className: "max-h-40 overflow-auto whitespace-pre-wrap break-all text-xs",
113335
- children: JSON.stringify(item.value, null, 2)
113336
- })]
113337
- }), /* @__PURE__ */ jsx(Button$1, {
113338
- variant: "outline",
113339
- size: "sm",
113340
- disabled: busy,
113341
- onClick: (event) => onClearValues(item.key, event.currentTarget),
113342
- children: t("flowState.delete")
113343
- })]
113417
+ value.values.map((item) => /* @__PURE__ */ jsx(StateValueRow, {
113418
+ item,
113419
+ client,
113420
+ flowId,
113421
+ scope: value.scope,
113422
+ busy,
113423
+ onClear: onClearValues
113344
113424
  }, item.key))
113345
113425
  ]
113346
113426
  }), /* @__PURE__ */ jsxs("section", {
@@ -113411,7 +113491,6 @@ function FlowStateButton({ client, flowId, nodeIds, history, onClose }) {
113411
113491
  const [open, setOpen] = useState(onClose != null);
113412
113492
  const [scope, setScope] = useState("draft");
113413
113493
  const space = history == null ? void 0 : `node:${history.nodeId}`;
113414
- const [values, setValues] = useState(false);
113415
113494
  const [data, setData] = useState();
113416
113495
  const [error, setError] = useState();
113417
113496
  const [busy, setBusy] = useState(false);
@@ -113431,7 +113510,7 @@ function FlowStateButton({ client, flowId, nodeIds, history, onClose }) {
113431
113510
  let active = true;
113432
113511
  setData(void 0);
113433
113512
  setError(void 0);
113434
- client.getFlowState(flowId, scope, values).then((result) => {
113513
+ client.getFlowState(flowId, scope).then((result) => {
113435
113514
  if (active) setData(result);
113436
113515
  }, (reason) => {
113437
113516
  if (active) setError(String(reason));
@@ -113443,7 +113522,6 @@ function FlowStateButton({ client, flowId, nodeIds, history, onClose }) {
113443
113522
  client,
113444
113523
  flowId,
113445
113524
  scope,
113446
- values,
113447
113525
  refresh,
113448
113526
  open,
113449
113527
  space
@@ -113475,10 +113553,7 @@ function FlowStateButton({ client, flowId, nodeIds, history, onClose }) {
113475
113553
  onOpenChange: (next) => {
113476
113554
  if (!busy) {
113477
113555
  setOpen(next);
113478
- if (next) {
113479
- setScope("draft");
113480
- setValues(false);
113481
- }
113556
+ if (next) setScope("draft");
113482
113557
  if (!next) onClose?.();
113483
113558
  setConfirm(void 0);
113484
113559
  }
@@ -113517,13 +113592,6 @@ function FlowStateButton({ client, flowId, nodeIds, history, onClose }) {
113517
113592
  children: t("flowState.live")
113518
113593
  })]
113519
113594
  }),
113520
- space == null && (values || (data?.values.length ?? 0) > 0) && /* @__PURE__ */ jsxs(Label, {
113521
- className: "flex items-center gap-2 text-sm",
113522
- children: [/* @__PURE__ */ jsx(Checkbox, {
113523
- checked: values,
113524
- onCheckedChange: setValues
113525
- }), t("flowState.showValues")]
113526
- }),
113527
113595
  /* @__PURE__ */ jsx(Button$1, {
113528
113596
  variant: "outline",
113529
113597
  size: "sm",
@@ -113603,12 +113671,18 @@ function FlowStateButton({ client, flowId, nodeIds, history, onClose }) {
113603
113671
  children: error == null ? t("flowState.loading") : ""
113604
113672
  }) : /* @__PURE__ */ jsx(FlowStatePanel, {
113605
113673
  value: data,
113674
+ client,
113675
+ flowId,
113606
113676
  space,
113607
113677
  nodeIds,
113608
113678
  busy,
113609
113679
  onClearValues: (key, trigger) => request({ key }, trigger),
113610
113680
  onClearSpace: (targetSpace, trigger) => request({ space: targetSpace }, trigger)
113611
- })
113681
+ }, JSON.stringify([
113682
+ flowId,
113683
+ scope,
113684
+ refresh
113685
+ ]))
113612
113686
  ]
113613
113687
  })]
113614
113688
  })