@pstdio/pocketcoder-sdk 0.6.0 → 0.6.1
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/dist/index.d.ts +212 -35
- package/dist/index.js +95 -8
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ declare const KeyIssueRequestSchema: z.ZodObject<{
|
|
|
32
32
|
"checkpoints:delete": "checkpoints:delete";
|
|
33
33
|
"outputs:read": "outputs:read";
|
|
34
34
|
"conversations:read": "conversations:read";
|
|
35
|
+
"conversations:write": "conversations:write";
|
|
35
36
|
"conversations:delete": "conversations:delete";
|
|
36
37
|
"services:relay": "services:relay";
|
|
37
38
|
"attachments:write": "attachments:write";
|
|
@@ -161,9 +162,128 @@ declare const ConversationMessageResourceSchema: z.ZodObject<{
|
|
|
161
162
|
occurred_at: z.ZodISODateTime;
|
|
162
163
|
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
163
164
|
seq: z.ZodNumber;
|
|
165
|
+
identity: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
166
|
+
schema: z.ZodLiteral<"pocketcoder.conversation/v2">;
|
|
167
|
+
authority: z.ZodEnum<{
|
|
168
|
+
external: "external";
|
|
169
|
+
generic: "generic";
|
|
170
|
+
}>;
|
|
171
|
+
conversation_id: z.ZodUUID;
|
|
172
|
+
request_id: z.ZodUUID;
|
|
173
|
+
turn_id: z.ZodUUID;
|
|
174
|
+
request_fingerprint: z.ZodString;
|
|
175
|
+
event_id: z.ZodUUID;
|
|
176
|
+
message_id: z.ZodString;
|
|
177
|
+
sequence: z.ZodNumber;
|
|
178
|
+
revision: z.ZodNumber;
|
|
179
|
+
fact: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
180
|
+
type: z.ZodLiteral<"intermediate">;
|
|
181
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
182
|
+
type: z.ZodLiteral<"final_response">;
|
|
183
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
184
|
+
type: z.ZodLiteral<"tool_only">;
|
|
185
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
186
|
+
type: z.ZodLiteral<"activity_started">;
|
|
187
|
+
activity_id: z.ZodUUID;
|
|
188
|
+
kind: z.ZodEnum<{
|
|
189
|
+
tool: "tool";
|
|
190
|
+
attachment: "attachment";
|
|
191
|
+
workspace: "workspace";
|
|
192
|
+
retrieval: "retrieval";
|
|
193
|
+
}>;
|
|
194
|
+
label: z.ZodString;
|
|
195
|
+
started_at: z.ZodNullable<z.ZodISODateTime>;
|
|
196
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
197
|
+
type: z.ZodLiteral<"activity_finished">;
|
|
198
|
+
activity_id: z.ZodUUID;
|
|
199
|
+
ended_at: z.ZodNullable<z.ZodISODateTime>;
|
|
200
|
+
outcome: z.ZodEnum<{
|
|
201
|
+
completed: "completed";
|
|
202
|
+
failed: "failed";
|
|
203
|
+
interrupted: "interrupted";
|
|
204
|
+
canceled: "canceled";
|
|
205
|
+
}>;
|
|
206
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
207
|
+
type: z.ZodLiteral<"turn_terminal">;
|
|
208
|
+
outcome: z.ZodEnum<{
|
|
209
|
+
completed: "completed";
|
|
210
|
+
failed: "failed";
|
|
211
|
+
interrupted: "interrupted";
|
|
212
|
+
canceled: "canceled";
|
|
213
|
+
lost: "lost";
|
|
214
|
+
}>;
|
|
215
|
+
}, z.core.$strip>], "type">>;
|
|
216
|
+
}, z.core.$strip>>>;
|
|
164
217
|
}, z.core.$strip>;
|
|
165
218
|
type ConversationMessageResource = z.infer<typeof ConversationMessageResourceSchema>;
|
|
166
219
|
//#endregion
|
|
220
|
+
//#region ../contracts/src/conversations/identity.d.ts
|
|
221
|
+
declare const ConversationRequestIdentitySchema: z.ZodObject<{
|
|
222
|
+
schema: z.ZodLiteral<"pocketcoder.conversation/v2">;
|
|
223
|
+
authority: z.ZodEnum<{
|
|
224
|
+
external: "external";
|
|
225
|
+
generic: "generic";
|
|
226
|
+
}>;
|
|
227
|
+
conversation_id: z.ZodUUID;
|
|
228
|
+
request_id: z.ZodUUID;
|
|
229
|
+
turn_id: z.ZodUUID;
|
|
230
|
+
request_fingerprint: z.ZodString;
|
|
231
|
+
}, z.core.$strip>;
|
|
232
|
+
type ConversationRequestIdentity = z.infer<typeof ConversationRequestIdentitySchema>;
|
|
233
|
+
declare const ConversationMessageIdentitySchema: z.ZodObject<{
|
|
234
|
+
schema: z.ZodLiteral<"pocketcoder.conversation/v2">;
|
|
235
|
+
authority: z.ZodEnum<{
|
|
236
|
+
external: "external";
|
|
237
|
+
generic: "generic";
|
|
238
|
+
}>;
|
|
239
|
+
conversation_id: z.ZodUUID;
|
|
240
|
+
request_id: z.ZodUUID;
|
|
241
|
+
turn_id: z.ZodUUID;
|
|
242
|
+
request_fingerprint: z.ZodString;
|
|
243
|
+
event_id: z.ZodUUID;
|
|
244
|
+
message_id: z.ZodString;
|
|
245
|
+
sequence: z.ZodNumber;
|
|
246
|
+
revision: z.ZodNumber;
|
|
247
|
+
fact: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
248
|
+
type: z.ZodLiteral<"intermediate">;
|
|
249
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
250
|
+
type: z.ZodLiteral<"final_response">;
|
|
251
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
252
|
+
type: z.ZodLiteral<"tool_only">;
|
|
253
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
254
|
+
type: z.ZodLiteral<"activity_started">;
|
|
255
|
+
activity_id: z.ZodUUID;
|
|
256
|
+
kind: z.ZodEnum<{
|
|
257
|
+
tool: "tool";
|
|
258
|
+
attachment: "attachment";
|
|
259
|
+
workspace: "workspace";
|
|
260
|
+
retrieval: "retrieval";
|
|
261
|
+
}>;
|
|
262
|
+
label: z.ZodString;
|
|
263
|
+
started_at: z.ZodNullable<z.ZodISODateTime>;
|
|
264
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
265
|
+
type: z.ZodLiteral<"activity_finished">;
|
|
266
|
+
activity_id: z.ZodUUID;
|
|
267
|
+
ended_at: z.ZodNullable<z.ZodISODateTime>;
|
|
268
|
+
outcome: z.ZodEnum<{
|
|
269
|
+
completed: "completed";
|
|
270
|
+
failed: "failed";
|
|
271
|
+
interrupted: "interrupted";
|
|
272
|
+
canceled: "canceled";
|
|
273
|
+
}>;
|
|
274
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
275
|
+
type: z.ZodLiteral<"turn_terminal">;
|
|
276
|
+
outcome: z.ZodEnum<{
|
|
277
|
+
completed: "completed";
|
|
278
|
+
failed: "failed";
|
|
279
|
+
interrupted: "interrupted";
|
|
280
|
+
canceled: "canceled";
|
|
281
|
+
lost: "lost";
|
|
282
|
+
}>;
|
|
283
|
+
}, z.core.$strip>], "type">>;
|
|
284
|
+
}, z.core.$strip>;
|
|
285
|
+
type ConversationMessageIdentity = z.infer<typeof ConversationMessageIdentitySchema>;
|
|
286
|
+
//#endregion
|
|
167
287
|
//#region ../contracts/src/network/network.d.ts
|
|
168
288
|
declare const NetworkEventSchema: z.ZodObject<{
|
|
169
289
|
path: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -594,7 +714,7 @@ declare class WorkspacesApi {
|
|
|
594
714
|
version: string;
|
|
595
715
|
digest: string;
|
|
596
716
|
};
|
|
597
|
-
state: "
|
|
717
|
+
state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
|
|
598
718
|
reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
|
|
599
719
|
agent_state: "unknown" | "running" | "stable";
|
|
600
720
|
change_cursor: number;
|
|
@@ -644,7 +764,7 @@ declare class WorkspacesApi {
|
|
|
644
764
|
version: string;
|
|
645
765
|
digest: string;
|
|
646
766
|
};
|
|
647
|
-
state: "
|
|
767
|
+
state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
|
|
648
768
|
reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
|
|
649
769
|
agent_state: "unknown" | "running" | "stable";
|
|
650
770
|
change_cursor: number;
|
|
@@ -694,7 +814,7 @@ declare class WorkspacesApi {
|
|
|
694
814
|
version: string;
|
|
695
815
|
digest: string;
|
|
696
816
|
};
|
|
697
|
-
state: "
|
|
817
|
+
state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
|
|
698
818
|
reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
|
|
699
819
|
agent_state: "unknown" | "running" | "stable";
|
|
700
820
|
change_cursor: number;
|
|
@@ -744,7 +864,7 @@ declare class WorkspacesApi {
|
|
|
744
864
|
version: string;
|
|
745
865
|
digest: string;
|
|
746
866
|
};
|
|
747
|
-
state: "
|
|
867
|
+
state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
|
|
748
868
|
reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
|
|
749
869
|
agent_state: "unknown" | "running" | "stable";
|
|
750
870
|
change_cursor: number;
|
|
@@ -794,7 +914,7 @@ declare class WorkspacesApi {
|
|
|
794
914
|
version: string;
|
|
795
915
|
digest: string;
|
|
796
916
|
};
|
|
797
|
-
state: "
|
|
917
|
+
state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
|
|
798
918
|
reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
|
|
799
919
|
agent_state: "unknown" | "running" | "stable";
|
|
800
920
|
change_cursor: number;
|
|
@@ -847,7 +967,7 @@ declare class WorkspacesApi {
|
|
|
847
967
|
version: string;
|
|
848
968
|
digest: string;
|
|
849
969
|
};
|
|
850
|
-
state: "
|
|
970
|
+
state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
|
|
851
971
|
reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
|
|
852
972
|
agent_state: "unknown" | "running" | "stable";
|
|
853
973
|
change_cursor: number;
|
|
@@ -900,7 +1020,7 @@ declare class WorkspacesApi {
|
|
|
900
1020
|
version: string;
|
|
901
1021
|
digest: string;
|
|
902
1022
|
};
|
|
903
|
-
state: "
|
|
1023
|
+
state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
|
|
904
1024
|
reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
|
|
905
1025
|
agent_state: "unknown" | "running" | "stable";
|
|
906
1026
|
change_cursor: number;
|
|
@@ -950,7 +1070,7 @@ declare class WorkspacesApi {
|
|
|
950
1070
|
version: string;
|
|
951
1071
|
digest: string;
|
|
952
1072
|
};
|
|
953
|
-
state: "
|
|
1073
|
+
state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
|
|
954
1074
|
reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
|
|
955
1075
|
agent_state: "unknown" | "running" | "stable";
|
|
956
1076
|
change_cursor: number;
|
|
@@ -1001,7 +1121,7 @@ declare class WorkspacesApi {
|
|
|
1001
1121
|
version: string;
|
|
1002
1122
|
digest: string;
|
|
1003
1123
|
};
|
|
1004
|
-
state: "
|
|
1124
|
+
state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
|
|
1005
1125
|
reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
|
|
1006
1126
|
agent_state: "unknown" | "running" | "stable";
|
|
1007
1127
|
change_cursor: number;
|
|
@@ -1046,7 +1166,7 @@ declare class WorkspacesApi {
|
|
|
1046
1166
|
checkpoint: {
|
|
1047
1167
|
id: string;
|
|
1048
1168
|
workspace_id: string;
|
|
1049
|
-
state: "deleted" | "
|
|
1169
|
+
state: "deleted" | "failed" | "ready" | "creating" | "deleting";
|
|
1050
1170
|
reason_code: string | null;
|
|
1051
1171
|
template: {
|
|
1052
1172
|
name: string;
|
|
@@ -1067,7 +1187,7 @@ declare class WorkspacesApi {
|
|
|
1067
1187
|
operation: {
|
|
1068
1188
|
id: string;
|
|
1069
1189
|
kind: "preserve" | "restore" | "verify" | "delete" | "purge";
|
|
1070
|
-
state: "
|
|
1190
|
+
state: "failed" | "succeeded" | "running" | "pending";
|
|
1071
1191
|
workspace_id: string | null;
|
|
1072
1192
|
checkpoint_id: string | null;
|
|
1073
1193
|
result_workspace_id: string | null;
|
|
@@ -1080,7 +1200,7 @@ declare class WorkspacesApi {
|
|
|
1080
1200
|
purge(id: string, key: string, options?: RequestOptions): Promise<{
|
|
1081
1201
|
id: string;
|
|
1082
1202
|
kind: "preserve" | "restore" | "verify" | "delete" | "purge";
|
|
1083
|
-
state: "
|
|
1203
|
+
state: "failed" | "succeeded" | "running" | "pending";
|
|
1084
1204
|
workspace_id: string | null;
|
|
1085
1205
|
checkpoint_id: string | null;
|
|
1086
1206
|
result_workspace_id: string | null;
|
|
@@ -1098,7 +1218,7 @@ declare class WorkspacesApi {
|
|
|
1098
1218
|
version: string;
|
|
1099
1219
|
digest: string;
|
|
1100
1220
|
};
|
|
1101
|
-
state: "
|
|
1221
|
+
state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
|
|
1102
1222
|
reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
|
|
1103
1223
|
agent_state: "unknown" | "running" | "stable";
|
|
1104
1224
|
change_cursor: number;
|
|
@@ -1143,7 +1263,7 @@ declare class WorkspacesApi {
|
|
|
1143
1263
|
operation: {
|
|
1144
1264
|
id: string;
|
|
1145
1265
|
kind: "preserve" | "restore" | "verify" | "delete" | "purge";
|
|
1146
|
-
state: "
|
|
1266
|
+
state: "failed" | "succeeded" | "running" | "pending";
|
|
1147
1267
|
workspace_id: string | null;
|
|
1148
1268
|
checkpoint_id: string | null;
|
|
1149
1269
|
result_workspace_id: string | null;
|
|
@@ -1162,7 +1282,7 @@ declare class WorkspacesApi {
|
|
|
1162
1282
|
version: string;
|
|
1163
1283
|
digest: string;
|
|
1164
1284
|
};
|
|
1165
|
-
state: "
|
|
1285
|
+
state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
|
|
1166
1286
|
reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
|
|
1167
1287
|
agent_state: "unknown" | "running" | "stable";
|
|
1168
1288
|
change_cursor: number;
|
|
@@ -1207,7 +1327,7 @@ declare class WorkspacesApi {
|
|
|
1207
1327
|
operation: {
|
|
1208
1328
|
id: string;
|
|
1209
1329
|
kind: "preserve" | "restore" | "verify" | "delete" | "purge";
|
|
1210
|
-
state: "
|
|
1330
|
+
state: "failed" | "succeeded" | "running" | "pending";
|
|
1211
1331
|
workspace_id: string | null;
|
|
1212
1332
|
checkpoint_id: string | null;
|
|
1213
1333
|
result_workspace_id: string | null;
|
|
@@ -1274,7 +1394,7 @@ declare class CheckpointsApi {
|
|
|
1274
1394
|
}, options?: RequestOptions): Promise<Page<{
|
|
1275
1395
|
id: string;
|
|
1276
1396
|
workspace_id: string;
|
|
1277
|
-
state: "deleted" | "
|
|
1397
|
+
state: "deleted" | "failed" | "ready" | "creating" | "deleting";
|
|
1278
1398
|
reason_code: string | null;
|
|
1279
1399
|
template: {
|
|
1280
1400
|
name: string;
|
|
@@ -1295,7 +1415,7 @@ declare class CheckpointsApi {
|
|
|
1295
1415
|
get(id: string, options?: RequestOptions): Promise<{
|
|
1296
1416
|
id: string;
|
|
1297
1417
|
workspace_id: string;
|
|
1298
|
-
state: "deleted" | "
|
|
1418
|
+
state: "deleted" | "failed" | "ready" | "creating" | "deleting";
|
|
1299
1419
|
reason_code: string | null;
|
|
1300
1420
|
template: {
|
|
1301
1421
|
name: string;
|
|
@@ -1316,7 +1436,7 @@ declare class CheckpointsApi {
|
|
|
1316
1436
|
verify(id: string, key: string, options?: RequestOptions): Promise<{
|
|
1317
1437
|
id: string;
|
|
1318
1438
|
kind: "preserve" | "restore" | "verify" | "delete" | "purge";
|
|
1319
|
-
state: "
|
|
1439
|
+
state: "failed" | "succeeded" | "running" | "pending";
|
|
1320
1440
|
workspace_id: string | null;
|
|
1321
1441
|
checkpoint_id: string | null;
|
|
1322
1442
|
result_workspace_id: string | null;
|
|
@@ -1328,7 +1448,7 @@ declare class CheckpointsApi {
|
|
|
1328
1448
|
delete(id: string, key: string, options?: RequestOptions): Promise<{
|
|
1329
1449
|
id: string;
|
|
1330
1450
|
kind: "preserve" | "restore" | "verify" | "delete" | "purge";
|
|
1331
|
-
state: "
|
|
1451
|
+
state: "failed" | "succeeded" | "running" | "pending";
|
|
1332
1452
|
workspace_id: string | null;
|
|
1333
1453
|
checkpoint_id: string | null;
|
|
1334
1454
|
result_workspace_id: string | null;
|
|
@@ -1346,7 +1466,7 @@ declare class CheckpointsApi {
|
|
|
1346
1466
|
version: string;
|
|
1347
1467
|
digest: string;
|
|
1348
1468
|
};
|
|
1349
|
-
state: "
|
|
1469
|
+
state: "failed" | "canceled" | "queued" | "provisioning" | "connected" | "ready" | "preserving" | "terminating" | "succeeded" | "expired" | "preserved";
|
|
1350
1470
|
reason_code: "child_exit_success" | "child_exit_failure" | "setup_failed" | "bootstrap_failed" | "registration_timeout" | "health_failed" | "child_crash" | "provider_lost" | "disconnect_timeout" | "canceled_by_caller" | "deadline_expired" | "idle_expired" | "queue_timeout" | "launch_failed" | "preserve_requested" | "preserved_by_policy" | "checkpoint_created" | "checkpoint_failed" | "checkpoint_corrupt" | "checkpoint_quota_exceeded" | "checkpoint_storage_lost" | "restore_requested" | "restore_failed" | "image_unavailable" | "source_resolution_failed" | "secret_resolution_failed" | "operation_conflict" | "network_policy_failed" | null;
|
|
1351
1471
|
agent_state: "unknown" | "running" | "stable";
|
|
1352
1472
|
change_cursor: number;
|
|
@@ -1391,7 +1511,7 @@ declare class CheckpointsApi {
|
|
|
1391
1511
|
operation: {
|
|
1392
1512
|
id: string;
|
|
1393
1513
|
kind: "preserve" | "restore" | "verify" | "delete" | "purge";
|
|
1394
|
-
state: "
|
|
1514
|
+
state: "failed" | "succeeded" | "running" | "pending";
|
|
1395
1515
|
workspace_id: string | null;
|
|
1396
1516
|
checkpoint_id: string | null;
|
|
1397
1517
|
result_workspace_id: string | null;
|
|
@@ -1409,7 +1529,7 @@ declare class OperationsApi {
|
|
|
1409
1529
|
get(id: string, options?: RequestOptions): Promise<{
|
|
1410
1530
|
id: string;
|
|
1411
1531
|
kind: "preserve" | "restore" | "verify" | "delete" | "purge";
|
|
1412
|
-
state: "
|
|
1532
|
+
state: "failed" | "succeeded" | "running" | "pending";
|
|
1413
1533
|
workspace_id: string | null;
|
|
1414
1534
|
checkpoint_id: string | null;
|
|
1415
1535
|
result_workspace_id: string | null;
|
|
@@ -1422,18 +1542,75 @@ declare class OperationsApi {
|
|
|
1422
1542
|
//#endregion
|
|
1423
1543
|
//#region src/resources/conversations/conversations.d.ts
|
|
1424
1544
|
type ConversationMessage = ConversationMessageResource;
|
|
1425
|
-
type ConversationPage =
|
|
1545
|
+
type ConversationPage = Awaited<ReturnType<ConversationsApi["list"]>>;
|
|
1426
1546
|
declare class ConversationsApi {
|
|
1427
1547
|
private readonly transport;
|
|
1428
1548
|
constructor(transport: PocketCoderTransport);
|
|
1429
|
-
list(id: string, query?: CursorListQuery, options?: RequestOptions): Promise<
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1549
|
+
list(id: string, query?: CursorListQuery, options?: RequestOptions): Promise<{
|
|
1550
|
+
protocol: {
|
|
1551
|
+
schema: "pocketcoder.conversation/v2";
|
|
1552
|
+
request_identity_authorities: ("external" | "generic")[];
|
|
1553
|
+
producer_capabilities: null;
|
|
1554
|
+
} | null;
|
|
1555
|
+
retention: {
|
|
1556
|
+
status: "retained";
|
|
1557
|
+
expires_at: string | null;
|
|
1558
|
+
};
|
|
1559
|
+
items: {
|
|
1560
|
+
message_id: string;
|
|
1561
|
+
role: "user" | "assistant" | "system" | "tool";
|
|
1562
|
+
content: string;
|
|
1563
|
+
occurred_at: string;
|
|
1564
|
+
metadata: Record<string, string>;
|
|
1565
|
+
seq: number;
|
|
1566
|
+
identity: {
|
|
1567
|
+
schema: "pocketcoder.conversation/v2";
|
|
1568
|
+
authority: "external" | "generic";
|
|
1569
|
+
conversation_id: string;
|
|
1570
|
+
request_id: string;
|
|
1571
|
+
turn_id: string;
|
|
1572
|
+
request_fingerprint: string;
|
|
1573
|
+
event_id: string;
|
|
1574
|
+
message_id: string;
|
|
1575
|
+
sequence: number;
|
|
1576
|
+
revision: number;
|
|
1577
|
+
fact?: {
|
|
1578
|
+
type: "intermediate";
|
|
1579
|
+
} | {
|
|
1580
|
+
type: "final_response";
|
|
1581
|
+
} | {
|
|
1582
|
+
type: "tool_only";
|
|
1583
|
+
} | {
|
|
1584
|
+
type: "activity_started";
|
|
1585
|
+
activity_id: string;
|
|
1586
|
+
kind: "tool" | "attachment" | "workspace" | "retrieval";
|
|
1587
|
+
label: string;
|
|
1588
|
+
started_at: string | null;
|
|
1589
|
+
} | {
|
|
1590
|
+
type: "activity_finished";
|
|
1591
|
+
activity_id: string;
|
|
1592
|
+
ended_at: string | null;
|
|
1593
|
+
outcome: "completed" | "failed" | "interrupted" | "canceled";
|
|
1594
|
+
} | {
|
|
1595
|
+
type: "turn_terminal";
|
|
1596
|
+
outcome: "completed" | "failed" | "interrupted" | "canceled" | "lost";
|
|
1597
|
+
} | undefined;
|
|
1598
|
+
} | null;
|
|
1599
|
+
}[];
|
|
1600
|
+
nextCursor: string | null;
|
|
1601
|
+
}>;
|
|
1602
|
+
acceptRequest(id: string, identity: ConversationRequestIdentity, options?: RequestOptions): Promise<{
|
|
1603
|
+
kind: "accepted" | "replayed";
|
|
1604
|
+
identity: {
|
|
1605
|
+
schema: "pocketcoder.conversation/v2";
|
|
1606
|
+
authority: "external" | "generic";
|
|
1607
|
+
conversation_id: string;
|
|
1608
|
+
request_id: string;
|
|
1609
|
+
turn_id: string;
|
|
1610
|
+
request_fingerprint: string;
|
|
1611
|
+
};
|
|
1612
|
+
accepted_at: string;
|
|
1613
|
+
}>;
|
|
1437
1614
|
}
|
|
1438
1615
|
//#endregion
|
|
1439
1616
|
//#region src/resources/diagnostics/diagnostics.d.ts
|
|
@@ -1521,7 +1698,7 @@ declare class RecoveryApi {
|
|
|
1521
1698
|
purge(principalId: string, workspaceId: string, executionKey: string, options?: RequestOptions): Promise<{
|
|
1522
1699
|
id: string;
|
|
1523
1700
|
kind: "preserve" | "restore" | "verify" | "delete" | "purge";
|
|
1524
|
-
state: "
|
|
1701
|
+
state: "failed" | "succeeded" | "running" | "pending";
|
|
1525
1702
|
workspace_id: string | null;
|
|
1526
1703
|
checkpoint_id: string | null;
|
|
1527
1704
|
result_workspace_id: string | null;
|
|
@@ -1533,7 +1710,7 @@ declare class RecoveryApi {
|
|
|
1533
1710
|
operation(principalId: string, operationId: string, options?: RequestOptions): Promise<{
|
|
1534
1711
|
id: string;
|
|
1535
1712
|
kind: "preserve" | "restore" | "verify" | "delete" | "purge";
|
|
1536
|
-
state: "
|
|
1713
|
+
state: "failed" | "succeeded" | "running" | "pending";
|
|
1537
1714
|
workspace_id: string | null;
|
|
1538
1715
|
checkpoint_id: string | null;
|
|
1539
1716
|
result_workspace_id: string | null;
|
|
@@ -1691,4 +1868,4 @@ declare class AgentNotReadyError extends Error {
|
|
|
1691
1868
|
}
|
|
1692
1869
|
declare function isPocketCoderErrorCode(value: unknown): value is ErrorCode;
|
|
1693
1870
|
//#endregion
|
|
1694
|
-
export { AdministrationApi, AgentApi, type AgentMessageInput, AgentNotReadyError, type AttachmentDescriptor, type AttachmentUploadInput, AttachmentsApi, type CheckpointResource, type CheckpointState, CheckpointsApi, type ClientErrorCode, ConversationGoneError, type ConversationMessage, type ConversationPage, ConversationsApi, type CursorListQuery, type KeyIssueRequest, type KeyIssueResponse, type KeyListQuery, type KeyListResponse, type KeyResource, KeysApi, type LogChunk, LogsApi, type NetworkEvent, NetworkEventsApi, type OperationKind, type OperationResource, type OperationState, OperationsApi, type OutputResource, OutputsApi, type Page, PocketCoderClient, type PocketCoderClientConfig, PocketCoderError, type PreserveRequest, RecoveryApi, type RequestOptions, type ResolveWorkspaceTurnOptions, type ResolvedWorkspaceTurn, type RestoreRequest, type ResumeWorkspaceContext, type ServerTerminalMessage, type StorageState, TERMINAL_WORKSPACE_STATES, type TemplateSummary, TemplatesApi, type TerminalConnectOptions, TerminalConnection, type TerminalSession, TerminalsApi, type WebSocketFactory, type WorkspaceCreateInput, type WorkspaceListQuery, type WorkspaceResource, type WorkspaceState, type WorkspaceSummary, WorkspaceTerminalError, WorkspaceTurnResolutionError, type WorkspaceTurnResolutionErrorCode, WorkspaceTurnResolver, type WorkspaceTurnResolverOptions, WorkspacesApi, isPocketCoderErrorCode, splitAttachmentManifest };
|
|
1871
|
+
export { AdministrationApi, AgentApi, type AgentMessageInput, AgentNotReadyError, type AttachmentDescriptor, type AttachmentUploadInput, AttachmentsApi, type CheckpointResource, type CheckpointState, CheckpointsApi, type ClientErrorCode, ConversationGoneError, type ConversationMessage, type ConversationMessageIdentity, type ConversationPage, type ConversationRequestIdentity, ConversationsApi, type CursorListQuery, type KeyIssueRequest, type KeyIssueResponse, type KeyListQuery, type KeyListResponse, type KeyResource, KeysApi, type LogChunk, LogsApi, type NetworkEvent, NetworkEventsApi, type OperationKind, type OperationResource, type OperationState, OperationsApi, type OutputResource, OutputsApi, type Page, PocketCoderClient, type PocketCoderClientConfig, PocketCoderError, type PreserveRequest, RecoveryApi, type RequestOptions, type ResolveWorkspaceTurnOptions, type ResolvedWorkspaceTurn, type RestoreRequest, type ResumeWorkspaceContext, type ServerTerminalMessage, type StorageState, TERMINAL_WORKSPACE_STATES, type TemplateSummary, TemplatesApi, type TerminalConnectOptions, TerminalConnection, type TerminalSession, TerminalsApi, type WebSocketFactory, type WorkspaceCreateInput, type WorkspaceListQuery, type WorkspaceResource, type WorkspaceState, type WorkspaceSummary, WorkspaceTerminalError, WorkspaceTurnResolutionError, type WorkspaceTurnResolutionErrorCode, WorkspaceTurnResolver, type WorkspaceTurnResolverOptions, WorkspacesApi, isPocketCoderErrorCode, splitAttachmentManifest };
|
package/dist/index.js
CHANGED
|
@@ -109,6 +109,7 @@ const SCOPES = [
|
|
|
109
109
|
"checkpoints:delete",
|
|
110
110
|
"outputs:read",
|
|
111
111
|
"conversations:read",
|
|
112
|
+
"conversations:write",
|
|
112
113
|
"conversations:delete",
|
|
113
114
|
"services:relay",
|
|
114
115
|
"attachments:write",
|
|
@@ -229,6 +230,73 @@ function CursorQuerySchema(maxLimit, defaultLimit) {
|
|
|
229
230
|
});
|
|
230
231
|
}
|
|
231
232
|
//#endregion
|
|
233
|
+
//#region ../contracts/src/conversations/facts.ts
|
|
234
|
+
const ConversationFactSchema = z.discriminatedUnion("type", [
|
|
235
|
+
z.object({ type: z.literal("intermediate") }),
|
|
236
|
+
z.object({ type: z.literal("final_response") }),
|
|
237
|
+
z.object({ type: z.literal("tool_only") }),
|
|
238
|
+
z.object({
|
|
239
|
+
type: z.literal("activity_started"),
|
|
240
|
+
activity_id: z.uuid(),
|
|
241
|
+
kind: z.enum([
|
|
242
|
+
"tool",
|
|
243
|
+
"attachment",
|
|
244
|
+
"workspace",
|
|
245
|
+
"retrieval"
|
|
246
|
+
]),
|
|
247
|
+
label: z.string().min(1).max(160),
|
|
248
|
+
started_at: z.iso.datetime().nullable()
|
|
249
|
+
}),
|
|
250
|
+
z.object({
|
|
251
|
+
type: z.literal("activity_finished"),
|
|
252
|
+
activity_id: z.uuid(),
|
|
253
|
+
ended_at: z.iso.datetime().nullable(),
|
|
254
|
+
outcome: z.enum([
|
|
255
|
+
"completed",
|
|
256
|
+
"failed",
|
|
257
|
+
"interrupted",
|
|
258
|
+
"canceled"
|
|
259
|
+
])
|
|
260
|
+
}),
|
|
261
|
+
z.object({
|
|
262
|
+
type: z.literal("turn_terminal"),
|
|
263
|
+
outcome: z.enum([
|
|
264
|
+
"completed",
|
|
265
|
+
"failed",
|
|
266
|
+
"interrupted",
|
|
267
|
+
"canceled",
|
|
268
|
+
"lost"
|
|
269
|
+
])
|
|
270
|
+
})
|
|
271
|
+
]);
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region ../contracts/src/conversations/identity.ts
|
|
274
|
+
const ConversationRequestIdentitySchema = z.object({
|
|
275
|
+
schema: z.literal("pocketcoder.conversation/v2"),
|
|
276
|
+
authority: z.enum(["external", "generic"]),
|
|
277
|
+
conversation_id: z.uuid(),
|
|
278
|
+
request_id: z.uuid(),
|
|
279
|
+
turn_id: z.uuid(),
|
|
280
|
+
request_fingerprint: z.string().regex(/^[0-9a-f]{64}$/)
|
|
281
|
+
});
|
|
282
|
+
const ConversationRequestReceiptSchema = z.object({
|
|
283
|
+
kind: z.enum(["accepted", "replayed"]),
|
|
284
|
+
identity: ConversationRequestIdentitySchema,
|
|
285
|
+
accepted_at: z.iso.datetime()
|
|
286
|
+
});
|
|
287
|
+
const ConversationMessageIdentitySchema = ConversationRequestIdentitySchema.extend({
|
|
288
|
+
event_id: z.uuid(),
|
|
289
|
+
message_id: z.string().min(1).max(256),
|
|
290
|
+
sequence: z.number().int().nonnegative(),
|
|
291
|
+
revision: z.number().int().positive(),
|
|
292
|
+
fact: ConversationFactSchema.optional()
|
|
293
|
+
});
|
|
294
|
+
const ConversationProtocolSupportSchema = z.object({
|
|
295
|
+
schema: z.literal("pocketcoder.conversation/v2"),
|
|
296
|
+
request_identity_authorities: z.array(z.enum(["external", "generic"])),
|
|
297
|
+
producer_capabilities: z.null()
|
|
298
|
+
});
|
|
299
|
+
//#endregion
|
|
232
300
|
//#region ../contracts/src/conversations/conversation.ts
|
|
233
301
|
const CONVERSATION_ROLES = [
|
|
234
302
|
"user",
|
|
@@ -242,14 +310,21 @@ const ConversationMessageInputSchema = z.object({
|
|
|
242
310
|
role: z.enum(CONVERSATION_ROLES),
|
|
243
311
|
content: z.string().max(262144),
|
|
244
312
|
occurred_at: z.iso.datetime(),
|
|
245
|
-
metadata: ConversationMetadataSchema.default({})
|
|
313
|
+
metadata: ConversationMetadataSchema.default({}),
|
|
314
|
+
identity: ConversationMessageIdentitySchema.nullable().optional()
|
|
315
|
+
});
|
|
316
|
+
const ConversationMessageResourceSchema = ConversationMessageInputSchema.extend({
|
|
317
|
+
seq: z.number().int().positive(),
|
|
318
|
+
identity: ConversationMessageIdentitySchema.nullable().default(null)
|
|
246
319
|
});
|
|
247
|
-
const ConversationMessageResourceSchema = ConversationMessageInputSchema.extend({ seq: z.number().int().positive() });
|
|
248
320
|
CursorQuerySchema(200, 100);
|
|
249
|
-
const ConversationPageSchema = CursorPageSchema(ConversationMessageResourceSchema).extend({
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
321
|
+
const ConversationPageSchema = CursorPageSchema(ConversationMessageResourceSchema).extend({
|
|
322
|
+
protocol: ConversationProtocolSupportSchema.nullable().default(null),
|
|
323
|
+
retention: z.object({
|
|
324
|
+
status: z.literal("retained"),
|
|
325
|
+
expires_at: z.iso.datetime().nullable()
|
|
326
|
+
})
|
|
327
|
+
});
|
|
253
328
|
const ConversationResumeOutcomeSchema = z.object({
|
|
254
329
|
status: z.literal("supported"),
|
|
255
330
|
reason: z.null(),
|
|
@@ -2053,10 +2128,22 @@ var ConversationsApi = class {
|
|
|
2053
2128
|
this.transport = transport;
|
|
2054
2129
|
}
|
|
2055
2130
|
async list(id, query = {}, options = {}) {
|
|
2056
|
-
|
|
2131
|
+
const body = await this.transport.request(`/v1/workspaces/${encodeURIComponent(id)}/conversation?${queryString({
|
|
2057
2132
|
cursor: query.cursor,
|
|
2058
2133
|
limit: query.limit ?? 100
|
|
2059
|
-
})}`, ConversationPageSchema, options)
|
|
2134
|
+
})}`, ConversationPageSchema, options);
|
|
2135
|
+
return {
|
|
2136
|
+
...page(body),
|
|
2137
|
+
protocol: body.protocol,
|
|
2138
|
+
retention: body.retention
|
|
2139
|
+
};
|
|
2140
|
+
}
|
|
2141
|
+
async acceptRequest(id, identity, options = {}) {
|
|
2142
|
+
return this.transport.request(`/v1/workspaces/${encodeURIComponent(id)}/conversation/requests`, ConversationRequestReceiptSchema, {
|
|
2143
|
+
...options,
|
|
2144
|
+
method: "POST",
|
|
2145
|
+
body: JSON.stringify(identity)
|
|
2146
|
+
});
|
|
2060
2147
|
}
|
|
2061
2148
|
};
|
|
2062
2149
|
//#endregion
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"type:library"
|
|
7
7
|
]
|
|
8
8
|
},
|
|
9
|
-
"version": "0.6.
|
|
9
|
+
"version": "0.6.1",
|
|
10
10
|
"private": false,
|
|
11
11
|
"description": "Runtime-validated TypeScript client for the PocketCoder control plane.",
|
|
12
12
|
"type": "module",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@pstdio/pocketcoder-contracts": "workspace:*",
|
|
46
|
-
"@types/bun": "1.
|
|
46
|
+
"@types/bun": "1.4.2",
|
|
47
47
|
"@types/node": "26.1.2",
|
|
48
48
|
"tsdown": "0.22.14",
|
|
49
49
|
"typescript": "5.9.3"
|