@jush-agent/sdk 0.2.6342 → 0.2.6368

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.mjs CHANGED
@@ -159,8 +159,17 @@ const queuedMessageSchema = z.object({
159
159
  * absent for a message the user wrote.
160
160
  */
161
161
  schedule: scheduleMarkSchema.optional(),
162
- /** Who sent it, which its `user` block keeps. */
163
- senderId: z.string().min(1).max(255).optional()
162
+ /**
163
+ * The labels its program gave it, which its `user` block keeps; omitted
164
+ * when there are none.
165
+ */
166
+ labels: z.record(z.string(), z.string()).optional(),
167
+ /**
168
+ * The assignment it is part of, which its `user` block keeps: its own id
169
+ * for one that opens one, the work's for one that continues it; absent
170
+ * when it names none.
171
+ */
172
+ assignmentId: z.string().min(1).optional()
164
173
  });
165
174
  /** What an `abort` stopped, and whether another `abort` would stop more. */
166
175
  const abortResultSchema = z.object({
@@ -533,8 +542,17 @@ const pendingSteerSchema = z.object({
533
542
  * there are none.
534
543
  */
535
544
  comments: z.array(messageCommentSchema).optional(),
536
- /** Who sent it, which its `steer` block keeps. */
537
- senderId: z.string().min(1).max(255).optional()
545
+ /**
546
+ * The labels its program gave it, which its `steer` block keeps; omitted
547
+ * when there are none.
548
+ */
549
+ labels: z.record(z.string(), z.string()).optional(),
550
+ /**
551
+ * The assignment it continues when it opens a turn of its own, as its
552
+ * program named it; none for one that opens the assignment of its own
553
+ * id. One the running turn reads joins that turn's.
554
+ */
555
+ assignmentId: z.string().min(1).optional()
538
556
  });
539
557
  /** One agent of the conversation. */
540
558
  const agentEntrySchema = z.object({
@@ -729,15 +747,19 @@ const agentMessageSchema = z.object({
729
747
  */
730
748
  origin: z.string().min(1).nullable().optional(),
731
749
  /**
732
- * Whom the work the message tells of is for, by the id its program
733
- * gave its sender (`crate::UserBlock`'s `sender_id`): for an explicit
734
- * message, whom the sending agent worked for
735
- * (`crate::Block::sender_id`); for a child's end, whom the child worked
736
- * for as it closed; for the end of another conversation's work, whom
737
- * the message that asked for it named. Absent for any other message,
738
- * and when no one was named.
750
+ * The program's labels of the work the message hands or tells of
751
+ * (`crate::UserBlock`'s `labels`): for an explicit message, those of the
752
+ * sending agent's work (`crate::Block::labels`); for a child's end, those
753
+ * of its work as it closed; for the end of another conversation's work,
754
+ * those of the message that asked for it. Omitted when there are none.
755
+ */
756
+ labels: z.record(z.string(), z.string()).optional(),
757
+ /**
758
+ * The assignment the work the message hands or tells of is part of, by
759
+ * the id of the message that opened it, as `labels` are its labels;
760
+ * absent when it names none.
739
761
  */
740
- senderId: z.string().min(1).max(255).nullable().optional()
762
+ assignmentId: z.string().min(1).nullable().optional()
741
763
  });
742
764
  /** How the video an edit or an extension changes went to the vendor. */
743
765
  const sentSourceSchema = z.discriminatedUnion("type", [
@@ -1047,11 +1069,15 @@ const commandReportSchema = z.object({
1047
1069
  */
1048
1070
  media: z.array(toolResultContentBlockSchema).optional(),
1049
1071
  /**
1050
- * Whom the command's work is for: the sender of the call that started
1051
- * it, which its record keeps; absent when that call's work was for no
1052
- * one named.
1072
+ * The labels of the work of the call that started it, which its record
1073
+ * keeps; omitted when there are none.
1074
+ */
1075
+ labels: z.record(z.string(), z.string()).optional(),
1076
+ /**
1077
+ * The assignment of the call that started it, which its record keeps; absent
1078
+ * when that call's turn named none.
1053
1079
  */
1054
- senderId: z.string().min(1).max(255).optional()
1080
+ assignmentId: z.string().min(1).optional()
1055
1081
  });
1056
1082
  /** Where a vendor's step is. */
1057
1083
  const opaqueStatusSchema = z.enum([
@@ -1477,10 +1503,19 @@ const blockSchema = z.discriminatedUnion("type", [
1477
1503
  */
1478
1504
  schedule: scheduleMarkSchema.optional(),
1479
1505
  /**
1480
- * Who sent the message, by the id the program that sent it gave
1481
- * ([`SENDER_ID_LIMIT`]); absent when it named no one.
1506
+ * The labels its program gave it, which its work carries
1507
+ * (`crate::Labels`); omitted when there are none.
1482
1508
  */
1483
- senderId: z.string().min(1).max(255).optional()
1509
+ labels: z.record(z.string(), z.string()).optional(),
1510
+ /**
1511
+ * The assignment the message is part of, by the id of the message that
1512
+ * opened it: its own for one the program, the user or a schedule sent,
1513
+ * or the one the program named of earlier work it continues; the turn's
1514
+ * that made it for a run of a schedule an agent made, and its parent's
1515
+ * for a subagent's. Absent when it names none, as the work it continues
1516
+ * named none, and in a block written before assignments were kept.
1517
+ */
1518
+ assignmentId: z.string().min(1).optional()
1484
1519
  }),
1485
1520
  z.object({
1486
1521
  type: z.literal("context"),
@@ -1560,8 +1595,16 @@ const blockSchema = z.discriminatedUnion("type", [
1560
1595
  * as a message's; omitted when there are none.
1561
1596
  */
1562
1597
  comments: z.array(messageCommentSchema).optional(),
1563
- /** Who sent it, as a `user` block names its sender. */
1564
- senderId: z.string().min(1).max(255).optional()
1598
+ /**
1599
+ * The labels its program gave it, as a `user` block's; omitted when
1600
+ * there are none.
1601
+ */
1602
+ labels: z.record(z.string(), z.string()).optional(),
1603
+ /**
1604
+ * The assignment of the turn that read it, which it joins; absent when that
1605
+ * turn named none.
1606
+ */
1607
+ assignmentId: z.string().min(1).optional()
1565
1608
  }),
1566
1609
  z.object({
1567
1610
  type: z.literal("agent_message"),
@@ -2304,12 +2347,19 @@ z.discriminatedUnion("type", [
2304
2347
  */
2305
2348
  comments: z.array(clientCommentSchema).optional(),
2306
2349
  /**
2307
- * Who sent it, by a program's own id, such as a person of a team's
2308
- * chat, which its `user` block keeps: the calls its agent makes after
2309
- * reading it are that sender's in the usage ledger. Absent for the
2310
- * core's own user, as the web app sends.
2350
+ * The program's own labels, such as who asked or what kind of work it
2351
+ * is, which its `user` block keeps: the calls its agent makes after
2352
+ * reading it carry them in the usage ledger. Absent for the core's own
2353
+ * user, as the web app sends.
2354
+ */
2355
+ labels: z.record(z.string(), z.string()).optional(),
2356
+ /**
2357
+ * The assignment it continues, by the id of the message that opened
2358
+ * it, as its program names it: the calls of the turn it opens are
2359
+ * counted in it. Absent for one that opens the assignment of its own
2360
+ * id.
2311
2361
  */
2312
- senderId: z.string().min(1).max(255).nullable().optional()
2362
+ assignmentId: z.string().min(1).nullable().optional()
2313
2363
  }),
2314
2364
  z.strictObject({
2315
2365
  type: z.literal("edit_and_send"),
@@ -2334,8 +2384,13 @@ z.discriminatedUnion("type", [
2334
2384
  * there are none.
2335
2385
  */
2336
2386
  comments: z.array(clientCommentSchema).optional(),
2337
- /** Who sent it, as a message's sender. */
2338
- senderId: z.string().min(1).max(255).nullable().optional()
2387
+ /** The labels its program gave it, as a message's. */
2388
+ labels: z.record(z.string(), z.string()).optional(),
2389
+ /**
2390
+ * The assignment it continues when it opens a turn of its own, as a
2391
+ * message's; one the running turn reads joins that turn's.
2392
+ */
2393
+ assignmentId: z.string().min(1).nullable().optional()
2339
2394
  }),
2340
2395
  z.strictObject({
2341
2396
  type: z.literal("send_saved"),
@@ -3137,11 +3192,15 @@ const jobCallerSchema = z.object({
3137
3192
  */
3138
3193
  turn: z.string().min(1).nullable().optional(),
3139
3194
  /**
3140
- * Whom the call's agent worked for, by its program's id, whom a
3141
- * command's call to a vendor is counted for; none when no one was
3142
- * named.
3195
+ * The labels of the work the call's agent did, which a command's call
3196
+ * to a vendor is counted with; omitted when there are none.
3197
+ */
3198
+ labels: z.record(z.string(), z.string()).optional(),
3199
+ /**
3200
+ * The assignment the call's agent worked in, which a command's call to a
3201
+ * vendor is counted in; none when its turn named none.
3143
3202
  */
3144
- senderId: z.string().nullable().optional()
3203
+ assignmentId: z.string().min(1).nullable().optional()
3145
3204
  });
3146
3205
  /** The ids of a call's relayed pipes. */
3147
3206
  const relayedPipesSchema = z.object({
@@ -4002,10 +4061,14 @@ z.discriminatedUnion("kind", [
4002
4061
  kind: z.literal("debug"),
4003
4062
  resume: z.string().nullable().optional()
4004
4063
  }),
4005
- z.strictObject({ kind: z.literal("starter") }),
4064
+ z.strictObject({
4065
+ kind: z.literal("starter"),
4066
+ version: z.string().nullable().optional()
4067
+ }),
4006
4068
  z.strictObject({
4007
4069
  kind: z.literal("plugin"),
4008
- plugin: z.string()
4070
+ plugin: z.string(),
4071
+ version: z.string().nullable().optional()
4009
4072
  })
4010
4073
  ]);
4011
4074
  /** A point of the picture, in its coordinates. */
@@ -4048,8 +4111,11 @@ const refusedCodeSchema = z.object({
4048
4111
  message: z.string()
4049
4112
  });
4050
4113
  z.object({
4051
- /** The address the user opens to confirm the login. */
4052
- verificationUrl: z.string(),
4114
+ /**
4115
+ * The address the user opens to confirm the login; null for a login
4116
+ * that waits for a refresh token the user pastes.
4117
+ */
4118
+ verificationUrl: z.string().nullable(),
4053
4119
  /**
4054
4120
  * The one-time code the user enters there; null when the address
4055
4121
  * carries it.
@@ -5413,6 +5479,11 @@ const accountDtoSchema = z.object({
5413
5479
  /** The account's last real snapshot; null before any. */
5414
5480
  quota: quotaSnapshotSchema.nullable()
5415
5481
  });
5482
+ /** How a sign-in proves the account. */
5483
+ const loginMethodSchema = z.enum(["browser", "refreshToken"]);
5484
+ z.strictObject({
5485
+ /** One of the family's `loginMethods`; `browser` without it. */
5486
+ method: loginMethodSchema.optional() });
5416
5487
  z.strictObject({ credentialIds: z.array(z.string().min(1)) });
5417
5488
  /** `GET /providers/:id/accounts`: the entry's accounts and the active one. */
5418
5489
  const accountsSchema = z.object({
@@ -5461,10 +5532,15 @@ z.strictObject({
5461
5532
  /** What is asked, a message's content, as a frame names it. */
5462
5533
  question: z.array(clientContentSchema),
5463
5534
  /**
5464
- * Who asked, as a message's sender
5535
+ * The labels its program gave it, as a message's
5465
5536
  * (`crates/conversation-lane-protocol/src/client.rs`).
5466
5537
  */
5467
- senderId: z.string().min(1).max(255).nullable().optional()
5538
+ labels: z.record(z.string(), z.string()).optional(),
5539
+ /**
5540
+ * The assignment its question continues, as a message's; one of its
5541
+ * own id when absent.
5542
+ */
5543
+ assignmentId: z.string().min(1).nullable().optional()
5468
5544
  });
5469
5545
  /** `AuthenticatorAssertionResponseJSON`. */
5470
5546
  const assertionResponseJsonSchema = z.strictObject({
@@ -5952,6 +6028,7 @@ const patchFieldSchema = z.enum([
5952
6028
  "browser_profile",
5953
6029
  "system_prompt",
5954
6030
  "commands",
6031
+ "plugin_versions",
5955
6032
  "target"
5956
6033
  ]);
5957
6034
  /**
@@ -6033,6 +6110,14 @@ const conversationPatchSchema = z.strictObject({
6033
6110
  * agent's next command; null for every command.
6034
6111
  */
6035
6112
  commands: z.array(z.string()).nullable().optional(),
6113
+ /**
6114
+ * The versions it runs on of the program's plugins, each by its
6115
+ * plugin's id, in place of those it named: its agents' commands, and
6116
+ * every request of the conversation, go to them from now on; a call
6117
+ * sent already goes on where it is. `{}` returns it to the current
6118
+ * versions.
6119
+ */
6120
+ pluginVersions: z.record(z.string(), z.string()).optional(),
6036
6121
  /** A switch of the conversation's execution target. */
6037
6122
  target: conversationTargetSchema.optional()
6038
6123
  });
@@ -6582,6 +6667,66 @@ const commandEndSchema = z.discriminatedUnion("kind", [
6582
6667
  }),
6583
6668
  z.object({ kind: z.literal("unrecorded") })
6584
6669
  ]);
6670
+ /** How a command ended, or why a call started none. */
6671
+ const commandHistoryEndSchema = z.discriminatedUnion("kind", [
6672
+ z.object({
6673
+ kind: z.literal("exited"),
6674
+ exitCode: z.int().min(-2147483648).max(2147483647)
6675
+ }),
6676
+ z.object({ kind: z.literal("stopped") }),
6677
+ z.object({
6678
+ kind: z.literal("lost"),
6679
+ reason: z.string()
6680
+ }),
6681
+ z.object({
6682
+ kind: z.literal("not_started"),
6683
+ reason: z.string()
6684
+ })
6685
+ ]);
6686
+ /**
6687
+ * A command an agent's `shell` call started, as it ended, or a call that
6688
+ * started none.
6689
+ */
6690
+ const commandHistoryEntrySchema = z.object({
6691
+ conversation: z.string().regex(/* @__PURE__ */ new RegExp("^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", "u")),
6692
+ /**
6693
+ * The number its conversation knows the call's agent by, 0 for the
6694
+ * main agent; none for a side question's.
6695
+ */
6696
+ agent: z.int().min(0).nullable().optional(),
6697
+ /** None for a call that started no command. */
6698
+ command: z.string().min(1).nullable().optional(),
6699
+ /** The device it ran on; none for a call that started no command. */
6700
+ device: z.string().min(1).nullable().optional(),
6701
+ /** The turn of the call. */
6702
+ turn: z.string().min(1).nullable().optional(),
6703
+ /** The program's labels of the call's work. */
6704
+ labels: z.record(z.string(), z.string()),
6705
+ /** The assignment the call's work was part of. */
6706
+ assignment: z.string().min(1).nullable().optional(),
6707
+ title: z.string(),
6708
+ script: z.string(),
6709
+ /**
6710
+ * When its call started it, a wait for its device to come online
6711
+ * included; none for a call that started no command, and for a
6712
+ * command that ended before its start was recorded.
6713
+ */
6714
+ startedAt: z.iso.datetime({ precision: 3 }).nullable().optional(),
6715
+ endedAt: z.iso.datetime({ precision: 3 }),
6716
+ end: commandHistoryEndSchema
6717
+ });
6718
+ /** A page of the history. */
6719
+ const commandHistorySchema = z.object({
6720
+ commands: z.array(commandHistoryEntrySchema),
6721
+ /**
6722
+ * Where the page ends, which `after` takes to read on: its last row's
6723
+ * place; for an empty page, the `after` given, the newest row's when
6724
+ * nothing ended at `from` or after, or the place before the first row.
6725
+ */
6726
+ next: z.string(),
6727
+ /** Whether rows were written after the page. */
6728
+ more: z.boolean()
6729
+ });
6585
6730
  /**
6586
6731
  * `GET /conversations/:id/commands/:commandId`: where the `shell` call that
6587
6732
  * started a command lies, which a report's title brings into view.
@@ -6917,6 +7062,11 @@ const conversationMetadataSchema = z.object({
6917
7062
  */
6918
7063
  commands: z.array(z.string()).nullable(),
6919
7064
  /**
7065
+ * The versions it runs on of the program's plugins, each by its
7066
+ * plugin's id; the current one of a plugin it names none of.
7067
+ */
7068
+ pluginVersions: z.record(z.string(), z.string()),
7069
+ /**
6920
7070
  * The directory the conversation's work runs in, resolved by the backend
6921
7071
  * for every kind of target, so the web app never derives it.
6922
7072
  */
@@ -8050,6 +8200,8 @@ const listedLoginSchema = z.object({
8050
8200
  providerId: z.string().min(1).nullable(),
8051
8201
  /** The entry's family, or the family of the entry the login makes. */
8052
8202
  providerType: z.string(),
8203
+ /** The way it signs in. */
8204
+ method: loginMethodSchema,
8053
8205
  /** As `GET /providers/subscription-login/:id` answers it. */
8054
8206
  login: loginStateSchema
8055
8207
  });
@@ -8146,12 +8298,19 @@ const sendMessageSchema = z.strictObject({
8146
8298
  */
8147
8299
  comments: z.array(clientCommentSchema).optional(),
8148
8300
  /**
8149
- * Who sent it, by a program's own id, such as a person of a team's
8150
- * chat, which its `user` block keeps: the calls its agent makes after
8151
- * reading it are that sender's in the usage ledger. Absent for the
8152
- * core's own user, as the web app sends.
8301
+ * The program's own labels, such as who asked or what kind of work it
8302
+ * is, which its `user` block keeps: the calls its agent makes after
8303
+ * reading it carry them in the usage ledger. Absent for the core's own
8304
+ * user, as the web app sends.
8305
+ */
8306
+ labels: z.record(z.string(), z.string()).optional(),
8307
+ /**
8308
+ * The assignment it continues, by the id of the message that opened
8309
+ * it, as its program names it: the calls of the turn it opens are
8310
+ * counted in it. Absent for one that opens the assignment of its own
8311
+ * id.
8153
8312
  */
8154
- senderId: z.string().min(1).max(255).nullable().optional()
8313
+ assignmentId: z.string().min(1).nullable().optional()
8155
8314
  });
8156
8315
  z.strictObject({
8157
8316
  id: z.string().regex(/* @__PURE__ */ new RegExp("^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", "u")),
@@ -8191,6 +8350,11 @@ z.strictObject({
8191
8350
  */
8192
8351
  commands: z.array(z.string()).optional(),
8193
8352
  /**
8353
+ * The versions it runs on of the program's plugins, each by its
8354
+ * plugin's id; the current one of a plugin it names none of.
8355
+ */
8356
+ pluginVersions: z.record(z.string(), z.string()).optional(),
8357
+ /**
8194
8358
  * The message the conversation starts with, as the socket's `send`
8195
8359
  * frame carries it.
8196
8360
  */
@@ -10610,10 +10774,21 @@ z.object({
10610
10774
  replyBlocks: z.array(replyBlockFactsSchema).optional()
10611
10775
  });
10612
10776
  z.strictObject({
10777
+ /**
10778
+ * Its id, which names the assignment it opens unless it names another,
10779
+ * and which a retry repeats so the side question takes it once; one is
10780
+ * made when none.
10781
+ */
10782
+ id: z.string().min(1).nullable().optional(),
10613
10783
  /** A message's content, as a frame names it. */
10614
10784
  content: z.array(clientContentSchema),
10615
- /** Who sent it, as a message's sender. */
10616
- senderId: z.string().min(1).max(255).nullable().optional()
10785
+ /** The labels its program gave it, as a message's. */
10786
+ labels: z.record(z.string(), z.string()).optional(),
10787
+ /**
10788
+ * The assignment it continues, as a message's; one of its own id when
10789
+ * absent.
10790
+ */
10791
+ assignmentId: z.string().min(1).nullable().optional()
10617
10792
  });
10618
10793
  /**
10619
10794
  * The answer of a side question's creation and of its patch: the side
@@ -10726,10 +10901,15 @@ z.strictObject({
10726
10901
  id: z.string().min(1).nullable().optional(),
10727
10902
  text: z.string(),
10728
10903
  /**
10729
- * Who sent it, as a message's sender
10904
+ * The labels its program gave it, as a message's
10730
10905
  * (`crates/conversation-lane-protocol/src/client.rs`).
10731
10906
  */
10732
- senderId: z.string().min(1).max(255).nullable().optional()
10907
+ labels: z.record(z.string(), z.string()).optional(),
10908
+ /**
10909
+ * The assignment it continues when it opens a turn of its own, as a
10910
+ * message's; one the running subagent reads joins its turn's.
10911
+ */
10912
+ assignmentId: z.string().min(1).nullable().optional()
10733
10913
  });
10734
10914
  /**
10735
10915
  * What a message to a subagent answers: its id, the one it named or the one
@@ -10771,12 +10951,19 @@ const subscriptionFamilySchema = z.object({
10771
10951
  * Whether its vendor's terms forbid it through third-party software,
10772
10952
  * which Settings says before an account is added.
10773
10953
  */
10774
- forbidsThirdParty: z.boolean()
10954
+ forbidsThirdParty: z.boolean(),
10955
+ /**
10956
+ * The ways its accounts sign in, the first the one a sign-in starts
10957
+ * with; a family with more lets the user choose.
10958
+ */
10959
+ loginMethods: z.array(loginMethodSchema)
10775
10960
  });
10776
10961
  z.strictObject({
10777
10962
  providerType: z.string().min(1),
10778
10963
  /** The new entry's label; the family's subscription name without it. */
10779
- label: z.string().trim().min(1).optional()
10964
+ label: z.string().trim().min(1).optional(),
10965
+ /** One of the family's `loginMethods`; `browser` without it. */
10966
+ method: loginMethodSchema.optional()
10780
10967
  });
10781
10968
  /** How the user took a suggested reply. */
10782
10969
  const suggestedReplyUseSchema = z.enum(["sent", "edited"]);
@@ -11061,17 +11248,24 @@ const usageCostsSchema = z.object({
11061
11248
  cny: z.number().nullable().optional()
11062
11249
  });
11063
11250
  /**
11064
- * The calls of a bucket that share each of the report's dimensions, which
11065
- * it names; a dimension the report does not group by is absent, and one
11066
- * a call has no value of, such as the sender of a title's call, is null.
11251
+ * The calls of a bucket that share each of the report's dimensions and
11252
+ * labels, which it names; a dimension the report does not group by is
11253
+ * absent, and one a call has no value of, such as the agent of a title's
11254
+ * call, is null.
11067
11255
  */
11068
11256
  const usageReportGroupSchema = z.object({
11069
11257
  conversation: z.string().nullable().optional(),
11070
- sender: z.string().nullable().optional(),
11258
+ agent: z.int().min(0).nullable().optional(),
11259
+ /**
11260
+ * The value of each label the report groups by, by its key, null for
11261
+ * the calls without it; absent when it groups by none.
11262
+ */
11263
+ labels: z.record(z.string(), z.string().nullable()).optional(),
11071
11264
  model: z.string().nullable().optional(),
11072
11265
  provider: z.string().nullable().optional(),
11073
11266
  account: z.string().nullable().optional(),
11074
11267
  turn: z.string().nullable().optional(),
11268
+ assignment: z.string().nullable().optional(),
11075
11269
  purpose: z.string().nullable().optional(),
11076
11270
  calls: z.int().min(0),
11077
11271
  inputTokens: z.int().min(0),
@@ -11092,20 +11286,25 @@ const usageReportGroupSchema = z.object({
11092
11286
  */
11093
11287
  unpricedCalls: z.int().min(0)
11094
11288
  });
11095
- /** One hour or day of a report, and its calls' groups. */
11289
+ /** One minute, hour or day of a report, and its calls' groups. */
11096
11290
  const usageBucketSchema = z.object({
11097
11291
  start: z.iso.datetime({ precision: 3 }),
11098
11292
  end: z.iso.datetime({ precision: 3 }),
11099
11293
  groups: z.array(usageReportGroupSchema)
11100
11294
  });
11101
- z.enum(["hour", "day"]);
11295
+ z.enum([
11296
+ "minute",
11297
+ "hour",
11298
+ "day"
11299
+ ]);
11102
11300
  z.enum([
11103
11301
  "conversation",
11104
11302
  "model",
11105
11303
  "provider",
11106
11304
  "turn",
11107
- "sender",
11305
+ "agent",
11108
11306
  "account",
11307
+ "assignment",
11109
11308
  "purpose"
11110
11309
  ]);
11111
11310
  /**
@@ -11907,14 +12106,14 @@ var ConversationClient = class {
11907
12106
  * the transcript or the queue. The wait has no deadline of its own: the
11908
12107
  * backend decides that a delivery failed, and says why.
11909
12108
  */
11910
- submit(content, messageId = createId(), comments = [], senderId) {
12109
+ submit(content, messageId = createId(), comments = [], options = {}) {
11911
12110
  let at;
11912
12111
  return this.request({
11913
12112
  type: "send",
11914
12113
  messageId,
11915
12114
  content,
11916
12115
  ...comments.length > 0 ? { comments: [...comments] } : {},
11917
- ...senderId === void 0 ? {} : { senderId }
12116
+ ...options
11918
12117
  }, (event) => {
11919
12118
  if (event.type === "send_result" && event.messageId === messageId) at = event.at;
11920
12119
  if (at !== void 0 && this.holdsVersion(at)) return { resolve: void 0 };
@@ -12030,14 +12229,14 @@ var ConversationClient = class {
12030
12229
  * version the answer names, which shows the steer, and rejects with
12031
12230
  * `SteerRejectedError` when the session refuses it.
12032
12231
  */
12033
- steer(content, steerId = createId(), comments = [], senderId) {
12232
+ steer(content, steerId = createId(), comments = [], options = {}) {
12034
12233
  let at;
12035
12234
  return this.request({
12036
12235
  type: "steer",
12037
12236
  steerId,
12038
12237
  content,
12039
12238
  ...comments.length > 0 ? { comments: [...comments] } : {},
12040
- ...senderId === void 0 ? {} : { senderId }
12239
+ ...options
12041
12240
  }, (event) => {
12042
12241
  if (event.type === "steer_result" && event.steerId === steerId) {
12043
12242
  if (event.outcome.status !== "accepted") return { reject: new SteerRejectedError(event.outcome) };
@@ -14404,9 +14603,11 @@ function sideQuestions(routes, id) {
14404
14603
  id: question.id ?? randomUUID(),
14405
14604
  question: content(question.question)
14406
14605
  }),
14407
- followUp: (side, input, options = {}) => routes.send("POST", `${one(side)}/messages`, {
14606
+ followUp: (side, input, messageId = randomUUID(), options = {}) => routes.send("POST", `${one(side)}/messages`, {
14607
+ id: messageId,
14408
14608
  content: content(input),
14409
- senderId: options.senderId
14609
+ labels: options.labels,
14610
+ assignmentId: options.assignmentId
14410
14611
  }),
14411
14612
  retry: (side) => routes.send("POST", `${one(side)}/retry`),
14412
14613
  stop: (side) => routes.send("POST", `${one(side)}/stop`),
@@ -14628,7 +14829,7 @@ var Conversation = class {
14628
14829
  * `messageId`, which messages and steers share.
14629
14830
  */
14630
14831
  async send(input, messageId = randomUUID(), options = {}) {
14631
- await (await this.open()).submit(content(input), messageId, [], options.senderId);
14832
+ await (await this.open()).submit(content(input), messageId, [], options);
14632
14833
  }
14633
14834
  /**
14634
14835
  * Changes what `patch` names of the conversation, as the app's settings
@@ -14705,7 +14906,8 @@ var Conversation = class {
14705
14906
  const { id } = await this.routes.json("POST", path, subagentMessageAnswerSchema, {
14706
14907
  id: messageId,
14707
14908
  text,
14708
- senderId: options.senderId
14909
+ labels: options.labels,
14910
+ assignmentId: options.assignmentId
14709
14911
  });
14710
14912
  return id;
14711
14913
  }
@@ -14715,7 +14917,7 @@ var Conversation = class {
14715
14917
  * `steerId`, which messages and steers share.
14716
14918
  */
14717
14919
  async steer(input, steerId = randomUUID(), options = {}) {
14718
- await (await this.open()).steer(content(input), steerId, [], options.senderId);
14920
+ await (await this.open()).steer(content(input), steerId, [], options);
14719
14921
  }
14720
14922
  async abort() {
14721
14923
  return (await this.open()).abort();
@@ -14968,11 +15170,23 @@ function usage$1(routes) {
14968
15170
  to: options.to.toISOString(),
14969
15171
  bucket: options.bucket,
14970
15172
  timeZone: options.timeZone,
14971
- groupBy: options.groupBy !== void 0 && options.groupBy.length > 0 ? options.groupBy.join(",") : void 0
15173
+ groupBy: options.groupBy !== void 0 && options.groupBy.length > 0 ? options.groupBy.join(",") : void 0,
15174
+ conversations: options.conversations?.join(","),
15175
+ agents: options.agents?.join(",")
14972
15176
  })}`, usageReportSchema)
14973
15177
  };
14974
15178
  }
14975
15179
  //#endregion
15180
+ //#region src/commands.ts
15181
+ /** The commands a core's agents ran, as the core's command history keeps them. */
15182
+ function commands(routes) {
15183
+ return { history: (options = {}) => routes.json("GET", `/commands/history${query({
15184
+ after: options.after,
15185
+ from: options.from?.toISOString(),
15186
+ limit: options.limit
15187
+ })}`, commandHistorySchema) };
15188
+ }
15189
+ //#endregion
14976
15190
  //#region src/organize.ts
14977
15191
  /** How a core's conversations are organized: workspaces and projects. */
14978
15192
  function workspaces(routes) {
@@ -15455,11 +15669,14 @@ var Core = class {
15455
15669
  plugins;
15456
15670
  models;
15457
15671
  usage;
15672
+ commands;
15458
15673
  workspaces;
15459
15674
  projects;
15460
15675
  portForwards;
15461
15676
  routes;
15462
15677
  connection;
15678
+ /** The version the program's plugins are; none for their current one. */
15679
+ pluginVersion;
15463
15680
  stateRead;
15464
15681
  stateListeners = /* @__PURE__ */ new Set();
15465
15682
  notify = null;
@@ -15471,6 +15688,7 @@ var Core = class {
15471
15688
  this.id = opening.id;
15472
15689
  this.dir = opening.dir;
15473
15690
  this.connection = new PageConnection(processConnection(opening.process, `/cores/${segment(opening.id)}/api/connect`));
15691
+ this.pluginVersion = opening.pluginVersion;
15474
15692
  this.connection.start();
15475
15693
  this.routes = new CoreRoutes(opening.process, opening.id, this.connection);
15476
15694
  this.conversations = new Conversations(this.routes, () => this.stateRead);
@@ -15482,6 +15700,7 @@ var Core = class {
15482
15700
  this.plugins = corePlugins(this.routes);
15483
15701
  this.models = models(this.routes);
15484
15702
  this.usage = usage$1(this.routes);
15703
+ this.commands = commands(this.routes);
15485
15704
  this.workspaces = workspaces(this.routes);
15486
15705
  this.projects = projects(this.routes);
15487
15706
  this.portForwards = portForwards(this.routes);
@@ -15643,7 +15862,10 @@ var Core = class {
15643
15862
  }
15644
15863
  openStarter() {
15645
15864
  if (this.closed || this.starter !== null) return;
15646
- const lane = this.connection.openLane({ kind: "starter" }, "starter lane");
15865
+ const lane = this.connection.openLane({
15866
+ kind: "starter",
15867
+ version: this.pluginVersion
15868
+ }, "starter lane");
15647
15869
  this.starter = lane;
15648
15870
  lane.addEventListener("message", (message) => {
15649
15871
  const parsed = starterRequestSchema.safeParse(JSON.parse(message.data));
@@ -15669,7 +15891,8 @@ var Core = class {
15669
15891
  if (this.closed) return;
15670
15892
  const lane = this.connection.openLane({
15671
15893
  kind: "plugin",
15672
- plugin: plugin.manifest.id
15894
+ plugin: plugin.manifest.id,
15895
+ version: this.pluginVersion
15673
15896
  }, `plugin lane of ${plugin.manifest.id}`);
15674
15897
  servePlugin(plugin, lane, (error) => process.emitWarning(error));
15675
15898
  lane.addEventListener("close", () => {
@@ -16327,6 +16550,7 @@ function pathListSeparator() {
16327
16550
  var Jush = class Jush {
16328
16551
  process;
16329
16552
  declared;
16553
+ pluginVersion;
16330
16554
  addresses;
16331
16555
  runner;
16332
16556
  owned;
@@ -16335,9 +16559,10 @@ var Jush = class Jush {
16335
16559
  /** The plugins' sign-ins, as the program's server takes their returns. */
16336
16560
  plugins;
16337
16561
  cores = /* @__PURE__ */ new Map();
16338
- constructor(process, declared, addresses, runner, owned) {
16562
+ constructor(process, declared, pluginVersion, addresses, runner, owned) {
16339
16563
  this.process = process;
16340
16564
  this.declared = declared;
16565
+ this.pluginVersion = pluginVersion;
16341
16566
  this.addresses = addresses;
16342
16567
  this.runner = runner;
16343
16568
  this.owned = owned;
@@ -16351,7 +16576,7 @@ var Jush = class Jush {
16351
16576
  executable: found.core,
16352
16577
  release: found.release
16353
16578
  });
16354
- return Jush.greeted(new Jush(process, options.plugins ?? [], options.addresses, () => found.runner, true));
16579
+ return Jush.greeted(new Jush(process, options.plugins ?? [], options.pluginVersion, options.addresses, () => found.runner, true));
16355
16580
  }
16356
16581
  /**
16357
16582
  * Connects to a process that runs on its own, and declares the program's
@@ -16365,7 +16590,7 @@ var Jush = class Jush {
16365
16590
  url: connection.url,
16366
16591
  token: connection.token
16367
16592
  });
16368
- return Jush.greeted(new Jush(process, connection.plugins ?? [], connection.addresses, () => binaries().runner, false));
16593
+ return Jush.greeted(new Jush(process, connection.plugins ?? [], connection.pluginVersion, connection.addresses, () => binaries().runner, false));
16369
16594
  }
16370
16595
  /**
16371
16596
  * `jush` once it greeted its process; a greeting the process refused,
@@ -16398,6 +16623,7 @@ var Jush = class Jush {
16398
16623
  id,
16399
16624
  dir: path,
16400
16625
  plugins: this.declared,
16626
+ pluginVersion: this.pluginVersion,
16401
16627
  runner: this.runner
16402
16628
  }, async () => {
16403
16629
  this.cores.delete(id);
@@ -16456,7 +16682,8 @@ var Jush = class Jush {
16456
16682
  */
16457
16683
  async greet(fetch) {
16458
16684
  if (this.addresses !== void 0) await (await this.call("PUT", "/addresses", this.addresses, fetch)).body?.cancel();
16459
- for (const plugin of this.declared) await (await this.call("PUT", `/plugins/${segment(plugin.manifest.id)}`, plugin.manifest, fetch)).body?.cancel();
16685
+ const version = this.pluginVersion === void 0 ? "" : `/versions/${segment(this.pluginVersion)}`;
16686
+ for (const plugin of this.declared) await (await this.call("PUT", `/plugins/${segment(plugin.manifest.id)}${version}`, plugin.manifest, fetch)).body?.cancel();
16460
16687
  for (const core of this.cores.values()) await (await this.call("POST", "/cores", { dir: core.dir }, fetch)).body?.cancel();
16461
16688
  }
16462
16689
  async call(method, path, body, fetch = (request) => this.process.fetch(request)) {