@usenaive-sdk/managed-agents 0.12.1 → 0.12.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/dist/index.d.ts +54 -29
- package/dist/index.js +165 -74
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -466,6 +466,8 @@ var LedgerEntrySchema = z2.object({
|
|
|
466
466
|
session_id: idOf("ses").nullable(),
|
|
467
467
|
agent_id: idOf("agt").nullable(),
|
|
468
468
|
deployment_id: idOf("dep").nullable(),
|
|
469
|
+
/** The computer (`cmp_`), browser (`brw_`) or phone (`mob_`) a debit bills; `null` for anything else, and from a server older than the field. */
|
|
470
|
+
resource_id: z2.string().nullable().default(null),
|
|
469
471
|
line_items: z2.array(z2.object({ tier: LineItemTierSchema, amount_micro_usd: MicroUsdField })),
|
|
470
472
|
created_at: Timestamp
|
|
471
473
|
});
|
|
@@ -1932,7 +1934,11 @@ var transposed = (a, b) => {
|
|
|
1932
1934
|
};
|
|
1933
1935
|
function toolNameProblem(name) {
|
|
1934
1936
|
if (BUILTIN_TOOLS.includes(name) || name in FOLLOWS_TOOL || PLATFORM_TOOLS.includes(name)) return null;
|
|
1935
|
-
if (!/^[a-z0-9_-]+(\.[a-z0-9_-]+)+$/i.test(name))
|
|
1937
|
+
if (!/^[a-z0-9_-]+(\.[a-z0-9_-]+)+$/i.test(name)) {
|
|
1938
|
+
const bare = [...BUILTIN_TOOLS, ...Object.keys(FOLLOWS_TOOL)].find((tool) => transposed(tool, name));
|
|
1939
|
+
const hint = bare === void 0 ? "name a built-in, or a namespaced `<namespace>.<tool>`" : `did you mean \`${bare}\`?`;
|
|
1940
|
+
return `\`${name}\` is not a tool; ${hint}`;
|
|
1941
|
+
}
|
|
1936
1942
|
const namespace = name.slice(0, name.indexOf("."));
|
|
1937
1943
|
if (PLATFORM_NAMESPACES.has(namespace)) {
|
|
1938
1944
|
const known = [...PLATFORM_TOOLS, ...Object.keys(FOLLOWS_TOOL)].filter((tool) => tool.startsWith(`${namespace}.`));
|
|
@@ -1943,7 +1949,8 @@ function toolNameProblem(name) {
|
|
|
1943
1949
|
}
|
|
1944
1950
|
var isToolName = (name) => toolNameProblem(name) === null;
|
|
1945
1951
|
var ToolConfigSchema = z12.object({
|
|
1946
|
-
enabled:
|
|
1952
|
+
/** Absent is enabled (ADR-1911): naming a tool to set its permission already says it is wanted. */
|
|
1953
|
+
enabled: z12.boolean().default(true),
|
|
1947
1954
|
permission: ToolPermissionSchema,
|
|
1948
1955
|
config: z12.record(z12.string(), z12.unknown()).optional()
|
|
1949
1956
|
});
|
|
@@ -2206,7 +2213,24 @@ var CREATOR_PROGRAM = {
|
|
|
2206
2213
|
upload_token_minutes: 15,
|
|
2207
2214
|
skill_max_bytes: 32 * 1024,
|
|
2208
2215
|
/** The reviewer's install check (§42.5): the hard cap on its one session, never charged to the draft. */
|
|
2209
|
-
review_check_budget_micro_usd: 5e6
|
|
2216
|
+
review_check_budget_micro_usd: 5e6,
|
|
2217
|
+
/** A `video` origin build (§42.14): one raw clip and its characters, recast by Mira. */
|
|
2218
|
+
video: {
|
|
2219
|
+
min_seconds: 3,
|
|
2220
|
+
max_seconds: 15,
|
|
2221
|
+
video_max_bytes: 95 * 1024 * 1024,
|
|
2222
|
+
image_max_bytes: 10 * 1024 * 1024,
|
|
2223
|
+
characters_min: 1,
|
|
2224
|
+
characters_max: 3,
|
|
2225
|
+
/** After the first render. A refused or failed render does not use one up. */
|
|
2226
|
+
revisions: 5,
|
|
2227
|
+
/** Per doomscroll account, until one of its templates is approved. */
|
|
2228
|
+
unapproved_templates: 2,
|
|
2229
|
+
/** Upload tickets a doomscroll account may ask for, per template. */
|
|
2230
|
+
upload_tickets: 20,
|
|
2231
|
+
/** A draft never submitted loses its source and character bytes this long after `updated_at`. */
|
|
2232
|
+
draft_retention_days: 30
|
|
2233
|
+
}
|
|
2210
2234
|
}
|
|
2211
2235
|
};
|
|
2212
2236
|
var DOOMSCROLL_PROGRAM = {
|
|
@@ -2250,6 +2274,8 @@ var StudioStateSchema = z13.enum([
|
|
|
2250
2274
|
"setup",
|
|
2251
2275
|
"building",
|
|
2252
2276
|
"ready",
|
|
2277
|
+
/** A `video` origin only: a version was submitted and its author is writing the skill. */
|
|
2278
|
+
"finalizing",
|
|
2253
2279
|
"in_review",
|
|
2254
2280
|
"live",
|
|
2255
2281
|
"changes_requested"
|
|
@@ -2313,10 +2339,26 @@ var StudioSkillSchema = SavedSkillSchema.extend({
|
|
|
2313
2339
|
id: idOf("skl").nullable(),
|
|
2314
2340
|
version: z13.number().int().positive().nullable()
|
|
2315
2341
|
});
|
|
2342
|
+
var StudioImageContentTypeSchema = z13.enum(["image/png", "image/jpeg", "image/webp"]);
|
|
2343
|
+
var StudioSourceVideoSchema = z13.object({
|
|
2344
|
+
file_id: z13.string().nullable(),
|
|
2345
|
+
bytes: z13.number().int().positive().max(CREATOR_PROGRAM.studio.video.video_max_bytes),
|
|
2346
|
+
content_type: StudioUploadContentTypeSchema,
|
|
2347
|
+
filename: z13.string().min(1).max(200),
|
|
2348
|
+
seconds: z13.number().nonnegative().nullable()
|
|
2349
|
+
});
|
|
2350
|
+
var CharacterPosition = z13.number().int().min(1).max(CREATOR_PROGRAM.studio.video.characters_max);
|
|
2351
|
+
var StudioCharacterSchema = z13.object({
|
|
2352
|
+
position: CharacterPosition,
|
|
2353
|
+
file_id: z13.string().nullable(),
|
|
2354
|
+
bytes: z13.number().int().positive().max(CREATOR_PROGRAM.studio.video.image_max_bytes),
|
|
2355
|
+
content_type: StudioImageContentTypeSchema,
|
|
2356
|
+
filename: z13.string().min(1).max(200)
|
|
2357
|
+
});
|
|
2316
2358
|
var CreatorStudioSchema = z13.object({
|
|
2317
2359
|
uploads: z13.array(StudioUploadSchema).max(CREATOR_PROGRAM.studio.uploads).default([]),
|
|
2318
|
-
/** `links`: built from 1–3 reel links (`imports`), prompts optional; `upload`: the creator's three videos. */
|
|
2319
|
-
origin: z13.enum(["upload", "links"]).default("upload"),
|
|
2360
|
+
/** `links`: built from 1–3 reel links (`imports`), prompts optional; `upload`: the creator's three videos; `video`: one raw clip recast by Mira (§42.14). */
|
|
2361
|
+
origin: z13.enum(["upload", "links", "video"]).default("upload"),
|
|
2320
2362
|
imports: z13.array(StudioImportSchema).max(CREATOR_PROGRAM.studio.uploads).default([]),
|
|
2321
2363
|
state: StudioStateSchema.default("setup"),
|
|
2322
2364
|
spend_micro_usd: MicroUsdField.nonnegative().default(0),
|
|
@@ -2327,7 +2369,11 @@ var CreatorStudioSchema = z13.object({
|
|
|
2327
2369
|
/** An org build's asked sample length (§57.2, ADR-1762); `null` is `sample_seconds`. */
|
|
2328
2370
|
seconds: z13.number().int().min(10).max(60).nullable().default(null),
|
|
2329
2371
|
/** An org build's own catalog text: its request's description when that fits a tagline; `null` lets the judge write one. */
|
|
2330
|
-
tagline: z13.string().max(140).nullable().default(null)
|
|
2372
|
+
tagline: z13.string().max(140).nullable().default(null),
|
|
2373
|
+
/** A `video` origin's raw clip, its characters, and the round submitted (§42.14). */
|
|
2374
|
+
source_video: StudioSourceVideoSchema.nullable().default(null),
|
|
2375
|
+
characters: z13.array(StudioCharacterSchema).max(CREATOR_PROGRAM.studio.video.characters_max).default([]),
|
|
2376
|
+
chosen_round: z13.number().int().positive().nullable().default(null)
|
|
2331
2377
|
});
|
|
2332
2378
|
var CreatorTemplateListingSchema = z13.object({
|
|
2333
2379
|
listed: z13.boolean(),
|
|
@@ -2381,7 +2427,15 @@ var CreatorTemplateRoundSchema = z13.object({
|
|
|
2381
2427
|
spend_micro_usd: MicroUsdField.nonnegative(),
|
|
2382
2428
|
error: z13.string().nullable(),
|
|
2383
2429
|
created_at: Timestamp,
|
|
2384
|
-
finished_at: Timestamp.nullable()
|
|
2430
|
+
finished_at: Timestamp.nullable(),
|
|
2431
|
+
/** A `video` origin round's Mira edit and its result (migration 0172, §42.14). */
|
|
2432
|
+
edit_job_id: z13.string().nullable().default(null),
|
|
2433
|
+
sample_file_id: z13.string().nullable().default(null)
|
|
2434
|
+
});
|
|
2435
|
+
var StudioPlateSchema = z13.object({
|
|
2436
|
+
file: z13.string().min(1),
|
|
2437
|
+
kind: z13.enum(["video", "image"]),
|
|
2438
|
+
file_id: z13.string().min(1)
|
|
2385
2439
|
});
|
|
2386
2440
|
var NicheVersionStudioSchema = z13.object({
|
|
2387
2441
|
round: z13.number().int().positive(),
|
|
@@ -2390,7 +2444,9 @@ var NicheVersionStudioSchema = z13.object({
|
|
|
2390
2444
|
frames: z13.array(StudioFrameSchema),
|
|
2391
2445
|
samples: z13.array(StudioSampleSchema),
|
|
2392
2446
|
tagline: z13.string().max(140),
|
|
2393
|
-
hero_sample_index: z13.number().int().nonnegative()
|
|
2447
|
+
hero_sample_index: z13.number().int().nonnegative(),
|
|
2448
|
+
/** A `video` origin's default clip and characters. */
|
|
2449
|
+
plates: z13.array(StudioPlateSchema).optional()
|
|
2394
2450
|
});
|
|
2395
2451
|
var CreatorTemplateSchema = z13.object({
|
|
2396
2452
|
id: idOf("ctp"),
|
|
@@ -2487,13 +2543,26 @@ var CreatorAnalyticsSchema = z13.object({
|
|
|
2487
2543
|
install_windows: z13.array(z13.object({ install_id: idOf("bpi"), from: Day, until: Day })).optional()
|
|
2488
2544
|
});
|
|
2489
2545
|
var CreatorTemplateCreateKindSchema = z13.object({
|
|
2490
|
-
kind: CreatorTemplateKindSchema.default("crew")
|
|
2546
|
+
kind: CreatorTemplateKindSchema.default("crew"),
|
|
2547
|
+
/** `video` makes a draft built from one raw clip (§42.14); it needs `kind: niche`. */
|
|
2548
|
+
origin: z13.literal("video").optional()
|
|
2491
2549
|
});
|
|
2492
2550
|
var StudioUploadCreateSchema = z13.object({
|
|
2493
|
-
|
|
2551
|
+
purpose: z13.enum(["source", "character"]).optional(),
|
|
2552
|
+
position: UploadPosition.optional(),
|
|
2494
2553
|
filename: z13.string().min(1).max(200),
|
|
2495
|
-
content_type: StudioUploadContentTypeSchema,
|
|
2496
|
-
bytes: z13.number().int().positive()
|
|
2554
|
+
content_type: z13.union([StudioUploadContentTypeSchema, StudioImageContentTypeSchema]),
|
|
2555
|
+
bytes: z13.number().int().positive()
|
|
2556
|
+
}).superRefine((body, ctx) => {
|
|
2557
|
+
const { video, upload_max_bytes } = CREATOR_PROGRAM.studio;
|
|
2558
|
+
const character = body.purpose === "character";
|
|
2559
|
+
const issue = (path, message) => ctx.addIssue({ code: "custom", path: [path], message });
|
|
2560
|
+
if (body.purpose !== "source" && body.position === void 0) issue("position", "position is required");
|
|
2561
|
+
if (character !== StudioImageContentTypeSchema.safeParse(body.content_type).success) {
|
|
2562
|
+
issue("content_type", character ? "a character must be a PNG, JPEG or WebP image" : "this upload must be an MP4, MOV or WebM video");
|
|
2563
|
+
}
|
|
2564
|
+
const max = character ? video.image_max_bytes : body.purpose === "source" ? video.video_max_bytes : upload_max_bytes;
|
|
2565
|
+
if (body.bytes > max) issue("bytes", `this upload may be at most ${max} bytes`);
|
|
2497
2566
|
});
|
|
2498
2567
|
var StudioUploadTicketSchema = z13.object({
|
|
2499
2568
|
object: z13.literal("studio_upload_ticket"),
|
|
@@ -2507,6 +2576,12 @@ var StudioUploadResultSchema = z13.object({
|
|
|
2507
2576
|
template_id: idOf("ctp"),
|
|
2508
2577
|
upload: StudioUploadSchema
|
|
2509
2578
|
});
|
|
2579
|
+
var StudioVideoUploadResultSchema = z13.object({
|
|
2580
|
+
object: z13.literal("studio_upload"),
|
|
2581
|
+
template_id: idOf("ctp"),
|
|
2582
|
+
source_video: StudioSourceVideoSchema.nullable(),
|
|
2583
|
+
characters: z13.array(StudioCharacterSchema)
|
|
2584
|
+
});
|
|
2510
2585
|
var StudioRoundCreateSchema = z13.object({
|
|
2511
2586
|
feedback: z13.string().min(1).max(4e3).optional(),
|
|
2512
2587
|
rights_attested: z13.boolean().optional()
|
|
@@ -2519,9 +2594,12 @@ var StudioBudgetSchema = z13.object({
|
|
|
2519
2594
|
var CreatorStudioViewSchema = z13.object({
|
|
2520
2595
|
object: z13.literal("creator_studio"),
|
|
2521
2596
|
template_id: idOf("ctp"),
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2597
|
+
/** A `video` origin's `source_video` also carries a signed `url` once its bytes landed. */
|
|
2598
|
+
studio: CreatorStudioSchema.extend({
|
|
2599
|
+
source_video: StudioSourceVideoSchema.extend({ url: z13.string().nullable().optional() }).nullable().default(null)
|
|
2600
|
+
}),
|
|
2601
|
+
/** Newest first. A `video` round also carries a signed `sample_url`. */
|
|
2602
|
+
rounds: z13.array(CreatorTemplateRoundSchema.extend({ sample_url: z13.string().nullable().optional() })),
|
|
2525
2603
|
budget: StudioBudgetSchema
|
|
2526
2604
|
});
|
|
2527
2605
|
var NicheSubmitSchema = z13.object({
|
|
@@ -2531,6 +2609,7 @@ var NicheSubmitSchema = z13.object({
|
|
|
2531
2609
|
hero_sample_index: z13.number().int().nonnegative()
|
|
2532
2610
|
})
|
|
2533
2611
|
});
|
|
2612
|
+
var VideoSubmitSchema = z13.object({ round: z13.number().int().positive() });
|
|
2534
2613
|
var CreatorListingPatchSchema = CreatorTemplateListingSchema.partial();
|
|
2535
2614
|
var CreatorListingSchema = z13.object({
|
|
2536
2615
|
object: z13.literal("creator_listing"),
|
|
@@ -2758,6 +2837,10 @@ var EventTypeSchema = z16.enum([
|
|
|
2758
2837
|
"span.harness_build.end",
|
|
2759
2838
|
"span.box_resume.start",
|
|
2760
2839
|
"span.box_resume.end",
|
|
2840
|
+
"span.tools_resolve.start",
|
|
2841
|
+
"span.tools_resolve.end",
|
|
2842
|
+
"span.model_gate.start",
|
|
2843
|
+
"span.model_gate.end",
|
|
2761
2844
|
/**
|
|
2762
2845
|
* A delegated thread's lifecycle, on the **coordinator's** stream (§28). The child's own
|
|
2763
2846
|
* `ses_…` rides inside `data.thread_id` — the event schema gains no field and `vetta.event` gains
|
|
@@ -4392,11 +4475,12 @@ var MusicGenerationSchema = z33.object({
|
|
|
4392
4475
|
duration_seconds: Seconds2.nullable(),
|
|
4393
4476
|
cost_micro_usd: MicroUsdField
|
|
4394
4477
|
});
|
|
4478
|
+
var EditModeSchema = z33.enum(["scene", "outfit_or_object", "person_swap", "recast"]);
|
|
4395
4479
|
var EditRequestSchema = z33.object({
|
|
4396
4480
|
video: z33.string().min(1),
|
|
4397
4481
|
prompt: z33.string().min(1).max(1e3),
|
|
4398
4482
|
references: z33.array(z33.string().min(1)).max(4).optional(),
|
|
4399
|
-
mode:
|
|
4483
|
+
mode: EditModeSchema.optional()
|
|
4400
4484
|
});
|
|
4401
4485
|
var EditFailureCodeSchema = z33.enum(["bad_source", "refused", "timed_out", "provider_error", "cancelled"]);
|
|
4402
4486
|
var EditJobSchema = z33.object({
|
|
@@ -4406,7 +4490,7 @@ var EditJobSchema = z33.object({
|
|
|
4406
4490
|
video: z33.string(),
|
|
4407
4491
|
prompt: z33.string(),
|
|
4408
4492
|
references: z33.array(z33.string()),
|
|
4409
|
-
mode:
|
|
4493
|
+
mode: EditModeSchema.nullable(),
|
|
4410
4494
|
result: z33.object({ file_id: z33.string().startsWith("fil_") }).nullable(),
|
|
4411
4495
|
error: z33.object({ code: EditFailureCodeSchema, message: z33.string() }).nullable(),
|
|
4412
4496
|
cost_micro_usd: MicroUsdField.nullable(),
|
|
@@ -5444,6 +5528,11 @@ function tolerantPage(item) {
|
|
|
5444
5528
|
});
|
|
5445
5529
|
}
|
|
5446
5530
|
var DOT_SEGMENT = /^(?:\.|%2e){1,2}$/i;
|
|
5531
|
+
function pathId(value, name) {
|
|
5532
|
+
if (value !== void 0 && value !== null && String(value) !== "") return encodeURIComponent(value);
|
|
5533
|
+
const message = `${name} is required`;
|
|
5534
|
+
throw new ApiError(400, { type: "invalid_request", code: "validation_failed", message, param: name, request_id: "" });
|
|
5535
|
+
}
|
|
5447
5536
|
function url(config, call) {
|
|
5448
5537
|
const segments = call.path.split("/");
|
|
5449
5538
|
if (segments.some((segment) => DOT_SEGMENT.test(segment)) || segments.at(-1) === "") {
|
|
@@ -6294,77 +6383,77 @@ var domains = (config) => ({
|
|
|
6294
6383
|
delete: (id) => request(config, DeletedSchema, { method: "DELETE", path: `/v1/domains/${encodeURIComponent(id)}` })
|
|
6295
6384
|
});
|
|
6296
6385
|
var emails = (config) => ({
|
|
6297
|
-
create: (identityId, body) => request(config, EmailInboxSchema, {
|
|
6386
|
+
create: async (identityId, body) => request(config, EmailInboxSchema, {
|
|
6298
6387
|
method: "POST",
|
|
6299
|
-
path: `/v1/identities/${
|
|
6388
|
+
path: `/v1/identities/${pathId(identityId, "identityId")}/emails`,
|
|
6300
6389
|
body
|
|
6301
6390
|
}),
|
|
6302
|
-
list: (identityId, query2 = {}) => request(config, page(EmailInboxSchema), {
|
|
6391
|
+
list: async (identityId, query2 = {}) => request(config, page(EmailInboxSchema), {
|
|
6303
6392
|
method: "GET",
|
|
6304
|
-
path: `/v1/identities/${
|
|
6393
|
+
path: `/v1/identities/${pathId(identityId, "identityId")}/emails`,
|
|
6305
6394
|
query: query2
|
|
6306
6395
|
}),
|
|
6307
6396
|
/** Turn on or off whether mail to the inbox wakes its owner. An inbox from before the wake shipped is off. */
|
|
6308
|
-
update: (identityId, inboxId, body) => request(config, EmailInboxSchema, {
|
|
6397
|
+
update: async (identityId, inboxId, body) => request(config, EmailInboxSchema, {
|
|
6309
6398
|
method: "PATCH",
|
|
6310
|
-
path: `/v1/identities/${
|
|
6399
|
+
path: `/v1/identities/${pathId(identityId, "identityId")}/emails/${encodeURIComponent(inboxId)}`,
|
|
6311
6400
|
body
|
|
6312
6401
|
}),
|
|
6313
|
-
delete: (identityId, inboxId) => request(config, DeletedSchema, {
|
|
6402
|
+
delete: async (identityId, inboxId) => request(config, DeletedSchema, {
|
|
6314
6403
|
method: "DELETE",
|
|
6315
|
-
path: `/v1/identities/${
|
|
6404
|
+
path: `/v1/identities/${pathId(identityId, "identityId")}/emails/${encodeURIComponent(inboxId)}`
|
|
6316
6405
|
}),
|
|
6317
6406
|
/** Gated on the domain's `dns_status`; a premature send is a retryable `job_not_ready`. */
|
|
6318
|
-
send: (identityId, inboxId, body) => request(config, EmailSendSchema, {
|
|
6407
|
+
send: async (identityId, inboxId, body) => request(config, EmailSendSchema, {
|
|
6319
6408
|
method: "POST",
|
|
6320
|
-
path: `/v1/identities/${
|
|
6409
|
+
path: `/v1/identities/${pathId(identityId, "identityId")}/emails/${encodeURIComponent(inboxId)}/send`,
|
|
6321
6410
|
body
|
|
6322
6411
|
}),
|
|
6323
6412
|
/** Everything that arrived for this persona, both channels unless one is named. */
|
|
6324
|
-
messages: (identityId, query2 = {}) => request(config, page(InboundMessageSchema), {
|
|
6413
|
+
messages: async (identityId, query2 = {}) => request(config, page(InboundMessageSchema), {
|
|
6325
6414
|
method: "GET",
|
|
6326
|
-
path: `/v1/identities/${
|
|
6415
|
+
path: `/v1/identities/${pathId(identityId, "identityId")}/messages`,
|
|
6327
6416
|
query: query2
|
|
6328
6417
|
}),
|
|
6329
6418
|
/** Mark one arrived message read or unread; a message already read keeps its first time. */
|
|
6330
|
-
markRead: (identityId, messageId, read) => request(config, InboundMessageSchema, {
|
|
6419
|
+
markRead: async (identityId, messageId, read) => request(config, InboundMessageSchema, {
|
|
6331
6420
|
method: "POST",
|
|
6332
|
-
path: `/v1/identities/${
|
|
6421
|
+
path: `/v1/identities/${pathId(identityId, "identityId")}/messages/${encodeURIComponent(messageId)}/read`,
|
|
6333
6422
|
body: { read }
|
|
6334
6423
|
}),
|
|
6335
6424
|
/** What the persona sent, newest first — through the API and through its agent alike. */
|
|
6336
|
-
sent: (identityId, query2 = {}) => request(config, page(OutboundMessageSchema), {
|
|
6425
|
+
sent: async (identityId, query2 = {}) => request(config, page(OutboundMessageSchema), {
|
|
6337
6426
|
method: "GET",
|
|
6338
|
-
path: `/v1/identities/${
|
|
6427
|
+
path: `/v1/identities/${pathId(identityId, "identityId")}/sent`,
|
|
6339
6428
|
query: query2
|
|
6340
6429
|
})
|
|
6341
6430
|
});
|
|
6342
6431
|
var phones = (config) => ({
|
|
6343
6432
|
/** 202, not 201: the number exists and can receive, but outbound waits on a carrier decision. */
|
|
6344
|
-
provision: (identityId, body) => request(config, PhoneNumberSchema, {
|
|
6433
|
+
provision: async (identityId, body) => request(config, PhoneNumberSchema, {
|
|
6345
6434
|
method: "POST",
|
|
6346
|
-
path: `/v1/identities/${
|
|
6435
|
+
path: `/v1/identities/${pathId(identityId, "identityId")}/phones`,
|
|
6347
6436
|
body
|
|
6348
6437
|
}),
|
|
6349
|
-
list: (identityId, query2 = {}) => request(config, page(PhoneNumberSchema), {
|
|
6438
|
+
list: async (identityId, query2 = {}) => request(config, page(PhoneNumberSchema), {
|
|
6350
6439
|
method: "GET",
|
|
6351
|
-
path: `/v1/identities/${
|
|
6440
|
+
path: `/v1/identities/${pathId(identityId, "identityId")}/phones`,
|
|
6352
6441
|
query: query2
|
|
6353
6442
|
}),
|
|
6354
6443
|
/** Set, or clear with `null`, the agent this number's inbound texts are for. */
|
|
6355
|
-
update: (identityId, phoneId, body) => request(config, PhoneNumberSchema, {
|
|
6444
|
+
update: async (identityId, phoneId, body) => request(config, PhoneNumberSchema, {
|
|
6356
6445
|
method: "PATCH",
|
|
6357
|
-
path: `/v1/identities/${
|
|
6446
|
+
path: `/v1/identities/${pathId(identityId, "identityId")}/phones/${encodeURIComponent(phoneId)}`,
|
|
6358
6447
|
body
|
|
6359
6448
|
}),
|
|
6360
|
-
release: (identityId, phoneId) => request(config, DeletedSchema, {
|
|
6449
|
+
release: async (identityId, phoneId) => request(config, DeletedSchema, {
|
|
6361
6450
|
method: "DELETE",
|
|
6362
|
-
path: `/v1/identities/${
|
|
6451
|
+
path: `/v1/identities/${pathId(identityId, "identityId")}/phones/${encodeURIComponent(phoneId)}`
|
|
6363
6452
|
}),
|
|
6364
6453
|
/** Refused with `compliance_pending` until the campaign is approved. That is a carrier rule. */
|
|
6365
|
-
send: (identityId, phoneId, body) => request(config, SmsSendSchema, {
|
|
6454
|
+
send: async (identityId, phoneId, body) => request(config, SmsSendSchema, {
|
|
6366
6455
|
method: "POST",
|
|
6367
|
-
path: `/v1/identities/${
|
|
6456
|
+
path: `/v1/identities/${pathId(identityId, "identityId")}/phones/${encodeURIComponent(phoneId)}/send`,
|
|
6368
6457
|
body
|
|
6369
6458
|
})
|
|
6370
6459
|
});
|
|
@@ -6955,7 +7044,7 @@ var wallet = (config) => {
|
|
|
6955
7044
|
updatePolicy: (identity, body, select = {}) => request(config, WalletSchema, { method: "PATCH", path: `/v1/identities/${encodeURIComponent(identity)}/wallet/policy`, body, query: select }),
|
|
6956
7045
|
freeze: (identity, select = {}) => request(config, WalletSchema, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity)}/wallet/freeze`, query: select }),
|
|
6957
7046
|
unfreeze: (identity, select = {}) => request(config, WalletSchema, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity)}/wallet/unfreeze`, query: select }),
|
|
6958
|
-
/** The
|
|
7047
|
+
/** The money moves (and `pay`) take an `idempotencyKey` so a retry of one move reuses its key and moves the money once. */
|
|
6959
7048
|
fund: (identity, body, select = {}, opts = {}) => request(config, WalletTransactionSchema, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity)}/wallet/fund`, body, query: select, headers: keyed(opts) }),
|
|
6960
7049
|
transfer: (identity, body, select = {}, opts = {}) => request(config, WalletTransactionSchema, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity)}/wallet/transfer`, body, query: select, headers: keyed(opts) }),
|
|
6961
7050
|
sweep: (identity, body = {}, select = {}, opts = {}) => request(config, WalletTransactionSchema, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity)}/wallet/sweep`, body, query: select, headers: keyed(opts) }),
|
|
@@ -6967,7 +7056,7 @@ var wallet = (config) => {
|
|
|
6967
7056
|
query: { ...query2, kind: "pay" }
|
|
6968
7057
|
}),
|
|
6969
7058
|
quote: (identity, body, select = {}) => request(config, WalletQuoteSchema, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity)}/wallet/quote`, body, query: select }),
|
|
6970
|
-
pay: (identity, body, select = {}) => request(config, WalletPaymentSchema, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity)}/wallet/pay`, body, query: select })
|
|
7059
|
+
pay: (identity, body, select = {}, opts = {}) => request(config, WalletPaymentSchema, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity)}/wallet/pay`, body, query: select, headers: keyed(opts) })
|
|
6971
7060
|
};
|
|
6972
7061
|
};
|
|
6973
7062
|
|
|
@@ -7177,65 +7266,65 @@ var SocialWorkspaceSchema = z62.object({
|
|
|
7177
7266
|
});
|
|
7178
7267
|
var SocialPortalSchema = z62.object({ object: z62.literal("social_portal_link"), url: z62.url() });
|
|
7179
7268
|
var setup = (config) => ({
|
|
7180
|
-
activate: (identity) => request(config, SocialWorkspaceSchema, {
|
|
7269
|
+
activate: async (identity) => request(config, SocialWorkspaceSchema, {
|
|
7181
7270
|
method: "POST",
|
|
7182
|
-
path: `/v1/identities/${
|
|
7271
|
+
path: `/v1/identities/${pathId(identity, "identity")}/social/activate`
|
|
7183
7272
|
}),
|
|
7184
|
-
status: (identity) => request(config, SocialWorkspaceSchema, {
|
|
7273
|
+
status: async (identity) => request(config, SocialWorkspaceSchema, {
|
|
7185
7274
|
method: "GET",
|
|
7186
|
-
path: `/v1/identities/${
|
|
7275
|
+
path: `/v1/identities/${pathId(identity, "identity")}/social`
|
|
7187
7276
|
}),
|
|
7188
|
-
portal: (identity, body = {}) => request(config, SocialPortalSchema, {
|
|
7277
|
+
portal: async (identity, body = {}) => request(config, SocialPortalSchema, {
|
|
7189
7278
|
method: "POST",
|
|
7190
|
-
path: `/v1/identities/${
|
|
7279
|
+
path: `/v1/identities/${pathId(identity, "identity")}/social/portal`,
|
|
7191
7280
|
body
|
|
7192
7281
|
}),
|
|
7193
|
-
accounts: (identity, query2 = {}) => request(config, page(SocialAccountSchema), {
|
|
7282
|
+
accounts: async (identity, query2 = {}) => request(config, page(SocialAccountSchema), {
|
|
7194
7283
|
method: "GET",
|
|
7195
|
-
path: `/v1/identities/${
|
|
7284
|
+
path: `/v1/identities/${pathId(identity, "identity")}/social/accounts`,
|
|
7196
7285
|
query: query2
|
|
7197
7286
|
}),
|
|
7198
|
-
accountAnalytics: (identity, account) => request(config, SocialAnalyticsSchema, {
|
|
7287
|
+
accountAnalytics: async (identity, account) => request(config, SocialAnalyticsSchema, {
|
|
7199
7288
|
method: "GET",
|
|
7200
|
-
path: `/v1/identities/${
|
|
7289
|
+
path: `/v1/identities/${pathId(identity, "identity")}/social/accounts/${encodeURIComponent(account)}/analytics`
|
|
7201
7290
|
}),
|
|
7202
|
-
upload: (identity, body) => request(config, SocialUploadSchema, {
|
|
7291
|
+
upload: async (identity, body) => request(config, SocialUploadSchema, {
|
|
7203
7292
|
method: "POST",
|
|
7204
|
-
path: `/v1/identities/${
|
|
7293
|
+
path: `/v1/identities/${pathId(identity, "identity")}/social/uploads`,
|
|
7205
7294
|
body
|
|
7206
7295
|
})
|
|
7207
7296
|
});
|
|
7208
7297
|
var publishing = (config) => ({
|
|
7209
|
-
createPost: (identity, body) => request(config, SocialPostSchema, {
|
|
7298
|
+
createPost: async (identity, body) => request(config, SocialPostSchema, {
|
|
7210
7299
|
method: "POST",
|
|
7211
|
-
path: `/v1/identities/${
|
|
7300
|
+
path: `/v1/identities/${pathId(identity, "identity")}/social/posts`,
|
|
7212
7301
|
body
|
|
7213
7302
|
}),
|
|
7214
|
-
getPost: (identity, post) => request(config, SocialPostSchema, {
|
|
7303
|
+
getPost: async (identity, post) => request(config, SocialPostSchema, {
|
|
7215
7304
|
method: "GET",
|
|
7216
|
-
path: `/v1/identities/${
|
|
7305
|
+
path: `/v1/identities/${pathId(identity, "identity")}/social/posts/${encodeURIComponent(post)}`
|
|
7217
7306
|
}),
|
|
7218
|
-
deletePost: (identity, post) => request(config, DeletedSchema, {
|
|
7307
|
+
deletePost: async (identity, post) => request(config, DeletedSchema, {
|
|
7219
7308
|
method: "DELETE",
|
|
7220
|
-
path: `/v1/identities/${
|
|
7309
|
+
path: `/v1/identities/${pathId(identity, "identity")}/social/posts/${encodeURIComponent(post)}`
|
|
7221
7310
|
}),
|
|
7222
|
-
postAnalytics: (identity, post) => request(config, SocialAnalyticsSchema, {
|
|
7311
|
+
postAnalytics: async (identity, post) => request(config, SocialAnalyticsSchema, {
|
|
7223
7312
|
method: "GET",
|
|
7224
|
-
path: `/v1/identities/${
|
|
7313
|
+
path: `/v1/identities/${pathId(identity, "identity")}/social/posts/${encodeURIComponent(post)}/analytics`
|
|
7225
7314
|
}),
|
|
7226
7315
|
/**
|
|
7227
7316
|
* `GET /v1/posts` — every post the company files, across identities and sessions (§27.1): the
|
|
7228
7317
|
* `social.post` calls waiting on a person (`pending`), and the ones sent, with their latest numbers.
|
|
7229
7318
|
* `reconcile: false` lists what is stored without asking the provider about due posts first.
|
|
7230
7319
|
*/
|
|
7231
|
-
listPosts: ({ reconcile, ...query2 } = {}) => request(config, page(PostSchema), {
|
|
7320
|
+
listPosts: async ({ reconcile, ...query2 } = {}) => request(config, page(PostSchema), {
|
|
7232
7321
|
method: "GET",
|
|
7233
7322
|
path: "/v1/posts",
|
|
7234
7323
|
query: { ...query2, ...reconcile === void 0 ? {} : { reconcile: String(reconcile) } }
|
|
7235
7324
|
}),
|
|
7236
|
-
comments: (identity, post, query2 = {}) => request(config, page(SocialCommentSchema), {
|
|
7325
|
+
comments: async (identity, post, query2 = {}) => request(config, page(SocialCommentSchema), {
|
|
7237
7326
|
method: "GET",
|
|
7238
|
-
path: `/v1/identities/${
|
|
7327
|
+
path: `/v1/identities/${pathId(identity, "identity")}/social/posts/${encodeURIComponent(post)}/comments`,
|
|
7239
7328
|
query: query2
|
|
7240
7329
|
})
|
|
7241
7330
|
});
|
|
@@ -7408,10 +7497,10 @@ async function* streamFrames(config, schema, call) {
|
|
|
7408
7497
|
yield parsed.data;
|
|
7409
7498
|
}
|
|
7410
7499
|
}
|
|
7411
|
-
function
|
|
7412
|
-
if (session.status === "running" || session.status === "queued") return
|
|
7413
|
-
if (throughGrades && session.stop_reason === "awaiting_delegation") return
|
|
7414
|
-
return session.last_seq
|
|
7500
|
+
function settledAt(session, throughGrades) {
|
|
7501
|
+
if (session.status === "running" || session.status === "queued") return null;
|
|
7502
|
+
if (throughGrades && session.stop_reason === "awaiting_delegation") return null;
|
|
7503
|
+
return session.last_seq;
|
|
7415
7504
|
}
|
|
7416
7505
|
async function* streamEvents(config, sessionId, options = {}) {
|
|
7417
7506
|
const maxRetries = options.maxRetries ?? 5;
|
|
@@ -7420,7 +7509,8 @@ async function* streamEvents(config, sessionId, options = {}) {
|
|
|
7420
7509
|
let failures = 0;
|
|
7421
7510
|
const grading = /* @__PURE__ */ new Set();
|
|
7422
7511
|
let held = false;
|
|
7423
|
-
|
|
7512
|
+
const endAt = lastSeq > 0 ? settledAt(await sessions(config).get(sessionId), throughGrades) : null;
|
|
7513
|
+
if (endAt !== null && endAt <= lastSeq) return;
|
|
7424
7514
|
for (; ; ) {
|
|
7425
7515
|
try {
|
|
7426
7516
|
const call = {
|
|
@@ -7438,6 +7528,7 @@ async function* streamEvents(config, sessionId, options = {}) {
|
|
|
7438
7528
|
if (event.type === "outcome.evaluation.started") grading.add(gradeKey(event));
|
|
7439
7529
|
if (event.type === "outcome.evaluation.completed") grading.delete(gradeKey(event));
|
|
7440
7530
|
yield event;
|
|
7531
|
+
if (endAt !== null && event.seq >= endAt) return;
|
|
7441
7532
|
if (event.type === "session.idle") {
|
|
7442
7533
|
held = throughGrades && grading.size > 0 && parkedOnGrade(event);
|
|
7443
7534
|
if (!held) return;
|
|
@@ -7509,7 +7600,7 @@ var computers = (config) => ({
|
|
|
7509
7600
|
path: `/v1/computers/${encodeURIComponent(id)}/exec`,
|
|
7510
7601
|
body: { command, ...timeoutMs === void 0 ? {} : { timeout_ms: timeoutMs } }
|
|
7511
7602
|
}),
|
|
7512
|
-
/** Paused bills
|
|
7603
|
+
/** Paused bills nothing (disk is never metered) — the first efficiency lever (`memory/context.md`). */
|
|
7513
7604
|
pause: (id) => request(config, ComputerSchema, { method: "POST", path: `/v1/computers/${encodeURIComponent(id)}/pause`, body: {} }),
|
|
7514
7605
|
resume: (id) => request(config, ComputerSchema, { method: "POST", path: `/v1/computers/${encodeURIComponent(id)}/resume`, body: {} }),
|
|
7515
7606
|
/** An agent's computer only (§41.8): a person holds it, and its sessions wait until it is handed back. */
|