@nullsquare/agent-authority 0.4.6 → 0.4.8
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 +108 -5
- package/ROADMAP.md +30 -5
- package/docs/connected-execution-api.md +60 -0
- package/docs/connected-github.md +140 -0
- package/docs/npm-release.md +30 -10
- package/docs/product-proof.md +134 -8
- package/docs/quickstart.md +147 -0
- package/docs/release-v0.4.7.md +38 -0
- package/examples/live-github-derived-mutation.js +47 -54
- package/examples/quickstart-github-connected.mjs +77 -0
- package/examples/quickstart-github-live.mjs +84 -0
- package/examples/quickstart.mjs +101 -0
- package/examples/task-first-coding.js +238 -0
- package/examples/task-first-finance.js +223 -0
- package/examples/task-first-support.js +127 -0
- package/package.json +7 -3
- package/src/cli.js +3 -3
- package/src/connections.js +19 -4
- package/src/providers/github-coding.js +101 -0
- package/src/providers/github.js +178 -9
- package/src/task.js +45 -4
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
**Agent Authority is a small execution layer that lets an agent use existing account permissions only for the task the user actually gave it.**
|
|
10
10
|
|
|
11
|
-
[Task-first API](#task-first-api) · [Product proof gate](docs/product-proof.md) · [Task Leases](docs/task-leases.md) · [Durability](docs/durable-task-leases.md) · [Evidence](docs/evidence.md) · [Transport invariance](docs/transport-invariance.md) · [Roadmap](ROADMAP.md)
|
|
11
|
+
[Quickstart](docs/quickstart.md) · [Connected GitHub](docs/connected-github.md) · [Task-first API](#task-first-api) · [Product proof gate](docs/product-proof.md) · [Task Leases](docs/task-leases.md) · [Durability](docs/durable-task-leases.md) · [Evidence](docs/evidence.md) · [Transport invariance](docs/transport-invariance.md) · [Roadmap](ROADMAP.md)
|
|
12
12
|
|
|
13
|
-
> **Status: public pre-alpha / v0.4.
|
|
13
|
+
> **Status: public pre-alpha / v0.4.7 Developer Preview on npm.** The task-first API is published as `@nullsquare/agent-authority/task`. Agent Authority is not production-ready yet.
|
|
14
14
|
|
|
15
15
|
</div>
|
|
16
16
|
|
|
@@ -56,6 +56,99 @@ Requires Node.js 20+.
|
|
|
56
56
|
npm install @nullsquare/agent-authority
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
## Fresh-install quickstart
|
|
60
|
+
|
|
61
|
+
You can see the task-authority model without a repository checkout, provider credential, OAuth setup, custom extractor, or Mission JSON.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
mkdir agent-authority-quickstart
|
|
65
|
+
cd agent-authority-quickstart
|
|
66
|
+
npm init -y
|
|
67
|
+
npm install @nullsquare/agent-authority
|
|
68
|
+
curl -fsSL https://raw.githubusercontent.com/Null-Square/agent-authority/main/examples/quickstart.mjs -o quickstart.mjs
|
|
69
|
+
node quickstart.mjs
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Expected shape:
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
ALLOW -> task discovered issue #42 and the exact comment effect ran
|
|
76
|
+
STEP-UP -> The task established authority for 42 but this action requested 7.
|
|
77
|
+
PASS -> useful task work ran; unrelated standing permission did not become task authority
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The quickstart uses the real published `createTask()` API and reviewed GitHub authority extractor. Only the provider callback is a local provider-shaped fixture so the first run needs no account.
|
|
81
|
+
|
|
82
|
+
The fresh-install path is continuously checked from blank Node 20 consumers against the public npm package. That proves the published package supports the documented task-first surface; it does **not** replace the still-open first-time-human under-10-minute adoption test.
|
|
83
|
+
|
|
84
|
+
### Next: make one real GitHub call, still with no credential
|
|
85
|
+
|
|
86
|
+
From the same blank project:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
curl -fsSL https://raw.githubusercontent.com/Null-Square/agent-authority/main/examples/quickstart-github-live.mjs -o quickstart-github-live.mjs
|
|
90
|
+
node quickstart-github-live.mjs
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Expected shape:
|
|
94
|
+
|
|
95
|
+
```text
|
|
96
|
+
Standing GitHub permission -> repo.read
|
|
97
|
+
Task authority -> Null-Square/agent-authority
|
|
98
|
+
GitHub mode -> public API; no credential required
|
|
99
|
+
ALLOW -> real GitHub returned Null-Square/agent-authority
|
|
100
|
+
STEP-UP -> The task established authority for "Null-Square/agent-authority" but this action requested "octocat/Hello-World".
|
|
101
|
+
PASS -> broader standing repo.read permission could not reach an unrelated repository for this task
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This deliberately models the account/app capability as broader than the task. Mission-level `repo.read` can read repositories generally, while the Task authority root allows this task to reach only `Null-Square/agent-authority`. The first request makes one real public GitHub `fetch()`; the unrelated repository is stopped before a second network call.
|
|
105
|
+
|
|
106
|
+
### Then: connect GitHub without putting the credential in task context
|
|
107
|
+
|
|
108
|
+
v0.4.7 adds the connected-provider task path. Initialize the local runtime and pipe a GitHub credential on stdin:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npx agent-authority setup
|
|
112
|
+
printf %s "$GITHUB_TOKEN" | npx agent-authority connect github --token-stdin
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Then an application can use the same task-first surface with broker-owned provider execution:
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
import { createRuntimeEnvironment } from '@nullsquare/agent-authority/runtime-env';
|
|
119
|
+
import { createTask } from '@nullsquare/agent-authority/task';
|
|
120
|
+
|
|
121
|
+
const env = createRuntimeEnvironment();
|
|
122
|
+
|
|
123
|
+
const task = createTask({
|
|
124
|
+
principal: env.config.principal_id,
|
|
125
|
+
agent: 'agent:assistant',
|
|
126
|
+
request: 'Inspect only acme/private',
|
|
127
|
+
permissions: {
|
|
128
|
+
github: { allow: ['repo.read'], constraints: {} }
|
|
129
|
+
},
|
|
130
|
+
authority: {
|
|
131
|
+
repository: { kind: 'github.repository', value: 'acme/private' }
|
|
132
|
+
},
|
|
133
|
+
bindings: [
|
|
134
|
+
{ service: 'github', action: 'repo.read', field: 'repository', authority: 'repository' }
|
|
135
|
+
],
|
|
136
|
+
runtime: env.runtime
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const result = await task.execute({
|
|
140
|
+
service: 'github',
|
|
141
|
+
action: 'repo.read',
|
|
142
|
+
context: { repository: 'acme/private' }
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`task.run(request, callback)` is for application-owned SDK/provider effects. `task.execute(request)` is for Agent Authority connected-provider execution, where credential resolution stays behind the broker boundary. Both use the same Task Lease semantics and the same deny/step-up error model.
|
|
147
|
+
|
|
148
|
+
The connected GitHub CI proof packs the candidate into a fresh Node 20 consumer, creates a fresh Agent Authority home, pipes the repository's GitHub Actions installation token through stdin, confirms no plaintext token appears under the home, executes one authorized live GitHub request, and blocks an unrelated repository at the Task Lease. A fine-grained PAT or GitHub App token can use the same path for repositories that credential is allowed to access. Public CI does **not** claim independent access to an unrelated private repository.
|
|
149
|
+
|
|
150
|
+
See [Fresh-install quickstart](docs/quickstart.md) and [Connected GitHub](docs/connected-github.md).
|
|
151
|
+
|
|
59
152
|
## Task-first API
|
|
60
153
|
|
|
61
154
|
The preferred developer surface is intentionally small:
|
|
@@ -144,6 +237,8 @@ Example output:
|
|
|
144
237
|
The task established authority for 42 but this action requested 7.
|
|
145
238
|
```
|
|
146
239
|
|
|
240
|
+
For a connected provider, the same error/explanation flow applies to `task.execute(request)`. Successful connected execution also returns an ALLOW receipt and execution evidence, so reviewed provider outputs can feed `task.authorityFrom()` without copying the provider credential into the task.
|
|
241
|
+
|
|
147
242
|
The task-first API is a facade over the existing Mission, Task Lease, execution-evidence and guard primitives. It does not weaken or replace them.
|
|
148
243
|
|
|
149
244
|
## Run the product demo
|
|
@@ -262,7 +357,7 @@ MCP gateway
|
|
|
262
357
|
brokered provider execution
|
|
263
358
|
```
|
|
264
359
|
|
|
265
|
-
A real Vercel AI SDK `ToolLoopAgent` integration also exercises the protected-tool boundary. See [Transport invariance](docs/transport-invariance.md).
|
|
360
|
+
The task-first facade can now use both application-owned execution (`task.run`) and broker-owned connected execution (`task.execute`) without changing the underlying Task Lease. A real Vercel AI SDK `ToolLoopAgent` integration also exercises the protected-tool boundary. See [Transport invariance](docs/transport-invariance.md) and [Connected execution](docs/connected-execution-api.md).
|
|
266
361
|
|
|
267
362
|
## Durability
|
|
268
363
|
|
|
@@ -304,8 +399,14 @@ See [Durable Task Leases](docs/durable-task-leases.md).
|
|
|
304
399
|
- authenticated durable Task Lease recovery;
|
|
305
400
|
- stale-writer/CAS and mission-alias protection;
|
|
306
401
|
- automatic durable Task Lease sessions;
|
|
402
|
+
- task-first public facade and deterministic utility regression gate;
|
|
403
|
+
- self-contained support/communications and operations/finance product proofs;
|
|
404
|
+
- blank-project fixture quickstart against the public npm package;
|
|
405
|
+
- blank-project real public GitHub onboarding with broader standing permission and narrower task authority;
|
|
406
|
+
- encrypted connected-GitHub onboarding through `task.execute()` with the credential kept broker-internal;
|
|
407
|
+
- safe sole-account default resolution while multiple connected accounts remain explicit/fail closed;
|
|
307
408
|
- Node 20/22 CI, coverage, packed-consumer validation and CodeQL;
|
|
308
|
-
- independent npm registry consumer verification.
|
|
409
|
+
- independent npm registry consumer verification, including v0.4.7 connected execution.
|
|
309
410
|
|
|
310
411
|
The lower-level evidence is documented under `docs/` and remains available for security review.
|
|
311
412
|
|
|
@@ -334,7 +435,9 @@ This is still a validation implementation.
|
|
|
334
435
|
- Provider outputs are evidence-bound inside the trusted Agent Authority runtime but are not provider-signed remote attestations.
|
|
335
436
|
- Source-data changes do not yet automatically invalidate already-derived authority.
|
|
336
437
|
- Approved authority deltas are surfaced but not automatically applied into a live durable task.
|
|
337
|
-
-
|
|
438
|
+
- Current Task Lease bindings are exact equality. The finance proof therefore steps up for a partial refund as well as an over-refund; a derived numeric ceiling remains an evidence-driven product question rather than a general policy language.
|
|
439
|
+
- The local encrypted credential vault and stdin GitHub connection are trusted-host developer onboarding, not production OAuth/KMS credential lifecycle.
|
|
440
|
+
- Public CI proves authenticated connected execution against the current repository but does not independently demonstrate access to an unrelated private repository.
|
|
338
441
|
- Remote authenticated deployment and production approval UX remain incomplete.
|
|
339
442
|
|
|
340
443
|
These are real limitations. They are not reasons to build every possible infrastructure layer before product adoption is proven.
|
package/ROADMAP.md
CHANGED
|
@@ -30,19 +30,38 @@ The engine has enough depth to test whether developers actually want this layer.
|
|
|
30
30
|
- [x] task-first facade over Mission + Task Lease + Guard
|
|
31
31
|
- [x] explicit service permissions without requiring hand-authored Mission JSON
|
|
32
32
|
- [x] named task authority roots
|
|
33
|
-
- [x] `task.run()` guarded effect boundary
|
|
34
|
-
- [x] `task.
|
|
33
|
+
- [x] `task.run()` guarded application-owned effect boundary
|
|
34
|
+
- [x] `task.execute()` connected-provider effect boundary with broker-owned credential resolution
|
|
35
|
+
- [x] `task.authorityFrom()` strict evidence-derived authority from `run()` or successful `execute()` output
|
|
35
36
|
- [x] task-first binding of named authority to later effects
|
|
36
37
|
- [x] human-readable authority-delta explanation
|
|
37
38
|
- [x] same task-first calls can opt into durable local state by adding a store
|
|
38
39
|
- [x] self-contained GitHub-shaped task-first demo
|
|
39
40
|
- [x] deterministic utility regression benchmark
|
|
41
|
+
- [x] first live provider proof through task-first API: GitHub issue discovery -> exact issue comment
|
|
42
|
+
- [x] self-contained support/communications proof: Gmail thread -> exact Calendar attendee
|
|
43
|
+
- [x] self-contained operations/finance proof: ticket -> order -> payment -> exact full refund
|
|
44
|
+
- [x] automated blank-project quickstart against the current published npm package
|
|
45
|
+
- [x] blank-project real-provider quickstart: broad standing `repo.read` -> one task-authorized public GitHub repository
|
|
46
|
+
- [x] encrypted connected GitHub onboarding: stdin credential -> local vault/broker -> `task.execute()` -> live provider request
|
|
40
47
|
- [ ] coding workflow: issue -> branch -> files -> PR, with merge/deploy outside authority
|
|
41
|
-
- [ ] support/communications
|
|
42
|
-
- [ ]
|
|
48
|
+
- [ ] support/communications expansion: customer -> meeting + reply/CRM, or live task-first Google Actions proof
|
|
49
|
+
- [ ] bounded finance refund: derived payment amount can authorize a smaller refund without authorizing an over-refund
|
|
43
50
|
- [ ] first-time developer can complete a meaningful integration in under 10 minutes
|
|
44
51
|
- [ ] at least one external developer adopts the package without project-author assistance
|
|
45
52
|
|
|
53
|
+
The live GitHub task-first proof selected issue #9 through the reviewed provider mapping, established that issue through `task.authorityFrom()`, executed exactly one real comment mutation, blocked unrelated issue #1 with `authority_delta_required`, surfaced the established-vs-requested explanation, denied the same issue after task completion, and observed `reads=1` / `task_mutations=1` before cleanup.
|
|
54
|
+
|
|
55
|
+
The support/communications proof uses the same task-first API across Gmail and Calendar: one authorized `thread_id` establishes one canonical `sender_email` through the reviewed Google extractor; only that attendee can be used for the task-bound Calendar event, while another thread or attendee executes zero provider-shaped callbacks. The example mirrors the real Google adapter contract but does not replace the still-open public Google Actions evidence gate.
|
|
56
|
+
|
|
57
|
+
The operations/finance proof keeps one evidence-derived chain from support ticket -> order -> payment -> exact refund. The exact payment ID, amount in minor units, and currency are all bound before the refund callback can execute. Unrelated payment, over-refund, wrong currency, partial refund under the current equality model, and post-completion refund all execute zero additional refund callbacks. This proof exposed a deliberate product gap: current bindings are exact equality, so a legitimate partial refund also steps up. Do not add a general expression language; add a narrow derived numeric ceiling only when real workflow/adoption evidence shows partial refunds are required.
|
|
58
|
+
|
|
59
|
+
The fixture fresh-install quickstart is independently exercised from blank Node 20 projects against the public npm package. The release-facing registry verifier for v0.4.7 installs that exact package, confirms the optional AI SDK is absent, and runs the ordinary public consumer contract plus the connected-execution consumer contract. This is automated compatibility evidence, not a substitute for the still-open first-time-human under-10-minute test.
|
|
60
|
+
|
|
61
|
+
The live credential-free quickstart keeps Mission-level `github:repo.read` broader than the task, binds Task authority to `Null-Square/agent-authority`, performs one real public GitHub API call, and produces `authority_delta_required` for `octocat/Hello-World` before a second `fetch()` can run.
|
|
62
|
+
|
|
63
|
+
v0.4.7 adds the authenticated connected path without creating an OAuth platform: a GitHub credential is accepted on stdin, stored in the encrypted trusted-local-host vault, resolved only inside the broker/provider runtime, and used by `task.execute()`. The live CI proof uses the repository's GitHub Actions installation token, confirms the raw token is not present in public task/connection state or plaintext under the Agent Authority home, executes the task-authorized repository read, and blocks the unrelated repository before connected provider execution. A fine-grained PAT or GitHub App token can use the same path for repositories it is allowed to access; public CI does not independently claim access to an unrelated private repository.
|
|
64
|
+
|
|
46
65
|
Current utility regression metrics:
|
|
47
66
|
|
|
48
67
|
```text
|
|
@@ -143,6 +162,7 @@ Do **not** build a general semantic policy language around this primitive.
|
|
|
143
162
|
- [x] same Task Lease through direct guard/SDK execution
|
|
144
163
|
- [x] same Task Lease through MCP gateway
|
|
145
164
|
- [x] same Task Lease through brokered provider execution
|
|
165
|
+
- [x] task-first connected-provider execution through `task.execute()`
|
|
146
166
|
- [x] real Vercel AI SDK protected-tool path
|
|
147
167
|
- [x] interoperability/adversarial vectors across transports
|
|
148
168
|
|
|
@@ -152,8 +172,13 @@ Changing transport or configured harness execution path does not expand task aut
|
|
|
152
172
|
|
|
153
173
|
Prioritize only the UX needed by successful P0 workflows.
|
|
154
174
|
|
|
175
|
+
- [x] credential-free fresh-install quickstart validated against the current public npm package
|
|
176
|
+
- [x] one low-friction real provider onboarding path: public GitHub read from a blank npm project
|
|
177
|
+
- [x] authenticated connected-provider onboarding path: GitHub stdin credential + encrypted local vault + `task.execute()`
|
|
178
|
+
- [x] safe sole-account default resolution; multiple connected accounts require explicit selection
|
|
179
|
+
- [ ] independent private-repository onboarding proof with a credential that has private-repo access
|
|
180
|
+
- [ ] production provider credential lifecycle / OAuth or GitHub App onboarding where real users require it
|
|
155
181
|
- [ ] compact approval UI showing the exact authority delta
|
|
156
|
-
- [ ] one low-friction real provider onboarding path
|
|
157
182
|
- [ ] automatic short-lived agent session bootstrap where needed
|
|
158
183
|
- [ ] framework integration starter focused on task-first API
|
|
159
184
|
- [ ] external-developer quickstart feedback loop
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Task-owned vs broker-owned execution
|
|
2
|
+
|
|
3
|
+
The task-first facade supports two effect ownership modes with the same Task Lease semantics.
|
|
4
|
+
|
|
5
|
+
## Application-owned effect
|
|
6
|
+
|
|
7
|
+
Use `task.run(request, callback)` when the application already owns the SDK or provider call:
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
const result = await task.run(request, () => existingSdkCall());
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The callback runs only after the Task Lease returns ALLOW. The task receives execution evidence for the exact callback output.
|
|
14
|
+
|
|
15
|
+
## Agent Authority connected-provider effect
|
|
16
|
+
|
|
17
|
+
Use `task.execute(request)` when the provider credential and provider adapter should stay behind Agent Authority's broker boundary:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
const result = await task.execute(request);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
This requires the task to be created with an `ExecutingAuthorityRuntime`, such as the runtime produced by the local `createRuntimeEnvironment()` helper.
|
|
24
|
+
|
|
25
|
+
The connected path performs:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
Task Lease evaluation
|
|
29
|
+
|
|
|
30
|
+
+--> DENY / STEP-UP -> stop before provider readiness or credential resolution
|
|
31
|
+
|
|
|
32
|
+
v
|
|
33
|
+
connected-provider readiness
|
|
34
|
+
|
|
|
35
|
+
v
|
|
36
|
+
credential broker resolves secret internally
|
|
37
|
+
|
|
|
38
|
+
v
|
|
39
|
+
provider adapter executes
|
|
40
|
+
|
|
|
41
|
+
v
|
|
42
|
+
sanitized output + ALLOW receipt + execution evidence
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`task.execute()` converts broker runtime `deny` and `require_approval` results into the same `AuthorityDeniedError` and `AuthorityApprovalRequiredError` classes used by `task.run()`.
|
|
46
|
+
|
|
47
|
+
Successful connected execution can therefore feed directly into `task.authorityFrom()` when a reviewed provider extractor exists.
|
|
48
|
+
|
|
49
|
+
## Credential boundary
|
|
50
|
+
|
|
51
|
+
The provider credential belongs to the broker/runtime, not the task request. It should not be copied into:
|
|
52
|
+
|
|
53
|
+
- Mission or Task Lease authority facts;
|
|
54
|
+
- model/tool arguments;
|
|
55
|
+
- action receipts;
|
|
56
|
+
- execution evidence;
|
|
57
|
+
- provider-normalized output;
|
|
58
|
+
- public connection listings.
|
|
59
|
+
|
|
60
|
+
The local runtime's encrypted file vault is a developer/trusted-host reference implementation. Production applications should use an appropriate secret manager/KMS and provider-native credential lifecycle.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Connected GitHub quickstart
|
|
2
|
+
|
|
3
|
+
This path is for a developer who has already understood the credential-free quickstart and now wants Agent Authority to execute through an authenticated GitHub connection.
|
|
4
|
+
|
|
5
|
+
The product boundary is:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
GitHub token
|
|
9
|
+
|
|
|
10
|
+
v
|
|
11
|
+
Agent Authority encrypted local vault
|
|
12
|
+
|
|
|
13
|
+
v
|
|
14
|
+
CredentialBroker
|
|
15
|
+
|
|
|
16
|
+
v
|
|
17
|
+
GitHub provider adapter
|
|
18
|
+
|
|
|
19
|
+
v
|
|
20
|
+
task.execute(request)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The token is not placed in the task request, Mission, Task Lease, receipt, execution evidence, or public connection listing.
|
|
24
|
+
|
|
25
|
+
## 1. Create a project
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
mkdir agent-authority-connected
|
|
29
|
+
cd agent-authority-connected
|
|
30
|
+
npm init -y
|
|
31
|
+
npm install @nullsquare/agent-authority
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Requires Node.js 20+.
|
|
35
|
+
|
|
36
|
+
## 2. Initialize the local Agent Authority home
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx agent-authority setup
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
By default this creates `~/.agent-authority`. Provider secrets are stored in the local encrypted vault, whose files are restricted to the local user. This is a trusted-local-host developer reference backend, not a hostile-host or production KMS boundary.
|
|
43
|
+
|
|
44
|
+
## 3. Connect GitHub without putting the token on the command line
|
|
45
|
+
|
|
46
|
+
Use a GitHub token that has only the provider permissions your application actually needs.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
printf %s "$GITHUB_TOKEN" | npx agent-authority connect github --token-stdin
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The CLI verifies ordinary user/PAT credentials against GitHub before storing them. The token is accepted only on stdin and is written into the encrypted Agent Authority vault rather than task/model context.
|
|
53
|
+
|
|
54
|
+
For CI installation tokens that do not support the `/user` verification endpoint, `--no-verify` is available for an already-trusted token source:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
printf %s "$GITHUB_TOKEN" | npx agent-authority connect github --token-stdin --no-verify
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Do not use `--no-verify` merely to bypass a failed or unknown credential.
|
|
61
|
+
|
|
62
|
+
GitHub recommends fine-grained personal access tokens with minimum repository/permission scope for user-scoped access, and GitHub Apps for long-lived organization integrations. Agent Authority does not replace those provider-side controls; it adds a narrower task boundary on top of them.
|
|
63
|
+
|
|
64
|
+
## 4. Run the connected task
|
|
65
|
+
|
|
66
|
+
Copy `examples/quickstart-github-connected.mjs` into the project, or run the repository example from a checkout.
|
|
67
|
+
|
|
68
|
+
The relevant application surface is intentionally small:
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
import { createTask } from '@nullsquare/agent-authority/task';
|
|
72
|
+
import { createRuntimeEnvironment } from '@nullsquare/agent-authority/runtime-env';
|
|
73
|
+
|
|
74
|
+
const env = createRuntimeEnvironment();
|
|
75
|
+
|
|
76
|
+
const task = createTask({
|
|
77
|
+
principal: env.config.principal_id,
|
|
78
|
+
agent: 'agent:assistant',
|
|
79
|
+
request: 'Inspect only acme/private',
|
|
80
|
+
permissions: {
|
|
81
|
+
github: {
|
|
82
|
+
allow: ['repo.read'],
|
|
83
|
+
constraints: {}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
authority: {
|
|
87
|
+
repository: { kind: 'github.repository', value: 'acme/private' }
|
|
88
|
+
},
|
|
89
|
+
bindings: [
|
|
90
|
+
{ service: 'github', action: 'repo.read', field: 'repository', authority: 'repository' }
|
|
91
|
+
],
|
|
92
|
+
runtime: env.runtime
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const result = await task.execute({
|
|
96
|
+
service: 'github',
|
|
97
|
+
action: 'repo.read',
|
|
98
|
+
context: { repository: 'acme/private' }
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Use `task.run(request, callback)` when your application owns the provider SDK call. Use `task.execute(request)` when Agent Authority's connected provider runtime should own credential resolution and provider execution.
|
|
103
|
+
|
|
104
|
+
## Standing permission vs task authority
|
|
105
|
+
|
|
106
|
+
The example deliberately leaves Mission-level `github:repo.read` broad while binding the Task Lease to one repository:
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
connected GitHub account can read repositories
|
|
110
|
+
|
|
|
111
|
+
v
|
|
112
|
+
Mission permits github:repo.read
|
|
113
|
+
|
|
|
114
|
+
v
|
|
115
|
+
Task authority = acme/private
|
|
116
|
+
|
|
|
117
|
+
+--> acme/private -> ALLOW -> provider executes
|
|
118
|
+
|
|
|
119
|
+
+--> acme/other -> STEP-UP -> provider does not execute
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
That is the product value: provider/IAM permission can remain broader than the exact task without becoming ambient agent authority.
|
|
123
|
+
|
|
124
|
+
## Multiple GitHub accounts
|
|
125
|
+
|
|
126
|
+
If there is exactly one active GitHub connection for the principal, requests that omit `account_id` resolve that sole connection. If multiple active GitHub accounts exist, Agent Authority does not guess: set `request.account_id` explicitly. Ambiguity fails closed.
|
|
127
|
+
|
|
128
|
+
## Automated proof
|
|
129
|
+
|
|
130
|
+
`.github/workflows/verify-connected-github.yml` installs the packed package into a blank Node 20 project, initializes a fresh Agent Authority home, connects the workflow's GitHub installation token through stdin, and runs the connected task against the live GitHub API.
|
|
131
|
+
|
|
132
|
+
The gate also checks that:
|
|
133
|
+
|
|
134
|
+
- the public connection listing does not contain `credential_ref` or the token;
|
|
135
|
+
- the raw token does not appear in plaintext under `AGENT_AUTHORITY_HOME`;
|
|
136
|
+
- an encrypted vault file is created;
|
|
137
|
+
- the unrelated repository is stopped by the Task Lease before connected provider execution;
|
|
138
|
+
- ordinary test/coverage/CodeQL/live-provider gates remain separate and must still pass.
|
|
139
|
+
|
|
140
|
+
The automated workflow uses the repository's GitHub Actions installation token on the current repository. That proves the authenticated brokered execution path; it does **not** claim public CI access to an unrelated private repository. A user-supplied fine-grained PAT or GitHub App token can use the same path for repositories that credential is permitted to access.
|
package/docs/npm-release.md
CHANGED
|
@@ -4,7 +4,7 @@ The public package name is `@nullsquare/agent-authority`.
|
|
|
4
4
|
|
|
5
5
|
Before any publication:
|
|
6
6
|
|
|
7
|
-
1. the release commit must pass CI, CodeQL, live GitHub validation, current AI SDK integration validation, and packed-consumer validation;
|
|
7
|
+
1. the release commit must pass CI, CodeQL, live GitHub validation, current AI SDK integration validation, task-first utility/demo gates, and packed-consumer validation;
|
|
8
8
|
2. `npm pack` must contain the documented public exports;
|
|
9
9
|
3. a fresh Node.js 20 consumer must install the tarball and run the current public behavior smoke test;
|
|
10
10
|
4. the optional AI SDK integration must import without making `ai` a production dependency;
|
|
@@ -13,30 +13,50 @@ Before any publication:
|
|
|
13
13
|
After publication, verify from a fresh project with:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npm install @nullsquare/agent-authority@0.4.
|
|
16
|
+
npm install @nullsquare/agent-authority@0.4.7
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
Then run the same consumer smoke
|
|
19
|
+
Then run the same consumer smoke flows through the registry-installed package. Registry verification is part of the release gate; a successful `npm publish` command alone is not sufficient.
|
|
20
20
|
|
|
21
|
-
The repository includes `.github/workflows/verify-npm-registry.yml`, which verifies registry visibility, a clean Node.js 20 install, and
|
|
21
|
+
The repository includes `.github/workflows/verify-npm-registry.yml`, which verifies registry visibility, a clean Node.js 20 install, and current public behavior from the registry artifact.
|
|
22
22
|
|
|
23
|
+
For v0.4.7 the registry consumer exercises the existing v0.4.6 contract plus connected provider execution:
|
|
24
|
+
|
|
25
|
+
- `createTask()` from `@nullsquare/agent-authority/task`;
|
|
26
|
+
- explicit task permissions and named authority roots;
|
|
27
|
+
- task-first allow / `authority_delta_required` behavior;
|
|
28
|
+
- `task.explain()` for established-vs-requested authority deltas;
|
|
29
|
+
- durable local-state opt-in through `JsonFileTaskLeaseStore` without changing normal task calls;
|
|
23
30
|
- execution evidence and the reviewed Google/GitHub authority extractors;
|
|
24
31
|
- `ExecutingAuthorityRuntime.executeTaskLease()` and `MissionMcpGateway` transport surfaces;
|
|
25
|
-
- `JsonFileTaskLeaseStore`
|
|
26
|
-
- `
|
|
27
|
-
-
|
|
32
|
+
- `JsonFileTaskLeaseStore`, `DurableTaskLeaseSession`, and the lower-level Task Lease APIs;
|
|
33
|
+
- `task.execute(request)` for connected-provider execution;
|
|
34
|
+
- the public `@nullsquare/agent-authority/runtime-env` export;
|
|
35
|
+
- safe sole-account connection resolution while multiple active accounts remain ambiguous/fail closed;
|
|
36
|
+
- connected execution where the credential is broker-internal, the task-authorized resource executes, and an unrelated resource is blocked before a second provider call;
|
|
28
37
|
- the requirement that the optional `ai` package is not installed as a production dependency.
|
|
29
38
|
|
|
30
|
-
This makes the registry artifact verification cover
|
|
39
|
+
This makes the registry artifact verification cover both application-owned task effects (`task.run`) and broker-owned connected provider effects (`task.execute`) together with the durability/evidence/transport surfaces they compose.
|
|
40
|
+
|
|
41
|
+
The v0.4.7 independent registry verification passed after publication: npm visibility succeeded, a fresh Node.js 20 consumer installed the exact `@nullsquare/agent-authority@0.4.7` artifact, the optional AI SDK was absent, and both the ordinary package smoke and connected-execution smoke passed.
|
|
42
|
+
|
|
43
|
+
The deterministic task utility fixture is also part of the source-release gate. It currently requires:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
normal task completion rate = 100%
|
|
47
|
+
false approval rate = 0%
|
|
48
|
+
true authority-delta step-up rate = 100%
|
|
49
|
+
unauthorized effect rate = 0%
|
|
50
|
+
```
|
|
31
51
|
|
|
32
|
-
|
|
52
|
+
This fixture is a regression gate, not a real-world performance benchmark.
|
|
33
53
|
|
|
34
54
|
## npm vs GitHub release surfaces
|
|
35
55
|
|
|
36
56
|
Publishing to the public npm registry does not automatically create either a GitHub Release or a GitHub Packages entry.
|
|
37
57
|
|
|
38
58
|
- **npm registry** — `npm publish --access public` publishes `@nullsquare/agent-authority` to `registry.npmjs.org` / npmjs.com. This is the package users install with `npm install`.
|
|
39
|
-
- **GitHub Releases** — a separate GitHub object, normally backed by a Git tag such as `v0.4.
|
|
59
|
+
- **GitHub Releases** — a separate GitHub object, normally backed by a Git tag such as `v0.4.7`. A release must be created explicitly or by release automation.
|
|
40
60
|
- **GitHub Packages** — a separate package registry. It only appears when the package is published to GitHub's npm registry (`npm.pkg.github.com`); publishing to npmjs.com does not populate it.
|
|
41
61
|
|
|
42
62
|
Agent Authority currently uses npmjs.com as its public package registry. Therefore an empty GitHub **Packages** section is expected unless the project intentionally adopts dual publication. A GitHub **Release** is still useful for source-release discoverability and should track published versions, but it is independent from npm publication.
|