@agimon-ai/po-workflow 0.0.0-alpha.225 → 0.0.0-alpha.227

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.
@@ -2,7 +2,7 @@ import { createApiClient, defineActivityGroup, defineChannelFile, defineDockFace
2
2
  import { View } from "react-native-unistyles/components/native/View";
3
3
  import { Text } from "react-native-unistyles/components/native/Text";
4
4
  import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
5
- import { ArrowRightIcon, Badge, Button, ChevronDownIcon, ChevronRightIcon, CodeBlock, Dot, EmptyState, FileIcon, FolderIcon, Input, Label, ListRow, LiveDuration, LoadingState, Markdown, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, SearchIcon, SegmentedControl, Select, Sheet, SheetBody, SheetContent, SheetHeader, SheetList, SheetTitle, Spinner, StatusBadge, Switch, Textarea, WorkflowIcon, fontOf, toolTone } from "@agimon-ai/po-native-components";
5
+ import { ArrowRightIcon, Badge, Button, ChevronDownIcon, ChevronRightIcon, CodeBlock, Dot, EmptyState, FileIcon, FolderIcon, InfoStrip, Input, Label, ListRow, LiveDuration, LoadingState, Markdown, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, SearchIcon, SegmentedControl, Select, Sheet, SheetBody, SheetContent, SheetHeader, SheetList, SheetTitle, Spinner, StatusBadge, Switch, Textarea, WorkflowIcon, fontOf, toolTone } from "@agimon-ai/po-native-components";
6
6
  import { createElement, memo, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
7
7
  import { StyleSheet } from "react-native-unistyles";
8
8
  import { Pressable } from "react-native-unistyles/components/native/Pressable";
@@ -84,7 +84,7 @@ function pendingLaunchName(workflowPath) {
84
84
  function detailOf(run, tone, t) {
85
85
  if (tone === "paused") return t("workflow.ui.activity.pausedDetail", "paused; resume it from the owning session");
86
86
  if (tone === "waiting") return t("workflow.ui.activity.waitingDetail", "waiting for your approval");
87
- if (tone === "failed") return run.errorMessage ?? (run.failedJob === void 0 ? t("workflow.ui.activity.failedDetail", "failed") : t("workflow.ui.activity.jobFailedDetail", "job '{job}' failed", { job: run.failedJob }));
87
+ if (tone === "failed") return run.failedJob === void 0 ? t("workflow.ui.workflowRunProblem", "Po couldn’t finish this workflow run.") : t("workflow.ui.activity.jobFailedDetail", "job '{job}' failed", { job: run.failedJob });
88
88
  if (tone === "running") {
89
89
  if (run.position === void 0) return t("workflow.ui.activity.startingDetail", "starting");
90
90
  return run.position.step === void 0 ? run.position.job : `${run.position.job} · ${run.position.step}`;
@@ -930,7 +930,7 @@ function attentionFor(run, t = (_key, english, vars) => english.replace(/\{(\w+)
930
930
  };
931
931
  }
932
932
  if (run.stage === "error") {
933
- const cause = run.errorMessage ?? t("workflow.ui.attention.error", "the run ended in the error stage");
933
+ const cause = t("workflow.ui.workflowRunProblem", "Po couldn’t finish this workflow run.");
934
934
  return {
935
935
  kind: "error",
936
936
  text: run.failedJob === void 0 ? cause : t("workflow.ui.attention.jobFailed", "job '{job}' failed: {cause}", {
@@ -1063,6 +1063,10 @@ function runSearchText(run) {
1063
1063
  function isLive(run) {
1064
1064
  return run.stage === "running" || run.waiting === true;
1065
1065
  }
1066
+ /** True while a run is actively executing in the background (not stale, waiting for approval, or paused). */
1067
+ function isRunningInBackground(run) {
1068
+ return run.stage === "running" && run.stale !== true && run.waiting !== true && (run.executionState === void 0 || run.executionState === "running");
1069
+ }
1066
1070
  /** The step session holding a pending approval request, if this run is waiting on a session step. */
1067
1071
  function waitingStepSessionId(run) {
1068
1072
  if (!run.waiting) return void 0;
@@ -1523,10 +1527,10 @@ function ItemRow({ item, run, now, defaultExpanded, onOpenAgent }) {
1523
1527
  style: styles$10.dim,
1524
1528
  children: t("workflow.ui.stepExecutionState", "Step: {state}", { state: workflowStatusLabel(t, phase.executionStatus) })
1525
1529
  }),
1526
- phase.error && /* @__PURE__ */ jsx(Text, {
1527
- accessibilityRole: phase.status === "failed" ? "alert" : void 0,
1528
- style: phase.status === "failed" ? styles$10.error : styles$10.dim,
1529
- children: phase.error
1530
+ phase.status === "failed" && /* @__PURE__ */ jsx(Text, {
1531
+ accessibilityRole: "alert",
1532
+ style: styles$10.error,
1533
+ children: t("workflow.ui.workflowStepProblem", "Po couldn’t finish this step.")
1530
1534
  }),
1531
1535
  phase.agents.map((agent, index) => /* @__PURE__ */ jsxs(View, {
1532
1536
  style: styles$10.inline,
@@ -1561,15 +1565,7 @@ function DynamicWorkflowView({ runs, now, connected = true, defaultExpandedKeys
1561
1565
  contentContainerStyle: styles$10.content,
1562
1566
  accessibilityLabel: t("workflow.ui.dynamicWorkflows", "Dynamic workflows"),
1563
1567
  children: [
1564
- !connected && /* @__PURE__ */ jsxs(Text, {
1565
- accessibilityRole: "alert",
1566
- style: styles$10.notice,
1567
- children: [
1568
- " ",
1569
- t("workflow.ui.connectionPausedTheseAreTheLastReportedWorkflowStates", "Connection paused. These are the last reported workflow states."),
1570
- " "
1571
- ]
1572
- }),
1568
+ !connected && /* @__PURE__ */ jsx(InfoStrip, { message: t("workflow.ui.connectionPausedTheseAreTheLastReportedWorkflowStates", "Connection paused. These are the last reported workflow states.") }),
1573
1569
  !runs.length && /* @__PURE__ */ jsx(EmptyState, {
1574
1570
  surface: "plain",
1575
1571
  icon: /* @__PURE__ */ jsx(WorkflowIcon, { size: 20 }),
@@ -1604,10 +1600,10 @@ function DynamicWorkflowView({ runs, now, connected = true, defaultExpandedKeys
1604
1600
  children: t("workflow.ui.executionStateCaption", " · Execution: {state}", { state: workflowStatusLabel(t, run.executionStatus) })
1605
1601
  })]
1606
1602
  }),
1607
- run.error && /* @__PURE__ */ jsx(Text, {
1603
+ run.status === "failed" && /* @__PURE__ */ jsx(Text, {
1608
1604
  accessibilityRole: run.status === "failed" ? "alert" : void 0,
1609
1605
  style: run.status === "failed" ? styles$10.error : styles$10.dim,
1610
- children: run.error
1606
+ children: t("workflow.ui.workflowRunProblem", "Po couldn’t finish this workflow run.")
1611
1607
  }),
1612
1608
  run.groups.map((group) => /* @__PURE__ */ jsxs(View, {
1613
1609
  style: styles$10.group,
@@ -1748,17 +1744,6 @@ const styles$10 = StyleSheet.create((theme) => ({
1748
1744
  lineHeight: theme.lineHeight.sm,
1749
1745
  uni__dependencies: [0]
1750
1746
  },
1751
- notice: {
1752
- borderWidth: 1,
1753
- borderColor: theme.colors.border,
1754
- borderRadius: theme.borderRadius.md,
1755
- padding: theme.spacing(3),
1756
- color: theme.colors.dim,
1757
- fontFamily: fontOf(theme.fontFamily.sans),
1758
- fontSize: theme.fontSize.base,
1759
- lineHeight: theme.lineHeight.base,
1760
- uni__dependencies: [0]
1761
- },
1762
1747
  group: {
1763
1748
  minWidth: 0,
1764
1749
  borderWidth: 1,
@@ -2324,7 +2309,7 @@ function WorkflowDockView({ run, runs, now, sheet = false, dockHeader, artifacts
2324
2309
  const failedStep = run ? failedStepLocation(run) : void 0;
2325
2310
  const live = run ? isLive(run) : false;
2326
2311
  const effectiveMode = mode === "stop" && !live ? "overview" : mode === "delete" && (!run || live) ? "overview" : mode;
2327
- const attentionText = attention?.kind === "paused" ? t("workflow.ui.attention.resumeNotice", "Waiting to be resumed.") : attention?.kind === "waiting" ? `${attention.text.charAt(0).toUpperCase()}${attention.text.slice(1)}.` : run?.errorMessage ?? run?.staleReason ?? (attention?.kind === "stale" ? t("workflow.ui.attention.staleNotice", "This run is no longer reporting progress.") : attention?.text);
2312
+ const attentionText = attention?.kind === "paused" ? t("workflow.ui.attention.resumeNotice", "Waiting to be resumed.") : attention?.kind === "waiting" ? `${attention.text.charAt(0).toUpperCase()}${attention.text.slice(1)}.` : run?.staleReason ?? (attention?.kind === "stale" ? t("workflow.ui.attention.staleNotice", "This run is no longer reporting progress.") : attention?.text);
2328
2313
  const List = sheet ? SheetList : FlatList;
2329
2314
  const header = /* @__PURE__ */ jsxs(Fragment, { children: [
2330
2315
  dockHeader,
@@ -4379,7 +4364,7 @@ var workflows_native_default = defineActivityGroup({
4379
4364
  };
4380
4365
  },
4381
4366
  isActive(sessionId) {
4382
- return workflows.select(workflows.store.state, sessionId).runs.some(isLive) || (dynamicWorkflows.select(dynamicWorkflows.store.state, sessionId)?.runs.some((run) => run.status === "running") ?? false);
4367
+ return workflows.select(workflows.store.state, sessionId).runs.some(isRunningInBackground) || (dynamicWorkflows.select(dynamicWorkflows.store.state, sessionId)?.runs.some((run) => run.status === "running") ?? false);
4383
4368
  }
4384
4369
  }
4385
4370
  });
@@ -4421,10 +4406,11 @@ function useDynamicWorkflows(sessionId) {
4421
4406
  }, []);
4422
4407
  return useSyncExternalStore(subscribe, () => dynamicWorkflows.select(dynamicWorkflows.store.state, sessionId));
4423
4408
  }
4424
- function DynamicWorkflowPanel({ sessionId, openTransientTab }) {
4409
+ function DynamicWorkflowPanel({ sessionId, openTransientTab, connected = sessionId !== null }) {
4425
4410
  const snapshot = useDynamicWorkflows(sessionId);
4426
4411
  return /* @__PURE__ */ jsx(DynamicWorkflowView, {
4427
4412
  runs: snapshot?.runs ?? EMPTY_RUNS,
4413
+ connected,
4428
4414
  onOpenAgent: (runId, session) => {
4429
4415
  if (sessionId !== null) openTransientTab(workflowAgentTab(runId, session));
4430
4416
  }