@vs4vijay/piverse 0.1.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/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # Piverse
2
+
3
+ A multi-extension ecosystem for the [Pi coding agent](https://github.com/earendil-works/pi).
4
+
5
+ ## Install
6
+
7
+ **All extensions:**
8
+
9
+ ```bash
10
+ pi install npm:@vs4vijay/piverse
11
+ ```
12
+
13
+ **Individual extensions:**
14
+
15
+ ```bash
16
+ pi install npm:@vs4vijay/pi-queue
17
+ ```
18
+
19
+ **From git (latest):**
20
+
21
+ ```bash
22
+ pi install git:github.com/vs4vijay/piverse
23
+ ```
24
+
25
+ ## Extensions
26
+
27
+ | Extension | Package | Description |
28
+ |-----------|---------|-------------|
29
+ | [pi-queue](./extensions/pi-queue) | `@vs4vijay/pi-queue` | Queue messages to run after the current turn settles |
30
+
31
+ ## Development
32
+
33
+ ### Quick test (single extension)
34
+
35
+ ```bash
36
+ pi -e ./extensions/pi-queue/src/index.ts
37
+ ```
38
+
39
+ ### Hot-reload via symlink
40
+
41
+ Link an extension into Pi's auto-discovery directory:
42
+
43
+ ```bash
44
+ ln -sf ~/GitHub/piverse/extensions/pi-queue ~/.pi/agent/extensions/pi-queue
45
+ ```
46
+
47
+ Then `/reload` inside Pi to pick up changes.
48
+
49
+ ### Type checking
50
+
51
+ ```bash
52
+ npm run typecheck
53
+ ```
54
+
55
+ ## Structure
56
+
57
+ ```
58
+ piverse/
59
+ ├── extensions/
60
+ │ ├── pi-queue/ # /queue - message queueing
61
+ │ └── ... # future extensions
62
+ ├── package.json # pi-package root
63
+ └── tsconfig.json # shared type checking
64
+ ```
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@vs4vijay/pi-queue",
3
+ "version": "0.1.0",
4
+ "description": "Queue messages to run after the current Pi session turn settles",
5
+ "type": "module",
6
+ "keywords": ["pi-package"],
7
+ "pi": {
8
+ "extensions": ["./src/index.ts"]
9
+ },
10
+ "scripts": {
11
+ "typecheck": "tsc --noEmit"
12
+ },
13
+ "peerDependencies": {
14
+ "@earendil-works/pi-coding-agent": "*"
15
+ }
16
+ }
@@ -0,0 +1,52 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+
3
+ export default function (pi: ExtensionAPI) {
4
+ let queue: string[] = [];
5
+
6
+ pi.registerCommand("queue", {
7
+ description: "Queue a message to send after the current turn settles. No args = show queue.",
8
+ handler: async (args, ctx) => {
9
+ if (!args.trim()) {
10
+ if (queue.length === 0) {
11
+ ctx.ui.notify("Queue is empty. /queue <message> to add.", "info");
12
+ } else {
13
+ const display = queue.map((m, i) => `${i + 1}. ${m}`).join("\n");
14
+ ctx.ui.notify(`Queued (${queue.length}):\n${display}`, "info");
15
+ }
16
+ return;
17
+ }
18
+ queue.push(args.trim());
19
+ ctx.ui.notify(`Queued #${queue.length}: "${args.trim()}"`, "info");
20
+ },
21
+ });
22
+
23
+ pi.registerCommand("queue-clear", {
24
+ description: "Clear all queued messages",
25
+ handler: async (_args, ctx) => {
26
+ const count = queue.length;
27
+ queue = [];
28
+ ctx.ui.notify(count ? `Cleared ${count} queued message(s)` : "Queue already empty", "info");
29
+ },
30
+ });
31
+
32
+ pi.on("agent_settled", async () => {
33
+ if (queue.length === 0) return;
34
+ const next = queue.shift()!;
35
+ pi.sendUserMessage(next);
36
+ });
37
+
38
+ pi.on("session_start", async (_event, ctx) => {
39
+ queue = [];
40
+ for (const entry of ctx.sessionManager.getEntries()) {
41
+ if (entry.type === "custom" && entry.customType === "piverse-queue-state") {
42
+ queue = (entry.data as { queue: string[] }).queue ?? [];
43
+ }
44
+ }
45
+ });
46
+
47
+ pi.on("session_shutdown", async () => {
48
+ if (queue.length > 0) {
49
+ pi.appendEntry("piverse-queue-state", { queue });
50
+ }
51
+ });
52
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@vs4vijay/piverse",
3
+ "version": "0.1.0",
4
+ "description": "A multi-extension ecosystem for the Pi coding agent",
5
+ "keywords": ["pi-package"],
6
+ "type": "module",
7
+ "pi": {
8
+ "extensions": ["./extensions/pi-queue/src/index.ts"]
9
+ },
10
+ "scripts": {
11
+ "typecheck": "tsc --noEmit"
12
+ },
13
+ "peerDependencies": {
14
+ "@earendil-works/pi-coding-agent": "*",
15
+ "typebox": "*"
16
+ },
17
+ "devDependencies": {
18
+ "typescript": "^5.0.0"
19
+ }
20
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "noEmit": true,
8
+ "skipLibCheck": true,
9
+ "esModuleInterop": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "verbatimModuleSyntax": true
13
+ },
14
+ "include": ["extensions/*/src/**/*.ts"]
15
+ }