cc-peer 1.6.0 → 1.6.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/dist/adapters/node/alias-worker.cjs +18 -8
- package/dist/adapters/node/alias-worker.mjs +18 -8
- package/dist/alias-pool.d.cts +1 -1
- package/dist/alias-pool.d.mts +1 -1
- package/dist/bin/cc-peer.cjs +1 -1
- package/dist/bin/cc-peer.mjs +1 -1
- package/dist/{cc-peer-BYqqGdh_.cjs → cc-peer-BvoaikwI.cjs} +1 -1
- package/dist/{cc-peer-BCixELiw.mjs → cc-peer-CQV4Qv_H.mjs} +1 -1
- package/dist/{cc-peer-B3i4ZlKV.d.cts → cc-peer-mYIVwlKe.d.cts} +3 -3
- package/dist/{cc-peer-B3i4ZlKV.d.mts → cc-peer-mYIVwlKe.d.mts} +3 -3
- package/dist/cc-peer.cjs +1 -1
- package/dist/cc-peer.d.cts +1 -1
- package/dist/cc-peer.d.mts +1 -1
- package/dist/cc-peer.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("../../rolldown-runtime-VH7oDXx4.cjs");
|
|
2
|
-
const require_cc_peer = require("../../cc-peer-
|
|
2
|
+
const require_cc_peer = require("../../cc-peer-BvoaikwI.cjs");
|
|
3
3
|
const require_errors = require("../../errors-BAbklcGw.cjs");
|
|
4
4
|
const require_alias_ipc = require("../../alias-ipc-BPc2wfmz.cjs");
|
|
5
5
|
let node_process = require("node:process");
|
|
@@ -12,11 +12,21 @@ let peer;
|
|
|
12
12
|
node_process.default.on("message", (raw) => {
|
|
13
13
|
handleCommand(raw);
|
|
14
14
|
});
|
|
15
|
+
node_process.default.on("disconnect", () => {
|
|
16
|
+
shutdown();
|
|
17
|
+
});
|
|
18
|
+
async function shutdown() {
|
|
19
|
+
await peer?.stop();
|
|
20
|
+
node_process.default.exit(0);
|
|
21
|
+
}
|
|
22
|
+
/** Relays an event to the parent unless its channel has already closed, since a send on a closed channel raises an error event on the process that nothing handles. */
|
|
23
|
+
function relay(message) {
|
|
24
|
+
if (node_process.default.connected) node_process.default.send?.(message);
|
|
25
|
+
}
|
|
15
26
|
async function handleCommand(raw) {
|
|
16
27
|
if (!require_alias_ipc.AliasCommandSchema.is(raw)) return;
|
|
17
28
|
if (raw.type === "stop") {
|
|
18
|
-
await
|
|
19
|
-
node_process.default.exit(0);
|
|
29
|
+
await shutdown();
|
|
20
30
|
return;
|
|
21
31
|
}
|
|
22
32
|
if (raw.type === "send") {
|
|
@@ -37,17 +47,17 @@ async function handleCommand(raw) {
|
|
|
37
47
|
}
|
|
38
48
|
peer = created;
|
|
39
49
|
peer.on("message", (message) => {
|
|
40
|
-
|
|
50
|
+
relay({
|
|
41
51
|
type: "message",
|
|
42
52
|
...message
|
|
43
53
|
});
|
|
44
54
|
});
|
|
45
|
-
|
|
55
|
+
relay({ type: "started" });
|
|
46
56
|
}
|
|
47
57
|
async function handleSend(command) {
|
|
48
58
|
const active = peer;
|
|
49
59
|
if (active === void 0) {
|
|
50
|
-
|
|
60
|
+
relay({
|
|
51
61
|
type: "send_failed",
|
|
52
62
|
requestId: command.requestId,
|
|
53
63
|
code: "NOT_STARTED",
|
|
@@ -57,13 +67,13 @@ async function handleSend(command) {
|
|
|
57
67
|
}
|
|
58
68
|
try {
|
|
59
69
|
const { msgId } = await active.send(command.target, command.body);
|
|
60
|
-
|
|
70
|
+
relay({
|
|
61
71
|
type: "sent",
|
|
62
72
|
requestId: command.requestId,
|
|
63
73
|
msgId
|
|
64
74
|
});
|
|
65
75
|
} catch (error) {
|
|
66
|
-
|
|
76
|
+
relay({
|
|
67
77
|
type: "send_failed",
|
|
68
78
|
requestId: command.requestId,
|
|
69
79
|
code: error instanceof require_errors.CcPeerError ? error.code : "UNKNOWN",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as CcPeer } from "../../cc-peer-
|
|
1
|
+
import { n as CcPeer } from "../../cc-peer-CQV4Qv_H.mjs";
|
|
2
2
|
import { r as CcPeerError } from "../../errors-KYBco8pU.mjs";
|
|
3
3
|
import { t as AliasCommandSchema } from "../../alias-ipc-BSh7Q4LL.mjs";
|
|
4
4
|
import process from "node:process";
|
|
@@ -10,11 +10,21 @@ let peer;
|
|
|
10
10
|
process.on("message", (raw) => {
|
|
11
11
|
handleCommand(raw);
|
|
12
12
|
});
|
|
13
|
+
process.on("disconnect", () => {
|
|
14
|
+
shutdown();
|
|
15
|
+
});
|
|
16
|
+
async function shutdown() {
|
|
17
|
+
await peer?.stop();
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
/** Relays an event to the parent unless its channel has already closed, since a send on a closed channel raises an error event on the process that nothing handles. */
|
|
21
|
+
function relay(message) {
|
|
22
|
+
if (process.connected) process.send?.(message);
|
|
23
|
+
}
|
|
13
24
|
async function handleCommand(raw) {
|
|
14
25
|
if (!AliasCommandSchema.is(raw)) return;
|
|
15
26
|
if (raw.type === "stop") {
|
|
16
|
-
await
|
|
17
|
-
process.exit(0);
|
|
27
|
+
await shutdown();
|
|
18
28
|
return;
|
|
19
29
|
}
|
|
20
30
|
if (raw.type === "send") {
|
|
@@ -35,17 +45,17 @@ async function handleCommand(raw) {
|
|
|
35
45
|
}
|
|
36
46
|
peer = created;
|
|
37
47
|
peer.on("message", (message) => {
|
|
38
|
-
|
|
48
|
+
relay({
|
|
39
49
|
type: "message",
|
|
40
50
|
...message
|
|
41
51
|
});
|
|
42
52
|
});
|
|
43
|
-
|
|
53
|
+
relay({ type: "started" });
|
|
44
54
|
}
|
|
45
55
|
async function handleSend(command) {
|
|
46
56
|
const active = peer;
|
|
47
57
|
if (active === void 0) {
|
|
48
|
-
|
|
58
|
+
relay({
|
|
49
59
|
type: "send_failed",
|
|
50
60
|
requestId: command.requestId,
|
|
51
61
|
code: "NOT_STARTED",
|
|
@@ -55,13 +65,13 @@ async function handleSend(command) {
|
|
|
55
65
|
}
|
|
56
66
|
try {
|
|
57
67
|
const { msgId } = await active.send(command.target, command.body);
|
|
58
|
-
|
|
68
|
+
relay({
|
|
59
69
|
type: "sent",
|
|
60
70
|
requestId: command.requestId,
|
|
61
71
|
msgId
|
|
62
72
|
});
|
|
63
73
|
} catch (error) {
|
|
64
|
-
|
|
74
|
+
relay({
|
|
65
75
|
type: "send_failed",
|
|
66
76
|
requestId: command.requestId,
|
|
67
77
|
code: error instanceof CcPeerError ? error.code : "UNKNOWN",
|
package/dist/alias-pool.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as InboundMessage, l as PathConfig, o as PeerRef } from "./cc-peer-
|
|
1
|
+
import { a as InboundMessage, l as PathConfig, o as PeerRef } from "./cc-peer-mYIVwlKe.cjs";
|
|
2
2
|
import { EventEmitter } from "node:events";
|
|
3
3
|
//#region src/ports/alias-process.d.ts
|
|
4
4
|
interface AliasStartOptions extends PathConfig {
|
package/dist/alias-pool.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as InboundMessage, l as PathConfig, o as PeerRef } from "./cc-peer-
|
|
1
|
+
import { a as InboundMessage, l as PathConfig, o as PeerRef } from "./cc-peer-mYIVwlKe.mjs";
|
|
2
2
|
import { EventEmitter } from "node:events";
|
|
3
3
|
//#region src/ports/alias-process.d.ts
|
|
4
4
|
interface AliasStartOptions extends PathConfig {
|
package/dist/bin/cc-peer.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_rolldown_runtime = require("../rolldown-runtime-VH7oDXx4.cjs");
|
|
3
|
-
const require_cc_peer = require("../cc-peer-
|
|
3
|
+
const require_cc_peer = require("../cc-peer-BvoaikwI.cjs");
|
|
4
4
|
const require_errors = require("../errors-BAbklcGw.cjs");
|
|
5
5
|
let node_crypto = require("node:crypto");
|
|
6
6
|
let zod = require("zod");
|
package/dist/bin/cc-peer.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as RegistryEntrySchema, n as CcPeer, r as PrioritySchema } from "../cc-peer-
|
|
2
|
+
import { i as RegistryEntrySchema, n as CcPeer, r as PrioritySchema } from "../cc-peer-CQV4Qv_H.mjs";
|
|
3
3
|
import { l as defineSchema } from "../errors-KYBco8pU.mjs";
|
|
4
4
|
import { randomBytes } from "node:crypto";
|
|
5
5
|
import { z } from "zod";
|
|
@@ -8,7 +8,7 @@ let zod = require("zod");
|
|
|
8
8
|
let node_os = require("node:os");
|
|
9
9
|
let node_child_process = require("node:child_process");
|
|
10
10
|
//#region package.json
|
|
11
|
-
var version = "1.6.
|
|
11
|
+
var version = "1.6.1";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/adapters/node/uds-transport.ts
|
|
14
14
|
/** macOS linger before close, matching the reference client's ~150ms. */
|
|
@@ -8,7 +8,7 @@ import { z } from "zod";
|
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
10
10
|
//#region package.json
|
|
11
|
-
var version = "1.6.
|
|
11
|
+
var version = "1.6.1";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/adapters/node/uds-transport.ts
|
|
14
14
|
/** macOS linger before close, matching the reference client's ~150ms. */
|
|
@@ -71,12 +71,12 @@ declare const RegistryEntrySchema: z.ZodObject<{
|
|
|
71
71
|
nameSince: z.ZodOptional<z.ZodNumber>;
|
|
72
72
|
updatedAt: z.ZodNumber;
|
|
73
73
|
status: z.ZodOptional<z.ZodEnum<{
|
|
74
|
-
idle: "idle";
|
|
75
74
|
busy: "busy";
|
|
76
75
|
shell: "shell";
|
|
76
|
+
idle: "idle";
|
|
77
77
|
waiting: "waiting";
|
|
78
78
|
}> & {
|
|
79
|
-
is(value: unknown): value is "
|
|
79
|
+
is(value: unknown): value is "busy" | "shell" | "idle" | "waiting";
|
|
80
80
|
}>;
|
|
81
81
|
statusUpdatedAt: z.ZodOptional<z.ZodNumber>;
|
|
82
82
|
bridgeSessionId: z.ZodOptional<z.ZodString>;
|
|
@@ -99,7 +99,7 @@ declare const RegistryEntrySchema: z.ZodObject<{
|
|
|
99
99
|
name?: string | undefined;
|
|
100
100
|
nameSource?: "user" | "peer" | "derived" | "collision" | "auto" | "hook" | undefined;
|
|
101
101
|
nameSince?: number | undefined;
|
|
102
|
-
status?: "
|
|
102
|
+
status?: "busy" | "shell" | "idle" | "waiting" | undefined;
|
|
103
103
|
statusUpdatedAt?: number | undefined;
|
|
104
104
|
bridgeSessionId?: string | undefined;
|
|
105
105
|
};
|
|
@@ -71,12 +71,12 @@ declare const RegistryEntrySchema: z.ZodObject<{
|
|
|
71
71
|
nameSince: z.ZodOptional<z.ZodNumber>;
|
|
72
72
|
updatedAt: z.ZodNumber;
|
|
73
73
|
status: z.ZodOptional<z.ZodEnum<{
|
|
74
|
-
idle: "idle";
|
|
75
74
|
busy: "busy";
|
|
76
75
|
shell: "shell";
|
|
76
|
+
idle: "idle";
|
|
77
77
|
waiting: "waiting";
|
|
78
78
|
}> & {
|
|
79
|
-
is(value: unknown): value is "
|
|
79
|
+
is(value: unknown): value is "busy" | "shell" | "idle" | "waiting";
|
|
80
80
|
}>;
|
|
81
81
|
statusUpdatedAt: z.ZodOptional<z.ZodNumber>;
|
|
82
82
|
bridgeSessionId: z.ZodOptional<z.ZodString>;
|
|
@@ -99,7 +99,7 @@ declare const RegistryEntrySchema: z.ZodObject<{
|
|
|
99
99
|
name?: string | undefined;
|
|
100
100
|
nameSource?: "user" | "peer" | "derived" | "collision" | "auto" | "hook" | undefined;
|
|
101
101
|
nameSince?: number | undefined;
|
|
102
|
-
status?: "
|
|
102
|
+
status?: "busy" | "shell" | "idle" | "waiting" | undefined;
|
|
103
103
|
statusUpdatedAt?: number | undefined;
|
|
104
104
|
bridgeSessionId?: string | undefined;
|
|
105
105
|
};
|
package/dist/cc-peer.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_cc_peer = require("./cc-peer-
|
|
2
|
+
const require_cc_peer = require("./cc-peer-BvoaikwI.cjs");
|
|
3
3
|
exports.CC_PEER_VERSION = require_cc_peer.CC_PEER_VERSION;
|
|
4
4
|
exports.CcPeer = require_cc_peer.CcPeer;
|
package/dist/cc-peer.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as InboundMessage, c as SendOptions, i as IdleNotice, n as CcPeer, o as PeerRef, r as CcPeerOptions, s as Receipt, t as CC_PEER_VERSION } from "./cc-peer-
|
|
1
|
+
import { a as InboundMessage, c as SendOptions, i as IdleNotice, n as CcPeer, o as PeerRef, r as CcPeerOptions, s as Receipt, t as CC_PEER_VERSION } from "./cc-peer-mYIVwlKe.cjs";
|
|
2
2
|
export { CC_PEER_VERSION, CcPeer, CcPeerOptions, IdleNotice, InboundMessage, PeerRef, Receipt, SendOptions };
|
package/dist/cc-peer.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as InboundMessage, c as SendOptions, i as IdleNotice, n as CcPeer, o as PeerRef, r as CcPeerOptions, s as Receipt, t as CC_PEER_VERSION } from "./cc-peer-
|
|
1
|
+
import { a as InboundMessage, c as SendOptions, i as IdleNotice, n as CcPeer, o as PeerRef, r as CcPeerOptions, s as Receipt, t as CC_PEER_VERSION } from "./cc-peer-mYIVwlKe.mjs";
|
|
2
2
|
export { CC_PEER_VERSION, CcPeer, CcPeerOptions, IdleNotice, InboundMessage, PeerRef, Receipt, SendOptions };
|
package/dist/cc-peer.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as CcPeer, t as CC_PEER_VERSION } from "./cc-peer-
|
|
1
|
+
import { n as CcPeer, t as CC_PEER_VERSION } from "./cc-peer-CQV4Qv_H.mjs";
|
|
2
2
|
export { CC_PEER_VERSION, CcPeer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-peer",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Communicate with local Claude Code instances over their native cross-session peer messaging: send and receive messages, register as a named discoverable peer, receipts, idle subscriptions, and a REST facade via `npx cc-peer`.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|