@agimon-ai/po-workflow 0.0.0-alpha.21 → 0.0.0-alpha.210

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 (58) hide show
  1. package/LICENSE +110 -149
  2. package/README.md +155 -53
  3. package/dist/apiContracts.cjs +205 -36
  4. package/dist/apiContracts.cjs.map +1 -1
  5. package/dist/apiContracts.d.mts +2 -2
  6. package/dist/apiContracts.d.mts.map +1 -1
  7. package/dist/apiContracts.mjs +205 -36
  8. package/dist/apiContracts.mjs.map +1 -1
  9. package/dist/contract-BpzJeyjh.mjs +33 -0
  10. package/dist/contract-BpzJeyjh.mjs.map +1 -0
  11. package/dist/contract-D80yV2d-.cjs +68 -0
  12. package/dist/contract-D80yV2d-.cjs.map +1 -0
  13. package/dist/extensions/native.mjs +4643 -1020
  14. package/dist/extensions/native.mjs.map +1 -1
  15. package/dist/extensions/server.cjs +21507 -3593
  16. package/dist/extensions/server.cjs.map +1 -1
  17. package/dist/extensions/server.d.mts.map +1 -1
  18. package/dist/extensions/server.mjs +21495 -3558
  19. package/dist/extensions/server.mjs.map +1 -1
  20. package/dist/extensions/web.mjs +5224 -2610
  21. package/dist/extensions/web.mjs.map +1 -1
  22. package/dist/index-CxS__mkJ.d.mts +5210 -0
  23. package/dist/index-CxS__mkJ.d.mts.map +1 -0
  24. package/dist/index.cjs +41 -3
  25. package/dist/index.cjs.map +1 -0
  26. package/dist/index.d.mts +104 -4
  27. package/dist/index.d.mts.map +1 -1
  28. package/dist/index.mjs +38 -1
  29. package/dist/index.mjs.map +1 -0
  30. package/dist/po-runtime-identity.json +1 -0
  31. package/dist/workflowHost-B8ludUOG.cjs +4190 -0
  32. package/dist/workflowHost-B8ludUOG.cjs.map +1 -0
  33. package/dist/workflowHost-DB4GtWpM.mjs +3974 -0
  34. package/dist/workflowHost-DB4GtWpM.mjs.map +1 -0
  35. package/dist/workflowHost.cjs +7 -0
  36. package/dist/workflowHost.d.mts +29 -0
  37. package/dist/workflowHost.d.mts.map +1 -0
  38. package/dist/workflowHost.mjs +3 -0
  39. package/dist/workflowServices-CSHleLJo.mjs +273 -0
  40. package/dist/workflowServices-CSHleLJo.mjs.map +1 -0
  41. package/dist/workflowServices-DYXhIDVE.cjs +350 -0
  42. package/dist/workflowServices-DYXhIDVE.cjs.map +1 -0
  43. package/llms.txt +10 -8
  44. package/locales/vi.json +492 -0
  45. package/locales/zh-CN.json +492 -0
  46. package/package.json +150 -26
  47. package/src/prompts/codemode-how-to-workflow/SKILL.md +226 -0
  48. package/src/prompts/help-how-to-workflow/SKILL.md +185 -0
  49. package/src/prompts/help-how-to-workflow-settings/SKILL.md +33 -0
  50. package/src/types/webWorkflowTerminal.ts +21 -0
  51. package/src/types/webWorkflows.ts +52 -2
  52. package/dist/workflowLaunchCommand-C69Nn3k5.cjs +0 -139
  53. package/dist/workflowLaunchCommand-C69Nn3k5.cjs.map +0 -1
  54. package/dist/workflowLaunchCommand-GGqimmTC.mjs +0 -122
  55. package/dist/workflowLaunchCommand-GGqimmTC.mjs.map +0 -1
  56. package/skills/workflow-recovery/SKILL.md +0 -85
  57. package/src/prompts/po-author-workflow/SKILL.md +0 -64
  58. package/src/prompts/po-use-workflow/SKILL.md +0 -21
@@ -0,0 +1,185 @@
1
+ ---
2
+ name: help-how-to-workflow
3
+ description: Author and maintain Po workflow graphs, validate commands and artifacts, and scaffold definitions in Help mode.
4
+ ---
5
+
6
+ # Workflow authoring and maintenance
7
+
8
+ `@agimon-ai/po-workflow` owns persisted YAML execution and the `workflow` and `dynamicWorkflow` code-mode namespaces. Select the workflow layer in presets.yaml. There is no workflow mode. Load `codemode-how-to-workflow` for launching, monitoring and recovery.
9
+
10
+ In Help mode, use `workflowAdmin.scaffold` in `exec` to create a YAML skeleton. Choose an explicit skeleton with `preset`; omitting it preserves the existing `dag` skeleton. Existing files require explicit `force: true` to overwrite. Where the session has stored sets (Po Cloud's `org` and `personal`, or a self-hosted Worker's `host`), pass `source` with a plain file name to create the skeleton there instead of in the repository; stored workflows cannot use imports or relative tools and instructions paths. Scaffolding writes a definition, it does not launch agents or run commands. Review and customize the generated file before running it.
11
+
12
+ ## Choose a workflow type
13
+
14
+ | Preset | Use when | Completion authority |
15
+ | ---------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------- |
16
+ | `dag` | Jobs and their dependencies are known before launch. | Job/step outcomes and declared artifacts. |
17
+ | `child-review` | One producer owns the work and repairs, while independent child jobs attest acceptance criteria. | Current immutable artifact checks from the authorized child verifiers. |
18
+ | `dynamic-fanout` | A step discovers a bounded item list at runtime and needs tracked per-item work. | The enclosing step's outcome and persisted results, not independent acceptance. |
19
+
20
+ Call `workflowAdmin.scaffold` with one of these inputs:
21
+
22
+ ```ts
23
+ await workflowAdmin.scaffold({ path: 'automations/check.workflow.yml', preset: 'dag' });
24
+ await workflowAdmin.scaffold({ path: 'automations/produce.workflow.yml', preset: 'child-review' });
25
+ await workflowAdmin.scaffold({ path: 'automations/items.workflow.yml', preset: 'dynamic-fanout' });
26
+ ```
27
+
28
+ Do not turn independent acceptance into ordinary Team fan-out: a producer's summary of another agent's opinion is not an authorized criterion report. Conversely, use the simpler `dag` or `dynamic-fanout` contract when independent attestation is not required. Managed agent skeletons require the Po server; they are not shell/CLI-only workflows. Replace the example brief and set `runConfig.preset` to an existing preset with the workflow layer. A `dynamic-fanout` skeleton also needs Team in that preset. Pin available models under the producer/reviewer job `runConfig` when the task requires distinct models, never invent model IDs.
29
+
30
+ # Author Po workflows
31
+
32
+ Create a `*.workflow.yml` file and keep its graph explicit:
33
+
34
+ ```yaml
35
+ name: verify
36
+
37
+ jobs:
38
+ test:
39
+ steps:
40
+ - name: Run tests
41
+ run: pnpm test
42
+
43
+ summarize:
44
+ needs: test
45
+ steps:
46
+ - name: Record result
47
+ run: node scripts/write-verification-summary.mjs
48
+ ```
49
+
50
+ `needs` expresses job ordering. Keep steps small enough that failure evidence identifies the command that needs attention. Use runner-specific `interactiveRun` configuration when a command genuinely requires a TTY.
51
+
52
+ For an agent step, declare the command once under `commands` (usually in an imported file) and let the step name it. A command is a Liquid template; `inProcess: true` lets the Po server run it as a child session instead of the shell, and the CLI and the TUI run the rendered command:
53
+
54
+ ```yaml
55
+ imports: [commands.yml]
56
+ choices:
57
+ default: { model: openai-codex/gpt-6-sol, thinking: medium }
58
+ jobs:
59
+ develop:
60
+ steps:
61
+ - name: Develop
62
+ runConfig: { preset: dev, domains: [engineering] }
63
+ systemPrompt: ${{ env.JOB_SYSTEM_PROMPT }}
64
+ prompt: ${{ env.WORKFLOW_CONTEXT }}
65
+ interactiveRun: [{ command: po }, { command: terminal }]
66
+ ```
67
+
68
+ `po` and `terminal` are the commands `commands.yml` declares; a step can only name a declared command. `runConfig` takes `preset`, `modes`, `profile`, `domains`, `model`, and `thinking`, plus any key the template reads; any other key fails the step, so a typo such as `prest` never runs on workspace defaults. `choices` compose model and thinking, with per-command overrides such as `terminal: { model: openai-codex/gpt-6-luna }`; a step can pin `choice:`, and a launch picks `command=` and `choice=` for the rest. Templates must quote prompts with `{{ prompt | shell }}`.
69
+
70
+ A command that only the Po server should run, such as `po: { inProcess: true }`, leaves out `run`. Its steps then fail in the CLI and the TUI, which have no shell command to run, instead of starting an agent outside Po.
71
+
72
+ After scaffolding and before launch, use `workflow.validate({ workflowPath, inputs, env, command, choice, runner, profile, job })` in code mode with the intended launch settings. Omit optional settings you do not need. Read diagnostic codes, locations and corrective messages; fix errors, then revalidate after edits. This checks the imported/extended graph and actual command binding resolution, not just the YAML schema. It checks required/default inputs and declared options/types, missing injected references, command/choice settings, effective runConfig and interpolation phases. Workflow env and runConfig values are literal where execution leaves them literal; a prompt cannot read a step-only env override that is installed later.
73
+
74
+ Read the separate `deferred` entries too. Run identities, assembled job prompts, child invocation inputs and conditional context files are not fabricated during validation. Preset/model/profile admission, authentication, shell behavior and produced artifacts still need runtime verification. `valid: true` means no errors detected by the available checks, not guaranteed successful execution. Reports/cards omit binding values; validation does not load secret files or execute steps. Secret availability may remain deferred.
75
+
76
+ Definition diagnostics need code mode: there is no standalone workflow CLI. Fix every error `workflow.validate` reports; the Po server refuses to launch a definition with errors.
77
+
78
+ An agent step ends by recording its outcome with the native workflow tools: `workflow.complete({ summary })`, `workflow.fix({ restartFrom, reason })` or `workflow.fail({ reason })` in code mode, or `workflow_step_complete`, `workflow_step_fix` and `workflow_step_fail` as direct tools. `workflow.context()` shows the step and what it recorded. The engine binds these tools to the step's own session, puts the instructions in its system prompt, and sends an agent that stops without deciding back until it does. Write repair contracts in those terms, not as `fix.md`.
79
+
80
+ What a step or job must leave is held the same way. A step's `artifacts` must be written during the step. A job must be the last to have written each run-directory entry it produces (`produced-by`): an entry an earlier job wrote must be written again, while a retry or a job that skips work it already did keeps its own output, and removing a file counts. Each write is sealed as an immutable version in the run database, recording which job and step wrote it; its bytes stay under `.workflow/versions` in the run directory. An agent step that ends its job is sent back until those entries are written, and the job fails when one was not. List a job under `produced-by` only when it writes the entry in every run. Write a `description` for every entry: the reminder tells the agent what the file holds from it.
81
+
82
+ Put independent checks in a `parallel` group. A `run:` check with `restart-from: <job>` turns a failure into a fix request, and every fix request of the job merges into one repair, so one loop back fixes all of them. Keep steps that edit files out of a group: its steps share the checkout.
83
+
84
+ Every `run` command executes on the workflow host with that process's environment and privileges. There is no VM, container, or sandbox. Review workflow changes as executable code, avoid embedding secrets, and make retry-sensitive external side effects explicit.
85
+
86
+ Before relying on the graph, discover it with `workflow.list`, validate the exact intended settings with `workflow.validate`, then launch an authorized disposable run with `workflow.launch` and inspect job/step status with `workflow.status`. Test a failure path when recovery behavior matters. Validation alone is not runtime acceptance.
87
+
88
+ ## Fix the YAML of a failed run
89
+
90
+ A run only executes the definition it was approved with. Outside Help mode, an edited YAML fails the run and its recovery is refused. In Help mode, follow this order:
91
+
92
+ 1. Edit the YAML, then `workflow.validate` it.
93
+ 2. `workflow.recover` the failed run. Help mode adopts the edit and moves the run's approved revision forward.
94
+ 3. If a later job then reports "No authoritative accepted criteria ledger exists for this job.", the lead's accepted criteria were recorded under the old revision. `workflow.inspectRun`, then `workflow.helpRepair({ runKey, workspace, stage: 'error', revision, reason, recomputeRevision: true })`. Acceptance comes back only for criteria whose definitions and reviewed artifact bytes still match; anything else must be verified again.
95
+ 4. `workflow.recover` again and check `workflow.status`.
96
+
97
+ To give a spent budget back, pass `fixLoopCycle` or `continuations: { <lead job>: <spent count> }` to the same `helpRepair` call.
98
+
99
+ ## Author one producer with independent child reviews
100
+
101
+ Start with `preset: child-review`. Keep exactly one main job under `jobs` when one producer is required. Define reusable reviewers separately under top-level `child-jobs`, not as root jobs connected with `needs`.
102
+
103
+ 1. Declare the deliverable as a file under `run-directory.entries`, with a description and `produced-by: [producer]`. The producer's managed step declares that file in `artifacts` and writes it in `WORKFLOW_RUN_DIR`.
104
+ 2. The producer's `children` lists allowed child definition names. Its `acceptance-criteria` maps stable criterion keys to descriptions, `verified-by` child names and explicit `artifacts` paths. Do not let assignment text, launch inputs or a producer-generated PASS file define acceptance authority.
105
+ 3. The producer explicitly calls `workflow.spawnChild({ job, prompt })` after preparing evidence. Children are not scheduled automatically, and `children` is not a fixed chain. If `inputs` are needed, declare their primitive types/requirements on the child before passing them in the spawn call. Jobs execute from the runtime root; definition-relative imports/tools and step `working-directory` have separate meanings.
106
+ 4. Each reviewer calls `workflow.reviewArtifacts()` and assesses the immutable snapshot for only its authorized keys. It calls `workflow.reportCriteria({ results: { accurate: { status: 'checked', feedback: 'Evidence verified...' } } })` or reports `not-met` with concrete findings. It must not rewrite the producer's evidence or certify the producer's assertions. Reports commit only after successful child settlement.
107
+ 5. The producer inspects `workflow.children()` and `workflow.childStatus({ invocationId })`, makes repairs itself, and requests fresh checks after changing reviewed artifacts. Do not edit shared evidence while children are reviewing it. All children must settle and all criteria must be checked against current bytes before completion.
108
+
109
+ Explicit criterion artifacts keep unrelated files from invalidating a review. For media, a text snapshot containing a filename does not attest the MP4, image or audio bytes: include immutable manifests/hashes, have reviewers verify the referenced files, and inspect the actual rendered/audio evidence. Distinguish source checks, deterministic measurements, rendered inspection and listening. Never claim a kind of review that was not performed.
110
+
111
+ `completion.max-continuations: 3` permits three additional settled attempts in the same lead session after its initial attempt, not three total attempts or a fresh root-job retry budget. Child waits consume the lead step's timeout, not continuation prompts. A child job counts its own failures: `max-failures` on the child (default 3) failed invocations in a row fail the lead with the last error; a recovery starts the count again. `not-met` is successful review feedback; execution/auth/environment failures are failures, not editorial verdicts. Exhaustion fails with outstanding criteria. A person's stop stays stopped. Load `codemode-how-to-workflow` for role-scoped methods, settlement and restart behavior.
112
+
113
+ An agent step that runs again in the same run directory (a re-spawned child, a fix-loop replay, a retry or a recovery) continues its previous conversation by default. Set `session: fresh` on a job, or a child job, whose agents must start clean each time, for example when an earlier conversation would bias a fresh review.
114
+
115
+ ## Job-specific tools
116
+
117
+ Use a workflow-owned tools folder when a managed Po agent step needs task-specific methods. Reuse
118
+ code mode, not a new direct tool or external CLI bridge:
119
+
120
+ ```yaml
121
+ tools: ./tools/shared
122
+ runConfig: { preset: copilot }
123
+ jobs:
124
+ summarize:
125
+ tools: ./tools/report
126
+ steps:
127
+ - name: Summarize
128
+ customRun:
129
+ prompt: Read workflow-job-tools, discover jobTools, then summarize this job.
130
+ ```
131
+
132
+ Workflow `tools` is the default. A job override applies to its main steps, `preJob` and `postJob`;
133
+ repair triage uses `repair.tools` or the default. Global phases use the default. Paths resolve against
134
+ the declaring YAML before imports and template inheritance, never step `cwd` or environment values.
135
+ Each session uses its captured config.
136
+ Parsing, listing and inspection do not execute the tools module.
137
+
138
+ The folder must contain `index.mjs` and non-empty `SKILL.md`. Default-export a factory receiving
139
+ `{ sessionId, cwd, workflow, fs, shell, signal, context }`, where `workflow` is the trusted workflow
140
+ context and `context` is the call context `fs` and `shell` methods take (aborted with `signal`).
141
+ Return a `PoCodemodeNamespace` named `jobTools`, with a one-line `summary`, TypeScript `declarations`
142
+ and `bind(run)` returning flat named async methods with JSON arguments and results. Keep per-session
143
+ state inside the factory, validate method inputs, honour `run.signal`, pass `run.context` to `fs` and
144
+ `shell` calls made from a method so they stop with the exec, and register exec-owned cleanup
145
+ with `run.onDispose`. Optional approval policies must name returned methods and use the existing
146
+ code-mode approval flow. Put judgement, ordering and effect rules in the skill, not signatures.
147
+ The package README's **Job-specific tools** section has a runnable module and skill example.
148
+
149
+ Only managed Po `customRun` and in-process `interactiveRun` sessions receive the namespace and pinned
150
+ `workflow-job-tools` skill. Ordinary sessions, shell steps and external Claude/Codex runners do not.
151
+ These modules are trusted host code, not sandboxed code or directly loaded TypeScript. Native import
152
+ caches by file URL: restart the host after same-path module edits; there is no hot reload.
153
+
154
+ Verify a disposable managed step can read the skill, `discover({ namespace: 'jobTools' })`, and call
155
+ its methods through `exec`. Check invalid input and cancellation before relying on effects. Missing
156
+ files or malformed selected tools fail the managed session before its first prompt. Namespace and
157
+ skill dispose together without stopping the owning workflow or changing recovery ownership. Load
158
+ `codemode-how-to-workflow` for agent-side usage and safety rules.
159
+
160
+ ## Step instructions
161
+
162
+ Top-level `instructions: ./AGENTS.md` gives the workflow's managed Po agent steps their own instructions
163
+ file in place of the AGENTS.md files they would discover from their working directory. It resolves and
164
+ inherits through imports like `tools`; the importing workflow's own value wins. A missing or unreadable
165
+ file fails the step session before its first prompt. Shell steps and external CLI runners ignore it.
166
+
167
+ ## Dynamic fan-out inside a step
168
+
169
+ Start with `preset: dynamic-fanout` when one step needs work whose shape is only known at runtime (one agent per file, finding or page). Keep the YAML graph fixed and let a `customRun` step's agent run a `dynamicWorkflow` script through `exec({ code, background: true })`. The generated prompt includes a runnable `createStep` / committed item workflow / `.foreach(item, { concurrency: 3 })` example. Replace its sample items and read-only task with the real discovered list before running. The step session has code mode in every preset; child agents (`team.run`) need the Team layer in the step's `runConfig.preset`.
170
+
171
+ Keep concurrency bounded and inspect every child's terminal status. A failed child must not become a success just because its error was returned as data. The runs appear under that step in Activity, but the YAML step still settles on its agent and declared artifacts: persist actual outcomes to the generated `results.md`, not just an exec return value. Item findings do not attest managed acceptance criteria.
172
+
173
+ Create and commit nested workflows within the same exec binding. Use the supplied `z`, `createStep` and `createWorkflow`, not raw package imports. Successful step outputs must be JSON-serializable for replay; code outside steps runs again, and a step interrupted mid-effect is refused on replay until `resume(recordId, { retryUncertain: true })` acknowledges it. Prefer read-only item tasks and make any required writes idempotent. Resume with the exact saved source and the runtime's `dynamicWorkflow.resume` instructions rather than launching a fresh copy. Load `codemode-how-to-workflow` for the full composition and replay limits.
174
+
175
+ ## Native execution contract
176
+
177
+ Agent steps require an effective `runConfig.preset`; delegated workflows require top-level `runConfig.preset` before their owner child is created. Selection projects preset, modes, profile and domains, without adding a workflow mode. `subagentModel` and `subagentThinking` set Team preferences independently of the step model.
178
+
179
+ The native host requires execution-state inspection before creating agent steps. After settlement it waits for idle, no pending messages and a known background snapshot without core holds or holding-provider errors before checking decisions. Unknown ownership waits closed without consuming reminders; stops interrupt reads and retry delays.
180
+
181
+ An approved call on its way to the step session (approved, running, or an outcome the agent has not heard) keeps the step waiting. A job step left idle with only undecided approvals parks its run instead of being nudged, unless it recorded a fail: the run ends interrupted with `wait` in run.json, the step session is released, `post:` is skipped, and the run is not resumed by the restart sweep. A lead, child, `pre:` or `post:` step holds its live session in place instead, until the person decides; only a recorded fail, Stop, an error or the step timeout withdraws the requests. While any approval is undecided, the step cannot record complete or fix. Every finished tracked step appends its verdict to `steps.ndjson` in the run directory, keyed by the job run's epoch, matrix copy, attempt and slot. Recovering a parked run replays those verdicts for its parked attempt only and reopens the waiting step sessions without a prompt; ordinary recovery, job retries and fix loops never read them. A step that ends for good withdraws what its session asked for and nobody decided. An unreadable approval queue leaves a step nudged and failed as before.
182
+
183
+ The owner session resumes its parked runs: at startup, on every approval change for one of their step sessions, and once more right after a run parks, since a decision can land before the run is listed as parked. Approve and Deny both resume. The approval root never revives a dormant step session for its decision; it revives the dormant owner, whose startup check resumes the run, and once at its own start it does the same for decisions nothing acted on. Where the host cannot revive a closed owner (Cloudflare Workers), the session that launched the run reopens the owner under its existing ID once a decision lands, and the owner's startup check resumes the run. Resumes are strict (Help off) and single-flight through the recovery claim. A refused resume is written to `wait.blocked` and not retried; a held claim or a closing session is retried on the next change or startup.
184
+
185
+ A delegated success is informational in the workflow owner and wakes the launcher to continue its applicable playbook. Errors wake the workflow owner through durable custom-message admission; the launcher gets an error notification, not an agent-waking failure completion. The owner checks evidence and repairs within its authority. A parked run is neither an error notice nor a completion: the person already has its approval card. A Po restart or session release resumes interrupted runs automatically, re-running the interrupted job while keeping earlier jobs finished. A person's stop never resumes automatically, a person-paused run stays interrupted, and a parked run waits for the person's decision. User-requested stops do not trigger diagnosis or automatic restart.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: help-how-to-workflow-settings
3
+ description: 'Turn workflow recovery edit checks on or off for this host or workspace through the workflowAdmin namespace in Help mode. Use when bots refuse or skip edited workflows on recovery.'
4
+ ---
5
+
6
+ # help-how-to-workflow-settings
7
+
8
+ `workflowAdmin` reads and changes one setting, `workflows.recovery.checkEdits`, in the host or workspace `config.yaml`, through `read`, `set` and `reload`. It exists only in Help mode. Use `discover({ namespace: 'workflowAdmin' })` for signatures.
9
+
10
+ ## What the setting decides
11
+
12
+ When a bot recovers a failed run and the workflow file was edited since, the recovery restarts at the job that failed (or the one a pending approval, an active repair or `fix.md` names).
13
+
14
+ - **Off (the default):** the edit is adopted as it is. Jobs the edit added before the restart job do not run; the run log names them. Use this while a workflow is still being written.
15
+ - **On:** a recovery refuses an edit that adds jobs before the restart job. Nothing runs and no recovery is spent. Turn it on once a workflow is stable, so a bot cannot skip a new prerequisite.
16
+
17
+ In both modes a recovery still refuses an edit that drops the restart job, and a changed workflow while the run has an active repair. The recovery limit, approvals, ownership and role rules do not change.
18
+
19
+ A workspace value wins over the host's, `false` included. `null` removes a value so the next layer applies. The setting is never portable to the Global tier.
20
+
21
+ ## Order
22
+
23
+ 1. `read()` first. Report `active` (what bots use now) and `saved` (what the files say) separately.
24
+ 2. If `reloadNeeded` is true, someone edited a file by hand or on the Settings page. Call `reload()`; it writes nothing.
25
+ 3. To change it, call `set({ scope, checkEdits })`. The person approves every write. Ask which scope they mean if it is unclear: `host` reaches every workspace on this Po host that sets no value of its own, `workspace` only this repository.
26
+ 4. Read the result. `saved: true` with `active: false` means the file changed but bots do not use it yet: say "Saved, but not yet active" with the `error`, and offer `reload()`.
27
+
28
+ ## Mistakes to avoid
29
+
30
+ - Do not say a change is active from the file alone. A hand edit is not picked up until `reload()` or a host restart.
31
+ - When `shared` is false, this host shares no settings: the change reaches only this session. Say so.
32
+ - `source: 'unreadable'` means a config file could not be read, so edits are being checked. Fix the file before changing the value.
33
+ - Do not turn checks off to get a stuck recovery through without telling the person which jobs will be skipped.
@@ -110,6 +110,27 @@ export interface WorkflowArtifactContentResponse {
110
110
  truncated: boolean;
111
111
  }
112
112
 
113
+ /** One sealed, immutable version of a run-directory entry. */
114
+ export interface WorkflowArtifactVersionView {
115
+ versionId: string;
116
+ seq: number;
117
+ /** SHA-256 of the bytes, `missing` for a removal, or a listing hash for a directory. */
118
+ sha: string;
119
+ size: number;
120
+ /** The job and step that wrote it; absent for a change made outside any step. */
121
+ job?: string;
122
+ step?: string;
123
+ /** ISO 8601 of when it was sealed. */
124
+ sealedAt: string;
125
+ /** True once its bytes were removed by the retention sweep. */
126
+ swept: boolean;
127
+ }
128
+
129
+ /** Every sealed version of one path, oldest first. */
130
+ export interface WorkflowArtifactVersionsResponse {
131
+ path: string;
132
+ versions: WorkflowArtifactVersionView[];
133
+ }
113
134
  /** Acknowledges opening the registered run folder in Finder. */
114
135
  export interface WorkflowOpenRunDirectoryResponse {
115
136
  opened: true;
@@ -4,6 +4,27 @@
4
4
  * the cockpit renders them as 'workflow_runs' channel payloads.
5
5
  */
6
6
 
7
+ import type { PoHubSessionUsage } from '@agimon-ai/po-core/hubChannel';
8
+ import type { PoWorkflowChildrenStatus } from '@agimon-ai/po-core/workflow';
9
+
10
+ /** Usage coverage is explicit: an absent total is not a measured zero. */
11
+ export interface WorkflowChildUsageSummary {
12
+ /** False when a journal or any invocation metric is unavailable. */
13
+ complete: boolean;
14
+ invocationCount: number;
15
+ tokensKnown: number;
16
+ costKnown: number;
17
+ toolCountKnown: number;
18
+ tokens?: PoHubSessionUsage['tokens'];
19
+ costUsd?: number;
20
+ toolCount?: number;
21
+ }
22
+
23
+ export interface WorkflowChildStatusError {
24
+ lead?: string;
25
+ message: string;
26
+ }
27
+
7
28
  /** workflow-mcp's own stage vocabulary; the registry bucket a run record sits in. */
8
29
  export type WorkflowStage = 'running' | 'completed' | 'error';
9
30
 
@@ -25,6 +46,13 @@ export type WorkflowProgressState =
25
46
  export const STEP_SESSION_REF_KIND = 'session';
26
47
  /** A command step ran in this terminal pane. */
27
48
  export const STEP_PANE_REF_KIND = 'pane';
49
+ /** The activity panel's scope line while a step tab is open. */
50
+ export const STEP_ACTIVITY_SCOPE = 'diagnose step';
51
+ /**
52
+ * The provenance a step's child session carries. The browser cannot read po-core's server-side
53
+ * `WORKFLOW_STEP_SESSION_PROVENANCE`, so it is repeated here; a test keeps the two equal.
54
+ */
55
+ export const STEP_SESSION_PROVENANCE = 'workflow';
28
56
 
29
57
  /** Where a host executor ran a step: `session` for a customRun agent, `pane` for a command. */
30
58
  export interface WorkflowStepRefView {
@@ -62,6 +90,8 @@ export interface WorkflowJobView {
62
90
  startedAt?: string;
63
91
  endedAt?: string;
64
92
  steps: WorkflowStepView[];
93
+ /** Run-directory files the job's steps declare, from the workflow definition; absent when none. */
94
+ artifacts?: string[];
65
95
  }
66
96
 
67
97
  /** The job and step a run is on right now; drives the NOW breadcrumb. */
@@ -74,7 +104,7 @@ export interface WorkflowPosition {
74
104
 
75
105
  /**
76
106
  * One workflow run of a session, read from workflow-mcp's registry: the
77
- * run.json record plus the folded progress.ndjson job tree.
107
+ * run record plus its folded progress job tree.
78
108
  */
79
109
  export interface WorkflowRunView {
80
110
  /** Opaque owner-qualified API/cache key. The displayed engine runKey stays unchanged. */
@@ -100,21 +130,41 @@ export interface WorkflowRunView {
100
130
  errorMessage?: string;
101
131
  /** The job the engine blamed for the failure, when it recorded one. */
102
132
  failedJob?: string;
133
+ /** The run is parked on the person's approval and resumes once they answer; its error stage is not a failure. */
134
+ waiting?: true;
103
135
  /** True when reconciliation decided the recorded pid is no longer alive. */
104
136
  stale?: boolean;
105
137
  staleReason?: string;
106
138
  worktreeBranch?: string;
107
- /** The session that owns the run (its PI_SESSION_ID); absent on records that carry none. */
139
+ /** The session that owns the run (its PO_SESSION_ID); absent on records that carry none. */
108
140
  ownerSessionId?: string;
109
141
  /** The session that launched the run into its own workflow session, when it was handed off. */
110
142
  launcherSessionId?: string;
111
143
  position?: WorkflowPosition;
112
144
  jobs: WorkflowJobView[];
145
+ /** Latest durable child state, including readable agent-session references. */
146
+ children?: readonly PoWorkflowChildrenStatus[];
147
+ childUsage?: WorkflowChildUsageSummary;
148
+ /** Missing or corrupt child evidence is visible, never represented as successful empty work. */
149
+ childStatusErrors?: WorkflowChildStatusError[];
113
150
  }
114
151
 
115
152
  /** What the workflow runs channel publishes for one session. */
116
153
  export interface WorkflowRunsPayload {
117
154
  runs: WorkflowRunView[];
155
+ /**
156
+ * Runs this session ran a step of, as their owners last reported them. Absent when there are none.
157
+ * The session views them and never owns them, so they grant no run actions.
158
+ */
159
+ parentRuns?: WorkflowRunView[];
160
+ }
161
+
162
+ /**
163
+ * The runs a session ran a step of, read from the durable registry. A stopped step session gets no
164
+ * channel, so its strip and Workflow tab ask for these instead.
165
+ */
166
+ export interface WorkflowStepRunsResponse {
167
+ runs: WorkflowRunView[];
118
168
  }
119
169
 
120
170
  export const WORKFLOW_RUNS_TYPE = 'workflow_runs';
@@ -1,139 +0,0 @@
1
- //#region src/services/workflowLaunchCommand/index.ts
2
- /**
3
- * The `/workflow-launch` line, parsed.
4
- *
5
- * WHY A VERB AT ALL:
6
- * A browser can only send a session a prompt frame, so every cockpit action
7
- * that has to run inside the session travels as a slash line, the way the
8
- * agent catalog sends `/run`. The workflow tools answer to the agent, not to a
9
- * page, and the leader board answers to a keyboard, so neither of them can be
10
- * what the launch dialog sends.
11
- *
12
- * THE SHAPE:
13
- * /workflow-launch <workflow> [key=value ...] [prompt words]
14
- *
15
- * Key-value pairs come first and stop at the first token that is not one, so
16
- * everything after them is the prompt exactly as it was typed, including any
17
- * `=` inside it. `runner`, `command` and `choice` are reserved keys; the rest
18
- * are the workflow's own `workflow_dispatch` inputs. Values may be double
19
- * quoted to hold spaces.
20
- */
21
- /** Reserved key: which runner map entry the run executes with. */
22
- const RUNNER_KEY = "runner";
23
- /** Reserved key: which command templated steps run through. */
24
- const COMMAND_KEY = "command";
25
- /** Reserved key: which model choice steps without their own run with. */
26
- const CHOICE_KEY = "choice";
27
- const KEY_VALUE = /^([A-Za-z_][\w.-]*)=(.*)$/s;
28
- /** Strips one layer of surrounding double quotes, which is how a value holds spaces. */
29
- function unquote(value) {
30
- return value.length > 1 && value.startsWith("\"") && value.endsWith("\"") ? value.slice(1, -1) : value;
31
- }
32
- /**
33
- * Splits on whitespace, keeping double-quoted runs together.
34
- *
35
- * Returns each token with the offset it started at, so the caller can take the
36
- * rest of the line verbatim rather than rebuilding it from tokens and losing
37
- * the spacing a prompt was written with.
38
- */
39
- function tokenize(line) {
40
- const tokens = [];
41
- let index = 0;
42
- while (index < line.length) {
43
- while (index < line.length && /\s/.test(line[index])) index += 1;
44
- if (index >= line.length) break;
45
- const start = index;
46
- let quoted = false;
47
- while (index < line.length && (quoted || !/\s/.test(line[index]))) {
48
- if (line[index] === "\"") quoted = !quoted;
49
- index += 1;
50
- }
51
- tokens.push({
52
- text: line.slice(start, index),
53
- start
54
- });
55
- }
56
- return tokens;
57
- }
58
- function parseWorkflowLaunchCommand(args) {
59
- const tokens = tokenize(args.trim());
60
- const first = tokens[0];
61
- if (first === void 0) return { error: "Usage: /workflow-launch <workflow> [key=value …] [prompt]" };
62
- const inputs = {};
63
- const reserved = {};
64
- let index = 1;
65
- for (; index < tokens.length; index += 1) {
66
- const token = tokens[index];
67
- const match = KEY_VALUE.exec(token.text);
68
- if (!match) break;
69
- const key = match[1];
70
- const value = unquote(match[2]);
71
- if (key === RUNNER_KEY || key === COMMAND_KEY || key === CHOICE_KEY) reserved[key] = value;
72
- else inputs[key] = value;
73
- }
74
- const rest = tokens[index];
75
- const prompt = rest === void 0 ? void 0 : args.trim().slice(rest.start).trim();
76
- return {
77
- workflow: unquote(first.text),
78
- ...reserved,
79
- inputs,
80
- ...prompt === void 0 || prompt === "" ? {} : { prompt }
81
- };
82
- }
83
- /**
84
- * The workflow a token names: its name, its path in the repository, or the
85
- * tail of that path. Case-insensitive on the name, because the catalog shows
86
- * names as their author capitalised them and nobody types that back exactly.
87
- */
88
- function resolveWorkflowEntry(entries, token) {
89
- const needle = token.trim();
90
- const lower = needle.toLocaleLowerCase();
91
- return entries.find((entry) => entry.name.toLocaleLowerCase() === lower) ?? entries.find((entry) => entry.relativePath === needle || entry.path === needle) ?? entries.find((entry) => entry.relativePath.endsWith(`/${needle}`) || entry.path.endsWith(`/${needle}`));
92
- }
93
- /** The trigger that makes a prompt mandatory: the run waits for one otherwise. */
94
- const USER_PROMPT_TRIGGER = "user_prompt";
95
- /**
96
- * Everything wrong with a launch, before it is started.
97
- *
98
- * Checked here rather than left to the engine because the failure would
99
- * otherwise be a run that starts and then waits forever for terminal input, or
100
- * one that dies on a runner its steps never declared. Both read as the launch
101
- * having worked.
102
- */
103
- function validateWorkflowLaunch(requirements, parsed) {
104
- const problems = [];
105
- if (requirements.triggers.includes(USER_PROMPT_TRIGGER) && (parsed.prompt ?? "") === "") problems.push("This workflow is triggered by a prompt, so it needs one.");
106
- const missing = requirements.inputs.filter((input) => input.required === true && (parsed.inputs[input.name] ?? "") === "").map((input) => input.name);
107
- if (missing.length > 0) problems.push(`Missing required input${missing.length > 1 ? "s" : ""}: ${missing.join(", ")}.`);
108
- for (const input of requirements.inputs) {
109
- const value = parsed.inputs[input.name];
110
- if (value === void 0 || input.options === void 0 || input.options.includes(value)) continue;
111
- problems.push(`Input ${input.name} must be one of: ${input.options.join(", ")}.`);
112
- }
113
- const declared = requirements.runners;
114
- if (parsed.runner !== void 0 && declared !== void 0 && !declared.includes(parsed.runner)) problems.push(declared.length === 0 ? "This workflow declares no runner its steps agree on." : `Runner ${parsed.runner} is not one this workflow declares: ${declared.join(", ")}.`);
115
- if (parsed.command !== void 0 && !(requirements.commands ?? []).includes(parsed.command)) problems.push(requirements.commands === void 0 || requirements.commands.length === 0 ? "This workflow has no templated steps to run through a command." : `Command ${parsed.command} is not one every step offers: ${requirements.commands.join(", ")}.`);
116
- if (parsed.choice !== void 0 && !(requirements.choices ?? []).includes(parsed.choice)) problems.push(`Choice ${parsed.choice} is not declared${requirements.choices?.length ? `: ${requirements.choices.join(", ")}` : ""}.`);
117
- return problems;
118
- }
119
- //#endregion
120
- Object.defineProperty(exports, "parseWorkflowLaunchCommand", {
121
- enumerable: true,
122
- get: function() {
123
- return parseWorkflowLaunchCommand;
124
- }
125
- });
126
- Object.defineProperty(exports, "resolveWorkflowEntry", {
127
- enumerable: true,
128
- get: function() {
129
- return resolveWorkflowEntry;
130
- }
131
- });
132
- Object.defineProperty(exports, "validateWorkflowLaunch", {
133
- enumerable: true,
134
- get: function() {
135
- return validateWorkflowLaunch;
136
- }
137
- });
138
-
139
- //# sourceMappingURL=workflowLaunchCommand-C69Nn3k5.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflowLaunchCommand-C69Nn3k5.cjs","names":[],"sources":["../src/services/workflowLaunchCommand/index.ts"],"sourcesContent":["/**\n * The `/workflow-launch` line, parsed.\n *\n * WHY A VERB AT ALL:\n * A browser can only send a session a prompt frame, so every cockpit action\n * that has to run inside the session travels as a slash line, the way the\n * agent catalog sends `/run`. The workflow tools answer to the agent, not to a\n * page, and the leader board answers to a keyboard, so neither of them can be\n * what the launch dialog sends.\n *\n * THE SHAPE:\n * /workflow-launch <workflow> [key=value ...] [prompt words]\n *\n * Key-value pairs come first and stop at the first token that is not one, so\n * everything after them is the prompt exactly as it was typed, including any\n * `=` inside it. `runner`, `command` and `choice` are reserved keys; the rest\n * are the workflow's own `workflow_dispatch` inputs. Values may be double\n * quoted to hold spaces.\n */\n\n/** Reserved key: which runner map entry the run executes with. */\nconst RUNNER_KEY = 'runner';\n/** Reserved key: which command templated steps run through. */\nconst COMMAND_KEY = 'command';\n/** Reserved key: which model choice steps without their own run with. */\nconst CHOICE_KEY = 'choice';\nconst KEY_VALUE = /^([A-Za-z_][\\w.-]*)=(.*)$/s;\n\nexport interface ParsedWorkflowLaunch {\n /** The workflow's name or its path, as typed; resolution belongs to the caller. */\n workflow: string;\n runner?: string;\n command?: string;\n choice?: string;\n inputs: Record<string, string>;\n prompt?: string;\n}\n\nexport interface WorkflowLaunchParseFailure {\n error: string;\n}\n\nexport function isLaunchParseFailure(\n value: ParsedWorkflowLaunch | WorkflowLaunchParseFailure,\n): value is WorkflowLaunchParseFailure {\n return 'error' in value;\n}\n\n/** Strips one layer of surrounding double quotes, which is how a value holds spaces. */\nfunction unquote(value: string): string {\n return value.length > 1 && value.startsWith('\"') && value.endsWith('\"') ? value.slice(1, -1) : value;\n}\n\n/**\n * Splits on whitespace, keeping double-quoted runs together.\n *\n * Returns each token with the offset it started at, so the caller can take the\n * rest of the line verbatim rather than rebuilding it from tokens and losing\n * the spacing a prompt was written with.\n */\nfunction tokenize(line: string): { text: string; start: number }[] {\n const tokens: { text: string; start: number }[] = [];\n let index = 0;\n while (index < line.length) {\n while (index < line.length && /\\s/.test(line[index] as string)) index += 1;\n if (index >= line.length) break;\n const start = index;\n let quoted = false;\n while (index < line.length && (quoted || !/\\s/.test(line[index] as string))) {\n if (line[index] === '\"') quoted = !quoted;\n index += 1;\n }\n tokens.push({ text: line.slice(start, index), start });\n }\n return tokens;\n}\n\nexport function parseWorkflowLaunchCommand(args: string): ParsedWorkflowLaunch | WorkflowLaunchParseFailure {\n const tokens = tokenize(args.trim());\n const first = tokens[0];\n if (first === undefined) return { error: 'Usage: /workflow-launch <workflow> [key=value …] [prompt]' };\n\n const inputs: Record<string, string> = {};\n const reserved: { runner?: string; command?: string; choice?: string } = {};\n let index = 1;\n for (; index < tokens.length; index += 1) {\n const token = tokens[index] as { text: string; start: number };\n const match = KEY_VALUE.exec(token.text);\n if (!match) break;\n const key = match[1] as string;\n const value = unquote(match[2] as string);\n if (key === RUNNER_KEY || key === COMMAND_KEY || key === CHOICE_KEY) reserved[key] = value;\n else inputs[key] = value;\n }\n\n const rest = tokens[index];\n const prompt = rest === undefined ? undefined : args.trim().slice(rest.start).trim();\n return {\n workflow: unquote(first.text),\n ...reserved,\n inputs,\n ...(prompt === undefined || prompt === '' ? {} : { prompt }),\n };\n}\n\n/** The line the cockpit sends, built from what its dialog collected. */\nexport function workflowLaunchCommand(request: ParsedWorkflowLaunch): string {\n const quote = (value: string): string => (/\\s/.test(value) ? `\"${value}\"` : value);\n const pairs = [\n ...(request.runner === undefined ? [] : [`${RUNNER_KEY}=${quote(request.runner)}`]),\n ...(request.command === undefined ? [] : [`${COMMAND_KEY}=${quote(request.command)}`]),\n ...(request.choice === undefined ? [] : [`${CHOICE_KEY}=${quote(request.choice)}`]),\n ...Object.entries(request.inputs).map(([key, value]) => `${key}=${quote(value)}`),\n ];\n const prompt = request.prompt?.trim();\n return ['/workflow-launch', quote(request.workflow), ...pairs, ...(prompt ? [prompt] : [])].join(' ');\n}\n\n/** One catalog row, as much of it as resolution needs. */\nexport interface LaunchResolvableWorkflow {\n name: string;\n path: string;\n relativePath: string;\n}\n\n/**\n * The workflow a token names: its name, its path in the repository, or the\n * tail of that path. Case-insensitive on the name, because the catalog shows\n * names as their author capitalised them and nobody types that back exactly.\n */\nexport function resolveWorkflowEntry<T extends LaunchResolvableWorkflow>(\n entries: readonly T[],\n token: string,\n): T | undefined {\n const needle = token.trim();\n const lower = needle.toLocaleLowerCase();\n return (\n entries.find((entry) => entry.name.toLocaleLowerCase() === lower) ??\n entries.find((entry) => entry.relativePath === needle || entry.path === needle) ??\n entries.find((entry) => entry.relativePath.endsWith(`/${needle}`) || entry.path.endsWith(`/${needle}`))\n );\n}\n\n/** What a workflow declares, as much of it as a launch has to satisfy. */\nexport interface LaunchRequirements {\n triggers: readonly string[];\n inputs: readonly { name: string; required?: boolean; options?: readonly string[] }[];\n /** Absent means the workflow names no runner map, so any runner will do. */\n runners?: readonly string[];\n /** Commands every templated step offers; absent when no step is templated. */\n commands?: readonly string[];\n /** Declared model choices. */\n choices?: readonly string[];\n}\n\n/** The trigger that makes a prompt mandatory: the run waits for one otherwise. */\nconst USER_PROMPT_TRIGGER = 'user_prompt';\n\n/**\n * Everything wrong with a launch, before it is started.\n *\n * Checked here rather than left to the engine because the failure would\n * otherwise be a run that starts and then waits forever for terminal input, or\n * one that dies on a runner its steps never declared. Both read as the launch\n * having worked.\n */\nexport function validateWorkflowLaunch(\n requirements: LaunchRequirements,\n parsed: Pick<ParsedWorkflowLaunch, 'inputs' | 'prompt' | 'runner' | 'command' | 'choice'>,\n): string[] {\n const problems: string[] = [];\n if (requirements.triggers.includes(USER_PROMPT_TRIGGER) && (parsed.prompt ?? '') === '') {\n problems.push('This workflow is triggered by a prompt, so it needs one.');\n }\n const missing = requirements.inputs\n .filter((input) => input.required === true && (parsed.inputs[input.name] ?? '') === '')\n .map((input) => input.name);\n if (missing.length > 0)\n problems.push(`Missing required input${missing.length > 1 ? 's' : ''}: ${missing.join(', ')}.`);\n for (const input of requirements.inputs) {\n const value = parsed.inputs[input.name];\n if (value === undefined || input.options === undefined || input.options.includes(value)) continue;\n problems.push(`Input ${input.name} must be one of: ${input.options.join(', ')}.`);\n }\n const declared = requirements.runners;\n if (parsed.runner !== undefined && declared !== undefined && !declared.includes(parsed.runner)) {\n problems.push(\n declared.length === 0\n ? 'This workflow declares no runner its steps agree on.'\n : `Runner ${parsed.runner} is not one this workflow declares: ${declared.join(', ')}.`,\n );\n }\n if (parsed.command !== undefined && !(requirements.commands ?? []).includes(parsed.command)) {\n problems.push(\n requirements.commands === undefined || requirements.commands.length === 0\n ? 'This workflow has no templated steps to run through a command.'\n : `Command ${parsed.command} is not one every step offers: ${requirements.commands.join(', ')}.`,\n );\n }\n if (parsed.choice !== undefined && !(requirements.choices ?? []).includes(parsed.choice)) {\n problems.push(\n `Choice ${parsed.choice} is not declared${requirements.choices?.length ? `: ${requirements.choices.join(', ')}` : ''}.`,\n );\n }\n return problems;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,aAAa;;AAEnB,MAAM,cAAc;;AAEpB,MAAM,aAAa;AACnB,MAAM,YAAY;;AAuBlB,SAAS,QAAQ,OAAuB;CACtC,OAAO,MAAM,SAAS,KAAK,MAAM,WAAW,IAAG,KAAK,MAAM,SAAS,IAAG,IAAI,MAAM,MAAM,GAAG,EAAE,IAAI;AACjG;;;;;;;;AASA,SAAS,SAAS,MAAiD;CACjE,MAAM,SAA4C,CAAC;CACnD,IAAI,QAAQ;CACZ,OAAO,QAAQ,KAAK,QAAQ;EAC1B,OAAO,QAAQ,KAAK,UAAU,KAAK,KAAK,KAAK,MAAgB,GAAG,SAAS;EACzE,IAAI,SAAS,KAAK,QAAQ;EAC1B,MAAM,QAAQ;EACd,IAAI,SAAS;EACb,OAAO,QAAQ,KAAK,WAAW,UAAU,CAAC,KAAK,KAAK,KAAK,MAAgB,IAAI;GAC3E,IAAI,KAAK,WAAW,MAAK,SAAS,CAAC;GACnC,SAAS;EACX;EACA,OAAO,KAAK;GAAE,MAAM,KAAK,MAAM,OAAO,KAAK;GAAG;EAAM,CAAC;CACvD;CACA,OAAO;AACT;AAEA,SAAgB,2BAA2B,MAAiE;CAC1G,MAAM,SAAS,SAAS,KAAK,KAAK,CAAC;CACnC,MAAM,QAAQ,OAAO;CACrB,IAAI,UAAU,KAAA,GAAW,OAAO,EAAE,OAAO,4DAA4D;CAErG,MAAM,SAAiC,CAAC;CACxC,MAAM,WAAmE,CAAC;CAC1E,IAAI,QAAQ;CACZ,OAAO,QAAQ,OAAO,QAAQ,SAAS,GAAG;EACxC,MAAM,QAAQ,OAAO;EACrB,MAAM,QAAQ,UAAU,KAAK,MAAM,IAAI;EACvC,IAAI,CAAC,OAAO;EACZ,MAAM,MAAM,MAAM;EAClB,MAAM,QAAQ,QAAQ,MAAM,EAAY;EACxC,IAAI,QAAQ,cAAc,QAAQ,eAAe,QAAQ,YAAY,SAAS,OAAO;OAChF,OAAO,OAAO;CACrB;CAEA,MAAM,OAAO,OAAO;CACpB,MAAM,SAAS,SAAS,KAAA,IAAY,KAAA,IAAY,KAAK,KAAK,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,KAAK;CACnF,OAAO;EACL,UAAU,QAAQ,MAAM,IAAI;EAC5B,GAAG;EACH;EACA,GAAI,WAAW,KAAA,KAAa,WAAW,KAAK,CAAC,IAAI,EAAE,OAAO;CAC5D;AACF;;;;;;AA2BA,SAAgB,qBACd,SACA,OACe;CACf,MAAM,SAAS,MAAM,KAAK;CAC1B,MAAM,QAAQ,OAAO,kBAAkB;CACvC,OACE,QAAQ,MAAM,UAAU,MAAM,KAAK,kBAAkB,MAAM,KAAK,KAChE,QAAQ,MAAM,UAAU,MAAM,iBAAiB,UAAU,MAAM,SAAS,MAAM,KAC9E,QAAQ,MAAM,UAAU,MAAM,aAAa,SAAS,IAAI,QAAQ,KAAK,MAAM,KAAK,SAAS,IAAI,QAAQ,CAAC;AAE1G;;AAeA,MAAM,sBAAsB;;;;;;;;;AAU5B,SAAgB,uBACd,cACA,QACU;CACV,MAAM,WAAqB,CAAC;CAC5B,IAAI,aAAa,SAAS,SAAS,mBAAmB,MAAM,OAAO,UAAU,QAAQ,IACnF,SAAS,KAAK,0DAA0D;CAE1E,MAAM,UAAU,aAAa,OAC1B,QAAQ,UAAU,MAAM,aAAa,SAAS,OAAO,OAAO,MAAM,SAAS,QAAQ,EAAE,CAAC,CACtF,KAAK,UAAU,MAAM,IAAI;CAC5B,IAAI,QAAQ,SAAS,GACnB,SAAS,KAAK,yBAAyB,QAAQ,SAAS,IAAI,MAAM,GAAG,IAAI,QAAQ,KAAK,IAAI,EAAE,EAAE;CAChG,KAAK,MAAM,SAAS,aAAa,QAAQ;EACvC,MAAM,QAAQ,OAAO,OAAO,MAAM;EAClC,IAAI,UAAU,KAAA,KAAa,MAAM,YAAY,KAAA,KAAa,MAAM,QAAQ,SAAS,KAAK,GAAG;EACzF,SAAS,KAAK,SAAS,MAAM,KAAK,mBAAmB,MAAM,QAAQ,KAAK,IAAI,EAAE,EAAE;CAClF;CACA,MAAM,WAAW,aAAa;CAC9B,IAAI,OAAO,WAAW,KAAA,KAAa,aAAa,KAAA,KAAa,CAAC,SAAS,SAAS,OAAO,MAAM,GAC3F,SAAS,KACP,SAAS,WAAW,IAChB,yDACA,UAAU,OAAO,OAAO,sCAAsC,SAAS,KAAK,IAAI,EAAE,EACxF;CAEF,IAAI,OAAO,YAAY,KAAA,KAAa,EAAE,aAAa,YAAY,CAAC,EAAA,CAAG,SAAS,OAAO,OAAO,GACxF,SAAS,KACP,aAAa,aAAa,KAAA,KAAa,aAAa,SAAS,WAAW,IACpE,mEACA,WAAW,OAAO,QAAQ,iCAAiC,aAAa,SAAS,KAAK,IAAI,EAAE,EAClG;CAEF,IAAI,OAAO,WAAW,KAAA,KAAa,EAAE,aAAa,WAAW,CAAC,EAAA,CAAG,SAAS,OAAO,MAAM,GACrF,SAAS,KACP,UAAU,OAAO,OAAO,kBAAkB,aAAa,SAAS,SAAS,KAAK,aAAa,QAAQ,KAAK,IAAI,MAAM,GAAG,EACvH;CAEF,OAAO;AACT"}