@lucid-agents/pi-xgate 0.0.0-stage → 0.1.5

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xgate contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,129 @@
1
- # Temporary Holding Version
1
+ # xgate provider for Pi
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A Pi **v1.1.0** provider extension for wallet-paid inference. It uses native
4
+ Anthropic Messages and structured OpenAI Responses through xgate. Pi executes its
5
+ own tools; xgate never executes local tools. Text, tool calls/results and supported
6
+ reasoning signatures survive the full agent loop.
7
+
8
+ ## Install
9
+
10
+ The release package is `@lucid-agents/pi-xgate`. It includes the client dependency
11
+ and the reviewed model-capability snapshot; the internal router contracts package
12
+ is not required. With Node 24.19+ (below 25) and Pi 1.1.0:
13
+
14
+ ```sh
15
+ pi install npm:@lucid-agents/pi-xgate@0.1.5
16
+ ```
17
+
18
+ For repository development before a release is available:
19
+
20
+ ```sh
21
+ pnpm --filter @lucid-agents/xgate-client build
22
+ pi install ./packages/pi-xgate
23
+ ```
24
+
25
+ Pi supplies `@earendil-works/pi-ai` and `@earendil-works/pi-coding-agent` as peers.
26
+ This release pins compatibility to 1.1.0; other versions need their own check.
27
+
28
+ ## Connect a wallet broker
29
+
30
+ Choose Tempo MPP, Base x402 batch settlement, or Solana x402 exact in the
31
+ [wallet service policy](../xgate-client/README.md#x402-configuration). Pi's provider
32
+ and tool loop are the same for each; payment selection and keys stay in the broker.
33
+ The new x402 client adapters have fixture coverage and still require separately
34
+ budgeted signed live qualification before production use.
35
+
36
+ Run the [wallet service](../xgate-client/README.md) outside the filesystem/process
37
+ access available to Pi tools. The extension reads a **broker token**, not a wallet
38
+ key. A broker running under the same user as unrestricted Pi shell tools does not
39
+ provide key isolation.
40
+
41
+ Use `/xgate setup` in Pi to set the broker URL and an absolute path to its token
42
+ file. Setup writes `~/.pi/agent/xgate.json` only if it does not already exist. To
43
+ change an existing setup, edit that owner-only file and use `/xgate refresh`.
44
+ For headless runs, set `XGATE_CONFIG` to an absolute owner-only JSON file:
45
+
46
+ ```json
47
+ {
48
+ "url": "http://127.0.0.1:4021",
49
+ "tokenFile": "/absolute/private/broker-token"
50
+ }
51
+ ```
52
+
53
+ Both files must be regular, nonsymlink files with no group/other permissions.
54
+ Select a model through `/model`. Only the broker policy's models with compatible
55
+ live qualifications are offered. OpenAI requires the new
56
+ `openai-anonymous-tools-v2` router profile; an older server will expose no OpenAI
57
+ coding models. Anthropic requires `anthropic-anonymous-usage-v3` and uses only
58
+ `anthropic_no_cache` native Messages scopes.
59
+ An expired/revoked catalog scope cannot authorize payment just because Pi remembers
60
+ an earlier model list: the provider refreshes before each invocation and the wallet
61
+ client validates the actual quote again.
62
+
63
+ Commands:
64
+
65
+ - `/xgate status`: pending purchases and budget totals.
66
+ - `/xgate budget`: show the wallet service's fixed authorization caps.
67
+ - `/xgate receipts`: recent content-free payment records.
68
+ - `/xgate reconcile <invocation ID>`: inspect/reconcile the original purchase without
69
+ resubmitting inference or payment.
70
+ - `/xgate refresh`: reload private configuration and available models.
71
+
72
+ Pi cannot raise the service budget. Authorized ceilings remain consumed after
73
+ successful settlement even when most of a deposit is returned. A new budget is an
74
+ explicit wallet-operator action, never automatic rollover or a fresh journal.
75
+
76
+ ## Behavior and limits
77
+
78
+ Responses are **buffered**, not token-streamed over the network. After a complete
79
+ response and independently verified payment, the adapter emits Pi's normal text,
80
+ thinking and tool-call events. It never exposes partial tool calls before payment
81
+ verification. It emits one terminal event and honors cancellation; cancellation
82
+ can still leave a charged or unresolved purchase requiring status inspection.
83
+
84
+ There is no automatic paid POST retry. Stable invocation IDs bind retries to the
85
+ same ledger record even when a payload hook changes its output. Unresolved
86
+ purchases block new purchases. A lost result is not recoverable from xgate and
87
+ cannot be regenerated by replaying the same invocation. Keep Pi agent/provider
88
+ retry disabled for an initial deployment; the durable wallet guard is independent
89
+ of that setting. Cache warming is disabled for this provider.
90
+
91
+ The initial scope is text-only, with a maximum advertised output of 8,192 tokens
92
+ and a default request cap of 4,096. A lower Pi `models.json` `modelOverrides`
93
+ `maxTokens` value lowers that default; it cannot raise the live catalog limit. Pi thinking controls expose the reviewed levels (GPT-5 Mini currently permits only
94
+ `minimal`) and clamp the selected level through Pi's native model handling.
95
+ It rejects images, unsupported sampling/forced
96
+ tool settings, excessive schemas and incompatible thinking levels before paying.
97
+ OpenAI allows eight custom tools / 8 KiB of declarations; Anthropic allows 32 /
98
+ 64 KiB. The router additionally validates tool/result identities and message bounds.
99
+ Opaque OpenAI reasoning reserves the reviewed full input ceiling because ciphertext
100
+ length cannot prove its decoded token count. Consequently its authorization hold
101
+ can be much larger than its eventual charge; the wallet cap still applies.
102
+
103
+ Pi's token-cost figures are supplier-rate estimates, excluding router markup and
104
+ success floors. `/xgate` status and receipts report actual atomic payment amounts.
105
+ The extension sends no Pi session ID, caller metadata, cache affinity key or wallet
106
+ credential to the inference provider. Payload hooks run before quoting and cannot
107
+ change the model, output cap or tool declarations. Response hooks receive sanitized
108
+ headers without payment/status capabilities.
109
+
110
+ Pi retains its own transcripts by default. That is separate from xgate's
111
+ application content-retention policy. Use Pi's `--no-session` option if local
112
+ transcript persistence is unwanted; financial reconciliation records are separate.
113
+ Changing models can discard incompatible opaque reasoning signatures, but preserves
114
+ text/tool history and consistent tool IDs. Removing a historical Anthropic tool
115
+ from the current tool set is rejected rather than silently losing that history.
116
+
117
+ ## Tests and rollout
118
+
119
+ Run `pnpm pi:check` at the repository root. Tests instantiate Pi's real agent core,
120
+ execute a fixture tool, and verify the next request contains its exact result and
121
+ reasoning history. Separate wallet tests cover durable financial boundaries.
122
+ These are fixture tests. The [9 October staging campaign](../../docs/validation/pi-client-staging-20261009.md)
123
+ separately exercised the installed Pi CLI with live providers and test tokens.
124
+ That evidence is staging-only; it does not qualify production payment execution.
125
+ Installing the extension does not publish router qualifications or deploy any service.
126
+
127
+ ## License
128
+
129
+ MIT. See [LICENSE](LICENSE).
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@lucid-agents/pi-xgate",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.5",
4
+ "type": "module",
5
+ "keywords": [
6
+ "pi-package",
7
+ "xgate",
8
+ "x402",
9
+ "mpp",
10
+ "lucid-agents"
11
+ ],
12
+ "pi": {
13
+ "extensions": [
14
+ "./src/extension.ts"
15
+ ]
16
+ },
17
+ "files": [
18
+ "src",
19
+ "README.md",
20
+ "LICENSE"
21
+ ],
22
+ "dependencies": {
23
+ "@lucid-agents/xgate-client": "0.1.5"
24
+ },
25
+ "peerDependencies": {
26
+ "@earendil-works/pi-ai": "1.1.0",
27
+ "@earendil-works/pi-coding-agent": "1.1.0"
28
+ },
29
+ "engines": {
30
+ "node": ">=24.19 <25"
31
+ },
32
+ "description": "Wallet-paid OpenAI and Anthropic inference through xgate for the Pi coding agent",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/daydreamsai/402-router.git",
36
+ "directory": "packages/pi-xgate"
37
+ },
38
+ "homepage": "https://github.com/daydreamsai/402-router/tree/main/packages/pi-xgate",
39
+ "bugs": {
40
+ "url": "https://github.com/daydreamsai/402-router/issues"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public",
44
+ "registry": "https://registry.npmjs.org"
45
+ },
46
+ "license": "MIT",
47
+ "gitHead": "2c12308686701f39f95093c5984d014c0ec83d26",
48
+ "xgateRelease": {
49
+ "version": "v0.1.5",
50
+ "sourceSha": "2c12308686701f39f95093c5984d014c0ec83d26",
51
+ "candidateId": "rc-2c1230868670-37853927676-1"
52
+ }
53
+ }