@inneranimalmedia/agentsam-sdk 2.0.0-alpha.identity.9 → 2.0.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/DEVELOPMENT.md +55 -71
- package/README.md +89 -205
- package/bin/tag +83 -0
- package/docs/CLI_SHELL.md +91 -61
- package/docs/DOCKERIZE.md +188 -0
- package/docs/MERKLE.md +70 -0
- package/docs/MINI.md +34 -0
- package/docs/PORTABLE_CONTEXT.md +69 -0
- package/docs/RELEASES.md +4 -0
- package/docs/REPOSITORY_INTELLIGENCE.md +30 -0
- package/docs/SECURITY.md +65 -0
- package/docs/branch-archive-2026-09-02.md +35 -0
- package/docs/knowledge-branch-recovery.md +29 -0
- package/docs/knowledge-service-verification.md +81 -0
- package/docs/knowledge-service.md +120 -0
- package/docs/knowledge-verification.md +25 -0
- package/docs/portable-knowledge.md +96 -0
- package/docs/sdk-2.0-release.md +81 -0
- package/examples/agentsam-tui-ansi.mjs +149 -0
- package/package.json +40 -8
- package/packages/identity/package.json +1 -1
- package/packages/identity/src/adapters/cloudflare-d1/index.js +8 -3
- package/packages/identity/src/core/constants.js +1 -1
- package/packages/identity/src/core/sessions.js +1 -28
- package/packages/identity/src/oauth/callback.js +5 -3
- package/packages/identity/src/oauth/finalize-inbound.js +163 -0
- package/packages/identity/src/oauth/iam-platform.js +2 -2
- package/packages/identity/src/oauth/redirect-paths.js +92 -0
- package/packages/identity/src/server/worker-router.js +7 -10
- package/packages/identity/tests/finalize-inbound-oauth.test.mjs +114 -0
- package/protocol/MERKLE_V1.md +25 -0
- package/protocol/README.md +20 -41
- package/protocol/knowledge/README.md +5 -0
- package/protocol/knowledge/chunk.schema.json +82 -0
- package/protocol/knowledge/context-pack.schema.json +37 -0
- package/protocol/knowledge/document.schema.json +57 -0
- package/protocol/knowledge/index-config.schema.json +40 -0
- package/protocol/knowledge/ingest-receipt.schema.json +56 -0
- package/protocol/knowledge/repository.schema.json +61 -0
- package/protocol/knowledge/retrieval-hit.schema.json +80 -0
- package/protocol/knowledge/retrieval-query.schema.json +72 -0
- package/protocol/knowledge/source.schema.json +52 -0
- package/python/README.md +16 -2
- package/python/agentsam_sdk/cli.py +22 -0
- package/python/agentsam_sdk/data/agentsam_walk.py +1 -0
- package/python/agentsam_sdk/knowledge/__init__.py +3 -0
- package/python/agentsam_sdk/knowledge/client.py +33 -0
- package/python/agentsam_sdk/knowledge/models.py +114 -0
- package/python/agentsam_sdk/repository/__init__.py +6 -6
- package/python/agentsam_sdk/repository/intelligence/__init__.py +5 -0
- package/python/agentsam_sdk/repository/intelligence/__main__.py +3 -0
- package/python/agentsam_sdk/repository/intelligence/cli.py +84 -0
- package/python/agentsam_sdk/repository/intelligence/discovery.py +128 -0
- package/python/agentsam_sdk/repository/intelligence/git.py +80 -0
- package/python/agentsam_sdk/repository/intelligence/metrics.py +92 -0
- package/python/agentsam_sdk/repository/intelligence/snapshot.py +108 -0
- package/python/agentsam_sdk/repository/inventory.py +1 -0
- package/python/agentsam_sdk/runtime/contract.py +14 -0
- package/python/agentsam_sdk/tui/README.md +22 -0
- package/python/agentsam_sdk/tui/__init__.py +52 -0
- package/python/agentsam_sdk/tui/__main__.py +4 -0
- package/python/agentsam_sdk/tui/bootstrap.py +15 -0
- package/python/agentsam_sdk/tui/demo.py +291 -0
- package/python/agentsam_sdk/tui/frames.py +147 -0
- package/python/agentsam_sdk/tui/status.py +87 -0
- package/python/agentsam_sdk/tui/theme.py +57 -0
- package/python/agentsam_sdk/tui/widgets.py +218 -0
- package/python/pyproject.toml +4 -1
- package/python/requirements-tui.txt +1 -0
- package/python/tests/test_contract.py +11 -0
- package/python/tests/test_knowledge_models.py +22 -0
- package/python/tests/test_repository_intelligence.py +69 -0
- package/python/tests/test_tui_cli.py +25 -0
- package/services/cad/server.py +284 -0
- package/services/knowledge/package-lock.json +28 -0
- package/services/knowledge/package.json +7 -0
- package/src/cli.js +156 -33
- package/src/commands/context.js +53 -0
- package/src/commands/db.js +60 -0
- package/src/commands/deploy.js +44 -15
- package/src/commands/dockerize.js +228 -0
- package/src/commands/knowledge.js +106 -0
- package/src/commands/merkle.js +123 -0
- package/src/commands/mini.js +92 -0
- package/src/commands/security.js +71 -0
- package/src/commands/start-local.js +8 -3
- package/src/commands/status.js +13 -0
- package/src/commands/tui.js +120 -0
- package/src/index.js +11 -0
- package/src/knowledge/client.js +20 -0
- package/src/knowledge/config.js +69 -0
- package/src/knowledge/context-pack.js +15 -0
- package/src/knowledge/contracts.js +23 -0
- package/src/knowledge/engine.js +118 -0
- package/src/knowledge/evolution.js +10 -0
- package/src/knowledge/index.js +10 -0
- package/src/knowledge/providers/gemini.js +31 -0
- package/src/knowledge/retrieval.js +20 -0
- package/src/knowledge/service/client.js +18 -0
- package/src/knowledge/service/job-worker.js +34 -0
- package/src/knowledge/service/server.js +168 -0
- package/src/knowledge/source.js +86 -0
- package/src/knowledge/stores/postgres.js +49 -0
- package/src/knowledge/stores/postgres.sql +29 -0
- package/src/knowledge/stores/sqlite.js +45 -0
- package/src/lib/bridge-client.js +76 -0
- package/src/lib/cad-docker.js +156 -0
- package/src/lib/dockerize.js +526 -0
- package/src/lib/git-context.js +91 -0
- package/src/lib/init-git.js +19 -0
- package/src/lib/knowledge-docker.js +132 -0
- package/src/lib/local-scaffold.js +163 -107
- package/src/lib/local-status.js +79 -0
- package/src/lib/merkle/diff.js +23 -0
- package/src/lib/merkle/hash.js +12 -0
- package/src/lib/merkle/index.js +4 -0
- package/src/lib/merkle/policy.js +22 -0
- package/src/lib/merkle/snapshot.js +78 -0
- package/src/lib/merkle/tree.js +82 -0
- package/src/lib/mini/index.js +2 -0
- package/src/lib/mini/preview.js +75 -0
- package/src/lib/mini/scaffold.js +35 -0
- package/src/lib/scaffold.js +2 -2
- package/src/lib/slash-commands.js +10 -13
- package/src/local/sqlite.js +109 -0
- package/src/security/cli.mjs +2 -0
- package/src/security/index.js +6 -0
- package/src/security/inventory.js +109 -0
- package/src/security/logs.js +35 -0
- package/src/security/osv.js +94 -0
- package/src/security/process.js +31 -0
- package/src/security/render.js +24 -0
- package/src/security/repair.js +88 -0
- package/src/security/scan.js +38 -0
- package/src/ui/ansi.js +67 -0
- package/src/ui/merkle/explorer.js +76 -0
- package/src/ui/merkle/render.js +89 -0
- package/templates/mini/data/app.js +22 -0
- package/templates/mini/data/index.html +15 -0
- package/templates/mini/gadget/app.js +45 -0
- package/templates/mini/gadget/index.html +13 -0
- package/templates/mini/page/app.js +7 -0
- package/templates/mini/page/index.html +11 -0
- package/templates/mini/shared/style.css +1 -0
- package/test/cad-docker.test.mjs +96 -0
- package/test/dockerize.test.mjs +93 -0
- package/test/knowledge-postgres.test.mjs +40 -0
- package/test/knowledge-service.test.mjs +101 -0
- package/test/knowledge.test.mjs +156 -0
- package/test/merkle-render.test.mjs +31 -0
- package/test/merkle.test.mjs +144 -0
- package/test/mini.test.mjs +140 -0
- package/test/portable-context.test.mjs +84 -0
- package/test/security.test.mjs +183 -0
- package/test/smoke.mjs +46 -16
- package/protocol/dual-repo-sync.md +0 -35
- package/python/protocol/README.md +0 -51
- package/python/protocol/dual-repo-sync.md +0 -35
package/DEVELOPMENT.md
CHANGED
|
@@ -1,96 +1,80 @@
|
|
|
1
|
-
# Developing
|
|
1
|
+
# Developing AgentSam SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This is the canonical repository for portable AgentSam kits. Read
|
|
4
|
+
[protocol/README.md](protocol/README.md) for ownership and host-adapter boundaries.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
cd agentsam-sdk
|
|
7
|
-
npm test
|
|
8
|
-
npm run preview:auth-portal # opens /auth/login at http://127.0.0.1:8791
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Link into a scaffolded project
|
|
6
|
+
## Local verification
|
|
12
7
|
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
npm run
|
|
8
|
+
```sh
|
|
9
|
+
npm ci
|
|
10
|
+
npm run verify
|
|
11
|
+
npm run verify:knowledge-package
|
|
12
|
+
npm run test:python
|
|
13
|
+
npm run security:check
|
|
17
14
|
```
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
`npm run verify:release` combines all four verification commands. The `prepublishOnly`
|
|
17
|
+
hook runs it automatically before npm publication. `verify` covers SDK and identity
|
|
18
|
+
tests, package invariants, scaffold/bootstrap checks, and a pack dry-run.
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
The installed-tarball proof generates and runs a fresh app, then initializes, indexes,
|
|
21
|
+
searches, snapshots, and stages the Docker knowledge service in two unrelated repositories.
|
|
22
|
+
It installs the candidate tarball so a release never accidentally tests an older registry
|
|
23
|
+
version. Use `npm run verify:knowledge-package -- --offline` when dependencies are cached.
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```
|
|
25
|
+
The Python suite uses unittest and bundled standard-library tooling. Rich is optional.
|
|
26
|
+
Postgres/pgvector checks use development-only PGlite; no production database or embedding
|
|
27
|
+
API call is required by the tests. Dependency scanning requires access to OSV.
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
## Use in a consumer
|
|
29
30
|
|
|
30
|
-
```
|
|
31
|
-
|
|
31
|
+
```sh
|
|
32
|
+
npm link
|
|
33
|
+
cd /path/to/consumer
|
|
34
|
+
npm link @inneranimalmedia/agentsam-sdk
|
|
35
|
+
agentsam context --json
|
|
32
36
|
```
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
Git context is derived from the checkout. Host authorization and credentials are supplied
|
|
39
|
+
through explicit adapters. See [portable context](docs/PORTABLE_CONTEXT.md).
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
npx agentsam init \
|
|
38
|
-
--name my-agent \
|
|
39
|
-
--lane fullstack \
|
|
40
|
-
--provider cloudflare \
|
|
41
|
-
--agent orchestrator \
|
|
42
|
-
--yes
|
|
43
|
-
```
|
|
41
|
+
For a new local application:
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
2. `npm test` passes
|
|
49
|
-
3. Bump version in root `package.json`
|
|
50
|
-
4. Confirm `files` includes consumer surfaces (`src`, `bin`, `python`, `protocol`, …)
|
|
51
|
-
5. `bash scripts/npm-publish-preflight.sh` — must print `npm whoami: inneranimalmedia`
|
|
52
|
-
6. `npm publish --tag alpha --access public` (or `--tag latest` for stable)
|
|
53
|
-
7. Tag: `git tag vX.Y.Z && git push origin vX.Y.Z`
|
|
54
|
-
8. Record pairing in [`docs/RELEASES.md`](./docs/RELEASES.md): `iam@<40-sha> ↔ @inneranimalmedia/agentsam-sdk@X.Y.Z`
|
|
43
|
+
```sh
|
|
44
|
+
agentsam init --name my-agent --lane fullstack --run-target local --yes
|
|
45
|
+
```
|
|
55
46
|
|
|
56
|
-
|
|
47
|
+
For an existing repository:
|
|
57
48
|
|
|
58
|
-
|
|
49
|
+
```sh
|
|
50
|
+
agentsam init . --yes --include src,docs
|
|
51
|
+
```
|
|
59
52
|
|
|
60
|
-
|
|
61
|
-
- Fix: `npm whoami` must be `inneranimalmedia`
|
|
62
|
-
```bash
|
|
63
|
-
npm logout
|
|
64
|
-
npm login # npm user inneranimalmedia (org owner), not personal GitHub-linked account
|
|
65
|
-
bash scripts/npm-publish-preflight.sh
|
|
66
|
-
npm publish --tag alpha --access public
|
|
67
|
-
```
|
|
68
|
-
- If you use a team org on npmjs.com, invite your daily npm user as **Developer** on the org with publish rights.
|
|
69
|
-
- Always pass `--access public` (already in `package.json` `publishConfig`; flag is harmless).
|
|
53
|
+
## Publish
|
|
70
54
|
|
|
71
|
-
|
|
72
|
-
|
|
55
|
+
Use [the stable 2.0 release guide](docs/sdk-2.0-release.md). The root package is the only
|
|
56
|
+
npm publication; identity and shell-kit workspaces remain private. Versions in the root
|
|
57
|
+
manifest, lockfile and identity workspace must match. All export targets and the shipped
|
|
58
|
+
knowledge-service runtime assets are checked before publication.
|
|
73
59
|
|
|
74
|
-
|
|
60
|
+
`scripts/npm-publish-preflight.sh` checks package invariants and npm login. Package
|
|
61
|
+
publishing rights are enforced by npm, not a hardcoded local username. Scoped public
|
|
62
|
+
publication uses `--access public`.
|
|
75
63
|
|
|
76
|
-
|
|
64
|
+
Stable publishing is manual:
|
|
77
65
|
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
python3 -m pip install -e ".[dev]"
|
|
81
|
-
python3 -m pytest
|
|
82
|
-
python3 -m agentsam_sdk.repository.inventory --json --root /path/to/repo
|
|
66
|
+
```sh
|
|
67
|
+
npm publish --tag latest --access public
|
|
83
68
|
```
|
|
84
69
|
|
|
85
|
-
|
|
86
|
-
|
|
70
|
+
Legacy `publish:identity-alpha` commands and the manual alpha workflow only accept alpha
|
|
71
|
+
versions. They do not publish a stable version under the alpha tag.
|
|
87
72
|
|
|
88
|
-
##
|
|
73
|
+
## Remaining integration work
|
|
89
74
|
|
|
90
|
-
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
-
|
|
94
|
-
- Published API route may differ; stub mode works without `AGENTSAM_SDK_TOKEN`
|
|
75
|
+
The local status command is implemented. Hosted execution/orchestration, production
|
|
76
|
+
knowledge-service routing, additional embedding adapters, scheduled indexing, and retention
|
|
77
|
+
are separate host or feature work. The archived execution branch is mapped in
|
|
78
|
+
[branch archive](docs/branch-archive-2026-09-02.md); it is not an implemented API surface.
|
|
95
79
|
|
|
96
|
-
|
|
80
|
+
Gorilla remains a visual experiment. It is not the default scaffold or a production shell.
|
package/README.md
CHANGED
|
@@ -1,233 +1,117 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AgentSam SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Portable SDK modules and CLI kits for creating local projects, inspecting repositories,
|
|
4
|
+
indexing selected code, integrating identity, and maintaining dependencies.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
**npm:** `@inneranimalmedia/agentsam-sdk` · **Source:** [GitHub](https://github.com/SamPrimeaux/agentsam-sdk)
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Node 22.5+ is required. Docker is optional for container commands. Python 3.10+ is required
|
|
9
|
+
for the bundled Python repository tools; Rich is optional for the richer terminal UI.
|
|
10
|
+
See the [2.0 release guide](docs/sdk-2.0-release.md) for publication status and migration notes.
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
## Install
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Agent Sam is a platform operator AI. It sits on top of your infrastructure and can:
|
|
16
|
-
|
|
17
|
-
- **Understand intent** — natural language in, real actions out
|
|
18
|
-
- **Execute across surfaces** — terminal, database, browser, CAD, deploy, MCP tools
|
|
19
|
-
- **Route intelligently** — local machine, cloud VM, or sandboxed environment based on context
|
|
20
|
-
- **Gate high-risk actions** — approval flows before anything destructive runs
|
|
21
|
-
- **Leave an audit trail** — every tool call, command run, and decision is logged
|
|
22
|
-
|
|
23
|
-
It is not a wrapper around a chat API. It is a command fabric with a conversation interface.
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Quickstart (local-first — Node only)
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npx @inneranimalmedia/agentsam-sdk init
|
|
14
|
+
```sh
|
|
15
|
+
npm install @inneranimalmedia/agentsam-sdk
|
|
16
|
+
# Or install the CLI globally:
|
|
17
|
+
npm install -g @inneranimalmedia/agentsam-sdk
|
|
31
18
|
```
|
|
32
19
|
|
|
33
|
-
|
|
20
|
+
The identity workspace is included through `@inneranimalmedia/agentsam-sdk/identity`.
|
|
21
|
+
It is not a separate npm installation. A container is not required to import SDK modules
|
|
22
|
+
or use local scaffolding/indexing.
|
|
34
23
|
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
## Create a local application
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
agentsam init --name my-agent --yes
|
|
28
|
+
cd my-agent
|
|
37
29
|
npm install
|
|
38
30
|
npm run smoke
|
|
39
|
-
|
|
40
|
-
npx agentsam tunnel # cloudflared → register with IAM (dashboard Local lane)
|
|
41
|
-
npm run dev # http://127.0.0.1:8787
|
|
42
|
-
npm run db:migrate # local D1 schema
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
`agentsam tunnel` (default `--quick`) starts a Cloudflare quick tunnel to `:3099` and POSTs the `wss://` URL to `/api/sdk/terminal/register-local` so `agentsam_terminal_local` can reach your machine. Use `--named --tunnel-name … --hostname … --zone-id …` for a stable BYOK named tunnel.
|
|
46
|
-
When you're ready to ship to **your** Cloudflare account:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
npx agentsam deploy
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Cloudflare OAuth is prompted **only at deploy** — not at init.
|
|
53
|
-
|
|
54
|
-
Non-interactive init:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
npx @inneranimalmedia/agentsam-sdk init \
|
|
58
|
-
--name my-agent \
|
|
59
|
-
--lane fullstack \
|
|
60
|
-
--run-target local \
|
|
61
|
-
--yes
|
|
31
|
+
npm run dev
|
|
62
32
|
```
|
|
63
33
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
34
|
+
This creates a Git repository, local SQLite database, environment templates, a Node API,
|
|
35
|
+
and terminal commands. Local setup does not require an IAM account, cloud credentials,
|
|
36
|
+
or a tunnel. `npm run status`, `npm run tui`, and `npm run pty` inspect or operate the
|
|
37
|
+
generated project. A configured host/provider is required when selecting cloud operations.
|
|
67
38
|
|
|
68
|
-
|
|
39
|
+
Without a global install, use `npx @inneranimalmedia/agentsam-sdk init --name my-agent --yes`.
|
|
69
40
|
|
|
70
|
-
##
|
|
41
|
+
## Index an existing repository
|
|
71
42
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
43
|
+
```sh
|
|
44
|
+
agentsam init . --yes --include src,docs
|
|
45
|
+
agentsam index plan
|
|
46
|
+
agentsam index run
|
|
47
|
+
agentsam search "configuration loading"
|
|
48
|
+
agentsam repo snapshot --save
|
|
76
49
|
```
|
|
77
50
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
51
|
+
Choose literal files/directories that actually exist in your repository. Initial indexing
|
|
52
|
+
is local AST/text work and makes no embedding calls. Unchanged content is cached; saved
|
|
53
|
+
generations retain source provenance. Explicit Gemini embedding requests and Postgres
|
|
54
|
+
storage are optional. See [portable knowledge](docs/portable-knowledge.md).
|
|
55
|
+
|
|
56
|
+
The JavaScript/TypeScript parser records syntactic relationships, not a fully resolved
|
|
57
|
+
semantic call graph. Model/dimension changes create a distinct embedding profile.
|
|
58
|
+
Python-backed snapshots capture repository composition and Git churn.
|
|
59
|
+
|
|
60
|
+
## Available kits
|
|
61
|
+
|
|
62
|
+
| Capability | Entry point | Guide |
|
|
63
|
+
| --- | --- | --- |
|
|
64
|
+
| Git context and bridge client | `agentsam context --json`; `/git-context`, `/bridge-client` | [Portable context](docs/PORTABLE_CONTEXT.md) |
|
|
65
|
+
| Identity contracts and adapters | `/identity`; `agentsam identity init` | [Identity](packages/identity/README.md) |
|
|
66
|
+
| Repository knowledge | `agentsam index`, `search`, `repo`; `/knowledge` | [Knowledge](docs/portable-knowledge.md) |
|
|
67
|
+
| File integrity | `agentsam merkle`; `/merkle` | [Merkle](docs/MERKLE.md) |
|
|
68
|
+
| Dependency health and repair | `agentsam security`; `/security` | [Security](docs/SECURITY.md) |
|
|
69
|
+
| Mini prototypes | `agentsam mini`; `/mini` | [Mini](docs/MINI.md) |
|
|
70
|
+
| Local containers | `agentsam dockerize`; `/dockerize` | [Dockerize](docs/DOCKERIZE.md) |
|
|
71
|
+
| Background indexing service | Docker `knowledge_service`; `/knowledge-service-client` | [Knowledge service](docs/knowledge-service.md) |
|
|
72
|
+
| Local status, DB, terminal UI | `agentsam status`, `db`, `tui`, `start-local` | [Terminal UI](docs/CLI_SHELL.md) |
|
|
73
|
+
|
|
74
|
+
Export suffixes such as `/identity` mean imports from
|
|
75
|
+
`@inneranimalmedia/agentsam-sdk/identity`. Use `agentsam <command> --help` where supported.
|
|
76
|
+
|
|
77
|
+
## Optional background service
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
agentsam dockerize --type knowledge_service --name agentsam-knowledge \
|
|
81
|
+
--repository app=/absolute/path/to/repository
|
|
88
82
|
```
|
|
89
83
|
|
|
90
|
-
|
|
84
|
+
The preset builds a small runtime image, mounts source read-only, exposes an authenticated
|
|
85
|
+
localhost job API, and preserves indexes/jobs in a Docker volume. Embeddings are disabled
|
|
86
|
+
by default. It uses the same SDK indexing engine; CocoIndex is not a dependency.
|
|
91
87
|
|
|
92
|
-
|
|
88
|
+
The service is a separate deployment target. It does not automatically connect production
|
|
89
|
+
Workers, ingest customer repositories, schedule scans, or supply end-user authorization.
|
|
90
|
+
The fetch-only `/knowledge-service-client` export can be used by a Worker after the host
|
|
91
|
+
authorizes its caller. Other local tooling uses Node APIs.
|
|
93
92
|
|
|
94
|
-
|
|
93
|
+
## Host integration and ownership
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
The root `AgentSam` helper supplies routing/session primitives. Full model orchestration,
|
|
96
|
+
tool execution policy, provider credentials, user authorization, and production storage
|
|
97
|
+
belong to the consuming host application. The npm package alone does not provide a hosted
|
|
98
|
+
autonomous agent platform. The old `scaffoldProject()` export is deprecated; use the local
|
|
99
|
+
CLI scaffold command.
|
|
97
100
|
|
|
98
|
-
|
|
101
|
+
This repository owns portable code once. Applications import it and provide adapters;
|
|
102
|
+
they do not mirror SDK trees. [Ownership protocol](protocol/README.md).
|
|
99
103
|
|
|
100
|
-
##
|
|
104
|
+
## Development and releases
|
|
101
105
|
|
|
102
|
-
```
|
|
103
|
-
npm
|
|
106
|
+
```sh
|
|
107
|
+
npm ci
|
|
108
|
+
npm run verify:release
|
|
104
109
|
```
|
|
105
110
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
| Lane | Best For |
|
|
111
|
-
|------|----------|
|
|
112
|
-
| **Full Stack** | End-to-end apps — agent chat, terminal, deploy, D1, R2, Durable Objects, KV |
|
|
113
|
-
| **CMS** | Content-managed websites — pages, assets, themes, navigation, live edit |
|
|
114
|
-
| **Data Solutions** | Database ops, migrations, queries, Supabase pgvector, Hyperdrive pipelines |
|
|
115
|
-
| **Customer Management** | CRM, contacts, billing, client workflows, multi-tenant isolation |
|
|
116
|
-
| **Creative & Design** | CAD, 3D, media generation, content pipelines |
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
## Agents
|
|
121
|
-
|
|
122
|
-
| Agent | Role |
|
|
123
|
-
|-------|------|
|
|
124
|
-
| **Orchestrator** | General purpose — routes across all lanes and tools |
|
|
125
|
-
| **CMS Agent** | Pages, sections, assets, themes, publishing workflows |
|
|
126
|
-
| **Data Agent** | D1, Supabase, Hyperdrive, migrations, vector search |
|
|
127
|
-
| **CRM Agent** | Customer records, contacts, billing, client isolation |
|
|
128
|
-
| **Creative Agent** | Design commands, 3D generation, CAD, media pipelines |
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## How It Works
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
User Intent (chat or CLI)
|
|
136
|
-
↓
|
|
137
|
-
Agent Sam — intent classification + command match
|
|
138
|
-
↓
|
|
139
|
-
Tool Catalog (D1) — policy check + approval gate
|
|
140
|
-
↓
|
|
141
|
-
Execution — terminal / D1 / Supabase / R2 / KV / DO / browser / deploy / MCP
|
|
142
|
-
↓
|
|
143
|
-
Telemetry — every action logged, measured, improvable
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
Capabilities are data-driven — new tools are added via D1, not Worker redeployments. The same tool catalog powers the dashboard, the CLI, and any MCP-connected client like Cursor or Claude Desktop.
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## Infrastructure
|
|
151
|
-
|
|
152
|
-
Agent Sam scaffolds and operates across the full Cloudflare + Supabase stack:
|
|
153
|
-
|
|
154
|
-
| Layer | Technology | Role |
|
|
155
|
-
|-------|------------|------|
|
|
156
|
-
| **Compute** | Cloudflare Workers | Edge runtime, API, agent dispatch |
|
|
157
|
-
| **Relational DB** | D1 (SQLite) | Tool catalog, sessions, telemetry, CMS, auth |
|
|
158
|
-
| **Vector DB** | Supabase pgvector via Hyperdrive | RAG, semantic search, agent memory |
|
|
159
|
-
| **Object Storage** | R2 | Assets, media, bundles, CMS content |
|
|
160
|
-
| **Key-Value** | Workers KV | Cache, CMS drafts, feature flags |
|
|
161
|
-
| **Stateful Sessions** | Durable Objects | Terminal sessions, collab, real-time state |
|
|
162
|
-
| **Terminal** | ExecOS over cloudflared tunnel | Shell execution, deploy, git, wrangler |
|
|
163
|
-
| **AI Router** | Anthropic + OpenAI | Adaptive Thompson sampling across models |
|
|
164
|
-
| **Protocol** | MCP (Model Context Protocol) | External agent surface for Cursor, Claude, etc. |
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## Execution Lanes
|
|
169
|
-
|
|
170
|
-
Agent Sam routes work to the right environment automatically:
|
|
171
|
-
|
|
172
|
-
| Lane | Environment | When |
|
|
173
|
-
|------|-------------|------|
|
|
174
|
-
| Local | Your machine | Fastest dev loop |
|
|
175
|
-
| Cloud | Always-on VM via tunnel | Machine asleep or offsite |
|
|
176
|
-
| Sandbox | Isolated workspace | Safe experiments, tenant isolation |
|
|
177
|
-
|
|
178
|
-
---
|
|
179
|
-
|
|
180
|
-
## What Gets Scaffolded
|
|
181
|
-
|
|
182
|
-
Running `agentsam init` generates a production-ready project for your lane:
|
|
183
|
-
|
|
184
|
-
**All lanes include:**
|
|
185
|
-
- `agentsam.config.js` — project config, lane, provider, agent
|
|
186
|
-
- `wrangler.toml` — Worker, D1, R2, KV, Durable Object bindings
|
|
187
|
-
- `.env.example` — all required secrets pre-listed
|
|
188
|
-
- `src/index.js` — Worker entry point wired to your agent
|
|
189
|
-
- `README.md` — setup and deploy instructions
|
|
190
|
-
|
|
191
|
-
**CMS lane adds:** page/section/asset schema migrations and CMS worker scaffold.
|
|
192
|
-
|
|
193
|
-
**Data lane adds:** D1 + Hyperdrive config and migration templates.
|
|
194
|
-
|
|
195
|
-
**Full Stack adds:** Durable Object session scaffold, auth tables, full agent chat loop.
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
## Multi-Tenant & Client Policy
|
|
200
|
-
|
|
201
|
-
- Each user or client gets a scoped workspace
|
|
202
|
-
- Terminal execution is path-isolated — no cross-tenant access
|
|
203
|
-
- AI usage is policy-gated — BYOK, managed, or disabled per client
|
|
204
|
-
- D1 and R2 are scoped per tenant at the binding level
|
|
205
|
-
- Every action produces an audit trail
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
## Roadmap
|
|
210
|
-
|
|
211
|
-
- [x] `agentsam shell` — shell UX info + slash command registry
|
|
212
|
-
- [x] Gorilla Shell Phase 0 prototype in `examples/gorilla-shell/`
|
|
213
|
-
- [x] `agentsam deploy` — push your project from CLI
|
|
214
|
-
- [x] Identity alpha — contracts, providers, auth portal preview (`agentsam identity preview`)
|
|
215
|
-
- [ ] `agentsam status` — live agent and infrastructure health
|
|
216
|
-
- [ ] `agentsam logs` — tail tool call and command logs
|
|
217
|
-
- [ ] PTY bridge (Phase 1) — ExecOS WebSocket in shell
|
|
218
|
-
- [ ] Kit marketplace — CMS, ecommerce, nonprofit, SaaS starters
|
|
219
|
-
- [ ] BYOK AI key support per project
|
|
220
|
-
|
|
221
|
-
---
|
|
222
|
-
|
|
223
|
-
## Built By
|
|
224
|
-
|
|
225
|
-
[Inner Animal Media](https://inneranimalmedia.com) — Agent Sam is the operator brain behind the platform. The SDK is how we productize that infrastructure for other developers.
|
|
226
|
-
|
|
227
|
-
**Legacy:** [InnerAnimal/gorilla-mode](https://github.com/InnerAnimal/gorilla-mode) → consolidated here.
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
## License
|
|
111
|
+
Release verification runs Node/identity tests, bootstrap and package checks, installed
|
|
112
|
+
tarball fixtures in unrelated repositories, Python tests, and a complete dependency scan.
|
|
113
|
+
[Development](DEVELOPMENT.md) · [Release guide](docs/sdk-2.0-release.md) ·
|
|
114
|
+
[Branch archive](docs/branch-archive-2026-09-02.md).
|
|
232
115
|
|
|
233
|
-
MIT
|
|
116
|
+
License: MIT. Optional visual experiments and host-specific integrations retain their
|
|
117
|
+
documented boundaries; they are not automatically installed into customer applications.
|
package/bin/tag
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# bin/tag (agentsam-sdk)
|
|
4
|
+
#
|
|
5
|
+
# WHAT THIS IS:
|
|
6
|
+
# Cross-repo hashtag ledger. Machine-random identifiers (commit SHAs,
|
|
7
|
+
# branch suffixes like "8edb", patch filenames, D1 UUIDs) are impossible
|
|
8
|
+
# to remember. This maps a human hashtag -> whatever the real ref is,
|
|
9
|
+
# across ALL your repos, in one file: tags/registry.json (in this repo,
|
|
10
|
+
# since agentsam-sdk is the one thing every project already touches).
|
|
11
|
+
#
|
|
12
|
+
# Convention: #<repo-shorthand>-<theme>[-<seq>], lowercase, hyphenated.
|
|
13
|
+
# e.g. #remix-workmode, #sdk-allowscripts, #workmode-promote
|
|
14
|
+
#
|
|
15
|
+
# USAGE:
|
|
16
|
+
# bin/tag add "#name" --repo <repo> --ref <sha|branch|patch|url> --note "..."
|
|
17
|
+
# bin/tag find "#name" (substring match on tag, repo, or note)
|
|
18
|
+
# bin/tag list (everything, most recent first)
|
|
19
|
+
# bin/tag list --repo <repo>
|
|
20
|
+
# ============================================================================
|
|
21
|
+
set -euo pipefail
|
|
22
|
+
|
|
23
|
+
SDK_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
24
|
+
REGISTRY="$SDK_ROOT/tags/registry.json"
|
|
25
|
+
mkdir -p "$(dirname "$REGISTRY")"
|
|
26
|
+
[[ -f "$REGISTRY" ]] || echo "[]" > "$REGISTRY"
|
|
27
|
+
|
|
28
|
+
norm_tag() {
|
|
29
|
+
local t="$1"
|
|
30
|
+
[[ "$t" == \#* ]] || t="#$t"
|
|
31
|
+
echo "$t" | tr '[:upper:]' '[:lower:]'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
cmd_add() {
|
|
35
|
+
local tag="" repo="" ref="" note=""
|
|
36
|
+
tag="$(norm_tag "$1")"; shift
|
|
37
|
+
while [[ $# -gt 0 ]]; do
|
|
38
|
+
case "$1" in
|
|
39
|
+
--repo) repo="$2"; shift 2 ;;
|
|
40
|
+
--ref) ref="$2"; shift 2 ;;
|
|
41
|
+
--note) note="$2"; shift 2 ;;
|
|
42
|
+
*) echo "Unknown arg: $1" >&2; exit 1 ;;
|
|
43
|
+
esac
|
|
44
|
+
done
|
|
45
|
+
local date
|
|
46
|
+
date="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
47
|
+
local tmp
|
|
48
|
+
tmp="$(mktemp)"
|
|
49
|
+
jq --arg tag "$tag" --arg repo "$repo" --arg ref "$ref" --arg note "$note" --arg date "$date" \
|
|
50
|
+
'. + [{tag:$tag, repo:$repo, ref:$ref, note:$note, date:$date}]' \
|
|
51
|
+
"$REGISTRY" > "$tmp" && mv "$tmp" "$REGISTRY"
|
|
52
|
+
echo "added $tag"
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
cmd_find() {
|
|
56
|
+
local q
|
|
57
|
+
q="$(echo "${1:-}" | tr '[:upper:]' '[:lower:]')"
|
|
58
|
+
jq -r --arg q "$q" '
|
|
59
|
+
[.[] | select(
|
|
60
|
+
(.tag | ascii_downcase | contains($q)) or
|
|
61
|
+
(.repo | ascii_downcase | contains($q)) or
|
|
62
|
+
(.note | ascii_downcase | contains($q))
|
|
63
|
+
)] | sort_by(.date) | reverse | .[] |
|
|
64
|
+
"\(.date) \(.tag) [\(.repo)] \(.ref)\n \(.note)\n"
|
|
65
|
+
' "$REGISTRY"
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
cmd_list() {
|
|
69
|
+
local repo_filter=""
|
|
70
|
+
if [[ "${1:-}" == "--repo" ]]; then repo_filter="${2:-}"; fi
|
|
71
|
+
jq -r --arg repo "$repo_filter" '
|
|
72
|
+
(if $repo == "" then . else [.[] | select(.repo == $repo)] end)
|
|
73
|
+
| sort_by(.date) | reverse | .[] |
|
|
74
|
+
"\(.date) \(.tag) [\(.repo)] \(.ref)\n \(.note)\n"
|
|
75
|
+
' "$REGISTRY"
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
case "${1:-list}" in
|
|
79
|
+
add) shift; cmd_add "$@" ;;
|
|
80
|
+
find) shift; cmd_find "$@" ;;
|
|
81
|
+
list) shift; cmd_list "$@" ;;
|
|
82
|
+
*) echo "Usage: $0 {add \"#tag\" --repo R --ref REF --note N|find \"#tag\"|list [--repo R]}" >&2; exit 1 ;;
|
|
83
|
+
esac
|