@inneranimalmedia/agentsam-sdk 2.4.1 → 2.6.0

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.
Files changed (233) hide show
  1. package/AGENTSAM.md +55 -0
  2. package/README.md +17 -12
  3. package/bin/agentsam +2 -0
  4. package/docs/AGENTSAM_ASTRA_OPENAI_INTEGRATION.md +1363 -0
  5. package/docs/AGENTSAM_WORKBENCH.md +30 -0
  6. package/docs/AUTH_IDENTITY_CONTRACT.md +52 -0
  7. package/docs/CAPABILITIES.md +5 -3
  8. package/docs/CLI_SHELL.md +167 -80
  9. package/docs/CMS_STUDIO.md +101 -0
  10. package/docs/CONTEXT.md +170 -0
  11. package/docs/LOCAL_OLLAMA.md +58 -0
  12. package/docs/MERKLE.md +19 -19
  13. package/docs/PORTABLE_CONTEXT.md +4 -3
  14. package/docs/PROJECT_CONFIG.md +72 -0
  15. package/docs/RELEASES.md +35 -2
  16. package/docs/REPOSITORY_INTELLIGENCE.md +1 -1
  17. package/docs/REPOSITORY_KNOWLEDGE.md +114 -0
  18. package/docs/SDK_WORKER.md +86 -0
  19. package/docs/SECURITY.md +59 -22
  20. package/docs/client-cms-editor.md +15 -0
  21. package/docs/local-studio/WORKMODE_DONOR_NOTES.md +485 -0
  22. package/package.json +35 -10
  23. package/packages/connectors/cloudflare/package.json +10 -0
  24. package/packages/connectors/cloudflare/src/index.js +127 -0
  25. package/packages/connectors/cloudflare/src/owner.js +76 -0
  26. package/packages/connectors/cloudflare/src/routes.js +223 -0
  27. package/packages/connectors/cloudflare/src/vault.js +80 -0
  28. package/packages/connectors/cloudflare/tests/connector.test.mjs +44 -0
  29. package/packages/identity/package.json +10 -1
  30. package/packages/identity/src/contracts/auth-config.js +109 -0
  31. package/packages/identity/src/index.js +1 -0
  32. package/packages/identity/src/oauth/README.md +2 -2
  33. package/packages/identity/src/oauth/credentials.js +11 -4
  34. package/packages/identity/src/oauth/iam-platform.js +3 -3
  35. package/packages/identity/src/providers/iam/index.js +7 -7
  36. package/packages/identity/src/providers/iam/oauth.js +6 -4
  37. package/packages/identity/src/providers/iam/profile.js +5 -5
  38. package/packages/identity/tests/auth-config.test.mjs +61 -0
  39. package/packages/identity/tests/oauth-credentials.test.mjs +13 -2
  40. package/protocol/FILEMETA_V1.md +95 -0
  41. package/protocol/INSPECT_VIEWS_V1.md +40 -0
  42. package/protocol/MERKLE_PERSISTENCE_V1.md +50 -0
  43. package/protocol/MERKLE_V1.md +3 -1
  44. package/protocol/README.md +1 -0
  45. package/protocol/capabilities/cloudflare-cpu-audit-input.schema.json +19 -0
  46. package/protocol/capabilities/cloudflare-cpu-profile-input.schema.json +13 -0
  47. package/protocol/capabilities/cloudflare-wrangler-native-input.schema.json +19 -0
  48. package/protocol/capabilities/manifest.json +79 -3
  49. package/protocol/capabilities/repository-snapshot.schema.json +1 -0
  50. package/protocol/context/context-budget.schema.json +36 -0
  51. package/protocol/context/context-item.schema.json +19 -0
  52. package/protocol/context/resolved-context-pack.schema.json +47 -0
  53. package/protocol/context/result-policy.schema.json +17 -0
  54. package/protocol/knowledge/context-pack.schema.json +33 -0
  55. package/protocol/knowledge/retrieval-query.schema.json +68 -13
  56. package/protocol/models/README.md +373 -0
  57. package/protocol/models/model-inventory-v2.schema.json +212 -0
  58. package/python/README.md +15 -7
  59. package/python/agentsam_sdk/cli.py +0 -21
  60. package/python/agentsam_sdk/tui/README.md +17 -12
  61. package/python/agentsam_sdk/tui/bootstrap.py +2 -2
  62. package/python/agentsam_sdk/tui/demo.py +25 -10
  63. package/python/agentsam_sdk/tui/onboarding.py +208 -0
  64. package/python/tests/test_tui_cli.py +7 -6
  65. package/skills/README.md +21 -0
  66. package/skills/agentsam-app-fundamentals/SKILL.md +165 -0
  67. package/skills/agentsam-app-fundamentals/references/graphs-contracts-ast-merkle.md +89 -0
  68. package/skills/agentsam-app-fundamentals/references/trust-credentials-and-destinations.md +99 -0
  69. package/skills/agentsam-cloudflare-workers/SKILL.md +53 -0
  70. package/skills/agentsam-cloudflare-workers/references/cpu-profiling.md +16 -0
  71. package/skills/agentsam-cloudflare-workers/references/errors-and-observability.md +29 -0
  72. package/skills/agentsam-cloudflare-workers/references/wrangler-native-map.md +28 -0
  73. package/skills/agentsam-jr-dev/SKILL.md +232 -0
  74. package/skills/agentsam-jr-dev/references/real-application-logic.md +156 -0
  75. package/skills/agentsam-jr-dev/references/web-application-fundamentals.md +240 -0
  76. package/skills/agentsam-progression-guard/SKILL.md +197 -0
  77. package/skills/agentsam-progression-guard/references/checkpoint-chain.md +111 -0
  78. package/skills/agentsam-progression-guard/references/hooks-operational-io.md +96 -0
  79. package/skills/catalog.json +71 -0
  80. package/src/agent/capability-adapter.js +25 -13
  81. package/src/agent/index.js +1 -0
  82. package/src/agent/responses-runner.js +325 -0
  83. package/src/capabilities/index.js +7 -0
  84. package/src/capabilities/repository-snapshot-view.js +238 -0
  85. package/src/capabilities/repository-snapshot.js +28 -14
  86. package/src/cli.js +198 -76
  87. package/src/cloudflare/cpu-profile.js +115 -0
  88. package/src/cloudflare/index.js +14 -0
  89. package/src/cloudflare/wrangler.js +132 -0
  90. package/src/commands/account-auth.js +47 -0
  91. package/src/commands/cloudflare.js +58 -0
  92. package/src/commands/connections.js +93 -0
  93. package/src/commands/context-economics.js +114 -0
  94. package/src/commands/context.js +14 -2
  95. package/src/commands/db.js +4 -7
  96. package/src/commands/deploy.js +54 -32
  97. package/src/commands/eval.js +63 -0
  98. package/src/commands/interactive.js +18 -0
  99. package/src/commands/knowledge.js +27 -4
  100. package/src/commands/merkle-persist.js +118 -0
  101. package/src/commands/merkle.js +32 -17
  102. package/src/commands/models.js +152 -0
  103. package/src/commands/ollama.js +259 -0
  104. package/src/commands/preferences.js +144 -0
  105. package/src/commands/product.js +86 -16
  106. package/src/commands/resume.js +67 -0
  107. package/src/commands/security.js +8 -6
  108. package/src/commands/shell.js +405 -100
  109. package/src/commands/skills.js +66 -0
  110. package/src/commands/start-local.js +1 -1
  111. package/src/commands/tunnel.js +5 -4
  112. package/src/commands/whoami.js +86 -0
  113. package/src/context/budget.js +120 -0
  114. package/src/context/compact.js +28 -0
  115. package/src/context/index.js +7 -0
  116. package/src/context/rehydrate.js +35 -0
  117. package/src/context/resolve.js +116 -0
  118. package/src/context/result-policy.js +66 -0
  119. package/src/errors/diagnostic.js +160 -0
  120. package/src/errors/index.js +9 -0
  121. package/src/eval/context.js +191 -0
  122. package/src/eval/index.js +1 -0
  123. package/src/index.js +70 -0
  124. package/src/indexing/execution-boundary.js +144 -0
  125. package/src/indexing/index.js +8 -0
  126. package/src/indexing/provider.js +41 -0
  127. package/src/knowledge/config.js +2 -2
  128. package/src/knowledge/context-pack.js +12 -1
  129. package/src/knowledge/contracts.js +9 -4
  130. package/src/knowledge/engine.js +7 -3
  131. package/src/knowledge/service/server.js +1 -1
  132. package/src/lib/account-session.js +98 -0
  133. package/src/lib/agent-instructions.js +73 -0
  134. package/src/lib/auth.js +4 -0
  135. package/src/lib/bridge-client.js +7 -5
  136. package/src/lib/cli-preferences.js +78 -0
  137. package/src/lib/core-client.js +8 -8
  138. package/src/lib/deploy/git-guard.js +69 -0
  139. package/src/lib/deploy/health.js +57 -0
  140. package/src/lib/deploy/local-studio.js +283 -0
  141. package/src/lib/deploy/secret-scan.js +65 -0
  142. package/src/lib/deploy-receipt/index.js +5 -2
  143. package/src/lib/detect-context.js +6 -5
  144. package/src/lib/execution-approvals.js +59 -0
  145. package/src/lib/identity-scaffold.js +1 -1
  146. package/src/lib/local-scaffold.js +35 -33
  147. package/src/lib/local-sessions.js +127 -0
  148. package/src/lib/local-status.js +9 -17
  149. package/src/lib/merkle/cloudflare-persistence.js +321 -0
  150. package/src/lib/merkle/filemeta.js +43 -0
  151. package/src/lib/merkle/git-ignore.js +24 -0
  152. package/src/lib/merkle/hash.js +1 -0
  153. package/src/lib/merkle/index.js +22 -0
  154. package/src/lib/merkle/persistence.js +72 -0
  155. package/src/lib/merkle/semantic.js +359 -0
  156. package/src/lib/merkle/snapshot.js +9 -3
  157. package/src/lib/merkle/tree.js +11 -6
  158. package/src/lib/project-config.js +227 -0
  159. package/src/lib/project-rules.js +68 -0
  160. package/src/lib/provider-credentials.js +83 -0
  161. package/src/lib/save-sdk-token.js +1 -1
  162. package/src/lib/scaffold/templates/worker-api/index.js +101 -20
  163. package/src/lib/scaffold/wizards/worker-api.js +27 -11
  164. package/src/lib/slash-commands.js +22 -15
  165. package/src/lib/tools.js +11 -5
  166. package/src/models/catalog.js +135 -0
  167. package/src/models/index.js +7 -0
  168. package/src/providers/index.js +5 -0
  169. package/src/providers/openai-responses.js +275 -0
  170. package/src/security/index.js +1 -0
  171. package/src/security/inventory.js +4 -1
  172. package/src/security/process.js +35 -9
  173. package/src/security/render.js +27 -5
  174. package/src/security/scan.js +24 -9
  175. package/src/security/trust-boundary.js +24 -0
  176. package/src/skills/index.js +64 -0
  177. package/src/telemetry/contracts.js +203 -0
  178. package/src/telemetry/events.js +48 -0
  179. package/src/telemetry/index.js +8 -0
  180. package/src/tools/hydrate.js +35 -0
  181. package/src/tools/index.js +2 -0
  182. package/src/tools/search.js +70 -0
  183. package/src/ui/ansi.js +1 -1
  184. package/src/ui/boot.js +54 -0
  185. package/src/ui/merkle/render.js +1 -0
  186. package/src/ui/runtime-activity.js +192 -0
  187. package/src/ui/theme.js +19 -18
  188. package/test/account-session.test.mjs +36 -0
  189. package/test/app-building-skills.test.mjs +61 -0
  190. package/test/apps-scaffold-contract.test.mjs +56 -0
  191. package/test/capabilities.test.mjs +53 -4
  192. package/test/cli-preferences.test.mjs +46 -0
  193. package/test/cloudflare-connector.test.mjs +96 -0
  194. package/test/cloudflare-runtime.test.mjs +75 -0
  195. package/test/context.test.mjs +144 -0
  196. package/test/deploy-health-scan.test.mjs +67 -0
  197. package/test/error-diagnostics.test.mjs +59 -0
  198. package/test/eval-context.test.mjs +37 -0
  199. package/test/execution-approvals.test.mjs +27 -0
  200. package/test/indexing-provider.test.mjs +29 -0
  201. package/test/jr-dev-skill.test.mjs +26 -0
  202. package/test/knowledge-context-pack.test.mjs +19 -0
  203. package/test/knowledge.test.mjs +1 -1
  204. package/test/local-sessions.test.mjs +42 -0
  205. package/test/local-studio-deploy.test.mjs +83 -0
  206. package/test/merkle-persistence.test.mjs +91 -0
  207. package/test/merkle.test.mjs +77 -3
  208. package/test/model-catalog.test.mjs +43 -0
  209. package/test/models.test.mjs +51 -0
  210. package/test/npm10-lock.test.mjs +29 -0
  211. package/test/ollama.test.mjs +94 -0
  212. package/test/openai-responses.test.mjs +95 -0
  213. package/test/project-config.test.mjs +81 -0
  214. package/test/project-rules.test.mjs +44 -0
  215. package/test/provider-credentials.test.mjs +52 -0
  216. package/test/rehydrate.test.mjs +25 -0
  217. package/test/release-hygiene.test.mjs +34 -0
  218. package/test/repository-snapshot-view.test.mjs +112 -0
  219. package/test/responses-runner.test.mjs +148 -0
  220. package/test/runtime-activity.test.mjs +98 -0
  221. package/test/sdk-worker-contract.test.mjs +68 -0
  222. package/test/security.test.mjs +46 -0
  223. package/test/shell.test.mjs +55 -21
  224. package/test/skills.test.mjs +22 -0
  225. package/test/smoke.mjs +5 -2
  226. package/test/telemetry.test.mjs +79 -0
  227. package/test/theme-portability.test.mjs +14 -0
  228. package/test/tools-search.test.mjs +40 -0
  229. package/test/whoami-resume.test.mjs +56 -0
  230. package/examples/agentsam-tui-ansi.mjs +0 -149
  231. package/src/commands/tui.js +0 -120
  232. package/src/ui/splash-xterm.js +0 -290
  233. package/src/ui/splash.js +0 -426
@@ -0,0 +1,485 @@
1
+ AgentSam Workmode ( agent reading this-- we will clone/repackage the build mentioned, RULES==== 1- this becomes a shell, but not a shallow placeholder. baseline- agentsam/cli packages come prebuilt in this app so user installing could get a local prebuilt agentsam editor. RULES- no hardcoded credentials ( remove my account info/urls etc )
2
+ ├─ src/
3
+ │ ├─ commands/
4
+ │ ├─ local-pty/
5
+ │ ├─ local-portal/
6
+ │ └─ ui/ GOAL======= WE FULLY BUILD OUT, an agent/ide ui/ux dashboard, local pty/cli use = default basic. if user chooses to use ai, they may be prompted to connect/deploy to cloudflare or github for secret encryption. once adding their api key and or scaffolding their repo/worker, the agentsam/ide = fully agentic automated code/web browsing multi agent orchistration system. tui/cli ui/ux = prebuilt into terminal ( dont even mention it, just design it so every in app user experience cli is clean/branded/interactive cli interactions.
7
+ Calm vibecode bench: persistent trails, helper chats, in-app browser, Monaco, xterm CLI, projects/artifacts, model picker, and GitHub / Cloudflare ship.
8
+
9
+ Repo: SamPrimeaux/AgentSam-Grok-Workmode
10
+ Account ID: ede6590ac0d2fb7daf155b35653457b2
11
+ Canonical D1: inneranimalmedia-business (cf87b717-d4e2-4cf8-bab0-a81268e32d49)
12
+ Product domain: https://simple.inneranimalmedia.com
13
+ UI Worker: agentsam-grok-workmode → https://agentsam-grok-workmode.meauxbility.workers.dev
14
+ Vault Worker: agentsam-workmode → https://agentsam-workmode.meauxbility.workers.dev
15
+ Vault on domain: GET https://simple.inneranimalmedia.com/health · /api/vault/*
16
+
17
+ What works today
18
+ Surface Behavior
19
+ Trails Left rail; persist in the browser
20
+ Helper chat Ephemeral side stage until you Keep trail
21
+ Browser Lookup without leaving the bench
22
+ Files / Monaco Agent-written code, editable
23
+ CLI `Ctrl+`` — git, vibe, wrangler helpers
24
+ Ship GitHub push + Cloudflare Pages via /api/github + /api/cloudflare
25
+ Tokens (interim) Plaintext localStorage (agentsam-ship-secrets) — replace with vault
26
+ Side chats stay ephemeral until kept. Shell fences in replies have a Run control that sends the command to the CLI.
27
+
28
+ Quick start (local)
29
+ npm install
30
+ npm run dev # preview on 0.0.0.0:8080
31
+ npm run typecheck
32
+ npm run build
33
+ Scaffold a new AgentSam product
34
+ Use the published SDK for a clean local project (identity + SQLite + CLI). This Workmode repo is the UI/template lane; the SDK is the portable scaffold lane.
35
+
36
+ # one-shot
37
+ npx @inneranimalmedia/agentsam-sdk init --name my-agent --yes
38
+ cd my-agent
39
+ npm install
40
+ npm run smoke
41
+ npm run dev
42
+
43
+ # or global CLI
44
+ npm install -g @inneranimalmedia/agentsam-sdk
45
+ agentsam init --name my-agent --yes
46
+ agentsam status
47
+ Optional: index an existing tree before wiring cloud ops.
48
+
49
+ agentsam init . --yes --include src,docs
50
+ agentsam index plan
51
+ agentsam index run
52
+ agentsam search "oauth vault secrets"
53
+ Docs: agentsam-sdk
54
+
55
+ Deploy / bind Cloudflare Worker + D1
56
+ Account + database (SSOT)
57
+ Binding Value
58
+ Account ID ede6590ac0d2fb7daf155b35653457b2
59
+ Account Inner Animal Media Cloudflare account
60
+ D1 name inneranimalmedia-business
61
+ D1 UUID cf87b717-d4e2-4cf8-bab0-a81268e32d49
62
+ Product host simple.inneranimalmedia.com
63
+ UI Worker agentsam-grok-workmode (SPA on /*)
64
+ Vault Worker agentsam-workmode (/health, /api/vault*)
65
+ workers.dev (UI) agentsam-grok-workmode.meauxbility.workers.dev
66
+ workers.dev (vault) agentsam-workmode.meauxbility.workers.dev
67
+ Copy the example Worker config:
68
+
69
+ cp wrangler.toml.example wrangler.toml
70
+ # live SSOT is wrangler.workmode.toml (account_id + domain routes baked in)
71
+ Auth for Wrangler (never commit tokens)
72
+ # preferred: OAuth login (interactive)
73
+ npx wrangler login
74
+
75
+ # or export a scoped API token in your shell only
76
+ export CLOUDFLARE_ACCOUNT_ID="ede6590ac0d2fb7daf155b35653457b2"
77
+ export CLOUDFLARE_API_TOKEN="<token-with-workers+d1>"
78
+ On the IAM Mac desk, prefer the monorepo env wrappers instead of pasting tokens into chat:
79
+
80
+ # from SamPrimeaux/inneranimalmedia
81
+ ./scripts/with-cloudflare-env.sh npx wrangler whoami
82
+ D1 inspect / one-off SQL (production DB)
83
+ Do not blindly migrations apply against production. Use reviewed one-off files (same rule as the platform deploy guide).
84
+
85
+ # list remote DBs
86
+ npx wrangler d1 list
87
+
88
+ # informational migration ledger
89
+ npx wrangler d1 migrations list inneranimalmedia-business --remote
90
+
91
+ # execute a reviewed SQL file against the business DB
92
+ npx wrangler d1 execute inneranimalmedia-business --remote \
93
+ --file=./migrations/workmode/<your-reviewed-migration>.sql
94
+
95
+ # ad-hoc read (example)
96
+ npx wrangler d1 execute inneranimalmedia-business --remote \
97
+ --command="SELECT name FROM sqlite_master WHERE name IN ('user_secrets','user_oauth_tokens','agentsam_user_ui_preferences');"
98
+ Worker secrets (vault + app)
99
+ # master key for AES-GCM vault (generate once; store only in CF Secrets)
100
+ openssl rand -base64 32 | npx wrangler secret put VAULT_MASTER_KEY
101
+
102
+ # optional aliases used by platform workers
103
+ npx wrangler secret put VAULT_KEY # same value if you keep one master
104
+ npx wrangler secret put BETTER_AUTH_SECRET
105
+ npx wrangler secret put XAI_API_KEY # server-only model calls
106
+ Deploy this Worker (vault API — live)
107
+ Entry: worker/index.js · config: wrangler.workmode.toml
108
+
109
+ # from IAM desk (credentials via .env.cloudflare wrapper)
110
+ ./scripts/with-cloudflare-env.sh npx wrangler deploy -c wrangler.workmode.toml
111
+
112
+ # secrets (once per account/script)
113
+ openssl rand -base64 32 | npx wrangler secret put VAULT_MASTER_KEY --name agentsam-workmode
114
+ openssl rand -hex 24 | npx wrangler secret put WORKMODE_API_KEY --name agentsam-workmode
115
+ Smoke (replace bearer + user):
116
+
117
+ curl -sS https://agentsam-workmode.meauxbility.workers.dev/health
118
+ curl -sS https://simple.inneranimalmedia.com/health
119
+
120
+ curl -sS -X POST https://simple.inneranimalmedia.com/api/vault/secrets \
121
+ -H "Authorization: Bearer $WORKMODE_API_KEY" \
122
+ -H "X-User-Id: au_…" \
123
+ -H "content-type: application/json" \
124
+ -d '{"service_name":"github","secret_name":"ship","value":"ghp_…"}'
125
+ Routes: GET/POST /api/vault/secrets, DELETE /api/vault/secrets/:id, POST /api/vault/unwrap (server-only).
126
+
127
+ For the full IAM platform (dashboard + R2 + Worker), use the monorepo ship lane — not a bare wrangler deploy from that repo:
128
+
129
+ # Mac operator desk (inneranimalmedia)
130
+ npm run deploy
131
+ # or
132
+ bin/agentsam deploy fast
133
+
134
+ # phone / GCP iam-tunnel (push; Cloudflare Builds does the heavy lift)
135
+ bash scripts/ship-remote.sh
136
+ See docs/DEPLOY_AND_AGENT_GUIDE.md in SamPrimeaux/inneranimalmedia.
137
+
138
+ GitHub Actions sketch (Worker)
139
+ # .github/workflows/deploy-worker.yml
140
+ name: Deploy Workmode Worker
141
+ on:
142
+ push:
143
+ branches: [main]
144
+ jobs:
145
+ deploy:
146
+ runs-on: ubuntu-latest
147
+ steps:
148
+ - uses: actions/checkout@v4
149
+ - uses: actions/setup-node@v4
150
+ with:
151
+ node-version: "22"
152
+ - run: npm ci && npm run build
153
+ - uses: cloudflare/wrangler-action@v3
154
+ with:
155
+ apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
156
+ accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
157
+ command: deploy -c wrangler.toml
158
+ Repo secrets: CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID only — never put user BYOK keys in Actions.
159
+
160
+ Encrypted secrets plan (required for Connect)
161
+ Status: planned / schema already exists on inneranimalmedia-business.
162
+ Interim: plaintext browser localStorage — not acceptable for multi-user or cross-device.
163
+
164
+ Full design: docs/SECRETS_VAULT_PLAN.md
165
+
166
+ Non-negotiables
167
+ Never store GitHub / Cloudflare / model API keys in localStorage, client state, or chat logs.
168
+ One vault lane: ciphertext in D1 (user_secrets, user_oauth_tokens, env_secrets); plaintext only in Worker memory at use-time.
169
+ OAuth preferred for GitHub + Cloudflare; paste-token is fallback that still goes through the vault encrypt path.
170
+ Decrypt only server-side for the authenticated user_id / tenant_id / workspace_id that owns the row.
171
+ Audit every read/write/rotate via secret_audit_log (last4 only in logs).
172
+ Existing tables (reuse — do not invent parallel vaults)
173
+ Table Role
174
+ user_secrets BYOK API keys (secret_value_encrypted, service_name, vault_secret_id)
175
+ user_oauth_tokens Provider tokens (access_token_encrypted / refresh_token_encrypted + vault ids)
176
+ env_secrets Worker/env registry (encrypted_d1 vs workers_secret)
177
+ secret_audit_log Rotate / use / revoke events
178
+ agentsam_user_ui_preferences Theme / accent / density JSON (non-secret)
179
+ oauth_providers Platform OAuth client config (client_secret_encrypted)
180
+ Crypto contract (Worker)
181
+ Algorithm: AES-256-GCM
182
+ Key: VAULT_MASTER_KEY (Worker secret, 32 bytes raw or base64)
183
+ Stored blob: base64(iv || ciphertext || tag) or separate iv column where the table already has one (env_secrets.iv)
184
+ AAD (optional but recommended): user_id:service_name:secret_name to bind ciphertext to owner
185
+ Connect UX (target)
186
+ Sign in → session carries verified user_id
187
+ Connect Cloudflare → OAuth (docs/auth/CLOUDFLARE_OAUTH_CLIENT_SCOPES.md in monorepo) → store tokens encrypted
188
+ Connect GitHub → GitHub App / OAuth → store tokens encrypted
189
+ BYOK API key → Settings form posts to /api/vault/secrets → encrypt → D1; UI shows masked last4 only
190
+ Ship / deploy / model routes resolve secrets by id, decrypt once, call provider, drop plaintext
191
+ Until Connect ships, Settings must keep warning that tokens are browser-local only.
192
+
193
+ Theme / prefs (non-secret)
194
+ Persist UI customization in agentsam_user_ui_preferences.ui_preferences_json keyed by (workspace_id, user_id):
195
+
196
+ {
197
+ "theme": "studio-dark",
198
+ "accent": "#c4a574",
199
+ "density": "comfortable",
200
+ "defaultModel": "grok-4-6"
201
+ }
202
+ Cache a copy locally for snappy paint; server row wins after sign-in.
203
+
204
+ Product direction (short)
205
+ Identity gate
206
+ Vault-backed Connect (CF + GitHub + BYOK)
207
+ Mobile single-pane shell
208
+ Theme prefs on D1
209
+ Agent run finalization / reliability
210
+ Package as agentsam-sdk workmode lane
211
+ Related
212
+ Platform deploy guide: SamPrimeaux/inneranimalmedia → docs/DEPLOY_AND_AGENT_GUIDE.md start-local should launch the Studio shell
213
+
214
+ I would change the mental model from:
215
+
216
+ agentsam start-local
217
+ → starts PTY
218
+
219
+ to:
220
+
221
+ agentsam start-local
222
+ → starts AgentSam Local
223
+
224
+ Underneath it starts several local capabilities:
225
+
226
+ AgentSam Local
227
+ │
228
+ ├─ HTTP portal
229
+ ├─ PTY WebSocket
230
+ ├─ project API
231
+ ├─ template catalog
232
+ ├─ preview server
233
+ └─ optional helper/chat bridge
234
+
235
+ Then terminal output:
236
+
237
+ Agent Sam Local
238
+
239
+ Project my-app
240
+ Studio http://127.0.0.1:3099
241
+ Terminal ready
242
+ Shell /bin/zsh
243
+
244
+ Press ENTER to open AgentSam.
245
+
246
+ Browser:
247
+
248
+ ┌─────────────────────────────────────────────────────┐
249
+ │ ● │
250
+ │ ◻ Studio │
251
+ │ ◇ │
252
+ │ ▣ Welcome back │
253
+ │ > │
254
+ │ What do you want to build? │
255
+ │ │
256
+ │ [ CMS ] [ App ] [ Data ] [ Agent ] │
257
+ │ │
258
+ │ ┌─────────────────────────────────┐ │
259
+ │ │ actual interactive preview │ │
260
+ │ │ │ │
261
+ │ └─────────────────────────────────┘ │
262
+ │ │
263
+ │ Preview Use template │
264
+ │ │
265
+ ├─────────────────────────────────────────────────────┤
266
+ │ Terminal ↑ │
267
+ └─────────────────────────────────────────────────────┘
268
+
269
+ Click the terminal button:
270
+
271
+ ┌─────────────────────────────────────────────────────┐
272
+ │ │
273
+ │ normal Studio │
274
+ │ │
275
+ ├─────────────────────────────────────────────────────┤
276
+ │ Terminal ─ □ x │
277
+ │ │
278
+ │ sam $ │
279
+ │ │
280
+ └─────────────────────────────────────────────────────┘
281
+
282
+ That matches what you’re describing much better than your second screenshot where CLI owns the entire viewport.
283
+
284
+ I’d make terminal drawer states:
285
+
286
+ closed
287
+ peek ~180px
288
+ half ~40vh
289
+ large ~70vh
290
+ fullscreen explicit only
291
+
292
+ On mobile:
293
+
294
+ closed
295
+ half
296
+ full
297
+
298
+ Same PTY underneath. No separate runtime.
299
+
300
+ Make each good preset a real mini app
301
+
302
+ Your instinct here is right.
303
+
304
+ The existing preset catalog currently mostly describes capabilities — fullstack, CMS, prototype, data — rather than actual visual products.
305
+
306
+ Upgrade the contract to connect a preset with an actual starter app:
307
+
308
+ {
309
+ "id": "cms",
310
+ "version": 2,
311
+ "lane": "cms",
312
+
313
+ "template": {
314
+ "app": "cms",
315
+ "scaffold": "generated/cms",
316
+ "preview": "cms"
317
+ },
318
+
319
+ "presentation": {
320
+ "title": "CMS Studio",
321
+ "description": "Content editing, assets and publishing.",
322
+ "category": "content",
323
+ "thumbnail": "/gallery/cms.webp"
324
+ },
325
+
326
+ "features": [
327
+ "cms",
328
+ "knowledge"
329
+ ],
330
+
331
+ "capabilities": [
332
+ "scaffold.create",
333
+ "repository.snapshot",
334
+ "knowledge.index",
335
+ "knowledge.search",
336
+ "site.scrape"
337
+ ]
338
+ }
339
+
340
+ Then the catalog becomes the joining point between:
341
+
342
+ visual card
343
+ │
344
+ ├─ preview
345
+ ├─ scaffold source
346
+ ├─ features
347
+ ├─ capabilities
348
+ └─ CLI preset ID
349
+
350
+ So:
351
+
352
+ click "Use CMS"
353
+
354
+ and:
355
+
356
+ agentsam create acme-site --preset cms
357
+
358
+ invoke the exact same backend function.
359
+
360
+ That's the architecture you want.
361
+
362
+ Preview them without creating them
363
+
364
+ This part would make the gallery feel dramatically better.
365
+
366
+ Build each apps/starters/* project to a static preview bundle:
367
+
368
+ apps/starters/cms
369
+ ↓ build
370
+ dist/gallery/cms/
371
+
372
+ Then AgentSam Local can mount it read-only:
373
+
374
+ http://127.0.0.1:3099/previews/cms/
375
+
376
+ and the gallery renders:
377
+
378
+ <iframe src="/previews/cms/">
379
+
380
+ So the user can actually click around a convincing app before scaffolding it.
381
+
382
+ That is much more useful than screenshots alone.
383
+
384
+ For starter types that need backend behavior, make the gallery build use demo/mock data:
385
+
386
+ CMS preview
387
+ ├─ sample posts
388
+ ├─ sample assets
389
+ └─ fake publish state
390
+
391
+ No credentials.
392
+
393
+ No database setup.
394
+
395
+ No deploy.
396
+
397
+ Just enough to communicate what they’re selecting.
398
+
399
+ Your existing minis still fit
400
+
401
+ Keep these:
402
+
403
+ mini/gadget
404
+ mini/page
405
+ mini/data
406
+
407
+ They already represent tiny zero-install examples.
408
+
409
+ But I’d establish tiers:
410
+
411
+ AgentSam catalog
412
+ │
413
+ ├─ Mini
414
+ │ ├─ focus timer
415
+ │ ├─ landing page
416
+ │ └─ JSON viewer
417
+ │
418
+ ├─ Starter
419
+ │ ├─ CMS
420
+ │ ├─ dashboard
421
+ │ ├─ agent workspace
422
+ │ └─ data explorer
423
+ │
424
+ └─ Stack
425
+ ├─ fullstack
426
+ ├─ CMS + knowledge
427
+ └─ data + knowledge
428
+
429
+ Users don’t need to know the internal distinction necessarily; it gives you a sane packaging model.
430
+
431
+ I would not publish every source app in the npm tarball
432
+
433
+ This is the other important piece.
434
+
435
+ Develop with:
436
+
437
+ apps/
438
+
439
+ but publish:
440
+
441
+ dist/local-studio/
442
+ templates/generated/
443
+ protocol/presets/catalog.json
444
+
445
+ The npm package does not need your entire dev source tree for every React starter.
446
+
447
+ So:
448
+
449
+ apps/* development SSOT
450
+ ↓ build
451
+ dist/gallery/* runtime previews
452
+ ↓ export
453
+ templates/* scaffold payload
454
+
455
+ That keeps AgentSam itself relatively lean.
456
+
457
+ You already have npm pack --dry-run verification, so add assertions such as:
458
+
459
+ ✓ local Studio bundle packaged
460
+ ✓ every catalog preset has a scaffold payload
461
+ ✓ every visual starter has preview assets
462
+ ✓ no node_modules in templates
463
+ ✓ no .env files
464
+ ✓ no .git directories
465
+ ✓ no source repo-specific IDs
466
+ My strongest recommended split
467
+ apps/
468
+ ├─ local-studio/ AgentSam's own localhost interface
469
+ └─ starters/ polished real example apps
470
+
471
+ templates/
472
+ └─ generated/ what gets copied onto users' disks
473
+
474
+ src/local-portal/ tiny Node server that serves Studio
475
+ src/local-pty/ PTY backend you already have
476
+
477
+ protocol/presets/ metadata joining all of it
478
+
479
+ Then agentsam start-local becomes the entrypoint to the whole local product, not “start a WebSocket and good luck.”
480
+
481
+ And your screenshot #1 is much closer to the right north star: keep the rail and workspace, make helper/chat optional, and move CLI into a bottom drawer rather than treating terminal as a destination page.
482
+ Cloudflare OAuth scopes: docs/auth/CLOUDFLARE_OAUTH_CLIENT_SCOPES.md
483
+ SDK: @inneranimalmedia/agentsam-sdk
484
+ Vault plan (this repo): docs/SECRETS_VAULT_PLAN.md
485
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneranimalmedia/agentsam-sdk",
3
- "version": "2.4.1",
3
+ "version": "2.6.0",
4
4
  "description": "Portable AgentSam SDK and CLI kits for local scaffolding, repository intelligence, incremental indexing, identity adapters, and verified dependency maintenance.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -32,6 +32,7 @@
32
32
  "./identity/contracts/session": "./packages/identity/src/contracts/session.js",
33
33
  "./identity/contracts/provider": "./packages/identity/src/contracts/provider.js",
34
34
  "./identity/contracts/external-identity": "./packages/identity/src/contracts/external-identity.js",
35
+ "./identity/contracts/auth-config": "./packages/identity/src/contracts/auth-config.js",
35
36
  "./identity/oauth/callback": "./packages/identity/src/oauth/callback.js",
36
37
  "./identity/oauth/finalize-inbound": "./packages/identity/src/oauth/finalize-inbound.js",
37
38
  "./identity/oauth/redirect-paths": "./packages/identity/src/oauth/redirect-paths.js",
@@ -45,23 +46,39 @@
45
46
  "./package.json": "./package.json",
46
47
  "./security": "./src/security/index.js",
47
48
  "./cad": "./src/lib/cad/index.js",
48
- "./cad-docker": "./src/lib/cad-docker.js"
49
+ "./cad-docker": "./src/lib/cad-docker.js",
50
+ "./context": "./src/context/index.js",
51
+ "./indexing": "./src/indexing/index.js",
52
+ "./tools": "./src/tools/index.js",
53
+ "./models": "./src/models/index.js",
54
+ "./telemetry": "./src/telemetry/index.js",
55
+ "./providers": "./src/providers/index.js",
56
+ "./errors": "./src/errors/index.js",
57
+ "./cloudflare": "./src/cloudflare/index.js",
58
+ "./eval": "./src/eval/index.js",
59
+ "./context/result-policy-schema": "./protocol/context/result-policy.schema.json",
60
+ "./context/budget-schema": "./protocol/context/context-budget.schema.json",
61
+ "./context/pack-schema": "./protocol/context/resolved-context-pack.schema.json",
62
+ "./skills": "./src/skills/index.js",
63
+ "./skills/catalog": "./skills/catalog.json"
49
64
  },
50
65
  "bin": {
51
- "agentsam": "src/cli.js",
52
- "agentsam-sdk": "src/cli.js",
66
+ "agentsam": "bin/agentsam",
67
+ "agentsam-sdk": "bin/agentsam",
53
68
  "agentsam-scaffold": "bin/scaffold.mjs",
54
69
  "agentsam-auth-portal": "packages/identity/scripts/preview-auth-portal.mjs"
55
70
  },
56
71
  "files": [
57
72
  "src",
58
73
  "packages/identity",
74
+ "packages/connectors/cloudflare",
59
75
  "templates",
60
76
  "docs",
61
77
  "examples",
62
78
  "test",
63
79
  "python",
64
80
  "protocol",
81
+ "skills",
65
82
  "services/knowledge/package.json",
66
83
  "services/knowledge/package-lock.json",
67
84
  "services/cad/server.py",
@@ -69,14 +86,17 @@
69
86
  "bin",
70
87
  "README.md",
71
88
  "LICENSE",
72
- "DEVELOPMENT.md"
89
+ "DEVELOPMENT.md",
90
+ "AGENTSAM.md"
73
91
  ],
74
92
  "workspaces": [
75
93
  "packages/agentsam-shell-kit",
76
- "packages/identity"
94
+ "packages/identity",
95
+ "packages/agentsam-contracts",
96
+ "packages/agentsam-workbench"
77
97
  ],
78
98
  "scripts": {
79
- "test": "node test/smoke.mjs && node --test test/*.test.mjs && npm --prefix packages/identity test",
99
+ "test": "node test/smoke.mjs && node --test test/*.test.mjs && npm --prefix packages/identity test && npm run test:connectors",
80
100
  "test:identity": "npm --prefix packages/identity test",
81
101
  "smoke": "node test/smoke.mjs",
82
102
  "verify:package": "node scripts/verify-package.mjs",
@@ -92,10 +112,14 @@
92
112
  "preview:auth-portal": "node packages/identity/scripts/preview-auth-portal.mjs --open",
93
113
  "prepublishOnly": "npm run verify:release",
94
114
  "security:check": "node src/security/cli.mjs scan",
95
- "security:repair": "node src/security/cli.mjs repair"
115
+ "security:repair": "node src/security/cli.mjs repair",
116
+ "ui:preview": "node scripts/ui-preview.mjs",
117
+ "test:connectors": "node --test packages/connectors/cloudflare/tests/**/*.test.mjs",
118
+ "verify:npm10-lock": "node apps/local-studio/scripts/verify-npm10-lock.mjs"
96
119
  },
97
120
  "engines": {
98
- "node": ">=22.5.0"
121
+ "node": ">=22 <25",
122
+ "npm": ">=10 <12"
99
123
  },
100
124
  "dependencies": {
101
125
  "@clack/prompts": "^1.7.0",
@@ -133,5 +157,6 @@
133
157
  "devDependencies": {
134
158
  "@electric-sql/pglite": "0.5.8",
135
159
  "@electric-sql/pglite-pgvector": "0.0.9"
136
- }
160
+ },
161
+ "packageManager": "npm@10.9.2"
137
162
  }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@inneranimalmedia/agentsam-connector-cloudflare",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "main": "./src/index.js",
7
+ "exports": {
8
+ ".": "./src/index.js"
9
+ }
10
+ }