@poncho-ai/sdk 1.9.0 → 1.11.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 +4 -4
- package/CHANGELOG.md +70 -0
- package/dist/index.d.ts +49 -1
- package/package.json +1 -1
- package/src/api-types.ts +21 -0
- package/src/index.ts +25 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/sdk@1.
|
|
2
|
+
> @poncho-ai/sdk@1.11.0 build /home/runner/work/poncho-ai/poncho-ai/packages/sdk
|
|
3
3
|
> tsup src/index.ts --format esm --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2022
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[32mESM[39m [1mdist/index.js [22m[32m17.24 KB[39m
|
|
11
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m ⚡️ Build success in 21ms
|
|
12
12
|
[34mDTS[39m Build start
|
|
13
|
-
[32mDTS[39m ⚡️ Build success in
|
|
14
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
13
|
+
[32mDTS[39m ⚡️ Build success in 1385ms
|
|
14
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m29.09 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# @poncho-ai/sdk
|
|
2
2
|
|
|
3
|
+
## 1.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`1adaae2`](https://github.com/cesr/poncho-ai/commit/1adaae2d4cc55800f01d602f2a7d6ecc65031443) Thanks [@cesr](https://github.com/cesr)! - harness: device-dispatch mode for tools that execute on a connected client
|
|
8
|
+
|
|
9
|
+
Tools can now be marked `dispatch: "device"` on `loadedConfig.tools`. When
|
|
10
|
+
the model calls such a tool the dispatcher pauses the run, emits a new
|
|
11
|
+
`tool:device:required` event, and checkpoints with the new
|
|
12
|
+
`kind: "device"` discriminator on `pendingApprovals` — same plumbing as
|
|
13
|
+
the approval flow, different trigger and different resume payload.
|
|
14
|
+
Consumers (e.g. PonchOS for iOS device tools) drive the external
|
|
15
|
+
execution and feed the result back via `continueFromToolResult`.
|
|
16
|
+
|
|
17
|
+
Approval can be combined: `{access: "approval", dispatch: "device"}`
|
|
18
|
+
yields the approval card first, then on resume falls through to the
|
|
19
|
+
device-required event. The wire vocabulary for approvals
|
|
20
|
+
(`approvalId` etc.) is unchanged; the `pendingApprovals` column /
|
|
21
|
+
field name stays.
|
|
22
|
+
|
|
23
|
+
`ToolAccess` is broadened to accept both the legacy string `"approval"`
|
|
24
|
+
and the new `{access?, dispatch?}` object form. Existing configs keep
|
|
25
|
+
working unchanged.
|
|
26
|
+
|
|
27
|
+
## 1.10.0
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- [#104](https://github.com/cesr/poncho-ai/pull/104) [`9616060`](https://github.com/cesr/poncho-ai/commit/96160607502c2c0b05bc60b67b8fc012f4052ef1) Thanks [@cesr](https://github.com/cesr)! - dev: add a Files mode to the sidebar with VFS browsing, preview, and uploads
|
|
32
|
+
|
|
33
|
+
The web UI sidebar now has a Chats / Files segmented control. Switching to
|
|
34
|
+
Files reveals a folder-tree view of the agent's VFS — the same storage the
|
|
35
|
+
agent reads and writes via `read_file`, `write_file`, and the virtualized
|
|
36
|
+
`bash` tool. Folders expand inline with the same caret/dropdown pattern as
|
|
37
|
+
the Cron jobs section. Clicking a file previews it in the main panel:
|
|
38
|
+
- Text / JSON / source code render as a wrapped `<pre>` (5 MB cap), with an Edit button for inline editing (last-write-wins via PUT).
|
|
39
|
+
- Images render inline.
|
|
40
|
+
- PDFs render in an embedded iframe.
|
|
41
|
+
- Audio and video render with native controls.
|
|
42
|
+
- Anything else shows a placeholder card with a Download button.
|
|
43
|
+
|
|
44
|
+
Files can be added directly from the UI: an Upload button (multi-file
|
|
45
|
+
picker), drag-and-drop onto the explorer or onto a specific folder row, and
|
|
46
|
+
a New folder button. Files and folders are deletable via a hover-X with a
|
|
47
|
+
two-step confirm. Conflicts prompt to overwrite. Four new HTTP routes back
|
|
48
|
+
this UI: `GET /api/vfs-list`, `PUT /api/vfs/{path}`, `DELETE /api/vfs/{path}`,
|
|
49
|
+
and `POST /api/vfs-mkdir`. URLs of the form `/f/{path}` deep-link to a file
|
|
50
|
+
preview; the chat composer is hidden while previewing a file.
|
|
51
|
+
|
|
52
|
+
The same routes are exposed on `AgentClient` for programmatic use:
|
|
53
|
+
`listDir`, `writeFile`, `deleteFile`, and `mkdir` (alongside the existing
|
|
54
|
+
`readFile`). New shared types `ApiVfsEntry`, `ApiVfsListResponse`, and
|
|
55
|
+
`ApiVfsWriteResponse` are exported from `@poncho-ai/sdk`.
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- [`524df41`](https://github.com/cesr/poncho-ai/commit/524df411904bd00c07901695eda6d4dd07dde972) Thanks [@cesr](https://github.com/cesr)! - fix: persist harness messages on cancelled runs so the agent doesn't lose context
|
|
60
|
+
|
|
61
|
+
When a run was cancelled (Stop button, abort signal), `conversation.messages`
|
|
62
|
+
was updated with the partial assistant turn but `conversation._harnessMessages`
|
|
63
|
+
— the canonical history `loadCanonicalHistory` hands to the model on the next
|
|
64
|
+
turn — was left holding a snapshot from the _previous_ successful run. The
|
|
65
|
+
agent had no memory of the cancelled work, even though the user-facing UI
|
|
66
|
+
still showed it. The new verbose-mode harness toggle made this divergence
|
|
67
|
+
directly visible.
|
|
68
|
+
|
|
69
|
+
The fix plumbs an in-flight `messages` snapshot through the `run:cancelled`
|
|
70
|
+
event, trims it to a model-valid prefix (no orphan `tool_use`), and persists
|
|
71
|
+
it as `_harnessMessages` on every cancel path in the CLI.
|
|
72
|
+
|
|
3
73
|
## 1.9.0
|
|
4
74
|
|
|
5
75
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -595,6 +595,27 @@ interface ApiSlashCommand {
|
|
|
595
595
|
description: string;
|
|
596
596
|
type: "command" | "skill";
|
|
597
597
|
}
|
|
598
|
+
interface ApiVfsEntry {
|
|
599
|
+
name: string;
|
|
600
|
+
type: "file" | "directory" | "symlink";
|
|
601
|
+
size: number;
|
|
602
|
+
mimeType: string | null;
|
|
603
|
+
updatedAt: number | null;
|
|
604
|
+
}
|
|
605
|
+
interface ApiVfsListResponse {
|
|
606
|
+
path: string;
|
|
607
|
+
entries: ApiVfsEntry[];
|
|
608
|
+
usage: {
|
|
609
|
+
fileCount: number;
|
|
610
|
+
totalBytes: number;
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
interface ApiVfsWriteResponse {
|
|
614
|
+
path: string;
|
|
615
|
+
size: number;
|
|
616
|
+
mimeType: string | null;
|
|
617
|
+
updatedAt: number;
|
|
618
|
+
}
|
|
598
619
|
|
|
599
620
|
declare const LEVELS: {
|
|
600
621
|
readonly debug: 10;
|
|
@@ -770,6 +791,7 @@ type AgentEvent = {
|
|
|
770
791
|
} | {
|
|
771
792
|
type: "run:cancelled";
|
|
772
793
|
runId: string;
|
|
794
|
+
messages?: Message[];
|
|
773
795
|
} | {
|
|
774
796
|
type: "run:error";
|
|
775
797
|
runId: string;
|
|
@@ -836,6 +858,32 @@ type AgentEvent = {
|
|
|
836
858
|
name: string;
|
|
837
859
|
input: Record<string, unknown>;
|
|
838
860
|
}>;
|
|
861
|
+
} | {
|
|
862
|
+
/**
|
|
863
|
+
* Tool wants to execute on a connected client device (e.g. iOS).
|
|
864
|
+
* The consumer of the harness is responsible for routing this event
|
|
865
|
+
* to the appropriate WebSocket and POSTing the tool's result back via
|
|
866
|
+
* `resumeRunFromCheckpoint`. Carries the same envelope as the
|
|
867
|
+
* approval-required event; `requestId` plays the role of `approvalId`.
|
|
868
|
+
*/
|
|
869
|
+
type: "tool:device:required";
|
|
870
|
+
tool: string;
|
|
871
|
+
input: unknown;
|
|
872
|
+
requestId: string;
|
|
873
|
+
} | {
|
|
874
|
+
type: "tool:device:checkpoint";
|
|
875
|
+
approvals: Array<{
|
|
876
|
+
approvalId: string;
|
|
877
|
+
tool: string;
|
|
878
|
+
toolCallId: string;
|
|
879
|
+
input: Record<string, unknown>;
|
|
880
|
+
}>;
|
|
881
|
+
checkpointMessages: Message[];
|
|
882
|
+
pendingToolCalls: Array<{
|
|
883
|
+
id: string;
|
|
884
|
+
name: string;
|
|
885
|
+
input: Record<string, unknown>;
|
|
886
|
+
}>;
|
|
839
887
|
} | {
|
|
840
888
|
type: "browser:frame";
|
|
841
889
|
data: string;
|
|
@@ -888,4 +936,4 @@ type AgentEvent = {
|
|
|
888
936
|
reason: string;
|
|
889
937
|
};
|
|
890
938
|
|
|
891
|
-
export { type AgentEvent, type AgentFailure, type ApiApprovalResponse, type ApiCompactResponse, type ApiCreateThreadRequest, type ApiCreateThreadResponse, type ApiSecretEntry, type ApiSlashCommand, type ApiStopRunResponse, type ApiSubagentSummary, type ApiThreadListResponse, type ApiThreadSummary, type ContentPart, FEATURE_DOMAIN_ORDER, type FeatureDomain, type FileContentPart, type FileInput, type JsonSchema, type Logger, type Message, ONBOARDING_FIELDS, type OnboardingField, type OnboardingFieldCondition, type OnboardingFieldKind, type OnboardingFieldTarget, type OnboardingOption, type OnboardingScope, type Role, type RunInput, type RunResult, type TextContentPart, type TokenUsage, type ToolContext, type ToolDefinition, type ToolHandler, type VfsAccess, createLogger, defineTool, fieldsForScope, formatError, getTextContent, muted, num, setLogLevel, url };
|
|
939
|
+
export { type AgentEvent, type AgentFailure, type ApiApprovalResponse, type ApiCompactResponse, type ApiCreateThreadRequest, type ApiCreateThreadResponse, type ApiSecretEntry, type ApiSlashCommand, type ApiStopRunResponse, type ApiSubagentSummary, type ApiThreadListResponse, type ApiThreadSummary, type ApiVfsEntry, type ApiVfsListResponse, type ApiVfsWriteResponse, type ContentPart, FEATURE_DOMAIN_ORDER, type FeatureDomain, type FileContentPart, type FileInput, type JsonSchema, type Logger, type Message, ONBOARDING_FIELDS, type OnboardingField, type OnboardingFieldCondition, type OnboardingFieldKind, type OnboardingFieldTarget, type OnboardingOption, type OnboardingScope, type Role, type RunInput, type RunResult, type TextContentPart, type TokenUsage, type ToolContext, type ToolDefinition, type ToolHandler, type VfsAccess, createLogger, defineTool, fieldsForScope, formatError, getTextContent, muted, num, setLogLevel, url };
|
package/package.json
CHANGED
package/src/api-types.ts
CHANGED
|
@@ -75,3 +75,24 @@ export interface ApiSlashCommand {
|
|
|
75
75
|
description: string;
|
|
76
76
|
type: "command" | "skill";
|
|
77
77
|
}
|
|
78
|
+
|
|
79
|
+
export interface ApiVfsEntry {
|
|
80
|
+
name: string;
|
|
81
|
+
type: "file" | "directory" | "symlink";
|
|
82
|
+
size: number;
|
|
83
|
+
mimeType: string | null;
|
|
84
|
+
updatedAt: number | null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface ApiVfsListResponse {
|
|
88
|
+
path: string;
|
|
89
|
+
entries: ApiVfsEntry[];
|
|
90
|
+
usage: { fileCount: number; totalBytes: number };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface ApiVfsWriteResponse {
|
|
94
|
+
path: string;
|
|
95
|
+
size: number;
|
|
96
|
+
mimeType: string | null;
|
|
97
|
+
updatedAt: number;
|
|
98
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -166,7 +166,7 @@ export interface AgentFailure {
|
|
|
166
166
|
export type AgentEvent =
|
|
167
167
|
| { type: "run:started"; runId: string; agentId: string; contextWindow?: number }
|
|
168
168
|
| { type: "run:completed"; runId: string; result: RunResult; pendingSubagents?: boolean }
|
|
169
|
-
| { type: "run:cancelled"; runId: string }
|
|
169
|
+
| { type: "run:cancelled"; runId: string; messages?: Message[] }
|
|
170
170
|
| { type: "run:error"; runId: string; error: AgentFailure }
|
|
171
171
|
| { type: "step:started"; step: number }
|
|
172
172
|
| { type: "step:completed"; step: number; duration: number }
|
|
@@ -196,6 +196,30 @@ export type AgentEvent =
|
|
|
196
196
|
checkpointMessages: Message[];
|
|
197
197
|
pendingToolCalls: Array<{ id: string; name: string; input: Record<string, unknown> }>;
|
|
198
198
|
}
|
|
199
|
+
| {
|
|
200
|
+
/**
|
|
201
|
+
* Tool wants to execute on a connected client device (e.g. iOS).
|
|
202
|
+
* The consumer of the harness is responsible for routing this event
|
|
203
|
+
* to the appropriate WebSocket and POSTing the tool's result back via
|
|
204
|
+
* `resumeRunFromCheckpoint`. Carries the same envelope as the
|
|
205
|
+
* approval-required event; `requestId` plays the role of `approvalId`.
|
|
206
|
+
*/
|
|
207
|
+
type: "tool:device:required";
|
|
208
|
+
tool: string;
|
|
209
|
+
input: unknown;
|
|
210
|
+
requestId: string;
|
|
211
|
+
}
|
|
212
|
+
| {
|
|
213
|
+
type: "tool:device:checkpoint";
|
|
214
|
+
approvals: Array<{
|
|
215
|
+
approvalId: string;
|
|
216
|
+
tool: string;
|
|
217
|
+
toolCallId: string;
|
|
218
|
+
input: Record<string, unknown>;
|
|
219
|
+
}>;
|
|
220
|
+
checkpointMessages: Message[];
|
|
221
|
+
pendingToolCalls: Array<{ id: string; name: string; input: Record<string, unknown> }>;
|
|
222
|
+
}
|
|
199
223
|
| { type: "browser:frame"; data: string; width: number; height: number }
|
|
200
224
|
| {
|
|
201
225
|
type: "browser:status";
|