@inneranimalmedia/agentsam-sdk 2.6.5 → 2.6.7
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/AGENTSAM.md +29 -0
- package/apps/README.md +5 -0
- package/apps/cad-creator/README.md +4 -4
- package/apps/cad-creator/shared/cad/package.json +1 -1
- package/apps/client-cms-editor/AGENTS.md +12 -7
- package/apps/client-cms-editor/README.md +76 -48
- package/apps/client-cms-editor/agentsam.app.json +26 -9
- package/apps/client-cms-editor/backend/package.json +20 -3
- package/apps/client-cms-editor/backend/src/api/client.ts +134 -101
- package/apps/client-cms-editor/backend/src/index.ts +1 -1
- package/apps/client-cms-editor/backend/src/model.ts +11 -115
- package/apps/client-cms-editor/backend/src/preview/bridge.ts +1 -1
- package/apps/client-cms-editor/backend/tsconfig.json +6 -1
- package/apps/client-cms-editor/bin/agentsam-cms.js +262 -0
- package/apps/client-cms-editor/bin/agentsam-cms.mjs +2 -228
- package/apps/client-cms-editor/frontend/package.json +16 -7
- package/apps/client-cms-editor/frontend/src/AgentSamDrawer.tsx +9 -41
- package/apps/client-cms-editor/frontend/src/CmsAgentSurface.tsx +19 -174
- package/apps/client-cms-editor/frontend/src/adapters/heuristic.ts +29 -0
- package/apps/client-cms-editor/frontend/src/adapters/http.ts +628 -0
- package/apps/client-cms-editor/frontend/src/adapters/memory.ts +510 -0
- package/apps/client-cms-editor/frontend/src/editor/CmsEditor.tsx +213 -0
- package/apps/client-cms-editor/frontend/src/editor/CmsEditorProvider.tsx +20 -0
- package/apps/client-cms-editor/frontend/src/editor/canvas/PreviewCanvas.tsx +53 -0
- package/apps/client-cms-editor/frontend/src/{CmsEditor.tsx → editor/legacy/CmsEditorPrototype.tsx} +52 -23
- package/apps/client-cms-editor/frontend/src/editor/useCmsEditorController.ts +218 -0
- package/apps/client-cms-editor/frontend/src/index.ts +19 -5
- package/apps/client-cms-editor/frontend/src/lib/agent-host.ts +24 -0
- package/apps/client-cms-editor/frontend/src/main.tsx +82 -8
- package/apps/client-cms-editor/frontend/src/mount.tsx +92 -30
- package/apps/client-cms-editor/frontend/src/styles/agentsam-drawer.css +1 -1
- package/apps/client-cms-editor/frontend/src/styles/cmsShell.css +8 -8
- package/apps/client-cms-editor/frontend/src/styles/studio.css +55 -3
- package/apps/client-cms-editor/frontend/tsconfig.json +12 -1
- package/apps/client-cms-editor/frontend/vite.config.ts +12 -0
- package/apps/client-cms-editor/package-lock.json +973 -134
- package/apps/client-cms-editor/package.json +118 -6
- package/apps/client-cms-editor/reference/harvest/HARVEST_RECEIPT.json +201 -0
- package/apps/client-cms-editor/reference/harvest/PROVENANCE_HISTORY.txt +10 -0
- package/apps/client-cms-editor/reference/harvest/README.md +8 -0
- package/apps/client-cms-editor/reference/harvest/plans/ARCHIVE-INTAKE.md +135 -0
- package/apps/client-cms-editor/reference/harvest/plans/CHATGPT-IDENTITY-HARVEST.md +83 -0
- package/apps/client-cms-editor/reference/harvest/plans/CMS-EDITOR-HARVEST.md +166 -0
- package/apps/client-cms-editor/reference/harvest/plans/HARVEST-INDEX.md +196 -0
- package/apps/client-cms-editor/reference/harvest/plans/INNERANIMALS-CONTENT-001.md +137 -0
- package/apps/client-cms-editor/reference/harvest/plans/NO-IMPLICIT-SIDE-EFFECTS.md +87 -0
- package/apps/client-cms-editor/reference/harvest/plans/STOREFRONT-SURFACE-MAP.md +140 -0
- package/apps/client-cms-editor/reference/harvest/plans/THEME-INNERANIMALS-HARVEST.md +137 -0
- package/apps/client-cms-editor/reference/harvest/plans/TOOLING-LAB.md +63 -0
- package/apps/client-cms-editor/reference/harvest/plans/harvest-manifest.json +97 -0
- package/apps/client-cms-editor/reference/harvest/plans/local-cms-harvest-schema.sql +328 -0
- package/apps/client-cms-editor/shared/cms/package.json +17 -7
- package/apps/client-cms-editor/shared/cms/src/adapter.ts +204 -0
- package/apps/client-cms-editor/shared/cms/src/agent-context.ts +7 -5
- package/apps/client-cms-editor/shared/cms/src/editor-types.ts +32 -0
- package/apps/client-cms-editor/shared/cms/src/host.ts +82 -0
- package/apps/client-cms-editor/shared/cms/src/index.ts +4 -0
- package/apps/client-cms-editor/shared/cms/src/map.ts +115 -0
- package/apps/client-cms-editor/shared/cms/src/starter-pack.ts +158 -0
- package/contracts/source-types.v1.json +353 -0
- package/docs/CMS_CONTEXTUAL_COMPOSER.md +1 -1
- package/docs/PRODUCT_LIFECYCLE.md +566 -0
- package/docs/THEME_REFINERY.md +2 -2
- package/docs/architecture/AGENTSAM_RUNTIME_PROTOCOL.md +40 -20
- package/docs/content-studio/REVISION_GATE_2026-09-27.md +1 -1
- package/docs/plans/LOCAL_STUDIO_DESKTOP_RELEASE_2026-09-29.md +150 -0
- package/migrations/d1/0017_identity_native_oauth.sql +21 -0
- package/native/agentsam-machine/Cargo.lock +426 -0
- package/native/agentsam-machine/Cargo.toml +9 -0
- package/native/agentsam-machine/cli/Cargo.toml +14 -0
- package/native/agentsam-machine/cli/src/main.rs +77 -0
- package/native/agentsam-machine/core/Cargo.toml +15 -0
- package/native/agentsam-machine/core/src/assets.rs +790 -0
- package/native/agentsam-machine/core/src/bound.rs +298 -0
- package/native/agentsam-machine/core/src/enrich.rs +706 -0
- package/native/agentsam-machine/core/src/frontend.rs +442 -0
- package/native/agentsam-machine/core/src/lib.rs +1086 -0
- package/native/agentsam-machine/core/src/liquid.rs +528 -0
- package/native/agentsam-machine/core/src/source_types.rs +78 -0
- package/package.json +51 -21
- package/packages/agentsam-brand/README.md +1 -1
- package/packages/agentsam-brand/package.json +4 -4
- package/packages/agentsam-brand/src/index.js +1 -1
- package/packages/agentsam-contracts/package.json +13 -3
- package/packages/agentsam-contracts/src/tools.ts +22 -0
- package/packages/agentsam-errors/package.json +13 -3
- package/packages/agentsam-knowledge/package.json +18 -4
- package/packages/agentsam-knowledge/src/autorag/index.js +10 -3
- package/packages/agentsam-knowledge/src/backends/index.js +33 -1
- package/packages/agentsam-knowledge/test/autorag.test.mjs +60 -1
- package/packages/agentsam-nav/package.json +24 -6
- package/packages/agentsam-queue-control/README.md +1 -1
- package/packages/agentsam-queue-control/package.json +7 -2
- package/packages/agentsam-rapid-rust/src/main.rs +1 -1
- package/packages/agentsam-repository/package.json +13 -3
- package/packages/agentsam-repository/src/source-types.js +8 -0
- package/packages/agentsam-vault/package.json +14 -4
- package/packages/agentsam-workbench/package.json +15 -4
- package/packages/agentsam-workbench/src/agent/ToolPermissionRequest.tsx +94 -0
- package/packages/agentsam-workbench/src/agent/index.ts +2 -0
- package/packages/agentsam-workbench/src/agent/tool-permission.css +134 -0
- package/packages/connectors/cloudflare/package.json +13 -3
- package/packages/connectors/cloudflare/src/api-client.js +3 -2
- package/packages/connectors/cloudflare/src/families/vectorize.js +127 -0
- package/packages/connectors/cloudflare/src/index.js +1 -0
- package/packages/heuristic-theme/README.md +2 -2
- package/packages/heuristic-theme/package.json +8 -3
- package/packages/heuristic-theme/src/registry.js +2 -2
- package/packages/heuristic-theme/src/theme.js +1 -1
- package/packages/heuristic-theme/test/theme.test.mjs +1 -1
- package/packages/identity/.agentsam/features/oauth-login-portal/agentsam.feature.json +1 -1
- package/packages/identity/.agentsam/features/oauth-login-portal/providers.json +27 -7
- package/packages/identity/README.md +2 -2
- package/packages/identity/migrations/D1_SCHEMA_MAPPING.md +18 -15
- package/packages/identity/migrations/apply-portable.js +109 -0
- package/packages/identity/migrations/sqlite/004_identity_oauth_consent_catalog.sql +1 -1
- package/packages/identity/migrations/sqlite/005_identity_company_native.sql +52 -0
- package/packages/identity/package.json +27 -6
- package/packages/identity/schema/agentsam.identity/manifest.json +101 -0
- package/packages/identity/scripts/local-identity-bridge.mjs +13 -7
- package/packages/identity/scripts/preview-auth-portal.mjs +6 -6
- package/packages/identity/src/adapters/cloudflare-d1/index.js +8 -401
- package/packages/identity/src/adapters/iam-compat/index.js +540 -0
- package/packages/identity/src/adapters/portable-d1/index.js +18 -0
- package/packages/identity/src/adapters/portable-store.js +479 -0
- package/packages/identity/src/adapters/sqlite/index.js +13 -312
- package/packages/identity/src/contracts/auth-config.js +0 -1
- package/packages/identity/src/contracts/identity-store.js +56 -5
- package/packages/identity/src/contracts/provider.js +1 -0
- package/packages/identity/src/contracts/sign-in-options.js +104 -0
- package/packages/identity/src/core/constants.js +1 -1
- package/packages/identity/src/core/session-policy.js +31 -0
- package/packages/identity/src/frontend/auth-portal/pages/login.html +6 -6
- package/packages/identity/src/frontend/auth-portal/pages/reset.html +5 -5
- package/packages/identity/src/frontend/auth-portal/pages/signup.html +5 -5
- package/packages/identity/src/frontend/auth-portal/shared/company-branding.js +1 -1
- package/packages/identity/src/frontend/auth-portal/shared/desktop-identity-bridge.js +6 -37
- package/packages/identity/src/index.js +28 -1
- package/packages/identity/src/migrations/README.md +23 -23
- package/packages/identity/src/oauth/README.md +1 -1
- package/packages/identity/src/oauth/credentials.js +10 -11
- package/packages/identity/src/oauth/google-desktop-exchange.js +195 -27
- package/packages/identity/src/oauth/iam-platform.js +21 -9
- package/packages/identity/src/oauth/native-handoff.js +136 -0
- package/packages/identity/src/providers/chatgpt/headers.js +65 -0
- package/packages/identity/src/providers/chatgpt/index.js +86 -0
- package/packages/identity/src/providers/chatgpt/mapper.js +43 -0
- package/packages/identity/src/providers/chatgpt/paths.js +45 -0
- package/packages/identity/src/providers/github/oauth.js +1 -2
- package/packages/identity/src/providers/github/profile.js +16 -2
- package/packages/identity/src/providers/index.js +11 -3
- package/packages/identity/src/server/identity-service.js +2 -1
- package/packages/identity/src/server/worker-router.js +71 -18
- package/packages/identity/tests/chatgpt-provider.test.mjs +75 -0
- package/packages/identity/tests/google-desktop-identity-login.test.mjs +210 -0
- package/packages/identity/tests/identity-init-scaffold.test.mjs +15 -4
- package/packages/identity/tests/lane1-identity-store-parity.test.mjs +527 -0
- package/packages/identity/tests/lane1-packed-consumer.test.mjs +175 -0
- package/packages/identity/tests/native-oauth-handoff.test.mjs +292 -0
- package/packages/identity/tests/oauth-credentials.test.mjs +4 -4
- package/packages/identity/tests/preview-auth-portal.test.mjs +4 -2
- package/packages/identity/tests/session-routes-policy.test.mjs +13 -1
- package/packages/identity/tests/worker-runtime-boundary.test.mjs +11 -0
- package/packages/providers/completeful/package.json +7 -2
- package/packages/theme-church-site/package.json +17 -6
- package/packages/theme-church-site/src/harvest.json +4 -2
- package/packages/theme-church-site/src/index.js +7 -3
- package/packages/theme-church-site/test/theme.test.mjs +4 -2
- package/packages/theme-companions-site/package.json +17 -6
- package/packages/theme-companions-site/src/harvest.json +4 -2
- package/packages/theme-companions-site/src/index.js +7 -3
- package/packages/theme-companions-site/test/theme.test.mjs +4 -2
- package/packages/theme-floors-site/package.json +17 -6
- package/packages/theme-floors-site/src/harvest.json +4 -2
- package/packages/theme-floors-site/src/index.js +7 -3
- package/packages/theme-floors-site/test/theme.test.mjs +4 -2
- package/packages/theme-fuelnfree-site/package.json +17 -6
- package/packages/theme-fuelnfree-site/src/harvest.json +4 -2
- package/packages/theme-fuelnfree-site/src/index.js +7 -3
- package/packages/theme-fuelnfree-site/test/theme.test.mjs +4 -2
- package/packages/theme-handyman-site/package.json +17 -6
- package/packages/theme-handyman-site/src/harvest.json +4 -2
- package/packages/theme-handyman-site/src/index.js +7 -3
- package/packages/theme-handyman-site/test/theme.test.mjs +4 -2
- package/packages/theme-insurance-site/package.json +17 -6
- package/packages/theme-insurance-site/src/harvest.json +4 -2
- package/packages/theme-insurance-site/src/index.js +7 -3
- package/packages/theme-insurance-site/test/theme.test.mjs +4 -2
- package/packages/theme-scenes/README.md +1 -1
- package/packages/theme-scenes/package.json +4 -3
- package/packages/theme-scenes/src/registry.js +187 -0
- package/packages/theme-shinshu-site/package.json +17 -6
- package/packages/theme-shinshu-site/src/harvest.json +4 -2
- package/packages/theme-shinshu-site/src/index.js +7 -3
- package/packages/theme-shinshu-site/test/theme.test.mjs +4 -2
- package/packages/work-graph/package.json +14 -4
- package/protocol/FILEMETA_V1.md +2 -2
- package/protocol/capabilities/manifest.json +1 -1
- package/protocol/database/agentsam.schema-pack.v1.schema.json +72 -0
- package/protocol/presets/catalog.json +2 -2
- package/protocol/theme-refinery/lineage-registry.json +105 -0
- package/protocol/theme-refinery/product-metadata.schema.json +21 -1
- package/skills/grok-auth/SKILL.md +110 -0
- package/skills/grok-auth/agentsam.skill.json +25 -0
- package/skills/grok-auth/references/grok-identity.md +64 -0
- package/skills/grok-auth/references/per-user-data.md +49 -0
- package/skills/grok-auth/references/prewired-and-env.md +54 -0
- package/skills/grok-auth/references/session-ui.md +133 -0
- package/skills/grok-auth/references/sign-in-methods.md +55 -0
- package/skills/grok-auth/references/wiring.md +71 -0
- package/skills/grok-building-games/SKILL.md +213 -0
- package/skills/grok-building-games/agentsam.skill.json +25 -0
- package/skills/grok-building-games/references/3d-libs.md +64 -0
- package/skills/grok-building-games/references/ai-pathfinding.md +122 -0
- package/skills/grok-building-games/references/audio.md +129 -0
- package/skills/grok-building-games/references/babylon.md +202 -0
- package/skills/grok-building-games/references/collision-physics.md +122 -0
- package/skills/grok-building-games/references/ecs-architecture.md +111 -0
- package/skills/grok-building-games/references/game-feel-juice.md +110 -0
- package/skills/grok-building-games/references/genres/board-card-chess.md +89 -0
- package/skills/grok-building-games/references/genres/endless-runner.md +83 -0
- package/skills/grok-building-games/references/genres/fps.md +105 -0
- package/skills/grok-building-games/references/genres/platformer-2d.md +97 -0
- package/skills/grok-building-games/references/genres/puzzle-match3-tetris.md +131 -0
- package/skills/grok-building-games/references/genres/racing-kart.md +106 -0
- package/skills/grok-building-games/references/genres/topdown-twin-stick.md +97 -0
- package/skills/grok-building-games/references/genres/tower-defense.md +84 -0
- package/skills/grok-building-games/references/genres/voxel-minecraft.md +89 -0
- package/skills/grok-building-games/references/input.md +139 -0
- package/skills/grok-building-games/references/phaser.md +277 -0
- package/skills/grok-building-games/references/procedural-generation.md +141 -0
- package/skills/grok-building-games/references/save-persistence.md +108 -0
- package/skills/grok-building-games/references/threejs-foundational.md +148 -0
- package/skills/grok-controls/SKILL.md +274 -0
- package/skills/grok-controls/agentsam.skill.json +25 -0
- package/skills/grok-design-ui/SKILL.md +122 -0
- package/skills/grok-design-ui/agentsam.skill.json +25 -0
- package/skills/grok-design-ui/references/animations.md +379 -0
- package/skills/grok-design-ui/references/performance.md +88 -0
- package/skills/grok-design-ui/references/refined-ui.md +384 -0
- package/skills/grok-design-ui/references/surfaces.md +247 -0
- package/skills/grok-design-ui/references/typography.md +123 -0
- package/skills/grok-game-animation-frames/SKILL.md +84 -0
- package/skills/grok-game-animation-frames/agentsam.skill.json +25 -0
- package/skills/grok-game-asset-core/SKILL.md +69 -0
- package/skills/grok-game-asset-core/agentsam.skill.json +25 -0
- package/skills/grok-game-character-consistency/SKILL.md +69 -0
- package/skills/grok-game-character-consistency/agentsam.skill.json +25 -0
- package/skills/grok-game-tilesets/SKILL.md +65 -0
- package/skills/grok-game-tilesets/agentsam.skill.json +25 -0
- package/skills/grok-game-ui-icons/SKILL.md +56 -0
- package/skills/grok-game-ui-icons/agentsam.skill.json +25 -0
- package/skills/grok-generate2dmap/LICENSE +21 -0
- package/skills/grok-generate2dmap/SKILL.md +120 -0
- package/skills/grok-generate2dmap/SOURCE.md +6 -0
- package/skills/grok-generate2dmap/agentsam.skill.json +25 -0
- package/skills/grok-generate2dmap/references/deliverables.md +101 -0
- package/skills/grok-generate2dmap/references/layered-map-contract.md +209 -0
- package/skills/grok-generate2dmap/references/map-strategies.md +341 -0
- package/skills/grok-generate2dmap/references/object-production-gate.md +24 -0
- package/skills/grok-generate2dmap/references/pipeline.md +149 -0
- package/skills/grok-generate2dmap/references/prop-pack-contract.md +174 -0
- package/skills/grok-generate2dmap/references/side-scroll-stages.md +29 -0
- package/skills/grok-generate2dmap/scripts/compose_layered_preview.py +157 -0
- package/skills/grok-generate2dmap/scripts/extract_prop_pack.py +369 -0
- package/skills/grok-generate2dsprite/LICENSE +21 -0
- package/skills/grok-generate2dsprite/SKILL.md +313 -0
- package/skills/grok-generate2dsprite/SOURCE.md +6 -0
- package/skills/grok-generate2dsprite/agentsam.skill.json +25 -0
- package/skills/grok-generate2dsprite/references/modes.md +124 -0
- package/skills/grok-generate2dsprite/references/prompt-rules.md +315 -0
- package/skills/grok-generate2dsprite/scripts/generate2dsprite.py +1031 -0
- package/skills/grok-generate2dsprite/scripts/make_layout_guide.py +109 -0
- package/skills/grok-imagine/SKILL.md +201 -0
- package/skills/grok-imagine/agentsam.skill.json +25 -0
- package/skills/grok-multiplayer-p2p/SKILL.md +111 -0
- package/skills/grok-multiplayer-p2p/agentsam.skill.json +25 -0
- package/skills/grok-multiplayer-p2p/references/react-binding.md +144 -0
- package/skills/grok-multiplayer-p2p/references/signaling-relay.md +269 -0
- package/skills/grok-neon/SKILL.md +157 -0
- package/skills/grok-neon/agentsam.skill.json +25 -0
- package/skills/grok-og/SKILL.md +102 -0
- package/skills/grok-og/agentsam.skill.json +25 -0
- package/skills/grok-og/references/brand-pass.md +53 -0
- package/skills/grok-og/references/custom-card.md +107 -0
- package/skills/grok-og/references/favicon-and-icons.md +48 -0
- package/skills/grok-og/references/og-type-contract.md +18 -0
- package/skills/grok-og/references/placeholder-card.md +21 -0
- package/skills/grok-og/references/x-banner.md +41 -0
- package/skills/grok-threejs/SKILL.md +67 -0
- package/skills/grok-threejs/agentsam.skill.json +25 -0
- package/skills/grok-threejs/references/llms-full.txt +2780 -0
- package/skills/grok-video2dsprite/LICENSE +21 -0
- package/skills/grok-video2dsprite/SKILL.md +236 -0
- package/skills/grok-video2dsprite/SOURCE.md +6 -0
- package/skills/grok-video2dsprite/agentsam.skill.json +25 -0
- package/skills/grok-video2dsprite/references/pipeline.md +90 -0
- package/skills/grok-video2dsprite/references/prompt-rules.md +63 -0
- package/skills/grok-video2dsprite/scripts/video2dsprite.py +490 -0
- package/skills/grok-xai-api/SKILL.md +152 -0
- package/skills/grok-xai-api/agentsam.skill.json +25 -0
- package/src/cli/command-catalog.js +46 -4
- package/src/cli/dispatch.js +1 -0
- package/src/cli.js +10 -0
- package/src/cloudflare/runtime-status.js +2 -1
- package/src/commands/autorag.js +67 -13
- package/src/commands/cheat-sheet.js +29 -4
- package/src/commands/codebaseindex.js +45 -2
- package/src/commands/knowledge.js +59 -2
- package/src/commands/machine-binary.js +103 -0
- package/src/commands/machine.js +137 -0
- package/src/commands/security.js +67 -4
- package/src/commands/setup.js +33 -16
- package/src/commands/status.js +8 -1
- package/src/features/resolve.js +1 -0
- package/src/knowledge/engine.js +21 -2
- package/src/knowledge/runtime-discovery.js +127 -0
- package/src/lib/identity-scaffold.js +53 -13
- package/src/lib/setup/recipes.js +1 -1
- package/src/models/discovery.js +40 -22
- package/src/models/inventory-core.d.ts +105 -0
- package/src/models/inventory-core.js +54 -6
- package/src/security/logs.js +3 -0
- package/src/ui/cli/help.js +41 -0
- package/test/apps-scaffold-contract.test.mjs +3 -2
- package/test/cli/api-key-env-whoami.test.mjs +2 -2
- package/test/cli/catalog-authority.test.mjs +64 -0
- package/test/cli/machine-command.test.mjs +34 -0
- package/test/fixtures/project-authority/customer-app/.agentsam/app.json +5 -0
- package/test/fixtures/project-authority/customer-app/apps/my-product/index.ts +1 -0
- package/test/fixtures/project-authority/customer-app/wrangler.toml +17 -0
- package/test/integration/autorag-project-authority.integration.test.mjs +51 -0
- package/test/integration/autorag-runtime-discovery.test.mjs +107 -0
- package/test/integration/cms-app-scaffold.test.mjs +37 -31
- package/test/integration/cms-site-tenancy-contract.test.mjs +28 -17
- package/test/integration/codebaseindex-ingest.test.mjs +41 -0
- package/test/integration/database-hosted-honesty.test.mjs +49 -0
- package/test/integration/desktop-keychain-boundary.test.mjs +45 -0
- package/test/integration/hosted-work-host-authority.test.mjs +47 -0
- package/test/integration/inventory-eligibility.test.mjs +59 -0
- package/test/integration/local-provider-bridge.test.mjs +65 -0
- package/test/integration/local-studio-settings-production.test.mjs +40 -0
- package/test/integration/lockfile-sync.test.mjs +26 -0
- package/test/integration/provider-env-cli.test.mjs +13 -3
- package/test/integration/runtime-status.integration.test.mjs +16 -1
- package/test/integration/theme-package-registry.test.mjs +31 -0
- package/test/repository-snapshot-view.test.mjs +2 -2
- package/test/security.test.mjs +14 -0
- package/test/terminal-machine-identity.test.mjs +2 -2
- package/apps/client-cms-editor/backend/src/demo-bootstrap.ts +0 -145
- package/packages/agentsam-nav/dist/Nav.d.ts +0 -43
- package/packages/agentsam-nav/dist/NavCollapsible.d.ts +0 -10
- package/packages/agentsam-nav/dist/NavContent.d.ts +0 -2
- package/packages/agentsam-nav/dist/NavFooter.d.ts +0 -2
- package/packages/agentsam-nav/dist/NavGroup.d.ts +0 -3
- package/packages/agentsam-nav/dist/NavHeader.d.ts +0 -2
- package/packages/agentsam-nav/dist/NavMenu.d.ts +0 -22
- package/packages/agentsam-nav/dist/NavProvider.d.ts +0 -35
- package/packages/agentsam-nav/dist/NavTrigger.d.ts +0 -2
- package/packages/agentsam-nav/dist/Surfaces.d.ts +0 -41
- package/packages/agentsam-nav/dist/browser.d.ts +0 -11
- package/packages/agentsam-nav/dist/browser.global.js +0 -132
- package/packages/agentsam-nav/dist/browser.js +0 -613
- package/packages/agentsam-nav/dist/contracts.d.ts +0 -76
- package/packages/agentsam-nav/dist/index.d.ts +0 -11
- package/packages/agentsam-nav/dist/index.js +0 -614
- package/packages/agentsam-nav/dist/legacy.css +0 -83
- package/packages/agentsam-nav/dist/shell.css +0 -113
- package/packages/agentsam-nav/dist/theme.css +0 -113
- package/packages/agentsam-nav/dist/utils.d.ts +0 -1
- package/packages/agentsam-repository/src/goap.js.bak-20260922011251 +0 -670
|
@@ -2,10 +2,12 @@ import assert from 'node:assert/strict';
|
|
|
2
2
|
import test from 'node:test';
|
|
3
3
|
import { createTheme, createProductRow } from '../src/index.js';
|
|
4
4
|
|
|
5
|
-
test('shinshu-site theme package exports installable contract', () => {
|
|
5
|
+
test('shinshu-site theme package exports harvested (not installable) contract', () => {
|
|
6
6
|
const theme = createTheme();
|
|
7
7
|
assert.equal(theme.slug, "shinshu-site");
|
|
8
|
-
assert.equal(theme.installable,
|
|
8
|
+
assert.equal(theme.installable, false);
|
|
9
|
+
assert.equal(theme.lineage, "shin");
|
|
10
|
+
assert.equal(theme.family, "consulting-portfolio");
|
|
9
11
|
assert.equal(theme.package, "@inneranimalmedia/theme-shinshu-site");
|
|
10
12
|
assert.ok(Array.isArray(theme.pages));
|
|
11
13
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@inneranimalmedia/work-graph",
|
|
3
|
-
"version": "
|
|
4
|
-
"private": true,
|
|
2
|
+
"name": "@inneranimalmedia/agentsam-work-graph",
|
|
3
|
+
"version": "2.6.7",
|
|
5
4
|
"description": "Core AgentSam work-graph primitive: one graph model (WorkItem, Dependency, TimelineEvent, Artifact, Evidence, Actor) powering an engineering adapter (git/MCP/tests/deploys) and a business adapter (projects/clients/approvals/milestones), with Gantt/timeline rendering as a pure projection over the graph rather than its own source of truth.",
|
|
6
5
|
"type": "module",
|
|
7
6
|
"main": "./src/index.js",
|
|
@@ -15,5 +14,16 @@
|
|
|
15
14
|
},
|
|
16
15
|
"scripts": {
|
|
17
16
|
"test": "node --test test/*.test.mjs"
|
|
18
|
-
}
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/SamPrimeaux/agentsam-sdk.git",
|
|
24
|
+
"directory": "packages/work-graph"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"src"
|
|
28
|
+
]
|
|
19
29
|
}
|
package/protocol/FILEMETA_V1.md
CHANGED
|
@@ -36,7 +36,7 @@ Semantic entries correspond one-for-one with non-directory content entries and r
|
|
|
36
36
|
"size": 213,
|
|
37
37
|
"mode": 420,
|
|
38
38
|
"hash": "sha256:...",
|
|
39
|
-
"package": "@inneranimalmedia/agentsam-
|
|
39
|
+
"package": "@inneranimalmedia/agentsam-identity",
|
|
40
40
|
"package_root": "packages/identity",
|
|
41
41
|
"package_kind": "library",
|
|
42
42
|
"system": "identity",
|
|
@@ -70,7 +70,7 @@ A package may declare stable package-level semantics without tagging every file:
|
|
|
70
70
|
|
|
71
71
|
```json
|
|
72
72
|
{
|
|
73
|
-
"name": "@inneranimalmedia/agentsam-
|
|
73
|
+
"name": "@inneranimalmedia/agentsam-identity",
|
|
74
74
|
"agentsam": {
|
|
75
75
|
"system": "identity",
|
|
76
76
|
"kind": "library",
|
|
@@ -481,7 +481,7 @@
|
|
|
481
481
|
"version": 1,
|
|
482
482
|
"domain": "theme",
|
|
483
483
|
"runtime": "node",
|
|
484
|
-
"package": "@inneranimalmedia/heuristic
|
|
484
|
+
"package": "@inneranimalmedia/theme-heuristic",
|
|
485
485
|
"export": "createStorefrontShellTheme",
|
|
486
486
|
"description": "Resolve the stock AgentSam CMS storefront shell theme contract.",
|
|
487
487
|
"deterministic": true,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://agentsam.dev/protocol/database/agentsam.schema-pack.v1.schema.json",
|
|
4
|
+
"title": "AgentSam schema pack family manifest",
|
|
5
|
+
"description": "Generic reusable contract for product schema packs (Identity, CMS, CAD, …). Packs own their manifests; this schema is protocol authority.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": true,
|
|
8
|
+
"required": ["schema", "id", "version", "components"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"schema": { "const": "agentsam.schema-pack.v1" },
|
|
11
|
+
"id": { "type": "string", "minLength": 1 },
|
|
12
|
+
"version": { "type": "string", "minLength": 1 },
|
|
13
|
+
"pack_family": { "type": "string", "minLength": 1 },
|
|
14
|
+
"components": {
|
|
15
|
+
"type": "array",
|
|
16
|
+
"minItems": 1,
|
|
17
|
+
"items": { "type": "string", "minLength": 1 }
|
|
18
|
+
},
|
|
19
|
+
"component_dependencies": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"additionalProperties": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"items": { "type": "string" }
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"adapters": {
|
|
27
|
+
"type": "array",
|
|
28
|
+
"items": { "type": "string", "minLength": 1 }
|
|
29
|
+
},
|
|
30
|
+
"sql": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"properties": {
|
|
33
|
+
"portable_dir": { "type": "string" },
|
|
34
|
+
"files": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"additionalProperties": {
|
|
37
|
+
"type": "array",
|
|
38
|
+
"items": { "type": "string" }
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"apply_order_fresh": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"items": { "type": "string" }
|
|
44
|
+
},
|
|
45
|
+
"apply_order_upgrade_v1_to_v2": {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"items": { "type": "string" }
|
|
48
|
+
},
|
|
49
|
+
"optional_after_core": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": { "type": "string" }
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"tables": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"additionalProperties": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": { "type": "string" }
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"table_patterns": {
|
|
63
|
+
"type": "array",
|
|
64
|
+
"items": { "type": "string" }
|
|
65
|
+
},
|
|
66
|
+
"seed_policy": { "type": "string" },
|
|
67
|
+
"compatibility": { "type": "object" },
|
|
68
|
+
"recovery": { "type": "object" },
|
|
69
|
+
"owner": { "type": "string" },
|
|
70
|
+
"notes": { "type": "string" }
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"composer": "agentsam.mini-composer"
|
|
55
55
|
},
|
|
56
56
|
"packages": {
|
|
57
|
-
"theme": "@inneranimalmedia/heuristic
|
|
57
|
+
"theme": "@inneranimalmedia/theme-heuristic",
|
|
58
58
|
"composer": "@inneranimalmedia/agentsam-workbench",
|
|
59
59
|
"analytics": "@inneranimalmedia/commerce-analytics"
|
|
60
60
|
},
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"capabilities": [
|
|
129
129
|
"theme.storefront.shell"
|
|
130
130
|
],
|
|
131
|
-
"description": "Stock storefront theme selection — default package @inneranimalmedia/heuristic
|
|
131
|
+
"description": "Stock storefront theme selection — default package @inneranimalmedia/theme-heuristic (theme.storefront.shell). Theme is a projection of Brand, not brand authority."
|
|
132
132
|
},
|
|
133
133
|
"brand": {
|
|
134
134
|
"id": "brand",
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "agentsam.theme-refinery.lineage.v1",
|
|
3
|
+
"note": "Donor evidence stays private. Package identity uses lineage codes until remaster gates pass. installable=false until PACKAGE-READY.",
|
|
4
|
+
"lineages": {
|
|
5
|
+
"fnf": {
|
|
6
|
+
"display": "FNF",
|
|
7
|
+
"family": "editorial-commerce",
|
|
8
|
+
"donor": "fuelnfreetime",
|
|
9
|
+
"donor_display": "Fuel & Free Time",
|
|
10
|
+
"package_current": "@inneranimalmedia/theme-fuelnfree-site",
|
|
11
|
+
"package_target": "@inneranimalmedia/theme-ember",
|
|
12
|
+
"gallery_slug": "fuelnfree-site",
|
|
13
|
+
"status": "needs_normalization",
|
|
14
|
+
"installable": false,
|
|
15
|
+
"canonical_id": "ember"
|
|
16
|
+
},
|
|
17
|
+
"afm": {
|
|
18
|
+
"display": "AFM",
|
|
19
|
+
"family": "service-gallery",
|
|
20
|
+
"donor": "anything-floors",
|
|
21
|
+
"donor_display": "Anything Floors & More",
|
|
22
|
+
"package_current": "@inneranimalmedia/theme-floors-site",
|
|
23
|
+
"package_target": "@inneranimalmedia/theme-grove",
|
|
24
|
+
"gallery_slug": "floors-site",
|
|
25
|
+
"status": "needs_normalization",
|
|
26
|
+
"installable": false,
|
|
27
|
+
"canonical_id": "grove"
|
|
28
|
+
},
|
|
29
|
+
"phs": {
|
|
30
|
+
"display": "PHS",
|
|
31
|
+
"family": "trade-services",
|
|
32
|
+
"donor": "primeaux-handyman",
|
|
33
|
+
"donor_display": "Primeaux Handyman Services",
|
|
34
|
+
"package_current": "@inneranimalmedia/theme-handyman-site",
|
|
35
|
+
"package_target": "@inneranimalmedia/theme-forge",
|
|
36
|
+
"gallery_slug": "handyman-site",
|
|
37
|
+
"status": "needs_normalization",
|
|
38
|
+
"installable": false,
|
|
39
|
+
"canonical_id": "forge"
|
|
40
|
+
},
|
|
41
|
+
"nic": {
|
|
42
|
+
"display": "NIC",
|
|
43
|
+
"family": "community-faith",
|
|
44
|
+
"donor": "new-iberia-church",
|
|
45
|
+
"donor_display": "New Iberia Church of Christ",
|
|
46
|
+
"package_current": "@inneranimalmedia/theme-church-site",
|
|
47
|
+
"package_target": "@inneranimalmedia/theme-cypress",
|
|
48
|
+
"gallery_slug": "church-site",
|
|
49
|
+
"status": "needs_normalization",
|
|
50
|
+
"installable": false,
|
|
51
|
+
"canonical_id": "cypress"
|
|
52
|
+
},
|
|
53
|
+
"coc": {
|
|
54
|
+
"display": "COC",
|
|
55
|
+
"family": "nonprofit-campaign",
|
|
56
|
+
"donor": "companions-of-caddo",
|
|
57
|
+
"donor_display": "Companions of Caddo",
|
|
58
|
+
"package_current": "@inneranimalmedia/theme-companions-site",
|
|
59
|
+
"package_target": "@inneranimalmedia/theme-violet",
|
|
60
|
+
"gallery_slug": "companions-site",
|
|
61
|
+
"status": "needs_normalization",
|
|
62
|
+
"installable": false,
|
|
63
|
+
"canonical_id": "violet"
|
|
64
|
+
},
|
|
65
|
+
"cci": {
|
|
66
|
+
"display": "CCI",
|
|
67
|
+
"family": "professional-leadgen",
|
|
68
|
+
"donor": "chrystal-clear-insurance",
|
|
69
|
+
"donor_display": "Chrystal Clear Insurance",
|
|
70
|
+
"package_current": "@inneranimalmedia/theme-insurance-site",
|
|
71
|
+
"package_target": "@inneranimalmedia/theme-harbor",
|
|
72
|
+
"gallery_slug": "insurance-site",
|
|
73
|
+
"status": "needs_normalization",
|
|
74
|
+
"installable": false,
|
|
75
|
+
"canonical_id": "harbor"
|
|
76
|
+
},
|
|
77
|
+
"shin": {
|
|
78
|
+
"display": "SHIN",
|
|
79
|
+
"family": "consulting-portfolio",
|
|
80
|
+
"donor": "shinshu-solutions",
|
|
81
|
+
"donor_display": "Shinshu Solutions",
|
|
82
|
+
"package_current": "@inneranimalmedia/theme-shinshu-site",
|
|
83
|
+
"package_target": "@inneranimalmedia/theme-summit",
|
|
84
|
+
"gallery_slug": "shinshu-site",
|
|
85
|
+
"status": "needs_normalization",
|
|
86
|
+
"installable": false,
|
|
87
|
+
"canonical_id": "summit"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"stages": [
|
|
91
|
+
"raw",
|
|
92
|
+
"harvested",
|
|
93
|
+
"needs_normalization",
|
|
94
|
+
"normalized",
|
|
95
|
+
"remastered",
|
|
96
|
+
"package_ready",
|
|
97
|
+
"published"
|
|
98
|
+
],
|
|
99
|
+
"pipeline": [
|
|
100
|
+
"agentsam-machine (inventory/types/parse/literal edges/assets/cache)",
|
|
101
|
+
"agentsam-brand (tokens/ingest/optimize/receipts)",
|
|
102
|
+
"theme-scenes + CMS contracts (shell/sections/pages)",
|
|
103
|
+
"refinery UI (keep / use primitive / ignore)"
|
|
104
|
+
]
|
|
105
|
+
}
|
|
@@ -11,7 +11,27 @@
|
|
|
11
11
|
"harvest_batch": { "type": "string" },
|
|
12
12
|
"normalization_state": {
|
|
13
13
|
"type": "string",
|
|
14
|
-
"enum": [
|
|
14
|
+
"enum": [
|
|
15
|
+
"fingerprinted",
|
|
16
|
+
"harvested",
|
|
17
|
+
"needs_normalization",
|
|
18
|
+
"scaffolded",
|
|
19
|
+
"portable",
|
|
20
|
+
"portable-preview",
|
|
21
|
+
"normalized",
|
|
22
|
+
"remastered",
|
|
23
|
+
"package_ready",
|
|
24
|
+
"wired",
|
|
25
|
+
"promoted"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"lineage": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "Short remaster codename (fnf, afm, phs, …). Not the customer/donor product name."
|
|
31
|
+
},
|
|
32
|
+
"family": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Generic reusable family (editorial-commerce, service-gallery, …)."
|
|
15
35
|
},
|
|
16
36
|
"source_hash": { "type": "string" },
|
|
17
37
|
"app_manifest": { "type": "string" },
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: auth
|
|
3
|
+
description: >
|
|
4
|
+
Add user accounts and sign-in to this TanStack Start app. Use when the app
|
|
5
|
+
needs authentication, sign-in, user accounts, protected routes, or per-user
|
|
6
|
+
data. Triggers on "auth", "login", "log in", "sign in", "sign up", "account",
|
|
7
|
+
"users", "authentication", "protected", "who is logged in", "current user",
|
|
8
|
+
"per-user".
|
|
9
|
+
metadata:
|
|
10
|
+
short-description: "Auth via the Grok broker (Google, X) or local email/password — no other methods supported"
|
|
11
|
+
user-invocable: false
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Auth
|
|
15
|
+
|
|
16
|
+
This app runs its **own** [Better Auth](https://better-auth.com) at
|
|
17
|
+
`/api/auth/*`, federating to the shared **Grok auth broker** (`auth.grok.me`)
|
|
18
|
+
via the `genericOAuth` plugin. This template wires **Google** and **X**.
|
|
19
|
+
|
|
20
|
+
**Supported sign-in methods — use ONLY these three; nothing else is supported:
|
|
21
|
+
Google, X, and email/password.** No other social/OAuth provider (GitHub, Apple,
|
|
22
|
+
Discord, …), no magic links, passkeys, OTP, phone/SMS, or anonymous sign-in. Do
|
|
23
|
+
not add entries to `GROK_PROVIDERS`. Method detail and the email/password switch
|
|
24
|
+
(edit **only** `src/lib/auth/email-password.ts`): `references/sign-in-methods.md`.
|
|
25
|
+
**Exception — gate viewers are signed in already; NEVER render login/re-auth
|
|
26
|
+
buttons for them. Connector / app-data apps: ONLY gate "Continue with Grok",
|
|
27
|
+
no Google/X buttons**: `references/grok-identity.md`.
|
|
28
|
+
|
|
29
|
+
**Sign-in is OFF by default** — the template ships `.grok/app-env.json` with
|
|
30
|
+
`{"VITE_AUTH_ENABLED": "false"}`, so only add accounts when the ask calls for
|
|
31
|
+
them (AGENTS.md §0.5). Switching it on is "Turning sign-in on" below.
|
|
32
|
+
|
|
33
|
+
**Once on, sign-in is REAL — including in the sandbox live preview.** Do **NOT**
|
|
34
|
+
scaffold demo/mock/hardcoded users. Preview: popup + baked preview client;
|
|
35
|
+
deployed: per-app client + `DATABASE_URL` + zero-click gate sign-in
|
|
36
|
+
(`references/prewired-and-env.md`).
|
|
37
|
+
|
|
38
|
+
**While OFF** (`VITE_AUTH_ENABLED=false`) a **dev user** is returned so a
|
|
39
|
+
non-auth app renders without a signed-in visitor — dev and preview only.
|
|
40
|
+
Deployed, the flag is the platform's (always `"true"`), so `requireUserId`
|
|
41
|
+
rejects every visitor — auth-off apps use neither it nor `authMiddleware`.
|
|
42
|
+
|
|
43
|
+
Everything is **preinstalled and pre-wired in `src/lib/auth/`** — do not
|
|
44
|
+
`npm install` anything; `better-auth` is the only auth package (never
|
|
45
|
+
`@neondatabase/*`, `@stackframe/*`, or `@clerk/*`). **Do not edit or rewrite any
|
|
46
|
+
file under `src/lib/auth/`** — `server.ts` least of all — except
|
|
47
|
+
`email-password.ts` for its one flag. Per-file map:
|
|
48
|
+
`references/prewired-and-env.md`.
|
|
49
|
+
|
|
50
|
+
**`/auth/popup` is already handled by the template Vite plugin**
|
|
51
|
+
(`vite.config.ts` → `popup.server.ts`): it never paints the React app. **Do NOT
|
|
52
|
+
create `src/routes/auth/popup.tsx`** (or any React page / client OAuth at that
|
|
53
|
+
path) — that shows the full app inside the popup, the common failure mode.
|
|
54
|
+
|
|
55
|
+
**Never write a `.env` / `.env.local` / `.env.example`** in this sandbox: live
|
|
56
|
+
preview needs **zero** env configuration and a deployed app gets its vars
|
|
57
|
+
injected by the platform. The knobs that exist are in
|
|
58
|
+
`references/prewired-and-env.md` — never expose a non-`VITE_` var to the client.
|
|
59
|
+
|
|
60
|
+
`migrations/auth/0001_auth.sql` is the Better Auth schema — **do not edit**. It
|
|
61
|
+
sits outside the globbed `migrations/` directory (neither applier descends), so
|
|
62
|
+
it is not applied to apps without sign-in; "Turning sign-in on" copies it up.
|
|
63
|
+
|
|
64
|
+
## Turning sign-in on
|
|
65
|
+
|
|
66
|
+
Do all of this — the routes alone render the disabled branch:
|
|
67
|
+
|
|
68
|
+
1. **Flag:** delete the `VITE_AUTH_ENABLED` key from `.grok/app-env.json` and
|
|
69
|
+
**restart the dev server**. Vite reads env at startup, so HMR will not pick
|
|
70
|
+
it up. `npm run dev`, `npm run build` and `npm run preview` all read that
|
|
71
|
+
file through `scripts/with-app-env.mjs`, so preview and the built output flip
|
|
72
|
+
together — never start Vite directly.
|
|
73
|
+
2. **Schema:** `cp migrations/auth/0001_auth.sql migrations/0001_auth.sql`, then
|
|
74
|
+
restart so it applies. It is tracked by basename in `_migrations`, so a
|
|
75
|
+
database that already has it will not re-run it.
|
|
76
|
+
3. **Routes:** add `src/routes/api/auth/$.ts` + `src/routes/login.tsx` — copy
|
|
77
|
+
both from `references/wiring.md` (the catch-all API route is what makes
|
|
78
|
+
`/api/auth/*` and the broker callback work).
|
|
79
|
+
4. **Sign out:** a login with no way out is not done — render `<UserButton />`
|
|
80
|
+
from `@/lib/auth/gates` (wires `signOut()`; hides sign-out for gate sessions).
|
|
81
|
+
5. **Existing data:** wrap the app's server functions in `authMiddleware` (an
|
|
82
|
+
auth-off app must not have been using it — see the `neon` skill). Rows from
|
|
83
|
+
before sign-in existed are **development data**: drop and recreate them
|
|
84
|
+
unless the user says otherwise — don't hand them to whoever signs in first.
|
|
85
|
+
|
|
86
|
+
## Building on it once it's on
|
|
87
|
+
|
|
88
|
+
- **Sign in / out:** `signIn(providerId)` and `signOut()` from
|
|
89
|
+
`@/lib/auth/client`; `GROK_PROVIDERS` renders the buttons. The popup,
|
|
90
|
+
bearer-token hand-off, and request attachment are internal — leave them alone.
|
|
91
|
+
Prefer `<UserButton />` (it handles the pending and failure states); `signOut()`
|
|
92
|
+
rejects when deployed if the server never confirms — catch it. Never
|
|
93
|
+
`authClient.signOut()`: it leaves the preview bearer token attached to every
|
|
94
|
+
later request, so the visitor stays signed in.
|
|
95
|
+
- **Reading the user:** `useCurrentUser()` is display-only (`null` means
|
|
96
|
+
*loading OR signed out*, so never redirect on it alone); guard on
|
|
97
|
+
`useCurrentUserState()`'s `isPending` instead. Gates (`SignedIn`, `SignedOut`,
|
|
98
|
+
`SignInGate`, `RedirectToSignIn`, `UserButton`) live in `@/lib/auth/gates`.
|
|
99
|
+
CTA hard rules, skeleton, and cookie-SSR zero-flash: `references/session-ui.md`.
|
|
100
|
+
- **Per-user data (mandatory):** every server function that touches per-user data
|
|
101
|
+
must use the prewired `authMiddleware` and scope every read **and** write to
|
|
102
|
+
`context.userId` — a Postgres driver has full DB access, so nothing else limits
|
|
103
|
+
the query. Keep `user_id` columns `TEXT`; never trust a client-supplied user id;
|
|
104
|
+
signed out, the middleware throws `UnauthorizedError` (401). Code and
|
|
105
|
+
disabled-mode semantics: `references/per-user-data.md`.
|
|
106
|
+
- **Security model:** headless broker, `__Host-` cookies + `trustedOrigins`, and
|
|
107
|
+
Fetch-Metadata sibling isolation are already wired — never weaken them to make
|
|
108
|
+
an error go away (`references/sign-in-methods.md` covers the model and the
|
|
109
|
+
"Invalid origin" fix).
|
|
110
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "agentsam.skill.v1",
|
|
3
|
+
"id": "grok-auth",
|
|
4
|
+
"name": "Grok \u00b7 auth",
|
|
5
|
+
"description": "Auth via the Grok broker (Google, X) or local email/password \u2014 no other methods supported",
|
|
6
|
+
"icon": "skill",
|
|
7
|
+
"slash": {
|
|
8
|
+
"suggested": "/grok-auth"
|
|
9
|
+
},
|
|
10
|
+
"instructions": {
|
|
11
|
+
"source": "local_file",
|
|
12
|
+
"ref": "SKILL.md"
|
|
13
|
+
},
|
|
14
|
+
"execution": {
|
|
15
|
+
"mode": "turn",
|
|
16
|
+
"tools": [],
|
|
17
|
+
"operations": [],
|
|
18
|
+
"capabilities": []
|
|
19
|
+
},
|
|
20
|
+
"provenance": {
|
|
21
|
+
"source": "apps/local-studio/.grok/skills",
|
|
22
|
+
"vendor": "grok",
|
|
23
|
+
"status": "imported"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Sign in with Grok (deployed apps — zero clicks)
|
|
2
|
+
|
|
3
|
+
Behind the edge gate, every proxied request from a signed-in Grok viewer
|
|
4
|
+
carries an unforgeable `x-grok-identity` JWT (EdDSA, minted per request; the
|
|
5
|
+
gate strips any client-supplied copy). The pre-wired `gateIdentitySessions`
|
|
6
|
+
plugin (`src/lib/auth/gate-session.server.ts`) verifies it against the gate's
|
|
7
|
+
JWKS (`/__gate/identity-key`, via `src/lib/auth/gate-identity.server.ts`) and,
|
|
8
|
+
when the app has no session yet, materializes the Better Auth session for that
|
|
9
|
+
viewer automatically — no sign-in button, no redirect, no broker round-trip.
|
|
10
|
+
`useSession` / `useCurrentUser` simply return the Grok user.
|
|
11
|
+
|
|
12
|
+
The broker OAuth flow is the **fallback** for anonymous/public viewers and for
|
|
13
|
+
contexts without the gate. The live preview gets the same zero-click identity
|
|
14
|
+
from the in-VM preview proxy at `http://127.0.0.1:6014` (preview tokens carry
|
|
15
|
+
audience `preview`); the popup mechanism remains the fallback there.
|
|
16
|
+
|
|
17
|
+
## Never render sign-in or re-auth UI to a gate viewer
|
|
18
|
+
|
|
19
|
+
A gate-authenticated viewer is **already signed in**, and the gate refreshes
|
|
20
|
+
connector tokens on every proxied request — **the platform has no re-auth
|
|
21
|
+
concept**. Never render "Re-auth with Grok", "Sign in again", "Refresh
|
|
22
|
+
session", or a standing "Continue with Grok" button: sign-in UI may appear
|
|
23
|
+
only in the `app-data` skill's `login` error state, after a connector call
|
|
24
|
+
actually returned `loginRequired: true`.
|
|
25
|
+
|
|
26
|
+
The live preview gets the same zero-click session, so a sign-in button visible
|
|
27
|
+
to the owner in the preview indicates a bug (a CTA rendered while the session
|
|
28
|
+
check was still pending, or rendered in reaction to a data error) — fix it,
|
|
29
|
+
don't restyle it. For any fallback sign-in surface use `<SignInGate>` from
|
|
30
|
+
`@/lib/auth/gates`: it renders sign-in UI only after the session check resolved
|
|
31
|
+
to no user, never during loading and never from a data error.
|
|
32
|
+
|
|
33
|
+
Sign-out is also a no-op for a gate session — the next request re-materializes
|
|
34
|
+
it from `x-grok-identity`, an instant sign-back-in loop. `<UserButton />`
|
|
35
|
+
already hides its sign-out control for gate sessions; never build a custom
|
|
36
|
+
sign-out (or any sign-out route/handler) for gate viewers.
|
|
37
|
+
|
|
38
|
+
## Files (pre-wired — do not edit)
|
|
39
|
+
|
|
40
|
+
| File | Role |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `gate-identity.server.ts` | Verifies the gate's `x-grok-identity` viewer JWT (EdDSA vs the gate JWKS; fail-closed). Server-only. |
|
|
43
|
+
| `gate-session.server.ts` | Better Auth plugin that turns a verified gate identity into the app session with zero clicks. Already registered in `server.ts`. |
|
|
44
|
+
|
|
45
|
+
## Env (deployer-injected)
|
|
46
|
+
|
|
47
|
+
| Var | Scope | Meaning |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| `GROK_PROJECT_ID` | server | deployed apps: enables "Sign in with Grok" (`x-grok-identity` audience check `app:<project_id>`) |
|
|
50
|
+
| `GROK_GATE_ORIGIN` | server | gate public origin override (JWKS + issuer pin); unset → preview mode (no `GROK_PROJECT_ID`) defaults to the in-VM proxy `http://127.0.0.1:6014` (audience `preview`), deployed mode derives it from the inbound host |
|
|
51
|
+
|
|
52
|
+
Deployed behavior: gate-authenticated viewers are signed in automatically from
|
|
53
|
+
`x-grok-identity`; the deployer also injects a per-app broker client +
|
|
54
|
+
`DATABASE_URL`, so the fallback sign-in persists identities in Postgres.
|
|
55
|
+
|
|
56
|
+
## Connector / app-data apps: gate sign-in only
|
|
57
|
+
|
|
58
|
+
When the `app-data` skill applies, the login page offers ONLY "Continue with
|
|
59
|
+
Grok" via the gate sign-in — the zero-click `x-grok-identity` session above, or
|
|
60
|
+
the gate-built `loginUrl` returned by a connector call. Do not wire Google/X
|
|
61
|
+
buttons for these apps: a broker login can mint an identity that is not the
|
|
62
|
+
gate viewer the connector data belongs to. The three-method rule applies to
|
|
63
|
+
apps without connector data. Still no new `GROK_PROVIDERS` entries, still never
|
|
64
|
+
edit `src/lib/auth/`.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Per-user data (server-side — mandatory)
|
|
2
|
+
|
|
3
|
+
Pair auth with the DB (see the `neon` skill). A regular Postgres driver has full
|
|
4
|
+
DB access, so **every** server function that touches per-user data must verify
|
|
5
|
+
the caller and scope rows to them. Use the prewired **`authMiddleware`**: it
|
|
6
|
+
resolves the same-origin session to a verified `context.userId` (and rejects
|
|
7
|
+
scripted cross-site/sibling requests) — no token threading:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { createServerFn } from "@tanstack/react-start";
|
|
11
|
+
import { getSql } from "@/lib/db";
|
|
12
|
+
import { authMiddleware } from "@/lib/auth/middleware";
|
|
13
|
+
|
|
14
|
+
export const listTodos = createServerFn({ method: "GET" })
|
|
15
|
+
.middleware([authMiddleware])
|
|
16
|
+
.handler(async ({ context }) => {
|
|
17
|
+
const sql = await getSql();
|
|
18
|
+
// Type the row shape — a server fn's return must be provably serializable.
|
|
19
|
+
return sql<{ id: number; title: string; done: boolean }>`select id, title, done from todos where user_id = ${context.userId} order by id desc`;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Inputs go through `.validator()` (the current API); the client passes `{ data }`:
|
|
23
|
+
export const addTodo = createServerFn({ method: "POST" })
|
|
24
|
+
.validator((title: string) => title.trim())
|
|
25
|
+
.middleware([authMiddleware])
|
|
26
|
+
.handler(async ({ context, data: title }) => {
|
|
27
|
+
if (!title) return;
|
|
28
|
+
const sql = await getSql();
|
|
29
|
+
await sql`insert into todos (user_id, title) values (${context.userId}, ${title})`;
|
|
30
|
+
});
|
|
31
|
+
// mutations must scope writes too: `... where id = ${id} and user_id = ${context.userId}`
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Call these from **client code** (effects, event handlers, React Query) — that's
|
|
35
|
+
where `Sec-Fetch-Site: same-origin` holds:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
useEffect(() => { listTodos().then(setTodos).catch(() => setTodos([])); }, []);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Semantics: signed out → the middleware throws `UnauthorizedError` (message
|
|
42
|
+
`"Unauthorized"`, `status` 401 — match it to send the visitor to sign-in), in the
|
|
43
|
+
live preview too (real auth). With auth disabled (`VITE_AUTH_ENABLED=false`) it
|
|
44
|
+
resolves the dev user (`"dev-user"`) in dev and preview only — the deployed flag
|
|
45
|
+
comes from the deployer (today always `"true"`), so deployed it rejects every
|
|
46
|
+
visitor — which is why an app without sign-in must not use the middleware at all
|
|
47
|
+
(see the `neon` skill). Keep `user_id` columns
|
|
48
|
+
`TEXT` (Better Auth uses text ids; the disabled dev user is `'dev-user'`). Never
|
|
49
|
+
trust a client-supplied user id — only the middleware / `requireUserId()` result.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# What's pre-wired, and the env vars
|
|
2
|
+
|
|
3
|
+
## `src/lib/auth/`
|
|
4
|
+
|
|
5
|
+
| File | Use it for |
|
|
6
|
+
|---|---|
|
|
7
|
+
| `client.ts` | Browser client. `signIn(providerId)`, `signOut()`, `authEnabled`, `GROK_PROVIDERS`. |
|
|
8
|
+
| `server.ts` | The Better Auth instance (server-only). **Do not edit or rewrite.** Import only from `/api/auth/$`. |
|
|
9
|
+
| `email-password.ts` | **Only** place to enable local email/password (`emailAndPasswordEnabled = true`). |
|
|
10
|
+
| `popup.server.ts` | Live-preview popup handler (server-only). Already wired by the Vite plugin — do not create a route for it. |
|
|
11
|
+
| `providers.ts` | `GROK_PROVIDERS` — the fixed broker upstream list (Google and X only; don't add others). |
|
|
12
|
+
| `use-current-user.ts` | `useCurrentUser()` / `useCurrentUserState()` React hooks. |
|
|
13
|
+
| `gates.tsx` | `SignedIn`, `SignedOut`, `RedirectToSignIn`, `UserButton`. |
|
|
14
|
+
| `middleware.ts` | `authMiddleware` for server functions → verified `context.userId`. |
|
|
15
|
+
| `verify.server.ts` | `requireUserId()` / `getSessionUser()` (server-only) for manual wiring. |
|
|
16
|
+
|
|
17
|
+
## How each mode gets its credentials
|
|
18
|
+
|
|
19
|
+
- **Live preview** (`*.grok-sandbox.com`): the app is an embedded iframe, so
|
|
20
|
+
sign-in opens a **popup** (a top-level redirect to the broker can't work inside
|
|
21
|
+
the iframe) and federates via a baked shared **preview client**
|
|
22
|
+
(`src/lib/auth/preview.ts`). The handler 302s straight to the broker/upstream
|
|
23
|
+
login; on return the popup posts the session bearer back in a tiny HTML page.
|
|
24
|
+
Sessions (and email/password users) persist in the app's embedded PGLite DB —
|
|
25
|
+
the SAME DB as app data — and, since the iframe's cookies are partitioned,
|
|
26
|
+
ride that bearer token; all of it lives in `src/lib/auth`.
|
|
27
|
+
Restarting the preview resets the DB.
|
|
28
|
+
- **Deployed**: the deployer injects a per-app client + `DATABASE_URL`, so
|
|
29
|
+
sign-in persists identities in Postgres.
|
|
30
|
+
|
|
31
|
+
## Env vars — do **not** create a `.env` file
|
|
32
|
+
|
|
33
|
+
**Never write a `.env` / `.env.local` / `.env.example` for auth (or anything
|
|
34
|
+
else) in this sandbox.** Live preview sign-in works out of the box with **zero**
|
|
35
|
+
env configuration: the server falls back to the baked preview client in
|
|
36
|
+
`src/lib/auth/preview.ts`, derives the `*.grok-sandbox.com` origin per-request,
|
|
37
|
+
mints a process-stable session secret, and persists sessions in embedded
|
|
38
|
+
PGLite. Deployed apps get `GROK_AUTH_*` / `BETTER_AUTH_*` / `DATABASE_URL`
|
|
39
|
+
injected by the platform — still not something you write into a file.
|
|
40
|
+
|
|
41
|
+
Optional process-env knobs (platform / rare overrides only — **do not** put
|
|
42
|
+
these in a file you create):
|
|
43
|
+
|
|
44
|
+
| Var | Where | Purpose |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `VITE_AUTH_ENABLED` | client | `"false"` in the shipped `.grok/app-env.json` (dev user); drop the key to turn sign-in ON. Only client-visible auth flag |
|
|
47
|
+
| `BETTER_AUTH_URL` | server | app's own public origin; unset in preview (origin is derived per-request) |
|
|
48
|
+
| `BETTER_AUTH_SECRET` | server | signs this app's own sessions (process-stable fallback in preview; survives HMR) |
|
|
49
|
+
| `GROK_AUTH_ISSUER` | server | the shared broker (defaults to `https://auth.grok.me`) |
|
|
50
|
+
| `GROK_AUTH_CLIENT_ID` / `GROK_AUTH_CLIENT_SECRET` | server | per-app client (falls back to the preview client) |
|
|
51
|
+
| `DATABASE_URL` | server | when deployed, Better Auth persists here (preview persists to the embedded PGLite — same DB as app data) |
|
|
52
|
+
|
|
53
|
+
Never expose a non-`VITE_` var to the client. The preview client id/secret live
|
|
54
|
+
server-only in `src/lib/auth/preview.ts`.
|