@astrosheep/keiyaku 4.1.5 → 4.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/build/src/akuma/akuma-product.d.ts +2 -3
- package/build/src/akuma/akuma.d.ts +2 -0
- package/build/src/akuma/body.d.ts +3 -3
- package/build/src/akuma/body.js +14 -13
- package/build/src/akuma/index.d.ts +1 -1
- package/build/src/cli/commands/akuma-invoke.d.ts +2 -2
- package/build/src/library/akuma-creation.d.ts +2 -3
- package/package.json +2 -2
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { SquareRoute } from "@astrosheep/square";
|
|
2
1
|
import { AkumaHandle } from "./akuma-handle.js";
|
|
3
|
-
import type { AkumaCallContext, AkumaCallInput, AkumaConfiguration, AkumaList, AkumaListInput } from "./akuma.js";
|
|
2
|
+
import type { AkumaCallContext, AkumaCallInput, AkumaConfiguration, AkumaList, AkumaListInput, ResultRoute } from "./akuma.js";
|
|
4
3
|
import { CALL_WITH_CONTEXT } from "./akuma-product-symbols.js";
|
|
5
4
|
import type { WorldRoot } from "../world.js";
|
|
6
5
|
type AkumaCallLaunchInput = AkumaCallInput & Readonly<{
|
|
7
|
-
resultRoute?:
|
|
6
|
+
resultRoute?: ResultRoute;
|
|
8
7
|
}>;
|
|
9
8
|
export declare class Akuma {
|
|
10
9
|
private readonly path;
|
|
@@ -57,6 +57,8 @@ export type AkumaCallInput = Readonly<{
|
|
|
57
57
|
readonly?: true;
|
|
58
58
|
allowed?: readonly AllowedAction[];
|
|
59
59
|
}>;
|
|
60
|
+
/** Opaque, serializable caller result address carried across the Body process. */
|
|
61
|
+
export type ResultRoute = Readonly<unknown>;
|
|
60
62
|
export type AkumaCallContext = Readonly<{
|
|
61
63
|
initiatorCwd?: string;
|
|
62
64
|
cwdCanonical?: true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { SquareRoute } from "@astrosheep/square";
|
|
2
1
|
import { type SessionFact, type Soul } from "./heart/index.js";
|
|
3
2
|
import type { AkumaPaths } from "./identity.js";
|
|
4
3
|
import type { ProviderAdapter } from "./provider.js";
|
|
4
|
+
import type { ResultRoute } from "./akuma.js";
|
|
5
5
|
import { type UpstreamExecutionPort, type RequestChildLaunch } from "./request-serve.js";
|
|
6
6
|
import { type OwnedProcess, type RunLogReference } from "../runtime/proc/run.js";
|
|
7
7
|
export declare const LEASH_HELD_EXIT = 75;
|
|
@@ -12,7 +12,7 @@ export type BodyLaunch = Readonly<{
|
|
|
12
12
|
birthSession?: Omit<SessionFact, "sequence">;
|
|
13
13
|
initialBody?: string;
|
|
14
14
|
refuseIfHeld?: boolean;
|
|
15
|
-
resultRoute?:
|
|
15
|
+
resultRoute?: ResultRoute;
|
|
16
16
|
}>;
|
|
17
17
|
export type TellWake = Readonly<{
|
|
18
18
|
kind: "told";
|
|
@@ -45,7 +45,7 @@ type BodyRuntime = Readonly<{
|
|
|
45
45
|
now(): string;
|
|
46
46
|
spawnChild?(launch: RequestChildLaunch): Promise<void>;
|
|
47
47
|
spawnBody?(launch: BodyLaunch): Promise<OwnedProcess>;
|
|
48
|
-
express?(route:
|
|
48
|
+
express?(route: ResultRoute, options: Readonly<{
|
|
49
49
|
as: string;
|
|
50
50
|
body: string;
|
|
51
51
|
}>): Promise<unknown>;
|
package/build/src/akuma/body.js
CHANGED
|
@@ -59,21 +59,22 @@ async function launchCwd(launch) {
|
|
|
59
59
|
return (await turnRecipe(launch.paths, soul)).cwd;
|
|
60
60
|
}
|
|
61
61
|
async function persistTurn(paths, turnSequence, result, completedAt) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
if (result.kind === "answered" && result.session !== undefined) {
|
|
63
|
+
await endTurn(paths, {
|
|
64
|
+
turnSequence,
|
|
65
|
+
outcome: {
|
|
66
66
|
kind: "answered",
|
|
67
67
|
session: result.session,
|
|
68
68
|
answer: result.answer,
|
|
69
69
|
...(result.historyId === undefined ? {} : { historyId: result.historyId }),
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
},
|
|
71
|
+
completedAt,
|
|
72
|
+
});
|
|
73
|
+
return { outcome: "answered", answer: result.answer };
|
|
74
|
+
}
|
|
75
|
+
const diagnostic = result.kind === "answered" ? "Provider answered without a resumable session" : result.diagnostic;
|
|
76
|
+
await endTurn(paths, { turnSequence, outcome: { kind: "failed", diagnostic }, completedAt });
|
|
77
|
+
return { outcome: "failed", diagnostic };
|
|
77
78
|
}
|
|
78
79
|
function boundedDiagnostic(error) {
|
|
79
80
|
const text = diagnostic(error);
|
|
@@ -86,7 +87,7 @@ async function expressInitialOutcome(launch, soul, outcome, runtime) {
|
|
|
86
87
|
const express = runtime.express ?? (await import("@astrosheep/square")).express;
|
|
87
88
|
await express(launch.resultRoute, {
|
|
88
89
|
as: "keiyaku",
|
|
89
|
-
body: JSON.stringify({ akuma: soul.id, outcome }),
|
|
90
|
+
body: JSON.stringify({ akuma: soul.id, ...outcome }),
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
93
|
catch (error) {
|
|
@@ -204,7 +205,7 @@ async function runBodyTurns(input) {
|
|
|
204
205
|
const outcome = await persistTurn(launch.paths, result.turnSequence, result, runtime.now());
|
|
205
206
|
if (initial !== undefined)
|
|
206
207
|
await expressInitialOutcome(launch, soul, outcome, runtime);
|
|
207
|
-
if (outcome === "failed") {
|
|
208
|
+
if (outcome.outcome === "failed") {
|
|
208
209
|
await breakBody(launch.paths, { sequence: bodySequence, end: "broke-off", at: runtime.now() });
|
|
209
210
|
return;
|
|
210
211
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AkuId } from "./identity.js";
|
|
2
2
|
import type { WorldRoot } from "../world.js";
|
|
3
3
|
export { Akuma, AkumaHandle, AkumaNotBornError, defaultWaitComplete } from "./akuma.js";
|
|
4
|
-
export type { AkumaCallInput } from "./akuma.js";
|
|
4
|
+
export type { AkumaCallInput, ResultRoute } from "./akuma.js";
|
|
5
5
|
export { ALLOWED_ACTIONS } from "./allowed.js";
|
|
6
6
|
export type { AllowedAction, AllowedActions } from "./allowed.js";
|
|
7
7
|
export type { WorldRoot } from "../world.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SquareRoute } from "@astrosheep/square";
|
|
2
1
|
import { type AkuId, type ActivityHistory } from "../../akuma/index.js";
|
|
2
|
+
import type { ResultRoute } from "../../akuma/akuma.js";
|
|
3
3
|
import { Keiyaku, type AkumaKillResult, type AkumaHistoryResult, type AkumaObservation, type AkumaTellResult, type AkumaWaitResult, type CallResult, type ForkResult, type Keiyaku as KeiyakuContract, type Repo } from "../../index.js";
|
|
4
4
|
import type { Settings } from "../../settings.js";
|
|
5
5
|
import type { WorldRoot } from "../../world.js";
|
|
@@ -73,7 +73,7 @@ type InvokeInput = Readonly<{
|
|
|
73
73
|
settings?: Settings;
|
|
74
74
|
contract?: KeiyakuContract;
|
|
75
75
|
repo?: Repo;
|
|
76
|
-
resultRoute?:
|
|
76
|
+
resultRoute?: ResultRoute;
|
|
77
77
|
readStdin(): Promise<string>;
|
|
78
78
|
}>;
|
|
79
79
|
export declare function invokeAkuma(command: InvokedAkumaCommand, input: InvokeInput): Promise<AkumaInvocationResult>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { SquareRoute } from "@astrosheep/square";
|
|
2
1
|
import { type AliasBinding } from "../alias/index.js";
|
|
3
|
-
import { type AkumaStatus, type ForkReceipt, type ReadonlyRestraint } from "../akuma/akuma.js";
|
|
2
|
+
import { type AkumaStatus, type ForkReceipt, type ReadonlyRestraint, type ResultRoute } from "../akuma/akuma.js";
|
|
4
3
|
import type { AkuId } from "../akuma/identity.js";
|
|
5
4
|
import { type Dispatch, type DispatchFailure } from "../dispatch/index.js";
|
|
6
5
|
import { type AkumaAlias } from "../identity/selector.js";
|
|
@@ -49,7 +48,7 @@ export type CallInput = Readonly<{
|
|
|
49
48
|
contract?: Keiyaku;
|
|
50
49
|
alias?: AkumaAlias;
|
|
51
50
|
allowed?: readonly AllowedAction[];
|
|
52
|
-
resultRoute?:
|
|
51
|
+
resultRoute?: ResultRoute;
|
|
53
52
|
}>;
|
|
54
53
|
export type CallObservation = Readonly<{
|
|
55
54
|
kind: "detached";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrosheep/keiyaku",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"build"
|
|
6
6
|
],
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@agentclientprotocol/sdk": "^1.3.0",
|
|
61
61
|
"@anthropic-ai/claude-agent-sdk": "^0.3.226",
|
|
62
|
-
"@astrosheep/square": "
|
|
62
|
+
"@astrosheep/square": "0.3.13",
|
|
63
63
|
"@earendil-works/pi-coding-agent": "0.80.10",
|
|
64
64
|
"@opencode-ai/sdk": "1.18.3",
|
|
65
65
|
"cross-spawn": "^7.0.6",
|