@inneranimalmedia/agentsam-sdk 2.6.17 → 2.6.18
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/AGENTSAM.md +19 -0
- package/README.md +15 -0
- package/apps/agentsam-copro-studio/agentsam.app.json +125 -0
- package/apps/cad-creator/agentsam.app.json +230 -0
- package/apps/cad-creator/shared/cad/package.json +1 -1
- package/apps/cad-creator/shared/cad/src/index.ts +1 -0
- package/apps/cad-creator/shared/cad/src/lighting.test.ts +32 -0
- package/apps/cad-creator/shared/cad/src/lighting.ts +79 -0
- package/apps/cad-creator/shared/cad/src/types.ts +106 -4
- package/apps/design-canvas/agentsam.app.json +144 -0
- package/apps/ecommerce-cms-agentsam/agentsam.app.json +658 -0
- package/apps/local-studio/agentsam.app.json +271 -0
- package/apps/samsketch/agentsam.app.json +136 -0
- package/contracts/source-types.v2.json +86 -1
- package/docs/CAPABILITIES.md +56 -0
- package/docs/PRODUCT_LIFECYCLE.md +2 -0
- package/docs/REPOSITORY_KNOWLEDGE.md +24 -0
- package/docs/adr/ADR-0010-widget-contributions-registry-persistence.md +60 -0
- package/docs/architecture/ACP_D1_HOSTING.md +67 -0
- package/docs/architecture/AGENTSAM-PRODUCT-CATALOG-RELEASES-20261028.md +3 -1
- package/docs/architecture/AGENTSAM_APPLICATION_CONTRACT.md +6 -2
- package/docs/architecture/AGENTSAM_APPLICATION_INVENTORY.md +135 -0
- package/docs/architecture/AGENTSAM_DISTRIBUTION_OWNERSHIP.md +1 -1
- package/docs/architecture/AGENTSAM_GO_RUNTIME.md +1 -1
- package/docs/architecture/APP_PRODUCT_DATA_MODEL.md +121 -0
- package/docs/architecture/BRAND_WORKSPACE_V1.md +71 -0
- package/docs/architecture/CANONICAL_CAD_FORMAT_SPINE.md +79 -0
- package/docs/architecture/ECOMMERCE_THEME_START_FLOW.md +31 -0
- package/docs/architecture/LIVE_AST_AND_CREATIVE_RESOURCE_GRAPH.md +129 -0
- package/docs/architecture/PRIMETECH_SCENE_V2_READINESS.md +89 -0
- package/docs/architecture/PYTHON_CAD_SERVICE_TRANSPORT.md +116 -0
- package/docs/architecture/SCHEMA_AUTHORITIES.md +83 -0
- package/docs/architecture/app-module-plugin-classification.md +71 -0
- package/docs/architecture/primetech/BARNDOMINIUM_BIM_BUILDOUT_RUNBOOK_20261123.md +139 -0
- package/docs/architecture/primetech/BARNDOMINIUM_SPACE_DELIVERY_20261123.md +58 -0
- package/docs/architecture/primetech/CAPABILITY_AND_ACCEPTANCE_MATRIX.md +176 -0
- package/docs/architecture/primetech/IMPLEMENTATION_WAVES.md +203 -0
- package/docs/architecture/primetech/PORTABLE_EDITOR_CONTRACTS.md +192 -0
- package/docs/architecture/primetech/README.md +65 -0
- package/docs/architecture/universal-registry-recovery.md +62 -0
- package/docs/audits/2026-11-22-sdk-d1-registry-parity.md +116 -0
- package/docs/brand/BRAND_CAPABILITY_INVENTORY.md +160 -0
- package/docs/cad/FORMAT_SUPPORT.md +46 -0
- package/docs/cad/LIB_CAD_REMASTER_AUDIT.md +49 -0
- package/docs/engineering/CMS_DATA_AUTHORITY_2026-11-03.md +4 -2
- package/docs/generated/SDK_CAPABILITY_INVENTORY.md +10 -10
- package/docs/intake/product-capabilities.proposed.ts +6 -6
- package/docs/operations/CLOUDFLARE-QUEUE-OBSERVABILITY.md +1 -1
- package/docs/product/AGENTSAM_PRODUCT_EXPERIENCE_STANDARD.md +1 -1
- package/docs/reference/AGENTSAM-CLI-WORKFLOWS.md +1 -1
- package/docs/reference/AGENTSAM-REGISTRY.generated.md +25 -16
- package/docs/sam/opencv-media.md +63 -0
- package/docs/standards/DESKTOP_WEB_PARITY_ACCEPTANCE.md +42 -0
- package/migrations/d1/0001_agentsam_plugin_runtime.sql +0 -2
- package/migrations/d1/0028_drop_unused_tool_handler_families.sql +4 -0
- package/migrations/d1/0029_agentsam_tools_account_plugin_key_unique.sql +26 -0
- package/migrations/d1/0030_cad_engine_plugins_contract_agnostic.sql +21 -0
- package/migrations/d1/0031_ops_trail_single_tool_call_source.sql +13 -0
- package/migrations/d1/0033_service_registry_model_discovery.sql +50 -0
- package/migrations/d1/20261123_skill_package_staging.sql +64 -0
- package/migrations/d1/20261123_universal_registry_stage.sql +58 -0
- package/migrations/d1/20261126_agentsam_tool_legacy_metadata_compact.sql +6 -0
- package/migrations/d1/20261126_agentsam_tools_archive_legacy_metadata.sql +20 -0
- package/migrations/d1/20261126_agentsam_tools_normalize_intent_tags.sql +49 -0
- package/migrations/d1/20261126_agentsam_tools_normalize_policy_health.sql +89 -0
- package/migrations/d1/20261126_agentsam_tools_remove_legacy_scope_keys.sql +29 -0
- package/migrations/d1/20261126_agentsam_tools_runtime_view_compat.sql +65 -0
- package/migrations/d1/generated/20261123_portable_cli_seed.sql +97 -0
- package/migrations/d1/generated/20261123_source_skill_seed.sql +3881 -0
- package/migrations/runtime/0012_agent_run_event_sequence.sql +27 -0
- package/package.json +57 -17
- package/packages/agentsam-3d-viewer/README.md +5 -0
- package/packages/agentsam-3d-viewer/package.json +1 -1
- package/packages/agentsam-3d-viewer/src/atmosphere.js +90 -0
- package/packages/agentsam-3d-viewer/src/gltf-loader.js +42 -0
- package/packages/agentsam-3d-viewer/src/index.d.ts +53 -1
- package/packages/agentsam-3d-viewer/src/index.js +18 -3
- package/packages/agentsam-3d-viewer/src/pbr-materials.js +330 -0
- package/packages/agentsam-3d-viewer/src/procedural-material.js +96 -0
- package/packages/agentsam-3d-viewer/src/procedural-textures.js +334 -0
- package/packages/agentsam-3d-viewer/src/renderer-capabilities.js +12 -0
- package/packages/agentsam-3d-viewer/src/stroke-geometry.js +4 -0
- package/packages/agentsam-3d-viewer/src/studio-finishes.js +67 -0
- package/packages/agentsam-3d-viewer/test/atmosphere.test.mjs +17 -0
- package/packages/agentsam-3d-viewer/test/gltf-loader.test.mjs +49 -0
- package/packages/agentsam-3d-viewer/test/pbr-mined-presets.test.mjs +44 -0
- package/packages/agentsam-3d-viewer/test/procedural-material.test.mjs +56 -0
- package/packages/agentsam-3d-viewer/test/renderer-capabilities.test.mjs +18 -0
- package/packages/agentsam-3d-viewer/test/studio-shared.test.mjs +23 -0
- package/packages/agentsam-architectural-intelligence/package.json +1 -1
- package/packages/agentsam-brand/package.json +3 -2
- package/packages/agentsam-brand/src/core/capabilities.js +108 -48
- package/packages/agentsam-brand/src/extract.js +6 -1
- package/packages/agentsam-brand/src/index.js +1 -0
- package/packages/agentsam-brand/src/public.js +15 -1
- package/packages/agentsam-brand/src/scan.js +47 -0
- package/packages/agentsam-brand/src/workspace.d.ts +19 -0
- package/packages/agentsam-brand/src/workspace.js +166 -0
- package/packages/agentsam-cms/README.md +11 -0
- package/packages/agentsam-cms/package.json +4 -3
- package/packages/agentsam-cms/src/contracts.js +16 -0
- package/packages/agentsam-cms/src/studio-bridge-protocol.js +113 -0
- package/packages/agentsam-cms/test/standalone.test.mjs +7 -3
- package/packages/agentsam-cms/test/studio-bridge-protocol.test.mjs +26 -0
- package/packages/agentsam-communications/package.json +3 -2
- package/packages/agentsam-communications/src/samspeaks-runtime.js +126 -0
- package/packages/agentsam-contracts/README.md +67 -0
- package/packages/agentsam-contracts/agentsam.package.json +46 -12
- package/packages/agentsam-contracts/dist/agent.d.ts +6 -3
- package/packages/agentsam-contracts/dist/agent.js +20 -0
- package/packages/agentsam-contracts/dist/bim-model.d.ts +95 -0
- package/packages/agentsam-contracts/dist/bim-model.js +57 -0
- package/packages/agentsam-contracts/dist/cad-source-formats.d.ts +55 -0
- package/packages/agentsam-contracts/dist/cad-source-formats.js +9617 -0
- package/packages/agentsam-contracts/dist/design-workspace.d.ts +13 -1
- package/packages/agentsam-contracts/dist/index.d.ts +6 -0
- package/packages/agentsam-contracts/dist/index.js +17836 -349
- package/packages/agentsam-contracts/dist/json-schema.d.ts +8 -0
- package/packages/agentsam-contracts/dist/json-schema.js +7787 -0
- package/packages/agentsam-contracts/dist/operations.d.ts +6 -1
- package/packages/agentsam-contracts/dist/operations.js +7795 -5
- package/packages/agentsam-contracts/dist/resource-ref.d.ts +21 -0
- package/packages/agentsam-contracts/dist/resource-ref.js +23 -0
- package/packages/agentsam-contracts/dist/run.d.ts +91 -3
- package/packages/agentsam-contracts/dist/run.js +28 -0
- package/packages/agentsam-contracts/dist/scene-document.d.ts +32 -0
- package/packages/agentsam-contracts/dist/scene-document.js +30 -0
- package/packages/agentsam-contracts/dist/scene-format.d.ts +44 -0
- package/packages/agentsam-contracts/dist/scene-format.js +35 -0
- package/packages/agentsam-contracts/dist/source-types-registry.d.ts +9 -0
- package/packages/agentsam-contracts/dist/source-types-registry.js +9512 -0
- package/packages/agentsam-contracts/dist/tools.d.ts +2 -1
- package/packages/agentsam-contracts/dist/tools.js +7794 -9
- package/packages/agentsam-contracts/dist/widgets.d.ts +2 -0
- package/packages/agentsam-contracts/package.json +42 -3
- package/packages/agentsam-contracts/schemas/activity.v1.schema.json +142 -0
- package/packages/agentsam-contracts/schemas/bim-model.v1.schema.json +76 -0
- package/packages/agentsam-contracts/schemas/resource-ref.v1.schema.json +18 -0
- package/packages/agentsam-contracts/schemas/run-receipt.v1.schema.json +411 -0
- package/packages/agentsam-contracts/schemas/run-start.v1.schema.json +40 -0
- package/packages/agentsam-contracts/schemas/run.v1.schema.json +243 -0
- package/packages/agentsam-contracts/schemas/sam-operation.v1.schema.json +8 -0
- package/packages/agentsam-contracts/schemas/scene-document.v2.schema.json +212 -0
- package/packages/agentsam-contracts/schemas/scene-format.v1.schema.json +173 -0
- package/packages/agentsam-contracts/schemas/source-types.v2.json +86 -1
- package/packages/agentsam-contracts/scripts/build.mjs +2 -1
- package/packages/agentsam-contracts/src/agent.ts +10 -18
- package/packages/agentsam-contracts/src/bim-model.ts +143 -0
- package/packages/agentsam-contracts/src/cad-source-formats.ts +195 -0
- package/packages/agentsam-contracts/src/design-workspace.ts +9 -0
- package/packages/agentsam-contracts/src/index.ts +6 -0
- package/packages/agentsam-contracts/src/json-schema.ts +37 -0
- package/packages/agentsam-contracts/src/operations.ts +12 -1
- package/packages/agentsam-contracts/src/resource-ref.ts +36 -0
- package/packages/agentsam-contracts/src/run.ts +93 -16
- package/packages/agentsam-contracts/src/scene-document.ts +58 -0
- package/packages/agentsam-contracts/src/scene-format.ts +91 -0
- package/packages/agentsam-contracts/src/source-types-registry.ts +65 -0
- package/packages/agentsam-contracts/src/tools.ts +4 -1
- package/packages/agentsam-contracts/src/widgets.ts +2 -0
- package/packages/agentsam-contracts/test/bim-model.test.mjs +66 -0
- package/packages/agentsam-contracts/test/cad-source-formats.test.mjs +103 -0
- package/packages/agentsam-contracts/test/contracts.test.mjs +23 -1
- package/packages/agentsam-contracts/test/resource-ref.test.mjs +29 -0
- package/packages/agentsam-contracts/test/run-contract.test.mjs +44 -0
- package/packages/agentsam-contracts/test/scene-document.test.mjs +30 -0
- package/packages/agentsam-contracts/test/scene-format.test.mjs +40 -0
- package/packages/agentsam-contracts/test/source-types.test.mjs +29 -0
- package/packages/agentsam-desktop-shell/scripts/app-discovery.mjs +36 -25
- package/packages/agentsam-errors/package.json +1 -1
- package/packages/agentsam-goalguru/agentsam.app.json +97 -0
- package/packages/agentsam-goap/package.json +2 -2
- package/packages/agentsam-hooks/package.json +1 -1
- package/packages/agentsam-knowledge/package.json +1 -1
- package/packages/agentsam-merch/package.json +1 -1
- package/packages/agentsam-nav/dist/Surfaces.d.ts +14 -4
- package/packages/agentsam-nav/dist/browser.global.js +16 -16
- package/packages/agentsam-nav/dist/browser.js +65 -22
- package/packages/agentsam-nav/dist/contracts.d.ts +2 -0
- package/packages/agentsam-nav/dist/index.d.ts +1 -1
- package/packages/agentsam-nav/dist/index.js +62 -21
- package/packages/agentsam-nav/dist/shell.css +149 -4
- package/packages/agentsam-nav/dist/theme.css +149 -4
- package/packages/agentsam-nav/dist/useAdminApps.d.ts +21 -2
- package/packages/agentsam-nav/package.json +1 -1
- package/packages/agentsam-occt/dist/native-provider.d.mts +1 -1
- package/packages/agentsam-occt/dist/native-provider.mjs +1 -1
- package/packages/agentsam-occt/package.json +1 -1
- package/packages/agentsam-occt/src/native-provider.mjs +1 -1
- package/packages/agentsam-queue-control/package.json +1 -1
- package/packages/agentsam-queue-control/src/adapters/sqlite.js +8 -6
- package/packages/agentsam-repository/package.json +1 -1
- package/packages/agentsam-vault/package.json +5 -1
- package/packages/agentsam-vault/src/crypto/aes-gcm.d.ts +25 -0
- package/packages/agentsam-vault/src/crypto/aes-gcm.js +149 -0
- package/packages/agentsam-vault/src/crypto/classify.d.ts +22 -0
- package/packages/agentsam-vault/src/crypto/classify.js +83 -0
- package/packages/agentsam-vault/src/crypto/oauth-envelope.d.ts +7 -0
- package/packages/agentsam-vault/src/index.js +10 -0
- package/packages/agentsam-vault/src/providers/registry.js +8 -0
- package/packages/agentsam-workbench/README.md +27 -3
- package/packages/agentsam-workbench/package.json +26 -4
- package/packages/agentsam-workbench/src/agent/AskAgentSamPill.tsx +17 -0
- package/packages/agentsam-workbench/src/agent/MiniAgentSam.tsx +144 -20
- package/packages/agentsam-workbench/src/agent/contextual-composer.css +7 -0
- package/packages/agentsam-workbench/src/agent/index.ts +1 -0
- package/packages/agentsam-workbench/src/agent/mini-agentsam.css +54 -0
- package/packages/agentsam-workbench/src/design/DesignWorkspaceFrame.tsx +277 -82
- package/packages/agentsam-workbench/src/design/design-workspace.css +173 -109
- package/packages/agentsam-workbench/src/index.ts +1 -0
- package/packages/agentsam-workbench/src/shell/InspectorPicker.tsx +38 -0
- package/packages/agentsam-workbench/src/shell/ResizableStage.tsx +26 -5
- package/packages/agentsam-workbench/src/shell/SidePanel.tsx +3 -3
- package/packages/agentsam-workbench/src/shell/StudioCommands.tsx +32 -0
- package/packages/agentsam-workbench/src/shell/appearance.d.mts +28 -0
- package/packages/agentsam-workbench/src/shell/appearance.mjs +279 -0
- package/packages/agentsam-workbench/src/shell/index.ts +2 -0
- package/packages/agentsam-workbench/src/shell/inspector-picker.css +48 -0
- package/packages/agentsam-workbench/src/shell/studio-icons.ts +104 -0
- package/packages/agentsam-workbench/src/shell/studio-panels.ts +21 -0
- package/packages/agentsam-workbench/src/widgets/registry.ts +4 -4
- package/packages/agentsam-workbench/src/workflows/WorkflowStudio.tsx +936 -0
- package/packages/agentsam-workbench/src/workflows/index.ts +5 -0
- package/packages/agentsam-workbench/src/workflows/model.ts +207 -0
- package/packages/agentsam-workbench/src/workflows/types.ts +206 -0
- package/packages/agentsam-workbench/src/workflows/workflow-studio.css +290 -0
- package/packages/catalog/generated/packages.json +157 -45
- package/packages/connectors/cfoa/package.json +7 -2
- package/packages/connectors/cfoa/src/PERMISSION_REGISTRY.md +45 -0
- package/packages/connectors/cfoa/src/api-client.js +4 -0
- package/packages/connectors/cfoa/src/capabilities.js +123 -285
- package/packages/connectors/cfoa/src/families/media.js +16 -12
- package/packages/connectors/cfoa/src/index.js +31 -37
- package/packages/connectors/cfoa/src/oauth-persist.js +18 -2
- package/packages/connectors/cfoa/src/permission-options.js +147 -1038
- package/packages/connectors/cfoa/src/routes.js +92 -35
- package/packages/connectors/cfoa/src/scope-catalog.js +16 -351
- package/packages/connectors/cfoa/src/scope-registry.js +248 -0
- package/packages/connectors/cfoa/test/scope-registry.test.mjs +168 -0
- package/packages/connectors/cfoa/tests/capabilities.test.mjs +86 -45
- package/packages/connectors/cfoa/tests/connector.test.mjs +143 -0
- package/packages/connectors/cfoa/tests/media-discovery.test.mjs +34 -10
- package/packages/identity/.agentsam/features/oauth-login-portal/agentsam.feature.json +1 -1
- package/packages/identity/agentsam.package.json +4 -4
- package/packages/identity/migrations/apply-portable.js +11 -4
- package/packages/identity/migrations/sqlite/007_identity_session_revoke_reason.sql +3 -0
- package/packages/identity/migrations/sqlite/008_identity_accounts.sql +41 -0
- package/packages/identity/migrations/sqlite/009_identity_scope.sql +30 -0
- package/packages/identity/package.json +11 -6
- package/packages/identity/schema/agentsam.identity/manifest.json +21 -4
- package/packages/identity/src/adapters/account-security-store.js +7 -0
- package/packages/identity/src/adapters/column-support.js +39 -0
- package/packages/identity/src/adapters/iam-compat/index.js +19 -4
- package/packages/identity/src/adapters/portable-d1/index.js +3 -1
- package/packages/identity/src/adapters/portable-store.js +80 -51
- package/packages/identity/src/app/verify-app.js +27 -0
- package/packages/identity/src/contracts/identity-store.js +2 -2
- package/packages/identity/src/core/password-gate.js +116 -0
- package/packages/identity/src/frontend/auth-portal/pages/login.html +1 -1
- package/packages/identity/src/frontend/auth-portal/pages/reset.html +1 -1
- package/packages/identity/src/frontend/auth-portal/pages/signup.html +1 -1
- package/packages/identity/src/frontend/auth-portal/shared/company-branding.js +18 -7
- package/packages/identity/src/frontend/auth-portal/shared/default-auth-logo.svg +4 -0
- package/packages/identity/src/frontend/auth-portal/store-access.js +97 -0
- package/packages/identity/src/migrations/0005_session_audit_columns.sql +6 -0
- package/packages/identity/src/migrations/README.md +2 -0
- package/packages/identity/src/oauth/native-handoff.js +2 -2
- package/packages/identity/src/server/identity-service.js +1 -1
- package/packages/identity/src/server/worker-router.js +16 -5
- package/packages/identity/tests/identity-portal-e2e.test.mjs +166 -0
- package/packages/identity/tests/lane1-identity-store-parity.test.mjs +17 -6
- package/packages/identity/tests/password-gate.test.mjs +66 -0
- package/packages/identity/tests/portable-identity-scope.test.mjs +59 -0
- package/packages/identity/tests/session-audit.test.mjs +135 -0
- package/packages/identity/tests/worker-portal-assets.test.mjs +47 -0
- package/packages/primetech-procedures/README.md +46 -5
- package/packages/primetech-procedures/agentsam.package.json +6 -6
- package/packages/primetech-procedures/package.json +14 -3
- package/packages/primetech-procedures/procedures/arch.assembly.calculate/procedure.json +83 -0
- package/packages/primetech-procedures/procedures/media.asset.preflight/procedure.json +85 -0
- package/packages/primetech-procedures/procedures/media.image.optimize-asset/procedure.json +102 -0
- package/packages/primetech-procedures/procedures/repo.asset.inventory/__pycache__/run.cpython-314.pyc +0 -0
- package/packages/primetech-procedures/procedures/repo.git.status/procedure.json +58 -0
- package/packages/primetech-procedures/procedures/repo.git.status/run.sh +10 -0
- package/packages/primetech-procedures/src/index.js +140 -41
- package/packages/primetech-procedures/test/__pycache__/test_inventory.cpython-314.pyc +0 -0
- package/packages/primetech-procedures/test/runtime-kinds.test.mjs +210 -0
- package/packages/theme-scenes/package.json +1 -1
- package/packages/work-graph/package.json +1 -1
- package/protocol/README.md +18 -0
- package/protocol/capabilities/capability-manifest.schema.json +111 -19
- package/protocol/capabilities/manifest.json +12 -1
- package/protocol/contracts/source-types.v2.json +86 -1
- package/protocol/product-releases/README.md +15 -12
- package/protocol/registry/universal-catalog.v1.json +2820 -0
- package/protocol/sam/activity.v1.schema.json +111 -17
- package/protocol/sam/operation.schema.json +8 -0
- package/protocol/sam/run-receipt.v1.schema.json +411 -0
- package/protocol/sam/run-start.v1.schema.json +40 -0
- package/protocol/sam/run.v1.schema.json +243 -0
- package/protocol/theme-refinery/d1-reconciliation.md +66 -32
- package/protocol/theme-refinery/product-metadata.schema.json +1 -1
- package/python/README.md +81 -8
- package/python/agentsam_sdk/cad/__init__.py +26 -3
- package/python/agentsam_sdk/cad/adapters/__init__.py +6 -0
- package/python/agentsam_sdk/cad/adapters/freecad.py +200 -0
- package/python/agentsam_sdk/cad/building.py +42 -0
- package/python/agentsam_sdk/cad/jobs.py +174 -0
- package/python/agentsam_sdk/cad/native.py +68 -9
- package/python/agentsam_sdk/cad/service.py +570 -0
- package/python/agentsam_sdk/cli.py +31 -0
- package/python/agentsam_sdk/client.py +49 -16
- package/python/agentsam_sdk/data/d1_bloat.py +0 -1
- package/python/agentsam_sdk/media/__init__.py +8 -0
- package/python/agentsam_sdk/media/opencv.py +188 -0
- package/python/agentsam_sdk/procedures/client.py +1 -1
- package/python/agentsam_sdk/registry_cli.py +88 -0
- package/python/agentsam_sdk/runtime/native.py +1 -1
- package/python/agentsam_sdk/terminal_art.py +5 -6
- package/python/pyproject.toml +3 -0
- package/python/tests/fixtures/freecad_host_cases.json +30 -0
- package/python/tests/test_bridge_policy.py +40 -0
- package/python/tests/test_cad_building_client.py +47 -0
- package/python/tests/test_cad_jobs_client.py +102 -0
- package/python/tests/test_cad_native.py +104 -1
- package/python/tests/test_cad_service_client.py +288 -0
- package/python/tests/test_opencv_media.py +79 -0
- package/python/tests/test_procedure_client.py +6 -0
- package/python/tests/test_public_client.py +13 -0
- package/services/cad/blender/adapter.py +49 -0
- package/services/cad/ifc/__pycache__/adapter.cpython-311.pyc +0 -0
- package/services/cad/ifc/adapter.py +836 -0
- package/services/cad/server.py +435 -132
- package/skills/README.md +1 -1
- package/skills/agentsam-app-fundamentals/agentsam.skill.json +20 -0
- package/skills/agentsam-arch-bim/SKILL.md +166 -6
- package/skills/agentsam-arch-bim/agentsam.skill.json +2 -2
- package/skills/agentsam-cad/SKILL.md +122 -36
- package/skills/agentsam-cad/agentsam.skill.json +20 -0
- package/skills/agentsam-cad/evals/README.md +56 -0
- package/skills/agentsam-cad/references/engines-and-lanes.md +70 -0
- package/skills/agentsam-cad/references/projects-and-operations.md +112 -0
- package/skills/agentsam-cad/references/proof-and-triage.md +89 -0
- package/skills/agentsam-cad/references/python-service-and-jobs.md +102 -0
- package/skills/agentsam-cad/references/scene-geometry-bim.md +113 -0
- package/skills/agentsam-canvas-creation/agentsam.skill.json +20 -0
- package/skills/agentsam-cloudflare-workers/agentsam.skill.json +20 -0
- package/skills/agentsam-cms-ready-creation/agentsam.skill.json +20 -0
- package/skills/agentsam-codebaseindex/agentsam.skill.json +20 -0
- package/skills/agentsam-jr-dev/agentsam.skill.json +20 -0
- package/skills/agentsam-plan-and-goap/agentsam.skill.json +20 -0
- package/skills/agentsam-progression-guard/agentsam.skill.json +20 -0
- package/skills/agentsam-repo-recon/agentsam.skill.json +20 -0
- package/skills/agentsam-sam-operations/SKILL.md +76 -36
- package/skills/agentsam-sam-operations/agentsam.skill.json +20 -0
- package/skills/agentsam-sdk-orientation/agentsam.skill.json +20 -0
- package/skills/catalog.json +21 -6
- package/src/acp/agent-executor.js +38 -2
- package/src/acp/client.js +128 -39
- package/src/acp/dependencies.js +159 -19
- package/src/acp/http.js +14 -0
- package/src/acp/index.js +3 -0
- package/src/acp/runs.js +5 -3
- package/src/agent/capability-adapter.js +21 -23
- package/src/cli/command-catalog.js +4 -4
- package/src/cli/desktop-launch.js +2 -2
- package/src/cli/update-check.js +131 -0
- package/src/cli.js +6 -5
- package/src/commands/account-auth.js +36 -26
- package/src/commands/app-inventory.js +343 -0
- package/src/commands/app.js +162 -27
- package/src/commands/ast.js +80 -0
- package/src/commands/cad.js +2 -0
- package/src/commands/cheat-sheet.js +1 -1
- package/src/commands/cloudflare-login.js +170 -65
- package/src/commands/cloudflare-status.js +38 -0
- package/src/commands/cloudflare.js +54 -42
- package/src/commands/codebaseindex.js +34 -13
- package/src/commands/db.js +2 -2
- package/src/commands/go.js +1 -1
- package/src/commands/interactive.js +5 -0
- package/src/commands/knowledge.js +4 -2
- package/src/commands/mcp.js +5 -2
- package/src/commands/preferences.js +48 -6
- package/src/commands/product.js +4 -4
- package/src/commands/run.js +3 -4
- package/src/commands/shell.js +32 -10
- package/src/go/contract.js +1 -1
- package/src/go/official-registry.js +41 -36
- package/src/go/product-catalog.test.mjs +52 -0
- package/src/go/receipts.js +19 -6
- package/src/indexing/index.js +10 -0
- package/src/indexing/live-ast.js +200 -0
- package/src/indexing/live-cad-graph.js +107 -0
- package/src/indexing/live-resource-graph.js +95 -0
- package/src/knowledge/config.js +5 -4
- package/src/knowledge/store-discovery.js +22 -5
- package/src/knowledge/stores/d1.js +141 -0
- package/src/lib/auth.js +7 -4
- package/src/lib/cad/bim-bridge.d.ts +6 -0
- package/src/lib/cad/bim-bridge.js +96 -0
- package/src/lib/cad/d1-project-store.js +1 -1
- package/src/lib/cad/delivery-profiles.d.ts +1 -1
- package/src/lib/cad/delivery-profiles.js +82 -6
- package/src/lib/cad/format-policy.d.ts +11 -0
- package/src/lib/cad/format-policy.js +14 -0
- package/src/lib/cad/freecad-host.d.ts +19 -0
- package/src/lib/cad/freecad-host.js +171 -0
- package/src/lib/cad/freecad.js +38 -65
- package/src/lib/cad/ifc-cli.js +82 -0
- package/src/lib/cad/ifc.js +152 -0
- package/src/lib/cad/index.js +3 -0
- package/src/lib/cad/production-operations.js +2 -0
- package/src/lib/cad/project-runtime.js +2 -2
- package/src/lib/cad/project-v2.js +13 -25
- package/src/lib/cad-docker.js +35 -17
- package/src/lib/whoami-capabilities.js +8 -14
- package/src/mcp/cloudflare-bundles.js +39 -41
- package/src/models/inventory-core.d.ts +32 -1
- package/src/models/inventory-core.js +118 -36
- package/src/plugins/cloudflare.js +3 -3
- package/src/plugins/completeful.js +2 -4
- package/src/plugins/contracts.js +2 -3
- package/src/plugins/creative.js +2 -2
- package/src/plugins/registry.js +52 -33
- package/src/plugins/runtime.js +64 -13
- package/src/registry/generated/inventory.json +289 -66
- package/src/registry/universal-reconcile.js +120 -0
- package/src/registry/universal-source.js +253 -0
- package/src/sam/adapters/opencv-video.js +206 -0
- package/src/sam/adapters/workspace-media.js +15 -2
- package/src/sam/bridge/policy.mjs +50 -0
- package/src/sam/bridge/stdio.mjs +61 -38
- package/src/sam/operations/architectural-knowledge.js +1 -0
- package/src/sam/operations/artifact-render.js +2 -1
- package/src/sam/operations/cad-bim-ifc.js +89 -0
- package/src/sam/operations/decision-evaluate.js +1 -0
- package/src/sam/operations/planning-goap.js +1 -0
- package/src/sam/operations/repository-inspect.js +1 -0
- package/src/sam/operations/robotics.js +1 -1
- package/src/sam/packs/core.js +2 -0
- package/src/sam/packs/evidence/endpoint.js +39 -0
- package/src/sam/packs/evidence/media.js +3 -2
- package/src/sam/packs/evidence/store-hosted.js +5 -3
- package/src/sam/shell-host.js +26 -8
- package/src/skills/catalog.js +12 -1
- package/src/skills/registry.js +16 -17
- package/src/ui/boot.js +12 -14
- package/src/ui/brand/agentsam-mark.generated.js +49 -0
- package/src/ui/cli/prompt-box.js +151 -0
- package/src/ui/home-screen.js +49 -0
- package/apps/README.md +0 -67
- package/apps/cad-creator/README.md +0 -743
- package/packages/agentsam-brand/LICENSE +0 -110
- package/packages/agentsam-desktop-shell/LICENSE +0 -110
- package/packages/agentsam-desktop-shell/README.md +0 -73
- package/packages/agentsam-ide/LICENSE +0 -110
- package/packages/agentsam-ide/README.md +0 -147
- package/packages/agentsam-nav/LICENSE +0 -110
- package/packages/agentsam-vault/LICENSE +0 -110
- package/packages/agentsam-workbench/LICENSE +0 -110
- package/src/ui/art/geaux_boot.json +0 -25
- package/src/ui/companion-art.js +0 -40
- /package/{apps/cad-creator → packages/primetech-procedures}/LICENSE +0 -0
|
@@ -0,0 +1,936 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Activity,
|
|
3
|
+
AlertCircle,
|
|
4
|
+
ArrowDownRight,
|
|
5
|
+
Bot,
|
|
6
|
+
Check,
|
|
7
|
+
CheckCircle2,
|
|
8
|
+
ChevronDown,
|
|
9
|
+
CircleDot,
|
|
10
|
+
GitBranch,
|
|
11
|
+
Grip,
|
|
12
|
+
Layers3,
|
|
13
|
+
Maximize2,
|
|
14
|
+
Merge,
|
|
15
|
+
PanelRightClose,
|
|
16
|
+
PanelRightOpen,
|
|
17
|
+
Play,
|
|
18
|
+
Plus,
|
|
19
|
+
RefreshCw,
|
|
20
|
+
Save,
|
|
21
|
+
ShieldCheck,
|
|
22
|
+
Sparkles,
|
|
23
|
+
Trash2,
|
|
24
|
+
Workflow as WorkflowIcon,
|
|
25
|
+
X,
|
|
26
|
+
ZoomIn,
|
|
27
|
+
ZoomOut,
|
|
28
|
+
Zap,
|
|
29
|
+
} from "lucide-react";
|
|
30
|
+
import { useCallback, useEffect, useMemo, useRef, useState, useId, type PointerEvent as ReactPointerEvent } from "react";
|
|
31
|
+
import {
|
|
32
|
+
autoLayoutWorkflowNodes,
|
|
33
|
+
createWorkflowNodeKey,
|
|
34
|
+
resolveWorkflowNodePositions,
|
|
35
|
+
validateWorkflowGraph,
|
|
36
|
+
workflowEdgeKey,
|
|
37
|
+
WORKFLOW_GRID_SIZE,
|
|
38
|
+
WORKFLOW_NODE_SIZE,
|
|
39
|
+
} from "./model";
|
|
40
|
+
import type {
|
|
41
|
+
WorkflowAgentProfileOption,
|
|
42
|
+
WorkflowCapabilityOption,
|
|
43
|
+
WorkflowGraph,
|
|
44
|
+
WorkflowGraphEdge,
|
|
45
|
+
WorkflowGraphNode,
|
|
46
|
+
WorkflowNodeKind,
|
|
47
|
+
WorkflowNodeStatus,
|
|
48
|
+
WorkflowRunStep,
|
|
49
|
+
WorkflowRunSummary,
|
|
50
|
+
WorkflowStudioProps,
|
|
51
|
+
WorkflowToolOption,
|
|
52
|
+
WorkflowValidationResult,
|
|
53
|
+
} from "./types";
|
|
54
|
+
|
|
55
|
+
const NODE_META: Record<WorkflowNodeKind, { label: string; description: string; Icon: typeof Zap }> = {
|
|
56
|
+
action: { label: "Action", description: "Run a routed capability or a pinned tool", Icon: Zap },
|
|
57
|
+
agent: { label: "Agent", description: "Delegate a bounded task to an agent profile", Icon: Bot },
|
|
58
|
+
branch: { label: "Branch", description: "Choose a path using a condition", Icon: GitBranch },
|
|
59
|
+
approval: { label: "Approval", description: "Pause for an explicit human decision", Icon: ShieldCheck },
|
|
60
|
+
parallel: { label: "Parallel", description: "Start independent branches", Icon: Layers3 },
|
|
61
|
+
join: { label: "Join", description: "Wait for incoming branches", Icon: Merge },
|
|
62
|
+
output: { label: "Output", description: "Produce a workflow result", Icon: CircleDot },
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const NODE_KINDS = Object.keys(NODE_META) as WorkflowNodeKind[];
|
|
66
|
+
const STATUS_LABEL: Record<WorkflowNodeStatus, string> = {
|
|
67
|
+
idle: "Idle", pending: "Pending", queued: "Queued", running: "Running", waiting: "Waiting",
|
|
68
|
+
success: "Succeeded", completed: "Completed", failed: "Failed", skipped: "Skipped",
|
|
69
|
+
approval_pending: "Approval needed", timed_out: "Timed out", retrying: "Retrying",
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
function statusTone(status?: WorkflowNodeStatus | WorkflowRunSummary["status"]): string {
|
|
73
|
+
if (status === "success" || status === "completed") return "success";
|
|
74
|
+
if (status === "failed" || status === "timed_out") return "danger";
|
|
75
|
+
if (status === "waiting" || status === "approval_pending") return "warning";
|
|
76
|
+
if (status === "running" || status === "retrying") return "active";
|
|
77
|
+
return "neutral";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function displayStatus(status?: WorkflowNodeStatus | WorkflowRunSummary["status"]): string {
|
|
81
|
+
if (!status) return "";
|
|
82
|
+
return STATUS_LABEL[status as WorkflowNodeStatus] ?? status.replaceAll("_", " ");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function formatDuration(ms?: number | null): string | null {
|
|
86
|
+
if (ms == null || !Number.isFinite(ms)) return null;
|
|
87
|
+
if (ms < 1000) return `${Math.max(0, Math.round(ms))} ms`;
|
|
88
|
+
if (ms < 60_000) return `${(ms / 1000).toFixed(1)} s`;
|
|
89
|
+
return `${Math.floor(ms / 60_000)}m ${Math.round((ms % 60_000) / 1000)}s`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function nodeSubtitle(node: WorkflowGraphNode): string {
|
|
93
|
+
if (node.kind === "action") {
|
|
94
|
+
if (node.resolutionMode === "routed" && node.capabilityKey) return node.capabilityKey;
|
|
95
|
+
if (node.resolutionMode === "pinned" && node.pinnedToolId) return node.pinnedToolId;
|
|
96
|
+
return "Action not configured";
|
|
97
|
+
}
|
|
98
|
+
if (node.kind === "agent" && node.agentProfileId) return node.agentProfileId;
|
|
99
|
+
return node.description?.trim() || NODE_META[node.kind].label;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function nodeStatusByKey(steps: WorkflowRunStep[] = []): Record<string, WorkflowNodeStatus> {
|
|
103
|
+
const result: Record<string, WorkflowNodeStatus> = {};
|
|
104
|
+
for (const step of steps) result[step.nodeKey] = step.status;
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function updateNodeInGraph(
|
|
109
|
+
graph: WorkflowGraph,
|
|
110
|
+
nodeKey: string,
|
|
111
|
+
patch: Partial<WorkflowGraphNode>,
|
|
112
|
+
): WorkflowGraph {
|
|
113
|
+
return {
|
|
114
|
+
...graph,
|
|
115
|
+
nodes: graph.nodes.map((node) => node.nodeKey === nodeKey ? { ...node, ...patch } : node),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function updateEdgeInGraph(
|
|
120
|
+
graph: WorkflowGraph,
|
|
121
|
+
index: number,
|
|
122
|
+
patch: Partial<WorkflowGraphEdge>,
|
|
123
|
+
): WorkflowGraph {
|
|
124
|
+
return {
|
|
125
|
+
...graph,
|
|
126
|
+
edges: graph.edges.map((edge, edgeIndex) => edgeIndex === index ? { ...edge, ...patch } : edge),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function newNode(kind: WorkflowNodeKind, graph: WorkflowGraph): WorkflowGraphNode {
|
|
131
|
+
const nodeKey = createWorkflowNodeKey(kind, graph.nodes.map((node) => node.nodeKey));
|
|
132
|
+
const node: WorkflowGraphNode = {
|
|
133
|
+
nodeKey,
|
|
134
|
+
kind,
|
|
135
|
+
title: NODE_META[kind].label,
|
|
136
|
+
description: "",
|
|
137
|
+
ui: {},
|
|
138
|
+
};
|
|
139
|
+
if (kind === "action") {
|
|
140
|
+
node.resolutionMode = "routed";
|
|
141
|
+
node.capabilityKey = null;
|
|
142
|
+
}
|
|
143
|
+
const layout = autoLayoutWorkflowNodes([...graph.nodes, node], graph.edges);
|
|
144
|
+
node.ui = { position: layout[nodeKey] };
|
|
145
|
+
return node;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function statusFromIssueCount(result: WorkflowValidationResult): string {
|
|
149
|
+
const errors = result.issues.filter((issue) => issue.severity === "error").length;
|
|
150
|
+
const warnings = result.issues.filter((issue) => issue.severity === "warning").length;
|
|
151
|
+
if (!errors && !warnings) return "No structural issues found";
|
|
152
|
+
return `${errors} error${errors === 1 ? "" : "s"}${warnings ? ` · ${warnings} warning${warnings === 1 ? "" : "s"}` : ""}`;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function ValidationPanel({ result, hostChecked }: { result: WorkflowValidationResult; hostChecked: boolean }) {
|
|
156
|
+
return (
|
|
157
|
+
<section className="as-wf-validation" aria-live="polite">
|
|
158
|
+
<div className="as-wf-validation__head">
|
|
159
|
+
{result.ok ? <CheckCircle2 size={16} /> : <AlertCircle size={16} />}
|
|
160
|
+
<strong>{statusFromIssueCount(result)}</strong>
|
|
161
|
+
<span>{hostChecked ? "Host validation included" : "Local structure check only"}</span>
|
|
162
|
+
</div>
|
|
163
|
+
{result.issues.length ? (
|
|
164
|
+
<ul>
|
|
165
|
+
{result.issues.map((issue, index) => (
|
|
166
|
+
<li key={`${issue.code}:${issue.nodeKey ?? issue.edgeIndex ?? index}`} data-severity={issue.severity}>
|
|
167
|
+
<span>{issue.severity === "error" ? "Error" : "Warning"}</span>
|
|
168
|
+
<p>{issue.message}</p>
|
|
169
|
+
{issue.nodeKey ? <code>{issue.nodeKey}</code> : null}
|
|
170
|
+
</li>
|
|
171
|
+
))}
|
|
172
|
+
</ul>
|
|
173
|
+
) : <p className="as-wf-validation__empty">The graph passes the local structural checks.</p>}
|
|
174
|
+
</section>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function RunPanel({ run, steps = [] }: { run: WorkflowRunSummary; steps?: WorkflowRunStep[] }) {
|
|
179
|
+
return (
|
|
180
|
+
<section className="as-wf-run-panel">
|
|
181
|
+
<div className="as-wf-run-panel__head">
|
|
182
|
+
<div>
|
|
183
|
+
<span className="as-wf-eyebrow">Latest execution</span>
|
|
184
|
+
<strong>{run.id}</strong>
|
|
185
|
+
</div>
|
|
186
|
+
<span className={`as-wf-status as-wf-status--${statusTone(run.status)}`}>{displayStatus(run.status)}</span>
|
|
187
|
+
</div>
|
|
188
|
+
<div className="as-wf-run-meta">
|
|
189
|
+
{run.triggerKind ? <span>Trigger · {run.triggerKind.replaceAll("_", " ")}</span> : null}
|
|
190
|
+
{run.waitingReason ? <span>Waiting · {run.waitingReason.replaceAll("_", " ")}</span> : null}
|
|
191
|
+
{formatDuration(run.durationMs) ? <span>{formatDuration(run.durationMs)}</span> : null}
|
|
192
|
+
</div>
|
|
193
|
+
{run.errorMessage ? <p className="as-wf-run-error">{run.errorMessage}</p> : null}
|
|
194
|
+
{steps.length ? (
|
|
195
|
+
<ol className="as-wf-run-steps">
|
|
196
|
+
{steps.map((step) => (
|
|
197
|
+
<li key={step.id}>
|
|
198
|
+
<span className={`as-wf-step-dot as-wf-step-dot--${statusTone(step.status)}`} />
|
|
199
|
+
<span className="as-wf-run-steps__name">{step.nodeKey}</span>
|
|
200
|
+
<span className="as-wf-run-steps__status">{displayStatus(step.status)}</span>
|
|
201
|
+
{step.attempt && step.attempt > 1 ? <small>Attempt {step.attempt}</small> : null}
|
|
202
|
+
{formatDuration(step.latencyMs) ? <small>{formatDuration(step.latencyMs)}</small> : null}
|
|
203
|
+
{step.errorMessage ? <p className="as-wf-run-steps__error">{step.errorMessage}</p> : null}
|
|
204
|
+
</li>
|
|
205
|
+
))}
|
|
206
|
+
</ol>
|
|
207
|
+
) : null}
|
|
208
|
+
</section>
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
type WorkflowCanvasProps = {
|
|
213
|
+
graph: WorkflowGraph;
|
|
214
|
+
selectedNodeKey: string | null;
|
|
215
|
+
selectedEdgeIndex: number | null;
|
|
216
|
+
connectMode: boolean;
|
|
217
|
+
connectFrom: string | null;
|
|
218
|
+
readOnly: boolean;
|
|
219
|
+
statuses: Record<string, WorkflowNodeStatus>;
|
|
220
|
+
onSelectNode: (key: string | null) => void;
|
|
221
|
+
onSelectEdge: (index: number | null) => void;
|
|
222
|
+
onConnectNode: (key: string) => void;
|
|
223
|
+
onPositionsChange: (positions: Record<string, { x: number; y: number }>) => void;
|
|
224
|
+
onAutoLayout: () => void;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
type CanvasDrag =
|
|
228
|
+
| { kind: "node"; nodeKey: string; offsetX: number; offsetY: number; pointerId: number }
|
|
229
|
+
| { kind: "pan"; startX: number; startY: number; originX: number; originY: number; pointerId: number };
|
|
230
|
+
|
|
231
|
+
function edgePath(from: { x: number; y: number }, to: { x: number; y: number }): string {
|
|
232
|
+
const forward = from.x <= to.x;
|
|
233
|
+
const sx = from.x + (forward ? WORKFLOW_NODE_SIZE.width : 0);
|
|
234
|
+
const tx = to.x + (forward ? 0 : WORKFLOW_NODE_SIZE.width);
|
|
235
|
+
const sy = from.y + WORKFLOW_NODE_SIZE.height / 2;
|
|
236
|
+
const ty = to.y + WORKFLOW_NODE_SIZE.height / 2;
|
|
237
|
+
const curve = Math.max(56, Math.abs(tx - sx) * 0.42);
|
|
238
|
+
const direction = forward ? 1 : -1;
|
|
239
|
+
return `M ${sx} ${sy} C ${sx + curve * direction} ${sy}, ${tx - curve * direction} ${ty}, ${tx} ${ty}`;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function WorkflowCanvas({
|
|
243
|
+
graph,
|
|
244
|
+
selectedNodeKey,
|
|
245
|
+
selectedEdgeIndex,
|
|
246
|
+
connectMode,
|
|
247
|
+
connectFrom,
|
|
248
|
+
readOnly,
|
|
249
|
+
statuses,
|
|
250
|
+
onSelectNode,
|
|
251
|
+
onSelectEdge,
|
|
252
|
+
onConnectNode,
|
|
253
|
+
onPositionsChange,
|
|
254
|
+
onAutoLayout,
|
|
255
|
+
}: WorkflowCanvasProps) {
|
|
256
|
+
const rootRef = useRef<HTMLDivElement>(null);
|
|
257
|
+
const dragRef = useRef<CanvasDrag | null>(null);
|
|
258
|
+
const positionsRef = useRef<Record<string, { x: number; y: number }>>({});
|
|
259
|
+
const [positions, setPositions] = useState<Record<string, { x: number; y: number }>>(() => resolveWorkflowNodePositions(graph.nodes, graph.edges));
|
|
260
|
+
const [pan, setPan] = useState({ x: 42, y: 38 });
|
|
261
|
+
const [zoom, setZoom] = useState(0.9);
|
|
262
|
+
const [snap, setSnap] = useState(true);
|
|
263
|
+
const markerId = `as-wf-arrow-${useId().replace(/:/g, "")}`;
|
|
264
|
+
|
|
265
|
+
useEffect(() => {
|
|
266
|
+
const next = resolveWorkflowNodePositions(graph.nodes, graph.edges);
|
|
267
|
+
positionsRef.current = next;
|
|
268
|
+
setPositions(next);
|
|
269
|
+
}, [graph.id, graph.revision, graph.nodes]);
|
|
270
|
+
|
|
271
|
+
const toWorld = useCallback((clientX: number, clientY: number) => {
|
|
272
|
+
const rect = rootRef.current?.getBoundingClientRect();
|
|
273
|
+
if (!rect) return { x: 0, y: 0 };
|
|
274
|
+
return {
|
|
275
|
+
x: (clientX - rect.left - pan.x) / zoom,
|
|
276
|
+
y: (clientY - rect.top - pan.y) / zoom,
|
|
277
|
+
};
|
|
278
|
+
}, [pan, zoom]);
|
|
279
|
+
|
|
280
|
+
const handlePointerDown = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {
|
|
281
|
+
if ((event.target as HTMLElement).closest("[data-workflow-node]")) return;
|
|
282
|
+
onSelectNode(null);
|
|
283
|
+
onSelectEdge(null);
|
|
284
|
+
rootRef.current?.setPointerCapture?.(event.pointerId);
|
|
285
|
+
dragRef.current = {
|
|
286
|
+
kind: "pan",
|
|
287
|
+
startX: event.clientX,
|
|
288
|
+
startY: event.clientY,
|
|
289
|
+
originX: pan.x,
|
|
290
|
+
originY: pan.y,
|
|
291
|
+
pointerId: event.pointerId,
|
|
292
|
+
};
|
|
293
|
+
}, [onSelectEdge, onSelectNode, pan, readOnly]);
|
|
294
|
+
|
|
295
|
+
const handleNodePointerDown = useCallback((event: ReactPointerEvent<HTMLButtonElement>, nodeKey: string) => {
|
|
296
|
+
event.stopPropagation();
|
|
297
|
+
onSelectEdge(null);
|
|
298
|
+
onSelectNode(nodeKey);
|
|
299
|
+
if (connectMode) return;
|
|
300
|
+
if (readOnly || event.button !== 0) return;
|
|
301
|
+
rootRef.current?.setPointerCapture?.(event.pointerId);
|
|
302
|
+
const world = toWorld(event.clientX, event.clientY);
|
|
303
|
+
const current = positionsRef.current[nodeKey] ?? { x: 0, y: 0 };
|
|
304
|
+
dragRef.current = {
|
|
305
|
+
kind: "node",
|
|
306
|
+
nodeKey,
|
|
307
|
+
offsetX: world.x - current.x,
|
|
308
|
+
offsetY: world.y - current.y,
|
|
309
|
+
pointerId: event.pointerId,
|
|
310
|
+
};
|
|
311
|
+
}, [connectMode, onConnectNode, onSelectEdge, onSelectNode, readOnly, toWorld]);
|
|
312
|
+
|
|
313
|
+
const handlePointerMove = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {
|
|
314
|
+
const drag = dragRef.current;
|
|
315
|
+
if (!drag || drag.pointerId !== event.pointerId) return;
|
|
316
|
+
if (drag.kind === "pan") {
|
|
317
|
+
setPan({
|
|
318
|
+
x: drag.originX + event.clientX - drag.startX,
|
|
319
|
+
y: drag.originY + event.clientY - drag.startY,
|
|
320
|
+
});
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
const world = toWorld(event.clientX, event.clientY);
|
|
324
|
+
let x = world.x - drag.offsetX;
|
|
325
|
+
let y = world.y - drag.offsetY;
|
|
326
|
+
if (snap) {
|
|
327
|
+
x = Math.round(x / WORKFLOW_GRID_SIZE) * WORKFLOW_GRID_SIZE;
|
|
328
|
+
y = Math.round(y / WORKFLOW_GRID_SIZE) * WORKFLOW_GRID_SIZE;
|
|
329
|
+
}
|
|
330
|
+
setPositions((current) => {
|
|
331
|
+
const next = { ...current, [drag.nodeKey]: { x, y } };
|
|
332
|
+
positionsRef.current = next;
|
|
333
|
+
return next;
|
|
334
|
+
});
|
|
335
|
+
}, [snap, toWorld]);
|
|
336
|
+
|
|
337
|
+
const handlePointerUp = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {
|
|
338
|
+
const drag = dragRef.current;
|
|
339
|
+
if (!drag || drag.pointerId !== event.pointerId) return;
|
|
340
|
+
if (drag.kind === "node") onPositionsChange(positionsRef.current);
|
|
341
|
+
dragRef.current = null;
|
|
342
|
+
rootRef.current?.releasePointerCapture?.(event.pointerId);
|
|
343
|
+
}, [onPositionsChange]);
|
|
344
|
+
|
|
345
|
+
const handleWheel = useCallback((event: React.WheelEvent<HTMLDivElement>) => {
|
|
346
|
+
event.preventDefault();
|
|
347
|
+
setZoom((current) => Math.max(0.35, Math.min(1.65, current * (event.deltaY < 0 ? 1.08 : 0.92))));
|
|
348
|
+
}, []);
|
|
349
|
+
|
|
350
|
+
const fitGraph = useCallback(() => {
|
|
351
|
+
const rect = rootRef.current?.getBoundingClientRect();
|
|
352
|
+
const points = Object.values(positionsRef.current);
|
|
353
|
+
if (!rect || !points.length) {
|
|
354
|
+
setPan({ x: 42, y: 38 });
|
|
355
|
+
setZoom(0.9);
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
const minX = Math.min(...points.map((point) => point.x));
|
|
359
|
+
const minY = Math.min(...points.map((point) => point.y));
|
|
360
|
+
const maxX = Math.max(...points.map((point) => point.x + WORKFLOW_NODE_SIZE.width));
|
|
361
|
+
const maxY = Math.max(...points.map((point) => point.y + WORKFLOW_NODE_SIZE.height));
|
|
362
|
+
const graphWidth = Math.max(1, maxX - minX + 96);
|
|
363
|
+
const graphHeight = Math.max(1, maxY - minY + 96);
|
|
364
|
+
const nextZoom = Math.max(0.35, Math.min(1.45, Math.min((rect.width - 48) / graphWidth, (rect.height - 48) / graphHeight)));
|
|
365
|
+
setZoom(nextZoom);
|
|
366
|
+
setPan({
|
|
367
|
+
x: (rect.width - graphWidth * nextZoom) / 2 - (minX - 48) * nextZoom,
|
|
368
|
+
y: (rect.height - graphHeight * nextZoom) / 2 - (minY - 48) * nextZoom,
|
|
369
|
+
});
|
|
370
|
+
}, []);
|
|
371
|
+
|
|
372
|
+
const orderedNodes = useMemo(() => [...graph.nodes].sort((a, b) => {
|
|
373
|
+
const pa = positions[a.nodeKey] ?? { x: 0, y: 0 };
|
|
374
|
+
const pb = positions[b.nodeKey] ?? { x: 0, y: 0 };
|
|
375
|
+
return pa.x - pb.x || pa.y - pb.y || a.nodeKey.localeCompare(b.nodeKey);
|
|
376
|
+
}), [graph.nodes, positions]);
|
|
377
|
+
|
|
378
|
+
const nodeByKey = useMemo(() => new Map(graph.nodes.map((node) => [node.nodeKey, node])), [graph.nodes]);
|
|
379
|
+
|
|
380
|
+
return (
|
|
381
|
+
<section className="as-wf-canvas-shell">
|
|
382
|
+
<div className="as-wf-canvas-toolbar">
|
|
383
|
+
<div className="as-wf-canvas-toolbar__group">
|
|
384
|
+
<button type="button" onClick={() => setZoom((value) => Math.max(0.35, value - 0.1))} aria-label="Zoom out"><ZoomOut size={15} /></button>
|
|
385
|
+
<span>{Math.round(zoom * 100)}%</span>
|
|
386
|
+
<button type="button" onClick={() => setZoom((value) => Math.min(1.65, value + 0.1))} aria-label="Zoom in"><ZoomIn size={15} /></button>
|
|
387
|
+
<button type="button" onClick={fitGraph} aria-label="Fit graph to canvas"><Maximize2 size={15} /></button>
|
|
388
|
+
</div>
|
|
389
|
+
<div className="as-wf-canvas-toolbar__group">
|
|
390
|
+
<button type="button" data-active={snap} aria-pressed={snap} onClick={() => setSnap((value) => !value)} title="Snap nodes to grid"><Grip size={15} /><span>Snap</span></button>
|
|
391
|
+
{!readOnly ? <button type="button" onClick={onAutoLayout} title="Arrange nodes"><Sparkles size={15} /><span>Auto arrange</span></button> : null}
|
|
392
|
+
</div>
|
|
393
|
+
<span className="as-wf-canvas-hint">{connectMode ? (connectFrom ? "Choose a destination node" : "Choose a source node") : "Drag nodes · drag empty space to pan · scroll to zoom"}</span>
|
|
394
|
+
</div>
|
|
395
|
+
|
|
396
|
+
<div
|
|
397
|
+
ref={rootRef}
|
|
398
|
+
className="as-wf-canvas"
|
|
399
|
+
data-connect-mode={connectMode}
|
|
400
|
+
onPointerDown={handlePointerDown}
|
|
401
|
+
onPointerMove={handlePointerMove}
|
|
402
|
+
onPointerUp={handlePointerUp}
|
|
403
|
+
onPointerCancel={handlePointerUp}
|
|
404
|
+
onWheel={handleWheel}
|
|
405
|
+
onClick={(event) => {
|
|
406
|
+
if ((event.target as HTMLElement).dataset.canvasBackground === "true") {
|
|
407
|
+
onSelectNode(null);
|
|
408
|
+
onSelectEdge(null);
|
|
409
|
+
}
|
|
410
|
+
}}
|
|
411
|
+
>
|
|
412
|
+
{graph.nodes.length ? (
|
|
413
|
+
<div className="as-wf-canvas-world" style={{ transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})` }}>
|
|
414
|
+
<svg className="as-wf-edges" width="5000" height="5000" aria-label="Workflow connections">
|
|
415
|
+
<defs>
|
|
416
|
+
<marker id={markerId} markerWidth="8" markerHeight="8" refX="6" refY="3" orient="auto" markerUnits="strokeWidth">
|
|
417
|
+
<path d="M0,0 L0,6 L6,3 z" />
|
|
418
|
+
</marker>
|
|
419
|
+
</defs>
|
|
420
|
+
{graph.edges.map((edge, index) => {
|
|
421
|
+
const from = positions[edge.fromNodeKey];
|
|
422
|
+
const to = positions[edge.toNodeKey];
|
|
423
|
+
if (!from || !to) return null;
|
|
424
|
+
const selected = selectedEdgeIndex === index;
|
|
425
|
+
const label = edge.ui?.label || (edge.conditionType === "always" ? "" : edge.conditionType);
|
|
426
|
+
const x = (from.x + WORKFLOW_NODE_SIZE.width + to.x) / 2;
|
|
427
|
+
const y = (from.y + WORKFLOW_NODE_SIZE.height / 2 + to.y + WORKFLOW_NODE_SIZE.height / 2) / 2 - 8;
|
|
428
|
+
return (
|
|
429
|
+
<g key={workflowEdgeKey(edge, index)} className="as-wf-edge-group" data-selected={selected}>
|
|
430
|
+
<path
|
|
431
|
+
className="as-wf-edge-hit"
|
|
432
|
+
d={edgePath(from, to)}
|
|
433
|
+
onClick={(event) => { event.stopPropagation(); onSelectNode(null); onSelectEdge(index); }}
|
|
434
|
+
/>
|
|
435
|
+
<path className="as-wf-edge-line" d={edgePath(from, to)} markerEnd={`url(#${markerId})`} />
|
|
436
|
+
{label ? <text x={x} y={y} className="as-wf-edge-label">{label}</text> : null}
|
|
437
|
+
</g>
|
|
438
|
+
);
|
|
439
|
+
})}
|
|
440
|
+
</svg>
|
|
441
|
+
{orderedNodes.map((node) => {
|
|
442
|
+
const position = positions[node.nodeKey] ?? { x: 0, y: 0 };
|
|
443
|
+
const Icon = NODE_META[node.kind].Icon;
|
|
444
|
+
const status = statuses[node.nodeKey] ?? "idle";
|
|
445
|
+
return (
|
|
446
|
+
<button
|
|
447
|
+
type="button"
|
|
448
|
+
key={node.nodeKey}
|
|
449
|
+
className="as-wf-node"
|
|
450
|
+
data-workflow-node="true"
|
|
451
|
+
data-kind={node.kind}
|
|
452
|
+
data-selected={selectedNodeKey === node.nodeKey}
|
|
453
|
+
data-connect-source={connectFrom === node.nodeKey}
|
|
454
|
+
data-status={statusTone(status)}
|
|
455
|
+
style={{ left: position.x, top: position.y }}
|
|
456
|
+
onPointerDown={(event) => handleNodePointerDown(event, node.nodeKey)}
|
|
457
|
+
onClick={() => { if (connectMode) onConnectNode(node.nodeKey); else onSelectNode(node.nodeKey); }}
|
|
458
|
+
aria-pressed={selectedNodeKey === node.nodeKey}
|
|
459
|
+
aria-label={`${node.title}, ${NODE_META[node.kind].label}`}
|
|
460
|
+
>
|
|
461
|
+
<span className="as-wf-node__icon"><Icon size={18} /></span>
|
|
462
|
+
<span className="as-wf-node__body">
|
|
463
|
+
<strong>{node.title}</strong>
|
|
464
|
+
<small>{nodeSubtitle(node)}</small>
|
|
465
|
+
<span className="as-wf-node__meta">
|
|
466
|
+
<span>{NODE_META[node.kind].label}</span>
|
|
467
|
+
{node.kind === "action" && node.resolutionMode ? <span>{node.resolutionMode}</span> : null}
|
|
468
|
+
</span>
|
|
469
|
+
{status !== "idle" ? <span className={`as-wf-node__status as-wf-node__status--${statusTone(status)}`}>{displayStatus(status)}</span> : null}
|
|
470
|
+
</span>
|
|
471
|
+
<span className="as-wf-node__ports" aria-hidden="true"><i /><i /></span>
|
|
472
|
+
</button>
|
|
473
|
+
);
|
|
474
|
+
})}
|
|
475
|
+
</div>
|
|
476
|
+
) : (
|
|
477
|
+
<div className="as-wf-canvas-empty" data-canvas-background="true">
|
|
478
|
+
<div><WorkflowIcon size={28} /><strong>Your workflow starts here</strong><span>Add a node to begin shaping the graph.</span></div>
|
|
479
|
+
</div>
|
|
480
|
+
)}
|
|
481
|
+
</div>
|
|
482
|
+
|
|
483
|
+
<div className="as-wf-mobile-flow">
|
|
484
|
+
{orderedNodes.map((node, index) => {
|
|
485
|
+
const Icon = NODE_META[node.kind].Icon;
|
|
486
|
+
const status = statuses[node.nodeKey] ?? "idle";
|
|
487
|
+
const selected = selectedNodeKey === node.nodeKey;
|
|
488
|
+
const outgoing = graph.edges.filter((edge) => edge.fromNodeKey === node.nodeKey);
|
|
489
|
+
return (
|
|
490
|
+
<div className="as-wf-mobile-flow__item" key={node.nodeKey}>
|
|
491
|
+
<button
|
|
492
|
+
type="button"
|
|
493
|
+
className="as-wf-mobile-node"
|
|
494
|
+
data-selected={selected}
|
|
495
|
+
onClick={() => {
|
|
496
|
+
onSelectEdge(null);
|
|
497
|
+
if (connectMode) onConnectNode(node.nodeKey);
|
|
498
|
+
else onSelectNode(node.nodeKey);
|
|
499
|
+
}}
|
|
500
|
+
>
|
|
501
|
+
<span className="as-wf-mobile-node__icon" data-kind={node.kind}><Icon size={17} /></span>
|
|
502
|
+
<span className="as-wf-mobile-node__body"><strong>{index + 1}. {node.title}</strong><small>{nodeSubtitle(node)}</small></span>
|
|
503
|
+
<span className={`as-wf-status as-wf-status--${statusTone(status)}`}>{displayStatus(status || "idle")}</span>
|
|
504
|
+
</button>
|
|
505
|
+
{outgoing.length ? <div className="as-wf-mobile-branches"><ArrowDownRight size={14} /> {outgoing.map((edge) => `${nodeByKey.get(edge.toNodeKey)?.title ?? edge.toNodeKey}${edge.ui?.label ? ` · ${edge.ui.label}` : ""}`).join(" / ")}</div> : null}
|
|
506
|
+
</div>
|
|
507
|
+
);
|
|
508
|
+
})}
|
|
509
|
+
</div>
|
|
510
|
+
</section>
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
function WorkflowInspector({
|
|
515
|
+
graph,
|
|
516
|
+
selectedNode,
|
|
517
|
+
selectedEdge,
|
|
518
|
+
selectedEdgeIndex,
|
|
519
|
+
canEdit,
|
|
520
|
+
capabilities,
|
|
521
|
+
tools,
|
|
522
|
+
agentProfiles,
|
|
523
|
+
onGraphChange,
|
|
524
|
+
onDeleteNode,
|
|
525
|
+
onDeleteEdge,
|
|
526
|
+
}: {
|
|
527
|
+
graph: WorkflowGraph;
|
|
528
|
+
selectedNode: WorkflowGraphNode | null;
|
|
529
|
+
selectedEdge: WorkflowGraphEdge | null;
|
|
530
|
+
selectedEdgeIndex: number | null;
|
|
531
|
+
canEdit: boolean;
|
|
532
|
+
capabilities: WorkflowCapabilityOption[];
|
|
533
|
+
tools: WorkflowToolOption[];
|
|
534
|
+
agentProfiles: WorkflowAgentProfileOption[];
|
|
535
|
+
onGraphChange: (next: WorkflowGraph) => void;
|
|
536
|
+
onDeleteNode: (nodeKey: string) => void;
|
|
537
|
+
onDeleteEdge: (index: number) => void;
|
|
538
|
+
}) {
|
|
539
|
+
if (selectedNode) {
|
|
540
|
+
const patch = (next: Partial<WorkflowGraphNode>) => onGraphChange(updateNodeInGraph(graph, selectedNode.nodeKey, next));
|
|
541
|
+
const patchConfig = (key: string, value: unknown) => patch({
|
|
542
|
+
config: { ...(selectedNode.config ?? {}), [key]: value },
|
|
543
|
+
});
|
|
544
|
+
return (
|
|
545
|
+
<div className="as-wf-inspector-content">
|
|
546
|
+
<div className="as-wf-inspector-identity">
|
|
547
|
+
<span className={`as-wf-kind-icon as-wf-kind-icon--${selectedNode.kind}`}><span>{NODE_META[selectedNode.kind].label}</span></span>
|
|
548
|
+
<code>{selectedNode.nodeKey}</code>
|
|
549
|
+
</div>
|
|
550
|
+
<label className="as-wf-field"><span>Node name</span><input value={selectedNode.title} disabled={!canEdit} onChange={(event) => patch({ title: event.target.value })} /></label>
|
|
551
|
+
<label className="as-wf-field"><span>Description</span><textarea rows={3} value={selectedNode.description ?? ""} disabled={!canEdit} onChange={(event) => patch({ description: event.target.value })} placeholder="What does this step do?" /></label>
|
|
552
|
+
|
|
553
|
+
{selectedNode.kind === "action" ? (
|
|
554
|
+
<>
|
|
555
|
+
<section className="as-wf-inspector-section">
|
|
556
|
+
<h4>Action resolution</h4>
|
|
557
|
+
<label className="as-wf-field"><span>Resolution</span><select value={selectedNode.resolutionMode ?? ""} disabled={!canEdit} onChange={(event) => patch({ resolutionMode: event.target.value as "routed" | "pinned", capabilityKey: null, pinnedToolId: null })}><option value="" disabled>Choose resolution</option><option value="routed">Routed capability</option><option value="pinned">Pinned tool</option></select></label>
|
|
558
|
+
{selectedNode.resolutionMode === "routed" ? (
|
|
559
|
+
capabilities.length ? <label className="as-wf-field"><span>Capability</span><select value={selectedNode.capabilityKey ?? ""} disabled={!canEdit} onChange={(event) => patch({ capabilityKey: event.target.value || null })}><option value="">Choose a capability</option>{capabilities.map((option) => <option key={option.key} value={option.key} disabled={option.ready === false}>{option.label}{option.ready === false ? " · unavailable" : ""}</option>)}</select><small>Only capabilities supplied by the host are selectable.</small></label> : <div className="as-wf-notice"><AlertCircle size={15} /> No capability options were supplied by the host.</div>
|
|
560
|
+
) : null}
|
|
561
|
+
{selectedNode.resolutionMode === "pinned" ? (
|
|
562
|
+
tools.length ? <label className="as-wf-field"><span>Tool</span><select value={selectedNode.pinnedToolId ?? ""} disabled={!canEdit} onChange={(event) => {
|
|
563
|
+
const option = tools.find((candidate) => candidate.id === event.target.value);
|
|
564
|
+
patch({ pinnedToolId: event.target.value || null, capabilityKey: option?.capabilityKey ?? null });
|
|
565
|
+
}}><option value="">Choose a tool</option>{tools.map((option) => <option key={option.id} value={option.id} disabled={option.ready === false || !option.capabilityKey}>{option.label}{option.ready === false || !option.capabilityKey ? " · unavailable" : ""}</option>)}</select><small>The pinned tool must be registered under a capability available to this account.</small></label> : <div className="as-wf-notice"><AlertCircle size={15} /> No tool options were supplied by the host.</div>
|
|
566
|
+
) : null}
|
|
567
|
+
</section>
|
|
568
|
+
<section className="as-wf-inspector-section">
|
|
569
|
+
<h4>Authorized operation</h4>
|
|
570
|
+
<label className="as-wf-field"><span>Operation key</span><input value={String(selectedNode.config?.authorized_operation ?? selectedNode.config?.operation ?? "")} disabled={!canEdit} onChange={(event) => patchConfig("authorized_operation", event.target.value)} placeholder="e.g. campaign.publish" /></label>
|
|
571
|
+
<label className="as-wf-field"><span>Resource type</span><input value={String(selectedNode.config?.resource_type ?? "")} disabled={!canEdit} onChange={(event) => patchConfig("resource_type", event.target.value)} placeholder="e.g. marketing.campaign" /></label>
|
|
572
|
+
<label className="as-wf-field"><span>Resource ID path</span><input value={String(selectedNode.config?.resource_id_path ?? "")} disabled={!canEdit} onChange={(event) => patchConfig("resource_id_path", event.target.value)} placeholder="e.g. campaign.id" /></label>
|
|
573
|
+
<label className="as-wf-field"><span>Resource revision path</span><input value={String(selectedNode.config?.resource_revision_path ?? "")} disabled={!canEdit} onChange={(event) => patchConfig("resource_revision_path", event.target.value)} placeholder="e.g. campaign.revision" /></label>
|
|
574
|
+
<label className="as-wf-checkbox"><input type="checkbox" checked={selectedNode.config?.requires_approval === true} disabled={!canEdit} onChange={(event) => patchConfig("requires_approval", event.target.checked)} /><span>Require human approval before this action</span></label>
|
|
575
|
+
<small>The approval gate binds to this operation, capability, resource ID and exact revision. The action handler must enforce the expected revision.</small>
|
|
576
|
+
</section>
|
|
577
|
+
</>
|
|
578
|
+
) : null}
|
|
579
|
+
|
|
580
|
+
{selectedNode.kind === "approval" ? (
|
|
581
|
+
<section className="as-wf-inspector-section">
|
|
582
|
+
<h4>Approval authority</h4>
|
|
583
|
+
<label className="as-wf-field"><span>Action being approved</span><select value={String(selectedNode.config?.target_node_key ?? "")} disabled={!canEdit} onChange={(event) => patchConfig("target_node_key", event.target.value)}><option value="">Choose a connected action</option>{graph.nodes.filter((candidate) => candidate.kind === "action").map((candidate) => <option key={candidate.nodeKey} value={candidate.nodeKey}>{candidate.title} · {candidate.nodeKey}</option>)}</select></label>
|
|
584
|
+
<label className="as-wf-field"><span>Approval summary</span><input value={String(selectedNode.config?.action_summary ?? "")} disabled={!canEdit} onChange={(event) => patchConfig("action_summary", event.target.value)} placeholder="What will this approval authorize?" /></label>
|
|
585
|
+
<label className="as-wf-field"><span>Risk level</span><select value={String(selectedNode.config?.risk_level ?? "high")} disabled={!canEdit} onChange={(event) => patchConfig("risk_level", event.target.value)}><option value="low">Low</option><option value="medium">Medium</option><option value="high">High</option><option value="critical">Critical</option></select></label>
|
|
586
|
+
<label className="as-wf-field"><span>Approval expires after <small>(seconds)</small></span><input type="number" min="60" max="86400" step="60" value={Number(selectedNode.config?.ttl_sec ?? 3600)} disabled={!canEdit} onChange={(event) => patchConfig("ttl_sec", Math.max(60, Math.min(86400, Number(event.target.value) || 3600)))} /></label>
|
|
587
|
+
<small>This gate pauses the durable run. It cannot authorize a different tool, operation, resource or revision.</small>
|
|
588
|
+
</section>
|
|
589
|
+
) : null}
|
|
590
|
+
|
|
591
|
+
{selectedNode.kind === "agent" ? (
|
|
592
|
+
<section className="as-wf-inspector-section">
|
|
593
|
+
<h4>Agent profile</h4>
|
|
594
|
+
{agentProfiles.length ? <label className="as-wf-field"><span>Profile</span><select value={selectedNode.agentProfileId ?? ""} disabled={!canEdit} onChange={(event) => patch({ agentProfileId: event.target.value || null })}><option value="">Select an agent profile</option>{agentProfiles.map((option) => <option key={option.id} value={option.id}>{option.label}</option>)}</select></label> : <div className="as-wf-notice">No agent profiles were supplied by the host.</div>}
|
|
595
|
+
</section>
|
|
596
|
+
) : null}
|
|
597
|
+
|
|
598
|
+
<section className="as-wf-inspector-section">
|
|
599
|
+
<h4>Execution limits</h4>
|
|
600
|
+
<label className="as-wf-field"><span>Timeout <small>(milliseconds)</small></span><input type="number" min="1" step="1000" value={selectedNode.timeoutMs ?? ""} disabled={!canEdit} placeholder="No node-specific limit" onChange={(event) => patch({ timeoutMs: event.target.value ? Math.max(1, Number(event.target.value)) : null })} /></label>
|
|
601
|
+
</section>
|
|
602
|
+
{canEdit ? <button type="button" className="as-wf-danger-button" onClick={() => onDeleteNode(selectedNode.nodeKey)}><Trash2 size={15} /> Remove node</button> : null}
|
|
603
|
+
</div>
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
if (selectedEdge && selectedEdgeIndex != null) {
|
|
608
|
+
const patch = (next: Partial<WorkflowGraphEdge>) => onGraphChange(updateEdgeInGraph(graph, selectedEdgeIndex, next));
|
|
609
|
+
return (
|
|
610
|
+
<div className="as-wf-inspector-content">
|
|
611
|
+
<div className="as-wf-inspector-heading"><strong>Connection</strong><code>{selectedEdge.fromNodeKey} → {selectedEdge.toNodeKey}</code></div>
|
|
612
|
+
<label className="as-wf-field"><span>Condition type</span><select value={selectedEdge.conditionType} disabled={!canEdit} onChange={(event) => patch({ conditionType: event.target.value as WorkflowGraphEdge["conditionType"] })}><option value="always">Always</option><option value="status">Status</option><option value="field">Field</option><option value="branch">Branch</option></select></label>
|
|
613
|
+
<label className="as-wf-field"><span>Priority</span><input type="number" value={selectedEdge.priority ?? 0} disabled={!canEdit} onChange={(event) => patch({ priority: Number(event.target.value) || 0 })} /></label>
|
|
614
|
+
<label className="as-wf-field"><span>Connector label</span><input value={selectedEdge.ui?.label ?? ""} disabled={!canEdit} onChange={(event) => patch({ ui: { ...selectedEdge.ui, label: event.target.value } })} placeholder="Optional label" /></label>
|
|
615
|
+
<label className="as-wf-checkbox"><input type="checkbox" checked={Boolean(selectedEdge.isFallback)} disabled={!canEdit} onChange={(event) => patch({ isFallback: event.target.checked })} /><span>Fallback connection</span></label>
|
|
616
|
+
{canEdit ? <button type="button" className="as-wf-danger-button" onClick={() => onDeleteEdge(selectedEdgeIndex)}><Trash2 size={15} /> Remove connection</button> : null}
|
|
617
|
+
</div>
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
return (
|
|
622
|
+
<div className="as-wf-inspector-content">
|
|
623
|
+
<div className="as-wf-inspector-heading"><strong>Workflow settings</strong><span>Revision {graph.revision}</span></div>
|
|
624
|
+
<label className="as-wf-field"><span>Name</span><input value={graph.displayName} disabled={!canEdit} onChange={(event) => onGraphChange({ ...graph, displayName: event.target.value })} /></label>
|
|
625
|
+
<label className="as-wf-field"><span>Description</span><textarea rows={4} value={graph.description ?? ""} disabled={!canEdit} onChange={(event) => onGraphChange({ ...graph, description: event.target.value })} placeholder="What should this workflow accomplish?" /></label>
|
|
626
|
+
<label className="as-wf-field"><span>Entry node</span><select value={graph.entryNodeKey ?? ""} disabled={!canEdit} onChange={(event) => onGraphChange({ ...graph, entryNodeKey: event.target.value || null })}><option value="">Choose an entry node</option>{graph.nodes.map((node) => <option key={node.nodeKey} value={node.nodeKey}>{node.title}</option>)}</select><small>Drafts may omit an entry node; activation requires one.</small></label>
|
|
627
|
+
<div className="as-wf-settings-facts"><div><span>Scope</span><strong>{graph.scopeType === "account" ? "Account" : "Platform"}</strong></div><div><span>Lifecycle</span><strong>{graph.lifecycle}</strong></div><div><span>Nodes</span><strong>{graph.nodes.length}</strong></div><div><span>Connections</span><strong>{graph.edges.length}</strong></div></div>
|
|
628
|
+
<p className="as-wf-inspector-footnote">Workflow identity, revisioning and persistence remain host-owned.</p>
|
|
629
|
+
</div>
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
export function WorkflowStudio({
|
|
634
|
+
workflow,
|
|
635
|
+
host,
|
|
636
|
+
loading = false,
|
|
637
|
+
error = null,
|
|
638
|
+
readOnly = false,
|
|
639
|
+
capabilities = [],
|
|
640
|
+
tools = [],
|
|
641
|
+
agentProfiles = [],
|
|
642
|
+
run = null,
|
|
643
|
+
runSteps = [],
|
|
644
|
+
onChange,
|
|
645
|
+
onRetry,
|
|
646
|
+
onClose,
|
|
647
|
+
}: WorkflowStudioProps) {
|
|
648
|
+
const [selectedNodeKey, setSelectedNodeKey] = useState<string | null>(null);
|
|
649
|
+
const [selectedEdgeIndex, setSelectedEdgeIndex] = useState<number | null>(null);
|
|
650
|
+
const [connectMode, setConnectMode] = useState(false);
|
|
651
|
+
const [connectFrom, setConnectFrom] = useState<string | null>(null);
|
|
652
|
+
const [paletteOpen, setPaletteOpen] = useState(false);
|
|
653
|
+
const [inspectorOpen, setInspectorOpen] = useState(true);
|
|
654
|
+
const [validation, setValidation] = useState<WorkflowValidationResult | null>(null);
|
|
655
|
+
const [validationHostChecked, setValidationHostChecked] = useState(false);
|
|
656
|
+
const [latestRun, setLatestRun] = useState<WorkflowRunSummary | null>(run);
|
|
657
|
+
const [busy, setBusy] = useState<"save" | "validate" | "activate" | "run" | null>(null);
|
|
658
|
+
const [actionError, setActionError] = useState<string | null>(null);
|
|
659
|
+
const [savedSignature, setSavedSignature] = useState("");
|
|
660
|
+
|
|
661
|
+
useEffect(() => {
|
|
662
|
+
setSelectedNodeKey(null);
|
|
663
|
+
setSelectedEdgeIndex(null);
|
|
664
|
+
setConnectMode(false);
|
|
665
|
+
setConnectFrom(null);
|
|
666
|
+
setValidation(null);
|
|
667
|
+
setLatestRun(run);
|
|
668
|
+
setSavedSignature(workflow ? JSON.stringify(workflow) : "");
|
|
669
|
+
}, [workflow?.id, workflow?.revision]);
|
|
670
|
+
|
|
671
|
+
useEffect(() => {
|
|
672
|
+
if (run) setLatestRun(run);
|
|
673
|
+
}, [run]);
|
|
674
|
+
|
|
675
|
+
const canEdit = Boolean(!readOnly && workflow && onChange && host?.saveDraft);
|
|
676
|
+
const dirty = Boolean(workflow && savedSignature && JSON.stringify(workflow) !== savedSignature);
|
|
677
|
+
const selectedNode = workflow?.nodes.find((node) => node.nodeKey === selectedNodeKey) ?? null;
|
|
678
|
+
const selectedEdge = workflow && selectedEdgeIndex != null ? workflow.edges[selectedEdgeIndex] ?? null : null;
|
|
679
|
+
const statuses = useMemo(() => nodeStatusByKey(runSteps), [runSteps]);
|
|
680
|
+
|
|
681
|
+
const emitChange = useCallback((next: WorkflowGraph) => {
|
|
682
|
+
if (!canEdit || !onChange) return;
|
|
683
|
+
onChange(next);
|
|
684
|
+
setValidation(null);
|
|
685
|
+
setActionError(null);
|
|
686
|
+
}, [canEdit, onChange]);
|
|
687
|
+
|
|
688
|
+
const addNode = useCallback((kind: WorkflowNodeKind) => {
|
|
689
|
+
if (!workflow || !canEdit) return;
|
|
690
|
+
if (kind === "action" && !capabilities.length && !tools.length) return;
|
|
691
|
+
const node = newNode(kind, workflow);
|
|
692
|
+
emitChange({ ...workflow, nodes: [...workflow.nodes, node] });
|
|
693
|
+
setSelectedNodeKey(node.nodeKey);
|
|
694
|
+
setSelectedEdgeIndex(null);
|
|
695
|
+
setPaletteOpen(false);
|
|
696
|
+
}, [capabilities.length, canEdit, emitChange, tools.length, workflow]);
|
|
697
|
+
|
|
698
|
+
const deleteNode = useCallback((nodeKey: string) => {
|
|
699
|
+
if (!workflow || !canEdit) return;
|
|
700
|
+
emitChange({
|
|
701
|
+
...workflow,
|
|
702
|
+
nodes: workflow.nodes.filter((node) => node.nodeKey !== nodeKey),
|
|
703
|
+
edges: workflow.edges.filter((edge) => edge.fromNodeKey !== nodeKey && edge.toNodeKey !== nodeKey),
|
|
704
|
+
entryNodeKey: workflow.entryNodeKey === nodeKey ? null : workflow.entryNodeKey,
|
|
705
|
+
});
|
|
706
|
+
setSelectedNodeKey(null);
|
|
707
|
+
}, [canEdit, emitChange, workflow]);
|
|
708
|
+
|
|
709
|
+
const deleteEdge = useCallback((index: number) => {
|
|
710
|
+
if (!workflow || !canEdit) return;
|
|
711
|
+
emitChange({ ...workflow, edges: workflow.edges.filter((_, edgeIndex) => edgeIndex !== index) });
|
|
712
|
+
setSelectedEdgeIndex(null);
|
|
713
|
+
}, [canEdit, emitChange, workflow]);
|
|
714
|
+
|
|
715
|
+
const connectNode = useCallback((nodeKey: string) => {
|
|
716
|
+
if (!workflow || !canEdit) return;
|
|
717
|
+
if (!connectFrom) {
|
|
718
|
+
setConnectFrom(nodeKey);
|
|
719
|
+
setSelectedNodeKey(nodeKey);
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
if (connectFrom === nodeKey) {
|
|
723
|
+
setConnectFrom(null);
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
const duplicate = workflow.edges.some((edge) => edge.fromNodeKey === connectFrom && edge.toNodeKey === nodeKey && edge.conditionType === "always" && (edge.priority ?? 0) === 0);
|
|
727
|
+
if (!duplicate) {
|
|
728
|
+
emitChange({
|
|
729
|
+
...workflow,
|
|
730
|
+
edges: [...workflow.edges, {
|
|
731
|
+
fromNodeKey: connectFrom,
|
|
732
|
+
toNodeKey: nodeKey,
|
|
733
|
+
conditionType: "always",
|
|
734
|
+
priority: 0,
|
|
735
|
+
isFallback: false,
|
|
736
|
+
ui: {},
|
|
737
|
+
}],
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
setConnectFrom(null);
|
|
741
|
+
setConnectMode(false);
|
|
742
|
+
setSelectedNodeKey(null);
|
|
743
|
+
}, [canEdit, connectFrom, emitChange, workflow]);
|
|
744
|
+
|
|
745
|
+
const updatePositions = useCallback((positions: Record<string, { x: number; y: number }>) => {
|
|
746
|
+
if (!workflow || !canEdit) return;
|
|
747
|
+
emitChange({
|
|
748
|
+
...workflow,
|
|
749
|
+
nodes: workflow.nodes.map((node) => ({
|
|
750
|
+
...node,
|
|
751
|
+
ui: { ...node.ui, position: positions[node.nodeKey] ?? node.ui?.position },
|
|
752
|
+
})),
|
|
753
|
+
});
|
|
754
|
+
}, [canEdit, emitChange, workflow]);
|
|
755
|
+
|
|
756
|
+
const autoLayout = useCallback(() => {
|
|
757
|
+
if (!workflow || !canEdit) return;
|
|
758
|
+
updatePositions(autoLayoutWorkflowNodes(workflow.nodes, workflow.edges));
|
|
759
|
+
}, [canEdit, updatePositions, workflow]);
|
|
760
|
+
|
|
761
|
+
const handleSave = useCallback(async () => {
|
|
762
|
+
if (!workflow || !host?.saveDraft || !canEdit) return;
|
|
763
|
+
setBusy("save");
|
|
764
|
+
setActionError(null);
|
|
765
|
+
try {
|
|
766
|
+
const saved = await host.saveDraft(workflow);
|
|
767
|
+
onChange?.(saved);
|
|
768
|
+
setSavedSignature(JSON.stringify(saved));
|
|
769
|
+
} catch (cause) {
|
|
770
|
+
setActionError(cause instanceof Error ? cause.message : "Could not save this workflow draft.");
|
|
771
|
+
} finally {
|
|
772
|
+
setBusy(null);
|
|
773
|
+
}
|
|
774
|
+
}, [canEdit, host, onChange, workflow]);
|
|
775
|
+
|
|
776
|
+
const handleValidate = useCallback(async () => {
|
|
777
|
+
if (!workflow) return;
|
|
778
|
+
setBusy("validate");
|
|
779
|
+
setActionError(null);
|
|
780
|
+
const local = validateWorkflowGraph(workflow);
|
|
781
|
+
setValidationHostChecked(false);
|
|
782
|
+
try {
|
|
783
|
+
if (host?.validate) {
|
|
784
|
+
const remote = await host.validate(workflow);
|
|
785
|
+
setValidation({
|
|
786
|
+
ok: local.ok && remote.ok,
|
|
787
|
+
issues: [...local.issues, ...remote.issues],
|
|
788
|
+
receiptId: remote.receiptId,
|
|
789
|
+
});
|
|
790
|
+
setValidationHostChecked(true);
|
|
791
|
+
} else {
|
|
792
|
+
setValidation(local);
|
|
793
|
+
}
|
|
794
|
+
} catch (cause) {
|
|
795
|
+
setValidation(local);
|
|
796
|
+
setActionError(cause instanceof Error ? cause.message : "Host validation could not be completed.");
|
|
797
|
+
} finally {
|
|
798
|
+
setBusy(null);
|
|
799
|
+
}
|
|
800
|
+
}, [host, workflow]);
|
|
801
|
+
|
|
802
|
+
const handleActivate = useCallback(async () => {
|
|
803
|
+
if (!workflow || !host?.activate) return;
|
|
804
|
+
const local = validateWorkflowGraph(workflow, { forActivation: true });
|
|
805
|
+
setValidation(local);
|
|
806
|
+
setValidationHostChecked(false);
|
|
807
|
+
if (!local.ok) return;
|
|
808
|
+
setBusy("activate");
|
|
809
|
+
setActionError(null);
|
|
810
|
+
try {
|
|
811
|
+
const activated = await host.activate(workflow);
|
|
812
|
+
onChange?.(activated);
|
|
813
|
+
setSavedSignature(JSON.stringify(activated));
|
|
814
|
+
} catch (cause) {
|
|
815
|
+
setActionError(cause instanceof Error ? cause.message : "The host could not activate this workflow.");
|
|
816
|
+
} finally {
|
|
817
|
+
setBusy(null);
|
|
818
|
+
}
|
|
819
|
+
}, [host, onChange, workflow]);
|
|
820
|
+
|
|
821
|
+
const handleRun = useCallback(async () => {
|
|
822
|
+
if (!workflow || !host?.run || workflow.lifecycle !== "active") return;
|
|
823
|
+
setBusy("run");
|
|
824
|
+
setActionError(null);
|
|
825
|
+
try {
|
|
826
|
+
const result = await host.run(workflow);
|
|
827
|
+
setLatestRun(result);
|
|
828
|
+
} catch (cause) {
|
|
829
|
+
setActionError(cause instanceof Error ? cause.message : "The host could not start this workflow.");
|
|
830
|
+
} finally {
|
|
831
|
+
setBusy(null);
|
|
832
|
+
}
|
|
833
|
+
}, [host, workflow]);
|
|
834
|
+
|
|
835
|
+
if (loading) {
|
|
836
|
+
return <div className="as-workflow-studio as-workflow-studio--loading"><div className="as-wf-skeleton as-wf-skeleton--header" /><div className="as-wf-skeleton as-wf-skeleton--body" /><span>Loading workflow…</span></div>;
|
|
837
|
+
}
|
|
838
|
+
if (error) {
|
|
839
|
+
return <div className="as-workflow-studio as-workflow-studio--message"><AlertCircle size={22} /><strong>Workflow could not be loaded</strong><p>{error}</p>{onRetry ? <button type="button" className="as-wf-button as-wf-button--primary" onClick={onRetry}><RefreshCw size={15} /> Try again</button> : null}</div>;
|
|
840
|
+
}
|
|
841
|
+
if (!workflow) {
|
|
842
|
+
return <div className="as-workflow-studio as-workflow-studio--message"><WorkflowIcon size={24} /><strong>No workflow selected</strong><p>Choose a workflow from its host-provided library.</p></div>;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
const canActivate = Boolean(host?.activate && workflow.lifecycle === "draft");
|
|
846
|
+
const canRun = Boolean(host?.run && workflow.lifecycle === "active");
|
|
847
|
+
const issueCount = validation?.issues.length ?? 0;
|
|
848
|
+
|
|
849
|
+
return (
|
|
850
|
+
<div className="as-workflow-studio">
|
|
851
|
+
<header className="as-wf-header">
|
|
852
|
+
<div className="as-wf-header__identity">
|
|
853
|
+
{onClose ? <button type="button" className="as-wf-icon-button" onClick={onClose} aria-label="Close workflow editor"><X size={17} /></button> : null}
|
|
854
|
+
<div className="as-wf-header__title">
|
|
855
|
+
<div><strong>{workflow.displayName}</strong><span className={`as-wf-status as-wf-status--${workflow.lifecycle}`}>{workflow.lifecycle}</span></div>
|
|
856
|
+
<p><code>{workflow.workflowKey}</code><span>Revision {workflow.revision}</span><span>{workflow.scopeType === "account" ? "Account workflow" : "Platform workflow"}</span></p>
|
|
857
|
+
</div>
|
|
858
|
+
</div>
|
|
859
|
+
<div className="as-wf-header__actions">
|
|
860
|
+
<button type="button" className="as-wf-button" onClick={() => void handleValidate()} disabled={busy !== null}><CheckCircle2 size={15} />{host?.validate ? "Validate" : "Check structure"}</button>
|
|
861
|
+
{canActivate ? <button type="button" className="as-wf-button" onClick={() => void handleActivate()} disabled={busy !== null || !validateWorkflowGraph(workflow, { forActivation: true }).ok}><Check size={15} />Activate</button> : null}
|
|
862
|
+
{canRun ? <button type="button" className="as-wf-button as-wf-button--primary" onClick={() => void handleRun()} disabled={busy !== null}><Play size={15} />{busy === "run" ? "Starting…" : "Run"}</button> : null}
|
|
863
|
+
{canEdit ? <button type="button" className="as-wf-button as-wf-button--primary" onClick={() => void handleSave()} disabled={busy !== null || !dirty}><Save size={15} />{busy === "save" ? "Saving…" : dirty ? "Save draft" : "Saved"}</button> : <span className="as-wf-readonly"><ShieldCheck size={14} />View only</span>}
|
|
864
|
+
</div>
|
|
865
|
+
</header>
|
|
866
|
+
|
|
867
|
+
{actionError ? <div className="as-wf-action-error" role="alert"><AlertCircle size={15} />{actionError}<button type="button" onClick={() => setActionError(null)} aria-label="Dismiss error"><X size={14} /></button></div> : null}
|
|
868
|
+
|
|
869
|
+
<div className="as-wf-studio-body">
|
|
870
|
+
<section className="as-wf-editor-main">
|
|
871
|
+
<div className="as-wf-editor-toolbar">
|
|
872
|
+
<div className="as-wf-editor-toolbar__left">
|
|
873
|
+
{canEdit ? (
|
|
874
|
+
<div className="as-wf-add-wrap">
|
|
875
|
+
<button type="button" className="as-wf-button" aria-expanded={paletteOpen} onClick={() => setPaletteOpen((value) => !value)}><Plus size={15} />Add node<ChevronDown size={13} /></button>
|
|
876
|
+
{paletteOpen ? <div className="as-wf-node-menu" role="menu">{NODE_KINDS.map((kind) => {
|
|
877
|
+
const Icon = NODE_META[kind].Icon;
|
|
878
|
+
const disabled = kind === "action" && !capabilities.length && !tools.length;
|
|
879
|
+
return <button type="button" key={kind} role="menuitem" disabled={disabled} onClick={() => addNode(kind)}><span className={`as-wf-node-menu__icon as-wf-node-menu__icon--${kind}`}><Icon size={16} /></span><span><strong>{NODE_META[kind].label}</strong><small>{disabled ? "No capability or tool catalog supplied" : NODE_META[kind].description}</small></span><Plus size={14} /></button>;
|
|
880
|
+
})}</div> : null}
|
|
881
|
+
</div>
|
|
882
|
+
) : null}
|
|
883
|
+
<button type="button" className={`as-wf-button${connectMode ? " as-wf-button--selected" : ""}`} disabled={!canEdit || workflow.nodes.length < 2} aria-pressed={connectMode} onClick={() => { setConnectMode((value) => !value); setConnectFrom(null); setSelectedNodeKey(null); setSelectedEdgeIndex(null); }}><GitBranch size={15} />{connectMode ? "Cancel connection" : "Connect nodes"}</button>
|
|
884
|
+
{connectMode && connectFrom ? <span className="as-wf-connect-hint">From {connectFrom}</span> : null}
|
|
885
|
+
</div>
|
|
886
|
+
<div className="as-wf-editor-toolbar__right">
|
|
887
|
+
<span>{workflow.nodes.length} nodes</span><span>{workflow.edges.length} connections</span>
|
|
888
|
+
<button type="button" className="as-wf-icon-button" onClick={() => setInspectorOpen((value) => !value)} aria-label={inspectorOpen ? "Hide inspector" : "Show inspector"}>{inspectorOpen ? <PanelRightClose size={16} /> : <PanelRightOpen size={16} />}</button>
|
|
889
|
+
</div>
|
|
890
|
+
</div>
|
|
891
|
+
|
|
892
|
+
<WorkflowCanvas
|
|
893
|
+
graph={workflow}
|
|
894
|
+
selectedNodeKey={selectedNodeKey}
|
|
895
|
+
selectedEdgeIndex={selectedEdgeIndex}
|
|
896
|
+
connectMode={connectMode}
|
|
897
|
+
connectFrom={connectFrom}
|
|
898
|
+
readOnly={!canEdit}
|
|
899
|
+
statuses={statuses}
|
|
900
|
+
onSelectNode={(key) => { setSelectedNodeKey(key); if (key) setSelectedEdgeIndex(null); }}
|
|
901
|
+
onSelectEdge={(index) => { setSelectedEdgeIndex(index); if (index != null) setSelectedNodeKey(null); }}
|
|
902
|
+
onConnectNode={connectNode}
|
|
903
|
+
onPositionsChange={updatePositions}
|
|
904
|
+
onAutoLayout={autoLayout}
|
|
905
|
+
/>
|
|
906
|
+
|
|
907
|
+
{validation ? <ValidationPanel result={validation} hostChecked={validationHostChecked} /> : null}
|
|
908
|
+
{latestRun ? <RunPanel run={latestRun} steps={runSteps} /> : null}
|
|
909
|
+
</section>
|
|
910
|
+
|
|
911
|
+
{inspectorOpen ? (
|
|
912
|
+
<aside className="as-wf-inspector">
|
|
913
|
+
<div className="as-wf-inspector-header"><strong>{selectedNode ? "Node properties" : selectedEdge ? "Connection properties" : "Properties"}</strong><span>{selectedNode ? NODE_META[selectedNode.kind].label : selectedEdge ? "Edge" : "Workflow"}</span></div>
|
|
914
|
+
<WorkflowInspector
|
|
915
|
+
graph={workflow}
|
|
916
|
+
selectedNode={selectedNode}
|
|
917
|
+
selectedEdge={selectedEdge}
|
|
918
|
+
selectedEdgeIndex={selectedEdgeIndex}
|
|
919
|
+
canEdit={canEdit}
|
|
920
|
+
capabilities={capabilities}
|
|
921
|
+
tools={tools}
|
|
922
|
+
agentProfiles={agentProfiles}
|
|
923
|
+
onGraphChange={emitChange}
|
|
924
|
+
onDeleteNode={deleteNode}
|
|
925
|
+
onDeleteEdge={deleteEdge}
|
|
926
|
+
/>
|
|
927
|
+
</aside>
|
|
928
|
+
) : null}
|
|
929
|
+
</div>
|
|
930
|
+
<footer className="as-wf-footer">
|
|
931
|
+
<span><Activity size={13} />{canEdit ? "Draft editing is enabled by the host" : "Read-only · host save capability not supplied"}</span>
|
|
932
|
+
<span>{issueCount ? `${issueCount} structural issue${issueCount === 1 ? "" : "s"}` : "Changes and execution remain host-owned"}</span>
|
|
933
|
+
</footer>
|
|
934
|
+
</div>
|
|
935
|
+
);
|
|
936
|
+
}
|