patchcord 0.3.14 → 0.3.15
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/bin/patchcord.mjs +56 -12
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "patchcord",
|
|
3
3
|
"description": "Cross-machine agent messaging with auto-inbox checking. Agents automatically respond to messages from other agents without human intervention.",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.15",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "ppravdin"
|
|
7
7
|
},
|
package/bin/patchcord.mjs
CHANGED
|
@@ -46,7 +46,7 @@ if (cmd === "install") {
|
|
|
46
46
|
|__] |__| | | |__| | | | |__/ | \\
|
|
47
47
|
| | | | |___ | | |___ |__| | \\ |__/
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Messenger for AI agents.
|
|
50
50
|
`);
|
|
51
51
|
|
|
52
52
|
let installedSomething = false;
|
|
@@ -141,7 +141,7 @@ Then run: npx patchcord@latest install`);
|
|
|
141
141
|
process.exit(0);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
// ── agent: per-project
|
|
144
|
+
// ── agent: per-project interactive setup ──────────────────────
|
|
145
145
|
if (cmd === "agent") {
|
|
146
146
|
const cwd = process.cwd();
|
|
147
147
|
const { readFileSync, writeFileSync } = await import("fs");
|
|
@@ -150,20 +150,63 @@ if (cmd === "agent") {
|
|
|
150
150
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
151
151
|
const ask = (q) => new Promise((resolve) => rl.question(q, resolve));
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
console.log(`\nWhich tool are you setting up?\n`);
|
|
154
|
+
console.log(` 1. Claude Code`);
|
|
155
|
+
console.log(` 2. Codex CLI\n`);
|
|
155
156
|
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
|
|
157
|
+
const choice = (await ask("Choose (1/2): ")).trim();
|
|
158
|
+
const isCodex = choice === "2";
|
|
159
|
+
|
|
160
|
+
if (choice !== "1" && choice !== "2") {
|
|
161
|
+
console.error("Invalid choice.");
|
|
162
|
+
rl.close();
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const token = (await ask("\nPaste your agent token: ")).trim();
|
|
159
167
|
|
|
160
168
|
if (!token) {
|
|
161
169
|
console.error("Token is required. Get one from your patchcord dashboard.");
|
|
170
|
+
rl.close();
|
|
162
171
|
process.exit(1);
|
|
163
172
|
}
|
|
164
173
|
|
|
165
|
-
//
|
|
166
|
-
|
|
174
|
+
// Validate token
|
|
175
|
+
let serverUrl = "https://mcp.patchcord.dev";
|
|
176
|
+
console.log("\nValidating token...");
|
|
177
|
+
const validateResp = run(`curl -sf --max-time 5 -H "Authorization: Bearer ${token}" "${serverUrl}/api/inbox?limit=0"`);
|
|
178
|
+
let identity = "";
|
|
179
|
+
if (validateResp) {
|
|
180
|
+
try {
|
|
181
|
+
const data = JSON.parse(validateResp);
|
|
182
|
+
identity = `${data.agent_id}@${data.namespace_id}`;
|
|
183
|
+
console.log(` ✓ ${identity}`);
|
|
184
|
+
} catch {}
|
|
185
|
+
}
|
|
186
|
+
if (!identity) {
|
|
187
|
+
console.log(" ✗ Could not validate token against mcp.patchcord.dev");
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const customUrl = (await ask("\nCustom server URL? (y/N): ")).trim().toLowerCase();
|
|
191
|
+
if (customUrl === "y" || customUrl === "yes") {
|
|
192
|
+
const url = (await ask("Server URL: ")).trim();
|
|
193
|
+
if (url) serverUrl = url;
|
|
194
|
+
|
|
195
|
+
// Re-validate against custom server if identity wasn't found
|
|
196
|
+
if (!identity) {
|
|
197
|
+
console.log("Validating token...");
|
|
198
|
+
const resp2 = run(`curl -sf --max-time 5 -H "Authorization: Bearer ${token}" "${serverUrl}/api/inbox?limit=0"`);
|
|
199
|
+
if (resp2) {
|
|
200
|
+
try {
|
|
201
|
+
const data = JSON.parse(resp2);
|
|
202
|
+
identity = `${data.agent_id}@${data.namespace_id}`;
|
|
203
|
+
console.log(` ✓ ${identity}`);
|
|
204
|
+
} catch {}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
rl.close();
|
|
167
210
|
|
|
168
211
|
if (isCodex) {
|
|
169
212
|
// Codex: copy skill + write config
|
|
@@ -179,7 +222,8 @@ if (cmd === "agent") {
|
|
|
179
222
|
existing = existing.trimEnd() + `\n\n[mcp_servers.patchcord]\nurl = "${serverUrl}/mcp/bearer"\nhttp_headers = { "Authorization" = "Bearer ${token}", "X-Patchcord-Client-Type" = "codex" }\n`;
|
|
180
223
|
writeFileSync(configPath, existing);
|
|
181
224
|
}
|
|
182
|
-
console.log(
|
|
225
|
+
console.log(`\n ✓ Codex configured: ${configPath}`);
|
|
226
|
+
console.log(` ✓ Skill installed`);
|
|
183
227
|
} else {
|
|
184
228
|
// Claude Code: write .mcp.json
|
|
185
229
|
const mcpPath = join(cwd, ".mcp.json");
|
|
@@ -207,10 +251,10 @@ if (cmd === "agent") {
|
|
|
207
251
|
} else {
|
|
208
252
|
writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2) + "\n");
|
|
209
253
|
}
|
|
210
|
-
console.log(
|
|
254
|
+
console.log(`\n ✓ Claude Code configured: ${mcpPath}`);
|
|
211
255
|
}
|
|
212
256
|
|
|
213
|
-
console.log(
|
|
257
|
+
console.log(`\nRestart your session, then run: inbox()`);
|
|
214
258
|
process.exit(0);
|
|
215
259
|
}
|
|
216
260
|
|