@topce/pizx 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.
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Π (capital pi) — pi-coding-agent as a zx-style template tag.
3
+ *
4
+ * Usage:
5
+ * await Π`fix the TypeScript errors in src/`
6
+ * await Π({ tools: ['read', 'bash', 'edit'], cwd: './subproject' })`refactor auth`
7
+ * await Π.quiet()`update import paths`
8
+ */
9
+ import { type CreateAgentSessionOptions } from '@earendil-works/pi-coding-agent';
10
+ export interface AgentOptions extends Partial<CreateAgentSessionOptions> {
11
+ /** Suppress progress output */
12
+ quiet?: boolean;
13
+ /** Maximum tool-call cycles (safety limit) */
14
+ maxTurns?: number;
15
+ /** Instruction text to inject as system prompt */
16
+ instruction?: string;
17
+ }
18
+ export declare class AgentOutput {
19
+ /** Final text response from the agent */
20
+ readonly text: string;
21
+ /** Number of tool-call rounds */
22
+ readonly turnCount: number;
23
+ /** Start time (ms) */
24
+ readonly startTime: number;
25
+ /** End time (ms) */
26
+ readonly endTime: number;
27
+ constructor(
28
+ /** Final text response from the agent */
29
+ text: string,
30
+ /** Number of tool-call rounds */
31
+ turnCount?: number,
32
+ /** Start time (ms) */
33
+ startTime?: number,
34
+ /** End time (ms) */
35
+ endTime?: number);
36
+ get duration(): number;
37
+ toString(): string;
38
+ valueOf(): string;
39
+ [Symbol.toPrimitive](): string;
40
+ }
41
+ export declare class AgentPromise extends Promise<AgentOutput> {
42
+ }
43
+ export interface AgentTag {
44
+ (pieces: TemplateStringsArray, ...args: unknown[]): AgentPromise;
45
+ (opts: Partial<AgentOptions>): AgentTag;
46
+ quiet: AgentTag;
47
+ }
48
+ /** Π tag — run pi-coding-agent with tools */
49
+ export declare const Π: AgentTag;
50
+ /**
51
+ * Configure Π defaults.
52
+ */
53
+ export declare function configureAgent(opts: Partial<AgentOptions>): void;
54
+ /**
55
+ * Close the shared agent session. Call at end of script for cleanup.
56
+ */
57
+ export declare function closeAgent(): Promise<void>;
58
+ //# sourceMappingURL=pi-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi-agent.d.ts","sourceRoot":"","sources":["../src/pi-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAsB,KAAK,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAKpG,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,yBAAyB,CAAC;IACtE,+BAA+B;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AASD,qBAAa,WAAW;IAEpB,yCAAyC;aACzB,IAAI,EAAE,MAAM;IAC5B,iCAAiC;aACjB,SAAS,EAAE,MAAM;IACjC,sBAAsB;aACN,SAAS,EAAE,MAAM;IACjC,oBAAoB;aACJ,OAAO,EAAE,MAAM;;IAP/B,yCAAyC;IACzB,IAAI,EAAE,MAAM;IAC5B,iCAAiC;IACjB,SAAS,GAAE,MAAU;IACrC,sBAAsB;IACN,SAAS,GAAE,MAAmB;IAC9C,oBAAoB;IACJ,OAAO,GAAE,MAAmB;IAG9C,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,QAAQ,IAAI,MAAM;IAIlB,OAAO,IAAI,MAAM;IAIjB,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM;CAG/B;AAID,qBAAa,YAAa,SAAQ,OAAO,CAAC,WAAW,CAAC;CAAG;AAmFzD,MAAM,WAAW,QAAQ;IACvB,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,YAAY,CAAA;IAChE,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAA;IACvC,KAAK,EAAE,QAAQ,CAAA;CAChB;AA6BD,6CAA6C;AAC7C,eAAO,MAAM,CAAC,EAAE,QAA2B,CAAA;AAE3C;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAEhE;AAED;;GAEG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAMhD"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * PiOutput — the result object returned by the π tag.
3
+ * Patterned after zx's ProcessOutput.
4
+ */
5
+ export declare class PiOutput {
6
+ /** Full AI response text */
7
+ readonly text: string;
8
+ /** The model id that produced this output */
9
+ readonly modelUsed: string;
10
+ /** Raw streaming events from pi-ai */
11
+ readonly events: readonly unknown[];
12
+ /** Start timestamp (ms) */
13
+ readonly startTime: number;
14
+ /** End timestamp (ms) */
15
+ readonly endTime: number;
16
+ constructor(
17
+ /** Full AI response text */
18
+ text: string,
19
+ /** The model id that produced this output */
20
+ modelUsed: string,
21
+ /** Raw streaming events from pi-ai */
22
+ events?: readonly unknown[],
23
+ /** Start timestamp (ms) */
24
+ startTime?: number,
25
+ /** End timestamp (ms) */
26
+ endTime?: number);
27
+ /** Duration in milliseconds */
28
+ get duration(): number;
29
+ toString(): string;
30
+ valueOf(): string;
31
+ [Symbol.toPrimitive](): string;
32
+ /** Number of characters in output */
33
+ get length(): number;
34
+ /** Number of lines in output */
35
+ get lines(): number;
36
+ }
37
+ //# sourceMappingURL=pi-output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi-output.d.ts","sourceRoot":"","sources":["../src/pi-output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,qBAAa,QAAQ;IAEjB,4BAA4B;aACZ,IAAI,EAAE,MAAM;IAC5B,6CAA6C;aAC7B,SAAS,EAAE,MAAM;IACjC,sCAAsC;aACtB,MAAM,EAAE,SAAS,OAAO,EAAE;IAC1C,2BAA2B;aACX,SAAS,EAAE,MAAM;IACjC,yBAAyB;aACT,OAAO,EAAE,MAAM;;IAT/B,4BAA4B;IACZ,IAAI,EAAE,MAAM;IAC5B,6CAA6C;IAC7B,SAAS,EAAE,MAAM;IACjC,sCAAsC;IACtB,MAAM,GAAE,SAAS,OAAO,EAAO;IAC/C,2BAA2B;IACX,SAAS,GAAE,MAAmB;IAC9C,yBAAyB;IACT,OAAO,GAAE,MAAmB;IAG9C,+BAA+B;IAC/B,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,QAAQ,IAAI,MAAM;IAIlB,OAAO,IAAI,MAAM;IAIjB,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM;IAI9B,qCAAqC;IACrC,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,gCAAgC;IAChC,IAAI,KAAK,IAAI,MAAM,CAElB;CACF"}
package/dist/pi.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * π (small pi) — pi-ai text generation as a zx-style template tag.
3
+ *
4
+ * const answer = await π`what is 7! + 5?`
5
+ * const answer = await π({ model: 'anthropic/claude-sonnet-4-5' })`explain`
6
+ * const answer = await π.quiet()`generate JSON`
7
+ * for await (const c of π.stream`tell me a story`) { process.stdout.write(c) }
8
+ */
9
+ import { type StreamSimpleOptions } from '@earendil-works/pi-ai';
10
+ import { PiOutput } from './pi-output.ts';
11
+ export interface PiOptions {
12
+ model?: string;
13
+ thinkingLevel?: StreamSimpleOptions['thinkingLevel'];
14
+ quiet?: boolean;
15
+ system?: string;
16
+ maxTokens?: number;
17
+ }
18
+ export declare class PiPromise extends Promise<PiOutput> {
19
+ private _modelId;
20
+ constructor(fn: (r: (v: PiOutput) => void, rj: (e: unknown) => void) => void, modelId?: string);
21
+ get modelUsed(): string;
22
+ }
23
+ type PiFn = {
24
+ (pieces: TemplateStringsArray, ...args: unknown[]): PiPromise;
25
+ (opts: Partial<PiOptions>): PiFn;
26
+ quiet: PiFn;
27
+ stream(pieces: TemplateStringsArray, ...args: unknown[]): AsyncGenerator<string>;
28
+ };
29
+ /** π template tag — call pi-ai for text generation */
30
+ export declare const π: PiFn;
31
+ export declare function configurePi(opts: Partial<PiOptions>): void;
32
+ export {};
33
+ //# sourceMappingURL=pi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../src/pi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAGL,KAAK,mBAAmB,EAGzB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAA;IACpD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AA8ED,qBAAa,SAAU,SAAQ,OAAO,CAAC,QAAQ,CAAC;IAC9C,OAAO,CAAC,QAAQ,CAAK;gBACT,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM;IAI9F,IAAI,SAAS,WAA2B;CACzC;AAID,KAAK,IAAI,GAAG;IACV,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,SAAS,CAAA;IAC7D,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;IAChC,KAAK,EAAE,IAAI,CAAA;IACX,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;CACjF,CAAA;AAqCD,sDAAsD;AACtD,eAAO,MAAM,CAAC,EAAE,IAAe,CAAA;AAE/B,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAE1D"}
package/package.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "@topce/pizx",
3
+ "version": "0.1.0",
4
+ "description": "zx fork with native Pi AI integration — π (pi-ai), Π (pi-coding-agent), and agent pattern template tags (Ρ Φ Σ Δ Λ Ψ Ω)",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./globals": {
15
+ "types": "./dist/globals.d.ts",
16
+ "import": "./dist/globals.js",
17
+ "default": "./dist/globals.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "bin": {
22
+ "pizx": "dist/cli.js"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "skill.sh",
27
+ "README.md"
28
+ ],
29
+ "scripts": {
30
+ "build": "npm run build:js && npm run build:dts",
31
+ "build:js": "node scripts/build.mjs",
32
+ "build:dts": "tsc --project tsconfig.build.json",
33
+ "dev": "node scripts/build.mjs --watch",
34
+ "check": "biome check --write src/",
35
+ "test": "vitest --run",
36
+ "test:integration": "PIZX_INTEGRATION=1 vitest --run",
37
+ "prepublishOnly": "npm run build",
38
+ "example:hello": "node dist/cli.js examples/hello-pizx.mjs",
39
+ "example:pi": "node dist/cli.js examples/basic-pi.mjs",
40
+ "example:Pi": "node dist/cli.js examples/basic-capital-pi.mjs",
41
+ "example:quick": "node dist/cli.js examples/quick-ask.mjs",
42
+ "example:ralph": "node dist/cli.js examples/ralph-loop.mjs",
43
+ "example:pattern-ralph": "node dist/cli.js examples/pattern-ralph.mjs",
44
+ "example:pattern-fleet": "node dist/cli.js examples/pattern-fleet.mjs",
45
+ "example:pattern-subagent": "node dist/cli.js examples/pattern-subagent.mjs",
46
+ "example:pattern-debate": "node dist/cli.js examples/pattern-debate.mjs",
47
+ "example:pattern-pipeline": "node dist/cli.js examples/pattern-pipeline.mjs",
48
+ "example:pattern-critique": "node dist/cli.js examples/pattern-critique.mjs",
49
+ "example:pattern-orchestrator": "node dist/cli.js examples/pattern-orchestrator.mjs",
50
+ "example:all": "npm run example:hello && npm run example:pi && npm run example:Pi && npm run example:quick && npm run example:ralph && npm run example:pattern-ralph && npm run example:pattern-fleet && npm run example:pattern-subagent && npm run example:pattern-debate && npm run example:pattern-pipeline && npm run example:pattern-critique && npm run example:pattern-orchestrator && npm run example:pattern-thread && npm run example:pattern-memory && npm run example:pattern-broadcast && npm run example:pattern-adaptive && npm run example:pattern-graph && npm run example:pattern-nu && npm run example:pattern-chi && npm run example:pattern-tau && npm run example:five-whys"
51
+ ,
52
+ "example:pattern-thread": "node dist/cli.js examples/pattern-thread.mjs",
53
+ "example:pattern-memory": "node dist/cli.js examples/pattern-memory.mjs",
54
+ "example:pattern-broadcast": "node dist/cli.js examples/pattern-broadcast.mjs",
55
+ "example:pattern-adaptive": "node dist/cli.js examples/pattern-adaptive.mjs",
56
+ "example:pattern-graph": "node dist/cli.js examples/pattern-graph.mjs",
57
+ "example:pattern-nu": "node dist/cli.js examples/pattern-nu.mjs",
58
+ "example:pattern-chi": "node dist/cli.js examples/pattern-chi.mjs",
59
+ "example:pattern-tau": "node dist/cli.js examples/pattern-tau.mjs",
60
+ "example:five-whys": "node dist/cli.js examples/pattern-five-whys.mjs"
61
+
62
+ },
63
+ "keywords": [
64
+ "zx",
65
+ "pi",
66
+ "ai",
67
+ "pi-ai",
68
+ "pi-coding-agent",
69
+ "shell",
70
+ "script",
71
+ "cli",
72
+ "automation",
73
+ "llm"
74
+ ],
75
+ "author": "Slobodan Filipovic <topce@users.noreply.github.com>",
76
+ "license": "MIT",
77
+ "repository": {
78
+ "type": "git",
79
+ "url": "git+https://github.com/topce/pizx.git"
80
+ },
81
+ "engines": {
82
+ "node": ">=22.19.0"
83
+ },
84
+ "dependencies": {
85
+ "@earendil-works/pi-ai": "0.78.1",
86
+ "@earendil-works/pi-coding-agent": "0.78.1",
87
+ "zx": "8.8.5"
88
+ },
89
+ "devDependencies": {
90
+ "@biomejs/biome": "2.4.16",
91
+ "@types/node": "25.9.2",
92
+ "esbuild": "0.28.0",
93
+ "typescript": "6.0.3",
94
+ "vitest": "4.1.8"
95
+ }
96
+ }