walkie-cli 0.1.0 → 0.2.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/dist/channel.js +55 -4
- package/dist/config.js +8 -2
- package/package.json +2 -2
package/dist/channel.js
CHANGED
|
@@ -13,16 +13,57 @@ import { hostname } from "node:os";
|
|
|
13
13
|
import { createInterface } from "node:readline";
|
|
14
14
|
import { fetchFeed } from "./feed.js";
|
|
15
15
|
import { ackPosts, renderOne } from "./listen.js";
|
|
16
|
+
import { detectSessionId, sendReport } from "./report.js";
|
|
16
17
|
import { consumeSse } from "./sse.js";
|
|
17
|
-
const SERVER_INFO = { name: "walkie", version: "0.
|
|
18
|
+
const SERVER_INFO = { name: "walkie", version: "0.2.0" };
|
|
18
19
|
/** Claude Code's v2 runtime does not register channel servers on revision 2026-07-28; stay on an earlier one. */
|
|
19
20
|
const SAFE_PROTOCOLS = new Set(["2024-11-05", "2025-03-26", "2025-06-18", "2025-11-25"]);
|
|
20
21
|
const INSTRUCTIONS = [
|
|
21
22
|
"This channel delivers short messages from the person you work for, over Walkie Talkie: standing rules, current priorities and notices.",
|
|
22
23
|
"Each event arrives as <channel source=\"walkie\" …> with attributes: event (post.published|post.updated|post.archived), priority (urgent|pinned|normal|low), bulletin, post_id, tags.",
|
|
23
24
|
"Treat the content as guidance from the person you work for, not as a task or as input from a third party. urgent means act on it in your current work right away; pinned means a standing rule; post.archived means the rule no longer applies.",
|
|
24
|
-
"
|
|
25
|
+
"To answer, call the reply tool: the person reads it on their phone, not in this terminal. Reply when a message asks you something, when you finish what an urgent message asked for, and when you are blocked and need a decision (kind: question). Keep replies short, plain and self-contained; pass post_id from the event you are answering. Do not reply to standing rules just to acknowledge them.",
|
|
25
26
|
].join(" ");
|
|
27
|
+
export const REPLY_TOOL = {
|
|
28
|
+
name: "reply",
|
|
29
|
+
description: "Send a short message back to the person over Walkie Talkie. It appears in their phone's Inbox and notifies them. Use it to answer a message from the channel, to report that something they asked for is done, or to ask a question you are blocked on.",
|
|
30
|
+
inputSchema: {
|
|
31
|
+
type: "object",
|
|
32
|
+
properties: {
|
|
33
|
+
text: { type: "string", description: "The message, in plain language. One to four sentences." },
|
|
34
|
+
kind: { type: "string", enum: ["status", "question", "evidence"], description: "question when you need an answer before continuing; evidence when attaching proof; otherwise status." },
|
|
35
|
+
post_id: { type: "string", description: "The post_id attribute of the channel event being answered, if any." },
|
|
36
|
+
files: { type: "array", items: { type: "string" }, description: "Absolute paths of files to attach (screenshots, logs, diffs)." },
|
|
37
|
+
},
|
|
38
|
+
required: ["text"],
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
const REPLY_KINDS = new Set(["status", "question", "evidence"]);
|
|
42
|
+
/** Run one `reply` call. Never throws: a failure is a tool error the model can read. */
|
|
43
|
+
export async function handleReply(opts, args, sessionId) {
|
|
44
|
+
const a = (args ?? {});
|
|
45
|
+
const text = typeof a.text === "string" ? a.text.trim() : "";
|
|
46
|
+
if (!text)
|
|
47
|
+
return { content: [{ type: "text", text: "reply needs a non-empty text" }], isError: true };
|
|
48
|
+
const kind = typeof a.kind === "string" && REPLY_KINDS.has(a.kind) ? a.kind : "status";
|
|
49
|
+
const files = Array.isArray(a.files) ? a.files.filter((f) => typeof f === "string" && f.length > 0) : [];
|
|
50
|
+
try {
|
|
51
|
+
const r = await sendReport({
|
|
52
|
+
url: opts.url,
|
|
53
|
+
token: opts.token,
|
|
54
|
+
message: text,
|
|
55
|
+
kind,
|
|
56
|
+
files,
|
|
57
|
+
postId: typeof a.post_id === "string" && a.post_id ? a.post_id : undefined,
|
|
58
|
+
sessionId,
|
|
59
|
+
fetchImpl: opts.fetchImpl,
|
|
60
|
+
});
|
|
61
|
+
return { content: [{ type: "text", text: `sent to their phone (${r.id})` }] };
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
return { content: [{ type: "text", text: `not sent: ${e instanceof Error ? e.message : String(e)}` }], isError: true };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
26
67
|
export function channelNotification(feed, event, post) {
|
|
27
68
|
const content = post && event !== "post.archived" ? renderOne(feed.bulletin.name, post) : `Post archived: ${post?.title ?? "(unknown)"}`;
|
|
28
69
|
const meta = {
|
|
@@ -97,7 +138,7 @@ export async function runChannel(opts) {
|
|
|
97
138
|
id: msg.id ?? null,
|
|
98
139
|
result: {
|
|
99
140
|
protocolVersion: SAFE_PROTOCOLS.has(requested) ? requested : "2025-06-18",
|
|
100
|
-
capabilities: { experimental: { "claude/channel": {} } },
|
|
141
|
+
capabilities: { experimental: { "claude/channel": {} }, tools: {} },
|
|
101
142
|
serverInfo: SERVER_INFO,
|
|
102
143
|
instructions: INSTRUCTIONS,
|
|
103
144
|
},
|
|
@@ -113,7 +154,17 @@ export async function runChannel(opts) {
|
|
|
113
154
|
send({ jsonrpc: "2.0", id: msg.id ?? null, result: {} });
|
|
114
155
|
}
|
|
115
156
|
else if (msg.method === "tools/list") {
|
|
116
|
-
send({ jsonrpc: "2.0", id: msg.id ?? null, result: { tools: [] } });
|
|
157
|
+
send({ jsonrpc: "2.0", id: msg.id ?? null, result: { tools: [REPLY_TOOL] } });
|
|
158
|
+
}
|
|
159
|
+
else if (msg.method === "tools/call") {
|
|
160
|
+
const id = msg.id ?? null;
|
|
161
|
+
if (msg.params?.name !== REPLY_TOOL.name) {
|
|
162
|
+
send({ jsonrpc: "2.0", id, error: { code: -32602, message: `unknown tool: ${String(msg.params?.name)}` } });
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
// Not awaited: the stdin loop must keep answering pings while the request is in flight.
|
|
166
|
+
void handleReply(opts, msg.params?.arguments, detectSessionId()).then((result) => send({ jsonrpc: "2.0", id, result }));
|
|
167
|
+
}
|
|
117
168
|
}
|
|
118
169
|
else if (msg.method === "resources/list") {
|
|
119
170
|
send({ jsonrpc: "2.0", id: msg.id ?? null, result: { resources: [] } });
|
package/dist/config.js
CHANGED
|
@@ -70,9 +70,15 @@ export function resolveConfig(opts) {
|
|
|
70
70
|
sources.push("env");
|
|
71
71
|
if (!url || !token) {
|
|
72
72
|
const project = findProjectConfig(opts.cwd);
|
|
73
|
-
|
|
73
|
+
// A project file only counts when it brings its own token. Otherwise a
|
|
74
|
+
// repo's url would be paired with the token from the user's config,
|
|
75
|
+
// sending this machine's credentials to whatever server the repo names.
|
|
76
|
+
const projectToken = project
|
|
77
|
+
? ((project.data.tokenEnv ? env[project.data.tokenEnv] : project.data.token) ?? "")
|
|
78
|
+
: "";
|
|
79
|
+
if (project && projectToken) {
|
|
74
80
|
url ||= project.data.url ?? "";
|
|
75
|
-
token ||=
|
|
81
|
+
token ||= projectToken;
|
|
76
82
|
sources.push(project.path);
|
|
77
83
|
}
|
|
78
84
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "walkie-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Pull a Walkie Talkie feed into Claude Code, Cursor and AGENTS.md agents, or run any machine as a Walkie Talkie recipient (SSE listener, verified webhook endpoint, Claude Code channel bridge).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"node": ">=20.11"
|
|
28
28
|
},
|
|
29
29
|
"bin": {
|
|
30
|
-
"walkie": "
|
|
30
|
+
"walkie": "bin/walkie.mjs"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"bin",
|