@mesh-tech/mesh-cli 0.1.1 → 0.12.1
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/assets/intent/agents-fence.md +10 -0
- package/assets/intent/intent-claude-gate.mjs +255 -0
- package/assets/log-shipper.mjs +94 -0
- package/bin/mesh.mjs +80 -0
- package/dist/bin/mesh.d.ts +7 -9
- package/dist/bin/mesh.d.ts.map +1 -1
- package/dist/bin/mesh.js +20878 -37
- package/dist/bin/mesh.js.map +7 -1
- package/dist/build-info.json +4 -0
- package/dist/src/commands/agent-api-client.d.ts +79 -0
- package/dist/src/commands/agent-api-client.d.ts.map +1 -0
- package/dist/src/commands/agent-api-client.js +170 -0
- package/dist/src/commands/agent-api-client.js.map +1 -0
- package/dist/src/commands/artifacts.d.ts +13 -0
- package/dist/src/commands/artifacts.d.ts.map +1 -0
- package/dist/src/commands/artifacts.js +140 -0
- package/dist/src/commands/artifacts.js.map +1 -0
- package/dist/src/commands/cluster.d.ts +45 -0
- package/dist/src/commands/cluster.d.ts.map +1 -0
- package/dist/src/commands/cluster.js +259 -0
- package/dist/src/commands/cluster.js.map +1 -0
- package/dist/src/commands/conversations.d.ts +61 -0
- package/dist/src/commands/conversations.d.ts.map +1 -0
- package/dist/src/commands/conversations.js +239 -0
- package/dist/src/commands/conversations.js.map +1 -0
- package/dist/src/commands/create-app.d.ts +26 -3
- package/dist/src/commands/create-app.d.ts.map +1 -1
- package/dist/src/commands/create-app.js +465 -107
- package/dist/src/commands/create-app.js.map +1 -1
- package/dist/src/commands/deploy.d.ts +19 -0
- package/dist/src/commands/deploy.d.ts.map +1 -1
- package/dist/src/commands/deploy.js +83 -142
- package/dist/src/commands/deploy.js.map +1 -1
- package/dist/src/commands/dev-doctor.d.ts +137 -0
- package/dist/src/commands/dev-doctor.d.ts.map +1 -0
- package/dist/src/commands/dev-doctor.js +671 -0
- package/dist/src/commands/dev-doctor.js.map +1 -0
- package/dist/src/commands/dev-launch.d.ts +59 -0
- package/dist/src/commands/dev-launch.d.ts.map +1 -0
- package/dist/src/commands/dev-launch.js +118 -0
- package/dist/src/commands/dev-launch.js.map +1 -0
- package/dist/src/commands/dev-token-server.d.ts +32 -0
- package/dist/src/commands/dev-token-server.d.ts.map +1 -0
- package/dist/src/commands/dev-token-server.js +68 -0
- package/dist/src/commands/dev-token-server.js.map +1 -0
- package/dist/src/commands/dev.d.ts +289 -2
- package/dist/src/commands/dev.d.ts.map +1 -1
- package/dist/src/commands/dev.js +2501 -574
- package/dist/src/commands/dev.js.map +1 -1
- package/dist/src/commands/docs.d.ts +3 -0
- package/dist/src/commands/docs.d.ts.map +1 -0
- package/dist/src/commands/docs.js +262 -0
- package/dist/src/commands/docs.js.map +1 -0
- package/dist/src/commands/hub/index.d.ts +99 -0
- package/dist/src/commands/hub/index.d.ts.map +1 -0
- package/dist/src/commands/hub/index.js +452 -0
- package/dist/src/commands/hub/index.js.map +1 -0
- package/dist/src/commands/init.d.ts +65 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +370 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/install-shim.d.ts +28 -0
- package/dist/src/commands/install-shim.d.ts.map +1 -0
- package/dist/src/commands/install-shim.js +191 -0
- package/dist/src/commands/install-shim.js.map +1 -0
- package/dist/src/commands/local/auth-provision.d.ts +71 -0
- package/dist/src/commands/local/auth-provision.d.ts.map +1 -0
- package/dist/src/commands/local/auth-provision.js +286 -0
- package/dist/src/commands/local/auth-provision.js.map +1 -0
- package/dist/src/commands/local/dev-local.d.ts +97 -0
- package/dist/src/commands/local/dev-local.d.ts.map +1 -0
- package/dist/src/commands/local/dev-local.js +306 -0
- package/dist/src/commands/local/dev-local.js.map +1 -0
- package/dist/src/commands/local/docker-runner.d.ts +37 -0
- package/dist/src/commands/local/docker-runner.d.ts.map +1 -0
- package/dist/src/commands/local/docker-runner.js +104 -0
- package/dist/src/commands/local/docker-runner.js.map +1 -0
- package/dist/src/commands/local/helpers.d.ts +22 -0
- package/dist/src/commands/local/helpers.d.ts.map +1 -0
- package/dist/src/commands/local/helpers.js +46 -0
- package/dist/src/commands/local/helpers.js.map +1 -0
- package/dist/src/commands/local/hub-local.d.ts +51 -0
- package/dist/src/commands/local/hub-local.d.ts.map +1 -0
- package/dist/src/commands/local/hub-local.js +197 -0
- package/dist/src/commands/local/hub-local.js.map +1 -0
- package/dist/src/commands/local/index.d.ts +23 -0
- package/dist/src/commands/local/index.d.ts.map +1 -0
- package/dist/src/commands/local/index.js +386 -0
- package/dist/src/commands/local/index.js.map +1 -0
- package/dist/src/commands/local/mocks.d.ts +361 -0
- package/dist/src/commands/local/mocks.d.ts.map +1 -0
- package/dist/src/commands/local/mocks.js +756 -0
- package/dist/src/commands/local/mocks.js.map +1 -0
- package/dist/src/commands/local/seed-zitadel.d.ts +151 -0
- package/dist/src/commands/local/seed-zitadel.d.ts.map +1 -0
- package/dist/src/commands/local/seed-zitadel.js +408 -0
- package/dist/src/commands/local/seed-zitadel.js.map +1 -0
- package/dist/src/commands/local/seed.d.ts +106 -0
- package/dist/src/commands/local/seed.d.ts.map +1 -0
- package/dist/src/commands/local/seed.js +252 -0
- package/dist/src/commands/local/seed.js.map +1 -0
- package/dist/src/commands/local/stack.d.ts +173 -0
- package/dist/src/commands/local/stack.d.ts.map +1 -0
- package/dist/src/commands/local/stack.js +499 -0
- package/dist/src/commands/local/stack.js.map +1 -0
- package/dist/src/commands/login.d.ts +256 -12
- package/dist/src/commands/login.d.ts.map +1 -1
- package/dist/src/commands/login.js +978 -50
- package/dist/src/commands/login.js.map +1 -1
- package/dist/src/commands/peer-addressing.d.ts +51 -0
- package/dist/src/commands/peer-addressing.d.ts.map +1 -0
- package/dist/src/commands/peer-addressing.js +64 -0
- package/dist/src/commands/peer-addressing.js.map +1 -0
- package/dist/src/commands/port-ownership.d.ts +69 -0
- package/dist/src/commands/port-ownership.d.ts.map +1 -0
- package/dist/src/commands/port-ownership.js +161 -0
- package/dist/src/commands/port-ownership.js.map +1 -0
- package/dist/src/commands/registry-publish.d.ts +3 -0
- package/dist/src/commands/registry-publish.d.ts.map +1 -0
- package/dist/src/commands/registry-publish.js +161 -0
- package/dist/src/commands/registry-publish.js.map +1 -0
- package/dist/src/commands/registry.d.ts +146 -2
- package/dist/src/commands/registry.d.ts.map +1 -1
- package/dist/src/commands/registry.js +541 -85
- package/dist/src/commands/registry.js.map +1 -1
- package/dist/src/commands/secrets/index.d.ts.map +1 -1
- package/dist/src/commands/secrets/index.js +15 -1
- package/dist/src/commands/secrets/index.js.map +1 -1
- package/dist/src/commands/secrets/migrate-config.d.ts +24 -0
- package/dist/src/commands/secrets/migrate-config.d.ts.map +1 -0
- package/dist/src/commands/secrets/migrate-config.js +277 -0
- package/dist/src/commands/secrets/migrate-config.js.map +1 -0
- package/dist/src/commands/secrets/set.d.ts +1 -0
- package/dist/src/commands/secrets/set.d.ts.map +1 -1
- package/dist/src/commands/secrets/set.js +96 -2
- package/dist/src/commands/secrets/set.js.map +1 -1
- package/dist/src/commands/skills.d.ts +34 -0
- package/dist/src/commands/skills.d.ts.map +1 -0
- package/dist/src/commands/skills.js +207 -0
- package/dist/src/commands/skills.js.map +1 -0
- package/dist/src/commands/stack.d.ts.map +1 -1
- package/dist/src/commands/stack.js +361 -23
- package/dist/src/commands/stack.js.map +1 -1
- package/dist/src/commands/temporal.d.ts +15 -0
- package/dist/src/commands/temporal.d.ts.map +1 -0
- package/dist/src/commands/temporal.js +781 -0
- package/dist/src/commands/temporal.js.map +1 -0
- package/dist/src/commands/tenant.d.ts +56 -0
- package/dist/src/commands/tenant.d.ts.map +1 -0
- package/dist/src/commands/tenant.js +233 -0
- package/dist/src/commands/tenant.js.map +1 -0
- package/dist/src/commands/tunnel/index.d.ts +49 -3
- package/dist/src/commands/tunnel/index.d.ts.map +1 -1
- package/dist/src/commands/tunnel/index.js +331 -8
- package/dist/src/commands/tunnel/index.js.map +1 -1
- package/dist/src/commands/vcs/clone.d.ts +3 -0
- package/dist/src/commands/vcs/clone.d.ts.map +1 -0
- package/dist/src/commands/vcs/clone.js +20 -0
- package/dist/src/commands/vcs/clone.js.map +1 -0
- package/dist/src/commands/vcs/common.d.ts +21 -0
- package/dist/src/commands/vcs/common.d.ts.map +1 -0
- package/dist/src/commands/vcs/common.js +62 -0
- package/dist/src/commands/vcs/common.js.map +1 -0
- package/dist/src/commands/vcs/drafts.d.ts +13 -0
- package/dist/src/commands/vcs/drafts.d.ts.map +1 -0
- package/dist/src/commands/vcs/drafts.js +45 -0
- package/dist/src/commands/vcs/drafts.js.map +1 -0
- package/dist/src/commands/vcs/get.d.ts +8 -0
- package/dist/src/commands/vcs/get.d.ts.map +1 -0
- package/dist/src/commands/vcs/get.js +61 -0
- package/dist/src/commands/vcs/get.js.map +1 -0
- package/dist/src/commands/vcs/index.d.ts +3 -0
- package/dist/src/commands/vcs/index.d.ts.map +1 -0
- package/dist/src/commands/vcs/index.js +58 -0
- package/dist/src/commands/vcs/index.js.map +1 -0
- package/dist/src/commands/vcs/propose.d.ts +23 -0
- package/dist/src/commands/vcs/propose.d.ts.map +1 -0
- package/dist/src/commands/vcs/propose.js +94 -0
- package/dist/src/commands/vcs/propose.js.map +1 -0
- package/dist/src/commands/vcs/review.d.ts +15 -0
- package/dist/src/commands/vcs/review.d.ts.map +1 -0
- package/dist/src/commands/vcs/review.js +35 -0
- package/dist/src/commands/vcs/review.js.map +1 -0
- package/dist/src/commands/vcs-enrich.d.ts +15 -0
- package/dist/src/commands/vcs-enrich.d.ts.map +1 -0
- package/dist/src/commands/vcs-enrich.js +28 -0
- package/dist/src/commands/vcs-enrich.js.map +1 -0
- package/dist/src/commands/vpn/index.d.ts +24 -0
- package/dist/src/commands/vpn/index.d.ts.map +1 -0
- package/dist/src/commands/vpn/index.js +543 -0
- package/dist/src/commands/vpn/index.js.map +1 -0
- package/dist/src/commands/vpn/tunnel.d.ts +11 -0
- package/dist/src/commands/vpn/tunnel.d.ts.map +1 -0
- package/dist/src/commands/vpn/tunnel.js +188 -0
- package/dist/src/commands/vpn/tunnel.js.map +1 -0
- package/dist/src/commands/workflow.d.ts +24 -0
- package/dist/src/commands/workflow.d.ts.map +1 -0
- package/dist/src/commands/workflow.js +577 -0
- package/dist/src/commands/workflow.js.map +1 -0
- package/dist/src/docs/assemble.d.ts +217 -0
- package/dist/src/docs/assemble.d.ts.map +1 -0
- package/dist/src/docs/assemble.js +739 -0
- package/dist/src/docs/assemble.js.map +1 -0
- package/dist/src/docs/cli-reference.d.ts +93 -0
- package/dist/src/docs/cli-reference.d.ts.map +1 -0
- package/dist/src/docs/cli-reference.js +256 -0
- package/dist/src/docs/cli-reference.js.map +1 -0
- package/dist/src/docs/discover.d.ts +60 -0
- package/dist/src/docs/discover.d.ts.map +1 -0
- package/dist/src/docs/discover.js +233 -0
- package/dist/src/docs/discover.js.map +1 -0
- package/dist/src/docs/portal.d.ts +79 -0
- package/dist/src/docs/portal.d.ts.map +1 -0
- package/dist/src/docs/portal.js +242 -0
- package/dist/src/docs/portal.js.map +1 -0
- package/dist/src/docs/registry-docs.d.ts +43 -0
- package/dist/src/docs/registry-docs.d.ts.map +1 -0
- package/dist/src/docs/registry-docs.js +138 -0
- package/dist/src/docs/registry-docs.js.map +1 -0
- package/dist/src/docs/schema.d.ts +48 -0
- package/dist/src/docs/schema.d.ts.map +1 -0
- package/dist/src/docs/schema.js +96 -0
- package/dist/src/docs/schema.js.map +1 -0
- package/dist/src/docs/serve.d.ts +27 -0
- package/dist/src/docs/serve.d.ts.map +1 -0
- package/dist/src/docs/serve.js +102 -0
- package/dist/src/docs/serve.js.map +1 -0
- package/dist/src/docs/start.d.ts +80 -0
- package/dist/src/docs/start.d.ts.map +1 -0
- package/dist/src/docs/start.js +313 -0
- package/dist/src/docs/start.js.map +1 -0
- package/dist/src/eval/agent-eval.d.mts +14 -0
- package/dist/src/eval/agent-eval.d.mts.map +1 -0
- package/dist/src/eval/agent-eval.mjs +273 -0
- package/dist/src/eval/agent-eval.mjs.map +1 -0
- package/dist/src/index.js +624 -7
- package/dist/src/index.js.map +7 -1
- package/dist/src/program.d.ts +26 -0
- package/dist/src/program.d.ts.map +1 -0
- package/dist/src/program.js +76 -0
- package/dist/src/program.js.map +1 -0
- package/dist/src/utils/auth-preflight.d.ts +159 -0
- package/dist/src/utils/auth-preflight.d.ts.map +1 -0
- package/dist/src/utils/auth-preflight.js +298 -0
- package/dist/src/utils/auth-preflight.js.map +1 -0
- package/dist/src/utils/aws-auth.d.ts +181 -0
- package/dist/src/utils/aws-auth.d.ts.map +1 -0
- package/dist/src/utils/aws-auth.js +527 -0
- package/dist/src/utils/aws-auth.js.map +1 -0
- package/dist/src/utils/bastion.d.ts +1 -1
- package/dist/src/utils/bastion.d.ts.map +1 -1
- package/dist/src/utils/bastion.js +29 -8
- package/dist/src/utils/bastion.js.map +1 -1
- package/dist/src/utils/build-info.d.ts +33 -0
- package/dist/src/utils/build-info.d.ts.map +1 -0
- package/dist/src/utils/build-info.js +102 -0
- package/dist/src/utils/build-info.js.map +1 -0
- package/dist/src/utils/capture-history.d.ts +62 -0
- package/dist/src/utils/capture-history.d.ts.map +1 -0
- package/dist/src/utils/capture-history.js +94 -0
- package/dist/src/utils/capture-history.js.map +1 -0
- package/dist/src/utils/deploy-preflight.d.ts +52 -0
- package/dist/src/utils/deploy-preflight.d.ts.map +1 -0
- package/dist/src/utils/deploy-preflight.js +183 -0
- package/dist/src/utils/deploy-preflight.js.map +1 -0
- package/dist/src/utils/errors.d.ts +75 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/errors.js +106 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/first-party-contexts.d.ts +40 -0
- package/dist/src/utils/first-party-contexts.d.ts.map +1 -0
- package/dist/src/utils/first-party-contexts.js +53 -0
- package/dist/src/utils/first-party-contexts.js.map +1 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +2 -0
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/kubeconfig.d.ts +62 -0
- package/dist/src/utils/kubeconfig.d.ts.map +1 -0
- package/dist/src/utils/kubeconfig.js +118 -0
- package/dist/src/utils/kubeconfig.js.map +1 -0
- package/dist/src/utils/log.d.ts +27 -1
- package/dist/src/utils/log.d.ts.map +1 -1
- package/dist/src/utils/log.js +59 -5
- package/dist/src/utils/log.js.map +1 -1
- package/dist/src/utils/pid.d.ts +47 -0
- package/dist/src/utils/pid.d.ts.map +1 -0
- package/dist/src/utils/pid.js +83 -0
- package/dist/src/utils/pid.js.map +1 -0
- package/dist/src/utils/pulumi-run.d.ts +23 -0
- package/dist/src/utils/pulumi-run.d.ts.map +1 -0
- package/dist/src/utils/pulumi-run.js +112 -0
- package/dist/src/utils/pulumi-run.js.map +1 -0
- package/dist/src/utils/pulumi.d.ts +15 -0
- package/dist/src/utils/pulumi.d.ts.map +1 -1
- package/dist/src/utils/pulumi.js +35 -0
- package/dist/src/utils/pulumi.js.map +1 -1
- package/dist/src/utils/reachability.d.ts +29 -0
- package/dist/src/utils/reachability.d.ts.map +1 -0
- package/dist/src/utils/reachability.js +81 -0
- package/dist/src/utils/reachability.js.map +1 -0
- package/dist/src/utils/recover-conversation.d.ts +154 -0
- package/dist/src/utils/recover-conversation.d.ts.map +1 -0
- package/dist/src/utils/recover-conversation.js +314 -0
- package/dist/src/utils/recover-conversation.js.map +1 -0
- package/dist/src/utils/registry-broker.d.ts +148 -0
- package/dist/src/utils/registry-broker.d.ts.map +1 -0
- package/dist/src/utils/registry-broker.js +180 -0
- package/dist/src/utils/registry-broker.js.map +1 -0
- package/dist/src/utils/socks-forward.d.ts +40 -0
- package/dist/src/utils/socks-forward.d.ts.map +1 -0
- package/dist/src/utils/socks-forward.js +97 -0
- package/dist/src/utils/socks-forward.js.map +1 -0
- package/dist/src/utils/stack-flag.d.ts +23 -0
- package/dist/src/utils/stack-flag.d.ts.map +1 -0
- package/dist/src/utils/stack-flag.js +41 -0
- package/dist/src/utils/stack-flag.js.map +1 -0
- package/dist/src/utils/tailscale-targets.d.ts +52 -0
- package/dist/src/utils/tailscale-targets.d.ts.map +1 -0
- package/dist/src/utils/tailscale-targets.js +93 -0
- package/dist/src/utils/tailscale-targets.js.map +1 -0
- package/dist/src/utils/tailscale.d.ts +277 -0
- package/dist/src/utils/tailscale.d.ts.map +1 -0
- package/dist/src/utils/tailscale.js +1007 -0
- package/dist/src/utils/tailscale.js.map +1 -0
- package/dist/src/utils/temporal-auth.d.ts +43 -0
- package/dist/src/utils/temporal-auth.d.ts.map +1 -0
- package/dist/src/utils/temporal-auth.js +176 -0
- package/dist/src/utils/temporal-auth.js.map +1 -0
- package/dist/src/utils/temporal-codec.d.ts +101 -0
- package/dist/src/utils/temporal-codec.d.ts.map +1 -0
- package/dist/src/utils/temporal-codec.js +319 -0
- package/dist/src/utils/temporal-codec.js.map +1 -0
- package/dist/src/utils/tunnel-ownership.d.ts +130 -0
- package/dist/src/utils/tunnel-ownership.d.ts.map +1 -0
- package/dist/src/utils/tunnel-ownership.js +274 -0
- package/dist/src/utils/tunnel-ownership.js.map +1 -0
- package/dist/src/utils/vpn-join.d.ts +32 -0
- package/dist/src/utils/vpn-join.d.ts.map +1 -0
- package/dist/src/utils/vpn-join.js +62 -0
- package/dist/src/utils/vpn-join.js.map +1 -0
- package/dist/src/utils/vpn.d.ts +62 -0
- package/dist/src/utils/vpn.d.ts.map +1 -0
- package/dist/src/utils/vpn.js +183 -0
- package/dist/src/utils/vpn.js.map +1 -0
- package/dist/src/utils/workflow-fingerprint.d.ts +49 -0
- package/dist/src/utils/workflow-fingerprint.d.ts.map +1 -0
- package/dist/src/utils/workflow-fingerprint.js +135 -0
- package/dist/src/utils/workflow-fingerprint.js.map +1 -0
- package/dist/src/utils/worktree-identity.d.ts +86 -0
- package/dist/src/utils/worktree-identity.d.ts.map +1 -0
- package/dist/src/utils/worktree-identity.js +164 -0
- package/dist/src/utils/worktree-identity.js.map +1 -0
- package/fragments/agents/AGENTS.md.hbs +92 -0
- package/fragments/agents/CLAUDE.md.hbs +8 -0
- package/fragments/base/Pulumi.dev.yaml.hbs +10 -0
- package/fragments/base/Pulumi.yaml.hbs +9 -0
- package/fragments/base/index.ts.hbs +107 -0
- package/fragments/base/package.json.hbs +22 -0
- package/{templates/api-web-db/api → fragments/base}/tsconfig.json +3 -4
- package/fragments/bucket/api/src/storage.ts.hbs +81 -0
- package/fragments/database/api/src/db.ts.hbs +23 -0
- package/fragments/database/prisma/schema.prisma.hbs +18 -0
- package/{templates/api-web-db → fragments/service}/api/.dockerignore +2 -0
- package/fragments/service/api/package.json.hbs +40 -0
- package/fragments/service/api/src/index.ts.hbs +58 -0
- package/{templates/api-web-db → fragments/service/api}/tsconfig.json +5 -3
- package/fragments/temporal/worker/.dockerignore +4 -0
- package/fragments/temporal/worker/Dockerfile +15 -0
- package/{templates/temporal-api-worker → fragments/temporal}/worker/package.json.hbs +3 -2
- package/fragments/temporal/worker/src/activities.ts.hbs +14 -0
- package/fragments/temporal/worker/src/worker.ts.hbs +27 -0
- package/fragments/temporal/worker/src/workflows.ts.hbs +24 -0
- package/fragments/temporal/worker/tsconfig.json +13 -0
- package/package.json +36 -22
- package/skills/core/SKILL.md +365 -0
- package/skills/pull-remote-agent-context/SKILL.md +194 -0
- package/stack/docker-compose.hub.yml +134 -0
- package/stack/docker-compose.yml +447 -0
- package/stack/hub/Dockerfile.api +18 -0
- package/stack/hub/Dockerfile.auth +10 -0
- package/stack/hub/Dockerfile.ui +10 -0
- package/stack/init/01-databases.sql +12 -0
- package/stack/observability/blackbox.yml +20 -0
- package/stack/observability/otel-collector.yaml +73 -0
- package/stack/observability/prometheus.yml +36 -0
- package/stack/observability/tempo.yaml +25 -0
- package/stack/temporal/local.yaml +44 -0
- package/templates/api-auth/AGENTS.md.hbs +16 -0
- package/templates/api-auth/Pulumi.dev.yaml.hbs +8 -0
- package/templates/api-auth/Pulumi.yaml.hbs +8 -0
- package/templates/api-auth/README.md.hbs +67 -0
- package/templates/api-auth/api/package.json.hbs +28 -0
- package/templates/api-auth/api/src/index.ts.hbs +96 -0
- package/templates/api-auth/api/src/schema.ts.hbs +35 -0
- package/templates/api-auth/api/src/seed-authz.ts.hbs +48 -0
- package/templates/api-auth/api/src/spicedb-http-provider.ts.hbs +89 -0
- package/templates/api-auth/index.ts.hbs +65 -0
- package/templates/api-auth/package.json.hbs +20 -0
- package/templates/api-auth/skills/develop/SKILL.md.hbs +32 -0
- package/templates/api-role-gating/AGENTS.md.hbs +20 -0
- package/templates/api-role-gating/Pulumi.dev.yaml.hbs +8 -0
- package/templates/api-role-gating/Pulumi.yaml.hbs +8 -0
- package/templates/api-role-gating/README.md.hbs +64 -0
- package/templates/api-role-gating/api/Dockerfile +17 -0
- package/templates/api-role-gating/api/package.json.hbs +28 -0
- package/templates/api-role-gating/api/src/authn.ts.hbs +29 -0
- package/templates/api-role-gating/api/src/authz.ts.hbs +12 -0
- package/templates/api-role-gating/api/src/main.ts.hbs +58 -0
- package/templates/api-role-gating/api/src/schema.ts.hbs +22 -0
- package/templates/api-role-gating/api/tsconfig.json +13 -0
- package/templates/api-role-gating/index.ts.hbs +107 -0
- package/templates/api-role-gating/package.json.hbs +21 -0
- package/templates/api-role-gating/skills/develop/SKILL.md.hbs +60 -0
- package/templates/api-role-gating/tsconfig.json +10 -0
- package/templates/apps-repo/README.md.hbs +24 -0
- package/templates/apps-repo/gitignore +41 -0
- package/templates/apps-repo/npmrc.hbs +7 -0
- package/templates/apps-repo/package.json.hbs +15 -0
- package/templates/apps-repo/pnpm-workspace.yaml +3 -0
- package/templates/apps-repo/tsconfig.json +18 -0
- package/templates/external-service/AGENTS.md.hbs +20 -0
- package/templates/external-service/Pulumi.dev.yaml.hbs +8 -0
- package/templates/external-service/Pulumi.yaml.hbs +8 -0
- package/templates/external-service/README.md.hbs +56 -0
- package/templates/external-service/api/Dockerfile +15 -0
- package/templates/external-service/api/package.json.hbs +25 -0
- package/templates/external-service/api/src/index.ts.hbs +81 -0
- package/templates/external-service/index.ts.hbs +82 -0
- package/templates/external-service/mocks/vendorpay/package.json.hbs +9 -0
- package/templates/external-service/mocks/vendorpay/server.mjs.hbs +61 -0
- package/templates/external-service/package.json.hbs +34 -0
- package/templates/external-service/skills/develop/SKILL.md.hbs +55 -0
- package/templates/external-service/tsconfig.json +10 -0
- package/templates/platform-repo/AGENTS.md.hbs +18 -0
- package/templates/platform-repo/README.md.hbs +38 -0
- package/templates/platform-repo/core/Pulumi.yaml.hbs +12 -0
- package/templates/platform-repo/core/Pulumi.{{tenant}}-{{env}}.yaml.hbs +57 -0
- package/templates/platform-repo/core/index.ts +62 -0
- package/templates/platform-repo/core/package.json.hbs +22 -0
- package/templates/platform-repo/core/tsconfig.json +8 -0
- package/templates/platform-repo/package.json.hbs +15 -0
- package/templates/platform-repo/platform/Pulumi.yaml.hbs +12 -0
- package/templates/platform-repo/platform/Pulumi.{{tenant}}-{{env}}.yaml.hbs +59 -0
- package/templates/platform-repo/platform/index.ts +95 -0
- package/templates/platform-repo/platform/package.json.hbs +26 -0
- package/templates/platform-repo/platform/tsconfig.json +8 -0
- package/templates/platform-repo/pnpm-workspace.yaml +3 -0
- package/templates/workflow/AGENTS.md.hbs +15 -0
- package/templates/workflow/Pulumi.dev.yaml.hbs +8 -0
- package/templates/workflow/Pulumi.yaml.hbs +8 -0
- package/templates/workflow/README.md.hbs +45 -0
- package/templates/workflow/api/.dockerignore +4 -0
- package/templates/workflow/api/Dockerfile +15 -0
- package/templates/{temporal-api-worker → workflow}/api/package.json.hbs +8 -6
- package/templates/workflow/api/src/index.ts.hbs +130 -0
- package/templates/workflow/api/tsconfig.json +14 -0
- package/templates/workflow/index.ts.hbs +67 -0
- package/templates/workflow/package.json.hbs +20 -0
- package/templates/workflow/skills/develop/SKILL.md.hbs +32 -0
- package/templates/workflow/tsconfig.json +10 -0
- package/templates/workflow/worker/.dockerignore +4 -0
- package/templates/workflow/worker/Dockerfile +13 -0
- package/templates/workflow/worker/package.json.hbs +25 -0
- package/templates/workflow/worker/src/worker.ts.hbs +24 -0
- package/templates/workflow/worker/tsconfig.json +14 -0
- package/dist/src/commands/devbox.d.ts +0 -22
- package/dist/src/commands/devbox.d.ts.map +0 -1
- package/dist/src/commands/devbox.js +0 -463
- package/dist/src/commands/devbox.js.map +0 -1
- package/templates/api-web-db/api/Dockerfile +0 -16
- package/templates/api-web-db/api/package.json.hbs +0 -21
- package/templates/api-web-db/api/src/index.ts.hbs +0 -123
- package/templates/api-web-db/package.json.hbs +0 -27
- package/templates/api-web-db/sst.config.ts.hbs +0 -151
- package/templates/api-web-db/web/.dockerignore +0 -3
- package/templates/api-web-db/web/Dockerfile +0 -17
- package/templates/api-web-db/web/app/lib/db.server.ts +0 -36
- package/templates/api-web-db/web/app/root.tsx +0 -29
- package/templates/api-web-db/web/app/routes/home.tsx.hbs +0 -114
- package/templates/api-web-db/web/app/routes.ts +0 -3
- package/templates/api-web-db/web/package.json.hbs +0 -30
- package/templates/api-web-db/web/prisma/schema.prisma +0 -25
- package/templates/api-web-db/web/prisma.config.ts +0 -18
- package/templates/api-web-db/web/react-router.config.ts +0 -5
- package/templates/api-web-db/web/tsconfig.json +0 -19
- package/templates/api-web-db/web/vite.config.ts +0 -9
- package/templates/temporal-api-worker/README.md.hbs +0 -133
- package/templates/temporal-api-worker/api/src/index.ts.hbs +0 -145
- package/templates/temporal-api-worker/package.json.hbs +0 -29
- package/templates/temporal-api-worker/sst.config.ts.hbs +0 -161
- package/templates/temporal-api-worker/worker/Dockerfile +0 -11
- package/templates/temporal-api-worker/worker/src/bundle-workflows.ts +0 -38
- package/templates/temporal-api-worker/worker/src/worker.ts.hbs +0 -93
- /package/templates/{temporal-api-worker → api-auth}/api/.dockerignore +0 -0
- /package/templates/{temporal-api-worker → api-auth}/api/Dockerfile +0 -0
- /package/templates/{temporal-api-worker → api-auth}/api/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker → api-auth}/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker/worker → api-role-gating/api}/.dockerignore +0 -0
- /package/templates/{temporal-api-worker/worker → external-service/api}/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker → workflow}/api/src/encryption-codec.ts +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/activities.ts.hbs +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/encryption-codec.ts +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/workflows.ts.hbs +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared agent-api client: resolves a `--target`/`--api-url`/`--context`
|
|
3
|
+
* triple (via the `@mesh-tech/agent-targets` registry) to a concrete
|
|
4
|
+
* `AgentApiTarget`, and fetches agent-api paths against it with auth.
|
|
5
|
+
*
|
|
6
|
+
* Consumed by `mesh artifacts get` today; later `mesh conversations`
|
|
7
|
+
* commands share the same resolution + fetch path.
|
|
8
|
+
*/
|
|
9
|
+
export interface AgentApiTarget {
|
|
10
|
+
apiBaseUrl: string;
|
|
11
|
+
loginContext?: string;
|
|
12
|
+
conversationPathPrefix?: string;
|
|
13
|
+
hubBaseUrl?: string;
|
|
14
|
+
token?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class TargetResolutionError extends Error {
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Precedence:
|
|
20
|
+
* 1. --api-url (+ --context, default "mesh.dev") — highest.
|
|
21
|
+
* 2. --target explicitly given → registry: loaded+found wins, loaded+missing
|
|
22
|
+
* throws (unknown target), invalid throws (with the registry's parse
|
|
23
|
+
* error), absent throws ("no registry" guidance).
|
|
24
|
+
* 3. neither given → loaded registry's defaultTarget; otherwise (registry
|
|
25
|
+
* absent/invalid) falls back to AGENT_API_URL/API_URL/localhost:8787 —
|
|
26
|
+
* this path NEVER throws (backward compat with the old no-flag behavior).
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveTarget(opts: {
|
|
29
|
+
target?: string;
|
|
30
|
+
apiUrl?: string;
|
|
31
|
+
context?: string;
|
|
32
|
+
}): AgentApiTarget;
|
|
33
|
+
/**
|
|
34
|
+
* Fetch an agent-api path on the resolved target, with auth. Caller checks
|
|
35
|
+
* status.
|
|
36
|
+
*
|
|
37
|
+
* `redirect: "manual"` is deliberate: an unauthenticated `/v1` call against a
|
|
38
|
+
* deployed agent 302s to Zitadel. With the default `redirect: "follow"`,
|
|
39
|
+
* fetch follows it and returns a `200` HTML login page — `describeHttpError`'s
|
|
40
|
+
* auth branch never fires and the caller sees a raw JSON-parse error instead
|
|
41
|
+
* of auth guidance. With `"manual"`, the redirect surfaces as a Response with
|
|
42
|
+
* `type: "opaqueredirect"` (status 0), which `describeHttpError` already maps
|
|
43
|
+
* to the "auth did not reach the agent" message.
|
|
44
|
+
*/
|
|
45
|
+
export declare function agentApiFetch(target: AgentApiTarget, apiPath: string): Promise<Response>;
|
|
46
|
+
/**
|
|
47
|
+
* Turn a thrown fetch error into local-vs-remote-aware guidance. A bare
|
|
48
|
+
* `ECONNREFUSED`/`fetch failed` (also `ENOTFOUND`/`EAI_AGAIN`) means
|
|
49
|
+
* something different depending on the target: against a LOCAL apiBaseUrl it
|
|
50
|
+
* almost always means the local `mesh dev` agent API isn't running; against
|
|
51
|
+
* a REMOTE one it means a down host, a DNS typo, a dropped VPN/tailscale
|
|
52
|
+
* connection, or (occasionally) an auth redirect that the fetch layer
|
|
53
|
+
* couldn't follow. Only actual network throws get this treatment — every
|
|
54
|
+
* other error (including ones `describeHttpError` already produced) passes
|
|
55
|
+
* through unchanged so callers can log it without double guidance.
|
|
56
|
+
*/
|
|
57
|
+
export declare function describeNetworkError(err: unknown, target: AgentApiTarget): string;
|
|
58
|
+
/**
|
|
59
|
+
* Shared, target-aware renderer for a non-ok agent-api response. Used by
|
|
60
|
+
* both `mesh conversations` (list/show/artifacts) and `mesh artifacts get`
|
|
61
|
+
* so there is exactly one place that turns an HTTP failure into human
|
|
62
|
+
* guidance — no more dev-oriented "restart the API process" advice, no more
|
|
63
|
+
* a second parallel renderer for `show`'s 503 special-case.
|
|
64
|
+
*
|
|
65
|
+
* `ctx.id` (a conversation id, when the caller has one) enables the
|
|
66
|
+
* `mesh temporal recover-conversation <id>` hint on a `conversation_unavailable`
|
|
67
|
+
* 503 and is echoed in the 404 message for context.
|
|
68
|
+
*
|
|
69
|
+
* Response shapes are verified against
|
|
70
|
+
* `packages/agent-sdk/src/agent-api/server.ts` — do not re-infer:
|
|
71
|
+
* - 404 → `{ error: "conversation not found", conversationId }`.
|
|
72
|
+
* - 503 conversation_unavailable → `{ error: "conversation_unavailable",
|
|
73
|
+
* conversationId, detail: "<text>" }` — human text is under `detail`,
|
|
74
|
+
* NOT `message`.
|
|
75
|
+
*/
|
|
76
|
+
export declare function describeHttpError(res: Response, target: AgentApiTarget, ctx?: {
|
|
77
|
+
id?: string;
|
|
78
|
+
}): Promise<string>;
|
|
79
|
+
//# sourceMappingURL=agent-api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-api-client.d.ts","sourceRoot":"","sources":["../../../src/commands/agent-api-client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,qBAAsB,SAAQ,KAAK;CAAG;AAKnD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,cAAc,CAuD1G;AAWD;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAG9F;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,CAajF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE,cAAc,EACtB,GAAG,CAAC,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GACpB,OAAO,CAAC,MAAM,CAAC,CA4BjB"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared agent-api client: resolves a `--target`/`--api-url`/`--context`
|
|
3
|
+
* triple (via the `@mesh-tech/agent-targets` registry) to a concrete
|
|
4
|
+
* `AgentApiTarget`, and fetches agent-api paths against it with auth.
|
|
5
|
+
*
|
|
6
|
+
* Consumed by `mesh artifacts get` today; later `mesh conversations`
|
|
7
|
+
* commands share the same resolution + fetch path.
|
|
8
|
+
*/
|
|
9
|
+
import { loadTargetsFile, stripSlash } from "@mesh-tech/agent-targets";
|
|
10
|
+
import { getValidToken } from "./login.js";
|
|
11
|
+
import { logWarn } from "../utils/log.js";
|
|
12
|
+
const DEFAULT_AUTH_CONTEXT = "mesh.dev";
|
|
13
|
+
/** Matches a local (`mesh dev`-hosted) apiBaseUrl — shared by `authHeaders`'s
|
|
14
|
+
* dev-identity fallback and `describeNetworkError`'s local/remote gating. */
|
|
15
|
+
const LOCAL_URL_RE = /^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])(:|\/|$)/i;
|
|
16
|
+
export class TargetResolutionError extends Error {
|
|
17
|
+
}
|
|
18
|
+
const NO_REGISTRY_GUIDANCE = "no registry — add `mesh agent-targets add <name>` or pass --api-url";
|
|
19
|
+
/**
|
|
20
|
+
* Precedence:
|
|
21
|
+
* 1. --api-url (+ --context, default "mesh.dev") — highest.
|
|
22
|
+
* 2. --target explicitly given → registry: loaded+found wins, loaded+missing
|
|
23
|
+
* throws (unknown target), invalid throws (with the registry's parse
|
|
24
|
+
* error), absent throws ("no registry" guidance).
|
|
25
|
+
* 3. neither given → loaded registry's defaultTarget; otherwise (registry
|
|
26
|
+
* absent/invalid) falls back to AGENT_API_URL/API_URL/localhost:8787 —
|
|
27
|
+
* this path NEVER throws (backward compat with the old no-flag behavior).
|
|
28
|
+
*/
|
|
29
|
+
export function resolveTarget(opts) {
|
|
30
|
+
if (opts.apiUrl) {
|
|
31
|
+
return { apiBaseUrl: stripSlash(opts.apiUrl), loginContext: opts.context || DEFAULT_AUTH_CONTEXT };
|
|
32
|
+
}
|
|
33
|
+
const res = loadTargetsFile();
|
|
34
|
+
if (opts.target) {
|
|
35
|
+
if (res.status === "invalid") {
|
|
36
|
+
throw new TargetResolutionError(`Registry at ${res.path} is invalid: ${res.message}. Fix it, or pass --api-url <url>.`);
|
|
37
|
+
}
|
|
38
|
+
if (res.status === "absent") {
|
|
39
|
+
throw new TargetResolutionError(`No agent target given and ${NO_REGISTRY_GUIDANCE}.`);
|
|
40
|
+
}
|
|
41
|
+
const entry = res.targets[opts.target];
|
|
42
|
+
if (!entry) {
|
|
43
|
+
throw new TargetResolutionError(`Unknown target "${opts.target}". Available: ${Object.keys(res.targets).join(", ") || "(none)"}. ` +
|
|
44
|
+
`Add it with 'mesh agent-targets add ${opts.target}' or pass --api-url.`);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
apiBaseUrl: entry.apiBaseUrl,
|
|
48
|
+
loginContext: entry.loginContext,
|
|
49
|
+
conversationPathPrefix: entry.conversationPathPrefix,
|
|
50
|
+
hubBaseUrl: entry.hubBaseUrl,
|
|
51
|
+
token: entry.token,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (res.status === "loaded") {
|
|
55
|
+
// RegistrySchema's refine() guarantees defaultTarget names an existing entry.
|
|
56
|
+
const entry = res.targets[res.defaultTarget];
|
|
57
|
+
return {
|
|
58
|
+
apiBaseUrl: entry.apiBaseUrl,
|
|
59
|
+
loginContext: entry.loginContext,
|
|
60
|
+
conversationPathPrefix: entry.conversationPathPrefix,
|
|
61
|
+
hubBaseUrl: entry.hubBaseUrl,
|
|
62
|
+
token: entry.token,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (res.status === "invalid") {
|
|
66
|
+
// Neither --target nor --api-url given, so this is the implicit/no-flag
|
|
67
|
+
// path — warn (don't throw) so a broken registry file doesn't silently
|
|
68
|
+
// swallow itself while the CLI quietly falls back to env/localhost.
|
|
69
|
+
logWarn(`Agent-targets registry at ${res.path} is invalid: ${res.message}. Falling back to env/localhost.`);
|
|
70
|
+
}
|
|
71
|
+
// No target/api-url given and no usable registry: preserve the old
|
|
72
|
+
// `mesh artifacts get` no-flag behavior — never throw here.
|
|
73
|
+
const fallbackUrl = process.env.AGENT_API_URL || process.env.API_URL || "http://localhost:8787";
|
|
74
|
+
return { apiBaseUrl: stripSlash(fallbackUrl), loginContext: opts.context || DEFAULT_AUTH_CONTEXT };
|
|
75
|
+
}
|
|
76
|
+
async function authHeaders(target) {
|
|
77
|
+
if (target.token)
|
|
78
|
+
return { Authorization: `Bearer ${target.token}` };
|
|
79
|
+
const ctx = target.loginContext || DEFAULT_AUTH_CONTEXT;
|
|
80
|
+
const token = await getValidToken(ctx);
|
|
81
|
+
if (token)
|
|
82
|
+
return { Authorization: `Bearer ${token}` };
|
|
83
|
+
if (LOCAL_URL_RE.test(target.apiBaseUrl))
|
|
84
|
+
return { "X-Forwarded-User": "dev-user", "X-Forwarded-Email": "dev@localhost" };
|
|
85
|
+
throw new TargetResolutionError(`No valid credentials for context "${ctx}". Run: mesh login ${ctx}`);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Fetch an agent-api path on the resolved target, with auth. Caller checks
|
|
89
|
+
* status.
|
|
90
|
+
*
|
|
91
|
+
* `redirect: "manual"` is deliberate: an unauthenticated `/v1` call against a
|
|
92
|
+
* deployed agent 302s to Zitadel. With the default `redirect: "follow"`,
|
|
93
|
+
* fetch follows it and returns a `200` HTML login page — `describeHttpError`'s
|
|
94
|
+
* auth branch never fires and the caller sees a raw JSON-parse error instead
|
|
95
|
+
* of auth guidance. With `"manual"`, the redirect surfaces as a Response with
|
|
96
|
+
* `type: "opaqueredirect"` (status 0), which `describeHttpError` already maps
|
|
97
|
+
* to the "auth did not reach the agent" message.
|
|
98
|
+
*/
|
|
99
|
+
export async function agentApiFetch(target, apiPath) {
|
|
100
|
+
const headers = await authHeaders(target);
|
|
101
|
+
return fetch(`${target.apiBaseUrl}${apiPath}`, { headers, redirect: "manual" });
|
|
102
|
+
}
|
|
103
|
+
const NETWORK_ERROR_PATTERN = /ECONNREFUSED|fetch failed|ENOTFOUND|EAI_AGAIN/;
|
|
104
|
+
/**
|
|
105
|
+
* Turn a thrown fetch error into local-vs-remote-aware guidance. A bare
|
|
106
|
+
* `ECONNREFUSED`/`fetch failed` (also `ENOTFOUND`/`EAI_AGAIN`) means
|
|
107
|
+
* something different depending on the target: against a LOCAL apiBaseUrl it
|
|
108
|
+
* almost always means the local `mesh dev` agent API isn't running; against
|
|
109
|
+
* a REMOTE one it means a down host, a DNS typo, a dropped VPN/tailscale
|
|
110
|
+
* connection, or (occasionally) an auth redirect that the fetch layer
|
|
111
|
+
* couldn't follow. Only actual network throws get this treatment — every
|
|
112
|
+
* other error (including ones `describeHttpError` already produced) passes
|
|
113
|
+
* through unchanged so callers can log it without double guidance.
|
|
114
|
+
*/
|
|
115
|
+
export function describeNetworkError(err, target) {
|
|
116
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
117
|
+
if (!NETWORK_ERROR_PATTERN.test(message))
|
|
118
|
+
return message;
|
|
119
|
+
if (LOCAL_URL_RE.test(target.apiBaseUrl)) {
|
|
120
|
+
return "Is the agent API running? Start it with: mesh dev";
|
|
121
|
+
}
|
|
122
|
+
const loginContext = target.loginContext ?? DEFAULT_AUTH_CONTEXT;
|
|
123
|
+
return (`Couldn't reach ${target.apiBaseUrl} — check the URL/VPN/tailscale, ` +
|
|
124
|
+
`or \`mesh login ${loginContext}\` if it's an auth redirect.`);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Shared, target-aware renderer for a non-ok agent-api response. Used by
|
|
128
|
+
* both `mesh conversations` (list/show/artifacts) and `mesh artifacts get`
|
|
129
|
+
* so there is exactly one place that turns an HTTP failure into human
|
|
130
|
+
* guidance — no more dev-oriented "restart the API process" advice, no more
|
|
131
|
+
* a second parallel renderer for `show`'s 503 special-case.
|
|
132
|
+
*
|
|
133
|
+
* `ctx.id` (a conversation id, when the caller has one) enables the
|
|
134
|
+
* `mesh temporal recover-conversation <id>` hint on a `conversation_unavailable`
|
|
135
|
+
* 503 and is echoed in the 404 message for context.
|
|
136
|
+
*
|
|
137
|
+
* Response shapes are verified against
|
|
138
|
+
* `packages/agent-sdk/src/agent-api/server.ts` — do not re-infer:
|
|
139
|
+
* - 404 → `{ error: "conversation not found", conversationId }`.
|
|
140
|
+
* - 503 conversation_unavailable → `{ error: "conversation_unavailable",
|
|
141
|
+
* conversationId, detail: "<text>" }` — human text is under `detail`,
|
|
142
|
+
* NOT `message`.
|
|
143
|
+
*/
|
|
144
|
+
export async function describeHttpError(res, target, ctx) {
|
|
145
|
+
const isRedirect = res.redirected || res.type === "opaqueredirect" || res.status === 302;
|
|
146
|
+
if (res.status === 401 || res.status === 403 || isRedirect) {
|
|
147
|
+
const loginContext = target.loginContext ?? DEFAULT_AUTH_CONTEXT;
|
|
148
|
+
return `auth did not reach the agent — run \`mesh login ${loginContext}\``;
|
|
149
|
+
}
|
|
150
|
+
if (res.status === 404) {
|
|
151
|
+
const idPart = ctx?.id ? ` (${ctx.id})` : "";
|
|
152
|
+
return `conversation/artifact not found${idPart}, or not owned by this identity — run \`mesh conversations list\` to see valid ids.`;
|
|
153
|
+
}
|
|
154
|
+
const bodyText = await res.text();
|
|
155
|
+
if (res.status === 503) {
|
|
156
|
+
try {
|
|
157
|
+
const parsed = JSON.parse(bodyText);
|
|
158
|
+
if (parsed.error === "conversation_unavailable") {
|
|
159
|
+
const message = parsed.detail ?? bodyText;
|
|
160
|
+
const recoverHint = ctx?.id ? `\ntry: mesh temporal recover-conversation ${ctx.id}` : "";
|
|
161
|
+
return `${message}${recoverHint}`;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// Not JSON, or not the shape we expect — fall through to the generic message.
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return `agent-api error ${res.status}: ${bodyText || res.statusText} (${target.apiBaseUrl})`;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=agent-api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-api-client.js","sourceRoot":"","sources":["../../../src/commands/agent-api-client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAExC;6EAC6E;AAC7E,MAAM,YAAY,GAAG,uDAAuD,CAAC;AAU7E,MAAM,OAAO,qBAAsB,SAAQ,KAAK;CAAG;AAEnD,MAAM,oBAAoB,GACxB,qEAAqE,CAAC;AAExE;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,IAA4D;IACxF,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,OAAO,IAAI,oBAAoB,EAAE,CAAC;IACrG,CAAC;IAED,MAAM,GAAG,GAAG,eAAe,EAAE,CAAC;IAE9B,IAAI,IAAI,CAAC,MAAM,E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MAAM,GAAG,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,OAAO,kCAAkC,MAAM,qFAAqF,CAAC;IACvI,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAElC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAwC,CAAC;YAC3E,IAAI,MAAM,CAAC,KAAK,KAAK,0BAA0B,EAAE,CAAC;gBAChD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,IAAI,QAAQ,CAAC;gBAC1C,MAAM,WAAW,GAAG,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,6CAA6C,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACzF,OAAO,GAAG,OAAO,GAAG,WAAW,EAAE,CAAC;YACpC,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,8EAA8E;QAChF,CAAC;IACH,CAAC;IAED,OAAO,mBAAmB,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,KAAK,MAAM,CAAC,UAAU,GAAG,CAAC;AAC/F,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mesh artifacts — manage workflow artifacts from AI agent conversations
|
|
3
|
+
*
|
|
4
|
+
* Commands:
|
|
5
|
+
* mesh artifacts get <ref> Download artifact files to local directory
|
|
6
|
+
*
|
|
7
|
+
* Ref format: <conversationId>:<artifactId>
|
|
8
|
+
* - Full: mesh artifacts get conv-abc123:workflow-artifact
|
|
9
|
+
* - Short: mesh artifacts get conv-abc123 (defaults to "workflow-artifact")
|
|
10
|
+
*/
|
|
11
|
+
import { Command } from "commander";
|
|
12
|
+
export declare function registerArtifactsCommands(program: Command): void;
|
|
13
|
+
//# sourceMappingURL=artifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../src/commands/artifacts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0HpC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqDhE"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mesh artifacts — manage workflow artifacts from AI agent conversations
|
|
3
|
+
*
|
|
4
|
+
* Commands:
|
|
5
|
+
* mesh artifacts get <ref> Download artifact files to local directory
|
|
6
|
+
*
|
|
7
|
+
* Ref format: <conversationId>:<artifactId>
|
|
8
|
+
* - Full: mesh artifacts get conv-abc123:workflow-artifact
|
|
9
|
+
* - Short: mesh artifacts get conv-abc123 (defaults to "workflow-artifact")
|
|
10
|
+
*/
|
|
11
|
+
import * as fs from "fs";
|
|
12
|
+
import * as path from "path";
|
|
13
|
+
import { logError, logInfo, logSuccess, logWarn } from "../utils/log.js";
|
|
14
|
+
import { agentApiFetch, describeHttpError, describeNetworkError, resolveTarget } from "./agent-api-client.js";
|
|
15
|
+
const DEFAULT_ARTIFACT_ID = "workflow-artifact";
|
|
16
|
+
/**
|
|
17
|
+
* Parse an artifact ref: "conversationId:artifactId" or just "conversationId".
|
|
18
|
+
*/
|
|
19
|
+
function parseRef(ref) {
|
|
20
|
+
const colonIdx = ref.indexOf(":");
|
|
21
|
+
if (colonIdx === -1) {
|
|
22
|
+
return { conversationId: ref, artifactId: DEFAULT_ARTIFACT_ID };
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
conversationId: ref.slice(0, colonIdx),
|
|
26
|
+
artifactId: ref.slice(colonIdx + 1),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const DEFAULT_AUTH_CONTEXT = "mesh.dev";
|
|
30
|
+
async function fetchExportBundle(target, conversationId, artifactId) {
|
|
31
|
+
const apiPath = `/v1/conversations/${encodeURIComponent(conversationId)}/artifacts/${encodeURIComponent(artifactId)}/export`;
|
|
32
|
+
const response = await agentApiFetch(target, apiPath);
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
throw new Error(await describeHttpError(response, target, { id: conversationId }));
|
|
35
|
+
}
|
|
36
|
+
return (await response.json());
|
|
37
|
+
}
|
|
38
|
+
async function getArtifact(ref, options, target) {
|
|
39
|
+
const { conversationId, artifactId } = parseRef(ref);
|
|
40
|
+
logInfo(`Fetching ${conversationId}:${artifactId} from ${target.apiBaseUrl}…`);
|
|
41
|
+
const bundle = await fetchExportBundle(target, conversationId, artifactId);
|
|
42
|
+
// Determine output directory
|
|
43
|
+
const outputDir = options.output
|
|
44
|
+
?? path.join("workflows", bundle.primaryWorkflow);
|
|
45
|
+
// Create directory
|
|
46
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
47
|
+
let filesWritten = 0;
|
|
48
|
+
// Write workflow source files
|
|
49
|
+
for (const file of bundle.files) {
|
|
50
|
+
const filePath = path.join(outputDir, file.filename);
|
|
51
|
+
fs.writeFileSync(filePath, file.code, "utf-8");
|
|
52
|
+
logSuccess(` ${file.filename}`);
|
|
53
|
+
filesWritten++;
|
|
54
|
+
}
|
|
55
|
+
// Write README.md from overview
|
|
56
|
+
if (bundle.overview) {
|
|
57
|
+
const readmePath = path.join(outputDir, "README.md");
|
|
58
|
+
fs.writeFileSync(readmePath, bundle.overview, "utf-8");
|
|
59
|
+
logSuccess(` README.md`);
|
|
60
|
+
filesWritten++;
|
|
61
|
+
}
|
|
62
|
+
// Write IR as JSON — always present, essential for IR-only artifacts
|
|
63
|
+
// (from update_workflow) that have no source files.
|
|
64
|
+
if (bundle.ir) {
|
|
65
|
+
const irPath = path.join(outputDir, "workflow-ir.json");
|
|
66
|
+
fs.writeFileSync(irPath, JSON.stringify(bundle.ir, null, 2), "utf-8");
|
|
67
|
+
logSuccess(` workflow-ir.json`);
|
|
68
|
+
filesWritten++;
|
|
69
|
+
}
|
|
70
|
+
// Write metadata file (conversation ref, IR for tooling)
|
|
71
|
+
const metaPath = path.join(outputDir, ".workflow-meta.json");
|
|
72
|
+
const meta = {
|
|
73
|
+
conversationId: bundle.conversationId,
|
|
74
|
+
artifactId,
|
|
75
|
+
primaryWorkflow: bundle.primaryWorkflow,
|
|
76
|
+
exportedAt: bundle.exportedAt,
|
|
77
|
+
files: bundle.files.map((f) => f.filename),
|
|
78
|
+
};
|
|
79
|
+
fs.writeFileSync(metaPath, JSON.stringify(meta, null, 2), "utf-8");
|
|
80
|
+
console.log();
|
|
81
|
+
logSuccess(`Exported ${filesWritten} files to ${outputDir}/`);
|
|
82
|
+
if (bundle.files.length > 1) {
|
|
83
|
+
const primary = bundle.files.find((f) => f.name === bundle.primaryWorkflow);
|
|
84
|
+
if (primary) {
|
|
85
|
+
logInfo(`Entry point: ${primary.filename}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
logInfo(`Ref: ${conversationId}:${artifactId}`);
|
|
89
|
+
}
|
|
90
|
+
export function registerArtifactsCommands(program) {
|
|
91
|
+
const artifacts = program
|
|
92
|
+
.command("artifacts")
|
|
93
|
+
.description("Manage workflow artifacts from AI agent conversations");
|
|
94
|
+
artifacts
|
|
95
|
+
.command("get <ref>")
|
|
96
|
+
.description("Download artifact files from an agent conversation\n\n" +
|
|
97
|
+
"Ref format: <conversationId>:<artifactId>\n" +
|
|
98
|
+
` Short form uses default artifactId "${DEFAULT_ARTIFACT_ID}"`)
|
|
99
|
+
.option("-o, --output <dir>", "Output directory (default: workflows/<workflowName>)")
|
|
100
|
+
.option("--target <name>", "Named agent target from the agent-targets registry")
|
|
101
|
+
.option("--api-url <url>", "Agent API URL (overrides --target; ad-hoc, no registry lookup)")
|
|
102
|
+
.option("--context <ctx>", `Zitadel auth context, used with --api-url (default: ${DEFAULT_AUTH_CONTEXT})`)
|
|
103
|
+
.action(async (ref, opts) => {
|
|
104
|
+
// Resolved outside the try so a network-error catch below can give
|
|
105
|
+
// local-vs-remote-aware guidance (`describeNetworkError` needs the
|
|
106
|
+
// target). If resolution itself throws (bad --target), there's no
|
|
107
|
+
// target to reason about — just report the resolution error.
|
|
108
|
+
let target;
|
|
109
|
+
try {
|
|
110
|
+
target = resolveTarget(opts);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
logError(error instanceof Error ? error.message : String(error));
|
|
114
|
+
process.exitCode = 1;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
await getArtifact(ref, opts, target);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
122
|
+
logError(message);
|
|
123
|
+
// `describeHttpError` covers every HTTP-level failure mode (auth,
|
|
124
|
+
// not-found, 503, generic) with target-aware messages already baked
|
|
125
|
+
// into the thrown message, so it round-trips through here as `hint
|
|
126
|
+
// === message` and is not re-logged. Only a genuine network throw
|
|
127
|
+
// (ECONNREFUSED/"fetch failed"/ENOTFOUND/EAI_AGAIN) — nothing
|
|
128
|
+
// listening at apiBaseUrl, a down host, a DNS typo, a dropped
|
|
129
|
+
// VPN/tailscale connection — gets guidance here, and it differs for
|
|
130
|
+
// a local vs. remote target (see `describeNetworkError`).
|
|
131
|
+
const hint = describeNetworkError(error, target);
|
|
132
|
+
if (hint !== message) {
|
|
133
|
+
logWarn(hint);
|
|
134
|
+
logWarn("Or specify the URL: mesh artifacts get <ref> --api-url https://your-agent-api.example.com");
|
|
135
|
+
}
|
|
136
|
+
process.exitCode = 1;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../../src/commands/artifacts.ts"],"names":[],"mappings":"AA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,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,QAAQ,CAAC,OAAO,CAAC,CAAC;YAElB,kEAAkE;YAClE,oEAAoE;YACpE,mEAAmE;YACnE,kEAAkE;YAClE,8DAA8D;YAC9D,8DAA8D;YAC9D,oEAAoE;YACpE,0DAA0D;YAC1D,MAAM,IAAI,GAAG,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YACjD,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;gBACrB,OAAO,CAAC,IAAI,CAAC,CAAC;gBACd,OAAO,CAAC,2FAA2F,CAAC,CAAC;YACvG,CAAC;YAED,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mesh cluster access — `mesh kubectl` / `mesh logs` / `mesh exec` against a
|
|
3
|
+
* deployed app's EKS cluster, authenticated as the app's Zitadel deployer role
|
|
4
|
+
* (MESH-2060).
|
|
5
|
+
*
|
|
6
|
+
* Reuses exactly what `mesh dev` already does internally: assume the app's
|
|
7
|
+
* deployer role, build a session kubeconfig from the platform `eks` SSM export
|
|
8
|
+
* (`aws eks get-token` — needs neither `eks:DescribeCluster` nor a readable
|
|
9
|
+
* `~/.kube/config`, which macOS TCC blocks for non-FDA shells), and shell out to
|
|
10
|
+
* kubectl with `KUBECONFIG` set.
|
|
11
|
+
*
|
|
12
|
+
* The deployer role's cluster RBAC is namespace-scoped to the tenant's
|
|
13
|
+
* namespaces (verified live: the `<tenant>-<env>-deployers` group grants
|
|
14
|
+
* pods/log/exec read in the app's namespace), so every command defaults to the
|
|
15
|
+
* app's own namespace and callers can still `-n <other>` within the tenant.
|
|
16
|
+
*/
|
|
17
|
+
import { Command } from "commander";
|
|
18
|
+
import { type EnsureKubeconfigFailure } from "../utils/kubeconfig.js";
|
|
19
|
+
/**
|
|
20
|
+
* Render the "couldn't resolve the EKS cluster" failure with the parameter
|
|
21
|
+
* tried and the real exception. The pre-MESH-2515 message guessed "you have
|
|
22
|
+
* SSM read access" at every failure — which sent three investigations after a
|
|
23
|
+
* permission that was never missing when the actual cause was the wrong
|
|
24
|
+
* platform name in the SSM path.
|
|
25
|
+
*/
|
|
26
|
+
export declare function clusterResolveErrorMessage(platformName: string, platformEnv: string, failure?: EnsureKubeconfigFailure): string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the user already scoped the namespace. Deliberately only detects the
|
|
29
|
+
* split forms (`-n foo`, `--namespace foo`, `--namespace=foo`, `-A`), NOT the
|
|
30
|
+
* smashed short form `-nfoo`: our default `-n <ns>` is PREPENDED, and kubectl's
|
|
31
|
+
* pflag lets the later (user-supplied) `-nfoo` win, so a missed detection here is
|
|
32
|
+
* harmless. Do not "fix" this into an append — that would let our default win
|
|
33
|
+
* over the user's intent.
|
|
34
|
+
*/
|
|
35
|
+
export declare function hasNamespaceFlag(args: string[]): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Translate an ergonomic log/exec target into kubectl selector args.
|
|
38
|
+
* - `deployment/x` / `pod/x` (contains `/`) → passed through
|
|
39
|
+
* - `k=v` (contains `=`) → label selector `-l k=v`
|
|
40
|
+
* - bare `<service>` → `-l app=<service>` (the reliable
|
|
41
|
+
* per-service label; deployment names == service names)
|
|
42
|
+
*/
|
|
43
|
+
export declare function targetToSelector(target: string): string[];
|
|
44
|
+
export declare function registerClusterCommands(program: Command): void;
|
|
45
|
+
//# sourceMappingURL=cluster.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster.d.ts","sourceRoot":"","sources":["../../../src/commands/cluster.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAwGhC;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,uBAAuB,GAChC,MAAM,CAiBR;AASD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAExD;AA+BD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAIzD;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2F9D"}
|