@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
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
# {{titleCase name}}
|
|
2
|
-
|
|
3
|
-
Temporal workflow application for {{tenant}}.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
This app demonstrates Temporal workflow orchestration with:
|
|
8
|
-
- **Worker**: Executes workflows and activities
|
|
9
|
-
- **API**: HTTP endpoints to trigger workflows
|
|
10
|
-
|
|
11
|
-
## Prerequisites
|
|
12
|
-
|
|
13
|
-
- MeshPlatform deployed with `temporal: { ... }` enabled
|
|
14
|
-
- AWS credentials with apps-deployer role
|
|
15
|
-
|
|
16
|
-
## Development
|
|
17
|
-
|
|
18
|
-
### 1. Start Dev Server
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
pnpm mesh dev
|
|
22
|
-
# Auto-starts unified tunnel (Temporal gRPC:7233, Web UI:8080, DB:5432)
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### 2. Start Worker Manually
|
|
26
|
-
|
|
27
|
-
Workers don't auto-start because they need the Temporal namespace to exist first.
|
|
28
|
-
After `sst dev` is ready:
|
|
29
|
-
1. Open SST dev UI
|
|
30
|
-
2. Find the worker service
|
|
31
|
-
3. Click to start it
|
|
32
|
-
|
|
33
|
-
### 4. Test Workflows
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
# Trigger greeting workflow
|
|
37
|
-
curl -X POST http://localhost:3000/greet \
|
|
38
|
-
-H "Content-Type: application/json" \
|
|
39
|
-
-d '{"name": "World"}'
|
|
40
|
-
|
|
41
|
-
# Trigger task workflow
|
|
42
|
-
curl -X POST http://localhost:3000/task \
|
|
43
|
-
-H "Content-Type: application/json" \
|
|
44
|
-
-d '{"taskId": "TASK-123", "userId": "user-456"}'
|
|
45
|
-
|
|
46
|
-
# Check workflow status
|
|
47
|
-
curl http://localhost:3000/workflow/task-TASK-123
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### 5. View in Web UI
|
|
51
|
-
|
|
52
|
-
Open http://localhost:8080 and navigate to your namespace.
|
|
53
|
-
|
|
54
|
-
## Deployment
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
pnpm deploy --stage dev
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Project Structure
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
{{name}}/
|
|
64
|
-
├── sst.config.ts # SST config with AppEnvironment + TemporalWorker
|
|
65
|
-
├── worker/
|
|
66
|
-
│ ├── src/
|
|
67
|
-
│ │ ├── worker.ts # Worker entry point
|
|
68
|
-
│ │ ├── workflows.ts # Workflow definitions
|
|
69
|
-
│ │ ├── activities.ts # Activity implementations
|
|
70
|
-
│ │ └── encryption-codec.ts # Payload encryption
|
|
71
|
-
│ ├── Dockerfile
|
|
72
|
-
│ └── package.json
|
|
73
|
-
├── api/
|
|
74
|
-
│ ├── src/
|
|
75
|
-
│ │ ├── index.ts # Express API
|
|
76
|
-
│ │ └── encryption-codec.ts # Payload encryption
|
|
77
|
-
│ ├── Dockerfile
|
|
78
|
-
│ └── package.json
|
|
79
|
-
└── README.md
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Customization
|
|
83
|
-
|
|
84
|
-
### Adding Workflows
|
|
85
|
-
|
|
86
|
-
1. Define workflow in `worker/src/workflows.ts`
|
|
87
|
-
2. Add activities in `worker/src/activities.ts`
|
|
88
|
-
3. Add API endpoint in `api/src/index.ts`
|
|
89
|
-
|
|
90
|
-
### Workflow Patterns
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
// Simple workflow
|
|
94
|
-
export async function myWorkflow(input: string): Promise<string> {
|
|
95
|
-
const result = await myActivity(input);
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Workflow with timer
|
|
100
|
-
export async function timedWorkflow(): Promise<void> {
|
|
101
|
-
await doSomething();
|
|
102
|
-
await sleep("1 hour"); // Durable timer
|
|
103
|
-
await doSomethingElse();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Workflow with error handling
|
|
107
|
-
export async function safeWorkflow(): Promise<string> {
|
|
108
|
-
try {
|
|
109
|
-
return await riskyActivity();
|
|
110
|
-
} catch (err) {
|
|
111
|
-
return await fallbackActivity();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## Troubleshooting
|
|
117
|
-
|
|
118
|
-
### Worker Can't Connect
|
|
119
|
-
|
|
120
|
-
1. Ensure tunnel is running in SST dev (check "tunnel" pane)
|
|
121
|
-
2. Check `TEMPORAL_ADDRESS` in worker logs
|
|
122
|
-
3. Or start tunnel manually: `pnpm mesh tunnel dev`
|
|
123
|
-
|
|
124
|
-
### Encrypted Payloads in Web UI
|
|
125
|
-
|
|
126
|
-
Configure codec server in Web UI settings:
|
|
127
|
-
- Dev: `http://localhost:8083`
|
|
128
|
-
- Deploy: Check `codecServerUrl` output
|
|
129
|
-
|
|
130
|
-
### Workflow Not Found
|
|
131
|
-
|
|
132
|
-
1. Ensure worker is running
|
|
133
|
-
2. Check task queue name matches between API and worker
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* {{titleCase name}} API
|
|
3
|
-
*
|
|
4
|
-
* HTTP API for triggering Temporal workflows.
|
|
5
|
-
*
|
|
6
|
-
* Environment variables:
|
|
7
|
-
* - PORT: Server port (default: 3000)
|
|
8
|
-
* - TEMPORAL_ADDRESS: Temporal server address (default: localhost:7233)
|
|
9
|
-
* - TEMPORAL_NAMESPACE: Temporal namespace (required)
|
|
10
|
-
* - TEMPORAL_TASK_QUEUE: Task queue name (required)
|
|
11
|
-
* - TEMPORAL_ENCODING_KEY: Encoding key for payload encryption (optional)
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import express, { Request, Response } from "express";
|
|
15
|
-
import { Client, Connection } from "@temporalio/client";
|
|
16
|
-
import { createEncryptionCodec } from "./encryption-codec.js";
|
|
17
|
-
|
|
18
|
-
const PORT = parseInt(process.env.PORT ?? "3000", 10);
|
|
19
|
-
const TEMPORAL_ADDRESS = process.env.TEMPORAL_ADDRESS ?? "localhost:7233";
|
|
20
|
-
|
|
21
|
-
function requireEnv(name: string): string {
|
|
22
|
-
const value = process.env[name];
|
|
23
|
-
if (!value) {
|
|
24
|
-
throw new Error(`${name} environment variable is required`);
|
|
25
|
-
}
|
|
26
|
-
return value;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const TEMPORAL_NAMESPACE = requireEnv("TEMPORAL_NAMESPACE");
|
|
30
|
-
const TEMPORAL_TASK_QUEUE = requireEnv("TEMPORAL_TASK_QUEUE");
|
|
31
|
-
|
|
32
|
-
const app = express();
|
|
33
|
-
app.use(express.json());
|
|
34
|
-
|
|
35
|
-
let client: Client;
|
|
36
|
-
|
|
37
|
-
// Initialize Temporal client
|
|
38
|
-
async function initClient(): Promise<void> {
|
|
39
|
-
console.log(`[API] Connecting to Temporal at ${TEMPORAL_ADDRESS}...`);
|
|
40
|
-
|
|
41
|
-
const connection = await Connection.connect({
|
|
42
|
-
address: TEMPORAL_ADDRESS,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// Set up payload encryption if encoding key is available
|
|
46
|
-
const encryptionCodec = await createEncryptionCodec();
|
|
47
|
-
const dataConverter = encryptionCodec
|
|
48
|
-
? { payloadCodecs: [encryptionCodec] }
|
|
49
|
-
: undefined;
|
|
50
|
-
|
|
51
|
-
client = new Client({
|
|
52
|
-
connection,
|
|
53
|
-
namespace: TEMPORAL_NAMESPACE,
|
|
54
|
-
dataConverter,
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
console.log(`[API] Connected. Namespace: ${TEMPORAL_NAMESPACE}`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Health check
|
|
61
|
-
app.get("/health", (_req: Request, res: Response) => {
|
|
62
|
-
res.json({ status: "ok" });
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// Trigger greeting workflow
|
|
66
|
-
app.post("/greet", async (req: Request, res: Response) => {
|
|
67
|
-
try {
|
|
68
|
-
const { name } = req.body as { name: string };
|
|
69
|
-
if (!name) {
|
|
70
|
-
res.status(400).json({ error: "name is required" });
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const handle = await client.workflow.start("greetingWorkflow", {
|
|
75
|
-
taskQueue: TEMPORAL_TASK_QUEUE,
|
|
76
|
-
workflowId: `greeting-${Date.now()}`,
|
|
77
|
-
args: [name],
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// Wait for result (greeting is quick)
|
|
81
|
-
const result = await handle.result();
|
|
82
|
-
res.json({ workflowId: handle.workflowId, result });
|
|
83
|
-
} catch (error) {
|
|
84
|
-
console.error("[API] Error starting workflow:", error);
|
|
85
|
-
res.status(500).json({ error: "Failed to start workflow" });
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
// Trigger task workflow
|
|
90
|
-
app.post("/task", async (req: Request, res: Response) => {
|
|
91
|
-
try {
|
|
92
|
-
const { taskId, userId } = req.body as { taskId: string; userId: string };
|
|
93
|
-
if (!taskId || !userId) {
|
|
94
|
-
res.status(400).json({ error: "taskId and userId are required" });
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const handle = await client.workflow.start("taskWorkflow", {
|
|
99
|
-
taskQueue: TEMPORAL_TASK_QUEUE,
|
|
100
|
-
workflowId: `task-${taskId}`,
|
|
101
|
-
args: [taskId, userId],
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// Don't wait for result - return workflow ID immediately
|
|
105
|
-
res.json({
|
|
106
|
-
workflowId: handle.workflowId,
|
|
107
|
-
status: "started",
|
|
108
|
-
message: "Workflow started. Check Temporal Web UI for progress.",
|
|
109
|
-
});
|
|
110
|
-
} catch (error) {
|
|
111
|
-
console.error("[API] Error starting workflow:", error);
|
|
112
|
-
res.status(500).json({ error: "Failed to start workflow" });
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// Get workflow status
|
|
117
|
-
app.get("/workflow/:workflowId", async (req: Request, res: Response) => {
|
|
118
|
-
try {
|
|
119
|
-
const { workflowId } = req.params;
|
|
120
|
-
const handle = client.workflow.getHandle(workflowId);
|
|
121
|
-
const describe = await handle.describe();
|
|
122
|
-
|
|
123
|
-
res.json({
|
|
124
|
-
workflowId,
|
|
125
|
-
status: describe.status.name,
|
|
126
|
-
startTime: describe.startTime,
|
|
127
|
-
closeTime: describe.closeTime,
|
|
128
|
-
});
|
|
129
|
-
} catch (error) {
|
|
130
|
-
console.error("[API] Error getting workflow:", error);
|
|
131
|
-
res.status(500).json({ error: "Failed to get workflow status" });
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
// Start server
|
|
136
|
-
initClient()
|
|
137
|
-
.then(() => {
|
|
138
|
-
app.listen(PORT, "0.0.0.0", () => {
|
|
139
|
-
console.log(`[API] {{titleCase name}} API listening on port ${PORT}`);
|
|
140
|
-
});
|
|
141
|
-
})
|
|
142
|
-
.catch((err) => {
|
|
143
|
-
console.error("[API] Failed to initialize:", err);
|
|
144
|
-
process.exit(1);
|
|
145
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{name}}",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"private": true,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"typecheck": "tsc --noEmit",
|
|
8
|
-
"sst:patch": "patch-sst-pulumi .",
|
|
9
|
-
"dev": "pnpm run sst:patch && sst dev",
|
|
10
|
-
"deploy": "pnpm run sst:patch && sst deploy",
|
|
11
|
-
"deploy:dev": "pnpm run sst:patch && sst deploy --stage dev",
|
|
12
|
-
"deploy:prod": "pnpm run sst:patch && sst deploy --stage prod",
|
|
13
|
-
"remove": "sst remove"
|
|
14
|
-
},
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"@mesh-tech/infra-components": "workspace:*",
|
|
17
|
-
"@pulumi/aws": "6.66.2",
|
|
18
|
-
"@pulumi/docker-build": "^0.0.15",
|
|
19
|
-
"@pulumi/eks": "4.2.0",
|
|
20
|
-
"@pulumi/kubernetes": "4.24.1",
|
|
21
|
-
"@pulumi/pulumi": "3.214.1",
|
|
22
|
-
"@pulumi/random": "4.18.2",
|
|
23
|
-
"sst": "^3.3.61"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@aws-sdk/credential-providers": "^3.964.0",
|
|
27
|
-
"typescript": "^5.7.2"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/// <reference path="./.sst/platform/config.d.ts" />
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* {{titleCase name}} - Temporal Workflow Application
|
|
5
|
-
*
|
|
6
|
-
* This app demonstrates Temporal workflow orchestration with:
|
|
7
|
-
* - AppEnvironment with temporal: true (namespace provisioning, encoding key)
|
|
8
|
-
* - TemporalWorker component (auto-configured env vars, no Service/Ingress)
|
|
9
|
-
* - API Service for triggering workflows
|
|
10
|
-
*
|
|
11
|
-
* Dev mode:
|
|
12
|
-
* 1. Run: pnpm mesh dev (auto-starts tunnel to Temporal + DB)
|
|
13
|
-
* 2. Start worker manually in SST dev UI
|
|
14
|
-
*
|
|
15
|
-
* Deploy:
|
|
16
|
-
* pnpm deploy --stage dev
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
export default $config({
|
|
20
|
-
app(input) {
|
|
21
|
-
return {
|
|
22
|
-
name: "{{name}}",
|
|
23
|
-
removal: input?.stage === "prod" ? "retain" : "remove",
|
|
24
|
-
protect: ["prod"].includes(input?.stage ?? ""),
|
|
25
|
-
home: "aws",
|
|
26
|
-
providers: {
|
|
27
|
-
aws: {
|
|
28
|
-
region: "us-east-2",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
async run() {
|
|
34
|
-
// Dynamic imports (SST requirement for non-SST packages)
|
|
35
|
-
const { mesh } = await import("@mesh-tech/infra-components");
|
|
36
|
-
const { config, getPlatform } = await import("../config.js");
|
|
37
|
-
|
|
38
|
-
const stage = $app.stage;
|
|
39
|
-
const tenant = config.tenant;
|
|
40
|
-
const platform = getPlatform(stage);
|
|
41
|
-
|
|
42
|
-
// =========================================================================
|
|
43
|
-
// AppEnvironment with Temporal enabled
|
|
44
|
-
// =========================================================================
|
|
45
|
-
// This creates:
|
|
46
|
-
// - Kubernetes namespace (deploy mode)
|
|
47
|
-
// - Temporal namespace (via TemporalNamespaceProvisioner Lambda)
|
|
48
|
-
// - Encoding key K8s Secret for payload encryption
|
|
49
|
-
// - Codec server deployment (for Web UI decryption)
|
|
50
|
-
// - Unified dev tunnel (mesh tunnel dev) for Temporal + DB access
|
|
51
|
-
|
|
52
|
-
const env = new mesh.apps.AppEnvironment("env", {
|
|
53
|
-
tenant,
|
|
54
|
-
platform,
|
|
55
|
-
stage,
|
|
56
|
-
appName: "{{name}}",
|
|
57
|
-
dev: $dev,
|
|
58
|
-
namespace: !$dev,
|
|
59
|
-
|
|
60
|
-
// Enable Temporal support
|
|
61
|
-
temporal: true,
|
|
62
|
-
DevCommand: sst.x.DevCommand,
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// =========================================================================
|
|
66
|
-
// Temporal Worker
|
|
67
|
-
// =========================================================================
|
|
68
|
-
// TemporalWorker automatically handles:
|
|
69
|
-
// - Temporal environment variables (ADDRESS, NAMESPACE, TASK_QUEUE)
|
|
70
|
-
// - Encoding key secret mounting for payload encryption
|
|
71
|
-
// - No Service/Ingress (workers don't serve HTTP)
|
|
72
|
-
// - Dev mode: doesn't autostart (waits for namespace provisioning)
|
|
73
|
-
|
|
74
|
-
const worker = new mesh.apps.TemporalWorker(
|
|
75
|
-
"worker",
|
|
76
|
-
{
|
|
77
|
-
env,
|
|
78
|
-
rootDir: $cli.paths.root,
|
|
79
|
-
src: "./worker",
|
|
80
|
-
devCommand: ["pnpm", "dev"],
|
|
81
|
-
|
|
82
|
-
// Task queue defaults to worker name ("worker")
|
|
83
|
-
taskQueue: "{{name}}",
|
|
84
|
-
|
|
85
|
-
environment: {
|
|
86
|
-
NODE_ENV: $dev ? "development" : "production",
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
replicas: 1,
|
|
90
|
-
resources: {
|
|
91
|
-
cpu: "100m",
|
|
92
|
-
memory: "256Mi",
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
providers: env.providers,
|
|
97
|
-
parent: env,
|
|
98
|
-
},
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
// =========================================================================
|
|
102
|
-
// API Service (triggers workflows)
|
|
103
|
-
// =========================================================================
|
|
104
|
-
const api = new mesh.apps.Service(
|
|
105
|
-
"api",
|
|
106
|
-
{
|
|
107
|
-
dev: $dev,
|
|
108
|
-
tenant,
|
|
109
|
-
stage,
|
|
110
|
-
appName: "{{name}}",
|
|
111
|
-
namespace: env.namespace!,
|
|
112
|
-
rootDir: $cli.paths.root,
|
|
113
|
-
src: "./api",
|
|
114
|
-
port: 3000,
|
|
115
|
-
devCommand: ["pnpm", "dev"],
|
|
116
|
-
|
|
117
|
-
environment: {
|
|
118
|
-
NODE_ENV: $dev ? "development" : "production",
|
|
119
|
-
TEMPORAL_ADDRESS: env.temporal!.endpoint.apply((e) =>
|
|
120
|
-
$dev ? "localhost:7233" : `${e}:7233`,
|
|
121
|
-
),
|
|
122
|
-
TEMPORAL_NAMESPACE: env.temporal!.namespace,
|
|
123
|
-
TEMPORAL_TASK_QUEUE: "{{name}}",
|
|
124
|
-
// Dev mode: inject encoding key directly
|
|
125
|
-
...($dev && env.temporal!.devEncodingKey
|
|
126
|
-
? { TEMPORAL_ENCODING_KEY: env.temporal!.devEncodingKey }
|
|
127
|
-
: {}),
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
// Deploy mode: inject encoding key from K8s secret
|
|
131
|
-
envFromSecrets: $dev ? [] : [env.temporal!.encodingKeySecretName],
|
|
132
|
-
|
|
133
|
-
ingress: env.buildIngress({
|
|
134
|
-
subdomain: "{{name}}-api",
|
|
135
|
-
healthCheckPath: "/health",
|
|
136
|
-
}),
|
|
137
|
-
|
|
138
|
-
replicas: 1,
|
|
139
|
-
resources: {
|
|
140
|
-
cpu: "100m",
|
|
141
|
-
memory: "128Mi",
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
providers: env.providers,
|
|
146
|
-
parent: env,
|
|
147
|
-
dependsOn: [worker],
|
|
148
|
-
},
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
return {
|
|
152
|
-
namespace: env.namespace,
|
|
153
|
-
temporalNamespace: env.temporal?.namespace,
|
|
154
|
-
temporalEndpoint: env.temporal?.endpoint,
|
|
155
|
-
encodingKeySecret: env.temporal?.encodingKeySecretName,
|
|
156
|
-
codecServerUrl: env.temporal?.codecServerUrl,
|
|
157
|
-
workerTaskQueue: worker.taskQueue,
|
|
158
|
-
apiUrl: api.url,
|
|
159
|
-
};
|
|
160
|
-
},
|
|
161
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bundle Workflows for Production
|
|
3
|
-
*
|
|
4
|
-
* Pre-bundles workflows to avoid runtime bundling in production.
|
|
5
|
-
* Run with: npm run bundle:workflows
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as fs from "fs";
|
|
9
|
-
import * as path from "path";
|
|
10
|
-
import { fileURLToPath } from "url";
|
|
11
|
-
import { bundleWorkflowCode } from "@temporalio/worker";
|
|
12
|
-
|
|
13
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
-
const __dirname = path.dirname(__filename);
|
|
15
|
-
|
|
16
|
-
async function bundle() {
|
|
17
|
-
console.log("[Bundle] Bundling workflows...");
|
|
18
|
-
|
|
19
|
-
const bundle = await bundleWorkflowCode({
|
|
20
|
-
workflowsPath: path.join(__dirname, "workflows.ts"),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const outPath = path.join(__dirname, "..", "dist", "workflows-bundle.js");
|
|
24
|
-
|
|
25
|
-
// Ensure dist directory exists
|
|
26
|
-
const distDir = path.dirname(outPath);
|
|
27
|
-
if (!fs.existsSync(distDir)) {
|
|
28
|
-
fs.mkdirSync(distDir, { recursive: true });
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
fs.writeFileSync(outPath, bundle.code);
|
|
32
|
-
console.log(`[Bundle] Wrote bundle to ${outPath}`);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
bundle().catch((err) => {
|
|
36
|
-
console.error("[Bundle] Failed:", err);
|
|
37
|
-
process.exit(1);
|
|
38
|
-
});
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* {{titleCase name}} Temporal Worker
|
|
3
|
-
*
|
|
4
|
-
* Environment variables:
|
|
5
|
-
* - TEMPORAL_ADDRESS: Temporal server address (default: localhost:7233)
|
|
6
|
-
* - TEMPORAL_NAMESPACE: Temporal namespace (required)
|
|
7
|
-
* - TEMPORAL_TASK_QUEUE: Task queue name (required)
|
|
8
|
-
* - TEMPORAL_ENCODING_KEY: Encoding key for payload encryption (optional)
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import * as fs from "fs";
|
|
12
|
-
import * as path from "path";
|
|
13
|
-
import { fileURLToPath } from "url";
|
|
14
|
-
import { NativeConnection, Worker, WorkerOptions, bundleWorkflowCode } from "@temporalio/worker";
|
|
15
|
-
import * as activities from "./activities.js";
|
|
16
|
-
import { createEncryptionCodec } from "./encryption-codec.js";
|
|
17
|
-
|
|
18
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
19
|
-
|
|
20
|
-
const TEMPORAL_ADDRESS = process.env.TEMPORAL_ADDRESS ?? "localhost:7233";
|
|
21
|
-
|
|
22
|
-
function requireEnv(name: string): string {
|
|
23
|
-
const value = process.env[name];
|
|
24
|
-
if (!value) {
|
|
25
|
-
throw new Error(`${name} environment variable is required`);
|
|
26
|
-
}
|
|
27
|
-
return value;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const TEMPORAL_NAMESPACE = requireEnv("TEMPORAL_NAMESPACE");
|
|
31
|
-
const TEMPORAL_TASK_QUEUE = requireEnv("TEMPORAL_TASK_QUEUE");
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Load workflows - uses pre-bundled code in production, source files in dev
|
|
35
|
-
*/
|
|
36
|
-
async function getWorkflowOptions(): Promise<
|
|
37
|
-
Pick<WorkerOptions, "workflowBundle" | "workflowsPath">
|
|
38
|
-
> {
|
|
39
|
-
const bundlePath = path.join(__dirname, "workflows-bundle.js");
|
|
40
|
-
|
|
41
|
-
if (fs.existsSync(bundlePath)) {
|
|
42
|
-
console.log("[Worker] Loading pre-bundled workflows...");
|
|
43
|
-
return {
|
|
44
|
-
workflowBundle: { code: fs.readFileSync(bundlePath, "utf-8") },
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
console.log("[Worker] Bundling workflows from source...");
|
|
49
|
-
return {
|
|
50
|
-
workflowBundle: await bundleWorkflowCode({
|
|
51
|
-
workflowsPath: new URL("./workflows.js", import.meta.url).pathname,
|
|
52
|
-
}),
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async function run() {
|
|
57
|
-
console.log(`[Worker] Connecting to Temporal at ${TEMPORAL_ADDRESS}...`);
|
|
58
|
-
|
|
59
|
-
const connection = await NativeConnection.connect({
|
|
60
|
-
address: TEMPORAL_ADDRESS,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
console.log(`[Worker] Connected. Namespace: ${TEMPORAL_NAMESPACE}`);
|
|
64
|
-
|
|
65
|
-
const workflowOptions = await getWorkflowOptions();
|
|
66
|
-
|
|
67
|
-
// Set up payload encryption if encoding key is available
|
|
68
|
-
const encryptionCodec = await createEncryptionCodec();
|
|
69
|
-
const dataConverter = encryptionCodec
|
|
70
|
-
? { payloadCodecs: [encryptionCodec] }
|
|
71
|
-
: undefined;
|
|
72
|
-
|
|
73
|
-
if (encryptionCodec) {
|
|
74
|
-
console.log("[Worker] Payload encryption enabled");
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const worker = await Worker.create({
|
|
78
|
-
connection,
|
|
79
|
-
namespace: TEMPORAL_NAMESPACE,
|
|
80
|
-
taskQueue: TEMPORAL_TASK_QUEUE,
|
|
81
|
-
...workflowOptions,
|
|
82
|
-
activities,
|
|
83
|
-
dataConverter,
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
console.log(`[Worker] Starting on task queue: ${TEMPORAL_TASK_QUEUE}`);
|
|
87
|
-
await worker.run();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
run().catch((err) => {
|
|
91
|
-
console.error("[Worker] Fatal error:", err);
|
|
92
|
-
process.exit(1);
|
|
93
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|