@synadia-ai/agent-fabric-pi 0.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/CHANGELOG.md +17 -0
- package/LICENSE +201 -0
- package/README.md +281 -0
- package/dist/index.cjs +154 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +28 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -0
- package/package.json +87 -0
- package/skill/scratchpad/LICENSE +201 -0
- package/skill/scratchpad/SKILL.md +208 -0
- package/skill/scratchpad/THIRD_PARTY_NOTICES +1067 -0
- package/skill/scratchpad/bin/BUILD.json +367 -0
- package/skill/scratchpad/bin/COMMIT +1 -0
- package/skill/scratchpad/bin/sp-darwin-amd64 +0 -0
- package/skill/scratchpad/bin/sp-darwin-arm64 +0 -0
- package/skill/scratchpad/bin/sp-linux-amd64 +0 -0
- package/skill/scratchpad/bin/sp-linux-arm64 +0 -0
- package/skill/scratchpad/scripts/sp +231 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scratchpad
|
|
3
|
+
description: Read ScratchPad references (sp-r1:… or sp-ref:…) handed to you, and publish, share, hydrate and recover bounded ScratchPad artifacts of your own, through this skill's scripts/sp.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ScratchPad
|
|
7
|
+
|
|
8
|
+
Adapted from the canonical ScratchPad skill for an agent on the fabric.
|
|
9
|
+
The packaged `bin/BUILD.json` records the release, opaque source identifier,
|
|
10
|
+
toolchain, targets, and executable hashes. `LICENSE` and
|
|
11
|
+
`THIRD_PARTY_NOTICES` contain the distribution terms.
|
|
12
|
+
Run the sp command line only as this skill's `scripts/sp`, by its absolute
|
|
13
|
+
path: the directory of this file, then `scripts/sp`. In the examples below,
|
|
14
|
+
`scripts/sp` stands for that path.
|
|
15
|
+
|
|
16
|
+
Run each `scripts/sp` command on its own: its absolute path written out in
|
|
17
|
+
full, no shell variable for it, no `cd`, `;` or `&&` around it, and its
|
|
18
|
+
output not piped into another command. Content may come in on standard
|
|
19
|
+
input (`printf '%s\n' "$TEXT" | scripts/sp publish-file --source - …`).
|
|
20
|
+
Decode `data_base64` in a command of its own:
|
|
21
|
+
`echo "$DATA_BASE64" | base64 -d`. A harness that asks before running a
|
|
22
|
+
shell command can then allow `scripts/sp` by its path, and does not ask.
|
|
23
|
+
|
|
24
|
+
`scripts/sp` adds what the examples in ScratchPad's own skill pass by hand:
|
|
25
|
+
the NATS server, this agent's credentials, its workspace, its volume on
|
|
26
|
+
`init`, the trace of the prompt you are serving, your address as the
|
|
27
|
+
creator of what you publish, and the agent that prompted you as the grantee
|
|
28
|
+
of a grant. Never pass `--url`, `--creds`, `--dir`, `--volume`,
|
|
29
|
+
`--thread-id`, `--root-id`, `--creator`, `--grantee-account` or
|
|
30
|
+
`--grantee-user` yourself; `scripts/sp` refuses them.
|
|
31
|
+
|
|
32
|
+
## Keep identity and recovery state
|
|
33
|
+
|
|
34
|
+
The connection uses this agent's own identity.
|
|
35
|
+
The service authenticates the connection; a reference, creator label, or trace field supplies no identity.
|
|
36
|
+
The workspace is private to this agent and persists across restarts.
|
|
37
|
+
|
|
38
|
+
Each successful command prints JSON.
|
|
39
|
+
Read the returned receipt before reporting that publication succeeded.
|
|
40
|
+
An upload alone does not publish a checkpoint.
|
|
41
|
+
Retention preserves the root until explicit release.
|
|
42
|
+
Its deadline permits later client cleanup.
|
|
43
|
+
A grant separately permits one authenticated principal to read that root and path.
|
|
44
|
+
Do not print credential contents.
|
|
45
|
+
|
|
46
|
+
## Read an artifact handed to you
|
|
47
|
+
|
|
48
|
+
A reference is one token that starts with `sp-r1:`. Copy the complete token exactly.
|
|
49
|
+
Services that do not enable short references return a longer `sp-ref:` token; copy that token unchanged too.
|
|
50
|
+
Keep the returned token in prompts and replies. Do not expand, shorten, repair, or reconstruct it.
|
|
51
|
+
A short reference can be read after an agent restart; it does not depend on a session alias table.
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
scripts/sp read --ref "$REFERENCE"
|
|
55
|
+
scripts/sp hydrate --ref "$REFERENCE" --destination "$DESTINATION"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Read returns verified bytes as `data_base64` and their count as `bytes`; decode `data_base64` to get the content.
|
|
59
|
+
Read accepts files up to 16 MiB; use hydration for larger files and directory trees.
|
|
60
|
+
`limits.read_bytes` from `info` bounds one service range request; the CLI combines ranges for this buffered read.
|
|
61
|
+
Hydrate requires a destination that does not exist.
|
|
62
|
+
It verifies content identities before completing files, and reports the files, directories, symbolic links and bytes it installed.
|
|
63
|
+
Failure can leave a partial destination; preserve that path for inspection.
|
|
64
|
+
An expired reference or refused grant does not authorize another identity or path.
|
|
65
|
+
|
|
66
|
+
## Initialize and inspect
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
scripts/sp info
|
|
70
|
+
scripts/sp init --operation-id "$CREATE_ID"
|
|
71
|
+
scripts/sp describe
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`info` returns this agent's authenticated principal, owned scope allowances, and request limits.
|
|
75
|
+
It needs no initialized workspace and changes no recovery state.
|
|
76
|
+
The scope byte and object figures are configured allowances; `describe` shows current usage.
|
|
77
|
+
An empty scope list needs an operator admission check before this agent can publish.
|
|
78
|
+
Volumes readable through another owner's grant are not listed; their granted references can still be read.
|
|
79
|
+
If `info` reports an unknown command, an older binary was selected; continue with the existing commands and ask the operator for the allowances.
|
|
80
|
+
|
|
81
|
+
`init` creates this agent's volume once; publishing needs it.
|
|
82
|
+
Rerun the saved creation action after an unknown outcome.
|
|
83
|
+
An established writer whose journal disappeared requires an explicit reset.
|
|
84
|
+
Initialization cannot silently reset that writer.
|
|
85
|
+
|
|
86
|
+
## Publish a file and share it with the agent that prompted you
|
|
87
|
+
|
|
88
|
+
`SOURCE` names the local file, or `-` for standard input; `ARTIFACT_PATH` is its canonical absolute artifact path, such as `/replies/1.txt`.
|
|
89
|
+
Use a new `OPERATION_ID` for each intended publication.
|
|
90
|
+
A rerun with the same operation identifier returns that publication's saved result; it never reads the source again, so changed content needs a new identifier.
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
scripts/sp publish-file --source "$SOURCE" --path "$ARTIFACT_PATH" --operation-id "$OPERATION_ID" --ttl-seconds 600
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Copy the returned `reference` without editing its contents.
|
|
97
|
+
This command publishes a complete root containing that one file.
|
|
98
|
+
It also retains the root in the same atomic publication.
|
|
99
|
+
While you serve a prompt, it also grants the agent that prompted you read on that file: the result's `granted_to_caller` says so, and `caller_grant_error` says why not.
|
|
100
|
+
Then put the unchanged reference in your reply.
|
|
101
|
+
|
|
102
|
+
To grant that agent read again, for example after the grant expired:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
scripts/sp grant --ref "$REFERENCE" --operation-id "$GRANT_ID" --ttl-seconds 600
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
A grant goes to the agent whose prompt you are serving, and to no one else.
|
|
109
|
+
The returned expiry can be earlier than requested because the grant cannot outlive its retained root.
|
|
110
|
+
|
|
111
|
+
## Hand a reference to another agent
|
|
112
|
+
|
|
113
|
+
Put the unchanged reference in the prompt of `prompt_agent`, and nothing
|
|
114
|
+
more: do not grant for it yourself. The agent tools grant the receiver read
|
|
115
|
+
when it reads references (`discover_agents` shows
|
|
116
|
+
`reads_scratchpad_references: true`), and take the reference out of the
|
|
117
|
+
prompt otherwise, saying so in the call's result. A reference another agent
|
|
118
|
+
handed you goes on the same way; its creator decides whether the receiver
|
|
119
|
+
may read it.
|
|
120
|
+
|
|
121
|
+
## Publish an edited directory
|
|
122
|
+
|
|
123
|
+
An external editor or executor prepares `SOURCE_DIRECTORY`.
|
|
124
|
+
ScratchPad does not run that editor or executor.
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
scripts/sp sync --source "$SOURCE_DIRECTORY" --operation-id "$OPERATION_ID"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Sync publishes the whole directory as the next root.
|
|
131
|
+
Paths absent from that directory are absent from the new root.
|
|
132
|
+
Preparation copies canonical content into a private disk spool in the workspace before upload.
|
|
133
|
+
It preserves executable file modes and literal symbolic links without following links.
|
|
134
|
+
There are no implicit Git exclusions; choose the source tree explicitly.
|
|
135
|
+
Another writer's publication can produce an explicit conflict; the command does not merge automatically.
|
|
136
|
+
|
|
137
|
+
## Resolve a failed command
|
|
138
|
+
|
|
139
|
+
| Exit | Action |
|
|
140
|
+
| ---- | ---------------------------------------------------------------------------------- |
|
|
141
|
+
| 0 | Inspect the successful JSON result. |
|
|
142
|
+
| 1 | Inspect the definite failure code and workspace state. |
|
|
143
|
+
| 2 | Correct the local arguments; no product request was sent. |
|
|
144
|
+
| 3 | The outcome is unknown. Recover the saved intent before starting another mutation. |
|
|
145
|
+
|
|
146
|
+
```sh
|
|
147
|
+
scripts/sp recover
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Recovery first reconciles an exact accepted receipt.
|
|
151
|
+
If publication remains necessary, recovery uploads the saved spool and submits the same command.
|
|
152
|
+
It never rereads a changed source file or standard input.
|
|
153
|
+
An `epoch_changed` response requires preparation against the current collection epoch; rerun recovery after maintenance ends.
|
|
154
|
+
Do not change its operation identifier, base, root, or requested retention while the outcome remains unresolved.
|
|
155
|
+
A definite conflict can leave the publication pending.
|
|
156
|
+
Inspect an explicit reset plan before abandoning that intent.
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
scripts/sp reset
|
|
160
|
+
scripts/sp reset --apply
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Reset fences the previous writer generation.
|
|
164
|
+
It does not release retention from an earlier unknown publication.
|
|
165
|
+
An unresolved grant can block further control operations until acceptance, a positive observation, or expiry settles it.
|
|
166
|
+
|
|
167
|
+
A publication refused before its checkpoint was prepared leaves its spool, and so does a publication abandoned by reset.
|
|
168
|
+
A later publication requires recovery or explicit removal of that saved upload.
|
|
169
|
+
Inspect the spool before attempting removal:
|
|
170
|
+
|
|
171
|
+
```sh
|
|
172
|
+
scripts/sp spool-inspect
|
|
173
|
+
scripts/sp spool-remove
|
|
174
|
+
scripts/sp spool-remove --apply
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Remove an unprepared upload
|
|
178
|
+
|
|
179
|
+
Removal is a dry run without `--apply` and refuses a pending checkpoint.
|
|
180
|
+
A refused upload can be removed without reset when its writer remains ready at the saved command position.
|
|
181
|
+
Inspect the removal report before applying it.
|
|
182
|
+
Removal abandons the saved upload, including bytes read from standard input.
|
|
183
|
+
Remote reservations remain charged until maintenance collects them.
|
|
184
|
+
An older workspace can already have a pending checkpoint after an upload refusal.
|
|
185
|
+
Do not automatically reset it because a response says `capacity`; recover or inspect an explicit reset first.
|
|
186
|
+
A new publication reclaims a completed previous spool only after its exact receipt is saved.
|
|
187
|
+
|
|
188
|
+
## Reclaim expired content
|
|
189
|
+
|
|
190
|
+
```sh
|
|
191
|
+
scripts/sp maintain
|
|
192
|
+
scripts/sp maintain --apply
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The first command reports the proposed maintenance.
|
|
196
|
+
The second releases unprotected expired pins, closes the volume, traces retained dependencies, collects unreachable objects, and reopens it.
|
|
197
|
+
Maintenance does not scrub retained file payloads.
|
|
198
|
+
If interrupted, recover the saved request or repeat maintenance against the durable closed state.
|
|
199
|
+
Capacity refusal requires maintenance or an explicit operator decision; it never permits eviction of retained content.
|
|
200
|
+
|
|
201
|
+
## Capacity
|
|
202
|
+
|
|
203
|
+
Deployment scopes select explicit encoded-byte and object quotas.
|
|
204
|
+
Read this agent's configured allowances with `scripts/sp info`; example sizes are not deployment defaults.
|
|
205
|
+
Objects include chunks, file metadata, and directories.
|
|
206
|
+
Retained results and unfinished uploads consume the same allowance.
|
|
207
|
+
Replacing unique content needs room for both versions until old retention is released and collection completes.
|
|
208
|
+
Local spools also need enough private disk space for the prepared artifact.
|