@sage-protocol/pi-adapter 0.4.3 → 0.5.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/README.md +21 -0
- package/USAGE.md +21 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6723 -51
- package/dist/intercom-storage.d.ts +20 -0
- package/dist/intercom-storage.d.ts.map +1 -0
- package/dist/intercom.d.ts +72 -0
- package/dist/intercom.d.ts.map +1 -0
- package/dist/sage-pi-adapter.d.ts +13 -0
- package/dist/sage-pi-adapter.d.ts.map +1 -1
- package/dist/wallet-status.d.ts +37 -0
- package/dist/wallet-status.d.ts.map +1 -0
- package/extensions/index.ts +27 -1
- package/package.json +8 -7
- package/dist/behavior/index.js +0 -9
- package/dist/behavior/index.js.map +0 -1
- package/dist/behavior/pi-executor.js +0 -188
- package/dist/behavior/pi-executor.js.map +0 -1
- package/dist/behavior/resolver.js +0 -171
- package/dist/behavior/resolver.js.map +0 -1
- package/dist/behavior/types.js +0 -16
- package/dist/behavior/types.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/sage-pi-adapter.js +0 -2862
- package/dist/sage-pi-adapter.js.map +0 -1
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ Sage integration for the Pi coding agent runtime.
|
|
|
14
14
|
- Captures prompts and responses for RLM feedback
|
|
15
15
|
- Observes truthful full native skill loads and writes source- and session-qualified load receipts
|
|
16
16
|
- Exposes `sage_mark_guided_use` in the packaged Pi extension so an agent can bind actually loaded, actually applied skills to the exact prompt capture through Sage's native-use daemon path
|
|
17
|
+
- Optionally exposes one status-only `sage_wallet_status` tool when Glove supplies either a strict inherited connected descriptor declaration or the complete legacy endpoint/root/owner tuple
|
|
17
18
|
- Preserves optional security hooks and explicit subagent skill resolution
|
|
18
19
|
- Keeps Sage-owned skills under `packages/sage/skills/` and the curated Pi export surface rather than bundling copies in this adapter
|
|
19
20
|
|
|
@@ -96,6 +97,13 @@ interface SageP2Config {
|
|
|
96
97
|
enableRlmFeedback?: boolean;
|
|
97
98
|
enableSecurityHooks?: boolean;
|
|
98
99
|
source?: string; // default: "pi"
|
|
100
|
+
// Inherited mode: both exact Glove values are required, with no legacy fields.
|
|
101
|
+
gloveLocalServiceFdsV1?: string; // exact JSON alias-to-FD map
|
|
102
|
+
gloveGuestChannelServiceAlias?: string; // exact wallet service alias
|
|
103
|
+
// Legacy mode: all three are required, with no inherited fields.
|
|
104
|
+
gloveGuestChannelEndpoint?: string; // canonical absolute Unix socket path
|
|
105
|
+
gloveGuestChannelRoot?: string; // canonical absolute trusted root
|
|
106
|
+
gloveGuestChannelOwnerUid?: number; // isolated socket-owner UID (not Pi's UID)
|
|
99
107
|
env?: Record<string, string>;
|
|
100
108
|
|
|
101
109
|
/** @deprecated Low-level legacy suggestion compatibility; ignored by the default Pi path. */
|
|
@@ -141,3 +149,16 @@ git diff --check
|
|
|
141
149
|
## License
|
|
142
150
|
|
|
143
151
|
MIT
|
|
152
|
+
|
|
153
|
+
## Session inbox liveness (shared with hook-driven harnesses)
|
|
154
|
+
|
|
155
|
+
The adapter currently renews the daemon lease from its own 2 s poll in
|
|
156
|
+
`src/intercom.ts`. The Sage CLI now ships a harness-agnostic keepalive,
|
|
157
|
+
`sage inbox keepalive --auth-file <capability> --watch-pid <pid>`, which is what
|
|
158
|
+
hook-driven harnesses (Claude Code, Codex) use. A follow-up can have the adapter
|
|
159
|
+
spawn it detached after `saveAuth` with `process.pid` as the watched host, send
|
|
160
|
+
`heartbeat` only on idle/busy transitions, and replace the receive poll with
|
|
161
|
+
`sage inbox receive --auth-file <capability> --wait <secs>`, so both harness
|
|
162
|
+
families share one liveness mechanism. Fencing (`session_inbox_fenced`) stops
|
|
163
|
+
both the adapter timer and the keepalive.
|
|
164
|
+
|
package/USAGE.md
CHANGED
|
@@ -84,6 +84,16 @@ const sage = await createSageSessionConfig({
|
|
|
84
84
|
source: 'pi-agent-core',
|
|
85
85
|
enableRlmFeedback: true,
|
|
86
86
|
enableSecurityHooks: true,
|
|
87
|
+
// Choose exactly one complete mode. Glove normally injects inherited mode.
|
|
88
|
+
gloveLocalServiceFdsV1: process.env.GLOVE_LOCAL_SERVICE_FDS_V1,
|
|
89
|
+
gloveGuestChannelServiceAlias:
|
|
90
|
+
process.env.GLOVE_GUEST_CHANNEL_SERVICE_ALIAS,
|
|
91
|
+
// Legacy compatibility mode (omit all three when inherited mode is present).
|
|
92
|
+
gloveGuestChannelEndpoint: process.env.GLOVE_GUEST_CHANNEL_ENDPOINT,
|
|
93
|
+
gloveGuestChannelRoot: process.env.GLOVE_GUEST_CHANNEL_ROOT,
|
|
94
|
+
gloveGuestChannelOwnerUid: process.env.GLOVE_GUEST_CHANNEL_OWNER_UID
|
|
95
|
+
? Number(process.env.GLOVE_GUEST_CHANNEL_OWNER_UID)
|
|
96
|
+
: undefined,
|
|
87
97
|
});
|
|
88
98
|
const cwd = process.cwd();
|
|
89
99
|
const securedTools = sage.wrapToolsWithSecurity(createCodingTools(cwd));
|
|
@@ -147,6 +157,17 @@ registration API. Do not put definitions in a `tools` option.
|
|
|
147
157
|
| `SAGE_ALLOW_BASH_CLI` | `1` | Allow direct `sage ...` bash calls |
|
|
148
158
|
| `SAGE_AUTO_RESOLVE_SKILLS` | `1` | Resolve skills explicitly named in subagent tasks |
|
|
149
159
|
| `SAGE_INJECT_TOOL_DOCS` | `1` | Add compact Sage tool guardrails each turn |
|
|
160
|
+
| `GLOVE_LOCAL_SERVICE_FDS_V1` | — | Exact bounded JSON object mapping the one service alias to its inherited connected FD |
|
|
161
|
+
| `GLOVE_GUEST_CHANNEL_SERVICE_ALIAS` | — | Exact alias selecting the wallet-status service entry |
|
|
162
|
+
| `GLOVE_GUEST_CHANNEL_ENDPOINT` | — | Legacy canonical absolute guest-visible Unix socket path |
|
|
163
|
+
| `GLOVE_GUEST_CHANNEL_ROOT` | — | Legacy canonical absolute trusted root containing the endpoint |
|
|
164
|
+
| `GLOVE_GUEST_CHANNEL_OWNER_UID` | — | Legacy strict nonnegative decimal UID that owns the socket; must differ from the Pi process UID |
|
|
165
|
+
|
|
166
|
+
Choose exactly one complete mode. Inherited mode requires the FD map and alias while all three legacy variables are absent. Legacy mode requires the endpoint/root/owner tuple while both inherited variables are absent. Mixed and partial declarations fail closed and expose no wallet tool.
|
|
167
|
+
|
|
168
|
+
Inherited mode accepts exactly one own alias entry with an integer FD from 3 through 1,048,575. It uses that already-connected Unix stream persistently, permits one in-flight status request with no queue, and permanently disables the channel after any protocol, timeout, cancellation, disconnect, write, or reuse failure. It never falls back to a pathname.
|
|
169
|
+
|
|
170
|
+
Legacy mode preserves its existing pathname authentication: the adapter rejects relative or non-canonical paths, endpoints outside the root, symlinks, non-sockets, unsafe directory authority, owner mismatches, and socket inode changes across connect. There are no endpoint, root, owner, alias, or descriptor defaults.
|
|
150
171
|
|
|
151
172
|
### Deprecated Low-Level Compatibility
|
|
152
173
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,cAAc,sBAAsB,CAAC;AAGrC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACjF,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE3F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,cAAc,sBAAsB,CAAC;AAGrC,cAAc,qBAAqB,CAAC"}
|