@synergenius/flow-weaver 0.33.1 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -226
- package/NOTICE +13 -0
- package/README.md +152 -244
- package/dist/agent/agent-loop.d.ts +4 -2
- package/dist/agent/cli-session.d.ts +3 -3
- package/dist/agent/cli-session.js +511 -438
- package/dist/agent/cli-spawn-config.d.ts +4 -4
- package/dist/agent/gate.d.ts +164 -0
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +174 -28
- package/dist/agent/mcp-bridge.d.ts +1 -1
- package/dist/agent/mcp-bridge.js +114 -128
- package/dist/agent/mcp-tool-server.d.ts +2 -2
- package/dist/agent/mcp-tool-server.js +147 -189
- package/dist/agent/profiles.d.ts +69 -0
- package/dist/agent/providers/anthropic.d.ts +2 -4
- package/dist/agent/providers/claude-cli.d.ts +4 -5
- package/dist/agent/providers/openai-compat.d.ts +8 -1
- package/dist/agent/streaming.d.ts +2 -2
- package/dist/agent/types.d.ts +16 -10
- package/dist/api/builder.d.ts +3 -3
- package/dist/api/compile.d.ts +9 -4
- package/dist/api/durable-validation.d.ts +15 -0
- package/dist/api/generate-in-place.d.ts +21 -19
- package/dist/api/generate.d.ts +21 -16
- package/dist/api/generated-module/local-node-functions.d.ts +24 -0
- package/dist/api/generated-module/module-format.d.ts +23 -0
- package/dist/api/generated-module/module-writer.d.ts +34 -0
- package/dist/api/generated-module/node-type-imports.d.ts +39 -0
- package/dist/api/generated-module/preamble.d.ts +16 -0
- package/dist/api/generated-module/workflow-functions.d.ts +29 -0
- package/dist/api/graph-identity.d.ts +39 -0
- package/dist/api/helpers.d.ts +4 -60
- package/dist/api/in-place/built-in-nodes.d.ts +18 -0
- package/dist/api/in-place/function-body.d.ts +21 -0
- package/dist/api/in-place/fw-imports.d.ts +30 -0
- package/dist/api/in-place/macro-coverage.d.ts +14 -0
- package/dist/api/in-place/node-type-functions.d.ts +18 -0
- package/dist/api/in-place/node-type-jsdoc.d.ts +20 -0
- package/dist/api/in-place/orphaned-node-types.d.ts +16 -0
- package/dist/api/in-place/runtime-section.d.ts +16 -0
- package/dist/api/in-place/signature.d.ts +47 -0
- package/dist/api/in-place/source-file.d.ts +19 -0
- package/dist/api/in-place/workflow-jsdoc.d.ts +19 -0
- package/dist/api/index.d.ts +18 -21
- package/dist/api/index.js +259 -53
- package/dist/api/inline-engine.generated.d.ts +3 -0
- package/dist/api/inline-runtime.d.ts +10 -2
- package/dist/api/manipulation/connections.d.ts +1 -1
- package/dist/api/manipulation/index.d.ts +8 -8
- package/dist/api/manipulation/node-types.d.ts +1 -1
- package/dist/api/manipulation/nodes.d.ts +3 -13
- package/dist/api/manipulation/ports.d.ts +1 -1
- package/dist/api/manipulation/scopes.d.ts +1 -1
- package/dist/api/manipulation/workflow.d.ts +1 -1
- package/dist/api/modify-operation.d.ts +0 -2
- package/dist/api/parse.d.ts +22 -1
- package/dist/api/port-references.d.ts +66 -0
- package/dist/api/query.d.ts +18 -2
- package/dist/api/templates.d.ts +1 -1
- package/dist/api/transform.d.ts +1 -1
- package/dist/api/validate.d.ts +1 -1
- package/dist/api/validation-registry.d.ts +2 -2
- package/dist/artifacts/brief.d.ts +43 -0
- package/dist/artifacts/index.d.ts +31 -0
- package/dist/artifacts/pdf.d.ts +19 -0
- package/dist/ast/builder.d.ts +3 -3
- package/dist/ast/index.d.ts +4 -4
- package/dist/ast/index.js +60 -5
- package/dist/ast/serialization-node.d.ts +1 -1
- package/dist/ast/serialization.d.ts +1 -1
- package/dist/ast/types.d.ts +82 -291
- package/dist/ast/workflow-utils.d.ts +4 -4
- package/dist/built-in-nodes/coercion-types.d.ts +1 -1
- package/dist/built-in-nodes/delay.d.ts +3 -1
- package/dist/built-in-nodes/generated-registry.d.ts +1 -1
- package/dist/built-in-nodes/index.d.ts +6 -5
- package/dist/built-in-nodes/index.js +79 -5
- package/dist/built-in-nodes/invoke-workflow.d.ts +2 -1
- package/dist/built-in-nodes/mock-types.d.ts +45 -14
- package/dist/built-in-nodes/sleep.d.ts +12 -0
- package/dist/built-in-nodes/wait-for-agent.d.ts +2 -1
- package/dist/built-in-nodes/wait-for-event.d.ts +2 -1
- package/dist/chevrotain-parser/coerce-parser.d.ts +1 -1
- package/dist/chevrotain-parser/connect-parser.d.ts +1 -1
- package/dist/chevrotain-parser/grammar-diagrams.d.ts +1 -1
- package/dist/chevrotain-parser/index.d.ts +20 -23
- package/dist/chevrotain-parser/node-parser.d.ts +7 -8
- package/dist/chevrotain-parser/parse-line.d.ts +54 -0
- package/dist/chevrotain-parser/tokens.d.ts +0 -17
- package/dist/chevrotain-parser/trigger-cancel-parser.d.ts +6 -1
- package/dist/chunks/chunk-4EUSHAY6.js +298 -0
- package/dist/chunks/chunk-4KDUEOFD.js +197 -0
- package/dist/chunks/chunk-5Y3AIUWY.js +911 -0
- package/dist/chunks/chunk-6KMVP6AU.js +20 -0
- package/dist/chunks/chunk-6PNJORFL.js +128 -0
- package/dist/chunks/chunk-7AAQNGRH.js +2001 -0
- package/dist/chunks/chunk-7YYKTPJ5.js +22705 -0
- package/dist/chunks/chunk-A5MBOFVY.js +33 -0
- package/dist/chunks/chunk-AXNQRVJB.js +18 -0
- package/dist/chunks/chunk-B6HQ6YS5.js +572 -0
- package/dist/chunks/chunk-CY3RNVML.js +296 -0
- package/dist/chunks/chunk-CYHYDLV4.js +653 -0
- package/dist/chunks/chunk-CZBCCK4Y.js +82 -0
- package/dist/chunks/chunk-DCMGQP5V.js +505 -0
- package/dist/chunks/chunk-DIAA66GL.js +72 -0
- package/dist/chunks/chunk-DUO6H5PR.js +20 -0
- package/dist/chunks/chunk-E5WN7IGO.js +125 -0
- package/dist/chunks/chunk-EFGFXXQF.js +184 -0
- package/dist/chunks/chunk-F3RTZV2A.js +2811 -0
- package/dist/chunks/chunk-FMTLP5ZX.js +1397 -0
- package/dist/chunks/chunk-HKZLQJDV.js +79 -0
- package/dist/chunks/chunk-INDEVYEC.js +146 -0
- package/dist/chunks/chunk-JQTF4R5L.js +390 -0
- package/dist/chunks/chunk-KMCAYNUM.js +331 -0
- package/dist/chunks/chunk-KMWCCOUJ.js +1444 -0
- package/dist/chunks/chunk-KU3CLJI2.js +338 -0
- package/dist/chunks/chunk-NDSTGMKR.js +3300 -0
- package/dist/chunks/chunk-NQNLUAPO.js +505 -0
- package/dist/chunks/chunk-O2U2LO57.js +466 -0
- package/dist/chunks/chunk-OOQG7UPP.js +457 -0
- package/dist/chunks/chunk-OZQAW5ZG.js +112 -0
- package/dist/chunks/chunk-P2CVDGHR.js +487 -0
- package/dist/chunks/chunk-P44RIZ7C.js +592 -0
- package/dist/chunks/chunk-PEZCT37T.js +1475 -0
- package/dist/chunks/chunk-PKWSAW6O.js +152 -0
- package/dist/chunks/chunk-Q6MDDZMT.js +4373 -0
- package/dist/chunks/chunk-QDE4Z7KW.js +6 -0
- package/dist/chunks/chunk-QJDAVSNY.js +8 -0
- package/dist/chunks/chunk-QYPORSLO.js +7552 -0
- package/dist/chunks/chunk-R4QGNK34.js +183 -0
- package/dist/chunks/chunk-REEYC73I.js +3002 -0
- package/dist/chunks/chunk-SEWDMQ6Q.js +46 -0
- package/dist/chunks/chunk-TAIUWKZB.js +3057 -0
- package/dist/chunks/chunk-TN4YZ3O7.js +196 -0
- package/dist/chunks/chunk-TRMFB43C.js +143 -0
- package/dist/chunks/chunk-VO4QXG2X.js +1016 -0
- package/dist/chunks/chunk-VP2P3BPA.js +1002 -0
- package/dist/chunks/chunk-VQ7H33J4.js +2176 -0
- package/dist/chunks/chunk-VWA7MCV2.js +105 -0
- package/dist/chunks/chunk-XAV22WD7.js +253 -0
- package/dist/chunks/chunk-YSPBPZDV.js +148 -0
- package/dist/chunks/chunk-ZKEGXO73.js +282 -0
- package/dist/chunks/chunk-ZMGN6F3S.js +4256 -0
- package/dist/chunks/grammar-diagrams-AI7VDXOM.js +14 -0
- package/dist/chunks/index.min-ECJD6GZC.js +37 -0
- package/dist/chunks/manifest-EPTR5MYH.js +21 -0
- package/dist/chunks/openapi-document-6TCGVDUW.js +69 -0
- package/dist/chunks/registry-K2U5KUTY.js +23 -0
- package/dist/chunks/serialization-node-UGY6CFH6.js +38 -0
- package/dist/chunks/validate-GEKSZPIN.js +24 -0
- package/dist/chunks/validation-registry-IQZX3UE3.js +7 -0
- package/dist/chunks/validator-VXFHLPDW.js +26 -0
- package/dist/chunks/workflow-executor-KBGFKHNR.js +36 -0
- package/dist/cli/commands/agents.d.ts +16 -0
- package/dist/cli/commands/artifact.d.ts +10 -0
- package/dist/cli/commands/compile.d.ts +0 -30
- package/dist/cli/commands/console.d.ts +32 -0
- package/dist/cli/commands/context.d.ts +0 -3
- package/dist/cli/commands/describe.js +386 -352
- package/dist/cli/commands/dev.d.ts +9 -4
- package/dist/cli/commands/diagram.d.ts +3 -5
- package/dist/cli/commands/doctor.d.ts +27 -4
- package/dist/cli/commands/doctor.js +3307 -633
- package/dist/cli/commands/export.d.ts +6 -4
- package/dist/cli/commands/grammar.d.ts +0 -3
- package/dist/cli/commands/implement.d.ts +1 -1
- package/dist/cli/commands/init/agent-handoff.d.ts +28 -0
- package/dist/cli/commands/init/config.d.ts +3 -0
- package/dist/cli/commands/init/files.d.ts +12 -0
- package/dist/cli/commands/init/naming.d.ts +13 -0
- package/dist/cli/commands/init/output.d.ts +12 -0
- package/dist/cli/commands/init/setup.d.ts +21 -0
- package/dist/cli/commands/init/types.d.ts +53 -0
- package/dist/cli/commands/init-personas.d.ts +9 -1
- package/dist/cli/commands/init.d.ts +24 -88
- package/dist/cli/commands/market.d.ts +1 -1
- package/dist/cli/commands/mcp-setup.d.ts +1 -4
- package/dist/cli/commands/modify.d.ts +0 -5
- package/dist/cli/commands/openapi.d.ts +9 -11
- package/dist/cli/commands/run.d.ts +0 -4
- package/dist/cli/commands/serve.d.ts +24 -26
- package/dist/cli/commands/status.d.ts +1 -1
- package/dist/cli/exports.d.ts +3 -4
- package/dist/cli/exports.js +124 -23
- package/dist/cli/flow-weaver-agents-H653446S.mjs +81 -0
- package/dist/cli/flow-weaver-artifact-WBFYTW76.mjs +58 -0
- package/dist/cli/flow-weaver-chunk-265CEK74.mjs +2 -0
- package/dist/cli/flow-weaver-chunk-2C7PZCV5.mjs +186 -0
- package/dist/cli/flow-weaver-chunk-3BSYCWPL.mjs +3109 -0
- package/dist/cli/flow-weaver-chunk-3MKUQP3D.mjs +547 -0
- package/dist/cli/flow-weaver-chunk-3ZLMPQTH.mjs +27 -0
- package/dist/cli/flow-weaver-chunk-4DVY73ML.mjs +280 -0
- package/dist/cli/flow-weaver-chunk-54M4KNEL.mjs +200 -0
- package/dist/cli/flow-weaver-chunk-55QMUZIA.mjs +256 -0
- package/dist/cli/flow-weaver-chunk-6ZUJ7LMX.mjs +2003 -0
- package/dist/cli/flow-weaver-chunk-7ET6N32V.mjs +419 -0
- package/dist/cli/flow-weaver-chunk-7G63RR4K.mjs +8880 -0
- package/dist/cli/flow-weaver-chunk-A6M5K3W7.mjs +4418 -0
- package/dist/cli/flow-weaver-chunk-AA3NATMX.mjs +154 -0
- package/dist/cli/flow-weaver-chunk-APX6MQ5A.mjs +5652 -0
- package/dist/cli/flow-weaver-chunk-BHCC5FE5.mjs +17 -0
- package/dist/cli/flow-weaver-chunk-DM4BBRRU.mjs +35 -0
- package/dist/cli/flow-weaver-chunk-DRN7KPWY.mjs +168 -0
- package/dist/cli/flow-weaver-chunk-EKWF27G6.mjs +23 -0
- package/dist/cli/flow-weaver-chunk-EM5HWQ4R.mjs +338 -0
- package/dist/cli/flow-weaver-chunk-FPPPU2DG.mjs +226 -0
- package/dist/cli/flow-weaver-chunk-GAQXZHNO.mjs +3005 -0
- package/dist/cli/flow-weaver-chunk-GBUNNP33.mjs +1329 -0
- package/dist/cli/flow-weaver-chunk-HMAKDE55.mjs +636 -0
- package/dist/cli/flow-weaver-chunk-HQ3ZAN44.mjs +367 -0
- package/dist/cli/flow-weaver-chunk-I4APCXYN.mjs +21442 -0
- package/dist/cli/flow-weaver-chunk-IJJ4JXTL.mjs +2297 -0
- package/dist/cli/flow-weaver-chunk-J7EPZW2I.mjs +33 -0
- package/dist/cli/flow-weaver-chunk-KOEMJHLG.mjs +83 -0
- package/dist/cli/flow-weaver-chunk-M6CBWQKJ.mjs +271 -0
- package/dist/cli/flow-weaver-chunk-MHJ4N652.mjs +1580 -0
- package/dist/cli/flow-weaver-chunk-MKAFQWLP.mjs +202 -0
- package/dist/cli/flow-weaver-chunk-MMV2XGD3.mjs +3291 -0
- package/dist/cli/flow-weaver-chunk-MSI2UJES.mjs +125 -0
- package/dist/cli/flow-weaver-chunk-N767YRAI.mjs +48 -0
- package/dist/cli/flow-weaver-chunk-NQKKWDGF.mjs +56 -0
- package/dist/cli/flow-weaver-chunk-NYZDQYFU.mjs +45 -0
- package/dist/cli/flow-weaver-chunk-OMVWSNHJ.mjs +14 -0
- package/dist/cli/flow-weaver-chunk-PUWZ47H5.mjs +2188 -0
- package/dist/cli/flow-weaver-chunk-QOPRVDES.mjs +46 -0
- package/dist/cli/flow-weaver-chunk-RIWE7YTR.mjs +216 -0
- package/dist/cli/flow-weaver-chunk-S63Q3JIU.mjs +789 -0
- package/dist/cli/flow-weaver-chunk-T7X5A23H.mjs +558 -0
- package/dist/cli/flow-weaver-chunk-TLV3VZUN.mjs +2 -0
- package/dist/cli/flow-weaver-chunk-TS5P3PIN.mjs +194 -0
- package/dist/cli/flow-weaver-chunk-U3EO3X4B.mjs +649 -0
- package/dist/cli/flow-weaver-chunk-UNFS3NQP.mjs +34 -0
- package/dist/cli/flow-weaver-chunk-V6DHWFQG.mjs +2811 -0
- package/dist/cli/flow-weaver-chunk-VXWNLYQU.mjs +9 -0
- package/dist/cli/flow-weaver-chunk-W3YNK26P.mjs +149 -0
- package/dist/cli/flow-weaver-chunk-XG2WKXYZ.mjs +324 -0
- package/dist/cli/flow-weaver-chunk-YLSRZWFK.mjs +2219 -0
- package/dist/cli/flow-weaver-chunk-YVPURWS6.mjs +40 -0
- package/dist/cli/flow-weaver-chunk-Z44JK332.mjs +582 -0
- package/dist/cli/flow-weaver-chunk-Z5ZJPNSY.mjs +517 -0
- package/dist/cli/flow-weaver-chunk-ZQALO25T.mjs +594 -0
- package/dist/cli/flow-weaver-compile-A2CABDSB.mjs +37 -0
- package/dist/cli/flow-weaver-console-6EBHDBTN.mjs +71 -0
- package/dist/cli/flow-weaver-context-ECLYANFF.mjs +17 -0
- package/dist/cli/flow-weaver-context-ZRUMW2KE.mjs +69 -0
- package/dist/cli/flow-weaver-create-WIP4EFNP.mjs +124 -0
- package/dist/cli/flow-weaver-deployment-WJJRK7NO.mjs +14 -0
- package/dist/cli/flow-weaver-describe-XDIFF5LI.mjs +41 -0
- package/dist/cli/flow-weaver-dev-LG2NSQAU.mjs +196 -0
- package/dist/cli/flow-weaver-diagram-3EVQARQE.mjs +52 -0
- package/dist/cli/flow-weaver-diagram-7LR7O4M2.mjs +44 -0
- package/dist/cli/flow-weaver-diff-USF7DJLU.mjs +85 -0
- package/dist/cli/flow-weaver-docs-QU2ZOXKH.mjs +96 -0
- package/dist/cli/flow-weaver-doctor-K447YWHR.mjs +43 -0
- package/dist/cli/flow-weaver-export-LAS6N56Y.mjs +140 -0
- package/dist/cli/flow-weaver-grammar-RIRUS3Q6.mjs +49 -0
- package/dist/cli/flow-weaver-grammar-diagrams-WXRTW5SK.mjs +15 -0
- package/dist/cli/flow-weaver-implement-5JG6BCFZ.mjs +114 -0
- package/dist/cli/flow-weaver-index.min-OR5SIHXD.mjs +39 -0
- package/dist/cli/flow-weaver-init-34YZNPQX.mjs +972 -0
- package/dist/cli/flow-weaver-init-personas-NOGZTQQ2.mjs +48 -0
- package/dist/cli/flow-weaver-manifest-4JNUSEB3.mjs +18 -0
- package/dist/cli/flow-weaver-market-WA4CKHKV.mjs +444 -0
- package/dist/cli/flow-weaver-mcp-setup-O26MGXSD.mjs +22 -0
- package/dist/cli/flow-weaver-migrate-VFVEUTPH.mjs +119 -0
- package/dist/cli/flow-weaver-modify-VM3JP5K6.mjs +97 -0
- package/dist/cli/flow-weaver-openapi-IRBWI3HM.mjs +71 -0
- package/dist/cli/flow-weaver-openapi-document-7N6YMPG3.mjs +30 -0
- package/dist/cli/flow-weaver-pack-commands-OS2QRXAK.mjs +146 -0
- package/dist/cli/flow-weaver-registry-5MLFRPPT.mjs +25 -0
- package/dist/cli/flow-weaver-run-DSTLSTHR.mjs +555 -0
- package/dist/cli/flow-weaver-serialization-node-LE6PCG4M.mjs +50 -0
- package/dist/cli/flow-weaver-serve-NVLCLSOW.mjs +192 -0
- package/dist/cli/flow-weaver-server-7IERLVXE.mjs +2925 -0
- package/dist/cli/flow-weaver-server-KWF4PXYC.mjs +19112 -0
- package/dist/cli/flow-weaver-status-75W2S3YB.mjs +138 -0
- package/dist/cli/flow-weaver-strip-AZPXUYVA.mjs +79 -0
- package/dist/cli/flow-weaver-templates-DSNMB6K7.mjs +72 -0
- package/dist/cli/flow-weaver-validate-A4UWDQN6.mjs +19 -0
- package/dist/cli/flow-weaver-validate-GRBZ5W4C.mjs +296 -0
- package/dist/cli/flow-weaver-validation-registry-BINGUNXX.mjs +9 -0
- package/dist/cli/flow-weaver-validator-TY56CI42.mjs +21 -0
- package/dist/cli/flow-weaver-watch-OPPERXL6.mjs +114 -0
- package/dist/cli/flow-weaver-workflow-executor-6AHYPXAN.mjs +26 -0
- package/dist/cli/flow-weaver.mjs +3557 -89498
- package/dist/cli/index.d.ts +5 -2
- package/dist/cli/pack-commands-needed.d.ts +12 -0
- package/dist/cli/program.d.ts +14 -0
- package/dist/cli/templates/ai/mock-provider.d.ts +1 -1
- package/dist/cli/templates/index.d.ts +1 -8
- package/dist/cli/templates/nodes/agent-router.d.ts +1 -1
- package/dist/cli/templates/nodes/aggregator.d.ts +1 -1
- package/dist/cli/templates/nodes/conversation-memory.d.ts +1 -1
- package/dist/cli/templates/nodes/http.d.ts +1 -1
- package/dist/cli/templates/nodes/human-approval.d.ts +1 -1
- package/dist/cli/templates/nodes/json-extractor.d.ts +1 -1
- package/dist/cli/templates/nodes/llm-call.d.ts +1 -1
- package/dist/cli/templates/nodes/prompt-template.d.ts +1 -1
- package/dist/cli/templates/nodes/rag-retriever.d.ts +1 -1
- package/dist/cli/templates/nodes/tool-executor.d.ts +1 -1
- package/dist/cli/templates/nodes/transformer.d.ts +1 -1
- package/dist/cli/templates/nodes/validator.d.ts +1 -1
- package/dist/cli/templates/shared/approval-types.d.ts +1 -1
- package/dist/cli/templates/shared/case.d.ts +14 -0
- package/dist/cli/templates/shared/llm-types.d.ts +4 -4
- package/dist/cli/templates/workflows/aggregator.d.ts +1 -1
- package/dist/cli/templates/workflows/ai-agent.d.ts +1 -1
- package/dist/cli/templates/workflows/ai-chat.d.ts +1 -1
- package/dist/cli/templates/workflows/ai-rag.d.ts +1 -1
- package/dist/cli/templates/workflows/ai-react.d.ts +1 -1
- package/dist/cli/templates/workflows/approval.d.ts +10 -0
- package/dist/cli/templates/workflows/conditional.d.ts +2 -2
- package/dist/cli/templates/workflows/error-handler.d.ts +2 -2
- package/dist/cli/templates/workflows/foreach.d.ts +1 -1
- package/dist/cli/templates/workflows/sequential.d.ts +1 -1
- package/dist/cli/templates/workflows/webhook.d.ts +1 -1
- package/dist/cli/utils/interactive.d.ts +6 -0
- package/dist/cli/utils/json-option.d.ts +8 -0
- package/dist/cli/utils/logger.d.ts +2 -0
- package/dist/compiler/durable-source-proof.d.ts +23 -0
- package/dist/compiler/executable-artifact.d.ts +29 -0
- package/dist/compiler/index.d.ts +4 -0
- package/dist/compiler/index.js +36 -0
- package/dist/console/app.js +106 -0
- package/dist/console/assets/synergenius.svg +18 -0
- package/dist/console/author.d.ts +32 -0
- package/dist/console/cli-catalog.d.ts +21 -0
- package/dist/console/cli-run.d.ts +35 -0
- package/dist/console/cli-run.js +46 -0
- package/dist/console/debug.d.ts +67 -0
- package/dist/console/diff-view.d.ts +96 -0
- package/dist/console/export.d.ts +36 -0
- package/dist/console/git.d.ts +27 -0
- package/dist/console/index.d.ts +4 -0
- package/dist/console/index.html +16 -0
- package/dist/console/index.js +203 -0
- package/dist/console/packs.d.ts +100 -0
- package/dist/console/request-guard.d.ts +10 -0
- package/dist/console/respond.d.ts +16 -0
- package/dist/console/router.d.ts +64 -0
- package/dist/console/routes-agents.d.ts +14 -0
- package/dist/console/routes-project.d.ts +3 -0
- package/dist/console/routes-runs.d.ts +3 -0
- package/dist/console/routes-services.d.ts +7 -0
- package/dist/console/routes-tools.d.ts +3 -0
- package/dist/console/runs.d.ts +69 -0
- package/dist/console/scan.d.ts +49 -0
- package/dist/console/schema.d.ts +74 -0
- package/dist/console/server.d.ts +34 -0
- package/dist/console/server.js +43264 -0
- package/dist/console/services.d.ts +119 -0
- package/dist/console/source.d.ts +23 -0
- package/dist/console/status.d.ts +68 -0
- package/dist/console/styles.css +1023 -0
- package/dist/console/terminals.d.ts +22 -0
- package/dist/console/workflow-view.d.ts +153 -0
- package/dist/constants.d.ts +5 -1
- package/dist/constants.js +56 -167
- package/dist/context/index.d.ts +10 -0
- package/dist/context/index.js +14 -191
- package/dist/coordinator/agent-gate.d.ts +107 -0
- package/dist/coordinator/bundle-digest.d.ts +20 -0
- package/dist/coordinator/clock-tick.d.ts +4 -0
- package/dist/coordinator/effect-receipts.d.ts +10 -0
- package/dist/coordinator/errors.d.ts +31 -0
- package/dist/coordinator/file-store.d.ts +3 -0
- package/dist/coordinator/gate-labeling.d.ts +33 -0
- package/dist/coordinator/gate-resolution.d.ts +28 -0
- package/dist/coordinator/index.d.ts +12 -0
- package/dist/coordinator/index.js +107 -0
- package/dist/coordinator/memory-store.d.ts +3 -0
- package/dist/coordinator/params.d.ts +18 -0
- package/dist/coordinator/run-annotations.d.ts +6 -0
- package/dist/coordinator/run-context.d.ts +11 -0
- package/dist/coordinator/run-ending.d.ts +5 -0
- package/dist/coordinator/run-outcome.d.ts +31 -0
- package/dist/coordinator/run-resume.d.ts +6 -0
- package/dist/coordinator/run-start.d.ts +4 -0
- package/dist/coordinator/run-store.d.ts +275 -0
- package/dist/coordinator/run-trace.d.ts +41 -0
- package/dist/coordinator/run-views.d.ts +12 -0
- package/dist/coordinator/runs-dir.d.ts +26 -0
- package/dist/coordinator/store.d.ts +67 -0
- package/dist/coordinator/time.d.ts +39 -0
- package/dist/coordinator/workflow-selection.d.ts +6 -0
- package/dist/deployment/index.d.ts +11 -16
- package/dist/deployment/index.js +541 -50
- package/dist/deployment/targets/base.d.ts +11 -13
- package/dist/deployment/targets/openapi-parts.d.ts +92 -0
- package/dist/diagram/arms.d.ts +70 -0
- package/dist/diagram/ascii-renderer.d.ts +1 -1
- package/dist/diagram/geometry.d.ts +22 -29
- package/dist/diagram/graph/bounds.d.ts +30 -0
- package/dist/diagram/graph/metrics.d.ts +21 -0
- package/dist/diagram/graph/nodes.d.ts +33 -0
- package/dist/diagram/graph/placement.d.ts +22 -0
- package/dist/diagram/graph/ports.d.ts +23 -0
- package/dist/diagram/graph/routing.d.ts +40 -0
- package/dist/diagram/graph/scopes.d.ts +30 -0
- package/dist/diagram/index.d.ts +15 -23
- package/dist/diagram/index.js +632 -111
- package/dist/diagram/labels.d.ts +12 -0
- package/dist/diagram/lanes.d.ts +93 -0
- package/dist/diagram/layout.d.ts +1 -1
- package/dist/diagram/material-symbols.d.ts +7 -0
- package/dist/diagram/orthogonal-router.d.ts +15 -51
- package/dist/diagram/process-view.d.ts +79 -0
- package/dist/diagram/spine.d.ts +25 -0
- package/dist/diagram/theme.d.ts +3 -5
- package/dist/diagram/types.d.ts +6 -20
- package/dist/diff/index.js +53 -9
- package/dist/diff/types.d.ts +1 -5
- package/dist/doc-metadata/extractors/annotations.d.ts +0 -4
- package/dist/doc-metadata/extractors/cli-commands.d.ts +2 -1
- package/dist/doc-metadata/extractors/core-metadata.d.ts +19 -4
- package/dist/doc-metadata/extractors/error-codes.d.ts +1 -1
- package/dist/doc-metadata/extractors/mcp-tools.d.ts +7 -3
- package/dist/doc-metadata/index.d.ts +1 -2
- package/dist/doc-metadata/index.js +2368 -9
- package/dist/doc-metadata/types.d.ts +7 -24
- package/dist/docs/guide.d.ts +33 -0
- package/dist/docs/index.d.ts +7 -4
- package/dist/docs/index.js +298 -298
- package/dist/docs/pack-topics.d.ts +18 -0
- package/dist/editor-completions/annotationValues.d.ts +1 -1
- package/dist/editor-completions/contextParser.d.ts +3 -2
- package/dist/editor-completions/dataTypes.d.ts +1 -1
- package/dist/editor-completions/goToDefinition.d.ts +1 -1
- package/dist/editor-completions/index.d.ts +8 -8
- package/dist/editor-completions/index.js +1244 -175
- package/dist/editor-completions/jsDocAnnotations.d.ts +1 -1
- package/dist/editor-completions/modifierCompletions.d.ts +1 -1
- package/dist/export/index.d.ts +7 -1
- package/dist/generated-branding.js +8 -21
- package/dist/generated-version.d.ts +1 -1
- package/dist/generated-version.js +7 -3
- package/dist/generator/annotation-generator.d.ts +84 -0
- package/dist/generator/async-detection.d.ts +1 -1
- package/dist/{body-generator.d.ts → generator/body-generator.d.ts} +7 -3
- package/dist/generator/code-utils.d.ts +15 -60
- package/dist/generator/connection-reads.d.ts +94 -0
- package/dist/generator/control-flow-plan.d.ts +74 -0
- package/dist/generator/control-flow.d.ts +1 -1
- package/dist/generator/exit-assembly.d.ts +11 -0
- package/dist/generator/index.d.ts +4 -5
- package/dist/generator/index.js +34 -11
- package/dist/generator/input-port-values.d.ts +22 -0
- package/dist/generator/{scope-function-generator.d.ts → node-arguments.d.ts} +76 -1
- package/dist/generator/node-invocation.d.ts +74 -0
- package/dist/{node-types-generator.d.ts → generator/node-types-generator.d.ts} +3 -2
- package/dist/generator/scope-closure.d.ts +23 -0
- package/dist/generator/scoped-child.d.ts +49 -0
- package/dist/{sugar-optimizer.d.ts → generator/sugar-optimizer.d.ts} +1 -1
- package/dist/generator/unified.d.ts +14 -2
- package/dist/generator/workflow-generator.d.ts +37 -0
- package/dist/index.d.ts +29 -26
- package/dist/index.js +1322 -92
- package/dist/jsdoc-port-sync/apply-diff.d.ts +15 -0
- package/dist/jsdoc-port-sync/callback-signature.d.ts +17 -0
- package/dist/jsdoc-port-sync/diff.d.ts +5 -7
- package/dist/jsdoc-port-sync/incomplete-lines.d.ts +41 -0
- package/dist/jsdoc-port-sync/index.d.ts +11 -11
- package/dist/jsdoc-port-sync/index.js +88 -45
- package/dist/jsdoc-port-sync/jsdoc-to-signature.d.ts +66 -0
- package/dist/jsdoc-port-sync/port-parser.d.ts +6 -24
- package/dist/jsdoc-port-sync/port-tag-placement.d.ts +55 -0
- package/dist/jsdoc-port-sync/scoped-ports.d.ts +21 -0
- package/dist/jsdoc-port-sync/signature-parser.d.ts +8 -1
- package/dist/jsdoc-port-sync/signature-to-jsdoc.d.ts +77 -0
- package/dist/jsdoc-port-sync/sync.d.ts +4 -1
- package/dist/marketplace/index.d.ts +5 -3
- package/dist/marketplace/index.js +62 -10
- package/dist/marketplace/install.d.ts +24 -0
- package/dist/marketplace/manifest.d.ts +1 -1
- package/dist/marketplace/npmrc.d.ts +24 -0
- package/dist/marketplace/registry.d.ts +46 -11
- package/dist/marketplace/types.d.ts +41 -24
- package/dist/marketplace/validator.d.ts +1 -1
- package/dist/mcp/debug-session.d.ts +2 -4
- package/dist/mcp/dist-imports.d.ts +12 -0
- package/dist/mcp/response-utils.d.ts +11 -9
- package/dist/mcp/server.d.ts +0 -1
- package/dist/mcp/tools-context.d.ts +11 -0
- package/dist/mcp/tools-diagram.d.ts +1 -2
- package/dist/mcp/tools-export.d.ts +2 -2
- package/dist/mcp/tools-marketplace.d.ts +1 -1
- package/dist/mcp/tools-run.d.ts +17 -0
- package/dist/mcp/tools-workflow.d.ts +3 -0
- package/dist/mcp/types.d.ts +4 -14
- package/dist/mcp/workflow-executor.d.ts +57 -19
- package/dist/npm-packages.d.ts +1 -1
- package/dist/npm-packages.js +10 -473
- package/dist/parser/annotation-parser.d.ts +88 -0
- package/dist/parser/annotation-suggestion.d.ts +23 -0
- package/dist/parser/durable-effect-contract.d.ts +10 -0
- package/dist/parser/expression-references.d.ts +101 -0
- package/dist/parser/external-node-types.d.ts +69 -0
- package/dist/{function-like.d.ts → parser/function-like.d.ts} +10 -3
- package/dist/parser/generated-sections.d.ts +25 -0
- package/dist/parser/import-resolution.d.ts +67 -0
- package/dist/parser/import-stub.d.ts +29 -0
- package/dist/parser/jsdoc/config-types.d.ts +209 -0
- package/dist/parser/jsdoc/graph-tags.d.ts +54 -0
- package/dist/parser/jsdoc/node-type-block.d.ts +23 -0
- package/dist/parser/jsdoc/parse-line-once.d.ts +11 -0
- package/dist/parser/jsdoc/port-tags.d.ts +42 -0
- package/dist/parser/jsdoc/runtime-tags.d.ts +65 -0
- package/dist/parser/jsdoc/signature-types.d.ts +52 -0
- package/dist/parser/jsdoc/workflow-block.d.ts +22 -0
- package/dist/parser/jsdoc-parser.d.ts +23 -0
- package/dist/parser/macro-expansion.d.ts +80 -0
- package/dist/parser/module-resolution.d.ts +38 -0
- package/dist/parser/node-inference.d.ts +39 -0
- package/dist/parser/npm-node-types.d.ts +24 -0
- package/dist/parser/pack-handlers.d.ts +12 -0
- package/dist/parser/path-data-resolution.d.ts +75 -0
- package/dist/parser/port-inference.d.ts +15 -0
- package/dist/{resolve-package-types.d.ts → parser/resolve-package-types.d.ts} +4 -0
- package/dist/parser/serialize-deploy-annotations.d.ts +19 -0
- package/dist/parser/tag-registry.d.ts +22 -0
- package/dist/parser/workflow-extraction.d.ts +39 -0
- package/dist/runtime/ExecutionContext.d.ts +87 -99
- package/dist/runtime/continuation-core.d.ts +147 -0
- package/dist/runtime/continuation.d.ts +48 -0
- package/dist/runtime/debug-controller.d.ts +7 -22
- package/dist/runtime/durable-execution.d.ts +176 -0
- package/dist/runtime/events.d.ts +16 -1
- package/dist/runtime/executable-module-contract.d.ts +16 -0
- package/dist/runtime/index.d.ts +13 -10
- package/dist/runtime/index.js +947 -9
- package/dist/runtime/strict-json.d.ts +15 -0
- package/dist/server/access.d.ts +12 -0
- package/dist/server/api.d.ts +126 -0
- package/dist/server/callback-delivery.d.ts +62 -0
- package/dist/server/callback-url.d.ts +44 -0
- package/dist/server/context.d.ts +35 -0
- package/dist/server/http-error.d.ts +10 -0
- package/dist/server/index.d.ts +7 -1
- package/dist/server/index.js +125 -6
- package/dist/server/openapi-document.d.ts +33 -0
- package/dist/server/openapi.d.ts +32 -0
- package/dist/server/respond.d.ts +35 -0
- package/dist/server/route-params.d.ts +17 -0
- package/dist/server/route-plan.d.ts +41 -0
- package/dist/server/routes-catalog.d.ts +5 -0
- package/dist/server/routes-declared.d.ts +12 -0
- package/dist/server/routes-runs.d.ts +8 -0
- package/dist/server/run-driver.d.ts +58 -0
- package/dist/server/run-view.d.ts +26 -0
- package/dist/server/transport.d.ts +35 -0
- package/dist/server/types.d.ts +143 -52
- package/dist/server/webhook-server.d.ts +12 -38
- package/dist/server/workflow-registry.d.ts +7 -4
- package/dist/service-registry.d.ts +49 -0
- package/dist/service-registry.js +123 -0
- package/dist/testing/assertions.d.ts +2 -2
- package/dist/testing/index.d.ts +14 -13
- package/dist/testing/index.js +582 -24
- package/dist/testing/mock-approval.d.ts +3 -5
- package/dist/testing/mock-llm.d.ts +2 -3
- package/dist/testing/recorder.d.ts +5 -6
- package/dist/testing/replayer.d.ts +6 -7
- package/dist/testing/run-store-check.d.ts +3 -0
- package/dist/testing/token-tracker.d.ts +2 -2
- package/dist/{type-mappings.d.ts → types/type-mappings.d.ts} +13 -1
- package/dist/utils/error-utils.d.ts +4 -2
- package/dist/utils/port-ordering.d.ts +2 -2
- package/dist/utils/port-tag-utils.d.ts +1 -1
- package/dist/validation/agent-detection.d.ts +17 -5
- package/dist/validation/agent-rules.d.ts +6 -7
- package/dist/validation/core-rules.d.ts +49 -0
- package/dist/validation/design-rules.d.ts +9 -3
- package/dist/validation/rule-registry.d.ts +3 -3
- package/dist/validation/rules/connections.d.ts +27 -0
- package/dist/validation/rules/context.d.ts +11 -0
- package/dist/validation/rules/cycles.d.ts +17 -0
- package/dist/validation/rules/data-flow.d.ts +19 -0
- package/dist/validation/rules/scope-topology.d.ts +35 -0
- package/dist/validation/rules/type-compatibility.d.ts +30 -0
- package/dist/validation/type-checker.d.ts +39 -0
- package/dist/validation/validator-helpers.d.ts +31 -0
- package/dist/validation/validator.d.ts +30 -0
- package/docs/reference/advanced-annotations.md +277 -60
- package/docs/reference/built-in-nodes.md +164 -94
- package/docs/reference/cancellation.md +44 -0
- package/docs/reference/cli-reference.md +252 -234
- package/docs/reference/compilation.md +36 -109
- package/docs/reference/concepts.md +80 -63
- package/docs/reference/console.md +169 -0
- package/docs/reference/debugging.md +26 -57
- package/docs/reference/deployment.md +217 -143
- package/docs/reference/durable-gates.md +445 -0
- package/docs/reference/error-codes.md +90 -43
- package/docs/reference/export-interface.md +91 -26
- package/docs/reference/iterative-development.md +50 -28
- package/docs/reference/jsdoc-grammar.md +66 -311
- package/docs/reference/library.md +250 -0
- package/docs/reference/marketplace.md +301 -152
- package/docs/reference/mcp-tools.md +102 -0
- package/docs/reference/node-conversion.md +84 -59
- package/docs/reference/orientation.md +68 -0
- package/docs/reference/scaffold.md +5 -4
- package/docs/reference/tutorial.md +106 -166
- package/docs/reference/visual-reference.md +1 -1
- package/package.json +85 -50
- package/dist/agent/agent-loop.js +0 -156
- package/dist/agent/cli-spawn-config.js +0 -65
- package/dist/agent/device-connection.d.ts +0 -79
- package/dist/agent/device-connection.js +0 -184
- package/dist/agent/env-allowlist.js +0 -60
- package/dist/agent/providers/anthropic.js +0 -198
- package/dist/agent/providers/claude-cli.js +0 -161
- package/dist/agent/providers/openai-compat.js +0 -205
- package/dist/agent/providers/platform.d.ts +0 -23
- package/dist/agent/providers/platform.js +0 -132
- package/dist/agent/streaming.js +0 -186
- package/dist/agent/types.js +0 -20
- package/dist/annotation-generator.d.ts +0 -50
- package/dist/annotation-generator.js +0 -743
- package/dist/api/builder.js +0 -345
- package/dist/api/command-runner.js +0 -787
- package/dist/api/compile.js +0 -148
- package/dist/api/extract-types.js +0 -57
- package/dist/api/generate-in-place.js +0 -1477
- package/dist/api/generate.js +0 -514
- package/dist/api/helpers.js +0 -285
- package/dist/api/inline-runtime.js +0 -526
- package/dist/api/manipulation/connections.js +0 -151
- package/dist/api/manipulation/index.js +0 -41
- package/dist/api/manipulation/node-types.js +0 -200
- package/dist/api/manipulation/nodes.js +0 -355
- package/dist/api/manipulation/ports.js +0 -228
- package/dist/api/manipulation/scopes.js +0 -156
- package/dist/api/manipulation/workflow.js +0 -116
- package/dist/api/modify-operation.js +0 -177
- package/dist/api/parse.js +0 -115
- package/dist/api/patterns.d.ts +0 -112
- package/dist/api/patterns.js +0 -303
- package/dist/api/query.js +0 -840
- package/dist/api/templates.js +0 -117
- package/dist/api/transform.js +0 -40
- package/dist/api/validate.js +0 -64
- package/dist/api/validation-registry.js +0 -10
- package/dist/api/workflow-file-operations.js +0 -180
- package/dist/ast/builder.js +0 -395
- package/dist/ast/serialization-node.js +0 -30
- package/dist/ast/serialization.js +0 -134
- package/dist/ast/types.js +0 -2
- package/dist/ast/workflow-utils.js +0 -114
- package/dist/body-generator.js +0 -35
- package/dist/built-in-nodes/coercion-types.js +0 -61
- package/dist/built-in-nodes/delay.js +0 -29
- package/dist/built-in-nodes/generated-registry.js +0 -299
- package/dist/built-in-nodes/invoke-workflow.js +0 -36
- package/dist/built-in-nodes/mock-types.js +0 -42
- package/dist/built-in-nodes/wait-for-agent.js +0 -31
- package/dist/built-in-nodes/wait-for-event.js +0 -25
- package/dist/chevrotain-parser/coerce-parser.js +0 -103
- package/dist/chevrotain-parser/connect-parser.js +0 -136
- package/dist/chevrotain-parser/fan-parser.js +0 -149
- package/dist/chevrotain-parser/grammar-diagrams.js +0 -273
- package/dist/chevrotain-parser/index.js +0 -31
- package/dist/chevrotain-parser/map-parser.js +0 -130
- package/dist/chevrotain-parser/node-parser.js +0 -558
- package/dist/chevrotain-parser/path-parser.js +0 -140
- package/dist/chevrotain-parser/port-parser.js +0 -519
- package/dist/chevrotain-parser/position-parser.d.ts +0 -20
- package/dist/chevrotain-parser/position-parser.js +0 -83
- package/dist/chevrotain-parser/scope-parser.js +0 -104
- package/dist/chevrotain-parser/tokens.js +0 -429
- package/dist/chevrotain-parser/trigger-cancel-parser.js +0 -291
- package/dist/cli/commands/account.d.ts +0 -4
- package/dist/cli/commands/account.js +0 -50
- package/dist/cli/commands/ai-credentials.d.ts +0 -12
- package/dist/cli/commands/ai-credentials.js +0 -95
- package/dist/cli/commands/apikey.d.ts +0 -4
- package/dist/cli/commands/apikey.js +0 -64
- package/dist/cli/commands/auth.d.ts +0 -9
- package/dist/cli/commands/auth.js +0 -255
- package/dist/cli/commands/compile.js +0 -331
- package/dist/cli/commands/connect.d.ts +0 -4
- package/dist/cli/commands/connect.js +0 -163
- package/dist/cli/commands/context.js +0 -51
- package/dist/cli/commands/create.js +0 -139
- package/dist/cli/commands/deploy.d.ts +0 -6
- package/dist/cli/commands/deploy.js +0 -74
- package/dist/cli/commands/dev.js +0 -227
- package/dist/cli/commands/diagram.js +0 -39
- package/dist/cli/commands/diff.js +0 -57
- package/dist/cli/commands/docs.js +0 -74
- package/dist/cli/commands/export.js +0 -153
- package/dist/cli/commands/grammar.js +0 -40
- package/dist/cli/commands/implement.js +0 -91
- package/dist/cli/commands/init-personas.js +0 -541
- package/dist/cli/commands/init.js +0 -797
- package/dist/cli/commands/market.js +0 -440
- package/dist/cli/commands/mcp-setup.js +0 -433
- package/dist/cli/commands/migrate.js +0 -91
- package/dist/cli/commands/modify.js +0 -58
- package/dist/cli/commands/openapi.js +0 -71
- package/dist/cli/commands/org.d.ts +0 -8
- package/dist/cli/commands/org.js +0 -136
- package/dist/cli/commands/pattern.d.ts +0 -34
- package/dist/cli/commands/pattern.js +0 -186
- package/dist/cli/commands/plugin.d.ts +0 -16
- package/dist/cli/commands/plugin.js +0 -176
- package/dist/cli/commands/run.js +0 -742
- package/dist/cli/commands/serve.js +0 -93
- package/dist/cli/commands/status.js +0 -123
- package/dist/cli/commands/strip.js +0 -61
- package/dist/cli/commands/templates.js +0 -58
- package/dist/cli/commands/validate.js +0 -267
- package/dist/cli/commands/watch.js +0 -71
- package/dist/cli/config/credentials.d.ts +0 -15
- package/dist/cli/config/credentials.js +0 -43
- package/dist/cli/config/platform-client.d.ts +0 -123
- package/dist/cli/config/platform-client.js +0 -248
- package/dist/cli/env-setup.js +0 -12
- package/dist/cli/index.js +0 -850
- package/dist/cli/pack-commands.js +0 -122
- package/dist/cli/postinstall.d.ts +0 -16
- package/dist/cli/postinstall.js +0 -119
- package/dist/cli/templates/ai/mock-provider.js +0 -64
- package/dist/cli/templates/ai/types.js +0 -5
- package/dist/cli/templates/approvals/index.d.ts +0 -15
- package/dist/cli/templates/approvals/index.js +0 -241
- package/dist/cli/templates/index.js +0 -123
- package/dist/cli/templates/nodes/agent-router.js +0 -114
- package/dist/cli/templates/nodes/aggregator.js +0 -63
- package/dist/cli/templates/nodes/conversation-memory.js +0 -85
- package/dist/cli/templates/nodes/http.js +0 -80
- package/dist/cli/templates/nodes/human-approval.js +0 -109
- package/dist/cli/templates/nodes/json-extractor.js +0 -119
- package/dist/cli/templates/nodes/llm-call.js +0 -106
- package/dist/cli/templates/nodes/prompt-template.js +0 -52
- package/dist/cli/templates/nodes/rag-retriever.js +0 -128
- package/dist/cli/templates/nodes/tool-executor.js +0 -108
- package/dist/cli/templates/nodes/transformer.js +0 -68
- package/dist/cli/templates/nodes/validator.js +0 -62
- package/dist/cli/templates/pack-loader.js +0 -58
- package/dist/cli/templates/providers/index.js +0 -239
- package/dist/cli/templates/shared/approval-types.js +0 -31
- package/dist/cli/templates/shared/llm-types.js +0 -109
- package/dist/cli/templates/workflows/aggregator.js +0 -101
- package/dist/cli/templates/workflows/ai-agent.js +0 -326
- package/dist/cli/templates/workflows/ai-chat.js +0 -167
- package/dist/cli/templates/workflows/ai-rag.js +0 -184
- package/dist/cli/templates/workflows/ai-react.js +0 -293
- package/dist/cli/templates/workflows/conditional.js +0 -139
- package/dist/cli/templates/workflows/error-handler.js +0 -145
- package/dist/cli/templates/workflows/foreach.js +0 -140
- package/dist/cli/templates/workflows/sequential.js +0 -200
- package/dist/cli/templates/workflows/webhook.js +0 -158
- package/dist/cli/utils/cli-helpers.d.ts +0 -44
- package/dist/cli/utils/cli-helpers.js +0 -99
- package/dist/cli/utils/logger.js +0 -126
- package/dist/cli/utils/parse-int-strict.js +0 -17
- package/dist/cli/utils/safe-write.js +0 -54
- package/dist/deployment/config/defaults.d.ts +0 -29
- package/dist/deployment/config/defaults.js +0 -98
- package/dist/deployment/config/loader.d.ts +0 -24
- package/dist/deployment/config/loader.js +0 -237
- package/dist/deployment/config/types.d.ts +0 -117
- package/dist/deployment/config/types.js +0 -5
- package/dist/deployment/core/adapters.d.ts +0 -66
- package/dist/deployment/core/adapters.js +0 -156
- package/dist/deployment/core/executor.d.ts +0 -62
- package/dist/deployment/core/executor.js +0 -197
- package/dist/deployment/core/formatters.d.ts +0 -42
- package/dist/deployment/core/formatters.js +0 -146
- package/dist/deployment/openapi/generator.d.ts +0 -146
- package/dist/deployment/openapi/generator.js +0 -347
- package/dist/deployment/openapi/schema-converter.d.ts +0 -49
- package/dist/deployment/openapi/schema-converter.js +0 -192
- package/dist/deployment/targets/base.js +0 -855
- package/dist/deployment/types.d.ts +0 -140
- package/dist/deployment/types.js +0 -8
- package/dist/diagram/ascii-renderer.js +0 -528
- package/dist/diagram/geometry.js +0 -1267
- package/dist/diagram/html-viewer.d.ts +0 -21
- package/dist/diagram/html-viewer.js +0 -1689
- package/dist/diagram/layout.js +0 -143
- package/dist/diagram/orthogonal-router.js +0 -568
- package/dist/diagram/renderer.d.ts +0 -3
- package/dist/diagram/renderer.js +0 -266
- package/dist/diagram/theme.js +0 -282
- package/dist/diagram/types.js +0 -2
- package/dist/diff/WorkflowDiffer.js +0 -429
- package/dist/diff/formatDiff.js +0 -239
- package/dist/diff/impact.js +0 -119
- package/dist/diff/types.js +0 -35
- package/dist/doc-metadata/extractors/annotations.js +0 -638
- package/dist/doc-metadata/extractors/cli-commands.js +0 -326
- package/dist/doc-metadata/extractors/core-metadata.js +0 -61
- package/dist/doc-metadata/extractors/error-codes.js +0 -372
- package/dist/doc-metadata/extractors/grammar-rules.js +0 -51
- package/dist/doc-metadata/extractors/mcp-tools.js +0 -705
- package/dist/doc-metadata/extractors/plugin-api.d.ts +0 -19
- package/dist/doc-metadata/extractors/plugin-api.js +0 -279
- package/dist/doc-metadata/types.js +0 -5
- package/dist/editor-completions/annotationValues.js +0 -146
- package/dist/editor-completions/contextParser.js +0 -410
- package/dist/editor-completions/dataTypes.js +0 -95
- package/dist/editor-completions/goToDefinition.js +0 -112
- package/dist/editor-completions/jsDocAnnotations.js +0 -359
- package/dist/editor-completions/modifierCompletions.js +0 -197
- package/dist/editor-completions/types.js +0 -8
- package/dist/export/index.js +0 -212
- package/dist/extensions/index.d.ts +0 -16
- package/dist/extensions/index.js +0 -17
- package/dist/friendly-errors.js +0 -761
- package/dist/function-like.js +0 -84
- package/dist/generator/async-detection.js +0 -56
- package/dist/generator/code-utils.js +0 -551
- package/dist/generator/compile-target-registry.d.ts +0 -20
- package/dist/generator/compile-target-registry.js +0 -20
- package/dist/generator/control-flow.js +0 -358
- package/dist/generator/dev-mode-registry.d.ts +0 -27
- package/dist/generator/dev-mode-registry.js +0 -20
- package/dist/generator/scope-function-generator.js +0 -397
- package/dist/generator/unified.js +0 -1831
- package/dist/generator.d.ts +0 -54
- package/dist/generator.js +0 -101
- package/dist/jsdoc-parser.d.ts +0 -377
- package/dist/jsdoc-parser.js +0 -1189
- package/dist/jsdoc-port-sync/constants.js +0 -103
- package/dist/jsdoc-port-sync/diff.js +0 -319
- package/dist/jsdoc-port-sync/port-parser.js +0 -579
- package/dist/jsdoc-port-sync/rename.js +0 -256
- package/dist/jsdoc-port-sync/signature-parser.js +0 -559
- package/dist/jsdoc-port-sync/sync.js +0 -653
- package/dist/marketplace/manifest.js +0 -194
- package/dist/marketplace/registry.js +0 -198
- package/dist/marketplace/types.js +0 -9
- package/dist/marketplace/validator.js +0 -150
- package/dist/mcp/agent-channel.d.ts +0 -35
- package/dist/mcp/agent-channel.js +0 -61
- package/dist/mcp/auto-registration.d.ts +0 -3
- package/dist/mcp/auto-registration.js +0 -62
- package/dist/mcp/debug-session.js +0 -25
- package/dist/mcp/index.d.ts +0 -11
- package/dist/mcp/index.js +0 -10
- package/dist/mcp/pack-tools.js +0 -59
- package/dist/mcp/prompts.js +0 -68
- package/dist/mcp/response-utils.js +0 -97
- package/dist/mcp/run-registry.d.ts +0 -29
- package/dist/mcp/run-registry.js +0 -24
- package/dist/mcp/server.js +0 -63
- package/dist/mcp/tools-context.js +0 -51
- package/dist/mcp/tools-debug.js +0 -451
- package/dist/mcp/tools-diagram.js +0 -97
- package/dist/mcp/tools-docs.js +0 -62
- package/dist/mcp/tools-export.js +0 -222
- package/dist/mcp/tools-marketplace.js +0 -132
- package/dist/mcp/tools-model.d.ts +0 -3
- package/dist/mcp/tools-model.js +0 -279
- package/dist/mcp/tools-pattern.d.ts +0 -3
- package/dist/mcp/tools-pattern.js +0 -604
- package/dist/mcp/tools-query.js +0 -377
- package/dist/mcp/tools-resources.js +0 -41
- package/dist/mcp/tools-template.js +0 -119
- package/dist/mcp/tools-workflow-run.d.ts +0 -40
- package/dist/mcp/tools-workflow-run.js +0 -150
- package/dist/mcp/types.js +0 -2
- package/dist/mcp/workflow-executor.js +0 -242
- package/dist/migration/registry.js +0 -29
- package/dist/node-types-generator.js +0 -139
- package/dist/parser/tag-registry.js +0 -57
- package/dist/parser.d.ts +0 -232
- package/dist/parser.js +0 -2500
- package/dist/plugin/PluginPanel.d.ts +0 -12
- package/dist/plugin/PluginPanel.js +0 -5
- package/dist/plugin/index.d.ts +0 -13
- package/dist/plugin/index.js +0 -14
- package/dist/plugin/types.d.ts +0 -75
- package/dist/plugin/types.js +0 -8
- package/dist/resolve-package-types.js +0 -123
- package/dist/runtime/CancellationError.js +0 -20
- package/dist/runtime/ExecutionContext.js +0 -280
- package/dist/runtime/builtin-functions.js +0 -549
- package/dist/runtime/checkpoint.d.ts +0 -84
- package/dist/runtime/checkpoint.js +0 -225
- package/dist/runtime/debug-controller.js +0 -247
- package/dist/runtime/events.js +0 -2
- package/dist/runtime/function-registry.js +0 -66
- package/dist/runtime/parameter-resolver.js +0 -113
- package/dist/server/types.js +0 -5
- package/dist/server/webhook-server.js +0 -269
- package/dist/server/workflow-registry.js +0 -202
- package/dist/shared-project.js +0 -28
- package/dist/sugar-optimizer.js +0 -498
- package/dist/testing/assertions.js +0 -127
- package/dist/testing/mock-approval.js +0 -98
- package/dist/testing/mock-llm.js +0 -119
- package/dist/testing/recorder.js +0 -70
- package/dist/testing/replayer.js +0 -143
- package/dist/testing/token-tracker.js +0 -94
- package/dist/type-checker.d.ts +0 -42
- package/dist/type-checker.js +0 -190
- package/dist/type-mappings.js +0 -131
- package/dist/types/branded-ports.d.ts +0 -151
- package/dist/types/branded-ports.js +0 -121
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.js +0 -5
- package/dist/types.d.ts +0 -139
- package/dist/types.js +0 -15
- package/dist/utils/error-utils.js +0 -27
- package/dist/utils/lru-cache.js +0 -40
- package/dist/utils/port-ordering.js +0 -81
- package/dist/utils/port-tag-utils.js +0 -41
- package/dist/utils/string-distance.js +0 -56
- package/dist/validation/agent-detection.js +0 -115
- package/dist/validation/agent-rules.js +0 -262
- package/dist/validation/design-rules.js +0 -377
- package/dist/validation/rule-registry.js +0 -37
- package/dist/validator.d.ts +0 -113
- package/dist/validator.js +0 -1631
- package/docs/reference/patterns.md +0 -159
- package/scripts/postinstall.cjs +0 -86
- /package/dist/{shared-project.d.ts → parser/shared-project.d.ts} +0 -0
- /package/dist/{friendly-errors.d.ts → validation/friendly-errors.d.ts} +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
var Ln,G,La,$s,st,Ea,Ia,Da,xs,Tn,Xt,Ma,Cs,_s,Ss,Oi,Rn={},An=[],ji=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,In=Array.isArray;function qe(t,n){for(var s in n)t[s]=n[s];return t}function Ts(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Ni(t,n,s){var a,r,o,l={};for(o in n)o=="key"?a=n[o]:o=="ref"?r=n[o]:l[o]=n[o];if(arguments.length>2&&(l.children=arguments.length>3?Ln.call(arguments,2):s),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)l[o]===void 0&&(l[o]=t.defaultProps[o]);return En(t,l,a,r,null)}function En(t,n,s,a,r){var o={type:t,props:n,key:s,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++La,__i:-1,__u:0};return r==null&&G.vnode!=null&&G.vnode(o),o}function x(t){return t.children}function Lt(t,n){this.props=t,this.context=n}function mt(t,n){if(n==null)return t.__?mt(t.__,t.__i+1):null;for(var s;n<t.__k.length;n++)if((s=t.__k[n])!=null&&s.__e!=null)return s.__e;return typeof t.type=="function"?mt(t):null}function Fi(t){if(t.__P&&t.__d){var n=t.__v,s=n.__e,a=[],r=[],o=qe({},n);o.__v=n.__v+1,G.vnode&&G.vnode(o),Es(t.__P,o,n,t.__n,t.__P.namespaceURI,32&n.__u?[s]:null,a,s??mt(n),!!(32&n.__u),r),o.__v=n.__v,o.__.__k[o.__i]=o,Ha(a,o,r),n.__e=n.__=null,o.__e!=s&&Oa(o)}}function Oa(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(n){if(n!=null&&n.__e!=null)return t.__e=t.__c.base=n.__e}),Oa(t)}function Ra(t){(!t.__d&&(t.__d=!0)&&st.push(t)&&!Pn.__r++||Ea!=G.debounceRendering)&&((Ea=G.debounceRendering)||Ia)(Pn)}function Pn(){try{for(var t,n=1;st.length;)st.length>n&&st.sort(Da),t=st.shift(),n=st.length,Fi(t)}finally{st.length=Pn.__r=0}}function ja(t,n,s,a,r,o,l,i,c,u,p){var f,d,h,v,g,m,k=a&&a.__k||An,y=n.length;for(c=Hi(s,n,k,c,y),f=0;f<y;f++)(h=s.__k[f])!=null&&(d=h.__i!=-1&&k[h.__i]||Rn,h.__i=f,m=Es(t,h,d,r,o,l,i,c,u,p),v=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&Rs(d.ref,null,h),p.push(h.ref,h.__c||v,h)),g==null&&v!=null&&(g=v),4&h.__u?(c=Na(h,c,t),d.__e&&(d.__e=null)):typeof h.type=="function"&&m!==void 0?c=m:v&&(c=v.nextSibling),h.__u&=-7);return s.__e=g,c}function Hi(t,n,s,a,r){var o,l,i,c,u,p=s.length,f=p,d=0;for(t.__k=new Array(r),o=0;o<r;o++)(l=n[o])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=t.__k[o]=En(null,l,null,null,null):In(l)?l=t.__k[o]=En(x,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=t.__k[o]=En(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):t.__k[o]=l,c=o+d,l.__=t,l.__b=t.__b+1,i=null,(u=l.__i=Wi(l,s,c,f))!=-1&&(f--,(i=s[u])&&(i.__u|=2)),i==null||i.__v==null?(u==-1&&(r>p?d--:r<p&&d++),typeof l.type!="function"&&(l.__u|=4)):u!=c&&(u==c-1?d--:u==c+1?d++:(u>c?d--:d++,l.__u|=4))):t.__k[o]=null;if(f)for(o=0;o<p;o++)(i=s[o])!=null&&(2&i.__u)==0&&(i.__e==a&&(a=mt(i)),za(i,i));return a}function Na(t,n,s){var a,r;if(typeof t.type=="function"){for(a=t.__k,r=0;a&&r<a.length;r++)a[r]&&(a[r].__=t,n=Na(a[r],n,s));return n}t.__e!=n&&(n&&t.type&&!n.parentNode&&(n=mt(t)),n=s.insertBefore(t.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function Wi(t,n,s,a){var r,o,l,i=t.key,c=t.type,u=n[s],p=u!=null&&(2&u.__u)==0;if(u===null&&i==null||p&&i==u.key&&c==u.type)return s;if(a>(p?1:0)){for(r=s-1,o=s+1;r>=0||o<n.length;)if((u=n[l=r>=0?r--:o++])!=null&&(2&u.__u)==0&&i==u.key&&c==u.type)return l}return-1}function Aa(t,n,s){n[0]=="-"?t.setProperty(n,s??""):t[n]=s==null?"":typeof s!="number"||ji.test(n)?s:s+"px"}function Cn(t,n,s,a,r){var o,l;e:if(n=="style")if(typeof s=="string")t.style.cssText=s;else{if(typeof a=="string"&&(t.style.cssText=a=""),a)for(n in a)s&&n in s||Aa(t.style,n,"");if(s)for(n in s)a&&s[n]==a[n]||Aa(t.style,n,s[n])}else if(n[0]=="o"&&n[1]=="n")o=n!=(n=n.replace(Ma,"$1")),l=n.toLowerCase(),n=l in t||n=="onFocusOut"||n=="onFocusIn"?l.slice(2):n.slice(2),t.l||(t.l={}),t.l[n+o]=s,s?a?s[Xt]=a[Xt]:(s[Xt]=Cs,t.addEventListener(n,o?Ss:_s,o)):t.removeEventListener(n,o?Ss:_s,o);else{if(r=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in t)try{t[n]=s??"";break e}catch{}typeof s=="function"||(s==null||s===!1&&n[4]!="-"?t.removeAttribute(n):t.setAttribute(n,n=="popover"&&s==1?"":s))}}function Pa(t){return function(n){if(this.l){var s=this.l[n.type+t];if(n[Tn]==null)n[Tn]=Cs++;else if(n[Tn]<s[Xt])return;return s(G.event?G.event(n):n)}}}function Es(t,n,s,a,r,o,l,i,c,u){var p,f,d,h,v,g,m,k,y,_,b,R,D,C,A,q,Z=n.type;if(n.constructor!==void 0)return null;128&s.__u&&(c=!!(32&s.__u),o=[i=n.__e=s.__e]),(p=G.__b)&&p(n);e:if(typeof Z=="function"){f=l.length;try{if(y=n.props,_=Z.prototype&&Z.prototype.render,b=(p=Z.contextType)&&a[p.__c],R=p?b?b.props.value:p.__:a,s.__c?k=(d=n.__c=s.__c).__=d.__E:(_?n.__c=d=new Z(y,R):(n.__c=d=new Lt(y,R),d.constructor=Z,d.render=Ui),b&&b.sub(d),d.state||(d.state={}),d.__n=a,h=d.__d=!0,d.__h=[],d._sb=[]),_&&d.__s==null&&(d.__s=d.state),_&&Z.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=qe({},d.__s)),qe(d.__s,Z.getDerivedStateFromProps(y,d.__s))),v=d.props,g=d.state,d.__v=n,h)_&&Z.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),_&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(_&&Z.getDerivedStateFromProps==null&&y!==v&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(y,R),n.__v==s.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(y,d.__s,R)===!1){n.__v!=s.__v&&(d.props=y,d.state=d.__s,d.__d=!1),n.__e=s.__e,n.__k=s.__k,n.__k.some(function(ie){ie&&(ie.__=n)}),An.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&l.push(d),i=mt(s);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(y,d.__s,R),_&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(v,g,m)})}if(d.context=R,d.props=y,d.__P=t,d.__e=!1,D=G.__r,C=0,_)d.state=d.__s,d.__d=!1,D&&D(n),p=d.render(d.props,d.state,d.context),An.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,D&&D(n),p=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++C<25);d.state=d.__s,d.getChildContext!=null&&(a=qe(qe({},a),d.getChildContext())),_&&!h&&d.getSnapshotBeforeUpdate!=null&&(m=d.getSnapshotBeforeUpdate(v,g)),A=p!=null&&p.type===x&&p.key==null?Wa(p.props.children):p,i=ja(t,In(A)?A:[A],n,s,a,r,o,l,i,c,u),d.base=n.__e,n.__u&=-161,d.__h.length&&l.push(d),k&&(d.__E=d.__=null)}catch(ie){if(l.length=f,n.__v=null,c||o!=null){if(ie.then){for(n.__u|=c?160:128;i&&i.nodeType==8&&i.nextSibling;)i=i.nextSibling;o!=null&&(o[o.indexOf(i)]=null),n.__e=i}else if(o!=null)for(q=o.length;q--;)Ts(o[q])}else n.__e=s.__e;n.__k==null&&(n.__k=s.__k||[]),ie.then||Fa(n),G.__e(ie,n,s)}}else o==null&&n.__v==s.__v?(n.__k=s.__k,n.__e=s.__e):i=n.__e=zi(s.__e,n,s,a,r,o,l,c,u);return(p=G.diffed)&&p(n),128&n.__u?void 0:i}function Fa(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Fa))}function Ha(t,n,s){for(var a=0;a<s.length;a++)Rs(s[a],s[++a],s[++a]);G.__c&&G.__c(n,t),t.some(function(r){try{t=r.__h,r.__h=[],t.some(function(o){o.call(r)})}catch(o){G.__e(o,r.__v)}})}function Wa(t){return typeof t!="object"||t==null||t.__b>0?t:In(t)?t.map(Wa):t.constructor!==void 0?null:qe({},t)}function zi(t,n,s,a,r,o,l,i,c){var u,p,f,d,h,v,g,m=s.props||Rn,k=n.props,y=n.type;if(y=="svg"?r="http://www.w3.org/2000/svg":y=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((h=o[u])&&"setAttribute"in h==!!y&&(y?h.localName==y:h.nodeType==3)){t=h,o[u]=null;break}}if(t==null){if(y==null)return document.createTextNode(k);t=document.createElementNS(r,y,k.is&&k),i&&(G.__m&&G.__m(n,o),i=!1),o=null}if(y==null)m===k||i&&t.data==k||(t.data=k);else{if(o=y=="textarea"&&k.defaultValue!=null?null:o&&Ln.call(t.childNodes),!i&&o!=null)for(m={},u=0;u<t.attributes.length;u++)m[(h=t.attributes[u]).name]=h.value;for(u in m)h=m[u],u=="dangerouslySetInnerHTML"?f=h:u=="children"||u in k||u=="value"&&"defaultValue"in k||u=="checked"&&"defaultChecked"in k||Cn(t,u,null,h,r);for(u in k)h=k[u],u=="children"?d=h:u=="dangerouslySetInnerHTML"?p=h:u=="value"?v=h:u=="checked"?g=h:i&&typeof h!="function"||m[u]===h||Cn(t,u,h,m[u],r);if(p)i||f&&(p.__html==f.__html||p.__html==t.innerHTML)||(t.innerHTML=p.__html),n.__k=[];else if(f&&(t.innerHTML=""),ja(n.type=="template"?t.content:t,In(d)?d:[d],n,s,a,y=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,l,o?o[0]:s.__k&&mt(s,0),i,c),o!=null)for(u=o.length;u--;)Ts(o[u]);i&&y!="textarea"||(u="value",y=="progress"&&v==null?t.removeAttribute("value"):v!=null&&(v!==t[u]||y=="progress"&&!v||y=="option"&&v!=m[u])&&Cn(t,u,v,m[u],r),u="checked",g!=null&&g!=t[u]&&Cn(t,u,g,m[u],r))}return t}function Rs(t,n,s){try{if(typeof t=="function"){var a=typeof t.__u=="function";a&&t.__u(),a&&n==null||(t.__u=t(n))}else t.current=n}catch(r){G.__e(r,s)}}function za(t,n,s){var a,r;if(G.unmount&&G.unmount(t),(a=t.ref)&&(a.current&&a.current!=t.__e||Rs(a,null,n)),(a=t.__c)!=null){if(a.componentWillUnmount)try{a.componentWillUnmount()}catch(o){G.__e(o,n)}a.base=a.__P=a.__n=null}if(a=t.__k)for(r=0;r<a.length;r++)a[r]&&za(a[r],n,s||typeof t.type!="function");s||Ts(t.__e),t.__c=t.__=t.__e=void 0}function Ui(t,n,s){return this.constructor(t,s)}function Ua(t,n,s){var a,r,o,l;n==document&&(n=document.documentElement),G.__&&G.__(t,n),r=(a=typeof s=="function")?null:s&&s.__k||n.__k,o=[],l=[],Es(n,t=(!a&&s||n).__k=Ni(x,null,[t]),r||Rn,Rn,n.namespaceURI,!a&&s?[s]:r?null:n.firstChild?Ln.call(n.childNodes):null,o,!a&&s?s:r?r.__e:n.firstChild,a,l),Ha(o,t,l),t.props.children=null}Ln=An.slice,G={__e:function(t,n,s,a){for(var r,o,l;n=n.__;)if((r=n.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(t)),l=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(t,a||{}),l=r.__d),l)return r.__E=r}catch(i){t=i}throw t}},La=0,$s=function(t){return t!=null&&t.constructor===void 0},Lt.prototype.setState=function(t,n){var s;s=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=qe({},this.state),typeof t=="function"&&(t=t(qe({},s),this.props)),t&&qe(s,t),t!=null&&this.__v&&(n&&this._sb.push(n),Ra(this))},Lt.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Ra(this))},Lt.prototype.render=x,st=[],Ia=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Da=function(t,n){return t.__v.__b-n.__v.__b},Pn.__r=0,xs=Math.random().toString(8),Tn="__d"+xs,Xt="__a"+xs,Ma=/(PointerCapture)$|Capture$/i,Cs=0,_s=Pa(!1),Ss=Pa(!0),Oi=0;var vt,oe,As,Ba,Mn=0,Qa=[],le=G,qa=le.__b,Ka=le.__r,Ga=le.diffed,Va=le.__c,Ja=le.unmount,Za=le.__;function Qt(t,n){le.__h&&le.__h(oe,t,Mn||n),Mn=0;var s=oe.__H||(oe.__H={__:[],__h:[]});return t>=s.__.length&&s.__.push({}),s.__[t]}function w(t){return Mn=1,Bi(er,t)}function Bi(t,n,s){var a=Qt(vt++,2);if(a.t=t,!a.__c&&(a.__=[s?s(n):er(void 0,n),function(i){var c=a.__N?a.__N[0]:a.__[0],u=a.t(c,i);c!==u&&(a.__N=[u,a.__[1]],a.__c.setState({}))}],a.__c=oe,!oe.__f)){var r=function(i,c,u){if(!a.__c.__H)return!0;var p=!1,f=a.__c.props!==i;if(a.__c.__H.__.some(function(h){if(h.__N){p=!0;var v=h.__[0];h.__=h.__N,h.__N=void 0,v!==h.__[0]&&(f=!0)}}),o){var d=o.call(this,i,c,u);return p?d||f:d}return!p||f};oe.__f=!0;var o=oe.shouldComponentUpdate,l=oe.componentWillUpdate;oe.componentWillUpdate=function(i,c,u){if(this.__e){var p=o;o=void 0,r(i,c,u),o=p}l&&l.call(this,i,c,u)},oe.shouldComponentUpdate=r}return a.__N||a.__}function P(t,n){var s=Qt(vt++,3);!le.__s&&Ls(s.__H,n)&&(s.__=t,s.u=n,oe.__H.__h.push(s))}function On(t,n){var s=Qt(vt++,4);!le.__s&&Ls(s.__H,n)&&(s.__=t,s.u=n,oe.__h.push(s))}function Y(t){return Mn=5,ne(function(){return{current:t}},[])}function ne(t,n){var s=Qt(vt++,7);return Ls(s.__H,n)&&(s.__=t(),s.__H=n,s.__h=t),s.__}function Ya(){var t=Qt(vt++,11);if(!t.__){for(var n=oe.__v;n!==null&&!n.__m&&n.__!==null;)n=n.__;var s=n.__m||(n.__m=[0,0]);t.__="P"+s[0]+"-"+s[1]++}return t.__}function qi(){for(var t;t=Qa.shift();){var n=t.__H;if(t.__P&&n)try{n.__h.some(Dn),n.__h.some(Ps),n.__h=[]}catch(s){n.__h=[],le.__e(s,t.__v)}}}le.__b=function(t){oe=null,qa&&qa(t)},le.__=function(t,n){t&&n.__k&&n.__k.__m&&(t.__m=n.__k.__m),Za&&Za(t,n)},le.__r=function(t){Ka&&Ka(t),vt=0;var n=(oe=t.__c).__H;n&&(As===oe?(n.__h=[],oe.__h=[],n.__.some(function(s){s.__N&&(s.__=s.__N),s.u=s.__N=void 0})):(n.__h.some(Dn),n.__h.some(Ps),n.__h=[],vt=0)),As=oe},le.diffed=function(t){Ga&&Ga(t);var n=t.__c;n&&n.__H&&(n.__H.__h.length&&(Qa.push(n)!==1&&Ba===le.requestAnimationFrame||((Ba=le.requestAnimationFrame)||Ki)(qi)),n.__H.__.some(function(s){s.u&&(s.__H=s.u,s.u=void 0)})),As=oe=null},le.__c=function(t,n){n.some(function(s){try{s.__h.some(Dn),s.__h=s.__h.filter(function(a){return!a.__||Ps(a)})}catch(a){n.some(function(r){r.__h&&(r.__h=[])}),n=[],le.__e(a,s.__v)}}),Va&&Va(t,n)},le.unmount=function(t){Ja&&Ja(t);var n,s=t.__c;s&&s.__H&&(s.__H.__.some(function(a){try{Dn(a)}catch(r){n=r}}),s.__H=void 0,n&&le.__e(n,s.__v))};var Xa=typeof requestAnimationFrame=="function";function Ki(t){var n,s=function(){clearTimeout(a),Xa&&cancelAnimationFrame(n),setTimeout(t)},a=setTimeout(s,35);Xa&&(n=requestAnimationFrame(s))}function Dn(t){var n=oe,s=t.__c;typeof s=="function"&&(t.__c=void 0,s()),oe=n}function Ps(t){var n=oe;t.__c=t.__(),oe=n}function Ls(t,n){return!t||t.length!==n.length||n.some(function(s,a){return s!==t[a]})}function er(t,n){return typeof n=="function"?n(t):n}var Gi=Symbol.for("preact-signals");function Hn(){if(Ke>1)Ke--;else{var t,n=!1;for((function(){var r=Nn;for(Nn=void 0;r!==void 0;){var o=r.S;if(o.v===r.v)for(var l=o.t;l!==void 0;l=l.x)l.i===r.i&&(l.i=o.i);r=r.o}})();en!==void 0;){var s=en;for(en=void 0,jn++;s!==void 0;){var a=s.u;if(s.u=void 0,s.f&=-3,!(8&s.f)&&nr(s))try{s.c()}catch(r){n||(t=r,n=!0)}s=a}}if(jn=0,Ke--,n)throw t}}function bt(t){if(Ke>0)return t();Is=++Vi,Ke++;try{return t()}finally{Hn()}}var Yt,se=void 0;function tn(t){var n=se,s=Yt;se=void 0,Yt=void 0;try{return t()}finally{se=n,Yt=s}}var en=void 0,Ke=0,jn=0,Vi=0,Is=0,Nn=void 0,Fn=0;function tr(t){if(se!==void 0){var n=t.n;if(n===void 0||n.t!==se)return n={i:0,S:t,p:se.s,n:void 0,t:se,e:void 0,x:void 0,r:n},se.s!==void 0&&(se.s.n=n),se.s=n,t.n=n,32&se.f&&t.S(n),n;if(n.i===-1)return n.i=0,n.n!==void 0&&(n.n.p=n.p,n.p!==void 0&&(n.p.n=n.n),n.p=se.s,n.n=void 0,se.s.n=n,se.s=n),n}}function de(t,n){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=n?.watched,this.Z=n?.unwatched,this.name=n?.name}de.prototype.brand=Gi;de.prototype.h=function(){return!0};de.prototype.S=function(t){var n=this,s=this.t;s!==t&&t.e===void 0&&(t.x=s,this.t=t,s!==void 0?s.e=t:tn(function(){var a;(a=n.W)==null||a.call(n)}))};de.prototype.U=function(t){var n=this;if(this.t!==void 0){var s=t.e,a=t.x;s!==void 0&&(s.x=a,t.e=void 0),a!==void 0&&(a.e=s,t.x=void 0),t===this.t&&(this.t=a,a===void 0&&tn(function(){var r;(r=n.Z)==null||r.call(n)}))}};de.prototype.subscribe=function(t){var n=this;return yt(function(){var s=n.value;tn(function(){return t(s)})},{name:"sub"})};de.prototype.valueOf=function(){return this.value};de.prototype.toString=function(){return this.value+""};de.prototype.toJSON=function(){return this.value};de.prototype.peek=function(){var t=this;return tn(function(){return t.value})};Object.defineProperty(de.prototype,"value",{get:function(){var t=tr(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(jn>100)throw new Error("Cycle detected");(function(s){Ke!==0&&jn===0&&s.l!==Is&&(s.l=Is,Nn={S:s,v:s.v,i:s.i,o:Nn})})(this),this.v=t,this.i++,Fn++,Ke++;try{for(var n=this.t;n!==void 0;n=n.x)n.t.N()}finally{Hn()}}}});function I(t,n){return new de(t,n)}function nr(t){for(var n=t.s;n!==void 0;n=n.n)if(n.S.i!==n.i||!n.S.h()||n.S.i!==n.i)return!0;return!1}function sr(t){for(var n=t.s;n!==void 0;n=n.n){var s=n.S.n;if(s!==void 0&&(n.r=s),n.S.n=n,n.i=-1,n.n===void 0){t.s=n;break}}}function ar(t){for(var n=t.s,s=void 0;n!==void 0;){var a=n.p;n.i===-1?(n.S.U(n),a!==void 0&&(a.n=n.n),n.n!==void 0&&(n.n.p=a)):s=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=a}t.s=s}function kt(t,n){de.call(this,void 0,n),this.x=t,this.s=void 0,this.g=Fn-1,this.f=4}kt.prototype=new de;kt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Fn))return!0;if(this.g=Fn,this.f|=1,this.i>0&&!nr(this))return this.f&=-2,!0;var t=se;try{sr(this),se=this;var n=this.x();(16&this.f||this.v!==n||this.i===0)&&(this.v=n,this.f&=-17,this.i++)}catch(s){this.v=s,this.f|=16,this.i++}return se=t,ar(this),this.f&=-2,!0};kt.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var n=this.s;n!==void 0;n=n.n)n.S.S(n)}de.prototype.S.call(this,t)};kt.prototype.U=function(t){if(this.t!==void 0&&(de.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var n=this.s;n!==void 0;n=n.n)n.S.U(n)}};kt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(kt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=tr(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Ge(t,n){return new kt(t,n)}function rr(t){var n=t.m;if(t.m=void 0,typeof n=="function"){Ke++;var s=se;se=void 0;try{n()}catch(a){throw t.f&=-2,t.f|=8,Ds(t),a}finally{se=s,Hn()}}}function Ds(t){for(var n=t.s;n!==void 0;n=n.n)n.S.U(n);t.x=void 0,t.s=void 0,rr(t)}function Ji(t){if(se!==this)throw new Error("Out-of-order effect");ar(this),se=t,this.f&=-2,8&this.f&&Ds(this),Hn()}function It(t,n){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=n?.name,Yt&&Yt.push(this)}It.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var n=this.x();typeof n=="function"&&(this.m=n)}finally{t()}};It.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,rr(this),sr(this),Ke++;var t=se;return se=this,Ji.bind(this,t)};It.prototype.N=function(){2&this.f||(this.f|=2,this.u=en,en=this)};It.prototype.d=function(){this.f|=8,1&this.f||Ds(this)};It.prototype.dispose=function(){this.d()};function yt(t,n){var s=new It(t,n);try{s.c()}catch(r){throw s.d(),r}var a=s.d.bind(s);return a[Symbol.dispose]=a,a}var or,zn,Wn,Zi=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var ir=[];yt(function(){or=this.N})();function Dt(t,n){G[t]=n.bind(null,G[t]||function(){})}function nn(t){if(Wn){var n=Wn;Wn=void 0,n()}Wn=t&&t.S()}function lr(t){var n=this,s=t.data,a=Qi(s);a.name="ReactiveDom",a.value=s;var r=ne(function(){for(var i=n,c=n.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var u=Ge(function(){var h=a.value.value;return h===0?0:h===!0?"":h||""}),p=Ge(function(){return!Array.isArray(u.value)&&!$s(u.value)}),f=yt(function(){if(this.N=cr,p.value){var h=u.value;i.__v&&i.__v.__e&&i.__v.__e.nodeType===3&&(i.__v.__e.data=h)}}),d=n.__$u.d;return n.__$u.d=function(){f(),d.call(this)},[p,u]},[]),o=r[0],l=r[1];return o.value?l.peek():l.value}lr.displayName="ReactiveTextNode";Object.defineProperties(de.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:lr},props:{configurable:!0,get:function(){var t=this;return{data:{get value(){return t.value}}}}},__b:{configurable:!0,value:1}});Dt("__b",function(t,n){if(nn(),zn=void 0,typeof n.type=="string"){var s,a=n.props;for(var r in a)if(r!=="children"){var o=a[r];o instanceof de&&(s||(n.__np=s={}),s[r]=o,a[r]=o.peek())}}t(n)});Dt("__r",function(t,n){if(t(n),n.type!==x){nn();var s,a=n.__c;a&&(a.__$f&=-2,(s=a.__$u)===void 0&&(a.__$u=s=(function(r,o){var l;return yt(function(){l=this},{name:o}),l.c=r,l})((function(r){return function(){var o;Zi&&((o=this.y)==null||o.call(this)),r.__$f|=1,r.setState({})}})(a),typeof n.type=="function"?n.type.displayName||n.type.name:""))),zn=a,nn(s)}});Dt("__e",function(t,n,s,a){nn(),zn=void 0,t(n,s,a)});Dt("diffed",function(t,n){nn(),zn=void 0;var s;if(typeof n.type=="string"&&(s=n.__e)){var a=n.__np,r=n.props,o=s.U;if(o)for(var l in o){var i=o[l];i===void 0||a&&l in a||(i.d(),o[l]=void 0)}if(a){o||(o={},s.U=o);for(var c in a){var u=o[c],p=a[c];u===void 0?(u=Xi(s,c,p,r),o[c]=u):u.o(p,r)}}}t(n)});function Xi(t,n,s,a){var r=n in t&&t.ownerSVGElement===void 0,o=I(s);return{o:function(l,i){o.value=l,a=i},d:yt(function(){this.N=cr;var l=o.value.value;a[n]!==l&&(a[n]=l,r?t[n]=l:l!=null&&(l!==!1||n[4]==="-")?t.setAttribute(n,l):t.removeAttribute(n))})}}Dt("unmount",function(t,n){if(typeof n.type=="string"){var s=n.__e;if(s){var a=s.U;if(a){s.U=void 0;for(var r in a){var o=a[r];o&&o.d()}}}var l=n.__np;if(l){var i=n.props;for(var c in l)i[c]=l[c]}n.__np=void 0}else{var u=n.__c;if(u){var p=u.__$u;p&&(u.__$u=void 0,p.d())}}t(n)});Dt("__h",function(t,n,s,a){a<3&&(n.__$f|=2),t(n,s,a)});Lt.prototype.shouldComponentUpdate=function(t,n){if(this.__R)return!0;var s=this.__$u,a=s&&s.s!==void 0;for(var r in n)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var o=2&this.__$f;if(!(a||o||4&this.__$f)||1&this.__$f)return!0}else if(!(a||4&this.__$f)||3&this.__$f)return!0;for(var l in t)if(l!=="__source"&&t[l]!==this.props[l])return!0;for(var i in this.props)if(!(i in t))return!0;return!1};function Qi(t,n){return ne(function(){return I(t,n)},[])}var Yi=function(t){queueMicrotask(function(){queueMicrotask(t)})};function el(){bt(function(){for(var t;t=ir.shift();)or.call(t)})}function cr(){ir.push(this)===1&&(G.requestAnimationFrame||Yi)(el)}async function K(t){let n=await fetch(t),s=await n.json();if(!n.ok)throw new Error(s.error||n.statusText);return s}async function Te(t,n){let s=await fetch(t,{method:"POST",headers:{"content-type":"application/json"},body:n===void 0?void 0:JSON.stringify(n)}),a=await s.json();if(!s.ok)throw new Error(a.error||s.statusText);return a}async function Mt(t,n){let s=await fetch(t,{method:"PUT",headers:{"content-type":"application/json"},body:n===void 0?void 0:JSON.stringify(n)}),a=await s.json();if(!s.ok)throw new Error(a.error||s.statusText);return a}async function Ms(t){let n=await fetch(t,{method:"DELETE"}),s=await n.json();if(!n.ok)throw new Error(s.error||n.statusText);return s}function sn(t,n,s){let a=new EventSource(t);return a.onmessage=r=>n(JSON.parse(r.data)),s&&(a.onopen=s),()=>a.close()}var M={get(t,n){try{let s=localStorage.getItem(t);return s===null?n:JSON.parse(s)}catch{return n}},set(t,n){try{localStorage.setItem(t,JSON.stringify(n))}catch{}}},Ve=t=>new URLSearchParams(t).toString();var ur=()=>({states:{},passes:{},values:{},errors:{},indexed:{}});function dr(t,n,s,a){if(a!==void 0){let r=t.passes[n]?.find(l=>l.index===a);if(r&&s in r.values)return r.values[s];let o=t.indexed[`${n}.${s}`];if(o&&a in o)return o[a]}return t.values[`${n}.${s}`]}function Os(t,n,s,a){let r=t.passes[n]??=[],o=r.length?r[r.length-1]:void 0,l=s??o?.index??0,i=r.find(c=>c.index===l);return!i&&!a&&o?o:(i||(i={index:l,status:"",values:{}},r.push(i),r.sort((c,u)=>c.index-u.index)),i)}function tl(t,n,s){let a=t.passes[n]??[s],r=a.reduce((o,l)=>o+(l.start!=null&&l.end!=null?l.end-l.start:0),0);t.states[n]={status:s.status,start:s.start,end:s.end,count:a.length,total:r}}var nl=new Set(["SUCCEEDED","FAILED","CANCELLED"]);function pr(t,n,s){if(s.type==="STATUS_CHANGED"){let a=Os(t,s.id,s.executionIndex,!0);a.status=s.status,s.status==="RUNNING"&&(a.start??=n),nl.has(s.status)&&(a.end=n),tl(t,s.id,a)}else if(s.type==="VARIABLE_SET"){let a=s.identifier?.id,r=s.identifier?.portName;a&&r&&(t.values[`${a}.${r}`]=s.value,Os(t,a,s.identifier.executionIndex,!1).values[r]=s.value,typeof s.identifier.executionIndex=="number"&&((t.indexed[`${a}.${r}`]??={})[s.identifier.executionIndex]=s.value))}else s.type==="LOG_ERROR"?(t.errors[s.id]=s.error,Os(t,s.id,s.executionIndex,!1).error=s.error):s.type==="WORKFLOW_COMPLETED"&&s.result!==void 0&&(t.result=s.result)}function fr(t){if(t.length)return(t.find(n=>n.status==="FAILED"||n.error)??t[t.length-1]).index}function an(t){let n=[],s="",a=!1,r=null;for(let o=0;o<t.length;o++){let l=t[o];if(r){if(l===r){r=null;continue}if(l==="\\"&&r==='"'&&o+1<t.length){s+=t[++o];continue}s+=l;continue}if(l==='"'||l==="'"){r=l,a=!0;continue}if(l==="\\"&&o+1<t.length){s+=t[++o],a=!0;continue}if(/\s/.test(l)){a&&(n.push(s),s="",a=!1);continue}s+=l,a=!0}return a&&n.push(s),n}function Ne(t){return/[\s"'\\]/.test(t)||t===""?`"${t.replace(/(["\\])/g,"\\$1")}"`:t}var Je=t=>!!t&&!t.parseErrors,vr=()=>({phase:"idle",text:"",thinking:"",tools:[]});function sl(t,n){switch(n.phase){case"start":Object.assign(t,vr(),{phase:"answering",profile:n.profile,provider:n.provider,model:n.model});break;case"text":t.text+=n.text;break;case"thinking":t.thinking+=n.text;break;case"tool":if(n.stage==="start")t.tools.push({name:n.name,args:n.args,done:!1});else{let s=[...t.tools].reverse().find(a=>a.name===n.name&&!a.done);s?Object.assign(s,{result:n.result,isError:n.isError,done:!0}):t.tools.push({name:n.name,args:n.args,result:n.result,isError:n.isError,done:!0})}break;case"usage":t.usage={promptTokens:n.promptTokens,completionTokens:n.completionTokens,...n.costUsd?{costUsd:n.costUsd}:{}};break;case"done":Object.assign(t,{phase:"done",outcome:n.outcome,error:n.error,reason:n.reason,ms:n.ms});break}}var we=I({dir:"",name:"",parent:""}),V=I([]),W=I(null),Le=I([]),z=I(null),ae=I(null),rt=I(Date.now()),jt=I(""),ot=I(null),Ze=I("diff"),qn=I(null);function br(t,n="worktree"){qn.value={from:t,to:n},S.side.value="changes"}var kr=t=>t.kind==="project"||t.kind==="agents"||t.kind==="endpoints",T=I({kind:"workflow"}),Xe=I([]),ye=I(null),Nt=I(""),rn=I(""),he=I([]),on=I([]),Ft=I({isPack:!1}),xt=I([]),j={line:I(""),focus:I(!1),build:I(!1),runs:I([]),history:I(M.get("cli-history",[]))},S={side:I("run"),pass:I(null),docSide:I("contents"),railW:I(M.get("railW",284)),sideW:I(M.get("sideW",420)),railOpen:I(!1),collapsed:I(new Set(M.get("collapsed",[]))),railTab:I(M.get("railTab","workflows")),packSide:I("project"),guideShut:I(new Set(M.get("guideShut",[]))),picker:I(!1),search:I(!1),width:I(window.innerWidth),drawer:I(M.get("drawer",null)),drawerH:I(M.get("drawerH",240))},js=I(!1),Ns=620,yr=Ge(()=>S.width.value<Ns),Ht=Ge(()=>!!z.value&&(z.value.status==="running"||z.value.status==="waiting")),ln=Ge(()=>Je(W.value)?W.value.issues.filter(t=>t.severity==="error").length:0);setInterval(()=>{Ht.value&&(rt.value=Date.now())},500);window.addEventListener("resize",()=>{S.width.value=window.innerWidth});document.fonts?.load('15px "Material Symbols Outlined"').then(t=>{js.value=t.length>0}).catch(()=>{});function O(t){jt.value=t,setTimeout(()=>{jt.value===t&&(jt.value="")},1800)}var Bn=null;function cn(t){Bn?.();let n=null;Bn=sn(`/api/runs/${t}/events`,s=>{if(s.type==="run"){let{agent:a,agents:r,...o}=n??{};n=n?{...o,...s.run}:{...s.run,...ur(),synced:!1,agentLog:vr()},["completed","failed","cancelled"].includes(s.run.status)&&Gn()}else s.type==="event"&&n?pr(n,s.t,s.e):s.type==="agent"&&n?sl(n.agentLog,s):s.type==="synced"&&n&&(n.synced=!0);n?.synced&&(z.value={...n,states:{...n.states},passes:{...n.passes},values:{...n.values},agentLog:{...n.agentLog,tools:[...n.agentLog.tools]}})})}function un(){Bn?.(),Bn=null,z.value=null}function wr(t){let n=z.value;if(!n)return"";if(n.status==="waiting"&&n.gate?.node===t)return"WAITING";if(n.debug?.status==="paused"&&n.debug.node===t)return"PAUSED";let s=n.states[t];return s?.status==="RUNNING"&&n.status!=="running"?"":s?.status==="CANCELLED"&&n.status!=="cancelled"?"skipped":s?.status?s.status:n.traced!==!1&&["completed","failed","cancelled"].includes(n.status)?"skipped":""}function dn(t){let n=z.value?.states[t];return n&&n.total>0?n.total:n?.start!=null&&n?.end!=null?n.end-n.start:null}function xr(t){return z.value?.passes[t]??[]}function _r(t){return z.value?.states[t]?.count??0}function Fs(t,n,s){let a=z.value;return a?dr(a,t,n,s):void 0}function He(t){return(t.status==="running"||t.status==="waiting"?rt.value:t.updatedAt)-t.startedAt}var Sr=900,Kn=I(!1),$r=0;function al(){Kn.value=!0,$r=Date.now()+Sr}function Cr(){let t=Math.max(0,$r-Date.now());setTimeout(()=>{V.value.every(n=>n.checked)&&(Kn.value=!1)},t)}var Un=null,Tr=t=>`${t.file}|${t.name}`,hr=0;async function Ot(){al();let t=new Map;Un=t;let n=++hr;try{let s=await K("/api/workflows");n===hr&&(V.value=s.map(a=>a.checked?a:t.get(Tr(a))??a))}finally{Un===t&&(Un=null),Cr()}}async function Gn(){let t=W.value;t&&(Le.value=await K(`/api/runs?${Ve({file:t.file,name:t.name})}`))}var wt=I(null);async function ke(t,n,s=!1){s||(un(),ae.value=null,S.railTab.value="workflows",T.value={kind:"workflow"});let a=`${t}|${n}`;wt.value=a;let r=Date.now()+Sr;try{let[o,l]=await Promise.all([K(`/api/workflow?${Ve({file:t,name:n})}`),K(`/api/runs?${Ve({file:t,name:n})}`)]);bt(()=>{W.value=o,Le.value=l,S.railOpen.value=!1,at.value=new Set(M.get(Rr(o),[]))}),T.value.kind==="workflow"&&(location.hash=Lr(o.rel||t,n))}finally{setTimeout(()=>{wt.value===a&&(wt.value=null)},Math.max(0,r-Date.now()))}}async function pn(t,n={}){let s=W.value;M.set(`params:${s.file}:${s.name}`,t);let a={file:s.file,name:s.name,params:t};n.mocks&&Object.keys(n.mocks).length&&(a.mocks=n.mocks),n.agents&&(a.agents=n.agents),n.debug&&(a.debug=!0,a.breakpoints=[...at.value],a.runTo=n.runTo??"first");let r=await Te("/api/runs",a);ae.value=null,cn(r.id),Gn()}async function Er(t){await Ms(`/api/runs/${t}`),z.value?.id===t&&un(),await Gn()}var it=t=>t.flatMap(n=>[n,...it(n.children)]),at=I(new Set),Rr=t=>`bp:${t.file}:${t.name}`,Ar=Ge(()=>z.value?.debug?.status==="paused");async function Qe(t,n={}){let s=z.value;s?.debug&&await Te(`/api/runs/${s.id}/debug`,{action:t,...n})}function Vn(t){let n=W.value;if(!n)return;let s=new Set(at.value),a=!s.has(t);a?s.add(t):s.delete(t),at.value=s,M.set(Rr(n),[...s]);let r=z.value;r?.debug&&(r.debug.status==="paused"||r.debug.status==="running")&&Qe("breakpoint",{op:a?"add":"remove",node:t})}async function Pr(t){await Te(`/api/runs/${z.value.id}/resolve`,t)}async function Jn(){await Te(`/api/runs/${z.value.id}/cancel`)}var gr;sn("/api/events",t=>{if(t.type==="changed"&&(clearTimeout(gr),gr=setTimeout(async()=>{await Ot();let n=W.value;n&&t.file===n.file&&(await ke(n.file,n.name,!0),O("file changed, reloaded"))},250)),t.type==="runs"&&(Gn(),Ot()),t.type==="checked"){let n=t.workflow;Un?.set(Tr(n),n),V.value=V.value.map(s=>s.file===n.file&&s.name===n.name?n:s),V.value.every(s=>s.checked)&&Cr()}t.type==="project"&&(K("/api/project").then(n=>{we.value=n}),Ot(),Ws().catch(()=>{})),t.type==="client"&&location.reload(),t.type==="services"&&(fn().catch(()=>{}),zt().catch(()=>{}),t.kind==="serve"&&t.state==="running"&&t.url&&O(`server up at ${t.url}`),t.state==="exited"&&t.error&&O(`${t.kind==="serve"?"server":"watch"} stopped: ${t.error}`))},()=>{Ot()});async function Hs(t){let n=await Te("/api/project",{dir:t});un(),bt(()=>{we.value=n,W.value=null,Le.value=[],ae.value=null,S.picker.value=!1}),await Ot();let s=V.value[0];s?await ke(s.file,s.name):location.hash=""}var Lr=(t,n)=>`${encodeURIComponent(t)}/${n}`;async function rl(){Xe.value=await K("/api/docs/guide")}async function J(t,n=""){if(S.railOpen.value=!1,S.railTab.value="guide",ye.value?.slug!==t){T.value={kind:"doc",slug:t},Nt.value=n,ye.value=null;try{ye.value=await K(`/api/docs/topic?slug=${encodeURIComponent(t)}`)}catch(s){O(s.message),T.value={kind:"workflow"};return}}else bt(()=>{T.value={kind:"doc",slug:t},Nt.value=n});S.docSide.value==="project"&&!Xe.value.flatMap(s=>s.topics).find(s=>s.slug===t)?.related&&(S.docSide.value="contents"),location.hash=`doc/${t}${n?`/${encodeURIComponent(n)}`:""}`}function lt(){T.value={kind:"workflow"},S.railTab.value="workflows";let t=W.value;location.hash=t?Lr(t.rel,t.name):""}async function Ws(){he.value=await K("/api/packs"),on.value=await K("/api/export/targets").catch(()=>[]),Ft.value=await K("/api/pack-project").catch(()=>({isPack:!1}))}function Fe(){S.railOpen.value=!1,T.value={kind:"project"},location.hash="project",fn().catch(()=>{})}var Ye=I(null),We=t=>Ye.value?.services.find(n=>n.kind===t);async function fn(){let t=await K("/api/services");return Ye.value=t,t}async function et(t,n){Ye.value=await Te(`/api/services/${t}/start`,n??{}),zt().catch(()=>{})}async function ze(t,n){Ye.value=await Te(`/api/services/${t}/stop`,n?{pid:n}:{}),zt().catch(()=>{})}async function Ir(t){Ye.value=await Te(`/api/services/${t}/restart`,{}),zt().catch(()=>{})}async function zs(t,n){Ye.value=await Mt(`/api/services/${t}/settings`,n)}function Ee(t){S.drawer.value=t,M.set("drawer",t)}function Dr(){S.drawer.value=null,M.set("drawer",null)}var pe=I(null);async function tt(){let t=await K("/api/agents");return pe.value=t,t}async function Mr(t,n){pe.value=await Mt(`/api/agents/profiles/${encodeURIComponent(t)}`,n)}async function Or(t){pe.value=await Ms(`/api/agents/profiles/${encodeURIComponent(t)}`)}async function jr(t){pe.value=await Mt("/api/agents/default",{name:t})}async function Wt(t,n){pe.value=await Mt("/api/agents/gates",{key:t,profile:n})}async function Nr(t){return Te(`/api/agents/try/${encodeURIComponent(t)}`)}async function Fr(t){return(await K(`/api/agents/env?name=${encodeURIComponent(t)}`)).set}function _e(){S.railOpen.value=!1,T.value={kind:"agents"},location.hash="agents",tt()}async function Hr(){await Te(`/api/runs/${z.value.id}/agent`,{})}var _t=I(null);async function zt(){let t=await K("/api/serve");return _t.value=t,t}var St=I(null);async function Ut(){let t=await K("/api/endpoints");return St.value=t,_t.value=t.serve,t}function Ue(){S.railOpen.value=!1,T.value={kind:"endpoints"},location.hash="endpoints",Ut()}async function Wr(t,n,s){let a=await Mt("/api/workflow/http",{file:t,name:n,routes:s});W.value&&W.value.file===t&&W.value.name===n&&(W.value=a),St.value&&Ut().catch(()=>{})}function hn(t,n){ke(t,n),S.side.value="serve"}function Us(){S.railOpen.value=!1,S.railTab.value="packs",T.value={kind:"author"},location.hash="author"}async function zr(t){let n=W.value;return Te("/api/export",{file:n.file,name:n.name,...t})}function Bs(){S.railOpen.value=!1,S.railTab.value="packs",T.value={kind:"market"},location.hash="market"}async function Re(t){S.railOpen.value=!1,S.railTab.value="packs",T.value={kind:"pack",name:t},location.hash=`pack/${encodeURIComponent(t)}`,he.value.some(n=>n.name===t)||await Ws()}async function Zn(){xt.value.length||(xt.value=await K("/api/cli/commands"))}function ce(t){let n=W.value,s=t.replace(/^(fw|flow-weaver)\s+/,"").replace(/\s*\[options\]/g,"");n&&(s=s.replace(/<(input|file|workflow-file|path|workflow\.ts)>/g,Ne(n.rel))),j.line.value=s,j.build.value=!1,j.focus.value=!0,Ee("cli")}function Ur(t){let n=`${Date.now()}-${Math.random().toString(36).slice(2,7)}`,s=t[0]==="fw"||t[0]==="flow-weaver"?t.slice(1):t,a=new AbortController,r={id:n,args:s,out:"",err:"",code:null,running:!0,stop:()=>a.abort()};j.runs.value=[r,...j.runs.value].slice(0,20);let o=l=>{j.runs.value=j.runs.value.map(i=>i.id===n?{...i,...l}:i)};fetch("/api/cli/run",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({argv:s}),signal:a.signal}).then(async l=>{if(!l.ok||!l.body){let p=await l.json().catch(()=>({}));o({running:!1,error:p.error||l.statusText});return}let i=l.body.getReader(),c=new TextDecoder,u="";for(;;){let{value:p,done:f}=await i.read();if(f)break;u+=c.decode(p,{stream:!0});let d;for(;(d=u.indexOf(`
|
|
2
|
+
|
|
3
|
+
`))>=0;){let h=u.slice(0,d);u=u.slice(d+2);let v=h.split(`
|
|
4
|
+
`).filter(k=>k.startsWith("data: ")).map(k=>k.slice(6)).join(`
|
|
5
|
+
`);if(!v)continue;let g=JSON.parse(v),m=j.runs.value.find(k=>k.id===n);g.type==="out"?o({out:m.out+g.text}):g.type==="err"?o({err:m.err+g.text}):g.type==="exit"&&o({running:!1,code:g.code,ms:g.ms,error:g.error})}}o({running:!1})}).catch(l=>o({running:!1,error:l.name==="AbortError"?"stopped":l.message}))}function qs(t){j.runs.value.find(n=>n.id===t)?.stop()}j.history.subscribe(t=>M.set("cli-history",t));fn().catch(()=>{});S.railTab.subscribe(t=>M.set("railTab",t));async function mr(t=!1){let n=decodeURIComponent(location.hash.slice(1));if(n==="market"){T.value.kind!=="market"&&Bs();return}if(n==="author"){T.value.kind!=="author"&&Us();return}if(n==="project"||n==="status"){T.value.kind!=="project"&&Fe();return}if(n==="agents"){T.value.kind!=="agents"&&_e();return}if(n==="endpoints"){T.value.kind!=="endpoints"&&Ue();return}let s=n.match(/^pack\/(.+)$/);if(s){let u=decodeURIComponent(s[1]);(T.value.kind!=="pack"||T.value.name!==u)&&await Re(u);return}let a=n.match(/^doc\/([^/]+)(?:\/(.*))?$/);if(a){let u=a[2]?decodeURIComponent(a[2]):"";(T.value.kind!=="doc"||T.value.slug!==a[1]||Nt.value!==u)&&await J(a[1],u);return}if(!n&&t){Fe();return}let r=n.lastIndexOf("/"),[o,l]=r>0?[n.slice(0,r),n.slice(r+1)]:["",""],c=V.value.find(u=>u.rel===o&&u.name===l)??(t?V.value.find(u=>/figma/.test(u.rel))??V.value[0]:void 0);T.value.kind!=="workflow"&&(T.value={kind:"workflow"}),c&&!(W.value&&W.value.file===c.file&&W.value.name===c.name)&&await ke(c.file,c.name)}async function Br(){let t=T.value,[n]=await Promise.all([K("/api/project"),Ot(),rl().catch(()=>{}),Ws().catch(()=>{})]);we.value=n,T.value===t&&wt.value===null&&await mr(!0),window.addEventListener("hashchange",()=>{mr()})}var Ae=t=>{let n=Math.max(0,(Date.now()-t)/1e3);if(n<60)return`${n|0}s ago`;if(n<3600)return`${n/60|0}m ago`;if(n<86400)return`${n/3600|0}h ago`;let s=n/86400|0;return s<7?`${s}d ago`:new Date(t).toLocaleDateString()},ee=t=>t==null?"":t<1?"<1 ms":t<1e3?`${Math.round(t)} ms`:t<6e4?`${(t/1e3).toFixed(t<1e4?2:1)} s`:t<36e5?`${Math.floor(t/6e4)}m ${Math.round(t%6e4/1e3)}s`:`${Math.floor(t/36e5)}h ${Math.round(t%36e5/6e4)}m`,qr=t=>{let n=JSON.stringify(t)?.length??0;return n<1024?`${n} B`:`${(n/1024).toFixed(1)} KB`};function Kr(t){if(t===void 0)return"\u2014";if(t===null)return"null";if(typeof t=="string")return JSON.stringify(t.length>60?t.slice(0,57)+"\u2026":t);if(typeof t!="object")return String(t);if(Array.isArray(t))return`[${t.length}]`;let n=Object.keys(t);return`{ ${n.slice(0,4).join(", ")}${n.length>4?", \u2026":""} }`}var Gr=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase(),ol=new Set(["blue","purple","cyan","orange","pink","green","red","yellow","teal"]),Bt=t=>t&&ol.has(t)?`var(--c-${t})`:null;function Ie(t,n){let s=t.replace(/\\/g,"/");return`vscode://file${s.startsWith("/")?s:`/${s}`}${n?`:${n}`:""}`}var De=t=>t.toLowerCase().replace(/`/g,"").replace(/[^\p{L}\p{N}\s-]/gu,"").trim().replace(/\s+/g,"-"),Be=t=>t.replace(/^@[^/]+\//,"").replace(/^flow-weaver-pack-/,""),Ks=t=>/[\s"'\\]/.test(t)||t===""?`"${t.replace(/(["\\])/g,"\\$1")}"`:t;function il(t){let n=s=>s.kind==="folder"?0:s.kind==="file"?1:2;return t.sort((s,a)=>n(s)-n(a)||s.label.localeCompare(a.label))}function Vr(t){for(let n of t.children)n.kind!=="workflow"?(Vr(n),t.errors+=n.errors,t.warnings+=n.warnings,t.waiting+=n.waiting,t.checked&&=n.checked):(t.errors+=n.workflow.errors,t.warnings+=n.workflow.warnings,t.waiting+=n.workflow.waiting,t.checked&&=n.workflow.checked);il(t.children)}function Jr(t){let n={kind:"folder",key:"",label:"",children:[],errors:0,warnings:0,waiting:0,checked:!0},s=new Map([["",n]]),a=new Map;for(let r of t)a.set(r.rel,(a.get(r.rel)??0)+1);for(let r of t){let o=r.rel.split("/"),l=o.pop(),i="",c=n;for(let u of o){i=i?`${i}/${u}`:u;let p=s.get(i);p||(p={kind:"folder",key:i,label:u,children:[],errors:0,warnings:0,waiting:0,checked:!0},s.set(i,p),c.children.push(p)),c=p}if((a.get(r.rel)??0)>1){let u=s.get(r.rel);u||(u={kind:"file",key:r.rel,label:l,children:[],errors:0,warnings:0,waiting:0,checked:!0},s.set(r.rel,u),c.children.push(u)),c=u}c.children.push({kind:"workflow",key:`${r.file}|${r.name}`,label:r.name,workflow:r})}return Vr(n),Zr(n.children)}function Zr(t){return t.map(n=>{if(n.kind!=="folder")return n;let s={...n,children:Zr(n.children)};for(;s.kind==="folder"&&s.children.length===1&&s.children[0].kind==="folder";){let a=s.children[0];s={...s,key:a.key,label:`${s.label}/${a.label}`,children:a.children}}return s})}function Xr(t){let n=t.split("/");n.pop();let s=[],a="";for(let r of n)a=a?`${a}/${r}`:r,s.push(a);return s}var ll=typeof navigator>"u"?"":`${navigator.userAgentData?.platform??""} ${navigator.platform??""} ${navigator.userAgent??""}`,qt=/Mac|iPhone|iPad|iPod/i.test(ll);function Gs(t){return t.split("+").map(n=>{let s=n.trim().toLowerCase();return s==="mod"?qt?"\u2318":"Ctrl":s==="shift"?qt?"\u21E7":"Shift":s==="alt"?qt?"\u2325":"Alt":s==="ctrl"?qt?"\u2303":"Ctrl":s==="esc"?"Esc":s==="enter"?qt?"\u21A9":"Enter":n.trim().length===1?n.trim().toUpperCase():n.trim()}).join(qt?"":"+")}var cl=0;function e(t,n,s,a,r,o){n||(n={});var l,i,c=n;if("ref"in c)for(i in c={},n)i=="ref"?l=n[i]:c[i]=n[i];var u={type:t,props:c,key:s,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--cl,__i:-1,__u:0,__source:r,__self:o};if(typeof t=="function"&&(l=t.defaultProps))for(i in l)c[i]===void 0&&(c[i]=l[i]);return G.vnode&&G.vnode(u),u}function xe({label:t,shortcut:n,side:s="right",children:a}){let r=Y(null),[o,l]=w(null),i=Y(void 0),c=()=>{window.clearTimeout(i.current),i.current=window.setTimeout(()=>{let p=r.current?.getBoundingClientRect();if(!p)return;let f=s!=="right"&&p.left+p.width/2>window.innerWidth-180;l(s==="right"?{x:p.right+8,y:p.top+p.height/2,end:f}:s==="top"?{x:f?window.innerWidth-p.right:p.left+p.width/2,y:p.top-8,end:f}:{x:f?window.innerWidth-p.right:p.left+p.width/2,y:p.bottom+8,end:f})},350)},u=()=>{window.clearTimeout(i.current),l(null)};return P(()=>()=>window.clearTimeout(i.current),[]),e("span",{class:"tipwrap",ref:r,onMouseEnter:c,onMouseLeave:u,onFocusCapture:c,onBlurCapture:u,onMouseDown:u,children:[a,o&&e("span",{class:`tip ${s} ${o.end?"end":""}`,role:"tooltip",style:o.end?`right: ${o.x}px; top: ${o.y}px`:`left: ${o.x}px; top: ${o.y}px`,children:[t,n&&e("kbd",{children:Gs(n)})]})]})}function ge({combo:t}){return e("span",{class:"kbd",children:Gs(t)})}function ul(){let[t,n]=w(we.value.dir),[s,a]=w([]),[r,o]=w([]),[l,i]=w("/"),[c,u]=w(""),[p,f]=w(""),[d,h]=w(!1);P(()=>{let g=!0;return K(`/api/browse?dir=${encodeURIComponent(t)}`).then(m=>{g&&(a(m.entries),u(m.parent),o(m.crumbs??[]),f(""),i(m.crumbs?.length?m.crumbs[0].dir.slice(0,m.crumbs[0].dir.length-m.crumbs[0].name.length):m.dir))}).catch(m=>{g&&(f(m.message),a([]))}),()=>{g=!1}},[t]),P(()=>{let g=m=>{m.key==="Escape"&&(S.picker.value=!1)};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[]);let v=async()=>{h(!0);try{await Hs(t)}catch(g){f(g.message)}finally{h(!1)}};return e(x,{children:[e("div",{class:"scrim",onClick:()=>{S.picker.value=!1}}),e("div",{class:"dialog",role:"dialog","aria-label":"Open project",children:[e("div",{class:"dialoghead",children:[e("b",{children:"Open project"}),e("span",{class:"sp"}),e("button",{class:"btn ghost sm",onClick:()=>{S.picker.value=!1},children:["Close",e(ge,{combo:"esc"})]})]}),e("div",{class:"crumbs",children:[e("button",{class:"crumb",onClick:()=>n(l),title:l,children:e("span",{class:"ms",children:"home"})}),r.map(g=>e("button",{class:"crumb",onClick:()=>n(g.dir),children:g.name},g.dir))]}),e("div",{class:"dialogbody",children:[p&&e("div",{class:"empty",style:"color:var(--err)",children:p}),c&&c!==t&&e("button",{class:"pickrow",onClick:()=>n(c),children:[e("span",{class:"ms",children:"drive_folder_upload"}),e("span",{class:"t",children:".."})]}),s.map(g=>e("button",{class:"pickrow",onClick:()=>n(g.dir),onDblClick:()=>Hs(g.dir),children:[e("span",{class:"ms",children:"folder"}),e("span",{class:"t",children:g.name})]},g.dir)),!s.length&&!p&&e("div",{class:"empty",children:"no subdirectories"})]}),e("div",{class:"dialogfoot",children:[e("span",{class:"mono",title:t,children:t}),e("button",{class:"btn primary sm",disabled:d,onClick:v,children:"Open this folder"})]})]})]})}var Xn=(t,n)=>`${t} ${n}${t===1?"":"s"}`;function dl(t,n){return t?n?`${Xn(t,"error")}, ${Xn(n,"warning")}`:Xn(t,"error"):n?Xn(n,"warning"):"valid"}function Vs({errors:t,warnings:n,waiting:s,checked:a=!0,busy:r=!1}){return e(x,{children:[s>0&&e("span",{class:"count",children:s}),a&&!Kn.value&&!r?e("span",{class:`dot ${t?"err":n?"warn":""}`,role:"img","aria-label":dl(t,n)}):e("span",{class:"spinner",role:"img",title:r?"opening":"checking","aria-label":r?"opening":"checking"})]})}var Js=21;function Qr({node:t,depth:n}){let s={"padding-left":`${9+n*Js}px`};if(t.kind==="workflow"){let o=t.workflow,l=W.value,i=l&&l.file===o.file&&l.name===o.name;return e("button",{class:`item ${i?"on":""}`,style:s,onClick:()=>ke(o.file,o.name),children:[e("span",{class:`ticon ${o.gates?"gated":""}`,title:o.gates?`${o.gates} gate${o.gates>1?"s":""}`:void 0,children:e("span",{class:"ms",children:o.gates?"pause_circle":"conversion_path"})}),e("span",{class:"t",children:e("b",{children:t.label})}),e(Vs,{errors:o.errors,warnings:o.warnings,waiting:o.waiting,checked:o.checked,busy:wt.value===t.key})]})}let a=S.collapsed.value.has(t.key);return e(x,{children:[e("button",{class:"folder",style:s,onClick:()=>{let o=new Set(S.collapsed.value);a?o.delete(t.key):o.add(t.key),S.collapsed.value=o,M.set("collapsed",[...o])},children:[e("span",{class:`caret ${a?"":"open"}`,children:"\u25B8"}),e("span",{class:"ticon ms",children:t.kind==="file"?"description":a?"folder":"folder_open"}),e("span",{class:"t",children:t.kind==="file"?t.label.replace(/\.ts$/,""):t.label}),a&&e(Vs,{errors:t.errors,warnings:t.warnings,waiting:t.waiting,checked:t.checked})]}),!a&&t.children.map(o=>e(Qr,{node:o,depth:n+1},o.key))]})}function pl({filter:t}){let n=T.value.kind==="doc"?T.value.slug:null,s=S.guideShut.value,[a,r]=w(new Map),o=t.trim().length>=2;P(()=>{if(!o){r(new Map);return}let c=setTimeout(()=>{K(`/api/docs/search?q=${encodeURIComponent(t.trim())}&limit=60`).then(u=>{let p=new Map;for(let f of u)f.heading&&p.set(f.slug,[...p.get(f.slug)??[],f].slice(0,5));r(p)}).catch(()=>r(new Map))},250);return()=>clearTimeout(c)},[t]);let l=c=>{let u=new Set(s);u.has(c)?u.delete(c):u.add(c),S.guideShut.value=u,M.set("guideShut",[...u])};P(()=>{if(!n)return;let c=Xe.value.find(u=>u.topics.some(p=>p.slug===n));if(c&&s.has(c.title)){let u=new Set(s);u.delete(c.title),S.guideShut.value=u}setTimeout(()=>document.querySelector(".railtree .item.on")?.scrollIntoView({block:"nearest"}),0)},[n]);let i=t.trim().toLowerCase();return e(x,{children:Xe.value.map(c=>{let u=i?c.topics.filter(f=>f.name.toLowerCase().includes(i)||f.slug.includes(i)||a.has(f.slug)):c.topics;if(!u.length)return null;let p=!i&&s.has(c.title);return e("div",{children:[e("button",{class:"folder",style:{"padding-left":"9px"},onClick:()=>l(c.title),children:[e("span",{class:`caret ${p?"":"open"}`,children:"\u25B8"}),e("span",{class:"ticon ms",children:p?"menu_book":"auto_stories"}),e("span",{class:"t",children:c.title}),p&&e("span",{class:"hint",children:c.topics.length})]}),!p&&u.map(f=>e("div",{children:[e("button",{class:`item ${n===f.slug?"on":""}`,style:{"padding-left":`${9+Js}px`},title:f.description,onClick:()=>J(f.slug),children:[e("span",{class:"ticon",children:e("span",{class:"ms",children:"article"})}),e("span",{class:"t",children:e("b",{children:f.name.replace(/^Flow Weaver /,"")})})]}),o&&(a.get(f.slug)??[]).map(d=>e("button",{class:"item section",style:{"padding-left":`${9+Js*2}px`},title:d.excerpt,onClick:()=>J(f.slug,d.heading),children:e("span",{class:"t",children:[e("b",{children:d.heading}),e("small",{children:d.excerpt.split(`
|
|
6
|
+
`)[0]})]})},d.heading))]},f.slug))]},c.title)})})}function fl({filter:t}){let n=T.value.kind==="pack"?T.value.name:null,s=t.trim().toLowerCase(),a=he.value.filter(c=>!s||c.namespace.includes(s)||c.name.toLowerCase().includes(s)),r=T.value.kind==="market",o=T.value.kind==="author",l=Ft.value,i=e(x,{children:[l.isPack&&e("button",{class:`item ${o?"on":""}`,onClick:Us,title:l.name,children:[e("span",{class:"ticon",children:e("span",{class:"ms",children:"construction"})}),e("span",{class:"t",children:[e("b",{children:"This pack"}),e("small",{children:[l.name,l.version?`@${l.version}`:""]})]})]}),e("button",{class:`item ${r?"on":""}`,onClick:Bs,children:[e("span",{class:"ticon",children:e("span",{class:"ms",children:"search"})}),e("span",{class:"t",children:[e("b",{children:"Find a pack"}),e("small",{children:"the marketplace"})]})]})]});return he.value.length?e(x,{children:[i,a.map(c=>e("button",{class:`item ${n===c.name?"on":""}`,title:c.name,onClick:()=>Re(c.name),children:[e("span",{class:`ticon ${c.compatible===!1?"warnicon":""}`,children:e("span",{class:"ms",children:c.compatible===!1?"warning":"inventory_2"})}),e("span",{class:"t",children:[e("b",{children:c.namespace}),e("small",{children:[c.version,c.nodeTypes.length?`, ${c.nodeTypes.length} node type${c.nodeTypes.length>1?"s":""}`:"",c.exportTargets.length?`, ${c.exportTargets.length} target${c.exportTargets.length>1?"s":""}`:""]})]})]},c.name)),!a.length&&e("div",{class:"empty",children:['nothing matching "',t,'"']})]}):e(x,{children:[i,e("div",{class:"empty",children:["No packs installed in ",we.value.name||"this project","."]})]})}function hl({w:t}){let n=W.value,s=n&&n.file===t.file&&n.name===t.name;return e("button",{class:`item ${s?"on":""}`,onClick:()=>ke(t.file,t.name),children:[e("span",{class:`ticon ${t.gates?"gated":""}`,children:e("span",{class:"ms",children:t.gates?"pause_circle":"conversion_path"})}),e("span",{class:"t",children:[e("b",{children:t.name}),e("small",{children:t.rel})]}),e(Vs,{errors:t.errors,warnings:t.warnings,waiting:t.waiting,checked:t.checked,busy:wt.value===`${t.file}|${t.name}`})]})}function Yr(){let[t,n]=w(""),s=t.trim().toLowerCase(),a=s?V.value.filter(u=>u.name.toLowerCase().includes(s)||u.rel.toLowerCase().includes(s)):V.value,r=s?null:Jr(a),o=S.railTab.value,l=V.value.reduce((u,p)=>u+p.waiting,0),i=W.value;P(()=>{if(!i||!S.collapsed.value.size)return;let u=Xr(i.rel);if(!u.some(f=>S.collapsed.value.has(f)))return;let p=new Set(S.collapsed.value);for(let f of u)p.delete(f);S.collapsed.value=p},[i?.file,i?.name]);let c=[{id:"workflows",label:"Workflows",icon:"conversion_path",badge:l,badgeKind:"waiting"},{id:"guide",label:"Guide",icon:"menu_book"},{id:"packs",label:"Packs",icon:"inventory_2",badge:he.value.length,badgeKind:"dim"}];return e(x,{children:[e("nav",{class:"bar","aria-label":"Views",children:[e(xe,{label:"Search",shortcut:"mod+K",children:e("button",{"aria-label":"Search",onClick:()=>{S.search.value=!0},children:e("span",{class:"ms",children:"search"})})}),e("span",{class:"barsep"}),c.map(u=>e(xe,{label:u.badge&&u.badgeKind==="waiting"?`${u.label}, ${u.badge} waiting at a gate`:u.label,children:e("button",{class:o===u.id?"on":"","aria-label":u.label,onClick:()=>{S.railTab.value=u.id},children:[e("span",{class:"ms",children:u.icon}),!!u.badge&&e("span",{class:`badge ${u.badgeKind??""}`,children:u.badge})]})},u.id)),e("span",{class:"sp"}),e(xe,{label:`Project, server ${We("serve")?.state==="running"?"up":We("serve")?.state==="starting"?"starting":"down"}`,children:e("button",{class:T.value.kind==="project"?"on":"","aria-label":"Project",onClick:Fe,children:[e("span",{class:"ms",children:"space_dashboard"}),We("serve")?.state==="running"&&e("span",{class:"livedot"})]})}),e(xe,{label:"Endpoints: workflows over HTTP",children:e("button",{class:T.value.kind==="endpoints"?"on":"","aria-label":"Endpoints",onClick:Ue,children:e("span",{class:"ms",children:"api"})})}),e(xe,{label:"Agents: what answers an agent gate",children:e("button",{class:T.value.kind==="agents"?"on":"","aria-label":"Agents",onClick:_e,children:e("span",{class:"ms",children:"smart_toy"})})}),e(xe,{label:"Open another project",children:e("button",{"aria-label":"Open another project",onClick:()=>{S.picker.value=!S.picker.value},children:e("span",{class:"ms",children:"folder_open"})})})]}),e("div",{class:"railbody",children:[e("div",{class:"brand",children:[e("b",{children:"Flow Weaver"}),e("button",{class:"projectbtn",onClick:()=>{S.picker.value=!S.picker.value},title:we.value.dir,children:[we.value.name,e("span",{class:"caret",children:"\u25BE"})]})]}),S.picker.value&&e(ul,{}),e("div",{class:"railhead",children:[e("h4",{children:c.find(u=>u.id===o)?.label}),e("input",{type:"text",class:"filter",placeholder:"filter",value:t,onInput:u=>n(u.target.value)})]}),e("div",{class:"railtree",children:o==="guide"?e(pl,{filter:t}):o==="packs"?e(fl,{filter:t}):e(x,{children:[r?r.map(u=>e(Qr,{node:u,depth:0},u.key)):a.map(u=>e(hl,{w:u},`${u.file}|${u.name}`)),!a.length&&e("div",{class:"empty",children:s?`nothing matching "${t}"`:`no workflows in ${we.value.dir||"this directory"}`})]})}),e("footer",{class:"railfoot",children:["Built by",e("img",{src:"/synergenius.svg",alt:"",width:"14",height:"14"}),"Synergenius"]})]})]})}function gl({file:t,name:n}){let[s,a]=w(!1),[r,o]=w(!1),l=Y(null);P(()=>{if(!s)return;let u=f=>{l.current?.contains(f.target)||a(!1)},p=f=>{f.key==="Escape"&&a(!1)};return window.addEventListener("mousedown",u),window.addEventListener("keydown",p),()=>{window.removeEventListener("mousedown",u),window.removeEventListener("keydown",p)}},[s]);let i=u=>`/api/artifact?${Ve({file:t,name:n,kind:u,theme:r?"dark":"light"})}`;return e("div",{class:"share",ref:l,children:[e(xe,{label:"Download as a document or a diagram",side:"bottom",children:e("button",{class:`btn sm ${s?"on":""}`,onClick:()=>a(!s),children:[e("span",{class:"ms",style:"font-size:15px",children:"ios_share"})," Share"]})}),s&&e("div",{class:"sharemenu",children:[[{kind:"brief",icon:"description",label:"Brief",what:"The workflow as a page for a PM or an architect: the graph to click through, what goes in and out, where people are needed."},{kind:"pdf",icon:"picture_as_pdf",label:"Brief (PDF)",what:"A one-page overview (the graph beside what goes in, what comes out, the pauses and the failure arms), then every step in detail. Printed by the browser on this machine."},{kind:"svg",icon:"image",label:"Diagram (SVG)",what:"The spine as drawn here, as a vector image for a slide or a document."}].map(u=>e("a",{class:"shareitem",href:i(u.kind),download:!0,onClick:()=>a(!1),children:[e("span",{class:"ms",children:u.icon}),e("span",{class:"t",children:[e("b",{children:u.label}),e("small",{children:u.what})]}),e("span",{class:"ms dl",children:"download"})]},u.kind)),e("label",{class:"check sharetheme",children:[e("input",{type:"checkbox",checked:r,onChange:u=>o(u.target.checked)}),e("span",{children:"Dark theme"})]})]})]})}function eo(){let t=W.value,n=yr.value&&e("button",{class:"btn ghost sm menu-btn",onClick:()=>{S.railOpen.value=!S.railOpen.value},title:"Workflows","aria-label":"Workflows",children:e("span",{class:"ms",children:"menu"})});if(T.value.kind==="doc"){let c=T.value.slug,u=Xe.value.find(p=>p.topics.some(f=>f.slug===c));return e("div",{class:"head docbar",children:[e("div",{class:"grow",children:e("div",{class:"meta",children:[n,e("span",{children:"Guide"}),u&&e(x,{children:[e("span",{class:"sep",children:"\u203A"}),e("span",{children:u.title})]}),ye.value&&e(x,{children:[e("span",{class:"sep",children:"\u203A"}),e("span",{class:"here",children:ye.value.name})]})]})}),e("div",{class:"actions",children:t&&e("button",{class:"btn sm",onClick:lt,children:["\u2190 ",t.name]})})]})}if(kr(T.value)){let c=T.value.kind;return e("div",{class:"head docbar",children:[e("div",{class:"grow",children:e("div",{class:"meta",children:[n,e("span",{children:we.value.name||"Project"})]})}),e("div",{class:"seg projectnav",children:[e("button",{class:c==="project"?"on":"",onClick:Fe,children:"Overview"}),e("button",{class:c==="endpoints"?"on":"",onClick:Ue,children:"Endpoints"}),e("button",{class:c==="agents"?"on":"",onClick:_e,children:"Agents"})]}),e("div",{class:"actions",children:t&&e("button",{class:"btn sm",onClick:lt,children:["\u2190 ",t.name]})})]})}if(T.value.kind==="author")return e("div",{class:"head docbar",children:[e("div",{class:"grow",children:e("div",{class:"meta",children:[n,e("span",{children:"Packs"}),e("span",{class:"sep",children:"\u203A"}),e("span",{class:"here",children:"This pack"})]})}),e("div",{class:"actions",children:t&&e("button",{class:"btn sm",onClick:lt,children:["\u2190 ",t.name]})})]});if(T.value.kind==="market")return e("div",{class:"head docbar",children:[e("div",{class:"grow",children:e("div",{class:"meta",children:[n,e("span",{children:"Packs"}),e("span",{class:"sep",children:"\u203A"}),e("span",{class:"here",children:"Marketplace"})]})}),e("div",{class:"actions",children:t&&e("button",{class:"btn sm",onClick:lt,children:["\u2190 ",t.name]})})]});if(T.value.kind==="pack"){let c=T.value.name,u=he.value.find(p=>p.name===c);return e("div",{class:"head docbar",children:[e("div",{class:"grow",children:e("div",{class:"meta",children:[n,e("span",{children:"Packs"}),e("span",{class:"sep",children:"\u203A"}),e("span",{class:"here",children:u?.namespace??c})]})}),e("div",{class:"actions",children:t&&e("button",{class:"btn sm",onClick:lt,children:["\u2190 ",t.name]})})]})}if(!t)return e("div",{class:"hint",style:"padding:40px 0",children:"Pick a workflow."});let s=e("h1",{children:[n,e("span",{children:t.name})]});if(!Je(t))return e("div",{class:"head",children:e("div",{class:"grow",children:[s,e("div",{class:"meta",children:[e("span",{class:"mono",children:t.rel}),e("span",{class:"pill err",children:"does not parse"})]})]})});let a=z.value,r=ln.value,o=t.issues.length-r,l=t.model.steps.filter(c=>c.kind==="pause").length;rt.value;let i=a?a.debug?.status==="paused"?e("span",{class:"pill debug",children:["paused ",a.debug.phase," ",t.nodes[a.debug.node??""]?.label??a.debug.node]}):a.debug?.status==="running"?e("span",{class:"pill debug",children:["stepping, ",ee(He(a))]}):a.status==="running"?e("span",{class:"pill run",children:["running, ",ee(He(a))]}):a.status==="waiting"?e("span",{class:"pill gate",children:["waiting at ",a.gate?.node]}):a.status==="completed"?e("span",{class:"pill ok",children:["completed in ",ee(He(a))]}):a.status==="failed"?e("span",{class:"pill err",children:"failed"}):e("span",{class:"pill",children:"cancelled"}):null;return e("div",{class:"head",children:[e("div",{class:"grow",children:[s,e("div",{class:"meta",children:[e("span",{class:"mono",children:t.rel}),e("span",{children:[t.model.steps.length," step",t.model.steps.length===1?"":"s",l?`, ${l} gate${l>1?"s":""}`:""]}),r>0&&e("span",{class:"pill err",children:[r," error",r>1?"s":""]}),o>0&&e("span",{class:"pill warn",children:[o," warning",o>1?"s":""]}),!r&&!o&&e("span",{class:"pill ok",children:"valid"}),!t.compiled&&e("button",{class:"pill linkpill",title:"Runs here use a private compile, so this is not a problem. fw compile writes the generated body into this file, for code of your own to call.",onClick:()=>J("compilation"),children:"not compiled in place"}),i]})]}),e("div",{class:"actions",children:[e(gl,{file:t.file,name:t.name}),Ht.value&&e("button",{class:"btn danger",onClick:()=>Jn(),children:a?.debug?"Stop":"Cancel"})]})]})}function ml(t){return t.pull?!0:!(t.entered.length>0||t.successTo.length>0||t.failureTo.length>0)&&(t.reads.length>0||t.produces.length>0)}function vl(t,n,s,a,r){let{byId:o,enteredBy:l,claimed:i,pulled:c}=s,u=o.get(n)?.step,p=[],f=new Set([n]),d=t;for(;d&&!f.has(d);){f.add(d);let h=o.get(d);if(!h?.step||i.has(d)||c.has(d)||h.owner!==a||(h.step.inScope??null)!==r)break;let v=d!==t&&!!u&&[...u.successTo,...u.failureTo].includes(d),g=l.get(d)??new Set;if(v||[...g].some(k=>k!==n&&!p.includes(k)))break;p.push(d);let m=[...h.step.successTo,...h.step.failureTo];d=m.length===1?m[0]:void 0}return p}function to(t,n=[]){let s=new Map(t.map(d=>[d.id,d])),a=new Map,r=(d,h)=>(a.get(d)??a.set(d,new Set).get(d)).add(h);for(let d of t)if(d.step)for(let h of[...d.step.successTo,...d.step.failureTo])r(h,d.id);for(let d of n)r("Exit",d.from);let o=new Set(t.filter(d=>d.step&&ml(d.step)).map(d=>d.id)),l=new Set,i=[],c={byId:s,enteredBy:a,claimed:l,pulled:o};for(let d of t){let h=d.step;if(!h?.failureTo.length||!h.failureTo.some(m=>!h.successTo.includes(m)))continue;let v=h.inScope??null,g=[];for(let m of h.failureTo){if(h.successTo.includes(m))continue;let k=vl(m,h.id,c,d.owner,v);if(k.length){for(let y of k)l.add(y);g.push(k)}}g.length&&i.push({gate:h.id,ids:g.flat()})}let u=t.filter(d=>{if(!d.step||l.has(d.id)||o.has(d.id))return!1;let h=[...a.get(d.id)??[]];return!(h.length<=1||!h.every(v=>s.get(v)?.step?.failureTo.includes(d.id))||h.every(v=>s.get(v)?.owner===d.id))}),p=d=>i.some(h=>h!==d&&d.ids.includes(h.gate)),f=[...t];for(let d of i){let h=d.ids.map(m=>f.find(k=>k.id===m)).filter(m=>!!m);if(!h.length)continue;f=f.filter(m=>!d.ids.includes(m.id));let v=f.findIndex(m=>m.id===d.gate);if(v<0)continue;let g=v+1;if(p(d)){let m=s.get(d.gate)?.step;for(;g<f.length&&m?.successTo.includes(f[g].id);)g++}f.splice(g,0,...h)}for(let d of u){let h=f.findIndex(k=>k.id===d.id),v=[...a.get(d.id)??[]],g=Math.max(...v.map(k=>f.findIndex(y=>y.id===k)));if(h<0||g<0||g<h)continue;let[m]=f.splice(h,1);f.splice(g,0,m)}return{flat:f,arms:i}}var bl=26,kl=11,yl=12;function no(t){return t?t.pull?!0:!(t.entered.length>0||t.successTo.length>0||t.failureTo.length>0)&&(t.reads.length>0||t.produces.length>0):!1}function Zs(t){let n=[{id:"Start",step:null,depth:0,owner:null}],s=($,L,B)=>{for(let Q of $)n.push({id:Q.id,step:Q,depth:L,owner:B}),s(Q.children,L+1,Q.id)};s(t.steps,0,null),n.push({id:"Exit",step:null,depth:0,owner:null});let a=to(n,t.exitFrom);n.length=0,n.push(...a.flat);let r=new Map(n.map($=>[$.id,$]));for(let $ of[...n]){if(!no($.step))continue;let L=new Set($.step.produces.flatMap(N=>N.to)),B=n.findIndex(N=>N.id===$.id),Q=n.findIndex((N,te)=>te!==B&&L.has(N.id));Q<0||(n.splice(B,1),n.splice(Q>B?Q-1:Q,0,$))}let o={};n.forEach(($,L)=>{o[$.id]=L});let l=[],i=new Set,c=new Set,u=($,L,B)=>{if(!(L in o)||!($ in o)||o[L]<=o[$])return;let Q=`${$}>${L}`;i.has(Q)||(i.add(Q),l.push({from:$,to:L,kind:B}))},p=[],f=$=>$.forEach(L=>{p.push(L),f(L.children)});f(t.steps);let d=$=>no(r.get($)?.step??null);for(let $ of t.startTo)d($)||u("Start",$,"ok");for(let $ of p){if($.children.length){let L=$.children;u($.id,L[0].id,"loop");let B=new Set(L.map(N=>N.id));for(let N of L){for(let te of N.successTo)B.has(te)&&u(N.id,te,"ok");for(let te of N.failureTo)B.has(te)&&u(N.id,te,"fail")}let Q=L.filter(N=>!N.successTo.some(te=>B.has(te)));for(let N of Q)for(let te of $.successTo)u(N.id,te,"return");if(Q.length)for(let N of $.successTo)c.add(`${$.id}>${N}`)}if(d($.id)){for(let L of $.reads)u(L.from,$.id,"pull");for(let L of new Set($.produces.flatMap(B=>B.to)))u($.id,L,"pull");continue}for(let L of $.successTo)d(L)||u($.id,L,"ok");for(let L of $.failureTo)d(L)||u($.id,L,"fail")}for(let $ of t.exitFrom)u($.from,"Exit",$.arm==="fail"?"fail":"ok");let h=l.filter($=>!($.kind==="ok"&&c.has(`${$.from}>${$.to}`)));l.length=0,l.push(...h);let v=[],g=($,L=0)=>{let B=v.findIndex((Q,N)=>Q===null&&N!==$&&N>=L);if(B<0)for(B=Math.max(v.length,L);v.length<=B;)v.push(null);return B},m=new Map,k={},y=new Map,_=new Map;for(let $ of l)(_.get($.from)??_.set($.from,[]).get($.from)).push($);for(let $ of n){let L=v.map((U,Se)=>U===$.id?Se:-1).filter(U=>U>=0);for(let U of L)v[U]=null;let Q=L.length>1&&v.every(U=>U===null),N=L.length?Q?0:Math.min(...L):g();if(k[$.id]=N,$.step?.children.length){let U=Se=>Se.forEach(Pt=>{y.set(Pt.id,N),U(Pt.children)});U($.step.children)}let te=(_.get($.id)??[]).slice().sort((U,Se)=>o[U.to]-o[Se.to]),Ce=n[o[$.id]+1]?.id,Pe=te.filter(U=>U.kind==="ok"||U.kind==="return"||U.kind==="pull"),F=Pe.find(U=>U.to===Ce)??Pe[0];for(let U of te){let Se=U.kind==="loop"||U.kind==="fail",Pt=U.kind==="return"?y.get($.id):void 0,ht=U.kind==="fail"&&r.get(U.to)?.owner?(y.get(U.to)??0)+1:0,Zt=Pt??(U===F&&!Se?N:g(Se?N:void 0,ht));v[Zt]=U.to,m.set(`${U.from}>${U.to}`,Zt)}}let b=n.map($=>({...$,lane:k[$.id]})),R=l.map($=>({...$,fromLane:k[$.from],lane:m.get(`${$.from}>${$.to}`),toLane:k[$.to]})),D=Math.max(1,...b.map($=>$.lane+1),...R.map($=>$.lane+1)),C=new Array(D).fill(!1);for(let $ of b)C[$.lane]=!0;let A=[],q=0;for(let $=0;$<D;$++){let L=C[$]?bl/2:kl/2;q+=L,A.push(q),q+=L}let Z=[];for(let $ of b){if(!$.step?.children.length)continue;let L=new Map,B=(Q,N)=>Q.forEach(te=>{let Ce=te.inScope??N,Pe=o[te.id];Pe!==void 0&&(L.get(Ce)??L.set(Ce,[]).get(Ce)).push(Pe),B(te.children,Ce)});B($.step.children,$.step.scope??null);for(let[Q,N]of L)N.length&&Z.push({owner:$.id,scope:Q,first:Math.min(...N),last:Math.max(...N),depth:$.depth,lane:Math.min(...N.map(te=>b[te].lane))})}let ie=[];for(let $ of a.arms){let L=$.ids.map(B=>o[B]).filter(B=>B!==void 0);L.length&&ie.push({gate:$.gate,first:Math.min(...L),last:Math.max(...L),lane:Math.min(...L.map(B=>b[B].lane))})}return{rows:b,edges:R,scopes:Z,arms:ie,lanes:D,index:o,laneX:A,gutter:q+yl}}function Xs(t,n,s){let a=n(t.from),r=n(t.to),o=s(t.fromLane),l=s(t.lane),i=s(t.toLane),c=Math.min(16,Math.max(6,(r-a)/4)),u=`M ${o} ${a}`;l!==o&&(u+=` C ${o} ${a+c}, ${l} ${a+c}, ${l} ${a+2*c}`);let p=l!==i?r-2*c:r;return u+=` L ${l} ${p}`,l!==i&&(u+=` C ${l} ${r-c}, ${i} ${r-c}, ${i} ${r}`),u}function Kt({name:t}){return js.value?e("span",{class:"ms","aria-hidden":"true",children:Gr(t)}):null}var wl={approval:"how_to_reg",input:"keyboard",agent:"smart_toy",loop:"repeat",effect:"bolt",pull:"download"};function Qn(t){return t?wl[t]??null:null}function so(t,n){return t===null?e("span",{class:"j-null",children:"null"},n):typeof t=="string"?e("span",{class:"j-str",children:JSON.stringify(t)},n):typeof t=="number"?e("span",{class:"j-num",children:String(t)},n):typeof t=="boolean"?e("span",{class:"j-bool",children:String(t)},n):e("span",{children:String(t)},n)}function Qs(t,n,s){let a=" ".repeat(n),r=" ".repeat(n+1);if(Array.isArray(t))return t.length===0?e("span",{children:"[]"},s):e("span",{children:[`[
|
|
7
|
+
`,t.map((o,l)=>e("span",{children:[r,Qs(o,n+1,String(l)),l<t.length-1?",":"",`
|
|
8
|
+
`]},l)),a,"]"]},s);if(t&&typeof t=="object"){let o=Object.entries(t);return o.length===0?e("span",{children:"{}"},s):e("span",{children:[`{
|
|
9
|
+
`,o.map(([l,i],c)=>e("span",{children:[r,e("span",{class:"j-key",children:JSON.stringify(l)}),": ",Qs(i,n+1,l),c<o.length-1?",":"",`
|
|
10
|
+
`]},l)),a,"}"]},s)}return so(t,s)}function Yn({value:t}){return e("span",{class:"json",children:Qs(t,0,"root")})}function ao({value:t}){if(t===null||typeof t!="object")return e("span",{class:"json",children:so(t,"v")});if(Array.isArray(t))return e("span",{class:"json",children:["[",t.length,"]"]});let n=Object.keys(t);return e("span",{class:"json",children:["{ ",n.slice(0,4).map((s,a)=>e("span",{children:[e("span",{class:"j-key",children:s}),a<Math.min(n.length,4)-1?", ":""]},s)),n.length>4?", \u2026":""," }"]})}function me({value:t,open:n=!1,static:s=!1}){let[a,r]=w(n);if(t===void 0)return e("span",{class:"val static",style:"color:var(--faint)",children:"\u2014"});let o=typeof t=="object"&&t!==null;return e("span",{class:`val ${s||!o?"static":""}`,onClick:()=>o&&!s&&r(!a),children:[a&&o?e(Yn,{value:t}):e(ao,{value:t}),o&&e("span",{class:"sz",children:qr(t)})]})}function ue({value:t,options:n,onChange:s,disabled:a,class:r,placeholder:o,title:l}){let i=Y(null),c=Y(null),[u,p]=w(!1),[f,d]=w(null),[h,v]=w(0),g=Y({s:"",t:0}),m=n.find(C=>C.value===t),k=C=>C?C.text??(typeof C.label=="string"?C.label:C.value):"",y=()=>{let C=i.current?.getBoundingClientRect();if(!C)return;let A=window.innerHeight-C.bottom,q=A<200&&C.top>A,Z=8,ie=Math.max(Z,Math.min(C.left,window.innerWidth-Z-C.width)),$=window.innerWidth-Z-ie;d({left:ie,top:q?C.top:C.bottom,width:C.width,maxWidth:$,above:q})},_=()=>{if(!a){if(u){p(!1);return}y(),v(Math.max(0,n.findIndex(C=>C.value===t))),p(!0)}},b=C=>{C.disabled||(s(C.value),p(!1),i.current?.focus())};P(()=>{if(!u)return;let C=q=>{let Z=q.target;i.current?.contains(Z)||c.current?.contains(Z)||p(!1)},A=q=>{c.current?.contains(q.target)||p(!1)};return window.addEventListener("mousedown",C,!0),window.addEventListener("scroll",A,!0),window.addEventListener("resize",y),()=>{window.removeEventListener("mousedown",C,!0),window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",y)}},[u]),On(()=>{u&&c.current?.querySelector(".opt.active")?.scrollIntoView({block:"nearest"})},[u,h]);let R=C=>{let A=h;for(let q=0;q<n.length;q++)if(A=(A+C+n.length)%n.length,!n[A].disabled){v(A);return}},D=C=>{if(!a){if(!u){(C.key==="ArrowDown"||C.key==="ArrowUp"||C.key==="Enter"||C.key===" ")&&(C.preventDefault(),_());return}if(C.key==="ArrowDown")C.preventDefault(),R(1);else if(C.key==="ArrowUp")C.preventDefault(),R(-1);else if(C.key==="Home")C.preventDefault(),v(n.findIndex(A=>!A.disabled));else if(C.key==="End"){C.preventDefault();for(let A=n.length-1;A>=0;A--)if(!n[A].disabled){v(A);break}}else if(C.key==="Enter"||C.key===" ")C.preventDefault(),n[h]&&b(n[h]);else if(C.key==="Escape")C.preventDefault(),p(!1),i.current?.focus();else if(C.key==="Tab")p(!1);else if(C.key.length===1){let A=Date.now();g.current.s=A-g.current.t<700?g.current.s+C.key:C.key,g.current.t=A;let q=g.current.s.toLowerCase(),Z=n.findIndex(ie=>!ie.disabled&&k(ie).toLowerCase().startsWith(q));Z>=0&&v(Z)}}};return e(x,{children:[e("button",{ref:i,type:"button",class:`selbox ${r??""} ${u?"open":""}`,disabled:a,title:l,"aria-haspopup":"listbox","aria-expanded":u,onClick:_,onKeyDown:D,children:e("span",{class:`selval ${m?"":"ph"}`,children:m?m.label:o??""})}),u&&f&&e("div",{ref:c,class:`selpanel ${f.above?"above":""}`,role:"listbox",style:`left: ${f.left}px; min-width: ${f.width}px; max-width: ${f.maxWidth}px; ${f.above?`bottom: ${window.innerHeight-f.top}px`:`top: ${f.top}px`}`,children:n.map((C,A)=>e("div",{role:"option","aria-selected":C.value===t,class:`opt ${C.value===t?"on":""} ${A===h?"active":""} ${C.disabled?"off":""}`,onMouseEnter:()=>!C.disabled&&v(A),onMouseDown:q=>{q.preventDefault(),b(C)},children:[e("span",{class:"lbl",children:C.label}),C.value===t&&e("span",{class:"ms tick",children:"check"})]},C.value))})]})}var ro=/\b(export|default|function|async|await|return|const|let|var|if|else|switch|case|break|continue|while|do|try|catch|finally|throw|new|delete|void|for|of|in|typeof|instanceof|keyof|satisfies|import|from|as|interface|type|enum|class|extends|implements|declare|namespace|abstract|static|readonly|public|private|protected|yield|this|super)\b/y,oo=/\b(true|false|null|undefined|NaN|Infinity)\b/y,io=/\b(?:0x[\da-fA-F_]+|0b[01_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:e[+-]?\d+)?n?)\b/y,lo=/'(?:\\.|[^'\\\n])*'|"(?:\\.|[^"\\\n])*"|`(?:\\.|[^`\\])*`/y,co=/\b(?:[A-Z][\w$]*|string|number|boolean|unknown|any|never|object|symbol|bigint)\b/y,es=/[A-Za-z_$][\w$]*/y,uo=/@[a-zA-Z]+/y,po=/`[^`\n]*`/y,xl=new Set(["input","output","node","connect","path","param","returns","scope","fwImport","workflow","nodeType","gate","expr","property","typedef","type","template","extends","durableGate"]);function Ys(t){let n=[],s=!1;for(let a of t.split(`
|
|
11
|
+
`)){let r=[],o=0,l="",i=()=>{l&&(r.push({c:l}),l="")},c=u=>/[\w$]/.test(a[u-1]??"");for(;o<a.length;){if(s){let p=a.indexOf("*/",o),f=p<0?a.slice(o):a.slice(o,p+2);i();let d=0,h="",v=!1,g=(m,k)=>{h&&(r.push({c:h,t:"c"}),h=""),r.push({c:m,t:k})};for(;d<f.length;){let m;if(uo.lastIndex=d,m=uo.exec(f)){g(m[0],"t"),d+=m[0].length,v=xl.has(m[0].slice(1));continue}if(po.lastIndex=d,m=po.exec(f)){g(m[0],"i"),d+=m[0].length;continue}if(v&&!/\s/.test(f[d])){let k=/[^\s]+/y;k.lastIndex=d,m=k.exec(f),g(m[0],"i"),d+=m[0].length,v=!1;continue}h+=f[d],d++}h&&r.push({c:h,t:"c"}),o+=f.length,p>=0&&(s=!1);continue}if(a.startsWith("/*",o)){s=!0;continue}if(a.startsWith("//",o)){i(),r.push({c:a.slice(o),t:"c"});break}let u;if(lo.lastIndex=o,u=lo.exec(a)){i(),r.push({c:u[0],t:"s"}),o+=u[0].length;continue}if(a[o]==="@"&&(es.lastIndex=o+1,u=es.exec(a))){i(),r.push({c:"@"+u[0],t:"d"}),o+=1+u[0].length;continue}if(!c(o)){if(io.lastIndex=o,u=io.exec(a)){i(),r.push({c:u[0],t:"n"}),o+=u[0].length;continue}if(oo.lastIndex=o,u=oo.exec(a)){i(),r.push({c:u[0],t:"n"}),o+=u[0].length;continue}if(ro.lastIndex=o,u=ro.exec(a)){i(),r.push({c:u[0],t:"k"}),o+=u[0].length;continue}if(co.lastIndex=o,(u=co.exec(a))&&!/[\w$]/.test(a[o+u[0].length]??"")){i(),r.push({c:u[0],t:"y"}),o+=u[0].length;continue}if(es.lastIndex=o,u=es.exec(a)){let p=a.slice(o+u[0].length).match(/^\s*(\(|<[^>]*>\s*\()/);i(),r.push(p?{c:u[0],t:"f"}:{c:u[0]}),o+=u[0].length;continue}}l+=a[o],o++}i(),n.push(r)}return n}function fo(t){let n=[],s=0,a=t.length;for(;s<a;){let r=t[s];if(r==='"'){let o=s+1;for(;o<a&&t[o]!=='"';)t[o]==="\\"&&o++,o++;o=Math.min(o+1,a);let l=t.slice(s,o),i=o;for(;i<a&&(t[i]===" "||t[i]===" ");)i++;n.push({c:l,t:t[i]===":"?"key":"str"}),s=o;continue}if(r==="-"||r>="0"&&r<="9"){let o=/^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(t.slice(s));if(o){n.push({c:o[0],t:"num"}),s+=o[0].length;continue}}if(r==="t"||r==="f"||r==="n"){let o=t.slice(s),l=o.startsWith("true")?"true":o.startsWith("false")?"false":o.startsWith("null")?"null":"";if(l){n.push({c:l,t:l==="null"?"null":"bool"}),s+=l.length;continue}}n.push({c:r}),s++}return n}function ho({value:t,onInput:n,rows:s=4,placeholder:a,invalid:r}){let o=Y(null),l=fo(t),i=t.endsWith(`
|
|
12
|
+
`);return e("div",{class:`jsoned ${r?"bad":""}`,children:[e("pre",{class:"jsoned-mirror json",ref:o,"aria-hidden":"true",children:[t===""&&a?e("span",{class:"jsoned-ph",children:a}):l.map((c,u)=>c.t?e("span",{class:`j-${c.t}`,children:c.c},u):e("span",{children:c.c},u)),i?"\u200B":""]}),e("textarea",{class:"jsoned-input",rows:s,value:t,spellcheck:!1,onInput:c=>n(c.target.value),onScroll:c=>{let u=o.current;u&&(u.scrollTop=c.target.scrollTop,u.scrollLeft=c.target.scrollLeft)}})]})}function ea(t,n,s=""){let a={};if(n==null||n==="")return t.optional||(a[s||"."]="required"),a;switch(t.type){case"string":typeof n!="string"&&(a[s]="must be text");break;case"number":(typeof n!="number"||Number.isNaN(n))&&(a[s]="must be a number");break;case"boolean":typeof n!="boolean"&&(a[s]="must be yes or no");break;case"enum":t.values.includes(n)||(a[s]=`one of ${t.values.join(", ")}`);break;case"array":if(!Array.isArray(n)){a[s]="must be a list";break}n.forEach((o,l)=>Object.assign(a,ea(t.items,o,`${s}[${l}]`)));break;case"object":if(typeof n!="object"||Array.isArray(n)){a[s]="must be an object";break}if(t.fields)for(let[o,l]of Object.entries(t.fields))Object.assign(a,ea(l,n[o],s?`${s}.${o}`:o));break}return a}function ct(t){if(t.type==="object"&&t.fields)return Object.fromEntries(Object.entries(t.fields).map(([n,s])=>[n,ct(s)]))}var ta=t=>t.type==="array"&&t.items&&["string","number","enum"].includes(t.items.type);function _l(t){return t.type==="array"?ta(t)?"one per line":t.text??"list":t.type==="object"&&!t.fields?t.text??"object":t.type==="any"?t.text??"":""}function na({name:t,path:n,schema:s,value:a,errors:r,onChange:o,bare:l}){let i=r[n]??r[n||"."],c=Ya(),u=s.type==="string"||s.type==="number"||s.type==="array"&&ta(s),p=l?null:e(x,{children:[e("label",{for:u?c:void 0,children:[e("span",{children:[t,s.optional?e("i",{children:" optional"}):""]}),e("i",{children:_l(s)})]}),s.help&&e("div",{class:"fhelp",children:s.help})]}),f=d=>e("div",{class:`field ${i?"bad":""}`,children:[p,d,i&&e("div",{class:"ferr",children:i})]});switch(s.type){case"string":{let d=a??"",h=s.text&&s.text!=="string"?s.text:"text";return f(d.length>80||d.includes(`
|
|
13
|
+
`)?e("textarea",{id:c,rows:Math.min(8,d.split(`
|
|
14
|
+
`).length+1),value:d,placeholder:h,onInput:v=>o(v.target.value||void 0)}):e("input",{id:c,type:"text",value:d,placeholder:h,onInput:v=>o(v.target.value||void 0)}))}case"number":return f(e("input",{id:c,type:"number",step:"any",value:a===void 0?"":String(a),placeholder:"a number",onInput:d=>{let h=d.target.value;o(h===""?void 0:Number(h))}}));case"boolean":return f(e("div",{class:"toggle",children:[e("button",{type:"button",class:a===!0?"on":"",onClick:()=>o(!0),children:"yes"}),e("button",{type:"button",class:a===!1?"on":"",onClick:()=>o(!1),children:"no"}),s.optional&&e("button",{type:"button",class:a===void 0?"on":"",onClick:()=>o(void 0),children:"unset"})]}));case"enum":return f(e(ue,{value:a===void 0?"":String(a),placeholder:"choose\u2026",options:s.values.map(d=>({value:String(d),label:String(d)})),onChange:d=>{let h=s.values.find(v=>String(v)===d);o(h)}}));case"array":if(ta(s)){let d=Array.isArray(a)?a.map(String).join(`
|
|
15
|
+
`):"";return f(e("textarea",{id:c,rows:3,value:d,placeholder:s.items.type==="number"?`1
|
|
16
|
+
2
|
|
17
|
+
3 (one per line)`:"one value per line",onInput:h=>{let g=h.target.value.split(`
|
|
18
|
+
`).map(m=>m.trim()).filter(Boolean).map(m=>s.items.type==="number"?Number(m):m);o(g.length?g:void 0)}}))}return s.items&&(s.items.type==="object"&&s.items.fields||s.items.type==="boolean")?f(e(Cl,{path:n,schema:s,value:a,errors:r,onChange:o})):f(e(ts,{value:a,onChange:o,placeholder:"[ \u2026 ] (a JSON list)"}));case"object":if(s.fields){let d=a??{};return e("div",{class:"field",children:[p,e("div",{class:"fieldset",children:Object.entries(s.fields).map(([h,v])=>e(na,{name:h,path:n?`${n}.${h}`:h,schema:v,value:d[h],errors:r,onChange:g=>o({...d,[h]:g})},h))})]})}return f(e(Sl,{value:a,onChange:o,typeName:s.text}));default:return f(e(ts,{value:a,onChange:o}))}}function Sl({value:t,onChange:n,typeName:s}){let a=t&&typeof t=="object"&&!Array.isArray(t)?t:{},[r,o]=w(!1),[l,i]=w(()=>Object.entries(a)),c=v=>{i(v);let g=v.filter(([m])=>m.trim()!=="");n(g.length?Object.fromEntries(g):void 0)},u=(v,g)=>c(l.map((m,k)=>k===v?[g,m[1]]:m)),p=(v,g)=>c(l.map((m,k)=>k===v?[m[0],g]:m)),f=()=>i([...l,["",""]]),d=v=>c(l.filter((g,m)=>m!==v)),h=e("div",{class:"kv-toolbar",children:[e("span",{class:"hint",children:s??"object"}),e("span",{class:"sp"}),e("div",{class:"seg sm",children:[e("button",{type:"button",class:r?"":"on",onClick:()=>{i(Object.entries(a)),o(!1)},children:"Fields"}),e("button",{type:"button",class:r?"on":"",onClick:()=>o(!0),children:"JSON"})]})]});return r?e("div",{class:"kv-open",children:[h,e(ts,{value:t,onChange:n})]}):e("div",{class:"kv-open",children:[h,l.length>0&&e("div",{class:"kv-rows",children:l.map(([v,g],m)=>e("div",{class:"kv-row",children:[e("input",{class:"kv-key",type:"text",value:v,placeholder:"key",onInput:k=>u(m,k.target.value)}),e($l,{value:g,onChange:k=>p(m,k)}),e("button",{type:"button",class:"kv-del",title:"Remove",onClick:()=>d(m),children:"\xD7"})]},m))}),e("button",{type:"button",class:"add",onClick:f,children:"+ add property"})]})}function $l({value:t,onChange:n}){let s=t==null?"":typeof t=="string"?t:JSON.stringify(t);return e("input",{class:"kv-val mono",type:"text",value:s,placeholder:"value",onInput:a=>{let r=a.target.value;if(r===""){n("");return}try{n(JSON.parse(r))}catch{n(r)}}})}function Cl({path:t,schema:n,value:s,errors:a,onChange:r}){let o=Array.isArray(s)?s:[],l=n.items,i=c=>r(c.length?c:void 0);return e("div",{class:"list",children:[o.map((c,u)=>e("div",{class:"item",children:[e("div",{class:"itemhead",children:[e("span",{children:u+1}),e("button",{type:"button",title:"Remove",onClick:()=>i(o.filter((p,f)=>f!==u)),children:"\xD7"})]}),e(na,{name:"",path:`${t}[${u}]`,schema:l,value:c,errors:a,onChange:p=>i(o.map((f,d)=>d===u?p:f)),bare:!0})]},u)),e("button",{type:"button",class:"add",onClick:()=>i([...o,ct(l)]),children:["+ add ",l.text&&l.text.length<30?l.text:"one"]})]})}function ts({value:t,onChange:n,rows:s=4,placeholder:a}){let[r,o]=w(t===void 0?"":JSON.stringify(t,null,2)),[l,i]=w(!1),c=()=>{try{o(JSON.stringify(JSON.parse(r),null,2)),i(!1)}catch{i(!0)}};return e("div",{class:"jsonfield",children:[e(ho,{rows:s,value:r,placeholder:a??'{ "key": "value" } (any JSON)',invalid:l,onInput:u=>{if(o(u),!u.trim()){i(!1),n(void 0);return}try{n(JSON.parse(u)),i(!1)}catch{i(!0)}}}),e("div",{class:"jsontools",children:[l?e("span",{class:"ferr",children:"not valid JSON"}):e("span",{}),r.trim()&&e("button",{type:"button",onClick:c,children:"tidy"})]})]})}var go=t=>t==null||t===""||Array.isArray(t)&&t.length===0||typeof t=="object"&&!Array.isArray(t)&&Object.values(t).every(go);function gn({fields:t,value:n,errors:s,onChange:a,plain:r,title:o}){let[l,i]=w(!1),c=go(n);return e("div",{children:[!r&&e("div",{class:`formhead ${o?"titled":""}`,children:[o&&e("h5",{children:o}),!c&&e("button",{type:"button",class:"formclear",onClick:()=>a(ct({type:"object",fields:t})??{}),children:"clear"}),e("div",{class:"seg sm",children:[e("button",{type:"button",class:l?"":"on",onClick:()=>i(!1),children:"Fields"}),e("button",{type:"button",class:l?"on":"",onClick:()=>i(!0),children:"JSON"})]})]}),l?e("div",{class:"field",children:e(ts,{rows:8,value:n,onChange:u=>a(u??{})})}):Object.entries(t).map(([u,p])=>e(na,{name:u,path:u,schema:p,value:n[u],errors:s,onChange:f=>a({...n,[u]:f})},u))]})}function mn(t,n){return ea({type:"object",fields:t},n)}var ns={approval:"Decide",input:"Provide input",agent:"Answer as the agent",timer:"Sleeping"},mo=t=>{let n=new Date(t);return new Date().toDateString()===n.toDateString()?n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}):n.toLocaleString([],{dateStyle:"medium",timeStyle:"short"})};function vo({due:t,kind:n}){let s=t.at<=Date.now(),a=n==="timer"?s?"wakes the next time it is checked":`wakes at ${mo(t.at)}`:s?"timed out, takes its failure path the next time it is checked":`times out at ${mo(t.at)}, then takes its failure path`;return e("div",{class:"hint",style:"margin-bottom:8px",children:[a,". Checked every few seconds while this console or the server is up."]})}function bo({gate:t}){let n=Object.entries(t.inputs);return n.length?e("section",{children:e("div",{class:"kv",children:n.map(([s,a])=>e(x,{children:[e("span",{class:"k",children:s}),e(me,{value:a,open:typeof a=="object"&&a!==null&&JSON.stringify(a).length<1500}),t.inputLabels?.[s]&&t.inputLabels[s]!==s&&e("span",{class:"khelp",children:t.inputLabels[s]})]}))})}):null}function ko({gate:t,due:n}){let a=`answer:${W.value.file}:${t.node}`,r=ne(()=>Object.fromEntries(t.outputs.map(b=>{let R=t.outputSchema?.[b]??{type:"any",text:t.outputTypes[b]},D=t.outputLabels?.[b];return[b,D&&!R.help?{...R,help:D}:R]})),[t.id]),[o,l]=w(()=>M.get(a,ct({type:"object",fields:r}))??{}),[i,c]=w({}),[u,p]=w(!1),[f,d]=w(""),[h,v]=w(""),[g,m]=w(!1),k=async b=>{m(!0),v("");try{await Pr(b)}catch(R){v(R.message)}finally{m(!1)}},y=()=>{let b=mn(r,o);c(b),!Object.keys(b).length&&(M.set(a,o),k({answer:t.outputs.length===1?o[t.outputs[0]]:t.outputs.length?o:null}))},_=t.description?.trim();return t.kind==="timer"?e("div",{class:"gatecard",role:"form","aria-label":`${ns.timer}: ${t.node}`,children:[e("div",{class:"gh",children:[e("b",{children:ns.timer}),e("span",{children:[t.node," (",t.kind,")"]})]}),e(bo,{gate:t}),e("section",{children:[n&&e(vo,{due:n,kind:"timer"}),e("div",{class:"formfoot",children:[e("button",{class:"btn primary sm",disabled:g,onClick:()=>{k({answer:t.outputs.length?new Date().toISOString():null})},children:"Wake now"}),e("span",{class:"err",children:h})]})]})]}):e("div",{class:"gatecard",role:"form","aria-label":`${ns[t.kind]??"Answer"}: ${t.node}`,children:[e("div",{class:"gh",children:[e("b",{children:ns[t.kind]??"Answer"}),e("span",{children:[t.node," (",t.kind,")"]})]}),_&&e("section",{children:e("div",{class:"asked",children:_})}),e(bo,{gate:t}),e("section",{children:[n&&e(vo,{due:n,kind:t.kind}),t.outputs.length?e(gn,{fields:r,value:o,errors:i,onChange:l}):e("div",{class:"hint",style:"margin-bottom:8px",children:"nothing to return"}),u&&e("div",{class:"field",children:[e("label",{children:e("span",{children:"reason"})}),e("input",{type:"text","aria-label":"Reason",value:f,onInput:b=>d(b.target.value),placeholder:"why it is rejected (the workflow reads it on its failure port)"})]}),e("div",{class:"formfoot",children:[u?e(x,{children:[e("button",{class:"btn primary sm",disabled:g,onClick:()=>k({reject:f||"rejected"}),children:"Reject"}),e("button",{class:"btn sm",onClick:()=>p(!1),children:"Back"})]}):e(x,{children:[e("button",{class:"btn primary sm",disabled:g,onClick:y,children:"Continue"}),t.hasFailurePort&&e("button",{class:"btn sm",onClick:()=>p(!0),children:"Reject"})]}),e("span",{class:"err",children:h})]})]})]})}function yo({note:t,log:n,compact:s=!1}){let[a,r]=w(!1),[o,l]=w(!1),i=Y(null),c=t.status==="answering",u=n.phase==="answering"&&(n.text||n.tools.length>0||n.thinking);P(()=>{let _=i.current;!_||!c||_.scrollHeight-_.scrollTop-_.clientHeight<60&&(_.scrollTop=_.scrollHeight)},[n.text,n.tools.length,c]);let p=t.usage??n.usage,f=p&&p.promptTokens+p.completionTokens>0?`${Tl(p.promptTokens+p.completionTokens)} tokens`:"",d=p?.costUsd?`, $${p.costUsd.toFixed(4)}`:"",h=t.endedAt&&t.startedAt?ee(Date.parse(t.endedAt)-Date.parse(t.startedAt)):n.ms!=null?ee(n.ms):"",v=c?"answering\u2026":t.status==="answered"?`answered${h?` in ${h}`:""}`:t.status==="rejected"?`rejected${t.error?`: ${t.error}`:""}`:`could not answer${t.error?`: ${t.error}`:""}`,g=t.model?` (${t.model})`:"",m=!s&&(c||a)&&(n.text||n.tools.length>0||n.thinking),k=!c&&z.value?.status==="waiting",y=async()=>{l(!0);try{await Hr()}finally{l(!1)}};return e("div",{class:`agentpanel ${t.status} ${s?"compact":""}`,children:[e("div",{class:"ah",onClick:()=>r(!a),children:[e("span",{class:"ms",children:"smart_toy"}),e("b",{children:t.profile}),e("span",{class:"hint",children:[t.provider,g]}),e("span",{class:`what ${t.status}`,children:v}),e("span",{class:"sp"}),f&&e("span",{class:"hint mono",children:[f,d]}),!s&&(n.text||n.tools.length>0)&&!c&&e("span",{class:"ms fold",children:a?"expand_less":"expand_more"})]}),m&&e("div",{class:"alog",ref:i,children:[n.thinking&&e("div",{class:"athink",children:n.thinking}),n.text&&e("div",{class:"atext",children:[n.text,c&&e("span",{class:"caret",children:"\u258D"})]}),n.tools.length>0&&e("div",{class:"atools",children:n.tools.map((_,b)=>e("div",{class:`atool ${_.done?_.isError?"bad":"ok":"pending"}`,children:[e("span",{class:"ms",children:_.done?_.isError?"error":"check":"progress_activity"}),e("code",{children:_.name}),_.args!==void 0&&e("span",{class:"aargs",children:e(me,{value:_.args})}),_.done&&_.result&&e("span",{class:"ares hint",children:_.result.length>160?`${_.result.slice(0,160)}\u2026`:_.result})]},b))}),c&&!u&&e("div",{class:"hint",children:"waiting for the model\u2026"})]}),!s&&t.status==="failed"&&k&&e("div",{class:"aactions",children:[e("span",{class:"hint",children:"Answer it below, or"}),e("button",{class:"btn sm",disabled:o,onClick:y,children:o?"Asking\u2026":"ask the agent again"})]})]})}function Tl(t){return t>=1e4?`${(t/1e3).toFixed(0)}k`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}var ss=22;function wo({node:t,step:n,state:s,term:a,bp:r=!1}){if(a){let p=z.value,f=a==="Start"?p?"done":"":p?.status==="completed"?"done":p?.status==="failed"?"failed":"";return e("div",{class:`tile term ${f}`})}let o=n?.kind==="loop"?"loop":t?.effect?"effect":t?.gate??(n?.pull?"pull":null),l=t?.icon??Qn(o),i=o==="loop"?"var(--loop)":t?.gate?"var(--gate)":t?.effect?"var(--orange, var(--c-orange))":n?.pull?"var(--pull)":"var(--dim)",c=Bt(t?.color)??i,u=t?.gate?"k-gate":o==="loop"?"k-loop":t?.expression?"expr":"";return e("div",{class:`tile ${l?"":"dot"} ${u} ${s} ${r?"bp":""}`,style:`--tc:${c}`,children:l&&e(Kt,{name:l})})}function El({id:t,row:n,gutter:s,laneX:a,w:r}){let o=z.value,i=(t==="Start"?r.params.map(p=>[p.name,o?.values[`Start.${p.name}`]]):r.returns.map(p=>[p.name,o?.result?.[p.name]])).filter(([,p])=>p!==void 0),c=t==="Exit"&&o?.status==="failed",u=()=>{let p=ae.value===t;ae.value=p?null:t,S.side.value=p?"run":"step"};return e("div",{class:`row term ${ae.value===t?"sel":""}`,"data-row":t,style:`padding-left:${s}px`,children:[e("div",{class:"tile-slot",style:`left:${a(n.lane)-ss/2}px`,children:e(wo,{term:t,state:""})}),e("div",{class:"body",children:[e("div",{class:"line1",onClick:u,children:[e("span",{class:"lbl",children:t}),e("span",{class:"sp"}),c&&e("span",{class:"st err",children:o?.error||"failed"}),t==="Exit"&&o?.status==="completed"&&o.result?.onFailure&&e("span",{class:"st err",children:"onFailure"})]}),i.length>0&&e("div",{class:"kv",style:"margin:0 0 6px",children:i.map(([p,f])=>e(x,{children:[e("span",{class:"k",children:p}),e(me,{value:f})]}))})]})]})}function Rl({row:t,gutter:n,laneX:s,w:a,nodes:r,mark:o,slot:l}){let i=z.value,c=t.step,u=r[c.id];if(l)return e("div",{class:"row slot","data-row":c.id,style:`padding-left:${n}px`,children:e("div",{class:"body",children:e("div",{class:"line1"})})});let p=wr(c.id),f=!c.pull&&!c.entered.length&&!c.successTo.length&&!c.failureTo.length&&(c.reads.length>0||c.produces.length>0),d=a.issues.filter(_=>_.node===c.id),h=d.some(_=>_.severity==="error")?"":"warn",v=dn(c.id),g=_r(c.id),m=g>1?`${g}\xD7 `:"",k=at.value.has(c.id),y=null;return p==="PAUSED"?y=e("span",{class:"st debug",children:["paused ",i?.debug?.phase,i?.debug?.phase==="after"&&v!=null?`, ${ee(v)}`:""]}):p==="RUNNING"?y=e("span",{class:"st run",children:[g>1?`pass ${g}, `:"","running"]}):p==="WAITING"?y=e("span",{class:"st gate",children:["waiting at ",c.gate??"gate"]}):p==="FAILED"?y=e("span",{class:"st err",children:[m,i?.errors[c.id]?"threw":"failed",v!=null?`, ${ee(v)}`:""]}):p==="SUCCEEDED"?y=e("span",{class:"st",children:[m,ee(v)]}):p==="CANCELLED"?y=e("span",{class:"st",children:"cancelled"}):!i&&c.kind==="pause"&&(y=e("span",{class:"st gate",style:"opacity:.7",children:c.gate??"gate"})),e("div",{class:`row ${p} ${ae.value===c.id?"sel":""} ${t.owner?"inscope":""} ${o?`diff-${o}`:""}`,"data-row":c.id,style:`padding-left:${n}px`,children:[e("div",{class:"tile-slot bpslot",style:`left:${s(t.lane)-ss/2}px`,title:k?"Remove breakpoint":"Add breakpoint",onClick:()=>Vn(c.id),children:e(wo,{node:u,step:c,state:p,bp:k})}),e("div",{class:"body",children:[e("div",{class:"line1",onClick:()=>{let _=ae.value===c.id;ae.value=_?null:c.id,S.side.value=_?"run":"step"},children:[e("span",{class:"lbl",children:c.label}),e("span",{class:"id",children:u?.builtin||c.label.toLowerCase()===c.id.toLowerCase()?c.type:c.id}),c.pull?e("span",{class:"tag pull",children:"pulled"}):f&&e("span",{class:"tag pull",children:"on demand"}),c.kind==="loop"&&e("span",{class:"tag loop",children:c.scope?`each ${c.scope}`:"each"}),d.length>0&&e("span",{class:`mark ${h}`,title:d.map(_=>_.message).join(`
|
|
19
|
+
`)}),e("span",{class:"sp"}),y]}),i?.agent?.node===c.id&&(p==="WAITING"||p==="SUCCEEDED"||p==="RUNNING")&&e(yo,{note:i.agent,log:i.agentLog,compact:p!=="WAITING"}),p==="WAITING"&&i?.gate&&!(i.agent?.node===c.id&&i.agent.status==="answering")&&e(ko,{gate:i.gate,due:i.due})]})]})}function Al(t){let n=z.value;if(!n)return t.kind;let s=n.states[t.from]?.status,a=n.states[t.to]?.status,r=["completed","failed","cancelled"].includes(n.status),o=s==="SUCCEEDED"||s==="FAILED"||t.from==="Start",l=!!a&&a!=="CANCELLED"||t.to==="Exit"&&n.status==="completed",i=n.values[`${t.from}.onFailure`]===!0;return o&&l&&(t.kind==="fail"?i:t.kind==="ok"||t.kind==="return"?!i||s==="SUCCEEDED"&&!i:!0)?`${t.kind} lit`:r?`${t.kind} dim`:t.kind}function xo({w:t}){let n=S.side.value==="changes"?ot.value:null,s=n?.model??t.model,a=n?.model?{...t.nodes,...n.nodes}:t.nodes,r=n?.model?Ze.value:"diff",o=ne(()=>{let g=new Map;if(!n?.model)return{rows:g,edges:new Map};for(let k of n.marks.added)g.set(k,"add");for(let k of n.marks.removed)g.set(k,"del");for(let k of n.marks.changed)g.set(k,"mod");let m=new Map;for(let[k,y]of n.marks.edgesAdded)m.set(`${k}>${y}`,"add");for(let[k,y]of n.marks.edgesRemoved)m.set(`${k}>${y}`,"del");return{rows:g,edges:m}},[n]),l=g=>r==="before"&&o.rows.get(g)==="add"||r==="after"&&o.rows.get(g)==="del",i=g=>r==="before"&&o.edges.get(g)==="add"||r==="after"&&o.edges.get(g)==="del",c=ne(()=>Zs(s),[s]),u=g=>c.laneX[g]??0,p=c.gutter,f=Y(null),[d,h]=w({y:{},top:{},bottom:{},h:0});On(()=>{let g=f.current;if(!g)return;let m=()=>{let y={},_={},b={};g.querySelectorAll("[data-row]").forEach(D=>{let C=D.dataset.row;y[C]=D.offsetTop+20,_[C]=D.offsetTop,b[C]=D.offsetTop+D.offsetHeight});let R=(D,C)=>Object.keys(D).length===Object.keys(C).length&&Object.keys(D).every(A=>D[A]===C[A]);h(D=>D.h===g.offsetHeight&&R(D.y,y)&&R(D.bottom,b)?D:{y,top:_,bottom:b,h:g.offsetHeight})};m();let k=new ResizeObserver(m);return k.observe(g),g.querySelectorAll("[data-row]").forEach(y=>k.observe(y)),()=>k.disconnect()});let v=g=>d.y[g]??0;return e("div",{class:"spine",ref:f,children:[c.scopes.map(g=>{let m=c.rows[g.first].id,k=c.rows[g.last].id;if(d.top[m]===void 0||d.bottom[k]===void 0)return null;let y=d.top[m]+3;return e("div",{class:"scope",style:`--d: ${g.depth}; top: ${y}px; height: ${d.bottom[k]-3-y}px; left: ${u(g.lane)-ss/2-8}px`,"aria-hidden":"true",children:e("span",{class:"lbl",children:[g.owner,g.scope?` ${g.scope}`:""]})},g.owner)}),c.arms.map(g=>{let m=c.rows[g.first].id,k=c.rows[g.last].id;if(d.top[m]===void 0||d.bottom[k]===void 0)return null;let y=d.top[m]+3;return e("div",{class:"arm",style:`top: ${y}px; height: ${d.bottom[k]-3-y}px; left: ${u(g.lane)-ss/2-8}px`,"aria-hidden":"true",children:e("span",{class:"lbl",children:[g.gate," on failure"]})},`arm-${g.gate}-${g.first}`)}),e("svg",{class:"lanes",width:p,height:d.h,"aria-hidden":"true",children:c.edges.map(g=>{let m=`${g.from}>${g.to}`;if(!(v(g.from)&&v(g.to))||i(m)||l(g.from)||l(g.to))return null;let k=r==="diff"?o.edges.get(m):void 0;return e("path",{class:`${Al(g)} ${k?`diff-${k}`:""}`,d:Xs(g,v,u)},m)})}),c.rows.map(g=>g.id==="Start"||g.id==="Exit"?e(El,{id:g.id,row:g,gutter:p,laneX:u,w:t},g.id):e(Rl,{row:g,gutter:p,laneX:u,w:t,nodes:a,mark:r==="diff"?o.rows.get(g.id):void 0,slot:l(g.id)},g.id))]})}function as({workflow:t,node:n,disabled:s}){let a=pe.value;if(!a)return null;let r=`${t}/${n}`,o=a.gates[r]??"",l=a.default?`the default, ${a.default}`:"whoever drives the run",i=[{value:"",label:l,text:l},...a.agents.map(u=>({value:u.name,label:e(x,{children:[u.name,e("span",{class:"opt-ns",children:[" (",u.provider,u.ready?"":", not ready",")"]})]}),text:u.name}))],c=a.agents.find(u=>u.name===(o||a.default));return e("span",{class:"agentpick",children:[e(ue,{value:o,options:i,disabled:s,onChange:u=>{Wt(r,u||null).catch(p=>O(p.message))}}),c&&e("span",{class:`sdot ${c.ready?"ok":"bad"}`,title:c.reason??"ready"})]})}var Pl=t=>{let n=Object.fromEntries(t.params.map(a=>[a.name,a.description])),s=t.paramsSchema??Object.fromEntries(t.params.map(a=>[a.name,{type:/^string$/.test(a.tsType)?"string":/^number$/.test(a.tsType)?"number":/^boolean$/.test(a.tsType)?"boolean":"any",optional:a.optional,text:a.tsType}]));return Object.fromEntries(Object.entries(s).map(([a,r])=>[a,n[a]?{...r,help:n[a]}:r]))};function $o(t){let n=it(t.model.steps);return{gates:n.filter(s=>s.kind==="pause"),calls:n.filter(s=>t.nodes[s.id]?.type==="invokeWorkflow"),delays:n.filter(s=>t.nodes[s.id]?.type==="delay").length}}function _o(t,n){let s=n.kind==="pause"?n.gateOutputs:["result"];return Object.fromEntries(s.map(a=>[a,t?.outputSchema?.[a]??{type:"any",text:t?.outputs.find(r=>r.name===a)?.tsType}]))}function So(t,n){let{gates:s,calls:a,delays:r}=$o(t),o={},l={};for(let c of s)n.on[c.id]&&(l[c.id]=n.answers[c.id]??{});Object.keys(l).length&&(o.gates=l);let i={};for(let c of a)n.on[c.id]&&(i[`${c.id}:*`]=n.answers[c.id]?.result??{});return Object.keys(i).length&&(o.invocations=i),r&&n.fast&&(o.fast=!0),o}var Ll={approval:"a person decides",input:"a person or system answers",agent:"an agent answers",timer:"the clock wakes it"};function Co({w:t}){let n=ne(()=>Pl(t),[t]),s=`${t.file}:${t.name}`,[a,r]=w(()=>M.get(`params:${s}`,ct({type:"object",fields:n}))??{}),[o,l]=w({}),[i,c]=w(""),[u,p]=w(()=>M.get(`debug:${s}`,!1)?"debug":"run"),[f,d]=w(()=>M.get(`runTo:${s}`,"first")),[h,v]=w(()=>M.get(`mocks:${s}`,{on:{},answers:{},fast:!0})),[g,m]=w({}),[k,y]=w(()=>M.get(`presets:${s}`,[])),[_,b]=w(""),[R,D]=w(null),[C,A]=w(!0),[q,Z]=w(()=>M.get(`agents:${s}`,!0));P(()=>{r(M.get(`params:${s}`,ct({type:"object",fields:n}))??{}),l({}),p(M.get(`debug:${s}`,!1)?"debug":"run"),d(M.get(`runTo:${s}`,"first")),v(M.get(`mocks:${s}`,{on:{},answers:{},fast:!0})),m({}),y(M.get(`presets:${s}`,[])),b(""),D(null),Z(M.get(`agents:${s}`,!0))},[s]),P(()=>{pe.value||tt().catch(()=>{})},[]);let{gates:ie,calls:$,delays:L}=ne(()=>$o(t),[t]),B=[...ie,...$],Q=B.filter(E=>h.on[E.id]).length,N=[...at.value],te=ie.some(E=>!h.on[E.id]),Ce=E=>{v(E),M.set(`mocks:${s}`,E)},Pe=E=>{p(E),M.set(`debug:${s}`,E==="debug")},F=E=>{d(E),M.set(`runTo:${s}`,E)},U=()=>{let E=mn(n,a);l(E);let fe={};for(let be of B)if(h.on[be.id]){let gt=mn(_o(t.nodes[be.id],be),h.answers[be.id]??{});Object.keys(gt).length&&(fe[be.id]=gt)}return m(fe),!Object.keys(E).length&&!Object.keys(fe).length},Se=async()=>{if(U()){c("");try{await pn(a,{debug:u==="debug",runTo:f,mocks:So(t,h),agents:q?"auto":"manual"})}catch(E){c(E.message)}}},Pt=E=>{Z(E),M.set(`agents:${s}`,E)},ys=ie.filter(E=>E.gate==="agent"&&!h.on[E.id]),ht=pe.value,Zt=()=>{let E=["fw","run",Ne(t.rel),"--workflow",t.name];Object.values(a).some(be=>be!==void 0)&&E.push("--params",Ne(JSON.stringify(a)));let fe=So(t,h);return Object.keys(fe).length&&E.push("--mocks",Ne(JSON.stringify(fe))),u==="debug"&&(E.push("--debug"),N.length&&E.push("--breakpoint",...N.map(Ne))),E.join(" ")},Ii=async()=>{try{await navigator.clipboard.writeText(Zt()),O("copied as fw run")}catch{O(Zt())}},Ta=E=>{let fe=E.trim();if(!fe)return;let be=[...k.filter(gt=>gt.name!==fe),{name:fe,params:a}];y(be),M.set(`presets:${s}`,be),b(fe),D(null)},Di=E=>{b(E);let fe=k.find(be=>be.name===E);fe&&(r(fe.params),l({}))},Mi=()=>{let E=k.filter(fe=>fe.name!==_);y(E),M.set(`presets:${s}`,E),b("")};return e("div",{class:"card newrun",role:"form","aria-label":"New run",onKeyDown:E=>{E.key==="Enter"&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),Se())},children:[e("h3",{children:["New run",e("span",{class:"sp"}),R===null?e("div",{class:"presets",children:[k.length>0&&e(ue,{value:_,placeholder:"presets\u2026",onChange:Di,options:k.map(E=>({value:E.name,label:E.name}))}),_&&e("button",{class:"btn ghost sm",title:"Forget this preset",onClick:Mi,children:"delete"}),e("button",{class:"btn ghost sm",title:"Keep these parameters under a name",onClick:()=>D(_),children:"save"})]}):e("div",{class:"presets",children:[e("input",{type:"text",value:R,placeholder:"preset name",autoFocus:!0,onInput:E=>D(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.stopPropagation(),Ta(R)),E.key==="Escape"&&D(null)}}),e("button",{class:"btn sm",onClick:()=>Ta(R),children:"keep"}),e("button",{class:"btn ghost sm",onClick:()=>D(null),children:"cancel"})]})]}),e("div",{class:"in",children:Object.keys(n).length?e(gn,{title:"Parameters",fields:n,value:a,errors:o,onChange:r}):e(x,{children:[e("h5",{children:"Parameters"}),e("div",{class:"hint",children:"This workflow takes none."})]})}),B.length+(L?1:0)>0&&e("div",{class:"in",children:[e("h5",{class:"fold",onClick:()=>A(!C),children:[e("span",{children:"Mocks"}),e("span",{class:"hint",children:Q?`${Q} of ${B.length} answered here`:"answer gates and calls without waiting"}),e("span",{class:"sp"}),e("span",{class:"ms",children:C?"expand_less":"expand_more"})]}),C&&e(x,{children:[B.map(E=>{let fe=t.nodes[E.id],be=!!h.on[E.id],gt=_o(fe,E);return e("div",{class:`mock ${be?"on":""}`,children:[e("label",{class:"check",children:[e("input",{type:"checkbox",checked:be,onChange:ws=>Ce({...h,on:{...h.on,[E.id]:ws.target.checked}})}),e("b",{children:E.label}),e("span",{class:"hint",children:E.kind==="pause"?`${E.gate} gate: ${Ll[E.gate??""]??"the run pauses"}`:"calls another workflow"})]}),be&&e("div",{class:"body",children:Object.keys(gt).length?e(gn,{plain:!0,fields:gt,value:h.answers[E.id]??{},errors:g[E.id]??{},onChange:ws=>Ce({...h,answers:{...h.answers,[E.id]:ws}})}):e("div",{class:"hint",children:"Nothing to return: the gate is passed."})})]},E.id)}),L>0&&e("label",{class:"check",children:[e("input",{type:"checkbox",checked:h.fast,onChange:E=>Ce({...h,fast:E.target.checked})}),e("span",{children:"Skip delays"}),e("span",{class:"hint",children:[L," delay step",L>1?"s":""," return at once"]})]})]})]}),ys.length>0&&e("div",{class:"in",children:[e("h5",{children:["Agents",e("span",{class:"hint",style:"margin-left:8px;text-transform:none;letter-spacing:0",children:ht?.exists?`${ht.agents.filter(E=>E.ready).length} of ${ht.agents.length} profile${ht.agents.length===1?"":"s"} ready`:"no profiles in this project"})]}),e("label",{class:"check",children:[e("input",{type:"checkbox",checked:q,onChange:E=>Pt(E.target.checked)}),e("span",{children:"Let a profile answer the agent gates"})]}),e("div",{class:"agentgates",children:ys.map(E=>e("div",{class:"agentgate",children:[e("span",{class:"ms",children:"smart_toy"}),e("span",{children:E.label}),e("span",{class:"to",children:"answered by"}),ht?.agents.length?e(as,{workflow:t.name,node:E.id,disabled:!q}):e("span",{class:"hint",style:"text-transform:none;letter-spacing:0",children:["whoever answers it, here or over MCP. ",e("button",{class:"linkish",onClick:_e,children:"Add a profile"})]})]},E.id))})]}),e("div",{class:"in",children:[e("h5",{children:"How"}),e("div",{class:"seg",role:"radiogroup","aria-label":"How",children:[e("button",{role:"radio","aria-checked":u==="run",class:u==="run"?"on":"",onClick:()=>Pe("run"),children:"Run"}),e("button",{role:"radio","aria-checked":u==="debug",class:u==="debug"?"on":"",onClick:()=>Pe("debug"),children:"Step through"})]}),u==="debug"&&e("div",{class:"dbgopts",children:[e("label",{class:"radio",children:[e("input",{type:"radio",name:"runto",checked:f==="first",onChange:()=>F("first")}),e("span",{children:"Pause before the first step"})]}),e("label",{class:`radio ${N.length?"":"off"}`,children:[e("input",{type:"radio",name:"runto",disabled:!N.length,checked:f==="breakpoint"&&N.length>0,onChange:()=>F("breakpoint")}),e("span",{children:"Run to the first breakpoint"})]}),e("div",{class:"bps",children:[N.map(E=>e("span",{class:"chip",children:[t.nodes[E]?.label??E,e("button",{type:"button",title:"Remove breakpoint",onClick:()=>Vn(E),children:"\xD7"})]},E)),!N.length&&e("span",{class:"hint",children:"No breakpoints. Click a step's tile to set one."})]}),te&&e("div",{class:"hint",children:"Stops at the first gate that is not answered here: the debugger cannot hold one."})]})]}),e("div",{class:"in formfoot",children:[e("button",{class:"btn primary sm",disabled:ln.value>0,title:ln.value>0?"Fix the errors first":void 0,onClick:Se,children:u==="debug"?"Debug":"Run"}),e("span",{class:"shortcut-hint",children:e(ge,{combo:"mod+enter"})}),e("button",{class:"btn ghost sm",title:"Copy this run as an fw run command",onClick:Ii,children:"copy as CLI"}),e("span",{class:"err",children:i})]})]})}var To={CRITICAL:{word:"Critical",cls:"err"},BREAKING:{word:"Breaking",cls:"err"},MINOR:{word:"Minor",cls:"warn"},COSMETIC:{word:"Cosmetic",cls:"ok"}},Il=[["diff","Changes"],["before","Before"],["after","After"]],Eo=(t,n)=>t==="worktree"?"working tree":t==="HEAD"?`HEAD${n?.head?` (${n.head})`:""}`:n?.commits.find(s=>s.sha===t||s.short===t)?.short??t;function Ro({w:t}){let n=`${t.file}:${t.name}`,[s,a]=w(null),[r,o]=w("HEAD"),[l,i]=w("worktree"),[c,u]=w(""),[p,f]=w(!1),d=ot.value;P(()=>{let g=!0;return a(null),u(""),ot.value=null,K(`/api/git/history?${Ve({file:t.file})}`).then(m=>{if(!g)return;a(m);let k=qn.value;if(qn.value=null,k){o(k.from),i(k.to);return}m.repo&&(m.dirty||m.commits.length<2?(o("HEAD"),i("worktree")):(o(m.commits[1].sha),i(m.commits[0].sha)))}).catch(m=>{g&&u(m.message)}),()=>{g=!1}},[n]),P(()=>{if(!s?.repo)return;let g=!0;return f(!0),u(""),K(`/api/diff?${Ve({file:t.file,name:t.name,from:r,to:l})}`).then(m=>{g&&(ot.value=m,Ze.value="diff")}).catch(m=>{g&&(ot.value=null,u(m.message))}).finally(()=>{g&&f(!1)}),()=>{g=!1}},[n,s?.repo,r,l]),P(()=>()=>{ot.value=null},[]),P(()=>{let g=m=>{m.target?.closest("input, textarea, select, [contenteditable]")||(m.key==="d"?Ze.value="diff":m.key==="b"?Ze.value="before":m.key==="a"&&(Ze.value="after"))};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[]);let h=g=>{ae.value=g},v=(g,m)=>{let k=[];m&&k.push({value:"worktree",label:e(x,{children:["working tree",s?.dirty?e("span",{class:"opt-ns",children:" (uncommitted changes)"}):null]}),text:"working tree"}),k.push({value:"HEAD",label:e(x,{children:["HEAD",s?.head?e("span",{class:"opt-ns",children:[" (",s.head,")"]}):null]}),text:"HEAD"});for(let y of s?.commits??[])k.push({value:y.sha,label:e(x,{children:[e("span",{class:"opt-sha",children:y.short})," ",e("span",{class:"opt-ns",children:y.subject.slice(0,48)})]}),text:`${y.short} ${y.subject}`});return[...(s?.commits??[]).map(y=>y.sha),"HEAD","worktree"].includes(g)||k.push({value:g,label:g}),k};return s&&!s.repo?e("div",{class:"card",children:[e("h3",{children:"Changes"}),e("div",{class:"in hint",children:"This file is not under git, so there is no earlier version to compare it with."})]}):e(x,{children:[e("div",{class:"card changes",children:[e("h3",{children:["Changes",e("span",{class:"sp"}),e("div",{class:"seg sm",children:Il.map(([g,m])=>e("button",{class:Ze.value===g?"on":"",disabled:!d?.model,title:`key ${g[0]}`,onClick:()=>{Ze.value=g},children:m},g))})]}),e("div",{class:"in refs",children:[e("label",{children:[e("span",{children:"from"}),e(ue,{value:r,options:v(r,!1),onChange:o})]}),e("span",{class:"arrow",children:"\u2192"}),e("label",{children:[e("span",{children:"to"}),e(ue,{value:l,options:v(l,!0),onChange:i})]})]}),c&&e("div",{class:"in",children:e("div",{class:"verdict err",children:c})}),!c&&d&&e("div",{class:"in",children:[d.identical?e("div",{class:"verdict ok",children:["No semantic change between ",Eo(r,s)," and ",Eo(l,s),"."]}):e("div",{class:`verdict ${To[d.impact].cls}`,children:[e("b",{children:[To[d.impact].word,"."]})," ",d.reasons[0]??"",d.reasons.length>1&&e("ul",{children:d.reasons.slice(1).map(g=>e("li",{children:g},g))})]}),!d.model&&!d.identical&&e("div",{class:"hint",style:"margin-top:6px",children:"The two versions cannot be laid out as one picture. The list below still says what changed."})]}),p&&!d&&e("div",{class:"in hint",children:"comparing\u2026"}),d&&!d.identical&&e(x,{children:[d.steps.length>0&&e("div",{class:"in",children:[e("h5",{children:"Steps"}),e("ul",{class:"chg",children:d.steps.map(g=>e("li",{class:g.change,children:[e("i",{}),e("button",{class:"linkish",onClick:()=>h(g.id),children:g.label}),e("small",{children:[g.change==="changed"?g.detail:g.change,g.change!=="changed"&&g.detail?`, ${g.detail}`:""]})]},g.id))})]}),d.wiring.length>0&&e("div",{class:"in",children:[e("h5",{children:"Wiring"}),e("ul",{class:"chg",children:d.wiring.map((g,m)=>e("li",{class:g.change,children:[e("i",{}),e("span",{children:g.label}),g.kind==="data"&&e("small",{children:"data"})]},m))})]}),d.contract.length>0&&e("div",{class:"in",children:[e("h5",{children:"Contract"}),e("ul",{class:"chg",children:d.contract.map((g,m)=>e("li",{class:g.change,children:[e("i",{}),e("span",{children:[g.side==="in"?"in":"out"," ",e("code",{children:g.name})]}),e("small",{children:g.change==="changed"?g.detail:`${g.change}${g.detail?`, ${g.detail}`:""}`})]},m))})]})]})]}),s&&s.commits.length>0&&e("div",{class:"card",children:[e("h3",{children:["History",e("span",{class:"hint",children:s.commits.length}),e("span",{class:"sp"}),e("span",{class:"hint",children:"click a commit to compare from it"})]}),e("div",{class:"in commits",children:[s.dirty&&e("div",{class:`commit ${l==="worktree"?"to":""}`,children:[e("span",{class:"rdot waiting"}),e("span",{class:"msg",children:"uncommitted changes"}),e("span",{class:"who",children:"now"})]}),s.commits.map(g=>{let m=r===g.sha||r==="HEAD"&&g.sha===s.commits[0].sha&&s.commits.length&&g.short===s.head,k=l===g.sha;return e("button",{class:`commit ${m?"from":""} ${k?"to":""}`,onClick:()=>o(g.sha),title:`${g.sha}
|
|
20
|
+
${g.author}`,children:[e("span",{class:"sha",children:g.short}),e("span",{class:"msg",children:g.subject}),e("span",{class:"who",children:Ae(g.at)}),e("span",{class:"toBtn",title:"Compare up to this commit",onClick:y=>{y.stopPropagation(),i(g.sha)},children:"to"})]},g.sha)})]})]})]})}var Dl=/^(['"])(.*)\1$/,Ml=/^-?\d+(\.\d+)?$/,Ol=/^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)+$/;function Ao(t){let n=t.trim();if(Dl.test(n))return{kind:"string",text:n};if(Ml.test(n))return{kind:"number",text:n};if(n==="true"||n==="false")return{kind:"boolean",text:n};if(n==="null"||n==="undefined")return{kind:"nullish",text:n};if(Ol.test(n)){let s=n.indexOf(".");return{kind:"reference",node:n.slice(0,s),port:n.slice(s+1)}}return{kind:"js",text:n}}var jl={string:"j-str",number:"j-num",boolean:"j-bool",nullish:"j-null",js:"e-js"};function vn({value:t}){let n=Ao(t);return n.kind==="reference"?e($t,{node:n.node,port:n.port}):e("span",{class:jl[n.kind],children:n.text})}function $t({node:t,port:n}){return e(x,{children:[e("span",{class:"e-node",children:t}),e("span",{class:"e-dot",children:[".",n]})]})}function Po({lines:t,startLine:n,highlight:s}){return e("pre",{children:t.map((a,r)=>e("div",{class:`l ${s.includes(n+r)?"hl":""}`,children:[e("span",{class:"n",children:n+r}),e("span",{children:a.length?a.map((o,l)=>o.t?e("span",{class:`c-${o.t}`,children:o.c},l):o.c):" "})]},r))})}function ut({source:t}){let n=ne(()=>Ys(t),[t]);return e("pre",{class:"hlcode",children:n.map((s,a)=>e("div",{class:"l",children:s.length?s.map((r,o)=>r.t?e("span",{class:`c-${r.t}`,children:r.c},o):r.c):" "},a))})}function rs({source:t,startLine:n=1,highlight:s=[],title:a,file:r}){let o=ne(()=>Ys(t),[t]),[l,i]=w(!1),[c,u]=w(!0);return P(()=>{if(!l)return;let p=f=>{f.key==="Escape"&&i(!1)};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[l]),l?e("div",{class:`codefull ${c?"":"nowrap"}`,children:[e("div",{class:"fullhead",children:[e("b",{children:a??"Code"}),r&&e("a",{class:"mono",href:Ie(r.path,r.line),children:r.label}),e("span",{class:"sp"}),e("button",{class:"code-toggle",onClick:()=>u(!c),children:c?"no wrap":"wrap"}),e("button",{class:"btn sm",onClick:()=>i(!1),children:["Close",e(ge,{combo:"esc"})]})]}),e("div",{class:"code",children:e(Po,{lines:o,startLine:n,highlight:s})})]}):e("div",{class:"codewrap",children:[e("button",{class:"expand",title:"Full screen",onClick:()=>i(!0),children:"\u2922"}),e("div",{class:"code",children:e(Po,{lines:o,startLine:n,highlight:s})})]})}function Lo({w:t}){let n=on.value,s=`export:${t.file}:${t.name}`,[a,r]=w(()=>M.get(s,n[0]?.name??"")),[o,l]=w(""),[i,c]=w(null),[u,p]=w(null),[f,d]=w(""),[h,v]=w(null);P(()=>{n.some(b=>b.name===a)||r(n[0]?.name??"")},[n.length]),P(()=>{c(null),d("")},[t.file,t.name,a]);let g=n.find(b=>b.name===a),m=`${t.rel.replace(/[^/]*$/,"")}dist/${a}`,k=async b=>{p(b?"preview":"write"),d("");try{let R=await zr({target:a,outputDir:o||void 0,preview:b});c(R),v(R.files[0]?.path??null),b||O(`${R.files.length} file${R.files.length===1?"":"s"} written`)}catch(R){d(R.message)}finally{p(null)}},y=`fw export ${Ks(t.rel)} --target ${a} --output ${Ks(o||m)}${t.name?` --workflow ${t.name}`:""}`;if(!n.length)return e("div",{class:"hint",style:"padding:12px",children:"No export target is installed. Targets come from packs."});let _=t.deploy?.[a]??{};return e(x,{children:[e("div",{class:"card",children:[e("h3",{children:["Export",e("span",{class:"sp"}),e("button",{class:"linkish",title:"The same as a command",onClick:()=>ce(y),children:"\u25B6 as a command"})]}),e("div",{class:"in",children:[e("div",{class:"field",children:[e("label",{children:e("span",{children:"target"})}),e(ue,{value:a,options:n.map(b=>({value:b.name,text:`${b.name}${b.pack?` ${Be(b.pack)}`:""}`,label:e(x,{children:[b.name,b.pack?e("span",{class:"opt-ns",children:[" from ",Be(b.pack)]}):null]})})),onChange:b=>{r(b),M.set(s,b)}})]}),g&&e("div",{class:"hint",style:"margin:-4px 0 10px",children:[g.description,g.pack&&e(x,{children:[" (from ",e("button",{class:"linkish",onClick:()=>Re(g.pack),children:Be(g.pack)}),")"]})]}),e("div",{class:"field",children:[e("label",{children:e("span",{children:"output"})}),e("input",{type:"text",class:"mono",value:o,placeholder:m,onInput:b=>l(b.target.value)})]}),e("div",{class:"formfoot",children:[e("button",{class:"btn sm",disabled:!!u,onClick:()=>k(!0),children:u==="preview"?"Generating\u2026":"Preview"}),e("button",{class:"btn primary sm",disabled:!!u,onClick:()=>k(!1),children:u==="write"?"Writing\u2026":"Write files"}),e("span",{class:"err",children:f})]})]}),g?.deploySchema&&Object.keys(g.deploySchema).length>0&&e("div",{class:"in",children:[e("h5",{children:["Reads from the workflow's @deploy ",a]}),e("div",{class:"ports",children:Object.entries(g.deploySchema).map(([b,R])=>e(x,{children:[e("span",{class:"p",title:R.description,children:b}),e("span",{children:[b in _?e(me,{value:_[b]}):e("span",{class:"from",style:"opacity:.7",children:R.default!==void 0?`default ${JSON.stringify(R.default)}`:"unset"}),e("span",{class:"from",children:[" (",R.type,")"]})]})]}))})]})]}),i&&e(x,{children:[e("div",{class:"card",children:[e("h3",{children:[i.written?"Written":"Preview",e("span",{class:"mono",children:[i.files.length," file",i.files.length===1?"":"s"]}),e("span",{class:"sp"}),e("span",{class:"hint mono",title:i.outputDir,children:i.outputDir.split(/[\\/]/).slice(-2).join("/")})]}),i.warnings.length>0&&e("div",{class:"in",children:i.warnings.map((b,R)=>e("div",{class:"issue",children:[e("span",{class:"mark warn"}),e("div",{children:b})]},R))}),e("div",{class:"in exportfiles",children:i.files.map(b=>e("div",{children:[e("button",{class:`filerow ${h===b.path?"on":""}`,onClick:()=>v(h===b.path?null:b.path),children:[e("span",{class:"ms",children:"description"}),e("span",{class:"mono",children:b.path}),e("span",{class:"sp"}),e("span",{class:"hint",children:[b.content.split(`
|
|
21
|
+
`).length," lines"]})]}),h===b.path&&e("div",{class:"codewrap",children:e("div",{class:"code",children:e(ut,{source:b.content})})})]},b.path))})]}),i.instructions&&e("div",{class:"card",children:[e("h3",{children:i.instructions.title}),i.instructions.prerequisites.length>0&&e("div",{class:"in",children:[e("h5",{children:"Requires"}),e("div",{children:i.instructions.prerequisites.join(", ")})]}),e("div",{class:"in",children:[e("h5",{children:"Steps"}),e("ol",{class:"steps",children:i.instructions.steps.map((b,R)=>e("li",{children:b},R))})]}),i.instructions.localTestSteps?.length?e("div",{class:"in",children:[e("h5",{children:"Test locally"}),e("ol",{class:"steps",children:i.instructions.localTestSteps.map((b,R)=>e("li",{children:b},R))})]}):null,i.instructions.links?.length?e("div",{class:"in",children:[e("h5",{children:"Links"}),i.instructions.links.map(b=>e("div",{children:e("a",{href:b.url,target:"_blank",rel:"noreferrer",children:b.label})},b.url))]}):null]})]})]})}function os(t){return"/"+t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^A-Za-z0-9-]+/g,"-").toLowerCase()}function aa(t){return`${t.method} ${t.path}${t.mode==="async"?" mode=async":""}${t.auth==="none"?" auth=none":""}${t.callback?" callback":""}`}function ra(t){return[...t.path.matchAll(/:([A-Za-z_][A-Za-z0-9_]*)/g)].map(n=>n[1])}var sa=t=>`'${t.replace(/'/g,"'\\''")}'`;function Ct(t,n,s,a,r){let o=m=>a.find(k=>k.name===m)?.tsType??"value",l=m=>r[m]!==void 0,i=m=>l(m)?r[m]:`<${o(m)}>`,c=m=>l(m)?encodeURIComponent(String(r[m])):`<${o(m)}>`,u=m=>JSON.stringify(Object.fromEntries(m.map(k=>[k,i(k)])),null,2);if(!s)return[`curl -X POST ${t}/workflows/${n} \\`,' -H "Authorization: Bearer $FW_SERVE_TOKEN" \\'," -H 'Content-Type: application/json' \\",` -d ${sa(u(a.map(m=>m.name)))}`].join(`
|
|
22
|
+
`);let p=new Set(ra(s)),f=s.path.replace(/:([A-Za-z_][A-Za-z0-9_]*)/g,(m,k)=>c(k)),d=a.filter(m=>!p.has(m.name)).map(m=>m.name),h=s.method==="GET"||s.method==="DELETE",v=`${t}${f}`;h&&d.length&&(v+=`?${d.map(m=>`${m}=${c(m)}`).join("&")}`);let g=[`curl -X ${s.method} ${/[?<>&]/.test(v)?sa(v):v}`];return s.auth!=="none"&&g.push(' -H "Authorization: Bearer $FW_SERVE_TOKEN"'),h||(g.push(" -H 'Content-Type: application/json'"),g.push(` -d ${sa(u(d))}`)),g.map((m,k)=>k<g.length-1?`${m} \\`:m).join(`
|
|
23
|
+
`)}function is(t,n){return t.mode==="async"?"202 at once with the run to follow":n>0?"200 with the return ports, or 202 with the run when a gate pauses it":"200 with the return ports; 422 when it ends on the failure path"}function re({icon:t,iconColor:n,label:s,on:a,disabled:r,onClick:o,children:l}){return e("button",{class:`panetab ${a?"on":""}`,disabled:r,onClick:o,children:[t&&e("span",{class:"tabicon",style:n?`color:${n}`:"",children:e(Kt,{name:t})}),e("span",{class:"tablabel",children:s}),l]})}var bn=async(t,n="copied")=>{try{await navigator.clipboard.writeText(t),O(n)}catch{O("could not copy")}};function ls({m:t}){return e("span",{class:`mchip ${t}`,children:t})}function oa({r:t}){return e(x,{children:[t.mode==="async"&&e("span",{class:"pill",title:"Answers 202 at once, then the run is followed by its id",children:"async"}),t.auth==="none"&&e("span",{class:"pill warn",title:"Served without the bearer token",children:"open"}),t.callback&&e("span",{class:"pill",title:"A caller may name a callbackUrl that receives the final response",children:"callback"}),t.mounted===!1&&e("span",{class:"pill err",title:"Not mounted: see the problems above",children:"not mounted"})]})}function Nl(){let t=_t.value,[n,s]=w(!1),a=async r=>{s(!0);try{await r()}catch(o){O(o.message)}finally{s(!1)}};return e("div",{class:"card serveline",children:e("div",{class:"in",children:t?.running?e(x,{children:[e("span",{class:"sdot ok"})," ",e("b",{children:"Server"})," up at ",e("a",{class:"mono",href:t.running.url??void 0,target:"_blank",rel:"noreferrer",children:t.running.url})," since ",Ae(Date.parse(t.running.startedAt)),t.running.owned?"":", started from a terminal",e("span",{class:"sp"}),t.running.owned&&e("button",{class:"btn ghost sm",onClick:()=>Ee("serve"),children:"Logs"}),e("button",{class:"btn sm",disabled:n,onClick:()=>a(()=>ze("serve",t.running.owned?void 0:t.running.pid)),children:"Stop"})]}):t?.state==="starting"?e(x,{children:[e("span",{class:"sdot warn"})," ",e("b",{children:"Server"})," starting\u2026 ",e("span",{class:"sp"}),e("button",{class:"btn ghost sm",onClick:()=>Ee("serve"),children:"Logs"})]}):e(x,{children:[e("span",{class:"sdot"})," ",e("b",{children:"Server"})," not running. The routes below answer once it is up.",e("span",{class:"sp"}),e("button",{class:"btn primary sm",disabled:n,onClick:()=>a(()=>et("serve")),children:n?"Starting\u2026":"Start server"}),e("button",{class:"btn ghost sm",onClick:Fe,title:"Port, host, token and options, on the Project page",children:"Settings"})]})})})}function Fl({w:t,base:n}){let[s,a]=w(null);return e("div",{class:"card epcard",children:[e("h3",{children:[e("button",{class:"linkish name",onClick:()=>hn(t.file,t.name),title:t.rel,children:t.name}),e("span",{class:"hint",children:t.rel}),e("span",{class:"sp"}),t.gates>0&&e("span",{class:"pill gate",title:"Pauses at a gate, so a caller gets 202 and a run to follow",children:[t.gates," gate",t.gates===1?"":"s"]}),e("button",{class:"btn ghost sm",onClick:()=>hn(t.file,t.name),title:"Change the routes on the workflow's Serve pane",children:"Edit"})]}),t.description&&e("div",{class:"in hint desc",children:t.description}),e("div",{class:"routes",children:t.routes.map((r,o)=>e("div",{class:`route ${s===o?"open":""}`,children:[e("button",{class:"routehead",onClick:()=>a(s===o?null:o),children:[e(ls,{m:r.method}),e("span",{class:"mono path",children:r.path}),e("span",{class:"flags",children:e(oa,{r})}),e("span",{class:"hint ans",children:is(r,t.gates)})]}),s===o&&e("div",{class:"routebody",children:[e("pre",{class:"curl mono",children:Ct(n,t.name,r,t.params,{})}),e("div",{class:"formfoot",children:[e("button",{class:"btn sm",onClick:()=>bn(Ct(n,t.name,r,t.params,{})),children:"copy request"}),e("span",{class:"hint",children:[t.params.length?`parameters: ${t.params.map(l=>`${l.name}: ${l.tsType}`).join(", ")}`:"no parameters",t.returns.length?`, answers with ${t.returns.map(l=>l.name).join(", ")}`:""]})]})]})]},`${r.method} ${r.path}`))})]})}function Oo(){let[t,n]=w(""),[s,a]=w(!1),r=()=>{a(!0),n(""),Ut().catch(c=>n(c.message)).finally(()=>a(!1))};if(P(()=>{T.value.kind==="endpoints"&&r()},[T.value.kind]),T.value.kind!=="endpoints")return null;let o=St.value,l=_t.value?.running?.url??"http://127.0.0.1:3000",i=o?.workflows.reduce((c,u)=>c+u.routes.length,0)??0;return e("div",{class:"docview endpointsview",children:[e("div",{class:"dochead",children:[e("h1",{children:"Endpoints"}),e("p",{class:"lede",children:["Workflows served over HTTP. Each ",e("code",{children:"@http"})," line on a workflow is a route on ",e("code",{children:"fw serve"}),", and on any server this project's API is mounted in."]}),e("div",{class:"docactions",children:[e("button",{class:"btn sm",onClick:()=>J("deployment","workflows-as-endpoints"),children:"How it works"}),e("button",{class:"btn sm",onClick:()=>bn(`${l}/openapi.json`,"OpenAPI URL copied"),children:"OpenAPI"}),e("button",{class:"btn sm",disabled:s,onClick:r,children:s?"Reading\u2026":"Read again"})]})]}),t&&e("div",{class:"card",children:e("div",{class:"in",style:"color:var(--err)",children:t})}),!o&&!t&&e("div",{class:"hint",children:"Reading\u2026"}),o&&e(x,{children:[e(Nl,{}),o.problems.length>0&&e("div",{class:"card",children:[e("h3",{children:"Not mounted"}),e("div",{class:"in",children:o.problems.map(c=>e("div",{class:"problem",children:c},c))})]}),i===0&&e("div",{class:"card welcome",children:[e("h3",{children:"No workflow is an endpoint yet"}),e("div",{class:"in",children:[e("p",{children:["Every workflow already answers as a ",e("i",{children:"run resource"})," at ",e("code",{children:"POST /workflows/<name>"}),": the body is the parameters, the answer is the run. An endpoint gives a workflow a path of its own (",e("code",{children:"POST /reviews"}),", ",e("code",{children:"GET /orders/:id"}),"), binds its parameters from the URL or the body, and answers with its return ports, the way a hand-written handler would."]}),e("p",{children:["Open a workflow, and on its ",e("b",{children:"Serve"})," pane press ",e("b",{children:"Expose as endpoint"}),". It writes one line, ",e("code",{children:"@http POST /<name>"}),", that you can edit like any other annotation."]}),o.candidates.length>0&&e("div",{class:"cands",children:o.candidates.slice(0,12).map(c=>e("button",{class:"cand",onClick:()=>hn(c.file,c.name),title:c.rel,children:[e("span",{class:"ms",children:c.gates?"pause_circle":"conversion_path"}),e("b",{children:c.name}),e("small",{children:c.rel})]},`${c.file}|${c.name}`))})]})]}),o.workflows.map(c=>e(Fl,{w:c,base:l},`${c.file}|${c.name}`)),i>0&&o.candidates.length>0&&e("div",{class:"card",children:[e("h3",{children:["Not exposed",e("span",{class:"hint",children:o.candidates.length})]}),e("div",{class:"in hint",children:["Still reachable as run resources. Open one and press ",e("b",{children:"Expose as endpoint"})," on its Serve pane: ",o.candidates.slice(0,8).map((c,u)=>e("span",{children:[u?", ":"",e("button",{class:"linkish",onClick:()=>hn(c.file,c.name),title:c.rel,children:c.name})]},`${c.file}|${c.name}`)),o.candidates.length>8?", \u2026":"","."]})]})]})]})}var Io=`import express from 'express';
|
|
24
|
+
import { createWorkflowApi } from '@synergenius/flow-weaver/server';
|
|
25
|
+
|
|
26
|
+
const app = express();
|
|
27
|
+
const api = createWorkflowApi({ dir: './workflows', token: process.env.FW_SERVE_TOKEN });
|
|
28
|
+
// declared routes, /runs and /openapi.json, all under /api
|
|
29
|
+
app.use('/api', api.express());
|
|
30
|
+
app.listen(8080);`,Do=`fastify.all('/api/*', async (request, reply) => {
|
|
31
|
+
reply.hijack();
|
|
32
|
+
const handled = await api.handle(request.raw, reply.raw, { basePath: '/api', body: request.body });
|
|
33
|
+
if (!handled) { reply.raw.writeHead(404); reply.raw.end(); }
|
|
34
|
+
});`,Mo=`import { createWorkflowApi } from '@synergenius/flow-weaver/server';
|
|
35
|
+
|
|
36
|
+
const api = createWorkflowApi({ dir: './workflows' });
|
|
37
|
+
// Bun, Hono, Deno, Next.js route handlers
|
|
38
|
+
export default { fetch: (req: Request) => api.fetch(req) };`;function jo(){let[t,n]=w("about");return e(x,{children:[e("div",{class:"panes",children:[e(re,{icon:"info",label:"About",on:t==="about",onClick:()=>n("about")}),e(re,{icon:"extension",label:"Mount",on:t==="mount",onClick:()=>n("mount")})]}),e("div",{class:"panebody",children:[t==="about"&&e("div",{class:"card",children:[e("h3",{children:"What a route answers"}),e("div",{class:"in",children:e("dl",{class:"regkv routes",children:[e("dt",{children:"ran to the end"}),e("dd",{children:[e("code",{children:"200"})," and the return ports as the body"]}),e("dt",{children:"failure path"}),e("dd",{children:[e("code",{children:"422"})," and the same body"]}),e("dt",{children:"paused at a gate"}),e("dd",{children:[e("code",{children:"202"}),", the run, and a ",e("code",{children:"Location"})," to poll. The gate is answered here, over the API, or by an agent profile"]}),e("dt",{children:"still running"}),e("dd",{children:[e("code",{children:"202"})," after 60 s (or ",e("code",{children:"Prefer: wait="}),"). ",e("code",{children:"Location"})," is ",e("code",{children:"/runs/:id/result"}),", which answers in this same shape"]}),e("dt",{children:"mode=async"}),e("dd",{children:[e("code",{children:"202"})," before the first step runs"]}),e("dt",{children:"failed"}),e("dd",{children:[e("code",{children:"500"})," with the error and the run id"]})]})}),e("h3",{children:"Parameters"}),e("div",{class:"in hint",children:["A ",e("code",{children:":name"})," in the path binds that parameter. A ",e("code",{children:"GET"})," or ",e("code",{children:"DELETE"})," takes the rest from the query string, anything else from the JSON body. A missing or mistyped one is ",e("code",{children:"400"})," with the field named."]}),e("h3",{children:"Retries and callbacks"}),e("div",{class:"in hint",children:["An ",e("code",{children:"Idempotency-Key"})," header makes the same request the same run, however many times it is sent. On a route marked ",e("code",{children:"callback"}),", a ",e("code",{children:"callbackUrl"})," in the body receives the final response by POST, signed with the server's token."]}),e("h3",{children:"Always there"}),e("div",{class:"in hint",children:[e("code",{children:"POST /workflows/<name>"})," for every workflow, ",e("code",{children:"GET /runs/:id"}),", ",e("code",{children:"/resolve"}),", ",e("code",{children:"/cancel"}),", ",e("code",{children:"/events"}),", and ",e("code",{children:"/openapi.json"})," describing all of it."]})]}),t==="mount"&&e("div",{class:"card",children:[e("h3",{children:"In your own server"}),e("div",{class:"in hint",children:["The same handler ",e("code",{children:"fw serve"})," runs, as a function your server calls. Runs land in the same store, so a gate reached in production is still answered here."]}),e("div",{class:"in",children:[e("h5",{children:"Express"}),e("div",{class:"snippet",children:[e(ut,{source:Io}),e("button",{class:"btn sm",onClick:()=>bn(Io),children:"copy"})]})]}),e("div",{class:"in",children:[e("h5",{children:"Fastify"}),e("div",{class:"snippet",children:[e(ut,{source:Do}),e("button",{class:"btn sm",onClick:()=>bn(Do),children:"copy"})]})]}),e("div",{class:"in",children:[e("h5",{children:"fetch hosts"}),e("div",{class:"snippet",children:[e(ut,{source:Mo}),e("button",{class:"btn sm",onClick:()=>bn(Mo),children:"copy"})]})]}),e("div",{class:"in hint",children:["Node's own ",e("code",{children:"http.createServer(api.node())"})," is what ",e("code",{children:"fw serve"})," does. A body your framework already parsed is used as is. ",e("button",{class:"linkish",onClick:()=>J("deployment","embedding-the-api"),children:"Options and details"})]}),e("h3",{children:"Before you ship"}),e("div",{class:"in",children:[e("dl",{class:"regkv routes",children:[e("dt",{children:"one instance"}),e("dd",{children:"the run store is a directory with no locking: one API process per store, on a persistent disk, not serverless"}),e("dt",{children:"your auth"}),e("dd",{children:["mount behind your own middleware and leave ",e("code",{children:"token"})," unset, or set both"]}),e("dt",{children:"long runs"}),e("dd",{children:["a request answers ",e("code",{children:"202"})," with the result URL after ",e("code",{children:"maxWaitMs"})," (60 s). Set it under your proxy's timeout"]}),e("dt",{children:"load"}),e("dd",{children:[e("code",{children:"maxInFlight"})," (32) caps running segments. Past it callers get ",e("code",{children:"503"})," and ",e("code",{children:"Retry-After"})]}),e("dt",{children:"callbacks"}),e("dd",{children:["public hosts only by default. Name yours with ",e("code",{children:"callbacks.hosts"}),", and verify the HMAC with your token"]}),e("dt",{children:"shutdown"}),e("dd",{children:[e("code",{children:"api.close()"})," on SIGTERM. Paused runs are safe, a segment in flight is recorded as failed"]})]}),e("div",{class:"hint",style:"margin-top:8px",children:e("button",{class:"linkish",onClick:()=>J("deployment","integrating-for-real"),children:"Integrating for real"})})]})]})]})]})}var Hl=["POST","GET","PUT","PATCH","DELETE"],No=async t=>{try{await navigator.clipboard.writeText(t),O("copied")}catch{O("could not copy")}};function Wl({w:t,onDone:n}){let[s,a]=w(t.http.length?t.http.map(d=>({...d})):[{method:"POST",path:os(t.name)}]),[r,o]=w(!1),[l,i]=w(""),c=new Set(t.params.map(d=>d.name)),u=s.map(d=>{if(!d.path.startsWith("/")||/\s/.test(d.path))return"a path starts with / and has no spaces";let h=ra(d).filter(v=>!c.has(v));return h.length?`:${h[0]} is not a parameter of this workflow${c.size?` (${[...c].join(", ")})`:""}`:s.some(v=>v!==d&&v.method===d.method&&v.path===d.path)?"listed twice":""}),p=(d,h)=>a(v=>v.map((g,m)=>m===d?{...g,...h}:g)),f=async()=>{o(!0),i("");try{await Wr(t.file,t.name,s),O(s.length?"routes written":"routes removed"),n()}catch(d){i(d.message)}finally{o(!1)}};return e("div",{class:"routeeditor",children:[s.map((d,h)=>e("div",{class:`erow ${u[h]?"bad":""}`,children:[e("div",{class:"line",children:[e(ue,{class:"method",value:d.method,options:Hl.map(v=>({value:v,label:v})),onChange:v=>p(h,{method:v})}),e("input",{type:"text",class:"mono",value:d.path,placeholder:"/path/:param",spellcheck:!1,onInput:v=>p(h,{path:v.target.value})}),e("button",{class:"btn ghost sm",title:"Remove this route",onClick:()=>a(s.filter((v,g)=>g!==h)),children:e("span",{class:"ms",style:"font-size:15px",children:"close"})})]}),e("div",{class:"opts",children:[e("label",{class:"check",children:[e("input",{type:"checkbox",checked:d.mode==="async",onChange:v=>p(h,{mode:v.target.checked?"async":void 0})}),"answer at once, follow the run"]}),e("label",{class:"check",children:[e("input",{type:"checkbox",checked:d.auth==="none",onChange:v=>p(h,{auth:v.target.checked?"none":void 0})}),"no token needed"]}),e("label",{class:"check",children:[e("input",{type:"checkbox",checked:!!d.callback,onChange:v=>p(h,{callback:v.target.checked||void 0})}),"accept a callback URL"]})]}),u[h]&&e("div",{class:"ferr",children:u[h]})]},h)),e("div",{class:"formfoot",children:[e("button",{class:"btn primary sm",disabled:r||u.some(Boolean),onClick:f,children:r?"Writing\u2026":s.length?t.http.length?"Save routes":"Expose":"Remove all routes"}),e("button",{class:"btn ghost sm",onClick:()=>a([...s,{method:"GET",path:`${os(t.name)}${t.params[0]?`/:${t.params[0].name}`:""}`}]),children:"+ route"}),e("button",{class:"btn ghost sm",onClick:n,children:"Cancel"}),l&&e("span",{class:"err",children:l})]}),e("div",{class:"hint",style:"margin-top:6px",children:["A ",e("code",{children:":name"})," in the path binds that parameter",t.params.length?` (${t.params.map(d=>d.name).join(", ")})`:"",". GET and DELETE take the rest from the query, the others from the body. Written as ",e("code",{children:"@http"})," lines on the workflow."]})]})}function Fo({w:t}){let[n,s]=w(!1),[a,r]=w(""),[o,l]=w(!1),[i,c]=w(!1),u=()=>{s(!0),r(""),zt().catch(A=>r(A.message)).finally(()=>s(!1))};P(()=>{u(),l(!1),pe.value||tt().catch(()=>{})},[t.file,t.name]);let p=_t.value,f=p?.running?.url??"http://127.0.0.1:3000",d=M.get(`params:${t.file}:${t.name}`,{})??{},h=ne(()=>it(t.model.steps).filter(A=>A.kind==="pause"),[t]),v=h.filter(A=>A.gate==="agent"),m=pe.value?.agents.filter(A=>A.ready).length??0,k=t.http,y=p?.running?.token??null,_=A=>y?A.replace("$FW_SERVE_TOKEN",y):A,b=Ct(f,t.name,null,t.params,d),[R,D]=w(!1),C=async A=>{D(!0);try{await A()}catch(q){O(q.message)}finally{D(!1)}};return e(x,{children:e("div",{class:"card serve",children:[e("h3",{children:["Serve",e("span",{class:"sp"}),p?.running?e("span",{class:"hint",children:[e("span",{class:"sdot ok"})," up since ",Ae(Date.parse(p.running.startedAt))]}):p?.state==="starting"?e("span",{class:"hint",children:[e("span",{class:"sdot warn"})," starting\u2026"]}):e("span",{class:"hint",children:[e("span",{class:"sdot"})," not running"]}),p?.running?e("button",{class:"btn ghost sm",disabled:R,onClick:()=>C(()=>ze("serve",p.running.owned?void 0:p.running.pid)),children:"Stop"}):p?.state!=="starting"&&e("button",{class:"btn primary sm",disabled:R,onClick:()=>C(()=>et("serve")),children:R?"Starting\u2026":"Start"}),(p?.running?.owned||p?.state==="starting")&&e("button",{class:"btn ghost sm",onClick:()=>Ee("serve"),title:"What the server prints",children:"Logs"}),e("button",{class:"btn ghost sm",disabled:n,onClick:u,title:"Look again",children:e("span",{class:"ms",style:"font-size:15px",children:"refresh"})})]}),a&&e("div",{class:"in err",children:a}),!p?.running&&p?.state!=="starting"&&e("div",{class:"in hint",children:["Start serves every workflow in the project on loopback with a generated token. Port, host and options are on the ",e("button",{class:"linkish",onClick:Fe,children:"Project page"}),". From a terminal: ",e("code",{children:p?.command??"fw serve --trace"}),"."]}),e("div",{class:"in",children:[e("h5",{children:["Routes",e("span",{class:"sp"}),k.length>0&&!o&&e("button",{class:"btn ghost sm",onClick:()=>l(!0),children:"Edit"})]}),o&&e(Wl,{w:t,onDone:()=>l(!1)}),!o&&k.length===0&&e("div",{class:"expose",children:[e("div",{class:"hint",children:"Not an endpoint yet. It still answers as a run resource (below). Exposing it gives it a path of its own, its parameters bound from the URL or the body, and its return ports as the answer."}),e("div",{class:"formfoot",children:[e("button",{class:"btn primary sm",onClick:()=>l(!0),children:"Expose as endpoint"}),e("span",{class:"hint mono",children:["@http POST ",os(t.name)]})]})]}),!o&&k.map(A=>e("div",{class:"declared",children:[e("div",{class:"endpoint mono",children:[e(ls,{m:A.method})," ",e("span",{class:"path",children:[f,A.path]}),e("span",{class:"sp"}),e(oa,{r:A})]}),e("div",{class:"hint",style:"margin:4px 0 6px",children:["Answers ",is(A,h.length),".",v.length?e(x,{children:[" The ",v.length===1?"agent gate is":`${v.length} agent gates are`," answered by ",m?e(x,{children:["a profile (",e("button",{class:"linkish",onClick:_e,children:[m," ready"]}),")"]}):e(x,{children:[e("button",{class:"linkish",onClick:_e,children:"no profile is ready"}),", so they wait for a person or an assistant"]}),"."]}):null]}),e("pre",{class:"curl mono",children:Ct(f,t.name,A,t.params,d)}),e("div",{class:"formfoot",children:[e("button",{class:"btn sm",onClick:()=>No(_(Ct(f,t.name,A,t.params,d))),children:y&&A.auth!=="none"?"copy request with token":"copy request"}),e("span",{class:"hint",children:"parameters come from the run form"})]})]},`${A.method} ${A.path}`))]}),e("div",{class:"in",children:[e("h5",{children:[e("button",{class:"linkish",onClick:()=>c(!i),children:[i?"\u25BE":"\u25B8"," The run resource"]}),e("span",{class:"hint",style:"margin-left:6px",children:"always there"})]}),i&&e(x,{children:[e("div",{class:"endpoint mono",children:[e(ls,{m:"POST"})," ",e("span",{class:"path",children:[f,"/workflows/",t.name]})]}),e("div",{class:"hint",style:"margin:4px 0 6px",children:["The parameters as the body, the run as the answer: ",e("code",{children:"200"})," with ",e("code",{children:"result"}),", or ",e("code",{children:"202"})," with a ",e("code",{children:"runId"})," and the gate."]}),e("pre",{class:"curl mono",children:b}),e("div",{class:"formfoot",children:e("button",{class:"btn sm",onClick:()=>No(_(b)),children:y?"copy request with token":"copy request"})})]})]}),e("div",{class:"in",children:[e("h5",{children:"Then"}),e("dl",{class:"regkv routes",children:[e("dt",{class:"mono",children:"GET /runs/:id"}),e("dd",{children:"the run: status, gate, agent, result"}),e("dt",{class:"mono",children:"POST /runs/:id/resolve"}),e("dd",{children:[e("code",{children:'{ "answer": \u2026 }'})," or ",e("code",{children:'{ "reject": "why" }'})]}),e("dt",{class:"mono",children:"GET /runs/:id/events"}),e("dd",{children:"server-sent events: the run, each step, what the agent says"}),e("dt",{class:"mono",children:"POST /runs/:id/cancel"}),e("dd",{children:"stop it"}),e("dt",{class:"mono",children:"GET /openapi.json"}),e("dd",{children:"all of it, as OpenAPI"})]}),e("div",{class:"hint",style:"margin-top:8px",children:["Runs made here and over the API are the same runs: a gate reached by a caller can be answered on this page. ",e("button",{class:"linkish",onClick:Ue,children:"All endpoints"}),", or ",e("button",{class:"linkish",onClick:()=>J("deployment","workflows-as-endpoints"),children:"how routes answer"})]})]})]})})}var Ho=t=>t.flatMap(n=>[n,...Ho(n.children)]);function cs({id:t,w:n}){let s=t==="Start"||t==="Exit"?t:n.nodes[t]?.label??t;return e("button",{class:"stepref",title:s!==t?`${s} (${t})`:t,onClick:()=>{ae.value=t,S.side.value="step"},children:t})}function Wo({w:t}){let[n,s]=w(!1),[a,r]=w(!1),o=t.reference,l=Ho(t.model.steps),i=Object.entries(o.options).filter(([f,d])=>f!=="http"&&d!==void 0&&d!==!1&&d!==null),c=(f,d)=>d===!0?`@${f}`:typeof d=="object"&&d?`@${f} ${Object.entries(d).map(([h,v])=>`${h}=${JSON.stringify(v)}`).join(" ")}`:`@${f} ${String(d)}`,u=(t.http??[]).map(f=>[`http ${aa(f)}`,`@http ${aa(f)}`]),p=f=>f.length?f.map(d=>`${d.name}${d.optional?"?":""}: ${d.tsType}`).join(", "):"";return e(x,{children:[e("div",{class:"card",children:[e("h3",{children:["Contract",e("span",{class:"sp"}),e("a",{class:"mono",href:Ie(t.file,t.sourceLine),title:"Open in the editor",children:[t.rel,":",t.sourceLine]})]}),e("div",{class:"in",children:[e("div",{class:"sig mono",children:[e("span",{class:"c-k",children:"function"})," ",e("b",{children:t.name}),"(",e("span",{class:"c-t",children:"execute"}),", params: ","{ ",e("span",{class:"params",children:p(t.params)||"\u2014"})," }",")",e("div",{class:"ret",children:["\u2192 ","{ ",e("span",{class:"params",children:p(t.returns)||"onSuccess, onFailure"})," }"]})]}),t.description&&e("div",{class:`desc about ${a?"open":""}`,onClick:()=>r(!a),children:t.description})]}),(i.length>0||u.length>0)&&e("div",{class:"in",children:[e("h5",{children:"Options"}),e("div",{class:"chips",children:[i.map(([f,d])=>e("code",{title:f,children:c(f,d)},f)),u.map(([f,d])=>e("code",{title:"The route this workflow is served on",children:d},f))]})]}),e("div",{class:"in",children:e("div",{class:"kv",children:[e("span",{class:"k",children:"compiled"}),e("span",{class:"val static",children:t.compiled?"yes, body generated in place":e(x,{children:["no, ",e("button",{class:"linkish",onClick:()=>ce(`fw compile ${t.rel}`),children:"\u25B6 fw compile"})]})}),e("span",{class:"k",children:"steps"}),e("span",{class:"val static",children:[l.length,l.some(f=>f.kind==="pause")?`, ${l.filter(f=>f.kind==="pause").length} gate${l.filter(f=>f.kind==="pause").length>1?"s":""}`:""]})]})})]}),e("div",{class:"card",children:[e("h3",{children:["Steps",e("span",{class:"mono",children:"@node"}),e("span",{class:"sp"}),e("span",{class:"hint",children:l.length})]}),e("div",{class:"in",children:e("div",{class:"steplist",children:l.map(f=>{let d=t.nodes[f.id];return e("div",{class:"steprow",style:f.scope?"padding-left:14px":"",children:[e(cs,{id:f.id,w:t}),e("span",{class:"type mono",children:d?.type??f.type}),e("span",{class:"marks",children:[d?.gate&&e("span",{class:"tag gate",children:[d.gate," gate"]}),f.kind==="loop"&&e("span",{class:"tag loop",children:"scope"}),f.pull&&e("span",{class:"tag pull",children:"pulled"}),d?.pack&&e("span",{class:"tag pack",children:Be(d.pack)}),d?.builtin&&!d?.pack&&e("span",{class:"tag",children:"built-in"}),(f.exprs.length>0||(d?.expr.length??0)>0)&&e("span",{class:"tag expr",children:[f.exprs.length||d.expr.length," expr"]})]})]},f.id)})})})]}),e("div",{class:"card",children:[e("h3",{children:["Wiring",e("span",{class:"mono",children:"@path, @connect"})]}),o.paths.length>0&&e("div",{class:"in",children:[e("h5",{children:"Paths"}),o.paths.map((f,d)=>e("div",{class:"path",children:f.map((h,v)=>e("span",{class:"pathstep",children:[v>0&&e("span",{class:"arrow",children:"\u2192"}),e(cs,{id:h.node,w:t}),h.route&&e("span",{class:`route ${h.route}`,children:[":",h.route]})]},v))},d)),e("div",{class:"hint",style:"margin-top:6px",children:"A path wires control flow along the chain, and each data port to the nearest earlier step with an output of the same name."})]}),o.connects.length>0&&e("div",{class:"in",children:[e("h5",{children:"Explicit connections"}),e("div",{class:"ports",children:o.connects.map((f,d)=>e(x,{children:[e("span",{class:"p",children:[e(cs,{id:f.from.node,w:t}),".",f.from.port]},`f${d}`),e("span",{class:"from",children:["\u2192 ",e($t,{node:f.to.node,port:f.to.port})]},`t${d}`)]}))})]}),o.exprs.length>0&&e("div",{class:"in",children:[e("h5",{children:"Expressions"}),e("div",{class:"ports",children:o.exprs.map((f,d)=>e(x,{children:[e("span",{class:"p",children:[e(cs,{id:f.node,w:t}),".",f.port]},`e${d}`),e("span",{class:"from",children:["= ",e(vn,{value:f.expr})]},`x${d}`)]}))})]}),!o.paths.length&&!o.connects.length&&!o.exprs.length&&e("div",{class:"in hint",children:o.options.autoConnect?"@autoConnect: ports are wired by name in declaration order.":"No wiring declared."}),o.importsFrom.length>0&&e("div",{class:"in",children:[e("h5",{children:["Imported node types",e("span",{class:"mono",style:"margin-left:6px",children:"@fwImport"})]}),e("div",{class:"ports",children:o.importsFrom.map(f=>e(x,{children:[e("span",{class:"p",children:f.type},f.type),e("span",{class:"from",children:["from ",f.from]},`${f.type}f`)]}))})]}),e("div",{class:"in hint",children:[e("button",{class:"linkish",onClick:()=>J("jsdoc-grammar"),children:"The grammar"}),", then ",e("button",{class:"linkish",onClick:()=>J("advanced-annotations"),children:"paths, expressions, pull execution"})]})]}),e("div",{class:"card",children:[e("h3",{children:["Annotations",e("span",{class:"sp"}),e("button",{class:"linkish",onClick:()=>s(!n),children:n?"hide":"show"})]}),n&&e(rs,{source:t.source,startLine:t.sourceLine,title:`${t.name} annotations`,file:{path:t.file,label:`${t.rel}:${t.sourceLine}`,line:t.sourceLine}}),!n&&e("div",{class:"in hint",children:["The JSDoc block as written, ",t.source.split(`
|
|
39
|
+
`).length," lines, at ",e("a",{class:"mono",href:Ie(t.file,t.sourceLine),children:[t.rel,":",t.sourceLine]}),"."]})]})]})}var Uo=(t,n,s=null)=>{for(let a of t){if(a.id===n)return s;let r=Uo(a.children,n,a);if(r)return r}return null},ca=(t,n)=>{for(let s of n){if(s.id===t)return s;let a=ca(t,s.children);if(a)return a}return null};function la({issues:t,w:n}){let s=r=>J("error-codes",r.code),a=r=>{navigator.clipboard.writeText(`${n.rel}${r.line?`:${r.line}`:""} ${r.code}${r.node?` (${r.node})`:""}: ${r.message}`).then(()=>O("copied"))};return e(x,{children:t.map((r,o)=>e("div",{class:"issue",children:[e("span",{class:`mark ${r.severity==="warning"?"warn":""}`}),e("div",{children:[e("div",{children:r.message}),e("div",{class:"h",children:[e("code",{children:r.code}),r.hint?`: ${r.hint}`:""]})]}),e("div",{class:"ops",children:[e("button",{onClick:()=>s(r),children:"docs"}),e("button",{onClick:()=>a(r),children:"copy"})]})]},o))})}var zo={SUCCEEDED:"completed",FAILED:"failed",RUNNING:"running",WAITING:"waiting",PAUSED:"waiting",CANCELLED:"cancelled"};function zl({w:t}){let n=z.value;rt.value;let[s,a]=w(new Set),r=it(t.model.steps).filter(p=>n.states[p.id]);if(!r.length)return null;let o=p=>p.start!=null?(p.end??Date.now())-p.start:null,l=p=>{let d=(n.passes[p]??[]).map(o).filter(h=>h!=null);return d.length?d.reduce((h,v)=>h+v,0):null},i=Math.max(1,...r.map(p=>l(p.id)??0)),c=p=>{let f=new Set(s);f.has(p)?f.delete(p):f.add(p),a(f)},u=p=>(n.passes[p]??[]).filter(f=>f.status==="FAILED"||f.error).length;return e("div",{class:"in",children:[e("h5",{children:["Steps",e("span",{class:"hint",style:"margin-left:8px;text-transform:none;letter-spacing:0",children:[r.length," of ",it(t.model.steps).length]})]}),e("div",{class:"tl",children:r.map(p=>{let f=n.states[p.id],d=l(p.id),h=f.count>1,v=u(p.id);return e(x,{children:[e("button",{class:`tlrow ${f.status}`,onClick:()=>{ae.value=p.id,S.side.value="step"},children:[e("span",{class:`rdot ${zo[f.status]??"cancelled"}`}),e("span",{class:"lbl",children:[p.label,h&&e("span",{class:"times",title:"Ran once per item, click to see each pass",onClick:g=>{g.stopPropagation(),c(p.id)},children:["\xD7",f.count,v?`, ${v} failed`:"",e("span",{class:"ms",children:s.has(p.id)?"expand_less":"expand_more"})]}),!h&&n.errors[p.id]&&e("span",{class:"err",children:[": ",n.errors[p.id]]})]}),e("span",{class:"dur",children:f.status==="RUNNING"?h?`pass ${f.count} running`:"running":f.status==="WAITING"?"waiting":ee(d)}),d!=null&&e("i",{style:`width:${Math.max(2,d/i*100)}%`})]},p.id),h&&s.has(p.id)&&(n.passes[p.id]??[]).map(g=>e("button",{class:`tlrow sub ${g.status}`,onClick:()=>{ae.value=p.id,S.side.value="step",S.pass.value={id:p.id,index:g.index}},children:[e("span",{class:`rdot ${zo[g.status]??"cancelled"}`}),e("span",{class:"lbl",children:["pass ",g.index+1,g.error&&e("span",{class:"err",children:[": ",g.error]})]}),e("span",{class:"dur",children:g.status==="RUNNING"?"running":ee(o(g))}),o(g)!=null&&e("i",{style:`width:${Math.max(2,(o(g)??0)/i*100)}%`})]},`${p.id}#${g.index}`))]})})})]})}function Ul({w:t}){let n=z.value;rt.value;let s=Object.keys(n.errors)[0],a=["completed","failed","cancelled"].includes(n.status),r=n.debug,o=r?.status==="paused",l=r?.node?t.nodes[r.node]?.label??r.node:"";return e("div",{class:"card",children:[e("h3",{children:[r?"Debug":"Run"," ",e("span",{class:"mono",children:n.id.slice(0,8)}),e("span",{class:"sp"}),e("span",{class:"hint",children:Ae(n.startedAt)}),Ht.value?e("button",{class:"btn danger sm",onClick:()=>Jn(),children:r?"Stop":"Cancel"}):e(x,{children:[e("button",{class:"btn sm",title:"The same parameters and mocks, once more",onClick:()=>{pn(n.params,{mocks:n.mocks})},children:"Run again"}),e("button",{class:"btn ghost sm",onClick:()=>un(),children:"New run"})]})]}),r&&(o||r.status==="running")&&e("div",{class:"in dbgbar",role:"toolbar","aria-label":"Debugger",children:[e("button",{class:"btn sm",disabled:!o,onClick:()=>Qe("step"),title:"Run the next node, then pause",children:["Step",e(ge,{combo:"F10"})]}),e("button",{class:"btn sm",disabled:!o,onClick:()=>Qe("continue"),title:"Run to the end",children:["Continue",e(ge,{combo:"F5"})]}),e("button",{class:"btn sm",disabled:!o||!r.breakpoints.length,onClick:()=>Qe("toBreakpoint"),title:r.breakpoints.length?"Run to the next breakpoint":"No breakpoints set",children:["To breakpoint",e(ge,{combo:"shift+F5"})]})]}),e("div",{class:"in",children:e("div",{class:"kv",children:[e("span",{class:"k",children:"status"}),e("span",{class:"val static",children:o?e(x,{children:["paused ",e("b",{children:r.phase})," ",l," at ",r.position,"/",r.order.length]}):r?.status==="running"?e(x,{children:["stepping, ",ee(He(n))]}):r?.status==="yielded"?e(x,{children:["stopped at a gate, ",ee(He(n))]}):r?.status==="aborted"?e(x,{children:["stopped, ",ee(He(n))]}):e(x,{children:[n.status,", ",ee(He(n))]})}),e("span",{class:"k",children:"params"}),e(me,{value:n.params}),n.mocks&&Object.keys(n.mocks).length>0&&e(x,{children:[e("span",{class:"k",children:"mocks"}),e(me,{value:n.mocks})]}),n.source?.commit&&e(x,{children:[e("span",{class:"k",children:"version"}),e("span",{class:"val static",children:[n.source.commit,n.source.dirty?" with uncommitted changes":""," ",e("button",{class:"linkish",title:"What changed in the file since this run",onClick:()=>br(n.source.commit),children:"changes since"})]})]}),n.error&&r?.status!=="yielded"&&e(x,{children:[e("span",{class:"k",children:"error"}),e("span",{class:"val static",style:"color:var(--err)",children:n.error})]}),s&&e(x,{children:[e("span",{class:"k",children:"threw at"}),e("span",{children:[e("button",{class:"linkish",onClick:()=>{ae.value=s,S.side.value="step"},children:t.nodes[s]?.label??s})," ",e("span",{class:"from",children:[s,(()=>{let i=n.passes[s]??[],c=i.find(u=>u.error||u.status==="FAILED");return i.length>1&&c?`, pass ${c.index+1} of ${i.length}`:""})()]})]})]})]})}),n.traced===!1&&e("div",{class:"in hint",children:"Part of this run was driven over MCP without a step trace, so steps from that part are not shown."}),r?.status==="yielded"&&e("div",{class:"in hint",children:n.error}),o&&r.phase==="after"&&e("div",{class:"in hint",children:["Values ",l," produced can be changed in its Step card before the next node reads them."]}),e(zl,{w:t}),a&&n.status==="completed"&&e("div",{class:"in result",role:"region","aria-label":"Result",children:[e("h5",{children:"Result"}),e("pre",{class:"mono",children:e(Yn,{value:n.result})})]})]})}var ia=6,Bl=[["all","all"],["failed","failed"],["waiting","waiting"],["done","done"]];function ql(t,n){return t.debug?.status==="paused"?`paused at ${n(t.debug.node)}`:t.status==="running"?t.debug?"stepping":"running":t.status==="waiting"?`waiting at ${n(t.gate?.node)}`:t.status==="failed"?t.failedAt?`failed at ${n(t.failedAt)}`:"failed":t.status}function Kl(t){let n=Object.entries(t??{}).filter(([,s])=>s!==void 0);return n.slice(0,3).map(([s,a])=>`${s}: ${Kr(a)}`).join(", ")+(n.length>3?", \u2026":"")}function Gl({w:t}){let[n,s]=w(!1),[a,r]=w("all"),[o,l]=w(!1);if(rt.value,!Le.value.length)return null;let i=h=>h?t.nodes[h]?.label??h:"",c=h=>a==="all"?!0:a==="failed"?h.status==="failed":a==="waiting"?h.status==="waiting"||h.debug?.status==="paused":h.status==="completed"||h.status==="cancelled",u=Le.value.filter(c),p=n?u:u.slice(0,ia),f=Le.value.filter(h=>["completed","failed","cancelled"].includes(h.status)&&!h.debug),d=async()=>{l(!1);for(let h of f)try{await Er(h.id)}catch(v){O(v.message);break}};return e("div",{class:"card",children:[e("h3",{children:["Runs",e("span",{class:"hint",children:Le.value.length}),e("span",{class:"sp"}),e("div",{class:"seg sm",children:Bl.map(([h,v])=>e("button",{class:a===h?"on":"",onClick:()=>r(h),children:v},h))})]}),e("div",{class:"in runlist",children:[p.map(h=>e("button",{class:`runrow ${z.value?.id===h.id?"on":""}`,onClick:()=>{ae.value=null,S.side.value="run",cn(h.id)},children:[e("span",{class:`rdot ${h.debug?.status==="paused"?"waiting":h.status}`}),e("span",{class:"what",children:[ql(h,i),h.origin&&h.origin!=="console"&&e("small",{class:"origin",title:`started over ${h.origin==="http"?"HTTP":h.origin==="mcp"?"MCP, by an assistant":h.origin}`,children:h.origin})]}),e("span",{class:"right",title:h.source?.commit?`on ${h.source.commit}${h.source.dirty?", with uncommitted changes":""}`:void 0,children:[h.source?.commit?`${h.source.commit}${h.source.dirty?"*":""}, `:"",Ae(h.startedAt),h.status==="running"||h.status==="waiting"?"":`, ${ee(He(h))}`]}),e("span",{class:"sub",children:Kl(h.params)||"no parameters"}),!Ht.value&&e("span",{class:"again",title:"Run again with these parameters",onClick:v=>{v.stopPropagation(),pn(h.params,{mocks:h.mocks})},children:e("span",{class:"ms",children:"replay"})})]},h.id)),!p.length&&e("div",{class:"hint",style:"padding:4px 9px",children:["none ",a==="all"?"":a]}),u.length>ia&&e("button",{class:"more",onClick:()=>s(!n),children:n?"show fewer":`${u.length-ia} more`}),f.length>0&&(o?e("div",{class:"clearrow",children:[e("span",{class:"hint",children:["Forget ",f.length," finished run",f.length>1?"s":"","?"]}),e("button",{class:"btn danger sm",onClick:d,children:"Forget"}),e("button",{class:"btn ghost sm",onClick:()=>l(!1),children:"Keep"})]}):e("button",{class:"more",onClick:()=>l(!0),children:"clear finished"}))]})]})}function Vl({id:t,w:n}){let s=z.value,a=n.nodes[t],r=ca(t,n.model.steps),[o,l]=w(!1),[i,c]=w(void 0);P(()=>{c(void 0)},[t]);let u=xr(t),p=S.pass.value?.id===t?S.pass.value.index:void 0,f=i??p??fr(u),d=f!==void 0?u.find(b=>b.index===f):void 0;if(!a)return null;let h=n.issues.filter(b=>b.node===t),v=b=>r?.reads.find(R=>R.port===b),g=b=>r?.exprs.find(R=>R.port===b)??a.expr.find(R=>R.port===b),m=b=>b==="Exit"?"Exit":n.nodes[b]?.label??b,k=[];a.gate&&k.push({cls:"gate",label:`${a.gate} gate`,why:"The run pauses here and resumes when answered.",doc:["durable-gates","Gate kinds"]}),r?.kind==="loop"&&k.push({cls:"loop",label:r.scope?`scope ${r.scope}`:"scope owner",why:"Owns the steps in the band below it and runs them once per item.",doc:["export-interface"]});let y=Uo(n.model.steps,t);y&&k.push({cls:"loop",label:y.scope?`inside ${y.scope}`:"inside a scope",why:e(x,{children:["Runs once per item, driven by ",e("a",{class:"go",onClick:()=>{ae.value=y.id,S.side.value="step"},children:y.label}),"."]}),doc:["export-interface"]}),a.pull&&k.push({cls:"pull",label:"pulled",why:"Runs on demand when a consumer reads it, not in process order.",doc:["advanced-annotations","pull"]}),a.expression?k.push({cls:"expr",label:"expression",why:"Computes a value and has no onFailure: a throw aborts the run.",doc:["orientation","The model"]}):a.durablePure&&k.push({cls:"expr",label:"pure",why:"Takes no effect on the world, so it may re-run when the workflow resumes.",doc:["durable-gates","Classifying every node"]}),a.effect&&k.push({cls:"effect",label:"effect",why:"Recovered from its recorded result on resume rather than re-run.",doc:["durable-gates","The effect contract"]}),a.builtin&&k.push({cls:"",label:"built-in",why:"Provided by the runtime. It has no source in this project.",doc:["built-in-nodes"]});let _=a.file.startsWith(n.file.slice(0,n.file.length-n.rel.length))?a.file.slice(n.file.length-n.rel.length):a.file;return e(x,{children:[e("div",{class:"card",children:[e("h3",{children:[a.label,e("span",{class:"mono",children:a.type}),a.pack&&e(x,{children:[e("span",{class:"sp"}),e("button",{class:"tag pack",title:a.pack,onClick:()=>Re(a.pack),children:Be(a.pack)})]})]}),k.length>0&&e("div",{class:"in traits",children:k.map(b=>e("div",{class:"trait",children:[e("button",{class:`tag ${b.cls} tagbtn`,title:"Read about this",onClick:()=>J(b.doc[0],b.doc[1]),children:b.label}),e("span",{class:"why",children:b.why})]},b.label))}),a.description&&e("div",{class:`in hint desc ${o?"open":""}`,onClick:()=>l(!o),children:a.description}),a.gate==="agent"&&e("div",{class:"in agentrow",children:[e("span",{class:"hint",children:"answered by"}),pe.value?.agents.length?e(as,{workflow:n.name,node:t}):e("button",{class:"linkish",onClick:_e,children:"a person (add a profile)"})]}),h.length>0&&e("div",{class:"in",children:e(la,{issues:h,w:n})}),u.length>1&&e("div",{class:"in passes",children:[e("span",{class:"hint",children:["ran ",u.length," times, pass"]}),u.length<=12?e("div",{class:"seg sm",children:u.map(b=>e("button",{class:`${f===b.index?"on":""} ${b.error||b.status==="FAILED"?"bad":""}`,title:b.error??b.status.toLowerCase(),onClick:()=>c(b.index),children:b.index+1},b.index))}):e(ue,{value:String(f),onChange:b=>c(Number(b)),options:u.map(b=>({value:String(b.index),label:e(x,{children:[b.index+1,b.error||b.status==="FAILED"?e("span",{class:"opt-ns",children:", failed"}):null]}),text:`${b.index+1}`}))}),d?.start!=null&&d.end!=null&&e("span",{class:"hint",children:ee(d.end-d.start)})]}),(d?d.error:s?.errors[t])&&e("div",{class:"in",children:[e("h5",{children:["Error",u.length>1?e("span",{class:"hint",style:"margin-left:8px;text-transform:none;letter-spacing:0",children:["pass ",f+1]}):null]}),e("div",{class:"val static",style:"color:var(--err)",children:d?d.error:s?.errors[t]})]}),e(Bo,{deploy:a.deploy}),e("div",{class:"in",children:[e("h5",{children:"Inputs"}),a.inputs.length?e("div",{class:"ports",children:a.inputs.map(b=>{let R=v(b.name),D=g(b.name),C=R?Fs(R.from,R.fromPort,f):void 0;return e(x,{children:[e("span",{class:"p",children:[b.name,b.optional&&e("i",{children:"?"})]}),e("span",{children:[C!==void 0&&e(x,{children:[e(me,{value:C})," "]}),D?e("span",{class:"from",children:["= ",e(vn,{value:D.expr})]}):R?e("span",{class:"from",children:["\u2190 ",e($t,{node:R.from,port:R.fromPort})]}):e("span",{class:"from",style:"opacity:.6",children:b.optional?"optional":"\u2014"})]})]})})}):e("div",{class:"hint",children:"none"})]}),e("div",{class:"in",children:[e("h5",{children:["Outputs",s?.debug?.status==="paused"&&e("span",{class:"hint",style:"margin-left:8px;text-transform:none;letter-spacing:0",children:"editable while paused"})]}),a.outputs.length?e("div",{class:"ports",children:a.outputs.map(b=>{let R=Fs(t,b.name,f),D=r?.produces.find(A=>A.port===b.name)?.to??[],C=s?.debug?.status==="paused"&&R!==void 0;return e(x,{children:[e("span",{class:"p",children:b.name}),e("span",{children:[C?e(Zl,{value:R,onSet:A=>Qe("set",{node:t,port:b.name,value:A})}):R!==void 0&&e(x,{children:[e(me,{value:R})," "]}),D.length>0&&e("span",{class:"from",children:["\u2192 ",D.map((A,q)=>e(x,{children:[e("span",{class:"e-node",children:A}),q<D.length-1?", ":""]}))]})]})]})})}):e("div",{class:"hint",children:"none"})]}),r&&(r.successTo.length>0||r.failureTo.length>0)&&e("div",{class:"in",children:[e("h5",{children:"Then"}),e("div",{class:"ports",children:[r.successTo.length>0&&e(x,{children:[e("span",{class:"p",style:"color:var(--ok)",children:"ok"}),e("span",{class:"from",children:["\u2192 ",r.successTo.map(m).join(", ")]})]}),r.failureTo.length>0&&e(x,{children:[e("span",{class:"p",style:"color:var(--err)",children:"failure"}),e("span",{class:"from",children:["\u2192 ",r.failureTo.map(m).join(", ")]})]})]})]}),s&&dn(t)!=null&&e("div",{class:"in",children:e("div",{class:"kv",children:[e("span",{class:"k",children:"took"}),e("span",{class:"val static",children:[ee(dn(t)),u.length>1?` over ${u.length} passes`:""]})]})})]}),e("div",{class:"card",children:[e("h3",{children:["Code",e("span",{class:"sp"}),a.source&&e("a",{class:"mono",href:Ie(a.file,a.line??1),children:[_,":",a.line??""]})]}),a.source?e(rs,{source:a.source,startLine:a.line??1,highlight:h.map(b=>b.line).filter(b=>!!b),title:a.label,file:{path:a.file,label:`${_}:${a.line??""}`,line:a.line??1}}):e("div",{class:"in hint",children:["Built-in node (",a.type,")",a.expr.length>0&&e("div",{class:"ports",style:"margin-top:8px",children:a.expr.map(b=>e(x,{children:[e("span",{class:"p",children:b.port}),e("span",{class:"from",children:["= ",e(vn,{value:b.expr})]})]}))})]})]})]})}function Jl({id:t,w:n}){let s=z.value,[a,r]=w(!1),o=c=>n.nodes[c]?.label??c,l=s?.status==="failed",i=s?.status==="completed"&&s.result?.onFailure===!0;return e(x,{children:e("div",{class:"card",children:[e("h3",{children:[t,e("span",{class:"mono",children:n.name})]}),t==="Start"&&n.description&&e("div",{class:`in hint desc ${a?"open":""}`,onClick:()=>r(!a),children:n.description}),t==="Exit"&&s?.error&&l&&e("div",{class:"in",children:[e("h5",{children:"Error"}),e("div",{class:"val static",style:"color:var(--err)",children:s.error})]}),t==="Start"?e("div",{class:"in",children:[e("h5",{children:"Parameters"}),n.params.length?e("div",{class:"ports",children:n.params.map(c=>{let u=s?s.values[`Start.${c.name}`]??s.params[c.name]:void 0,p=n.wiring.start[c.name]??[];return e(x,{children:[e("span",{class:"p",title:c.description,children:[c.name,c.optional&&e("i",{children:"?"})]}),e("span",{children:[u!==void 0&&e(x,{children:[e(me,{value:u})," "]}),e("span",{class:"from",children:c.tsType}),p.length>0&&e("span",{class:"from",children:[" \u2192 ",p.map((f,d)=>e(x,{children:[e($t,{node:f.node,port:f.port}),d<p.length-1?", ":""]}))]}),!p.length&&e("span",{class:"from",style:"opacity:.6",children:" unread"})]})]})})}):e("div",{class:"hint",children:"no parameters"})]}):e("div",{class:"in",children:[e("h5",{children:["Returns",i&&e("span",{class:"tag",style:"margin-left:8px;color:var(--err)",children:"onFailure"})]}),n.returns.length?e("div",{class:"ports",children:n.returns.map(c=>{let u=s?.result?.[c.name],p=n.wiring.exit[c.name];return e(x,{children:[e("span",{class:"p",title:c.description,children:[c.name,c.optional&&e("i",{children:"?"})]}),e("span",{children:[u!==void 0&&e(x,{children:[e(me,{value:u})," "]}),e("span",{class:"from",children:c.tsType}),p?e("span",{class:"from",children:[" \u2190 ",e($t,{node:p.node,port:p.port})]}):e("span",{class:"from",style:"opacity:.6",children:" nothing feeds it"})]})]})})}):e("div",{class:"hint",children:"no return values"})]}),t==="Start"&&n.model.startTo.length>0&&e("div",{class:"in",children:[e("h5",{children:"Then"}),e("div",{class:"ports",children:[e("span",{class:"p",style:"color:var(--ok)",children:"ok"}),e("span",{class:"from",children:["\u2192 ",n.model.startTo.map(o).join(", ")]})]})]}),t==="Exit"&&n.model.exitFrom.length>0&&e("div",{class:"in",children:[e("h5",{children:"Reached from"}),e("div",{class:"ports",children:n.model.exitFrom.map(c=>e(x,{children:[e("span",{class:"p",style:`color:var(--${c.arm==="fail"?"err":"ok"})`,children:c.arm==="fail"?"failure":"ok"}),e("span",{class:"from",children:["\u2190 ",o(c.from)]})]}))})]}),t==="Start"&&e(Bo,{deploy:n.deploy}),(n.params.some(c=>c.description)||n.returns.some(c=>c.description))&&e("div",{class:"in",children:e("div",{class:"ports",children:(t==="Start"?n.params:n.returns).filter(c=>c.description).map(c=>e(x,{children:[e("span",{class:"p",children:c.name}),e("span",{class:"hint",children:c.description})]}))})})]})})}function Bo({deploy:t}){return t?e(x,{children:Object.entries(t).map(([n,s])=>e("div",{class:"in",children:[e("h5",{children:[n," tags"]}),e("div",{class:"kv",children:Object.entries(s).map(([a,r])=>e(x,{children:[e("span",{class:"k",children:a}),e(me,{value:r})]}))})]},n))}):null}function Zl({value:t,onSet:n}){let[s,a]=w(!1),[r,o]=w(""),[l,i]=w(""),c=()=>{o(JSON.stringify(t)),i(""),a(!0)},u=async()=>{let p;try{p=JSON.parse(r)}catch{i("not valid JSON");return}try{await n(p),a(!1),O("value set")}catch(f){i(f.message)}};return s?e("span",{class:"editval",children:[e("input",{type:"text",class:"mono",value:r,placeholder:'a JSON value: "text", 42, true, { \u2026 }',onInput:p=>o(p.target.value),onKeyDown:p=>{p.key==="Enter"&&u(),p.key==="Escape"&&a(!1)},autoFocus:!0}),e("button",{class:"btn primary sm",onClick:u,children:"Set"}),e("button",{class:"btn sm",onClick:()=>a(!1),children:"Cancel"}),l&&e("span",{class:"err",children:l})]}):e(x,{children:[e(me,{value:t})," ",e("button",{class:"linkish",title:"Change this value",onClick:c,children:"edit"})," "]})}function Xl(){return e("div",{class:"card",children:[e("h3",{children:["Guide",e("span",{class:"sp"}),e("button",{class:"linkish",onClick:()=>J("orientation"),children:"open"})]}),e("div",{class:"in",children:e("button",{class:"searchbtn",onClick:()=>{S.search.value=!0},children:[e("span",{class:"ms",children:"search"}),e("span",{children:"Search the guide, workflows, packs, commands\u2026"}),e("span",{class:"sp"}),e(ge,{combo:"mod+K"})]})})]})}function Ql({w:t}){let n=t.issues.filter(a=>!a.node),s=new Map;for(let a of t.issues){if(!a.node)continue;let r=s.get(a.node)??[];r.push(a),s.set(a.node,r)}return e(x,{children:[n.length>0&&e("div",{class:"card",children:[e("h3",{children:"Workflow"}),e("div",{class:"in",children:e(la,{issues:n,w:t})})]}),[...s].map(([a,r])=>e("div",{class:"card",children:[e("h3",{children:[e("button",{class:"linkish",onClick:()=>{ae.value=a,S.side.value="step"},children:t.nodes[a]?.label??a}),e("span",{class:"mono",children:a})]}),e("div",{class:"in",children:e(la,{issues:r,w:t})})]},a))]})}function qo(){let t=W.value;if(!Je(t))return null;let n=t.issues,s=n.filter(v=>v.severity==="error").length,a=S.side.value,r=ae.value,o=z.value?z.value.debug?.status==="paused"?"Paused":z.value.status==="waiting"?"Gate":z.value.status==="running"?"Running":"Run":"Run",l=r?t.nodes[r]:void 0,i=r?ca(r,t.model.steps):null,c=r?r==="Start"?"play_arrow":r==="Exit"?"flag":l?.icon??Qn(i?.kind==="loop"?"loop":l?.effect?"effect":l?.gate??(i?.pull?"pull":null))??"adjust":"adjust",u=l?Bt(l.color)??(l.gate?"var(--gate)":i?.kind==="loop"?"var(--loop)":null):null,p=["reference","changes","export"],[f,d]=w(!1),h=f||p.includes(a);return P(()=>{p.includes(a)||d(!1)},[a]),e(x,{children:[e("div",{class:"panes",children:[e(re,{icon:z.value?z.value.debug?.status==="paused"?"pause_circle":z.value.status==="waiting"?"how_to_reg":z.value.status==="running"?"play_circle":"check_circle":"play_circle",label:o,on:a==="run",onClick:()=>{S.side.value="run"}}),e(re,{icon:c,iconColor:u,label:r?r==="Start"||r==="Exit"?r:t.nodes[r]?.label??r:"Step",on:a==="step",disabled:!r,onClick:()=>{S.side.value="step"}}),n.length>0&&e(re,{icon:s>0?"error":"warning",label:"Issues",on:a==="issues",onClick:()=>{S.side.value="issues"},children:e("span",{class:`issuecount ${s>0?"err":"warn"}`,children:n.length})}),e(re,{icon:"dns",label:"Serve",on:a==="serve",onClick:()=>{S.side.value="serve"}}),h?e(x,{children:[e(re,{icon:"data_object",label:"Reference",on:a==="reference",onClick:()=>{S.side.value="reference"}}),e(re,{icon:"difference",label:"Changes",on:a==="changes",onClick:()=>{S.side.value="changes"}}),on.value.length>0&&e(re,{icon:"output",label:"Export",on:a==="export",onClick:()=>{S.side.value="export"}})]}):e(re,{icon:"more_horiz",label:"More",on:!1,onClick:()=>d(!0)})]}),e("div",{class:"panebody",children:[a==="run"&&e(x,{children:[z.value?e(Ul,{w:t}):e(Co,{w:t}),e(Gl,{w:t})]}),a==="issues"&&e(Ql,{w:t}),a==="step"&&(r?r==="Start"||r==="Exit"?e(Jl,{id:r,w:t}):e(Vl,{id:r,w:t}):e("div",{class:"hint",style:"padding:12px",children:"Pick a step in the process."})),a==="changes"&&e(Ro,{w:t}),a==="reference"&&e(x,{children:[e(Wo,{w:t}),e(Xl,{})]}),a==="export"&&e(Lo,{w:t}),a==="serve"&&e(Fo,{w:t})]})]})}function fa(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Rt=fa();function ni(t){Rt=t}var Tt={exec:()=>null};function Gt(t){let n=[];return s=>{let a=Math.max(0,Math.min(3,s-1)),r=n[a];return r||(r=t(a),n[a]=r),r}}function H(t,n=""){let s=typeof t=="string"?t:t.source,a={replace:(r,o)=>{let l=typeof o=="string"?o:o.source;return l=l.replace(ve.caret,"$1"),s=s.replace(r,l),a},getRegex:()=>new RegExp(s,n)};return a}var Yl=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),ve={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Gt(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Gt(t=>new RegExp(`^ {0,${t}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Gt(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:Gt(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:Gt(t=>new RegExp(`^ {0,${t}}(?:</?(?:${xn})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,"i")),blockquoteBeginRegex:Gt(t=>new RegExp(`^ {0,${t}}>`))},ec=/^(?:[ \t]*(?:\n|$))+/,tc=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,nc=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,wn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,sc=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ha=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,si=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ai=H(si).replace(/bull/g,ha).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ac=H(si).replace(/bull/g,ha).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ga=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,rc=/^[^\n]+/,ma=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,oc=H(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ma).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ic=H(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ha).getRegex(),xn="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",va=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,lc=H("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",va).replace("tag",xn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ri=t=>H(ga).replace("hr",wn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",t).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",xn).getRegex(),cc=ri(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),uc=ri(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),dc=H(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",uc).getRegex(),ba={blockquote:dc,code:tc,def:oc,fences:nc,heading:sc,hr:wn,html:lc,lheading:ai,list:ic,newline:ec,paragraph:cc,table:Tt,text:rc},Ko=H("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",wn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",xn).getRegex(),pc={...ba,lheading:ac,table:Ko,paragraph:H(ga).replace("hr",wn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ko).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",xn).getRegex()},fc={...ba,html:H(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",va).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Tt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:H(ga).replace("hr",wn).replace("heading",` *#{1,6} *[^
|
|
40
|
+
]`).replace("lheading",ai).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},hc=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,gc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,oi=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,mc=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,nt=/[\p{P}\p{S}]/u,Vt=/[\s\p{P}\p{S}]/u,_n=/[^\s\p{P}\p{S}]/u,vc=H(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Vt).getRegex(),bc=/[\p{Pi}\p{Ps}"']/u,ii=/(?!~)[\p{P}\p{S}]/u,kc=/(?!~)[\s\p{P}\p{S}]/u,yc=/(?:[^\s\p{P}\p{S}]|~)/u,wc=H(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Yl?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),li=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,xc=H(li,"u").replace(/punct/g,nt).getRegex(),_c=H(li,"u").replace(/punct/g,ii).getRegex(),Sc=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,$c=H(Sc,"u").replace(/openQuote/g,bc).replace(/punct/g,nt).getRegex(),ci="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Cc=H(ci,"gu").replace(/notPunctSpace/g,_n).replace(/punctSpace/g,Vt).replace(/punct/g,nt).getRegex(),Tc=H(ci,"gu").replace(/notPunctSpace/g,yc).replace(/punctSpace/g,kc).replace(/punct/g,ii).getRegex(),Ec="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Rc=H(Ec,"gu").replace(/notPunctSpace/g,_n).replace(/punctSpace/g,Vt).replace(/punct/g,nt).getRegex(),Ac=H("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,_n).replace(/punctSpace/g,Vt).replace(/punct/g,nt).getRegex(),Pc="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Lc=H(Pc,"gu").replace(/notPunctSpace/g,_n).replace(/punctSpace/g,Vt).replace(/punct/g,nt).getRegex(),Ic=H(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,nt).getRegex(),Dc="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Mc=H(Dc,"gu").replace(/notPunctSpace/g,_n).replace(/punctSpace/g,Vt).replace(/punct/g,nt).getRegex(),Oc=H(/\\(punct)/,"gu").replace(/punct/g,nt).getRegex(),jc=H(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Nc=H(va).replace("(?:-->|$)","-->").getRegex(),Fc=H("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Nc).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ui=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,ds=H(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",ui).getRegex(),Hc=H(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ds).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Wc=H(/^!?\[(label)\]\[(ref)\]/).replace("label",ds).replace("ref",ma).getRegex(),zc=H(/^!?\[(ref)\](?:\[\])?/).replace("ref",ma).getRegex(),Go=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Uc=H(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",ui).getRegex(),Bc=H("reflink|nolink(?!\\()","g").replace("reflink",H(/^!?\[(label)\]\[(ref)\]/).replace("label",Uc).replace("ref",Go).getRegex()).replace("nolink",H(/^!?\[(ref)\](?:\[\])?/).replace("ref",Go).getRegex()).getRegex(),Vo=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,qc=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,Kc=H(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,qc).getRegex(),ka={_backpedal:Tt,anyPunctuation:Oc,autolink:jc,blockSkip:wc,br:oi,code:gc,del:Tt,delLDelim:Tt,delRDelim:Tt,emStrongLDelim:xc,emStrongRDelimAst:Cc,emStrongRDelimUnd:Ac,escape:hc,link:Hc,nolink:zc,punctuation:vc,reflink:Wc,reflinkSearch:Bc,tag:Fc,text:mc,url:Tt},Gc={...ka,emStrongLDelim:$c,emStrongRDelimAst:Rc,emStrongRDelimUnd:Lc,link:H(/^!?\[(label)\]\((.*?)\)/).replace("label",ds).getRegex(),reflink:H(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ds).getRegex()},ua={...ka,emStrongRDelimAst:Tc,emStrongLDelim:_c,delLDelim:Ic,delRDelim:Mc,url:H(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",Kc).replace("protocol",Vo).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:H(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",Vo).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Vc={...ua,br:H(oi).replace("{2,}","*").getRegex(),text:H(ua.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},us={normal:ba,gfm:pc,pedantic:fc},kn={normal:ka,gfm:ua,breaks:Vc,pedantic:Gc},Jc={"&":"&","<":"<",">":">",'"':""","'":"'"},Jo=t=>Jc[t];function $e(t,n){if(n){if(ve.escapeTest.test(t))return t.replace(ve.escapeReplace,Jo)}else if(ve.escapeTestNoEncode.test(t))return t.replace(ve.escapeReplaceNoEncode,Jo);return t}function Zc(t){return t.replace(ve.numericCharacterReference,(n,s,a)=>{let r=s===void 0?Number.parseInt(a,16):Number.parseInt(s,10);return r===0||r>1114111||r>=55296&&r<=57343?"\uFFFD":String.fromCodePoint(r)})}function Zo(t){try{t=encodeURI(t).replace(ve.percentDecode,"%")}catch{return null}return t}function Xo(t,n){let s=t.replace(ve.findPipe,(o,l,i)=>{let c=!1,u=l;for(;--u>=0&&i[u]==="\\";)c=!c;return c?"|":" |"}),a=s.split(ve.splitPipe),r=0;if(a[0].trim()||a.shift(),a.length>0&&!a.at(-1)?.trim()&&a.pop(),n)if(a.length>n)a.splice(n);else for(;a.length<n;)a.push("");for(;r<a.length;r++)a[r]=a[r].trim().replace(ve.slashPipe,"|");return a}function dt(t,n,s){let a=t.length;if(a===0)return"";let r=0;for(;r<a;){let o=t.charAt(a-r-1);if(o===n&&!s)r++;else if(o!==n&&s)r++;else break}return t.slice(0,a-r)}function Qo(t){let n=t.split(`
|
|
41
|
+
`),s=n.length-1;for(;s>=0&&ve.blankLine.test(n[s]);)s--;return n.length-s<=2?t:n.slice(0,s+1).join(`
|
|
42
|
+
`)}function ps(t){return t.trim().toLowerCase().toUpperCase().toLowerCase()}function Xc(t,n){if(t.indexOf(n[1])===-1)return-1;let s=0;for(let a=0;a<t.length;a++)if(t[a]==="\\")a++;else if(t[a]===n[0])s++;else if(t[a]===n[1]&&(s--,s<0))return a;return s>0?-2:-1}function Yo(t,n=0){let s=n,a="";for(let r of t)if(r===" "){let o=4-s%4;a+=" ".repeat(o),s+=o}else a+=r,s++;return a}function ei(t,n,s,a,r){let o=n.href,l=n.title||null,i=t[1].replace(r.other.outputLinkReplace,"$1"),c=t[0].charAt(0)==="!";a.state.inLink=!0;let u=a.state.linkEmitted,p=a.state.inRawBlock;a.state.linkEmitted=!1;let f=a.inlineTokens(i),d=a.state.linkEmitted;if(a.state.linkEmitted=u,a.state.inLink=!1,!c){if(d){a.state.inRawBlock=p;return}a.state.linkEmitted=!0}return{type:c?"image":"link",raw:s,href:o,title:l,text:i,tokens:f}}function Qc(t,n,s){let a=t.match(s.other.indentCodeCompensation);if(a===null)return n;let r=a[1];return n.split(`
|
|
43
|
+
`).map(o=>{let l=o.match(s.other.beginningSpace);if(l===null)return o;let[i]=l;return o.slice(Math.min(i.length,r.length))}).join(`
|
|
44
|
+
`)}function ti(t,n,s,a){if(!n.includes("<"))return!1;for(let r=0;r<n.length;r++){if(n[r]==="\\"){r++;continue}if(n[r]==="`"){let i=a.inline.code.exec(n.slice(r));if(i){r+=i[0].length-1;continue}}if(n[r]!=="<")continue;let o=t.slice(s+r),l=a.inline.tag.exec(o)||a.inline.autolink.exec(o);if(l){if(l[0].length>n.length-r)return!0;r+=l[0].length-1}}return!1}var fs=class{options;rules;lexer;constructor(t){this.options=t||Rt}space(t){let n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){let n=this.rules.block.code.exec(t);if(n){let s=this.options.pedantic?n[0]:Qo(n[0]),a=s.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:s,codeBlockStyle:"indented",text:a}}}fences(t){let n=this.rules.block.fences.exec(t);if(n){let s=n[0],a=Qc(s,n[3]||"",this.rules);return{type:"code",raw:s,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:a}}}heading(t){let n=this.rules.block.heading.exec(t);if(n){let s=n[2].trim();if(this.rules.other.endingHash.test(s)){let a=dt(s,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceTabChar.test(a))&&(s=a.trim())}return{type:"heading",raw:dt(n[0],`
|
|
45
|
+
`),depth:n[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(t){let n=this.rules.block.hr.exec(t);if(n)return{type:"hr",raw:dt(n[0],`
|
|
46
|
+
`)}}blockquote(t){let n=this.rules.block.blockquote.exec(t);if(n){let s=dt(n[0],`
|
|
47
|
+
`).split(`
|
|
48
|
+
`),a="",r="",o=[];for(;s.length>0;){let l=!1,i=[],c;for(c=0;c<s.length;c++)if(this.rules.other.blockquoteStart.test(s[c]))i.push(s[c]),l=!0;else if(!l)i.push(s[c]);else break;s=s.slice(c);let u=i.join(`
|
|
49
|
+
`),p=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
50
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
|
|
51
|
+
${u}`:u,r=r?`${r}
|
|
52
|
+
${p}`:p;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,o,!0),this.lexer.state.top=f,s.length===0)break;let d=o.at(-1);if(d?.type==="code")break;if(d?.type==="blockquote"){let h=d,v=s.join(`
|
|
53
|
+
`),g=h.raw+`
|
|
54
|
+
`+v.replace(this.rules.other.blockquoteSetextReplace2,""),m=this.blockquote(g);o[o.length-1]=m;let k=g.substring(m.raw.length).replace(/^\n/,""),y=k?k.split(`
|
|
55
|
+
`).length:0,_=y?s.slice(0,-y):s;_.length>0&&(a=`${a}
|
|
56
|
+
${_.join(`
|
|
57
|
+
`)}`),r=r.substring(0,r.length-h.text.length)+m.text;break}else if(d?.type==="list"){let h=d,v=h.raw+`
|
|
58
|
+
`+s.join(`
|
|
59
|
+
`),g=this.list(v);o[o.length-1]=g,a=a.substring(0,a.length-d.raw.length)+g.raw,r=r.substring(0,r.length-h.raw.length)+g.raw,s=v.substring(o.at(-1).raw.length).split(`
|
|
60
|
+
`);continue}}return{type:"blockquote",raw:a,tokens:o,text:r}}}list(t){let n=this.rules.block.list.exec(t);if(n){let s=n[1].trim(),a=s.length>1,r={type:"list",raw:"",ordered:a,start:a?+s.slice(0,-1):"",loose:!1,items:[]};s=a?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=a?s:"[*+-]");let o=this.rules.other.listItemRegex(s),l=!1;for(;t;){let c=!1,u="",p="";if(!(n=o.exec(t))||this.rules.block.hr.test(t))break;u=n[0],t=t.substring(u.length);let f=n[2].split(`
|
|
61
|
+
`,1)[0],d=n[1].length,h=this.options.pedantic?Yo(f,d):f.replace(this.rules.other.leadingSpaceTab,k=>Yo(k,d)),v=t.split(`
|
|
62
|
+
`,1)[0],g=!h.trim(),m=0;if(this.options.pedantic?(m=2,p=h.trimStart()):g?m=d+1:(m=h.search(this.rules.other.nonSpaceChar),m=m>4?1:m,p=h.slice(m),m+=d),g&&this.rules.other.blankLine.test(v)&&(u+=v+`
|
|
63
|
+
`,t=t.substring(v.length+1),c=!0),!c){let k=this.rules.other.nextBulletRegex(m),y=this.rules.other.hrRegex(m),_=this.rules.other.fencesBeginRegex(m),b=this.rules.other.headingBeginRegex(m),R=this.rules.other.htmlBeginRegex(m),D=this.rules.other.blockquoteBeginRegex(m);for(;t;){let C=t.split(`
|
|
64
|
+
`,1)[0],A;if(v=C,this.options.pedantic?(v=v.replace(this.rules.other.listReplaceNesting," "),A=v):A=v.replace(this.rules.other.leadingSpaceTab,q=>q.replace(this.rules.other.tabCharGlobal," ")),_.test(v)||b.test(v)||R.test(v)||D.test(v)||k.test(v)||y.test(v))break;if(A.search(this.rules.other.nonSpaceChar)>=m||!v.trim())p+=`
|
|
65
|
+
`+A.slice(m);else{if(g||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(h)||b.test(h)||y.test(h))break;p+=`
|
|
66
|
+
`+v}g=!v.trim(),u+=C+`
|
|
67
|
+
`,t=t.substring(C.length+1),h=A.slice(m)}}r.loose||(l?r.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(l=!0)),r.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),r.raw+=u}let i=r.items.at(-1);if(i)i.raw=i.raw.trimEnd(),i.text=i.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let c of r.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!r.loose){let u=c.tokens.filter(f=>f.type==="space"),p=u.length>0&&u.some(f=>this.rules.other.anyLine.test(f.raw));r.loose=p}for(let c of r.items){let u=c.tokens[0];if(c.task&&(u?.type==="text"||u?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),u.raw=u.raw.replace(this.rules.other.listReplaceTask,""),u.text=u.text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(c.raw);if(p){let f={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};c.checked=f.checked,r.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=f.raw+c.tokens[0].raw,c.tokens[0].text=f.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(f)):c.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):c.tokens.unshift(f)}}else c.task&&(c.task=!1)}if(r.loose)for(let c of r.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return r}}html(t){let n=this.rules.block.html.exec(t);if(n){let s=Qo(n[0]);return{type:"html",block:!0,raw:s,pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:s}}}def(t){let n=this.rules.block.def.exec(t);if(n){let s=ps(n[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:s,raw:dt(n[0],`
|
|
68
|
+
`),href:a,title:r}}}table(t){let n=this.rules.block.table.exec(t);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;let s=Xo(n[1]),a=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=n[3]?.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
69
|
+
`):[],o={type:"table",raw:dt(n[0],`
|
|
70
|
+
`),header:[],align:[],rows:[]};if(s.length===a.length){for(let l of a)this.rules.other.tableAlignRight.test(l)?o.align.push("right"):this.rules.other.tableAlignCenter.test(l)?o.align.push("center"):this.rules.other.tableAlignLeft.test(l)?o.align.push("left"):o.align.push(null);for(let l=0;l<s.length;l++)o.header.push({text:s[l],tokens:this.lexer.inline(s[l]),header:!0,align:o.align[l]});for(let l of r)o.rows.push(Xo(l,o.header.length).map((i,c)=>({text:i,tokens:this.lexer.inline(i),header:!1,align:o.align[c]})));return o}}lheading(t){let n=this.rules.block.lheading.exec(t);if(n){let s=n[1].trim();return{type:"heading",raw:dt(n[0],`
|
|
71
|
+
`),depth:n[2].charAt(0)==="="?1:2,text:s,tokens:this.lexer.inline(s)}}}paragraph(t){let n=this.rules.block.paragraph.exec(t);if(n){let s=n[1].charAt(n[1].length-1)===`
|
|
72
|
+
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:s,tokens:this.lexer.inline(s)}}}text(t){let n=this.rules.block.text.exec(t);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(t){let n=this.rules.inline.escape.exec(t);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(t){let n=this.rules.inline.tag.exec(t);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(t){let n=this.rules.inline.link.exec(t);if(n){let s=n[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&ti(t,n[1],s,this.rules))return;let a=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(a)){if(!this.rules.other.endAngleBracket.test(a))return;let l=dt(a.slice(0,-1),"\\");if((a.length-l.length)%2===0)return}else{let l=Xc(n[2],"()");if(l===-2)return;if(l>-1){let i=(n[0].indexOf("!")===0?5:4)+n[1].length+l;n[2]=n[2].substring(0,l),n[0]=n[0].substring(0,i).trim(),n[3]=""}}let r=n[2],o="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(r);l&&(r=l[1],o=l[3])}else o=n[3]?n[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(a)?r=r.slice(1):r=r.slice(1,-1)),ei(n,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(t,n){let s;if((s=this.rules.inline.reflink.exec(t))||(s=this.rules.inline.nolink.exec(t))){let a=s[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&ti(t,s[1],a,this.rules))return;let r=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=n[ps(r)];if(!o){let l=s[0].charAt(0);return{type:"text",raw:l,text:l}}return ei(s,o,s[0],this.lexer,this.rules)}}emStrong(t,n,s=""){let a=this.rules.inline.emStrongLDelim.exec(t);if(!(!a||!a[1]&&!a[2]&&!a[3]&&!a[4]||a[4]&&s.match(this.rules.other.unicodeAlphaNumeric))&&(!(a[1]||a[3])||!s||this.rules.inline.punctuation.exec(s))){let r=[...a[0]].length-1,o,l,i=r,c=0,u=a[0][0],p=s===u,f=u==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,n=n.slice(-1*t.length+r);(a=f.exec(n))!==null;){if(o=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!o)continue;if(l=[...o].length,a[3]||a[4]){i+=l;continue}else if(a[5]||a[6]){if(r%3&&!((r+l)%3)){c+=l;continue}if(p)break}if(i-=l,i>0)continue;l=Math.min(l,l+i+c);let d=[...a[0]][0].length,h=t.slice(0,r+a.index+d+l);if(Math.min(r,l)%2){let g=h.slice(1,-1);return{type:"em",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}let v=h.slice(2,-2);return{type:"strong",raw:h,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(t){let n=this.rules.inline.code.exec(t);if(n){let s=n[2].replace(this.rules.other.newLineCharGlobal," "),a=this.rules.other.nonSpaceChar.test(s),r=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return a&&r&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:n[0],text:s}}}br(t){let n=this.rules.inline.br.exec(t);if(n)return{type:"br",raw:n[0]}}del(t,n,s=""){let a=this.rules.inline.delLDelim.exec(t);if(a&&(!a[1]||!s||this.rules.inline.punctuation.exec(s))){let r=[...a[0]].length-1,o,l,i=r,c=this.rules.inline.delRDelim;for(c.lastIndex=0,n=n.slice(-1*t.length+r);(a=c.exec(n))!==null;){if(o=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!o||(l=[...o].length,l!==r))continue;if(a[3]||a[4]){i+=l;continue}if(i-=l,i>0)continue;l=Math.min(l,l+i);let u=[...a[0]][0].length,p=t.slice(0,r+a.index+u+l),f=p.slice(r,-r);return{type:"del",raw:p,text:f,tokens:this.lexer.inlineTokens(f)}}}}autolink(t){let n=this.rules.inline.autolink.exec(t);if(n){let s,a;return n[2]==="@"?(s=n[1],a="mailto:"+s):(s=n[1],a=s),{type:"link",raw:n[0],text:s,href:a,autolink:!0,tokens:[{type:"text",raw:s,text:s}]}}}url(t){let n;if(n=this.rules.inline.url.exec(t)){let s,a;if(n[2]==="@")s=n[0],a="mailto:"+s;else{let r;do r=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??"";while(r!==n[0]);s=n[0],n[1]==="www."?a="http://"+n[0]:a=n[0]}return{type:"link",raw:n[0],text:s,href:a,autolink:!0,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(t){let n=this.rules.inline.text.exec(t);if(n){let s=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:s?n[0]:Zc(n[0]),escaped:s}}}},Me=class da{tokens;options;state;inlineQueue;tokenizer;constructor(n){this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Rt,this.options.tokenizer=this.options.tokenizer||new fs,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let s={other:ve,block:us.normal,inline:kn.normal};this.options.pedantic?(s.block=us.pedantic,s.inline=kn.pedantic):this.options.gfm&&(s.block=us.gfm,this.options.breaks?s.inline=kn.breaks:s.inline=kn.gfm),this.tokenizer.rules=s}static get rules(){return{block:us,inline:kn}}static lex(n,s){return new da(s).lex(n)}static lexInline(n,s){return new da(s).inlineTokens(n)}lex(n){n=n.replace(ve.carriageReturn,`
|
|
73
|
+
`),this.blockTokens(n,this.tokens);for(let s=0;s<this.inlineQueue.length;s++){let a=this.inlineQueue[s];this.inlineTokens(a.src,a.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,s=[],a=!1){this.tokenizer.lexer=this,this.options.pedantic&&(n=n.replace(ve.tabCharGlobal," ").replace(ve.spaceLine,""));let r=1/0;for(;n;){if(n.length<r)r=n.length;else{this.infiniteLoopError(n.charCodeAt(0));break}let o;if(this.options.extensions?.block?.some(i=>(o=i.call({lexer:this},n,s))?(n=n.substring(o.raw.length),s.push(o),!0):!1))continue;if(o=this.tokenizer.space(n)){n=n.substring(o.raw.length);let i=s.at(-1);o.raw.length===1&&i!==void 0?i.raw+=`
|
|
74
|
+
`:s.push(o);continue}if(o=this.tokenizer.code(n)){n=n.substring(o.raw.length);let i=s.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
75
|
+
`)?"":`
|
|
76
|
+
`)+o.raw,i.text+=`
|
|
77
|
+
`+o.text,this.inlineQueue.at(-1).src=i.text):s.push(o);continue}if(o=this.tokenizer.fences(n)){n=n.substring(o.raw.length),s.push(o);continue}if(o=this.tokenizer.heading(n)){n=n.substring(o.raw.length),s.push(o);continue}if(o=this.tokenizer.hr(n)){n=n.substring(o.raw.length),s.push(o);continue}if(o=this.tokenizer.blockquote(n)){n=n.substring(o.raw.length),s.push(o);continue}if(o=this.tokenizer.list(n)){n=n.substring(o.raw.length),s.push(o);continue}if(o=this.tokenizer.html(n)){n=n.substring(o.raw.length),s.push(o);continue}if(o=this.tokenizer.def(n)){n=n.substring(o.raw.length);let i=s.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
78
|
+
`)?"":`
|
|
79
|
+
`)+o.raw,i.text+=`
|
|
80
|
+
`+o.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},s.push(o));continue}if(o=this.tokenizer.table(n)){n=n.substring(o.raw.length),s.push(o);continue}if(o=this.tokenizer.lheading(n)){n=n.substring(o.raw.length),s.push(o);continue}let l=n;if(this.options.extensions?.startBlock){let i=1/0,c=n.slice(1),u;this.options.extensions.startBlock.forEach(p=>{u=p.call({lexer:this},c),typeof u=="number"&&u>=0&&(i=Math.min(i,u))}),i<1/0&&i>=0&&(l=n.substring(0,i+1))}if(this.state.top&&(o=this.tokenizer.paragraph(l))){let i=s.at(-1);a&&i?.type==="paragraph"?(i.raw+=(i.raw.endsWith(`
|
|
81
|
+
`)?"":`
|
|
82
|
+
`)+o.raw,i.text+=`
|
|
83
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):s.push(o),a=l.length!==n.length,n=n.substring(o.raw.length);continue}if(o=this.tokenizer.text(n)){n=n.substring(o.raw.length);let i=s.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
84
|
+
`)?"":`
|
|
85
|
+
`)+o.raw,i.text+=`
|
|
86
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):s.push(o);continue}if(n){this.infiniteLoopError(n.charCodeAt(0));break}}return this.state.top=!0,s}inline(n,s=[]){return this.inlineQueue.push({src:n,tokens:s}),s}linkInText(n){if(!n.includes("["))return!1;let s=this.tokenizer.rules.inline.link;for(let a of n.matchAll(this.tokenizer.rules.inline.blockSkip))if(s.test(a[0])&&n.charAt(a.index-1)!=="!")return!0;for(let a of n.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let r=a[0],o=r.lastIndexOf("[");if(!(r.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,ps(r.slice(o+1,-1))))&&!(o>1&&this.linkInText(r.slice(1,o-1))))return!0}return!1}inlineTokens(n,s=[]){this.tokenizer.lexer=this;let a=n;if(this.tokens.links&&n.includes("[")){let i=this.tokenizer.rules.inline.reflinkSearch,c=u=>{let p=u.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,ps(u.slice(p+1,-1))))return u;if(p>1&&u.charAt(0)!=="!"){let f=u.slice(1,p-1);if(this.linkInText(f))return"["+f.replace(i,c)+"]["+"a".repeat(u.length-p-2)+"]"}return"["+"a".repeat(u.length-2)+"]"};a=a.replace(i,c)}a=a.replace(this.tokenizer.rules.inline.anyPunctuation,i=>"+".repeat(i.length)),a=a.replace(this.tokenizer.rules.inline.blockSkip,(i,c,u)=>{let p=u?u.length:0;return i.slice(0,p)+"["+"a".repeat(i.length-p-2)+"]"}),a=this.options.hooks?.emStrongMask?.call({lexer:this},a)??a;let r=!1,o="",l=1/0;for(;n;){if(n.length<l)l=n.length;else{this.infiniteLoopError(n.charCodeAt(0));break}r||(o=""),r=!1;let i;if(this.options.extensions?.inline?.some(u=>(i=u.call({lexer:this},n,s))?(n=n.substring(i.raw.length),s.push(i),!0):!1))continue;if(i=this.tokenizer.escape(n)){n=n.substring(i.raw.length),s.push(i);continue}if(i=this.tokenizer.tag(n)){n=n.substring(i.raw.length),s.push(i);continue}if(i=this.tokenizer.link(n)){n=n.substring(i.raw.length),s.push(i);continue}if(i=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(i.raw.length);let u=s.at(-1);i.type==="text"&&u?.type==="text"?(u.raw+=i.raw,u.text+=i.text):s.push(i);continue}if(i=this.tokenizer.emStrong(n,a,o)){n=n.substring(i.raw.length),s.push(i);continue}if(i=this.tokenizer.codespan(n)){n=n.substring(i.raw.length),s.push(i);continue}if(i=this.tokenizer.br(n)){n=n.substring(i.raw.length),s.push(i);continue}if(i=this.tokenizer.del(n,a,o)){n=n.substring(i.raw.length),s.push(i);continue}if(i=this.tokenizer.autolink(n)){n=n.substring(i.raw.length),s.push(i);continue}if(!this.state.inLink&&(i=this.tokenizer.url(n))){n=n.substring(i.raw.length),s.push(i);continue}let c=n;if(this.options.extensions?.startInline){let u=1/0,p=n.slice(1),f;this.options.extensions.startInline.forEach(d=>{f=d.call({lexer:this},p),typeof f=="number"&&f>=0&&(u=Math.min(u,f))}),u<1/0&&u>=0&&(c=n.substring(0,u+1))}if(i=this.tokenizer.inlineText(c)){n=n.substring(i.raw.length),i.raw.slice(-1)!=="_"&&(o=i.raw.slice(-1)),r=!0;let u=s.at(-1);u?.type==="text"?(u.raw+=i.raw,u.text+=i.text):s.push(i);continue}if(n){this.infiniteLoopError(n.charCodeAt(0));break}}return s}infiniteLoopError(n){let s="Infinite loop on byte: "+n;if(this.options.silent)console.error(s);else throw new Error(s)}},hs=class{options;parser;constructor(t){this.options=t||Rt}space(t){return""}code({text:t,lang:n,escaped:s}){let a=(n||"").match(ve.notSpaceStart)?.[0],r=t?t.replace(ve.endingNewline,"")+`
|
|
87
|
+
`:"";return a?'<pre><code class="language-'+$e(a)+'">'+(s?r:$e(r,!0))+`</code></pre>
|
|
88
|
+
`:"<pre><code>"+(s?r:$e(r,!0))+`</code></pre>
|
|
89
|
+
`}blockquote({tokens:t}){return`<blockquote>
|
|
90
|
+
${this.parser.parse(t)}</blockquote>
|
|
91
|
+
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:n}){return`<h${n}>${this.parser.parseInline(t)}</h${n}>
|
|
92
|
+
`}hr(t){return`<hr>
|
|
93
|
+
`}list(t){let n=t.ordered,s=t.start,a="";for(let l=0;l<t.items.length;l++){let i=t.items[l];a+=this.listitem(i)}let r=n?"ol":"ul",o=n&&s!==1?' start="'+s+'"':"";return"<"+r+o+`>
|
|
94
|
+
`+a+"</"+r+`>
|
|
95
|
+
`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
|
|
96
|
+
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
97
|
+
`}table(t){let n="",s="";for(let r=0;r<t.header.length;r++)s+=this.tablecell(t.header[r]);n+=this.tablerow({text:s});let a="";for(let r=0;r<t.rows.length;r++){let o=t.rows[r];s="";for(let l=0;l<o.length;l++)s+=this.tablecell(o[l]);a+=this.tablerow({text:s})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
|
|
98
|
+
<thead>
|
|
99
|
+
`+n+`</thead>
|
|
100
|
+
`+a+`</table>
|
|
101
|
+
`}tablerow({text:t}){return`<tr>
|
|
102
|
+
${t}</tr>
|
|
103
|
+
`}tablecell(t){let n=this.parser.parseInline(t.tokens),s=t.header?"th":"td";return(t.align?`<${s} align="${t.align}">`:`<${s}>`)+n+`</${s}>
|
|
104
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${$e(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:n,text:s,tokens:a,autolink:r}){let o=r?$e(s,!0):this.parser.parseInline(a),l=Zo(t);if(l===null)return o;t=$e(l,r);let i='<a href="'+t+'"';return n&&(i+=' title="'+$e(n)+'"'),i+=">"+o+"</a>",i}image({href:t,title:n,text:s,tokens:a}){a&&(s=this.parser.parseInline(a,this.parser.textRenderer));let r=Zo(t);if(r===null)return $e(s);t=r;let o=`<img src="${$e(t)}" alt="${$e(s)}"`;return n&&(o+=` title="${$e(n)}"`),o+=">",o}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:$e(t.text)}},ya=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},Oe=class pa{options;renderer;textRenderer;constructor(n){this.options=n||Rt,this.options.renderer=this.options.renderer||new hs,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ya}static parse(n,s){return new pa(s).parse(n)}static parseInline(n,s){return new pa(s).parseInline(n)}parse(n){this.renderer.parser=this;let s="";for(let a=0;a<n.length;a++){let r=n[a];if(this.options.extensions?.renderers?.[r.type]){let l=r,i=this.options.extensions.renderers[l.type].call({parser:this},l);if(i!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(l.type)){s+=i||"";continue}}let o=r;switch(o.type){case"space":{s+=this.renderer.space(o);break}case"hr":{s+=this.renderer.hr(o);break}case"heading":{s+=this.renderer.heading(o);break}case"code":{s+=this.renderer.code(o);break}case"table":{s+=this.renderer.table(o);break}case"blockquote":{s+=this.renderer.blockquote(o);break}case"list":{s+=this.renderer.list(o);break}case"checkbox":{s+=this.renderer.checkbox(o);break}case"html":{s+=this.renderer.html(o);break}case"def":{s+=this.renderer.def(o);break}case"paragraph":{s+=this.renderer.paragraph(o);break}case"text":{s+=this.renderer.text(o);break}default:{let l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}parseInline(n,s=this.renderer){this.renderer.parser=this;let a="";for(let r=0;r<n.length;r++){let o=n[r];if(this.options.extensions?.renderers?.[o.type]){let i=this.options.extensions.renderers[o.type].call({parser:this},o);if(i!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(o.type)){a+=i||"";continue}}let l=o;switch(l.type){case"escape":{a+=s.text(l);break}case"html":{a+=s.html(l);break}case"link":{a+=s.link(l);break}case"image":{a+=s.image(l);break}case"checkbox":{a+=s.checkbox(l);break}case"strong":{a+=s.strong(l);break}case"em":{a+=s.em(l);break}case"codespan":{a+=s.codespan(l);break}case"br":{a+=s.br(l);break}case"del":{a+=s.del(l);break}case"text":{a+=s.text(l);break}default:{let i='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return a}},yn=class{options;block;constructor(t){this.options=t||Rt}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?Me.lex:Me.lexInline}provideParser(t=this.block){return t?Oe.parse:Oe.parseInline}},Yc=class{defaults=fa();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Oe;Renderer=hs;TextRenderer=ya;Lexer=Me;Tokenizer=fs;Hooks=yn;constructor(...t){this.use(...t)}walkTokens(t,n){let s=[];for(let a of t)switch(s=s.concat(n.call(this,a)),a.type){case"table":{let r=a;for(let o of r.header)s=s.concat(this.walkTokens(o.tokens,n));for(let o of r.rows)for(let l of o)s=s.concat(this.walkTokens(l.tokens,n));break}case"list":{let r=a;s=s.concat(this.walkTokens(r.items,n));break}default:{let r=a;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(o=>{let l=r[o].flat(1/0);s=s.concat(this.walkTokens(l,n))}):r.tokens&&(s=s.concat(this.walkTokens(r.tokens,n)))}}return s}use(...t){let n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(s=>{let a={...s};if(a.async=this.defaults.async||a.async||!1,s.extensions&&(s.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let o=n.renderers[r.name];o?n.renderers[r.name]=function(...l){let i=r.renderer.apply(this,l);return i===!1&&(i=o.apply(this,l)),i}:n.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=n[r.level];o?o.unshift(r.tokenizer):n[r.level]=[r.tokenizer],r.start&&(r.level==="block"?n.startBlock?n.startBlock.push(r.start):n.startBlock=[r.start]:r.level==="inline"&&(n.startInline?n.startInline.push(r.start):n.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(n.childTokens[r.name]=r.childTokens)}),a.extensions=n),s.renderer){let r=this.defaults.renderer||new hs(this.defaults);for(let o in s.renderer){if(!(o in r))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let l=o,i=s.renderer[l],c=r[l];r[l]=(...u)=>{let p=i.apply(r,u);return p===!1&&(p=c.apply(r,u)),p||""}}a.renderer=r}if(s.tokenizer){let r=this.defaults.tokenizer||new fs(this.defaults);for(let o in s.tokenizer){if(!(o in r))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let l=o,i=s.tokenizer[l],c=r[l];r[l]=(...u)=>{let p=i.apply(r,u);return p===!1&&(p=c.apply(r,u)),p}}a.tokenizer=r}if(s.hooks){let r=this.defaults.hooks||new yn;for(let o in s.hooks){if(!(o in r))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let l=o,i=s.hooks[l],c=r[l];yn.passThroughHooks.has(o)?r[l]=u=>{if(this.defaults.async&&yn.passThroughHooksRespectAsync.has(o))return(async()=>{let f=await i.call(r,u);return c.call(r,f)})();let p=i.call(r,u);return c.call(r,p)}:r[l]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await i.apply(r,u);return f===!1&&(f=await c.apply(r,u)),f})();let p=i.apply(r,u);return p===!1&&(p=c.apply(r,u)),p}}a.hooks=r}if(s.walkTokens){let r=this.defaults.walkTokens,o=s.walkTokens;a.walkTokens=function(l){let i=[];return i.push(o.call(this,l)),r&&(i=i.concat(r.call(this,l))),i}}this.defaults={...this.defaults,...a}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return Me.lex(t,n??this.defaults)}parser(t,n){return Oe.parse(t,n??this.defaults)}parseMarkdown(t){return(n,s)=>{let a={...s},r={...this.defaults,...a},o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&a.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=t),r.async)return(async()=>{let l=r.hooks?await r.hooks.preprocess(n):n,i=await(r.hooks?await r.hooks.provideLexer(t):t?Me.lex:Me.lexInline)(l,r),c=r.hooks?await r.hooks.processAllTokens(i):i;r.walkTokens&&await Promise.all(this.walkTokens(c,r.walkTokens));let u=await(r.hooks?await r.hooks.provideParser(t):t?Oe.parse:Oe.parseInline)(c,r);return r.hooks?await r.hooks.postprocess(u):u})().catch(o);try{r.hooks&&(n=r.hooks.preprocess(n));let l=(r.hooks?r.hooks.provideLexer(t):t?Me.lex:Me.lexInline)(n,r);r.hooks&&(l=r.hooks.processAllTokens(l)),r.walkTokens&&this.walkTokens(l,r.walkTokens);let i=(r.hooks?r.hooks.provideParser(t):t?Oe.parse:Oe.parseInline)(l,r);return r.hooks&&(i=r.hooks.postprocess(i)),i}catch(l){return o(l)}}}onError(t,n){return s=>{if(s.message+=`
|
|
105
|
+
Please report this to https://github.com/markedjs/marked.`,t){let a="<p>An error occurred:</p><pre>"+$e(s.message+"",!0)+"</pre>";return n?Promise.resolve(a):a}if(n)return Promise.reject(s);throw s}}},Et=new Yc;function X(t,n){return Et.parse(t,n)}X.options=X.setOptions=function(t){return Et.setOptions(t),X.defaults=Et.defaults,ni(X.defaults),X};X.getDefaults=fa;X.defaults=Rt;function eu(...t){return Et.use(...t),X.defaults=Et.defaults,ni(X.defaults),X}X.use=eu;X.walkTokens=function(t,n){return Et.walkTokens(t,n)};X.parseInline=Et.parseInline;X.Parser=Oe;X.parser=Oe.parse;X.Renderer=hs;X.TextRenderer=ya;X.Lexer=Me;X.lexer=Me.lex;X.Tokenizer=fs;X.Hooks=yn;X.parse=X;var Qf=X.options,Yf=X.setOptions,eh=X.walkTokens,th=X.parseInline;var nh=Oe.parse,sh=Me.lex;var tu=t=>/^(fw|flow-weaver)\b/.test(t.trim());function nu({token:t}){let n=(t.lang??"").split(/\s+/)[0],s=t.text.replace(/\n$/,""),a=/^(bash|sh|shell|zsh|console)$/.test(n),r=()=>navigator.clipboard.writeText(s).then(()=>O("copied"));if(a){let o=s.split(`
|
|
106
|
+
`);return e("div",{class:"block cmd",children:[e("button",{class:"blockbtn copy",onClick:r,title:"Copy",children:"copy"}),e("pre",{children:o.map((l,i)=>{let c=tu(l);return e("div",{class:`l ${c?"run":""} ${l.trim().startsWith("#")?"c-c":""}`,children:[c&&e("button",{class:"play",title:"Put on the command line",onClick:()=>ce(l.trim()),children:"\u25B6"}),e("span",{children:l||" "})]},i)})})]})}return e("div",{class:"block",children:[e("button",{class:"blockbtn copy",onClick:r,title:"Copy",children:"copy"}),/^(ts|typescript|js|javascript|tsx|jsx)$/.test(n)||n===""?e(ut,{source:s}):e("pre",{children:e("code",{children:s})})]})}function su({token:t}){let n=t.href,s=e(je,{tokens:t.tokens}),a=n.match(/^([a-z0-9-]+)(?:\.md)?(?:#(.+))?$/i);return a&&!/^https?:/.test(n)?e("a",{href:`#doc/${a[1]}${a[2]?`/${a[2]}`:""}`,onClick:r=>{r.preventDefault(),J(a[1],a[2])},children:s}):n.startsWith("#")?e("a",{href:n,onClick:r=>{r.preventDefault(),document.getElementById(n.slice(1))?.scrollIntoView({block:"start",behavior:"smooth"})},children:s}):e("a",{href:n,target:"_blank",rel:"noreferrer",children:s})}function je({tokens:t}){return t?e(x,{children:t.map((n,s)=>{switch(n.type){case"text":return"tokens"in n&&n.tokens?e(je,{tokens:n.tokens},s):e("span",{children:n.text.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")},s);case"escape":return e("span",{children:n.text},s);case"strong":return e("strong",{children:e(je,{tokens:n.tokens})},s);case"em":return e("em",{children:e(je,{tokens:n.tokens})},s);case"del":return e("del",{children:e(je,{tokens:n.tokens})},s);case"codespan":return e("code",{children:n.text.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')},s);case"br":return e("br",{},s);case"link":return e(su,{token:n},s);case"image":return e("span",{class:"hint",children:["[",n.text,"]"]},s);case"html":return e("span",{children:n.text.startsWith("<!--")?"":n.text},s);default:return e("span",{children:n.raw},s)}})}):e(x,{})}function au({item:t}){return e("li",{children:[t.task&&e("input",{type:"checkbox",checked:t.checked,disabled:!0}),e(wa,{tokens:t.tokens,tight:!0})]})}function wa({tokens:t,tight:n=!1}){return e(x,{children:t.map((s,a)=>{switch(s.type){case"heading":{let r=s,o=De(r.text),l=`h${Math.min(6,r.depth)}`;return e(l,{id:o,children:[e("a",{class:"anchor",href:`#${o}`,onClick:i=>{i.preventDefault(),document.getElementById(o)?.scrollIntoView({block:"start",behavior:"smooth"})},children:"#"}),e(je,{tokens:r.tokens})]},a)}case"paragraph":return n?e("span",{class:"tight",children:e(je,{tokens:s.tokens})},a):e("p",{children:e(je,{tokens:s.tokens})},a);case"text":return e("span",{children:e(je,{tokens:s.tokens??[{type:"text",raw:s.text,text:s.text}]})},a);case"code":return e(nu,{token:s},a);case"blockquote":return e("blockquote",{children:e(wa,{tokens:s.tokens})},a);case"list":{let r=s,o=r.items.map((l,i)=>e(au,{item:l},i));return r.ordered?e("ol",{start:Number(r.start)||1,children:o},a):e("ul",{children:o},a)}case"table":{let r=s;return e("div",{class:"tablewrap",children:e("table",{children:[e("thead",{children:e("tr",{children:r.header.map((o,l)=>e("th",{style:o.align?`text-align:${o.align}`:"",children:e(je,{tokens:o.tokens})},l))})}),e("tbody",{children:r.rows.map((o,l)=>e("tr",{children:o.map((i,c)=>e("td",{style:i.align?`text-align:${i.align}`:"",children:e(je,{tokens:i.tokens})},c))},l))})]})},a)}case"hr":return e("hr",{},a);case"html":return s.text.trim().startsWith("<!--")?null:e("pre",{class:"rawhtml",children:s.text},a);case"space":return null;default:return e("p",{children:s.raw},a)}})})}function di({text:t,title:n}){let s=ne(()=>{let a=X.lexer(t,{gfm:!0}),r=a[0];return n&&r?.type==="heading"&&r.depth===1&&De(r.text)===De(n)?a.slice(1):a},[t,n]);return e("div",{class:"article",children:e(wa,{tokens:s})})}function pi(){let t=ye.value,n=Y(null),s=T.value;if(P(()=>{if(!t)return;let r=n.current?.closest(".col"),o=Nt.value;if(o){let l=[...n.current?.querySelectorAll("h1[id], h2[id], h3[id], h4[id]")??[]],i=document.getElementById(De(o))??document.getElementById(o)??l.find(c=>(c.textContent??"").toLowerCase().includes(o.toLowerCase()));if(i){i.scrollIntoView({block:"start"});return}}r?.scrollTo({top:0})},[t?.slug,Nt.value]),P(()=>{let r=n.current?.closest(".col");if(!r||!t)return;let o=()=>{let l=n.current?.querySelectorAll("h1[id], h2[id], h3[id], h4[id]")??[],i=r.getBoundingClientRect().top+12,c="";for(let u of l)if(u.getBoundingClientRect().top-i<=0)c=u.id;else break;c!==rn.value&&(rn.value=c)};return o(),r.addEventListener("scroll",o,{passive:!0}),()=>r.removeEventListener("scroll",o)},[t?.slug]),s.kind!=="doc")return null;if(!t)return e("div",{class:"hint",style:"padding:40px 0",children:"Loading\u2026"});let a=()=>navigator.clipboard.writeText(t.compact).then(()=>O("copied compact topic"));return e("div",{class:"docview",ref:n,children:[e("div",{class:"dochead",children:[e("h1",{children:t.name}),t.description&&e("p",{class:"lede",children:t.description}),e("div",{class:"docactions",children:e("button",{class:"btn sm",onClick:a,title:"The compact form of this topic, as fw_docs gives it to an assistant",children:"Copy for your assistant"})})]}),e(di,{text:t.markdown,title:t.name})]})}function ru(){let t=ye.value;if(!t)return null;let n=t.sections.filter(s=>s.heading&&s.level<=3&&!(s.level===1&&De(s.heading)===De(t.name)));return n.length?e("div",{class:"card",children:[e("h3",{children:"Contents"}),e("div",{class:"in toc",children:n.map(s=>{let a=De(s.heading);return e("button",{class:`tocrow l${s.level} ${rn.value===a?"on":""}`,onClick:()=>document.getElementById(a)?.scrollIntoView({block:"start",behavior:"smooth"}),children:s.heading},a)})})]}):e("div",{class:"hint",style:"padding:12px",children:"No sections."})}var ou=(t,n)=>t.uses.filter(s=>n.some(a=>a.endsWith(":")?s.startsWith(a):s===a));function xa({w:t,note:n,onOpen:s}){return e("button",{class:"projrow",onClick:()=>{lt(),s?s():ke(t.file,t.name)},children:[e("span",{class:"t",children:[e("b",{children:t.name}),e("small",{children:t.rel})]}),n&&e("span",{class:"note",children:n})]})}var fi=xa;function iu(){let t=ye.value,s=Xe.value.flatMap(o=>o.topics).find(o=>o.slug===t?.slug)?.related;if(!t||!s)return e("div",{class:"hint",style:"padding:12px",children:"This topic is not about anything in particular in the project."});let a=V.value.filter(o=>o.checked),r=[];if(s.uses){let o=a.map(l=>({w:l,on:ou(l,s.uses)})).filter(l=>l.on.length);r.push(e("div",{class:"card",children:[e("h3",{children:["In this project",e("span",{class:"sp"}),e("span",{class:"hint",children:o.length})]}),e("div",{class:"in",children:o.length?o.map(({w:l,on:i})=>e(fi,{w:l,note:i.map(c=>c.replace(/^(gate|builtin):/,"")).join(", ")},`${l.file}|${l.name}`)):e("div",{class:"hint",children:"Nothing here uses this yet."})})]},"uses"))}if(s.codes){let o=new Map;for(let i of a)for(let c of i.codes)o.set(c,[...o.get(c)??[],i]);let l=[...o].sort((i,c)=>c[1].length-i[1].length);r.push(e("div",{class:"card",children:[e("h3",{children:["Raised in this project",e("span",{class:"sp"}),e("span",{class:"hint",children:l.length})]}),e("div",{class:"in",children:l.length?l.map(([i,c])=>e("div",{class:"codegroup",children:[e("button",{class:"linkish mono",onClick:()=>document.getElementById(De(i))?.scrollIntoView({block:"start",behavior:"smooth"}),children:i}),e("span",{class:"hint",children:[" (",c.length,")"]}),e("div",{children:c.map(u=>e(fi,{w:u},`${u.file}|${u.name}`))})]},i)):e("div",{class:"hint",children:"Every workflow is clean."})})]},"codes"))}return e(x,{children:r})}function hi(){let t=S.docSide.value;return e(x,{children:[e("div",{class:"panes",children:[e(re,{icon:"toc",label:"Contents",on:t==="contents",onClick:()=>{S.docSide.value="contents"}}),e(re,{icon:"account_tree",label:"In this project",on:t==="project",onClick:()=>{S.docSide.value="project"}})]}),e("div",{class:"panebody",children:[t==="contents"&&e(ru,{}),t==="project"&&e(iu,{})]})]})}function gs(t){let n=[];for(let s of t.matchAll(/<([^>]+)>|\[([^\]]+)\]/g)){let a=s[1]??s[2],r=s[1]!==void 0;if(!r&&/^options$/i.test(a))continue;let o=a.endsWith("...");n.push({name:o?a.slice(0,-3):a,required:r,variadic:o})}return n}function ms(t){let n=t.flag.split(",").map(o=>o.trim()),s=null,a=null,r=null;for(let o of n){let l=o.match(/^(--?[\w-]+)(?:\s+(<[^>]+>|\[[^\]]+\]))?$/);l&&(l[1].startsWith("--")?s=l[1]:a=l[1],l[2]&&(r=l[2]))}return!s&&!a?null:{long:s??a,short:s?a:null,value:r,variadic:!!r&&r.includes("..."),negation:!!s?.startsWith("--no-"),description:t.description,default:t.default}}function lu(t,n){let s=t[0]==="fw"||t[0]==="flow-weaver"?t.slice(1):t,a;for(let r of n)r.words.length&&r.words.every((o,l)=>s[l]===o)&&(!a||r.words.length>a.words.length)&&(a=r);return a}function Sn(t,n){let s=an(t),a=lu(s,n);if(!a)return null;let r=(s[0]==="fw"||s[0]==="flow-weaver"?1:0)+a.words.length,o=a.flags.map(ms).filter(p=>!!p),l=new Map;for(let p of o)l.set(p.long,p),p.short&&l.set(p.short,p);let i=[],c={},u=[];for(let p=r;p<s.length;p++){let f=s[p],d=f.startsWith("--")?f.indexOf("="):-1,h=d>0?f.slice(0,d):f,v=l.get(h);v?v.value?d>0?c[v.long]=f.slice(d+1):p+1<s.length?c[v.long]=s[++p]:c[v.long]="":c[v.long]=!0:f.startsWith("-")&&f!=="-"?u.push(f):i.push(f)}return{command:a,args:i,flags:c,rest:u}}function gi(t){let n=[...t.command.words],s=gs(t.command.usage);t.args.forEach((a,r)=>{let o=s[Math.min(r,s.length-1)];a===""&&o&&!o.required||n.push(a===""?o?`<${o.name}>`:"":/^<[^>]+>$/.test(a)?a:Ne(a))});for(let[a,r]of Object.entries(t.flags))r===!0?n.push(a):r!==""&&n.push(a,/^<[^>]+>$/.test(r)?r:Ne(r));return n.push(...t.rest),n.filter(Boolean).join(" ")}var $n=t=>/<[^>]+>/.test(t);function cu(t,n){let s=an(t),a=/\s$/.test(t)||!t,r=a?"":s[s.length-1]??"",o=(a?s:s.slice(0,-1)).filter((c,u)=>!(u===0&&(c==="fw"||c==="flow-weaver")));if(!o.length){let c=new Map;for(let u of n)c.has(u.words[0])||c.set(u.words[0],u);return[...c.values()].filter(u=>u.words[0].startsWith(r)).map(u=>({text:u.words[0],hint:u.words.length>1?`${u.words.slice(1).join(" ")} \u2026`:u.description}))}let l=n.filter(c=>c.words[0]===o[0]&&c.words.length>1&&o.length===1);if(l.length&&!r.startsWith("-"))return l.filter(c=>c.words[1].startsWith(r)).map(c=>({text:c.words[1],hint:c.description}));let i=n.find(c=>c.words.every((u,p)=>o[p]===u)&&c.words.length<=o.length)??n.find(c=>c.words[0]===o[0]);return i?r.startsWith("-")||a?i.flags.map(ms).filter(c=>!!c).filter(c=>c.long.startsWith(r)&&!o.includes(c.long)).map(c=>({text:c.long,hint:`${c.description}${c.value?` ${c.value}`:""}`})):[]:[]}function uu({run:t,open:n,onToggle:s,onRerun:a,onRemove:r}){let o=Y(null),[l,i]=w(!1);P(()=>{n&&t.running&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},[t.out,t.err,n]),P(()=>{if(!l)return;let d=h=>{h.key==="Escape"&&i(!1)};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[l]);let c=t.out+(t.err?t.err:""),u=()=>navigator.clipboard.writeText(c).then(()=>O("output copied")),p=t.running?"running":t.code===0?ee(t.ms):t.code===null?t.error==="stopped"?"stopped":"refused":`exit ${t.code}`,f=e(x,{children:[t.out,t.err&&e("span",{class:"c-err",children:t.err}),t.error&&t.error!=="stopped"&&e("span",{class:"c-err",children:t.error}),!t.out&&!t.err&&!t.error&&!t.running&&e("span",{class:"hint",children:"(no output)"})]});return l?e("div",{class:"codefull",children:[e("div",{class:"fullhead",children:[e("b",{class:"mono",children:["fw ",t.args.join(" ")]}),e("span",{class:"hint",children:p}),e("span",{class:"sp"}),e("button",{class:"code-toggle",onClick:u,children:"copy"}),e("button",{class:"btn sm",onClick:()=>i(!1),children:["Close",e(ge,{combo:"esc"})]})]}),e("pre",{class:"cliout full",children:f})]}):e("div",{class:`clirun ${t.running?"running":t.code===0?"ok":"bad"}`,children:[e("div",{class:"clihead",children:[e("button",{class:"clitoggle",onClick:s,title:n?"Collapse":"Expand",children:[e("span",{class:"dot"}),e("span",{class:"mono cmdline",children:["fw ",t.args.join(" ")]})]}),e("span",{class:"sp"}),e("span",{class:"hint",children:p}),e("span",{class:"cliops",children:[t.running?e(xe,{label:"Stop",side:"top",children:e("button",{onClick:()=>qs(t.id),children:e("span",{class:"ms",children:"stop"})})}):e(xe,{label:"Run again",side:"top",children:e("button",{onClick:a,children:e("span",{class:"ms",children:"replay"})})}),e(xe,{label:"Copy output",side:"top",children:e("button",{onClick:u,children:e("span",{class:"ms",children:"content_copy"})})}),e(xe,{label:"Full screen",side:"top",children:e("button",{onClick:()=>i(!0),children:e("span",{class:"ms",children:"open_in_full"})})}),!t.running&&e(xe,{label:"Remove",side:"top",children:e("button",{onClick:r,children:e("span",{class:"ms",children:"close"})})})]})]}),n&&e("pre",{ref:o,class:"cliout",children:f})]})}function du({commands:t,initial:n,onLine:s,onRun:a,onClose:r}){let[o,l]=w(""),[i,c]=w(n);P(()=>{n&&c(n)},[n?.command.name]);let u=ne(()=>{let k=o.trim().toLowerCase(),y=new Map;for(let _ of t)k&&!_.name.includes(k)&&!_.description.toLowerCase().includes(k)||y.set(_.group,[...y.get(_.group)??[],_]);return[...y]},[t,o]),p=k=>{let y=gs(k.usage),_=W.value;c({command:k,args:y.map(b=>_&&/^(input|file|workflow-file|path)$/.test(b.name)?_.rel:""),flags:{},rest:[]})},f=i?gi(i):"";if(P(()=>{i&&s(f)},[f]),!i)return e("div",{class:"in builder",children:[e("div",{class:"builderhead",children:[e("input",{type:"text",class:"filter",placeholder:"find a command",value:o,onInput:k=>l(k.target.value),autoFocus:!0}),e("button",{class:"btn ghost sm",onClick:r,children:["Close",e(ge,{combo:"esc"})]})]}),e("div",{class:"cmdlist",children:[u.map(([k,y])=>e("div",{children:[e("h6",{children:k}),y.map(_=>e("button",{class:"cmdrow",onClick:()=>p(_),children:[e("span",{class:"mono",children:_.name}),e("small",{children:_.description})]},_.name))]},k)),!u.length&&e("div",{class:"hint",children:['nothing matching "',o,'"']})]})]});let d=gs(i.command.usage),h=i.command.flags.map(ms).filter(k=>!!k),v=(k,y)=>c({...i,args:Object.assign([...i.args],{[k]:y})}),g=(k,y)=>{let _={...i.flags};y===null?delete _[k.long]:_[k.long]=y,c({...i,flags:_})},m=d.some((k,y)=>k.required&&!(i.args[y]??"").trim());return e("div",{class:"in builder",children:[e("div",{class:"builderhead",children:[e("button",{class:"linkish",onClick:()=>c(null),children:"\u2190 commands"}),e("b",{class:"mono",children:["fw ",i.command.name]}),e("span",{class:"sp"}),e("button",{class:"btn ghost sm",onClick:r,children:["Close",e(ge,{combo:"esc"})]})]}),e("div",{class:"hint",style:"margin:0 0 10px",children:i.command.description}),d.length>0&&e("div",{class:"fields",children:d.map((k,y)=>e("div",{class:"field",children:[e("label",{children:e("span",{children:[k.name,k.required&&e("i",{children:"*"}),k.variadic&&e("em",{children:" (several, space-separated)"})]})}),e("input",{type:"text",class:"mono",value:i.args[y]??"",placeholder:k.required?`<${k.name}>`:`[${k.name}]`,onInput:_=>v(y,_.target.value)})]},k.name))}),h.length>0&&e("div",{class:"flags",children:[e("h6",{children:"Options"}),h.map(k=>{let y=i.flags[k.long];return e("div",{class:"flag",children:k.value?e(x,{children:[e("label",{class:"flagname",title:k.description,children:[e("code",{children:k.long}),e("span",{class:"hint",children:k.value})]}),e("input",{type:"text",class:"mono",value:typeof y=="string"?y:"",placeholder:k.default&&k.default!=="\u2014"?`default ${k.default}`:"",onInput:_=>{let b=_.target.value;g(k,b===""?null:b)}}),e("span",{class:"flagdesc",children:k.description})]}):e("label",{class:"check flagcheck",children:[e("input",{type:"checkbox",checked:y===!0,onChange:_=>g(k,_.target.checked?!0:null)}),e("code",{children:k.long}),e("span",{class:"flagdesc",children:k.description})]})},k.long)})]}),i.command.examples.length>0&&e("div",{class:"examples",children:[e("h6",{children:"Examples"}),i.command.examples.map(k=>{let y=Sn(k,t);return e("button",{class:"example mono",title:"Use this",onClick:()=>{y&&c(y)},children:k},k)})]}),e("div",{class:"composed",children:[e("span",{class:"prompt mono",children:"fw"}),e("code",{children:f})]}),e("div",{class:"formfoot",children:[e("button",{class:"btn primary sm",disabled:m||$n(f),onClick:()=>a(f),children:"Run"}),e("button",{class:"btn sm",onClick:r,children:"Edit as text"}),m&&e("span",{class:"hint",children:"fill the required arguments"})]})]})}function pt(){let t=Y(null),[n,s]=w(0),[a,r]=w(null),[o,l]=w(-1),[i,c]=w(null);P(()=>{Zn()},[]);let u=xt.value,p=j.line.value,f=j.build.value;P(()=>{if(!j.focus.value)return;j.focus.value=!1;let y=t.current;if($n(p)&&u.length){let _=Sn(p,u);if(_){c(_),j.build.value=!0;return}}y&&(y.focus(),y.setSelectionRange(y.value.length,y.value.length))},[j.focus.value,u.length]),P(()=>{let y=j.runs.value[0];y&&r(y.id)},[j.runs.value.length]),P(()=>{if(!f)return;let y=_=>{_.key==="Escape"&&(j.build.value=!1)};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[f]);let d=f?[]:cu(p,u).slice(0,8),h=y=>{let _=/\s$/.test(p)||!p;j.line.value=`${_?p:p.replace(/\S+$/,"")}${y.text} `,s(0),t.current?.focus()},v=(y=p)=>{let _=an(y);if(_.length){if($n(y)){let b=Sn(y,u);b&&(c(b),j.build.value=!0);return}Ur(_),j.history.value=[y,...j.history.value.filter(b=>b!==y)].slice(0,50),j.line.value="",j.build.value=!1,s(0),l(-1)}},g=y=>{let _=j.history.value;if(y.key==="Enter")y.preventDefault(),d.length&&y.shiftKey?h(d[n]):v();else if(y.key==="Tab"&&d.length)y.preventDefault(),h(d[n]);else if(y.key==="ArrowDown"){if(y.preventDefault(),d.length)s((n+1)%d.length);else if(o>=0){let b=o-1;l(b),j.line.value=b<0?"":_[b]}}else if(y.key==="ArrowUp"){if(y.preventDefault(),d.length)s((n+d.length-1)%d.length);else if(_.length){let b=Math.min(o+1,_.length-1);l(b),j.line.value=_[b]}}else y.key==="Escape"&&(s(0),y.target.blur())},m=j.runs.value.find(y=>y.running),k=()=>{let y=p.trim()?Sn(p,u):null;c(y),j.build.value=!0};return e("div",{class:"clipane",children:[e("div",{class:"card",children:[e("h3",{children:["fw",e("span",{class:"mono",children:we.value.name}),e("span",{class:"sp"}),e("button",{class:`btn ghost sm ${f?"on":""}`,title:"Build a command from the catalogue",onClick:()=>f?j.build.value=!1:k(),children:[e("span",{class:"ms",style:"font-size:14px",children:"tune"})," Commands"]})]}),e("div",{class:"in cliinput",children:[e("span",{class:"prompt mono",children:"fw"}),e("input",{ref:t,type:"text",class:"mono",value:p,placeholder:"validate <input>",spellcheck:!1,onInput:y=>{j.line.value=y.target.value,s(0),l(-1)},onKeyDown:g}),m?e("button",{class:"btn danger sm",onClick:()=>qs(m.id),children:"Stop"}):e("button",{class:"btn primary sm",disabled:!p.trim(),onClick:()=>v(),children:$n(p)?"Fill in\u2026":"Run"})]}),d.length>0&&p&&!f&&e("div",{class:"in sugg",children:d.map((y,_)=>e("button",{class:_===n?"on":"",onMouseDown:b=>{b.preventDefault(),h(y)},children:[e("span",{class:"mono",children:y.text}),e("small",{children:y.hint})]},y.text))}),f&&e(du,{commands:u,initial:i,onLine:y=>{j.line.value=y},onRun:y=>v(y),onClose:()=>{j.build.value=!1,t.current?.focus()}})]}),j.runs.value.length>0&&e("div",{class:"clihist",children:[e("span",{class:"hint",children:[j.runs.value.length," run",j.runs.value.length===1?"":"s"," this session"]}),e("span",{class:"sp"}),e("button",{class:"linkish",onClick:()=>{j.runs.value=j.runs.value.filter(y=>y.running)},children:"clear"})]}),j.runs.value.map(y=>e(uu,{run:y,open:a===y.id,onToggle:()=>r(a===y.id?null:y.id),onRerun:()=>v(y.args.join(" ")),onRemove:()=>{j.runs.value=j.runs.value.filter(_=>_.id!==y.id)}},y.id)),!j.runs.value.length&&e("div",{class:"hint",style:"padding:4px 12px",children:"Nothing run yet. Type a command, or open Commands to build one. Any \u25B6 in the guide lands here."})]})}var vs=({list:t})=>e("span",{class:"from",children:t.length?t.map((n,s)=>e("span",{title:n.description,children:[s>0?", ":"",n.name,n.optional?"?":"",e("i",{children:[": ",n.type]})]},n.name)):"\u2014"});function mi(){let t=T.value;if(t.kind!=="pack")return null;let n=he.value.find(a=>a.name===t.name);if(!n)return e("div",{class:"hint",style:"padding:40px 0",children:he.value.length?`No pack ${t.name} is installed.`:"Loading\u2026"});let s=V.value.filter(a=>a.uses.includes(`pack:${n.name}`));return e("div",{class:"docview packview",children:[e("div",{class:"dochead",children:[e("h1",{children:n.namespace}),e("div",{class:"meta",children:[e("span",{class:"mono",children:[n.name,"@",n.version]}),n.engineVersion&&e("span",{class:`pill ${n.compatible===!1?"warn":n.compatible?"ok":""}`,title:n.compatible===!1?"This pack expects a newer Flow Weaver. It still loads, with a warning":"",children:["engine ",n.engineVersion,n.compatible===!1?" (newer than this one)":""]}),s.length>0&&e("span",{class:"pill",children:["used by ",s.length," workflow",s.length>1?"s":""]})]}),n.description&&e("p",{class:"lede",children:n.description})]}),e(_a,{p:n})]})}function _a({p:t}){return e("div",{class:"article",children:[e(ft,{title:"Node types",count:t.nodeTypes.length,what:"node types",empty:"This pack adds no node types.",children:[e("div",{class:"tablewrap",children:e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"Node type"}),e("th",{children:"Inputs"}),e("th",{children:"Outputs"}),e("th",{children:"About"})]})}),e("tbody",{children:t.nodeTypes.map(n=>e("tr",{children:[e("td",{children:e("span",{class:"packnode",style:`--tc:${Bt(n.color)??"var(--dim)"}`,children:[n.icon&&e(Kt,{name:n.icon}),e("code",{children:n.name})]})}),e("td",{children:e(vs,{list:n.inputs})}),e("td",{children:e(vs,{list:n.outputs})}),e("td",{children:n.description})]},n.name))})]})}),e("p",{class:"hint",children:["Use one with ",e("code",{children:"@fwImport"}),"; see ",e("a",{href:"#doc/advanced-annotations",onClick:n=>{n.preventDefault(),J("advanced-annotations","fwImport")},children:"Advanced Annotations"}),"."]})]}),e(ft,{title:"Workflows",count:t.workflows.length,what:"workflows",children:e("div",{class:"tablewrap",children:e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"Workflow"}),e("th",{children:"Parameters"}),e("th",{children:"Returns"}),e("th",{children:"Steps"})]})}),e("tbody",{children:t.workflows.map(n=>e("tr",{children:[e("td",{children:[e("code",{children:n.name}),e("div",{class:"hint",children:n.description})]}),e("td",{children:e(vs,{list:n.params})}),e("td",{children:e(vs,{list:n.returns})}),e("td",{children:n.nodes})]},n.name))})]})})}),e(ft,{title:"Export targets",count:t.exportTargets.length,what:"export targets",children:e("ul",{children:t.exportTargets.map(n=>e("li",{children:[e("code",{children:n.name}),n.description?`: ${n.description}`:""," ",e("button",{class:"linkish",onClick:()=>ce(`fw export <input> --target ${n.name}`),children:"\u25B6 export with it"})]},n.name))})}),e(ft,{title:"Annotations it understands",count:t.tagHandlers.length,what:"tag handlers",children:[e("div",{class:"tablewrap",children:e("table",{children:[e("thead",{children:e("tr",{children:[e("th",{children:"Tags"}),e("th",{children:"Namespace"}),e("th",{children:"Where"})]})}),e("tbody",{children:t.tagHandlers.map((n,s)=>e("tr",{children:[e("td",{children:n.tags.map(a=>e("code",{style:"margin-right:6px",children:["@",a]},a))}),e("td",{children:e("code",{children:n.namespace})}),e("td",{children:n.scope==="both"?"workflows and node types":n.scope==="workflow"?"workflows":"node types"})]},s))})]})}),e("p",{class:"hint",children:"Whatever these tags say lands under the namespace, and shows on the step or workflow as pack tags."})]}),e(ft,{title:"Validation rules",count:t.validationRuleSets.length,what:"rule sets",children:e("ul",{children:t.validationRuleSets.map(n=>e("li",{children:[n.name," ",e("span",{class:"hint",children:["applies to ",e("code",{children:n.namespace})]})]},n.name))})}),e(ft,{title:"Documentation",count:t.docs.length,what:"topics",children:e("ul",{children:t.docs.map(n=>e("li",{children:[e("a",{href:`#doc/${n.slug}`,onClick:s=>{s.preventDefault(),J(n.slug)},children:n.name}),n.description?`: ${n.description}`:""]},n.slug))})}),e(ft,{title:"CLI commands",count:t.cliCommands.length,what:"commands",children:e("div",{class:"block cmd",children:e("pre",{children:t.cliCommands.map(n=>e("div",{class:"l run",children:[e("button",{class:"play",title:"Put on the command line",onClick:()=>ce(n.usage),children:"\u25B6"}),e("span",{children:[n.usage,e("span",{class:"c-c",children:[" # ",n.description]})]})]},n.name))})})}),e(ft,{title:"MCP tools",count:t.mcpTools.length,what:"tools",children:e("ul",{children:t.mcpTools.map(n=>e("li",{children:[e("code",{children:n.name})," \u2014 ",n.description]},n.name))})})]})}function ft({title:t,count:n,what:s,empty:a,children:r}){return!n&&!a?null:e(x,{children:[e("h2",{children:[t,e("span",{class:"hint",style:"font-weight:400;margin-left:8px",children:[n," ",n===1?s.replace(/s$/,""):s]})]}),n?r:e("p",{class:"hint",children:a})]})}function vi(){let t=T.value,n=t.kind==="pack"?he.value.find(r=>r.name===t.name):void 0,s=S.packSide.value,a=n?V.value.filter(r=>r.uses.includes(`pack:${n.name}`)):[];return e(x,{children:[e("div",{class:"panes",children:[e(re,{icon:"account_tree",label:"In this project",on:s==="project",onClick:()=>{S.packSide.value="project"}}),e(re,{icon:"terminal",label:"CLI",on:s==="cli",onClick:()=>{S.packSide.value="cli"}})]}),e("div",{class:"panebody",children:[s==="project"&&e("div",{class:"card",children:[e("h3",{children:["Workflows using it",e("span",{class:"sp"}),e("span",{class:"hint",children:a.length})]}),e("div",{class:"in",children:a.length?a.map(r=>e(xa,{w:r,onOpen:()=>ke(r.file,r.name)},`${r.file}|${r.name}`)):e("div",{class:"hint",children:"No workflow in this project uses a node type from this pack yet."})})]}),s==="cli"&&e(pt,{})]})]})}function bi(){let[t,n]=w(""),[s,a]=w(null),[r,o]=w([]),[l,i]=w(""),[c,u]=w(!1);if(P(()=>{if(T.value.kind!=="market")return;u(!0),i("");let d=setTimeout(()=>{K(`/api/market/search?q=${encodeURIComponent(t.trim())}`).then(h=>{a(h.results),o(h.searched),u(!1)}).catch(h=>{i(h.message),a([]),u(!1)})},t?300:0);return()=>clearTimeout(d)},[t,T.value.kind]),T.value.kind!=="market")return null;let p=new Set(he.value.map(d=>d.name)),f=d=>d.replace(/^https?:\/\//,"").replace(/\/$/,"");return e("div",{class:"docview",children:[e("div",{class:"dochead",children:[e("h1",{children:"Find a pack"}),e("p",{class:"lede",children:["Packs add node types, export targets, annotations, rules, docs and commands to a project. A pack is an npm package with a ",e("code",{children:"flowweaver.manifest.json"}),", named ",e("code",{children:"flow-weaver-pack-*"})," by convention."]}),e("input",{type:"text",class:"marketsearch",placeholder:"search the marketplace: openai, slack\u2026",value:t,onInput:d=>n(d.target.value),autoFocus:!0}),r.length>0&&e("div",{class:"registries",children:r.map(d=>e("span",{class:`pill ${d.ok?"":"err"}`,title:d.error??(d.scopes.length?`for ${d.scopes.join(", ")}`:"the default registry"),children:[d.authenticated&&e("span",{class:"ms",style:"font-size:12px",children:"lock"}),f(d.url),d.scopes.length?` for ${d.scopes.join(" ")}`:"",d.ok?`, ${d.count} pack${d.count===1?"":"s"}`:", not answering"]},d.url))})]}),l&&e("div",{class:"card",children:[e("div",{class:"in",style:"color:var(--err)",children:l}),e("div",{class:"in hint",children:["The search goes to the npm registry; ",e("button",{class:"linkish",onClick:()=>ce("fw market search --registry <url>"),children:"a private registry"})," can be given to ",e("code",{children:"fw market search"}),"."]})]}),c&&!s&&e("div",{class:"hint",children:"Searching\u2026"}),s&&e("div",{class:"market",children:[s.map(d=>{let h=p.has(d.name);return e("div",{class:"marketrow",children:[e("div",{class:"t",children:[e("b",{children:Be(d.name)}),e("span",{class:"mono",children:[d.name,"@",d.version]}),e("span",{class:"hint",children:d.registry}),d.official&&e("span",{class:"pill ok",children:"official"}),h&&e("span",{class:"pill",children:"installed"})]}),d.description&&e("div",{class:"hint",children:d.description}),e("div",{class:"ops",children:h?e("button",{class:"btn sm",onClick:()=>Re(d.name),children:"Open"}):e("button",{class:"btn primary sm",onClick:()=>ce(`fw market install ${d.name}`),children:"Install\u2026"})})]},d.name)}),!s.length&&!l&&e("div",{class:"hint",children:[t?`Nothing matching "${t}" on the registries above.`:"Nothing on the registries above yet."," ","A registry not in ",e("code",{children:".npmrc"})," can be searched with ",e("button",{class:"linkish",onClick:()=>ce(`fw market search ${t.trim()} --registry <url>`.replace(/\s+/g," ")),children:"\u25B6 fw market search --registry"}),"."]})]})]})}function ki(){return e(x,{children:[e("div",{class:"panes",children:e(re,{icon:"terminal",label:"CLI",on:!0,onClick:()=>{}})}),e("div",{class:"panebody",children:e(pt,{})})]})}function yi(){let[t,n]=w(null),[s,a]=w(""),[r,o]=w(!1),l=()=>{o(!0),a(""),K("/api/pack-project/check").then(n).catch(p=>a(p.message)).finally(()=>o(!1))};if(P(()=>{T.value.kind==="author"&&l()},[T.value.kind,Ft.value.name]),T.value.kind!=="author")return null;let i=Ft.value,c=t?.issues.filter(p=>p.severity==="error")??[],u=t?.issues.filter(p=>p.severity==="warning")??[];return e("div",{class:"docview packview",children:[e("div",{class:"dochead",children:[e("h1",{children:t?.manifest.namespace??i.name}),e("div",{class:"meta",children:[e("span",{class:"mono",children:[i.name,"@",t?.version??i.version]}),t&&(t.valid?e("span",{class:"pill ok",children:["passes the marketplace rules",u.length?`, ${u.length} warning${u.length>1?"s":""}`:""]}):e("span",{class:"pill err",children:[c.length," error",c.length>1?"s":""]})),t&&e("span",{class:"hint",children:[t.parsedFiles," file",t.parsedFiles===1?"":"s"," parsed"]})]}),e("p",{class:"lede",children:["This project is a pack. What is below is the manifest as ",e("code",{children:"fw market pack"})," would write it from the sources, checked against the marketplace rules. Nothing has been written."]}),e("div",{class:"docactions",children:[e("button",{class:"btn sm",disabled:r,onClick:l,children:r?"Checking\u2026":"Check again"}),e("button",{class:"btn sm",onClick:()=>ce("fw market pack"),title:"Write flowweaver.manifest.json",children:"\u25B6 fw market pack"}),e("button",{class:"btn sm",onClick:()=>ce("fw market publish --dry-run"),children:"\u25B6 fw market publish --dry-run"})]})]}),s&&e("div",{class:"card",children:e("div",{class:"in",style:"color:var(--err)",children:s})}),t&&e(x,{children:[(t.issues.length>0||t.parseErrors.length>0)&&e("div",{class:"card",children:[e("h3",{children:["Rules",e("span",{class:"sp"}),e("span",{class:"hint",children:[t.issues.length," finding",t.issues.length===1?"":"s"]})]}),e("div",{class:"in",children:[[...c,...u].map((p,f)=>e("div",{class:"issue",children:[e("span",{class:`mark ${p.severity==="warning"?"warn":""}`}),e("div",{children:[e("div",{children:p.message}),e("div",{class:"h",children:e("code",{children:p.code})})]})]},f)),t.parseErrors.map((p,f)=>e("div",{class:"issue",children:[e("span",{class:"mark"}),e("div",{children:[e("div",{children:p}),e("div",{class:"h",children:e("code",{children:"parse"})})]})]},`p${f}`))]})]}),e("div",{class:"card",children:[e("h3",{children:t.hasManifest?"Since flowweaver.manifest.json":"Manifest"}),e("div",{class:"in",children:t.changes.length?e("ul",{class:"changes",children:t.changes.map((p,f)=>e("li",{children:p},f))}):e("div",{class:"hint",children:"flowweaver.manifest.json is up to date with the sources."})})]}),e(_a,{p:t.manifest})]}),!t&&!s&&e("div",{class:"hint",children:"Generating the manifest\u2026"})]})}function wi(){return e(x,{children:[e("div",{class:"panes",children:e(re,{icon:"terminal",label:"CLI",on:!0,onClick:()=>{}})}),e("div",{class:"panebody",children:e(pt,{})})]})}var bs=t=>t.toLowerCase(),pu=t=>bs(t).split(/\s+/).filter(Boolean);function fu(t,n){let s=pu(t);if(!s.length)return 0;let a=bs(n.title),r=bs(n.detail??""),o=bs(t.trim()),l=0;for(let i of s){let c=a.includes(i),u=r.includes(i);if(!c&&!u)return 0;a===i?l+=100:a.startsWith(i)?l+=80:c&&new RegExp(`(^|[^a-z0-9])${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`).test(a)?l+=60:c?l+=40:l+=20}return s.length>1&&a===o?l+=40:s.length>1&&a.startsWith(o)&&(l+=20),l/s.length-Math.min(10,a.length/8)}function At(t,n,s=8){return n.map(a=>({...a,score:fu(t,a)})).filter(a=>a.score>0).sort((a,r)=>r.score-a.score||a.title.localeCompare(r.title)).slice(0,s)}var hu={doc:"Guide",workflow:"Workflows",step:"Steps",pack:"Packs",node:"Node types",command:"Commands"},gu={doc:"article",workflow:"conversion_path",step:"adjust",pack:"inventory_2",node:"extension",command:"terminal"},xi=t=>t.flatMap(n=>[n,...xi(n.children)]);function _i(){let t=S.search.value,n=Y(null),[s,a]=w(""),[r,o]=w([]),[l,i]=w(0);P(()=>{t&&(a(""),o([]),i(0),Zn(),setTimeout(()=>n.current?.focus(),0))},[t]),P(()=>{if(!t||s.trim().length<2){o([]);return}let d=setTimeout(()=>K(`/api/docs/search?q=${encodeURIComponent(s.trim())}&limit=40`).then(o).catch(()=>o([])),200);return()=>clearTimeout(d)},[s,t]);let c=ne(()=>{let d=s.trim();if(!d)return[];let h=[],v=()=>{S.search.value=!1};h.push(...At(d,V.value.map(m=>({title:m.name,detail:m.rel,w:m})),6).map(m=>({kind:"workflow",title:m.title,detail:m.detail,score:m.score+5,run:()=>{v(),ke(m.w.file,m.w.name)}})));let g=W.value;return Je(g)&&h.push(...At(d,xi(g.model.steps).map(m=>({title:m.label,detail:`${m.id} (${m.type})`,s:m})),6).map(m=>({kind:"step",title:m.title,detail:m.detail,score:m.score,run:()=>{v(),T.value.kind!=="workflow"&&(T.value={kind:"workflow"}),ae.value=m.s.id,S.side.value="step"}}))),h.push(...At(d,he.value.map(m=>({title:m.namespace,detail:m.name,p:m})),4).map(m=>({kind:"pack",title:m.title,detail:m.detail,score:m.score,run:()=>{v(),Re(m.p.name)}}))),h.push(...At(d,he.value.flatMap(m=>m.nodeTypes.map(k=>({title:k.name,detail:`${m.namespace}: ${k.description}`,p:m}))),6).map(m=>({kind:"node",title:m.title,detail:m.detail,score:m.score-5,run:()=>{v(),Re(m.p.name)}}))),h.push(...At(d,xt.value.map(m=>({title:`fw ${m.name}`,detail:m.description,c:m})),6).map(m=>({kind:"command",title:m.title,detail:m.detail,score:m.score-5,run:()=>{v(),ce(m.c.usage),j.build.value=!0}}))),h.push(...r.slice(0,10).map((m,k)=>{let y=m.heading||m.topic,_=At(d,[{title:y,detail:m.topic}],1)[0]?.score??0;return{kind:"doc",title:y,detail:m.heading?m.topic:m.excerpt.slice(0,80),score:Math.max(_,30)+Math.max(0,10-k),run:()=>{v(),J(m.slug,m.heading)}}})),h.sort((m,k)=>k.score-m.score)},[s,r,V.value,W.value,he.value,xt.value]),u=ne(()=>{let d=new Map;for(let h of c)d.set(h.kind,[...d.get(h.kind)??[],h]);return[...d.entries()]},[c]),p=u.flatMap(([,d])=>d);if(P(()=>{i(0)},[s,r.length]),P(()=>{if(!t)return;let d=h=>{h.key==="Escape"?(h.preventDefault(),S.search.value=!1):h.key==="ArrowDown"?(h.preventDefault(),i(v=>Math.min(v+1,p.length-1))):h.key==="ArrowUp"?(h.preventDefault(),i(v=>Math.max(v-1,0))):h.key==="Enter"&&(h.preventDefault(),p[l]?.run())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[t,p,l]),P(()=>{document.querySelector(".searchrow.on")?.scrollIntoView({block:"nearest"})},[l]),!t)return null;let f=-1;return e(x,{children:[e("div",{class:"scrim",onClick:()=>{S.search.value=!1}}),e("div",{class:"dialog search",role:"dialog","aria-label":"Search",children:[e("div",{class:"searchhead",children:[e("span",{class:"ms",children:"search"}),e("input",{ref:n,type:"text",value:s,placeholder:"Search the guide, workflows, steps, packs, commands\u2026",spellcheck:!1,onInput:d=>a(d.target.value)}),e(ge,{combo:"esc"})]}),e("div",{class:"dialogbody searchbody",children:[u.map(([d,h])=>e("div",{class:"searchgroup",children:[e("h6",{children:hu[d]}),h.map(v=>{f+=1;let g=f;return e("button",{class:`searchrow ${g===l?"on":""}`,onMouseEnter:()=>i(g),onClick:v.run,children:[e("span",{class:"ms",children:gu[d]}),e("span",{class:"t",children:[e("b",{children:v.title}),v.detail&&e("small",{children:v.detail})]})]},`${d}:${v.title}:${v.detail}`)})]},d)),s.trim()&&!p.length&&e("div",{class:"empty",children:['nothing matching "',s.trim(),'"']}),!s.trim()&&e("div",{class:"empty hint",children:["Type to search. ",e("span",{class:"kbd",children:"\u2191"}),e("span",{class:"kbd",children:"\u2193"})," to move, ",e(ge,{combo:"enter"})," to open."]})]})]})]})}function mu(t){let n=t.gate?.node??"a gate";if(!t.due)return`at ${n}`;let s=new Date(t.due.at),a=s.toDateString()===new Date().toDateString()?s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):s.toLocaleString([],{dateStyle:"medium",timeStyle:"short"});return t.due.action==="wake"?`sleeping at ${n} until ${a}`:`at ${n}, times out ${a}`}var vu=t=>t.replace(/^https?:\/\//,"").replace(/\/$/,""),ks=t=>Ae(Date.parse(t)),Si=async(t,n="copied")=>{try{await navigator.clipboard.writeText(t),O(n)}catch{O("could not copy")}};function Sa({ok:t,warn:n=!1}){return e("span",{class:`sdot ${t?n?"warn":"ok":"bad"}`})}var bu={stopped:"not running",starting:"starting\u2026",running:"up",exited:"stopped"};function ku({s:t,running:n,onDone:s}){let[a,r]=w({...t}),[o,l]=w(!1),[i,c]=w(""),u=d=>r(h=>({...h,...d})),p=async()=>{l(!0),c("");try{await zs("serve",a),O(n?"saved, restart to apply":"saved"),s()}catch(d){c(d.message)}finally{l(!1)}},f=(d,h,v)=>e("label",{class:"check",title:v,children:[e("input",{type:"checkbox",checked:a[d],onChange:g=>u({[d]:g.target.checked})}),h]});return e("div",{class:"svcsettings",children:[e("div",{class:"row3",children:[e("div",{class:"field",children:[e("label",{children:"port"}),e("input",{type:"number",min:0,max:65535,value:a.port,onInput:d=>u({port:Number(d.target.value)})})]}),e("div",{class:"field",children:[e("label",{children:["host ",e("i",{children:a.host==="127.0.0.1"||a.host==="localhost"?"this machine only":"reachable from elsewhere"})]}),e("input",{type:"text",class:"mono",value:a.host,onInput:d=>u({host:d.target.value.trim()})})]}),e("div",{class:"field",children:[e("label",{children:"auth"}),e(ue,{value:a.auth,options:[{value:"token",label:"bearer token, generated at start"},{value:"open",label:"open (loopback only)"}],onChange:d=>u({auth:d})})]})]}),e("div",{class:"opts",children:[f("agents","agent profiles answer agent gates","Off: agent gates wait for a person or an assistant"),f("trace","keep a step trace per run","What the run pages show step by step. Costs a debug build"),f("swagger","Swagger UI at /docs","The page and /openapi.json readable without the token"),f("dev","dev: stacks in errors, mocks accepted, callbacks to localhost","Never in production"),f("autoStart","start with the console","Bring the server up whenever the console opens this project")]}),e("div",{class:"formfoot",children:[e("button",{class:"btn primary sm",disabled:o,onClick:p,children:o?"Saving\u2026":"Save"}),e("button",{class:"btn ghost sm",onClick:s,children:"Cancel"}),i&&e("span",{class:"err",children:i})]})]})}function yu(){let t=We("serve"),n=Ye.value?.settings.serve,[s,a]=w(""),[r,o]=w(!1),l=async(u,p)=>{a(u);try{await p()}catch(f){O(f.message)}finally{a("")}},i=St.value?.workflows.reduce((u,p)=>u+p.routes.length,0);if(!t||!n)return e("div",{class:"card svc",children:[e("h3",{children:"Server"}),e("div",{class:"in hint",children:"Reading\u2026"})]});let c=t.state==="running";return e("div",{class:`card svc state-${t.state}`,children:[e("h3",{children:[e("span",{class:`sdot ${c?"ok":t.state==="starting"?"warn":t.error?"bad":""}`}),"Server",e("span",{class:"hint",children:[bu[t.state],c&&t.startedAt?`, since ${ks(t.startedAt)}`:"",c&&!t.owned?", started from a terminal":""]}),e("span",{class:"sp"}),t.state!=="running"&&t.state!=="starting"&&e("button",{class:"btn primary sm",disabled:!!s,onClick:()=>l("start",()=>et("serve")),children:s==="start"?"Starting\u2026":"Start"}),(c||t.state==="starting")&&e("button",{class:"btn sm",disabled:!!s,onClick:()=>l("stop",()=>ze("serve",t.owned?void 0:t.pid)),children:s==="stop"?"Stopping\u2026":"Stop"}),c&&t.owned&&e("button",{class:"btn ghost sm",disabled:!!s,onClick:()=>l("restart",()=>Ir("serve")),title:"Stop and start again, with the saved settings",children:"Restart"}),t.owned&&e("button",{class:"btn ghost sm",onClick:()=>Ee("serve"),title:"What the server prints",children:["Logs",t.lines?e("span",{class:"hint",children:[" ",t.lines]}):null]}),e("button",{class:`btn ghost sm ${r?"on":""}`,onClick:()=>o(!r),title:"Port, host, token, options",children:e("span",{class:"ms",style:"font-size:15px",children:"tune"})})]}),t.error&&t.state==="exited"&&e("div",{class:"in err",children:[t.error," ",e("button",{class:"linkish",onClick:()=>Ee("serve"),children:"logs"})]}),c&&e("div",{class:"in svcline",children:[e("a",{class:"mono",href:t.url,target:"_blank",rel:"noreferrer",children:t.url}),e("button",{class:"linkish",onClick:()=>Si(t.url??""),children:"copy"}),t.token&&e("span",{class:"hint",children:["token ",e("code",{title:t.token,children:[t.token.slice(0,6),"\u2026"]})," ",e("button",{class:"linkish",onClick:()=>Si(t.token,"token copied"),children:"copy"})]}),!t.token&&t.owned&&e("span",{class:"hint",children:"open, no token"}),t.activity&&e("span",{class:"hint",children:[t.activity.count," request",t.activity.count===1?"":"s",t.activity.last?`, last ${t.activity.last} ${ks(t.activity.at)}`:""]})]}),!c&&t.state!=="starting"&&e("div",{class:"in hint",children:["Serves this project's workflows over HTTP on ",e("code",{children:[n.host,":",n.port]}),n.auth==="token"?", guarded by a token generated at start":", open",".",i!==void 0?e(x,{children:[" ",i?e(x,{children:[i," declared route",i===1?"":"s"]}):"No route declared yet",", plus a run resource for every workflow. ",e("button",{class:"linkish",onClick:Ue,children:"Endpoints"}),"."]}):null," ","Or from a terminal: ",e("code",{children:"fw serve --trace"}),"."]}),t.others.length>0&&e("div",{class:"in",children:[e("h5",{children:"Also running for this project"}),t.others.map(u=>e("div",{class:"svcother",children:[e("span",{class:"mono",children:u.url??`pid ${u.pid}`}),e("span",{class:"hint",children:[" (pid ",u.pid,", v",u.version,", since ",ks(u.startedAt),")"]}),e("span",{class:"sp"}),e("button",{class:"btn ghost sm",onClick:()=>l(`stop-${u.pid}`,()=>ze("serve",u.pid)),children:"Stop"})]},u.pid))]}),r&&e("div",{class:"in",children:e(ku,{s:n,running:c&&t.owned,onDone:()=>o(!1)})})]})}function wu(){let t=We("watch"),n=Ye.value?.settings.watch.autoStart??!1,[s,a]=w(!1);if(!t)return null;let r=t.state==="running"||t.state==="starting",o=async()=>{a(!0);try{r?await ze("watch"):await et("watch")}catch(l){O(l.message)}finally{a(!1)}};return e("div",{class:"card svc small",children:[e("h3",{children:[e("span",{class:`sdot ${r?"ok":t.error?"bad":""}`}),"Recompile on save",e("span",{class:"hint",children:r?"watching":t.error?"stopped":"off"}),e("span",{class:"sp"}),e("button",{class:`btn sm ${r?"":"primary"}`,disabled:s,onClick:o,children:r?"Stop":"Start"}),t.owned&&e("button",{class:"btn ghost sm",onClick:()=>Ee("watch"),children:"Logs"})]}),e("div",{class:"in hint",children:[e("code",{children:"fw watch"})," recompiles a workflow file in place each time it is saved, so the compiled body never lags the annotations."," ",e("label",{class:"check inline",children:[e("input",{type:"checkbox",checked:n,onChange:l=>zs("watch",{autoStart:l.target.checked}).catch(i=>O(i.message))}),"start with the console"]})]}),t.error&&e("div",{class:"in err",children:t.error})]})}function $i(){let[t,n]=w(null),[s,a]=w(""),[r,o]=w(!1),[l,i]=w(null),c=()=>{o(!0),a(""),Promise.all([K("/api/status").then(n),K("/api/runs").then(b=>i(b.length)).catch(()=>i(null)),fn(),tt().catch(()=>{}),Ut().catch(()=>{})]).catch(b=>a(b.message)).finally(()=>o(!1))};if(P(()=>{T.value.kind==="project"&&c()},[T.value.kind]),T.value.kind!=="project")return null;let u=V.value.reduce((b,R)=>b+R.waiting,0),p=V.value.filter(b=>b.errors>0),f=p.length,d=pe.value,h=d?.agents.filter(b=>b.ready).length??0,v=St.value,g=v?.workflows.reduce((b,R)=>b+R.routes.length,0)??0;Le.value;let m=l===0&&V.value.length>0,k=V.value.find(b=>b.errors===0)??V.value[0],y=async()=>{await ke(k.file,k.name),S.side.value="run"},_=b=>b.slice(0,3).map(R=>R.name).join(", ")+(b.length>3?` and ${b.length-3} more`:"");return e("div",{class:"docview projectview",children:[e("div",{class:"dochead",children:[e("h1",{children:we.value.name||"Project"}),e("p",{class:"lede",children:[V.value.length," workflow",V.value.length===1?"":"s",f?e(x,{children:[", ",e("span",{class:"bad",children:[f," with errors"]})," (",_(p),")"]}):"",u?e(x,{children:[", ",e("b",{children:[u," waiting at a gate"]})]}):"",". ",m?"Nothing has run yet.":"Its server, endpoints, agents and environment, and the controls for them."]}),e("div",{class:"docactions",children:[e("button",{class:"btn sm",disabled:r,onClick:c,children:r?"Checking\u2026":"Check again"}),e("button",{class:"btn sm",onClick:()=>ce("fw doctor"),children:"\u25B6 fw doctor"}),e("button",{class:"btn sm",onClick:()=>J("console","the-project-page"),children:"About this page"}),t&&e("span",{class:"hint",children:["as of ",ks(t.at)]})]})]}),s&&e("div",{class:"card",children:e("div",{class:"in",style:"color:var(--err)",children:s})}),m&&k&&e("div",{class:"card starthere",children:[e("h3",{children:[e("span",{class:"ms",children:"play_arrow"}),"Start here"]}),e("div",{class:"in",children:[e("p",{children:"Every workflow on the left is a process you can run from this page: fill its parameters, watch each step, answer its gates. Try one now."}),e("div",{class:"formfoot",children:[e("button",{class:"btn primary",onClick:()=>{y()},children:["Run ",k.name]}),e("span",{class:"hint",children:[k.steps," step",k.steps===1?"":"s",k.gates?`, ${k.gates} gate${k.gates===1?"":"s"}`:"",". Or pick another in the list."]})]})]})]}),e(yu,{}),e("div",{class:"cards2",children:[e("button",{class:"card summary",onClick:Ue,children:[e("h3",{children:[e("span",{class:"ms",children:"api"}),"Endpoints",e("span",{class:"sp"}),e("span",{class:"ms go",children:"chevron_right"})]}),e("div",{class:"in",children:[e("div",{class:"big",children:v?g:"\u2026"}),e("div",{class:"hint",children:v?g?`declared route${g===1?"":"s"} across ${v.workflows.length} workflow${v.workflows.length===1?"":"s"}${v.problems.length?`, ${v.problems.length} not mounted`:""}`:`no route yet; ${v.candidates.length} workflow${v.candidates.length===1?"":"s"} to expose`:"reading"})]})]}),e("button",{class:"card summary",onClick:_e,children:[e("h3",{children:[e("span",{class:"ms",children:"smart_toy"}),"Agents",e("span",{class:"sp"}),e("span",{class:"ms go",children:"chevron_right"})]}),e("div",{class:"in",children:[e("div",{class:"big",children:d?`${h}/${d.agents.length}`:"\u2026"}),e("div",{class:"hint",children:d?d.agents.length?`profile${d.agents.length===1?"":"s"} ready${d.default?`, default ${d.default}`:", no default"}`:"no profile, agent gates wait for you or an assistant":"reading"})]})]}),e(wu,{}),e("div",{class:"card summary static",children:[e("h3",{children:[e("span",{class:"ms",children:"extension"}),"Editors",e("span",{class:"sp"}),e("button",{class:"linkish",onClick:()=>ce("fw mcp-setup"),children:"\u25B6 fw mcp-setup"})]}),e("div",{class:"in",children:[t?t.mcp.registrations.length?t.mcp.registrations.map(b=>e("div",{class:"regrow",children:[e(Sa,{ok:b.runs!=="other install",warn:b.runs!=="this install"}),e("b",{children:b.tool}),e("span",{class:"hint",children:b.runs==="npm latest"?"npm latest":b.runs})]},b.tool+b.file)):e("div",{class:"hint",children:"No editor has the MCP server registered for this project."}):e("div",{class:"hint",children:"reading"}),t&&t.mcp.running.length>0&&e("div",{class:"hint",style:"margin-top:6px",children:[t.mcp.running.length," MCP server",t.mcp.running.length===1?"":"s"," running now",t.mcp.running[0].client?` for ${t.mcp.running[0].client}`:"","."]})]})]})]}),t&&e(x,{children:[e("div",{class:"card",children:[e("h3",{children:["Environment",e("span",{class:"sp"}),e("span",{class:`pill ${t.doctor.summary.fail?"err":t.doctor.summary.warn?"warn":"ok"}`,children:t.doctor.summary.fail?`${t.doctor.summary.fail} failing`:t.doctor.summary.warn?`${t.doctor.summary.warn} warning${t.doctor.summary.warn>1?"s":""}`:"all checks pass"})]}),e("div",{class:"in",children:t.doctor.checks.map(b=>e("div",{class:"check-row",children:[e(Sa,{ok:b.status!=="fail",warn:b.status==="warn"}),e("div",{children:[e("b",{children:b.name}),e("div",{class:"hint",children:b.message}),b.fix&&e("div",{class:"fix",children:b.fix})]})]},b.name))})]}),e("div",{class:"card",children:[e("h3",{children:"This console"}),e("div",{class:"in",children:e("div",{class:"kv",children:[e("span",{class:"k",children:"version"}),e("span",{class:"val static",children:t.console.version}),e("span",{class:"k",children:"install"}),e("span",{class:"val static mono",children:t.console.install}),e("span",{class:"k",children:"project"}),e("span",{class:"val static mono",children:t.console.project}),e("span",{class:"k",children:"listening"}),e("span",{class:"val static mono",children:[t.console.url,t.console.watching?", watching files":", not watching"]}),e("span",{class:"k",children:"run store"}),e("span",{class:"val static mono",children:t.console.runsDir})]})})]}),e("div",{class:"card",children:[e("h3",{children:"Registries"}),e("div",{class:"in",children:t.registries.map(b=>e("div",{class:"check-row",children:[e(Sa,{ok:b.ok}),e("div",{children:[e("b",{children:vu(b.url)}),b.scopes.length?e("span",{class:"hint",children:[" for ",b.scopes.join(" ")]}):e("span",{class:"hint",children:" (default)"}),e("div",{class:"hint",children:[b.ok?b.user?`signed in as ${b.user}`:b.authenticated?"answers, token not accepted":"answers, no token":b.error??`status ${b.status}`,b.ms!=null?`, ${ee(b.ms)}`:""]})]})]},b.url))})]})]})]})}function Ci(){let[t,n]=w(null),s=()=>{K("/api/runs").then(n).catch(()=>n([]))};P(()=>{s()},[Le.value,V.value]);let a=(t??[]).filter(i=>i.status==="waiting"),r=(t??[]).filter(i=>i.status==="failed").slice(0,5),o=async i=>{await ke(i.file,i.name),S.side.value="run",cn(i.id)},l=({r:i,what:c})=>e("button",{class:"runrow",onClick:()=>o(i),children:[e("span",{class:`rdot ${i.status}`}),e("span",{class:"what",children:[i.name,": ",c,i.origin&&i.origin!=="console"&&e("small",{class:"origin",children:i.origin})]}),e("span",{class:"right",children:Ae(i.updatedAt)})]});return e(x,{children:[e("div",{class:"panes",children:e("span",{class:"panetitle",children:"Needs you"})}),e("div",{class:"panebody",children:[e("div",{class:"card",children:[e("h3",{children:["Waiting at a gate",e("span",{class:"hint",children:a.length})]}),e("div",{class:"in runlist",children:[t===null&&e("div",{class:"hint",style:"padding:4px 9px",children:"reading"}),a.map(i=>e(l,{r:i,what:mu(i)},i.id)),t&&!a.length&&e("div",{class:"hint",style:"padding:4px 9px",children:"nothing is waiting for a person"})]})]}),r.length>0&&e("div",{class:"card",children:[e("h3",{children:["Failed lately",e("span",{class:"hint",children:r.length})]}),e("div",{class:"in runlist",children:r.map(i=>e(l,{r:i,what:i.error?i.error.slice(0,60):"failed"},i.id))})]}),e("div",{class:"card",children:[e("h3",{children:"Where things live"}),e("div",{class:"in hint",children:["Runs made here, over the server and by an assistant are the same runs. A gate reached anywhere is answered here. ",e("button",{class:"linkish",onClick:()=>J("console"),children:"The console"}),", or ",e("button",{class:"linkish",onClick:()=>J("deployment","http-serve-mode"),children:"the server"})]})]})]})]})}var $a=[{id:"anthropic",title:"Anthropic API",blurb:"Claude, over the API.",needs:"ANTHROPIC_API_KEY in the environment",icon:"auto_awesome",keyEnv:"ANTHROPIC_API_KEY",model:"claude-sonnet-5"},{id:"openai",title:"OpenAI-compatible",blurb:"OpenAI, Groq, GitHub Models, or a local Ollama, vLLM, LM Studio.",needs:"a key variable, or just a base URL for a local server",icon:"hub",keyEnv:"OPENAI_API_KEY",model:"gpt-4o"},{id:"claude-cli",title:"Claude Code",blurb:"The claude command on this machine, with its own login.",needs:"claude on PATH, nothing else",icon:"terminal",model:""}],Jt=t=>$a.find(n=>n.id===t);function Ei(){let[t,n]=w(""),[s,a]=w(!1),[r,o]=w(null),[l,i]=w(null),[c,u]=w(!1),p=()=>{a(!0),n(""),tt().catch(g=>n(g.message)).finally(()=>a(!1))};if(P(()=>{T.value.kind==="agents"&&(p(),o(null),i(null))},[T.value.kind]),T.value.kind!=="agents")return null;let f=pe.value,d=V.value.filter(g=>g.gates>0).length,h=!!f&&f.agents.length===0,v=f?f.file.replace(/^.*[\\/](\.flowweaver[\\/]agents\.yaml)$/,"$1"):".flowweaver/agents.yaml";return e("div",{class:"docview agentsview",children:[e("div",{class:"dochead",children:[e("h1",{children:"Agents"}),e("p",{class:"lede",children:"A model that answers an agent gate while nobody is watching, named in the project and called from inside the run."}),e("div",{class:"docactions",children:[f&&!h&&e("button",{class:"btn primary sm",onClick:()=>{i(null),o("")},children:"Add a profile"}),e("button",{class:"btn sm",onClick:()=>J("durable-gates","agent-profiles"),children:"How it works"}),e("button",{class:"btn sm",disabled:s,onClick:p,children:s?"Reading\u2026":"Read again"})]})]}),t&&e("div",{class:"card",children:e("div",{class:"in",style:"color:var(--err)",children:t})}),!f&&!t&&e("div",{class:"hint",children:"Reading\u2026"}),f&&h&&r===null&&e("div",{class:"card welcome",children:[e("h3",{children:"Let a model answer your agent gates"}),e("div",{class:"in",children:[e("p",{children:[d?`${d} workflow${d===1?"":"s"} in this project pause${d===1?"s":""} at a gate.`:"No workflow here has a gate yet."," Until a profile is here to answer it, an agent gate waits for whoever drives the run: you, here, or an assistant over MCP. Pick where the model comes from:"]}),e("div",{class:"provcards",children:$a.map(g=>e("button",{class:"provcard",onClick:()=>{i(g.id),o("")},children:[e("span",{class:"ms",children:g.icon}),e("b",{children:g.title}),e("span",{children:g.blurb}),e("small",{children:["Needs ",g.needs,"."]})]},g.id))}),e("div",{class:"hint",style:"margin-top:12px",children:["Nothing is stored but a name for the key. ",e("button",{class:"linkish",onClick:()=>u(!c),children:c?"Hide the file":"Prefer to write the file yourself?"})]}),c&&e("div",{class:"starter",children:[e("pre",{class:"mono",children:f.starter}),e("button",{class:"btn sm",onClick:()=>navigator.clipboard.writeText(f.starter).then(()=>O("copied")),children:"copy"})]}),c&&e("div",{class:"hint",children:["It goes at ",e("code",{children:v})," in the project."]})]})]}),f&&r===""&&e(Ti,{existing:null,start:l,suggestions:f.suggestedModels,onDone:()=>{o(null),i(null)}},"new"),f&&f.errors.length>0&&e("div",{class:"card",children:[e("h3",{children:["Problems in ",v]}),e("div",{class:"in",children:f.errors.map((g,m)=>e("div",{class:"issue",children:[e("span",{class:"mark"}),e("div",{children:g})]},m))})]}),f&&!h&&e("div",{class:"card",children:[e("h3",{children:["Profiles",e("span",{class:"hint",style:"margin-left:8px",children:f.agents.length})]}),e("div",{class:"in reglist",children:f.agents.map(g=>r===g.name?e(Ti,{existing:g,start:null,suggestions:f.suggestedModels,onDone:()=>o(null)},g.name):e(xu,{p:g,isDefault:f.default===g.name,onEdit:()=>{i(null),o(g.name)}},g.name))})]}),f&&!h&&e("div",{class:"card",children:[e("h3",{children:"Which gate goes to which"}),e("div",{class:"in",children:[e("p",{class:"hint",children:["A paused gate is matched by ",e("code",{children:"workflow/node"})," first, then by its ",e("code",{children:"agentId"}),", then the default",f.default?e(x,{children:[" (",e("b",{children:f.default}),")"]}):" (and there is none, so an unmatched gate waits for a person or an assistant)",". The ",e("b",{children:"answered by"})," menu on a gate's step writes a row here."]}),e(_u,{gates:f.gates,profiles:f.agents})]})]}),f&&!h&&e("div",{class:"card",children:[e("h3",{children:"The file"}),e("div",{class:"in hint",children:["All of this is ",e("code",{children:v}),", versioned with the workflows. Edit it here or by hand. The console rewrites it whole, so a comment you add by hand does not survive a change made here. ",e("a",{href:Ie(f.file),children:"Open it"}),"."]})]})]})}function xu({p:t,isDefault:n,onEdit:s}){let[a,r]=w(!1),[o,l]=w(null),i=Jt(t.provider),c=async()=>{r(!0),l(null);try{l(await Nr(t.name))}catch(u){l({ok:!1,ms:0,error:u.message})}finally{r(!1)}};return e("div",{class:`reg profile ${t.ready?"":"notready"}`,children:[e("div",{class:"reghead",children:[e("span",{class:"ms",style:"color:var(--gate)",children:"smart_toy"}),e("b",{children:t.name}),n&&e("span",{class:"pill",children:"default"}),e("span",{class:"regruns",children:[e("span",{class:`sdot ${t.ready?"ok":"bad"}`})," ",t.ready?"ready":"not ready"]})]}),e("dl",{class:"regkv",children:[e("dt",{children:"model"}),e("dd",{children:[t.model||e("span",{class:"opt-ns",children:"the command's default"}),e("span",{class:"opt-ns",children:[" on ",i.title]})]}),t.provider!=="claude-cli"&&e(x,{children:[e("dt",{children:"key"}),e("dd",{class:"mono",children:[t.keyEnv,e("span",{class:`opt-ns ${t.ready?"":"err"}`,children:[" (",t.reason??"set in the environment",")"]})]})]}),t.provider==="claude-cli"&&e(x,{children:[e("dt",{children:"command"}),e("dd",{class:"mono",children:[t.bin??"claude",e("span",{class:`opt-ns ${t.ready?"":"err"}`,children:[" (",t.ready?"on PATH":t.reason,")"]})]})]}),t.baseUrl&&e(x,{children:[e("dt",{children:"base URL"}),e("dd",{class:"mono break",children:t.baseUrl})]}),t.system&&e(x,{children:[e("dt",{children:"told"}),e("dd",{class:"sys",children:t.system})]}),t.description&&e(x,{children:[e("dt",{children:"about"}),e("dd",{children:t.description})]})]}),e("div",{class:"regactions",children:[e("button",{class:"btn sm",onClick:s,children:"Edit"}),e("button",{class:"btn sm",disabled:a||!t.ready,title:t.ready?"One short reply, to see that it works":t.reason??"",onClick:c,children:a?"Trying\u2026":"Try it"}),!n&&e("button",{class:"btn ghost sm",onClick:()=>jr(t.name).catch(u=>O(u.message)),children:"Make default"}),o&&(o.ok?e("span",{class:"tried ok",children:[e("span",{class:"ms",children:"check_circle"})," replied in ",o.ms," ms",o.usage?`, ${o.usage.promptTokens+o.usage.completionTokens} tokens`:"",o.text?e("span",{class:"hint",children:[": \u201C",o.text.slice(0,60),"\u201D"]}):null]}):e("span",{class:"tried bad",children:[e("span",{class:"ms",children:"error"})," ",o.error]}))]})]})}function Ti({existing:t,start:n,suggestions:s,onDone:a}){let r=t?.provider??n??"anthropic",[o,l]=w(t?.name??(r==="claude-cli"?"claude":"assistant")),[i,c]=w(r),[u,p]=w(t?.model??Jt(r).model),[f,d]=w(t?.keyEnv??Jt(r).keyEnv??""),[h,v]=w(t?.baseUrl??""),[g,m]=w(t?.bin??""),[k,y]=w(t?.system??""),[_,b]=w(t?.maxIterations??8),[R,D]=w(t?.description??""),[C,A]=w(null),[q,Z]=w(!1),[ie,$]=w(""),[L,B]=w(!1);P(()=>{if(i==="claude-cli"||!f){A(null);return}let F=!0,U=setTimeout(()=>{Fr(f).then(Se=>{F&&A(Se)}).catch(()=>{F&&A(null)})},250);return()=>{F=!1,clearTimeout(U)}},[f,i]);let Q=F=>{c(F);let U=Jt(F);t||(p(U.model),d(U.keyEnv??""),(o==="assistant"||o==="claude")&&l(F==="claude-cli"?"claude":"assistant"))},N=i==="openai"&&h&&!C,te=async()=>{Z(!0),$("");let F={provider:i,model:u||void 0,apiKeyEnv:i==="claude-cli"?void 0:f||void 0,baseUrl:i==="openai"&&h||void 0,bin:i==="claude-cli"&&g||void 0,system:k||void 0,maxIterations:_,description:R||void 0};try{await Mr(o.trim(),F),O(t?"profile saved":`${o.trim()} added`),a()}catch(U){$(U.message)}finally{Z(!1)}},Ce=async()=>{Z(!0);try{await Or(t.name),O("profile removed"),a()}catch(F){$(F.message)}finally{Z(!1)}},Pe=s[i]??[];return e("div",{class:"card pform",children:[e("h3",{children:[t?e(x,{children:["Edit ",e("b",{children:t.name})]}):"New profile",e("span",{class:"sp"}),e("button",{class:"btn ghost sm",onClick:a,children:"Cancel"})]}),e("div",{class:"in",children:[e("div",{class:"field",children:[e("label",{children:e("span",{children:"where the model comes from"})}),e("div",{class:"seg",children:$a.map(F=>e("button",{class:i===F.id?"on":"",onClick:()=>Q(F.id),children:F.title},F.id))}),e("div",{class:"hint",style:"margin-top:6px",children:[Jt(i).blurb," Needs ",Jt(i).needs,"."]})]}),e("div",{class:"row2",children:[e("div",{class:"field",children:[e("label",{children:[e("span",{children:"name"}),e("i",{children:"how gates refer to it"})]}),e("input",{type:"text",value:o,disabled:!!t,placeholder:"reviewer",onInput:F=>l(F.target.value)})]}),e("div",{class:"field",children:[e("label",{children:[e("span",{children:"model"}),i==="claude-cli"&&e("i",{children:"optional"})]}),e("input",{type:"text",value:u,placeholder:i==="claude-cli"?"the command's default":"model id",onInput:F=>p(F.target.value)}),Pe.filter(Boolean).length>0&&e("div",{class:"chips",children:Pe.filter(Boolean).map(F=>e("button",{class:`chip ${u===F?"on":""}`,onClick:()=>p(F),children:F},F))})]})]}),i!=="claude-cli"&&e("div",{class:"field",children:[e("label",{children:[e("span",{children:"key"}),e("i",{children:"the environment variable that holds it"})]}),e("div",{class:"withstat",children:[e("input",{type:"text",class:"mono",value:f,placeholder:"MY_API_KEY",onInput:F=>d(F.target.value.toUpperCase())}),e("span",{class:`stat ${C===!0?"ok":C===!1?N?"warn":"bad":""}`,children:C===!0?"set":C===!1?N?"not set (fine for a local server)":"not set here":""})]}),e("div",{class:"fhelp",children:["Only the name is saved. The value is read from the shell that started the console or ",e("code",{children:"fw serve"}),C===!1&&!N?e(x,{children:" (export it there and this turns green)"}):"","."]})]}),i==="openai"&&e("div",{class:"field",children:[e("label",{children:[e("span",{children:"base URL"}),e("i",{children:"optional"})]}),e("input",{type:"text",class:"mono",value:h,placeholder:"https://api.openai.com, or http://localhost:11434/v1 for Ollama",onInput:F=>v(F.target.value)})]}),i==="claude-cli"&&e("div",{class:"field",children:[e("label",{children:[e("span",{children:"command"}),e("i",{children:"optional"})]}),e("input",{type:"text",class:"mono",value:g,placeholder:"claude, or a path to it",onInput:F=>m(F.target.value)})]}),e("div",{class:"field",children:[e("label",{children:[e("span",{children:"what it is told"}),e("i",{children:"optional, goes before the gate's own instructions"})]}),e("textarea",{rows:3,value:k,placeholder:"You review files for risk. Be terse.",onInput:F=>y(F.target.value)})]}),e("div",{class:"row2",children:[e("div",{class:"field",children:[e("label",{children:[e("span",{children:"turns"}),e("i",{children:"model calls before giving up"})]}),e("input",{type:"number",min:1,max:50,value:_,onInput:F=>b(Number(F.target.value)||8)})]}),e("div",{class:"field",children:[e("label",{children:[e("span",{children:"about"}),e("i",{children:"optional"})]}),e("input",{type:"text",value:R,placeholder:"a note for the team",onInput:F=>D(F.target.value)})]})]}),e("div",{class:"formfoot",children:[e("button",{class:"btn primary sm",disabled:q||!o.trim(),onClick:te,children:q?"Saving\u2026":t?"Save":"Add profile"}),t&&!L&&e("button",{class:"btn ghost sm",onClick:()=>B(!0),children:"Remove"}),t&&L&&e(x,{children:[e("span",{class:"hint",children:["remove ",t.name,"?"]}),e("button",{class:"btn danger sm",disabled:q,onClick:Ce,children:"Yes, remove"}),e("button",{class:"btn ghost sm",onClick:()=>B(!1),children:"No"})]}),e("span",{class:"err",children:ie})]})]})]})}function _u({gates:t,profiles:n}){let[s,a]=w(""),[r,o]=w(n[0]?.name??""),l=n.map(c=>({value:c.name,label:c.name})),i=async()=>{if(!(!s.trim()||!r))try{await Wt(s.trim(),r),a("")}catch(c){O(c.message)}};return e(x,{children:[Object.keys(t).length>0&&e("div",{class:"gatemap",children:Object.entries(t).map(([c,u])=>e("div",{class:"gaterow",children:[e("code",{children:c}),e("span",{class:"arrow",children:"\u2192"}),e(ue,{value:u,options:l,onChange:p=>Wt(c,p).catch(f=>O(f.message))}),e("button",{class:"btn ghost sm",title:"Back to the default",onClick:()=>Wt(c,null).catch(p=>O(p.message)),children:"\xD7"})]},c))}),e("div",{class:"gaterow add",children:[e("input",{type:"text",class:"mono",value:s,placeholder:"agentId, or workflow/node",onInput:c=>a(c.target.value),onKeyDown:c=>{c.key==="Enter"&&i()}}),e("span",{class:"arrow",children:"\u2192"}),e(ue,{value:r,options:l,onChange:o}),e("button",{class:"btn sm",disabled:!s.trim()||!r,onClick:i,children:"Add"})]})]})}function Ri(){let[t,n]=w("about");return e(x,{children:[e("div",{class:"panes",children:e(re,{icon:"info",label:"About",on:t==="about",onClick:()=>n("about")})}),e("div",{class:"panebody",children:t==="about"&&e("div",{class:"card",children:[e("h3",{children:"What the model gets"}),e("div",{class:"in hint",children:["The gate's inputs (",e("code",{children:"agentId"}),", ",e("code",{children:"context"}),", ",e("code",{children:"prompt"}),") and one tool to return the answer, shaped from the gate's output type. No files, no shell, no network of its own: what it needs goes in ",e("code",{children:"context"}),". Its words stream onto the step while it works."]}),e("h3",{children:"Keys"}),e("div",{class:"in hint",children:["A profile names the variable a key lives in and nothing more. The console reads it from the shell it was started in and says only whether it is set. Start the console or ",e("code",{children:"fw serve"})," from a shell that has it."]}),e("h3",{children:"Local models"}),e("div",{class:"in hint",children:["Ollama, vLLM or LM Studio on this machine is ",e("b",{children:"OpenAI-compatible"})," with a base URL such as ",e("code",{children:"http://localhost:11434/v1"}),". No key needed."]}),e("h3",{children:"GitHub Models"}),e("div",{class:"in hint",children:["Also OpenAI-compatible: base URL ",e("code",{children:"https://models.github.ai/inference"}),", key variable ",e("code",{children:"GITHUB_TOKEN"}),"."]}),e("h3",{children:"Where it applies"}),e("div",{class:"in hint",children:["Runs started here and over ",e("code",{children:"fw serve"}),", unless a run is started with agents off. A run an assistant drives over MCP is the assistant's to answer."]})]})})]})}function Su({kind:t}){let[n,s]=w([]),[a,r]=w(!1),o=Y(null),l=Y(!0),i=We(t),c=i?.state==="running"||i?.state==="starting";P(()=>(s([]),r(!1),sn(`/api/services/${t}/logs`,f=>{if(f.synced){r(!0);return}s(d=>d.length>2e3?[...d.slice(-1500),f]:[...d,f])})),[t,i?.pid]),P(()=>{l.current&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},[n.length]);let u=()=>{let f=o.current;f&&(l.current=f.scrollHeight-f.scrollTop-f.clientHeight<24)},p=f=>new Date(f).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return e("div",{class:"logs",children:[e("div",{class:"logbar",children:[e("span",{class:`sdot ${c?"ok":i?.error?"bad":""}`}),e("span",{class:"hint",children:[t==="serve"?"fw serve":"fw watch",": ",!i||i.state==="stopped"?"not running":i.state==="exited"?`stopped${i.exitCode?` (exit ${i.exitCode})`:""}`:i.state,i?.url?e(x,{children:[" at ",e("a",{class:"mono",href:i.url,target:"_blank",rel:"noreferrer",children:i.url})]}):null]}),e("span",{class:"sp"}),!c&&e("button",{class:"btn primary sm",onClick:()=>et(t).catch(f=>O(f.message)),children:"Start"}),c&&e("button",{class:"btn sm",onClick:()=>ze(t).catch(f=>O(f.message)),children:"Stop"}),e("button",{class:"btn ghost sm",onClick:()=>s([]),title:"Clear what is shown. The server keeps its own",children:"Clear"})]}),e("div",{class:"logbody mono",ref:o,onScroll:u,children:[n.map((f,d)=>e("div",{class:`ln ${f.stream}`,children:[e("span",{class:"t",children:p(f.t)}),f.text]},d)),a&&!n.length&&e("div",{class:"hint",children:c?"nothing printed yet":"nothing kept, start it to see its output here"})]})]})}function Ai(){let t=S.drawer.value,[n,s]=w(!1);if(!t)return null;let a=l=>{let i=l.currentTarget;i.setPointerCapture(l.pointerId),s(!0);let c=l.clientY,u=S.drawerH.value,p=d=>{S.drawerH.value=Math.max(120,Math.min(window.innerHeight*.7,u+(c-d.clientY)))},f=()=>{s(!1),i.removeEventListener("pointermove",p),i.removeEventListener("pointerup",f),M.set("drawerH",S.drawerH.value)};i.addEventListener("pointermove",p),i.addEventListener("pointerup",f)},r=[{id:"serve",label:"Server",icon:"dns"},{id:"watch",label:"Watch",icon:"sync"},{id:"cli",label:"CLI",icon:"terminal"}],o=We("serve");return e("div",{class:`drawer ${n?"dragging":""}`,style:`height:${S.drawerH.value}px`,children:[e("div",{class:"drawergrip",onPointerDown:a,title:"Drag to resize"}),e("div",{class:"panes drawertabs",children:[r.map(l=>e("button",{class:t===l.id?"on":"",onClick:()=>Ee(l.id),children:[e("span",{class:"ms",style:"font-size:15px",children:l.icon}),l.label,l.id==="serve"&&o?.state==="running"&&e("span",{class:"sdot ok",style:"margin-left:2px"})]},l.id)),e("span",{class:"sp"}),e("button",{class:"btn ghost sm",onClick:Dr,title:"Close (the services keep running)",children:e("span",{class:"ms",style:"font-size:16px",children:"expand_more"})})]}),e("div",{class:"drawerbody",children:t==="cli"?e(pt,{}):e(Su,{kind:t})})]})}function Pi({side:t}){let n=a=>{let r=a.currentTarget;r.setPointerCapture(a.pointerId),r.classList.add("on");let o=a.clientX,l=t==="rail"?S.railW.value:S.sideW.value,i=u=>{let p=u.clientX-o,f=Math.max(t==="rail"?228:320,Math.min(t==="rail"?460:720,t==="rail"?l+p:l-p));(t==="rail"?S.railW:S.sideW).value=f},c=()=>{r.classList.remove("on"),r.removeEventListener("pointermove",i),r.removeEventListener("pointerup",c),M.set(t==="rail"?"railW":"sideW",(t==="rail"?S.railW:S.sideW).value)};r.addEventListener("pointermove",i),r.addEventListener("pointerup",c)},s=()=>{(t==="rail"?S.railW:S.sideW).value=t==="rail"?284:420};return e("div",{class:`split ${t}-split`,onPointerDown:n,onDblClick:s})}var Ca=420;function $u({wf:t}){return e("div",{class:"card",style:"max-width:760px",children:[e("h3",{children:["Does not parse",e("span",{class:"sp"}),e("a",{class:"mono",href:Ie(t.file),children:t.rel})]}),e("div",{class:"in",children:t.parseErrors.map((n,s)=>e("div",{class:"issue",children:[e("span",{class:"mark"}),e("div",{children:n})]},s))}),e("div",{class:"in hint",children:"The console re-reads the file as you save it."})]})}function Li(){let t=S.width.value,n=t<Ns?"narrow":t<Ca+200+320?"stacked":"",s=n==="narrow"?300:Math.min(S.railW.value,Math.max(228,t-Ca-(n==="stacked"?0:320))),a=n?0:Math.min(S.sideW.value,Math.max(320,t-s-Ca)),r=T.value.kind==="doc",o=T.value.kind==="pack",l=T.value.kind==="market",i=T.value.kind==="author",c=T.value.kind==="project",u=T.value.kind==="agents",p=T.value.kind==="endpoints";return P(()=>{let f=d=>{if((d.metaKey||d.ctrlKey)&&d.key.toLowerCase()==="k"){d.preventDefault(),S.search.value=!S.search.value;return}!Ar.value||d.target?.tagName==="INPUT"||d.target?.tagName==="TEXTAREA"||(d.key==="F10"?(d.preventDefault(),Qe("step")):d.key==="F5"&&(d.preventDefault(),Qe(d.shiftKey?"toBreakpoint":"continue")))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[]),P(()=>{document.title=r&&ye.value?`${ye.value.name} (Flow Weaver)`:W.value?`${W.value.name} (Flow Weaver)`:"Flow Weaver"},[W.value?.name,r,ye.value?.name]),e("div",{class:`shell ${n}`,style:`grid-template-columns: ${s}px 0 minmax(0, 1fr) 0 ${a}px; --rail:${s}px`,children:[e("aside",{class:`col rail ${S.railOpen.value?"open":""}`,"aria-label":"Navigator",children:e(Yr,{})}),e(Pi,{side:"rail"}),e("main",{class:"col main",children:[e(eo,{}),r?e(pi,{}):o?e(mi,{}):l?e(bi,{}):i?e(yi,{}):c?e($i,{}):u?e(Ei,{}):p?e(Oo,{}):e(x,{children:[Je(W.value)&&e(xo,{w:W.value}),W.value?.parseErrors&&e($u,{wf:W.value})]})]}),e(Pi,{side:"side"}),e("aside",{class:"col side","aria-label":"Inspector",children:r?e(hi,{}):o?e(vi,{}):l?e(ki,{}):i?e(wi,{}):c?e(Ci,{}):u?e(Ri,{}):p?e(jo,{}):e(qo,{})}),e(Ai,{}),e(_i,{}),e("div",{class:`toast ${jt.value?"show":""}`,children:jt.value}),n==="narrow"&&S.railOpen.value&&e("div",{class:"scrim",onClick:()=>{S.railOpen.value=!1}})]})}Ua(e(Li,{}),document.getElementById("app"));Br();
|