@inneranimalmedia/agentsam-sdk 2.4.0 → 2.5.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/README.md +7 -6
- 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 +57 -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 +26 -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 +17 -5
- package/packages/identity/package.json +11 -2
- package/packages/identity/src/contracts/auth-config.js +98 -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 +57 -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/capabilities/manifest.json +32 -3
- package/protocol/capabilities/repository-snapshot.schema.json +1 -0
- package/protocol/context/context-budget.schema.json +41 -0
- package/protocol/context/context-item.schema.json +20 -0
- package/protocol/context/resolved-context-pack.schema.json +42 -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/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-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 +53 -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 +108 -56
- package/src/commands/cad.js +56 -6
- package/src/commands/context.js +14 -2
- package/src/commands/db.js +4 -7
- package/src/commands/deploy.js +17 -31
- package/src/commands/interactive.js +21 -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 +107 -0
- package/src/commands/ollama.js +259 -0
- package/src/commands/preferences.js +102 -0
- package/src/commands/product.js +86 -16
- package/src/commands/security.js +3 -3
- package/src/commands/shell.js +71 -27
- package/src/commands/skills.js +66 -0
- package/src/commands/start-local.js +1 -1
- package/src/commands/tunnel.js +5 -4
- package/src/context/budget.js +58 -0
- package/src/context/compact.js +28 -0
- package/src/context/index.js +5 -0
- package/src/context/resolve.js +84 -0
- package/src/context/result-policy.js +66 -0
- package/src/index.js +16 -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/auth.js +10 -19
- package/src/lib/bridge-client.js +7 -5
- package/src/lib/cli-preferences.js +74 -0
- package/src/lib/core-client.js +8 -8
- package/src/lib/deploy-receipt/index.js +5 -2
- package/src/lib/detect-context.js +6 -5
- package/src/lib/identity-scaffold.js +1 -1
- package/src/lib/local-scaffold.js +35 -33
- 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/open-url.js +66 -0
- package/src/lib/project-config.js +227 -0
- package/src/lib/project-rules.js +68 -0
- package/src/lib/save-sdk-token.js +1 -1
- package/src/lib/slash-commands.js +2 -1
- package/src/lib/tools.js +11 -5
- package/src/security/index.js +1 -0
- package/src/security/inventory.js +4 -1
- 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/tools/index.js +1 -0
- package/src/tools/search.js +70 -0
- package/src/ui/ansi.js +1 -1
- package/src/ui/boot.js +56 -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/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 +25 -0
- package/test/context.test.mjs +95 -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/merkle-persistence.test.mjs +91 -0
- package/test/merkle.test.mjs +77 -3
- package/test/models.test.mjs +37 -0
- package/test/ollama.test.mjs +94 -0
- package/test/open-url.test.mjs +64 -0
- package/test/project-config.test.mjs +81 -0
- package/test/project-rules.test.mjs +44 -0
- package/test/release-hygiene.test.mjs +34 -0
- package/test/repository-snapshot-view.test.mjs +112 -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 +8 -1
- package/test/skills.test.mjs +22 -0
- package/test/smoke.mjs +2 -2
- package/test/theme-portability.test.mjs +14 -0
- package/test/tools-search.test.mjs +27 -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
package/README.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
A deterministic-first application and agent toolkit: reusable repository, knowledge, integrity,
|
|
4
4
|
security, identity, scaffolding, and delivery capabilities with optional AgentSam/LLM composition.
|
|
5
|
-
CLI
|
|
5
|
+
The interactive CLI makes those same primitives easy to use without making a model part of the implementation.
|
|
6
6
|
|
|
7
7
|
**npm:** `@inneranimalmedia/agentsam-sdk` · **Source:** [GitHub](https://github.com/SamPrimeaux/agentsam-sdk)
|
|
8
8
|
|
|
9
9
|
Node 22.5+ is required. Docker is optional for container commands. Python 3.10+ is required
|
|
10
|
-
for the bundled Python repository tools
|
|
11
|
-
See
|
|
10
|
+
for the bundled Python repository tools. Rich is optional for the contributor-only terminal renderer lab.
|
|
11
|
+
See [release receipts](docs/RELEASES.md) for publication status.
|
|
12
12
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
@@ -71,17 +71,18 @@ read-only `repository.snapshot` composition primitive. See [Capabilities and pre
|
|
|
71
71
|
| Capability | Entry point | Guide |
|
|
72
72
|
| --- | --- | --- |
|
|
73
73
|
| Capability registry + presets | `agentsam capabilities`, `/capabilities`, `/presets` | [Capabilities](docs/CAPABILITIES.md) |
|
|
74
|
+
| Portable AgentSam skills | `agentsam skills`; `/skills` | [Skills](skills/README.md) |
|
|
74
75
|
| Canonical repository snapshot | `agentsam inspect --json`; `/repository` | [Capabilities](docs/CAPABILITIES.md) |
|
|
75
76
|
| Git context and bridge client | `agentsam context --json`; `/git-context`, `/bridge-client` | [Portable context](docs/PORTABLE_CONTEXT.md) |
|
|
76
77
|
| Identity contracts and adapters | `/identity`; `agentsam identity init` | [Identity](packages/identity/README.md) |
|
|
77
78
|
| Repository knowledge | `agentsam index`, `search`, `repo`; `/knowledge` | [Knowledge](docs/portable-knowledge.md) |
|
|
78
79
|
| File integrity | `agentsam merkle`; `/merkle` | [Merkle](docs/MERKLE.md) |
|
|
79
|
-
|
|
|
80
|
+
| Security, trust-boundary scan, and repair | `agentsam security`; `/security` | [Security](docs/SECURITY.md) |
|
|
80
81
|
| Mini prototypes | `agentsam mini`; `/mini` | [Mini](docs/MINI.md) |
|
|
81
82
|
| Recon bounded-worker packets | `agentsam recon pack\|validate` | [Recon](docs/RECON.md) |
|
|
82
83
|
| Local containers | `agentsam dockerize`; `/dockerize` | [Dockerize](docs/DOCKERIZE.md) |
|
|
83
84
|
| Background indexing service | Docker `knowledge_service`; `/knowledge-service-client` | [Knowledge service](docs/knowledge-service.md) |
|
|
84
|
-
|
|
|
85
|
+
| Interactive Agent Sam + local runtime | `agentsam`, `agentsam status`, `db`, `models`, `start-local` | [CLI shell](docs/CLI_SHELL.md) |
|
|
85
86
|
|
|
86
87
|
Export suffixes such as `/identity` mean imports from
|
|
87
88
|
`@inneranimalmedia/agentsam-sdk/identity`. Use `agentsam <command> --help` where supported.
|
|
@@ -123,7 +124,7 @@ npm run verify:release
|
|
|
123
124
|
|
|
124
125
|
Release verification runs Node/identity tests, bootstrap and package checks, installed
|
|
125
126
|
tarball fixtures in unrelated repositories, Python tests, and a complete dependency scan.
|
|
126
|
-
[Development](DEVELOPMENT.md) · [Release
|
|
127
|
+
[Development](DEVELOPMENT.md) · [Release receipts](docs/RELEASES.md) ·
|
|
127
128
|
[Branch archive](docs/branch-archive-2026-09-02.md).
|
|
128
129
|
|
|
129
130
|
License: MIT. Optional visual experiments and host-specific integrations retain their
|
|
@@ -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,106 @@
|
|
|
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, Rich, 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 the first run for a project, Agent Sam opens keyboard-driven setup for the project, runtime, terminal, and model preference. On later runs it shows a short project-aware boot transition and enters the Agent Sam prompt.
|
|
12
12
|
|
|
13
|
-
```
|
|
14
|
-
agentsam
|
|
15
|
-
agentsam tui rich --install
|
|
16
|
-
```
|
|
13
|
+
```text
|
|
14
|
+
$ agentsam
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
Agent Sam
|
|
17
|
+
my-project · main · qwen2.5-coder
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
✓ project
|
|
20
|
+
✓ runtime
|
|
21
|
+
✓ model
|
|
22
|
+
|
|
23
|
+
username ~/path/to/project >
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
The model stored by the CLI is a **preference only**. It does not replace the connected host/runtime as model-routing authority.
|
|
27
|
+
|
|
28
|
+
Live terminal scenes are automatic product behavior. When Agent Sam is actively handling an `/agent` request, the installed CLI renders the compact thinking/activity panel itself; users never run a renderer or preview command. The same shipped activity seam accepts model, tool, and context-compaction lifecycle events from richer hosts. Pipes and CI remain plain/deterministic.
|
|
29
|
+
|
|
30
|
+
Use `/settings` inside Agent Sam to revisit the keyboard choices and `/models` to inspect providers and locally available models.
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
## One-shot commands
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
Normal commands remain deterministic and scriptable:
|
|
29
35
|
|
|
30
36
|
```bash
|
|
31
|
-
agentsam
|
|
37
|
+
agentsam status
|
|
38
|
+
agentsam models
|
|
39
|
+
agentsam inspect --json
|
|
40
|
+
agentsam deploy
|
|
41
|
+
agentsam --help
|
|
32
42
|
```
|
|
33
43
|
|
|
34
|
-
|
|
44
|
+
`agentsam shell` remains an explicit/secondary way to enter the slash-command shell. Bare `agentsam` is the normal interactive entrypoint.
|
|
35
45
|
|
|
36
|
-
|
|
37
|
-
CLI command / execution state
|
|
38
|
-
|
|
|
39
|
-
+--> Node ANSI renderer default, zero extra dependencies
|
|
40
|
-
|
|
|
41
|
-
+--> Python Rich renderer optional high-fidelity live presentation
|
|
42
|
-
|
|
|
43
|
-
+--> browser shell-kit reusable React components, separate surface
|
|
44
|
-
|
|
45
|
-
Capabilities underneath presentation:
|
|
46
|
+
For regression tests, one slash command can still be dispatched without opening an interactive terminal:
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
Local PTY
|
|
50
|
-
Agent/tool execution
|
|
51
|
-
Logs/events
|
|
52
|
-
Deploy adapters
|
|
48
|
+
```bash
|
|
49
|
+
agentsam shell --command /help
|
|
53
50
|
```
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## Local project contract
|
|
52
|
+
## Internal UI engine
|
|
58
53
|
|
|
59
|
-
|
|
54
|
+
The renderer is implementation detail:
|
|
60
55
|
|
|
61
56
|
```text
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
db/schema.sql
|
|
69
|
-
src/agent.js
|
|
70
|
-
src/dev-server.js
|
|
71
|
-
scripts/smoke.mjs
|
|
57
|
+
Agent Sam lifecycle/state
|
|
58
|
+
|
|
|
59
|
+
+--> ANSI / picocolors semantic color + cursor control
|
|
60
|
+
+--> Rich renderer high-fidelity live render experiments
|
|
61
|
+
+--> Clack prompts arrow-key selects / confirms / text input
|
|
62
|
+
+--> node-pty real shell/process/filesystem
|
|
72
63
|
```
|
|
73
64
|
|
|
74
|
-
|
|
65
|
+
SDK developers can preview render experiments from this repository without exposing renderer names as product commands:
|
|
75
66
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
| shell-kit | `packages/agentsam-shell-kit/` | reusable React/browser work-surface components |
|
|
85
|
-
| Gorilla | `templates/gorilla-shell/` | visual/theme experiment only |
|
|
67
|
+
```bash
|
|
68
|
+
npm run ui:preview -- tour
|
|
69
|
+
npm run ui:preview -- boot
|
|
70
|
+
npm run ui:preview -- setup
|
|
71
|
+
npm run ui:preview -- thinking
|
|
72
|
+
npm run ui:preview -- ready
|
|
73
|
+
npm run ui:preview -- ansi
|
|
74
|
+
```
|
|
86
75
|
|
|
87
|
-
|
|
76
|
+
These preview commands are a design lab, not part of the installed user vocabulary.
|
|
88
77
|
|
|
89
|
-
##
|
|
78
|
+
## Slash commands
|
|
90
79
|
|
|
91
80
|
```text
|
|
92
81
|
/help show commands
|
|
93
82
|
/status local project / DB / Git / PTY health
|
|
94
83
|
/context current repository + revision
|
|
95
84
|
/pwd working directory
|
|
96
|
-
/cd change directory
|
|
85
|
+
/cd change working directory
|
|
97
86
|
/git Git operations
|
|
98
87
|
/db local SQLite
|
|
99
88
|
/agent invoke configured Agent Sam
|
|
89
|
+
/models inspect available providers and local models
|
|
90
|
+
/settings choose project/runtime/terminal/model preference
|
|
100
91
|
/logs local execution events
|
|
101
|
-
/tui terminal presentation
|
|
102
92
|
/deploy intentionally add a cloud adapter
|
|
103
|
-
/exit exit Agent Sam
|
|
93
|
+
/exit exit Agent Sam and return to the host terminal
|
|
104
94
|
```
|
|
105
95
|
|
|
106
|
-
Provider-specific commands such as `/claude` or `/codex` are not part of the generic shell contract. Model routing belongs behind Agent Sam.
|
|
107
|
-
|
|
108
|
-
Workspace switching is not required for local tooling. Authenticated user/session identity is the security boundary; workspace/project labels are organizational metadata.
|
|
109
|
-
|
|
110
|
-
## Cloud graduation
|
|
96
|
+
Provider-specific commands such as `/claude` or `/codex` are not part of the generic shell contract. Model execution/routing belongs behind Agent Sam.
|
|
111
97
|
|
|
112
|
-
|
|
98
|
+
## Local project contract
|
|
113
99
|
|
|
114
|
-
|
|
115
|
-
local project
|
|
116
|
-
|
|
|
117
|
-
+--> agentsam deploy --target cloudflare
|
|
118
|
-
|
|
|
119
|
-
+--> src/cloudflare-worker.js
|
|
120
|
-
+--> wrangler.toml
|
|
121
|
-
+--> migrations/0001_agentsam_core.sql
|
|
122
|
-
+--> provisioned account bindings
|
|
123
|
-
```
|
|
100
|
+
`agentsam init` creates a local project with Git, `.env`, `.agentsam/config.json`, a committed `.agentsamrules` project-instruction file, local SQLite, and the project runtime files. The setup wizard uses keyboard-driven Clack prompts in an interactive terminal; flags keep non-interactive creation deterministic.
|
|
124
101
|
|
|
125
|
-
|
|
102
|
+
Local development requires no Worker or cloud account. Cloud infrastructure is added intentionally at deploy time.
|
|
126
103
|
|
|
127
104
|
## Design rule
|
|
128
105
|
|
|
129
|
-
A CLI operation
|
|
106
|
+
A CLI operation must remain understandable in plain text and deterministic in CI/pipes. Interactive terminals may enhance that state with color, cursor redraw, prompts, progress, and animation. Presentation does not authorize tools, own execution policy, or silently become model-routing authority.
|
|
@@ -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.
|
package/docs/CONTEXT.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Agent Sam context contracts
|
|
2
|
+
|
|
3
|
+
Agent Sam treats context as a bounded evidence pack, not as a place to dump every available index, tool, file, or prior message.
|
|
4
|
+
|
|
5
|
+
## Project rules
|
|
6
|
+
|
|
7
|
+
Generated projects include a committed `.agentsamrules` file. It is the repository-level instruction surface, similar in spirit to `.cursorrules`.
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
repo/
|
|
11
|
+
├── .agentsam/config.json portable project identity/defaults
|
|
12
|
+
├── .agentsamrules committed project instructions
|
|
13
|
+
└── .agentsam/cli.json machine/user preferences; gitignored
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`loadProjectRules()` searches upward from the active cwd, hashes the source, and bounds loaded content before it can enter system context. The portable default ceiling is 24,000 characters; a host may choose a lower ceiling through its context budget.
|
|
17
|
+
|
|
18
|
+
`.agentsamrules` is for durable repository instructions and conventions. It is not a place for secrets, account IDs, active runs, task state, model history, terminal sessions, or Merkle roots.
|
|
19
|
+
|
|
20
|
+
## Result policy
|
|
21
|
+
|
|
22
|
+
Every result-producing capability should have a result policy. Absence of a custom policy means the bounded SDK default:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"max_items": 8,
|
|
27
|
+
"max_chars": 24000,
|
|
28
|
+
"detail": "excerpt"
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
A caller may request less. Asking for more items, more characters, or a higher detail class requires the explicit `higher-detail` operation.
|
|
33
|
+
|
|
34
|
+
Progressive detail is ordered as:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
metadata
|
|
38
|
+
↓
|
|
39
|
+
card
|
|
40
|
+
↓
|
|
41
|
+
excerpt
|
|
42
|
+
↓
|
|
43
|
+
range
|
|
44
|
+
↓
|
|
45
|
+
full
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`normalizeResultPolicy()` enforces the ceiling. Built-in SDK tool cards inherit the bounded default rather than silently behaving as unlimited.
|
|
49
|
+
|
|
50
|
+
## Context budget
|
|
51
|
+
|
|
52
|
+
`createContextBudget()` derives per-class ceilings from the selected model's context window. The default operating ratios are:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
target active input 60%
|
|
56
|
+
emergency hard line 85%
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The remaining window is deliberate headroom for additional retrieval, tool iterations, reasoning, user input, and output.
|
|
60
|
+
|
|
61
|
+
A budget owns separate ceilings for:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
system / project rules
|
|
65
|
+
tool schemas
|
|
66
|
+
retrieved evidence
|
|
67
|
+
single file reads
|
|
68
|
+
cumulative file reads per turn
|
|
69
|
+
tool results
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For example:
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
import { createContextBudget } from '@inneranimalmedia/agentsam-sdk/context';
|
|
76
|
+
|
|
77
|
+
const budget = createContextBudget({
|
|
78
|
+
windowTokens: 250_000,
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The resulting budget tracks both tokens and deterministic character ceilings.
|
|
83
|
+
|
|
84
|
+
## Context items
|
|
85
|
+
|
|
86
|
+
Portable context evidence uses the following shape:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
interface ContextItem {
|
|
90
|
+
ref: string;
|
|
91
|
+
kind: 'file' | 'symbol' | 'memory' | 'tool_result' | 'repo' | 'artifact';
|
|
92
|
+
chars: number;
|
|
93
|
+
hash?: string;
|
|
94
|
+
priority: number;
|
|
95
|
+
content?: string;
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`resolveContext()` sorts candidate evidence by priority, applies kind-specific and cumulative limits, and returns only the selected items.
|
|
100
|
+
|
|
101
|
+
`resolveProjectContext()` does the same while automatically loading `.agentsamrules` within the system-context ceiling.
|
|
102
|
+
|
|
103
|
+
Every resolved pack includes a receipt:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"chars": 18422,
|
|
108
|
+
"evidence_chars": 17769,
|
|
109
|
+
"system_chars": 653,
|
|
110
|
+
"estimated_tokens": 4606,
|
|
111
|
+
"sources_considered": 73,
|
|
112
|
+
"sources_included": 6,
|
|
113
|
+
"sources_deferred": 67,
|
|
114
|
+
"deferred_refs": []
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The existing knowledge `ContextPack` now uses the same receipt vocabulary for retrieval hits.
|
|
119
|
+
|
|
120
|
+
### Consumed tool results
|
|
121
|
+
|
|
122
|
+
`compactConsumedToolResult()` defaults to 4,000 characters for evidence that has already had its high-fidelity pass. It preserves the item ref/hash/priority so later turns can expand the source again instead of replaying the original dump.
|
|
123
|
+
|
|
124
|
+
## Index law
|
|
125
|
+
|
|
126
|
+
> An index is a retrieval substrate, never prompt content.
|
|
127
|
+
|
|
128
|
+
The active prompt should receive a compact repository/index status plus selected evidence references. It should not receive an entire repository tree, symbol graph, embedding set, tool catalog, or hundreds of search results.
|
|
129
|
+
|
|
130
|
+
Prefer evidence in this order whenever possible:
|
|
131
|
+
|
|
132
|
+
```text
|
|
133
|
+
exact structural evidence
|
|
134
|
+
↓
|
|
135
|
+
bounded lexical/search evidence
|
|
136
|
+
↓
|
|
137
|
+
semantic retrieval
|
|
138
|
+
↓
|
|
139
|
+
explicit larger range/full object only when required
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Tool discovery
|
|
143
|
+
|
|
144
|
+
`searchToolCards()` supports cards-first discovery. It accepts a host/tool catalog and returns compact cards without full input schemas:
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"tool": "code.retrieve",
|
|
149
|
+
"summary": "Find symbols, callers, and semantic code matches.",
|
|
150
|
+
"risk": "read",
|
|
151
|
+
"required": ["query"],
|
|
152
|
+
"result_class": "bounded_evidence"
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
A host can hydrate the selected tool's full schema only after selection. This keeps the portable contract compatible with small local catalogs and large hosted catalogs without injecting all schemas at turn zero.
|
|
157
|
+
|
|
158
|
+
## Subagent handoff law
|
|
159
|
+
|
|
160
|
+
A child agent should return a compact work receipt rather than its entire prompt/tool history:
|
|
161
|
+
|
|
162
|
+
```text
|
|
163
|
+
conclusion
|
|
164
|
+
evidence refs
|
|
165
|
+
changed files
|
|
166
|
+
commands/tests
|
|
167
|
+
uncertainty
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The parent can expand an evidence ref when needed.
|