@astrosheep/keiyaku 4.5.1 → 4.5.2
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 +8 -2
- package/build/src/akuma/akuma-product.js +9 -4
- package/build/src/akuma/body.d.ts +4 -0
- package/build/src/akuma/body.js +10 -9
- package/build/src/cli/commands/akuma-invoke.js +1 -1
- package/build/src/cli/square-edge.d.ts +1 -0
- package/build/src/cli/square-edge.js +1 -0
- package/build/src/library/akuma-creation.d.ts +1 -1
- package/build/src/library/akuma-creation.js +6 -2
- package/package.json +2 -2
|
@@ -42,11 +42,17 @@ export declare class Akuma {
|
|
|
42
42
|
listArchetypes(): Promise<readonly string[]>;
|
|
43
43
|
call(input: AkumaCallLaunchInput): Promise<AkumaHandle>;
|
|
44
44
|
beginCall(input: AkumaCallLaunchInput, context: AkumaCallContext): Promise<AkumaBornCall>;
|
|
45
|
-
finishCall(born: AkumaBornCall
|
|
45
|
+
finishCall(born: AkumaBornCall, completion?: Readonly<{
|
|
46
|
+
participantName?: string;
|
|
47
|
+
contractId?: string;
|
|
48
|
+
}>): Promise<AkumaHandle>;
|
|
46
49
|
[CALL_WITH_CONTEXT](input: AkumaCallLaunchInput, context: AkumaCallContext): Promise<AkumaHandle>;
|
|
47
50
|
list(input?: AkumaListInput): Promise<AkumaList>;
|
|
48
51
|
}
|
|
49
52
|
export declare function callAkumaWithContext(akuma: Akuma, input: AkumaCallLaunchInput, context: AkumaCallContext): Promise<AkumaHandle>;
|
|
50
53
|
export declare function beginAkumaCall(akuma: Akuma, input: AkumaCallLaunchInput, context: AkumaCallContext): Promise<AkumaBornCall>;
|
|
51
|
-
export declare function finishAkumaCall(akuma: Akuma, born: AkumaBornCall
|
|
54
|
+
export declare function finishAkumaCall(akuma: Akuma, born: AkumaBornCall, completion?: Readonly<{
|
|
55
|
+
participantName?: string;
|
|
56
|
+
contractId?: string;
|
|
57
|
+
}>): Promise<AkumaHandle>;
|
|
52
58
|
export {};
|
|
@@ -112,13 +112,18 @@ export class Akuma {
|
|
|
112
112
|
},
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
async finishCall(born) {
|
|
115
|
+
async finishCall(born, completion = {}) {
|
|
116
116
|
if (born.kind === "requested") {
|
|
117
117
|
return new AkumaHandle(born.id, this.path, { cwd: born.cwd, source: born.execution.source });
|
|
118
118
|
}
|
|
119
119
|
const published = await launchAkuma({
|
|
120
120
|
allocated: born.allocated,
|
|
121
|
-
launch: async (allocated) => await spawnAkumaBody({
|
|
121
|
+
launch: async (allocated) => await spawnAkumaBody({
|
|
122
|
+
paths: allocated.paths,
|
|
123
|
+
seed: born.seed,
|
|
124
|
+
initialBody: born.initialBody,
|
|
125
|
+
...(Object.keys(completion).length === 0 ? {} : { completion }),
|
|
126
|
+
}),
|
|
122
127
|
});
|
|
123
128
|
return new AkumaHandle(published.id, this.path, {
|
|
124
129
|
cwd: born.execution.cwd,
|
|
@@ -174,6 +179,6 @@ export async function callAkumaWithContext(akuma, input, context) {
|
|
|
174
179
|
export async function beginAkumaCall(akuma, input, context) {
|
|
175
180
|
return await akuma.beginCall(input, context);
|
|
176
181
|
}
|
|
177
|
-
export async function finishAkumaCall(akuma, born) {
|
|
178
|
-
return await akuma.finishCall(born);
|
|
182
|
+
export async function finishAkumaCall(akuma, born, completion = {}) {
|
|
183
|
+
return await akuma.finishCall(born, completion);
|
|
179
184
|
}
|
|
@@ -11,6 +11,10 @@ export type BodyLaunch = Readonly<{
|
|
|
11
11
|
birthSession?: Omit<SessionFact, "sequence">;
|
|
12
12
|
initialBody?: string;
|
|
13
13
|
refuseIfHeld?: boolean;
|
|
14
|
+
completion?: Readonly<{
|
|
15
|
+
participantName?: string;
|
|
16
|
+
contractId?: string;
|
|
17
|
+
}>;
|
|
14
18
|
}>;
|
|
15
19
|
export type TellWake = Readonly<{
|
|
16
20
|
kind: "told";
|
package/build/src/akuma/body.js
CHANGED
|
@@ -78,18 +78,19 @@ async function persistTurn(paths, turnSequence, result, completedAt) {
|
|
|
78
78
|
await endTurn(paths, { turnSequence, outcome: { kind: "failed", diagnostic }, completedAt });
|
|
79
79
|
return { outcome: "failed", diagnostic };
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
function completionMessage(identity, completion) {
|
|
82
|
+
const participant = completion?.participantName;
|
|
83
|
+
const contract = completion?.contractId;
|
|
84
|
+
const header = [identity, participant === undefined ? undefined : `(@${participant})`, contract]
|
|
85
|
+
.filter((value) => value !== undefined)
|
|
86
|
+
.join(" ");
|
|
87
|
+
return `${header}\n✓ came back`;
|
|
87
88
|
}
|
|
88
89
|
function boundedDiagnostic(error) {
|
|
89
90
|
const text = diagnostic(error);
|
|
90
91
|
return text.length <= 500 ? text : `${text.slice(0, 500)}...`;
|
|
91
92
|
}
|
|
92
|
-
async function expressInitialOutcome(launch
|
|
93
|
+
async function expressInitialOutcome(launch) {
|
|
93
94
|
try {
|
|
94
95
|
const { Square } = await import("@astrosheep/square");
|
|
95
96
|
const identity = launch.seed?.id ?? (await readHeart(launch.paths)).soul?.id;
|
|
@@ -100,7 +101,7 @@ async function expressInitialOutcome(launch, outcome) {
|
|
|
100
101
|
const joined = await square.implicitJoin(identity);
|
|
101
102
|
if (joined.state === "done" || joined.participant === undefined)
|
|
102
103
|
return;
|
|
103
|
-
await joined.participant.express(
|
|
104
|
+
await joined.participant.express(completionMessage(identity, launch.completion));
|
|
104
105
|
}
|
|
105
106
|
finally {
|
|
106
107
|
await square.close();
|
|
@@ -217,7 +218,7 @@ async function runBodyTurns(input) {
|
|
|
217
218
|
}
|
|
218
219
|
const outcome = await persistTurn(launch.paths, result.turnSequence, result, runtime.now());
|
|
219
220
|
if (initial !== undefined)
|
|
220
|
-
await expressInitialOutcome(launch
|
|
221
|
+
await expressInitialOutcome(launch);
|
|
221
222
|
if (outcome.outcome === "failed") {
|
|
222
223
|
await breakBody(launch.paths, { sequence: bodySequence, end: "broke-off", at: runtime.now() });
|
|
223
224
|
return;
|
|
@@ -124,7 +124,7 @@ export async function invokeAkuma(command, input) {
|
|
|
124
124
|
: undefined;
|
|
125
125
|
let result;
|
|
126
126
|
try {
|
|
127
|
-
result = await (input.finishCall ?? finishCall)(born);
|
|
127
|
+
result = await (input.finishCall ?? finishCall)(born, listener?.participantName);
|
|
128
128
|
}
|
|
129
129
|
catch (error) {
|
|
130
130
|
if (listener?.committed === true) {
|
|
@@ -2,5 +2,6 @@ import type { AllocatedAkuma } from "../akuma/identity.js";
|
|
|
2
2
|
import { type WorldRoot } from "../world.js";
|
|
3
3
|
export declare function recognizeAndListen(worldRoot: WorldRoot, environment: NodeJS.ProcessEnv, allocated: AllocatedAkuma): Promise<{
|
|
4
4
|
committed: boolean;
|
|
5
|
+
participantName: string;
|
|
5
6
|
rollback(): Promise<void>;
|
|
6
7
|
} | void>;
|
|
@@ -99,6 +99,6 @@ export type ForkResult = Readonly<{
|
|
|
99
99
|
parent: AkuId;
|
|
100
100
|
}>);
|
|
101
101
|
export declare function beginCall(input: CallInput): Promise<BornCall>;
|
|
102
|
-
export declare function finishCall(born: BornCall): Promise<CallResult>;
|
|
102
|
+
export declare function finishCall(born: BornCall, participantName?: string): Promise<CallResult>;
|
|
103
103
|
export declare function callKeiyaku(input: CallInput): Promise<CallResult>;
|
|
104
104
|
export declare function forkKeiyaku(input: ForkInput): Promise<ForkResult>;
|
|
@@ -236,9 +236,13 @@ export async function beginCall(input) {
|
|
|
236
236
|
alias: aliasStage,
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
export async function finishCall(born) {
|
|
239
|
+
export async function finishCall(born, participantName) {
|
|
240
240
|
const world = akumaWorld(born.path);
|
|
241
|
-
const
|
|
241
|
+
const contractId = born.dispatch.kind === "dispatched" ? born.dispatch.dispatch.contractId : undefined;
|
|
242
|
+
const handle = await finishAkumaCall(world, born.born, {
|
|
243
|
+
...(participantName === undefined ? {} : { participantName }),
|
|
244
|
+
...(contractId === undefined ? {} : { contractId }),
|
|
245
|
+
});
|
|
242
246
|
const readonly = (await handle.status()).readonly;
|
|
243
247
|
const observation = await observeCall(handle, born.mode, born.timeoutMs);
|
|
244
248
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrosheep/keiyaku",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.2",
|
|
4
4
|
"files": [
|
|
5
5
|
"build"
|
|
6
6
|
],
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@agentclientprotocol/sdk": "^1.3.0",
|
|
66
66
|
"@anthropic-ai/claude-agent-sdk": "^0.3.226",
|
|
67
|
-
"@astrosheep/square": "0.3.
|
|
67
|
+
"@astrosheep/square": "0.3.24",
|
|
68
68
|
"@earendil-works/pi-coding-agent": "0.80.10",
|
|
69
69
|
"@opencode-ai/sdk": "1.18.3",
|
|
70
70
|
"cross-spawn": "^7.0.6",
|