@poncho-ai/cli 0.37.0 → 0.38.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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +225 -0
- package/dist/{chunk-GUGBKAIM.js → chunk-U643TWFX.js} +6188 -4727
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +186 -128
- package/dist/index.js +111 -5
- package/dist/run-interactive-ink-CE7U47S5.js +679 -0
- package/package.json +4 -4
- package/src/cron-helpers.ts +174 -0
- package/src/http-utils.ts +220 -0
- package/src/index.ts +998 -4741
- package/src/logger.ts +9 -0
- package/src/mcp-commands.ts +283 -0
- package/src/project-init.ts +150 -0
- package/src/run-commands.ts +145 -0
- package/src/scaffolding.ts +528 -0
- package/src/skills.ts +372 -0
- package/src/templates.ts +563 -0
- package/src/testing.ts +108 -0
- package/src/web-ui-client.ts +865 -94
- package/src/web-ui-styles.ts +278 -1
- package/src/web-ui.ts +24 -0
- package/test/cli.test.ts +52 -1
- package/dist/run-interactive-ink-75GKYSEC.js +0 -2115
- package/test/run-orchestration.test.ts +0 -171
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import type { AgentEvent, Message } from "@poncho-ai/sdk";
|
|
3
|
-
import { __internalRunOrchestration } from "../src/index.js";
|
|
4
|
-
|
|
5
|
-
const baseMessages: Message[] = [{ role: "user", content: "hello" }];
|
|
6
|
-
|
|
7
|
-
describe("run orchestration helpers", () => {
|
|
8
|
-
it("falls back to user messages when harness history is unavailable", () => {
|
|
9
|
-
const conversation = {
|
|
10
|
-
messages: baseMessages,
|
|
11
|
-
_harnessMessages: "invalid",
|
|
12
|
-
};
|
|
13
|
-
const resolved = __internalRunOrchestration.loadRunHistory(
|
|
14
|
-
conversation as unknown as { messages: Message[]; _harnessMessages?: unknown; _continuationMessages?: unknown },
|
|
15
|
-
);
|
|
16
|
-
expect(resolved.source).toBe("messages");
|
|
17
|
-
expect(resolved.shouldRebuildCanonical).toBe(true);
|
|
18
|
-
expect(resolved.messages).toEqual(baseMessages);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("prefers continuation history when requested", () => {
|
|
22
|
-
const continuation: Message[] = [{ role: "assistant", content: "next" }];
|
|
23
|
-
const conversation = {
|
|
24
|
-
messages: baseMessages,
|
|
25
|
-
_harnessMessages: baseMessages,
|
|
26
|
-
_continuationMessages: continuation,
|
|
27
|
-
};
|
|
28
|
-
const resolved = __internalRunOrchestration.loadRunHistory(
|
|
29
|
-
conversation as unknown as { messages: Message[]; _harnessMessages?: unknown; _continuationMessages?: unknown },
|
|
30
|
-
{ preferContinuation: true },
|
|
31
|
-
);
|
|
32
|
-
expect(resolved.source).toBe("continuation");
|
|
33
|
-
expect(resolved.messages).toEqual(continuation);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("normalizes legacy approval checkpoint payloads", () => {
|
|
37
|
-
const normalized = __internalRunOrchestration.normalizeApprovalCheckpoint(
|
|
38
|
-
{
|
|
39
|
-
approvalId: "approval_1",
|
|
40
|
-
runId: "run_1",
|
|
41
|
-
tool: "read_file",
|
|
42
|
-
toolCallId: "tool_1",
|
|
43
|
-
input: {},
|
|
44
|
-
checkpointMessages: undefined,
|
|
45
|
-
baseMessageCount: -1,
|
|
46
|
-
pendingToolCalls: [{ id: "t2", name: "list_directory", input: {} }, { foo: "bar" }],
|
|
47
|
-
} as unknown as {
|
|
48
|
-
approvalId: string;
|
|
49
|
-
runId: string;
|
|
50
|
-
tool: string;
|
|
51
|
-
toolCallId?: string;
|
|
52
|
-
input: Record<string, unknown>;
|
|
53
|
-
checkpointMessages?: Message[];
|
|
54
|
-
baseMessageCount?: number;
|
|
55
|
-
pendingToolCalls?: Array<{ id: string; name: string; input: Record<string, unknown> }>;
|
|
56
|
-
decision?: "approved" | "denied";
|
|
57
|
-
},
|
|
58
|
-
baseMessages,
|
|
59
|
-
);
|
|
60
|
-
expect(normalized.checkpointMessages).toEqual(baseMessages);
|
|
61
|
-
expect(normalized.baseMessageCount).toBe(0);
|
|
62
|
-
expect(normalized.pendingToolCalls).toEqual([{ id: "t2", name: "list_directory", input: {} }]);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("builds checkpoint approvals with a canonical shape", () => {
|
|
66
|
-
const checkpoints = __internalRunOrchestration.buildApprovalCheckpoints({
|
|
67
|
-
approvals: [
|
|
68
|
-
{
|
|
69
|
-
approvalId: "approval_1",
|
|
70
|
-
tool: "read_file",
|
|
71
|
-
toolCallId: "tool_1",
|
|
72
|
-
input: { path: "README.md" },
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
runId: "run_1",
|
|
76
|
-
checkpointMessages: baseMessages,
|
|
77
|
-
baseMessageCount: 2,
|
|
78
|
-
pendingToolCalls: [{ id: "tool_2", name: "list_directory", input: {} }],
|
|
79
|
-
});
|
|
80
|
-
expect(checkpoints).toEqual([
|
|
81
|
-
{
|
|
82
|
-
approvalId: "approval_1",
|
|
83
|
-
runId: "run_1",
|
|
84
|
-
tool: "read_file",
|
|
85
|
-
toolCallId: "tool_1",
|
|
86
|
-
input: { path: "README.md" },
|
|
87
|
-
checkpointMessages: baseMessages,
|
|
88
|
-
baseMessageCount: 2,
|
|
89
|
-
pendingToolCalls: [{ id: "tool_2", name: "list_directory", input: {} }],
|
|
90
|
-
},
|
|
91
|
-
]);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it("resolves run request by preferring continuation and preserves rebuild signal", () => {
|
|
95
|
-
const continuation: Message[] = [{ role: "assistant", content: "continuation" }];
|
|
96
|
-
const resolved = __internalRunOrchestration.resolveRunRequest(
|
|
97
|
-
{
|
|
98
|
-
messages: baseMessages,
|
|
99
|
-
_harnessMessages: "invalid",
|
|
100
|
-
_continuationMessages: continuation,
|
|
101
|
-
} as unknown as { messages: Message[]; _harnessMessages?: unknown; _continuationMessages?: unknown },
|
|
102
|
-
{
|
|
103
|
-
conversationId: "conv_1",
|
|
104
|
-
messages: baseMessages,
|
|
105
|
-
preferContinuation: true,
|
|
106
|
-
},
|
|
107
|
-
);
|
|
108
|
-
expect(resolved.source).toBe("continuation");
|
|
109
|
-
expect(resolved.messages).toEqual(continuation);
|
|
110
|
-
expect(resolved.shouldRebuildCanonical).toBe(true);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it("records standard draft events for tool timeline and text", () => {
|
|
114
|
-
const draft = __internalRunOrchestration.createTurnDraftState();
|
|
115
|
-
__internalRunOrchestration.recordStandardTurnEvent(
|
|
116
|
-
draft,
|
|
117
|
-
{ type: "tool:started", runId: "run_1", step: 1, tool: "read_file", input: {} } as AgentEvent,
|
|
118
|
-
);
|
|
119
|
-
__internalRunOrchestration.recordStandardTurnEvent(
|
|
120
|
-
draft,
|
|
121
|
-
{ type: "tool:completed", runId: "run_1", step: 1, tool: "read_file", duration: 42, output: {} } as AgentEvent,
|
|
122
|
-
);
|
|
123
|
-
__internalRunOrchestration.recordStandardTurnEvent(
|
|
124
|
-
draft,
|
|
125
|
-
{ type: "model:chunk", runId: "run_1", step: 1, content: "done" } as AgentEvent,
|
|
126
|
-
);
|
|
127
|
-
expect(draft.toolTimeline).toEqual(["- start `read_file`", "- done `read_file` (42ms)"]);
|
|
128
|
-
expect(draft.assistantResponse).toBe("done");
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it("executes a conversation turn through the shared executor", async () => {
|
|
132
|
-
const events: AgentEvent[] = [
|
|
133
|
-
{ type: "run:started", runId: "run_1", startedAt: Date.now() } as AgentEvent,
|
|
134
|
-
{ type: "tool:started", runId: "run_1", step: 1, tool: "list_directory", input: {} } as AgentEvent,
|
|
135
|
-
{ type: "model:chunk", runId: "run_1", step: 1, content: "hello" } as AgentEvent,
|
|
136
|
-
{
|
|
137
|
-
type: "run:completed",
|
|
138
|
-
runId: "run_1",
|
|
139
|
-
result: {
|
|
140
|
-
status: "completed",
|
|
141
|
-
response: "hello",
|
|
142
|
-
steps: 2,
|
|
143
|
-
duration: 10,
|
|
144
|
-
continuation: false,
|
|
145
|
-
continuationMessages: baseMessages,
|
|
146
|
-
usage: { inputTokens: 1, outputTokens: 1 },
|
|
147
|
-
contextTokens: 321,
|
|
148
|
-
contextWindow: 1000,
|
|
149
|
-
},
|
|
150
|
-
} as AgentEvent,
|
|
151
|
-
];
|
|
152
|
-
const fakeHarness = {
|
|
153
|
-
async *runWithTelemetry() {
|
|
154
|
-
for (const event of events) yield event;
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
const seenTypes: string[] = [];
|
|
158
|
-
const result = await __internalRunOrchestration.executeConversationTurn({
|
|
159
|
-
harness: fakeHarness as never,
|
|
160
|
-
runInput: { task: "test", messages: baseMessages, conversationId: "conv_1" } as never,
|
|
161
|
-
onEvent: (event) => {
|
|
162
|
-
seenTypes.push(event.type);
|
|
163
|
-
},
|
|
164
|
-
});
|
|
165
|
-
expect(result.latestRunId).toBe("run_1");
|
|
166
|
-
expect(result.runSteps).toBe(2);
|
|
167
|
-
expect(result.runContextTokens).toBe(321);
|
|
168
|
-
expect(result.draft.assistantResponse).toBe("hello");
|
|
169
|
-
expect(seenTypes).toEqual(["run:started", "tool:started", "model:chunk", "run:completed"]);
|
|
170
|
-
});
|
|
171
|
-
});
|