@inneranimalmedia/agentsam-sdk 2.0.0 → 2.1.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 +1 -0
- package/docs/DEPLOY_RECEIPTS.md +83 -0
- package/docs/RECON.md +165 -0
- package/docs/RELEASES.md +3 -3
- package/docs/sdk-2.0-release.md +19 -21
- package/package.json +2 -1
- package/packages/identity/package.json +1 -1
- package/protocol/recon/README.md +19 -0
- package/protocol/recon/finding-report.schema.json +46 -0
- package/protocol/recon/task-packet.schema.json +79 -0
- package/python/agentsam_sdk/repository/recon/__init__.py +28 -0
- package/python/agentsam_sdk/repository/recon/__main__.py +3 -0
- package/python/agentsam_sdk/repository/recon/cli.py +178 -0
- package/python/agentsam_sdk/repository/recon/packet.py +294 -0
- package/python/agentsam_sdk/repository/recon/validate.py +76 -0
- package/python/tests/test_recon.py +257 -0
- package/src/cli.js +15 -7
- package/src/commands/deploy-receipt.js +129 -0
- package/src/commands/recon.js +71 -0
- package/src/index.js +8 -0
- package/src/lib/deploy-receipt/index.js +246 -0
- package/test/deploy-receipt.test.mjs +91 -0
package/README.md
CHANGED
|
@@ -67,6 +67,7 @@ Python-backed snapshots capture repository composition and Git churn.
|
|
|
67
67
|
| File integrity | `agentsam merkle`; `/merkle` | [Merkle](docs/MERKLE.md) |
|
|
68
68
|
| Dependency health and repair | `agentsam security`; `/security` | [Security](docs/SECURITY.md) |
|
|
69
69
|
| Mini prototypes | `agentsam mini`; `/mini` | [Mini](docs/MINI.md) |
|
|
70
|
+
| Recon bounded-worker packets | `agentsam recon pack\|validate` | [Recon](docs/RECON.md) |
|
|
70
71
|
| Local containers | `agentsam dockerize`; `/dockerize` | [Dockerize](docs/DOCKERIZE.md) |
|
|
71
72
|
| Background indexing service | Docker `knowledge_service`; `/knowledge-service-client` | [Knowledge service](docs/knowledge-service.md) |
|
|
72
73
|
| Local status, DB, terminal UI | `agentsam status`, `db`, `tui`, `start-local` | [Terminal UI](docs/CLI_SHELL.md) |
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Deployment receipts and checkpoints
|
|
2
|
+
|
|
3
|
+
Agent Sam's Merkle tree answers a source identity question: **what exact file tree exists right now?**
|
|
4
|
+
|
|
5
|
+
The deploy-receipt lifecycle adds a second question: **what changed since the last state we trusted?**
|
|
6
|
+
|
|
7
|
+
The runtime checkpoint belongs under `.agentsam/deploy-merkle/` by default and is deliberately excluded from the captured source tree. It is cache/checkpoint state, not application source. Committing it would make deployment bookkeeping mutate Git and feed back into the next hash.
|
|
8
|
+
|
|
9
|
+
## CLI
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
agentsam deploy-receipt capture . --project my-app --json
|
|
13
|
+
# run any deployment provider here
|
|
14
|
+
agentsam deploy-receipt success . --deployment-id dep_123 --worker-version worker_v1 --json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If deployment fails:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
agentsam deploy-receipt failure . --deployment-id dep_123 --json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
A successful finalize promotes `latest.snapshot.json` and `latest.receipt.json`. A failed finalize writes failure history but does **not** advance the trusted baseline.
|
|
24
|
+
|
|
25
|
+
An external durable snapshot (R2, S3, GCS, artifact store, etc.) can be restored before capture and supplied explicitly:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
agentsam deploy-receipt capture . \
|
|
29
|
+
--baseline /tmp/last-success.snapshot.json \
|
|
30
|
+
--baseline-source r2 \
|
|
31
|
+
--project my-app \
|
|
32
|
+
--json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Provider storage stays an adapter. The Merkle tree, diff, receipt contract, local checkpoint state, Git metadata, dirty-tree observation, and success/failure promotion semantics live in the SDK.
|
|
36
|
+
|
|
37
|
+
## Programmatic API
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
import {
|
|
41
|
+
captureDeployReceipt,
|
|
42
|
+
finalizeDeployReceipt,
|
|
43
|
+
} from '@inneranimalmedia/agentsam-sdk/deploy-receipt';
|
|
44
|
+
|
|
45
|
+
const capture = await captureDeployReceipt({
|
|
46
|
+
root: process.cwd(),
|
|
47
|
+
project: 'my-app',
|
|
48
|
+
baselineSnapshot: restoredSnapshotPath,
|
|
49
|
+
baselineSource: 'r2',
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
const deployment = await deploy();
|
|
54
|
+
const completed = await finalizeDeployReceipt({
|
|
55
|
+
root: process.cwd(),
|
|
56
|
+
status: 'success',
|
|
57
|
+
deploymentId: deployment.id,
|
|
58
|
+
workerVersionId: deployment.versionId,
|
|
59
|
+
});
|
|
60
|
+
await persistSnapshotAndReceipt(completed);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
await finalizeDeployReceipt({
|
|
63
|
+
root: process.cwd(),
|
|
64
|
+
status: 'failed',
|
|
65
|
+
});
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The same primitive is exported as `captureCheckpoint()` / `promoteCheckpoint()` for long-running agent work. That enables a loop to checkpoint a trusted tree, execute a batch, inspect the exact Merkle delta, run verification, and only promote the new checkpoint when the batch is accepted.
|
|
71
|
+
|
|
72
|
+
## Receipt shape
|
|
73
|
+
|
|
74
|
+
A capture includes compact metadata such as:
|
|
75
|
+
|
|
76
|
+
- Git SHA, branch, repository remote, and dirty-tree state
|
|
77
|
+
- current Merkle root and previous trusted root
|
|
78
|
+
- added / modified / removed counts
|
|
79
|
+
- exact changed paths (capped for receipt size)
|
|
80
|
+
- file / directory / byte statistics
|
|
81
|
+
- baseline provenance
|
|
82
|
+
|
|
83
|
+
Full file trees remain Merkle snapshots. Deployment ledgers should store the compact receipt metadata rather than the complete manifest.
|
package/docs/RECON.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Recon: bounded-worker harness (aka "MiniCodeScout")
|
|
2
|
+
|
|
3
|
+
A cheap or local model (Ollama/Qwen-class, a mini-tier hosted model, whatever's
|
|
4
|
+
cheapest that week) can be useful as a **reconnaissance subagent** — but only once
|
|
5
|
+
the evidence handed to it is already disambiguated. Live investigation on the
|
|
6
|
+
`feat/workflow-runtime-v2` worktree found the actual failure mode wasn't missing
|
|
7
|
+
ceilings, it was mixed-signal evidence: a flat `rg 'workspace_id'` sweep conflates
|
|
8
|
+
a JS member access (`authUser?.workspace_id`), an object key (`workspace_id: ctx.workspaceId`),
|
|
9
|
+
and a SQL template literal (`` `AND workspace_id = ?` ``) into one undifferentiated
|
|
10
|
+
hit list. That's why a Qwen-class mini guessed — not because it lacked a schema.
|
|
11
|
+
|
|
12
|
+
**Current status:** the mini-worker step is benched for this sprint (decision:
|
|
13
|
+
`workflows-v2:ollama-benched`; follow-up tracked as backlog P3). Deterministic
|
|
14
|
+
search alone (`rg` and `ast-grep`, both installed on the primary dev machine) is
|
|
15
|
+
already answering the questions that matter, faster and for free. This kit ships
|
|
16
|
+
as reusable infra ahead of need — it isn't on the critical path for Workflows v2,
|
|
17
|
+
and nothing here should be read as "go delegate to Ollama now." `ast-grep` stays
|
|
18
|
+
recon-only: no `sgconfig.yml`, no `--fix`/`--update-all`/`--interactive` on target
|
|
19
|
+
files until well after v2 lands — those are what turn it from search into a write
|
|
20
|
+
action.
|
|
21
|
+
|
|
22
|
+
## Where recon actually starts
|
|
23
|
+
|
|
24
|
+
Recon is the last two stages of a longer pipeline, not the whole thing:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
lexical search (rg) "where is this text?" — do this first, always
|
|
28
|
+
|
|
|
29
|
+
structural search (ast-grep)
|
|
30
|
+
| "where is this shape, and which kind?"
|
|
31
|
+
v
|
|
32
|
+
raw hits: {path, line, kind?}
|
|
33
|
+
|
|
|
34
|
+
v
|
|
35
|
+
agentsam_sdk.repository.recon.from_matches(...)
|
|
36
|
+
| groups by file, windows context lines,
|
|
37
|
+
| chunks into packets of <=5 files each
|
|
38
|
+
v
|
|
39
|
+
ReconTaskPacket(s) (protocol/recon/task-packet.schema.json)
|
|
40
|
+
|
|
|
41
|
+
v
|
|
42
|
+
mini worker (only if/when actually delegated -- never given rg)
|
|
43
|
+
|
|
|
44
|
+
v
|
|
45
|
+
ReconFindingReport (protocol/recon/finding-report.schema.json)
|
|
46
|
+
|
|
|
47
|
+
v
|
|
48
|
+
agentsam_sdk.repository.recon.validate_report(...)
|
|
49
|
+
|
|
|
50
|
+
v
|
|
51
|
+
capable agent (verifies, edits, git, tests, PR)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Hand-picked slices still work too — `build_task_packet()` takes an explicit slice
|
|
55
|
+
list directly when you already know exactly which 5 files matter and don't have a
|
|
56
|
+
raw hit list to chunk.
|
|
57
|
+
|
|
58
|
+
## Rules the worker operates under
|
|
59
|
+
|
|
60
|
+
- **One question, not a subsystem audit.** "Does this file still read
|
|
61
|
+
`workspace_id`?" — not "audit the workflow runtime."
|
|
62
|
+
- **≤5 file slices per packet, supplied — never discovered.** The worker doesn't
|
|
63
|
+
run its own `rg`/`ast-grep`/`find`/`ls`; the controller already ran search and
|
|
64
|
+
chunked the results before the worker ever sees anything. "Do not give Qwen rg."
|
|
65
|
+
- **≤2 follow-up reads**, each still inside the packet's ceilings.
|
|
66
|
+
- **Read-only diagnostics only**, and only ones the controller pre-approved
|
|
67
|
+
(`allowed_diagnostics` in the packet) — `git status`/`diff`/`log`/`show`, a
|
|
68
|
+
syntax check, a single named test. Never `git add|commit|reset|push`, never a
|
|
69
|
+
migration, never a full build or deploy, never `ast-grep --fix`/`sg --update-all`
|
|
70
|
+
on the target files.
|
|
71
|
+
- **No branch ownership.** The worker's only output is a `ReconFindingReport`. It
|
|
72
|
+
never calls `write_file` against the repository.
|
|
73
|
+
- **Never guess.** If the supplied slices don't answer the question, the worker
|
|
74
|
+
returns `status: "needs_context"` with `reason` and `missing` — not a
|
|
75
|
+
fabricated finding. `validate_report` rejects any `answered` report that cites
|
|
76
|
+
a file outside the packet's slices, so a worker can't paper over a gap with
|
|
77
|
+
invented evidence either.
|
|
78
|
+
- **A slice's `kind` (when present) is a controller-verified structural label,
|
|
79
|
+
not a hint the worker should second-guess.** `sql_string` and `member` are not
|
|
80
|
+
the same finding even when the literal text matches.
|
|
81
|
+
|
|
82
|
+
## Where each half lives
|
|
83
|
+
|
|
84
|
+
| Half | Module | Notes |
|
|
85
|
+
| --- | --- | --- |
|
|
86
|
+
| rg adapter | `agentsam_sdk.repository.recon.from_ripgrep` | Parses `rg --json` NDJSON into hits. No `kind` — lexical only. Runs no search itself. |
|
|
87
|
+
| ast-grep adapter | `agentsam_sdk.repository.recon.from_ast_grep` | Parses `sg`/`ast-grep --json=compact` array output into hits, tagged with a caller-supplied `kind` (one invocation = one shape). Runs no search itself. |
|
|
88
|
+
| Chunker | `agentsam_sdk.repository.recon.from_matches` | Takes hits from either adapter (or hand-built), groups by file, windows context lines, chunks anything over 5 files into multiple packets. |
|
|
89
|
+
| Controller (hand-picked packets) | `agentsam_sdk.repository.recon.build_task_packet` | For when you already know the exact ≤5 files/lines — no hit list to chunk. |
|
|
90
|
+
| Validator (gate reports) | `agentsam_sdk.repository.recon.validate_report` | Structural check + the "never guess" rule + citation check (findings can't reference files the worker was never given). Raises `ReportError`; callers must discard, not patch, a rejected report. |
|
|
91
|
+
| Contracts | `protocol/recon/task-packet.schema.json`, `protocol/recon/finding-report.schema.json` | Provider-neutral; usable from the CLI, the MCP surface, or a Worker. |
|
|
92
|
+
| CLI | `agentsam recon pack \| validate` (Node, thin passthrough) or `python -m agentsam_sdk.repository.recon pack \| validate` | Hand-picked slices only. Same `ToolInput`/`ToolResult` contract as every other `agentsam_sdk` tool on the Python side — read-only by default, gets a receipt. |
|
|
93
|
+
|
|
94
|
+
This kit intentionally stops at the report. Model orchestration — which model
|
|
95
|
+
answers a packet, retries, cost routing, whether delegation happens at all — is
|
|
96
|
+
host policy, same as the rest of the SDK's "host integration and ownership"
|
|
97
|
+
boundary in the root README. A future `bounded-mutation` contract (a worker
|
|
98
|
+
allowed to perform one specific, proven-safe transform, e.g. "rename import path
|
|
99
|
+
A → B") is a separate, narrower protocol, not an extension of recon's read-only
|
|
100
|
+
contract. `ast-grep` structural classification (splitting hits by node kind) is a
|
|
101
|
+
separate layer with its own hard rule — recon only, never `sgconfig.yml`/`--fix`
|
|
102
|
+
on target files — and `from_ast_grep()`/`from_matches()` carry its `kind` labels
|
|
103
|
+
through into packets without needing a schema change.
|
|
104
|
+
|
|
105
|
+
## Example
|
|
106
|
+
|
|
107
|
+
`from_ripgrep()` and `from_ast_grep()` parse the two tools' real output shapes directly
|
|
108
|
+
-- no hand-rolled JSON parsing needed. `from_ast_grep()` takes a `kind` label because one
|
|
109
|
+
`sg`/`ast-grep` invocation is one pattern or rule, i.e. one structural shape; `from_ripgrep()`
|
|
110
|
+
never sets `kind` since lexical hits carry no structural classification on their own.
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
import subprocess
|
|
114
|
+
from agentsam_sdk.repository import recon
|
|
115
|
+
|
|
116
|
+
def run(*args):
|
|
117
|
+
return subprocess.run(args, capture_output=True, text=True).stdout
|
|
118
|
+
|
|
119
|
+
matches = []
|
|
120
|
+
matches += recon.from_ast_grep(
|
|
121
|
+
run("sg", "-p", "$X.workspace_id", "-l", "js", "--json=compact",
|
|
122
|
+
"backend/workflows", "backend/http/workflows"),
|
|
123
|
+
kind="member",
|
|
124
|
+
)
|
|
125
|
+
matches += recon.from_ast_grep(
|
|
126
|
+
run("sg", "-p", "$X.workspaceId", "-l", "js", "--json=compact",
|
|
127
|
+
"backend/workflows", "backend/http/workflows"),
|
|
128
|
+
kind="member_camel",
|
|
129
|
+
)
|
|
130
|
+
matches += recon.from_ast_grep(
|
|
131
|
+
run("sg", "scan", "--inline-rules",
|
|
132
|
+
"id: sql-ws\nlanguage: JavaScript\nrule:\n kind: template_string\n regex: workspace_id",
|
|
133
|
+
"backend/workflows", "backend/http/workflows", "--json=compact"),
|
|
134
|
+
kind="sql_string",
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
packets = recon.from_matches(
|
|
138
|
+
".",
|
|
139
|
+
question="Does this file still depend on removed workspace-scoped columns?",
|
|
140
|
+
matches=matches,
|
|
141
|
+
task_id_prefix="workflow-v2-runtime-audit",
|
|
142
|
+
)
|
|
143
|
+
# classified hits across N files -> packets of <=5 files each, ready to hand to a
|
|
144
|
+
# capable model for direct classification, or to a delegated worker later. Files
|
|
145
|
+
# with more than one kind in their hit set come back with slice.kind omitted --
|
|
146
|
+
# genuinely mixed evidence is a real signal, not something to flatten.
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Also usable from the shell directly for hand-picked slices, no Python needed:
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
agentsam recon pack --repo-root . --question "..." \
|
|
153
|
+
--slice backend/workflows/repository.js:1-180 --out /tmp/packet.json
|
|
154
|
+
agentsam recon validate --packet /tmp/packet.json --report /tmp/report.json
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
`agentsam recon` is a thin passthrough to the same Python module (`python -m
|
|
158
|
+
agentsam_sdk.repository.recon`), for hand-picked slices only -- `from_matches`,
|
|
159
|
+
`from_ripgrep`, and `from_ast_grep` are Python-only since raw hit shapes vary by tool
|
|
160
|
+
and don't have a stable CLI surface yet.
|
|
161
|
+
|
|
162
|
+
See [`REPOSITORY_INTELLIGENCE.md`](REPOSITORY_INTELLIGENCE.md) for the git-level
|
|
163
|
+
evidence layer (hotspots/churn) that can help decide *which* files to search in
|
|
164
|
+
the first place, and [`protocol/README.md`](../protocol/README.md) (rule 6) for
|
|
165
|
+
the read-only, no-hardcoded-identity law this module follows.
|
package/docs/RELEASES.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# `@inneranimalmedia/agentsam-sdk` release receipts
|
|
2
2
|
|
|
3
|
-
**2.0.0 is
|
|
4
|
-
|
|
5
|
-
publish the private identity workspace or create a `v2.0.0` release tag.
|
|
3
|
+
**2.0.0 is published on npm and is the `latest` dist-tag.** The private identity workspace
|
|
4
|
+
continues to ship through the root SDK exports and is not published separately.
|
|
6
5
|
|
|
7
6
|
| npm version | Published (UTC) | IAM git SHA (40) | Notes |
|
|
8
7
|
|-------------|-----------------|------------------|-------|
|
|
8
|
+
| 2.0.0 | 2026-09-03T02:21:44.857Z | `ed629869e701809d2bf4c61bd56d05d8d8d1e183` | Stable SDK 2.0.0; npm `latest`; identity bundled through root exports; release verification and dependency scan passed before publish. |
|
|
9
9
|
| 2.0.0-alpha.identity.5 | _(pending npm)_ | `df064114eb7f8888f163e4a07dfddf19035b7169` | Password reset service, `registerFinalizeInboundOAuth`, IAM live proof. |
|
|
10
10
|
| 2.0.0-alpha.identity.4 | 2026-08-22 | `df064114eb7f8888f163e4a07dfddf19035b7169` | IAM auth portal sync: signup→`/api/auth/signup`, `company-branding.js`, preview stubs. SDK git `d7498ca`. |
|
|
11
11
|
| 2.0.0-alpha.identity.3 | 2026-08-22 | `559bc37267f76790136004f5fa94a2bb3cd6a721` | `company` table + `GET/PATCH /api/company` branding SSOT. |
|
package/docs/sdk-2.0-release.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AgentSam SDK 2.0.0 release
|
|
2
2
|
|
|
3
|
-
Status:
|
|
3
|
+
Status: published to npm as `@inneranimalmedia/agentsam-sdk@2.0.0`; npm `latest` points to 2.0.0.
|
|
4
4
|
|
|
5
5
|
## Product boundaries
|
|
6
6
|
|
|
@@ -32,8 +32,8 @@ automatic retention, multi-user authorization and production routing remain host
|
|
|
32
32
|
|
|
33
33
|
## Changes from 1.9 and the identity alphas
|
|
34
34
|
|
|
35
|
-
-
|
|
36
|
-
2.0.0-alpha.identity.12
|
|
35
|
+
- npm `latest` advanced from 1.9.0 to 2.0.0. The alpha tag remains
|
|
36
|
+
2.0.0-alpha.identity.12 for the final identity prerelease line.
|
|
37
37
|
- Node 22.5+ is required. Python 3.10+ is required for Python repository intelligence;
|
|
38
38
|
Docker is required only when actually building/running containers.
|
|
39
39
|
- In an existing repository, `agentsam init` configures repository knowledge. Use
|
|
@@ -43,36 +43,34 @@ automatic retention, multi-user authorization and production routing remain host
|
|
|
43
43
|
- Knowledge and Docker features from PRs #20 and #21 are integrated in main.
|
|
44
44
|
- Publication runs the installed-tarball consumer proof, Python tests, and dependency scan
|
|
45
45
|
in addition to the existing SDK, identity, bootstrap and package checks.
|
|
46
|
-
- The legacy alpha workflow refuses stable versions. Stable npm publication
|
|
46
|
+
- The legacy alpha workflow refuses stable versions. Stable npm publication remains manual.
|
|
47
47
|
|
|
48
|
-
##
|
|
48
|
+
## Publication receipt
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
bash scripts/npm-publish-preflight.sh
|
|
56
|
-
npm publish --tag latest --access public
|
|
50
|
+
Version 2.0.0 was published on 2026-09-03 at `2026-09-03T02:21:44.857Z` from SDK git SHA
|
|
51
|
+
`ed629869e701809d2bf4c61bd56d05d8d8d1e183`. npm recorded this integrity value:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
sha512-lXnBp8GR1iduKWxxHSRHSd9Q1fjTUZvX1UecwtS8xdDxMdZRd2BSHtDygm0OMNYchrtUP1nR6g0t3MqZTkE5HA==
|
|
57
55
|
```
|
|
58
56
|
|
|
59
|
-
The `prepublishOnly` hook
|
|
60
|
-
identity suites, package/bootstrap checks, installed-tarball fixtures, Python
|
|
61
|
-
complete dependency scan. The
|
|
62
|
-
|
|
63
|
-
with `--workspaces`: identity and shell-kit workspaces remain private.
|
|
57
|
+
The `prepublishOnly` hook ran `npm run verify:release` before upload. That verification ran
|
|
58
|
+
the SDK and identity suites, package/bootstrap checks, installed-tarball fixtures, Python
|
|
59
|
+
tests and the complete dependency scan. The private identity and shell-kit workspaces were
|
|
60
|
+
not published separately.
|
|
64
61
|
|
|
65
|
-
|
|
62
|
+
Verify the live registry state with:
|
|
66
63
|
|
|
67
64
|
```sh
|
|
68
|
-
npm view @inneranimalmedia/agentsam-sdk@2.0.0 version dist.integrity
|
|
65
|
+
npm view @inneranimalmedia/agentsam-sdk@2.0.0 version gitHead dist.integrity
|
|
69
66
|
npm view @inneranimalmedia/agentsam-sdk dist-tags --json
|
|
70
67
|
npm install -g @inneranimalmedia/agentsam-sdk@2.0.0
|
|
71
68
|
agentsam --version
|
|
72
69
|
```
|
|
73
70
|
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
The publication receipt is recorded in `docs/RELEASES.md`. Git tag `v2.0.0` identifies the
|
|
72
|
+
exact npm `gitHead`. A published npm name/version cannot be overwritten; subsequent package
|
|
73
|
+
changes require a new version.
|
|
76
74
|
|
|
77
75
|
## Branch consolidation
|
|
78
76
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inneranimalmedia/agentsam-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Portable AgentSam SDK and CLI kits for local scaffolding, repository intelligence, incremental indexing, identity adapters, and verified dependency maintenance.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"./dockerize": "./src/lib/dockerize.js",
|
|
13
13
|
"./mini": "./src/lib/mini/index.js",
|
|
14
14
|
"./merkle": "./src/lib/merkle/index.js",
|
|
15
|
+
"./deploy-receipt": "./src/lib/deploy-receipt/index.js",
|
|
15
16
|
"./knowledge": "./src/knowledge/index.js",
|
|
16
17
|
"./knowledge-service-client": "./src/knowledge/service/client.js",
|
|
17
18
|
"./identity": "./packages/identity/src/index.js",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# AgentSam Recon Protocol (aka "MiniCodeScout")
|
|
2
|
+
|
|
3
|
+
Provider-neutral contracts for delegating bounded read-only investigation to a cheap or
|
|
4
|
+
local model (Ollama/Qwen-class, mini-tier hosted models, etc.) without giving it branch,
|
|
5
|
+
Git, or write authority. See [docs/RECON.md](../../docs/RECON.md) for the design rationale
|
|
6
|
+
and current status — the delegation step itself is currently benched in favor of plain
|
|
7
|
+
deterministic search; these contracts are the reusable substrate for when it isn't.
|
|
8
|
+
|
|
9
|
+
`task-packet.schema.json` is the only input a recon worker receives. It is built by a
|
|
10
|
+
deterministic controller (`repository.intelligence`, `rg`, AST lookups) — never by the
|
|
11
|
+
worker itself, and never contains a workspace/tenant ID as the task handle.
|
|
12
|
+
|
|
13
|
+
`finding-report.schema.json` is the only output a recon worker may return. A worker that
|
|
14
|
+
cannot answer from its supplied slices must return `status: "needs_context"`, not a guess.
|
|
15
|
+
|
|
16
|
+
These schemas intentionally do not define a code-mutation contract. Recon workers observe;
|
|
17
|
+
they do not write, `git commit`, migrate, or merge. A future `bounded-mutation` protocol
|
|
18
|
+
(scoped to specific, proven-safe transforms) is a separate contract, not an extension of
|
|
19
|
+
this one — see ownership rule 6 in `protocol/README.md`.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schemas.inneranimalmedia.com/agentsam/recon/finding-report.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"title": "ReconFindingReport",
|
|
7
|
+
"description": "The only artifact a bounded recon worker may produce. It never edits files, never touches Git, and never owns a branch.",
|
|
8
|
+
"required": ["schema_version", "task_id", "status"],
|
|
9
|
+
"oneOf": [
|
|
10
|
+
{ "required": ["status"], "properties": { "status": { "const": "needs_context" } } },
|
|
11
|
+
{ "required": ["status"], "properties": { "status": { "const": "answered" } } }
|
|
12
|
+
],
|
|
13
|
+
"properties": {
|
|
14
|
+
"schema_version": { "const": 1 },
|
|
15
|
+
"task_id": { "type": "string", "minLength": 1 },
|
|
16
|
+
"status": { "enum": ["answered", "needs_context"] },
|
|
17
|
+
"summary": { "type": "string" },
|
|
18
|
+
"findings": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"additionalProperties": false,
|
|
23
|
+
"required": ["severity", "file", "finding"],
|
|
24
|
+
"properties": {
|
|
25
|
+
"severity": { "enum": ["low", "medium", "high"] },
|
|
26
|
+
"file": { "type": "string" },
|
|
27
|
+
"lines": { "type": "string" },
|
|
28
|
+
"finding": { "type": "string" },
|
|
29
|
+
"evidence": { "type": "string" },
|
|
30
|
+
"recommended_action": { "type": "string" }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"affected_files": { "type": "array", "items": { "type": "string" } },
|
|
35
|
+
"unknowns": { "type": "array", "items": { "type": "string" } },
|
|
36
|
+
"missing": {
|
|
37
|
+
"type": "array",
|
|
38
|
+
"items": { "type": "string" },
|
|
39
|
+
"description": "Required when status is needs_context: what evidence was missing."
|
|
40
|
+
},
|
|
41
|
+
"reason": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "Required when status is needs_context: why the supplied slices were insufficient."
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schemas.inneranimalmedia.com/agentsam/recon/task-packet.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"title": "ReconTaskPacket",
|
|
7
|
+
"description": "A bounded assignment handed to a cheap/local recon worker. Produced by a deterministic controller (rg/AST/repository.intelligence), never by the worker itself.",
|
|
8
|
+
"required": [
|
|
9
|
+
"schema_version",
|
|
10
|
+
"task_id",
|
|
11
|
+
"repo_root",
|
|
12
|
+
"base_sha",
|
|
13
|
+
"question",
|
|
14
|
+
"slices",
|
|
15
|
+
"ceilings"
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"schema_version": { "const": 1 },
|
|
19
|
+
"task_id": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"minLength": 1,
|
|
22
|
+
"description": "Caller-supplied identifier. Never a workspace/tenant ID — this is a task handle only."
|
|
23
|
+
},
|
|
24
|
+
"repo_root": { "type": "string", "minLength": 1 },
|
|
25
|
+
"base_sha": { "type": "string", "minLength": 1 },
|
|
26
|
+
"question": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"minLength": 1,
|
|
29
|
+
"description": "Exactly one bounded question. Not 'audit the subsystem'."
|
|
30
|
+
},
|
|
31
|
+
"slices": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"minItems": 1,
|
|
34
|
+
"maxItems": 5,
|
|
35
|
+
"description": "Exact file/line slices the worker may read. The worker must not open anything outside this list.",
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"additionalProperties": false,
|
|
39
|
+
"required": ["path"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"path": { "type": "string", "minLength": 1 },
|
|
42
|
+
"start_line": { "type": "integer", "minimum": 1 },
|
|
43
|
+
"end_line": { "type": "integer", "minimum": 1 },
|
|
44
|
+
"content": { "type": "string" },
|
|
45
|
+
"reason": { "type": "string" },
|
|
46
|
+
"kind": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "Optional structural label from a disambiguating tool (e.g. ast-grep): member, object_key, sql_string, call, comment, unknown. Absent when the slice came from lexical search alone."
|
|
49
|
+
},
|
|
50
|
+
"hit_count": {
|
|
51
|
+
"type": "integer",
|
|
52
|
+
"minimum": 1,
|
|
53
|
+
"description": "Optional: how many raw search hits this slice's line range covers, when built via from_matches()."
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"allowed_diagnostics": {
|
|
59
|
+
"type": "array",
|
|
60
|
+
"description": "Pre-approved read-only commands the worker may run verbatim. Empty/omitted means none.",
|
|
61
|
+
"items": { "type": "string" },
|
|
62
|
+
"default": []
|
|
63
|
+
},
|
|
64
|
+
"ceilings": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"additionalProperties": false,
|
|
67
|
+
"required": ["max_follow_up_reads", "max_output_tokens", "timeout_seconds"],
|
|
68
|
+
"properties": {
|
|
69
|
+
"max_follow_up_reads": { "type": "integer", "minimum": 0, "maximum": 2 },
|
|
70
|
+
"max_output_tokens": { "type": "integer", "minimum": 1 },
|
|
71
|
+
"timeout_seconds": { "type": "integer", "minimum": 1, "maximum": 600 }
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"response_schema_ref": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"const": "./finding-report.schema.json"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Bounded recon-worker harness: task-packet construction and finding-report validation.
|
|
2
|
+
|
|
3
|
+
This module does not call any model. It is the deterministic controller half of the
|
|
4
|
+
recon protocol described in docs/RECON.md — building small, exact, already-scoped work
|
|
5
|
+
packets, and validating whatever a worker (local or hosted) sends back against hard
|
|
6
|
+
ceilings before it reaches a capable coding agent.
|
|
7
|
+
"""
|
|
8
|
+
from .packet import (
|
|
9
|
+
build_task_packet,
|
|
10
|
+
from_matches,
|
|
11
|
+
from_ast_grep,
|
|
12
|
+
from_ripgrep,
|
|
13
|
+
PacketError,
|
|
14
|
+
TOOL_NAME_PACK,
|
|
15
|
+
)
|
|
16
|
+
from .validate import validate_report, ReportError, TOOL_NAME_VALIDATE
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"build_task_packet",
|
|
20
|
+
"from_matches",
|
|
21
|
+
"from_ast_grep",
|
|
22
|
+
"from_ripgrep",
|
|
23
|
+
"PacketError",
|
|
24
|
+
"TOOL_NAME_PACK",
|
|
25
|
+
"validate_report",
|
|
26
|
+
"ReportError",
|
|
27
|
+
"TOOL_NAME_VALIDATE",
|
|
28
|
+
]
|