@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.
Files changed (112) hide show
  1. package/AGENTSAM.md +55 -0
  2. package/README.md +12 -8
  3. package/bin/agentsam +2 -0
  4. package/docs/AGENTSAM_ASTRA_OPENAI_INTEGRATION.md +1363 -0
  5. package/docs/CLI_SHELL.md +163 -53
  6. package/docs/RELEASES.md +16 -7
  7. package/package.json +20 -8
  8. package/packages/connectors/cloudflare/package.json +10 -0
  9. package/packages/connectors/cloudflare/src/index.js +127 -0
  10. package/packages/connectors/cloudflare/src/owner.js +76 -0
  11. package/packages/connectors/cloudflare/src/routes.js +223 -0
  12. package/packages/connectors/cloudflare/src/vault.js +80 -0
  13. package/packages/connectors/cloudflare/tests/connector.test.mjs +44 -0
  14. package/packages/identity/package.json +2 -2
  15. package/packages/identity/src/contracts/auth-config.js +18 -7
  16. package/packages/identity/tests/auth-config.test.mjs +9 -5
  17. package/packages/identity/tests/oauth-credentials.test.mjs +4 -4
  18. package/protocol/README.md +1 -0
  19. package/protocol/capabilities/cloudflare-cpu-audit-input.schema.json +19 -0
  20. package/protocol/capabilities/cloudflare-cpu-profile-input.schema.json +13 -0
  21. package/protocol/capabilities/cloudflare-wrangler-native-input.schema.json +19 -0
  22. package/protocol/capabilities/manifest.json +47 -0
  23. package/protocol/context/context-budget.schema.json +10 -15
  24. package/protocol/context/context-item.schema.json +4 -5
  25. package/protocol/context/resolved-context-pack.schema.json +19 -14
  26. package/protocol/models/README.md +373 -0
  27. package/protocol/models/model-inventory-v2.schema.json +212 -0
  28. package/skills/agentsam-cloudflare-workers/SKILL.md +53 -0
  29. package/skills/agentsam-cloudflare-workers/references/cpu-profiling.md +16 -0
  30. package/skills/agentsam-cloudflare-workers/references/errors-and-observability.md +29 -0
  31. package/skills/agentsam-cloudflare-workers/references/wrangler-native-map.md +28 -0
  32. package/skills/catalog.json +18 -0
  33. package/src/agent/capability-adapter.js +25 -13
  34. package/src/agent/index.js +1 -0
  35. package/src/agent/responses-runner.js +325 -0
  36. package/src/cli.js +98 -28
  37. package/src/cloudflare/cpu-profile.js +115 -0
  38. package/src/cloudflare/index.js +14 -0
  39. package/src/cloudflare/wrangler.js +132 -0
  40. package/src/commands/account-auth.js +47 -0
  41. package/src/commands/cloudflare.js +58 -0
  42. package/src/commands/connections.js +93 -0
  43. package/src/commands/context-economics.js +114 -0
  44. package/src/commands/deploy.js +39 -3
  45. package/src/commands/eval.js +63 -0
  46. package/src/commands/interactive.js +2 -5
  47. package/src/commands/models.js +85 -40
  48. package/src/commands/preferences.js +101 -59
  49. package/src/commands/resume.js +67 -0
  50. package/src/commands/security.js +5 -3
  51. package/src/commands/shell.js +370 -109
  52. package/src/commands/tunnel.js +2 -2
  53. package/src/commands/whoami.js +86 -0
  54. package/src/context/budget.js +68 -6
  55. package/src/context/index.js +3 -1
  56. package/src/context/rehydrate.js +35 -0
  57. package/src/context/resolve.js +44 -12
  58. package/src/errors/diagnostic.js +160 -0
  59. package/src/errors/index.js +9 -0
  60. package/src/eval/context.js +191 -0
  61. package/src/eval/index.js +1 -0
  62. package/src/index.js +55 -1
  63. package/src/lib/account-session.js +98 -0
  64. package/src/lib/agent-instructions.js +73 -0
  65. package/src/lib/auth.js +4 -0
  66. package/src/lib/cli-preferences.js +28 -24
  67. package/src/lib/deploy/git-guard.js +69 -0
  68. package/src/lib/deploy/health.js +57 -0
  69. package/src/lib/deploy/local-studio.js +283 -0
  70. package/src/lib/deploy/secret-scan.js +65 -0
  71. package/src/lib/detect-context.js +2 -2
  72. package/src/lib/execution-approvals.js +59 -0
  73. package/src/lib/local-sessions.js +127 -0
  74. package/src/lib/provider-credentials.js +83 -0
  75. package/src/lib/scaffold/templates/worker-api/index.js +101 -20
  76. package/src/lib/scaffold/wizards/worker-api.js +27 -11
  77. package/src/lib/slash-commands.js +22 -16
  78. package/src/models/catalog.js +135 -0
  79. package/src/models/index.js +7 -0
  80. package/src/providers/index.js +5 -0
  81. package/src/providers/openai-responses.js +275 -0
  82. package/src/security/process.js +35 -9
  83. package/src/telemetry/contracts.js +203 -0
  84. package/src/telemetry/events.js +48 -0
  85. package/src/telemetry/index.js +8 -0
  86. package/src/tools/hydrate.js +35 -0
  87. package/src/tools/index.js +1 -0
  88. package/src/ui/boot.js +15 -17
  89. package/test/account-session.test.mjs +36 -0
  90. package/test/cli-preferences.test.mjs +26 -5
  91. package/test/cloudflare-connector.test.mjs +96 -0
  92. package/test/cloudflare-runtime.test.mjs +75 -0
  93. package/test/context.test.mjs +61 -12
  94. package/test/deploy-health-scan.test.mjs +67 -0
  95. package/test/error-diagnostics.test.mjs +59 -0
  96. package/test/eval-context.test.mjs +37 -0
  97. package/test/execution-approvals.test.mjs +27 -0
  98. package/test/local-sessions.test.mjs +42 -0
  99. package/test/local-studio-deploy.test.mjs +83 -0
  100. package/test/model-catalog.test.mjs +43 -0
  101. package/test/models.test.mjs +30 -16
  102. package/test/npm10-lock.test.mjs +29 -0
  103. package/test/openai-responses.test.mjs +95 -0
  104. package/test/provider-credentials.test.mjs +52 -0
  105. package/test/rehydrate.test.mjs +25 -0
  106. package/test/release-hygiene.test.mjs +4 -4
  107. package/test/responses-runner.test.mjs +148 -0
  108. package/test/shell.test.mjs +47 -20
  109. package/test/smoke.mjs +4 -1
  110. package/test/telemetry.test.mjs +79 -0
  111. package/test/tools-search.test.mjs +14 -1
  112. package/test/whoami-resume.test.mjs +56 -0
package/AGENTSAM.md ADDED
@@ -0,0 +1,55 @@
1
+ # AgentSam Runtime Contract
2
+
3
+ This file defines stable behavior for AgentSam agents using the portable SDK. It is not account state, project state, a run log, or a replacement for repository-specific `.agentsamrules`.
4
+
5
+ ## Execution
6
+
7
+ - Infer routine implementation details when repository evidence makes the answer clear; do not block on unnecessary questions.
8
+ - Carry authorized work through the coherent implementation, verification, and reviewable result instead of stopping at an audit or TODO list.
9
+ - Never claim a command, test, build, commit, merge, publish, or deploy succeeded without execution evidence.
10
+ - Runtime authentication and authorization are authoritative. Never ask the model to invent account, repository, connection, run, or task identifiers already owned by the runtime.
11
+
12
+ ## Context discipline
13
+
14
+ - Use the smallest context that contains the evidence required for the task.
15
+ - Retrieve deliberately: structural metadata and compact cards first, then excerpts/ranges, then full objects only when required.
16
+ - Treat a model context window as a technical ceiling, not a target working-set size.
17
+ - Respect model-specific working-set policy and pricing boundaries before a request is sent. Compact proactively rather than paying for an avoidable threshold crossing.
18
+ - Preserve stable references and hashes when evidence leaves active context so it can be rehydrated explicitly.
19
+ - Keep observability and telemetry out of model context unless a task explicitly requires a bounded excerpt of it as evidence.
20
+
21
+ ## Tool discipline
22
+
23
+ - Search compact capability cards before hydrating schemas when the tool surface is large.
24
+ - Hydrate only the selected tool schemas needed for the current step.
25
+ - Prefer deterministic code, Git, Merkle, AST, indexes, and other non-LLM mechanisms when they can answer the question reliably.
26
+ - Keep security- or correctness-critical checks in trusted runtime code, not prompt prose.
27
+
28
+ ## Repository behavior
29
+
30
+ - Inspect relevant current code before changing it.
31
+ - Extend working primitives instead of creating parallel legacy implementations.
32
+ - Git owns source-control history. Merkle owns filesystem evidence and snapshot lineage. Runtime/hosted stores own run and execution history.
33
+ - Portable project configuration must not become an account/session/run database.
34
+
35
+ ## Model and run policy
36
+
37
+ - Model, reasoning effort, service tier, budget, and permissions are runtime configuration, not hidden prompt instructions.
38
+ - Show users meaningful cost/latency controls when the active provider/model supports them; do not silently guess support.
39
+ - Batch is an asynchronous execution lane, not an interactive service tier. Projected spend and request counts must be known before submitting budgeted background work.
40
+ - Do not impose arbitrary short wall-clock caps on legitimate long work. Use checkpoints, progress events, durable receipts, provider status, and explicit fallback policy so a slow run can continue or fail visibly rather than being silently abandoned.
41
+
42
+ ## Verification and completion
43
+
44
+ - Run proportionate focused tests first, then the repository gates required by the affected public surface.
45
+ - Preserve provider-reported usage alongside local estimates and treat provider usage as authoritative when available.
46
+ - A task is complete only when its code/contracts/docs/tests agree and the final status is supported by evidence.
47
+
48
+ ## Instruction precedence
49
+
50
+ AgentSam compiles instructions deterministically in this order:
51
+
52
+ 1. `AGENTSAM.md` — stable runtime behavior.
53
+ 2. `.agentsamrules` — repository-specific rules, loaded after the stable contract and therefore more specific where the two address the same repository behavior.
54
+
55
+ Live account, authorization, model, run, task, terminal, and usage state never belong in either file.
package/README.md CHANGED
@@ -2,7 +2,8 @@
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
- The interactive CLI makes those same primitives easy to use without making a model part of the implementation.
5
+ The interactive CLI can run the same bounded capabilities through an explicitly selected model while
6
+ keeping model choice, reasoning effort, processing tier, credentials, approvals, context, and cost inspectable.
6
7
 
7
8
  **npm:** `@inneranimalmedia/agentsam-sdk` · **Source:** [GitHub](https://github.com/SamPrimeaux/agentsam-sdk)
8
9
 
@@ -82,7 +83,7 @@ read-only `repository.snapshot` composition primitive. See [Capabilities and pre
82
83
  | Recon bounded-worker packets | `agentsam recon pack\|validate` | [Recon](docs/RECON.md) |
83
84
  | Local containers | `agentsam dockerize`; `/dockerize` | [Dockerize](docs/DOCKERIZE.md) |
84
85
  | Background indexing service | Docker `knowledge_service`; `/knowledge-service-client` | [Knowledge service](docs/knowledge-service.md) |
85
- | Interactive Agent Sam + local runtime | `agentsam`, `agentsam status`, `db`, `models`, `start-local` | [CLI shell](docs/CLI_SHELL.md) |
86
+ | Interactive Agent Sam + resumable local runtime | `agentsam`, `agentsam resume`, `whoami`, `status`, `models`, `start-local` | [CLI shell](docs/CLI_SHELL.md) |
86
87
 
87
88
  Export suffixes such as `/identity` mean imports from
88
89
  `@inneranimalmedia/agentsam-sdk/identity`. Use `agentsam <command> --help` where supported.
@@ -105,12 +106,15 @@ authorizes its caller. Other local tooling uses Node APIs.
105
106
 
106
107
  ## Host integration and ownership
107
108
 
108
- Deterministic SDK capabilities remain useful without a model. The root `AgentSam` helper supplies an
109
- optional routing/session wrapper, while model orchestration, tool execution policy, provider credentials,
110
- actor/account authorization, workflow durability, approvals, jobs, and production application records
111
- belong to the consuming host application. Git/repository identity never proves actor authority, and the SDK
112
- does not create a second platform tools database. The old `scaffoldProject()` export is deprecated; use
113
- `agentsam create` or the local scaffold commands.
109
+ Deterministic SDK capabilities remain useful without a model. The installed CLI adds a portable local
110
+ runtime for explicit model selection, bounded tool orchestration, secure machine-local credential lookup,
111
+ project-scoped execution approvals, provider-neutral resumable sessions, and usage/cost receipts. Those
112
+ local records live under the user's AgentSam home state rather than portable repository config.
113
+
114
+ Production actor/account authorization, shared credential vaults, workflow durability, remote job ownership,
115
+ and application records still belong to the consuming host. Git/repository identity never proves actor
116
+ authority, and the SDK does not create a second platform tools database. The old `scaffoldProject()` export
117
+ is deprecated; use `agentsam create` or the local scaffold commands.
114
118
 
115
119
  This repository owns portable code once. Applications import it and provide adapters;
116
120
  they do not mirror SDK trees. [Ownership protocol](protocol/README.md).
package/bin/agentsam ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '../src/cli.js';