@synadia-ai/agent-fabric-claude-code 0.2.0 → 0.3.1
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/.claude-plugin/plugin.json +1 -1
- package/BUILD +3 -3
- package/README.md +4 -2
- package/hooks/hooks.json +22 -0
- package/hooks/session-event.js +12 -9
- package/package.json +1 -1
- package/runtime/chunk-5ke4ws7r.js +38 -0
- package/runtime/fabric.js +5 -5
- package/runtime/server.js +37 -34
- package/skills/scratchpad/SKILL.md +87 -6
- package/skills/scratchpad/scripts/sp +13 -7
- package/runtime/chunk-prncr0vg.js +0 -38
|
@@ -26,7 +26,7 @@ shell command can then allow `scripts/sp` by its path, and does not ask.
|
|
|
26
26
|
the NATS server, this agent's credentials, its workspace, its volume on
|
|
27
27
|
`init`, the trace of the prompt you are serving, your address as the
|
|
28
28
|
creator of what you publish, and the agent that prompted you as the grantee
|
|
29
|
-
of a grant. Never pass `--url`, `--creds`, `--dir`, `--volume`,
|
|
29
|
+
of a grant. Never pass `--url`, `--creds`, `--dir`, `--volume`, `--bootstrap-file`,
|
|
30
30
|
`--thread-id`, `--root-id`, `--creator`, `--grantee-account` or
|
|
31
31
|
`--grantee-user` yourself; `scripts/sp` refuses them.
|
|
32
32
|
|
|
@@ -39,8 +39,8 @@ The workspace is private to this agent and persists across restarts.
|
|
|
39
39
|
Each successful command prints JSON.
|
|
40
40
|
Read the returned receipt before reporting that publication succeeded.
|
|
41
41
|
An upload alone does not publish a checkpoint.
|
|
42
|
-
Retention preserves the root
|
|
43
|
-
|
|
42
|
+
Retention preserves the root for its recorded promise.
|
|
43
|
+
A finite deadline permits later cleanup by the client or the private lifecycle worker.
|
|
44
44
|
A grant separately permits one authenticated principal to read that root and path.
|
|
45
45
|
Do not print credential contents.
|
|
46
46
|
|
|
@@ -68,13 +68,27 @@ An expired reference or refused grant does not authorize another identity or pat
|
|
|
68
68
|
|
|
69
69
|
```sh
|
|
70
70
|
scripts/sp info
|
|
71
|
-
scripts/sp init
|
|
71
|
+
scripts/sp init
|
|
72
72
|
scripts/sp describe
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
`info` returns this agent's authenticated principal, owned scope allowances, and request limits.
|
|
76
76
|
It needs no initialized workspace and changes no recovery state.
|
|
77
77
|
The scope byte and object figures are configured allowances; `describe` shows current usage.
|
|
78
|
+
|
|
79
|
+
### Import the configured bootstrap
|
|
80
|
+
|
|
81
|
+
When `SCRATCHPAD_BOOTSTRAP_FILE` is configured, the wrapper supplies it on `init`.
|
|
82
|
+
The public file selects one volume, admission binding, and complete saved creation Action.
|
|
83
|
+
It contains no credentials and supplies no authentication authority.
|
|
84
|
+
Run `scripts/sp init` without inventing a creation operation identifier.
|
|
85
|
+
Keep both the file and the private workspace across restarts.
|
|
86
|
+
An exact matching import preserves existing commands, writer state, and unknown outcomes.
|
|
87
|
+
A different creation request refuses; an `exists` result never permits adoption.
|
|
88
|
+
Saved creation recovery uses the owner's connection and does not need admin ensure.
|
|
89
|
+
An expiry or closed refusal alone does not settle an earlier possibly sent creation.
|
|
90
|
+
An explicit later admission needs a separate workspace; never erase the earlier one to continue.
|
|
91
|
+
A configured custom volume must match the file. Unsupported command lines refuse the import.
|
|
78
92
|
An empty scope list needs an operator admission check before this agent can publish.
|
|
79
93
|
Volumes readable through another owner's grant are not listed; their granted references can still be read.
|
|
80
94
|
If `info` reports an unknown command, an older binary was selected; continue with the existing commands and ask the operator for the allowances.
|
|
@@ -83,6 +97,10 @@ If `info` reports an unknown command, an older binary was selected; continue wit
|
|
|
83
97
|
Rerun the saved creation action after an unknown outcome.
|
|
84
98
|
An established writer whose journal disappeared requires an explicit reset.
|
|
85
99
|
Initialization cannot silently reset that writer.
|
|
100
|
+
For a reusable lifetime, `info` also returns its admission binding.
|
|
101
|
+
`init` saves that binding before its first creation request and reuses it after a restart.
|
|
102
|
+
A saved creation cannot adopt a later admission with the same volume name.
|
|
103
|
+
Preserve the workspace after a refusal; do not erase it to bypass lifetime fencing.
|
|
86
104
|
|
|
87
105
|
## Publish a file and share it with the agent that prompted you
|
|
88
106
|
|
|
@@ -194,9 +212,12 @@ scripts/sp maintain --apply
|
|
|
194
212
|
```
|
|
195
213
|
|
|
196
214
|
The first command reports the proposed maintenance.
|
|
197
|
-
The second releases unprotected expired pins
|
|
215
|
+
The second releases unprotected expired pins and closes a collection interval.
|
|
216
|
+
On a reusable deployment, private maintenance traces retained dependencies,
|
|
217
|
+
collects unreachable objects and reopens that interval. The client observes its completion.
|
|
218
|
+
On an existing deployment, the client performs that collection.
|
|
198
219
|
Maintenance does not scrub retained file payloads.
|
|
199
|
-
If interrupted, recover the saved request
|
|
220
|
+
If interrupted, recover the saved request. A newer collection interval fences that request.
|
|
200
221
|
Capacity refusal requires maintenance or an explicit operator decision; it never permits eviction of retained content.
|
|
201
222
|
|
|
202
223
|
## Capacity
|
|
@@ -207,3 +228,63 @@ Objects include chunks, file metadata, and directories.
|
|
|
207
228
|
Retained results and unfinished uploads consume the same allowance.
|
|
208
229
|
Replacing unique content needs room for both versions until old retention is released and collection completes.
|
|
209
230
|
Local spools also need enough private disk space for the prepared artifact.
|
|
231
|
+
|
|
232
|
+
### Choose what to remove at capacity
|
|
233
|
+
|
|
234
|
+
On a reusable volume, `describe` includes `lifetime` with the lease, grace period,
|
|
235
|
+
recovery-read state and reserved metadata allowance.
|
|
236
|
+
Choose a path from the current head to remove. The service never chooses a live
|
|
237
|
+
file to evict because the volume is full.
|
|
238
|
+
|
|
239
|
+
```sh
|
|
240
|
+
scripts/sp remove --path "$ARTIFACT_PATH" --operation-id "$REMOVE_ID"
|
|
241
|
+
scripts/sp remove --path "$ARTIFACT_PATH" --operation-id "$REMOVE_ID" --apply
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
The first command reports a plan without changing the head.
|
|
245
|
+
Applying saves the exact command and uses reserved metadata space within the reported bounds.
|
|
246
|
+
The receipt confirms the new head. Retention or grants can still protect the removed content.
|
|
247
|
+
Private maintenance returns space after that content is no longer protected.
|
|
248
|
+
After an unknown result, use `recover`; do not change the saved path or operation identifier.
|
|
249
|
+
Older binaries or deployments can refuse this command; that refusal does not permit eviction.
|
|
250
|
+
|
|
251
|
+
### Keep or end a reusable lifetime
|
|
252
|
+
|
|
253
|
+
A volume with `lifetime.expires_at` equal to zero is durable.
|
|
254
|
+
For a managed lease, request one absolute Unix deadline in seconds:
|
|
255
|
+
|
|
256
|
+
```sh
|
|
257
|
+
scripts/sp renew --until "$UNTIL"
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Save and retry the same deadline. Renewal must win before retirement begins.
|
|
261
|
+
An already achieved renewal can still recover after that deadline passes.
|
|
262
|
+
If recovery reports definite `expired` for an unachieved saved deadline, only the
|
|
263
|
+
renewal intent is cleared. Request a new absolute deadline if the same lifetime is
|
|
264
|
+
still renewable, then recover the unchanged ordinary pending operation.
|
|
265
|
+
An unknown result keeps the saved renewal pending; do not replace its deadline.
|
|
266
|
+
During recorded grace, recovery reads can remain available while ordinary writes are closed.
|
|
267
|
+
Do not infer disposal authority from an agent disconnect, an idle volume, or full quota.
|
|
268
|
+
|
|
269
|
+
Whole-volume retirement ends all head, retention, grant and access promises in its plan.
|
|
270
|
+
It can permanently delete every artifact. Use it only when the user has authorized
|
|
271
|
+
ending those promises and any required export has been restored and checked.
|
|
272
|
+
|
|
273
|
+
```sh
|
|
274
|
+
scripts/sp retire --operation-id "$RETIRE_ID"
|
|
275
|
+
scripts/sp retire --operation-id "$RETIRE_ID" --end-promises --apply
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Review the first result before applying. The exact terminal operation persists for recovery.
|
|
279
|
+
If recovery proves a strictly newer nonterminal plan for the same incarnation,
|
|
280
|
+
slot, generation, target, and saved request, it clears only the old release intent
|
|
281
|
+
and reports `fenced`. The lifetime remains nonterminal. Inspect the reported
|
|
282
|
+
lifetime and renew before ordinary work if needed. Review a new plan before
|
|
283
|
+
applying again; this refusal does not mean that artifacts were disposed or capacity returned.
|
|
284
|
+
Unknown or mismatched evidence and an already accepted terminal fence stay pending.
|
|
285
|
+
`disposed` reports physical disposal; only `capacity_returned` confirms admission capacity is free.
|
|
286
|
+
If a successor generation proves the old lifetime ended but this workspace never
|
|
287
|
+
observed its own release fence, recovery also reports `acceptance_unknown: true`.
|
|
288
|
+
That result confirms capacity return while leaving the original operation's acceptance unknown.
|
|
289
|
+
Preserve the old workspace through completion. A later admission is a different lifetime,
|
|
290
|
+
and old references and receipts do not select it.
|
|
@@ -50,7 +50,7 @@ refuse() {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
# The command: the first argument that is not a flag or a flag's value, as
|
|
53
|
-
# sp itself finds it.
|
|
53
|
+
# sp itself finds it. --apply, --end-promises and --help take no value.
|
|
54
54
|
# On the way, the operation id and the expiry, for the caller's grant after
|
|
55
55
|
# a publication, and the reference, for the record of a grant.
|
|
56
56
|
command=
|
|
@@ -70,7 +70,7 @@ for arg in "$@"; do
|
|
|
70
70
|
fi
|
|
71
71
|
case $arg in
|
|
72
72
|
--) break ;;
|
|
73
|
-
-apply | --apply | -help | --help | -h) ;;
|
|
73
|
+
-apply | --apply | -end-promises | --end-promises | -help | --help | -h) ;;
|
|
74
74
|
-*=*)
|
|
75
75
|
name=${arg%%=*}
|
|
76
76
|
case ${name#-} in
|
|
@@ -94,7 +94,7 @@ for arg in "$@"; do
|
|
|
94
94
|
case $arg in
|
|
95
95
|
-*)
|
|
96
96
|
case $name in
|
|
97
|
-
url | creds | dir | volume | thread-id | root-id | tool-call-id | creator | grantee-account | grantee-user)
|
|
97
|
+
url | creds | dir | volume | bootstrap-file | thread-id | root-id | tool-call-id | creator | grantee-account | grantee-user)
|
|
98
98
|
refuse "--$name is set by the agent, not passed; run the command without it" ;;
|
|
99
99
|
esac
|
|
100
100
|
;;
|
|
@@ -102,12 +102,12 @@ for arg in "$@"; do
|
|
|
102
102
|
done
|
|
103
103
|
|
|
104
104
|
if [ -n "${SP_ENV_FILE:-}" ] && [ -f "$SP_ENV_FILE" ]; then
|
|
105
|
-
unset SP_THREAD_ID SP_ROOT_ID SP_CALLER_ACCOUNT SP_CALLER_USER
|
|
105
|
+
unset SP_THREAD_ID SP_ROOT_ID SP_CALLER_ACCOUNT SP_CALLER_USER SCRATCHPAD_VOLUME SCRATCHPAD_BOOTSTRAP_FILE
|
|
106
106
|
while IFS= read -r line || [ -n "$line" ]; do
|
|
107
107
|
case $line in
|
|
108
108
|
*=*)
|
|
109
109
|
case ${line%%=*} in
|
|
110
|
-
SP_NATS_URL | SP_NATS_CREDS | SCRATCHPAD_DIR | SCRATCHPAD_VOLUME | SP_CREATOR | \
|
|
110
|
+
SP_NATS_URL | SP_NATS_CREDS | SCRATCHPAD_DIR | SCRATCHPAD_VOLUME | SCRATCHPAD_BOOTSTRAP_FILE | SP_CREATOR | \
|
|
111
111
|
SP_THREAD_ID | SP_ROOT_ID | SP_CALLER_ACCOUNT | SP_CALLER_USER | SP_GRANTS_FILE)
|
|
112
112
|
# The name is one of these; the value is assigned as it is.
|
|
113
113
|
eval "${line%%=*}=\${line#*=}"
|
|
@@ -150,8 +150,14 @@ fi
|
|
|
150
150
|
|
|
151
151
|
case $command in
|
|
152
152
|
init)
|
|
153
|
-
[ -n "${
|
|
154
|
-
|
|
153
|
+
if [ -n "${SCRATCHPAD_BOOTSTRAP_FILE:-}" ]; then
|
|
154
|
+
set -- --bootstrap-file "$SCRATCHPAD_BOOTSTRAP_FILE" "$@"
|
|
155
|
+
else
|
|
156
|
+
[ -n "${SCRATCHPAD_VOLUME:-}" ] || refuse "ScratchPad has no volume or bootstrap file for this agent"
|
|
157
|
+
fi
|
|
158
|
+
if [ -n "${SCRATCHPAD_VOLUME:-}" ]; then
|
|
159
|
+
set -- --volume "$SCRATCHPAD_VOLUME" "$@"
|
|
160
|
+
fi
|
|
155
161
|
;;
|
|
156
162
|
publish-file)
|
|
157
163
|
if [ -n "${SP_CREATOR:-}" ]; then
|