@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.
- package/AGENTSAM.md +55 -0
- package/README.md +17 -12
- package/bin/agentsam +2 -0
- package/docs/AGENTSAM_ASTRA_OPENAI_INTEGRATION.md +1363 -0
- package/docs/AGENTSAM_WORKBENCH.md +30 -0
- package/docs/AUTH_IDENTITY_CONTRACT.md +52 -0
- package/docs/CAPABILITIES.md +5 -3
- package/docs/CLI_SHELL.md +167 -80
- package/docs/CMS_STUDIO.md +101 -0
- package/docs/CONTEXT.md +170 -0
- package/docs/LOCAL_OLLAMA.md +58 -0
- package/docs/MERKLE.md +19 -19
- package/docs/PORTABLE_CONTEXT.md +4 -3
- package/docs/PROJECT_CONFIG.md +72 -0
- package/docs/RELEASES.md +35 -2
- package/docs/REPOSITORY_INTELLIGENCE.md +1 -1
- package/docs/REPOSITORY_KNOWLEDGE.md +114 -0
- package/docs/SDK_WORKER.md +86 -0
- package/docs/SECURITY.md +59 -22
- package/docs/client-cms-editor.md +15 -0
- package/docs/local-studio/WORKMODE_DONOR_NOTES.md +485 -0
- package/package.json +35 -10
- package/packages/connectors/cloudflare/package.json +10 -0
- package/packages/connectors/cloudflare/src/index.js +127 -0
- package/packages/connectors/cloudflare/src/owner.js +76 -0
- package/packages/connectors/cloudflare/src/routes.js +223 -0
- package/packages/connectors/cloudflare/src/vault.js +80 -0
- package/packages/connectors/cloudflare/tests/connector.test.mjs +44 -0
- package/packages/identity/package.json +10 -1
- package/packages/identity/src/contracts/auth-config.js +109 -0
- package/packages/identity/src/index.js +1 -0
- package/packages/identity/src/oauth/README.md +2 -2
- package/packages/identity/src/oauth/credentials.js +11 -4
- package/packages/identity/src/oauth/iam-platform.js +3 -3
- package/packages/identity/src/providers/iam/index.js +7 -7
- package/packages/identity/src/providers/iam/oauth.js +6 -4
- package/packages/identity/src/providers/iam/profile.js +5 -5
- package/packages/identity/tests/auth-config.test.mjs +61 -0
- package/packages/identity/tests/oauth-credentials.test.mjs +13 -2
- package/protocol/FILEMETA_V1.md +95 -0
- package/protocol/INSPECT_VIEWS_V1.md +40 -0
- package/protocol/MERKLE_PERSISTENCE_V1.md +50 -0
- package/protocol/MERKLE_V1.md +3 -1
- package/protocol/README.md +1 -0
- package/protocol/capabilities/cloudflare-cpu-audit-input.schema.json +19 -0
- package/protocol/capabilities/cloudflare-cpu-profile-input.schema.json +13 -0
- package/protocol/capabilities/cloudflare-wrangler-native-input.schema.json +19 -0
- package/protocol/capabilities/manifest.json +79 -3
- package/protocol/capabilities/repository-snapshot.schema.json +1 -0
- package/protocol/context/context-budget.schema.json +36 -0
- package/protocol/context/context-item.schema.json +19 -0
- package/protocol/context/resolved-context-pack.schema.json +47 -0
- package/protocol/context/result-policy.schema.json +17 -0
- package/protocol/knowledge/context-pack.schema.json +33 -0
- package/protocol/knowledge/retrieval-query.schema.json +68 -13
- package/protocol/models/README.md +373 -0
- package/protocol/models/model-inventory-v2.schema.json +212 -0
- package/python/README.md +15 -7
- package/python/agentsam_sdk/cli.py +0 -21
- package/python/agentsam_sdk/tui/README.md +17 -12
- package/python/agentsam_sdk/tui/bootstrap.py +2 -2
- package/python/agentsam_sdk/tui/demo.py +25 -10
- package/python/agentsam_sdk/tui/onboarding.py +208 -0
- package/python/tests/test_tui_cli.py +7 -6
- package/skills/README.md +21 -0
- package/skills/agentsam-app-fundamentals/SKILL.md +165 -0
- package/skills/agentsam-app-fundamentals/references/graphs-contracts-ast-merkle.md +89 -0
- package/skills/agentsam-app-fundamentals/references/trust-credentials-and-destinations.md +99 -0
- package/skills/agentsam-cloudflare-workers/SKILL.md +53 -0
- package/skills/agentsam-cloudflare-workers/references/cpu-profiling.md +16 -0
- package/skills/agentsam-cloudflare-workers/references/errors-and-observability.md +29 -0
- package/skills/agentsam-cloudflare-workers/references/wrangler-native-map.md +28 -0
- package/skills/agentsam-jr-dev/SKILL.md +232 -0
- package/skills/agentsam-jr-dev/references/real-application-logic.md +156 -0
- package/skills/agentsam-jr-dev/references/web-application-fundamentals.md +240 -0
- package/skills/agentsam-progression-guard/SKILL.md +197 -0
- package/skills/agentsam-progression-guard/references/checkpoint-chain.md +111 -0
- package/skills/agentsam-progression-guard/references/hooks-operational-io.md +96 -0
- package/skills/catalog.json +71 -0
- package/src/agent/capability-adapter.js +25 -13
- package/src/agent/index.js +1 -0
- package/src/agent/responses-runner.js +325 -0
- package/src/capabilities/index.js +7 -0
- package/src/capabilities/repository-snapshot-view.js +238 -0
- package/src/capabilities/repository-snapshot.js +28 -14
- package/src/cli.js +198 -76
- package/src/cloudflare/cpu-profile.js +115 -0
- package/src/cloudflare/index.js +14 -0
- package/src/cloudflare/wrangler.js +132 -0
- package/src/commands/account-auth.js +47 -0
- package/src/commands/cloudflare.js +58 -0
- package/src/commands/connections.js +93 -0
- package/src/commands/context-economics.js +114 -0
- package/src/commands/context.js +14 -2
- package/src/commands/db.js +4 -7
- package/src/commands/deploy.js +54 -32
- package/src/commands/eval.js +63 -0
- package/src/commands/interactive.js +18 -0
- package/src/commands/knowledge.js +27 -4
- package/src/commands/merkle-persist.js +118 -0
- package/src/commands/merkle.js +32 -17
- package/src/commands/models.js +152 -0
- package/src/commands/ollama.js +259 -0
- package/src/commands/preferences.js +144 -0
- package/src/commands/product.js +86 -16
- package/src/commands/resume.js +67 -0
- package/src/commands/security.js +8 -6
- package/src/commands/shell.js +405 -100
- package/src/commands/skills.js +66 -0
- package/src/commands/start-local.js +1 -1
- package/src/commands/tunnel.js +5 -4
- package/src/commands/whoami.js +86 -0
- package/src/context/budget.js +120 -0
- package/src/context/compact.js +28 -0
- package/src/context/index.js +7 -0
- package/src/context/rehydrate.js +35 -0
- package/src/context/resolve.js +116 -0
- package/src/context/result-policy.js +66 -0
- package/src/errors/diagnostic.js +160 -0
- package/src/errors/index.js +9 -0
- package/src/eval/context.js +191 -0
- package/src/eval/index.js +1 -0
- package/src/index.js +70 -0
- package/src/indexing/execution-boundary.js +144 -0
- package/src/indexing/index.js +8 -0
- package/src/indexing/provider.js +41 -0
- package/src/knowledge/config.js +2 -2
- package/src/knowledge/context-pack.js +12 -1
- package/src/knowledge/contracts.js +9 -4
- package/src/knowledge/engine.js +7 -3
- package/src/knowledge/service/server.js +1 -1
- package/src/lib/account-session.js +98 -0
- package/src/lib/agent-instructions.js +73 -0
- package/src/lib/auth.js +4 -0
- package/src/lib/bridge-client.js +7 -5
- package/src/lib/cli-preferences.js +78 -0
- package/src/lib/core-client.js +8 -8
- package/src/lib/deploy/git-guard.js +69 -0
- package/src/lib/deploy/health.js +57 -0
- package/src/lib/deploy/local-studio.js +283 -0
- package/src/lib/deploy/secret-scan.js +65 -0
- package/src/lib/deploy-receipt/index.js +5 -2
- package/src/lib/detect-context.js +6 -5
- package/src/lib/execution-approvals.js +59 -0
- package/src/lib/identity-scaffold.js +1 -1
- package/src/lib/local-scaffold.js +35 -33
- package/src/lib/local-sessions.js +127 -0
- package/src/lib/local-status.js +9 -17
- package/src/lib/merkle/cloudflare-persistence.js +321 -0
- package/src/lib/merkle/filemeta.js +43 -0
- package/src/lib/merkle/git-ignore.js +24 -0
- package/src/lib/merkle/hash.js +1 -0
- package/src/lib/merkle/index.js +22 -0
- package/src/lib/merkle/persistence.js +72 -0
- package/src/lib/merkle/semantic.js +359 -0
- package/src/lib/merkle/snapshot.js +9 -3
- package/src/lib/merkle/tree.js +11 -6
- package/src/lib/project-config.js +227 -0
- package/src/lib/project-rules.js +68 -0
- package/src/lib/provider-credentials.js +83 -0
- package/src/lib/save-sdk-token.js +1 -1
- package/src/lib/scaffold/templates/worker-api/index.js +101 -20
- package/src/lib/scaffold/wizards/worker-api.js +27 -11
- package/src/lib/slash-commands.js +22 -15
- package/src/lib/tools.js +11 -5
- package/src/models/catalog.js +135 -0
- package/src/models/index.js +7 -0
- package/src/providers/index.js +5 -0
- package/src/providers/openai-responses.js +275 -0
- package/src/security/index.js +1 -0
- package/src/security/inventory.js +4 -1
- package/src/security/process.js +35 -9
- package/src/security/render.js +27 -5
- package/src/security/scan.js +24 -9
- package/src/security/trust-boundary.js +24 -0
- package/src/skills/index.js +64 -0
- package/src/telemetry/contracts.js +203 -0
- package/src/telemetry/events.js +48 -0
- package/src/telemetry/index.js +8 -0
- package/src/tools/hydrate.js +35 -0
- package/src/tools/index.js +2 -0
- package/src/tools/search.js +70 -0
- package/src/ui/ansi.js +1 -1
- package/src/ui/boot.js +54 -0
- package/src/ui/merkle/render.js +1 -0
- package/src/ui/runtime-activity.js +192 -0
- package/src/ui/theme.js +19 -18
- package/test/account-session.test.mjs +36 -0
- package/test/app-building-skills.test.mjs +61 -0
- package/test/apps-scaffold-contract.test.mjs +56 -0
- package/test/capabilities.test.mjs +53 -4
- package/test/cli-preferences.test.mjs +46 -0
- package/test/cloudflare-connector.test.mjs +96 -0
- package/test/cloudflare-runtime.test.mjs +75 -0
- package/test/context.test.mjs +144 -0
- package/test/deploy-health-scan.test.mjs +67 -0
- package/test/error-diagnostics.test.mjs +59 -0
- package/test/eval-context.test.mjs +37 -0
- package/test/execution-approvals.test.mjs +27 -0
- package/test/indexing-provider.test.mjs +29 -0
- package/test/jr-dev-skill.test.mjs +26 -0
- package/test/knowledge-context-pack.test.mjs +19 -0
- package/test/knowledge.test.mjs +1 -1
- package/test/local-sessions.test.mjs +42 -0
- package/test/local-studio-deploy.test.mjs +83 -0
- package/test/merkle-persistence.test.mjs +91 -0
- package/test/merkle.test.mjs +77 -3
- package/test/model-catalog.test.mjs +43 -0
- package/test/models.test.mjs +51 -0
- package/test/npm10-lock.test.mjs +29 -0
- package/test/ollama.test.mjs +94 -0
- package/test/openai-responses.test.mjs +95 -0
- package/test/project-config.test.mjs +81 -0
- package/test/project-rules.test.mjs +44 -0
- package/test/provider-credentials.test.mjs +52 -0
- package/test/rehydrate.test.mjs +25 -0
- package/test/release-hygiene.test.mjs +34 -0
- package/test/repository-snapshot-view.test.mjs +112 -0
- package/test/responses-runner.test.mjs +148 -0
- package/test/runtime-activity.test.mjs +98 -0
- package/test/sdk-worker-contract.test.mjs +68 -0
- package/test/security.test.mjs +46 -0
- package/test/shell.test.mjs +55 -21
- package/test/skills.test.mjs +22 -0
- package/test/smoke.mjs +5 -2
- package/test/telemetry.test.mjs +79 -0
- package/test/theme-portability.test.mjs +14 -0
- package/test/tools-search.test.mjs +40 -0
- package/test/whoami-resume.test.mjs +56 -0
- package/examples/agentsam-tui-ansi.mjs +0 -149
- package/src/commands/tui.js +0 -120
- package/src/ui/splash-xterm.js +0 -290
- package/src/ui/splash.js +0 -426
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# AgentSam shared workbench boundary
|
|
2
|
+
|
|
3
|
+
The SDK has one shared AgentSam interaction layer for product applications:
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
packages/agentsam-contracts pure TypeScript, no React
|
|
7
|
+
↑
|
|
8
|
+
packages/agentsam-workbench reusable React/browser workbench
|
|
9
|
+
↑
|
|
10
|
+
┌───────┼────────┐
|
|
11
|
+
│ │ │
|
|
12
|
+
Local CAD CMS
|
|
13
|
+
Studio Studio Studio
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`apps/*` are development products and remain independent workspace roots. They may consume the shared packages, but shared packages must never import an app.
|
|
17
|
+
|
|
18
|
+
## Contracts
|
|
19
|
+
|
|
20
|
+
`@inneranimalmedia/agentsam-contracts` owns messages, runs, events, tools/capabilities, artifacts/attachments, model options, explicit context, and runtime adapter interfaces. Context is supplied by the host through an explicit `AgentContextProvider`; the workbench does not scrape app state implicitly.
|
|
21
|
+
|
|
22
|
+
## Workbench
|
|
23
|
+
|
|
24
|
+
`@inneranimalmedia/agentsam-workbench` owns reusable controlled UI primitives. Product-specific state stores, route trees, auth implementations, repo/CAD/CMS schemas, and deployment wiring remain outside it.
|
|
25
|
+
|
|
26
|
+
Local Studio is the first proof consumer. CAD and CMS should consume this layer through domain adapters rather than cloning Local Studio components.
|
|
27
|
+
|
|
28
|
+
## Authentication and execution
|
|
29
|
+
|
|
30
|
+
The workbench does not own identity authority. Identity establishes an authenticated principal first; application authorization then creates any optional browser/container/terminal execution session. Cache and execution bindings are never account/session authority.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# AgentSam identity/auth configuration contract
|
|
2
|
+
|
|
3
|
+
The `agentsam-sdk` package owns the portable public configuration contract. Consuming applications implement storage, authorization, and host routes against this contract instead of defining competing environment names.
|
|
4
|
+
|
|
5
|
+
## Canonical variables
|
|
6
|
+
|
|
7
|
+
| Variable | Meaning |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `IAM_ORIGIN` | Canonical IAM authority and browser/OAuth/API origin. |
|
|
10
|
+
| `IAM_CLIENT_ID` | OAuth client id for an application using IAM identity. |
|
|
11
|
+
| `IAM_CLIENT_SECRET` | OAuth client secret. Keep it server-side. |
|
|
12
|
+
| `AGENTSAM_SDK_KEY` | Account/delegated SDK bearer. Raw values use the `sdk_` prefix and are sent as `Authorization: Bearer …`. |
|
|
13
|
+
| `AGENTSAM_BRIDGE_KEY` | Machine/integration credential. It is never a substitute for user SDK authentication. |
|
|
14
|
+
|
|
15
|
+
The host-side durable verifier for SDK credentials is `agentsam_sdk_tokens`. The SDK defines the public credential semantics; the host owns the database and authorization implementation.
|
|
16
|
+
|
|
17
|
+
`AGENTSAM_BRIDGE_KEY` remains the direct machine-secret environment variable. A host may additionally resolve a hashed credential from `agentsam_sdk_tokens` when that row has `token_type='integration'`. That does not turn the bridge credential into user authentication.
|
|
18
|
+
|
|
19
|
+
## Migration compatibility
|
|
20
|
+
|
|
21
|
+
The current migration window accepts two deprecated read fallbacks:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
IAM_ORIGIN
|
|
25
|
+
fallback: IAM_OAUTH_ISSUER
|
|
26
|
+
|
|
27
|
+
AGENTSAM_SDK_KEY
|
|
28
|
+
fallback: AGENTSAM_SDK_TOKEN
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Canonical names always win when both are present. New scaffolds, docs, and writes emit only the canonical names. Compatibility aliases are intentionally not a permanent parallel configuration surface.
|
|
32
|
+
|
|
33
|
+
Older platform-base aliases (`IAM_CORE_URL`, `AGENTSAM_CORE_URL`, `AGENTSAM_BASE_URL`) are compatibility-only. SDK clients prefer `IAM_ORIGIN`.
|
|
34
|
+
|
|
35
|
+
## Credential boundaries
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
human/account SDK lane
|
|
39
|
+
AGENTSAM_SDK_KEY
|
|
40
|
+
-> sdk_* bearer
|
|
41
|
+
-> Authorization: Bearer <sdk_*>
|
|
42
|
+
-> account/delegated authority
|
|
43
|
+
-> agentsam_sdk_tokens
|
|
44
|
+
|
|
45
|
+
machine/integration lane
|
|
46
|
+
AGENTSAM_BRIDGE_KEY
|
|
47
|
+
-> machine principal
|
|
48
|
+
-> no user/workspace identity injection
|
|
49
|
+
-> host env secret OR agentsam_sdk_tokens(token_type='integration')
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Browser OAuth uses `IAM_ORIGIN` together with `IAM_CLIENT_ID` and `IAM_CLIENT_SECRET`. Repository identity, workspace labels, or machine trust do not prove account authority.
|
package/docs/CAPABILITIES.md
CHANGED
|
@@ -18,7 +18,7 @@ agentsam capabilities
|
|
|
18
18
|
agentsam capabilities repository.snapshot --json
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
This registry is intended to drive CLI/
|
|
21
|
+
This registry is intended to drive CLI/terminal UI discovery, AgentSam/MCP tool selection, docs, verification, and workflow capability resolution. It is deliberately not a second hosted tools database.
|
|
22
22
|
|
|
23
23
|
## repository.snapshot
|
|
24
24
|
|
|
@@ -26,7 +26,8 @@ This registry is intended to drive CLI/TUI discovery, AgentSam/MCP tool selectio
|
|
|
26
26
|
|
|
27
27
|
- Git resource identity and revision
|
|
28
28
|
- Python repository intelligence
|
|
29
|
-
- Merkle root and tree statistics
|
|
29
|
+
- Merkle root, semantic metadata root, execution-domain facts, and tree statistics
|
|
30
|
+
- deterministic client/server trust-boundary contradictions derived from the Merkle-bound AST graph
|
|
30
31
|
- package/manifests
|
|
31
32
|
- local knowledge/index generation when configured
|
|
32
33
|
- last trusted local deployment receipt when available
|
|
@@ -36,6 +37,7 @@ It does **not** call an LLM, mutate source, index the repository, provision clou
|
|
|
36
37
|
|
|
37
38
|
```sh
|
|
38
39
|
agentsam inspect --json
|
|
40
|
+
agentsam inspect --execution-domain browser --view files --json
|
|
39
41
|
```
|
|
40
42
|
|
|
41
43
|
```js
|
|
@@ -43,7 +45,7 @@ import { repositorySnapshot } from '@inneranimalmedia/agentsam-sdk/repository';
|
|
|
43
45
|
const snapshot = await repositorySnapshot({ cwd: process.cwd() });
|
|
44
46
|
```
|
|
45
47
|
|
|
46
|
-
The timestamp is not included in the content hash, so unchanged evidence produces the same `content_hash` and `snapshot_id`.
|
|
48
|
+
The timestamp is not included in the content hash, so unchanged evidence produces the same `content_hash` and `snapshot_id`. The default bounded index view carries a compact `analysis.trust_boundary` summary (up to 20 contradiction cards) while the canonical full snapshot retains all deterministic findings. `agentsam security scan` consumes the same analyzer rather than maintaining a separate architecture model.
|
|
47
49
|
|
|
48
50
|
## Optional AgentSam/LLM composition
|
|
49
51
|
|
package/docs/CLI_SHELL.md
CHANGED
|
@@ -1,129 +1,216 @@
|
|
|
1
1
|
# Agent Sam SDK — terminal experience
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`agentsam` is the product entrypoint. Users do not choose a renderer or need to know whether a screen is implemented with ANSI, Clack, or another terminal library.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Product entrypoint
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
agentsam
|
|
8
|
+
agentsam
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
On first use in a project, Agent Sam asks whether the directory is trusted before project-local instructions, hooks, or execution policy can load. The setup flow then uses keyboard-driven selectors for runtime and model policy.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
Model policy is explicit and is governed by the normative model-selection SSOT contract in `protocol/models/README.md`:
|
|
14
|
+
|
|
15
|
+
1. **Provider** — the explicit provider lane selected by the user.
|
|
16
|
+
2. **Model** — the exact provider-verified model; provider-level pseudo-models such as `automatic` or `default` are not substitutes for exact selection.
|
|
17
|
+
3. **Reasoning level** — one of the reasoning efforts declared by that model.
|
|
18
|
+
4. **Processing** — Standard, Fast, Flex, or another tier only when that model declares it.
|
|
19
|
+
|
|
20
|
+
`/models`, `agentsam models`, exact `-m <model_id>` selection, runtime execution, and usage receipts must all resolve through that same inventory/selection authority. AgentSam may curate and rank a useful first page, but provider availability, capabilities, limits, and pricing retain provider-authoritative provenance.
|
|
21
|
+
|
|
22
|
+
For models with materially different pricing by reasoning, service tier, or context size, these controls are user-visible policy. They are not hidden prompt hints.
|
|
23
|
+
|
|
24
|
+
After setup, bare text is an Agent Sam request. Slash commands control the runtime.
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
sam ~/project > Find why OAuth callback state is failing
|
|
28
|
+
|
|
29
|
+
Model request
|
|
30
|
+
model openai:gpt-6-astra
|
|
31
|
+
reasoning high
|
|
32
|
+
processing default
|
|
33
|
+
context ~18,240 input tokens
|
|
34
|
+
max call $... conservative ceiling
|
|
35
|
+
|
|
36
|
+
Send this request? Yes / No
|
|
16
37
|
```
|
|
17
38
|
|
|
18
|
-
|
|
39
|
+
The model preflight is shown before the first paid request in a session, and again if a later request raises the previously approved conservative cost ceiling. Current active context remains distinct from cumulative session usage.
|
|
19
40
|
|
|
20
|
-
|
|
21
|
-
|
|
41
|
+
## Command picker
|
|
42
|
+
|
|
43
|
+
Typing `/` opens the scrollable command picker in an interactive terminal. The picker is generated from the implemented command catalog; commands should not be advertised before a handler exists.
|
|
44
|
+
|
|
45
|
+
Current controls include:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
/model exact model + reasoning + processing selectors
|
|
49
|
+
/reasoning change the selected model's reasoning effort
|
|
50
|
+
/fast request the model's Fast processing tier
|
|
51
|
+
/flex request Flex processing when supported
|
|
52
|
+
/standard return to Standard processing
|
|
53
|
+
/context context economics and current active-context information
|
|
54
|
+
/models safe credential/provider/model inventory
|
|
55
|
+
/whoami authenticated IAM identity + safe credential status
|
|
56
|
+
/session current cumulative token/cost/resume receipt
|
|
57
|
+
/cf bounded Cloudflare/Workers operations
|
|
58
|
+
/status local project / DB / Git / PTY health
|
|
59
|
+
/settings project/runtime/terminal/model preferences
|
|
60
|
+
/pwd working directory
|
|
61
|
+
/cd change working directory
|
|
62
|
+
/git Git operations
|
|
63
|
+
/diff Git diff
|
|
64
|
+
/db local SQLite
|
|
65
|
+
/agent local Agent Sam dev-server request
|
|
66
|
+
/logs local execution events
|
|
67
|
+
/deploy intentional deployment flow
|
|
68
|
+
/clear clear the terminal
|
|
69
|
+
/help show commands
|
|
70
|
+
/exit save/pause the session and return to the host terminal
|
|
22
71
|
```
|
|
23
72
|
|
|
24
|
-
|
|
73
|
+
Provider-brand commands such as `/claude` or `/codex` are not the generic shell contract. Model execution stays behind Agent Sam.
|
|
25
74
|
|
|
26
|
-
|
|
75
|
+
## Credentials and identity
|
|
27
76
|
|
|
28
|
-
|
|
77
|
+
A user should not need to manually `source` and `unset` provider keys for every Agent Sam command.
|
|
78
|
+
|
|
79
|
+
Agent Sam resolves credentials in this order:
|
|
80
|
+
|
|
81
|
+
1. an explicitly supplied credential where a command contract permits one;
|
|
82
|
+
2. the current process environment;
|
|
83
|
+
3. the user's secure Agent Sam provider files under `~/.agentsam/env.d/`.
|
|
84
|
+
|
|
85
|
+
Provider files are machine-local and must not be group/world-readable on POSIX systems. Agent Sam parses the expected variable from the file rather than evaluating the file as shell code.
|
|
86
|
+
|
|
87
|
+
`agentsam models` uses the credential internally for safe provider discovery but never returns the secret. Its public status reports only safe facts such as provider, configured state, source class, and provider-verified model availability.
|
|
88
|
+
|
|
89
|
+
IAM login is also machine-local rather than repository state. A successful browser authentication may persist the `sdk_` bearer under `~/.agentsam/auth/session.json` with restrictive permissions. `agentsam whoami`, deploy, tunnel, and context detection can reuse that validated session. Project `.agentsam/config.json` remains portable and must not become a second identity database.
|
|
29
90
|
|
|
30
91
|
```bash
|
|
31
|
-
agentsam
|
|
92
|
+
agentsam whoami
|
|
93
|
+
agentsam whoami --json
|
|
32
94
|
```
|
|
33
95
|
|
|
34
|
-
|
|
96
|
+
`whoami` can show safe identity/account information and whether provider credentials are available. It never prints API-key or SDK-bearer values.
|
|
97
|
+
|
|
98
|
+
## Execution approval
|
|
99
|
+
|
|
100
|
+
Model reasoning does not itself authorize host execution.
|
|
101
|
+
|
|
102
|
+
Read-only/no-side-effect capabilities may execute under the current trusted runtime policy. A model-selected capability with declared side effects must pass a runtime-owned approval boundary before its handler is invoked.
|
|
35
103
|
|
|
36
104
|
```text
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
+--> browser shell-kit reusable React components, separate surface
|
|
105
|
+
Agent Sam needs execution permission
|
|
106
|
+
|
|
107
|
+
action cloudflare.wrangler.native:whoami
|
|
108
|
+
target local runtime · ~/project
|
|
109
|
+
effect local_process
|
|
110
|
+
input {"command":"whoami"}
|
|
44
111
|
|
|
45
|
-
|
|
112
|
+
secrets remain runtime-owned and are not included in the model-visible result.
|
|
46
113
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Logs/events
|
|
52
|
-
Deploy adapters
|
|
114
|
+
? Allow cloudflare.wrangler.native:whoami?
|
|
115
|
+
Allow once
|
|
116
|
+
Always allow cloudflare.wrangler.native:whoami in this project
|
|
117
|
+
Deny
|
|
53
118
|
```
|
|
54
119
|
|
|
55
|
-
|
|
120
|
+
Persistent approvals are exact-operation and exact-project grants. Approving `wrangler whoami` does not authorize another Wrangler operation or another repository.
|
|
56
121
|
|
|
57
|
-
|
|
122
|
+
Commands whose purpose is to disclose a credential, such as `wrangler auth token`, are not model-visible capabilities. Safe identity/authorization probes are preferred.
|
|
123
|
+
|
|
124
|
+
## Sessions and resume
|
|
58
125
|
|
|
59
|
-
|
|
126
|
+
Every interactive Agent Sam run receives a provider-neutral session identifier:
|
|
60
127
|
|
|
61
128
|
```text
|
|
62
|
-
|
|
63
|
-
.env
|
|
64
|
-
.env.example
|
|
65
|
-
agentsam.config.js
|
|
66
|
-
.agentsam/config.json
|
|
67
|
-
.agentsam/data/agentsam.sqlite
|
|
68
|
-
db/schema.sql
|
|
69
|
-
src/agent.js
|
|
70
|
-
src/dev-server.js
|
|
71
|
-
scripts/smoke.mjs
|
|
129
|
+
asess_<uuid>
|
|
72
130
|
```
|
|
73
131
|
|
|
74
|
-
|
|
132
|
+
Provider response IDs live beneath the Agent Sam session and are not the public session identity. Session files are machine-local under `~/.agentsam/sessions/` and use restrictive permissions.
|
|
75
133
|
|
|
76
|
-
|
|
134
|
+
The session retains enough runtime state to continue a compatible provider conversation, including selected model policy, provider continuation reference, current usage snapshot, cumulative usage, accumulated catalog-calculated cost, last safe error receipt, cwd, and the last substantive user request/command used as the session title.
|
|
77
135
|
|
|
78
|
-
|
|
136
|
+
Housekeeping actions such as `/exit`, `/help`, and `/session` do not replace that human-readable title.
|
|
79
137
|
|
|
80
|
-
|
|
81
|
-
|---|---|---|
|
|
82
|
-
| ANSI | `examples/agentsam-tui-ansi.mjs` | npm-native default terminal renderer |
|
|
83
|
-
| Rich | `python/agentsam_sdk/tui/` | optional richer cards, progress, events, logs |
|
|
84
|
-
| shell-kit | `packages/agentsam-shell-kit/` | reusable React/browser work-surface components |
|
|
85
|
-
| Gorilla | `templates/gorilla-shell/` | visual/theme experiment only |
|
|
138
|
+
On Ctrl+C or normal exit, Agent Sam saves the session and prints a compact receipt:
|
|
86
139
|
|
|
87
|
-
|
|
140
|
+
```text
|
|
141
|
+
Token usage: total=21,463 input=21,244 (+ 60,544 cached) output=219 reasoning=...
|
|
142
|
+
Cost: $... · openai:gpt-6-astra · fast
|
|
143
|
+
Active context: ... tokens
|
|
88
144
|
|
|
89
|
-
|
|
145
|
+
To continue this session, run:
|
|
146
|
+
agentsam resume asess_...
|
|
90
147
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
148
|
+
Or run:
|
|
149
|
+
agentsam resume
|
|
150
|
+
|
|
151
|
+
and select:
|
|
152
|
+
Run wrangler whoami
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Provider-reported token usage is authoritative when available. Cached input is reported separately rather than added to normal input. Cost is calculated from Agent Sam's active model/pricing authority and is not presented as a provider invoice unless the provider supplied one.
|
|
156
|
+
|
|
157
|
+
Resume commands:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
agentsam resume asess_...
|
|
161
|
+
agentsam resume # scrollable recent-session picker in a TTY
|
|
162
|
+
agentsam resume --list
|
|
163
|
+
agentsam resume --json
|
|
104
164
|
```
|
|
105
165
|
|
|
106
|
-
|
|
166
|
+
Changing model, reasoning effort, or processing tier breaks provider-continuation compatibility for the next turn; Agent Sam starts a fresh provider continuation while retaining cumulative Agent Sam session accounting.
|
|
167
|
+
|
|
168
|
+
## Error presentation
|
|
107
169
|
|
|
108
|
-
|
|
170
|
+
Errors preserve machine identity instead of becoming generic prose. Where available the terminal should surface HTTP status, provider error type/code, request or Ray ID, retry metadata, requested/resolved service tier, and retry classification. Secrets and authorization headers are redacted before an error receipt enters model-visible output or a persisted session.
|
|
109
171
|
|
|
110
|
-
##
|
|
172
|
+
## One-shot commands
|
|
111
173
|
|
|
112
|
-
|
|
174
|
+
Normal commands remain deterministic and scriptable:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
agentsam status
|
|
178
|
+
agentsam models
|
|
179
|
+
agentsam whoami --json
|
|
180
|
+
agentsam inspect --match oauth --view files --json
|
|
181
|
+
agentsam deploy
|
|
182
|
+
agentsam --help
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
`agentsam shell` remains an explicit/secondary way to enter the same shell. Bare `agentsam` is the normal interactive entrypoint.
|
|
186
|
+
|
|
187
|
+
For regression tests, a slash command can be dispatched without creating interactive-session clutter:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
agentsam shell --command /help
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Internal UI engine
|
|
194
|
+
|
|
195
|
+
Presentation is implementation detail:
|
|
113
196
|
|
|
114
197
|
```text
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
+--> migrations/0001_agentsam_core.sql
|
|
122
|
-
+--> provisioned account bindings
|
|
198
|
+
Agent Sam lifecycle/state
|
|
199
|
+
|
|
|
200
|
+
+--> ANSI / picocolors semantic color + cursor control
|
|
201
|
+
+--> Clack prompts arrow-key selects / confirms / text input
|
|
202
|
+
+--> runtime activity thinking/tool/context lifecycle
|
|
203
|
+
+--> node-pty / host runtime real process/filesystem boundary
|
|
123
204
|
```
|
|
124
205
|
|
|
125
|
-
|
|
206
|
+
SDK developers can preview rendering experiments from this repository, but those are design-lab commands rather than installed product vocabulary.
|
|
207
|
+
|
|
208
|
+
## Local project contract
|
|
209
|
+
|
|
210
|
+
`agentsam init` owns portable repository/project setup. User identity, provider secrets, session history, execution approvals, and provider continuation state are machine/account runtime state and must not be written into portable project configuration.
|
|
211
|
+
|
|
212
|
+
Local development does not require a cloud account. Cloud infrastructure is added intentionally.
|
|
126
213
|
|
|
127
214
|
## Design rule
|
|
128
215
|
|
|
129
|
-
A CLI operation
|
|
216
|
+
A CLI operation must remain understandable in plain text and deterministic in CI/pipes. Interactive terminals may enhance state with color, cursor redraw, selectors, confirmation, progress, and animation. Presentation does not authorize tools, own credentials, or silently become model-routing authority. Runtime contracts do.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# AgentSam CMS Studio architecture
|
|
2
|
+
|
|
3
|
+
The SDK treats CMS authoring and the public website as separate deployment products that share publication contracts.
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
apps/client-cms-editor/ authenticated authoring/control app
|
|
7
|
+
│
|
|
8
|
+
├─ pages / sections / themes / assets
|
|
9
|
+
├─ AgentSam workbench
|
|
10
|
+
├─ preview
|
|
11
|
+
└─ publish
|
|
12
|
+
↓
|
|
13
|
+
structured publication snapshot
|
|
14
|
+
┌──┴──┐
|
|
15
|
+
│ │
|
|
16
|
+
D1 R2 WEBSITE_ASSETS
|
|
17
|
+
metadata content/media/theme artifacts
|
|
18
|
+
│ │
|
|
19
|
+
└──┬──┘
|
|
20
|
+
↓
|
|
21
|
+
small public CMS runtime
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The public runtime must not inherit the full authoring dependency graph. Monaco, terminal, browser automation, authenticated admin UI, and the AgentSam workbench stay in the authoring application unless a public feature explicitly requires them.
|
|
25
|
+
|
|
26
|
+
## Shared AgentSam platform
|
|
27
|
+
|
|
28
|
+
CMS consumes `@inneranimalmedia/agentsam-contracts` and `@inneranimalmedia/agentsam-workbench`, the same product-neutral layer proven first by Local Studio. `CmsAgentSurface` supplies explicit CMS context to the shared `AgentWorkbenchAdapter`; it does not scrape editor state or invent a CMS-specific chat transport.
|
|
29
|
+
|
|
30
|
+
Identity is resolved before AgentSam execution:
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
IAM
|
|
34
|
+
↓
|
|
35
|
+
authenticated principal (accountId + authUserId)
|
|
36
|
+
↓
|
|
37
|
+
application authorization
|
|
38
|
+
↓
|
|
39
|
+
CMS context / capabilities
|
|
40
|
+
↓
|
|
41
|
+
optional browser or container runtime
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`SESSION_CACHE` is an optional cache only. `MY_CONTAINER` and `MYBROWSER` are execution infrastructure only. None may become identity/session authority.
|
|
45
|
+
|
|
46
|
+
## Cloudflare capability contract
|
|
47
|
+
|
|
48
|
+
Baseline `cms-cloud` requires `DB` and `WEBSITE_ASSETS`. Other bindings are capability-driven:
|
|
49
|
+
|
|
50
|
+
- `iam` → `IAM_CLIENT_ID`, `IAM_CLIENT_SECRET`, `IAM_ORIGIN`
|
|
51
|
+
- `workers-ai` → `AGENTSAM_WAI`
|
|
52
|
+
- `browser` → `MYBROWSER`
|
|
53
|
+
- `container` → `MY_CONTAINER`
|
|
54
|
+
- `encrypted-secrets` → `SECRETS_ENCRYPTION_KEY`
|
|
55
|
+
- `acp` → `ACP_CLIENT_ID`, `ACP_CLIENT_SECRET`
|
|
56
|
+
|
|
57
|
+
`IAM_ORIGIN` means the canonical IAM issuer/auth service. It must not silently mean the current website origin.
|
|
58
|
+
|
|
59
|
+
## Routes
|
|
60
|
+
|
|
61
|
+
The intended ownership boundary is:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
/* public CMS
|
|
65
|
+
/auth/* identity
|
|
66
|
+
/dashboard/* authenticated application
|
|
67
|
+
/dashboard/agentsam authenticated AgentSam product
|
|
68
|
+
/dashboard/cms authenticated CMS Studio
|
|
69
|
+
/api/public/* visitor-safe CMS APIs
|
|
70
|
+
/api/auth/* identity/session
|
|
71
|
+
/api/cms/* authenticated editor/publishing APIs
|
|
72
|
+
/api/agentsam/* authenticated AgentSam APIs
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Publication data
|
|
76
|
+
|
|
77
|
+
Prefer versioned structured sections such as:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"publicationId": "pub_example",
|
|
82
|
+
"route": "/about",
|
|
83
|
+
"revision": 18,
|
|
84
|
+
"theme": "iam-classy",
|
|
85
|
+
"sections": [
|
|
86
|
+
{
|
|
87
|
+
"type": "hero",
|
|
88
|
+
"props": {
|
|
89
|
+
"title": "About us",
|
|
90
|
+
"imageAsset": "asset_example"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The renderer may produce sanitized HTML/static snapshots from this data. Arbitrary executable HTML from the editor is not the public-content authority.
|
|
98
|
+
|
|
99
|
+
## Current server authority
|
|
100
|
+
|
|
101
|
+
The imported app contains only the portable CMS API/routing/preview bridge. The current full CMS domain remains in `inneranimalmedia/src/core/agentsam/cms/` at the import provenance revision. The next server-side extraction should create reusable `packages/agentsam-cms-*` packages rather than copy that domain into this app.
|