@chopin-ai/harness-pi 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/dist/acp.d.ts +42 -0
- package/dist/acp.js +122 -0
- package/dist/acp.js.map +1 -0
- package/dist/auth.d.ts +25 -0
- package/dist/auth.js +56 -0
- package/dist/auth.js.map +1 -0
- package/dist/backoff.d.ts +5 -0
- package/dist/backoff.js +13 -0
- package/dist/backoff.js.map +1 -0
- package/dist/bridge.d.ts +11 -0
- package/dist/bridge.js +259 -0
- package/dist/bridge.js.map +1 -0
- package/dist/http.d.ts +7 -0
- package/dist/http.js +73 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/layer.d.ts +8 -0
- package/dist/layer.js +84 -0
- package/dist/layer.js.map +1 -0
- package/dist/mcp.d.ts +24 -0
- package/dist/mcp.js +126 -0
- package/dist/mcp.js.map +1 -0
- package/dist/mode.d.ts +11 -0
- package/dist/mode.js +33 -0
- package/dist/mode.js.map +1 -0
- package/dist/pages.d.ts +8 -0
- package/dist/pages.js +12 -0
- package/dist/pages.js.map +1 -0
- package/dist/project-context.d.ts +18 -0
- package/dist/project-context.js +77 -0
- package/dist/project-context.js.map +1 -0
- package/dist/protocol.d.ts +247 -0
- package/dist/protocol.js +327 -0
- package/dist/protocol.js.map +1 -0
- package/dist/server.d.ts +25 -0
- package/dist/server.js +349 -0
- package/dist/server.js.map +1 -0
- package/dist/service.d.ts +96 -0
- package/dist/service.js +493 -0
- package/dist/service.js.map +1 -0
- package/dist/shell.d.ts +31 -0
- package/dist/shell.js +57 -0
- package/dist/shell.js.map +1 -0
- package/dist/submissions.d.ts +22 -0
- package/dist/submissions.js +33 -0
- package/dist/submissions.js.map +1 -0
- package/package.json +48 -3
- package/README.md +0 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ConversationView } from "@earendil-works/pi-durable";
|
|
2
|
+
import type { Static } from "typebox";
|
|
3
|
+
import type { SubmissionSchema } from "./protocol.js";
|
|
4
|
+
/** How a submission stands, as clients see it. */
|
|
5
|
+
export type Outcome = Static<typeof SubmissionSchema>;
|
|
6
|
+
/** How many settled submissions clients keep learning of; running ones are always kept. */
|
|
7
|
+
export declare const RECENT_SUBMISSIONS = 16;
|
|
8
|
+
/** A submission as clients see it: running until it settles, then answered or not, and why. */
|
|
9
|
+
export declare function outcomeOf(record: {
|
|
10
|
+
status: string;
|
|
11
|
+
reason?: string;
|
|
12
|
+
detail?: unknown;
|
|
13
|
+
}): Outcome;
|
|
14
|
+
/** A submission nobody can say more about, for want of a store to read. */
|
|
15
|
+
export declare function lost(detail: string): Outcome;
|
|
16
|
+
/**
|
|
17
|
+
* Folds what the store says into what clients have, keeping every running submission, the latest settled ones, and
|
|
18
|
+
* whatever this read reported, so a client waiting on an old one sees how it ended before it goes.
|
|
19
|
+
*/
|
|
20
|
+
export declare function merge(draft: Record<string, Outcome>, known: Readonly<Record<string, Outcome>>): void;
|
|
21
|
+
/** What changes when a submission may have ended: which entries are there, and which inputs the run serves. */
|
|
22
|
+
export declare function progressOf(view: ConversationView): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { detailText, runInputs } from "./acp.js";
|
|
2
|
+
/** How many settled submissions clients keep learning of; running ones are always kept. */
|
|
3
|
+
export const RECENT_SUBMISSIONS = 16;
|
|
4
|
+
/** A submission as clients see it: running until it settles, then answered or not, and why. */
|
|
5
|
+
export function outcomeOf(record) {
|
|
6
|
+
if (record.status === "done")
|
|
7
|
+
return { status: "done" };
|
|
8
|
+
if (record.status !== "unanswered")
|
|
9
|
+
return { status: "pending" };
|
|
10
|
+
const detail = detailText(record.detail);
|
|
11
|
+
return { status: "unanswered", reason: record.reason ?? "unknown", ...(detail !== undefined && { detail }) };
|
|
12
|
+
}
|
|
13
|
+
/** A submission nobody can say more about, for want of a store to read. */
|
|
14
|
+
export function lost(detail) {
|
|
15
|
+
return { status: "unanswered", reason: "lost", detail };
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Folds what the store says into what clients have, keeping every running submission, the latest settled ones, and
|
|
19
|
+
* whatever this read reported, so a client waiting on an old one sees how it ended before it goes.
|
|
20
|
+
*/
|
|
21
|
+
export function merge(draft, known) {
|
|
22
|
+
Object.assign(draft, known);
|
|
23
|
+
const settled = Object.keys(draft).filter((id) => draft[id]?.status !== "pending").map(Number).sort((a, b) => b - a);
|
|
24
|
+
for (const id of settled.slice(RECENT_SUBMISSIONS))
|
|
25
|
+
if (!(String(id) in known))
|
|
26
|
+
delete draft[String(id)];
|
|
27
|
+
}
|
|
28
|
+
/** What changes when a submission may have ended: which entries are there, and which inputs the run serves. */
|
|
29
|
+
export function progressOf(view) {
|
|
30
|
+
const { entries } = view;
|
|
31
|
+
return `${entries.length}:${entries[0]?.id ?? ""}:${entries.at(-1)?.id ?? ""}:${runInputs(view).join(",")}`;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=submissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submissions.js","sourceRoot":"","sources":["../src/submissions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAMjD,2FAA2F;AAC3F,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,+FAA+F;AAC/F,MAAM,UAAU,SAAS,CAAC,MAA6D;IACrF,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM;QAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IACxD,IAAI,MAAM,CAAC,MAAM,KAAK,YAAY;QAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IACjE,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACzC,OAAO,EAAE,MAAM,EAAE,YAAY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E,CAAC;AAC9G,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chopin-ai/harness-pi",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Durable harness adapter: agent service, client protocol and ACP bridge",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/CodePrometheus/chopin-ai.git",
|
|
9
|
+
"directory": "packages/harness-pi"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=24.8.0"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./protocol": {
|
|
21
|
+
"types": "./dist/protocol.d.ts",
|
|
22
|
+
"default": "./dist/protocol.js"
|
|
23
|
+
},
|
|
24
|
+
"./acp": {
|
|
25
|
+
"types": "./dist/acp.d.ts",
|
|
26
|
+
"default": "./dist/acp.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@agentclientprotocol/sdk": "^1.9.0",
|
|
34
|
+
"@chopin-ai/core": "^0.2.0",
|
|
35
|
+
"@chopin-ai/workspace": "^0.2.0",
|
|
36
|
+
"@earendil-works/chord": "1.3.0",
|
|
37
|
+
"@earendil-works/pi-ai": "1.3.0",
|
|
38
|
+
"@earendil-works/pi-durable": "1.3.0",
|
|
39
|
+
"@earendil-works/pi-env": "1.3.0",
|
|
40
|
+
"@earendil-works/pi-mcp": "1.3.0",
|
|
41
|
+
"jose": "^6.2.12",
|
|
42
|
+
"typebox": "1.3.27",
|
|
43
|
+
"ws": "^8.22.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/ws": "^8.18.2"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"image": "node scripts/build-image.mjs"
|
|
50
|
+
}
|
|
6
51
|
}
|
package/README.md
DELETED