patchcord 0.5.100 → 0.5.102
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/bin/patchcord.mjs
CHANGED
|
@@ -869,7 +869,7 @@ if (cmd === "main" || cmd === "master" || cmd === "provision" || cmd === "team")
|
|
|
869
869
|
const sub = process.argv[3];
|
|
870
870
|
if (sub === "connect") {
|
|
871
871
|
const harness = flagVal("harness", flagVal("tool", ""));
|
|
872
|
-
const create = run(`curl -sf --max-time 10 -X POST "${DEFAULT_API}/api/
|
|
872
|
+
const create = run(`curl -sf --max-time 10 -X POST "${DEFAULT_API}/api/main/session" -H "Content-Type: application/json" -d '{"harness":"${harness}"}'`);
|
|
873
873
|
let sessionId = "";
|
|
874
874
|
try { sessionId = (JSON.parse(create).session_id) || ""; } catch {}
|
|
875
875
|
if (!sessionId) { console.error("Could not start main-auth session."); process.exit(1); }
|
|
@@ -904,7 +904,7 @@ if (cmd === "main" || cmd === "master" || cmd === "provision" || cmd === "team")
|
|
|
904
904
|
}
|
|
905
905
|
if (sub === "whoami") {
|
|
906
906
|
const m = requireMain();
|
|
907
|
-
const { status, json } = await _httpJSON("GET", `${m.baseUrl}/api/
|
|
907
|
+
const { status, json } = await _httpJSON("GET", `${m.baseUrl}/api/main/whoami`, m.token);
|
|
908
908
|
if (status !== "200" || !json) { console.error(`main whoami failed (HTTP ${status})`); process.exit(1); }
|
|
909
909
|
console.log(`main · user ${json.user_id} · ${json.agents}/${json.quota} agents`);
|
|
910
910
|
process.exit(0);
|
|
@@ -1458,20 +1458,19 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
1458
1458
|
// Kimi CLI
|
|
1459
1459
|
const hasKimi = run("which kimi");
|
|
1460
1460
|
if (hasKimi) {
|
|
1461
|
-
// Clean up old skill names
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
const
|
|
1473
|
-
const
|
|
1474
|
-
const kimiSubDir = join(HOME, ".kimi", "skills", "patchcord:subscribe");
|
|
1461
|
+
// Clean up old skill names: the combined skill AND the colon-named flow
|
|
1462
|
+
// skills (patchcord:inbox …). Kimi requires skill names to be
|
|
1463
|
+
// lowercase/digits/hyphens only — a colon kept them out of /flow:, so they
|
|
1464
|
+
// showed only under /skill:. Renamed to patchcord-inbox etc.
|
|
1465
|
+
for (const stale of ["patchcord", "patchcord-wait", "patchcord:inbox", "patchcord:wait", "patchcord:subscribe"]) {
|
|
1466
|
+
const d = join(HOME, ".kimi", "skills", stale);
|
|
1467
|
+
if (existsSync(d)) { try { rmSync(d, { recursive: true, force: true }); } catch {} }
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
// Install three focused Kimi flow skills (hyphen names → /flow:patchcord-inbox)
|
|
1471
|
+
const kimiInboxDir = join(HOME, ".kimi", "skills", "patchcord-inbox");
|
|
1472
|
+
const kimiWaitDir = join(HOME, ".kimi", "skills", "patchcord-wait");
|
|
1473
|
+
const kimiSubDir = join(HOME, ".kimi", "skills", "patchcord-subscribe");
|
|
1475
1474
|
let kimiChanged = false;
|
|
1476
1475
|
|
|
1477
1476
|
const installKimiSkill = (destDir, relSrc) => {
|
|
@@ -2333,14 +2332,20 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
2333
2332
|
console.log(`\n ${green}✓${r} Kimi Code configured: ${dim}${kcPath}${r}`);
|
|
2334
2333
|
console.log(` ${dim}Kimi Code auto-loads project-local .kimi-code/mcp.json — just run ${r}${bold}kimi${r}${dim} in this project (no wrapper needed).${r}`);
|
|
2335
2334
|
}
|
|
2336
|
-
// Skills → user-level Kimi Code skills dir
|
|
2335
|
+
// Skills → user-level Kimi Code skills dir. Hyphen names so they register
|
|
2336
|
+
// as /flow:patchcord-inbox (a colon kept them out of /flow:). Remove any
|
|
2337
|
+
// stale colon-named dirs from prior installs.
|
|
2337
2338
|
try {
|
|
2338
|
-
for (const
|
|
2339
|
+
for (const stale of ["patchcord:inbox", "patchcord:wait", "patchcord:subscribe", "patchcord"]) {
|
|
2340
|
+
const d = join(kimiCodeHome, "skills", stale);
|
|
2341
|
+
if (existsSync(d)) { try { rmSync(d, { recursive: true, force: true }); } catch {} }
|
|
2342
|
+
}
|
|
2343
|
+
for (const [label, rel] of [["patchcord-inbox", "inbox"], ["patchcord-wait", "wait"], ["patchcord-subscribe", "subscribe"]]) {
|
|
2339
2344
|
const dest = join(kimiCodeHome, "skills", label);
|
|
2340
2345
|
mkdirSync(dest, { recursive: true });
|
|
2341
2346
|
cpSync(join(pluginRoot, "per-project-skills", "kimi", rel, "SKILL.md"), join(dest, "SKILL.md"));
|
|
2342
2347
|
}
|
|
2343
|
-
console.log(` ${green}✓${r} Skills installed: ${dim}${join(kimiCodeHome, "skills")}${r}`);
|
|
2348
|
+
console.log(` ${green}✓${r} Skills installed: ${dim}${join(kimiCodeHome, "skills")}${r} ${dim}(/flow:patchcord-inbox)${r}`);
|
|
2344
2349
|
} catch {}
|
|
2345
2350
|
} else if (isKimi) {
|
|
2346
2351
|
// Kimi CLI (Python): per-project .kimi/mcp.json + shell wrapper for --mcp-config-file
|
|
@@ -2360,22 +2365,22 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
2360
2365
|
console.log(`\n ${green}✓${r} Kimi CLI configured: ${dim}${kimiPath}${r}`);
|
|
2361
2366
|
console.log(` ${dim}Per-project — use the kimi-pc wrapper (see below) so Kimi loads this config.${r}`);
|
|
2362
2367
|
}
|
|
2363
|
-
// Install/update global skills
|
|
2364
|
-
|
|
2365
|
-
const
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
const kimiInboxDir = join(HOME, ".kimi", "skills", "patchcord
|
|
2370
|
-
const kimiWaitDir = join(HOME, ".kimi", "skills", "patchcord
|
|
2371
|
-
const kimiSubDir = join(HOME, ".kimi", "skills", "patchcord
|
|
2368
|
+
// Install/update global skills. Hyphen names → /flow:patchcord-inbox
|
|
2369
|
+
// (colon names never registered as flows). Remove old combined + colon dirs.
|
|
2370
|
+
for (const stale of ["patchcord", "patchcord-wait", "patchcord:inbox", "patchcord:wait", "patchcord:subscribe"]) {
|
|
2371
|
+
const d = join(HOME, ".kimi", "skills", stale);
|
|
2372
|
+
if (existsSync(d)) { try { rmSync(d, { recursive: true, force: true }); } catch {} }
|
|
2373
|
+
}
|
|
2374
|
+
const kimiInboxDir = join(HOME, ".kimi", "skills", "patchcord-inbox");
|
|
2375
|
+
const kimiWaitDir = join(HOME, ".kimi", "skills", "patchcord-wait");
|
|
2376
|
+
const kimiSubDir = join(HOME, ".kimi", "skills", "patchcord-subscribe");
|
|
2372
2377
|
mkdirSync(kimiInboxDir, { recursive: true });
|
|
2373
2378
|
mkdirSync(kimiWaitDir, { recursive: true });
|
|
2374
2379
|
mkdirSync(kimiSubDir, { recursive: true });
|
|
2375
2380
|
cpSync(join(pluginRoot, "per-project-skills", "kimi", "inbox", "SKILL.md"), join(kimiInboxDir, "SKILL.md"));
|
|
2376
2381
|
cpSync(join(pluginRoot, "per-project-skills", "kimi", "wait", "SKILL.md"), join(kimiWaitDir, "SKILL.md"));
|
|
2377
2382
|
cpSync(join(pluginRoot, "per-project-skills", "kimi", "subscribe", "SKILL.md"), join(kimiSubDir, "SKILL.md"));
|
|
2378
|
-
console.log(` ${green}✓${r} Skills installed: ${dim}patchcord
|
|
2383
|
+
console.log(` ${green}✓${r} Skills installed: ${dim}/flow:patchcord-inbox${r}, ${dim}-wait${r}, ${dim}-subscribe${r}`);
|
|
2379
2384
|
|
|
2380
2385
|
// Install alias for per-project --mcp-config-file
|
|
2381
2386
|
const aliasLine = `alias kimi-pc='kimi --mcp-config-file .kimi/mcp.json'`;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: patchcord
|
|
2
|
+
name: patchcord-inbox
|
|
3
3
|
description: Read Patchcord inbox and reply to messages
|
|
4
4
|
type: flow
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
> Use `/flow:patchcord
|
|
7
|
+
> Use `/flow:patchcord-inbox` to run this. `/skill:` only loads it as docs (Kimi design).
|
|
8
8
|
|
|
9
9
|
```mermaid
|
|
10
10
|
flowchart TD
|
|
11
|
-
A([BEGIN]) --> B[Call the inbox MCP tool. Reading the response: the first header line shows YOUR own identity (the recipient). The actual sender of each message is
|
|
12
|
-
B --> C[Call the Shell tool with these exact parameters to re-arm the listener: command=
|
|
11
|
+
A([BEGIN]) --> B["Call the inbox MCP tool. Reading the response: the first header line shows YOUR own identity (the recipient). The actual sender of each message is on a 'From X' line — never confuse the header with the sender. For each pending message, classify it: (1) ACK — short signals like thanks, noted, works, great, ok, 👍 with no task. Close silently with reply(message_id, resolve=true) and NO content. Never send a text reply to an ack — it creates infinite ack chains. (2) BLOCKED — you cannot do the work right now (busy, missing credentials, ambiguous target). Use reply(message_id, reason, defer=true) — the message stays in your inbox as a reminder. Never silently skip a message. (3) ACTIONABLE — do the work the message asks for first (edit the file, run the command, write the code), THEN call reply(message_id, concrete summary) with file paths and line numbers. Never reply will-do or understood before doing the work."]
|
|
12
|
+
B --> C["Call the Shell tool with these exact parameters to re-arm the listener: command=patchcord subscribe --kimi 5, run_in_background=true, timeout=86400, description=Patchcord listener."]
|
|
13
13
|
C --> D([END])
|
|
14
14
|
```
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: patchcord
|
|
2
|
+
name: patchcord-subscribe
|
|
3
3
|
description: Start the Patchcord background polling listener
|
|
4
4
|
type: flow
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
> Use `/flow:patchcord
|
|
7
|
+
> Use `/flow:patchcord-subscribe` to run this. `/skill:` only loads it as docs (Kimi design).
|
|
8
8
|
|
|
9
9
|
```mermaid
|
|
10
10
|
flowchart TD
|
|
11
|
-
A([BEGIN]) --> B[First, call the inbox MCP tool. Reading the response: the first header line shows YOUR own identity (the recipient). The actual sender of each message is
|
|
12
|
-
B --> C[Now call the Shell tool with these exact parameters: command=
|
|
11
|
+
A([BEGIN]) --> B["First, call the inbox MCP tool. Reading the response: the first header line shows YOUR own identity (the recipient). The actual sender of each message is on a 'From X' line — never confuse the header with the sender. Drain each pending message by classifying it: ACK (thanks, noted, works, ok, 👍) → close silently with reply(message_id, resolve=true), no content; BLOCKED (you cannot do the work right now) → reply(message_id, reason, defer=true); ACTIONABLE → do the work first, then reply(message_id, concrete summary). Do NOT skip the drain — the listener exits immediately if messages are already waiting."]
|
|
12
|
+
B --> C["Now call the Shell tool with these exact parameters: command=patchcord subscribe --kimi 5, run_in_background=true, timeout=86400, description=Patchcord listener. Then tell the user in one sentence: Patchcord listener active."]
|
|
13
13
|
C --> D([END])
|
|
14
14
|
```
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: patchcord
|
|
2
|
+
name: patchcord-wait
|
|
3
3
|
description: Wait for one incoming Patchcord message
|
|
4
4
|
type: flow
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
> Use `/flow:patchcord
|
|
7
|
+
> Use `/flow:patchcord-wait` to run this. `/skill:` only loads it as docs (Kimi design).
|
|
8
8
|
|
|
9
9
|
```mermaid
|
|
10
10
|
flowchart TD
|
|
11
|
-
A([BEGIN]) --> B[Call the wait_for_message MCP tool to block until a message arrives or 5 minutes elapse.]
|
|
12
|
-
B --> C{Message arrived?}
|
|
13
|
-
C -->|Yes| D[Classify the message: ACK (
|
|
11
|
+
A([BEGIN]) --> B["Call the wait_for_message MCP tool to block until a message arrives or 5 minutes elapse."]
|
|
12
|
+
B --> C{"Message arrived?"}
|
|
13
|
+
C -->|Yes| D["Classify the message: ACK (thanks, noted, works, ok, 👍) → close silently with reply(message_id, resolve=true), no content; BLOCKED (cannot do work right now) → reply(message_id, reason, defer=true); ACTIONABLE → do the work first, then reply(message_id, concrete summary). Never reply to an ack with text."]
|
|
14
14
|
C -->|No| E([END])
|
|
15
|
-
D --> F[Call the Shell tool with these exact parameters to re-arm the listener: command=
|
|
15
|
+
D --> F["Call the Shell tool with these exact parameters to re-arm the listener: command=patchcord subscribe --kimi 5, run_in_background=true, timeout=86400, description=Patchcord listener."]
|
|
16
16
|
F --> E
|
|
17
17
|
```
|