@overmux/pi 0.0.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 +118 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +40 -0
- package/dist/cli.js.map +1 -0
- package/dist/config-2jNv4tol.d.ts +34 -0
- package/dist/config-2jNv4tol.d.ts.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +47 -0
- package/dist/config.js.map +1 -0
- package/dist/extension.d.ts +19 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +265 -0
- package/dist/extension.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/jsonl-tail.d.ts +13 -0
- package/dist/jsonl-tail.d.ts.map +1 -0
- package/dist/jsonl-tail.js +83 -0
- package/dist/jsonl-tail.js.map +1 -0
- package/dist/live-events-ClhFOMGW.js +497 -0
- package/dist/live-events-ClhFOMGW.js.map +1 -0
- package/dist/live-events-DAmf6RRx.d.ts +107 -0
- package/dist/live-events-DAmf6RRx.d.ts.map +1 -0
- package/dist/live-events.d.ts +2 -0
- package/dist/live-events.js +2 -0
- package/dist/notification-DzOd9cRc.d.ts +20 -0
- package/dist/notification-DzOd9cRc.d.ts.map +1 -0
- package/dist/notification.d.ts +2 -0
- package/dist/notification.js +54 -0
- package/dist/notification.js.map +1 -0
- package/dist/plugin.d.ts +90 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +213 -0
- package/dist/plugin.js.map +1 -0
- package/dist/projection.d.ts +101 -0
- package/dist/projection.d.ts.map +1 -0
- package/dist/projection.js +550 -0
- package/dist/projection.js.map +1 -0
- package/dist/protocol-CsrnSPOv.d.ts +115 -0
- package/dist/protocol-CsrnSPOv.d.ts.map +1 -0
- package/dist/protocol.d.ts +2 -0
- package/dist/protocol.js +365 -0
- package/dist/protocol.js.map +1 -0
- package/dist/react.d.ts +139 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +796 -0
- package/dist/react.js.map +1 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +4 -0
- package/dist/session-status-CZLTo8Km.d.ts +71 -0
- package/dist/session-status-CZLTo8Km.d.ts.map +1 -0
- package/dist/styles.css +619 -0
- package/docs/index.md +10 -0
- package/package.json +115 -0
- package/src/cli.ts +59 -0
- package/src/config.ts +87 -0
- package/src/extension.ts +486 -0
- package/src/index.ts +14 -0
- package/src/jsonl-tail.ts +110 -0
- package/src/live-events.ts +578 -0
- package/src/notification.ts +109 -0
- package/src/plugin.ts +369 -0
- package/src/projection.ts +995 -0
- package/src/protocol.ts +805 -0
- package/src/react.tsx +1293 -0
- package/src/server.ts +15 -0
- package/src/session-status.ts +379 -0
- package/src/styles.css +619 -0
package/package.json
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@overmux/pi",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Pi extension and private Unix-socket protocol for Overmux",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"overmux",
|
|
7
|
+
"pi-package"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://github.com/richardgill/overmux/tree/main/packages/ecosystem/pi",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/richardgill/overmux",
|
|
13
|
+
"directory": "packages/ecosystem/pi"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=24.20.0"
|
|
19
|
+
},
|
|
20
|
+
"bin": {
|
|
21
|
+
"overmux-pi-send": "./dist/cli.js"
|
|
22
|
+
},
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./config": {
|
|
29
|
+
"types": "./dist/config.d.ts",
|
|
30
|
+
"import": "./dist/config.js"
|
|
31
|
+
},
|
|
32
|
+
"./extension": {
|
|
33
|
+
"types": "./dist/extension.d.ts",
|
|
34
|
+
"import": "./dist/extension.js"
|
|
35
|
+
},
|
|
36
|
+
"./live-events": {
|
|
37
|
+
"types": "./dist/live-events.d.ts",
|
|
38
|
+
"import": "./dist/live-events.js"
|
|
39
|
+
},
|
|
40
|
+
"./protocol": {
|
|
41
|
+
"types": "./dist/protocol.d.ts",
|
|
42
|
+
"import": "./dist/protocol.js"
|
|
43
|
+
},
|
|
44
|
+
"./server": {
|
|
45
|
+
"types": "./dist/server.d.ts",
|
|
46
|
+
"import": "./dist/server.js"
|
|
47
|
+
},
|
|
48
|
+
"./plugin": {
|
|
49
|
+
"types": "./dist/plugin.d.ts",
|
|
50
|
+
"import": "./dist/plugin.js"
|
|
51
|
+
},
|
|
52
|
+
"./styles.css": "./dist/styles.css",
|
|
53
|
+
"./react": {
|
|
54
|
+
"types": "./dist/react.d.ts",
|
|
55
|
+
"import": "./dist/react.js"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"files": [
|
|
59
|
+
"dist",
|
|
60
|
+
"docs",
|
|
61
|
+
"src",
|
|
62
|
+
"!src/**/*.test.*",
|
|
63
|
+
"!src/**/fixtures",
|
|
64
|
+
"!src/**/testing",
|
|
65
|
+
"README.md"
|
|
66
|
+
],
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"@richardgill/pi-config": "0.0.8",
|
|
69
|
+
"@shikijs/langs": "4.4.3",
|
|
70
|
+
"@shikijs/themes": "4.4.3",
|
|
71
|
+
"jsonc-parser": "3.3.1",
|
|
72
|
+
"lucide-react": "1.32.0",
|
|
73
|
+
"react-markdown": "10.1.0",
|
|
74
|
+
"shiki": "4.4.3",
|
|
75
|
+
"zod": "4.4.3",
|
|
76
|
+
"@overmux/git": "0.0.1"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@types/react": "19.2.17",
|
|
80
|
+
"@types/react-dom": "19.2.3",
|
|
81
|
+
"happy-dom": "20.11.6",
|
|
82
|
+
"react": "19.2.3",
|
|
83
|
+
"react-dom": "19.2.3",
|
|
84
|
+
"vitest": "4.1.10",
|
|
85
|
+
"overmux": "0.0.1"
|
|
86
|
+
},
|
|
87
|
+
"peerDependencies": {
|
|
88
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
89
|
+
"@earendil-works/pi-tui": "*",
|
|
90
|
+
"overmux": "^0.0.1",
|
|
91
|
+
"react": "^19.0.0"
|
|
92
|
+
},
|
|
93
|
+
"peerDependenciesMeta": {
|
|
94
|
+
"@earendil-works/pi-coding-agent": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"@earendil-works/pi-tui": {
|
|
98
|
+
"optional": true
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"pi": {
|
|
102
|
+
"extensions": [
|
|
103
|
+
"./dist/index.js"
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"publishConfig": {
|
|
107
|
+
"access": "public"
|
|
108
|
+
},
|
|
109
|
+
"scripts": {
|
|
110
|
+
"build": "rm -rf dist && vp pack && cp src/styles.css dist/styles.css",
|
|
111
|
+
"overmux-pi-send": "node dist/cli.js",
|
|
112
|
+
"test": "vitest run",
|
|
113
|
+
"typecheck": "tsc --noEmit"
|
|
114
|
+
}
|
|
115
|
+
}
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
|
|
5
|
+
import { sendUserMessage } from "./protocol.js";
|
|
6
|
+
|
|
7
|
+
type CliInput = {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
deliverAs: "steer" | "followUp";
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const usage = (): string =>
|
|
14
|
+
"Usage: overmux-pi-send <sessionId> [--after-turn|--follow-up] <message>\n";
|
|
15
|
+
|
|
16
|
+
const parseInput = (args: string[]): CliInput | undefined => {
|
|
17
|
+
const [sessionId, ...rest] = args;
|
|
18
|
+
if (!sessionId) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
const followUp = rest.at(0) === "--follow-up";
|
|
22
|
+
const afterTurn = rest.at(0) === "--after-turn";
|
|
23
|
+
const message = rest
|
|
24
|
+
.slice(followUp || afterTurn ? 1 : 0)
|
|
25
|
+
.join(" ")
|
|
26
|
+
.trim();
|
|
27
|
+
return { sessionId, deliverAs: followUp ? "followUp" : "steer", message };
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const readMessage = async (message: string): Promise<string> =>
|
|
31
|
+
message ||
|
|
32
|
+
(process.stdin.isTTY ? "" : (await readFile("/dev/stdin", "utf8")).trim());
|
|
33
|
+
|
|
34
|
+
const main = async (): Promise<void> => {
|
|
35
|
+
const input = parseInput(process.argv.slice(2));
|
|
36
|
+
if (!input) {
|
|
37
|
+
throw new Error(usage());
|
|
38
|
+
}
|
|
39
|
+
const message = await readMessage(input.message);
|
|
40
|
+
if (!message) {
|
|
41
|
+
throw new Error(usage());
|
|
42
|
+
}
|
|
43
|
+
const response = await sendUserMessage(input.sessionId, {
|
|
44
|
+
requestId: randomUUID(),
|
|
45
|
+
message,
|
|
46
|
+
deliverAs: input.deliverAs,
|
|
47
|
+
});
|
|
48
|
+
if (!response?.ok) {
|
|
49
|
+
throw new Error(JSON.stringify(response ?? { error: "unavailable" }));
|
|
50
|
+
}
|
|
51
|
+
process.stdout.write(`${JSON.stringify(response)}\n`);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
void main().catch((error: unknown) => {
|
|
55
|
+
process.stderr.write(
|
|
56
|
+
`${error instanceof Error ? error.message : String(error)}\n`,
|
|
57
|
+
);
|
|
58
|
+
process.exitCode = 1;
|
|
59
|
+
});
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { isAbsolute } from "node:path";
|
|
2
|
+
|
|
3
|
+
import { templatedString } from "@richardgill/pi-config";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
export const DEFAULT_OVERMUX_PI_CONFIG = {
|
|
7
|
+
inspectionCommand: [
|
|
8
|
+
"pi-jq",
|
|
9
|
+
"{{childSessionId}}",
|
|
10
|
+
"--messages",
|
|
11
|
+
"3",
|
|
12
|
+
"--role",
|
|
13
|
+
"assistant",
|
|
14
|
+
],
|
|
15
|
+
inspectionTimeoutMs: 5000,
|
|
16
|
+
supervisionPrompt: "Continue supervision.",
|
|
17
|
+
liveEventsDir: null,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const InspectionArgumentSchema = templatedString({
|
|
21
|
+
variables: ["childSessionId"],
|
|
22
|
+
missing: "keep",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const InspectionCommandSchema = z
|
|
26
|
+
.array(InspectionArgumentSchema)
|
|
27
|
+
.min(1)
|
|
28
|
+
.refine(
|
|
29
|
+
(command) =>
|
|
30
|
+
command.reduce(
|
|
31
|
+
(count, argument) =>
|
|
32
|
+
count + argument.split("{{childSessionId}}").length - 1,
|
|
33
|
+
0,
|
|
34
|
+
) === 1,
|
|
35
|
+
"must contain exactly one {{childSessionId}} placeholder",
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const InspectionTimeoutSchema = z.number().int().positive().max(60_000);
|
|
39
|
+
const SupervisionPromptSchema = z.string();
|
|
40
|
+
const LiveEventsDirSchema = z
|
|
41
|
+
.string()
|
|
42
|
+
.trim()
|
|
43
|
+
.min(1)
|
|
44
|
+
.refine(isAbsolute, "must be an absolute path")
|
|
45
|
+
.nullable();
|
|
46
|
+
|
|
47
|
+
const ConfigSchema = z
|
|
48
|
+
.object({
|
|
49
|
+
inspectionCommand: InspectionCommandSchema,
|
|
50
|
+
inspectionTimeoutMs: InspectionTimeoutSchema.default(
|
|
51
|
+
DEFAULT_OVERMUX_PI_CONFIG.inspectionTimeoutMs,
|
|
52
|
+
),
|
|
53
|
+
supervisionPrompt: SupervisionPromptSchema.default(
|
|
54
|
+
DEFAULT_OVERMUX_PI_CONFIG.supervisionPrompt,
|
|
55
|
+
),
|
|
56
|
+
liveEventsDir: LiveEventsDirSchema.default(
|
|
57
|
+
DEFAULT_OVERMUX_PI_CONFIG.liveEventsDir,
|
|
58
|
+
),
|
|
59
|
+
})
|
|
60
|
+
.strict();
|
|
61
|
+
|
|
62
|
+
const DefaultConfigSchema = z
|
|
63
|
+
.object({
|
|
64
|
+
inspectionCommand: z.undefined().optional(),
|
|
65
|
+
inspectionTimeoutMs: InspectionTimeoutSchema.optional(),
|
|
66
|
+
supervisionPrompt: SupervisionPromptSchema.optional(),
|
|
67
|
+
liveEventsDir: LiveEventsDirSchema.optional(),
|
|
68
|
+
})
|
|
69
|
+
.strict()
|
|
70
|
+
.transform((config) => ({
|
|
71
|
+
inspectionCommand: [...DEFAULT_OVERMUX_PI_CONFIG.inspectionCommand],
|
|
72
|
+
inspectionTimeoutMs:
|
|
73
|
+
config.inspectionTimeoutMs ??
|
|
74
|
+
DEFAULT_OVERMUX_PI_CONFIG.inspectionTimeoutMs,
|
|
75
|
+
supervisionPrompt:
|
|
76
|
+
config.supervisionPrompt ?? DEFAULT_OVERMUX_PI_CONFIG.supervisionPrompt,
|
|
77
|
+
liveEventsDir:
|
|
78
|
+
config.liveEventsDir ?? DEFAULT_OVERMUX_PI_CONFIG.liveEventsDir,
|
|
79
|
+
}));
|
|
80
|
+
|
|
81
|
+
export const OvermuxPiConfigSchema = z.union([
|
|
82
|
+
ConfigSchema,
|
|
83
|
+
DefaultConfigSchema,
|
|
84
|
+
]);
|
|
85
|
+
|
|
86
|
+
export type OvermuxPiConfig = z.output<typeof OvermuxPiConfigSchema>;
|
|
87
|
+
export type OvermuxPiConfigInput = z.input<typeof OvermuxPiConfigSchema>;
|