@inneranimalmedia/agentsam-sdk 2.6.18 → 2.6.19
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 +9 -1
- package/apps/README.md +71 -0
- package/apps/agentsam-browser-site/README.md +30 -0
- package/apps/agentsam-copro-studio/README.md +113 -0
- package/apps/agentsam-go-worker/LICENSE +110 -0
- package/apps/agentsam-go-worker/README.md +244 -0
- package/apps/agentsam-go-worker/runtime/.agentsam-build-commit +1 -0
- package/apps/agentsam-go-worker/runtime/.agentsam-built-at +1 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/app_packages.go +443 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/app_packages_test.go +125 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/auth.go +27 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/auth_test.go +45 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/expose.go +147 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/expose_test.go +59 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/hostpath.go +11 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/language_packs.go +172 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/language_packs_test.go +32 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/main.go +253 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/pair.go +157 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/pair_test.go +100 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/relay.go +162 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/relay_supervisor_test.go +128 -0
- package/apps/agentsam-go-worker/runtime/cmd/agentsamd/tunnel.go +51 -0
- package/apps/agentsam-go-worker/runtime/cmd/server/main.go +135 -0
- package/apps/agentsam-go-worker/runtime/go.mod +8 -0
- package/apps/agentsam-go-worker/runtime/go.sum +4 -0
- package/apps/agentsam-go-worker/runtime/internal/agentserror/envelope.go +100 -0
- package/apps/agentsam-go-worker/runtime/internal/agentserror/envelope_test.go +31 -0
- package/apps/agentsam-go-worker/runtime/internal/backoff/backoff.go +57 -0
- package/apps/agentsam-go-worker/runtime/internal/backoff/backoff_test.go +31 -0
- package/apps/agentsam-go-worker/runtime/internal/dockerapi/client.go +409 -0
- package/apps/agentsam-go-worker/runtime/internal/dockerapi/dockerapi_test.go +178 -0
- package/apps/agentsam-go-worker/runtime/internal/dockerapi/http.go +202 -0
- package/apps/agentsam-go-worker/runtime/internal/execapi/exec.go +148 -0
- package/apps/agentsam-go-worker/runtime/internal/execapi/http.go +18 -0
- package/apps/agentsam-go-worker/runtime/internal/execapi/pty.go +45 -0
- package/apps/agentsam-go-worker/runtime/internal/execapi/pty_sessions.go +543 -0
- package/apps/agentsam-go-worker/runtime/internal/execapi/pty_sessions_test.go +195 -0
- package/apps/agentsam-go-worker/runtime/internal/execapi/pty_test.go +21 -0
- package/apps/agentsam-go-worker/runtime/internal/fsapi/fsapi.go +864 -0
- package/apps/agentsam-go-worker/runtime/internal/fsapi/fsapi_test.go +228 -0
- package/apps/agentsam-go-worker/runtime/internal/gitapi/gitapi.go +589 -0
- package/apps/agentsam-go-worker/runtime/internal/gitapi/gitapi_test.go +113 -0
- package/apps/agentsam-go-worker/runtime/internal/hashop/hashop.go +37 -0
- package/apps/agentsam-go-worker/runtime/internal/hashop/hashop_test.go +26 -0
- package/apps/agentsam-go-worker/runtime/internal/health/health.go +60 -0
- package/apps/agentsam-go-worker/runtime/internal/hostpath/hostpath.go +134 -0
- package/apps/agentsam-go-worker/runtime/internal/hostpath/hostpath_test.go +59 -0
- package/apps/agentsam-go-worker/runtime/internal/imessage/http.go +120 -0
- package/apps/agentsam-go-worker/runtime/internal/imessage/imessage.go +523 -0
- package/apps/agentsam-go-worker/runtime/internal/imessage/imessage_test.go +307 -0
- package/apps/agentsam-go-worker/runtime/internal/inspect/inspect.go +71 -0
- package/apps/agentsam-go-worker/runtime/internal/inspect/inspect_test.go +24 -0
- package/apps/agentsam-go-worker/runtime/internal/localauth/token.go +171 -0
- package/apps/agentsam-go-worker/runtime/internal/localauth/token_test.go +84 -0
- package/apps/agentsam-go-worker/runtime/internal/pairing/dialog.go +56 -0
- package/apps/agentsam-go-worker/runtime/internal/pairing/pairing.go +100 -0
- package/apps/agentsam-go-worker/runtime/internal/pairing/pairing_test.go +75 -0
- package/apps/agentsam-go-worker/runtime/internal/relay/relay.go +519 -0
- package/apps/agentsam-go-worker/runtime/internal/relay/relay_test.go +397 -0
- package/apps/agentsam-go-worker/runtime/internal/runtimeinfo/runtimeinfo.go +49 -0
- package/apps/agentsam-go-worker/runtime/internal/runtimeinfo/runtimeinfo_test.go +20 -0
- package/apps/agentsam-go-worker/runtime/internal/sshtunnel/sshtunnel.go +277 -0
- package/apps/agentsam-go-worker/runtime/internal/sshtunnel/sshtunnel_test.go +176 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/ADAPTER_CONTRACT.md +61 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/bridge.go +125 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/registry.go +53 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/tools/echo-go/adapter.go +39 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/tools/echo-go/tool.json +21 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/tools/echo-http/server.py +33 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/tools/echo-http/tool.json +17 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/tools/echo-node/adapter.js +13 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/tools/echo-node/tool.json +20 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/tools/echo-python/adapter.py +18 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/tools/echo-python/tool.json +20 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/tools/echo-rust/Cargo.toml +12 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/tools/echo-rust/src/main.rs +21 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/tools/echo-rust/tool.json +21 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/tools/echo-ts/adapter.ts +19 -0
- package/apps/agentsam-go-worker/runtime/mcp-bridge/tools/echo-ts/tool.json +22 -0
- package/apps/agentsamd/README.md +107 -0
- package/apps/cad-creator/LICENSE +110 -0
- package/apps/cad-creator/README.md +743 -0
- package/apps/cad-creator/agentsam.app.json +2 -2
- package/apps/design-canvas/README.md +101 -0
- package/apps/design-canvas/agentsam.app.json +19 -8
- package/apps/ecommerce-cms-agentsam/README.md +24 -0
- package/apps/ecommerce-cms-agentsam/agentsam.app.json +1 -128
- package/apps/local-studio/LICENSE +110 -0
- package/apps/local-studio/README.md +61 -0
- package/apps/local-studio/agentsam.app.json +47 -2
- package/apps/samsketch/README.md +21 -0
- package/apps/samsketch/agentsam.app.json +0 -1
- package/apps/samspeaks/README.md +49 -0
- package/apps/theme-gallery-preview/README.md +49 -0
- package/docs/AUTH_IDENTITY_CONTRACT.md +70 -37
- package/docs/CLI_SHELL.md +19 -8
- package/docs/adr/ADR-0011-portable-project-context-and-agentsam-authority.md +124 -0
- package/docs/adr/ADR-0012-repository-intelligence-and-knowledge-lane-authority.md +148 -0
- package/docs/adr/ADR-0013-local-studio-identity-and-provider-grant-ownership.md +101 -0
- package/docs/adr/README.md +24 -13
- package/docs/agentsam-remote-control/ARCHITECTURE.md +60 -0
- package/docs/agentsam-remote-control/README.md +127 -0
- package/docs/architecture/ACP_D1_HOSTING.md +93 -47
- package/docs/architecture/AGENTSAM_RUNTIME_PROTOCOL.md +6 -4
- package/docs/architecture/AGENTSAM_WORK_IDE_LANES_2026-10-28.md +2 -0
- package/docs/architecture/DESIGN_PROJECT_READS.md +35 -0
- package/docs/architecture/FS_E2E_CLOSURE_RECEIPT.md +2 -0
- package/docs/architecture/LOCAL_FS_AUTHORITY.md +31 -29
- package/docs/architecture/LOCAL_STUDIO_CLOUDFLARE_OAUTH.md +115 -23
- package/docs/architecture/PROVIDER_NEUTRAL_COMPUTE.md +89 -0
- package/docs/architecture/SAM_RUNTIME_EXECUTION_PLAN.md +88 -0
- package/docs/architecture/identity-and-plugin-oauth-ownership.md +70 -0
- package/docs/architecture/marketplace-forms-and-embeds-end-state.md +299 -0
- package/docs/architecture/primetech/IMPLEMENTATION_WAVES.md +4 -0
- package/docs/architecture/primetech/RESIDENTIAL_DEVELOPMENT_PLAN.md +166 -0
- package/docs/architecture/studio-templates-audit-2026-11-01.md +2 -0
- package/docs/contracts/environment-vocabulary.md +14 -14
- package/docs/contracts/google-cloud-oauth-setup.md +15 -0
- package/docs/document-workflows.md +14 -0
- package/docs/generated/SDK_CAPABILITY_INVENTORY.md +37 -34
- package/docs/local-studio/WORKMODE_DONOR_NOTES.md +2 -0
- package/docs/plans/AGENTSAM_SDK_RELEASE_PROGRAM.md +3 -3
- package/docs/plugins.md +82 -37
- package/docs/prd/PRD-agentsam-cad-studio.md +8 -0
- package/docs/primetech/CANVAS_WORKSPACE_SPEC_2026-12-01.md +335 -0
- package/docs/product/COPRO-EXECUTION-PLAN.md +1 -1
- package/docs/product/PLUGIN-GALLERY-DISCOVERY-AND-INSTALL.md +44 -97
- package/docs/reference/AGENTSAM-REGISTRY.generated.md +18 -15
- package/docs/reference/MCP-DEVELOPMENT.md +32 -0
- package/docs/sam/opencv-media.md +70 -36
- package/migrations/d1/0011c_agentsam_skill_v2_backfill.sql +23 -1
- package/migrations/d1/20261127_agentsam_r2_list_prefix_pagination.sql +17 -0
- package/migrations/d1/20261128_rename_agentsam_mcp_cloudflare_plugin_key.sql +29 -0
- package/migrations/d1/20261130_release_publish_capability.sql +16 -0
- package/migrations/d1/20261202_plugin_built_in_and_categories.sql +19 -0
- package/migrations/d1/generated/20261123_portable_cli_seed.sql +99 -94
- package/migrations/d1/generated/20261123_source_skill_seed.sql +487 -39
- package/migrations/runtime/0013_acp_spawn_and_approval_contract.sql +54 -0
- package/migrations/runtime/0014_notification_outbox_channels.sql +41 -0
- package/package.json +26 -12
- package/packages/agentsam-3d-viewer/package.json +1 -1
- package/packages/agentsam-abs/README.md +91 -0
- package/packages/agentsam-analytics/LICENSE +110 -0
- package/packages/agentsam-analytics/README.md +92 -0
- package/packages/agentsam-architectural-intelligence/mcp/assembly.mjs +17 -0
- package/packages/agentsam-architectural-intelligence/mcp/server.mjs +2 -8
- package/packages/agentsam-assets-core/LICENSE +110 -0
- package/packages/agentsam-brand/LICENSE +110 -0
- package/packages/agentsam-brand/README.md +12 -0
- package/packages/agentsam-brand/package.json +8 -3
- package/packages/agentsam-brand/src/adapters/d1-registry.d.ts +58 -0
- package/packages/agentsam-brand/src/adapters/d1-registry.js +437 -15
- package/packages/agentsam-brand/src/cli/controller.js +53 -16
- package/packages/agentsam-brand/src/core/capabilities.js +3 -3
- package/packages/agentsam-brand/src/core/iconography/family.js +569 -0
- package/packages/agentsam-brand/src/index.js +15 -1
- package/packages/agentsam-brand/src/workspace.d.ts +30 -4
- package/packages/agentsam-brand/src/workspace.js +28 -3
- package/packages/agentsam-browser-surface/README.md +28 -0
- package/packages/agentsam-campaign/LICENSE +110 -0
- package/packages/agentsam-campaign/README.md +133 -0
- package/packages/agentsam-cloudflare-images/LICENSE +110 -0
- package/packages/agentsam-cms/package.json +2 -2
- package/packages/agentsam-cms/src/chat-storage.js +33 -9
- package/packages/agentsam-cms/test/chat-storage.test.mjs +37 -0
- package/packages/agentsam-communications/README.md +5 -4
- package/packages/agentsam-communications/package.json +5 -3
- package/packages/agentsam-communications/src/adapters.js +26 -0
- package/packages/agentsam-communications/src/imessage.js +249 -0
- package/packages/agentsam-communications/src/index.js +3 -1
- package/packages/agentsam-communications/src/outbox.js +87 -6
- package/packages/agentsam-communications/src/push.js +146 -0
- package/packages/agentsam-communications/test/communications.test.mjs +43 -1
- package/packages/agentsam-communications/test/imessage.test.mjs +223 -0
- package/packages/agentsam-communications/test/push.test.mjs +113 -0
- package/packages/agentsam-content/LICENSE +110 -0
- package/packages/agentsam-content-studio/LICENSE +110 -0
- package/packages/agentsam-contracts/README.md +6 -1
- package/packages/agentsam-contracts/agentsam.package.json +11 -3
- package/packages/agentsam-contracts/dist/agent.d.ts +1 -3
- package/packages/agentsam-contracts/dist/agent.js +1 -1
- package/packages/agentsam-contracts/dist/index.js +30 -39
- package/packages/agentsam-contracts/dist/run.d.ts +70 -45
- package/packages/agentsam-contracts/dist/run.js +29 -38
- package/packages/agentsam-contracts/dist/widgets.d.ts +18 -0
- package/packages/agentsam-contracts/package.json +6 -3
- package/packages/agentsam-contracts/schemas/approval-decision.v1.schema.json +36 -0
- package/packages/agentsam-contracts/schemas/approval.v1.schema.json +134 -0
- package/packages/agentsam-contracts/schemas/run-receipt.v1.schema.json +2 -91
- package/packages/agentsam-contracts/schemas/run-spawn.v1.schema.json +74 -0
- package/packages/agentsam-contracts/schemas/run.v1.schema.json +3 -85
- package/packages/agentsam-contracts/src/agent.ts +1 -3
- package/packages/agentsam-contracts/src/run.ts +76 -90
- package/packages/agentsam-contracts/src/widgets.ts +22 -0
- package/packages/agentsam-contracts/test/run-contract.test.mjs +29 -61
- package/packages/agentsam-database-editor/LICENSE +110 -0
- package/packages/agentsam-database-editor/README.md +105 -0
- package/packages/agentsam-desktop-shell/LICENSE +110 -0
- package/packages/agentsam-desktop-shell/README.md +73 -0
- package/packages/agentsam-docs-theme/LICENSE +110 -0
- package/packages/agentsam-docs-theme/README.md +11 -0
- package/packages/agentsam-embeds/README.md +51 -0
- package/packages/agentsam-errors/package.json +1 -1
- package/packages/agentsam-goalguru/README.md +19 -0
- package/packages/agentsam-goap/package.json +2 -2
- package/packages/agentsam-hooks/README.md +14 -0
- package/packages/agentsam-hooks/package.json +1 -1
- package/packages/agentsam-hooks/src/contracts.js +1 -0
- package/packages/agentsam-hooks/src/index.d.ts +1 -1
- package/packages/agentsam-hooks/test/runtime.test.mjs +13 -0
- package/packages/agentsam-ide/LICENSE +110 -0
- package/packages/agentsam-ide/README.md +146 -0
- package/packages/agentsam-key-manager/LICENSE +110 -0
- package/packages/agentsam-knowledge/package.json +1 -1
- package/packages/agentsam-loading-scene/LICENSE +110 -0
- package/packages/agentsam-loading-scene/README.md +109 -0
- package/packages/agentsam-merch/package.json +1 -1
- package/packages/agentsam-nav/LICENSE +110 -0
- package/packages/agentsam-nav/dist/AdminAppsDialog.d.ts +1 -1
- package/packages/agentsam-nav/dist/NavProvider.d.ts +2 -0
- package/packages/agentsam-nav/dist/Surfaces.d.ts +1 -0
- package/packages/agentsam-nav/dist/browser.global.js +19 -15
- package/packages/agentsam-nav/dist/browser.js +598 -190
- package/packages/agentsam-nav/dist/contracts.d.ts +22 -1
- package/packages/agentsam-nav/dist/index.d.ts +1 -1
- package/packages/agentsam-nav/dist/index.js +529 -91
- package/packages/agentsam-nav/dist/legacy.css +8 -0
- package/packages/agentsam-nav/dist/shell.css +268 -2
- package/packages/agentsam-nav/dist/theme.css +268 -2
- package/packages/agentsam-nav/dist/useAdminApps.d.ts +1 -0
- package/packages/agentsam-nav/package.json +1 -1
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/engine.cpp.o +0 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/engine.cpp.o.d +2 -0
- package/packages/agentsam-occt/.native-build/agentsam-occt +0 -0
- package/packages/agentsam-occt/dist/browser.d.ts +2 -2
- package/packages/agentsam-occt/native/engine.cpp +3 -0
- package/packages/agentsam-occt/package.json +1 -1
- package/packages/agentsam-occt/src/browser.ts +2 -2
- package/packages/agentsam-occt/test/native-engine.test.mjs +2 -2
- package/packages/agentsam-queue-control/package.json +1 -1
- package/packages/agentsam-repository/package.json +1 -1
- package/packages/agentsam-scoring/LICENSE +110 -0
- package/packages/agentsam-sections/README.md +76 -0
- package/packages/agentsam-settings/LICENSE +110 -0
- package/packages/agentsam-settings/README.md +136 -0
- package/packages/agentsam-shell-kit/LICENSE +110 -0
- package/packages/agentsam-shell-kit/README.md +5 -0
- package/packages/agentsam-vault/LICENSE +110 -0
- package/packages/agentsam-vault/README.md +16 -8
- package/packages/agentsam-vault/package.json +5 -2
- package/packages/agentsam-vault/src/crypto/oauth-envelope.js +1 -1
- package/packages/agentsam-vault/src/index.d.ts +84 -0
- package/packages/agentsam-vault/src/index.js +4 -0
- package/packages/agentsam-vault/src/providers/registry.js +8 -0
- package/packages/agentsam-vault/src/runtime/account-resolver.js +282 -0
- package/packages/agentsam-vault/src/runtime/oauth-resolver.js +163 -0
- package/packages/agentsam-vault/src/runtime/resolver.js +73 -30
- package/packages/agentsam-work/LICENSE +110 -0
- package/packages/agentsam-work/README.md +64 -0
- package/packages/agentsam-workbench/LICENSE +110 -0
- package/packages/agentsam-workbench/package.json +8 -3
- package/packages/agentsam-workbench/src/agent/AgentPanel.tsx +2 -0
- package/packages/agentsam-workbench/src/agent/ArtifactCard.tsx +61 -0
- package/packages/agentsam-workbench/src/agent/Composer.tsx +90 -26
- package/packages/agentsam-workbench/src/agent/ConnectedAgentPanel.tsx +8 -0
- package/packages/agentsam-workbench/src/agent/Thread.tsx +21 -4
- package/packages/agentsam-workbench/src/agent/ToolReceipt.tsx +48 -8
- package/packages/agentsam-workbench/src/agent/contextual-composer.css +12 -0
- package/packages/agentsam-workbench/src/agent/mini-agentsam.css +18 -2
- package/packages/agentsam-workbench/src/agent/thread.css +20 -0
- package/packages/agentsam-workbench/src/design/DesignWorkspaceFrame.tsx +16 -3
- package/packages/agentsam-workbench/src/design/design-workspace.css +52 -1
- package/packages/agentsam-workbench/src/shell/appearance.mjs +16 -5
- package/packages/agentsam-workbench/src/styles.d.ts +1 -0
- package/packages/agentsam-workbench/src/widgets/AskAgentSamWidget.tsx +29 -0
- package/packages/agentsam-workbench/src/widgets/BuiltinWidget.tsx +33 -1
- package/packages/agentsam-workbench/src/widgets/CreativeWidgets.tsx +30 -0
- package/packages/agentsam-workbench/src/widgets/MediaWidget.tsx +21 -0
- package/packages/agentsam-workbench/src/widgets/ProviderWidgets.tsx +96 -0
- package/packages/agentsam-workbench/src/widgets/QueueDepthWidget.tsx +53 -10
- package/packages/agentsam-workbench/src/widgets/ReleaseWidgets.tsx +137 -0
- package/packages/agentsam-workbench/src/widgets/ask-agentsam.ts +25 -0
- package/packages/agentsam-workbench/src/widgets/covers/brand-guidelines.svg +1 -0
- package/packages/agentsam-workbench/src/widgets/covers/brand.svg +28 -0
- package/packages/agentsam-workbench/src/widgets/covers/data.svg +24 -0
- package/packages/agentsam-workbench/src/widgets/covers/design-in-code.svg +1 -0
- package/packages/agentsam-workbench/src/widgets/covers/design-system.svg +1 -0
- package/packages/agentsam-workbench/src/widgets/covers/design.svg +1 -0
- package/packages/agentsam-workbench/src/widgets/covers/docs.svg +21 -0
- package/packages/agentsam-workbench/src/widgets/covers/sheets.svg +17 -0
- package/packages/agentsam-workbench/src/widgets/covers/slides.svg +1 -0
- package/packages/agentsam-workbench/src/widgets/covers/whiteboard.svg +1 -0
- package/packages/agentsam-workbench/src/widgets/covers/workflows.svg +36 -0
- package/packages/agentsam-workbench/src/widgets/creative-covers.ts +54 -0
- package/packages/agentsam-workbench/src/widgets/index.ts +8 -0
- package/packages/agentsam-workbench/src/widgets/register-ask-agentsam-widget.sql +5 -0
- package/packages/agentsam-workbench/src/widgets/register-creative-widgets.sql +10 -0
- package/packages/agentsam-workbench/src/widgets/register-media-widget.sql +1 -0
- package/packages/agentsam-workbench/src/widgets/register-release-widgets.sql +5 -0
- package/packages/agentsam-workbench/src/widgets/registry.ts +64 -36
- package/packages/agentsam-workbench/src/widgets/release-snapshots.ts +28 -0
- package/packages/agentsam-workbench/src/widgets/svg.d.ts +9 -0
- package/packages/agentsam-workbench/src/widgets/widgets.css +82 -0
- package/packages/agentsam-workbench/src/workflows/WorkflowStudio.tsx +366 -97
- package/packages/agentsam-workbench/src/workflows/model.ts +15 -9
- package/packages/agentsam-workbench/src/workflows/step-choices.ts +46 -0
- package/packages/agentsam-workbench/src/workflows/types.ts +34 -1
- package/packages/agentsam-workbench/src/workflows/workflow-studio.css +301 -0
- package/packages/analytics-ui/LICENSE +110 -0
- package/packages/analytics-ui/README.md +22 -0
- package/packages/catalog/generated/packages.json +47 -9
- package/packages/connectors/cfoa/OAUTH_STORAGE_AUDIT.md +11 -55
- package/packages/connectors/cfoa/package.json +5 -2
- package/packages/connectors/cfoa/src/api-client.js +18 -1
- package/packages/connectors/cfoa/src/credential.js +139 -23
- package/packages/connectors/cfoa/src/families/media.js +25 -3
- package/packages/connectors/cfoa/src/index.js +2 -2
- package/packages/connectors/cfoa/src/oauth-persist.js +177 -61
- package/packages/connectors/cfoa/src/owner.js +20 -32
- package/packages/connectors/cfoa/src/routes.js +160 -42
- package/packages/connectors/cfoa/src/scope-registry.js +15 -0
- package/packages/connectors/cfoa/test/scope-registry.test.mjs +23 -0
- package/packages/connectors/cfoa/tests/api-client-fetch.test.mjs +34 -0
- package/packages/connectors/cfoa/tests/connection-records.test.mjs +74 -0
- package/packages/connectors/cfoa/tests/connector.test.mjs +123 -1
- package/packages/connectors/cfoa/tests/cross-host-recovery.test.mjs +19 -4
- package/packages/connectors/cfoa/tests/media-discovery.test.mjs +48 -2
- package/packages/connectors/cfoa/tests/oauth-account-selection.test.mjs +51 -0
- package/packages/connectors/cfoa/tests/oauth-persist.test.mjs +131 -0
- package/packages/copro-editor/LICENSE +110 -0
- package/packages/copro-editor/README.md +16 -0
- package/packages/copro-media/LICENSE +110 -0
- package/packages/copro-media/README.md +5 -0
- package/packages/copro-project/LICENSE +110 -0
- package/packages/copro-project/README.md +13 -0
- package/packages/copro-proof/LICENSE +110 -0
- package/packages/copro-proof/README.md +9 -0
- package/packages/copro-provider-contracts/LICENSE +110 -0
- package/packages/copro-provider-contracts/README.md +23 -0
- package/packages/copro-render/LICENSE +110 -0
- package/packages/copro-render/README.md +5 -0
- package/packages/copro-storage/LICENSE +110 -0
- package/packages/copro-storage/README.md +37 -0
- package/packages/copro-templates/LICENSE +110 -0
- package/packages/copro-templates/README.md +52 -0
- package/packages/copro-timeline/LICENSE +110 -0
- package/packages/copro-timeline/README.md +5 -0
- package/packages/copro-ui/LICENSE +110 -0
- package/packages/copro-ui/README.md +7 -0
- package/packages/financial-analytics/README.md +69 -0
- package/packages/iamscene/LICENSE +110 -0
- package/packages/iamscene/README.md +375 -0
- package/packages/identity/README.md +1 -1
- package/packages/identity/migrations/D1_SCHEMA_MAPPING.md +3 -3
- package/packages/identity/package.json +5 -2
- package/packages/identity/src/adapters/account-security-store.js +119 -28
- package/packages/identity/src/adapters/iam-compat/index.js +100 -40
- package/packages/identity/src/contracts/auth-config.js +2 -0
- package/packages/identity/src/core/account-api-key.js +31 -0
- package/packages/identity/src/core/account-security.js +23 -2
- package/packages/identity/src/core/service-api-key.js +79 -0
- package/packages/identity/src/frontend/auth-portal/README.md +2 -1
- package/packages/identity/src/oauth/goaude.js +38 -32
- package/packages/identity/src/recovery/d1-password-reset.js +238 -0
- package/packages/identity/src/server/identity-service.js +14 -2
- package/packages/identity/src/server/mcp-workspace-policy.js +61 -0
- package/packages/identity/src/server/worker-router.js +113 -46
- package/packages/identity/tests/account-api-key.test.mjs +35 -0
- package/packages/identity/tests/account-security.test.mjs +108 -3
- package/packages/identity/tests/d1-password-reset.test.mjs +175 -0
- package/packages/identity/tests/google-desktop-identity-login.test.mjs +65 -35
- package/packages/identity/tests/iam-compat-hosted-migrations.test.mjs +102 -0
- package/packages/identity/tests/identity-service.test.mjs +32 -0
- package/packages/identity/tests/lane1-identity-store-parity.test.mjs +77 -10
- package/packages/identity/tests/lane1-packed-consumer.test.mjs +11 -1
- package/packages/identity/tests/oauth-presets-accounts-ssot.test.mjs +29 -0
- package/packages/identity/tests/service-api-key.test.mjs +70 -0
- package/packages/identity/tests/user-oauth-token-owner-migration.test.mjs +72 -0
- package/packages/primetech-procedures/README.md +145 -4
- package/packages/providers/completeful/src/tools.js +3 -4
- package/packages/providers/completeful/test/provider.test.mjs +24 -0
- package/packages/runtime-protocol/src/adapters/agentsamd.js +141 -0
- package/packages/runtime-protocol/src/adapters/execos-legacy.js +39 -0
- package/packages/runtime-protocol/src/adapters/provider-native.js +119 -0
- package/packages/runtime-protocol/src/client.js +299 -0
- package/packages/runtime-protocol/src/dispatch.js +81 -0
- package/packages/runtime-protocol/src/index.js +46 -14
- package/packages/runtime-protocol/src/timeouts.js +25 -0
- package/packages/theme-contract/README.md +5 -0
- package/packages/theme-plain-jane/README.md +42 -0
- package/packages/theme-scenes/package.json +1 -1
- package/packages/work-graph/package.json +1 -1
- package/protocol/capabilities/terminal-exec-input.schema.json +2 -2
- package/protocol/governance/distribution-roadmap.v1.json +2 -2
- package/protocol/models/README.md +9 -6
- package/protocol/models/discovery.mjs +39 -10
- package/protocol/models/workers-ai-curated.mjs +6 -0
- package/protocol/notifications/README.md +3 -3
- package/protocol/plugins/agentsam.plugin-package.v1.schema.json +24 -0
- package/protocol/registry/universal-catalog.v1.json +640 -368
- package/protocol/runtime/agentsam.runtime.v1.schema.json +1 -0
- package/protocol/sam/run-receipt.v1.schema.json +2 -91
- package/protocol/sam/run.v1.schema.json +3 -85
- package/python/README.md +46 -16
- package/python/agentsam_sdk/cli.py +1 -1
- package/python/agentsam_sdk/client.py +120 -19
- package/python/agentsam_sdk/mcp/__init__.py +8 -0
- package/python/agentsam_sdk/mcp/__main__.py +68 -0
- package/python/agentsam_sdk/mcp/server.py +129 -0
- package/python/agentsam_sdk/media/opencv.py +73 -7
- package/python/agentsam_sdk/registry_cli.py +2 -2
- package/python/agentsam_sdk/runtime/native.py +2 -2
- package/python/docs/gaps.md +24 -4
- package/python/docs/tooling.md +4 -4
- package/python/pyproject.toml +2 -1
- package/python/requirements-tui.txt +1 -1
- package/python/scripts/check-dist.py +2 -2
- package/python/tests/test_bridge_policy.py +3 -1
- package/python/tests/test_cli_distribution.py +3 -0
- package/python/tests/test_mcp_server.py +108 -0
- package/python/tests/test_opencv_media.py +12 -4
- package/python/tests/test_packaging.py +5 -0
- package/python/tests/test_public_client.py +84 -2
- package/skills/README.md +11 -1
- package/skills/catalog.json +152 -1
- package/src/acp/agent-executor.js +14 -2
- package/src/acp/client.js +66 -317
- package/src/acp/database-client.js +348 -0
- package/src/acp/dependencies.js +753 -264
- package/src/acp/http.js +33 -0
- package/src/acp/index.js +9 -0
- package/src/acp/queue-executor.js +79 -0
- package/src/acp/runs.js +6 -2
- package/src/acp/runtime-candidates.js +191 -0
- package/src/acp/runtime-registry.js +34 -0
- package/src/acp/runtime-selection.js +35 -9
- package/src/capabilities/terminal-exec.js +3 -2
- package/src/capabilities/test-run.js +2 -1
- package/src/cli/command-catalog.js +37 -13
- package/src/cli/desktop-launch.js +66 -17
- package/src/cli/dispatch.js +1 -0
- package/src/cli.js +39 -6
- package/src/commands/account-auth.js +8 -5
- package/src/commands/account-model-inventory.js +84 -0
- package/src/commands/api-key.js +172 -120
- package/src/commands/app.js +27 -22
- package/src/commands/cheat-sheet.js +12 -7
- package/src/commands/cloudflare-login.js +94 -46
- package/src/commands/cloudflare.js +28 -18
- package/src/commands/codebaseindex.js +179 -74
- package/src/commands/compute.js +485 -2
- package/src/commands/db.js +471 -41
- package/src/commands/design.js +64 -0
- package/src/commands/document.js +22 -0
- package/src/commands/env.js +16 -6
- package/src/commands/gcloud-auth.js +23 -12
- package/src/commands/google-cloud.js +5 -9
- package/src/commands/mcp.js +86 -3
- package/src/commands/models.js +49 -5
- package/src/commands/plugins.js +18 -8
- package/src/commands/providers.js +6 -5
- package/src/commands/python.js +167 -0
- package/src/commands/rc.js +175 -0
- package/src/commands/remote.js +369 -0
- package/src/commands/run.js +38 -16
- package/src/commands/runtime-connect.js +156 -0
- package/src/commands/runtime-status.js +25 -2
- package/src/commands/runtime.js +95 -51
- package/src/commands/setup.js +269 -86
- package/src/commands/shell.js +235 -36
- package/src/commands/skill.js +22 -22
- package/src/commands/terminal.js +30 -144
- package/src/commands/tunnel.js +81 -17
- package/src/commands/update.js +5 -5
- package/src/commands/whoami.js +9 -4
- package/src/commands/workflows.js +213 -0
- package/src/index.js +3 -1
- package/src/knowledge/config.js +4 -1
- package/src/knowledge/store-discovery.js +92 -10
- package/src/knowledge/stores/d1.js +138 -73
- package/src/lib/account-session.js +2 -0
- package/src/lib/auth.js +93 -1
- package/src/lib/cad/production-operations.d.ts +1 -1
- package/src/lib/cad/production-operations.js +21 -21
- package/src/lib/cad/project-runtime.js +8 -2
- package/src/lib/core-client.js +1 -0
- package/src/lib/design-client.js +68 -0
- package/src/lib/google-desktop-oauth.js +5 -2
- package/src/lib/local-scaffold.js +3 -4
- package/src/lib/local-status.js +2 -1
- package/src/lib/machine-connection.js +120 -0
- package/src/lib/machine-connection.test.js +74 -0
- package/src/lib/provider-credentials.js +64 -18
- package/src/lib/scaffold/mcp-project.js +97 -0
- package/src/lib/scaffold/mcp-server.js +17 -3
- package/src/lib/scaffold/templates/mcp-server/index.js +409 -304
- package/src/lib/scaffold/templates/mcp-server/presets.js +8 -10
- package/src/lib/scaffold/templates/mcp-server/runtime-adapters.js +165 -0
- package/src/lib/scaffold/wizards/mcp-server.js +48 -4
- package/src/lib/setup/runtime-persist.js +12 -8
- package/src/lib/setup/runtime.js +84 -156
- package/src/lib/slash-commands.js +72 -17
- package/src/lib/studio-client.js +81 -0
- package/src/lib/terminal-scopes.js +9 -6
- package/src/local-fs/index.js +29 -2
- package/src/mcp/client.js +18 -10
- package/src/mcp/server/account-workspace-policy.js +2 -0
- package/src/mcp/server/index.js +70 -0
- package/src/mcp/server/oauth.js +134 -0
- package/src/mcp/server/studio-host.js +96 -0
- package/src/mcp/server/tools/index.js +81 -0
- package/src/mcp/server/workspace.js +142 -0
- package/src/models/catalog.js +2 -0
- package/src/models/index.js +2 -0
- package/src/models/inventory-core.d.ts +10 -0
- package/src/models/inventory-core.js +2 -2
- package/src/models/media-runtime.d.ts +53 -0
- package/src/models/media-runtime.js +221 -0
- package/src/plugins/cloudflare.js +62 -12
- package/src/plugins/contracts.js +58 -3
- package/src/plugins/index.js +4 -1
- package/src/plugins/primetech-hosted.js +13 -0
- package/src/plugins/registry.js +79 -25
- package/src/plugins/runtime.js +6 -2
- package/src/providers/anthropic-messages.js +7 -3
- package/src/providers/cloudflare-chat.js +5 -2
- package/src/providers/gemini-generate-content.js +8 -20
- package/src/providers/index.js +13 -0
- package/src/providers/multimodal-input.js +181 -0
- package/src/providers/ollama-chat.js +5 -2
- package/src/providers/openai-media.d.ts +18 -0
- package/src/providers/openai-media.js +81 -0
- package/src/providers/openai-responses.js +7 -2
- package/src/registry/generated/inventory.json +146 -33
- package/src/registry/universal-source.js +43 -14
- package/src/sam/adapters/audio-transcription.js +122 -0
- package/src/sam/adapters/cloudflare-r2-inventory.js +34 -0
- package/src/sam/adapters/local-script-runtime.js +3 -2
- package/src/sam/adapters/opencv-video.js +103 -16
- package/src/sam/adapters/pdf-document.js +210 -0
- package/src/sam/adapters/tesseract-ocr.js +276 -0
- package/src/sam/bridge/stdio.mjs +57 -2
- package/src/sam/client.js +48 -84
- package/src/sam/index.js +2 -0
- package/src/sam/model-adapter.js +15 -2
- package/src/sam/operation-packs/generated-v2/background.d.ts +21 -0
- package/src/sam/operation-packs/generated-v2/background.js +6 -0
- package/src/sam/operation-packs/generated-v2/catalog.js +98 -3
- package/src/sam/operation-packs/generated-v2/generated-tool-descriptors.json +98 -3
- package/src/sam/operation-packs/generated-v2/operation-pack.js +2 -2
- package/src/sam/operation-packs/generated-v2/raster.js +54 -13
- package/src/sam/operation-packs/generated-v2/test/background.test.mjs +5 -0
- package/src/sam/operation-packs/generated-v2/test/raster.test.mjs +19 -5
- package/src/sam/operation-packs/generated-v2/test/superbash-client-integration.test.mjs +8 -1
- package/src/sam/operation-packs/generated-v2/tool-types.d.ts +1 -1
- package/src/sam/operations/cad-bim-ifc.js +1 -1
- package/src/sam/operations/cad-blender-inspect.js +1 -1
- package/src/sam/os.js +269 -11
- package/src/sam/packs/cad/index.js +18 -12
- package/src/sam/packs/primetech-creative.js +250 -0
- package/src/sam/shell-host.js +121 -16
- package/src/sam/validation.js +3 -0
- package/src/skills/catalog.js +32 -9
- package/src/skills/index.js +3 -1
- package/src/skills/local-store.js +84 -0
- package/src/skills/package-source.js +9 -0
- package/src/skills/registry.js +13 -7
- package/src/tunnel/providers.js +133 -0
- package/src/tunnel/session.js +100 -0
- package/src/ui/boot.js +7 -2
- package/src/ui/brand/primetech-mark.generated.js +49 -0
- package/src/ui/cli/brand-profile.js +42 -0
- package/src/ui/cli/prompt-box.js +73 -25
- package/src/ui/home-screen.js +46 -13
- package/src/ui/theme.js +1 -1
- package/docs/acceptance/AGENTSAM_DOCS_CMS_2026-11-10.md +0 -62
- package/docs/agent-briefs/2026-10-28-agent1-ui-product-foundation.md +0 -132
- package/docs/agent-briefs/2026-10-28-agent2-cms-audit.md +0 -144
- package/docs/agent-briefs/2026-10-28-sites-next-wave-acceptance.md +0 -67
- package/packages/primetech-procedures/agentsam.package.json +0 -63
- package/packages/primetech-procedures/package.json +0 -33
- package/packages/primetech-procedures/procedures/arch.assembly.calculate/procedure.json +0 -83
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/README.md +0 -21
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/__pycache__/test_generate_toolpaths.cpython-314.pyc +0 -0
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/build_freecad.py +0 -514
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/finalize_bundle.py +0 -26
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/generate_assets.py +0 -284
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/generate_toolpaths.py +0 -715
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/package_artifacts.py +0 -154
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/parameters.json +0 -51
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/procedure.json +0 -101
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/render_preview.py +0 -98
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/run.py +0 -214
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/test_generate_toolpaths.py +0 -50
- package/packages/primetech-procedures/procedures/media.asset.preflight/procedure.json +0 -85
- package/packages/primetech-procedures/procedures/media.image.optimize-asset/procedure.json +0 -102
- package/packages/primetech-procedures/procedures/repo.asset.inventory/__pycache__/run.cpython-312.pyc +0 -0
- package/packages/primetech-procedures/procedures/repo.asset.inventory/__pycache__/run.cpython-314.pyc +0 -0
- package/packages/primetech-procedures/procedures/repo.asset.inventory/procedure.json +0 -65
- package/packages/primetech-procedures/procedures/repo.asset.inventory/run.py +0 -116
- package/packages/primetech-procedures/procedures/repo.asset.inventory/run.sh +0 -11
- package/packages/primetech-procedures/procedures/repo.git.status/procedure.json +0 -58
- package/packages/primetech-procedures/procedures/repo.git.status/run.sh +0 -10
- package/packages/primetech-procedures/profiles/PRIMETECH_PROCEDURE_ENGINEER.md +0 -25
- package/packages/primetech-procedures/src/index.js +0 -646
- package/packages/primetech-procedures/test/__pycache__/test_inventory.cpython-312.pyc +0 -0
- package/packages/primetech-procedures/test/__pycache__/test_inventory.cpython-314.pyc +0 -0
- package/packages/primetech-procedures/test/procedure.test.mjs +0 -207
- package/packages/primetech-procedures/test/runtime-kinds.test.mjs +0 -210
- package/packages/primetech-procedures/test/test_inventory.py +0 -57
- package/src/commands/start-local.js +0 -98
- package/src/local-fs/capability.js +0 -126
- package/src/local-lsp/host.js +0 -2
- package/src/local-pty/server.js +0 -521
package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/generate_toolpaths.py
DELETED
|
@@ -1,715 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""Generate deterministic cutter-center paths, review-only generic G-code, and evidence."""
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import argparse
|
|
6
|
-
import hashlib
|
|
7
|
-
import html
|
|
8
|
-
import json
|
|
9
|
-
import math
|
|
10
|
-
import re
|
|
11
|
-
from pathlib import Path
|
|
12
|
-
|
|
13
|
-
SCHEMA = "inneranimalmedia.cam.toolpath.v1"
|
|
14
|
-
DIALECT = "generic_fanuc_style"
|
|
15
|
-
TOP_Z = -0.5
|
|
16
|
-
CLEARANCE_Z = 2.0
|
|
17
|
-
SAFE_Z = 5.0
|
|
18
|
-
BREAKTHROUGH_Z = -13.0
|
|
19
|
-
RAPID_MM_MIN = 3000.0
|
|
20
|
-
|
|
21
|
-
def sha256(path: Path) -> str:
|
|
22
|
-
digest = hashlib.sha256()
|
|
23
|
-
with path.open("rb") as stream:
|
|
24
|
-
for chunk in iter(lambda: stream.read(1024 * 1024), b""):
|
|
25
|
-
digest.update(chunk)
|
|
26
|
-
return digest.hexdigest()
|
|
27
|
-
|
|
28
|
-
def rounded_rect_points(half_l: float, half_w: float, radius: float, segments: int = 12):
|
|
29
|
-
"""Closed rounded-rectangle centerline, counter-clockwise."""
|
|
30
|
-
cx = half_l - radius
|
|
31
|
-
cy = half_w - radius
|
|
32
|
-
pts = [(-cx, -half_w), (cx, -half_w)]
|
|
33
|
-
corners = [
|
|
34
|
-
(cx, -cy, -90.0, 0.0),
|
|
35
|
-
(cx, cy, 0.0, 90.0),
|
|
36
|
-
(-cx, cy, 90.0, 180.0),
|
|
37
|
-
(-cx, -cy, 180.0, 270.0),
|
|
38
|
-
]
|
|
39
|
-
for index, (x, y, a0, a1) in enumerate(corners):
|
|
40
|
-
for step in range(1, segments + 1):
|
|
41
|
-
a = math.radians(a0 + (a1 - a0) * step / segments)
|
|
42
|
-
pts.append((x + radius * math.cos(a), y + radius * math.sin(a)))
|
|
43
|
-
if index == 0:
|
|
44
|
-
pts.append((half_l, cy))
|
|
45
|
-
pts.append((half_l, cy))
|
|
46
|
-
elif index == 1:
|
|
47
|
-
pts.append((-cx, half_w))
|
|
48
|
-
elif index == 2:
|
|
49
|
-
pts.append((-half_l, -cy))
|
|
50
|
-
# Remove consecutive duplicates, then close exactly.
|
|
51
|
-
cleaned = []
|
|
52
|
-
for pt in pts:
|
|
53
|
-
if not cleaned or math.dist(cleaned[-1], pt) > 1e-7:
|
|
54
|
-
cleaned.append(pt)
|
|
55
|
-
if math.dist(cleaned[0], cleaned[-1]) > 1e-7:
|
|
56
|
-
cleaned.append(cleaned[0])
|
|
57
|
-
return cleaned
|
|
58
|
-
|
|
59
|
-
def pocket_transform(x: float, y: float, p: dict):
|
|
60
|
-
theta = math.radians(p["pocket_angle_deg"] + 90.0)
|
|
61
|
-
center = p["pocket_center_radius_mm"] / math.sqrt(2.0)
|
|
62
|
-
return (
|
|
63
|
-
center + x * math.cos(theta) - y * math.sin(theta),
|
|
64
|
-
center + x * math.sin(theta) + y * math.cos(theta),
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
def fmt(v: float) -> str:
|
|
68
|
-
if abs(v) < 0.0005:
|
|
69
|
-
v = 0.0
|
|
70
|
-
return f"{v:.3f}"
|
|
71
|
-
|
|
72
|
-
class Program:
|
|
73
|
-
def __init__(self):
|
|
74
|
-
self.lines = [
|
|
75
|
-
"%",
|
|
76
|
-
"(CAM MODEL 01 - MOTOR / BEARING END PLATE)",
|
|
77
|
-
"(CANDIDATE B - 150 MM OD; NOT APPROVED FOR MANUFACTURE)",
|
|
78
|
-
"(GENERIC FANUC-STYLE OUTPUT - UNVERIFIED FOR ANY MACHINE)",
|
|
79
|
-
"(PRECONDITION: TOP FACE ESTABLISHED AT Z-0.500; G54 Z0 IS RAW STOCK TOP)",
|
|
80
|
-
"(DEMO OPERATIONS ONLY: POCKET, CLEARANCE DRILLING, PILOT, BORE, COUNTERBORE)",
|
|
81
|
-
"(FACE, OUTSIDE PROFILE, CHAMFER, FIXTURE AND SECOND SETUP ARE NOT INCLUDED)",
|
|
82
|
-
"G21 G17 G90 G94",
|
|
83
|
-
"G54",
|
|
84
|
-
"G40 G49 G80",
|
|
85
|
-
]
|
|
86
|
-
self.moves = []
|
|
87
|
-
self.current = {"x": 0.0, "y": 0.0, "z": SAFE_Z}
|
|
88
|
-
self.tool = None
|
|
89
|
-
self.operation = "setup"
|
|
90
|
-
self.tool_changes = 0
|
|
91
|
-
|
|
92
|
-
def comment(self, value: str):
|
|
93
|
-
self.lines.append(f"({value})")
|
|
94
|
-
|
|
95
|
-
def _record(self, kind, start, end, op, feed=None, center=None, direction=None, code=None):
|
|
96
|
-
dx = end["x"] - start["x"]
|
|
97
|
-
dy = end["y"] - start["y"]
|
|
98
|
-
dz = end["z"] - start["z"]
|
|
99
|
-
if kind in ("arc_ccw", "arc_cw") and center:
|
|
100
|
-
radius = math.hypot(start["x"] - center["x"], start["y"] - center["y"])
|
|
101
|
-
a0 = math.atan2(start["y"] - center["y"], start["x"] - center["x"])
|
|
102
|
-
a1 = math.atan2(end["y"] - center["y"], end["x"] - center["x"])
|
|
103
|
-
delta = (a1 - a0) % (2 * math.pi) if kind == "arc_ccw" else (a0 - a1) % (2 * math.pi)
|
|
104
|
-
if delta < 1e-8 and math.hypot(dx, dy) < 1e-8:
|
|
105
|
-
delta = 2 * math.pi
|
|
106
|
-
xy_length = radius * delta
|
|
107
|
-
length = math.hypot(xy_length, dz)
|
|
108
|
-
else:
|
|
109
|
-
length = math.sqrt(dx * dx + dy * dy + dz * dz)
|
|
110
|
-
if length < 1e-8:
|
|
111
|
-
return
|
|
112
|
-
row = {
|
|
113
|
-
"index": len(self.moves) + 1,
|
|
114
|
-
"operation_id": op,
|
|
115
|
-
"motion": kind,
|
|
116
|
-
"start_mm": {k: round(v, 5) for k, v in start.items()},
|
|
117
|
-
"end_mm": {k: round(v, 5) for k, v in end.items()},
|
|
118
|
-
"length_mm": round(length, 5),
|
|
119
|
-
"gcode": code,
|
|
120
|
-
}
|
|
121
|
-
if feed is not None:
|
|
122
|
-
row["feed_mm_min"] = feed
|
|
123
|
-
if center:
|
|
124
|
-
row["center_mm"] = {"x": round(center["x"], 5), "y": round(center["y"], 5)}
|
|
125
|
-
if direction:
|
|
126
|
-
row["direction"] = direction
|
|
127
|
-
self.moves.append(row)
|
|
128
|
-
|
|
129
|
-
def rapid(self, op, x=None, y=None, z=None):
|
|
130
|
-
start = dict(self.current)
|
|
131
|
-
end = dict(self.current)
|
|
132
|
-
axes = []
|
|
133
|
-
for key, value in (("x", x), ("y", y), ("z", z)):
|
|
134
|
-
if value is not None:
|
|
135
|
-
end[key] = float(value)
|
|
136
|
-
axes.append(f"{key.upper()}{fmt(float(value))}")
|
|
137
|
-
if not axes:
|
|
138
|
-
return
|
|
139
|
-
code = "G0 " + " ".join(axes)
|
|
140
|
-
self.lines.append(code)
|
|
141
|
-
self._record("rapid", start, end, op, code=code)
|
|
142
|
-
self.current = end
|
|
143
|
-
|
|
144
|
-
def feed(self, op, feed, x=None, y=None, z=None):
|
|
145
|
-
start = dict(self.current)
|
|
146
|
-
end = dict(self.current)
|
|
147
|
-
axes = []
|
|
148
|
-
for key, value in (("x", x), ("y", y), ("z", z)):
|
|
149
|
-
if value is not None:
|
|
150
|
-
end[key] = float(value)
|
|
151
|
-
axes.append(f"{key.upper()}{fmt(float(value))}")
|
|
152
|
-
if not axes:
|
|
153
|
-
return
|
|
154
|
-
axes.append(f"F{float(feed):.1f}")
|
|
155
|
-
code = "G1 " + " ".join(axes)
|
|
156
|
-
self.lines.append(code)
|
|
157
|
-
self._record("feed", start, end, op, float(feed), code=code)
|
|
158
|
-
self.current = end
|
|
159
|
-
|
|
160
|
-
def arc(self, op, direction, feed, x, y, z, i, j):
|
|
161
|
-
start = dict(self.current)
|
|
162
|
-
end = {"x": float(x), "y": float(y), "z": float(z)}
|
|
163
|
-
center = {"x": start["x"] + float(i), "y": start["y"] + float(j)}
|
|
164
|
-
cmd = "G3" if direction == "ccw" else "G2"
|
|
165
|
-
code = (
|
|
166
|
-
f"{cmd} X{fmt(end['x'])} Y{fmt(end['y'])} Z{fmt(end['z'])} "
|
|
167
|
-
f"I{fmt(float(i))} J{fmt(float(j))} F{float(feed):.1f}"
|
|
168
|
-
)
|
|
169
|
-
self.lines.append(code)
|
|
170
|
-
kind = "arc_ccw" if direction == "ccw" else "arc_cw"
|
|
171
|
-
self._record(kind, start, end, op, float(feed), center, direction, code)
|
|
172
|
-
self.current = end
|
|
173
|
-
|
|
174
|
-
def tool_change(self, number, rpm, label):
|
|
175
|
-
if self.current["z"] < SAFE_Z:
|
|
176
|
-
self.rapid(self.operation, z=SAFE_Z)
|
|
177
|
-
if self.tool is not None:
|
|
178
|
-
self.lines.append("M5")
|
|
179
|
-
self.lines.append(f"(T{number} - {label})")
|
|
180
|
-
self.lines.append(f"T{number} M6")
|
|
181
|
-
self.lines.append(f"S{int(rpm)} M3")
|
|
182
|
-
self.tool = number
|
|
183
|
-
self.tool_changes += 1
|
|
184
|
-
|
|
185
|
-
def pocket_x_limit(y: float, half_l: float, half_w: float, radius: float, offset: float):
|
|
186
|
-
side_x = half_l - offset
|
|
187
|
-
corner_x = half_l - radius
|
|
188
|
-
corner_y = half_w - radius
|
|
189
|
-
effective_r = radius - offset
|
|
190
|
-
ay = abs(y)
|
|
191
|
-
if ay <= corner_y:
|
|
192
|
-
return side_x
|
|
193
|
-
if ay > corner_y + effective_r + 1e-7:
|
|
194
|
-
return None
|
|
195
|
-
return corner_x + math.sqrt(max(0.0, effective_r * effective_r - (ay - corner_y) ** 2))
|
|
196
|
-
|
|
197
|
-
def generate_paths(params: dict, out: Path):
|
|
198
|
-
p = params["candidate"]
|
|
199
|
-
prog = Program()
|
|
200
|
-
tool_definitions = [
|
|
201
|
-
{"number": 1, "diameter_mm": 6.0, "flutes": 3, "type": "carbide flat end mill", "stickout_mm": 18, "rpm": 10000, "feed_mm_min": 400, "ramp_feed_mm_min": 150, "status": "starting value; verify vendor data and machine rigidity"},
|
|
202
|
-
{"number": 2, "diameter_mm": 6.6, "flutes": 2, "type": "drill", "stickout_mm": 28, "rpm": 4000, "feed_mm_min": 160, "peck_depth_mm": 2.0, "status": "starting value; verify vendor data and machine rigidity"},
|
|
203
|
-
{"number": 3, "diameter_mm": 12.0, "flutes": 2, "type": "drill", "stickout_mm": 30, "rpm": 2500, "feed_mm_min": 100, "peck_depth_mm": 2.0, "status": "starting value; verify vendor data and machine rigidity"},
|
|
204
|
-
{"number": 4, "diameter_mm": 10.0, "flutes": 2, "type": "90-degree chamfer mill", "stickout_mm": 25, "rpm": 6000, "feed_mm_min": 120, "status": "starting value; tool geometry and chamfer compensation unverified"},
|
|
205
|
-
{"number": 5, "diameter_mm": 10.0, "flutes": 3, "type": "carbide flat end mill for facing and outside profile", "stickout_mm": 25, "rpm": 8000, "feed_mm_min": 350, "stepover_mm": 6.0, "status": "starting value; verify vendor data and workholding"},
|
|
206
|
-
]
|
|
207
|
-
op_meta = []
|
|
208
|
-
def begin(op, description):
|
|
209
|
-
prog.operation = op
|
|
210
|
-
prog.comment("OPERATION " + op + " - " + description)
|
|
211
|
-
|
|
212
|
-
# Operation 1/2: rough pocket raster with 0.3 mm radial stock left for a wall finish.
|
|
213
|
-
begin("pocket-rough", "rounded pocket roughing; 0.3 mm wall stock left")
|
|
214
|
-
prog.tool_change(1, 10000, "6 mm 3-flute carbide end mill")
|
|
215
|
-
tool_r = 3.0
|
|
216
|
-
offset = tool_r + 0.3
|
|
217
|
-
half_l = p["pocket_length_mm"] / 2.0
|
|
218
|
-
half_w = p["pocket_width_mm"] / 2.0
|
|
219
|
-
radius = p["pocket_corner_radius_mm"]
|
|
220
|
-
effective_half_w = half_w - offset
|
|
221
|
-
stepover = 2.4
|
|
222
|
-
lane_count = math.ceil((2 * effective_half_w) / stepover)
|
|
223
|
-
lane_step = (2 * effective_half_w) / lane_count
|
|
224
|
-
lane_ys = [-effective_half_w + i * lane_step for i in range(lane_count + 1)]
|
|
225
|
-
pocket_center = pocket_transform(0, 0, p)
|
|
226
|
-
pocket_depths = [-1.5, -2.5, -3.5, -4.5]
|
|
227
|
-
for depth in pocket_depths:
|
|
228
|
-
for y_local in lane_ys:
|
|
229
|
-
xlim = pocket_x_limit(y_local, half_l, half_w, radius, offset)
|
|
230
|
-
if xlim is None:
|
|
231
|
-
continue
|
|
232
|
-
sx, sy = pocket_transform(-15.0, y_local, p)
|
|
233
|
-
ex, ey = pocket_transform(15.0, y_local, p)
|
|
234
|
-
rx, ry = pocket_transform(xlim, y_local, p)
|
|
235
|
-
lx, ly = pocket_transform(-xlim, y_local, p)
|
|
236
|
-
prog.rapid("pocket-rough", z=SAFE_Z)
|
|
237
|
-
prog.rapid("pocket-rough", x=sx, y=sy, z=CLEARANCE_Z)
|
|
238
|
-
prog.feed("pocket-rough", 120, z=TOP_Z)
|
|
239
|
-
prog.feed("pocket-rough", 150, x=ex, y=ey, z=depth)
|
|
240
|
-
prog.feed("pocket-rough", 400, x=rx, y=ry, z=depth)
|
|
241
|
-
prog.feed("pocket-rough", 400, x=lx, y=ly, z=depth)
|
|
242
|
-
prog.rapid("pocket-rough", z=CLEARANCE_Z)
|
|
243
|
-
op_meta.append({
|
|
244
|
-
"id": "pocket-rough", "status": "generated", "tool": 1, "strategy": "linear ramp-in plus serpentine raster",
|
|
245
|
-
"depths_z_mm": pocket_depths, "stepdown_mm": 1.0, "stepover_mm": round(lane_step, 4),
|
|
246
|
-
"stock_to_leave_radial_mm": 0.3, "corner_radius_mm": radius,
|
|
247
|
-
"tool_radius_mm": tool_r, "corner_access_check": radius >= tool_r,
|
|
248
|
-
})
|
|
249
|
-
|
|
250
|
-
begin("pocket-finish", "rounded pocket wall finish at final depth")
|
|
251
|
-
prog.rapid("pocket-finish", z=SAFE_Z)
|
|
252
|
-
prog.rapid("pocket-finish", x=pocket_center[0], y=pocket_center[1], z=CLEARANCE_Z)
|
|
253
|
-
prog.feed("pocket-finish", 100, z=TOP_Z)
|
|
254
|
-
prog.feed("pocket-finish", 100, z=-p["pocket_depth_mm"] - 0.5)
|
|
255
|
-
finish_pts = rounded_rect_points(half_l - tool_r, half_w - tool_r, radius - tool_r, 16)
|
|
256
|
-
world_pts = [pocket_transform(x, y, p) for x, y in finish_pts]
|
|
257
|
-
for x, y in world_pts:
|
|
258
|
-
prog.feed("pocket-finish", 250, x=x, y=y)
|
|
259
|
-
prog.rapid("pocket-finish", z=SAFE_Z)
|
|
260
|
-
op_meta.append({
|
|
261
|
-
"id": "pocket-finish", "status": "generated", "tool": 1, "strategy": "closed rounded-rectangle contour",
|
|
262
|
-
"final_depth_z_mm": -p["pocket_depth_mm"] - 0.5, "stock_to_leave_radial_mm": 0.0,
|
|
263
|
-
"centerline_corner_radius_mm": radius - tool_r,
|
|
264
|
-
})
|
|
265
|
-
|
|
266
|
-
# Operation 3: explicit peck-drill moves for the four clearance holes.
|
|
267
|
-
def peck_drill(op, tool, rpm, feed, points, label):
|
|
268
|
-
begin(op, label)
|
|
269
|
-
prog.tool_change(tool, rpm, f"T{tool} drill")
|
|
270
|
-
peck_depth = 2.0
|
|
271
|
-
pecks = [-2.0, -4.0, -6.0, -8.0, -10.0, -12.0, BREAKTHROUGH_Z]
|
|
272
|
-
for x, y in points:
|
|
273
|
-
prog.rapid(op, z=SAFE_Z)
|
|
274
|
-
prog.rapid(op, x=x, y=y, z=CLEARANCE_Z)
|
|
275
|
-
prog.feed(op, 100, z=0.0)
|
|
276
|
-
previous = 0.0
|
|
277
|
-
for index, depth in enumerate(pecks):
|
|
278
|
-
if index:
|
|
279
|
-
prog.rapid(op, z=CLEARANCE_Z)
|
|
280
|
-
prog.rapid(op, z=previous + 0.5)
|
|
281
|
-
prog.feed(op, feed, z=depth)
|
|
282
|
-
previous = depth
|
|
283
|
-
prog.rapid(op, z=SAFE_Z)
|
|
284
|
-
return pecks
|
|
285
|
-
bolt_radius = p["bolt_circle_diameter_mm"] / 2.0
|
|
286
|
-
hole_points = [
|
|
287
|
-
(bolt_radius * math.cos(math.radians(a)), bolt_radius * math.sin(math.radians(a)))
|
|
288
|
-
for a in p["bolt_hole_angles_deg"]
|
|
289
|
-
]
|
|
290
|
-
hole_pecks = peck_drill("clearance-drill", 2, 4000, 160, hole_points, "four 6.6 mm clearance holes; explicit peck moves")
|
|
291
|
-
op_meta.append({
|
|
292
|
-
"id": "clearance-drill", "status": "generated", "tool": 2, "strategy": "explicit peck drilling",
|
|
293
|
-
"hole_count": len(hole_points), "diameter_mm": p["hole_diameter_mm"],
|
|
294
|
-
"bolt_circle_diameter_mm": p["bolt_circle_diameter_mm"], "peck_depth_mm": 2.0,
|
|
295
|
-
"final_z_mm": BREAKTHROUGH_Z,
|
|
296
|
-
})
|
|
297
|
-
|
|
298
|
-
pilot_pecks = peck_drill("bore-pilot", 3, 2500, 100, [(0.0, 0.0)], "12 mm center pilot hole for circular interpolation")
|
|
299
|
-
op_meta.append({
|
|
300
|
-
"id": "bore-pilot", "status": "generated", "tool": 3, "strategy": "explicit peck drilling",
|
|
301
|
-
"diameter_mm": 12.0, "peck_depth_mm": 2.0, "final_z_mm": BREAKTHROUGH_Z,
|
|
302
|
-
})
|
|
303
|
-
|
|
304
|
-
# Operation 4: helical entry and concentric passes for the 40 mm through bore.
|
|
305
|
-
begin("bore-interpolate", "40 mm nominal through bore; H7 still requires qualified finishing and inspection")
|
|
306
|
-
prog.tool_change(1, 10000, "6 mm 3-flute carbide end mill (reloaded)")
|
|
307
|
-
bore_depths = []
|
|
308
|
-
z = -1.5
|
|
309
|
-
while z > BREAKTHROUGH_Z + 1e-8:
|
|
310
|
-
bore_depths.append(round(z, 3))
|
|
311
|
-
z -= 1.0
|
|
312
|
-
if not bore_depths or abs(bore_depths[-1] - BREAKTHROUGH_Z) > 1e-8:
|
|
313
|
-
bore_depths.append(BREAKTHROUGH_Z)
|
|
314
|
-
bore_radii = [8.0, 10.0, 12.0, 14.0, 16.0, 17.0]
|
|
315
|
-
previous_z = TOP_Z
|
|
316
|
-
for depth in bore_depths:
|
|
317
|
-
prog.rapid("bore-interpolate", z=SAFE_Z)
|
|
318
|
-
prog.rapid("bore-interpolate", x=8.0, y=0.0, z=CLEARANCE_Z)
|
|
319
|
-
prog.feed("bore-interpolate", 120, z=previous_z)
|
|
320
|
-
mid = (previous_z + depth) / 2.0
|
|
321
|
-
prog.arc("bore-interpolate", "ccw", 120, -8.0, 0.0, mid, -8.0, 0.0)
|
|
322
|
-
prog.arc("bore-interpolate", "ccw", 120, 8.0, 0.0, depth, 8.0, 0.0)
|
|
323
|
-
for r in bore_radii[1:]:
|
|
324
|
-
prog.feed("bore-interpolate", 180, x=r, y=0.0)
|
|
325
|
-
prog.arc("bore-interpolate", "ccw", 180, -r, 0.0, depth, -r, 0.0)
|
|
326
|
-
prog.arc("bore-interpolate", "ccw", 180, r, 0.0, depth, r, 0.0)
|
|
327
|
-
previous_z = depth
|
|
328
|
-
prog.rapid("bore-interpolate", z=SAFE_Z)
|
|
329
|
-
op_meta.append({
|
|
330
|
-
"id": "bore-interpolate", "status": "generated", "tool": 1, "strategy": "helical entry plus concentric interpolation passes",
|
|
331
|
-
"nominal_diameter_mm": p["bore_diameter_mm"], "centerline_radii_mm": bore_radii,
|
|
332
|
-
"stepdown_mm": 1.0, "final_z_mm": BREAKTHROUGH_Z,
|
|
333
|
-
"tolerance_status": "nominal path only; H7 is not certified by this toolpath",
|
|
334
|
-
})
|
|
335
|
-
|
|
336
|
-
# Operation 5: counterbore annulus uses the through-bore wall as its inner boundary.
|
|
337
|
-
begin("counterbore-interpolate", "52 mm counterbore; 4 mm below finished top face")
|
|
338
|
-
prog.rapid("counterbore-interpolate", z=SAFE_Z)
|
|
339
|
-
prog.rapid("counterbore-interpolate", x=23.0, y=0.0, z=CLEARANCE_Z)
|
|
340
|
-
prog.feed("counterbore-interpolate", 100, z=TOP_Z)
|
|
341
|
-
previous_z = TOP_Z
|
|
342
|
-
final_cb_z = TOP_Z - p["counterbore_depth_mm"]
|
|
343
|
-
while previous_z > final_cb_z + 1e-8:
|
|
344
|
-
next_z = max(final_cb_z, previous_z - 0.5)
|
|
345
|
-
mid = (previous_z + next_z) / 2.0
|
|
346
|
-
prog.arc("counterbore-interpolate", "ccw", 120, -23.0, 0.0, mid, -23.0, 0.0)
|
|
347
|
-
prog.arc("counterbore-interpolate", "ccw", 120, 23.0, 0.0, next_z, 23.0, 0.0)
|
|
348
|
-
previous_z = next_z
|
|
349
|
-
# Finish circle at the final counterbore depth.
|
|
350
|
-
prog.arc("counterbore-interpolate", "ccw", 100, -23.0, 0.0, final_cb_z, -23.0, 0.0)
|
|
351
|
-
prog.arc("counterbore-interpolate", "ccw", 100, 23.0, 0.0, final_cb_z, 23.0, 0.0)
|
|
352
|
-
prog.rapid("counterbore-interpolate", z=SAFE_Z)
|
|
353
|
-
op_meta.append({
|
|
354
|
-
"id": "counterbore-interpolate", "status": "generated", "tool": 1, "strategy": "helical circular interpolation",
|
|
355
|
-
"diameter_mm": p["counterbore_diameter_mm"], "depth_mm": p["counterbore_depth_mm"],
|
|
356
|
-
"centerline_radius_mm": 23.0, "axial_stepdown_mm": 0.5,
|
|
357
|
-
})
|
|
358
|
-
|
|
359
|
-
prog.lines.extend(["M5", "G0 Z5.000", "M30", "%"])
|
|
360
|
-
gcode_path = out / "toolpath-unverified.nc"
|
|
361
|
-
gcode_path.write_text("\n".join(prog.lines) + "\n", encoding="utf-8")
|
|
362
|
-
|
|
363
|
-
# Validate the emitted path independently of the CAD builder.
|
|
364
|
-
stock_radius = p["outer_diameter_mm"] / 2.0 + 2.0
|
|
365
|
-
finite = all(
|
|
366
|
-
math.isfinite(v)
|
|
367
|
-
for move in prog.moves
|
|
368
|
-
for point_key in ("start_mm", "end_mm")
|
|
369
|
-
for v in move[point_key].values()
|
|
370
|
-
)
|
|
371
|
-
max_radius = max(
|
|
372
|
-
math.hypot(move[key]["x"], move[key]["y"])
|
|
373
|
-
for move in prog.moves
|
|
374
|
-
for key in ("start_mm", "end_mm")
|
|
375
|
-
)
|
|
376
|
-
min_z = min(move[key]["z"] for move in prog.moves for key in ("start_mm", "end_mm"))
|
|
377
|
-
max_z = max(move[key]["z"] for move in prog.moves for key in ("start_mm", "end_mm"))
|
|
378
|
-
gcode_text = gcode_path.read_text(encoding="utf-8")
|
|
379
|
-
motion_lines = [line for line in prog.lines if re.match(r"^G[0123]\s", line)]
|
|
380
|
-
# Parse the emitted NC text independently of the in-memory move writer.
|
|
381
|
-
parsed_position = {"x": 0.0, "y": 0.0, "z": 0.0}
|
|
382
|
-
parsed_positions = [dict(parsed_position)]
|
|
383
|
-
parsed_arc_errors = []
|
|
384
|
-
parsed_finite = True
|
|
385
|
-
for line in gcode_text.splitlines():
|
|
386
|
-
command_match = re.match(r"^(G[0123])(?:\s|$)", line)
|
|
387
|
-
if not command_match:
|
|
388
|
-
continue
|
|
389
|
-
words = {key.upper(): float(value) for key, value in re.findall(
|
|
390
|
-
r"([XYZIJKF])([-+]?(?:\d+(?:\.\d*)?|\.\d+))", line
|
|
391
|
-
)}
|
|
392
|
-
if any(not math.isfinite(value) for value in words.values()):
|
|
393
|
-
parsed_finite = False
|
|
394
|
-
continue
|
|
395
|
-
start = dict(parsed_position)
|
|
396
|
-
command = command_match.group(1)
|
|
397
|
-
if command in ("G2", "G3"):
|
|
398
|
-
if "I" not in words or "J" not in words:
|
|
399
|
-
parsed_arc_errors.append({"line": line, "error": "arc_center_missing"})
|
|
400
|
-
else:
|
|
401
|
-
center_x = start["x"] + words["I"]
|
|
402
|
-
center_y = start["y"] + words["J"]
|
|
403
|
-
end_x = words.get("X", start["x"])
|
|
404
|
-
end_y = words.get("Y", start["y"])
|
|
405
|
-
start_radius = math.hypot(start["x"] - center_x, start["y"] - center_y)
|
|
406
|
-
end_radius = math.hypot(end_x - center_x, end_y - center_y)
|
|
407
|
-
if abs(start_radius - end_radius) > 0.02:
|
|
408
|
-
parsed_arc_errors.append({
|
|
409
|
-
"line": line,
|
|
410
|
-
"start_radius_mm": round(start_radius, 6),
|
|
411
|
-
"end_radius_mm": round(end_radius, 6),
|
|
412
|
-
"error": "arc_radius_mismatch",
|
|
413
|
-
})
|
|
414
|
-
for axis in ("X", "Y", "Z"):
|
|
415
|
-
if axis in words:
|
|
416
|
-
parsed_position[axis.lower()] = words[axis]
|
|
417
|
-
parsed_positions.append(dict(parsed_position))
|
|
418
|
-
parsed_max_radius = max(math.hypot(point["x"], point["y"]) for point in parsed_positions)
|
|
419
|
-
parsed_min_z = min(point["z"] for point in parsed_positions)
|
|
420
|
-
parsed_max_z = max(point["z"] for point in parsed_positions)
|
|
421
|
-
parsed_arc_count = sum(1 for line in motion_lines if line.startswith(("G2 ", "G3 ")))
|
|
422
|
-
parsed_motion_count = len(motion_lines)
|
|
423
|
-
checks = [
|
|
424
|
-
{"check": "geometry_verification_precondition", "expected": True, "actual": json.loads((out / "verification.json").read_text())["all_checks_pass"], "pass": json.loads((out / "verification.json").read_text())["all_checks_pass"]},
|
|
425
|
-
{"check": "required_operations_generated", "expected": ["pocket-rough", "clearance-drill", "bore-interpolate"], "actual": sorted({m["operation_id"] for m in prog.moves} & {"pocket-rough", "clearance-drill", "bore-interpolate"}), "pass": all(x in {m["operation_id"] for m in prog.moves} for x in ["pocket-rough", "clearance-drill", "bore-interpolate"])},
|
|
426
|
-
{"check": "all_coordinates_finite", "expected": True, "actual": finite, "pass": finite},
|
|
427
|
-
{"check": "tool_center_within_stock_envelope", "expected": f"<= {stock_radius:g} mm radius", "actual": round(max_radius, 5), "pass": max_radius <= stock_radius + 1e-5},
|
|
428
|
-
{"check": "z_limits", "expected": {"min_mm": BREAKTHROUGH_Z, "max_mm": SAFE_Z}, "actual": {"min_mm": round(min_z, 5), "max_mm": round(max_z, 5)}, "pass": min_z >= BREAKTHROUGH_Z - 1e-5 and max_z <= SAFE_Z + 1e-5},
|
|
429
|
-
{"check": "gcode_has_metric_absolute_setup", "expected": True, "actual": all(x in gcode_text for x in ["G21 G17 G90 G94", "G54"]), "pass": all(x in gcode_text for x in ["G21 G17 G90 G94", "G54"])},
|
|
430
|
-
{"check": "gcode_has_program_end", "expected": "M30", "actual": "M30" in gcode_text, "pass": "M30" in gcode_text},
|
|
431
|
-
{"check": "gcode_marked_unverified", "expected": True, "actual": "UNVERIFIED" in gcode_text and "NOT APPROVED" in gcode_text, "pass": "UNVERIFIED" in gcode_text and "NOT APPROVED" in gcode_text},
|
|
432
|
-
{"check": "gcode_motion_text_parses", "expected": True, "actual": parsed_finite and parsed_motion_count > 100, "pass": parsed_finite and parsed_motion_count > 100},
|
|
433
|
-
{"check": "gcode_arc_radii_consistent", "expected": "all emitted G2/G3 arcs have matching start/end radii within 0.02 mm", "actual": {"arc_count": parsed_arc_count, "errors": parsed_arc_errors[:10]}, "pass": parsed_arc_count > 0 and not parsed_arc_errors},
|
|
434
|
-
{"check": "gcode_coordinate_envelope", "expected": {"stock_radius_mm": stock_radius, "min_z_mm": BREAKTHROUGH_Z, "max_z_mm": SAFE_Z}, "actual": {"max_tool_center_radius_mm": round(parsed_max_radius, 5), "min_z_mm": round(parsed_min_z, 5), "max_z_mm": round(parsed_max_z, 5)}, "pass": parsed_max_radius <= stock_radius + 1e-5 and parsed_min_z >= BREAKTHROUGH_Z - 1e-5 and parsed_max_z <= SAFE_Z + 1e-5},
|
|
435
|
-
{"check": "nonempty_motion_program", "expected": "> 100 motion commands", "actual": len(motion_lines), "pass": len(motion_lines) > 100},
|
|
436
|
-
]
|
|
437
|
-
all_pass = all(row["pass"] for row in checks)
|
|
438
|
-
if not all_pass:
|
|
439
|
-
raise RuntimeError("toolpath_verification_failed: " + json.dumps([row for row in checks if not row["pass"]]))
|
|
440
|
-
|
|
441
|
-
# Generate a backplot from the same moves consumed by the NC writer.
|
|
442
|
-
W = H = 1000
|
|
443
|
-
cx = cy = 450.0
|
|
444
|
-
scale = 3.6
|
|
445
|
-
def sx(x): return cx + x * scale
|
|
446
|
-
def sy(y): return cy - y * scale
|
|
447
|
-
def esc(value): return html.escape(str(value), quote=True)
|
|
448
|
-
svg = [
|
|
449
|
-
f'<svg xmlns="http://www.w3.org/2000/svg" width="{W}" height="{H}" viewBox="0 0 {W} {H}" role="img" aria-label="Generated toolpath backplot">',
|
|
450
|
-
'<rect width="100%" height="100%" fill="#f4f5f1"/>',
|
|
451
|
-
'<text x="50" y="48" font-family="Arial, sans-serif" font-size="17" font-weight="700" letter-spacing="2" fill="#526b62">CAM MODEL 01 / GENERATED TOOLPATH</text>',
|
|
452
|
-
'<text x="50" y="78" font-family="Arial, sans-serif" font-size="26" font-weight="700" fill="#203b34">Cutter-center backplot · Candidate B</text>',
|
|
453
|
-
f'<circle cx="{cx}" cy="{cy}" r="{p["outer_diameter_mm"]/2*scale:.2f}" fill="#fffdfa" stroke="#314b45" stroke-width="2.6"/>',
|
|
454
|
-
f'<circle cx="{cx}" cy="{cy}" r="{p["bolt_circle_diameter_mm"]/2*scale:.2f}" fill="none" stroke="#b4bdb7" stroke-width="1.5" stroke-dasharray="6 7"/>',
|
|
455
|
-
f'<circle cx="{cx}" cy="{cy}" r="{p["counterbore_diameter_mm"]/2*scale:.2f}" fill="none" stroke="#85968c" stroke-width="2" stroke-dasharray="7 5"/>',
|
|
456
|
-
f'<circle cx="{cx}" cy="{cy}" r="{p["bore_diameter_mm"]/2*scale:.2f}" fill="none" stroke="#85968c" stroke-width="2"/>',
|
|
457
|
-
]
|
|
458
|
-
for x, y in hole_points:
|
|
459
|
-
svg.append(f'<circle cx="{sx(x):.2f}" cy="{sy(y):.2f}" r="{p["hole_diameter_mm"]/2*scale:.2f}" fill="#fffdfa" stroke="#314b45" stroke-width="1.8"/>')
|
|
460
|
-
pocket_boundary = rounded_rect_points(p["pocket_length_mm"]/2, p["pocket_width_mm"]/2, p["pocket_corner_radius_mm"], 12)
|
|
461
|
-
pb = [pocket_transform(x, y, p) for x, y in pocket_boundary]
|
|
462
|
-
svg.append('<path d="' + " ".join(("M" if i == 0 else "L") + f"{sx(x):.2f},{sy(y):.2f}" for i, (x, y) in enumerate(pb)) + ' Z" fill="none" stroke="#7d9388" stroke-width="1.5"/>')
|
|
463
|
-
|
|
464
|
-
def arc_points(move, segments=20):
|
|
465
|
-
start = move["start_mm"]
|
|
466
|
-
end = move["end_mm"]
|
|
467
|
-
center = move.get("center_mm")
|
|
468
|
-
if not center:
|
|
469
|
-
return [(start["x"], start["y"]), (end["x"], end["y"])]
|
|
470
|
-
r = math.hypot(start["x"] - center["x"], start["y"] - center["y"])
|
|
471
|
-
a0 = math.atan2(start["y"] - center["y"], start["x"] - center["x"])
|
|
472
|
-
a1 = math.atan2(end["y"] - center["y"], end["x"] - center["x"])
|
|
473
|
-
delta = (a1 - a0) % (2 * math.pi) if move["motion"] == "arc_ccw" else (a0 - a1) % (2 * math.pi)
|
|
474
|
-
if delta < 1e-8 and math.hypot(end["x"] - start["x"], end["y"] - start["y"]) < 1e-8:
|
|
475
|
-
delta = 2 * math.pi
|
|
476
|
-
sign = 1 if move["motion"] == "arc_ccw" else -1
|
|
477
|
-
return [(center["x"] + r * math.cos(a0 + sign * delta * i / segments),
|
|
478
|
-
center["y"] + r * math.sin(a0 + sign * delta * i / segments)) for i in range(segments + 1)]
|
|
479
|
-
|
|
480
|
-
for move in prog.moves:
|
|
481
|
-
start = move["start_mm"]
|
|
482
|
-
end = move["end_mm"]
|
|
483
|
-
if math.hypot(end["x"] - start["x"], end["y"] - start["y"]) < 1e-6:
|
|
484
|
-
continue
|
|
485
|
-
pts = arc_points(move) if move["motion"].startswith("arc_") else [(start["x"], start["y"]), (end["x"], end["y"])]
|
|
486
|
-
points = " ".join(f"{sx(x):.2f},{sy(y):.2f}" for x, y in pts)
|
|
487
|
-
if move["motion"] == "rapid":
|
|
488
|
-
color, dash, width = "#c08b45", ' stroke-dasharray="6 5"', 1.25
|
|
489
|
-
elif move["motion"].startswith("arc_"):
|
|
490
|
-
color, dash, width = "#315f9b", "", 1.6
|
|
491
|
-
else:
|
|
492
|
-
color, dash, width = "#2d7771", "", 1.35
|
|
493
|
-
svg.append(f'<polyline points="{points}" fill="none" stroke="{color}" stroke-width="{width}"{dash} opacity="0.76" stroke-linecap="round" stroke-linejoin="round"/>')
|
|
494
|
-
svg.extend([
|
|
495
|
-
'<rect x="720" y="150" width="235" height="215" rx="5" fill="#fffdfa" stroke="#d6ddd6"/>',
|
|
496
|
-
'<text x="745" y="185" font-family="Arial, sans-serif" font-size="14" font-weight="700" fill="#203b34">MOTION LEGEND</text>',
|
|
497
|
-
'<line x1="745" y1="220" x2="795" y2="220" stroke="#c08b45" stroke-width="3" stroke-dasharray="6 5"/><text x="810" y="225" font-family="Arial, sans-serif" font-size="13" fill="#203b34">Rapid / reposition</text>',
|
|
498
|
-
'<line x1="745" y1="255" x2="795" y2="255" stroke="#2d7771" stroke-width="3"/><text x="810" y="260" font-family="Arial, sans-serif" font-size="13" fill="#203b34">Feed / cut</text>',
|
|
499
|
-
'<line x1="745" y1="290" x2="795" y2="290" stroke="#315f9b" stroke-width="3"/><text x="810" y="295" font-family="Arial, sans-serif" font-size="13" fill="#203b34">Arc / helix</text>',
|
|
500
|
-
f'<text x="745" y="335" font-family="Arial, sans-serif" font-size="12" fill="#61736c">{len(prog.moves)} recorded moves</text>',
|
|
501
|
-
'<rect x="720" y="390" width="235" height="190" rx="5" fill="#fffdfa" stroke="#d6ddd6"/>',
|
|
502
|
-
'<text x="745" y="425" font-family="Arial, sans-serif" font-size="14" font-weight="700" fill="#203b34">PROGRAM LIMITS</text>',
|
|
503
|
-
'<text x="745" y="455" font-family="Arial, sans-serif" font-size="12" fill="#61736c">Z0 = raw stock top</text>',
|
|
504
|
-
'<text x="745" y="478" font-family="Arial, sans-serif" font-size="12" fill="#61736c">Finished top = Z-0.5</text>',
|
|
505
|
-
f'<text x="745" y="501" font-family="Arial, sans-serif" font-size="12" fill="#61736c">Through cut = Z{BREAKTHROUGH_Z:g}</text>',
|
|
506
|
-
'<text x="745" y="536" font-family="Arial, sans-serif" font-size="12" font-weight="700" fill="#9b593c">UNVERIFIED POST</text>',
|
|
507
|
-
'<text x="50" y="950" font-family="Arial, sans-serif" font-size="14" fill="#9b593c">Review artifact only — no machine, fixture, collision simulation, or controller qualification.</text>',
|
|
508
|
-
'</svg>',
|
|
509
|
-
])
|
|
510
|
-
(out / "toolpath-preview.svg").write_text("\n".join(svg) + "\n", encoding="utf-8")
|
|
511
|
-
(out / "toolpath-preview.html").write_text(
|
|
512
|
-
'<!doctype html><html><head><meta charset="utf-8"><title>Toolpath backplot</title><style>body{margin:0;background:#e8ece7;display:grid;place-items:center;min-height:100vh}img{width:min(96vw,1100px);height:auto;background:#f4f5f1;box-shadow:0 18px 60px #132b241a}</style></head><body><img src="toolpath-preview.svg" alt="Generated toolpath backplot"></body></html>\n',
|
|
513
|
-
encoding="utf-8",
|
|
514
|
-
)
|
|
515
|
-
|
|
516
|
-
feed_seconds = sum(m["length_mm"] / m["feed_mm_min"] * 60 for m in prog.moves if m.get("feed_mm_min"))
|
|
517
|
-
rapid_seconds = sum(m["length_mm"] / RAPID_MM_MIN * 60 for m in prog.moves if m["motion"] == "rapid")
|
|
518
|
-
overhead_seconds = prog.tool_changes * 10.0 + 20.0
|
|
519
|
-
estimated_seconds = feed_seconds + rapid_seconds + overhead_seconds
|
|
520
|
-
gcode_sha = sha256(gcode_path)
|
|
521
|
-
toolpath_doc = {
|
|
522
|
-
"schema": SCHEMA,
|
|
523
|
-
"part_id": params["part_id"],
|
|
524
|
-
"revision": params["revision"],
|
|
525
|
-
"design_status": "proposal_not_approved",
|
|
526
|
-
"dialect": DIALECT,
|
|
527
|
-
"post_status": "UNVERIFIED",
|
|
528
|
-
"units": "mm",
|
|
529
|
-
"wcs": {
|
|
530
|
-
"coordinate_system": "G54",
|
|
531
|
-
"origin": "center of raw stock top",
|
|
532
|
-
"x0_mm": 0.0, "y0_mm": 0.0, "z0_mm": 0.0,
|
|
533
|
-
"finished_top_z_mm": TOP_Z,
|
|
534
|
-
"finished_bottom_z_mm": -12.5,
|
|
535
|
-
"through_breakthrough_z_mm": BREAKTHROUGH_Z,
|
|
536
|
-
},
|
|
537
|
-
"tooling": tool_definitions,
|
|
538
|
-
"operations": op_meta,
|
|
539
|
-
"moves": prog.moves,
|
|
540
|
-
"summary": {
|
|
541
|
-
"move_count": len(prog.moves),
|
|
542
|
-
"gcode_motion_line_count": len(motion_lines),
|
|
543
|
-
"feed_motion_seconds": round(feed_seconds, 2),
|
|
544
|
-
"rapid_motion_seconds_at_assumed_rate": round(rapid_seconds, 2),
|
|
545
|
-
"tool_change_allowance_seconds": round(prog.tool_changes * 10.0, 2),
|
|
546
|
-
"other_allowance_seconds": 20.0,
|
|
547
|
-
"estimated_cycle_time_seconds": round(estimated_seconds, 2),
|
|
548
|
-
"estimated_cycle_time_basis": "feed and rapid distance estimate plus explicit 10 s per tool change and 20 s other allowance; excludes machine acceleration, actual controller behavior, probing, coolant, setup, and ungenerated face/profile/chamfer operations",
|
|
549
|
-
"gcode_file": gcode_path.name,
|
|
550
|
-
"gcode_sha256": gcode_sha,
|
|
551
|
-
},
|
|
552
|
-
}
|
|
553
|
-
(out / "toolpath.json").write_text(json.dumps(toolpath_doc, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
|
554
|
-
|
|
555
|
-
verification = {
|
|
556
|
-
"schema": "inneranimalmedia.cam.toolpath-verification.v1",
|
|
557
|
-
"part_id": params["part_id"],
|
|
558
|
-
"revision": params["revision"],
|
|
559
|
-
"design_status": "proposal_not_approved",
|
|
560
|
-
"dialect": DIALECT,
|
|
561
|
-
"post_status": "UNVERIFIED",
|
|
562
|
-
"checks": checks,
|
|
563
|
-
"all_checks_pass": all_pass,
|
|
564
|
-
"limits": {
|
|
565
|
-
"stock_radius_mm": stock_radius,
|
|
566
|
-
"max_tool_center_radius_mm": round(max_radius, 5),
|
|
567
|
-
"min_z_mm": round(min_z, 5),
|
|
568
|
-
"max_z_mm": round(max_z, 5),
|
|
569
|
-
"gcode_parsed_max_tool_center_radius_mm": round(parsed_max_radius, 5),
|
|
570
|
-
"gcode_parsed_min_z_mm": round(parsed_min_z, 5),
|
|
571
|
-
"gcode_parsed_max_z_mm": round(parsed_max_z, 5),
|
|
572
|
-
"gcode_parsed_arc_count": parsed_arc_count,
|
|
573
|
-
"gcode_motion_line_count": len(motion_lines),
|
|
574
|
-
},
|
|
575
|
-
"not_verified": [
|
|
576
|
-
"No machine-specific postprocessor or controller dialect selected.",
|
|
577
|
-
"No machine, fixture, clamp, or workholding collision simulation.",
|
|
578
|
-
"No cutting load, tool deflection, chip evacuation, or spindle power simulation.",
|
|
579
|
-
"Feeds and speeds are starting values only and require tool-vendor and machine verification.",
|
|
580
|
-
"Ø40 H7 is not certified by nominal interpolation; use qualified finish process and inspect the bore.",
|
|
581
|
-
"The generic program does not include stock facing, outside profile finishing, chamfering, or the second setup.",
|
|
582
|
-
],
|
|
583
|
-
}
|
|
584
|
-
(out / "gcode-verification.json").write_text(json.dumps(verification, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
|
585
|
-
|
|
586
|
-
# Enrich the operation plan generated by the presentation/drawing stage.
|
|
587
|
-
plan_path = out / "cam-plan.json"
|
|
588
|
-
if plan_path.exists():
|
|
589
|
-
plan = json.loads(plan_path.read_text(encoding="utf-8"))
|
|
590
|
-
else:
|
|
591
|
-
plan = {"schema": "inneranimalmedia.cam.plan.v1", "part_id": params["part_id"], "revision": params["revision"]}
|
|
592
|
-
plan.update({
|
|
593
|
-
"design_status": "proposal_not_approved",
|
|
594
|
-
"execution_mode": "generated_generic_toolpath_review",
|
|
595
|
-
"machine_ready": False,
|
|
596
|
-
"controller_output": {
|
|
597
|
-
"generated": True,
|
|
598
|
-
"dialect": DIALECT,
|
|
599
|
-
"status": "UNVERIFIED",
|
|
600
|
-
"file": gcode_path.name,
|
|
601
|
-
"sha256": gcode_sha,
|
|
602
|
-
"includes": ["pocket roughing", "pocket wall finish", "four-hole peck drilling", "center pilot drilling", "through-bore interpolation", "counterbore interpolation"],
|
|
603
|
-
"omits": ["stock facing", "outside profile finishing", "outer-edge chamfer", "fixture/setup moves", "second setup"],
|
|
604
|
-
"reason": "Generic review program only. A qualified machine-specific post and simulation are still required.",
|
|
605
|
-
},
|
|
606
|
-
"stock_concept": {
|
|
607
|
-
"shape": "round",
|
|
608
|
-
"diameter_mm": p["outer_diameter_mm"] + 4.0,
|
|
609
|
-
"thickness_mm": p["thickness_mm"] + 2.0,
|
|
610
|
-
"material": params["material"],
|
|
611
|
-
"status": "conceptual stock; verify supplier availability and workholding",
|
|
612
|
-
"radial_allowance_mm": 2.0,
|
|
613
|
-
"axial_allowance_mm": 1.0,
|
|
614
|
-
},
|
|
615
|
-
"wcs_concept": {
|
|
616
|
-
"coordinate_system": "G54",
|
|
617
|
-
"origin": "center of raw stock top",
|
|
618
|
-
"x_mm": 0.0, "y_mm": 0.0, "z_mm": 0.0,
|
|
619
|
-
"finished_top_z_mm": TOP_Z,
|
|
620
|
-
"finished_bottom_z_mm": -12.5,
|
|
621
|
-
"axes": {"X": "part horizontal datum", "Y": "part vertical datum", "Z": "normal to top face"},
|
|
622
|
-
"status": "conceptual; confirm stock face and fixture datum",
|
|
623
|
-
},
|
|
624
|
-
"setups": [
|
|
625
|
-
{"id": "setup-01", "access": "top face", "purpose": "face reference, pocket, holes, pilot, bore, counterbore, top chamfer; leave radial stock on outside profile", "status": "conceptual; fixture not defined"},
|
|
626
|
-
{"id": "setup-02", "access": "flipped/back face", "purpose": "finish back face and outside diameter; deburr underside", "status": "planned only; no toolpath generated"},
|
|
627
|
-
],
|
|
628
|
-
"tools": tool_definitions,
|
|
629
|
-
"operation_sequence": [
|
|
630
|
-
{"order": 1, "id": "face-stock", "name": "Face stock", "tool": 5, "strategy": "raster facing", "rpm": 8000, "feed_mm_min": 350, "stepdown_mm": 0.5, "stepover_mm": 6.0, "stock_to_leave_mm": 0.0, "status": "planned; not included in NC file"},
|
|
631
|
-
{"order": 2, "id": "pocket-rough", "name": "Pocket roughing", "tool": 1, "strategy": "ramp-in plus raster", "rpm": 10000, "feed_mm_min": 400, "ramp_feed_mm_min": 150, "stepdown_mm": 1.0, "stepover_mm": 2.4, "stock_to_leave_radial_mm": 0.3, "status": "generated"},
|
|
632
|
-
{"order": 3, "id": "pocket-finish", "name": "Pocket finishing", "tool": 1, "strategy": "rounded contour", "rpm": 10000, "feed_mm_min": 250, "stepdown_mm": 0.5, "stepover_mm": 0.0, "stock_to_leave_radial_mm": 0.0, "status": "generated"},
|
|
633
|
-
{"order": 4, "id": "clearance-drill", "name": "Drill clearance holes", "tool": 2, "strategy": "explicit peck drilling", "rpm": 4000, "feed_mm_min": 160, "peck_depth_mm": 2.0, "final_z_mm": BREAKTHROUGH_Z, "status": "generated"},
|
|
634
|
-
{"order": 5, "id": "bore-pilot", "name": "Drill bore pilot", "tool": 3, "strategy": "explicit peck drilling", "rpm": 2500, "feed_mm_min": 100, "peck_depth_mm": 2.0, "final_z_mm": BREAKTHROUGH_Z, "status": "generated"},
|
|
635
|
-
{"order": 6, "id": "bore-interpolate", "name": "Bore Ø40 nominal", "tool": 1, "strategy": "helical entry plus concentric interpolation", "rpm": 10000, "feed_mm_min": 180, "stepdown_mm": 1.0, "radial_stepover_mm": 2.0, "stock_to_leave_mm": 0.0, "tolerance_status": "nominal only; H7 requires qualified finish and inspection", "status": "generated"},
|
|
636
|
-
{"order": 7, "id": "counterbore-interpolate", "name": "Counterbore Ø52 x 4 mm", "tool": 1, "strategy": "helical circular interpolation", "rpm": 10000, "feed_mm_min": 120, "stepdown_mm": 0.5, "stock_to_leave_mm": 0.0, "status": "generated"},
|
|
637
|
-
{"order": 8, "id": "outer-chamfer", "name": "Top outside chamfer 0.5 mm", "tool": 4, "strategy": "qualified chamfer contour", "rpm": 6000, "feed_mm_min": 120, "stepdown_mm": 0.5, "status": "planned; not included in NC file"},
|
|
638
|
-
{"order": 9, "id": "finish-outside-profile", "name": "Finish outside diameter and back face", "tool": 5, "strategy": "profile plus flipped setup", "rpm": 8000, "feed_mm_min": 350, "stepdown_mm": 1.0, "stock_to_leave_radial_mm": 0.5, "status": "planned; fixture and second setup not generated"},
|
|
639
|
-
],
|
|
640
|
-
"verification": {
|
|
641
|
-
"geometry_checks_pass": json.loads((out / "verification.json").read_text(encoding="utf-8"))["all_checks_pass"],
|
|
642
|
-
"toolpath_checks_pass": all_pass,
|
|
643
|
-
"toolpath_move_count": len(prog.moves),
|
|
644
|
-
"toolpath_checks": checks,
|
|
645
|
-
},
|
|
646
|
-
"cycle_time_estimate": toolpath_doc["summary"],
|
|
647
|
-
"excluded": {
|
|
648
|
-
"machine_specific_post": "not selected; generic Fanuc-style code is unverified",
|
|
649
|
-
"physical machining": "not authorized or supported by this artifact",
|
|
650
|
-
"collision_simulation": "not performed",
|
|
651
|
-
"H7_tolerance": "nominal path only; qualified finishing and inspection required",
|
|
652
|
-
"face_profile_chamfer_second_setup": "operation plan only; not in generated NC file",
|
|
653
|
-
},
|
|
654
|
-
"review_required": [
|
|
655
|
-
"Approve Candidate B 150 mm OD or revise the original 120 mm OD/pocket layout.",
|
|
656
|
-
"Confirm material, M6 clearance fit, and the exact Ø40 H7 acceptance limits.",
|
|
657
|
-
"Select stock, machine, fixture, clamps, tools, and a qualified postprocessor.",
|
|
658
|
-
"Simulate collisions and validate feeds/speeds, spindle load, chip evacuation, and workholding.",
|
|
659
|
-
"Inspect the finished bore and all critical dimensions before release.",
|
|
660
|
-
],
|
|
661
|
-
})
|
|
662
|
-
plan_path.write_text(json.dumps(plan, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
|
663
|
-
|
|
664
|
-
# The deck's image and narrative must refer to the generated backplot, not the old schematic.
|
|
665
|
-
deck_path = out / "presentation.html"
|
|
666
|
-
if deck_path.exists():
|
|
667
|
-
deck = deck_path.read_text(encoding="utf-8")
|
|
668
|
-
replacements = {
|
|
669
|
-
"The CAM view explains sequence, not machine commands.": "Generated cutter-center paths make the first machining sequence inspectable.",
|
|
670
|
-
'<img src="toolpath-preview.png" alt="Illustrative toolpath layers">': '<img src="toolpath-preview.svg" alt="Generated toolpath backplot">',
|
|
671
|
-
"No executable G-code, machine-specific feeds/speeds, or cycle-time estimate is included.": "Generic Fanuc-style G-code exists for review; post, machine settings, and cycle time remain unverified.",
|
|
672
|
-
"simulation-only process story": "offline CAM review package",
|
|
673
|
-
"The operation map connects each intent to a named CAD feature. It is useful for review without pretending that a machine, fixture, tool library, or post has been validated.": "The generated path data covers pocket roughing and finishing, peck drilling, bore interpolation, and counterbore interpolation. It remains unverified for any machine or post.",
|
|
674
|
-
}
|
|
675
|
-
for old, new in replacements.items():
|
|
676
|
-
deck = deck.replace(old, new)
|
|
677
|
-
deck_path.write_text(deck, encoding="utf-8")
|
|
678
|
-
|
|
679
|
-
summary = {
|
|
680
|
-
"schema": "inneranimalmedia.cam.toolpath-result.v1",
|
|
681
|
-
"ok": all_pass,
|
|
682
|
-
"part_id": params["part_id"],
|
|
683
|
-
"revision": params["revision"],
|
|
684
|
-
"design_status": "proposal_not_approved",
|
|
685
|
-
"dialect": DIALECT,
|
|
686
|
-
"post_status": "UNVERIFIED",
|
|
687
|
-
"move_count": len(prog.moves),
|
|
688
|
-
"gcode_motion_line_count": len(motion_lines),
|
|
689
|
-
"gcode_file": gcode_path.name,
|
|
690
|
-
"gcode_sha256": gcode_sha,
|
|
691
|
-
"toolpath_sha256": sha256(out / "toolpath.json"),
|
|
692
|
-
"verification_file": "gcode-verification.json",
|
|
693
|
-
"verification_pass": all_pass,
|
|
694
|
-
"estimated_cycle_time_seconds": round(estimated_seconds, 2),
|
|
695
|
-
"files": [
|
|
696
|
-
{"name": name, "bytes": (out / name).stat().st_size, "sha256": sha256(out / name)}
|
|
697
|
-
for name in ["toolpath-unverified.nc", "toolpath.json", "toolpath-preview.svg", "toolpath-preview.html", "gcode-verification.json", "cam-plan.json"]
|
|
698
|
-
],
|
|
699
|
-
}
|
|
700
|
-
(out / "toolpath-result.json").write_text(json.dumps(summary, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
|
701
|
-
print(json.dumps(summary, sort_keys=True))
|
|
702
|
-
return 0 if all_pass else 2
|
|
703
|
-
|
|
704
|
-
def main():
|
|
705
|
-
parser = argparse.ArgumentParser()
|
|
706
|
-
parser.add_argument("--parameters", required=True)
|
|
707
|
-
parser.add_argument("--output-dir", required=True)
|
|
708
|
-
args = parser.parse_args()
|
|
709
|
-
params_path = Path(args.parameters).resolve(strict=True)
|
|
710
|
-
out = Path(args.output_dir).resolve(strict=True)
|
|
711
|
-
params = json.loads(params_path.read_text(encoding="utf-8"))
|
|
712
|
-
return generate_paths(params, out)
|
|
713
|
-
|
|
714
|
-
if __name__ == "__main__":
|
|
715
|
-
raise SystemExit(main())
|