diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..aa53c1b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +FROM node:22-bookworm-slim + +WORKDIR /app + +ENV NODE_ENV=production +ENV HOSTNAME=0.0.0.0 +ENV PORT=3000 +ENV CAD_AGENT_STUDIO_ROOT=/app/cad-agent-studio +ENV CAD_ENGINE_ROOT=/app/text-to-cad +ENV CAD_AGENT_STUDIO_CONFIG=/app/cad-agent-studio/config/llm.config.yaml +ENV PYTHONPATH=/app/text-to-cad/packages/cadpy/src + +RUN sed -i \ + -e 's|http://deb.debian.org/debian|http://mirrors.aliyun.com/debian|g' \ + -e 's|http://deb.debian.org/debian-security|http://mirrors.aliyun.com/debian-security|g' \ + /etc/apt/sources.list.d/debian.sources \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + ca-certificates \ + python3 \ + python3-pip \ + python3-venv \ + libgl1 \ + libglib2.0-0 \ + libxrender1 \ + libxext6 \ + libsm6 \ + libice6 \ + libfontconfig1 \ + fontconfig \ + fonts-dejavu-core \ + libgomp1 \ + && rm -rf /var/lib/apt/lists/* + +RUN npm config set registry https://registry.npmmirror.com + +RUN python3 -m pip install \ + --break-system-packages \ + --no-cache-dir \ + -i https://pypi.tuna.tsinghua.edu.cn/simple \ + build123d + +COPY text-to-cad ./text-to-cad +COPY cad-agent-studio ./cad-agent-studio + +RUN cd cad-agent-studio && npm install --include=dev --no-audit --no-fund +RUN cd cad-agent-studio && npm run build + +EXPOSE 3000 + +CMD ["sh", "-lc", "cd /app/cad-agent-studio && npm run start -- -H 0.0.0.0 -p ${PORT}"] diff --git a/cad-agent-studio/next.config.ts b/cad-agent-studio/next.config.ts index dc78103..07f0500 100644 --- a/cad-agent-studio/next.config.ts +++ b/cad-agent-studio/next.config.ts @@ -9,6 +9,7 @@ const nextConfig: NextConfig = { transpilePackages: ["cadjs", "three", "three-mesh-bvh"], turbopack: { resolveAlias: { + "@": "./src", cadjs: "./src/viewer-cadjs", three: "./node_modules/three", "three/examples": "./node_modules/three/examples", @@ -21,6 +22,7 @@ const nextConfig: NextConfig = { config.resolve = config.resolve || {}; config.resolve.alias = { ...(config.resolve.alias || {}), + "@": path.join(appRoot, "src"), cadjs: cadJsSrc, three: path.join(appRoot, "node_modules", "three"), "three/examples": path.join(appRoot, "node_modules", "three", "examples"), diff --git a/cad-experience-plugin/work/review/experience-draft.json b/cad-experience-plugin/work/review/experience-draft.json new file mode 100644 index 0000000..bf1dbc1 --- /dev/null +++ b/cad-experience-plugin/work/review/experience-draft.json @@ -0,0 +1,77 @@ +{ + "schema_version": "1.0", + "draft_kind": "llm_generalized_experience_proposals", + "proposals": [ + { + "id": "motif.rotational_part.coaxial_core_with_center_passage", + "kind": "feature_motif", + "scope": ["rotational_part"], + "evidence_query": { + "required_features": [ + "rotational_body", + "coaxial_cylindrical_stack", + "central_passage" + ], + "required_relations": [ + "coaxial_stack", + "dominant_axis_alignment" + ] + }, + "guidance": "Treat the rotational body, coaxial cylindrical stack, and central passage as one shared-axis core.", + "semantic_rationale": "The relationship transfers because the participating roles describe axis organization rather than a particular size.", + "check": "Confirm that the rotational body, stacked cylindrical roles, and central passage retain their intended common axis." + }, + { + "id": "motif.rotational_part.patterned_axial_mounting", + "kind": "feature_motif", + "scope": ["rotational_part"], + "evidence_query": { + "required_features": [ + "rotational_body", + "repeated_axial_hole_pattern" + ], + "required_relations": [ + "repeated_radius_group" + ] + }, + "guidance": "Represent repeated axial holes as a symmetric mounting pattern tied to the rotational body.", + "semantic_rationale": "The motif remains useful across variants because it captures repeated functional placement around a rotational form.", + "check": "Confirm that repeated axial holes remain grouped consistently around the rotational body." + }, + { + "id": "constraint.rotational_part.shared_dominant_axis", + "kind": "constraint", + "scope": ["rotational_part"], + "evidence_query": { + "required_features": [ + "rotational_body", + "coaxial_cylindrical_stack" + ], + "required_relations": [ + "dominant_axis_alignment" + ] + }, + "guidance": "Preserve the dominant axis as the organizing datum for rotational feature roles.", + "semantic_rationale": "The datum transfers because axis alignment is independent of the individual component dimensions.", + "check": "Confirm that rotational feature roles remain aligned to the same organizing datum." + }, + { + "id": "validation.rotational_part.axis_and_pattern_consistency", + "kind": "validation_rule", + "scope": ["rotational_part"], + "evidence_query": { + "required_features": [ + "central_passage", + "repeated_axial_hole_pattern" + ], + "required_relations": [ + "dominant_axis_alignment", + "repeated_radius_group" + ] + }, + "guidance": "Validate both the shared rotational axis and the grouped repeated-hole relationship before handoff.", + "semantic_rationale": "These checks protect transferable intent without relying on instance geometry.", + "check": "Confirm shared-axis alignment and repeated-hole grouping before treating the model as ready." + } + ] +} diff --git a/cad-experience-plugin/work/review/semantic-batch.json b/cad-experience-plugin/work/review/semantic-batch.json new file mode 100644 index 0000000..55f6b7d --- /dev/null +++ b/cad-experience-plugin/work/review/semantic-batch.json @@ -0,0 +1,81 @@ +{ + "schema_version": "1.0", + "batch_kind": "sanitized_cad_semantic_review", + "guardrails": { + "contains_instance_dimensions": false, + "contains_absolute_coordinates": false, + "llm_must_propose_methods_not_copy_answers": true, + "proposals_require_deterministic_evidence_verification": true + }, + "corpus_summary": { + "case_count": 2, + "family_count": 1 + }, + "cases": [ + { + "anonymous_case": "case_000001", + "family": "rotational_part", + "features": [ + "central_passage", + "coaxial_cylindrical_stack", + "multi_axis_passage", + "repeated_axial_hole_pattern", + "rotational_body" + ], + "relations": [ + "coaxial_stack", + "dominant_axis_alignment", + "repeated_radius_group" + ], + "candidate_rules": [], + "validation_targets": [], + "dimensionless_observation_roles": [] + }, + { + "anonymous_case": "case_000002", + "family": "rotational_part", + "features": [ + "central_passage", + "coaxial_cylindrical_stack", + "repeated_axial_hole_pattern", + "rotational_body" + ], + "relations": [ + "coaxial_stack", + "dominant_axis_alignment", + "repeated_radius_group" + ], + "candidate_rules": [], + "validation_targets": [], + "dimensionless_observation_roles": [] + } + ], + "existing_vocabulary": { + "promoted_ids": [], + "candidate_ids": [ + "constraint.flanged_hub_adapter.pattern_radius_consistency", + "constraint.flanged_hub_adapter.shared_dominant_axis", + "constraint.flanged_hub_adapter.transition_axis_continuity", + "motif.flanged_hub_adapter.rotational_core_with_patterned_mounting", + "validation.flanged_hub_adapter.rotational_relationships" + ] + }, + "draft_contract": { + "draft_kind": "llm_generalized_experience_proposals", + "proposal_required_fields": [ + "id", + "kind", + "scope", + "evidence_query", + "guidance", + "semantic_rationale" + ], + "allowed_kinds": [ + "feature_motif", + "constraint", + "design_rule", + "validation_rule", + "failure_repair" + ] + } +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a70c69e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +services: + cad-agent-studio: + build: + context: . + dockerfile: Dockerfile + container_name: cad-agent-studio + restart: unless-stopped + environment: + NODE_ENV: production + PORT: 3000 + DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY} + CAD_AGENT_STUDIO_ROOT: /app/cad-agent-studio + CAD_ENGINE_ROOT: /app/text-to-cad + CAD_AGENT_STUDIO_CONFIG: /app/cad-agent-studio/config/llm.config.yaml + PYTHONPATH: /app/text-to-cad/packages/cadpy/src + ports: + - "127.0.0.1:53821:3000" + volumes: + - ./cad-agent-studio/models/agent-studio:/app/cad-agent-studio/models/agent-studio + - ./cad-agent-studio/config/llm.config.yaml:/app/cad-agent-studio/config/llm.config.yaml:ro \ No newline at end of file diff --git a/dockerignore b/dockerignore new file mode 100644 index 0000000..b599654 --- /dev/null +++ b/dockerignore @@ -0,0 +1,8 @@ +.git +**/node_modules +**/.next +**/dist +**/.DS_Store + + +