@pi-harness/core 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/dist/boot.d.ts +13 -0
- package/dist/boot.d.ts.map +1 -0
- package/dist/boot.js +96 -0
- package/dist/boot.js.map +1 -0
- package/dist/context.d.ts +3 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +2 -0
- package/dist/context.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/model.d.ts +8 -0
- package/dist/plugins/model.d.ts.map +1 -0
- package/dist/plugins/model.js +12 -0
- package/dist/plugins/model.js.map +1 -0
- package/dist/plugins/models.d.ts +16 -0
- package/dist/plugins/models.d.ts.map +1 -0
- package/dist/plugins/models.js +24 -0
- package/dist/plugins/models.js.map +1 -0
- package/dist/plugins/resources.d.ts +18 -0
- package/dist/plugins/resources.d.ts.map +1 -0
- package/dist/plugins/resources.js +48 -0
- package/dist/plugins/resources.js.map +1 -0
- package/dist/plugins/runtime.d.ts +14 -0
- package/dist/plugins/runtime.d.ts.map +1 -0
- package/dist/plugins/runtime.js +68 -0
- package/dist/plugins/runtime.js.map +1 -0
- package/dist/plugins/session.d.ts +15 -0
- package/dist/plugins/session.d.ts.map +1 -0
- package/dist/plugins/session.js +20 -0
- package/dist/plugins/session.js.map +1 -0
- package/dist/plugins/stdio.d.ts +8 -0
- package/dist/plugins/stdio.d.ts.map +1 -0
- package/dist/plugins/stdio.js +20 -0
- package/dist/plugins/stdio.js.map +1 -0
- package/dist/plugins/tools.d.ts +13 -0
- package/dist/plugins/tools.d.ts.map +1 -0
- package/dist/plugins/tools.js +17 -0
- package/dist/plugins/tools.js.map +1 -0
- package/dist/profile.d.ts +8 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +28 -0
- package/dist/profile.js.map +1 -0
- package/dist/runtime.d.ts +16 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +33 -0
- package/dist/runtime.js.map +1 -0
- package/dist/services.d.ts +63 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/services.js +39 -0
- package/dist/services.js.map +1 -0
- package/dist/stdio.d.ts +25 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +74 -0
- package/dist/stdio.js.map +1 -0
- package/package.json +44 -0
- package/profiles/default/cordis.yml +35 -0
- package/profiles/development/cordis.yml +47 -0
package/dist/boot.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
export interface BootHarnessOptions {
|
|
3
|
+
configPath: string;
|
|
4
|
+
prepare?: (context: Context) => Promise<void> | void;
|
|
5
|
+
onFullReload?: () => void;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
}
|
|
8
|
+
export interface BootedHarness {
|
|
9
|
+
readonly context: Context;
|
|
10
|
+
dispose(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare function bootHarness(options: BootHarnessOptions): Promise<BootedHarness>;
|
|
13
|
+
//# sourceMappingURL=boot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAmB,MAAM,qBAAqB,CAAC;AAS/D,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACrD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAmDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC,CA8BrF"}
|
package/dist/boot.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { dirname, resolve } from "node:path";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
3
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
4
|
+
import Group from "@deepseek-ai/cordis-plugin-group";
|
|
5
|
+
import Include from "@deepseek-ai/cordis-plugin-include";
|
|
6
|
+
import Loader, {} from "@deepseek-ai/cordis-plugin-loader";
|
|
7
|
+
class ReadonlyInclude extends Include {
|
|
8
|
+
write() { }
|
|
9
|
+
}
|
|
10
|
+
const FIBER_PENDING = 0;
|
|
11
|
+
const FIBER_ACTIVE = 2;
|
|
12
|
+
const FIBER_FAILED = 3;
|
|
13
|
+
function formatError(error) {
|
|
14
|
+
return error instanceof Error ? error.stack ?? error.message : String(error);
|
|
15
|
+
}
|
|
16
|
+
async function assertEntriesActivated(context) {
|
|
17
|
+
const loader = context.get("loader");
|
|
18
|
+
if (loader === undefined)
|
|
19
|
+
throw new Error("Cordis Loader was disposed during startup");
|
|
20
|
+
const failures = [];
|
|
21
|
+
for (const entry of loader.entries()) {
|
|
22
|
+
if (entry.disabled)
|
|
23
|
+
continue;
|
|
24
|
+
const fiber = entry.fiber;
|
|
25
|
+
if (fiber === undefined) {
|
|
26
|
+
failures.push(`${entry.options.name}: module did not load`);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (fiber.state === FIBER_ACTIVE)
|
|
30
|
+
continue;
|
|
31
|
+
if (fiber.state === FIBER_FAILED) {
|
|
32
|
+
try {
|
|
33
|
+
await fiber.await();
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
failures.push(`${entry.options.name}: ${formatError(error)}`);
|
|
37
|
+
}
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (fiber.state === FIBER_PENDING) {
|
|
41
|
+
const missing = Object.keys(fiber.inject).filter((service) => fiber.ctx.get(service) === undefined);
|
|
42
|
+
failures.push(`${entry.options.name}: pending (waiting for services: ${missing.join(", ") || "unknown"})`);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
failures.push(`${entry.options.name}: fiber state ${String(fiber.state)}`);
|
|
46
|
+
}
|
|
47
|
+
if (failures.length > 0)
|
|
48
|
+
throw new Error(`Cordis plugin tree did not activate:\n${failures.join("\n")}`);
|
|
49
|
+
}
|
|
50
|
+
async function mountProfile(context, configPath) {
|
|
51
|
+
context.loader.builtins.include = ReadonlyInclude;
|
|
52
|
+
context.loader.builtins.group = Group;
|
|
53
|
+
const root = {
|
|
54
|
+
id: "profile",
|
|
55
|
+
name: "cordis:include",
|
|
56
|
+
config: { path: pathToFileURL(configPath).href },
|
|
57
|
+
};
|
|
58
|
+
await context.loader.create(root);
|
|
59
|
+
}
|
|
60
|
+
export async function bootHarness(options) {
|
|
61
|
+
const configPath = resolve(options.configPath);
|
|
62
|
+
const context = new Context();
|
|
63
|
+
const abort = () => {
|
|
64
|
+
void context.fiber.dispose().catch(() => { });
|
|
65
|
+
};
|
|
66
|
+
if (options.signal?.aborted)
|
|
67
|
+
throw new Error("Pi Harness startup was aborted", { cause: options.signal.reason });
|
|
68
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
69
|
+
let stage = "host preparation";
|
|
70
|
+
try {
|
|
71
|
+
context.baseUrl = `${pathToFileURL(dirname(configPath)).href}/`;
|
|
72
|
+
await context.plugin(Loader);
|
|
73
|
+
if (options.onFullReload !== undefined)
|
|
74
|
+
context.loader.exit = options.onFullReload;
|
|
75
|
+
await options.prepare?.(context);
|
|
76
|
+
stage = "plugin tree activation";
|
|
77
|
+
await mountProfile(context, configPath);
|
|
78
|
+
await context.get("loader")?.await();
|
|
79
|
+
if (context.get("loader") !== undefined)
|
|
80
|
+
await assertEntriesActivated(context);
|
|
81
|
+
}
|
|
82
|
+
catch (cause) {
|
|
83
|
+
await context.fiber.dispose();
|
|
84
|
+
throw new Error(`Pi Harness ${stage} failed: ${formatError(cause)}`, { cause });
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
options.signal?.removeEventListener("abort", abort);
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
context,
|
|
91
|
+
async dispose() {
|
|
92
|
+
await context.fiber.dispose();
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=boot.js.map
|
package/dist/boot.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot.js","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAmB,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,MAAM,kCAAkC,CAAC;AACrD,OAAO,OAAO,MAAM,oCAAoC,CAAC;AACzD,OAAO,MAAM,EAAE,EAAqB,MAAM,mCAAmC,CAAC;AAE9E,MAAM,eAAgB,SAAQ,OAAO;IAC1B,KAAK,KAAU,CAAC;CAC1B;AAcD,MAAM,aAAa,GAAG,CAAuB,CAAC;AAC9C,MAAM,YAAY,GAAG,CAAsB,CAAC;AAC5C,MAAM,YAAY,GAAG,CAAsB,CAAC;AAE5C,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/E,CAAC;AAED,KAAK,UAAU,sBAAsB,CAAC,OAAgB;IACpD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,MAAM,KAAK,SAAS;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EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC"}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,mBAAmB,cAAc,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAE1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/plugins/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;;;;mBAKlC,OAAO;;AAHxB,wBASE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
name: "pi-model",
|
|
3
|
+
inject: ["piModelRuntime", "piResources"],
|
|
4
|
+
apply(context) {
|
|
5
|
+
const { runtime, provider, model: modelId } = context.piModelRuntime;
|
|
6
|
+
const model = runtime.getModel(provider, modelId);
|
|
7
|
+
if (model === undefined)
|
|
8
|
+
throw new Error(`Pi model is not registered: ${provider}/${modelId}`);
|
|
9
|
+
context.provide("piModels", { runtime, model });
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/plugins/model.ts"],"names":[],"mappings":"AAEA,eAAe;IACb,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,CAAC,gBAAgB,EAAE,aAAa,CAAC;IACzC,KAAK,CAAC,OAAgB;QACpB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;QACrE,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClD,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,QAAQ,IAAI,OAAO,EAAE,CAAC,CAAC;QAC/F,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAClD,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import z from "@deepseek-ai/schemastery";
|
|
3
|
+
export interface ModelsPluginConfig {
|
|
4
|
+
provider: string;
|
|
5
|
+
model: string;
|
|
6
|
+
refreshOnCreate?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const Config: z<ModelsPluginConfig>;
|
|
9
|
+
declare const _default: {
|
|
10
|
+
name: string;
|
|
11
|
+
inject: string[];
|
|
12
|
+
Config: z<ModelsPluginConfig>;
|
|
13
|
+
apply(context: Context, config: ModelsPluginConfig): Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
16
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/plugins/models.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAGzC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,kBAAkB,CAIvC,CAAC;;;;;mBAMoB,OAAO,UAAU,kBAAkB;;AAJ1D,wBAcE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import z from "@deepseek-ai/schemastery";
|
|
3
|
+
import { ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
4
|
+
export const Config = z.object({
|
|
5
|
+
provider: z.string().required(),
|
|
6
|
+
model: z.string().required(),
|
|
7
|
+
refreshOnCreate: z.boolean().default(false),
|
|
8
|
+
});
|
|
9
|
+
export default {
|
|
10
|
+
name: "pi-models",
|
|
11
|
+
inject: ["piHarnessLaunch"],
|
|
12
|
+
Config,
|
|
13
|
+
async apply(context, config) {
|
|
14
|
+
const agentDir = context.piHarnessLaunch.agentDir;
|
|
15
|
+
const runtime = await ModelRuntime.create({
|
|
16
|
+
authPath: join(agentDir, "auth.json"),
|
|
17
|
+
modelsPath: join(agentDir, "models.json"),
|
|
18
|
+
modelsStorePath: join(agentDir, "models-store.json"),
|
|
19
|
+
refreshOnCreate: config.refreshOnCreate ?? false,
|
|
20
|
+
});
|
|
21
|
+
context.provide("piModelRuntime", { runtime, provider: config.provider, model: config.model });
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/plugins/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAQ/D,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,CAAC,MAAM,CAAC;IACpD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CAC5C,CAAC,CAAC;AAEH,eAAe;IACb,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,CAAC,iBAAiB,CAAC;IAC3B,MAAM;IACN,KAAK,CAAC,KAAK,CAAC,OAAgB,EAAE,MAA0B;QACtD,MAAM,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC;QAClD,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC;YACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC;YACrC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC;YACzC,eAAe,EAAE,IAAI,CAAC,QAAQ,EAAE,mBAAmB,CAAC;YACpD,eAAe,EAAE,MAAM,CAAC,eAAe,IAAI,KAAK;SACjD,CAAC,CAAC;QACH,OAAO,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACjG,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import z from "@deepseek-ai/schemastery";
|
|
3
|
+
export interface ResourcesPluginConfig {
|
|
4
|
+
noExtensions?: boolean;
|
|
5
|
+
noSkills?: boolean;
|
|
6
|
+
noPromptTemplates?: boolean;
|
|
7
|
+
noThemes?: boolean;
|
|
8
|
+
noContextFiles?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const Config: z<ResourcesPluginConfig>;
|
|
11
|
+
declare const _default: {
|
|
12
|
+
name: string;
|
|
13
|
+
inject: string[];
|
|
14
|
+
Config: z<ResourcesPluginConfig>;
|
|
15
|
+
apply(context: Context, config: ResourcesPluginConfig): Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
18
|
+
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/plugins/resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAGzC,MAAM,WAAW,qBAAqB;IACpC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,qBAAqB,CAM1C,CAAC;;;;;mBAMoB,OAAO,UAAU,qBAAqB;;AAJ7D,wBAoCE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { createAgentSessionServices } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
export const Config = z.object({
|
|
4
|
+
noExtensions: z.boolean().default(false),
|
|
5
|
+
noSkills: z.boolean().default(false),
|
|
6
|
+
noPromptTemplates: z.boolean().default(false),
|
|
7
|
+
noThemes: z.boolean().default(false),
|
|
8
|
+
noContextFiles: z.boolean().default(false),
|
|
9
|
+
});
|
|
10
|
+
export default {
|
|
11
|
+
name: "pi-resources",
|
|
12
|
+
inject: ["piHarnessLaunch", "piModelRuntime"],
|
|
13
|
+
Config,
|
|
14
|
+
async apply(context, config) {
|
|
15
|
+
const services = await createAgentSessionServices({
|
|
16
|
+
cwd: context.piHarnessLaunch.cwd,
|
|
17
|
+
agentDir: context.piHarnessLaunch.agentDir,
|
|
18
|
+
modelRuntime: context.piModelRuntime.runtime,
|
|
19
|
+
resourceLoaderOptions: {
|
|
20
|
+
noExtensions: config.noExtensions ?? false,
|
|
21
|
+
noSkills: config.noSkills ?? false,
|
|
22
|
+
noPromptTemplates: config.noPromptTemplates ?? false,
|
|
23
|
+
noThemes: config.noThemes ?? false,
|
|
24
|
+
noContextFiles: config.noContextFiles ?? false,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const errors = services.diagnostics.filter((diagnostic) => diagnostic.type === "error");
|
|
28
|
+
if (errors.length > 0)
|
|
29
|
+
throw new Error(`Pi resource loading failed:\n${errors.map((diagnostic) => diagnostic.message).join("\n")}`);
|
|
30
|
+
const resourceLoaderOptions = {
|
|
31
|
+
noExtensions: config.noExtensions ?? false,
|
|
32
|
+
noSkills: config.noSkills ?? false,
|
|
33
|
+
noPromptTemplates: config.noPromptTemplates ?? false,
|
|
34
|
+
noThemes: config.noThemes ?? false,
|
|
35
|
+
noContextFiles: config.noContextFiles ?? false,
|
|
36
|
+
};
|
|
37
|
+
context.provide("piResources", {
|
|
38
|
+
...services,
|
|
39
|
+
createForCwd: (cwd) => createAgentSessionServices({
|
|
40
|
+
cwd,
|
|
41
|
+
agentDir: context.piHarnessLaunch.agentDir,
|
|
42
|
+
modelRuntime: context.piModelRuntime.runtime,
|
|
43
|
+
resourceLoaderOptions,
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/plugins/resources.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,EA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AAC,IAAI,KAAK,OAAO,CAAC,CAAC;QACxF,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpI,MAAM,qBAAqB,GAAG;YAC5B,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,KAAK;YAC1C,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,KAAK;YAClC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,IAAI,KAAK;YACpD,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,KAAK;YAClC,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,KAAK;SAC/C,CAAC;QACF,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE;YAC7B,GAAG,QAAQ;YACX,YAAY,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,0BAA0B,CAAC;gBACxD,GAAG;gBACH,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,QAAQ;gBAC1C,YAAY,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO;gBAC5C,qBAAqB;aACtB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import z from "@deepseek-ai/schemastery";
|
|
3
|
+
export interface RuntimePluginConfig {
|
|
4
|
+
thinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
5
|
+
}
|
|
6
|
+
export declare const Config: z<RuntimePluginConfig>;
|
|
7
|
+
declare const _default: {
|
|
8
|
+
name: string;
|
|
9
|
+
inject: string[];
|
|
10
|
+
Config: z<RuntimePluginConfig>;
|
|
11
|
+
apply(context: Context, config: RuntimePluginConfig): Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/plugins/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAIzC,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;CACjF;AAED,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,mBAAmB,CAExC,CAAC;;;;;mBAMoB,OAAO,UAAU,mBAAmB;;AAJ3D,wBA2DE"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { createAgentSessionFromServices, createAgentSessionRuntime } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import { PiRuntime } from "../runtime.js";
|
|
4
|
+
export const Config = z.object({
|
|
5
|
+
thinkingLevel: z.union(["off", "minimal", "low", "medium", "high", "xhigh", "max"]).default("medium"),
|
|
6
|
+
});
|
|
7
|
+
export default {
|
|
8
|
+
name: "pi-runtime",
|
|
9
|
+
inject: ["piModels", "piResources", "piSession", "piTools"],
|
|
10
|
+
Config,
|
|
11
|
+
async apply(context, config) {
|
|
12
|
+
const tools = context.piTools.acquire();
|
|
13
|
+
context.effect(() => () => tools.release());
|
|
14
|
+
const requestedTools = [...tools.names, ...tools.customTools.map((tool) => tool.name)];
|
|
15
|
+
const createRuntime = async ({ cwd, sessionManager, sessionStartEvent }) => {
|
|
16
|
+
const services = cwd === context.piResources.cwd ? context.piResources : await context.piResources.createForCwd(cwd);
|
|
17
|
+
const result = await createAgentSessionFromServices({
|
|
18
|
+
services,
|
|
19
|
+
sessionManager,
|
|
20
|
+
...(sessionStartEvent === undefined ? {} : { sessionStartEvent }),
|
|
21
|
+
model: context.piModels.model,
|
|
22
|
+
thinkingLevel: config.thinkingLevel ?? "medium",
|
|
23
|
+
tools: requestedTools,
|
|
24
|
+
customTools: tools.customTools,
|
|
25
|
+
});
|
|
26
|
+
return { ...result, services, diagnostics: services.diagnostics };
|
|
27
|
+
};
|
|
28
|
+
const sessionRuntime = await createAgentSessionRuntime(createRuntime, {
|
|
29
|
+
cwd: context.piResources.cwd,
|
|
30
|
+
agentDir: context.piResources.agentDir,
|
|
31
|
+
sessionManager: context.piSession.manager,
|
|
32
|
+
});
|
|
33
|
+
const runtime = new PiRuntime(sessionRuntime);
|
|
34
|
+
const bindSession = async (session) => {
|
|
35
|
+
const activeTools = new Set(session.getAllTools().map((tool) => tool.name));
|
|
36
|
+
const missingTools = requestedTools.filter((name) => !activeTools.has(name));
|
|
37
|
+
if (missingTools.length > 0)
|
|
38
|
+
throw new Error(`Pi tools are not registered: ${missingTools.join(", ")}`);
|
|
39
|
+
await session.bindExtensions({
|
|
40
|
+
mode: "print",
|
|
41
|
+
abortHandler: () => {
|
|
42
|
+
void runtime.abort();
|
|
43
|
+
},
|
|
44
|
+
onError: (error) => {
|
|
45
|
+
context.emit("pi/extension-error", error);
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
context.provide("piRuntime", runtime);
|
|
50
|
+
let unsubscribe;
|
|
51
|
+
const rebindSession = async (session) => {
|
|
52
|
+
unsubscribe?.();
|
|
53
|
+
await bindSession(session);
|
|
54
|
+
unsubscribe = session.subscribe((event) => {
|
|
55
|
+
context.emit("pi/session-event", event);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
sessionRuntime.setRebindSession(rebindSession);
|
|
59
|
+
await rebindSession(sessionRuntime.session);
|
|
60
|
+
context.effect(() => {
|
|
61
|
+
return async () => {
|
|
62
|
+
unsubscribe?.();
|
|
63
|
+
await runtime.dispose();
|
|
64
|
+
};
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"@deepseek-ai/schemastery";
|
|
3
|
+
export interface SessionPluginConfig {
|
|
4
|
+
storage?: "memory" | "jsonl";
|
|
5
|
+
directory?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const Config: z<SessionPluginConfig>;
|
|
8
|
+
declare const _default: {
|
|
9
|
+
name: string;
|
|
10
|
+
inject: string[];
|
|
11
|
+
Config: z<SessionPluginConfig>;
|
|
12
|
+
apply(context: Context, config: SessionPluginConfig): void;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
15
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/plugins/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAGzC,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,mBAAmB,CAGxC,CAAC;;;;;mBAMc,OAAO,UAAU,mBAAmB;;AAJrD,wBAWE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { join, resolve } from "node:path";
|
|
2
|
+
import z from "@deepseek-ai/schemastery";
|
|
3
|
+
import { SessionManager } from "@earendil-works/pi-coding-agent";
|
|
4
|
+
export const Config = z.object({
|
|
5
|
+
storage: z.union(["memory", "jsonl"]).default("jsonl"),
|
|
6
|
+
directory: z.string(),
|
|
7
|
+
});
|
|
8
|
+
export default {
|
|
9
|
+
name: "pi-session",
|
|
10
|
+
inject: ["piHarnessLaunch"],
|
|
11
|
+
Config,
|
|
12
|
+
apply(context, config) {
|
|
13
|
+
const storage = config.storage ?? "jsonl";
|
|
14
|
+
const manager = storage === "memory"
|
|
15
|
+
? SessionManager.inMemory(context.piHarnessLaunch.cwd)
|
|
16
|
+
: SessionManager.create(context.piHarnessLaunch.cwd, config.directory === undefined ? join(context.piHarnessLaunch.agentDir, "sessions") : resolve(context.piHarnessLaunch.cwd, config.directory));
|
|
17
|
+
context.provide("piSession", { manager });
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/plugins/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAOjE,MAAM,CAAC,MAAM,MAAM,GAA2B,CAAC,CAAC,MAAM,CAAC;IACrD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACtD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAEH,eAAe;IACb,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,CAAC,iBAAiB,CAAC;IAC3B,MAAM;IACN,KAAK,CAAC,OAAgB,EAAE,MAA2B;QACjD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC;QAC1C,MAAM,OAAO,GAAG,OAAO,KAAK,QAAQ;YAClC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC;YACtD,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QACrM,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../src/plugins/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;;;;mBAMlC,OAAO;;AAHxB,wBAgBE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StdioApplication } from "../stdio.js";
|
|
2
|
+
export default {
|
|
3
|
+
name: "pi-stdio",
|
|
4
|
+
inject: ["piRuntime", "piResources", "piHarnessStdio", "piHarnessLaunch"],
|
|
5
|
+
apply(context) {
|
|
6
|
+
const application = new StdioApplication(context.piRuntime, context.piHarnessLaunch, context.piHarnessStdio);
|
|
7
|
+
for (const diagnostic of context.piResources.diagnostics) {
|
|
8
|
+
if (diagnostic.type !== "error")
|
|
9
|
+
context.piHarnessStdio.writeError(`Resource ${diagnostic.type}: ${diagnostic.message}\n`);
|
|
10
|
+
}
|
|
11
|
+
context.on("pi/session-event", (event) => {
|
|
12
|
+
application.writeSessionEvent(event);
|
|
13
|
+
});
|
|
14
|
+
context.on("pi/extension-error", (error) => {
|
|
15
|
+
context.piHarnessStdio.writeError(`Extension error (${error.extensionPath}): ${error.error}\n`);
|
|
16
|
+
});
|
|
17
|
+
context.provide("piApplication", application);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=stdio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../src/plugins/stdio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAe;IACb,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,CAAC;IACzE,KAAK,CAAC,OAAgB;QACpB,MAAM,WAAW,GAAG,IAAI,gBAAgB,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;QAC7G,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;YACzD,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO;gBAAE,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,YAAY,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;QAC7H,CAAC;QACD,OAAO,CAAC,EAAE,CAAC,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE;YACvC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,EAAE;YACzC,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,oBAAoB,KAAK,CAAC,aAAa,MAAM,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;QAClG,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import z from "@deepseek-ai/schemastery";
|
|
3
|
+
export interface ToolsPluginConfig {
|
|
4
|
+
names?: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const Config: z<ToolsPluginConfig>;
|
|
7
|
+
declare const _default: {
|
|
8
|
+
name: string;
|
|
9
|
+
Config: z<ToolsPluginConfig>;
|
|
10
|
+
apply(context: Context, config: ToolsPluginConfig): void;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/plugins/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAGzC,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAID,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,iBAAiB,CAEtC,CAAC;;;;mBAKc,OAAO,UAAU,iBAAiB;;AAHnD,wBAQE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { PiToolRegistry } from "../services.js";
|
|
3
|
+
const DEFAULT_TOOLS = ["read", "bash", "edit", "write"];
|
|
4
|
+
export const Config = z.object({
|
|
5
|
+
names: z.array(z.string()).default(DEFAULT_TOOLS),
|
|
6
|
+
});
|
|
7
|
+
export default {
|
|
8
|
+
name: "pi-tools",
|
|
9
|
+
Config,
|
|
10
|
+
apply(context, config) {
|
|
11
|
+
const names = config.names ?? DEFAULT_TOOLS;
|
|
12
|
+
if (new Set(names).size !== names.length)
|
|
13
|
+
throw new Error("Pi core tool names must be unique");
|
|
14
|
+
context.provide("piTools", new PiToolRegistry(names));
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/plugins/tools.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMhD,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAyB,CAAC,CAAC,MAAM,CAAC;IACnD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;CAClD,CAAC,CAAC;AAEH,eAAe;IACb,IAAI,EAAE,UAAU;IAChB,MAAM;IACN,KAAK,CAAC,OAAgB,EAAE,MAAyB;QAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,aAAa,CAAC;QAC5C,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QAC/F,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;IACxD,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ResolveProfileConfigOptions {
|
|
2
|
+
profile?: string;
|
|
3
|
+
configPath?: string;
|
|
4
|
+
cwd?: string;
|
|
5
|
+
profilesDir?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function resolveProfileConfig(_options?: ResolveProfileConfigOptions): Promise<string>;
|
|
8
|
+
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,2BAA2B;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,oBAAoB,CAAC,QAAQ,GAAE,2BAAgC,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBtG"}
|
package/dist/profile.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { access } from "node:fs/promises";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
export async function resolveProfileConfig(_options = {}) {
|
|
5
|
+
const options = _options;
|
|
6
|
+
if (options.profile !== undefined && options.configPath !== undefined)
|
|
7
|
+
throw new Error("profile and configPath cannot be used together");
|
|
8
|
+
const cwd = options.cwd ?? process.cwd();
|
|
9
|
+
let configPath;
|
|
10
|
+
if (options.configPath !== undefined) {
|
|
11
|
+
configPath = resolve(cwd, options.configPath);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
const profile = options.profile ?? "default";
|
|
15
|
+
if (!/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(profile))
|
|
16
|
+
throw new Error(`Invalid profile name: ${profile}`);
|
|
17
|
+
const profilesDir = options.profilesDir ?? fileURLToPath(new URL("../profiles", import.meta.url));
|
|
18
|
+
configPath = resolve(profilesDir, profile, "cordis.yml");
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
await access(configPath);
|
|
22
|
+
}
|
|
23
|
+
catch (cause) {
|
|
24
|
+
throw new Error(`Pi Harness profile config does not exist or is not readable: ${configPath}`, { cause });
|
|
25
|
+
}
|
|
26
|
+
return configPath;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AASzC,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,WAAwC,EAAE;IACnF,MAAM,OAAO,GAAG,QAAQ,CAAC;IACzB,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACzI,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACzC,IAAI,UAAkB,CAAC;IACvB,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACrC,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAChD,CAAC;SAAM,CAAC;QACN,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,SAAS,CAAC;QAC7C,IAAI,CAAC,mCAAmC,CAAC,IAAI,CAAC,OAAO,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,OAAO,EAAE,CAAC,CAAC;QAC5G,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,aAAa,CAAC,IAAI,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAClG,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,gEAAgE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3G,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AgentSession, AgentSessionRuntime } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { PiRuntimeService } from "./services.js";
|
|
3
|
+
export declare class PiRuntimeDisposedError extends Error {
|
|
4
|
+
readonly name = "PiRuntimeDisposedError";
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
7
|
+
export declare class PiRuntime implements PiRuntimeService {
|
|
8
|
+
#private;
|
|
9
|
+
readonly sessionRuntime: AgentSessionRuntime;
|
|
10
|
+
constructor(sessionRuntime: AgentSessionRuntime);
|
|
11
|
+
get session(): AgentSession;
|
|
12
|
+
prompt(text: string): Promise<void>;
|
|
13
|
+
abort(): Promise<void>;
|
|
14
|
+
dispose(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,SAAkB,IAAI,4BAA4B;;CAKnD;AAED,qBAAa,SAAU,YAAW,gBAAgB;;IAChD,QAAQ,CAAC,cAAc,EAAE,mBAAmB,CAAC;gBAGjC,cAAc,EAAE,mBAAmB;IAI/C,IAAI,OAAO,IAAI,YAAY,CAE1B;IAEK,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAK/B"}
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export class PiRuntimeDisposedError extends Error {
|
|
2
|
+
name = "PiRuntimeDisposedError";
|
|
3
|
+
constructor() {
|
|
4
|
+
super("Pi runtime is disposed");
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class PiRuntime {
|
|
8
|
+
sessionRuntime;
|
|
9
|
+
#disposed = false;
|
|
10
|
+
constructor(sessionRuntime) {
|
|
11
|
+
this.sessionRuntime = sessionRuntime;
|
|
12
|
+
}
|
|
13
|
+
get session() {
|
|
14
|
+
return this.sessionRuntime.session;
|
|
15
|
+
}
|
|
16
|
+
async prompt(text) {
|
|
17
|
+
if (this.#disposed)
|
|
18
|
+
throw new PiRuntimeDisposedError();
|
|
19
|
+
await this.sessionRuntime.session.prompt(text);
|
|
20
|
+
}
|
|
21
|
+
async abort() {
|
|
22
|
+
if (this.#disposed)
|
|
23
|
+
return;
|
|
24
|
+
await this.sessionRuntime.session.abort();
|
|
25
|
+
}
|
|
26
|
+
async dispose() {
|
|
27
|
+
if (this.#disposed)
|
|
28
|
+
return;
|
|
29
|
+
this.#disposed = true;
|
|
30
|
+
await this.sessionRuntime.dispose();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC7B,IAAI,GAAG,wBAAwB,CAAC;IAElD;QACE,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAClC,CAAC;CACF;AAED,MAAM,OAAO,SAAS;IACX,cAAc,CAAsB;IAC7C,SAAS,GAAG,KAAK,CAAC;IAElB,YAAY,cAAmC;QAC7C,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,IAAI,IAAI,CAAC,SAAS;YAAE,MAAM,IAAI,sBAAsB,EAAE,CAAC;QACvD,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO;QAC3B,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import type { AgentSession, AgentSessionEvent, AgentSessionRuntime, AgentSessionServices, ExtensionError, SessionManager, ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import type { Api, Model } from "@earendil-works/pi-ai";
|
|
4
|
+
import type { ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
5
|
+
export interface PiHarnessLaunch {
|
|
6
|
+
readonly cwd: string;
|
|
7
|
+
readonly agentDir: string;
|
|
8
|
+
readonly args: readonly string[];
|
|
9
|
+
requestExit(code: number): void;
|
|
10
|
+
}
|
|
11
|
+
export interface PiModelsService {
|
|
12
|
+
readonly runtime: ModelRuntime;
|
|
13
|
+
readonly model: Model<Api>;
|
|
14
|
+
}
|
|
15
|
+
export interface PiModelRuntimeService {
|
|
16
|
+
readonly runtime: ModelRuntime;
|
|
17
|
+
readonly provider: string;
|
|
18
|
+
readonly model: string;
|
|
19
|
+
}
|
|
20
|
+
export type PiResourcesService = AgentSessionServices & {
|
|
21
|
+
createForCwd(cwd: string): Promise<AgentSessionServices>;
|
|
22
|
+
};
|
|
23
|
+
export interface PiSessionService {
|
|
24
|
+
readonly manager: SessionManager;
|
|
25
|
+
}
|
|
26
|
+
export interface PiRuntimeService {
|
|
27
|
+
readonly session: AgentSession;
|
|
28
|
+
readonly sessionRuntime: AgentSessionRuntime;
|
|
29
|
+
prompt(text: string): Promise<void>;
|
|
30
|
+
abort(): Promise<void>;
|
|
31
|
+
dispose(): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export interface PiToolsSnapshot {
|
|
34
|
+
readonly names: string[];
|
|
35
|
+
readonly customTools: ToolDefinition[];
|
|
36
|
+
}
|
|
37
|
+
export interface PiToolsLease extends PiToolsSnapshot {
|
|
38
|
+
release(): void;
|
|
39
|
+
}
|
|
40
|
+
export declare class PiToolRegistry {
|
|
41
|
+
#private;
|
|
42
|
+
constructor(names?: readonly string[]);
|
|
43
|
+
register(tool: ToolDefinition): () => void;
|
|
44
|
+
snapshot(): PiToolsSnapshot;
|
|
45
|
+
acquire(): PiToolsLease;
|
|
46
|
+
}
|
|
47
|
+
declare module "@deepseek-ai/cordis" {
|
|
48
|
+
interface Context {
|
|
49
|
+
piHarnessLaunch: PiHarnessLaunch;
|
|
50
|
+
piModelRuntime: PiModelRuntimeService;
|
|
51
|
+
piModels: PiModelsService;
|
|
52
|
+
piResources: PiResourcesService;
|
|
53
|
+
piSession: PiSessionService;
|
|
54
|
+
piTools: PiToolRegistry;
|
|
55
|
+
piRuntime: PiRuntimeService;
|
|
56
|
+
}
|
|
57
|
+
interface Events {
|
|
58
|
+
"pi/session-event"(event: AgentSessionEvent): void;
|
|
59
|
+
"pi/extension-error"(error: ExtensionError): void;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export declare function provideLaunchContext(context: Context, launch: PiHarnessLaunch): () => void;
|
|
63
|
+
//# sourceMappingURL=services.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../src/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAClL,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC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;CACjB;AAED,qBAAa,cAAc;;gBAKb,KAAK,GAAE,SAAS,MAAM,EAAO;IAIzC,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,IAAI;IAS1C,QAAQ,IAAI,eAAe;IAI3B,OAAO,IAAI,YAAY;CAYxB;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,eAAe,EAAE,eAAe,CAAC;QACjC,cAAc,EAAE,qBAAqB,CAAC;QACtC,QAAQ,EAAE,eAAe,CAAC;QAC1B,WAAW,EAAE,kBAAkB,CAAC;QAChC,SAAS,EAAE,gBAAgB,CAAC;QAC5B,OAAO,EAAE,cAAc,CAAC;QACxB,SAAS,EAAE,gBAAgB,CAAC;KAC7B;IAED,UAAU,MAAM;QACd,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;QACnD,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;KACnD;CACF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,GAAG,MAAM,IAAI,CAG1F"}
|
package/dist/services.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export class PiToolRegistry {
|
|
2
|
+
#names;
|
|
3
|
+
#customTools = new Map();
|
|
4
|
+
#leases = 0;
|
|
5
|
+
constructor(names = []) {
|
|
6
|
+
this.#names = [...names];
|
|
7
|
+
}
|
|
8
|
+
register(tool) {
|
|
9
|
+
if (this.#leases > 0)
|
|
10
|
+
throw new Error(`Pi tool registry is leased by pi-runtime; declare a Cordis injection that activates ${tool.name} before pi-runtime`);
|
|
11
|
+
if (this.#names.includes(tool.name) || this.#customTools.has(tool.name))
|
|
12
|
+
throw new Error(`Pi tool is already registered: ${tool.name}`);
|
|
13
|
+
this.#customTools.set(tool.name, tool);
|
|
14
|
+
return () => {
|
|
15
|
+
this.#customTools.delete(tool.name);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
snapshot() {
|
|
19
|
+
return { names: [...this.#names], customTools: [...this.#customTools.values()] };
|
|
20
|
+
}
|
|
21
|
+
acquire() {
|
|
22
|
+
this.#leases += 1;
|
|
23
|
+
let released = false;
|
|
24
|
+
return {
|
|
25
|
+
...this.snapshot(),
|
|
26
|
+
release: () => {
|
|
27
|
+
if (released)
|
|
28
|
+
return;
|
|
29
|
+
released = true;
|
|
30
|
+
this.#leases -= 1;
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function provideLaunchContext(context, launch) {
|
|
36
|
+
const value = Object.freeze({ ...launch, args: Object.freeze([...launch.args]) });
|
|
37
|
+
return context.provide("piHarnessLaunch", value);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.js","sourceRoot":"","sources":["../src/services.ts"],"names":[],"mappings":"AAgDA,MAAM,OAAO,cAAc;IAChB,MAAM,CAAW;IACjB,YAAY,GAAG,IAAI,GAAG,EAA0B,CAAC;IAC1D,OAAO,GAAG,CAAC,CAAC;IAEZ,YAAY,QAA2B,EAAE;QACvC,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,QAAQ,CAAC,IAAoB;QAC3B,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,uFAAuF,IAAI,CAAC,IAAI,oBAAoB,CAAC,CAAC;QAC5J,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACxI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACvC,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC,CAAC;IACJ,CAAC;IAED,QAAQ;QACN,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;IACnF,CAAC;IAED,OAAO;QACL,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;QAClB,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,OAAO;YACL,GAAG,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO,EAAE,GAAG,EAAE;gBACZ,IAAI,QAAQ;oBAAE,OAAO;gBACrB,QAAQ,GAAG,IAAI,CAAC;gBAChB,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;YACpB,CAAC;SACF,CAAC;IACJ,CAAC;CACF;AAmBD,MAAM,UAAU,oBAAoB,CAAC,OAAgB,EAAE,MAAuB;IAC5E,MAAM,KAAK,GAAoB,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;IACnG,OAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC"}
|
package/dist/stdio.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import type { AgentSessionEvent } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import type { PiHarnessLaunch, PiRuntimeService } from "./services.js";
|
|
4
|
+
export interface PiHarnessStdio {
|
|
5
|
+
readPrompt(): Promise<string>;
|
|
6
|
+
writeOutput(text: string): void;
|
|
7
|
+
writeError(text: string): void;
|
|
8
|
+
}
|
|
9
|
+
export interface PiHarnessApplication {
|
|
10
|
+
run(): Promise<number>;
|
|
11
|
+
}
|
|
12
|
+
declare module "@deepseek-ai/cordis" {
|
|
13
|
+
interface Context {
|
|
14
|
+
piHarnessStdio: PiHarnessStdio;
|
|
15
|
+
piApplication: PiHarnessApplication;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export declare function provideStdioContext(context: Context, stdio: PiHarnessStdio): () => void;
|
|
19
|
+
export declare class StdioApplication implements PiHarnessApplication {
|
|
20
|
+
#private;
|
|
21
|
+
constructor(runtime: PiRuntimeService, launch: PiHarnessLaunch, stdio: PiHarnessStdio);
|
|
22
|
+
writeSessionEvent(event: AgentSessionEvent): void;
|
|
23
|
+
run(): Promise<number>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=stdio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,WAAW,cAAc;IAC7B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACxB;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,cAAc,EAAE,cAAc,CAAC;QAC/B,aAAa,EAAE,oBAAoB,CAAC;KACrC;CACF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,IAAI,CAEvF;AAeD,qBAAa,gBAAiB,YAAW,oBAAoB;;gBAM/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc;IAMrF,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAK3C,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;CAgC7B"}
|
package/dist/stdio.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export function provideStdioContext(context, stdio) {
|
|
2
|
+
return context.provide("piHarnessStdio", stdio);
|
|
3
|
+
}
|
|
4
|
+
function promptFromArgs(args) {
|
|
5
|
+
if (args.length === 0)
|
|
6
|
+
return undefined;
|
|
7
|
+
if (args[0] === "--prompt") {
|
|
8
|
+
const prompt = args[1];
|
|
9
|
+
if (prompt === undefined)
|
|
10
|
+
throw new Error("--prompt requires a value");
|
|
11
|
+
if (args.length > 2)
|
|
12
|
+
throw new Error("--prompt accepts exactly one value");
|
|
13
|
+
return prompt;
|
|
14
|
+
}
|
|
15
|
+
if (args[0]?.startsWith("--prompt="))
|
|
16
|
+
return args[0].slice("--prompt=".length);
|
|
17
|
+
if (args.some((arg) => arg.startsWith("-")))
|
|
18
|
+
throw new Error(`Unknown stdio option: ${args.find((arg) => arg.startsWith("-")) ?? ""}`);
|
|
19
|
+
return args.join(" ");
|
|
20
|
+
}
|
|
21
|
+
export class StdioApplication {
|
|
22
|
+
#runtime;
|
|
23
|
+
#launch;
|
|
24
|
+
#stdio;
|
|
25
|
+
#running = false;
|
|
26
|
+
constructor(runtime, launch, stdio) {
|
|
27
|
+
this.#runtime = runtime;
|
|
28
|
+
this.#launch = launch;
|
|
29
|
+
this.#stdio = stdio;
|
|
30
|
+
}
|
|
31
|
+
writeSessionEvent(event) {
|
|
32
|
+
if (!this.#running)
|
|
33
|
+
return;
|
|
34
|
+
if (event.type === "message_update" && event.assistantMessageEvent.type === "text_delta")
|
|
35
|
+
this.#stdio.writeOutput(event.assistantMessageEvent.delta);
|
|
36
|
+
}
|
|
37
|
+
async run() {
|
|
38
|
+
if (this.#running)
|
|
39
|
+
throw new Error("stdio application is already running");
|
|
40
|
+
this.#running = true;
|
|
41
|
+
try {
|
|
42
|
+
let prompt;
|
|
43
|
+
try {
|
|
44
|
+
prompt = promptFromArgs(this.#launch.args) ?? await this.#stdio.readPrompt();
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
this.#stdio.writeError(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
48
|
+
return 2;
|
|
49
|
+
}
|
|
50
|
+
if (prompt.trim().length === 0) {
|
|
51
|
+
this.#stdio.writeError("Prompt is empty\n");
|
|
52
|
+
return 2;
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
await this.#runtime.prompt(prompt);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
this.#stdio.writeError(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
59
|
+
return 1;
|
|
60
|
+
}
|
|
61
|
+
const lastMessage = this.#runtime.session.messages.at(-1);
|
|
62
|
+
if (lastMessage?.role === "assistant" && (lastMessage.stopReason === "error" || lastMessage.stopReason === "aborted")) {
|
|
63
|
+
this.#stdio.writeError(`${lastMessage.errorMessage ?? `Request ${lastMessage.stopReason}`}\n`);
|
|
64
|
+
return 1;
|
|
65
|
+
}
|
|
66
|
+
this.#stdio.writeOutput("\n");
|
|
67
|
+
return 0;
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
this.#running = false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=stdio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAqBA,MAAM,UAAU,mBAAmB,CAAC,OAAgB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CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACtF,OAAO,CAAC,CAAC;YACX,CAAC;YACD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1D,IAAI,WAAW,EAAE,IAAI,KAAK,WAAW,IAAI,CAAC,WAAW,CAAC,UAAU,KAAK,OAAO,IAAI,WAAW,CAAC,UAAU,KAAK,SAAS,CAAC,EAAE,CAAC;gBACtH,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC,YAAY,IAAI,WAAW,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;gBAC/F,OAAO,CAAC,CAAC;YACX,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAC9B,OAAO,CAAC,CAAC;QACX,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pi-harness/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Cordis boot and Pi runtime plugins for Pi Harness",
|
|
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
|
+
},
|
|
13
|
+
"./plugins/*": {
|
|
14
|
+
"types": "./dist/plugins/*.d.ts",
|
|
15
|
+
"import": "./dist/plugins/*.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"profiles"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=22.19.0"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc -p tsconfig.build.json",
|
|
28
|
+
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
29
|
+
"typecheck": "tsc -p tsconfig.json"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@deepseek-ai/cordis": "4.0.1",
|
|
33
|
+
"@deepseek-ai/cordis-plugin-group": "1.0.1",
|
|
34
|
+
"@deepseek-ai/cordis-plugin-hmr": "1.0.16",
|
|
35
|
+
"@deepseek-ai/cordis-plugin-include": "1.0.6",
|
|
36
|
+
"@deepseek-ai/cordis-plugin-loader": "1.0.2",
|
|
37
|
+
"@deepseek-ai/cordis-plugin-logger-console": "1.0.1",
|
|
38
|
+
"@deepseek-ai/cordis-plugin-timer": "1.1.3",
|
|
39
|
+
"@deepseek-ai/schemastery": "3.18.1",
|
|
40
|
+
"@earendil-works/pi-agent-core": "0.84.4",
|
|
41
|
+
"@earendil-works/pi-ai": "0.84.4",
|
|
42
|
+
"@earendil-works/pi-coding-agent": "0.84.4"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
- id: agent
|
|
2
|
+
name: cordis:group
|
|
3
|
+
group: true
|
|
4
|
+
config:
|
|
5
|
+
- id: models
|
|
6
|
+
name: "@pi-harness/core/plugins/models"
|
|
7
|
+
config:
|
|
8
|
+
provider: deepseek
|
|
9
|
+
model: deepseek-v4-flash
|
|
10
|
+
refreshOnCreate: false
|
|
11
|
+
- id: resources
|
|
12
|
+
name: "@pi-harness/core/plugins/resources"
|
|
13
|
+
config: {}
|
|
14
|
+
- id: model
|
|
15
|
+
name: "@pi-harness/core/plugins/model"
|
|
16
|
+
config: {}
|
|
17
|
+
- id: session
|
|
18
|
+
name: "@pi-harness/core/plugins/session"
|
|
19
|
+
config:
|
|
20
|
+
storage: jsonl
|
|
21
|
+
- id: tools
|
|
22
|
+
name: "@pi-harness/core/plugins/tools"
|
|
23
|
+
config:
|
|
24
|
+
names:
|
|
25
|
+
- read
|
|
26
|
+
- bash
|
|
27
|
+
- edit
|
|
28
|
+
- write
|
|
29
|
+
- id: runtime
|
|
30
|
+
name: "@pi-harness/core/plugins/runtime"
|
|
31
|
+
config:
|
|
32
|
+
thinkingLevel: medium
|
|
33
|
+
- id: stdio
|
|
34
|
+
name: "@pi-harness/core/plugins/stdio"
|
|
35
|
+
config: {}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
- id: logger
|
|
2
|
+
name: "@deepseek-ai/cordis-plugin-logger-console"
|
|
3
|
+
config: {}
|
|
4
|
+
- id: timer
|
|
5
|
+
name: "@deepseek-ai/cordis-plugin-timer"
|
|
6
|
+
config: {}
|
|
7
|
+
- id: hmr
|
|
8
|
+
name: "@deepseek-ai/cordis-plugin-hmr"
|
|
9
|
+
config:
|
|
10
|
+
base: !!js piHarnessLaunch.cwd
|
|
11
|
+
root:
|
|
12
|
+
- .
|
|
13
|
+
- id: agent
|
|
14
|
+
name: cordis:group
|
|
15
|
+
group: true
|
|
16
|
+
config:
|
|
17
|
+
- id: models
|
|
18
|
+
name: "@pi-harness/core/plugins/models"
|
|
19
|
+
config:
|
|
20
|
+
provider: deepseek
|
|
21
|
+
model: deepseek-v4-flash
|
|
22
|
+
refreshOnCreate: false
|
|
23
|
+
- id: resources
|
|
24
|
+
name: "@pi-harness/core/plugins/resources"
|
|
25
|
+
config: {}
|
|
26
|
+
- id: model
|
|
27
|
+
name: "@pi-harness/core/plugins/model"
|
|
28
|
+
config: {}
|
|
29
|
+
- id: session
|
|
30
|
+
name: "@pi-harness/core/plugins/session"
|
|
31
|
+
config:
|
|
32
|
+
storage: jsonl
|
|
33
|
+
- id: tools
|
|
34
|
+
name: "@pi-harness/core/plugins/tools"
|
|
35
|
+
config:
|
|
36
|
+
names:
|
|
37
|
+
- read
|
|
38
|
+
- bash
|
|
39
|
+
- edit
|
|
40
|
+
- write
|
|
41
|
+
- id: runtime
|
|
42
|
+
name: "@pi-harness/core/plugins/runtime"
|
|
43
|
+
config:
|
|
44
|
+
thinkingLevel: medium
|
|
45
|
+
- id: stdio
|
|
46
|
+
name: "@pi-harness/core/plugins/stdio"
|
|
47
|
+
config: {}
|