@inneranimalmedia/agentsam-sdk 2.5.0 → 2.6.1
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 +12 -8
- package/bin/agentsam +2 -0
- package/docs/AGENTSAM_ASTRA_OPENAI_INTEGRATION.md +1363 -0
- package/docs/CLI_SHELL.md +163 -53
- package/docs/PLATFORM_RUNTIME_EVENTS.md +48 -0
- package/docs/RELEASES.md +16 -7
- package/docs/SOURCE_ARCHITECTURE.md +58 -0
- package/docs/TEST_TIERS.md +26 -0
- package/migrations/runtime/0001_cli_runtime.sql +298 -0
- package/package.json +45 -12
- package/packages/agentsam-repository/README.md +15 -0
- package/packages/agentsam-repository/package.json +25 -0
- package/packages/agentsam-repository/src/contracts.js +113 -0
- package/packages/agentsam-repository/src/index.js +3 -0
- package/{src/lib → packages/agentsam-repository/src}/merkle/cloudflare-persistence.js +14 -24
- package/{src/lib → packages/agentsam-repository/src}/merkle/index.js +1 -0
- package/{src/lib → packages/agentsam-repository/src}/merkle/persistence.js +6 -4
- package/{src/lib → packages/agentsam-repository/src}/merkle/policy.js +1 -0
- package/packages/agentsam-repository/test/contracts.test.mjs +40 -0
- package/packages/agentsam-repository/test/git-context.test.mjs +24 -0
- package/{test/merkle.test.mjs → packages/agentsam-repository/test/merkle-core.test.mjs} +2 -32
- package/{test → packages/agentsam-repository/test}/merkle-persistence.test.mjs +11 -6
- 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 +2 -2
- package/packages/identity/src/contracts/auth-config.js +18 -7
- package/packages/identity/tests/auth-config.test.mjs +9 -5
- package/packages/identity/tests/oauth-credentials.test.mjs +4 -4
- package/protocol/COMPANY_REPOSITORY_GRAPH_V1.md +91 -0
- package/protocol/MERKLE_PERSISTENCE_V1.md +2 -0
- package/protocol/MERKLE_PERSISTENCE_V2.md +40 -0
- 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 +47 -0
- package/protocol/context/context-budget.schema.json +10 -15
- package/protocol/context/context-item.schema.json +4 -5
- package/protocol/context/resolved-context-pack.schema.json +19 -14
- package/protocol/models/README.md +373 -0
- package/protocol/models/model-inventory-v2.schema.json +212 -0
- package/protocol/repository/repository-contract.schema.json +24 -0
- package/protocol/repository/repository-dependency.schema.json +24 -0
- package/protocol/repository/repository-identity.schema.json +17 -0
- package/protocol/rpc/v1/common.proto +16 -0
- package/protocol/rpc/v1/errors.proto +35 -0
- package/protocol/rpc/v1/knowledge.proto +77 -0
- package/services/knowledge/package-lock.json +333 -0
- package/services/knowledge/package.json +5 -1
- 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/catalog.json +18 -0
- package/src/agent/capability-adapter.js +25 -13
- package/src/agent/index.js +1 -0
- package/src/agent/responses-runner.js +353 -0
- package/src/capabilities/repository-snapshot.js +3 -3
- package/src/cli.js +118 -31
- 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 +129 -0
- package/src/commands/context.js +1 -1
- package/src/commands/db.js +20 -3
- package/src/commands/deploy.js +39 -3
- package/src/commands/env.js +90 -0
- package/src/commands/eval.js +63 -0
- package/src/commands/interactive.js +2 -5
- package/src/commands/knowledge.js +12 -4
- package/src/commands/merkle-persist.js +30 -11
- package/src/commands/merkle.js +1 -1
- package/src/commands/models.js +149 -46
- package/src/commands/ollama.js +26 -0
- package/src/commands/preferences.js +130 -61
- package/src/commands/resume.js +67 -0
- package/src/commands/security.js +5 -3
- package/src/commands/shell.js +568 -119
- package/src/commands/tunnel.js +2 -2
- package/src/commands/whoami.js +86 -0
- package/src/context/budget.js +68 -6
- package/src/context/index.js +3 -1
- package/src/context/rehydrate.js +35 -0
- package/src/context/resolve.js +44 -12
- package/src/errors/contract.js +236 -0
- package/src/errors/diagnostic.js +160 -0
- package/src/errors/index.js +23 -0
- package/src/eval/context.js +191 -0
- package/src/eval/index.js +1 -0
- package/src/index.js +68 -2
- package/src/knowledge/service/auth.js +13 -0
- package/src/knowledge/service/grpc-client.js +115 -0
- package/src/knowledge/service/grpc-codec.js +237 -0
- package/src/knowledge/service/grpc-server.js +83 -0
- package/src/knowledge/service/job-engine.js +248 -0
- package/src/knowledge/service/server.js +87 -135
- package/src/knowledge/source.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/cli-preferences.js +55 -24
- 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 +2 -2
- package/src/lib/detect-context.js +2 -2
- package/src/lib/execution-approvals.js +59 -0
- package/src/lib/knowledge-docker.js +6 -3
- package/src/lib/local-sessions.js +148 -0
- package/src/lib/local-status.js +1 -1
- package/src/lib/project-config.js +1 -1
- package/src/lib/provider-credentials.js +183 -0
- 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 +23 -16
- package/src/local/migrations.js +93 -0
- package/src/local/runtime-store.js +141 -0
- package/src/local/sqlite.js +2 -0
- package/src/local-pty/server.js +113 -51
- package/src/models/catalog.js +135 -0
- package/src/models/discovery.js +292 -0
- package/src/models/index.js +7 -0
- package/src/providers/anthropic-messages.js +192 -0
- package/src/providers/cloudflare-chat.js +183 -0
- package/src/providers/factory.js +69 -0
- package/src/providers/gemini-generate-content.js +208 -0
- package/src/providers/index.js +10 -0
- package/src/providers/ollama-chat.js +148 -0
- package/src/providers/openai-responses.js +426 -0
- package/src/repository/index.js +14 -2
- package/src/rpc/generated/common_grpc_pb.js +1 -0
- package/src/rpc/generated/common_pb.js +536 -0
- package/src/rpc/generated/errors_grpc_pb.js +1 -0
- package/src/rpc/generated/errors_pb.js +482 -0
- package/src/rpc/generated/knowledge_grpc_pb.js +135 -0
- package/src/rpc/generated/knowledge_pb.js +2168 -0
- package/src/rpc/generated/package.json +3 -0
- package/src/security/process.js +35 -9
- package/src/security/trust-boundary.js +2 -2
- package/src/telemetry/contracts.js +203 -0
- package/src/telemetry/events.js +51 -0
- package/src/telemetry/index.js +8 -0
- package/src/tools/hydrate.js +35 -0
- package/src/tools/index.js +1 -0
- package/src/ui/boot.js +15 -17
- package/src/ui/cli/activity.js +76 -0
- package/src/ui/cli/compaction.js +15 -0
- package/src/ui/cli/footer.js +39 -0
- package/src/ui/cli/help.js +192 -0
- package/src/ui/cli/plan.js +20 -0
- package/src/ui/cli/runtime-events.js +110 -0
- package/src/ui/cli/waiting.js +16 -0
- package/src/ui/merkle/render.js +1 -1
- package/test/account-session.test.mjs +36 -0
- package/test/cli/preferences-runtime.test.mjs +11 -0
- package/test/cli/runtime-ui.test.mjs +74 -0
- package/test/cli-preferences.test.mjs +26 -5
- package/test/cloudflare-connector.test.mjs +96 -0
- package/test/cloudflare-runtime.test.mjs +75 -0
- package/test/context.test.mjs +61 -12
- package/test/deploy-health-scan.test.mjs +67 -0
- package/test/error-diagnostics.test.mjs +115 -0
- package/test/eval-context.test.mjs +37 -0
- package/test/execution-approvals.test.mjs +27 -0
- package/test/fixtures/knowledge-rpc-worker.mjs +16 -0
- package/test/integration/cli-help.test.mjs +37 -0
- package/test/integration/knowledge-rpc.test.mjs +112 -0
- package/test/integration/merkle-cli.test.mjs +61 -0
- package/test/integration/merkle-persistence-identity.test.mjs +48 -0
- package/test/integration/provider-env-cli.test.mjs +49 -0
- package/test/integration/provider-factory.test.mjs +197 -0
- package/test/integration/repository-company-graph.test.mjs +90 -0
- package/test/integration/runtime-migrations.test.mjs +82 -0
- package/test/knowledge-service.test.mjs +5 -0
- package/test/knowledge.test.mjs +16 -0
- package/test/live/terminal-transport.live.test.mjs +24 -0
- package/test/local-sessions.test.mjs +48 -0
- package/test/local-studio-deploy.test.mjs +83 -0
- package/test/model-catalog.test.mjs +43 -0
- package/test/models.test.mjs +127 -16
- package/test/npm10-lock.test.mjs +29 -0
- package/test/ollama.test.mjs +21 -0
- package/test/openai-responses.test.mjs +95 -0
- package/test/portable-context.test.mjs +1 -1
- package/test/provider-credentials.test.mjs +96 -0
- package/test/rehydrate.test.mjs +25 -0
- package/test/release-hygiene.test.mjs +13 -5
- package/test/responses-runner.test.mjs +150 -0
- package/test/shell.test.mjs +92 -23
- package/test/smoke.mjs +4 -1
- package/test/telemetry.test.mjs +79 -0
- package/test/terminal/local-pty.mock.test.mjs +151 -0
- package/test/tools-search.test.mjs +14 -1
- package/test/whoami-resume.test.mjs +56 -0
- /package/{src/lib → packages/agentsam-repository/src}/git-context.js +0 -0
- /package/{src/lib → packages/agentsam-repository/src}/merkle/diff.js +0 -0
- /package/{src/lib → packages/agentsam-repository/src}/merkle/filemeta.js +0 -0
- /package/{src/lib → packages/agentsam-repository/src}/merkle/git-ignore.js +0 -0
- /package/{src/lib → packages/agentsam-repository/src}/merkle/hash.js +0 -0
- /package/{src/lib → packages/agentsam-repository/src}/merkle/semantic.js +0 -0
- /package/{src/lib → packages/agentsam-repository/src}/merkle/snapshot.js +0 -0
- /package/{src/lib → packages/agentsam-repository/src}/merkle/tree.js +0 -0
package/docs/CLI_SHELL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Agent Sam SDK — terminal experience
|
|
2
2
|
|
|
3
|
-
`agentsam` is the product entrypoint. Users do not choose a renderer or need to know whether a screen is implemented with ANSI,
|
|
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
|
|
|
@@ -8,26 +8,166 @@
|
|
|
8
8
|
agentsam
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
On
|
|
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
|
+
|
|
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
|
|
37
|
+
```
|
|
38
|
+
|
|
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.
|
|
40
|
+
|
|
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
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Provider-brand commands such as `/claude` or `/codex` are not the generic shell contract. Model execution stays behind Agent Sam.
|
|
74
|
+
|
|
75
|
+
## Credentials and identity
|
|
76
|
+
|
|
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.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
agentsam whoami
|
|
93
|
+
agentsam whoami --json
|
|
94
|
+
```
|
|
95
|
+
|
|
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.
|
|
12
103
|
|
|
13
104
|
```text
|
|
14
|
-
|
|
105
|
+
Agent Sam needs execution permission
|
|
15
106
|
|
|
16
|
-
|
|
17
|
-
|
|
107
|
+
action cloudflare.wrangler.native:whoami
|
|
108
|
+
target local runtime · ~/project
|
|
109
|
+
effect local_process
|
|
110
|
+
input {"command":"whoami"}
|
|
18
111
|
|
|
19
|
-
|
|
20
|
-
✓ runtime
|
|
21
|
-
✓ model
|
|
112
|
+
secrets remain runtime-owned and are not included in the model-visible result.
|
|
22
113
|
|
|
23
|
-
|
|
114
|
+
? Allow cloudflare.wrangler.native:whoami?
|
|
115
|
+
Allow once
|
|
116
|
+
Always allow cloudflare.wrangler.native:whoami in this project
|
|
117
|
+
Deny
|
|
24
118
|
```
|
|
25
119
|
|
|
26
|
-
|
|
120
|
+
Persistent approvals are exact-operation and exact-project grants. Approving `wrangler whoami` does not authorize another Wrangler operation or another repository.
|
|
27
121
|
|
|
28
|
-
|
|
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.
|
|
29
123
|
|
|
30
|
-
|
|
124
|
+
## Sessions and resume
|
|
125
|
+
|
|
126
|
+
Every interactive Agent Sam run receives a provider-neutral session identifier:
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
asess_<uuid>
|
|
130
|
+
```
|
|
131
|
+
|
|
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.
|
|
133
|
+
|
|
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.
|
|
135
|
+
|
|
136
|
+
Housekeeping actions such as `/exit`, `/help`, and `/session` do not replace that human-readable title.
|
|
137
|
+
|
|
138
|
+
On Ctrl+C or normal exit, Agent Sam saves the session and prints a compact receipt:
|
|
139
|
+
|
|
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
|
|
144
|
+
|
|
145
|
+
To continue this session, run:
|
|
146
|
+
agentsam resume asess_...
|
|
147
|
+
|
|
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
|
|
164
|
+
```
|
|
165
|
+
|
|
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
|
|
169
|
+
|
|
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.
|
|
31
171
|
|
|
32
172
|
## One-shot commands
|
|
33
173
|
|
|
@@ -36,14 +176,15 @@ Normal commands remain deterministic and scriptable:
|
|
|
36
176
|
```bash
|
|
37
177
|
agentsam status
|
|
38
178
|
agentsam models
|
|
39
|
-
agentsam
|
|
179
|
+
agentsam whoami --json
|
|
180
|
+
agentsam inspect --match oauth --view files --json
|
|
40
181
|
agentsam deploy
|
|
41
182
|
agentsam --help
|
|
42
183
|
```
|
|
43
184
|
|
|
44
|
-
`agentsam shell` remains an explicit/secondary way to enter the
|
|
185
|
+
`agentsam shell` remains an explicit/secondary way to enter the same shell. Bare `agentsam` is the normal interactive entrypoint.
|
|
45
186
|
|
|
46
|
-
For regression tests,
|
|
187
|
+
For regression tests, a slash command can be dispatched without creating interactive-session clutter:
|
|
47
188
|
|
|
48
189
|
```bash
|
|
49
190
|
agentsam shell --command /help
|
|
@@ -51,56 +192,25 @@ agentsam shell --command /help
|
|
|
51
192
|
|
|
52
193
|
## Internal UI engine
|
|
53
194
|
|
|
54
|
-
|
|
195
|
+
Presentation is implementation detail:
|
|
55
196
|
|
|
56
197
|
```text
|
|
57
198
|
Agent Sam lifecycle/state
|
|
58
199
|
|
|
|
59
200
|
+--> ANSI / picocolors semantic color + cursor control
|
|
60
|
-
+--> Rich renderer high-fidelity live render experiments
|
|
61
201
|
+--> Clack prompts arrow-key selects / confirms / text input
|
|
62
|
-
+-->
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
SDK developers can preview render experiments from this repository without exposing renderer names as product commands:
|
|
66
|
-
|
|
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
|
-
```
|
|
75
|
-
|
|
76
|
-
These preview commands are a design lab, not part of the installed user vocabulary.
|
|
77
|
-
|
|
78
|
-
## Slash commands
|
|
79
|
-
|
|
80
|
-
```text
|
|
81
|
-
/help show commands
|
|
82
|
-
/status local project / DB / Git / PTY health
|
|
83
|
-
/context current repository + revision
|
|
84
|
-
/pwd working directory
|
|
85
|
-
/cd change working directory
|
|
86
|
-
/git Git operations
|
|
87
|
-
/db local SQLite
|
|
88
|
-
/agent invoke configured Agent Sam
|
|
89
|
-
/models inspect available providers and local models
|
|
90
|
-
/settings choose project/runtime/terminal/model preference
|
|
91
|
-
/logs local execution events
|
|
92
|
-
/deploy intentionally add a cloud adapter
|
|
93
|
-
/exit exit Agent Sam and return to the host terminal
|
|
202
|
+
+--> runtime activity thinking/tool/context lifecycle
|
|
203
|
+
+--> node-pty / host runtime real process/filesystem boundary
|
|
94
204
|
```
|
|
95
205
|
|
|
96
|
-
|
|
206
|
+
SDK developers can preview rendering experiments from this repository, but those are design-lab commands rather than installed product vocabulary.
|
|
97
207
|
|
|
98
208
|
## Local project contract
|
|
99
209
|
|
|
100
|
-
`agentsam init`
|
|
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.
|
|
101
211
|
|
|
102
|
-
Local development
|
|
212
|
+
Local development does not require a cloud account. Cloud infrastructure is added intentionally.
|
|
103
213
|
|
|
104
214
|
## Design rule
|
|
105
215
|
|
|
106
|
-
A CLI operation must remain understandable in plain text and deterministic in CI/pipes. Interactive terminals may enhance
|
|
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,48 @@
|
|
|
1
|
+
# Platform runtime event dependency
|
|
2
|
+
|
|
3
|
+
Status: **SDK consumer ready; platform producer pending.**
|
|
4
|
+
|
|
5
|
+
The standalone CLI does not depend on a platform event endpoint. Local/provider execution emits runtime events directly into the same presenter used by future platform-connected sessions.
|
|
6
|
+
|
|
7
|
+
The cross-repo dependency is in `SamPrimeaux/inneranimalmedia`: its pending agent-runtime SSE/event channel must eventually deliver the same normalized envelope consumed by:
|
|
8
|
+
|
|
9
|
+
`src/ui/cli/runtime-events.js -> normalizeRuntimeEventEnvelope()`
|
|
10
|
+
|
|
11
|
+
The SDK intentionally does **not** invent a route such as `/api/sdk/agent/runs`. Endpoint ownership, authorization, reconnection, and SSE lifecycle belong to the platform repository.
|
|
12
|
+
|
|
13
|
+
## Producer contract
|
|
14
|
+
|
|
15
|
+
Each platform event delivered to the SDK must normalize to:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
{
|
|
19
|
+
schema_version: 1,
|
|
20
|
+
type: "tool.started",
|
|
21
|
+
timestamp: "2026-09-18T00:00:00.000Z",
|
|
22
|
+
run_id: "run_...",
|
|
23
|
+
sequence: 3,
|
|
24
|
+
payload: {
|
|
25
|
+
// event-specific data
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`run_id` and `sequence` are optional when the source cannot supply them. `type` is required. `payload` is always normalized to an object.
|
|
31
|
+
|
|
32
|
+
The SDK adds the internal contract marker `schema: "agentsam-runtime-event-v1"` after normalization. Platform producers do not need to know about CLI rendering, spinners, plans, approval prompts, compaction UI, or footer layout. They only emit the envelope.
|
|
33
|
+
|
|
34
|
+
Current event vocabulary is declared in `src/telemetry/events.js`, including model, usage, cost, context, tool, approval, plan/task, timer, waiting-input, error, and run lifecycle events.
|
|
35
|
+
|
|
36
|
+
## Boundary
|
|
37
|
+
|
|
38
|
+
Standalone completion is not blocked by this dependency.
|
|
39
|
+
|
|
40
|
+
The release-blocking standalone path is:
|
|
41
|
+
|
|
42
|
+
provider/local runtime -> AgentEvent -> normalizeRuntimeEventEnvelope -> CLI presenter
|
|
43
|
+
|
|
44
|
+
The later platform-connected path should be:
|
|
45
|
+
|
|
46
|
+
platform runtime -> SSE/WebSocket transport -> normalizeRuntimeEventEnvelope -> same CLI presenter
|
|
47
|
+
|
|
48
|
+
If platform integration requires changing the presenter contract instead of only adding the transport connection, treat that as a contract regression.
|
package/docs/RELEASES.md
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
# `@inneranimalmedia/agentsam-sdk` release receipts
|
|
2
2
|
|
|
3
|
-
**2.
|
|
4
|
-
The npm `latest` dist-tag is **2.4.1**. The private identity workspace continues to
|
|
3
|
+
**2.6.0 is published and is the npm `latest` release.** The private identity workspace continues to
|
|
5
4
|
ship through root SDK exports and is not published separately.
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`
|
|
6
|
+
Published at `2026-09-12T21:14:57.827Z` from git SHA
|
|
7
|
+
`ae32fba0a761cb18c5f940957bdcd58e3cab6072`, tagged `v2.6.0`. Registry integrity:
|
|
8
|
+
`sha512-98xvyIXGcX6/S0nFUkB2+s4zPxF5WvN/eYBjt6s575uC/ux/xB9Y0dH+pw7ur5TMRkQj7JDR4XN5cSy6I2Hr+w==`.
|
|
9
|
+
Publishing remains manual and `prepublishOnly` runs `npm run verify:release`.
|
|
10
10
|
|
|
11
|
-
## 2.
|
|
11
|
+
## 2.6.0 highlights
|
|
12
|
+
|
|
13
|
+
- Interactive AgentSam now has persistent machine-local account/session identity with explicit `login`, `logout`, `whoami`, and `resume` flows.
|
|
14
|
+
- `/models` and model-selection UX bind to the canonical model inventory v2 contract instead of maintaining a second CLI catalog.
|
|
15
|
+
- Provider credentials and account BYOK resolution are scoped, source-aware, and reusable across interactive, deploy, and tunnel flows without storing secrets in project state.
|
|
16
|
+
- Runtime receipts now model account-owned runs, provider usage, approvals, and terminal jobs with stable lineage and no tenant/workspace/user ownership aliases.
|
|
17
|
+
- Cloudflare diagnostics, context economics, repository evidence, and security/indexing contracts accumulated after 2.5.0 are included in the same verified release lineage.
|
|
18
|
+
|
|
19
|
+
## 2.5.0 highlights
|
|
12
20
|
|
|
13
21
|
- `agentsam` is the interactive product entrypoint; renderer selection is internal, and live thinking/activity scenes now run automatically around real Agent Sam work.
|
|
14
22
|
- Portable project authority is `.agentsam/config.json` + `.agentsamrules`; local CLI preferences remain non-authoritative.
|
|
@@ -23,7 +31,8 @@ publish commit will be recorded here after release. Publishing remains manual an
|
|
|
23
31
|
|
|
24
32
|
| npm version | Published (UTC) | IAM git SHA (40) | Notes |
|
|
25
33
|
|-------------|-----------------|------------------|-------|
|
|
26
|
-
| 2.
|
|
34
|
+
| 2.6.0 | 2026-09-12T21:14:57.827Z | `ae32fba0a761cb18c5f940957bdcd58e3cab6072` | Published package; npm `latest`; registry `gitHead`, shasum, integrity, and `v2.6.0` tag verified. |
|
|
35
|
+
| 2.5.0 | 2026-09-11T21:27:11.516Z | `da28623dc4808025b77605ed09aa16217b1db607` | Published package; registry `gitHead` receipt. |
|
|
27
36
|
| 2.4.1 | 2026-09-11T05:45:03.622Z | `a256ababededd904da555e7898bc8afd753737d2` | Latest published package before 2.5.0. |
|
|
28
37
|
| 2.4.0 | 2026-09-11T05:29:02.811Z | `81c8659977953bed53c2adb0a341ce7382be4794` | Published 2.4 line. |
|
|
29
38
|
| 2.3.0 | 2026-09-11T05:09:40.046Z | `b517a720fb9b90f35c26f9ef87a84abd60d7ee01` | Published 2.3 line. |
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# AgentSam SDK source architecture
|
|
2
|
+
|
|
3
|
+
The SDK root is the product/package composition layer, not the permanent home for every reusable subsystem.
|
|
4
|
+
|
|
5
|
+
## Ownership rule
|
|
6
|
+
|
|
7
|
+
New reusable code should have an explicit owner:
|
|
8
|
+
|
|
9
|
+
- `packages/agentsam-contracts/` — framework-neutral wire/types vocabulary shared across AgentSam products and repositories.
|
|
10
|
+
- `packages/identity/` — identity/auth contracts and adapters.
|
|
11
|
+
- `packages/connectors/*/` — provider-specific connectors.
|
|
12
|
+
- `packages/agentsam-workbench/` — reusable UI/workbench primitives.
|
|
13
|
+
- `apps/*/` — self-contained applications with their own frontend/backend/shared package boundaries.
|
|
14
|
+
- root `src/commands/`, `src/cli.js`, and `src/index.js` — SDK/CLI composition and public facade.
|
|
15
|
+
|
|
16
|
+
`src/lib/` is a legacy extraction zone. Its current files are supported, but new unrelated reusable modules must not be added there. The source-boundary verifier freezes that surface so it can shrink over time.
|
|
17
|
+
|
|
18
|
+
## Package extraction status
|
|
19
|
+
|
|
20
|
+
Do not split the repo into micro-packages for their own sake. Extract a subsystem when it has a coherent public responsibility and can own its tests.
|
|
21
|
+
|
|
22
|
+
**Extracted:** `packages/agentsam-repository/` now owns Git identity, Merkle/filemeta algorithms, repository graph runtime normalization, and snapshot persistence. Root SDK exports and CLI/runtime consumers compose that package without restoring `src/lib/merkle` or `src/lib/git-context.js`.
|
|
23
|
+
|
|
24
|
+
Next coherent extractions:
|
|
25
|
+
|
|
26
|
+
1. **Runtime/core** — account session, provider credentials, execution approvals, run/session primitives, and telemetry composition that are not CLI-specific.
|
|
27
|
+
2. **Knowledge/indexing** — repository knowledge engine, stores, indexing provider contracts, and service client/runtime seams.
|
|
28
|
+
|
|
29
|
+
The root CLI should depend on these packages; packages must not depend on root CLI/commands/UI internals.
|
|
30
|
+
|
|
31
|
+
## Test placement
|
|
32
|
+
|
|
33
|
+
Package behavior belongs with the package:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
packages/identity/tests/*
|
|
37
|
+
packages/agentsam-contracts/test/*
|
|
38
|
+
packages/agentsam-workbench/test/*
|
|
39
|
+
packages/connectors/cloudflare/tests/*
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Root SDK tests should move toward explicit roles:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
test/integration/* cross-package/root-facade behavior
|
|
46
|
+
test/cli/* CLI command behavior
|
|
47
|
+
test/release/* packaging/release hygiene
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The existing flat `test/*.test.mjs` set is legacy debt. It is frozen: old tests may remain while their owning subsystem is extracted, but new flat tests are rejected by `npm run verify:boundaries`.
|
|
51
|
+
|
|
52
|
+
## App isolation
|
|
53
|
+
|
|
54
|
+
Every `apps/<name>/` is a self-contained application boundary. Apps may consume documented SDK/package exports, but must not deep-import root `src/` implementation files. Reusable app logic should live in that app's `shared/` package first, then move to a top-level package only when it is genuinely cross-application.
|
|
55
|
+
|
|
56
|
+
## Company graph / Merkle authority
|
|
57
|
+
|
|
58
|
+
`agentsam-sdk` defines the portable vocabulary and deterministic algorithms. `inneranimalmedia` owns account-scoped operational persistence. The SDK must not introduce tenant/workspace/user ownership aliases or environment variables that impersonate authenticated account/repository authority.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# AgentSam SDK test tiers
|
|
2
|
+
|
|
3
|
+
The release-blocking test gate must be deterministic and must not require ExecOS, a user-hosted terminal tunnel, a cloud VM, or any other live external daemon.
|
|
4
|
+
|
|
5
|
+
## Release-blocking tiers
|
|
6
|
+
|
|
7
|
+
`npm test` runs these tiers:
|
|
8
|
+
|
|
9
|
+
- `npm run test:unit` — deterministic unit/contract tests.
|
|
10
|
+
- `npm run test:integration:mock` — integration behavior against local or mocked dependencies.
|
|
11
|
+
- `npm run test:terminal:mock` — terminal/PTY behavior through an injected mock PTY transport. No ExecOS or tunnel is contacted.
|
|
12
|
+
- identity and connector tests already included by the root `npm test` script.
|
|
13
|
+
|
|
14
|
+
These tiers are the standard release gate and are suitable for GitHub Actions.
|
|
15
|
+
|
|
16
|
+
## Live terminal tier
|
|
17
|
+
|
|
18
|
+
`npm run test:live:terminal` is deliberately outside `npm test` and `npm run verify`.
|
|
19
|
+
|
|
20
|
+
Set `AGENTSAM_LIVE_TERMINAL_WS_URL` to a real enrolled terminal WebSocket URL when an operator intentionally wants to exercise a live transport. `AGENTSAM_LIVE_TERMINAL_AUTH` may be supplied when that endpoint requires an Authorization header.
|
|
21
|
+
|
|
22
|
+
If no live URL is supplied, the live test is skipped. A tunnel outage must never make the package release gate red.
|
|
23
|
+
|
|
24
|
+
## Rule
|
|
25
|
+
|
|
26
|
+
Tests may verify terminal protocol semantics in the release-blocking suite only through a local/mock transport. Any test that depends on ExecOS, a provisioned IAM terminal connection, Cloudflare Tunnel, or a real remote PTY belongs in the explicit live tier.
|