@inneranimalmedia/agentsam-sdk 2.6.7 → 2.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/apps/README.md +25 -0
- package/apps/cad-creator/shared/cad/package.json +1 -1
- package/apps/client-cms-editor/backend/package.json +4 -6
- package/apps/client-cms-editor/frontend/package.json +6 -8
- package/apps/client-cms-editor/frontend/tsconfig.json +27 -8
- package/apps/client-cms-editor/package.json +1 -1
- package/apps/client-cms-editor/shared/cms/package.json +4 -6
- package/docs/LOCAL_ENGINE_COMPUTE_AUDIT_PLAN.md +299 -0
- package/docs/REPO_FILE_MAP.txt +132 -0
- package/migrations/d1/0018_goap_control_plane_remaster.sql +40 -0
- package/migrations/d1/0019_agentsam_agent_run_plan_todo.sql +14 -0
- package/migrations/d1/README_PORTABLE_CONTROL_PLANE.md +20 -9
- package/migrations/runtime/0002_goap_blackboard_v1.sql +15 -0
- package/migrations/runtime/0004_agent_run_plan_linkage.sql +8 -0
- package/native/agentsam-machine/cli/Cargo.toml +8 -1
- package/native/agentsam-machine/cli/README.md +21 -0
- package/native/agentsam-machine/core/Cargo.toml +7 -0
- package/native/agentsam-machine/core/README.md +14 -0
- package/native/agentsam-machine/core/build.rs +33 -0
- package/native/agentsam-machine/core/contracts/source-types.v1.json +353 -0
- package/native/agentsam-machine/core/src/lib.rs +6 -0
- package/native/agentsam-machine/core/src/source_types.rs +2 -2
- package/package.json +31 -10
- package/packages/agentsam-brand/package.json +1 -1
- package/packages/agentsam-contracts/package.json +71 -20
- package/packages/agentsam-contracts/scripts/build.mjs +18 -0
- package/packages/agentsam-contracts/test/contracts.test.mjs +4 -1
- package/packages/agentsam-contracts/test/repository.test.mjs +4 -1
- package/packages/agentsam-contracts/tsconfig.build.json +10 -0
- package/packages/agentsam-errors/package.json +3 -2
- package/packages/agentsam-errors/src/index.js +1 -0
- package/packages/agentsam-errors/src/tool.js +56 -0
- package/packages/agentsam-errors/test/tool.test.mjs +58 -0
- package/packages/agentsam-goap/README.md +52 -0
- package/packages/agentsam-goap/package.json +37 -0
- package/packages/agentsam-goap/src/adapters/d1-sqlite.js +570 -0
- package/packages/agentsam-goap/src/adapters/memory.js +199 -0
- package/packages/agentsam-goap/src/contracts.js +226 -0
- package/packages/agentsam-goap/src/control-plane.js +112 -0
- package/packages/agentsam-goap/src/errors.js +157 -0
- package/packages/agentsam-goap/src/index.js +5 -0
- package/packages/agentsam-goap/src/world.js +202 -0
- package/packages/agentsam-goap/test/goap-control-plane.test.mjs +245 -0
- package/packages/agentsam-goap/test/world.test.mjs +79 -0
- package/packages/agentsam-knowledge/package.json +3 -2
- package/packages/agentsam-nav/package.json +1 -1
- package/packages/agentsam-queue-control/package.json +1 -1
- package/packages/agentsam-rapid-rust/src/main.rs +1 -0
- package/packages/agentsam-repository/package.json +3 -2
- package/packages/agentsam-repository/src/goap.js +13 -14
- package/packages/agentsam-repository/src/tickets.js +15 -22
- package/packages/agentsam-repository/test/goap-tickets-workspace-state.test.mjs +19 -8
- package/packages/agentsam-vault/package.json +8 -5
- package/packages/agentsam-workbench/package.json +44 -17
- package/packages/connectors/cloudflare/package.json +4 -2
- package/packages/heuristic-theme/package.json +1 -1
- package/packages/identity/package.json +4 -3
- package/packages/identity/tests/lane1-packed-consumer.test.mjs +10 -2
- package/packages/providers/completeful/package.json +1 -1
- package/packages/theme-church-site/README.md +2 -2
- package/packages/theme-church-site/package.json +3 -4
- package/packages/theme-church-site/src/index.js +1 -1
- package/packages/theme-church-site/test/theme.test.mjs +1 -1
- package/packages/theme-companions-site/README.md +2 -2
- package/packages/theme-companions-site/package.json +3 -4
- package/packages/theme-companions-site/src/index.js +1 -1
- package/packages/theme-companions-site/test/theme.test.mjs +1 -1
- package/packages/theme-floors-site/README.md +2 -2
- package/packages/theme-floors-site/package.json +3 -4
- package/packages/theme-floors-site/src/index.js +1 -1
- package/packages/theme-floors-site/test/theme.test.mjs +1 -1
- package/packages/theme-fuelnfree-site/README.md +2 -2
- package/packages/theme-fuelnfree-site/package.json +3 -4
- package/packages/theme-fuelnfree-site/src/index.js +1 -1
- package/packages/theme-fuelnfree-site/test/theme.test.mjs +1 -1
- package/packages/theme-handyman-site/README.md +2 -2
- package/packages/theme-handyman-site/package.json +3 -4
- package/packages/theme-handyman-site/src/index.js +1 -1
- package/packages/theme-handyman-site/test/theme.test.mjs +1 -1
- package/packages/theme-insurance-site/README.md +2 -2
- package/packages/theme-insurance-site/package.json +3 -4
- package/packages/theme-insurance-site/src/index.js +1 -1
- package/packages/theme-insurance-site/test/theme.test.mjs +1 -1
- package/packages/theme-scenes/package.json +1 -1
- package/packages/theme-shinshu-site/README.md +2 -2
- package/packages/theme-shinshu-site/package.json +3 -4
- package/packages/theme-shinshu-site/src/index.js +1 -1
- package/packages/theme-shinshu-site/test/theme.test.mjs +1 -1
- package/packages/work-graph/package.json +3 -2
- package/protocol/local-engine/benchmark.v1.schema.json +14 -0
- package/protocol/local-engine/engine.v1.schema.json +17 -0
- package/python/agentsam_sdk/repository/intelligence/discovery.py +27 -2
- package/python/agentsam_sdk/repository/intelligence/git.py +4 -0
- package/python/tests/test_repository_intelligence.py +30 -0
- package/src/cli/command-catalog.js +3 -1
- package/src/cli.js +20 -1
- package/src/commands/app.js +10 -0
- package/src/commands/engine.js +10 -0
- package/src/commands/goap-world.js +134 -0
- package/src/commands/goap.js +11 -4
- package/src/commands/machine-binary.js +33 -27
- package/src/commands/machine-runtime.js +266 -0
- package/src/commands/machine.js +155 -51
- package/src/commands/package.js +537 -0
- package/src/commands/plan-ledger.js +370 -0
- package/src/commands/plan.js +183 -0
- package/src/commands/runtime.js +25 -10
- package/src/commands/setup.js +30 -6
- package/src/commands/skill.js +78 -17
- package/src/commands/terminal.js +20 -8
- package/src/errors/contract.js +4 -4
- package/src/errors/diagnostic.js +1 -1
- package/src/errors/index.js +1 -1
- package/src/index.js +20 -0
- package/src/indexing/ingest/materials.js +237 -30
- package/src/knowledge/source.js +1 -1
- package/src/lib/setup/runtime.js +4 -2
- package/src/lib/slash-commands.js +1 -1
- package/src/local/runtime-store.js +24 -2
- package/src/local/sqlite.js +17 -0
- package/src/local-engine/assets.js +37 -0
- package/src/local-engine/audit.js +133 -0
- package/src/local-engine/benchmark.js +26 -0
- package/src/local-engine/contracts.js +101 -0
- package/src/local-engine/engines.js +142 -0
- package/src/local-engine/index.js +18 -0
- package/src/local-engine/runtime.js +39 -0
- package/src/sam/operations/package-audit.js +41 -0
- package/src/sam/seed.js +2 -0
- package/skills/grok-auth/SKILL.md +0 -110
- package/skills/grok-auth/agentsam.skill.json +0 -25
- package/skills/grok-auth/references/grok-identity.md +0 -64
- package/skills/grok-auth/references/per-user-data.md +0 -49
- package/skills/grok-auth/references/prewired-and-env.md +0 -54
- package/skills/grok-auth/references/session-ui.md +0 -133
- package/skills/grok-auth/references/sign-in-methods.md +0 -55
- package/skills/grok-auth/references/wiring.md +0 -71
- package/skills/grok-building-games/SKILL.md +0 -213
- package/skills/grok-building-games/agentsam.skill.json +0 -25
- package/skills/grok-building-games/references/3d-libs.md +0 -64
- package/skills/grok-building-games/references/ai-pathfinding.md +0 -122
- package/skills/grok-building-games/references/audio.md +0 -129
- package/skills/grok-building-games/references/babylon.md +0 -202
- package/skills/grok-building-games/references/collision-physics.md +0 -122
- package/skills/grok-building-games/references/ecs-architecture.md +0 -111
- package/skills/grok-building-games/references/game-feel-juice.md +0 -110
- package/skills/grok-building-games/references/genres/board-card-chess.md +0 -89
- package/skills/grok-building-games/references/genres/endless-runner.md +0 -83
- package/skills/grok-building-games/references/genres/fps.md +0 -105
- package/skills/grok-building-games/references/genres/platformer-2d.md +0 -97
- package/skills/grok-building-games/references/genres/puzzle-match3-tetris.md +0 -131
- package/skills/grok-building-games/references/genres/racing-kart.md +0 -106
- package/skills/grok-building-games/references/genres/topdown-twin-stick.md +0 -97
- package/skills/grok-building-games/references/genres/tower-defense.md +0 -84
- package/skills/grok-building-games/references/genres/voxel-minecraft.md +0 -89
- package/skills/grok-building-games/references/input.md +0 -139
- package/skills/grok-building-games/references/phaser.md +0 -277
- package/skills/grok-building-games/references/procedural-generation.md +0 -141
- package/skills/grok-building-games/references/save-persistence.md +0 -108
- package/skills/grok-building-games/references/threejs-foundational.md +0 -148
- package/skills/grok-controls/SKILL.md +0 -274
- package/skills/grok-controls/agentsam.skill.json +0 -25
- package/skills/grok-design-ui/SKILL.md +0 -122
- package/skills/grok-design-ui/agentsam.skill.json +0 -25
- package/skills/grok-design-ui/references/animations.md +0 -379
- package/skills/grok-design-ui/references/performance.md +0 -88
- package/skills/grok-design-ui/references/refined-ui.md +0 -384
- package/skills/grok-design-ui/references/surfaces.md +0 -247
- package/skills/grok-design-ui/references/typography.md +0 -123
- package/skills/grok-game-animation-frames/SKILL.md +0 -84
- package/skills/grok-game-animation-frames/agentsam.skill.json +0 -25
- package/skills/grok-game-asset-core/SKILL.md +0 -69
- package/skills/grok-game-asset-core/agentsam.skill.json +0 -25
- package/skills/grok-game-character-consistency/SKILL.md +0 -69
- package/skills/grok-game-character-consistency/agentsam.skill.json +0 -25
- package/skills/grok-game-tilesets/SKILL.md +0 -65
- package/skills/grok-game-tilesets/agentsam.skill.json +0 -25
- package/skills/grok-game-ui-icons/SKILL.md +0 -56
- package/skills/grok-game-ui-icons/agentsam.skill.json +0 -25
- package/skills/grok-generate2dmap/LICENSE +0 -21
- package/skills/grok-generate2dmap/SKILL.md +0 -120
- package/skills/grok-generate2dmap/SOURCE.md +0 -6
- package/skills/grok-generate2dmap/agentsam.skill.json +0 -25
- package/skills/grok-generate2dmap/references/deliverables.md +0 -101
- package/skills/grok-generate2dmap/references/layered-map-contract.md +0 -209
- package/skills/grok-generate2dmap/references/map-strategies.md +0 -341
- package/skills/grok-generate2dmap/references/object-production-gate.md +0 -24
- package/skills/grok-generate2dmap/references/pipeline.md +0 -149
- package/skills/grok-generate2dmap/references/prop-pack-contract.md +0 -174
- package/skills/grok-generate2dmap/references/side-scroll-stages.md +0 -29
- package/skills/grok-generate2dmap/scripts/compose_layered_preview.py +0 -157
- package/skills/grok-generate2dmap/scripts/extract_prop_pack.py +0 -369
- package/skills/grok-generate2dsprite/LICENSE +0 -21
- package/skills/grok-generate2dsprite/SKILL.md +0 -313
- package/skills/grok-generate2dsprite/SOURCE.md +0 -6
- package/skills/grok-generate2dsprite/agentsam.skill.json +0 -25
- package/skills/grok-generate2dsprite/references/modes.md +0 -124
- package/skills/grok-generate2dsprite/references/prompt-rules.md +0 -315
- package/skills/grok-generate2dsprite/scripts/generate2dsprite.py +0 -1031
- package/skills/grok-generate2dsprite/scripts/make_layout_guide.py +0 -109
- package/skills/grok-imagine/SKILL.md +0 -201
- package/skills/grok-imagine/agentsam.skill.json +0 -25
- package/skills/grok-multiplayer-p2p/SKILL.md +0 -111
- package/skills/grok-multiplayer-p2p/agentsam.skill.json +0 -25
- package/skills/grok-multiplayer-p2p/references/react-binding.md +0 -144
- package/skills/grok-multiplayer-p2p/references/signaling-relay.md +0 -269
- package/skills/grok-neon/SKILL.md +0 -157
- package/skills/grok-neon/agentsam.skill.json +0 -25
- package/skills/grok-og/SKILL.md +0 -102
- package/skills/grok-og/agentsam.skill.json +0 -25
- package/skills/grok-og/references/brand-pass.md +0 -53
- package/skills/grok-og/references/custom-card.md +0 -107
- package/skills/grok-og/references/favicon-and-icons.md +0 -48
- package/skills/grok-og/references/og-type-contract.md +0 -18
- package/skills/grok-og/references/placeholder-card.md +0 -21
- package/skills/grok-og/references/x-banner.md +0 -41
- package/skills/grok-threejs/SKILL.md +0 -67
- package/skills/grok-threejs/agentsam.skill.json +0 -25
- package/skills/grok-threejs/references/llms-full.txt +0 -2780
- package/skills/grok-video2dsprite/LICENSE +0 -21
- package/skills/grok-video2dsprite/SKILL.md +0 -236
- package/skills/grok-video2dsprite/SOURCE.md +0 -6
- package/skills/grok-video2dsprite/agentsam.skill.json +0 -25
- package/skills/grok-video2dsprite/references/pipeline.md +0 -90
- package/skills/grok-video2dsprite/references/prompt-rules.md +0 -63
- package/skills/grok-video2dsprite/scripts/video2dsprite.py +0 -490
- package/skills/grok-xai-api/SKILL.md +0 -152
- package/skills/grok-xai-api/agentsam.skill.json +0 -25
- package/test/account-session.test.mjs +0 -101
- package/test/agent-capabilities.test.mjs +0 -67
- package/test/app-authority-context.test.mjs +0 -32
- package/test/app-building-skills.test.mjs +0 -61
- package/test/apps-scaffold-contract.test.mjs +0 -115
- package/test/blender-cad.test.mjs +0 -146
- package/test/cad-docker.test.mjs +0 -96
- package/test/capabilities.test.mjs +0 -133
- package/test/cli/api-key-env-whoami.test.mjs +0 -129
- package/test/cli/catalog-authority.test.mjs +0 -64
- package/test/cli/codebaseindex-plan-ux.test.mjs +0 -37
- package/test/cli/eval-live.test.mjs +0 -219
- package/test/cli/go.test.mjs +0 -128
- package/test/cli/local-vault-and-provider-setup.test.mjs +0 -268
- package/test/cli/machine-command.test.mjs +0 -34
- package/test/cli/mcp-client.test.mjs +0 -256
- package/test/cli/preferences-runtime.test.mjs +0 -11
- package/test/cli/runtime-persist.test.mjs +0 -56
- package/test/cli/runtime-ui.test.mjs +0 -141
- package/test/cli/rust-command.test.mjs +0 -21
- package/test/cli/skill-npm-and-env.test.mjs +0 -52
- package/test/cli/status-actions.test.mjs +0 -88
- package/test/cli/wireframes-go-registry.test.mjs +0 -139
- package/test/cli-preferences.test.mjs +0 -46
- package/test/cloudflare-connector.test.mjs +0 -93
- package/test/cloudflare-runtime.test.mjs +0 -82
- package/test/context.test.mjs +0 -159
- package/test/credentials-audit.test.mjs +0 -113
- package/test/deploy-health-scan.test.mjs +0 -95
- package/test/deploy-receipt.test.mjs +0 -91
- package/test/dockerize.test.mjs +0 -93
- package/test/error-diagnostics.test.mjs +0 -124
- package/test/eval-context.test.mjs +0 -37
- package/test/execution-approvals.test.mjs +0 -27
- package/test/fixtures/cad/courtyard-house.json +0 -208
- package/test/fixtures/knowledge-rpc-worker.mjs +0 -16
- package/test/fixtures/project-authority/customer-app/.agentsam/app.json +0 -5
- package/test/fixtures/project-authority/customer-app/apps/my-product/index.ts +0 -1
- package/test/fixtures/project-authority/customer-app/wrangler.toml +0 -17
- package/test/gcloud-auth.test.mjs +0 -111
- package/test/go/build-source-identity.test.mjs +0 -31
- package/test/go/cloudflare-probe.test.mjs +0 -317
- package/test/go/distribution.test.mjs +0 -28
- package/test/google-cloud-connection.test.mjs +0 -83
- package/test/google-cloud-inventory.test.mjs +0 -64
- package/test/indexing-provider.test.mjs +0 -29
- package/test/init-options.test.mjs +0 -35
- package/test/integration/ai-access-onboarding.test.mjs +0 -47
- package/test/integration/app-command.test.mjs +0 -85
- package/test/integration/autorag-project-authority.integration.test.mjs +0 -51
- package/test/integration/autorag-runtime-discovery.test.mjs +0 -107
- package/test/integration/cad-discovery.test.mjs +0 -158
- package/test/integration/cad-docker-executor.test.mjs +0 -249
- package/test/integration/cad-execution.test.mjs +0 -184
- package/test/integration/cad-project-app.test.mjs +0 -31
- package/test/integration/cad-project-d1.test.mjs +0 -25
- package/test/integration/cad-project-native.test.mjs +0 -24
- package/test/integration/cad-project-workflow.test.mjs +0 -9
- package/test/integration/cad-project.test.mjs +0 -85
- package/test/integration/cli-help.test.mjs +0 -41
- package/test/integration/cms-app-scaffold.test.mjs +0 -77
- package/test/integration/cms-site-tenancy-contract.test.mjs +0 -268
- package/test/integration/codebaseindex-ingest.test.mjs +0 -255
- package/test/integration/core-client.integration.test.mjs +0 -55
- package/test/integration/database-hosted-honesty.test.mjs +0 -49
- package/test/integration/desktop-keychain-boundary.test.mjs +0 -45
- package/test/integration/error-runtime-rpc.test.mjs +0 -71
- package/test/integration/features-resolve.test.mjs +0 -147
- package/test/integration/hosted-work-host-authority.test.mjs +0 -47
- package/test/integration/icon-registry.test.mjs +0 -67
- package/test/integration/ingest-discover-models.test.mjs +0 -30
- package/test/integration/inspect-path-cli.test.mjs +0 -46
- package/test/integration/install-script.test.mjs +0 -110
- package/test/integration/inventory-core.test.mjs +0 -53
- package/test/integration/inventory-eligibility.test.mjs +0 -59
- package/test/integration/inventory-evidence.test.mjs +0 -125
- package/test/integration/knowledge-rpc.test.mjs +0 -112
- package/test/integration/local-fs.test.mjs +0 -113
- package/test/integration/local-provider-bridge.test.mjs +0 -65
- package/test/integration/local-studio-settings-production.test.mjs +0 -40
- package/test/integration/lockfile-sync.test.mjs +0 -26
- package/test/integration/merkle-cli.test.mjs +0 -61
- package/test/integration/merkle-persistence-identity.test.mjs +0 -48
- package/test/integration/plugins-cloudflare.integration.test.mjs +0 -28
- package/test/integration/provider-env-cli.test.mjs +0 -60
- package/test/integration/provider-factory.test.mjs +0 -197
- package/test/integration/repository-company-graph.test.mjs +0 -90
- package/test/integration/runtime-migrations.test.mjs +0 -87
- package/test/integration/runtime-status.integration.test.mjs +0 -227
- package/test/integration/sam-activity-recovery.test.mjs +0 -147
- package/test/integration/sam-decision.test.mjs +0 -584
- package/test/integration/sam-kernel.test.mjs +0 -99
- package/test/integration/sam-planning-astar.test.mjs +0 -279
- package/test/integration/scaffold-cloudflare.test.mjs +0 -46
- package/test/integration/skill-runtime.test.mjs +0 -240
- package/test/integration/storage-architecture.test.mjs +0 -154
- package/test/integration/store-discovery.test.mjs +0 -44
- package/test/integration/studio-fs-pty-e2e.test.mjs +0 -294
- package/test/integration/terminal-exec.integration.test.mjs +0 -86
- package/test/integration/theme-package-registry.test.mjs +0 -31
- package/test/integration/tool-runtime.test.mjs +0 -124
- package/test/integration/tool-schema.test.mjs +0 -59
- package/test/jr-dev-skill.test.mjs +0 -26
- package/test/knowledge-context-pack.test.mjs +0 -19
- package/test/knowledge-postgres.test.mjs +0 -40
- package/test/knowledge-service.test.mjs +0 -110
- package/test/knowledge.test.mjs +0 -206
- package/test/live/terminal-transport.live.test.mjs +0 -24
- package/test/local-sessions.test.mjs +0 -57
- package/test/local-studio-deploy.test.mjs +0 -83
- package/test/loopback-oauth.test.mjs +0 -53
- package/test/merkle-render.test.mjs +0 -31
- package/test/mini.test.mjs +0 -140
- package/test/model-catalog.test.mjs +0 -70
- package/test/models.test.mjs +0 -309
- package/test/npm10-lock.test.mjs +0 -29
- package/test/ollama.test.mjs +0 -137
- package/test/open-url.test.mjs +0 -64
- package/test/openai-responses.test.mjs +0 -155
- package/test/portable-context.test.mjs +0 -94
- package/test/project-config.test.mjs +0 -81
- package/test/project-rules.test.mjs +0 -44
- package/test/provider-credentials.test.mjs +0 -106
- package/test/rehydrate.test.mjs +0 -25
- package/test/release-hygiene.test.mjs +0 -42
- package/test/repository-snapshot-view.test.mjs +0 -112
- package/test/responses-runner.test.mjs +0 -465
- package/test/runtime-activity.test.mjs +0 -98
- package/test/sdk-worker-contract.test.mjs +0 -72
- package/test/security.test.mjs +0 -266
- package/test/setup-planner.test.mjs +0 -74
- package/test/setup-runtime.test.mjs +0 -51
- package/test/shell.test.mjs +0 -281
- package/test/skills.test.mjs +0 -22
- package/test/smoke.mjs +0 -122
- package/test/telemetry.test.mjs +0 -79
- package/test/terminal/local-pty.mock.test.mjs +0 -153
- package/test/terminal-machine-identity.test.mjs +0 -88
- package/test/theme-portability.test.mjs +0 -14
- package/test/tools-search.test.mjs +0 -73
- package/test/unit/website-assets-bindings.test.mjs +0 -60
- package/test/whoami-resume.test.mjs +0 -157
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { spawnSync } from 'node:child_process';
|
|
5
|
-
import test from 'node:test';
|
|
6
|
-
import { listAppManifests } from '../../src/commands/app.js';
|
|
7
|
-
|
|
8
|
-
test('lists agentsam.app.json manifests for product apps', () => {
|
|
9
|
-
const apps = listAppManifests();
|
|
10
|
-
const ids = apps.map((row) => row.id).sort();
|
|
11
|
-
assert.ok(ids.includes('cad-creator'));
|
|
12
|
-
assert.ok(ids.includes('local-studio'));
|
|
13
|
-
assert.ok(ids.includes('client-cms-editor'));
|
|
14
|
-
assert.ok(ids.includes('ecommerce-cms-agentsam'));
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test('agentsam app validate passes for all product apps', async () => {
|
|
18
|
-
const { validateApps } = await import('../../src/commands/app.js');
|
|
19
|
-
const report = validateApps();
|
|
20
|
-
assert.equal(report.ok, true, report.errors.join('\n'));
|
|
21
|
-
assert.ok(report.apps.length >= 4);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test('CMS app scaffold source is included in the SDK distribution contract', async () => {
|
|
25
|
-
const { validateApps } = await import('../../src/commands/app.js');
|
|
26
|
-
const report = validateApps({ appId: 'client-cms-editor' });
|
|
27
|
-
assert.equal(report.ok, true, report.errors.join('\n'));
|
|
28
|
-
assert.deepEqual(report.warnings, []);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
test('CAD and CMS workers load APP identity from agentsam.app.json', () => {
|
|
32
|
-
const cad = fs.readFileSync(path.resolve('apps/cad-creator/backend/worker/index.js'), 'utf8');
|
|
33
|
-
const cms = fs.readFileSync(path.resolve('apps/client-cms-editor/backend/worker/index.js'), 'utf8');
|
|
34
|
-
assert.match(cad, /import appManifest from ['"]\.\.\/\.\.\/agentsam\.app\.json['"]/);
|
|
35
|
-
assert.match(cms, /import appManifest from ['"]\.\.\/\.\.\/agentsam\.app\.json['"]/);
|
|
36
|
-
assert.doesNotMatch(cad, /const\s+APP\s*=\s*["']/);
|
|
37
|
-
assert.doesNotMatch(cms, /const\s+APP\s*=\s*["']/);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
test('desktop CMS shell app_id resolves to client-cms-editor', () => {
|
|
41
|
-
const manifest = JSON.parse(
|
|
42
|
-
fs.readFileSync(path.resolve('packages/agentsam-desktop-shell/manifests/cms-editor.json'), 'utf8'),
|
|
43
|
-
);
|
|
44
|
-
assert.equal(manifest.app_id, 'client-cms-editor');
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
test('Ecommerce CMS app bin exposes truthful runnable doctor state', () => {
|
|
49
|
-
const bin = path.resolve('apps/ecommerce-cms-agentsam/bin/agentsam-ecommerce.mjs');
|
|
50
|
-
const result = spawnSync(process.execPath, [bin, 'doctor', '--json'], {
|
|
51
|
-
cwd: path.resolve('.'),
|
|
52
|
-
encoding: 'utf8',
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
assert.equal(result.status, 0, result.stderr);
|
|
56
|
-
const report = JSON.parse(result.stdout);
|
|
57
|
-
assert.equal(report.app_id, 'ecommerce-cms-agentsam');
|
|
58
|
-
assert.equal(report.source.frontend, true);
|
|
59
|
-
assert.equal(report.runtime.package_json, true);
|
|
60
|
-
assert.equal(report.runtime.runnable, true);
|
|
61
|
-
assert.equal(report.manifest_runtime.local_preview, 'ready');
|
|
62
|
-
assert.equal(report.manifest_runtime.source_scaffold, 'ready');
|
|
63
|
-
assert.equal(report.contract_consistent, true);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test('Ecommerce CMS app manifest and package agree on executable preview', () => {
|
|
67
|
-
const manifest = JSON.parse(
|
|
68
|
-
fs.readFileSync(path.resolve('apps/ecommerce-cms-agentsam/agentsam.app.json'), 'utf8'),
|
|
69
|
-
);
|
|
70
|
-
const pkg = JSON.parse(
|
|
71
|
-
fs.readFileSync(path.resolve('apps/ecommerce-cms-agentsam/package.json'), 'utf8'),
|
|
72
|
-
);
|
|
73
|
-
const frontendPkg = JSON.parse(
|
|
74
|
-
fs.readFileSync(path.resolve('apps/ecommerce-cms-agentsam/frontend/package.json'), 'utf8'),
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
assert.equal(manifest.package, pkg.name);
|
|
78
|
-
assert.equal(manifest.bin, 'bin/agentsam-ecommerce.mjs');
|
|
79
|
-
assert.equal(manifest.runtime.local_preview, 'ready');
|
|
80
|
-
assert.equal(manifest.runtime.source_scaffold, 'ready');
|
|
81
|
-
assert.equal(manifest.preview.entry, '/admin');
|
|
82
|
-
assert.equal(manifest.preview.port, 4174);
|
|
83
|
-
assert.equal(typeof pkg.scripts.preview, 'string');
|
|
84
|
-
assert.equal(typeof frontendPkg.scripts.preview, 'string');
|
|
85
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { execFileSync } from 'node:child_process';
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import os from 'node:os';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import test from 'node:test';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
|
-
|
|
9
|
-
const repoRoot = fileURLToPath(new URL('../..', import.meta.url));
|
|
10
|
-
const bin = path.join(repoRoot, 'bin', 'agentsam');
|
|
11
|
-
const fixture = path.join(repoRoot, 'test', 'fixtures', 'project-authority', 'customer-app');
|
|
12
|
-
|
|
13
|
-
function runAutorag(root, ...args) {
|
|
14
|
-
const stdout = execFileSync(process.execPath, [bin, 'autorag', ...args, '--cwd', root], {
|
|
15
|
-
cwd: root,
|
|
16
|
-
encoding: 'utf8',
|
|
17
|
-
env: { ...process.env, CLOUDFLARE_API_TOKEN: '', CLOUDFLARE_ACCOUNT_ID: '' },
|
|
18
|
-
});
|
|
19
|
-
return JSON.parse(stdout);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
test('generic customer fixture discovers existing project resources and adopts Vectorize', () => {
|
|
23
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agentsam-project-authority-fixture-'));
|
|
24
|
-
try {
|
|
25
|
-
fs.cpSync(fixture, root, { recursive: true });
|
|
26
|
-
const status = runAutorag(root, 'status');
|
|
27
|
-
assert.deepEqual(status.discovery.scopes, ['apps']);
|
|
28
|
-
assert.equal(status.project_context.schema, 'agentsam.project-context.v1');
|
|
29
|
-
assert.equal(status.project_context.project.host_install.app_id, 'my-product');
|
|
30
|
-
assert.equal(status.project_context.resources.workers_ai.binding, 'MY_AI');
|
|
31
|
-
assert.equal(status.project_context.resources.vectorize[0].binding, 'MY_VECTORS');
|
|
32
|
-
assert.equal(status.project_context.resources.vectorize[0].index, 'customer-code-index');
|
|
33
|
-
assert.equal(status.project_context.resources.d1[0].binding, 'DB');
|
|
34
|
-
assert.equal(status.project_context.resources.r2[0].binding, 'CONTENT');
|
|
35
|
-
assert.equal(status.project_context.resources.vectorize[0].locally_executable, false);
|
|
36
|
-
assert.equal(status.project_context.resources.vectorize[0].remotely_executable, true);
|
|
37
|
-
|
|
38
|
-
const setup = runAutorag(root, 'setup', '--yes');
|
|
39
|
-
assert.deepEqual(setup.recommendation.scope, ['apps']);
|
|
40
|
-
assert.equal(setup.config.lane.backend, 'cloudflare_vectorize');
|
|
41
|
-
assert.equal(setup.config.lane.binding, 'MY_VECTORS');
|
|
42
|
-
assert.equal(setup.config.lane.index, 'customer-code-index');
|
|
43
|
-
assert.equal(setup.config.embedding.provider, 'none');
|
|
44
|
-
|
|
45
|
-
const policy = JSON.parse(fs.readFileSync(path.join(root, '.agentsam', 'knowledge.json'), 'utf8'));
|
|
46
|
-
assert.equal(policy.lane.binding, 'MY_VECTORS');
|
|
47
|
-
assert.equal(policy.lane.index, 'customer-code-index');
|
|
48
|
-
} finally {
|
|
49
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
50
|
-
}
|
|
51
|
-
});
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import os from 'node:os';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import test from 'node:test';
|
|
6
|
-
import { discoverKnowledgeRuntime } from '../../src/knowledge/runtime-discovery.js';
|
|
7
|
-
|
|
8
|
-
test('AutoRAG runtime discovery sees local index and Cloudflare Vectorize without local knowledge config', () => {
|
|
9
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agentsam-autorag-runtime-'));
|
|
10
|
-
try {
|
|
11
|
-
fs.mkdirSync(path.join(root, '.agentsam', 'knowledge'), { recursive: true });
|
|
12
|
-
fs.writeFileSync(path.join(root, '.agentsam', 'knowledge', 'index.sqlite'), '');
|
|
13
|
-
fs.writeFileSync(
|
|
14
|
-
path.join(root, 'wrangler.toml'),
|
|
15
|
-
[
|
|
16
|
-
'name = "demo-worker"',
|
|
17
|
-
'',
|
|
18
|
-
'[ai]',
|
|
19
|
-
'binding = "AGENTSAM_WAI"',
|
|
20
|
-
'',
|
|
21
|
-
'[[vectorize]]',
|
|
22
|
-
'binding = "DEMO_VECTORIZE"',
|
|
23
|
-
'index_name = "demo-index-1024"',
|
|
24
|
-
'',
|
|
25
|
-
].join('\n'),
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const runtime = discoverKnowledgeRuntime(root);
|
|
29
|
-
assert.equal(runtime.local_index.exists, true);
|
|
30
|
-
assert.equal(runtime.cloudflare.configured, true);
|
|
31
|
-
assert.equal(runtime.cloudflare.worker_name, 'demo-worker');
|
|
32
|
-
assert.equal(runtime.cloudflare.ai_binding, 'AGENTSAM_WAI');
|
|
33
|
-
assert.deepEqual(runtime.cloudflare.vectorize, [{
|
|
34
|
-
binding: 'DEMO_VECTORIZE',
|
|
35
|
-
index: 'demo-index-1024',
|
|
36
|
-
source: 'wrangler_config',
|
|
37
|
-
}]);
|
|
38
|
-
assert.deepEqual(runtime.lanes.map((lane) => lane.backend), [
|
|
39
|
-
'local_exact',
|
|
40
|
-
'cloudflare_vectorize',
|
|
41
|
-
]);
|
|
42
|
-
} finally {
|
|
43
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test('project context receipt separates observed deployment resources from local executability', () => {
|
|
48
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agentsam-project-context-'));
|
|
49
|
-
try {
|
|
50
|
-
fs.mkdirSync(path.join(root, '.agentsam'), { recursive: true });
|
|
51
|
-
fs.writeFileSync(path.join(root, '.agentsam', 'app.json'), JSON.stringify({ schema: 'agentsam.app-install.v1', app_id: 'my-product' }));
|
|
52
|
-
fs.writeFileSync(path.join(root, 'wrangler.toml'), [
|
|
53
|
-
'name = "customer-worker"',
|
|
54
|
-
'[ai]',
|
|
55
|
-
'binding = "MY_AI"',
|
|
56
|
-
'[[vectorize]]',
|
|
57
|
-
'binding = "MY_VECTORS"',
|
|
58
|
-
'index_name = "customer-code-index"',
|
|
59
|
-
'[[d1_databases]]',
|
|
60
|
-
'binding = "DB"',
|
|
61
|
-
'database_name = "customer-db"',
|
|
62
|
-
'database_id = "00000000-0000-0000-0000-000000000001"',
|
|
63
|
-
'[[r2_buckets]]',
|
|
64
|
-
'binding = "CONTENT"',
|
|
65
|
-
'bucket_name = "customer-assets"',
|
|
66
|
-
'',
|
|
67
|
-
].join('\n'));
|
|
68
|
-
|
|
69
|
-
const runtime = discoverKnowledgeRuntime(root, { env: {} });
|
|
70
|
-
assert.equal(runtime.schema, 'agentsam.project-context.v1');
|
|
71
|
-
assert.equal(runtime.project.host_install.app_id, 'my-product');
|
|
72
|
-
assert.equal(runtime.resources.workers_ai.binding, 'MY_AI');
|
|
73
|
-
assert.equal(runtime.resources.workers_ai.locally_executable, false);
|
|
74
|
-
assert.equal(runtime.resources.workers_ai.remotely_executable, true);
|
|
75
|
-
assert.equal(runtime.resources.vectorize[0].binding, 'MY_VECTORS');
|
|
76
|
-
assert.equal(runtime.resources.vectorize[0].index, 'customer-code-index');
|
|
77
|
-
assert.equal(runtime.resources.vectorize[0].locally_executable, false);
|
|
78
|
-
assert.equal(runtime.resources.vectorize[0].remotely_executable, true);
|
|
79
|
-
assert.equal(runtime.resources.d1[0].binding, 'DB');
|
|
80
|
-
assert.equal(runtime.resources.r2[0].binding, 'CONTENT');
|
|
81
|
-
assert.equal(runtime.knowledge.policy_configured, false);
|
|
82
|
-
assert.equal(runtime.knowledge.suggested_backend, 'cloudflare_vectorize');
|
|
83
|
-
} finally {
|
|
84
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
test('project context receipt surfaces knowledge policy versus Wrangler drift', () => {
|
|
89
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agentsam-project-context-drift-'));
|
|
90
|
-
try {
|
|
91
|
-
fs.writeFileSync(path.join(root, 'wrangler.toml'), [
|
|
92
|
-
'name = "customer-worker"',
|
|
93
|
-
'[[vectorize]]',
|
|
94
|
-
'binding = "MY_VECTORS"',
|
|
95
|
-
'index_name = "customer-code-index"',
|
|
96
|
-
'',
|
|
97
|
-
].join('\n'));
|
|
98
|
-
const runtime = discoverKnowledgeRuntime(root, {
|
|
99
|
-
env: {},
|
|
100
|
-
knowledgeConfig: { lane: { backend: 'cloudflare_vectorize', binding: 'OTHER_VECTORS', index: 'other-index' } },
|
|
101
|
-
});
|
|
102
|
-
assert.equal(runtime.conflicts.length, 1);
|
|
103
|
-
assert.equal(runtime.conflicts[0].kind, 'knowledge_deployment_drift');
|
|
104
|
-
} finally {
|
|
105
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
106
|
-
}
|
|
107
|
-
});
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import os from 'node:os';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import {
|
|
7
|
-
discoverOpenScad,
|
|
8
|
-
openScadStatus,
|
|
9
|
-
discoverFreeCad,
|
|
10
|
-
freeCadStatus,
|
|
11
|
-
meshyStatus,
|
|
12
|
-
mujocoStatus,
|
|
13
|
-
discoverAllCadTools,
|
|
14
|
-
getInstallGuidance,
|
|
15
|
-
} from '../../src/lib/cad/index.js';
|
|
16
|
-
|
|
17
|
-
function makeFixture(t, name) {
|
|
18
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), `agentsam-${name}-test-`));
|
|
19
|
-
t.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
20
|
-
const binary = path.join(root, process.platform === 'win32' ? `${name}.exe` : name);
|
|
21
|
-
fs.writeFileSync(binary, `fake ${name}\n`);
|
|
22
|
-
return { root, binary };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
test('discoverOpenScad honors explicit binary before env and path', (t) => {
|
|
26
|
-
const { binary } = makeFixture(t, 'openscad');
|
|
27
|
-
const result = discoverOpenScad({
|
|
28
|
-
openscadBin: binary,
|
|
29
|
-
env: { AGENTSAM_OPENSCAD_BIN: '/nonexistent/bin' },
|
|
30
|
-
});
|
|
31
|
-
assert.equal(result.source, 'explicit');
|
|
32
|
-
assert.equal(result.binary, fs.realpathSync(binary));
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test('discoverOpenScad honors AGENTSAM_OPENSCAD_BIN when explicit is not set', (t) => {
|
|
36
|
-
const { binary } = makeFixture(t, 'openscad');
|
|
37
|
-
const result = discoverOpenScad({
|
|
38
|
-
env: { AGENTSAM_OPENSCAD_BIN: binary },
|
|
39
|
-
});
|
|
40
|
-
assert.equal(result.source, 'env');
|
|
41
|
-
assert.equal(result.binary, fs.realpathSync(binary));
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('openScadStatus probes version boundedly and returns deterministic receipt', async (t) => {
|
|
45
|
-
const { binary } = makeFixture(t, 'openscad');
|
|
46
|
-
const calls = [];
|
|
47
|
-
const status = await openScadStatus({
|
|
48
|
-
openscadBin: binary,
|
|
49
|
-
runProcessImpl: async (command, args) => {
|
|
50
|
-
calls.push({ command, args });
|
|
51
|
-
return { code: 0, stdout: '', stderr: 'OpenSCAD version 2026.04.26\n' };
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
assert.equal(status.tool, 'openscad');
|
|
56
|
-
assert.equal(status.available, true);
|
|
57
|
-
assert.equal(status.version, '2026.04.26');
|
|
58
|
-
assert.equal(status.execution_lane, 'native');
|
|
59
|
-
assert.deepEqual(calls[0], { command: fs.realpathSync(binary), args: ['-v'] });
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test('discoverFreeCad honors explicit binary and AGENTSAM_FREECAD_BIN', (t) => {
|
|
63
|
-
const { binary } = makeFixture(t, 'FreeCADCmd');
|
|
64
|
-
const result = discoverFreeCad({
|
|
65
|
-
freecadBin: binary,
|
|
66
|
-
env: { AGENTSAM_FREECAD_BIN: '/nonexistent/path' },
|
|
67
|
-
});
|
|
68
|
-
assert.equal(result.source, 'explicit');
|
|
69
|
-
assert.equal(result.binary, fs.realpathSync(binary));
|
|
70
|
-
|
|
71
|
-
const envResult = discoverFreeCad({
|
|
72
|
-
env: { AGENTSAM_FREECAD_BIN: binary },
|
|
73
|
-
});
|
|
74
|
-
assert.equal(envResult.source, 'env');
|
|
75
|
-
assert.equal(envResult.binary, fs.realpathSync(binary));
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test('freeCadStatus probes version and returns deterministic receipt', async (t) => {
|
|
79
|
-
const { binary } = makeFixture(t, 'FreeCADCmd');
|
|
80
|
-
const calls = [];
|
|
81
|
-
const status = await freeCadStatus({
|
|
82
|
-
freecadBin: binary,
|
|
83
|
-
runProcessImpl: async (command, args) => {
|
|
84
|
-
calls.push({ command, args });
|
|
85
|
-
return { code: 0, stdout: 'FreeCAD 1.1.1 Revision: 20260414 (Git shallow)\n', stderr: '' };
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
assert.equal(status.tool, 'freecad');
|
|
90
|
-
assert.equal(status.available, true);
|
|
91
|
-
assert.equal(status.version, 'FreeCAD 1.1.1 Revision: 20260414 (Git shallow)');
|
|
92
|
-
assert.equal(status.execution_lane, 'native');
|
|
93
|
-
assert.deepEqual(calls[0], { command: fs.realpathSync(binary), args: ['--version'] });
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
test('meshyStatus discovers API key configuration via environment', () => {
|
|
97
|
-
const noKey = meshyStatus({ env: {} });
|
|
98
|
-
assert.equal(noKey.available, false);
|
|
99
|
-
assert.equal(noKey.source, 'none');
|
|
100
|
-
assert.equal(noKey.execution_lane, 'cloud_byok');
|
|
101
|
-
|
|
102
|
-
const withKey = meshyStatus({ env: { MESHY_API_KEY: 'msy_test_secret_key' } });
|
|
103
|
-
assert.equal(withKey.available, true);
|
|
104
|
-
assert.equal(withKey.source, 'env');
|
|
105
|
-
assert.equal(withKey.version, 'v2-api');
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
test('mujocoStatus returns browser WASM bundled capability', () => {
|
|
109
|
-
const status = mujocoStatus();
|
|
110
|
-
assert.equal(status.tool, 'mujoco');
|
|
111
|
-
assert.equal(status.available, true);
|
|
112
|
-
assert.equal(status.execution_lane, 'browser_wasm');
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
test('discoverAllCadTools aggregates deterministic receipts across engines', async (t) => {
|
|
116
|
-
const { binary: openscad } = makeFixture(t, 'openscad');
|
|
117
|
-
const { binary: freecad } = makeFixture(t, 'FreeCADCmd');
|
|
118
|
-
const { binary: blender } = makeFixture(t, 'blender');
|
|
119
|
-
|
|
120
|
-
const report = await discoverAllCadTools({
|
|
121
|
-
openscadBin: openscad,
|
|
122
|
-
freecadBin: freecad,
|
|
123
|
-
blenderBin: blender,
|
|
124
|
-
env: { MESHY_API_KEY: 'test_key' },
|
|
125
|
-
runProcessImpl: async (command, args) => {
|
|
126
|
-
if (args[0] === '-v') return { code: 0, stdout: '', stderr: 'OpenSCAD version 2026.04.26\n' };
|
|
127
|
-
if (command.includes('FreeCAD')) return { code: 0, stdout: 'FreeCAD 1.1.1 Revision: 20260414\n', stderr: '' };
|
|
128
|
-
return { code: 0, stdout: 'Blender 5.0.1\n', stderr: '' };
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
assert.equal(report.schema_version, 1);
|
|
133
|
-
assert.equal(report.total_tools, 5);
|
|
134
|
-
assert.equal(report.available_tools, 5);
|
|
135
|
-
assert.equal(report.all_systems_ready, true);
|
|
136
|
-
assert.equal(report.tools.length, 5);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
test('getInstallGuidance provides exact OS package manager commands', () => {
|
|
140
|
-
const darwinOpenScad = getInstallGuidance('openscad', 'darwin');
|
|
141
|
-
assert.equal(darwinOpenScad.command, 'brew install openscad');
|
|
142
|
-
|
|
143
|
-
const linuxFreeCad = getInstallGuidance('freecad', 'linux');
|
|
144
|
-
assert.match(linuxFreeCad.command, /apt-get install.*freecad/);
|
|
145
|
-
|
|
146
|
-
const winBlender = getInstallGuidance('blender', 'win32');
|
|
147
|
-
assert.equal(winBlender.command, 'winget install BlenderFoundation.Blender');
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
test('discoverOpenScad returns binary: null when not found on host (no hardcoded defaults)', () => {
|
|
151
|
-
const emptyDiscovery = discoverOpenScad({
|
|
152
|
-
env: { PATH: '' },
|
|
153
|
-
platform: 'unknown_os',
|
|
154
|
-
});
|
|
155
|
-
assert.equal(emptyDiscovery.binary, null);
|
|
156
|
-
assert.equal(emptyDiscovery.source, 'none');
|
|
157
|
-
});
|
|
158
|
-
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { test } from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import http from 'node:http';
|
|
4
|
-
import fs from 'node:fs';
|
|
5
|
-
import os from 'node:os';
|
|
6
|
-
import path from 'node:path';
|
|
7
|
-
import {
|
|
8
|
-
DEFAULT_CAD_DOCKER_PORT,
|
|
9
|
-
DEFAULT_CAD_DOCKER_URL,
|
|
10
|
-
resolveDockerServiceConfig,
|
|
11
|
-
probeDockerServiceHealth,
|
|
12
|
-
executeOpenScadDocker,
|
|
13
|
-
executeFreeCadDocker,
|
|
14
|
-
executeBlenderDocker,
|
|
15
|
-
} from '../../src/lib/cad/docker-executor.js';
|
|
16
|
-
import { discoverAllCadTools } from '../../src/lib/cad/discovery.js';
|
|
17
|
-
|
|
18
|
-
test('resolveDockerServiceConfig resolves URL and token from env or options', () => {
|
|
19
|
-
const conf1 = resolveDockerServiceConfig({
|
|
20
|
-
serviceUrl: 'http://custom-host:9999/',
|
|
21
|
-
token: 'secret-token-123',
|
|
22
|
-
});
|
|
23
|
-
assert.equal(conf1.url, 'http://custom-host:9999');
|
|
24
|
-
assert.equal(conf1.token, 'secret-token-123');
|
|
25
|
-
|
|
26
|
-
const conf2 = resolveDockerServiceConfig({
|
|
27
|
-
env: {
|
|
28
|
-
AGENTSAM_CAD_SERVICE_URL: 'http://env-host:8888',
|
|
29
|
-
AGENTSAM_CAD_TOKEN: 'env-tok',
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
assert.equal(conf2.url, 'http://env-host:8888');
|
|
33
|
-
assert.equal(conf2.token, 'env-tok');
|
|
34
|
-
|
|
35
|
-
const confDefault = resolveDockerServiceConfig({ env: {} });
|
|
36
|
-
assert.equal(confDefault.url, DEFAULT_CAD_DOCKER_URL);
|
|
37
|
-
assert.equal(confDefault.token, null);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
test('probeDockerServiceHealth returns offline gracefully when unreachable', async () => {
|
|
41
|
-
const result = await probeDockerServiceHealth({
|
|
42
|
-
serviceUrl: 'http://127.0.0.1:54321', // Unused port
|
|
43
|
-
timeoutMs: 150,
|
|
44
|
-
});
|
|
45
|
-
assert.equal(result.available, false);
|
|
46
|
-
assert.equal(result.url, 'http://127.0.0.1:54321');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
test('Docker CAD service executor routes compile, build, and inspect requests', async () => {
|
|
50
|
-
const recordedRequests = [];
|
|
51
|
-
const mockServer = http.createServer((req, res) => {
|
|
52
|
-
let body = '';
|
|
53
|
-
req.on('data', chunk => { body += chunk; });
|
|
54
|
-
req.on('end', () => {
|
|
55
|
-
recordedRequests.push({
|
|
56
|
-
url: req.url,
|
|
57
|
-
method: req.method,
|
|
58
|
-
auth: req.headers['authorization'],
|
|
59
|
-
body: body ? JSON.parse(body) : null,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
if (req.url === '/healthz') {
|
|
63
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
64
|
-
res.end(JSON.stringify({
|
|
65
|
-
ok: true,
|
|
66
|
-
service: 'agentsam-cad',
|
|
67
|
-
version: '1',
|
|
68
|
-
tools: {
|
|
69
|
-
openscad: { installed: true, version: 'OpenSCAD 2021.01-docker' },
|
|
70
|
-
freecad: { installed: true, version: 'FreeCAD 0.21.2-docker' },
|
|
71
|
-
blender: { installed: true, version: 'Blender 4.2.0-docker' },
|
|
72
|
-
},
|
|
73
|
-
}));
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (req.url === '/v1/openscad/compile') {
|
|
78
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
79
|
-
res.end(JSON.stringify({
|
|
80
|
-
ok: true,
|
|
81
|
-
tool: 'openscad',
|
|
82
|
-
format: 'stl',
|
|
83
|
-
filename: 'bracket.stl',
|
|
84
|
-
size_bytes: 128,
|
|
85
|
-
sha256: 'abc123sha',
|
|
86
|
-
artifact_base64: Buffer.from('solid bracket\nendsolid').toString('base64'),
|
|
87
|
-
logs: ['[DOCKER] OpenSCAD compiled successfully'],
|
|
88
|
-
}));
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (req.url === '/v1/freecad/execute') {
|
|
93
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
94
|
-
res.end(JSON.stringify({
|
|
95
|
-
ok: true,
|
|
96
|
-
tool: 'freecad',
|
|
97
|
-
format: 'step',
|
|
98
|
-
filename: 'part.step',
|
|
99
|
-
size_bytes: 512,
|
|
100
|
-
sha256: 'step123sha',
|
|
101
|
-
artifact_base64: Buffer.from('ISO-10303-21;').toString('base64'),
|
|
102
|
-
metrics: { volume: 1500, surface_area: 800, faces_count: 6 },
|
|
103
|
-
logs: ['[DOCKER] FreeCAD built STEP model'],
|
|
104
|
-
}));
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (req.url === '/v1/blender/execute') {
|
|
109
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
110
|
-
res.end(JSON.stringify({
|
|
111
|
-
ok: true,
|
|
112
|
-
tool: 'blender',
|
|
113
|
-
operation: 'build',
|
|
114
|
-
format: 'glb',
|
|
115
|
-
filename: 'scene.glb',
|
|
116
|
-
size_bytes: 1024,
|
|
117
|
-
sha256: 'glb123sha',
|
|
118
|
-
artifact_base64: Buffer.from('glTF binary mock').toString('base64'),
|
|
119
|
-
result: { ok: true, blender_version: '4.2.0', objects: ['Cube', 'Camera'] },
|
|
120
|
-
logs: ['[DOCKER] Blender rendered glb scene'],
|
|
121
|
-
}));
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
126
|
-
res.end(JSON.stringify({ ok: false, error: 'not_found' }));
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
await new Promise((resolve) => mockServer.listen(0, '127.0.0.1', resolve));
|
|
131
|
-
const port = mockServer.address().port;
|
|
132
|
-
const serviceUrl = `http://127.0.0.1:${port}`;
|
|
133
|
-
const token = 'test-token-xyz';
|
|
134
|
-
|
|
135
|
-
try {
|
|
136
|
-
// 1. Health probe
|
|
137
|
-
const health = await probeDockerServiceHealth({ serviceUrl, token });
|
|
138
|
-
assert.equal(health.available, true);
|
|
139
|
-
assert.equal(health.tools.openscad.installed, true);
|
|
140
|
-
assert.equal(health.tools.freecad.installed, true);
|
|
141
|
-
assert.equal(health.tools.blender.installed, true);
|
|
142
|
-
|
|
143
|
-
// 2. OpenSCAD execution
|
|
144
|
-
const oscadRes = await executeOpenScadDocker({
|
|
145
|
-
source: 'cube([10, 10, 10]);',
|
|
146
|
-
outputFormat: 'stl',
|
|
147
|
-
filename: 'bracket.stl',
|
|
148
|
-
serviceUrl,
|
|
149
|
-
token,
|
|
150
|
-
});
|
|
151
|
-
assert.equal(oscadRes.success, true);
|
|
152
|
-
assert.equal(oscadRes.filename, 'bracket.stl');
|
|
153
|
-
assert.match(oscadRes.artifactContent, /solid bracket/);
|
|
154
|
-
assert.equal(oscadRes.mimeType, 'model/stl');
|
|
155
|
-
|
|
156
|
-
// 3. FreeCAD execution
|
|
157
|
-
const freecadRes = await executeFreeCadDocker({
|
|
158
|
-
operations: [{ op: 'box', length: 10, width: 10, height: 10 }],
|
|
159
|
-
format: 'step',
|
|
160
|
-
filename: 'part.step',
|
|
161
|
-
serviceUrl,
|
|
162
|
-
token,
|
|
163
|
-
});
|
|
164
|
-
assert.equal(freecadRes.success, true);
|
|
165
|
-
assert.equal(freecadRes.format, 'step');
|
|
166
|
-
assert.equal(freecadRes.metrics.volume, 1500);
|
|
167
|
-
assert.match(freecadRes.artifactText, /ISO-10303-21;/);
|
|
168
|
-
|
|
169
|
-
// 4. Blender execution
|
|
170
|
-
const blenderRes = await executeBlenderDocker({
|
|
171
|
-
operation: 'build',
|
|
172
|
-
operations: [{ op: 'add', primitive: 'cube' }],
|
|
173
|
-
format: 'glb',
|
|
174
|
-
serviceUrl,
|
|
175
|
-
token,
|
|
176
|
-
});
|
|
177
|
-
assert.equal(blenderRes.success, true);
|
|
178
|
-
assert.equal(blenderRes.format, 'glb');
|
|
179
|
-
assert.equal(blenderRes.result.blender_version, '4.2.0');
|
|
180
|
-
|
|
181
|
-
// 5. Verify recorded request signatures
|
|
182
|
-
assert.equal(recordedRequests[0].url, '/healthz');
|
|
183
|
-
assert.equal(recordedRequests[0].auth, 'Bearer test-token-xyz');
|
|
184
|
-
assert.equal(recordedRequests[1].url, '/v1/openscad/compile');
|
|
185
|
-
assert.equal(recordedRequests[2].url, '/v1/freecad/execute');
|
|
186
|
-
assert.equal(recordedRequests[3].url, '/v1/blender/execute');
|
|
187
|
-
} finally {
|
|
188
|
-
await new Promise((resolve) => mockServer.close(resolve));
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
test('discoverAllCadTools adopts Docker service execution lane when host tools are absent', async () => {
|
|
193
|
-
const mockServer = http.createServer((req, res) => {
|
|
194
|
-
if (req.url === '/healthz') {
|
|
195
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
196
|
-
res.end(JSON.stringify({
|
|
197
|
-
ok: true,
|
|
198
|
-
service: 'agentsam-cad',
|
|
199
|
-
version: '1',
|
|
200
|
-
tools: {
|
|
201
|
-
openscad: { installed: true, version: 'OpenSCAD 2021.01-docker' },
|
|
202
|
-
freecad: { installed: true, version: 'FreeCAD 0.21.2-docker' },
|
|
203
|
-
blender: { installed: true, version: 'Blender 4.2.0-docker' },
|
|
204
|
-
},
|
|
205
|
-
}));
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
res.writeHead(404);
|
|
209
|
-
res.end();
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
await new Promise((resolve) => mockServer.listen(0, '127.0.0.1', resolve));
|
|
213
|
-
const port = mockServer.address().port;
|
|
214
|
-
const serviceUrl = `http://127.0.0.1:${port}`;
|
|
215
|
-
|
|
216
|
-
try {
|
|
217
|
-
const report = await discoverAllCadTools({
|
|
218
|
-
openscadBin: '/nonexistent/openscad',
|
|
219
|
-
freecadBin: '/nonexistent/freecad',
|
|
220
|
-
blenderBin: '/nonexistent/blender',
|
|
221
|
-
env: {
|
|
222
|
-
AGENTSAM_CAD_SERVICE_URL: serviceUrl,
|
|
223
|
-
PATH: '/empty',
|
|
224
|
-
},
|
|
225
|
-
cache: false,
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
const openscad = report.tools.find(t => t.tool === 'openscad');
|
|
229
|
-
const freecad = report.tools.find(t => t.tool === 'freecad');
|
|
230
|
-
const blender = report.tools.find(t => t.tool === 'blender');
|
|
231
|
-
|
|
232
|
-
assert.equal(openscad.available, true);
|
|
233
|
-
assert.equal(openscad.execution_lane, 'docker_service');
|
|
234
|
-
assert.equal(openscad.source, 'docker_service');
|
|
235
|
-
assert.match(openscad.binary, /^docker:\/\//);
|
|
236
|
-
|
|
237
|
-
assert.equal(freecad.available, true);
|
|
238
|
-
assert.equal(freecad.execution_lane, 'docker_service');
|
|
239
|
-
assert.equal(freecad.source, 'docker_service');
|
|
240
|
-
assert.match(freecad.binary, /^docker:\/\//);
|
|
241
|
-
|
|
242
|
-
assert.equal(blender.available, true);
|
|
243
|
-
assert.equal(blender.execution_lane, 'docker_service');
|
|
244
|
-
assert.equal(blender.source, 'docker_service');
|
|
245
|
-
assert.match(blender.binary, /^docker:\/\//);
|
|
246
|
-
} finally {
|
|
247
|
-
await new Promise((resolve) => mockServer.close(resolve));
|
|
248
|
-
}
|
|
249
|
-
});
|