@inneranimalmedia/agentsam-sdk 2.5.0 → 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 +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/RELEASES.md +16 -7
- package/package.json +20 -8
- 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/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/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 +325 -0
- package/src/cli.js +98 -28
- 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/deploy.js +39 -3
- package/src/commands/eval.js +63 -0
- package/src/commands/interactive.js +2 -5
- package/src/commands/models.js +85 -40
- package/src/commands/preferences.js +101 -59
- package/src/commands/resume.js +67 -0
- package/src/commands/security.js +5 -3
- package/src/commands/shell.js +370 -109
- 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/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 +55 -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 +28 -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/detect-context.js +2 -2
- package/src/lib/execution-approvals.js +59 -0
- package/src/lib/local-sessions.js +127 -0
- package/src/lib/provider-credentials.js +83 -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 +22 -16
- 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/process.js +35 -9
- 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 +1 -0
- package/src/ui/boot.js +15 -17
- package/test/account-session.test.mjs +36 -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 +59 -0
- package/test/eval-context.test.mjs +37 -0
- package/test/execution-approvals.test.mjs +27 -0
- package/test/local-sessions.test.mjs +42 -0
- package/test/local-studio-deploy.test.mjs +83 -0
- package/test/model-catalog.test.mjs +43 -0
- package/test/models.test.mjs +30 -16
- package/test/npm10-lock.test.mjs +29 -0
- package/test/openai-responses.test.mjs +95 -0
- package/test/provider-credentials.test.mjs +52 -0
- package/test/rehydrate.test.mjs +25 -0
- package/test/release-hygiene.test.mjs +4 -4
- package/test/responses-runner.test.mjs +148 -0
- package/test/shell.test.mjs +47 -20
- package/test/smoke.mjs +4 -1
- package/test/telemetry.test.mjs +79 -0
- package/test/tools-search.test.mjs +14 -1
- package/test/whoami-resume.test.mjs +56 -0
|
@@ -7,14 +7,13 @@
|
|
|
7
7
|
"required": ["ref", "kind", "chars", "priority"],
|
|
8
8
|
"properties": {
|
|
9
9
|
"ref": { "type": "string", "minLength": 1 },
|
|
10
|
-
"kind": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"enum": ["file", "symbol", "memory", "tool_result", "repo", "artifact"]
|
|
13
|
-
},
|
|
10
|
+
"kind": { "type": "string", "enum": ["file", "symbol", "memory", "tool_result", "repo", "artifact"] },
|
|
14
11
|
"chars": { "type": "integer", "minimum": 0 },
|
|
15
12
|
"hash": { "type": "string" },
|
|
16
13
|
"priority": { "type": "number" },
|
|
17
14
|
"content": { "type": "string" },
|
|
18
|
-
"truncated": { "type": "boolean" }
|
|
15
|
+
"truncated": { "type": "boolean" },
|
|
16
|
+
"compacted": { "type": "boolean" },
|
|
17
|
+
"source_chars": { "type": "integer", "minimum": 0 }
|
|
19
18
|
}
|
|
20
19
|
}
|
|
@@ -9,33 +9,38 @@
|
|
|
9
9
|
"objective": { "type": "string", "minLength": 1 },
|
|
10
10
|
"refs": { "type": "array", "items": { "type": "string" } },
|
|
11
11
|
"rules": { "type": ["object", "null"] },
|
|
12
|
-
"items": {
|
|
13
|
-
"type": "array",
|
|
14
|
-
"items": { "$ref": "./context-item.schema.json" }
|
|
15
|
-
},
|
|
12
|
+
"items": { "type": "array", "items": { "$ref": "./context-item.schema.json" } },
|
|
16
13
|
"budget": { "$ref": "./context-budget.schema.json" },
|
|
17
14
|
"receipt": {
|
|
18
15
|
"type": "object",
|
|
19
16
|
"additionalProperties": false,
|
|
20
17
|
"required": [
|
|
21
|
-
"chars",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"sources_considered",
|
|
26
|
-
"sources_included",
|
|
27
|
-
"sources_deferred",
|
|
28
|
-
"deferred_refs"
|
|
18
|
+
"chars", "system_chars", "instruction_chars", "tool_schema_chars", "history_chars", "evidence_chars", "tool_result_chars",
|
|
19
|
+
"estimated_tokens", "estimated_input_tokens", "window_tokens", "utilization_ratio", "pricing_threshold_tokens",
|
|
20
|
+
"tokens_until_pricing_threshold", "pressure", "estimate_kind", "sources_considered", "sources_included",
|
|
21
|
+
"sources_deferred", "deferred_refs", "rehydratable_refs"
|
|
29
22
|
],
|
|
30
23
|
"properties": {
|
|
31
24
|
"chars": { "type": "integer", "minimum": 0 },
|
|
32
|
-
"evidence_chars": { "type": "integer", "minimum": 0 },
|
|
33
25
|
"system_chars": { "type": "integer", "minimum": 0 },
|
|
26
|
+
"instruction_chars": { "type": "integer", "minimum": 0 },
|
|
27
|
+
"tool_schema_chars": { "type": "integer", "minimum": 0 },
|
|
28
|
+
"history_chars": { "type": "integer", "minimum": 0 },
|
|
29
|
+
"evidence_chars": { "type": "integer", "minimum": 0 },
|
|
30
|
+
"tool_result_chars": { "type": "integer", "minimum": 0 },
|
|
34
31
|
"estimated_tokens": { "type": "integer", "minimum": 0 },
|
|
32
|
+
"estimated_input_tokens": { "type": "integer", "minimum": 0 },
|
|
33
|
+
"window_tokens": { "type": "integer", "minimum": 1 },
|
|
34
|
+
"utilization_ratio": { "type": "number", "minimum": 0 },
|
|
35
|
+
"pricing_threshold_tokens": { "type": ["integer", "null"] },
|
|
36
|
+
"tokens_until_pricing_threshold": { "type": ["integer", "null"] },
|
|
37
|
+
"pressure": { "type": "string", "enum": ["normal", "target", "compact", "intervene", "max-normal", "hard"] },
|
|
38
|
+
"estimate_kind": { "type": "string", "enum": ["local", "provider"] },
|
|
35
39
|
"sources_considered": { "type": "integer", "minimum": 0 },
|
|
36
40
|
"sources_included": { "type": "integer", "minimum": 0 },
|
|
37
41
|
"sources_deferred": { "type": "integer", "minimum": 0 },
|
|
38
|
-
"deferred_refs": { "type": "array", "items": { "type": "string" } }
|
|
42
|
+
"deferred_refs": { "type": "array", "items": { "type": "string" } },
|
|
43
|
+
"rehydratable_refs": { "type": "array", "items": { "type": "string" } }
|
|
39
44
|
}
|
|
40
45
|
}
|
|
41
46
|
}
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
# AgentSam model selection SSOT contract
|
|
2
|
+
|
|
3
|
+
Status: **normative v1 acceptance contract** for `/models`, `agentsam models`, exact model selection, provider facts, pricing provenance, and runtime receipts.
|
|
4
|
+
|
|
5
|
+
The core law is:
|
|
6
|
+
|
|
7
|
+
> **AgentSam recommends models; providers define model facts; users select the exact model; runtime receipts prove what actually ran.**
|
|
8
|
+
|
|
9
|
+
This contract exists to prevent model UX, provider discovery, pricing, runtime selection, and usage accounting from drifting apart across CLI, dashboard, MCP, subagents, or future surfaces.
|
|
10
|
+
|
|
11
|
+
## 1. One model system
|
|
12
|
+
|
|
13
|
+
The following surfaces MUST resolve through one model inventory + selection authority:
|
|
14
|
+
|
|
15
|
+
- interactive `/models` and `/model`;
|
|
16
|
+
- `agentsam models` and `agentsam models --json`;
|
|
17
|
+
- `agentsam -m <model_id>`;
|
|
18
|
+
- persisted user model preferences;
|
|
19
|
+
- dashboard / Work model selectors;
|
|
20
|
+
- MCP-driven AgentSam sessions;
|
|
21
|
+
- subagent profiles;
|
|
22
|
+
- model execution adapters;
|
|
23
|
+
- run/session receipts and usage accounting.
|
|
24
|
+
|
|
25
|
+
A surface MAY render the data differently. It MUST NOT maintain an independent model catalog, price table, fallback list, or runtime-selection rule.
|
|
26
|
+
|
|
27
|
+
## 2. Exact model identity is explicit runtime state
|
|
28
|
+
|
|
29
|
+
A model selection is the tuple:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
provider
|
|
33
|
+
model_id
|
|
34
|
+
reasoning_effort
|
|
35
|
+
service_tier
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The exact provider and exact model MUST be user-visible before inference when a selection is required.
|
|
39
|
+
|
|
40
|
+
The runtime MUST NOT silently replace an exact selected model with `automatic`, `best available`, `default`, a fallback model, or another provider.
|
|
41
|
+
|
|
42
|
+
If an exact model is unavailable, AgentSam MUST stop and let the user choose another model. A future user-configured routing policy MAY permit substitution, but that policy itself must be explicit, inspectable, and recorded in the run receipt.
|
|
43
|
+
|
|
44
|
+
## 3. Provider credentials: machine-local provider SSOT
|
|
45
|
+
|
|
46
|
+
Provider API credentials are machine-local runtime state. They are not project configuration and must never enter model-visible output.
|
|
47
|
+
|
|
48
|
+
The current AgentSam provider-file convention is:
|
|
49
|
+
|
|
50
|
+
```text
|
|
51
|
+
~/.agentsam/env.d/openai.env OPENAI_API_KEY
|
|
52
|
+
~/.agentsam/env.d/gemini.env GEMINI_API_KEY
|
|
53
|
+
~/.agentsam/env.d/cloudflare.env CLOUDFLARE_API_TOKEN
|
|
54
|
+
~/.agentsam/env.d/anthropic.env ANTHROPIC_API_KEY
|
|
55
|
+
~/.agentsam/env.d/xai.env XAI_API_KEY
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`~/.agentsam/load-agent-env.sh <provider>` is a human/debug helper. Normal AgentSam usage MUST NOT require the user to manually `source` or `unset` credentials before `/models` or model execution.
|
|
59
|
+
|
|
60
|
+
AgentSam MUST resolve provider credentials internally using the canonical credential resolver. Provider files must be permission-safe and parsed for the expected variable; they must not be evaluated as arbitrary shell code.
|
|
61
|
+
|
|
62
|
+
IAM / AgentSam account authentication is a separate credential category. An account session MUST NOT become the storage authority for OpenAI, Gemini, Cloudflare, Anthropic, xAI, or other provider API keys.
|
|
63
|
+
|
|
64
|
+
Public status may expose only safe metadata such as:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
provider
|
|
68
|
+
configured / present
|
|
69
|
+
source_class
|
|
70
|
+
safe source path
|
|
71
|
+
valid / provider_accepts
|
|
72
|
+
required_capability / authorized
|
|
73
|
+
verified_at
|
|
74
|
+
secret_hidden=true
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Secret values, authorization headers, bearer tokens, or recoverable derivatives are forbidden in UI, JSON inventory, logs, model context, session titles, and receipts.
|
|
78
|
+
|
|
79
|
+
## 4. Provider facts vs AgentSam policy
|
|
80
|
+
|
|
81
|
+
Provider facts and AgentSam recommendations are different authorities and MUST remain distinguishable.
|
|
82
|
+
|
|
83
|
+
### Provider-owned facts
|
|
84
|
+
|
|
85
|
+
Where the provider exposes them, AgentSam normalizes:
|
|
86
|
+
|
|
87
|
+
- exact model ID;
|
|
88
|
+
- availability to the current credential/account;
|
|
89
|
+
- input/context limit;
|
|
90
|
+
- maximum output tokens;
|
|
91
|
+
- reasoning controls;
|
|
92
|
+
- modalities;
|
|
93
|
+
- function/tool support declared by the provider;
|
|
94
|
+
- service tiers;
|
|
95
|
+
- input pricing;
|
|
96
|
+
- cached-input / cache-write pricing;
|
|
97
|
+
- output pricing;
|
|
98
|
+
- long-context thresholds or multipliers;
|
|
99
|
+
- other provider-specific pricing rules.
|
|
100
|
+
|
|
101
|
+
Every normalized provider fact MUST retain provenance sufficient to answer:
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
value
|
|
105
|
+
source_kind
|
|
106
|
+
source_ref or provider
|
|
107
|
+
observed_at / pricing_as_of
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Preferred source order for a fact is:
|
|
111
|
+
|
|
112
|
+
1. provider machine-readable API;
|
|
113
|
+
2. provider authoritative published model/pricing source;
|
|
114
|
+
3. unavailable / unknown.
|
|
115
|
+
|
|
116
|
+
AgentSam MUST NOT silently substitute an old hardcoded guess when an authoritative fact cannot be refreshed.
|
|
117
|
+
|
|
118
|
+
If a last-verified value is retained for resilience, it MUST be labeled with its verification timestamp and current/stale state. A stale value must never be presented as freshly provider-verified.
|
|
119
|
+
|
|
120
|
+
### AgentSam-owned policy
|
|
121
|
+
|
|
122
|
+
AgentSam may add clearly separated policy metadata such as:
|
|
123
|
+
|
|
124
|
+
- recommended rank;
|
|
125
|
+
- coding / agentic / vision / low-cost / long-context tags;
|
|
126
|
+
- working-context target;
|
|
127
|
+
- compaction threshold;
|
|
128
|
+
- compatibility notes;
|
|
129
|
+
- measured AgentSam eval results.
|
|
130
|
+
|
|
131
|
+
AgentSam policy MUST NOT overwrite provider capacity, capability, availability, or price facts.
|
|
132
|
+
|
|
133
|
+
## 5. Runtime compatibility is not the same as provider capability
|
|
134
|
+
|
|
135
|
+
A provider may declare that a model supports function calling or vision while the current AgentSam adapter may not yet implement that path.
|
|
136
|
+
|
|
137
|
+
Inventory MUST keep these concepts separate:
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
provider_capabilities
|
|
141
|
+
agentsam_runtime_compatibility
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The UI must not claim that AgentSam can execute a capability merely because the provider model supports it.
|
|
145
|
+
|
|
146
|
+
## 6. `/models` provider picker
|
|
147
|
+
|
|
148
|
+
Typing `/models` or running interactive `agentsam models` MUST start from a provider picker, not an invented provider-level model such as `Gemini automatic` or `Workers AI default`.
|
|
149
|
+
|
|
150
|
+
Expected shape:
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
Select provider
|
|
154
|
+
|
|
155
|
+
› OpenAI configured · verified
|
|
156
|
+
Gemini configured · verified
|
|
157
|
+
Cloudflare Workers AI configured · verified
|
|
158
|
+
Ollama local · online
|
|
159
|
+
Anthropic not configured
|
|
160
|
+
Grok not configured
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The provider row is status and navigation. It is not itself a model selection.
|
|
164
|
+
|
|
165
|
+
Selecting a provider performs:
|
|
166
|
+
|
|
167
|
+
```text
|
|
168
|
+
resolve credential
|
|
169
|
+
→ verify provider access
|
|
170
|
+
→ fetch accessible/current model inventory
|
|
171
|
+
→ join authoritative capability + pricing facts
|
|
172
|
+
→ apply AgentSam ranking metadata
|
|
173
|
+
→ render the model picker
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## 7. Curated first page, unrestricted exact access
|
|
177
|
+
|
|
178
|
+
The primary provider model picker SHOULD show roughly the top 10 logical coding/agent models rather than forcing the user through every image, speech, embedding, moderation, legacy, or specialist endpoint.
|
|
179
|
+
|
|
180
|
+
The curated page is a presentation policy, not an access restriction.
|
|
181
|
+
|
|
182
|
+
The user MUST retain access to the complete provider-visible inventory through a `More models…` / `All models…` path and an exact-model escape hatch:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
agentsam -m <exact_model_id>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
A future `config.toml` or other persisted configuration UI MUST write to the same canonical model preference state. It must not create a second selection authority.
|
|
189
|
+
|
|
190
|
+
A concise UX hint may say:
|
|
191
|
+
|
|
192
|
+
```text
|
|
193
|
+
Access other or legacy models with `agentsam -m <model_id>` or your canonical AgentSam model configuration.
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## 8. Model rows show factual economics and capabilities
|
|
197
|
+
|
|
198
|
+
For a selected/provider-visible model, the UI SHOULD expose the facts needed to make an informed choice without requiring a documentation hunt:
|
|
199
|
+
|
|
200
|
+
```text
|
|
201
|
+
model ID / label
|
|
202
|
+
availability
|
|
203
|
+
context/input limit
|
|
204
|
+
max output
|
|
205
|
+
reasoning levels
|
|
206
|
+
provider-declared capabilities
|
|
207
|
+
AgentSam runtime compatibility
|
|
208
|
+
service tiers
|
|
209
|
+
input price
|
|
210
|
+
cached-input / cache-write price
|
|
211
|
+
output price
|
|
212
|
+
long-context pricing rules
|
|
213
|
+
pricing/source timestamp
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Example presentation only:
|
|
217
|
+
|
|
218
|
+
```text
|
|
219
|
+
GPT-6 Astra
|
|
220
|
+
OpenAI
|
|
221
|
+
|
|
222
|
+
Capacity
|
|
223
|
+
context 1,050,000
|
|
224
|
+
max output 128,000
|
|
225
|
+
|
|
226
|
+
Reasoning
|
|
227
|
+
low · medium · high · xhigh · max
|
|
228
|
+
|
|
229
|
+
Standard · USD / 1M tokens
|
|
230
|
+
input $...
|
|
231
|
+
cached input $...
|
|
232
|
+
output $...
|
|
233
|
+
|
|
234
|
+
Pricing provenance
|
|
235
|
+
availability provider API
|
|
236
|
+
limits provider authoritative
|
|
237
|
+
pricing provider authoritative
|
|
238
|
+
verified <timestamp>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
The contract does not freeze today's model names or prices. The provider-source records do.
|
|
242
|
+
|
|
243
|
+
## 9. Selection flow
|
|
244
|
+
|
|
245
|
+
For a provider requiring explicit selection, the flow is:
|
|
246
|
+
|
|
247
|
+
```text
|
|
248
|
+
Provider
|
|
249
|
+
→ Exact model
|
|
250
|
+
→ Reasoning level
|
|
251
|
+
→ Processing / service tier
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Only controls supported by the exact selected model may be offered.
|
|
255
|
+
|
|
256
|
+
The final selection MUST be persisted through one canonical preference writer and MUST survive a CLI restart.
|
|
257
|
+
|
|
258
|
+
## 10. CLI and JSON are two renderings of one inventory
|
|
259
|
+
|
|
260
|
+
`/models`, `agentsam models`, and `agentsam models --json` MUST be backed by the same normalized inventory.
|
|
261
|
+
|
|
262
|
+
The machine-readable contract is `agentsam-model-inventory-v2`; see `model-inventory-v2.schema.json`.
|
|
263
|
+
|
|
264
|
+
The JSON inventory MUST NOT contain secrets.
|
|
265
|
+
|
|
266
|
+
At minimum it needs to distinguish:
|
|
267
|
+
|
|
268
|
+
```text
|
|
269
|
+
provider credential/status receipt
|
|
270
|
+
provider-visible model records
|
|
271
|
+
provider facts + provenance
|
|
272
|
+
AgentSam policy annotations
|
|
273
|
+
current exact selection
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## 11. Pricing law
|
|
277
|
+
|
|
278
|
+
Pricing shown in the picker and pricing used for run-cost calculation MUST come from the same normalized pricing record.
|
|
279
|
+
|
|
280
|
+
A model turn receipt MUST freeze or reference the pricing basis used at execution time so later provider price changes do not rewrite historical cost estimates.
|
|
281
|
+
|
|
282
|
+
Provider-authoritative token usage and AgentSam-calculated cost are distinct facts:
|
|
283
|
+
|
|
284
|
+
```text
|
|
285
|
+
provider usage receipt
|
|
286
|
+
input_tokens
|
|
287
|
+
cached_input_tokens
|
|
288
|
+
cache_write_tokens when available
|
|
289
|
+
output_tokens
|
|
290
|
+
reasoning_tokens when available
|
|
291
|
+
|
|
292
|
+
AgentSam economics receipt
|
|
293
|
+
pricing basis/version
|
|
294
|
+
requested service tier
|
|
295
|
+
actual service tier
|
|
296
|
+
calculated cost
|
|
297
|
+
currency
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
AgentSam must never label a calculated estimate as a provider invoice unless the provider supplied that invoice/cost directly.
|
|
301
|
+
|
|
302
|
+
## 12. Runtime receipt proves the exact model
|
|
303
|
+
|
|
304
|
+
Every real model call/run MUST be attributable to:
|
|
305
|
+
|
|
306
|
+
```text
|
|
307
|
+
provider
|
|
308
|
+
exact model_id
|
|
309
|
+
reasoning_effort
|
|
310
|
+
requested_service_tier
|
|
311
|
+
actual_service_tier
|
|
312
|
+
provider_request_id when available
|
|
313
|
+
provider-authoritative usage
|
|
314
|
+
pricing basis/version
|
|
315
|
+
calculated cost
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
The runtime receipt is the final truth of what actually ran. A UI preference alone is not sufficient proof.
|
|
319
|
+
|
|
320
|
+
## 13. Failure behavior
|
|
321
|
+
|
|
322
|
+
These conditions are release blockers for the `/models` contract:
|
|
323
|
+
|
|
324
|
+
- valid AgentSam provider file exists but UI says the provider is not configured;
|
|
325
|
+
- a provider-level pseudo-model such as `Gemini automatic` replaces exact model discovery;
|
|
326
|
+
- selected model is silently substituted;
|
|
327
|
+
- pricing shown as current without authoritative provenance;
|
|
328
|
+
- provider context/output limits are guessed or overwritten by AgentSam policy;
|
|
329
|
+
- `/models` and `agentsam models --json` disagree about the same provider/model;
|
|
330
|
+
- picker pricing and runtime cost accounting use different price records;
|
|
331
|
+
- secrets appear in terminal output, JSON, logs, or model context;
|
|
332
|
+
- unsupported reasoning/service-tier controls are offered;
|
|
333
|
+
- the primary picker dumps every irrelevant provider endpoint instead of a curated useful page;
|
|
334
|
+
- an exact provider-visible model is inaccessible merely because it was omitted from the curated page.
|
|
335
|
+
|
|
336
|
+
## 14. Publish acceptance proof
|
|
337
|
+
|
|
338
|
+
Before release, verify the **installed package**, not only repository source:
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
which agentsam
|
|
342
|
+
agentsam --version
|
|
343
|
+
agentsam models
|
|
344
|
+
agentsam models --json
|
|
345
|
+
agentsam -m <known-accessible-exact-model>
|
|
346
|
+
agentsam
|
|
347
|
+
# then /models
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
For every configured provider used in release validation, prove:
|
|
351
|
+
|
|
352
|
+
1. no manual `source` command is required;
|
|
353
|
+
2. the machine-local provider credential is found safely;
|
|
354
|
+
3. provider access is actually validated;
|
|
355
|
+
4. live/provider-visible models are discovered;
|
|
356
|
+
5. the curated coding/agent page is useful and bounded;
|
|
357
|
+
6. full exact-model access still exists;
|
|
358
|
+
7. capacities/capabilities/pricing show provenance;
|
|
359
|
+
8. exact model selection persists;
|
|
360
|
+
9. reasoning/service tier are reconciled to that model;
|
|
361
|
+
10. a runtime receipt reports the same provider/model that the user selected;
|
|
362
|
+
11. a deliberately invalid model fails loudly rather than routing elsewhere.
|
|
363
|
+
|
|
364
|
+
## 15. Acceptance sentence
|
|
365
|
+
|
|
366
|
+
If any contributor cannot answer all four questions below from one AgentSam inventory + receipt path, the model system is not finished:
|
|
367
|
+
|
|
368
|
+
```text
|
|
369
|
+
What provider credentials are safely available?
|
|
370
|
+
What exact models can this account use?
|
|
371
|
+
What does the provider currently say each model can do and cost?
|
|
372
|
+
What exact provider/model/reasoning/tier actually handled this run?
|
|
373
|
+
```
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://inneranimalmedia.com/protocol/models/model-inventory-v2.schema.json",
|
|
4
|
+
"title": "AgentSam Model Inventory v2",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schemaVersion", "generatedAt", "providers", "models"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schemaVersion": {
|
|
10
|
+
"const": "agentsam-model-inventory-v2"
|
|
11
|
+
},
|
|
12
|
+
"generatedAt": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"format": "date-time"
|
|
15
|
+
},
|
|
16
|
+
"selection": {
|
|
17
|
+
"oneOf": [
|
|
18
|
+
{ "type": "null" },
|
|
19
|
+
{ "$ref": "#/$defs/selection" }
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"providers": {
|
|
23
|
+
"type": "array",
|
|
24
|
+
"items": { "$ref": "#/$defs/provider" }
|
|
25
|
+
},
|
|
26
|
+
"models": {
|
|
27
|
+
"type": "array",
|
|
28
|
+
"items": { "$ref": "#/$defs/model" }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"$defs": {
|
|
32
|
+
"provenance": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"additionalProperties": false,
|
|
35
|
+
"required": ["sourceKind"],
|
|
36
|
+
"properties": {
|
|
37
|
+
"sourceKind": {
|
|
38
|
+
"enum": [
|
|
39
|
+
"provider_api",
|
|
40
|
+
"provider_published",
|
|
41
|
+
"local_runtime",
|
|
42
|
+
"agentsam_policy",
|
|
43
|
+
"unknown"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"sourceRef": { "type": ["string", "null"] },
|
|
47
|
+
"observedAt": { "type": ["string", "null"], "format": "date-time" },
|
|
48
|
+
"pricingAsOf": { "type": ["string", "null"] },
|
|
49
|
+
"status": {
|
|
50
|
+
"enum": ["current", "stale", "unavailable", "unknown"]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"provider": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"additionalProperties": false,
|
|
57
|
+
"required": ["id", "label", "configured", "secretHidden"],
|
|
58
|
+
"properties": {
|
|
59
|
+
"id": { "type": "string", "minLength": 1 },
|
|
60
|
+
"label": { "type": "string", "minLength": 1 },
|
|
61
|
+
"configured": { "type": "boolean" },
|
|
62
|
+
"present": { "type": ["boolean", "null"] },
|
|
63
|
+
"valid": { "type": ["boolean", "null"] },
|
|
64
|
+
"authorized": { "type": ["boolean", "null"] },
|
|
65
|
+
"credentialSourceClass": { "type": ["string", "null"] },
|
|
66
|
+
"credentialPath": { "type": ["string", "null"] },
|
|
67
|
+
"verifiedAt": { "type": ["string", "null"], "format": "date-time" },
|
|
68
|
+
"modelsDiscovered": { "type": ["integer", "null"], "minimum": 0 },
|
|
69
|
+
"secretHidden": { "const": true },
|
|
70
|
+
"error": { "type": ["string", "null"] }
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"priceSet": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"additionalProperties": false,
|
|
76
|
+
"properties": {
|
|
77
|
+
"input": { "type": ["number", "null"], "minimum": 0 },
|
|
78
|
+
"cachedInput": { "type": ["number", "null"], "minimum": 0 },
|
|
79
|
+
"cacheWrite": { "type": ["number", "null"], "minimum": 0 },
|
|
80
|
+
"output": { "type": ["number", "null"], "minimum": 0 }
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"pricing": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"additionalProperties": false,
|
|
86
|
+
"required": ["currency", "unit", "provenance"],
|
|
87
|
+
"properties": {
|
|
88
|
+
"currency": { "type": "string", "minLength": 1 },
|
|
89
|
+
"unit": { "type": "string", "minLength": 1 },
|
|
90
|
+
"standard": { "$ref": "#/$defs/priceSet" },
|
|
91
|
+
"fast": { "$ref": "#/$defs/priceSet" },
|
|
92
|
+
"flex": { "$ref": "#/$defs/priceSet" },
|
|
93
|
+
"batch": { "$ref": "#/$defs/priceSet" },
|
|
94
|
+
"rules": {
|
|
95
|
+
"type": "array",
|
|
96
|
+
"items": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"additionalProperties": true
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"provenance": { "$ref": "#/$defs/provenance" }
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"providerCapabilities": {
|
|
105
|
+
"type": "object",
|
|
106
|
+
"additionalProperties": true,
|
|
107
|
+
"properties": {
|
|
108
|
+
"contextTokens": { "type": ["integer", "null"], "minimum": 1 },
|
|
109
|
+
"maxOutputTokens": { "type": ["integer", "null"], "minimum": 1 },
|
|
110
|
+
"reasoningEfforts": {
|
|
111
|
+
"type": "array",
|
|
112
|
+
"items": { "type": "string" },
|
|
113
|
+
"uniqueItems": true
|
|
114
|
+
},
|
|
115
|
+
"serviceTiers": {
|
|
116
|
+
"type": "array",
|
|
117
|
+
"items": { "type": "string" },
|
|
118
|
+
"uniqueItems": true
|
|
119
|
+
},
|
|
120
|
+
"modalities": {
|
|
121
|
+
"type": "array",
|
|
122
|
+
"items": { "type": "string" },
|
|
123
|
+
"uniqueItems": true
|
|
124
|
+
},
|
|
125
|
+
"tools": {
|
|
126
|
+
"type": "array",
|
|
127
|
+
"items": { "type": "string" },
|
|
128
|
+
"uniqueItems": true
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"runtimeCompatibility": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"additionalProperties": true,
|
|
135
|
+
"properties": {
|
|
136
|
+
"interactive": { "type": ["boolean", "null"] },
|
|
137
|
+
"functionCalling": { "type": ["boolean", "null"] },
|
|
138
|
+
"vision": { "type": ["boolean", "null"] },
|
|
139
|
+
"toolLoop": { "type": ["boolean", "null"] },
|
|
140
|
+
"notes": {
|
|
141
|
+
"type": "array",
|
|
142
|
+
"items": { "type": "string" }
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"agentsamPolicy": {
|
|
147
|
+
"type": "object",
|
|
148
|
+
"additionalProperties": true,
|
|
149
|
+
"properties": {
|
|
150
|
+
"recommended": { "type": "boolean" },
|
|
151
|
+
"rank": { "type": ["integer", "null"], "minimum": 1 },
|
|
152
|
+
"tags": {
|
|
153
|
+
"type": "array",
|
|
154
|
+
"items": { "type": "string" },
|
|
155
|
+
"uniqueItems": true
|
|
156
|
+
},
|
|
157
|
+
"workingContextTarget": { "type": ["integer", "null"], "minimum": 1 },
|
|
158
|
+
"compactAt": { "type": ["integer", "null"], "minimum": 1 },
|
|
159
|
+
"interveneAt": { "type": ["integer", "null"], "minimum": 1 }
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"model": {
|
|
163
|
+
"type": "object",
|
|
164
|
+
"additionalProperties": false,
|
|
165
|
+
"required": [
|
|
166
|
+
"provider",
|
|
167
|
+
"modelId",
|
|
168
|
+
"available",
|
|
169
|
+
"providerCapabilities",
|
|
170
|
+
"runtimeCompatibility",
|
|
171
|
+
"provenance",
|
|
172
|
+
"agentsam"
|
|
173
|
+
],
|
|
174
|
+
"properties": {
|
|
175
|
+
"provider": { "type": "string", "minLength": 1 },
|
|
176
|
+
"modelId": { "type": "string", "minLength": 1 },
|
|
177
|
+
"label": { "type": ["string", "null"] },
|
|
178
|
+
"available": { "type": "boolean" },
|
|
179
|
+
"providerCapabilities": { "$ref": "#/$defs/providerCapabilities" },
|
|
180
|
+
"runtimeCompatibility": { "$ref": "#/$defs/runtimeCompatibility" },
|
|
181
|
+
"pricing": {
|
|
182
|
+
"oneOf": [
|
|
183
|
+
{ "type": "null" },
|
|
184
|
+
{ "$ref": "#/$defs/pricing" }
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
"provenance": {
|
|
188
|
+
"type": "object",
|
|
189
|
+
"additionalProperties": false,
|
|
190
|
+
"required": ["availability", "capabilities"],
|
|
191
|
+
"properties": {
|
|
192
|
+
"availability": { "$ref": "#/$defs/provenance" },
|
|
193
|
+
"capabilities": { "$ref": "#/$defs/provenance" }
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"agentsam": { "$ref": "#/$defs/agentsamPolicy" }
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"selection": {
|
|
200
|
+
"type": "object",
|
|
201
|
+
"additionalProperties": false,
|
|
202
|
+
"required": ["provider", "modelId"],
|
|
203
|
+
"properties": {
|
|
204
|
+
"provider": { "type": "string", "minLength": 1 },
|
|
205
|
+
"modelId": { "type": "string", "minLength": 1 },
|
|
206
|
+
"reasoningEffort": { "type": ["string", "null"] },
|
|
207
|
+
"serviceTier": { "type": ["string", "null"] },
|
|
208
|
+
"selectedAt": { "type": ["string", "null"], "format": "date-time" }
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|