@cydm/happy-elves 0.1.0-beta.57 → 0.1.0-beta.58
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/apps/cli/dist/commands/lib/exit.js +2 -0
- package/apps/cli/dist/commands/lib/orchestrator.d.ts +3 -0
- package/apps/cli/dist/commands/lib/orchestrator.js +3 -0
- package/apps/cli/dist/commands/lib/session-output.js +1 -1
- package/apps/cli/dist/commands/lib/session-view.d.ts +2 -1
- package/apps/cli/dist/commands/lib/session-view.js +34 -23
- package/apps/cli/dist/commands/orchestrator.js +301 -64
- package/apps/cli/dist/commands/session.js +4 -1
- package/apps/cli/dist/commands/skill.js +83 -2
- package/apps/cli/dist/commands/turn.js +1 -1
- package/apps/cli/dist/skills/registry.js +15 -1
- package/apps/daemon/dist/gateway/runtime.js +31 -7
- package/apps/daemon/dist/relay/connection-diagnostics.d.ts +30 -0
- package/apps/daemon/dist/relay/connection-diagnostics.js +60 -0
- package/apps/daemon/dist/relay/connection.js +65 -16
- package/apps/daemon/dist/relay/devtools.js +2 -0
- package/apps/daemon/package.json +1 -1
- package/apps/relay/dist/index.js +2 -1
- package/apps/relay/dist/session-projection-reducer.js +5 -7
- package/npm-shrinkwrap.json +532 -2
- package/package.json +2 -1
- package/packages/shared/dist/protocol-schemas.d.ts +24 -0
- package/packages/shared/dist/protocol-schemas.js +17 -0
- package/packages/shared/dist/protocol-types.d.ts +17 -0
- package/packages/shared/dist/protocol.d.ts +10 -0
|
@@ -127,6 +127,8 @@ export function handleCliError(error) {
|
|
|
127
127
|
latestCompletedTurnId: enriched.latestCompletedTurnId,
|
|
128
128
|
commandAcked: enriched.commandAcked,
|
|
129
129
|
rawStatus: enriched.rawStatus,
|
|
130
|
+
lastTransientError: enriched.lastTransientError,
|
|
131
|
+
retryCount: enriched.retryCount,
|
|
130
132
|
}, enriched.capability, enriched.retryable);
|
|
131
133
|
process.exit(1);
|
|
132
134
|
}
|
|
@@ -5,6 +5,9 @@ export type OrchestratorStatus = "idle" | "inProgress" | "completed" | "needsInp
|
|
|
5
5
|
export type OrchestratorRequestRecord = {
|
|
6
6
|
turnId: string;
|
|
7
7
|
promptSha256: string;
|
|
8
|
+
inputSha256?: string;
|
|
9
|
+
sourceOutputSha256?: string;
|
|
10
|
+
runtimeTurnId?: string;
|
|
8
11
|
model?: string | null;
|
|
9
12
|
thoughtLevel?: string | null;
|
|
10
13
|
createdAt: number;
|
|
@@ -78,6 +78,9 @@ export function readOrchestratorMetadata(metadata) {
|
|
|
78
78
|
requests[requestId] = {
|
|
79
79
|
turnId: candidate.turnId,
|
|
80
80
|
promptSha256: candidate.promptSha256,
|
|
81
|
+
...(typeof candidate.inputSha256 === "string" ? { inputSha256: candidate.inputSha256 } : {}),
|
|
82
|
+
...(typeof candidate.sourceOutputSha256 === "string" ? { sourceOutputSha256: candidate.sourceOutputSha256 } : {}),
|
|
83
|
+
...(typeof candidate.runtimeTurnId === "string" ? { runtimeTurnId: candidate.runtimeTurnId } : {}),
|
|
81
84
|
...(candidate.model === null || typeof candidate.model === "string" ? { model: candidate.model } : {}),
|
|
82
85
|
...(candidate.thoughtLevel === null || typeof candidate.thoughtLevel === "string" ? { thoughtLevel: candidate.thoughtLevel } : {}),
|
|
83
86
|
createdAt: candidate.createdAt,
|
|
@@ -234,7 +234,7 @@ export function summarizeTurns(events) {
|
|
|
234
234
|
.map(({ order: _order, ...turn }) => turn);
|
|
235
235
|
}
|
|
236
236
|
export function structuredOutputForTurn(sessionId, turn) {
|
|
237
|
-
const finalOutput = turn.output || turn.terminalText || undefined;
|
|
237
|
+
const finalOutput = turn.status !== "running" ? turn.output || turn.terminalText || undefined : undefined;
|
|
238
238
|
return {
|
|
239
239
|
state: turn.status,
|
|
240
240
|
sessionId,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ControllerClient, DecodedSessionEvent } from "../../../../../packages/client/dist/index.js";
|
|
2
2
|
import type { MachineSnapshot, SessionSnapshot } from "../../../../../packages/shared/dist/index.js";
|
|
3
3
|
import { type MachineMetadata, type OrchestrationSummary, type OrchestrationState } from "./types.js";
|
|
4
|
+
import { type TurnSummary } from "./session-output.js";
|
|
4
5
|
export declare function showMachine(client: ControllerClient, machine: MachineSnapshot): Promise<MachineSnapshot & {
|
|
5
6
|
defaultCwd?: string;
|
|
6
7
|
metadata: MachineMetadata;
|
|
7
8
|
}>;
|
|
8
|
-
export declare function deriveOrchestration(session: SessionSnapshot, events?: DecodedSessionEvent[]): OrchestrationSummary;
|
|
9
|
+
export declare function deriveOrchestration(session: SessionSnapshot, events?: DecodedSessionEvent[], focusTurn?: Pick<TurnSummary, "turnId" | "status">): OrchestrationSummary;
|
|
9
10
|
export declare function showSession(client: ControllerClient, session: SessionSnapshot, events?: DecodedSessionEvent[]): Promise<SessionSnapshot & {
|
|
10
11
|
metadata: unknown;
|
|
11
12
|
orchestration: OrchestrationSummary;
|
|
@@ -38,23 +38,44 @@ function orchestrationStateFromStatus(status) {
|
|
|
38
38
|
return "blocked";
|
|
39
39
|
return "closed";
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
function canTrustVisibleRunningTurn(status) {
|
|
42
|
+
return status !== "closed" && status !== "offline" && status !== "cancelled";
|
|
43
|
+
}
|
|
44
|
+
function visibleRunningTurnSummary(session, turnId) {
|
|
45
|
+
return {
|
|
46
|
+
state: "active",
|
|
47
|
+
rawStatus: session.status,
|
|
48
|
+
needsUser: false,
|
|
49
|
+
blocked: false,
|
|
50
|
+
completed: false,
|
|
51
|
+
...(session.status !== "running" ? {
|
|
52
52
|
statusConflict: {
|
|
53
53
|
rawStatus: session.status,
|
|
54
54
|
evidence: "running-turn",
|
|
55
|
-
turnId
|
|
55
|
+
turnId,
|
|
56
56
|
},
|
|
57
|
-
}
|
|
57
|
+
} : {}),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export function deriveOrchestration(session, events = [], focusTurn) {
|
|
61
|
+
const turns = summarizeTurns(events);
|
|
62
|
+
const latestTurn = turns[0];
|
|
63
|
+
const activeTurn = turns.find((turn) => turn.status === "running") ?? (focusTurn?.status === "running" ? focusTurn : undefined);
|
|
64
|
+
const latestTerminalTurn = turns.find((turn) => turn.status !== "running");
|
|
65
|
+
const relevantTurnId = activeTurn?.turnId ?? latestTerminalTurn?.turnId;
|
|
66
|
+
const needsUserEvent = relevantTurnId
|
|
67
|
+
? [...events].reverse().find((event) => event.turnId === relevantTurnId && eventNeedsUser(event))
|
|
68
|
+
: undefined;
|
|
69
|
+
if (needsUserEvent && activeTurn)
|
|
70
|
+
return needsUserSummary(session, needsUserEvent);
|
|
71
|
+
if (needsUserEvent && latestTerminalTurn && latestTerminalTurn.status !== "completed") {
|
|
72
|
+
return needsUserSummary(session, needsUserEvent);
|
|
73
|
+
}
|
|
74
|
+
if (latestTurn?.status === "running" && canTrustVisibleRunningTurn(session.status)) {
|
|
75
|
+
return visibleRunningTurnSummary(session, latestTurn.turnId);
|
|
76
|
+
}
|
|
77
|
+
if (focusTurn?.status === "running" && canTrustVisibleRunningTurn(session.status)) {
|
|
78
|
+
return visibleRunningTurnSummary(session, focusTurn.turnId);
|
|
58
79
|
}
|
|
59
80
|
if (session.status !== "running") {
|
|
60
81
|
const state = orchestrationStateFromStatus(session.status);
|
|
@@ -66,16 +87,6 @@ export function deriveOrchestration(session, events = []) {
|
|
|
66
87
|
completed: state === "completed",
|
|
67
88
|
};
|
|
68
89
|
}
|
|
69
|
-
const latestTerminalTurn = turns.find((turn) => turn.status !== "running");
|
|
70
|
-
const relevantTurnId = activeTurn?.turnId ?? latestTerminalTurn?.turnId;
|
|
71
|
-
const needsUserEvent = relevantTurnId
|
|
72
|
-
? [...events].reverse().find((event) => event.turnId === relevantTurnId && eventNeedsUser(event))
|
|
73
|
-
: undefined;
|
|
74
|
-
if (needsUserEvent && activeTurn)
|
|
75
|
-
return needsUserSummary(session, needsUserEvent);
|
|
76
|
-
if (needsUserEvent && latestTerminalTurn && latestTerminalTurn.status !== "completed") {
|
|
77
|
-
return needsUserSummary(session, needsUserEvent);
|
|
78
|
-
}
|
|
79
90
|
if (activeTurn) {
|
|
80
91
|
return {
|
|
81
92
|
state: "active",
|