@agrentingai/paperclip-adapter 0.2.2 → 0.4.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 ADDED
@@ -0,0 +1,86 @@
1
+ # Changelog
2
+
3
+ ## 0.4.0 (2026-07-17)
4
+
5
+ ### Paperclip compatibility
6
+
7
+ - Implement the current `@paperclipai/adapter-utils@2026.707.0`
8
+ `ServerAdapterModule` contract at the package root, including structured
9
+ execution results, environment checks, declarative configuration, and
10
+ hiring-session serialization.
11
+ - Keep the pre-0.4 task, ledger, webhook, discovery, and UI helpers available
12
+ from `./server` and `./ui`; expose legacy factory operations under explicit
13
+ compatibility names.
14
+ - Export an Agrenting Apps v2 gallery descriptor for a future upstream
15
+ Paperclip gallery submission. Current canary users can connect the same
16
+ Streamable HTTP endpoint through Apps → Connect your own tool.
17
+
18
+ ### Marketplace hiring
19
+
20
+ - Send the canonical `task_description`, `capability_requested`, `price`,
21
+ delivery, task input, repository, message, and idempotency fields to
22
+ `POST /api/v1/agents/:did/hire`.
23
+ - Use the Paperclip run ID as `client_idempotency_key`, poll the canonical
24
+ hiring lifecycle, return remote output, and best-effort cancel on timeout.
25
+ - Read hiring messages from the canonical detail response, support hiring
26
+ cancellation, and parse paginated hiring lists.
27
+ - Treat string-valued reputation scores safely during auto-selection.
28
+ - Stop retrying non-retryable 4xx and API-envelope failures; retain retries for
29
+ network errors, HTTP 429, and server errors.
30
+
31
+ ### Security and documentation
32
+
33
+ - Test canonical connectivity against the user-only hiring API instead of
34
+ requiring ledger access or a local agent context.
35
+ - Default delivery to `output`; expose `repoUrl` for optional push delivery
36
+ while keeping repository credentials out of Paperclip adapter config.
37
+ - Document one-key least-privilege scopes, per-hire price caps, current stable
38
+ external-adapter installation, canary Apps v2 setup, and the correct array
39
+ shape for `~/.paperclip/adapter-plugins.json`.
40
+
41
+ ## 0.3.0 (2026-05-06)
42
+
43
+ ### Features
44
+ - Implement the canonical Paperclip `AgentAdapter` contract: `invoke`, `status`, `cancel`. The package now loads cleanly via Paperclip's external-adapter system (`~/.paperclip/adapter-plugins.json`).
45
+ - Add `detectModel` for adapter-UI pre-population; reads the agent's `ai_provider`/`ai_model` from the Agrenting profile when available.
46
+ - Add `listSkills` / `syncSkills` to surface the agent's capabilities as Paperclip skills.
47
+ - Add `sessionCodec` (`encode`/`decode`) for session-state serialisation across heartbeats.
48
+ - Re-export the canonical names from `./server` so plugin loaders find them by name.
49
+
50
+ ### Notes
51
+ - Backward-compatible: `createServerAdapter()` still bundles the original surface plus the new canonical members.
52
+
53
+ ## 0.2.1 (2026-04-14)
54
+
55
+ ### Fixes
56
+ - Remove `cacp` from package.json keywords
57
+ - Remove CACP protocol references from README and UI adapter description
58
+ - Update `packages/adapter-agrenting/tutorial.md` to use `@agrentingai/paperclip-adapter` instead of old package name
59
+ - Add "Why Hire a Remote Agent" section to README explaining cost benefits
60
+
61
+ ## 0.2.0 (2026-04-14)
62
+
63
+ ### Features
64
+ - Add `hireAgent` for agent hiring via the Agrenting platform
65
+ - Add `getAgentProfile` for fetching agent profile data
66
+ - Add `sendMessageToTask` for messaging existing tasks
67
+ - Add `reassignTask` for task reassignment flows
68
+
69
+ ### Fixes
70
+ - Fix empty `companyId` handling
71
+ - Deduplicate polling requests
72
+ - Add `AbortSignal` support for request cancellation
73
+ - Improve adapter client and test coverage
74
+ - Use `/api/v1/uploads` for documents with flat webhook shape
75
+ - Fix critical retry, webhook security, and API compatibility bugs
76
+ - Resolve merge conflicts — deduplicate types, functions, and exports
77
+
78
+ ### Docs
79
+ - Add comprehensive tutorial for Paperclip + Agrenting adapter
80
+ - Document messaging, reassignment, and profile flows
81
+
82
+ ## 0.1.0 (2026-04-12)
83
+
84
+ - Initial release
85
+ - Paperclip adapter for Agrenting platform
86
+ - Server and UI exports
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AgRenting
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,314 +1,229 @@
1
1
  # @agrentingai/paperclip-adapter
2
2
 
3
- Paperclip adapter for [Agrenting](https://www.agrenting.com) — remote AI agent orchestration via the Agrenting platform.
3
+ Hire remote marketplace agents from [Agrenting](https://agrenting.com) during
4
+ Paperclip runs. Version 0.4.0 exposes Paperclip's current
5
+ `ServerAdapterModule` contract from the package root and keeps the previous
6
+ task, ledger, webhook, and marketplace helpers available from `./server`.
4
7
 
5
- ## Overview
8
+ ## Choose the integration
6
9
 
7
- This adapter enables Paperclip to submit tasks to agents hosted on the Agrenting platform. It provides both server-side execution and UI-side configuration components.
10
+ | Paperclip release | Recommended path | What it provides |
11
+ |---|---|---|
12
+ | Stable `v2026.707.0` | Install this external adapter | A Paperclip agent delegates each run to one configured Agrenting marketplace agent through the REST hiring lifecycle. |
13
+ | Canary/master `v2026.717.0-canary.5` | Apps → Connect your own tool | Governed Agrenting MCP tools for discovery, hiring, cancellation, artifact lookup, and status checks. |
8
14
 
9
- ## Why Hire a Remote Agent?
15
+ The two paths can use the same scoped Agrenting `ap_*` key. Apps v2 stores the
16
+ credential and applies Paperclip's tool governance; this adapter does not add a
17
+ second MCP bridge. Agrenting's Streamable HTTP endpoint is:
10
18
 
11
- Instead of spawning a Claude agent locally, hiring a remote agent on Agrenting offers several advantages:
12
-
13
- - **Offload the cost**: A $1 remote agent can burn through $20+ worth of tokens on heavy tasks — the compute and token costs are on the renter's side, not yours.
14
- - **Tap into underutilized capacity**: People who rent out their agents are typically looking to monetize their local AI infrastructure or leftover monthly subscription quota. You get access to that capacity at a fraction of the direct cost.
15
- - **Scale without infrastructure**: No need to manage API keys, rate limits, or local compute. Hire an agent and let it handle the heavy lifting.
16
-
17
- ## Installation
18
-
19
- ```bash
20
- npm install @agrentingai/paperclip-adapter
19
+ ```text
20
+ https://agrenting.com/mcp/hirer
21
21
  ```
22
22
 
23
- ## Usage
23
+ The Apps gallery is currently compiled into Paperclip. This package exports
24
+ `agrentingAppGalleryEntry` as a ready descriptor for a future upstream gallery
25
+ submission, but current users should choose **Connect your own tool**.
24
26
 
25
- ### Server Adapter
27
+ ## Create one least-privilege API key
26
28
 
27
- ```typescript
28
- import { createServerAdapter, AgrentingClient } from "@agrentingai/paperclip-adapter/server";
29
+ For this external adapter alone, create a user API key in the Agrenting
30
+ dashboard with these minimum scopes:
29
31
 
30
- const adapter = createServerAdapter();
32
+ - `agents:discover`
33
+ - `agents:read` (the adapter resolves the configured DID's capability and price)
34
+ - `hire:create`
35
+ - `hirings:read`
36
+ - `hirings:cancel`
31
37
 
32
- // Get the config schema (used by Paperclip to validate agent config)
33
- const schema = adapter.getConfigSchema();
38
+ For one key shared by this adapter, Paperclip Apps, and the Agrenting Claude
39
+ hire/status skills, also grant:
34
40
 
35
- // Test connectivity
36
- const result = await adapter.testEnvironment({
37
- agrentingUrl: "https://www.agrenting.com",
38
- apiKey: process.env.AGRENTING_API_KEY!,
39
- agentDid: "did:agrenting:my-agent",
40
- });
41
+ - `balance:read`
42
+ - `artifacts:read`
41
43
 
42
- // Execute a task
43
- const output = await adapter.execute(
44
- {
45
- agrentingUrl: "https://www.agrenting.com",
46
- apiKey: process.env.AGRENTING_API_KEY!,
47
- agentDid: "did:agrenting:my-agent",
48
- },
49
- {
50
- input: "Analyze this dataset and summarize findings",
51
- capability: "data-analysis",
52
- instructions: "You are a data analysis agent...",
53
- }
54
- );
44
+ Grant `deposits:create` only if the clients should fund the account, and grant
45
+ `account:read` / `account:write` only if they should inspect or manage stored
46
+ account integrations such as the GitHub credential used for push delivery.
55
47
 
56
- // Or use the client directly for more control
57
- const client = new AgrentingClient({
58
- agrentingUrl: "https://www.agrenting.com",
59
- apiKey: process.env.AGRENTING_API_KEY!,
60
- agentDid: "did:agrenting:my-agent",
61
- });
62
- const task = await client.createTask({
63
- providerAgentId: "did:agrenting:my-agent",
64
- capability: "data-analysis",
65
- input: "Analyze this dataset",
66
- });
67
- ```
48
+ Set `max_price_per_hire` on the key to cap each paid action. Keep the `ap_*`
49
+ value in Paperclip's secret storage or Apps credential field; never put it in
50
+ agent instructions, task text, logs, source control, or adapter JSON checked
51
+ into a repository.
68
52
 
69
- ### UI Adapter
53
+ ## External adapter installation
70
54
 
71
- ```typescript
72
- import { parseConfigSchema } from "@agrentingai/paperclip-adapter/ui";
55
+ Install the package through Paperclip's supported adapter manager:
73
56
 
74
- const info = parseConfigSchema();
75
- // info.label => "Agrenting"
76
- // info.configFields => array of form field definitions
77
- // info.buildAdapterConfig(formValues) => adapter config object
57
+ ```text
58
+ Settings Adapters → Install from npm → @agrentingai/paperclip-adapter
78
59
  ```
79
60
 
80
- ## Configuration
81
-
82
- | Field | Type | Required | Description |
83
- |-------|------|----------|-------------|
84
- | `agrentingUrl` | URL | Yes | Agrenting platform base URL |
85
- | `apiKey` | string | Yes | API key for authentication |
86
- | `agentDid` | string | Yes | Target agent's decentralized identifier |
87
- | `webhookSecret` | string | No | Webhook signing secret for callbacks |
88
- | `webhookCallbackUrl` | URL | No | Override URL for webhook callbacks |
89
- | `pricingModel` | enum | No | `fixed`, `per-token`, or `subscription` |
90
- | `timeoutSec` | number | No | Task timeout in seconds (default: 600) |
91
- | `instructionsBundleMode` | enum | No | `inline` or `managed` |
61
+ The equivalent API request is:
92
62
 
93
- ## Payment & Escrow
94
-
95
- Tasks can optionally use Agrenting's escrow system by providing a `maxPrice` budget:
96
-
97
- ```typescript
98
- const output = await adapter.execute(config, {
99
- input: "Analyze this dataset and summarize findings",
100
- capability: "data-analysis",
101
- maxPrice: "5.00", // Budget in USD — triggers escrow lock
102
- paymentType: "crypto", // "crypto" | "escrow" | "nowpayments"
103
- });
63
+ ```bash
64
+ curl -X POST http://localhost:3100/api/adapters/install \
65
+ -H "Authorization: Bearer <paperclip-token>" \
66
+ -H "Content-Type: application/json" \
67
+ -d '{"packageName":"@agrentingai/paperclip-adapter"}'
104
68
  ```
105
69
 
106
- When `maxPrice` is set:
107
- 1. The task is created with a price budget
108
- 2. `createTaskPayment()` is called to lock funds in escrow
109
- 3. Funds are released to the provider agent on completion
110
- 4. Failed/cancelled tasks return funds to the client's available balance
70
+ For local development, point Paperclip at this checkout:
111
71
 
112
- Check your balance before submitting:
113
-
114
- ```typescript
115
- import { checkBalance, canSubmitTask } from "@agrentingai/paperclip-adapter/server";
72
+ ```bash
73
+ curl -X POST http://localhost:3100/api/adapters/install \
74
+ -H "Authorization: Bearer <paperclip-token>" \
75
+ -H "Content-Type: application/json" \
76
+ -d '{"packageName":"/absolute/path/to/paperclip-adapter","isLocalPath":true}'
77
+ ```
116
78
 
117
- const balance = await checkBalance({ config });
118
- // balance.available, balance.escrow, balance.total
79
+ Directly editing `~/.paperclip/adapter-plugins.json` is a development fallback.
80
+ The current store is an array, not a package-name map:
119
81
 
120
- const ok = await canSubmitTask({ config });
121
- // { ok: true } or { ok: false, reason: "Insufficient balance: ..." }
82
+ ```json
83
+ [
84
+ {
85
+ "packageName": "@agrentingai/paperclip-adapter",
86
+ "localPath": "/absolute/path/to/paperclip-adapter",
87
+ "type": "agrenting",
88
+ "installedAt": "2026-07-17T00:00:00.000Z"
89
+ }
90
+ ]
122
91
  ```
123
92
 
124
- ## Marketplace Discovery
93
+ Restart Paperclip after a manual store edit.
125
94
 
126
- Browse available agents on the Agrenting marketplace:
95
+ ## Configure an Agrenting adapter agent
127
96
 
128
- ```typescript
129
- import { discoverAgents } from "@agrentingai/paperclip-adapter/server";
130
-
131
- const agents = await discoverAgents(config, {
132
- capability: "data-analysis",
133
- maxPrice: 5,
134
- minReputation: 4.0,
135
- sortBy: "reputation",
136
- limit: 10,
137
- });
138
- ```
97
+ Create a Paperclip agent with adapter type `agrenting` and configure:
139
98
 
140
- ## Task Progress Monitoring
99
+ | Field | Required | Default | Purpose |
100
+ |---|---:|---|---|
101
+ | `agrentingUrl` | Yes | `https://agrenting.com` | Agrenting base URL. |
102
+ | `apiKey` | Yes | — | Scoped user token beginning with `ap_`; stored as a secret. |
103
+ | `agentDid` | Yes | — | Marketplace agent DID to hire for each run. |
104
+ | `capabilityRequested` | No | First profile capability | Capability sent in the hiring. |
105
+ | `price` | No | Agent base price | USD price offered for each hiring. |
106
+ | `timeoutSec` | No | `600` | Maximum time to wait for a terminal hiring state. |
107
+ | `pollIntervalMs` | No | `2000` | Hiring status polling interval. |
108
+ | `deliveryMode` | No | `output` | `output` returns task output; `push` requests repository delivery. |
109
+ | `repoUrl` | Push only | — | Repository target for push delivery. |
141
110
 
142
- Monitor task progress in real-time via webhooks or polling:
111
+ Each Paperclip run creates one canonical Agrenting hiring and uses the
112
+ Paperclip run ID as `client_idempotency_key`. The adapter polls
113
+ `GET /api/v1/hirings/:id`, returns completed output through Paperclip logs and
114
+ `resultJson`, and best-effort cancels the hiring on timeout.
143
115
 
144
- ```typescript
145
- import { getTaskProgress } from "@agrentingai/paperclip-adapter/server";
146
-
147
- const progress = await getTaskProgress(config, taskId);
148
- // progress.status, progress.progressPercent, progress.progressMessage, progress.timeline
149
- ```
116
+ `output` is the safe default. For `push`, configure `repoUrl` and store the
117
+ user's GitHub credential in Agrenting first. The canonical Paperclip adapter
118
+ does not accept or persist a repository access token in its agent config.
150
119
 
151
- ## Agent Hiring
120
+ ### Package-root contract
152
121
 
153
- Hire agents directly from the marketplace for auto-provisioning:
122
+ Paperclip loads `createServerAdapter()` from the package root:
154
123
 
155
124
  ```typescript
156
- import { hireAgent, getAgentProfile } from "@agrentingai/paperclip-adapter/server";
125
+ import { createServerAdapter } from "@agrentingai/paperclip-adapter";
157
126
 
158
- // Get agent profile before hiring
159
- const profile = await getAgentProfile(config, "did:agrenting:code-reviewer");
160
- // profile.name, profile.capabilities, profile.pricing_model, profile.reputation_score
127
+ const adapter = createServerAdapter();
161
128
 
162
- // Hire the agent - returns hiring record + adapter config for auto-provisioning
163
- const result = await hireAgent(config, "did:agrenting:code-reviewer");
164
- // result.hiring.id, result.hiring.status
165
- // result.config.agentDid, result.config.pricingModel, result.config.basePrice
129
+ adapter.type; // "agrenting"
130
+ adapter.execute; // (AdapterExecutionContext) => AdapterExecutionResult
131
+ adapter.testEnvironment; // structured Paperclip environment checks
132
+ adapter.getConfigSchema?.(); // declarative adapter configuration fields
166
133
  ```
167
134
 
168
- ## Auto-Select Mode
135
+ The factory also exposes explicitly named compatibility helpers such as
136
+ `legacyExecute`, `legacyTestEnvironment`, `getLegacyConfigSchema`,
137
+ `legacyDetectModel`, `legacyListSkills`, and `legacySyncSkills`.
169
138
 
170
- Automatically discover and hire the best agent for a capability:
139
+ ## Paperclip Apps v2
171
140
 
172
- ```typescript
173
- import { autoSelectAgent } from "@agrentingai/paperclip-adapter/server";
174
-
175
- // Auto-select best agent for a capability
176
- const result = await autoSelectAgent(config, {
177
- capability: "code-review",
178
- maxPrice: "10.00", // Optional budget limit
179
- minReputation: 4.0, // Optional reputation filter
180
- sortBy: "reputation_score", // Sort by: reputation_score, base_price, availability
181
- preferAvailable: true, // Prefer agents with "available" status
182
- });
183
-
184
- // Result includes hiring, config, and selected agent profile
185
- // result.hiring, result.config, result.selectedAgent
186
- ```
187
-
188
- ## Task Messaging
141
+ On `v2026.717.0-canary.5` or newer:
189
142
 
190
- Send follow-up messages to agents mid-task for bidirectional communication:
143
+ 1. Open **Apps** and choose **Connect your own tool**.
144
+ 2. Enter `https://agrenting.com/mcp/hirer`.
145
+ 3. Choose API-key authentication.
146
+ 4. Put the `ap_*` key in the `Authorization` header with the `Bearer ` prefix.
147
+ 5. Grant access to the intended agents.
148
+ 6. Keep ask-first approval enabled for `write` and `destructive` tools.
191
149
 
192
- ```typescript
193
- import { sendMessageToTask, getTaskMessages } from "@agrentingai/paperclip-adapter/server";
194
-
195
- // Send message to active task
196
- await sendMessageToTask(config, taskId, "Please also check the error handling");
150
+ Paid `hire_agent` calls are write actions. Paperclip should show the selected
151
+ agent and price for approval before funds are committed. Cancellation and
152
+ credential-clearing operations are destructive. Read-only discovery and status
153
+ tools can run without a paid action.
197
154
 
198
- // Get message history
199
- const messages = await getTaskMessages(config, taskId);
200
- // messages[].sender_agent_id, messages[].content, messages[].created_at
201
- ```
155
+ Apps v2 posts JSON-RPC directly to the Streamable HTTP URL; no local bridge or
156
+ legacy GET-SSE session is required. The older `/mcp/hirer/sse` transport remains
157
+ an Agrenting fallback for clients that specifically require legacy SSE.
202
158
 
203
- ## Task Reassignment
159
+ ## Direct REST client
204
160
 
205
- Reassign failed or cancelled tasks to a different agent:
161
+ The server subpath exports the lower-level client and compatibility helpers:
206
162
 
207
163
  ```typescript
208
- import { reassignTask } from "@agrentingai/paperclip-adapter/server";
164
+ import { AgrentingClient } from "@agrentingai/paperclip-adapter/server";
209
165
 
210
- // Reassign to specific agent
211
- await reassignTask(config, taskId, "did:agrenting:new-agent");
212
-
213
- // Or let the system auto-select a replacement
214
- await reassignTask(config, taskId);
215
- ```
216
-
217
- ## Task Retry with Backoff
218
-
219
- Execute tasks with automatic retry logic:
220
-
221
- ```typescript
222
- import { executeWithRetry } from "@agrentingai/paperclip-adapter/server";
166
+ const client = new AgrentingClient({
167
+ agrentingUrl: "https://agrenting.com",
168
+ apiKey: process.env.AGRENTING_API_KEY!,
169
+ agentDid: "did:agrenting:code-reviewer",
170
+ });
223
171
 
224
- // Execute with automatic retries (default: 2 retries with exponential backoff)
225
- const result = await executeWithRetry(config, {
226
- input: "Analyze this dataset",
227
- capability: "data-analysis",
228
- maxRetries: 3, // Optional: override default max retries
172
+ const created = await client.hireAgent("did:agrenting:code-reviewer", {
173
+ taskDescription: "Review the authentication changes and return findings.",
174
+ capabilityRequested: "code-review",
175
+ price: "8.50",
176
+ deliveryMode: "output",
177
+ clientIdempotencyKey: "paperclip-run-123",
178
+ taskInput: { issue_id: "issue-42" },
229
179
  });
230
180
 
231
- // If task fails, it will retry with exponential backoff (1s, 2s, 4s...)
181
+ let hiring = created.hiring;
182
+ while (!["completed", "failed", "cancelled", "disputed", "refunded"].includes(hiring.status)) {
183
+ await new Promise((resolve) => setTimeout(resolve, 2_000));
184
+ hiring = await client.getHiring(hiring.id);
185
+ }
232
186
  ```
233
187
 
234
- ## Hiring Management
188
+ Marketplace hiring uses:
235
189
 
236
- Manage hirings and communicate with hired agents:
237
-
238
- ```typescript
239
- import { listHirings, getHiring, sendMessageToHiring, retryHiring } from "@agrentingai/paperclip-adapter/server";
190
+ 1. `GET /api/v1/agents/discover?capability=...`
191
+ 2. `POST /api/v1/agents/:did/hire`
192
+ 3. `GET /api/v1/hirings/:id`
193
+ 4. `/api/v1/hirings/:id/messages`, `/cancel`, or `/retry` as needed
240
194
 
241
- // List active hirings
242
- const hirings = await listHirings(config, { status: "active" });
195
+ Do not use `/api/v1/tasks` for user marketplace hiring. The task helpers kept
196
+ in this package serve Agrenting's separate agent-to-agent execution model.
243
197
 
244
- // Get specific hiring
245
- const hiring = await getHiring(config, hiringId);
198
+ ## Legacy helper surface
246
199
 
247
- // Send message to hired agent
248
- await sendMessageToHiring(config, hiringId, "Ready to start the next phase");
249
-
250
- // Retry a failed hiring
251
- await retryHiring(config, hiringId, { reason: "previous timeout" });
252
- ```
253
-
254
- ## Capabilities Discovery
255
-
256
- List available capabilities to help with agent selection:
200
+ Existing integrations may continue importing from
201
+ `@agrentingai/paperclip-adapter/server`. The subpath retains task execution,
202
+ polling, webhook verification, balance/payment helpers, discovery, hiring,
203
+ messaging, retry, cancellation, and skill helpers. The UI subpath is also kept
204
+ for backward compatibility:
257
205
 
258
206
  ```typescript
259
- import { listCapabilities } from "@agrentingai/paperclip-adapter/server";
260
-
261
- const capabilities = await listCapabilities(config);
262
- // capabilities[].name, capabilities[].description, capabilities[].agent_count, capabilities[].avg_price
263
- ```
264
-
265
- ## Architecture
266
-
267
- ```
268
- @agrentingai/paperclip-adapter/
269
- ├── server/ # Server-side adapter (Node.js)
270
- │ └── src/
271
- │ ├── adapter.ts # createServerAdapter, execute, getConfigSchema
272
- │ ├── client.ts # Agrenting HTTP API client (AgrentingClient)
273
- │ ├── types.ts # TypeScript interfaces
274
- │ └── index.ts # Public exports
275
- ├── ui/ # UI-side adapter (browser, React optional)
276
- │ └── src/
277
- │ ├── adapter.ts # parseConfigSchema, UI type definitions
278
- │ └── index.ts # Public exports
279
- ├── package.json
280
- ├── tsconfig.json
281
- └── tsup.config.ts
207
+ import { parseConfigSchema } from "@agrentingai/paperclip-adapter/ui";
282
208
  ```
283
209
 
284
- ## Task Execution Flow
285
-
286
- 1. Paperclip calls `adapter.execute()` with task input, agent config, and optional `maxPrice`
287
- 2. Adapter performs a balance pre-check (`GET /api/v1/ledger/balance`)
288
- 3. Task is submitted to `POST /api/v1/tasks` on Agrenting with `external_client: true`
289
- 4. If `maxPrice` is set, `POST /api/v1/tasks/:id/payments` locks escrow funds
290
- 5. Adapter monitors progress via webhook callback or exponential backoff polling
291
- 6. On completion, escrow is released to the provider agent; on failure, funds return
292
- 7. Result is returned to Paperclip's execution engine
293
-
294
- ## Ledger & Payments
295
-
296
- ```typescript
297
- import { getBalance, getTransactions, deposit, withdraw } from "@agrentingai/paperclip-adapter/server";
210
+ New Paperclip installations do not need a custom UI parser because Paperclip
211
+ can render the canonical declarative configuration schema and generic run
212
+ output.
298
213
 
299
- // Check platform balance (available + escrowed + total)
300
- const balance = await getBalance(config);
214
+ ## Development
301
215
 
302
- // View recent transactions
303
- const txs = await getTransactions(config, { limit: 20 });
304
-
305
- // Deposit funds
306
- const depositResult = await deposit(config, { amount: "100", currency: "USD", paymentMethod: "crypto" });
307
-
308
- // Withdraw to external wallet
309
- const withdrawResult = await withdraw(config, { amount: "50", withdrawalAddressId: "addr-123" });
216
+ ```bash
217
+ npm install
218
+ npm test
219
+ npm run typecheck
220
+ npm run lint
221
+ npm run build
222
+ npm pack --dry-run
310
223
  ```
311
224
 
225
+ Node.js 20 or newer is required.
226
+
312
227
  ## License
313
228
 
314
229
  MIT
package/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.4.0