talking-stick 0.1.0-alpha → 0.1.0-alpha.1
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/README.md +4 -4
- package/dist/cli.js +0 -0
- package/dist/identity.js +32 -2
- package/dist/process-utils.js +8 -4
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@ An MCP coordination server that lets multiple AI coding agents share a single wo
|
|
|
9
9
|
Three commands from zero to coordinated agents. No repo clone required.
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
# 1. Install the `tt` binary
|
|
13
|
-
npm i -g
|
|
12
|
+
# 1. Install the `tt` binary from npm
|
|
13
|
+
npm i -g talking-stick
|
|
14
14
|
|
|
15
15
|
# 2. Register Talking Stick as an MCP server + install the coordination skill
|
|
16
16
|
# across every harness detected on your machine
|
|
@@ -27,8 +27,8 @@ That's it. The next time two agents `cd` into the same repo, they see each other
|
|
|
27
27
|
|
|
28
28
|
| Method | Command | Notes |
|
|
29
29
|
|---|---|---|
|
|
30
|
-
| **From
|
|
31
|
-
| **From
|
|
30
|
+
| **From npm** | `npm i -g talking-stick` | Published as `0.1.0-alpha`. Requires Node ≥ 22. |
|
|
31
|
+
| **From GitHub** | `npm i -g github:mostlydev/talking-stick` | Tracks the `master` branch; builds on install via the `prepare` hook. |
|
|
32
32
|
| **From source** | `git clone … && npm install && npm link` | For contributors. |
|
|
33
33
|
|
|
34
34
|
All three produce a `tt` binary on your `PATH`. Everything else below works identically.
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/identity.js
CHANGED
|
@@ -72,12 +72,16 @@ export function deriveMcpHarnessIdentity(options = {}) {
|
|
|
72
72
|
}
|
|
73
73
|
export function deriveHarnessCliIdentity(options = {}) {
|
|
74
74
|
const env = options.env ?? process.env;
|
|
75
|
-
const
|
|
75
|
+
const inspector = options.inspector ?? createSystemProcessInspector();
|
|
76
|
+
let signal = detectHarnessSignal(env);
|
|
77
|
+
if (!signal) {
|
|
78
|
+
const parentPid = options.parentPid ?? process.ppid;
|
|
79
|
+
signal = detectHarnessViaAncestry(parentPid, inspector);
|
|
80
|
+
}
|
|
76
81
|
if (!signal)
|
|
77
82
|
return null;
|
|
78
83
|
const parentPid = options.parentPid ?? process.ppid;
|
|
79
84
|
const hostId = options.hostId ?? os.hostname();
|
|
80
|
-
const inspector = options.inspector ?? createSystemProcessInspector();
|
|
81
85
|
const parentInspection = inspector.inspect(parentPid);
|
|
82
86
|
const username = options.username ?? safeUsername();
|
|
83
87
|
const sessionId = resolveHarnessSessionId(signal, env, parentPid, parentInspection, username, hostId);
|
|
@@ -130,6 +134,32 @@ function resolveTerminalSessionId(env) {
|
|
|
130
134
|
}
|
|
131
135
|
return null;
|
|
132
136
|
}
|
|
137
|
+
const HARNESS_COMMAND_MAPPING = {
|
|
138
|
+
claude: "claude",
|
|
139
|
+
"claude-code": "claude",
|
|
140
|
+
codex: "codex",
|
|
141
|
+
gemini: "gemini",
|
|
142
|
+
opencode: "opencode"
|
|
143
|
+
};
|
|
144
|
+
function detectHarnessViaAncestry(pid, inspector, maxDepth = 10) {
|
|
145
|
+
let currentPid = pid;
|
|
146
|
+
for (let i = 0; i < maxDepth; i++) {
|
|
147
|
+
if (currentPid === null || currentPid === 0 || currentPid === 1)
|
|
148
|
+
break;
|
|
149
|
+
const inspection = inspector.inspect(currentPid);
|
|
150
|
+
if (!inspection)
|
|
151
|
+
break;
|
|
152
|
+
const label = deriveCommandLabel(inspection.command);
|
|
153
|
+
if (HARNESS_COMMAND_MAPPING[label]) {
|
|
154
|
+
return {
|
|
155
|
+
harness: HARNESS_COMMAND_MAPPING[label],
|
|
156
|
+
sessionId: `pid:${inspection.pid}@${inspection.startTime}`
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
currentPid = inspection.ppid;
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
133
163
|
function detectHarnessSignal(env) {
|
|
134
164
|
if (env.CLAUDECODE === "1") {
|
|
135
165
|
return { harness: "claude", sessionId: nonEmpty(env.CLAUDE_CODE_EXECPATH) };
|
package/dist/process-utils.js
CHANGED
|
@@ -61,10 +61,14 @@ function inspectSystemProcess(pid, options) {
|
|
|
61
61
|
if (!output.trim()) {
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
const match = output.trimStart().match(/^(\d+)\s+(.{24})\s+(.*)$/);
|
|
65
|
+
if (!match) {
|
|
66
|
+
// Fallback for cases where output might differ
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const ppid = parseInt(match[1], 10);
|
|
70
|
+
const startTime = match[2].trim();
|
|
71
|
+
const command = match[3].trim();
|
|
68
72
|
return {
|
|
69
73
|
pid,
|
|
70
74
|
ppid: isNaN(ppid) ? null : ppid,
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "talking-stick",
|
|
3
|
-
"version": "0.1.0-alpha",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
4
|
"description": "MCP coordination server for path-scoped agent handoffs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"tt": "
|
|
7
|
+
"tt": "dist/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"exports": {
|
|
10
10
|
".": "./dist/index.js"
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"README.md"
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "tsc -p tsconfig.build.json",
|
|
20
|
-
"prepare": "tsc -p tsconfig.build.json",
|
|
19
|
+
"build": "tsc -p tsconfig.build.json && chmod +x dist/cli.js",
|
|
20
|
+
"prepare": "tsc -p tsconfig.build.json && chmod +x dist/cli.js",
|
|
21
21
|
"test": "vitest run",
|
|
22
22
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
23
23
|
},
|