@aifabrix/builder 2.53.1 → 2.55.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/README.md +8 -0
- package/bin/aifabrix.js +2 -2
- package/lib/agent-kit/apply-ops.js +82 -0
- package/lib/agent-kit/checksums.js +28 -0
- package/lib/agent-kit/classify.js +113 -0
- package/lib/agent-kit/claude-shim.js +61 -0
- package/lib/agent-kit/constants.js +55 -0
- package/lib/agent-kit/file-list.js +103 -0
- package/lib/agent-kit/host-approve.js +130 -0
- package/lib/agent-kit/hosting/github.js +63 -0
- package/lib/agent-kit/hosts.js +71 -0
- package/lib/agent-kit/init.js +319 -0
- package/lib/agent-kit/kit-root.js +17 -0
- package/lib/agent-kit/managed-section.js +79 -0
- package/lib/agent-kit/package-load.js +45 -0
- package/lib/agent-kit/plan-ops.js +69 -0
- package/lib/agent-kit/remote-prompts.js +239 -0
- package/lib/agent-kit/render-host-markdown.js +40 -0
- package/lib/agent-kit/repo-guard.js +47 -0
- package/lib/agent-kit/report.js +107 -0
- package/lib/agent-kit/run.js +82 -0
- package/lib/agent-kit/scm/git.js +122 -0
- package/lib/agent-kit/state-file.js +83 -0
- package/lib/agent-kit/status.js +50 -0
- package/lib/agent-kit/v1-detect.js +81 -0
- package/lib/agent-kit/validate-kit.js +87 -0
- package/lib/agent-kit/workspace-name.js +40 -0
- package/lib/agent-kit/workspace-skeleton.js +103 -0
- package/lib/api/assistants.api.js +8 -5
- package/lib/api/channel-identity.api.js +41 -0
- package/lib/api/evidence-authoring.api.js +5 -1
- package/lib/api/evidence.api.js +2 -0
- package/lib/api/role-assistant-test-pack.api.js +86 -0
- package/lib/api/types/evidence.types.js +2 -0
- package/lib/api/work-search.api.js +163 -0
- package/lib/api/work.api.js +19 -12
- package/lib/app/list-external-systems.js +2 -1
- package/lib/app/show-display.js +33 -6
- package/lib/app/show.js +25 -2
- package/lib/channels/add-channel.js +164 -126
- package/lib/channels/approval-guides/chatgpt.js +14 -18
- package/lib/channels/approval-guides/claude.js +29 -0
- package/lib/channels/approval-guides/index.js +88 -22
- package/lib/channels/approval-guides/mcp-client.js +27 -0
- package/lib/channels/approval-guides/microsoft-copilot.js +52 -3
- package/lib/channels/approval-guides/slack.js +10 -10
- package/lib/channels/approval-guides/teams-bot.js +8 -12
- package/lib/channels/channel-add-continuations.js +91 -0
- package/lib/channels/channel-add-ensure.js +124 -27
- package/lib/channels/channel-add-existing.js +160 -28
- package/lib/channels/channel-add-failure.js +61 -0
- package/lib/channels/channel-add-remaining.js +492 -0
- package/lib/channels/channel-add-tty.js +190 -0
- package/lib/channels/channel-add-wizard-config.js +138 -0
- package/lib/channels/channel-add-wizard.js +250 -0
- package/lib/channels/channel-artifact-generator.js +27 -13
- package/lib/channels/channel-cardinality.js +83 -0
- package/lib/channels/channel-catalog-icon.js +45 -0
- package/lib/channels/channel-cli-instructions.js +75 -0
- package/lib/channels/channel-configuration-map.js +213 -0
- package/lib/channels/channel-credential.js +11 -14
- package/lib/channels/channel-definition-project.js +101 -0
- package/lib/channels/channel-definition-registry.js +154 -0
- package/lib/channels/channel-definition-status.js +115 -0
- package/lib/channels/channel-description.js +60 -2
- package/lib/channels/channel-discovery.js +16 -2
- package/lib/channels/channel-external-system.js +86 -9
- package/lib/channels/channel-install-envelope-actions.js +88 -0
- package/lib/channels/channel-install-envelope-microsoft.js +155 -0
- package/lib/channels/channel-install-envelope.js +358 -0
- package/lib/channels/channel-install-help-md.js +172 -0
- package/lib/channels/channel-install-http-payload.js +62 -0
- package/lib/channels/channel-install-inventory.js +115 -0
- package/lib/channels/channel-install-profiles.js +90 -0
- package/lib/channels/channel-instance-collision.js +118 -0
- package/lib/channels/channel-instance-key.js +100 -0
- package/lib/channels/channel-instance-materialize.js +240 -0
- package/lib/channels/channel-integration-generator.js +18 -9
- package/lib/channels/channel-integration-template.js +101 -22
- package/lib/channels/channel-inventory-fetch.js +79 -0
- package/lib/channels/channel-oauth-preflight.js +104 -0
- package/lib/channels/channel-package-version.js +76 -0
- package/lib/channels/channel-predefined-client.js +154 -0
- package/lib/channels/channel-probe.js +7 -2
- package/lib/channels/channel-runtime-resolver.js +194 -72
- package/lib/channels/channel-status-display.js +86 -16
- package/lib/channels/channel-targets.js +132 -92
- package/lib/channels/chatgpt-callback.js +318 -0
- package/lib/channels/chatgpt-channel-add.js +229 -0
- package/lib/channels/chatgpt-preflight.js +396 -0
- package/lib/channels/chatgpt-runtime-contract.js +17 -0
- package/lib/channels/chatgpt-setup-values.js +124 -0
- package/lib/channels/claude-callback.js +67 -0
- package/lib/channels/claude-channel-add.js +254 -0
- package/lib/channels/claude-runtime-contract.js +40 -0
- package/lib/channels/claude-runtime.js +58 -0
- package/lib/channels/claude-setup-values.js +92 -0
- package/lib/channels/mcp-client/config-merge.js +148 -0
- package/lib/channels/mcp-client/ensure-client.js +231 -0
- package/lib/channels/mcp-client/paths.js +53 -0
- package/lib/channels/mcp-client/profiles.js +122 -0
- package/lib/channels/mcp-client/redirect-uris.js +99 -0
- package/lib/channels/mcp-client/runtime.js +59 -0
- package/lib/channels/mcp-client-channel-add.js +186 -0
- package/lib/channels/microsoft-copilot-channel-add.js +117 -7
- package/lib/channels/microsoft-copilot-entra-identifier-uris.js +187 -0
- package/lib/channels/microsoft-copilot-entra-sso-form.js +106 -18
- package/lib/channels/microsoft-copilot-entra-sso.js +31 -2
- package/lib/channels/microsoft-copilot-package-prior.js +107 -0
- package/lib/channels/microsoft-copilot-package.js +29 -28
- package/lib/channels/microsoft-provisioning/a365.js +80 -0
- package/lib/channels/microsoft-provisioning/auth-config.js +240 -0
- package/lib/channels/microsoft-provisioning/auth.js +179 -0
- package/lib/channels/microsoft-provisioning/cli.js +71 -0
- package/lib/channels/microsoft-provisioning/constants.js +75 -0
- package/lib/channels/microsoft-provisioning/errors.js +117 -0
- package/lib/channels/microsoft-provisioning/index.js +55 -0
- package/lib/channels/microsoft-provisioning/install-atk.js +158 -0
- package/lib/channels/microsoft-provisioning/install-teams.js +115 -0
- package/lib/channels/microsoft-provisioning/login-portal-device.js +236 -0
- package/lib/channels/microsoft-provisioning/login-portal-parse.js +71 -0
- package/lib/channels/microsoft-provisioning/login-portal-teams.js +193 -0
- package/lib/channels/microsoft-provisioning/login-portal.js +230 -0
- package/lib/channels/microsoft-provisioning/persist.js +110 -0
- package/lib/channels/microsoft-provisioning/teams-bot-args.js +119 -0
- package/lib/channels/microsoft-provisioning/teams-bot-controller.js +123 -0
- package/lib/channels/microsoft-provisioning/teams-bot-parse.js +134 -0
- package/lib/channels/microsoft-provisioning/teams-bot-persist.js +113 -0
- package/lib/channels/microsoft-provisioning/teams-bot-provision.js +234 -0
- package/lib/channels/microsoft-provisioning/teams-bot-secrets.js +45 -0
- package/lib/channels/microsoft-provisioning/teams-cli.js +82 -0
- package/lib/channels/runtime-tool-catalog.js +5 -2
- package/lib/channels/slack-channel-add-portal.js +130 -0
- package/lib/channels/slack-channel-add-tty-auth.js +95 -0
- package/lib/channels/slack-channel-add.js +311 -0
- package/lib/channels/slack-mcp-callback.js +51 -0
- package/lib/channels/slack-mcp-runtime.js +156 -0
- package/lib/channels/slack-provisioning/apps.js +181 -0
- package/lib/channels/slack-provisioning/auth-store.js +110 -0
- package/lib/channels/slack-provisioning/auth-ticket.js +185 -0
- package/lib/channels/slack-provisioning/auth.js +115 -0
- package/lib/channels/slack-provisioning/callbacks.js +41 -0
- package/lib/channels/slack-provisioning/cli.js +226 -0
- package/lib/channels/slack-provisioning/constants.js +37 -0
- package/lib/channels/slack-provisioning/credentials.js +169 -0
- package/lib/channels/slack-provisioning/curl-shim.js +132 -0
- package/lib/channels/slack-provisioning/developer-install.js +118 -0
- package/lib/channels/slack-provisioning/env-file.js +120 -0
- package/lib/channels/slack-provisioning/errors.js +47 -0
- package/lib/channels/slack-provisioning/go-ca-bundle.js +137 -0
- package/lib/channels/slack-provisioning/index.js +250 -0
- package/lib/channels/slack-provisioning/install-cli.js +335 -0
- package/lib/channels/slack-provisioning/manifest.js +89 -0
- package/lib/channels/slack-provisioning/oauth-lock.js +33 -0
- package/lib/channels/slack-provisioning/offer-cli.js +113 -0
- package/lib/channels/slack-provisioning/onboard-members.js +122 -0
- package/lib/channels/slack-provisioning/onboard.js +89 -0
- package/lib/channels/slack-provisioning/persist.js +95 -0
- package/lib/channels/slack-provisioning/remaining-urls.js +158 -0
- package/lib/channels/slack-provisioning/with-curl-on-path.js +53 -0
- package/lib/channels/teams-bot-channel-add.js +94 -0
- package/lib/channels/vendor-dataplane-url.js +249 -0
- package/lib/cli/index.js +4 -0
- package/lib/cli/setup-certification-commands.js +2 -2
- package/lib/cli/setup-certification.help.js +5 -1
- package/lib/cli/setup-external-system-help.js +2 -0
- package/lib/cli/setup-external-system.js +1 -1
- package/lib/commands/agent-kit-help.js +79 -0
- package/lib/commands/agent-kit.js +346 -0
- package/lib/commands/channel-add-help.js +366 -0
- package/lib/commands/channel-add-setup.js +162 -80
- package/lib/commands/channel-configure.js +118 -0
- package/lib/commands/channel.js +10 -1
- package/lib/commands/datasource-capability-relate-cli.js +5 -4
- package/lib/commands/governance-upload-external.js +6 -3
- package/lib/commands/lifecycle-command-action.js +2 -5
- package/lib/commands/lifecycle-external.js +93 -21
- package/lib/commands/repair-auth-apply.js +1 -1
- package/lib/commands/repair-datasource-key-skip.js +39 -0
- package/lib/commands/repair-datasource-keys.js +24 -12
- package/lib/commands/repair-datasource-test-payload.js +4 -2
- package/lib/commands/repair-datasource-webhooks-sync-bridge.js +23 -2
- package/lib/commands/repair-datasource.js +3 -0
- package/lib/commands/repair-external-run.js +59 -25
- package/lib/commands/repair-openapi-rest-runtime.js +127 -0
- package/lib/commands/repair-orchestration-tag-merge.js +339 -0
- package/lib/commands/repair-rbac-catalog-defaults.js +96 -0
- package/lib/commands/repair-rbac-platform-preset.js +26 -15
- package/lib/commands/repair-rbac-reader-roles.js +8 -21
- package/lib/commands/repair-rbac.js +26 -44
- package/lib/commands/repair-system-permissions.js +24 -22
- package/lib/commands/role-assistant-copy-output.js +61 -0
- package/lib/commands/role-assistant-copy.js +155 -0
- package/lib/commands/role-assistant-test-output.js +22 -9
- package/lib/commands/role-assistant-test-result-rows.js +42 -0
- package/lib/commands/role-assistant.js +150 -43
- package/lib/commands/search.js +143 -0
- package/lib/commands/test-e2e-external.js +148 -21
- package/lib/commands/test-trust-external.js +7 -5
- package/lib/commands/upload-credential-push-log.js +2 -1
- package/lib/commands/upload-publish-context.js +1 -1
- package/lib/commands/upload-role-assistant-shell.js +124 -0
- package/lib/commands/upload-sidecar-followups.js +10 -4
- package/lib/commands/upload.js +18 -3
- package/lib/commands/verify-operations-skip-e2e.js +131 -0
- package/lib/commands/verify-operations-step-plan.js +6 -33
- package/lib/commands/verify-operations-steps.js +3 -1
- package/lib/core/secrets-docker-env.js +4 -1
- package/lib/core/secrets-env-content.js +17 -3
- package/lib/datasource/capability/capability-manifest.js +0 -3
- package/lib/datasource/capability/copy-test-payload.js +3 -0
- package/lib/datasource/capability/relate-operations.js +28 -10
- package/lib/datasource/capability/run-capability-relate.js +48 -25
- package/lib/datasource/datasource-identifier.js +13 -5
- package/lib/deployment/deployer-poll-run.js +117 -35
- package/lib/external-system/deploy-dataplane-published.js +70 -0
- package/lib/external-system/deploy-helpers.js +26 -1
- package/lib/external-system/deploy.js +22 -8
- package/lib/external-system/download-helpers.js +29 -2
- package/lib/external-system/download-role-assistant.js +109 -4
- package/lib/external-system/download.js +46 -30
- package/lib/external-system/sync-deploy-manifest.js +3 -2
- package/lib/external-system/upload-identity.js +42 -0
- package/lib/generator/index.js +19 -15
- package/lib/generator/split.js +13 -2
- package/lib/generator/wizard-datasource-key.js +54 -0
- package/lib/generator/wizard.js +55 -54
- package/lib/integration-definition/apply-datasource-keys.js +75 -0
- package/lib/integration-definition/apply-relationships.js +195 -0
- package/lib/integration-definition/apply-static-enterprise.js +229 -0
- package/lib/integration-definition/apply-system-file.js +71 -0
- package/lib/integration-definition/apply-test-endpoint.js +89 -0
- package/lib/integration-definition/apply-viewpoint-defaults.js +157 -0
- package/lib/integration-definition/apply.js +78 -59
- package/lib/integration-definition/enrich-openapi-operations.js +36 -10
- package/lib/integration-definition/enrich-openapi-pick.js +87 -0
- package/lib/lifecycle/role-assistant-governance.js +181 -0
- package/lib/lifecycle/scenario-upload.js +181 -30
- package/lib/programmatic/builder-api-cors.js +143 -0
- package/lib/programmatic/builder-api-request.js +6 -0
- package/lib/programmatic/builder-api-route-dispatch.js +56 -42
- package/lib/programmatic/builder-api-server.js +8 -1
- package/lib/programmatic/capability-registry.js +55 -0
- package/lib/programmatic/channel-install-help-resolve.js +359 -0
- package/lib/programmatic/channel-install-session.js +218 -0
- package/lib/programmatic/help-content/channel-onboarding.md +2 -0
- package/lib/programmatic/help-content/cip-overview.md +3 -1
- package/lib/programmatic/http-raw-response.js +62 -0
- package/lib/programmatic/index.js +2 -0
- package/lib/programmatic/openapi-apply-result-schemas.js +8 -0
- package/lib/programmatic/openapi-channel-install-bindings.js +179 -0
- package/lib/programmatic/openapi-channel-install-schemas.js +289 -0
- package/lib/programmatic/openapi-component-schemas.js +19 -1
- package/lib/programmatic/openapi-description-enricher.js +3 -1
- package/lib/programmatic/openapi-descriptions.js +80 -3
- package/lib/programmatic/openapi-envelope-examples.js +124 -0
- package/lib/programmatic/openapi-operation-bindings.js +9 -1
- package/lib/programmatic/openapi-request-schemas.js +5 -0
- package/lib/programmatic/openapi-schema-descriptions-channel.js +319 -0
- package/lib/programmatic/openapi-schema-descriptions-operations.js +19 -0
- package/lib/programmatic/openapi-spec.js +13 -8
- package/lib/programmatic/platform-rbac-catalog.js +36 -18
- package/lib/programmatic/request-timeout.js +3 -0
- package/lib/programmatic/route-handler-map.js +58 -1
- package/lib/programmatic/route-handlers-context.js +2 -1
- package/lib/programmatic/run-auth-permissions.js +54 -0
- package/lib/programmatic/run-channel-catalog.js +238 -0
- package/lib/programmatic/run-channel-install-artifacts.js +137 -0
- package/lib/programmatic/run-channel-install-copilot.js +353 -0
- package/lib/programmatic/run-channel-install-options.js +236 -0
- package/lib/programmatic/run-channel-install-teams-bot.js +204 -0
- package/lib/programmatic/run-channel-install.js +346 -0
- package/lib/programmatic/run-channel-package.js +87 -7
- package/lib/programmatic/run-download.js +41 -0
- package/lib/programmatic/workspace-context.js +2 -0
- package/lib/protection/auth-context.js +3 -1
- package/lib/protection/protection-display.js +3 -2
- package/lib/protection/report-exit.js +50 -0
- package/lib/protection/run-commands.js +2 -0
- package/lib/role-assistant/evidence-sync.js +4 -2
- package/lib/role-assistant/evidence-validation-issues.js +51 -0
- package/lib/role-assistant/knowledge-sync.js +10 -4
- package/lib/role-assistant/package-validate.js +175 -0
- package/lib/role-assistant/settings.js +49 -2
- package/lib/role-assistant/test-case-assertion-row.js +36 -0
- package/lib/role-assistant/test-case-copy-bind.js +77 -0
- package/lib/role-assistant/test-case-copy-expected.js +127 -0
- package/lib/role-assistant/test-case-copy-from-work.js +90 -0
- package/lib/role-assistant/test-case-copy-interactions.js +67 -0
- package/lib/role-assistant/test-case-copy.js +119 -0
- package/lib/role-assistant/test-case-expected-catalog.js +135 -0
- package/lib/role-assistant/test-case-validate.js +88 -0
- package/lib/role-assistant/test-cases-bid.js +117 -4
- package/lib/role-assistant/test-cases-evaluate.js +159 -24
- package/lib/role-assistant/test-cases-evidence.js +175 -0
- package/lib/role-assistant/test-cases-honesty.js +155 -6
- package/lib/role-assistant/test-cases-lifecycle.js +291 -0
- package/lib/role-assistant/test-cases-search-graph.js +122 -0
- package/lib/role-assistant/test-cases-search.js +247 -0
- package/lib/role-assistant/test-cases.js +71 -172
- package/lib/role-assistant/test-pack-map.js +180 -0
- package/lib/role-assistant/test-pack-sync.js +187 -0
- package/lib/role-assistant/test-runner-debug.js +54 -0
- package/lib/role-assistant/test-runner-respond-body.js +36 -0
- package/lib/role-assistant/test-runner-search.js +164 -0
- package/lib/role-assistant/test-runner-start-payload.js +63 -10
- package/lib/role-assistant/test-runner-workhub-answers.js +45 -16
- package/lib/role-assistant/test-runner-workhub-helpers.js +40 -2
- package/lib/role-assistant/test-runner-workhub-soft.js +9 -3
- package/lib/role-assistant/test-runner-workhub.js +74 -32
- package/lib/role-assistant/test-runner.js +66 -11
- package/lib/schema/external-datasource.schema.json +146 -21
- package/lib/schema/external-system.schema.json +177 -2
- package/lib/schema/mcp-client-profile.schema.json +103 -0
- package/lib/schema/role-assistant-test-case.schema.json +408 -0
- package/lib/search/dataplane-context.js +23 -0
- package/lib/search/search-args.js +211 -0
- package/lib/search/search-display.js +238 -0
- package/lib/search/search-errors.js +50 -0
- package/lib/search/search-prompts.js +119 -0
- package/lib/search/search-roles.js +85 -0
- package/lib/search/search-run.js +241 -0
- package/lib/search/search-skills.js +198 -0
- package/lib/utils/app-path-resolve.js +4 -0
- package/lib/utils/authentication-env-template.js +44 -6
- package/lib/utils/authentication-slot-show.js +153 -0
- package/lib/utils/credential-display.js +43 -1
- package/lib/utils/credential-secrets-env.js +6 -1
- package/lib/utils/env-copy.js +19 -7
- package/lib/utils/external-env-template.js +20 -2
- package/lib/utils/external-system-readiness-compact-blocks.js +5 -1
- package/lib/utils/external-system-readiness-compact-display.js +30 -1
- package/lib/utils/external-system-validators.js +2 -1
- package/lib/utils/help-builder.js +3 -1
- package/lib/utils/paths.js +18 -1
- package/lib/utils/platform-shell-package.js +69 -0
- package/lib/utils/port-resolver.js +50 -1
- package/lib/utils/rewrite-name-flag.js +20 -0
- package/lib/utils/role-assistant-paths.js +13 -10
- package/lib/utils/schema-loader.js +37 -0
- package/lib/utils/schema-resolver.js +11 -1
- package/lib/utils/secrets-helpers.js +12 -21
- package/lib/utils/token-manager.js +10 -5
- package/lib/validation/validate-external-file.js +5 -1
- package/lib/validation/validate.js +41 -0
- package/package.json +1 -1
- package/templates/README.md +1 -1
- package/templates/agent-kit/adapters/claude/nested.CLAUDE.md +1 -0
- package/templates/agent-kit/adapters/claude/root.CLAUDE.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-0-plan.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-1-validate.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-2-build.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-3-push.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-biz-1-validate.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-biz-2-build.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-biz-3-prove.md +5 -0
- package/templates/agent-kit/agent-kit.yaml +45 -0
- package/templates/agent-kit/instructions/AGENTKIT.md +83 -0
- package/templates/agent-kit/instructions/integration.AGENTS.md +25 -0
- package/templates/agent-kit/instructions/role-assistant.AGENTS.md +22 -0
- package/templates/agent-kit/instructions/root.AGENTS.md +37 -0
- package/templates/agent-kit/parity-inventory.yaml +188 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/SKILL.md +58 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/references/contract-checklist.md +40 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/references/delivery-gates.md +54 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/references/production-safety.md +35 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/scripts/reserved-system-key.js +19 -0
- package/templates/agent-kit/skills/aifabrix-plan/SKILL.md +51 -0
- package/templates/agent-kit/skills/aifabrix-plan/references/challenge-checklist.md +108 -0
- package/templates/agent-kit/skills/aifabrix-plan/references/interaction.md +34 -0
- package/templates/agent-kit/skills/aifabrix-plan/references/plan-template.md +182 -0
- package/templates/agent-kit/skills/aifabrix-prove/SKILL.md +50 -0
- package/templates/agent-kit/skills/aifabrix-prove/references/demo-template.md +65 -0
- package/templates/agent-kit/skills/aifabrix-prove/references/evidence-lifecycle.md +68 -0
- package/templates/agent-kit/skills/aifabrix-prove/references/learning-template.md +66 -0
- package/templates/agent-kit/skills/aifabrix-role-assistant/SKILL.md +42 -0
- package/templates/agent-kit/skills/aifabrix-role-assistant/references/package-boundary.md +21 -0
- package/templates/agent-kit/skills/shared/hosts.md +78 -0
- package/templates/agent-kit/workspace/.cursor/plans/README.md +22 -0
- package/templates/agent-kit/workspace/LICENSE.mit +21 -0
- package/templates/agent-kit/workspace/README.md +89 -0
- package/templates/applications/builder-api/Dockerfile +3 -1
- package/templates/applications/builder-api/env.template +7 -0
- package/templates/applications/dataplane/application.yaml +6 -5
- package/templates/applications/dataplane/env.template +2 -2
- package/templates/applications/dataplane/rbac.yaml +35 -2
- package/templates/applications/keycloak/Dockerfile +30 -4
- package/templates/applications/keycloak/application.yaml +2 -2
- package/templates/applications/keycloak/cimd-lenient-parse/AbstractClientIdMetadataDocumentExecutor.java +896 -0
- package/templates/applications/keycloak/cimd-lenient-parse/SOURCE.md +19 -0
- package/templates/applications/keycloak/env.template +3 -0
- package/templates/applications/miso-controller/application.yaml +1 -2
- package/templates/applications/miso-controller/env.template +10 -9
- package/templates/channels/README.md +5 -5
- package/templates/channels/chatgpt/TROUBLESHOOTING.md +51 -0
- package/templates/channels/chatgpt/channel.json +59 -0
- package/templates/channels/chatgpt/icon.svg +1 -0
- package/templates/channels/chatgpt/install.template.md.hbs +20 -95
- package/templates/channels/chatgpt/integration/README.md +1 -1
- package/templates/channels/chatgpt/integration/application.json +2 -2
- package/templates/channels/chatgpt/integration/chatgpt-system.json +49 -4
- package/templates/channels/chatgpt/integration/env.template +2 -4
- package/templates/channels/chatgpt/integration/rbac.json +13 -0
- package/templates/channels/claude/TROUBLESHOOTING.md +44 -0
- package/templates/channels/claude/channel.json +59 -0
- package/templates/channels/claude/icon.svg +1 -0
- package/templates/channels/claude/install.template.md.hbs +22 -0
- package/templates/channels/claude/integration/README.md +14 -0
- package/templates/channels/claude/integration/application.json +15 -0
- package/templates/channels/claude/integration/claude-system.json +59 -0
- package/templates/channels/claude/integration/env.template +2 -0
- package/templates/channels/claude/integration/rbac.json +13 -0
- package/templates/channels/claude/manifest.template.json.hbs +40 -0
- package/templates/channels/mcp-client/channel.json +72 -0
- package/templates/channels/mcp-client/icon.svg +1 -0
- package/templates/channels/mcp-client/install.template.md.hbs +24 -0
- package/templates/channels/mcp-client/integration/README.md +13 -0
- package/templates/channels/mcp-client/integration/application.json +15 -0
- package/templates/channels/mcp-client/integration/env.template +2 -0
- package/templates/channels/mcp-client/integration/mcp-client-system.json +72 -0
- package/templates/channels/mcp-client/integration/rbac.json +13 -0
- package/templates/channels/mcp-client/manifest.template.json.hbs +41 -0
- package/templates/channels/mcp-client/profiles/cursor.json +26 -0
- package/templates/channels/mcp-client/profiles/github-copilot.json +29 -0
- package/templates/channels/mcp-client/profiles/vscode.json +29 -0
- package/templates/channels/microsoft-copilot/channel.json +73 -0
- package/templates/channels/microsoft-copilot/declarative-agent.template.json.hbs +8 -4
- package/templates/channels/microsoft-copilot/entra-sso-registration.template.md.hbs +65 -5
- package/templates/channels/microsoft-copilot/icon.svg +1 -0
- package/templates/channels/microsoft-copilot/install.template.md.hbs +9 -9
- package/templates/channels/microsoft-copilot/integration/README.md +1 -1
- package/templates/channels/microsoft-copilot/integration/application.json +2 -2
- package/templates/channels/microsoft-copilot/integration/env.template +3 -6
- package/templates/channels/microsoft-copilot/integration/microsoft-copilot-system.json +63 -4
- package/templates/channels/microsoft-copilot/integration/rbac.json +13 -0
- package/templates/channels/microsoft-copilot/oauth-plugin-vault-required.template.md.hbs +5 -5
- package/templates/channels/slack/channel.json +234 -0
- package/templates/channels/slack/icon.svg +1 -0
- package/templates/channels/slack/install.template.md.hbs +45 -28
- package/templates/channels/slack/integration/README.md +245 -22
- package/templates/channels/slack/integration/application.json +44 -7
- package/templates/channels/slack/integration/env.template +15 -6
- package/templates/channels/slack/integration/openapi/openapi.json +126 -0
- package/templates/channels/slack/integration/rbac.json +84 -0
- package/templates/channels/slack/integration/slack-datasource-commands.json +154 -0
- package/templates/channels/slack/integration/slack-datasource-conversations.json +28 -3
- package/templates/channels/slack/integration/slack-datasource-events.json +154 -0
- package/templates/channels/slack/integration/slack-datasource-interactive.json +154 -0
- package/templates/channels/slack/integration/slack-datasource-messages.json +40 -2
- package/templates/channels/slack/integration/slack-system.json +161 -72
- package/templates/channels/slack/manifest.template.json.hbs +10 -4
- package/templates/channels/teams-bot/channel.json +162 -0
- package/templates/channels/teams-bot/icon.svg +1 -0
- package/templates/channels/teams-bot/install.template.md.hbs +12 -13
- package/templates/channels/teams-bot/integration/README.md +5 -4
- package/templates/channels/teams-bot/integration/application.json +6 -4
- package/templates/channels/teams-bot/integration/env.template +5 -4
- package/templates/channels/teams-bot/integration/openapi/openapi.json +68 -0
- package/templates/channels/teams-bot/integration/rbac.json +21 -0
- package/templates/channels/teams-bot/integration/teams-bot-datasource-activities.json +154 -0
- package/templates/channels/teams-bot/integration/teams-bot-system.json +128 -23
- package/templates/channels/web-embed/channel.json +60 -0
- package/templates/channels/web-embed/install.template.md.hbs +1 -1
- package/templates/channels/web-embed/integration/README.md +2 -2
- package/templates/channels/web-embed/integration/application.json +2 -2
- package/templates/channels/web-embed/integration/env.template +1 -1
- package/templates/channels/web-embed/integration/rbac.json +13 -0
- package/templates/channels/web-embed/integration/web-embed-system.json +50 -4
- package/templates/python/docker-compose.hbs +14 -0
- package/templates/typescript/docker-compose.hbs +14 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map local Role Assistant YAML cases to a published test pack (and back).
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview YAML specification only — currentStatus stays on dataplane
|
|
5
|
+
* @author AI Fabrix Team
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const yaml = require('js-yaml');
|
|
13
|
+
const fs = require('../internal/fs-real-sync');
|
|
14
|
+
const { roleAssistantTestsDir } = require('./test-cases');
|
|
15
|
+
const { discoverSuiteCaseFiles } = require('./test-suite');
|
|
16
|
+
const { roleAssistantSystemKey } = require('../utils/role-assistant-paths');
|
|
17
|
+
|
|
18
|
+
const PACK_API_VERSION = 'dataplane.aifabrix.ai/v1';
|
|
19
|
+
const PACK_KIND = 'RoleAssistantTestPack';
|
|
20
|
+
const STATUS_KEYS = new Set(['currentStatus', 'lastTestedAt', 'summary', 'sourceFile']);
|
|
21
|
+
const YAML_SPEC_KEYS = [
|
|
22
|
+
'caseId',
|
|
23
|
+
'input',
|
|
24
|
+
'answers',
|
|
25
|
+
'approvals',
|
|
26
|
+
'expected',
|
|
27
|
+
'preflight',
|
|
28
|
+
'metadata'
|
|
29
|
+
];
|
|
30
|
+
const PACK_INPUT_ALIASES = ['executionPath', 'roleRef', 'businessRoleRef'];
|
|
31
|
+
|
|
32
|
+
function isYamlName(name) {
|
|
33
|
+
return /\.(ya?ml)$/i.test(name);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function listRootYamlFiles(testsDir) {
|
|
37
|
+
if (!fs.existsSync(testsDir)) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
return fs.readdirSync(testsDir)
|
|
41
|
+
.filter((name) => isYamlName(name))
|
|
42
|
+
.map((name) => path.join(testsDir, name));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function copySpecFields(parsed, caseId) {
|
|
46
|
+
const out = { caseId };
|
|
47
|
+
for (const key of YAML_SPEC_KEYS) {
|
|
48
|
+
if (key === 'caseId' || parsed[key] === undefined) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
out[key] = parsed[key];
|
|
52
|
+
}
|
|
53
|
+
const input = out.input && typeof out.input === 'object' && !Array.isArray(out.input)
|
|
54
|
+
? out.input
|
|
55
|
+
: {};
|
|
56
|
+
for (const key of PACK_INPUT_ALIASES) {
|
|
57
|
+
if (input[key] !== undefined) {
|
|
58
|
+
out[key] = input[key];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function specCaseFromFile(filePath) {
|
|
65
|
+
const parsed = yaml.load(fs.readFileSync(filePath, 'utf8'));
|
|
66
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
67
|
+
throw new Error(`Test case must be an object: ${filePath}`);
|
|
68
|
+
}
|
|
69
|
+
const fileBase = path.basename(filePath, path.extname(filePath));
|
|
70
|
+
const caseId = String(parsed.caseId || fileBase).trim();
|
|
71
|
+
if (!caseId) {
|
|
72
|
+
throw new Error(`Test case is missing caseId: ${filePath}`);
|
|
73
|
+
}
|
|
74
|
+
return copySpecFields(parsed, caseId);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function collectSuiteMap(testsDir) {
|
|
78
|
+
const suites = new Map();
|
|
79
|
+
const add = (suiteId, filePath) => {
|
|
80
|
+
const id = String(suiteId || 'default').trim() || 'default';
|
|
81
|
+
if (!suites.has(id)) {
|
|
82
|
+
suites.set(id, []);
|
|
83
|
+
}
|
|
84
|
+
suites.get(id).push(specCaseFromFile(filePath));
|
|
85
|
+
};
|
|
86
|
+
for (const filePath of listRootYamlFiles(testsDir)) {
|
|
87
|
+
add('default', filePath);
|
|
88
|
+
}
|
|
89
|
+
for (const row of discoverSuiteCaseFiles(testsDir)) {
|
|
90
|
+
add(row.suite, row.absPath);
|
|
91
|
+
}
|
|
92
|
+
return suites;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function buildRoleAssistantTestPack(systemKey, suiteMap) {
|
|
96
|
+
const key = roleAssistantSystemKey(systemKey);
|
|
97
|
+
const suites = [];
|
|
98
|
+
for (const [suiteId, cases] of suiteMap.entries()) {
|
|
99
|
+
if (cases.length > 0) {
|
|
100
|
+
suites.push({ suiteId, cases });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
apiVersion: PACK_API_VERSION,
|
|
105
|
+
kind: PACK_KIND,
|
|
106
|
+
metadata: { key },
|
|
107
|
+
spec: { suites }
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function mapLocalTestsToPack(systemKey, options = {}) {
|
|
112
|
+
const testsDir = roleAssistantTestsDir(systemKey, options);
|
|
113
|
+
if (!fs.existsSync(testsDir)) {
|
|
114
|
+
return { skipped: true, reason: 'No tests folder' };
|
|
115
|
+
}
|
|
116
|
+
const suiteMap = collectSuiteMap(testsDir);
|
|
117
|
+
const pack = buildRoleAssistantTestPack(systemKey, suiteMap);
|
|
118
|
+
if (!pack.spec.suites.length) {
|
|
119
|
+
return { skipped: true, reason: 'No test cases in tests folder' };
|
|
120
|
+
}
|
|
121
|
+
return { skipped: false, pack, testsDir };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function mergePackAliasesIntoInput(packCase, input) {
|
|
125
|
+
const next = { ...input };
|
|
126
|
+
for (const key of PACK_INPUT_ALIASES) {
|
|
127
|
+
if (packCase[key] !== undefined && next[key] === undefined) {
|
|
128
|
+
next[key] = packCase[key];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return next;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function yamlFromPackCase(packCase) {
|
|
135
|
+
const body = {};
|
|
136
|
+
for (const key of YAML_SPEC_KEYS) {
|
|
137
|
+
if (packCase[key] === undefined || STATUS_KEYS.has(key)) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
body[key] = packCase[key];
|
|
141
|
+
}
|
|
142
|
+
const input = body.input && typeof body.input === 'object' && !Array.isArray(body.input)
|
|
143
|
+
? body.input
|
|
144
|
+
: {};
|
|
145
|
+
const merged = mergePackAliasesIntoInput(packCase, input);
|
|
146
|
+
if (Object.keys(merged).length > 0) {
|
|
147
|
+
body.input = merged;
|
|
148
|
+
}
|
|
149
|
+
return yaml.dump(body, { lineWidth: 120, noRefs: true, sortKeys: false });
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function writePackToTestsDir(pack, testsDir) {
|
|
153
|
+
const suites = pack && pack.spec && Array.isArray(pack.spec.suites) ? pack.spec.suites : [];
|
|
154
|
+
fs.mkdirSync(testsDir, { recursive: true });
|
|
155
|
+
let written = 0;
|
|
156
|
+
for (const suite of suites) {
|
|
157
|
+
const suiteId = String((suite && suite.suiteId) || 'default').trim() || 'default';
|
|
158
|
+
const suiteDir = path.join(testsDir, suiteId);
|
|
159
|
+
fs.mkdirSync(suiteDir, { recursive: true });
|
|
160
|
+
const cases = Array.isArray(suite.cases) ? suite.cases : [];
|
|
161
|
+
for (const row of cases) {
|
|
162
|
+
const caseId = String((row && row.caseId) || '').trim();
|
|
163
|
+
if (!caseId) {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
fs.writeFileSync(path.join(suiteDir, `${caseId}.yaml`), yamlFromPackCase(row), 'utf8');
|
|
167
|
+
written += 1;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return written;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
module.exports = {
|
|
174
|
+
PACK_API_VERSION,
|
|
175
|
+
PACK_KIND,
|
|
176
|
+
YAML_SPEC_KEYS,
|
|
177
|
+
mapLocalTestsToPack,
|
|
178
|
+
writePackToTestsDir,
|
|
179
|
+
specCaseFromFile
|
|
180
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role Assistant test-pack sidecar: upload PUT, download GET, case status PATCH.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Shared CLI and builder-api adapters — no Task/PE or /runs
|
|
5
|
+
* @author AI Fabrix Team
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
const os = require('os');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const logger = require('../utils/logger');
|
|
14
|
+
const { formatWarningLine } = require('../utils/cli-test-layout-chalk');
|
|
15
|
+
const { isDigitalWorkerKind } = require('../utils/platform-shell-package');
|
|
16
|
+
const { roleAssistantTestsDir } = require('./test-cases');
|
|
17
|
+
const { mapLocalTestsToPack, writePackToTestsDir } = require('./test-pack-map');
|
|
18
|
+
const {
|
|
19
|
+
upsertRoleAssistantTestPack,
|
|
20
|
+
getRoleAssistantTestPack,
|
|
21
|
+
patchRoleAssistantTestCaseStatus
|
|
22
|
+
} = require('../api/role-assistant-test-pack.api');
|
|
23
|
+
const fs = require('../internal/fs-real-sync');
|
|
24
|
+
|
|
25
|
+
function skipResult(reason) {
|
|
26
|
+
return { skipped: true, reason };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function isRoleAssistantPayload(payload) {
|
|
30
|
+
return isDigitalWorkerKind(payload && payload.application);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function runTestsSidecar(ctx, sidecar, quietSidecar) {
|
|
34
|
+
if (!isRoleAssistantPayload(ctx.payload)) {
|
|
35
|
+
sidecar.tests = skipResult('Not a Role Assistant package');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (ctx.options && ctx.options.dryRun === true) {
|
|
39
|
+
sidecar.tests = skipResult('Dry run');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const mapped = mapLocalTestsToPack(ctx.systemKey, {
|
|
43
|
+
pathOptions: (ctx.options && ctx.options.pathOptions) || {},
|
|
44
|
+
testsDir: ctx.options && ctx.options.testsDir
|
|
45
|
+
});
|
|
46
|
+
if (mapped.skipped) {
|
|
47
|
+
sidecar.tests = skipResult(mapped.reason);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
const uploaded = await upsertRoleAssistantTestPack(
|
|
52
|
+
ctx.dataplaneUrl,
|
|
53
|
+
ctx.authConfig,
|
|
54
|
+
ctx.systemKey,
|
|
55
|
+
mapped.pack
|
|
56
|
+
);
|
|
57
|
+
sidecar.tests = {
|
|
58
|
+
skipped: false,
|
|
59
|
+
packVersion: uploaded && uploaded.packVersion,
|
|
60
|
+
packKey: uploaded && uploaded.packKey
|
|
61
|
+
};
|
|
62
|
+
} catch (err) {
|
|
63
|
+
sidecar.tests = skipResult(err.message || String(err));
|
|
64
|
+
if (!quietSidecar) {
|
|
65
|
+
logger.log(formatWarningLine(`Role assistant tests upload skipped: ${err.message}`));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function exportRoleAssistantTests(params) {
|
|
71
|
+
const { systemKey, dataplaneUrl, authConfig, options = {} } = params;
|
|
72
|
+
const row = await getRoleAssistantTestPack(dataplaneUrl, authConfig, systemKey, {
|
|
73
|
+
allowMissing: true
|
|
74
|
+
});
|
|
75
|
+
if (!row || !row.pack) {
|
|
76
|
+
return skipResult('No published test pack');
|
|
77
|
+
}
|
|
78
|
+
const testsDir = roleAssistantTestsDir(systemKey, {
|
|
79
|
+
pathOptions: options.pathOptions || {},
|
|
80
|
+
testsDir: options.testsDir
|
|
81
|
+
});
|
|
82
|
+
const written = writePackToTestsDir(row.pack, testsDir);
|
|
83
|
+
return { skipped: false, written, testsDir };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function publishedTestsOwnerToken() {
|
|
87
|
+
if (typeof process.getuid === 'function') {
|
|
88
|
+
return String(process.getuid());
|
|
89
|
+
}
|
|
90
|
+
return 'u';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function publishedTestsTempDir(systemKey) {
|
|
94
|
+
const key = String(systemKey || 'pack').replace(/[^a-zA-Z0-9._-]+/g, '_');
|
|
95
|
+
return path.join(os.tmpdir(), `aifabrix-ra-tests-${publishedTestsOwnerToken()}`, key);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function materializePublishedTests(systemKey, dataplaneUrl, authConfig, destRoot) {
|
|
99
|
+
const row = await getRoleAssistantTestPack(dataplaneUrl, authConfig, systemKey, {
|
|
100
|
+
allowMissing: true
|
|
101
|
+
});
|
|
102
|
+
if (!row || !row.pack) {
|
|
103
|
+
throw new Error(
|
|
104
|
+
`No published tests for ${systemKey}. Upload the Role Assistant package first.`
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
if (fs.existsSync(destRoot)) {
|
|
108
|
+
fs.rmSync(destRoot, { recursive: true, force: true });
|
|
109
|
+
}
|
|
110
|
+
const written = writePackToTestsDir(row.pack, destRoot);
|
|
111
|
+
return { testsDir: destRoot, written };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function caseStatusFromEvaluation(evaluation) {
|
|
115
|
+
if (!evaluation) {
|
|
116
|
+
return 'skipped';
|
|
117
|
+
}
|
|
118
|
+
if (evaluation.passed === true) {
|
|
119
|
+
return 'passed';
|
|
120
|
+
}
|
|
121
|
+
if (evaluation.passed === false) {
|
|
122
|
+
return 'failed';
|
|
123
|
+
}
|
|
124
|
+
return 'skipped';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function caseSummaryFromEvaluation(evaluation) {
|
|
128
|
+
if (!evaluation) {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
const summary = evaluation.summary || evaluation.reason || evaluation.error;
|
|
132
|
+
return typeof summary === 'string' && summary.trim() ? summary.trim() : undefined;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async function loadPublishedTestsIntoOptions(systemKey, opts, authContext) {
|
|
136
|
+
if (!opts || opts.fromDataplane !== true) {
|
|
137
|
+
return opts;
|
|
138
|
+
}
|
|
139
|
+
const dest = publishedTestsTempDir(systemKey);
|
|
140
|
+
await materializePublishedTests(
|
|
141
|
+
systemKey,
|
|
142
|
+
authContext.dataplaneUrl,
|
|
143
|
+
authContext.authConfig,
|
|
144
|
+
dest
|
|
145
|
+
);
|
|
146
|
+
return { ...opts, casesRoot: dest, testsDir: dest };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async function patchCaseStatusAfterRun(params) {
|
|
150
|
+
const { systemKey, caseId, evaluation, dataplaneUrl, authConfig } = params;
|
|
151
|
+
if (!dataplaneUrl || !authConfig || !caseId) {
|
|
152
|
+
return { skipped: true, reason: 'Missing dataplane context' };
|
|
153
|
+
}
|
|
154
|
+
const body = {
|
|
155
|
+
status: caseStatusFromEvaluation(evaluation),
|
|
156
|
+
testedAt: new Date().toISOString()
|
|
157
|
+
};
|
|
158
|
+
const summary = caseSummaryFromEvaluation(evaluation);
|
|
159
|
+
if (summary) {
|
|
160
|
+
body.summary = summary;
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
await patchRoleAssistantTestCaseStatus(
|
|
164
|
+
dataplaneUrl,
|
|
165
|
+
authConfig,
|
|
166
|
+
systemKey,
|
|
167
|
+
caseId,
|
|
168
|
+
body
|
|
169
|
+
);
|
|
170
|
+
return { skipped: false, status: body.status };
|
|
171
|
+
} catch (err) {
|
|
172
|
+
logger.log(
|
|
173
|
+
formatWarningLine(`Could not update published case status for ${caseId}: ${err.message}`)
|
|
174
|
+
);
|
|
175
|
+
return { skipped: true, reason: err.message || String(err) };
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
module.exports = {
|
|
180
|
+
runTestsSidecar,
|
|
181
|
+
exportRoleAssistantTests,
|
|
182
|
+
publishedTestsTempDir,
|
|
183
|
+
materializePublishedTests,
|
|
184
|
+
loadPublishedTestsIntoOptions,
|
|
185
|
+
caseStatusFromEvaluation,
|
|
186
|
+
patchCaseStatusAfterRun
|
|
187
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role assistant --debug Work Result fetch and log persistence.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Technical work-result depth and logs under role-assistant/<role>/logs/
|
|
5
|
+
* @author AI Fabrix Team
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
const fs = require('../internal/fs-real-sync');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const { getWorkExecutionResult } = require('../api/work.api');
|
|
14
|
+
const { sanitizeForLog } = require('../utils/test-log-writer');
|
|
15
|
+
const {
|
|
16
|
+
getRoleAssistantPath,
|
|
17
|
+
roleAssistantSystemKey
|
|
18
|
+
} = require('../utils/role-assistant-paths');
|
|
19
|
+
|
|
20
|
+
function requestedWorkResultDepth(options) {
|
|
21
|
+
return options && options.debug === true ? 'technical' : 'business';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function fetchWorkHubResult(dataplaneUrl, authConfig, processExecutionId, options = {}) {
|
|
25
|
+
try {
|
|
26
|
+
const workResult = await getWorkExecutionResult(dataplaneUrl, authConfig, processExecutionId, {
|
|
27
|
+
requestedDepth: requestedWorkResultDepth(options),
|
|
28
|
+
format: 'json'
|
|
29
|
+
});
|
|
30
|
+
return { workResult, workResultError: null };
|
|
31
|
+
} catch (error) {
|
|
32
|
+
return { workResult: null, workResultError: error.message || String(error) };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function persistRoleAssistantDebugLog(roleKey, payload, options = {}) {
|
|
37
|
+
if (!options || options.debug !== true) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const systemKey = roleAssistantSystemKey(roleKey);
|
|
41
|
+
const logsDir = path.join(getRoleAssistantPath(systemKey), 'logs');
|
|
42
|
+
fs.mkdirSync(logsDir, { recursive: true });
|
|
43
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
44
|
+
const filePath = path.join(logsDir, `work-result-technical-${timestamp}.json`);
|
|
45
|
+
const sanitized = sanitizeForLog(payload);
|
|
46
|
+
fs.writeFileSync(filePath, `${JSON.stringify(sanitized, null, 2)}\n`, 'utf8');
|
|
47
|
+
return filePath;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
module.exports = {
|
|
51
|
+
requestedWorkResultDepth,
|
|
52
|
+
fetchWorkHubResult,
|
|
53
|
+
persistRoleAssistantDebugLog
|
|
54
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keep human.respond bodies on the OpenAPI request shape.
|
|
3
|
+
* WaitPayload.prompt is server-owned and must not be echoed.
|
|
4
|
+
* @fileoverview Strip extra wait fields from RA respond payloads
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const HUMAN_RESPOND_KEYS = [
|
|
10
|
+
'respondIdempotencyKey',
|
|
11
|
+
'answerType',
|
|
12
|
+
'value',
|
|
13
|
+
'evidenceRef',
|
|
14
|
+
'declined',
|
|
15
|
+
'selectedOptionId',
|
|
16
|
+
'approvalDecision',
|
|
17
|
+
'proposedPatch',
|
|
18
|
+
'requestVersion',
|
|
19
|
+
'stateVersionRef',
|
|
20
|
+
'requestFingerprint'
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
function pickHumanRespondBody(payload) {
|
|
24
|
+
const out = {};
|
|
25
|
+
if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
for (const key of HUMAN_RESPOND_KEYS) {
|
|
29
|
+
if (payload[key] !== undefined) {
|
|
30
|
+
out[key] = payload[key];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = { pickHumanRespondBody };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role-assistant typed search cases (work.skills / work.search).
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Execute viewpoint and table search cases without Work Hub
|
|
5
|
+
* @author AI Fabrix Team
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
const { getWorkSkills, searchWork } = require('../api/work-search.api');
|
|
12
|
+
const { resourceTypesMap } = require('../search/search-skills');
|
|
13
|
+
const { roleAssistantSystemKey } = require('../utils/role-assistant-paths');
|
|
14
|
+
const {
|
|
15
|
+
resolveInput,
|
|
16
|
+
wantsSearchPath,
|
|
17
|
+
wantsSkillsOnlyPath
|
|
18
|
+
} = require('./test-runner-workhub-helpers');
|
|
19
|
+
|
|
20
|
+
function operationKeys(spec) {
|
|
21
|
+
const raw = Array.isArray(spec && spec.operations) ? spec.operations : [];
|
|
22
|
+
const keys = [];
|
|
23
|
+
for (const item of raw) {
|
|
24
|
+
if (typeof item === 'string' && item.trim()) {
|
|
25
|
+
keys.push(item.trim());
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const key = item && typeof item === 'object' ? String(item.key || '').trim() : '';
|
|
29
|
+
if (key) {
|
|
30
|
+
keys.push(key);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return keys;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function pickResourceType(skillsPayload, operation) {
|
|
37
|
+
const rts = resourceTypesMap(skillsPayload);
|
|
38
|
+
const keys = Object.keys(rts);
|
|
39
|
+
const wanted = String(operation || '').trim();
|
|
40
|
+
if (wanted) {
|
|
41
|
+
const hits = keys.filter((resourceType) => operationKeys(rts[resourceType]).includes(wanted));
|
|
42
|
+
if (hits.length === 1) {
|
|
43
|
+
return hits[0];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return keys.length === 1 ? keys[0] : '';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function resolveRoleRef(roleKey, testCase) {
|
|
50
|
+
const input = resolveInput(testCase);
|
|
51
|
+
const candidates = [
|
|
52
|
+
input.roleRef,
|
|
53
|
+
input.businessRoleRef,
|
|
54
|
+
testCase && testCase.roleRef,
|
|
55
|
+
testCase && testCase.businessRoleRef,
|
|
56
|
+
roleAssistantSystemKey(roleKey)
|
|
57
|
+
];
|
|
58
|
+
for (const row of candidates) {
|
|
59
|
+
if (typeof row === 'string' && row.trim()) {
|
|
60
|
+
return row.trim();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return roleAssistantSystemKey(roleKey);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function assignOptionalNumber(args, input, key) {
|
|
67
|
+
if (Number.isFinite(input[key])) {
|
|
68
|
+
args[key] = input[key];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function assignGraphFields(args, input) {
|
|
73
|
+
if (input.graph === true) {
|
|
74
|
+
args.graph = { depth: 1 };
|
|
75
|
+
} else if (input.graph && typeof input.graph === 'object' && !Array.isArray(input.graph)) {
|
|
76
|
+
args.graph = { depth: 1 };
|
|
77
|
+
}
|
|
78
|
+
if (typeof input.query === 'string' && input.query.trim()) {
|
|
79
|
+
args.query = input.query.trim();
|
|
80
|
+
}
|
|
81
|
+
if (!Array.isArray(input.knowledgeKeys) || !input.knowledgeKeys.length) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const keys = input.knowledgeKeys.map((item) => String(item || '').trim()).filter(Boolean);
|
|
85
|
+
if (keys.length) {
|
|
86
|
+
args.knowledgeKeys = keys;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function buildSearchArguments(roleRef, input, skillsPayload) {
|
|
91
|
+
const args = { roleRef };
|
|
92
|
+
const resourceType =
|
|
93
|
+
String(input.resourceType || '').trim() || pickResourceType(skillsPayload, input.operation);
|
|
94
|
+
if (resourceType) {
|
|
95
|
+
args.resourceType = resourceType;
|
|
96
|
+
}
|
|
97
|
+
if (typeof input.operation === 'string' && input.operation.trim()) {
|
|
98
|
+
args.operation = input.operation.trim();
|
|
99
|
+
}
|
|
100
|
+
if (input.filters && typeof input.filters === 'object' && !Array.isArray(input.filters)) {
|
|
101
|
+
args.filters = input.filters;
|
|
102
|
+
}
|
|
103
|
+
assignOptionalNumber(args, input, 'page');
|
|
104
|
+
assignOptionalNumber(args, input, 'pageSize');
|
|
105
|
+
if (Array.isArray(input.fields) && input.fields.length) {
|
|
106
|
+
args.fields = input.fields;
|
|
107
|
+
}
|
|
108
|
+
assignGraphFields(args, input);
|
|
109
|
+
return args;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function statusToken(statusCode) {
|
|
113
|
+
return Number(statusCode) === 200 ? 'completed' : 'stopped';
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function searchLifecycleResult(roleKey, testCase, roleRef, skillsRes, searchRes, args) {
|
|
117
|
+
return {
|
|
118
|
+
kind: searchRes ? 'search' : 'skills',
|
|
119
|
+
roleKey,
|
|
120
|
+
caseId: testCase.caseId,
|
|
121
|
+
roleRef,
|
|
122
|
+
processExecutionId: null,
|
|
123
|
+
skills: skillsRes,
|
|
124
|
+
search: searchRes ? { ...searchRes, arguments: args } : null,
|
|
125
|
+
finalStatus: {
|
|
126
|
+
status: statusToken((searchRes || skillsRes).status)
|
|
127
|
+
},
|
|
128
|
+
timeline: [],
|
|
129
|
+
interactions: [],
|
|
130
|
+
workResult: null,
|
|
131
|
+
workResultError: null
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async function runSearchCaseLifecycle(roleKey, testCase, runtimeContext) {
|
|
136
|
+
const dataplaneUrl = runtimeContext && runtimeContext.dataplaneUrl;
|
|
137
|
+
const authConfig = runtimeContext && runtimeContext.authConfig;
|
|
138
|
+
if (!dataplaneUrl || !authConfig) {
|
|
139
|
+
throw new Error('Role assistant search case requires dataplane auth context.');
|
|
140
|
+
}
|
|
141
|
+
const roleRef = resolveRoleRef(roleKey, testCase);
|
|
142
|
+
const skillsRes = await getWorkSkills(dataplaneUrl, authConfig, roleRef);
|
|
143
|
+
if (wantsSkillsOnlyPath(testCase)) {
|
|
144
|
+
return searchLifecycleResult(roleKey, testCase, roleRef, skillsRes, null, null);
|
|
145
|
+
}
|
|
146
|
+
const args = buildSearchArguments(roleRef, resolveInput(testCase), skillsRes.payload);
|
|
147
|
+
if (!args.resourceType) {
|
|
148
|
+
throw new Error(
|
|
149
|
+
'Search case requires input.resourceType (or exactly one matching type from work.skills).'
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
const searchRes = await searchWork(dataplaneUrl, authConfig, args);
|
|
153
|
+
return searchLifecycleResult(roleKey, testCase, roleRef, skillsRes, searchRes, args);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
module.exports = {
|
|
157
|
+
wantsSearchPath,
|
|
158
|
+
wantsSkillsOnlyPath,
|
|
159
|
+
operationKeys,
|
|
160
|
+
pickResourceType,
|
|
161
|
+
resolveRoleRef,
|
|
162
|
+
buildSearchArguments,
|
|
163
|
+
runSearchCaseLifecycle
|
|
164
|
+
};
|