omnara 1.0.42 → 1.0.43

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.
Files changed (2) hide show
  1. package/dist/bin.js +1328 -281
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -11,6 +11,45 @@ import { Command } from "commander";
11
11
  // ../sdk/src/agent-event-stream.ts
12
12
  import * as z5 from "zod";
13
13
 
14
+ // ../sdk/src/abort.ts
15
+ function forwardAbort(source, target) {
16
+ let attached = false;
17
+ function dispose() {
18
+ if (!attached) return;
19
+ attached = false;
20
+ source?.removeEventListener("abort", abort);
21
+ }
22
+ function abort() {
23
+ dispose();
24
+ target.abort(source?.reason);
25
+ }
26
+ if (source?.aborted) abort();
27
+ else if (source) {
28
+ attached = true;
29
+ source.addEventListener("abort", abort, { once: true });
30
+ }
31
+ return dispose;
32
+ }
33
+ function untilAborted(request, signal) {
34
+ return new Promise((resolve3, reject) => {
35
+ const abort = () => {
36
+ signal.removeEventListener("abort", abort);
37
+ reject(signal.reason);
38
+ };
39
+ if (signal.aborted) {
40
+ abort();
41
+ return;
42
+ }
43
+ signal.addEventListener("abort", abort, { once: true });
44
+ Promise.resolve().then(() => {
45
+ signal.throwIfAborted();
46
+ return request();
47
+ }).then(resolve3, reject).finally(() => {
48
+ signal.removeEventListener("abort", abort);
49
+ });
50
+ });
51
+ }
52
+
14
53
  // ../sdk/src/errors.ts
15
54
  import * as z4 from "zod";
16
55
 
@@ -211,6 +250,7 @@ var zErrorCode = z.enum([
211
250
  "idempotency_key_conflict",
212
251
  "agent_backlog_full",
213
252
  "state_transition_conflict",
253
+ "tool_call_already_completed",
214
254
  "managed_work_admission_denied",
215
255
  "pending_work",
216
256
  "not_wake_capable",
@@ -391,6 +431,7 @@ var zSkillGrantId = z.string().regex(/^skg_[a-z2-7]{26}$/);
391
431
  var zMemoryStoreId = z.string().regex(/^mst_[a-z2-7]{26}$/);
392
432
  var zSecretId = z.string().regex(/^sec_[a-z2-7]{26}$/);
393
433
  var zUpdateEventWebhookRequest = z.object({
434
+ scope: zEventWebhookScope.optional(),
394
435
  url: z.string().min(1).max(2048).optional(),
395
436
  event_types: z.array(zEventWebhookEventType).min(1).optional(),
396
437
  signing_secret_id: zSecretId.nullish()
@@ -406,6 +447,7 @@ var zEventWebhook = z.object({
406
447
  event_types: z.array(zEventWebhookEventType).min(1),
407
448
  signing_secret_id: zSecretId.optional(),
408
449
  scope: zEventWebhookScope,
450
+ scope_name: zResourceName.optional(),
409
451
  id: zEventWebhookId,
410
452
  org_id: zOrganizationId,
411
453
  project_id: zProjectId,
@@ -413,7 +455,8 @@ var zEventWebhook = z.object({
413
455
  updated_at: z.iso.datetime({ offset: true })
414
456
  });
415
457
  var zListEventWebhooksResponse = z.object({
416
- data: z.array(zEventWebhook)
458
+ data: z.array(zEventWebhook),
459
+ next_cursor: z.string().nullable()
417
460
  });
418
461
  var zCreateModelProviderConfigRequest = z.object({
419
462
  name: zResourceName,
@@ -1076,6 +1119,12 @@ var zCronTriggerLastRun = z.object({
1076
1119
  updated_at: zTimestamp,
1077
1120
  failure_message: z.string().nullable()
1078
1121
  });
1122
+ var zAgentActivityState = z.enum([
1123
+ "running",
1124
+ "idle",
1125
+ "waiting_on_interaction",
1126
+ "archived"
1127
+ ]);
1079
1128
  var zAgentOpenInteractions = z.object({
1080
1129
  question_count: z.int().gte(0),
1081
1130
  permission_request_count: z.int().gte(0)
@@ -1089,12 +1138,7 @@ var zAgentWorkingSubagents = z.object({
1089
1138
  agent_ids: z.array(zAgentId).max(20)
1090
1139
  });
1091
1140
  var zAgentActivity = z.object({
1092
- state: z.enum([
1093
- "running",
1094
- "idle",
1095
- "waiting_on_interaction",
1096
- "archived"
1097
- ]),
1141
+ state: zAgentActivityState,
1098
1142
  last_activity_at: zTimestamp,
1099
1143
  open_interactions: zAgentOpenInteractions,
1100
1144
  running_processes: zAgentRunningProcesses,
@@ -1348,6 +1392,9 @@ var zAgentInputEvent = z.object({
1348
1392
  org_id: zOrganizationId,
1349
1393
  project_id: zProjectId,
1350
1394
  agent_id: zAgentId,
1395
+ agent_profile_id: zAgentProfileId.nullable(),
1396
+ parent_agent_id: zAgentId.nullable(),
1397
+ root_agent_id: zAgentId,
1351
1398
  turn_id: zAgentTurnId,
1352
1399
  turn_sequence: zAgentSequence,
1353
1400
  is_opening_event: z.boolean(),
@@ -1368,6 +1415,9 @@ var zToolResultEvent = z.object({
1368
1415
  org_id: zOrganizationId,
1369
1416
  project_id: zProjectId,
1370
1417
  agent_id: zAgentId,
1418
+ agent_profile_id: zAgentProfileId.nullable(),
1419
+ parent_agent_id: zAgentId.nullable(),
1420
+ root_agent_id: zAgentId,
1371
1421
  turn_id: zAgentTurnId,
1372
1422
  turn_sequence: zAgentSequence,
1373
1423
  is_opening_event: z.literal(false),
@@ -1383,6 +1433,9 @@ var zContextCheckpointEvent = z.object({
1383
1433
  org_id: zOrganizationId,
1384
1434
  project_id: zProjectId,
1385
1435
  agent_id: zAgentId,
1436
+ agent_profile_id: zAgentProfileId.nullable(),
1437
+ parent_agent_id: zAgentId.nullable(),
1438
+ root_agent_id: zAgentId,
1386
1439
  turn_id: zAgentTurnId,
1387
1440
  turn_sequence: zAgentSequence,
1388
1441
  is_opening_event: z.literal(false),
@@ -1458,6 +1511,9 @@ var zModelOutputEvent = z.object({
1458
1511
  org_id: zOrganizationId,
1459
1512
  project_id: zProjectId,
1460
1513
  agent_id: zAgentId,
1514
+ agent_profile_id: zAgentProfileId.nullable(),
1515
+ parent_agent_id: zAgentId.nullable(),
1516
+ root_agent_id: zAgentId,
1461
1517
  turn_id: zAgentTurnId,
1462
1518
  turn_sequence: zAgentSequence,
1463
1519
  is_opening_event: z.literal(false),
@@ -1598,9 +1654,16 @@ var zAgentInteractionUpdate = z.object({
1598
1654
  state: zAgentInteractionState
1599
1655
  });
1600
1656
  var zToolCallUpdate = z.object({
1657
+ org_id: zOrganizationId,
1658
+ project_id: zProjectId,
1601
1659
  tool_call_id: zToolCallId,
1602
- agent_id: zAgentId.optional(),
1660
+ agent_id: zAgentId,
1661
+ agent_profile_id: zAgentProfileId.nullable(),
1662
+ parent_agent_id: zAgentId.nullable(),
1663
+ root_agent_id: zAgentId,
1603
1664
  state: zToolCallState,
1665
+ name: z.string().optional(),
1666
+ input: zToolInput.optional(),
1604
1667
  interaction_update: zAgentInteractionUpdate.optional()
1605
1668
  });
1606
1669
  var zEventWebhookToolCallUpdate = z.object({
@@ -2369,6 +2432,9 @@ var zBootstrapDaemonResponse = z.object({
2369
2432
  var zCreateProjectRequest = z.object({
2370
2433
  name: zResourceName
2371
2434
  });
2435
+ var zUpdateProjectRequest = z.object({
2436
+ name: zResourceName
2437
+ });
2372
2438
  var zProjectFields = z.object({
2373
2439
  id: zProjectId,
2374
2440
  org_id: zOrganizationId,
@@ -2941,9 +3007,11 @@ var zListEventWebhooksPath = z.object({
2941
3007
  projectID: zProjectId
2942
3008
  });
2943
3009
  var zListEventWebhooksQuery = z.object({
2944
- scope_type: zEventWebhookScopeType,
3010
+ scope_type: zEventWebhookScopeType.optional(),
2945
3011
  agent_profile_id: zAgentProfileId.optional(),
2946
- agent_id: zAgentId.optional()
3012
+ agent_id: zAgentId.optional(),
3013
+ limit: z.int().gte(1).lte(100).optional().default(50),
3014
+ cursor: z.string().max(1024).optional()
2947
3015
  });
2948
3016
  var zListEventWebhooksResponse2 = zListEventWebhooksResponse;
2949
3017
  var zCreateEventWebhookPath = z.object({
@@ -2957,6 +3025,12 @@ var zDeleteEventWebhookPath = z.object({
2957
3025
  webhookID: zEventWebhookId
2958
3026
  });
2959
3027
  var zDeleteEventWebhookResponse = z.void();
3028
+ var zGetEventWebhookPath = z.object({
3029
+ orgID: zOrganizationId,
3030
+ projectID: zProjectId,
3031
+ webhookID: zEventWebhookId
3032
+ });
3033
+ var zGetEventWebhookResponse = zEventWebhook;
2960
3034
  var zUpdateEventWebhookPath = z.object({
2961
3035
  orgID: zOrganizationId,
2962
3036
  projectID: zProjectId,
@@ -3055,6 +3129,7 @@ var zListOrgAgentsQuery = z.object({
3055
3129
  parent_agent_id: zAgentId.optional(),
3056
3130
  include_subagents: z.boolean().optional(),
3057
3131
  include_archived: z.boolean().optional(),
3132
+ activity_state: zAgentActivityState.optional(),
3058
3133
  include_usage: z.boolean().optional(),
3059
3134
  sort: zResourceListSort.optional(),
3060
3135
  limit: z.int().gte(1).lte(100).optional().default(50),
@@ -3094,6 +3169,17 @@ var zDeleteProjectPath = z.object({
3094
3169
  projectID: z.string().regex(/^proj_[a-z2-7]{26}$/)
3095
3170
  });
3096
3171
  var zDeleteProjectResponse = z.void();
3172
+ var zGetProjectPath = z.object({
3173
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3174
+ projectID: z.string().regex(/^proj_[a-z2-7]{26}$/)
3175
+ });
3176
+ var zGetProjectResponse = zProject;
3177
+ var zUpdateProjectBody = zUpdateProjectRequest;
3178
+ var zUpdateProjectPath = z.object({
3179
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3180
+ projectID: z.string().regex(/^proj_[a-z2-7]{26}$/)
3181
+ });
3182
+ var zUpdateProjectResponse = zProject;
3097
3183
  var zGetProjectUsagePath = z.object({
3098
3184
  orgID: zOrganizationId,
3099
3185
  projectID: zProjectId
@@ -3261,6 +3347,12 @@ var zDeleteSkillGrantPath = z.object({
3261
3347
  grantID: zSkillGrantId
3262
3348
  });
3263
3349
  var zDeleteSkillGrantResponse = z.void();
3350
+ var zGetSkillGrantPath = z.object({
3351
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3352
+ skillID: zSkillId,
3353
+ grantID: zSkillGrantId
3354
+ });
3355
+ var zGetSkillGrantResponse = zSkillGrant;
3264
3356
  var zListProjectAvailableSkillsPath = z.object({
3265
3357
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3266
3358
  projectID: zProjectId
@@ -3435,6 +3527,12 @@ var zDeleteSecretGrantPath = z.object({
3435
3527
  grantID: z.string().regex(/^sgr_[a-z2-7]{26}$/)
3436
3528
  });
3437
3529
  var zDeleteSecretGrantResponse = z.void();
3530
+ var zGetSecretGrantPath = z.object({
3531
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3532
+ secretID: z.string().regex(/^sec_[a-z2-7]{26}$/),
3533
+ grantID: z.string().regex(/^sgr_[a-z2-7]{26}$/)
3534
+ });
3535
+ var zGetSecretGrantResponse = zSecretGrant;
3438
3536
  var zResolveAgentConfigToolsPath = z.object({
3439
3537
  orgID: zOrganizationId,
3440
3538
  projectID: zProjectId
@@ -3609,6 +3707,7 @@ var zListAgentsQuery = z.object({
3609
3707
  parent_agent_id: zAgentId.optional(),
3610
3708
  include_subagents: z.boolean().optional(),
3611
3709
  include_archived: z.boolean().optional(),
3710
+ activity_state: zAgentActivityState.optional(),
3612
3711
  include_usage: z.boolean().optional(),
3613
3712
  sort: zResourceListSort.optional(),
3614
3713
  limit: z.int().gte(1).lte(100).optional().default(50),
@@ -3668,6 +3767,25 @@ var zCreateAgentInputPath = z.object({
3668
3767
  agentID: z.string().regex(/^agt_[a-z2-7]{26}$/)
3669
3768
  });
3670
3769
  var zCreateAgentInputResponse = zAgentInputEnvelope;
3770
+ var zListProjectToolCallsPath = z.object({
3771
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3772
+ projectID: z.string().regex(/^proj_[a-z2-7]{26}$/)
3773
+ });
3774
+ var zListProjectToolCallsQuery = z.object({
3775
+ state: z.enum([
3776
+ "awaiting_authorization",
3777
+ "awaiting_permission",
3778
+ "ready",
3779
+ "running",
3780
+ "waiting"
3781
+ ]).optional(),
3782
+ type: zToolCallType.optional(),
3783
+ names: z.array(z.string().min(1).max(64)).min(1).max(100).optional(),
3784
+ agent_profile_id: zAgentProfileId.optional(),
3785
+ limit: z.int().gte(1).lte(100).optional().default(50),
3786
+ cursor: z.string().max(1024).optional()
3787
+ });
3788
+ var zListProjectToolCallsResponse = zListToolCallsResponse;
3671
3789
  var zListToolCallsPath = z.object({
3672
3790
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3673
3791
  projectID: z.string().regex(/^proj_[a-z2-7]{26}$/),
@@ -3681,6 +3799,13 @@ var zListToolCallsQuery = z.object({
3681
3799
  cursor: z.string().max(1024).optional()
3682
3800
  });
3683
3801
  var zListToolCallsResponse2 = zListToolCallsResponse;
3802
+ var zGetToolCallPath = z.object({
3803
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3804
+ projectID: z.string().regex(/^proj_[a-z2-7]{26}$/),
3805
+ agentID: z.string().regex(/^agt_[a-z2-7]{26}$/),
3806
+ toolCallID: zToolCallId
3807
+ });
3808
+ var zGetToolCallResponse = zToolCall;
3684
3809
  var zSubmitToolCallResultPath = z.object({
3685
3810
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3686
3811
  projectID: z.string().regex(/^proj_[a-z2-7]{26}$/),
@@ -3740,6 +3865,17 @@ var zCancelAgentPath = z.object({
3740
3865
  agentID: z.string().regex(/^agt_[a-z2-7]{26}$/)
3741
3866
  });
3742
3867
  var zCancelAgentResponse2 = zCancelAgentResponse;
3868
+ var zListProjectInteractionsPath = z.object({
3869
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3870
+ projectID: z.string().regex(/^proj_[a-z2-7]{26}$/)
3871
+ });
3872
+ var zListProjectInteractionsQuery = z.object({
3873
+ interaction_kind: zAgentInteractionKind.optional(),
3874
+ agent_profile_id: zAgentProfileId.optional(),
3875
+ limit: z.int().gte(1).lte(100).optional().default(50),
3876
+ cursor: z.string().max(1024).optional()
3877
+ });
3878
+ var zListProjectInteractionsResponse = zListAgentInteractionsResponse;
3743
3879
  var zListAgentInteractionsPath = z.object({
3744
3880
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3745
3881
  projectID: z.string().regex(/^proj_[a-z2-7]{26}$/),
@@ -3851,6 +3987,12 @@ var zDeleteProjectMachineGrantPath = z.object({
3851
3987
  grantID: z.string().regex(/^pmg_[a-z2-7]{26}$/)
3852
3988
  });
3853
3989
  var zDeleteProjectMachineGrantResponse = z.void();
3990
+ var zGetProjectMachineGrantPath = z.object({
3991
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3992
+ projectID: z.string().regex(/^proj_[a-z2-7]{26}$/),
3993
+ grantID: z.string().regex(/^pmg_[a-z2-7]{26}$/)
3994
+ });
3995
+ var zGetProjectMachineGrantResponse = zCreateProjectMachineGrantResponse;
3854
3996
  var zListProjectAvailableSecretsPath = z.object({
3855
3997
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
3856
3998
  projectID: z.string().regex(/^proj_[a-z2-7]{26}$/)
@@ -3995,6 +4137,12 @@ var zDeleteConfiguredModelPath = z.object({
3995
4137
  configuredModelID: z.string().regex(/^mdl_[a-z2-7]{26}$/)
3996
4138
  });
3997
4139
  var zDeleteConfiguredModelResponse = z.void();
4140
+ var zGetConfiguredModelPath = z.object({
4141
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
4142
+ modelProviderConfigID: z.string().regex(/^mpc_[a-z2-7]{26}$/),
4143
+ configuredModelID: z.string().regex(/^mdl_[a-z2-7]{26}$/)
4144
+ });
4145
+ var zGetConfiguredModelResponse = zConfiguredModel;
3998
4146
  var zUpdateConfiguredModelBody = zUpdateConfiguredModelRequest;
3999
4147
  var zUpdateConfiguredModelPath = z.object({
4000
4148
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
@@ -4025,6 +4173,12 @@ var zDeleteProjectModelGrantPath = z.object({
4025
4173
  modelGrantID: z.string().regex(/^pmog_[a-z2-7]{26}$/)
4026
4174
  });
4027
4175
  var zDeleteProjectModelGrantResponse = z.void();
4176
+ var zGetProjectModelGrantPath = z.object({
4177
+ orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
4178
+ projectID: z.string().regex(/^proj_[a-z2-7]{26}$/),
4179
+ modelGrantID: z.string().regex(/^pmog_[a-z2-7]{26}$/)
4180
+ });
4181
+ var zGetProjectModelGrantResponse = zProjectModelGrantEnvelope;
4028
4182
  var zUpdateProjectModelGrantBody = zUpdateProjectModelGrantRequest;
4029
4183
  var zUpdateProjectModelGrantPath = z.object({
4030
4184
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
@@ -4234,6 +4388,13 @@ var zDeleteIntegrationSubscriptionPath = z.object({
4234
4388
  subscriptionID: zIntegrationSubscriptionId
4235
4389
  });
4236
4390
  var zDeleteIntegrationSubscriptionResponse = z.void();
4391
+ var zGetIntegrationSubscriptionPath = z.object({
4392
+ orgID: zOrganizationId,
4393
+ projectID: zProjectId,
4394
+ integrationID: zIntegrationId,
4395
+ subscriptionID: zIntegrationSubscriptionId
4396
+ });
4397
+ var zGetIntegrationSubscriptionResponse = zIntegrationSubscription;
4237
4398
  var zConfigureIntegrationBody = zConfigureIntegrationRequest;
4238
4399
  var zConfigureIntegrationPath = z.object({
4239
4400
  orgID: zOrganizationId,
@@ -4366,6 +4527,32 @@ function parseRetryAfter(value) {
4366
4527
  return Math.max(at - Date.now(), 0);
4367
4528
  }
4368
4529
 
4530
+ // ../sdk/src/retry.ts
4531
+ var retryBaseDelayMs = 1e3;
4532
+ var retryMaximumDelayMs = 3e4;
4533
+ var retryAfterMaximumDelayMs = 6e4;
4534
+ function retryDelay(attempt) {
4535
+ const maximum = Math.min(retryBaseDelayMs * 2 ** Math.max(attempt - 1, 0), retryMaximumDelayMs);
4536
+ return Math.floor(Math.random() * maximum);
4537
+ }
4538
+ function abortableDelay(ms, signal) {
4539
+ if (signal?.aborted === true) return Promise.resolve(false);
4540
+ return new Promise((resolve3) => {
4541
+ const onAbort = () => {
4542
+ finish(false);
4543
+ };
4544
+ const timeout = globalThis.setTimeout(() => {
4545
+ finish(true);
4546
+ }, ms);
4547
+ function finish(completed) {
4548
+ globalThis.clearTimeout(timeout);
4549
+ signal?.removeEventListener("abort", onAbort);
4550
+ resolve3(completed);
4551
+ }
4552
+ signal?.addEventListener("abort", onAbort, { once: true });
4553
+ });
4554
+ }
4555
+
4369
4556
  // ../sdk/src/server-sent-events.ts
4370
4557
  function createServerSentEventParser() {
4371
4558
  let parts = [];
@@ -4428,9 +4615,6 @@ var AgentEventStreamError = class extends Error {
4428
4615
  }
4429
4616
  };
4430
4617
  var streamUrl = "/orgs/{orgID}/projects/{projectID}/agents/{agentID}/events/stream";
4431
- var retryBaseDelayMs = 1e3;
4432
- var retryMaximumDelayMs = 3e4;
4433
- var retryAfterMaximumDelayMs = 6e4;
4434
4618
  var stableConnectionResetMs = 1e4;
4435
4619
  var stallTimeoutMs = 35e3;
4436
4620
  var zDurableCursor = z5.object({
@@ -4447,27 +4631,6 @@ function retryable(error) {
4447
4631
  if (error.kind === "api") return error.code === "service_unavailable";
4448
4632
  return error.kind === "http" && (error.status === 408 || error.status === 429 || error.status != null && error.status >= 500);
4449
4633
  }
4450
- function reconnectDelay(attempt) {
4451
- const maximum = Math.min(retryBaseDelayMs * 2 ** Math.max(attempt - 1, 0), retryMaximumDelayMs);
4452
- return Math.floor(Math.random() * maximum);
4453
- }
4454
- function abortableDelay(ms, signal) {
4455
- if (signal?.aborted === true) return Promise.resolve(false);
4456
- return new Promise((resolve3) => {
4457
- const timeout = globalThis.setTimeout(() => {
4458
- finish(true);
4459
- }, ms);
4460
- const onAbort = () => {
4461
- finish(false);
4462
- };
4463
- function finish(completed) {
4464
- globalThis.clearTimeout(timeout);
4465
- signal?.removeEventListener("abort", onAbort);
4466
- resolve3(completed);
4467
- }
4468
- signal?.addEventListener("abort", onAbort, { once: true });
4469
- });
4470
- }
4471
4634
  async function settleWithin(pending, ms, attempt) {
4472
4635
  let timer;
4473
4636
  const deadline = new Promise((_, reject) => {
@@ -4485,7 +4648,8 @@ async function settleWithin(pending, ms, attempt) {
4485
4648
  }
4486
4649
  async function* openConnection(client2, { path, query, headers }, callerSignal) {
4487
4650
  const attempt = new AbortController();
4488
- const signal = callerSignal == null ? attempt.signal : AbortSignal.any([callerSignal, attempt.signal]);
4651
+ const disposeCaller = forwardAbort(callerSignal, attempt);
4652
+ const { signal } = attempt;
4489
4653
  let reader;
4490
4654
  try {
4491
4655
  const dispatch = { started: false };
@@ -4549,7 +4713,9 @@ async function* openConnection(client2, { path, query, headers }, callerSignal)
4549
4713
  } catch (error) {
4550
4714
  throw error instanceof AgentEventStreamError ? error : streamError("transport", "Agent event stream disconnected", { cause: error });
4551
4715
  } finally {
4716
+ disposeCaller();
4552
4717
  await reader?.cancel().catch(() => void 0);
4718
+ reader?.releaseLock();
4553
4719
  }
4554
4720
  }
4555
4721
  function decodeFrame(text) {
@@ -4613,7 +4779,7 @@ async function* openAgentEventStream({
4613
4779
  consecutiveFailures = 0;
4614
4780
  }
4615
4781
  consecutiveFailures += 1;
4616
- const delayMs = Math.max(reconnectDelay(consecutiveFailures), error.retryAfterMs ?? 0);
4782
+ const delayMs = Math.max(retryDelay(consecutiveFailures), error.retryAfterMs ?? 0);
4617
4783
  onConnectionStateChange?.({
4618
4784
  state: "reconnecting",
4619
4785
  attempt: consecutiveFailures,
@@ -4707,7 +4873,7 @@ function createSseClient({
4707
4873
  let lastEventId;
4708
4874
  const sleep = sseSleepFn ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
4709
4875
  const createStream = async function* () {
4710
- let retryDelay = sseDefaultRetryDelay ?? 3e3;
4876
+ let retryDelay2 = sseDefaultRetryDelay ?? 3e3;
4711
4877
  let attempt = 0;
4712
4878
  const signal = options.signal ?? new AbortController().signal;
4713
4879
  while (true) {
@@ -4764,7 +4930,7 @@ function createSseClient({
4764
4930
  } else if (line.startsWith("retry:")) {
4765
4931
  const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
4766
4932
  if (!Number.isNaN(parsed)) {
4767
- retryDelay = parsed;
4933
+ retryDelay2 = parsed;
4768
4934
  }
4769
4935
  }
4770
4936
  }
@@ -4791,7 +4957,7 @@ function createSseClient({
4791
4957
  data,
4792
4958
  event: eventName,
4793
4959
  id: lastEventId,
4794
- retry: retryDelay
4960
+ retry: retryDelay2
4795
4961
  });
4796
4962
  if (dataLines.length) {
4797
4963
  yield data;
@@ -4808,7 +4974,7 @@ function createSseClient({
4808
4974
  if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
4809
4975
  break;
4810
4976
  }
4811
- const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
4977
+ const backoff = Math.min(retryDelay2 * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
4812
4978
  await sleep(backoff);
4813
4979
  }
4814
4980
  }
@@ -5464,6 +5630,508 @@ var createClient = (config2 = {}) => {
5464
5630
  // ../sdk/src/generated/client.gen.ts
5465
5631
  var client = createClient(createConfig({ baseUrl: "https://api.omnara.com/v1", throwOnError: true }));
5466
5632
 
5633
+ // ../sdk/src/generated/replay-contracts.gen.ts
5634
+ var knownOperations = /* @__PURE__ */ new Set([
5635
+ "DELETE /me",
5636
+ "DELETE /orgs/{orgID}",
5637
+ "DELETE /orgs/{orgID}/api-keys/{keyID}/projects/{projectID}",
5638
+ "DELETE /orgs/{orgID}/invitations/{invitationID}",
5639
+ "DELETE /orgs/{orgID}/machine-pools/{poolID}",
5640
+ "DELETE /orgs/{orgID}/machines/{machineID}",
5641
+ "DELETE /orgs/{orgID}/members/{userID}",
5642
+ "DELETE /orgs/{orgID}/members/{userID}/projects/{projectID}",
5643
+ "DELETE /orgs/{orgID}/model-provider-configs/{modelProviderConfigID}",
5644
+ "DELETE /orgs/{orgID}/model-provider-configs/{modelProviderConfigID}/models/{configuredModelID}",
5645
+ "DELETE /orgs/{orgID}/projects/{projectID}",
5646
+ "DELETE /orgs/{orgID}/projects/{projectID}/agent-profiles/{agentProfileID}",
5647
+ "DELETE /orgs/{orgID}/projects/{projectID}/cron-triggers/{cronTriggerID}",
5648
+ "DELETE /orgs/{orgID}/projects/{projectID}/event-webhooks/{webhookID}",
5649
+ "DELETE /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}",
5650
+ "DELETE /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/subscriptions/{subscriptionID}",
5651
+ "DELETE /orgs/{orgID}/projects/{projectID}/machine-grants/{grantID}",
5652
+ "DELETE /orgs/{orgID}/projects/{projectID}/machine-pool-grants/{poolGrantID}",
5653
+ "DELETE /orgs/{orgID}/projects/{projectID}/memory-stores/{memoryStoreID}",
5654
+ "DELETE /orgs/{orgID}/projects/{projectID}/memory-stores/{memoryStoreID}/file",
5655
+ "DELETE /orgs/{orgID}/projects/{projectID}/model-grants/{modelGrantID}",
5656
+ "DELETE /orgs/{orgID}/secrets/{secretID}",
5657
+ "DELETE /orgs/{orgID}/secrets/{secretID}/grants/{grantID}",
5658
+ "DELETE /orgs/{orgID}/skills/{skillID}",
5659
+ "DELETE /orgs/{orgID}/skills/{skillID}/grants/{grantID}",
5660
+ "GET /daemon/processes/{processID}/file",
5661
+ "GET /daemon/runtimes/{runtimeID}/socket",
5662
+ "GET /daemon/skills/{skillID}/archive",
5663
+ "GET /invitations",
5664
+ "GET /mcp-servers",
5665
+ "GET /me",
5666
+ "GET /orgs",
5667
+ "GET /orgs/{orgID}/agent-profiles",
5668
+ "GET /orgs/{orgID}/agents",
5669
+ "GET /orgs/{orgID}/api-keys",
5670
+ "GET /orgs/{orgID}/api-keys/{keyID}",
5671
+ "GET /orgs/{orgID}/api-keys/{keyID}/projects",
5672
+ "GET /orgs/{orgID}/integrations",
5673
+ "GET /orgs/{orgID}/invitations",
5674
+ "GET /orgs/{orgID}/machine-pools",
5675
+ "GET /orgs/{orgID}/machine-pools/{poolID}",
5676
+ "GET /orgs/{orgID}/machines",
5677
+ "GET /orgs/{orgID}/machines/{machineID}",
5678
+ "GET /orgs/{orgID}/machines/{machineID}/daemon-tokens",
5679
+ "GET /orgs/{orgID}/members",
5680
+ "GET /orgs/{orgID}/members/{userID}/projects",
5681
+ "GET /orgs/{orgID}/memory-stores",
5682
+ "GET /orgs/{orgID}/model-provider-configs",
5683
+ "GET /orgs/{orgID}/model-provider-configs/{modelProviderConfigID}",
5684
+ "GET /orgs/{orgID}/model-provider-configs/{modelProviderConfigID}/model-catalog",
5685
+ "GET /orgs/{orgID}/model-provider-configs/{modelProviderConfigID}/models",
5686
+ "GET /orgs/{orgID}/model-provider-configs/{modelProviderConfigID}/models/{configuredModelID}",
5687
+ "GET /orgs/{orgID}/overview",
5688
+ "GET /orgs/{orgID}/projects",
5689
+ "GET /orgs/{orgID}/projects/{projectID}",
5690
+ "GET /orgs/{orgID}/projects/{projectID}/actors",
5691
+ "GET /orgs/{orgID}/projects/{projectID}/actors/{actorID}",
5692
+ "GET /orgs/{orgID}/projects/{projectID}/agent-configs/{agentConfigID}",
5693
+ "GET /orgs/{orgID}/projects/{projectID}/agent-configs/{agentConfigID}/generated-source",
5694
+ "GET /orgs/{orgID}/projects/{projectID}/agent-profiles",
5695
+ "GET /orgs/{orgID}/projects/{projectID}/agent-profiles/{agentProfileID}",
5696
+ "GET /orgs/{orgID}/projects/{projectID}/agent-profiles/{agentProfileID}/usage",
5697
+ "GET /orgs/{orgID}/projects/{projectID}/agents",
5698
+ "GET /orgs/{orgID}/projects/{projectID}/agents/{agentID}",
5699
+ "GET /orgs/{orgID}/projects/{projectID}/agents/{agentID}/artifacts/{artifactID}",
5700
+ "GET /orgs/{orgID}/projects/{projectID}/agents/{agentID}/artifacts/{artifactID}/content",
5701
+ "GET /orgs/{orgID}/projects/{projectID}/agents/{agentID}/events",
5702
+ "GET /orgs/{orgID}/projects/{projectID}/agents/{agentID}/events/stream",
5703
+ "GET /orgs/{orgID}/projects/{projectID}/agents/{agentID}/inputs/backlog",
5704
+ "GET /orgs/{orgID}/projects/{projectID}/agents/{agentID}/interactions",
5705
+ "GET /orgs/{orgID}/projects/{projectID}/agents/{agentID}/tool-calls",
5706
+ "GET /orgs/{orgID}/projects/{projectID}/agents/{agentID}/tool-calls/{toolCallID}",
5707
+ "GET /orgs/{orgID}/projects/{projectID}/agents/{agentID}/turns",
5708
+ "GET /orgs/{orgID}/projects/{projectID}/agents/{agentID}/turns/{turnID}/events",
5709
+ "GET /orgs/{orgID}/projects/{projectID}/agents/{agentID}/usage",
5710
+ "GET /orgs/{orgID}/projects/{projectID}/cron-triggers",
5711
+ "GET /orgs/{orgID}/projects/{projectID}/cron-triggers/{cronTriggerID}",
5712
+ "GET /orgs/{orgID}/projects/{projectID}/event-webhooks",
5713
+ "GET /orgs/{orgID}/projects/{projectID}/event-webhooks/{webhookID}",
5714
+ "GET /orgs/{orgID}/projects/{projectID}/integration-definitions",
5715
+ "GET /orgs/{orgID}/projects/{projectID}/integrations",
5716
+ "GET /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}",
5717
+ "GET /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/github-repositories",
5718
+ "GET /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/subscriptions",
5719
+ "GET /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/subscriptions/{subscriptionID}",
5720
+ "GET /orgs/{orgID}/projects/{projectID}/interactions",
5721
+ "GET /orgs/{orgID}/projects/{projectID}/machine-grants",
5722
+ "GET /orgs/{orgID}/projects/{projectID}/machine-grants/{grantID}",
5723
+ "GET /orgs/{orgID}/projects/{projectID}/machine-pool-grants",
5724
+ "GET /orgs/{orgID}/projects/{projectID}/machine-pool-grants/{poolGrantID}",
5725
+ "GET /orgs/{orgID}/projects/{projectID}/machines",
5726
+ "GET /orgs/{orgID}/projects/{projectID}/memory-stores",
5727
+ "GET /orgs/{orgID}/projects/{projectID}/memory-stores/{memoryStoreID}",
5728
+ "GET /orgs/{orgID}/projects/{projectID}/memory-stores/{memoryStoreID}/file",
5729
+ "GET /orgs/{orgID}/projects/{projectID}/memory-stores/{memoryStoreID}/files",
5730
+ "GET /orgs/{orgID}/projects/{projectID}/model-grants",
5731
+ "GET /orgs/{orgID}/projects/{projectID}/model-grants/{modelGrantID}",
5732
+ "GET /orgs/{orgID}/projects/{projectID}/secrets",
5733
+ "GET /orgs/{orgID}/projects/{projectID}/secrets/{secretID}",
5734
+ "GET /orgs/{orgID}/projects/{projectID}/skills",
5735
+ "GET /orgs/{orgID}/projects/{projectID}/tool-calls",
5736
+ "GET /orgs/{orgID}/projects/{projectID}/usage",
5737
+ "GET /orgs/{orgID}/secrets",
5738
+ "GET /orgs/{orgID}/secrets/{secretID}",
5739
+ "GET /orgs/{orgID}/secrets/{secretID}/grants",
5740
+ "GET /orgs/{orgID}/secrets/{secretID}/grants/{grantID}",
5741
+ "GET /orgs/{orgID}/skills",
5742
+ "GET /orgs/{orgID}/skills/{skillID}",
5743
+ "GET /orgs/{orgID}/skills/{skillID}/grants",
5744
+ "GET /orgs/{orgID}/skills/{skillID}/grants/{grantID}",
5745
+ "GET /orgs/{orgID}/usage",
5746
+ "GET /orgs/{orgID}/usage/timeseries",
5747
+ "GET /personal-access-tokens",
5748
+ "GET /tool-catalog",
5749
+ "PATCH /orgs/{orgID}/api-keys/{keyID}",
5750
+ "PATCH /orgs/{orgID}/machines/{machineID}",
5751
+ "PATCH /orgs/{orgID}/members/{userID}",
5752
+ "PATCH /orgs/{orgID}/projects/{projectID}",
5753
+ "PATCH /orgs/{orgID}/projects/{projectID}/agent-profiles/{agentProfileID}",
5754
+ "PATCH /orgs/{orgID}/projects/{projectID}/cron-triggers/{cronTriggerID}",
5755
+ "PATCH /orgs/{orgID}/projects/{projectID}/event-webhooks/{webhookID}",
5756
+ "PATCH /orgs/{orgID}/projects/{projectID}/machine-pool-grants/{poolGrantID}",
5757
+ "PATCH /orgs/{orgID}/projects/{projectID}/memory-stores/{memoryStoreID}",
5758
+ "PATCH /orgs/{orgID}/projects/{projectID}/model-grants/{modelGrantID}",
5759
+ "PATCH /orgs/{orgID}/secrets/{secretID}",
5760
+ "POST /daemon/bootstrap",
5761
+ "POST /daemon/failures",
5762
+ "POST /daemon/processes/{processID}/file",
5763
+ "POST /daemon/processes/{processID}/git-credentials",
5764
+ "POST /daemon/runtimes",
5765
+ "POST /daemon/runtimes/{runtimeID}/end",
5766
+ "POST /daemon/runtimes/{runtimeID}/sleep",
5767
+ "POST /invitations/{invitationID}/accept",
5768
+ "POST /invitations/{invitationID}/decline",
5769
+ "POST /orgs",
5770
+ "POST /orgs/{orgID}/api-keys",
5771
+ "POST /orgs/{orgID}/api-keys/{keyID}/revoke",
5772
+ "POST /orgs/{orgID}/invitations",
5773
+ "POST /orgs/{orgID}/machine-pools",
5774
+ "POST /orgs/{orgID}/machine-pools/check-connection",
5775
+ "POST /orgs/{orgID}/machines",
5776
+ "POST /orgs/{orgID}/machines/connect",
5777
+ "POST /orgs/{orgID}/machines/{machineID}/daemon-tokens",
5778
+ "POST /orgs/{orgID}/machines/{machineID}/daemon-tokens/{tokenID}/revoke",
5779
+ "POST /orgs/{orgID}/model-provider-configs",
5780
+ "POST /orgs/{orgID}/model-provider-configs/{modelProviderConfigID}/models",
5781
+ "POST /orgs/{orgID}/projects",
5782
+ "POST /orgs/{orgID}/projects/{projectID}/agent-configs",
5783
+ "POST /orgs/{orgID}/projects/{projectID}/agent-configs/tools",
5784
+ "POST /orgs/{orgID}/projects/{projectID}/agent-profiles",
5785
+ "POST /orgs/{orgID}/projects/{projectID}/agent-profiles/{agentProfileID}/config",
5786
+ "POST /orgs/{orgID}/projects/{projectID}/agents",
5787
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/archive",
5788
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/cancel",
5789
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/config",
5790
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/inputs",
5791
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/inputs/{inputID}/cancel",
5792
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/inputs/{inputID}/demote_to_queued",
5793
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/inputs/{inputID}/move",
5794
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/inputs/{inputID}/promote_to_steering",
5795
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/interactions/{interactionID}/resolve",
5796
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/tool-calls/{toolCallID}/result",
5797
+ "POST /orgs/{orgID}/projects/{projectID}/cron-triggers",
5798
+ "POST /orgs/{orgID}/projects/{projectID}/event-webhooks",
5799
+ "POST /orgs/{orgID}/projects/{projectID}/integrations",
5800
+ "POST /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/disconnect",
5801
+ "POST /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/github-setup",
5802
+ "POST /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/github-setup/installations",
5803
+ "POST /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/oauth/setup",
5804
+ "POST /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/setup",
5805
+ "POST /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/slack-setup",
5806
+ "POST /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/subscriptions",
5807
+ "POST /orgs/{orgID}/projects/{projectID}/machine-grants",
5808
+ "POST /orgs/{orgID}/projects/{projectID}/machine-pool-grants",
5809
+ "POST /orgs/{orgID}/projects/{projectID}/mcp-servers/tools",
5810
+ "POST /orgs/{orgID}/projects/{projectID}/memory-stores",
5811
+ "POST /orgs/{orgID}/projects/{projectID}/model-grants",
5812
+ "POST /orgs/{orgID}/secrets",
5813
+ "POST /orgs/{orgID}/secrets/mcp-oauth",
5814
+ "POST /orgs/{orgID}/secrets/{secretID}/grants",
5815
+ "POST /orgs/{orgID}/secrets/{secretID}/versions",
5816
+ "POST /orgs/{orgID}/skills",
5817
+ "POST /orgs/{orgID}/skills/{skillID}",
5818
+ "POST /orgs/{orgID}/skills/{skillID}/grants",
5819
+ "POST /personal-access-tokens",
5820
+ "POST /personal-access-tokens/{tokenID}/revoke",
5821
+ "PUT /orgs/{orgID}/api-keys/{keyID}/projects/{projectID}",
5822
+ "PUT /orgs/{orgID}/machine-pools/{poolID}",
5823
+ "PUT /orgs/{orgID}/members/{userID}/projects/{projectID}",
5824
+ "PUT /orgs/{orgID}/model-provider-configs/{modelProviderConfigID}",
5825
+ "PUT /orgs/{orgID}/model-provider-configs/{modelProviderConfigID}/models/{configuredModelID}",
5826
+ "PUT /orgs/{orgID}/projects/{projectID}/actors",
5827
+ "PUT /orgs/{orgID}/projects/{projectID}/integrations/{integrationID}",
5828
+ "PUT /orgs/{orgID}/projects/{projectID}/memory-stores/{memoryStoreID}/file"
5829
+ ]);
5830
+ var keyedOperations = /* @__PURE__ */ new Set([
5831
+ "POST /orgs",
5832
+ "POST /orgs/{orgID}/machines",
5833
+ "POST /orgs/{orgID}/projects",
5834
+ "POST /orgs/{orgID}/projects/{projectID}/agent-profiles",
5835
+ "POST /orgs/{orgID}/projects/{projectID}/agent-profiles/{agentProfileID}/config",
5836
+ "POST /orgs/{orgID}/projects/{projectID}/agents",
5837
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/config",
5838
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/inputs",
5839
+ "POST /orgs/{orgID}/projects/{projectID}/cron-triggers",
5840
+ "POST /orgs/{orgID}/projects/{projectID}/machine-grants",
5841
+ "POST /orgs/{orgID}/projects/{projectID}/machine-pool-grants"
5842
+ ]);
5843
+ var idempotentOperations = /* @__PURE__ */ new Set([
5844
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/archive",
5845
+ "POST /orgs/{orgID}/projects/{projectID}/agents/{agentID}/tool-calls/{toolCallID}/result",
5846
+ "PUT /orgs/{orgID}/projects/{projectID}/memory-stores/{memoryStoreID}/file"
5847
+ ]);
5848
+
5849
+ // ../sdk/src/observer.ts
5850
+ function notifyObserver(observer, observation) {
5851
+ if (observer === void 0) return;
5852
+ try {
5853
+ void Promise.resolve(observer(observation)).catch(() => void 0);
5854
+ } catch {
5855
+ }
5856
+ }
5857
+
5858
+ // ../sdk/src/response-stream.ts
5859
+ function responseWithStreamLifetime(response, signal, dispose) {
5860
+ if (response.body === null) return response;
5861
+ const wrapped = new Response(streamWithLifetime(response.body, signal, dispose), response);
5862
+ return copyResponseMetadata(wrapped, response);
5863
+ }
5864
+ function copyResponseMetadata(target, source) {
5865
+ Object.defineProperties(target, {
5866
+ url: { value: source.url },
5867
+ redirected: { value: source.redirected },
5868
+ type: { value: source.type },
5869
+ clone: {
5870
+ configurable: true,
5871
+ writable: true,
5872
+ value: function clone() {
5873
+ return copyResponseMetadata(Response.prototype.clone.call(this), this);
5874
+ }
5875
+ }
5876
+ });
5877
+ return target;
5878
+ }
5879
+ function streamWithLifetime(source, signal, dispose) {
5880
+ const reader = source.getReader();
5881
+ let finished = false;
5882
+ let disposed = false;
5883
+ let output;
5884
+ function release2() {
5885
+ if (disposed) return;
5886
+ disposed = true;
5887
+ signal.removeEventListener("abort", abort);
5888
+ dispose();
5889
+ }
5890
+ function fail(reason) {
5891
+ if (finished) return;
5892
+ finished = true;
5893
+ output.error(reason);
5894
+ release2();
5895
+ void reader.cancel(reason).catch(() => void 0).finally(() => {
5896
+ reader.releaseLock();
5897
+ });
5898
+ }
5899
+ function abort() {
5900
+ fail(signal.reason);
5901
+ }
5902
+ return new ReadableStream(
5903
+ {
5904
+ start(controller) {
5905
+ output = controller;
5906
+ if (signal.aborted) abort();
5907
+ else signal.addEventListener("abort", abort, { once: true });
5908
+ void reader.closed.then(release2, fail);
5909
+ },
5910
+ async pull(controller) {
5911
+ try {
5912
+ const chunk = await reader.read();
5913
+ if (finished) return;
5914
+ if (chunk.done) {
5915
+ finished = true;
5916
+ controller.close();
5917
+ release2();
5918
+ reader.releaseLock();
5919
+ } else controller.enqueue(chunk.value);
5920
+ } catch (error) {
5921
+ fail(error);
5922
+ }
5923
+ },
5924
+ // oxlint-disable-next-line anti-slop/no-unknown-parameters
5925
+ async cancel(reason) {
5926
+ finished = true;
5927
+ release2();
5928
+ try {
5929
+ await reader.cancel(reason);
5930
+ } finally {
5931
+ reader.releaseLock();
5932
+ }
5933
+ }
5934
+ },
5935
+ { highWaterMark: 0 }
5936
+ );
5937
+ }
5938
+
5939
+ // ../sdk/src/request-policy.ts
5940
+ function validateRequestPolicy(options) {
5941
+ for (const name of ["maxRetries", "timeoutMs"]) {
5942
+ const value = options[name];
5943
+ if (value !== void 0 && (!Number.isSafeInteger(value) || value < 0)) {
5944
+ throw new RangeError(`${name} must be a non-negative safe integer`);
5945
+ }
5946
+ }
5947
+ if (options.timeoutMs !== void 0 && options.timeoutMs > 2147483647) {
5948
+ throw new RangeError("timeoutMs must fit a 32-bit timer (at most 2147483647 ms)");
5949
+ }
5950
+ }
5951
+ function normalizeHeaders(headers) {
5952
+ return Array.isArray(headers) ? new Headers(headers) : headers;
5953
+ }
5954
+ function validateClientRequestPolicy(options) {
5955
+ validateRequestPolicy(options);
5956
+ if (mergeHeaders(normalizeHeaders(options.headers)).has("Idempotency-Key")) {
5957
+ throw new TypeError(
5958
+ "Idempotency-Key cannot be set in client-wide headers; set it on each request instead."
5959
+ );
5960
+ }
5961
+ }
5962
+ function oneShotBody(body) {
5963
+ return body instanceof ReadableStream || body !== null && typeof body === "object" && Symbol.asyncIterator in body;
5964
+ }
5965
+ var retryableStatuses = /* @__PURE__ */ new Set([408, 429, 500, 502, 503, 504]);
5966
+ var originalRequests = /* @__PURE__ */ new WeakMap();
5967
+ function captureRequestDestination(request, options) {
5968
+ if (options.fetch !== void 0 && originalRequests.has(options.fetch)) {
5969
+ originalRequests.set(options.fetch, {
5970
+ method: request.method,
5971
+ url: request.url,
5972
+ baseUrl: options.baseUrl,
5973
+ operation: `${(options.method ?? "GET").toUpperCase()} ${options.url}`
5974
+ });
5975
+ }
5976
+ return request;
5977
+ }
5978
+ async function requestWithPolicy(config2, options, dispatch) {
5979
+ const maxRetries = options.maxRetries ?? config2.maxRetries ?? 2;
5980
+ const timeoutMs = options.timeoutMs ?? config2.timeoutMs ?? 0;
5981
+ validateRequestPolicy({ maxRetries, timeoutMs });
5982
+ const startedAt = Date.now();
5983
+ const observer = options.onRequestComplete ?? config2.onRequestComplete;
5984
+ const method = (options.method ?? "GET").toUpperCase();
5985
+ const operation = `${method} ${options.url}`;
5986
+ const baseUrl = "baseUrl" in options ? options.baseUrl : config2.baseUrl;
5987
+ const keyed = keyedOperations.has(operation);
5988
+ let headers = normalizeHeaders(options.headers);
5989
+ const mergedHeaders = mergeHeaders(normalizeHeaders(config2.headers), headers);
5990
+ if (keyed && !mergedHeaders.has("Idempotency-Key")) {
5991
+ headers = {
5992
+ ...headers instanceof Headers ? Object.fromEntries(headers) : headers,
5993
+ "Idempotency-Key": crypto.randomUUID()
5994
+ };
5995
+ }
5996
+ const callerSignal = options.signal !== void 0 ? options.signal : config2.signal;
5997
+ const controller = new AbortController();
5998
+ const disposeCaller = forwardAbort(callerSignal, controller);
5999
+ const { signal } = controller;
6000
+ const timeoutReason = timeoutMs > 0 ? new DOMException("SDK request timed out", "TimeoutError") : void 0;
6001
+ const expiresAt = timeoutMs > 0 ? Date.now() + timeoutMs : Infinity;
6002
+ const timer = timeoutMs > 0 ? setTimeout(() => {
6003
+ if (signal.aborted) return;
6004
+ controller.abort(timeoutReason);
6005
+ }, timeoutMs) : void 0;
6006
+ const fetch2 = options.fetch ?? config2.fetch ?? globalThis.fetch;
6007
+ const parseAs = options.parseAs ?? config2.parseAs;
6008
+ let replayable = !oneShotBody(options.body);
6009
+ const serializer = options.bodySerializer !== void 0 ? options.bodySerializer : config2.bodySerializer;
6010
+ const bodySerializer = serializer ? (body) => {
6011
+ const serialized = serializer(body);
6012
+ replayable &&= !oneShotBody(serialized);
6013
+ return serialized;
6014
+ } : serializer;
6015
+ let lastRequest;
6016
+ let lastResponse;
6017
+ let handoff = "none";
6018
+ let attempts = 0;
6019
+ const backoff = { elapsedMs: 0 };
6020
+ let status;
6021
+ let observationOperation = knownOperations.has(operation) ? operation : "unknown";
6022
+ let outcome = "returned";
6023
+ async function wait(delayMs) {
6024
+ const waitingAt = Date.now();
6025
+ backoff.startedAt = waitingAt;
6026
+ try {
6027
+ await abortableDelay(delayMs, signal);
6028
+ } finally {
6029
+ backoff.elapsedMs += Math.max(0, Date.now() - waitingAt);
6030
+ backoff.startedAt = void 0;
6031
+ }
6032
+ }
6033
+ function exposeResponse(response) {
6034
+ if (parseAs === "stream" && response.ok) clearTimeout(timer);
6035
+ return response;
6036
+ }
6037
+ const retryingFetch = async (input, init) => {
6038
+ signal.throwIfAborted();
6039
+ const template = input instanceof Request && init === void 0 ? input : new Request(input, init);
6040
+ const original = originalRequests.get(retryingFetch);
6041
+ const sameDestination = original?.operation === operation && original.baseUrl === baseUrl && template.method === method && original.method === template.method && original.url === template.url;
6042
+ if (!sameDestination) observationOperation = "unknown";
6043
+ const safe = sameDestination && replayable && parseAs !== "stream" && (template.method === "GET" || template.method === "HEAD" || idempotentOperations.has(operation) || keyed && Boolean(template.headers.get("Idempotency-Key")?.trim()));
6044
+ const retries = safe ? maxRetries : 0;
6045
+ try {
6046
+ for (let attempt = 0; ; attempt++) {
6047
+ signal.throwIfAborted();
6048
+ lastRequest = retries > 0 ? template.clone() : template;
6049
+ lastResponse = void 0;
6050
+ status = void 0;
6051
+ let response;
6052
+ try {
6053
+ attempts++;
6054
+ response = await fetch2(lastRequest);
6055
+ } catch (error) {
6056
+ signal.throwIfAborted();
6057
+ const delay2 = retryDelay(attempt + 1);
6058
+ if (!(error instanceof TypeError) || attempt >= retries || Date.now() + delay2 >= expiresAt)
6059
+ throw error;
6060
+ await wait(delay2);
6061
+ continue;
6062
+ }
6063
+ if (signal.aborted) {
6064
+ void response.body?.cancel().catch(() => void 0);
6065
+ signal.throwIfAborted();
6066
+ }
6067
+ lastResponse = response;
6068
+ status = response.status;
6069
+ if (!retryableStatuses.has(response.status) || attempt >= retries)
6070
+ return exposeResponse(response);
6071
+ const retryAfterMs = parseRetryAfter(response.headers.get("Retry-After")) ?? 0;
6072
+ const delay = Math.max(retryDelay(attempt + 1), retryAfterMs);
6073
+ if (retryAfterMs > retryAfterMaximumDelayMs || Date.now() + delay >= expiresAt)
6074
+ return exposeResponse(response);
6075
+ void response.body?.cancel().catch(() => void 0);
6076
+ lastResponse = void 0;
6077
+ await wait(delay);
6078
+ }
6079
+ } finally {
6080
+ if (retries > 0) void template.body?.cancel().catch(() => void 0);
6081
+ }
6082
+ };
6083
+ originalRequests.set(retryingFetch, void 0);
6084
+ try {
6085
+ const result = await untilAborted(
6086
+ () => dispatch({ fetch: retryingFetch, signal, headers, bodySerializer }),
6087
+ signal
6088
+ );
6089
+ if (result instanceof ReadableStream) {
6090
+ clearTimeout(timer);
6091
+ const stream = callerSignal ? streamWithLifetime(result, signal, disposeCaller) : result;
6092
+ handoff = "stream";
6093
+ return stream;
6094
+ }
6095
+ if (result !== null && // oxlint-disable-next-line anti-slop/no-runtime-typeof
6096
+ typeof result === "object" && "response" in result && result.response instanceof Response) {
6097
+ handoff = result.response === lastResponse ? "response" : "none";
6098
+ if (result.response.body !== null && "data" in result && result.data === result.response.body) {
6099
+ clearTimeout(timer);
6100
+ const response = callerSignal ? responseWithStreamLifetime(result.response, signal, disposeCaller) : result.response;
6101
+ handoff = "stream";
6102
+ return { ...result, data: response.body, response };
6103
+ }
6104
+ }
6105
+ return result;
6106
+ } catch (error) {
6107
+ if (options.throwOnError ?? config2.throwOnError) {
6108
+ outcome = "threw";
6109
+ throw error;
6110
+ }
6111
+ const dataOnly = (options.responseStyle ?? config2.responseStyle) === "data";
6112
+ handoff = !dataOnly && lastResponse !== void 0 ? "response" : "none";
6113
+ return dataOnly ? void 0 : { error, request: lastRequest, response: lastResponse };
6114
+ } finally {
6115
+ originalRequests.delete(retryingFetch);
6116
+ clearTimeout(timer);
6117
+ if (handoff !== "stream") {
6118
+ disposeCaller();
6119
+ if (parseAs === "stream" && (handoff === "none" || signal.aborted))
6120
+ void lastResponse?.body?.cancel().catch(() => void 0);
6121
+ }
6122
+ if (observer !== void 0) {
6123
+ notifyObserver(observer, {
6124
+ operation: observationOperation,
6125
+ durationMs: Math.max(0, Date.now() - startedAt),
6126
+ attempts,
6127
+ backoffMs: backoff.elapsedMs + (backoff.startedAt === void 0 ? 0 : Math.max(0, Date.now() - backoff.startedAt)),
6128
+ status,
6129
+ outcome: signal.aborted ? signal.reason === timeoutReason ? "timeout" : "canceled" : outcome
6130
+ });
6131
+ }
6132
+ }
6133
+ }
6134
+
5467
6135
  // ../sdk/src/client.ts
5468
6136
  var httpMethods = [
5469
6137
  "connect",
@@ -5503,28 +6171,43 @@ function normalizeRequestOptions(options) {
5503
6171
  }
5504
6172
  return normalized;
5505
6173
  }
5506
- function patchGeneratedRequests(client2) {
6174
+ function configureRequests(client2) {
6175
+ client2.interceptors.request.use(captureRequestDestination);
6176
+ const { setConfig } = client2;
6177
+ client2.setConfig = (config2) => {
6178
+ validateClientRequestPolicy(config2);
6179
+ return setConfig({ ...config2, headers: normalizeHeaders(config2.headers) });
6180
+ };
5507
6181
  const { request } = client2;
5508
- client2.request = (options) => request(normalizeRequestOptions(options));
6182
+ client2.request = (options) => requestWithPolicy(
6183
+ client2.getConfig(),
6184
+ normalizeRequestOptions(options),
6185
+ (overrides) => request(normalizeRequestOptions({ ...options, ...overrides }))
6186
+ );
5509
6187
  for (const method of httpMethods) {
5510
- const dispatch = client2[method];
5511
- client2[method] = (options) => dispatch(normalizeRequestOptions(options));
6188
+ const requestMethod = method.toUpperCase();
6189
+ client2[method] = (options) => client2.request({ ...options, method: requestMethod });
5512
6190
  const sseDispatch = client2.sse[method];
5513
6191
  client2.sse[method] = (options) => sseDispatch(normalizeRequestOptions(options));
5514
6192
  }
5515
6193
  }
5516
- patchGeneratedRequests(client);
6194
+ client.setConfig({ maxRetries: 0, timeoutMs: 0 });
6195
+ configureRequests(client);
5517
6196
  function createOmnaraClient(options = {}) {
5518
6197
  const client2 = createClient(
5519
6198
  createConfig({
5520
6199
  throwOnError: true
5521
6200
  })
5522
6201
  );
6202
+ configureRequests(client2);
5523
6203
  client2.setConfig({
5524
6204
  baseUrl: options.baseUrl ?? client.getConfig().baseUrl,
5525
6205
  credentials: options.credentials,
5526
6206
  headers: options.headers,
5527
- fetch: options.fetch
6207
+ fetch: options.fetch,
6208
+ maxRetries: options.maxRetries,
6209
+ timeoutMs: options.timeoutMs,
6210
+ onRequestComplete: options.onRequestComplete
5528
6211
  });
5529
6212
  const { auth } = options;
5530
6213
  if (auth) {
@@ -5537,139 +6220,9 @@ function createOmnaraClient(options = {}) {
5537
6220
  if (!response.ok) throw await ApiError.fromResponse(response);
5538
6221
  return response;
5539
6222
  });
5540
- patchGeneratedRequests(client2);
5541
6223
  return client2;
5542
6224
  }
5543
6225
 
5544
- // ../sdk/src/device.ts
5545
- import * as z7 from "zod";
5546
- var OMNARA_CLI_OAUTH_CLIENT_ID = "omnara-cli";
5547
- var OAUTH_DEVICE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
5548
- var zAuthorizationServerMetadata = z7.object({
5549
- issuer: z7.url(),
5550
- device_authorization_endpoint: z7.url(),
5551
- token_endpoint: z7.url(),
5552
- grant_types_supported: z7.array(z7.string()),
5553
- token_endpoint_auth_methods_supported: z7.array(z7.string())
5554
- });
5555
- var zDeviceAuthStartResponse = z7.object({
5556
- device_code: z7.string().min(1),
5557
- user_code: z7.string().min(1),
5558
- verification_uri: z7.string().min(1),
5559
- verification_uri_complete: z7.string().min(1),
5560
- expires_in: z7.number().int().positive(),
5561
- interval: z7.number().int().positive()
5562
- });
5563
- var zDeviceAuthErrorResponse = z7.object({
5564
- error: z7.string().min(1),
5565
- error_description: z7.string().optional()
5566
- });
5567
- var zDeviceAuthFailure = zJsonText.pipe(zDeviceAuthErrorResponse);
5568
- var zDeviceAuthApprovedResponse = z7.object({
5569
- access_token: z7.string().min(1),
5570
- token_type: z7.string()
5571
- });
5572
- var DEVICE_AUTH_FAILURE_MESSAGES = {
5573
- access_denied: "the login request was denied",
5574
- expired_token: "the login request expired before it was approved"
5575
- };
5576
- var DeviceAuthError = class extends Error {
5577
- code;
5578
- constructor(code) {
5579
- super(DEVICE_AUTH_FAILURE_MESSAGES[code]);
5580
- this.name = "DeviceAuthError";
5581
- this.code = code;
5582
- }
5583
- };
5584
- async function postOAuthForm(fetchImpl, endpoint, body) {
5585
- return fetchImpl(endpoint, {
5586
- method: "POST",
5587
- headers: {
5588
- Accept: "application/json",
5589
- "Content-Type": "application/x-www-form-urlencoded"
5590
- },
5591
- body: body.toString()
5592
- });
5593
- }
5594
- function normalizeIssuer(raw) {
5595
- const issuer = new URL(raw);
5596
- if (issuer.username !== "" || issuer.password !== "" || issuer.pathname !== "/" || issuer.search !== "" || issuer.hash !== "") {
5597
- throw new Error("authorization server issuer must be an origin");
5598
- }
5599
- return issuer.origin;
5600
- }
5601
- async function startDeviceAuth(options) {
5602
- const fetchImpl = options.fetch ?? fetch;
5603
- const expectedIssuer = normalizeIssuer(options.issuerUrl);
5604
- const metadataUrl = new URL("/.well-known/oauth-authorization-server", `${expectedIssuer}/`);
5605
- const metadataResponse = await fetchImpl(metadataUrl, { headers: { Accept: "application/json" } });
5606
- if (!metadataResponse.ok) throw await ApiError.fromResponse(metadataResponse);
5607
- const metadata = zAuthorizationServerMetadata.parse(await metadataResponse.json());
5608
- if (normalizeIssuer(metadata.issuer) !== expectedIssuer) {
5609
- throw new Error(
5610
- `authorization server issuer mismatch: expected ${expectedIssuer}, received ${metadata.issuer}`
5611
- );
5612
- }
5613
- if (!metadata.grant_types_supported.includes(OAUTH_DEVICE_GRANT_TYPE)) {
5614
- throw new Error("authorization server does not support the OAuth device grant");
5615
- }
5616
- if (!metadata.token_endpoint_auth_methods_supported.includes("none")) {
5617
- throw new Error("authorization server does not support public OAuth clients");
5618
- }
5619
- const body = new URLSearchParams({ client_id: options.clientId });
5620
- if (options.tokenName !== void 0) body.set("token_name", options.tokenName);
5621
- const response = await postOAuthForm(fetchImpl, metadata.device_authorization_endpoint, body);
5622
- if (!response.ok) throw await ApiError.fromResponse(response);
5623
- const data = zDeviceAuthStartResponse.parse(await response.json());
5624
- return {
5625
- deviceCode: data.device_code,
5626
- userCode: data.user_code,
5627
- verificationUri: new URL(data.verification_uri, metadata.issuer).toString(),
5628
- verificationUriComplete: new URL(data.verification_uri_complete, metadata.issuer).toString(),
5629
- expiresInSeconds: data.expires_in,
5630
- intervalSeconds: data.interval,
5631
- tokenEndpoint: metadata.token_endpoint,
5632
- clientId: options.clientId
5633
- };
5634
- }
5635
- function defaultSleep(seconds) {
5636
- return new Promise((resolve3) => setTimeout(resolve3, seconds * 1e3));
5637
- }
5638
- async function pollDeviceAuthToken(options) {
5639
- const fetchImpl = options.fetch ?? fetch;
5640
- const sleep = options.sleep ?? defaultSleep;
5641
- let interval = options.intervalSeconds;
5642
- while (true) {
5643
- await sleep(interval);
5644
- const response = await postOAuthForm(
5645
- fetchImpl,
5646
- options.tokenEndpoint,
5647
- new URLSearchParams({
5648
- grant_type: OAUTH_DEVICE_GRANT_TYPE,
5649
- device_code: options.deviceCode,
5650
- client_id: options.clientId
5651
- })
5652
- );
5653
- if (response.status === 200) {
5654
- return zDeviceAuthApprovedResponse.parse(await response.json()).access_token;
5655
- }
5656
- if (response.status === 400) {
5657
- const failure = zDeviceAuthFailure.safeParse(await response.clone().text());
5658
- if (failure.success) {
5659
- if (failure.data.error === "authorization_pending") continue;
5660
- if (failure.data.error === "slow_down") {
5661
- interval += 5;
5662
- continue;
5663
- }
5664
- if (failure.data.error === "access_denied" || failure.data.error === "expired_token") {
5665
- throw new DeviceAuthError(failure.data.error);
5666
- }
5667
- }
5668
- }
5669
- throw await ApiError.fromResponse(response);
5670
- }
5671
- }
5672
-
5673
6226
  // ../sdk/src/generated/sdk.gen.ts
5674
6227
  var sdk_gen_exports = {};
5675
6228
  __export(sdk_gen_exports, {
@@ -5748,11 +6301,14 @@ __export(sdk_gen_exports, {
5748
6301
  getAgentUsage: () => getAgentUsage,
5749
6302
  getArtifact: () => getArtifact,
5750
6303
  getArtifactContent: () => getArtifactContent,
6304
+ getConfiguredModel: () => getConfiguredModel,
5751
6305
  getCronTrigger: () => getCronTrigger,
5752
6306
  getCurrentUser: () => getCurrentUser,
5753
6307
  getDaemonGitCredentials: () => getDaemonGitCredentials,
5754
6308
  getDaemonSkillArchive: () => getDaemonSkillArchive,
6309
+ getEventWebhook: () => getEventWebhook,
5755
6310
  getIntegration: () => getIntegration,
6311
+ getIntegrationSubscription: () => getIntegrationSubscription,
5756
6312
  getMachine: () => getMachine,
5757
6313
  getMachinePool: () => getMachinePool,
5758
6314
  getMemoryStore: () => getMemoryStore,
@@ -5762,11 +6318,17 @@ __export(sdk_gen_exports, {
5762
6318
  getOrgOverview: () => getOrgOverview,
5763
6319
  getOrgUsage: () => getOrgUsage,
5764
6320
  getOrgUsageTimeseries: () => getOrgUsageTimeseries,
6321
+ getProject: () => getProject,
5765
6322
  getProjectAvailableSecret: () => getProjectAvailableSecret,
6323
+ getProjectMachineGrant: () => getProjectMachineGrant,
5766
6324
  getProjectMachinePoolGrant: () => getProjectMachinePoolGrant,
6325
+ getProjectModelGrant: () => getProjectModelGrant,
5767
6326
  getProjectUsage: () => getProjectUsage,
5768
6327
  getSecret: () => getSecret,
6328
+ getSecretGrant: () => getSecretGrant,
5769
6329
  getSkill: () => getSkill,
6330
+ getSkillGrant: () => getSkillGrant,
6331
+ getToolCall: () => getToolCall,
5770
6332
  getToolCatalog: () => getToolCatalog,
5771
6333
  inspectIntegrationGitHubInstallations: () => inspectIntegrationGitHubInstallations,
5772
6334
  listActors: () => listActors,
@@ -5802,9 +6364,11 @@ __export(sdk_gen_exports, {
5802
6364
  listPersonalAccessTokens: () => listPersonalAccessTokens,
5803
6365
  listProjectAvailableSecrets: () => listProjectAvailableSecrets,
5804
6366
  listProjectAvailableSkills: () => listProjectAvailableSkills,
6367
+ listProjectInteractions: () => listProjectInteractions,
5805
6368
  listProjectMachineGrants: () => listProjectMachineGrants,
5806
6369
  listProjectMachinePoolGrants: () => listProjectMachinePoolGrants,
5807
6370
  listProjectModelGrants: () => listProjectModelGrants,
6371
+ listProjectToolCalls: () => listProjectToolCalls,
5808
6372
  listQueuedBacklogInputs: () => listQueuedBacklogInputs,
5809
6373
  listSecretGrants: () => listSecretGrants,
5810
6374
  listSecrets: () => listSecrets,
@@ -5849,6 +6413,7 @@ __export(sdk_gen_exports, {
5849
6413
  updateModelProviderConfig: () => updateModelProviderConfig,
5850
6414
  updateOrgApiKey: () => updateOrgApiKey,
5851
6415
  updateOrgMember: () => updateOrgMember,
6416
+ updateProject: () => updateProject,
5852
6417
  updateProjectMachinePoolGrant: () => updateProjectMachinePoolGrant,
5853
6418
  updateProjectModelGrant: () => updateProjectModelGrant,
5854
6419
  updateSecret: () => updateSecret,
@@ -5910,6 +6475,20 @@ var deleteEventWebhook = (options) => (options.client ?? client).delete({
5910
6475
  url: "/orgs/{orgID}/projects/{projectID}/event-webhooks/{webhookID}",
5911
6476
  ...options
5912
6477
  });
6478
+ var getEventWebhook = (options) => (options.client ?? client).get({
6479
+ responseValidator: relaxedResponseValidator(zGetEventWebhookResponse),
6480
+ security: [{
6481
+ key: "bearerAuth",
6482
+ scheme: "bearer",
6483
+ type: "http"
6484
+ }, {
6485
+ in: "cookie",
6486
+ name: "__Host-omnara_session",
6487
+ type: "apiKey"
6488
+ }],
6489
+ url: "/orgs/{orgID}/projects/{projectID}/event-webhooks/{webhookID}",
6490
+ ...options
6491
+ });
5913
6492
  var updateEventWebhook = (options) => (options.client ?? client).patch({
5914
6493
  responseValidator: relaxedResponseValidator(zUpdateEventWebhookResponse),
5915
6494
  security: [
@@ -6263,6 +6842,42 @@ var deleteProject = (options) => (options.client ?? client).delete({
6263
6842
  url: "/orgs/{orgID}/projects/{projectID}",
6264
6843
  ...options
6265
6844
  });
6845
+ var getProject = (options) => (options.client ?? client).get({
6846
+ responseValidator: relaxedResponseValidator(zGetProjectResponse),
6847
+ security: [{
6848
+ key: "bearerAuth",
6849
+ scheme: "bearer",
6850
+ type: "http"
6851
+ }, {
6852
+ in: "cookie",
6853
+ name: "__Host-omnara_session",
6854
+ type: "apiKey"
6855
+ }],
6856
+ url: "/orgs/{orgID}/projects/{projectID}",
6857
+ ...options
6858
+ });
6859
+ var updateProject = (options) => (options.client ?? client).patch({
6860
+ responseValidator: relaxedResponseValidator(zUpdateProjectResponse),
6861
+ security: [
6862
+ {
6863
+ key: "bearerAuth",
6864
+ scheme: "bearer",
6865
+ type: "http"
6866
+ },
6867
+ {
6868
+ in: "cookie",
6869
+ name: "__Host-omnara_session",
6870
+ type: "apiKey"
6871
+ },
6872
+ { name: "X-Omnara-Csrf", type: "apiKey" }
6873
+ ],
6874
+ url: "/orgs/{orgID}/projects/{projectID}",
6875
+ ...options,
6876
+ headers: {
6877
+ "Content-Type": "application/json",
6878
+ ...options.headers
6879
+ }
6880
+ });
6266
6881
  var getProjectUsage = (options) => (options.client ?? client).get({
6267
6882
  responseValidator: relaxedResponseValidator(zGetProjectUsageResponse),
6268
6883
  security: [{
@@ -6689,6 +7304,20 @@ var deleteSkillGrant = (options) => (options.client ?? client).delete({
6689
7304
  url: "/orgs/{orgID}/skills/{skillID}/grants/{grantID}",
6690
7305
  ...options
6691
7306
  });
7307
+ var getSkillGrant = (options) => (options.client ?? client).get({
7308
+ responseValidator: relaxedResponseValidator(zGetSkillGrantResponse),
7309
+ security: [{
7310
+ key: "bearerAuth",
7311
+ scheme: "bearer",
7312
+ type: "http"
7313
+ }, {
7314
+ in: "cookie",
7315
+ name: "__Host-omnara_session",
7316
+ type: "apiKey"
7317
+ }],
7318
+ url: "/orgs/{orgID}/skills/{skillID}/grants/{grantID}",
7319
+ ...options
7320
+ });
6692
7321
  var listProjectAvailableSkills = (options) => (options.client ?? client).get({
6693
7322
  responseValidator: relaxedResponseValidator(zListProjectAvailableSkillsResponse),
6694
7323
  security: [{
@@ -7064,6 +7693,20 @@ var deleteSecretGrant = (options) => (options.client ?? client).delete({
7064
7693
  url: "/orgs/{orgID}/secrets/{secretID}/grants/{grantID}",
7065
7694
  ...options
7066
7695
  });
7696
+ var getSecretGrant = (options) => (options.client ?? client).get({
7697
+ responseValidator: relaxedResponseValidator(zGetSecretGrantResponse),
7698
+ security: [{
7699
+ key: "bearerAuth",
7700
+ scheme: "bearer",
7701
+ type: "http"
7702
+ }, {
7703
+ in: "cookie",
7704
+ name: "__Host-omnara_session",
7705
+ type: "apiKey"
7706
+ }],
7707
+ url: "/orgs/{orgID}/secrets/{secretID}/grants/{grantID}",
7708
+ ...options
7709
+ });
7067
7710
  var resolveAgentConfigTools = (options) => (options.client ?? client).post({
7068
7711
  responseValidator: relaxedResponseValidator(zResolveAgentConfigToolsResponse),
7069
7712
  security: [
@@ -7600,6 +8243,20 @@ var createAgentInput = (options) => (options.client ?? client).post({
7600
8243
  ...options.headers
7601
8244
  }
7602
8245
  });
8246
+ var listProjectToolCalls = (options) => (options.client ?? client).get({
8247
+ responseValidator: relaxedResponseValidator(zListProjectToolCallsResponse),
8248
+ security: [{
8249
+ key: "bearerAuth",
8250
+ scheme: "bearer",
8251
+ type: "http"
8252
+ }, {
8253
+ in: "cookie",
8254
+ name: "__Host-omnara_session",
8255
+ type: "apiKey"
8256
+ }],
8257
+ url: "/orgs/{orgID}/projects/{projectID}/tool-calls",
8258
+ ...options
8259
+ });
7603
8260
  var listToolCalls = (options) => (options.client ?? client).get({
7604
8261
  responseValidator: relaxedResponseValidator(zListToolCallsResponse2),
7605
8262
  security: [{
@@ -7614,6 +8271,20 @@ var listToolCalls = (options) => (options.client ?? client).get({
7614
8271
  url: "/orgs/{orgID}/projects/{projectID}/agents/{agentID}/tool-calls",
7615
8272
  ...options
7616
8273
  });
8274
+ var getToolCall = (options) => (options.client ?? client).get({
8275
+ responseValidator: relaxedResponseValidator(zGetToolCallResponse),
8276
+ security: [{
8277
+ key: "bearerAuth",
8278
+ scheme: "bearer",
8279
+ type: "http"
8280
+ }, {
8281
+ in: "cookie",
8282
+ name: "__Host-omnara_session",
8283
+ type: "apiKey"
8284
+ }],
8285
+ url: "/orgs/{orgID}/projects/{projectID}/agents/{agentID}/tool-calls/{toolCallID}",
8286
+ ...options
8287
+ });
7617
8288
  var submitToolCallResult = (options) => (options.client ?? client).post({
7618
8289
  responseValidator: relaxedResponseValidator(zSubmitToolCallResultResponse2),
7619
8290
  security: [
@@ -7714,6 +8385,20 @@ var cancelAgent = (options) => (options.client ?? client).post({
7714
8385
  ...options.headers
7715
8386
  }
7716
8387
  });
8388
+ var listProjectInteractions = (options) => (options.client ?? client).get({
8389
+ responseValidator: relaxedResponseValidator(zListProjectInteractionsResponse),
8390
+ security: [{
8391
+ key: "bearerAuth",
8392
+ scheme: "bearer",
8393
+ type: "http"
8394
+ }, {
8395
+ in: "cookie",
8396
+ name: "__Host-omnara_session",
8397
+ type: "apiKey"
8398
+ }],
8399
+ url: "/orgs/{orgID}/projects/{projectID}/interactions",
8400
+ ...options
8401
+ });
7717
8402
  var listAgentInteractions = (options) => (options.client ?? client).get({
7718
8403
  responseValidator: relaxedResponseValidator(zListAgentInteractionsResponse2),
7719
8404
  security: [{
@@ -7940,6 +8625,20 @@ var deleteProjectMachineGrant = (options) => (options.client ?? client).delete({
7940
8625
  url: "/orgs/{orgID}/projects/{projectID}/machine-grants/{grantID}",
7941
8626
  ...options
7942
8627
  });
8628
+ var getProjectMachineGrant = (options) => (options.client ?? client).get({
8629
+ responseValidator: relaxedResponseValidator(zGetProjectMachineGrantResponse),
8630
+ security: [{
8631
+ key: "bearerAuth",
8632
+ scheme: "bearer",
8633
+ type: "http"
8634
+ }, {
8635
+ in: "cookie",
8636
+ name: "__Host-omnara_session",
8637
+ type: "apiKey"
8638
+ }],
8639
+ url: "/orgs/{orgID}/projects/{projectID}/machine-grants/{grantID}",
8640
+ ...options
8641
+ });
7943
8642
  var listProjectAvailableSecrets = (options) => (options.client ?? client).get({
7944
8643
  responseValidator: relaxedResponseValidator(zListProjectAvailableSecretsResponse),
7945
8644
  security: [{
@@ -8288,6 +8987,20 @@ var deleteConfiguredModel = (options) => (options.client ?? client).delete({
8288
8987
  url: "/orgs/{orgID}/model-provider-configs/{modelProviderConfigID}/models/{configuredModelID}",
8289
8988
  ...options
8290
8989
  });
8990
+ var getConfiguredModel = (options) => (options.client ?? client).get({
8991
+ responseValidator: relaxedResponseValidator(zGetConfiguredModelResponse),
8992
+ security: [{
8993
+ key: "bearerAuth",
8994
+ scheme: "bearer",
8995
+ type: "http"
8996
+ }, {
8997
+ in: "cookie",
8998
+ name: "__Host-omnara_session",
8999
+ type: "apiKey"
9000
+ }],
9001
+ url: "/orgs/{orgID}/model-provider-configs/{modelProviderConfigID}/models/{configuredModelID}",
9002
+ ...options
9003
+ });
8291
9004
  var updateConfiguredModel = (options) => (options.client ?? client).put({
8292
9005
  responseValidator: relaxedResponseValidator(zUpdateConfiguredModelResponse),
8293
9006
  security: [
@@ -8364,6 +9077,20 @@ var deleteProjectModelGrant = (options) => (options.client ?? client).delete({
8364
9077
  url: "/orgs/{orgID}/projects/{projectID}/model-grants/{modelGrantID}",
8365
9078
  ...options
8366
9079
  });
9080
+ var getProjectModelGrant = (options) => (options.client ?? client).get({
9081
+ responseValidator: relaxedResponseValidator(zGetProjectModelGrantResponse),
9082
+ security: [{
9083
+ key: "bearerAuth",
9084
+ scheme: "bearer",
9085
+ type: "http"
9086
+ }, {
9087
+ in: "cookie",
9088
+ name: "__Host-omnara_session",
9089
+ type: "apiKey"
9090
+ }],
9091
+ url: "/orgs/{orgID}/projects/{projectID}/model-grants/{modelGrantID}",
9092
+ ...options
9093
+ });
8367
9094
  var updateProjectModelGrant = (options) => (options.client ?? client).patch({
8368
9095
  responseValidator: relaxedResponseValidator(zUpdateProjectModelGrantResponse),
8369
9096
  security: [
@@ -8888,6 +9615,20 @@ var deleteIntegrationSubscription = (options) => (options.client ?? client).dele
8888
9615
  url: "/orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/subscriptions/{subscriptionID}",
8889
9616
  ...options
8890
9617
  });
9618
+ var getIntegrationSubscription = (options) => (options.client ?? client).get({
9619
+ responseValidator: relaxedResponseValidator(zGetIntegrationSubscriptionResponse),
9620
+ security: [{
9621
+ key: "bearerAuth",
9622
+ scheme: "bearer",
9623
+ type: "http"
9624
+ }, {
9625
+ in: "cookie",
9626
+ name: "__Host-omnara_session",
9627
+ type: "apiKey"
9628
+ }],
9629
+ url: "/orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/subscriptions/{subscriptionID}",
9630
+ ...options
9631
+ });
8891
9632
  var configureIntegration = (options) => (options.client ?? client).post({
8892
9633
  responseValidator: relaxedResponseValidator(zConfigureIntegrationResponse),
8893
9634
  security: [
@@ -8957,6 +9698,138 @@ var listIntegrationDefinitions = (options) => (options.client ?? client).get({
8957
9698
  ...options
8958
9699
  });
8959
9700
 
9701
+ // ../sdk/src/device.ts
9702
+ import * as z7 from "zod";
9703
+ var OMNARA_CLI_OAUTH_CLIENT_ID = "omnara-cli";
9704
+ var OAUTH_DEVICE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
9705
+ var zAuthorizationServerMetadata = z7.object({
9706
+ issuer: z7.url(),
9707
+ device_authorization_endpoint: z7.url(),
9708
+ token_endpoint: z7.url(),
9709
+ grant_types_supported: z7.array(z7.string()),
9710
+ token_endpoint_auth_methods_supported: z7.array(z7.string())
9711
+ });
9712
+ var zDeviceAuthStartResponse = z7.object({
9713
+ device_code: z7.string().min(1),
9714
+ user_code: z7.string().min(1),
9715
+ verification_uri: z7.string().min(1),
9716
+ verification_uri_complete: z7.string().min(1),
9717
+ expires_in: z7.number().int().positive(),
9718
+ interval: z7.number().int().positive()
9719
+ });
9720
+ var zDeviceAuthErrorResponse = z7.object({
9721
+ error: z7.string().min(1),
9722
+ error_description: z7.string().optional()
9723
+ });
9724
+ var zDeviceAuthFailure = zJsonText.pipe(zDeviceAuthErrorResponse);
9725
+ var zDeviceAuthApprovedResponse = z7.object({
9726
+ access_token: z7.string().min(1),
9727
+ token_type: z7.string()
9728
+ });
9729
+ var DEVICE_AUTH_FAILURE_MESSAGES = {
9730
+ access_denied: "the login request was denied",
9731
+ expired_token: "the login request expired before it was approved"
9732
+ };
9733
+ var DeviceAuthError = class extends Error {
9734
+ code;
9735
+ constructor(code) {
9736
+ super(DEVICE_AUTH_FAILURE_MESSAGES[code]);
9737
+ this.name = "DeviceAuthError";
9738
+ this.code = code;
9739
+ }
9740
+ };
9741
+ async function postOAuthForm(fetchImpl, endpoint, body) {
9742
+ return fetchImpl(endpoint, {
9743
+ method: "POST",
9744
+ headers: {
9745
+ Accept: "application/json",
9746
+ "Content-Type": "application/x-www-form-urlencoded"
9747
+ },
9748
+ body: body.toString()
9749
+ });
9750
+ }
9751
+ function normalizeIssuer(raw) {
9752
+ const issuer = new URL(raw);
9753
+ if (issuer.username !== "" || issuer.password !== "" || issuer.pathname !== "/" || issuer.search !== "" || issuer.hash !== "") {
9754
+ throw new Error("authorization server issuer must be an origin");
9755
+ }
9756
+ return issuer.origin;
9757
+ }
9758
+ async function startDeviceAuth(options) {
9759
+ const fetchImpl = options.fetch ?? fetch;
9760
+ const expectedIssuer = normalizeIssuer(options.issuerUrl);
9761
+ const metadataUrl = new URL("/.well-known/oauth-authorization-server", `${expectedIssuer}/`);
9762
+ const metadataResponse = await fetchImpl(metadataUrl, { headers: { Accept: "application/json" } });
9763
+ if (!metadataResponse.ok) throw await ApiError.fromResponse(metadataResponse);
9764
+ const metadata = zAuthorizationServerMetadata.parse(await metadataResponse.json());
9765
+ if (normalizeIssuer(metadata.issuer) !== expectedIssuer) {
9766
+ throw new Error(
9767
+ `authorization server issuer mismatch: expected ${expectedIssuer}, received ${metadata.issuer}`
9768
+ );
9769
+ }
9770
+ if (!metadata.grant_types_supported.includes(OAUTH_DEVICE_GRANT_TYPE)) {
9771
+ throw new Error("authorization server does not support the OAuth device grant");
9772
+ }
9773
+ if (!metadata.token_endpoint_auth_methods_supported.includes("none")) {
9774
+ throw new Error("authorization server does not support public OAuth clients");
9775
+ }
9776
+ const body = new URLSearchParams({ client_id: options.clientId });
9777
+ if (options.tokenName !== void 0) body.set("token_name", options.tokenName);
9778
+ const response = await postOAuthForm(fetchImpl, metadata.device_authorization_endpoint, body);
9779
+ if (!response.ok) throw await ApiError.fromResponse(response);
9780
+ const data = zDeviceAuthStartResponse.parse(await response.json());
9781
+ return {
9782
+ deviceCode: data.device_code,
9783
+ userCode: data.user_code,
9784
+ verificationUri: new URL(data.verification_uri, metadata.issuer).toString(),
9785
+ verificationUriComplete: new URL(data.verification_uri_complete, metadata.issuer).toString(),
9786
+ expiresInSeconds: data.expires_in,
9787
+ intervalSeconds: data.interval,
9788
+ tokenEndpoint: metadata.token_endpoint,
9789
+ clientId: options.clientId
9790
+ };
9791
+ }
9792
+ function defaultSleep(seconds) {
9793
+ return new Promise((resolve3) => setTimeout(resolve3, seconds * 1e3));
9794
+ }
9795
+ async function pollDeviceAuthToken(options) {
9796
+ const fetchImpl = options.fetch ?? fetch;
9797
+ const sleep = options.sleep ?? defaultSleep;
9798
+ let interval = options.intervalSeconds;
9799
+ while (true) {
9800
+ await sleep(interval);
9801
+ const response = await postOAuthForm(
9802
+ fetchImpl,
9803
+ options.tokenEndpoint,
9804
+ new URLSearchParams({
9805
+ grant_type: OAUTH_DEVICE_GRANT_TYPE,
9806
+ device_code: options.deviceCode,
9807
+ client_id: options.clientId
9808
+ })
9809
+ );
9810
+ if (response.status === 200) {
9811
+ return zDeviceAuthApprovedResponse.parse(await response.json()).access_token;
9812
+ }
9813
+ if (response.status === 400) {
9814
+ const failure = zDeviceAuthFailure.safeParse(await response.clone().text());
9815
+ if (failure.success) {
9816
+ if (failure.data.error === "authorization_pending") continue;
9817
+ if (failure.data.error === "slow_down") {
9818
+ interval += 5;
9819
+ continue;
9820
+ }
9821
+ if (failure.data.error === "access_denied" || failure.data.error === "expired_token") {
9822
+ throw new DeviceAuthError(failure.data.error);
9823
+ }
9824
+ }
9825
+ }
9826
+ throw await ApiError.fromResponse(response);
9827
+ }
9828
+ }
9829
+
9830
+ // ../sdk/src/event-webhook.ts
9831
+ var webhookPayload = relaxedSchema(zEventWebhookPayload);
9832
+
8960
9833
  // ../sdk/src/memory.ts
8961
9834
  var MAX_MEMORY_FILE_BYTES = 10 * 1024 * 1024;
8962
9835
  var FILE_DIGEST_HEADER = "X-Omnara-File-Digest";
@@ -9497,18 +10370,47 @@ async function loginWithDevice(options) {
9497
10370
  // src/poll.ts
9498
10371
  var POLL_INTERVAL_SECONDS = 2;
9499
10372
  var MAX_CONSECUTIVE_POLL_FAILURES = 3;
10373
+ var MAX_TIMER_MS = 2 ** 31 - 1;
9500
10374
  function sleepSeconds(seconds) {
9501
10375
  return new Promise((resolve3) => setTimeout(resolve3, seconds * 1e3));
9502
10376
  }
10377
+ var DeadlineExceeded = class extends Error {
10378
+ };
10379
+ var PollTerminalError = class extends CliInputError {
10380
+ };
10381
+ async function fetchBeforeDeadline(abortAt, fetchOnce) {
10382
+ const controller = new AbortController();
10383
+ const remainingMs = abortAt - Date.now();
10384
+ let timer;
10385
+ const expired = new Promise((_, reject) => {
10386
+ if (remainingMs > MAX_TIMER_MS) return;
10387
+ timer = setTimeout(
10388
+ () => {
10389
+ controller.abort();
10390
+ reject(new DeadlineExceeded());
10391
+ },
10392
+ Math.max(0, remainingMs)
10393
+ );
10394
+ });
10395
+ try {
10396
+ return await Promise.race([fetchOnce(controller.signal), expired]);
10397
+ } finally {
10398
+ clearTimeout(timer);
10399
+ }
10400
+ }
9503
10401
  async function pollUntilDeadline(options) {
9504
10402
  const deadline = Date.parse(options.expiresAt);
10403
+ const abortAt = deadline + POLL_INTERVAL_SECONDS * 1e3;
9505
10404
  let consecutiveFailures = 0;
9506
10405
  while (true) {
9507
10406
  try {
9508
- const found = await options.fetchOnce();
10407
+ const found = await fetchBeforeDeadline(abortAt, options.fetchOnce);
10408
+ if (Date.now() >= abortAt) break;
9509
10409
  consecutiveFailures = 0;
9510
10410
  if (found !== void 0) return found;
9511
10411
  } catch (error) {
10412
+ if (error instanceof PollTerminalError) throw error;
10413
+ if (error instanceof DeadlineExceeded || Date.now() >= deadline) break;
9512
10414
  consecutiveFailures += 1;
9513
10415
  if (consecutiveFailures >= MAX_CONSECUTIVE_POLL_FAILURES) throw error;
9514
10416
  }
@@ -10200,7 +11102,7 @@ function registerLoginCommand(program2, cli) {
10200
11102
  }
10201
11103
 
10202
11104
  // src/manifest.ts
10203
- import * as z28 from "zod";
11105
+ import * as z29 from "zod";
10204
11106
 
10205
11107
  // src/agent-commands.ts
10206
11108
  import * as z19 from "zod";
@@ -10328,20 +11230,11 @@ function projectActorsQueryPredicate(orgID, projectID) {
10328
11230
  }
10329
11231
 
10330
11232
  // ../react/src/domains/agent-activity.ts
10331
- var activeAgentPollIntervalMs = 5e3;
10332
11233
  function isAgentActive(agent) {
10333
11234
  const activity = agent.activity;
10334
11235
  if (!activity) return false;
10335
11236
  return activity.state === "running" || activity.state === "waiting_on_interaction" || activity.running_processes.count > 0 || activity.working_subagents.count > 0;
10336
11237
  }
10337
- function activeAgentsRefetchInterval(getAgents, refetchInterval) {
10338
- return (query) => {
10339
- const data = query.state.data;
10340
- const own = refetchInterval?.(data);
10341
- if (own) return own;
10342
- return getAgents(data).some(isAgentActive) ? activeAgentPollIntervalMs : false;
10343
- };
10344
- }
10345
11238
 
10346
11239
  // ../react/src/domains/agent-chat.ts
10347
11240
  import { useQueryClient as useQueryClient3 } from "@tanstack/react-query";
@@ -10517,10 +11410,8 @@ function agentEventsToMessages(events, { hasOlderEvents = false } = {}) {
10517
11410
  toolType: part.toolType,
10518
11411
  state: "output-available",
10519
11412
  input: part.input,
10520
- output: {
10521
- outcome: event.outcome,
10522
- contentBlocks
10523
- }
11413
+ output: { contentBlocks },
11414
+ toolOutcome: event.outcome
10524
11415
  };
10525
11416
  if (toolErrorCode != null) toolPart.toolErrorCode = toolErrorCode;
10526
11417
  const mediaParts = contentBlocks.flatMap(
@@ -11552,46 +12443,47 @@ import {
11552
12443
  useQueryClient as useQueryClient6,
11553
12444
  useSuspenseQuery as useSuspenseQuery3
11554
12445
  } from "@tanstack/react-query";
11555
- var agentListRefetchInterval = activeAgentsRefetchInterval(
11556
- (data) => data?.pages.flatMap((page) => page.data) ?? []
11557
- );
11558
12446
 
11559
12447
  // ../react/src/domains/cron-triggers.ts
11560
12448
  import { useInfiniteQuery as useInfiniteQuery4, useMutation as useMutation6, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
11561
12449
 
11562
12450
  // ../react/src/domains/event-webhooks.ts
11563
- import { useMutation as useMutation7, useQuery as useQuery7, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
12451
+ import {
12452
+ useInfiniteQuery as useInfiniteQuery5,
12453
+ useMutation as useMutation7,
12454
+ useQueryClient as useQueryClient8
12455
+ } from "@tanstack/react-query";
11564
12456
 
11565
12457
  // ../react/src/domains/integration-subscriptions.ts
11566
12458
  import {
11567
- useInfiniteQuery as useInfiniteQuery5,
12459
+ useInfiniteQuery as useInfiniteQuery6,
11568
12460
  useMutation as useMutation8,
11569
12461
  useQueryClient as useQueryClient9
11570
12462
  } from "@tanstack/react-query";
11571
12463
 
11572
12464
  // ../react/src/domains/integrations.ts
11573
12465
  import {
11574
- useInfiniteQuery as useInfiniteQuery6,
12466
+ useInfiniteQuery as useInfiniteQuery7,
11575
12467
  useMutation as useMutation9,
11576
- useQuery as useQuery8,
12468
+ useQuery as useQuery7,
11577
12469
  useQueryClient as useQueryClient10
11578
12470
  } from "@tanstack/react-query";
11579
12471
 
11580
12472
  // ../react/src/domains/invitations.ts
11581
- import { useMutation as useMutation10, useQuery as useQuery9, useQueryClient as useQueryClient11, useSuspenseQuery as useSuspenseQuery4 } from "@tanstack/react-query";
12473
+ import { useMutation as useMutation10, useQuery as useQuery8, useQueryClient as useQueryClient11, useSuspenseQuery as useSuspenseQuery4 } from "@tanstack/react-query";
11582
12474
 
11583
12475
  // ../react/src/domains/machine-pools.ts
11584
- import { useInfiniteQuery as useInfiniteQuery7, useMutation as useMutation11, useQuery as useQuery10, useQueryClient as useQueryClient12 } from "@tanstack/react-query";
12476
+ import { useInfiniteQuery as useInfiniteQuery8, useMutation as useMutation11, useQuery as useQuery9, useQueryClient as useQueryClient12 } from "@tanstack/react-query";
11585
12477
 
11586
12478
  // ../react/src/domains/machines.ts
11587
- import { useInfiniteQuery as useInfiniteQuery8, useMutation as useMutation12, useQuery as useQuery11, useQueryClient as useQueryClient13 } from "@tanstack/react-query";
12479
+ import { useInfiniteQuery as useInfiniteQuery9, useMutation as useMutation12, useQuery as useQuery10, useQueryClient as useQueryClient13 } from "@tanstack/react-query";
11588
12480
 
11589
12481
  // ../react/src/domains/mcp-registry.ts
11590
- import { useInfiniteQuery as useInfiniteQuery9, useQuery as useQuery12, useQueryClient as useQueryClient14 } from "@tanstack/react-query";
12482
+ import { useInfiniteQuery as useInfiniteQuery10, useQuery as useQuery11, useQueryClient as useQueryClient14 } from "@tanstack/react-query";
11591
12483
  var serverInfoStaleTime = 5 * 60 * 1e3;
11592
12484
 
11593
12485
  // ../react/src/domains/mcp-server-tools.ts
11594
- import { useQuery as useQuery13 } from "@tanstack/react-query";
12486
+ import { useQuery as useQuery12 } from "@tanstack/react-query";
11595
12487
  var mcpServerToolsStaleTime = 60 * 1e3;
11596
12488
 
11597
12489
  // ../react/src/domains/me.ts
@@ -11599,10 +12491,9 @@ import { useMutation as useMutation13, useQueryClient as useQueryClient15, useSu
11599
12491
 
11600
12492
  // ../react/src/domains/memory.ts
11601
12493
  import {
11602
- skipToken,
11603
- useInfiniteQuery as useInfiniteQuery10,
12494
+ useInfiniteQuery as useInfiniteQuery11,
11604
12495
  useMutation as useMutation14,
11605
- useQuery as useQuery14,
12496
+ useQuery as useQuery13,
11606
12497
  useQueryClient as useQueryClient16
11607
12498
  } from "@tanstack/react-query";
11608
12499
  import * as z16 from "zod";
@@ -11610,55 +12501,50 @@ var memoryFileDigest = z16.object({ digest: z16.string() });
11610
12501
 
11611
12502
  // ../react/src/domains/model-providers.ts
11612
12503
  import {
11613
- useInfiniteQuery as useInfiniteQuery11,
12504
+ useInfiniteQuery as useInfiniteQuery12,
11614
12505
  useMutation as useMutation15,
11615
12506
  useQueries,
11616
- useQuery as useQuery15,
12507
+ useQuery as useQuery14,
11617
12508
  useQueryClient as useQueryClient17
11618
12509
  } from "@tanstack/react-query";
11619
12510
  import { useEffect as useEffect2 } from "react";
11620
12511
 
11621
12512
  // ../react/src/domains/org-api-keys.ts
11622
- import { useInfiniteQuery as useInfiniteQuery12, useMutation as useMutation16, useQuery as useQuery16, useQueryClient as useQueryClient18 } from "@tanstack/react-query";
12513
+ import { useInfiniteQuery as useInfiniteQuery13, useMutation as useMutation16, useQuery as useQuery15, useQueryClient as useQueryClient18 } from "@tanstack/react-query";
11623
12514
 
11624
12515
  // ../react/src/domains/org-members.ts
11625
- import { useMutation as useMutation17, useQuery as useQuery17, useQueryClient as useQueryClient19 } from "@tanstack/react-query";
12516
+ import { useMutation as useMutation17, useQuery as useQuery16, useQueryClient as useQueryClient19 } from "@tanstack/react-query";
11626
12517
 
11627
12518
  // ../react/src/domains/orgs.ts
11628
- import { useInfiniteQuery as useInfiniteQuery13, useMutation as useMutation18, useQuery as useQuery18, useQueryClient as useQueryClient20 } from "@tanstack/react-query";
12519
+ import { useInfiniteQuery as useInfiniteQuery14, useMutation as useMutation18, useQuery as useQuery17, useQueryClient as useQueryClient20 } from "@tanstack/react-query";
11629
12520
 
11630
12521
  // ../react/src/domains/personal-access-tokens.ts
11631
- import { useInfiniteQuery as useInfiniteQuery14, useMutation as useMutation19, useQueryClient as useQueryClient21 } from "@tanstack/react-query";
12522
+ import { useInfiniteQuery as useInfiniteQuery15, useMutation as useMutation19, useQueryClient as useQueryClient21 } from "@tanstack/react-query";
11632
12523
 
11633
12524
  // ../react/src/domains/project-grants.ts
11634
- import { useInfiniteQuery as useInfiniteQuery15, useMutation as useMutation20, useQueryClient as useQueryClient22 } from "@tanstack/react-query";
12525
+ import { useInfiniteQuery as useInfiniteQuery16, useMutation as useMutation20, useQueryClient as useQueryClient22 } from "@tanstack/react-query";
11635
12526
 
11636
12527
  // ../react/src/domains/projects.ts
11637
- import {
11638
- skipToken as skipToken2,
11639
- useInfiniteQuery as useInfiniteQuery16,
11640
- useQueryClient as useQueryClient23,
11641
- useSuspenseInfiniteQuery
11642
- } from "@tanstack/react-query";
12528
+ import { useInfiniteQuery as useInfiniteQuery17, useQueryClient as useQueryClient23, useSuspenseInfiniteQuery } from "@tanstack/react-query";
11643
12529
 
11644
12530
  // ../react/src/domains/secrets.ts
11645
12531
  import {
11646
- useInfiniteQuery as useInfiniteQuery17,
12532
+ useInfiniteQuery as useInfiniteQuery18,
11647
12533
  useMutation as useMutation21,
11648
- useQuery as useQuery19,
12534
+ useQuery as useQuery18,
11649
12535
  useQueryClient as useQueryClient24
11650
12536
  } from "@tanstack/react-query";
11651
12537
 
11652
12538
  // ../react/src/domains/skills.ts
11653
12539
  import {
11654
- useInfiniteQuery as useInfiniteQuery18,
12540
+ useInfiniteQuery as useInfiniteQuery19,
11655
12541
  useMutation as useMutation22,
11656
- useQuery as useQuery20,
12542
+ useQuery as useQuery19,
11657
12543
  useQueryClient as useQueryClient25
11658
12544
  } from "@tanstack/react-query";
11659
12545
 
11660
12546
  // ../react/src/domains/tool-catalog.ts
11661
- import { useQuery as useQuery21 } from "@tanstack/react-query";
12547
+ import { useQuery as useQuery20 } from "@tanstack/react-query";
11662
12548
 
11663
12549
  // src/chat.tsx
11664
12550
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
@@ -11784,6 +12670,7 @@ function SelectList({
11784
12670
  }
11785
12671
  function InteractionPrompt({
11786
12672
  interaction,
12673
+ agentID,
11787
12674
  onAnswer
11788
12675
  }) {
11789
12676
  const approval = interaction.interaction_kind === "permission";
@@ -11809,11 +12696,11 @@ function InteractionPrompt({
11809
12696
  " ",
11810
12697
  form.title
11811
12698
  ] }),
11812
- interaction.agent_name != null && /* @__PURE__ */ jsxs(Text, { children: [
12699
+ interaction.agent_id !== agentID && /* @__PURE__ */ jsxs(Text, { children: [
11813
12700
  " ",
11814
12701
  /* @__PURE__ */ jsx2(Text, { dimColor: true, children: "from subagent" }),
11815
12702
  " ",
11816
- interaction.agent_name
12703
+ (interaction.agent_name ?? "") || interaction.agent_id
11817
12704
  ] }),
11818
12705
  (form.context ?? []).map((item) => /* @__PURE__ */ jsxs(Text, { children: [
11819
12706
  " ",
@@ -11886,7 +12773,6 @@ var streamingTailLines = 8;
11886
12773
  var streamingTailChars = 1500;
11887
12774
  var zToolInput2 = z18.record(z18.string(), z18.json());
11888
12775
  var zToolOutput = z18.object({
11889
- outcome: zToolCallOutcome,
11890
12776
  contentBlocks: z18.array(zToolResultContentBlock)
11891
12777
  });
11892
12778
  function formatDuration(ms) {
@@ -11906,12 +12792,13 @@ function toolOutput(part) {
11906
12792
  if (part.state !== "output-available") return void 0;
11907
12793
  const output = zToolOutput.safeParse(part.output);
11908
12794
  if (!output.success) return void 0;
12795
+ const outcome = part.toolOutcome ?? "succeeded";
11909
12796
  for (const block of output.data.contentBlocks) {
11910
12797
  if (block.type !== "text" && block.type !== "structured_data") continue;
11911
12798
  const text = blockText(block);
11912
- if (text.trim() !== "") return { outcome: output.data.outcome, text };
12799
+ if (text.trim() !== "") return { outcome, text };
11913
12800
  }
11914
- return { outcome: output.data.outcome, text: void 0 };
12801
+ return { outcome, text: void 0 };
11915
12802
  }
11916
12803
  function ToolPartView({ part }) {
11917
12804
  const summary = useMemo2(() => toolSummary(part), [part]);
@@ -12187,6 +13074,7 @@ function Chat({ scope }) {
12187
13074
  InteractionPrompt,
12188
13075
  {
12189
13076
  interaction,
13077
+ agentID: scope.agentID,
12190
13078
  onAnswer: (answers) => {
12191
13079
  void resolveInteraction.mutateAsync({
12192
13080
  interactionID: interaction.id,
@@ -12268,14 +13156,110 @@ var agentEventsStreamOp = customOp({
12268
13156
  }
12269
13157
  });
12270
13158
 
13159
+ // src/agent-wait.ts
13160
+ import * as z20 from "zod";
13161
+ var DEFAULT_AGENT_WAIT_TIMEOUT_SECONDS = 300;
13162
+ var DEFAULT_AGENT_WAIT_STATE = "idle";
13163
+ var zWaitState = zAgentActivity.shape.state;
13164
+ var zAgentWaitStateFlags = z20.array(z20.string()).optional().transform((value) => value ?? []);
13165
+ var zAgentWaitTimeoutSeconds = z20.number().int().gte(0).optional().transform((value) => value ?? DEFAULT_AGENT_WAIT_TIMEOUT_SECONDS);
13166
+ function collectRepeatableFlag(value, previous) {
13167
+ return [...previous ?? [], value];
13168
+ }
13169
+ function parseAgentWaitStates(values) {
13170
+ const selected = values.length === 0 ? [DEFAULT_AGENT_WAIT_STATE] : values;
13171
+ const states = [];
13172
+ for (const value of selected) {
13173
+ const parsed = zWaitState.safeParse(value);
13174
+ if (!parsed.success) {
13175
+ throw new CliInputError(
13176
+ `invalid --activity-state ${value}: expected running, idle, waiting_on_interaction, or archived`
13177
+ );
13178
+ }
13179
+ if (!states.includes(parsed.data)) states.push(parsed.data);
13180
+ }
13181
+ return states;
13182
+ }
13183
+ function agentWaitDeadline(nowMs, timeoutSeconds) {
13184
+ if (timeoutSeconds === 0) {
13185
+ return new Date(nowMs + 100 * 365 * 24 * 60 * 60 * 1e3).toISOString();
13186
+ }
13187
+ return new Date(nowMs + timeoutSeconds * 1e3).toISOString();
13188
+ }
13189
+ function agentMatchesWaitStates(agent, states) {
13190
+ const current = agent.activity?.state;
13191
+ if (current === void 0 || !states.includes(current)) return false;
13192
+ return current !== "idle" || !isAgentActive(agent);
13193
+ }
13194
+ function agentWaitExpiredMessage(states, timeoutSeconds) {
13195
+ const wanted = states.join(", ");
13196
+ const note3 = states.includes("idle") ? " (idle also waits for subagents and background work to finish)" : "";
13197
+ if (timeoutSeconds === 0) {
13198
+ return `agent did not reach activity state ${wanted}${note3}`;
13199
+ }
13200
+ return `agent did not reach activity state ${wanted} within ${timeoutSeconds}s${note3}`;
13201
+ }
13202
+ function agentArchivedMessage(states) {
13203
+ return `agent was archived before reaching activity state ${states.join(", ")}`;
13204
+ }
13205
+ async function waitForAgent(input) {
13206
+ return pollUntilDeadline({
13207
+ expiresAt: agentWaitDeadline(Date.now(), input.timeoutSeconds),
13208
+ expiredMessage: agentWaitExpiredMessage(input.states, input.timeoutSeconds),
13209
+ async fetchOnce(signal) {
13210
+ const { data } = await sdk_gen_exports.getAgent({
13211
+ client: input.client,
13212
+ path: { orgID: input.orgID, projectID: input.projectID, agentID: input.agentID },
13213
+ signal
13214
+ });
13215
+ if (agentMatchesWaitStates(data.agent, input.states)) return data;
13216
+ const archived = data.agent.state === "archived" || data.agent.activity?.state === "archived";
13217
+ if (archived) throw new PollTerminalError(agentArchivedMessage(input.states));
13218
+ return void 0;
13219
+ }
13220
+ });
13221
+ }
13222
+ var agentWaitOp = customOp({
13223
+ verb: "wait",
13224
+ summary: "Wait until an agent reaches an activity state",
13225
+ path: zListAgentsPath,
13226
+ configure: (command) => {
13227
+ command.argument("<agent-id>").option(
13228
+ "--activity-state <state>",
13229
+ "activity state to wait for; repeatable (default: idle, which also waits for subagents and background work)",
13230
+ collectRepeatableFlag
13231
+ ).option(
13232
+ "--timeout <seconds>",
13233
+ "seconds to wait before failing; 0 waits until interrupted (default: 300)",
13234
+ parseNumberFlag
13235
+ ).option("--json", "print the raw JSON response");
13236
+ },
13237
+ run: async ({ client: client2, path, args, options }) => {
13238
+ const agentID = parseWithSchema(zAgentId, args[0], "agent id");
13239
+ const states = parseAgentWaitStates(
13240
+ parseWithSchema(zAgentWaitStateFlags, options.activityState, "--activity-state")
13241
+ );
13242
+ const timeoutSeconds = parseWithSchema(zAgentWaitTimeoutSeconds, options.timeout, "--timeout");
13243
+ const response = await waitForAgent({
13244
+ client: client2,
13245
+ orgID: path.orgID,
13246
+ projectID: path.projectID,
13247
+ agentID,
13248
+ states,
13249
+ timeoutSeconds
13250
+ });
13251
+ renderResult(zOptionalRenderValue.parse(response), options.json === true);
13252
+ }
13253
+ });
13254
+
12271
13255
  // src/config-attachment.ts
12272
13256
  import { readFileSync as readFileSync2 } from "node:fs";
12273
- import * as z20 from "zod";
12274
- var zConfigSourceAttachment = z20.object({
12275
- file: z20.string().min(1).optional().describe("path to an agent config file (.yaml, .yml, or .json)"),
12276
- source: z20.string().min(1).optional().describe("inline agent config source (YAML or JSON)")
13257
+ import * as z21 from "zod";
13258
+ var zConfigSourceAttachment = z21.object({
13259
+ file: z21.string().min(1).optional().describe("path to an agent config file (.yaml, .yml, or .json)"),
13260
+ source: z21.string().min(1).optional().describe("inline agent config source (YAML or JSON)")
12277
13261
  });
12278
- var zConfigAttachment = z20.object({
13262
+ var zConfigAttachment = z21.object({
12279
13263
  config: zAgentConfigId.optional().describe("existing agent config ID"),
12280
13264
  ...zConfigSourceAttachment.shape
12281
13265
  });
@@ -12292,8 +13276,8 @@ function fileFormat(filePath) {
12292
13276
  throw new CliInputError(`config file must end in .yaml, .yml, or .json: ${filePath}`);
12293
13277
  }
12294
13278
  var zDefinitionText = zJsonText.pipe(
12295
- z20.custom(
12296
- (value) => z20.record(z20.string(), z20.unknown()).safeParse(value).success,
13279
+ z21.custom(
13280
+ (value) => z21.record(z21.string(), z21.unknown()).safeParse(value).success,
12297
13281
  "expected a JSON object"
12298
13282
  )
12299
13283
  );
@@ -12379,13 +13363,13 @@ function formatVoid(message = "ok") {
12379
13363
  }
12380
13364
 
12381
13365
  // src/integration-setup.ts
12382
- import * as z23 from "zod";
13366
+ import * as z24 from "zod";
12383
13367
 
12384
13368
  // src/slack-setup.ts
12385
- import * as z22 from "zod";
13369
+ import * as z23 from "zod";
12386
13370
 
12387
13371
  // src/mcp-oauth.ts
12388
- import * as z21 from "zod";
13372
+ import * as z22 from "zod";
12389
13373
  async function authorizeMcpOAuthSecret(options) {
12390
13374
  const { data: start } = await sdk_gen_exports.startSecretMcpoAuth({
12391
13375
  client: options.client,
@@ -12396,17 +13380,18 @@ async function authorizeMcpOAuthSecret(options) {
12396
13380
  return pollUntilDeadline({
12397
13381
  expiresAt: start.expires_at,
12398
13382
  expiredMessage: "MCP OAuth authorization expired before the secret was created",
12399
- async fetchOnce() {
13383
+ async fetchOnce(signal) {
12400
13384
  const { data } = await sdk_gen_exports.listSecrets({
12401
13385
  client: options.client,
12402
13386
  path: { orgID: options.orgId },
12403
- query: { mcp_oauth_flow_id: start.flow_id, limit: 1 }
13387
+ query: { mcp_oauth_flow_id: start.flow_id, limit: 1 },
13388
+ signal
12404
13389
  });
12405
13390
  return data.data[0];
12406
13391
  }
12407
13392
  });
12408
13393
  }
12409
- var zBrowserFlag = z21.boolean().default(true).describe("open the authorization URL in a browser");
13394
+ var zBrowserFlag = z22.boolean().default(true).describe("open the authorization URL in a browser");
12410
13395
  function openAuthorizationUrl(report, title, url4, browser) {
12411
13396
  report.url(title, url4);
12412
13397
  if (browser) {
@@ -12440,15 +13425,15 @@ async function runMcpOAuth(context) {
12440
13425
  }
12441
13426
 
12442
13427
  // src/slack-setup.ts
12443
- var zSlackBody = z22.object({
12444
- app_name: z22.string().optional().describe("name for a new Slack app"),
12445
- app_configuration_token: z22.string().optional().describe("Slack app configuration token for a new app"),
12446
- icon_filename: z22.string().optional().describe("filename for the new Slack app icon"),
12447
- icon_data_base64: z22.string().optional().describe("base64-encoded Slack app icon"),
12448
- client_id: z22.string().optional().describe("existing Slack app client ID"),
12449
- client_secret: z22.string().optional().describe("existing Slack app client secret"),
12450
- signing_secret: z22.string().optional().describe("existing Slack app signing secret"),
12451
- return_to: z22.string().optional().describe("console-relative path opened after authorization"),
13428
+ var zSlackBody = z23.object({
13429
+ app_name: z23.string().optional().describe("name for a new Slack app"),
13430
+ app_configuration_token: z23.string().optional().describe("Slack app configuration token for a new app"),
13431
+ icon_filename: z23.string().optional().describe("filename for the new Slack app icon"),
13432
+ icon_data_base64: z23.string().optional().describe("base64-encoded Slack app icon"),
13433
+ client_id: z23.string().optional().describe("existing Slack app client ID"),
13434
+ client_secret: z23.string().optional().describe("existing Slack app client secret"),
13435
+ signing_secret: z23.string().optional().describe("existing Slack app signing secret"),
13436
+ return_to: z23.string().optional().describe("console-relative path opened after authorization"),
12452
13437
  browser: zBrowserFlag
12453
13438
  });
12454
13439
  function parseRequest(body) {
@@ -12477,7 +13462,7 @@ function parseRequest(body) {
12477
13462
  if (!result2.success) {
12478
13463
  throw new CliInputError(
12479
13464
  `invalid existing Slack app parameters:
12480
- ${z22.prettifyError(result2.error)}`
13465
+ ${z23.prettifyError(result2.error)}`
12481
13466
  );
12482
13467
  }
12483
13468
  return { kind: "existing-app", body: result2.data };
@@ -12498,7 +13483,7 @@ ${z22.prettifyError(result2.error)}`
12498
13483
  if (!result.success) {
12499
13484
  throw new CliInputError(
12500
13485
  `invalid Slack app parameters:
12501
- ${z22.prettifyError(result.error)}
13486
+ ${z23.prettifyError(result.error)}
12502
13487
  Pass --app-name and --app-configuration-token, or existing app credentials.`
12503
13488
  );
12504
13489
  }
@@ -12542,8 +13527,8 @@ async function runSlackIntegration(context) {
12542
13527
  integration = await pollUntilDeadline({
12543
13528
  expiresAt: start.expires_at,
12544
13529
  expiredMessage: "Slack authorization expired before the integration connected",
12545
- async fetchOnce() {
12546
- const { data } = await sdk_gen_exports.getIntegration({ client: client2, path: setupPath });
13530
+ async fetchOnce(signal) {
13531
+ const { data } = await sdk_gen_exports.getIntegration({ client: client2, path: setupPath, signal });
12547
13532
  return data.state === "active" && data.last_oauth_flow_id === start.flow_id ? data : void 0;
12548
13533
  }
12549
13534
  });
@@ -12563,8 +13548,8 @@ async function runSlackIntegration(context) {
12563
13548
  }
12564
13549
 
12565
13550
  // src/integration-setup.ts
12566
- var zIntegrationProfilesBody = z23.object({
12567
- profile_ids: z23.array(zAgentProfileId).max(16).describe("repeat for each offered profile; preserves other integration settings")
13551
+ var zIntegrationProfilesBody = z24.object({
13552
+ profile_ids: z24.array(zAgentProfileId).max(16).describe("repeat for each offered profile; preserves other integration settings")
12568
13553
  });
12569
13554
  async function runIntegrationProfilesUpdate(context) {
12570
13555
  const { client: client2, path, body, report } = context;
@@ -12665,7 +13650,7 @@ import { spawn as spawn2, spawnSync } from "node:child_process";
12665
13650
  import { accessSync, constants, existsSync as existsSync2, readdirSync, readFileSync as readFileSync3 } from "node:fs";
12666
13651
  import { homedir as homedir2, release } from "node:os";
12667
13652
  import { basename, dirname as dirname2, isAbsolute, join as join2, resolve } from "node:path";
12668
- import * as z24 from "zod";
13653
+ import * as z25 from "zod";
12669
13654
  var zMachineSetupBody = zConnectByoMachineRequest.extend({
12670
13655
  project_ids: zConnectByoMachineRequest.shape.project_ids.describe(
12671
13656
  "project ID to grant the machine to, from omnara projects list"
@@ -12706,9 +13691,9 @@ var daemonConfigFileName = "daemon.json";
12706
13691
  var installLockFileName = "install.lock";
12707
13692
  var daemonLockFileName = "daemon.lock";
12708
13693
  var daemonLockPollMs = 250;
12709
- var zDaemonConfigFile = z24.looseObject({
12710
- machine_id: z24.string().optional(),
12711
- api_url: z24.string().optional()
13694
+ var zDaemonConfigFile = z25.looseObject({
13695
+ machine_id: z25.string().optional(),
13696
+ api_url: z25.string().optional()
12712
13697
  });
12713
13698
  function daemonHome() {
12714
13699
  const override = process.env.OMNARA_HOME;
@@ -12990,10 +13975,10 @@ function runInstaller(report, apiUrl, token, machineId, home) {
12990
13975
 
12991
13976
  // src/mcp-add.ts
12992
13977
  import { isMap, isScalar as isScalar2, parseDocument } from "yaml";
12993
- import * as z25 from "zod";
13978
+ import * as z26 from "zod";
12994
13979
  var SERVER_KEY_PATTERN = /^[a-zA-Z][a-zA-Z0-9-]{0,31}$/;
12995
13980
  var zMcpAddBody = zMcpoAuthStartRequest.omit({ owner: true, name: true }).extend({
12996
- server_name: z25.string().regex(
13981
+ server_name: z26.string().regex(
12997
13982
  SERVER_KEY_PATTERN,
12998
13983
  "must start with a letter and contain at most 32 letters, digits, or hyphens"
12999
13984
  ).describe("MCP server key used in the agent config"),
@@ -13006,9 +13991,9 @@ function targetLabel(target) {
13006
13991
  function serverEntry(url4, secretId) {
13007
13992
  return { url: url4, auth: { type: "oauth", secret_id: secretId } };
13008
13993
  }
13009
- var zJsonRecord = z25.record(z25.string(), z25.json());
13994
+ var zJsonRecord = z26.record(z26.string(), z26.json());
13010
13995
  var zDefinitionText2 = zJsonText.pipe(
13011
- z25.custom((value) => zJsonRecord.safeParse(value).success)
13996
+ z26.custom((value) => zJsonRecord.safeParse(value).success)
13012
13997
  );
13013
13998
  function prepareJsonConfig(configId, source, serverName, mcpUrl) {
13014
13999
  const parsed = zDefinitionText2.safeParse(source);
@@ -13178,9 +14163,9 @@ function runProfileMcpAdd(context) {
13178
14163
  // src/memory-files.ts
13179
14164
  import { open, writeFile } from "node:fs/promises";
13180
14165
  import { buffer } from "node:stream/consumers";
13181
- import * as z26 from "zod";
13182
- var zMemoryUploadBody = z26.object({
13183
- file: z26.string().min(1).describe("local file to upload")
14166
+ import * as z27 from "zod";
14167
+ var zMemoryUploadBody = z27.object({
14168
+ file: z27.string().min(1).describe("local file to upload")
13184
14169
  });
13185
14170
  async function loadMemoryUpload(file) {
13186
14171
  const handle = await open(file, "r");
@@ -13212,7 +14197,7 @@ var memoryDownloadOp = customOp({
13212
14197
  { path: options.path ?? null },
13213
14198
  "query flags"
13214
14199
  );
13215
- const output = parseWithSchema(z26.string().min(1), options.output, "--output");
14200
+ const output = parseWithSchema(z27.string().min(1), options.output, "--output");
13216
14201
  const { response } = await sdk_gen_exports.downloadMemoryFile({ client: client2, path, query, parseAs: "stream" });
13217
14202
  const digest = response.headers.get(FILE_DIGEST_HEADER);
13218
14203
  if (!digest) throw new CliInputError("file response is missing its digest");
@@ -13226,10 +14211,10 @@ var memoryDownloadOp = customOp({
13226
14211
  import { readdirSync as readdirSync2, readFileSync as readFileSync4, statSync } from "node:fs";
13227
14212
  import { basename as basename2, dirname as dirname3, join as join3, resolve as resolve2 } from "node:path";
13228
14213
  import * as tar from "tar";
13229
- import * as z27 from "zod";
13230
- var zCreateSkillCliBody = z27.object({
14214
+ import * as z28 from "zod";
14215
+ var zCreateSkillCliBody = z28.object({
13231
14216
  owner: zSkillOwnerInput,
13232
- archive: z27.string().min(1).describe("path to a skill directory (packed automatically) or a .zip/.tar.gz archive")
14217
+ archive: z28.string().min(1).describe("path to a skill directory (packed automatically) or a .zip/.tar.gz archive")
13233
14218
  });
13234
14219
  var ARCHIVE_SUFFIXES = [".zip", ".tar.gz", ".tgz"];
13235
14220
  function assertPackable(dir) {
@@ -13282,9 +14267,18 @@ var commandGroups = [
13282
14267
  verb: "list",
13283
14268
  summary: "List agents in a project",
13284
14269
  fn: sdk_gen_exports.listAgents,
13285
- format: (response) => formatTable(["id", "name", "state", "model", "parent_agent_id", "created_at"])({
14270
+ format: (response) => formatTable([
14271
+ "id",
14272
+ "name",
14273
+ "state",
14274
+ "activity",
14275
+ "model",
14276
+ "parent_agent_id",
14277
+ "created_at"
14278
+ ])({
13286
14279
  data: response.data.map((agent) => ({
13287
14280
  ...agent,
14281
+ activity: agent.activity?.state,
13288
14282
  model: agent.model?.name,
13289
14283
  parent_agent_id: agent.parent_agent_id ?? ""
13290
14284
  })),
@@ -13300,6 +14294,7 @@ var commandGroups = [
13300
14294
  format: formatRecord(),
13301
14295
  path: zGetAgentPath
13302
14296
  }),
14297
+ agentWaitOp,
13303
14298
  op({
13304
14299
  verb: "launch",
13305
14300
  summary: "Launch a new agent",
@@ -13309,7 +14304,7 @@ var commandGroups = [
13309
14304
  body: zConfigAttachment.extend({
13310
14305
  profile: zAgentProfileId.optional().describe("agent profile ID; runs its current config unless a config is given"),
13311
14306
  name: zAgentName.optional(),
13312
- message: z28.string().optional()
14307
+ message: z29.string().optional()
13313
14308
  }),
13314
14309
  transformBody: ({ profile, name, message, ...attachment }) => ({
13315
14310
  name,
@@ -13349,7 +14344,7 @@ var commandGroups = [
13349
14344
  flowOp({
13350
14345
  verb: "mcp-add",
13351
14346
  summary: "Create an OAuth secret and add an MCP server to an agent",
13352
- path: z28.object({
14347
+ path: z29.object({
13353
14348
  orgID: zOrganizationId,
13354
14349
  projectID: zProjectId,
13355
14350
  agentID: zAgentId
@@ -13365,7 +14360,7 @@ var commandGroups = [
13365
14360
  format: (response) => formatRecord()(response.agent_input),
13366
14361
  path: zCreateAgentInputPath,
13367
14362
  body: zCreateAgentInputBody.partial({ content_blocks: true }).extend({
13368
- message: z28.string().optional().describe("plain text to send as a single text block")
14363
+ message: z29.string().optional().describe("plain text to send as a single text block")
13369
14364
  }).transform(({ message, content_blocks, ...rest }, ctx) => {
13370
14365
  if (content_blocks !== void 0 && message === void 0) {
13371
14366
  return { ...rest, content_blocks };
@@ -13374,7 +14369,7 @@ var commandGroups = [
13374
14369
  return { ...rest, content_blocks: [{ type: "text", text: message }] };
13375
14370
  }
13376
14371
  ctx.addIssue("pass exactly one of --message or --content-blocks");
13377
- return z28.NEVER;
14372
+ return z29.NEVER;
13378
14373
  })
13379
14374
  })
13380
14375
  ],
@@ -13391,8 +14386,8 @@ var commandGroups = [
13391
14386
  format: formatAgentEventList,
13392
14387
  path: zListEventsPath,
13393
14388
  query: zListEventsQuery.extend({
13394
- before_sequence: z28.int().gte(0).optional(),
13395
- after_sequence: z28.int().gte(0).optional()
14389
+ before_sequence: z29.int().gte(0).optional(),
14390
+ after_sequence: z29.int().gte(0).optional()
13396
14391
  })
13397
14392
  }),
13398
14393
  agentEventsStreamOp
@@ -13479,6 +14474,23 @@ var commandGroups = [
13479
14474
  path: zCreateProjectPath,
13480
14475
  body: zCreateProjectBody
13481
14476
  }),
14477
+ op({
14478
+ verb: "get",
14479
+ summary: "Fetch a project",
14480
+ fn: sdk_gen_exports.getProject,
14481
+ format: formatRecord(),
14482
+ path: zGetProjectPath,
14483
+ positional: ["projectID"]
14484
+ }),
14485
+ op({
14486
+ verb: "update",
14487
+ summary: "Rename a project",
14488
+ fn: sdk_gen_exports.updateProject,
14489
+ format: formatRecord(),
14490
+ path: zUpdateProjectPath,
14491
+ body: zUpdateProjectBody,
14492
+ positional: ["projectID"]
14493
+ }),
13482
14494
  op({
13483
14495
  verb: "delete",
13484
14496
  summary: "Delete a project",
@@ -13810,6 +14822,13 @@ var commandGroups = [
13810
14822
  path: zListConfiguredModelsPath,
13811
14823
  query: zListConfiguredModelsQuery
13812
14824
  }),
14825
+ op({
14826
+ verb: "get",
14827
+ summary: "Fetch a configured model",
14828
+ fn: sdk_gen_exports.getConfiguredModel,
14829
+ format: formatRecord(),
14830
+ path: zGetConfiguredModelPath
14831
+ }),
13813
14832
  op({
13814
14833
  verb: "create",
13815
14834
  summary: "Configure a model",
@@ -13888,7 +14907,7 @@ var commandGroups = [
13888
14907
  flowOp({
13889
14908
  verb: "mcp-oauth",
13890
14909
  summary: "Create a secret through an MCP server OAuth flow",
13891
- path: z28.object({ orgID: zOrganizationId }),
14910
+ path: z29.object({ orgID: zOrganizationId }),
13892
14911
  body: zMcpOAuthBody,
13893
14912
  run: runMcpOAuth
13894
14913
  })
@@ -14095,7 +15114,7 @@ var commandGroups = [
14095
15114
  flowOp({
14096
15115
  verb: "mcp-add",
14097
15116
  summary: "Create an OAuth secret and add an MCP server to an agent profile",
14098
- path: z28.object({
15117
+ path: z29.object({
14099
15118
  orgID: zOrganizationId,
14100
15119
  projectID: zProjectId,
14101
15120
  agentProfileID: zAgentProfileId
@@ -14182,6 +15201,13 @@ var commandGroups = [
14182
15201
  path: zListSkillGrantsPath,
14183
15202
  query: zListSkillGrantsQuery
14184
15203
  }),
15204
+ op({
15205
+ verb: "get",
15206
+ summary: "Fetch a skill grant",
15207
+ fn: sdk_gen_exports.getSkillGrant,
15208
+ format: formatRecord(),
15209
+ path: zGetSkillGrantPath
15210
+ }),
14185
15211
  op({
14186
15212
  verb: "add",
14187
15213
  summary: "Grant a skill to a project",
@@ -14218,6 +15244,13 @@ var commandGroups = [
14218
15244
  path: zListSecretGrantsPath,
14219
15245
  query: zListSecretGrantsQuery
14220
15246
  }),
15247
+ op({
15248
+ verb: "get",
15249
+ summary: "Fetch a secret grant",
15250
+ fn: sdk_gen_exports.getSecretGrant,
15251
+ format: formatRecord(),
15252
+ path: zGetSecretGrantPath
15253
+ }),
14221
15254
  op({
14222
15255
  verb: "add",
14223
15256
  summary: "Grant a secret to a project",
@@ -14254,6 +15287,13 @@ var commandGroups = [
14254
15287
  path: zListProjectMachineGrantsPath,
14255
15288
  query: zListProjectMachineGrantsQuery
14256
15289
  }),
15290
+ op({
15291
+ verb: "get",
15292
+ summary: "Fetch a machine grant",
15293
+ fn: sdk_gen_exports.getProjectMachineGrant,
15294
+ format: (response) => formatRecord()(response.grant),
15295
+ path: zGetProjectMachineGrantPath
15296
+ }),
14257
15297
  op({
14258
15298
  verb: "add",
14259
15299
  summary: "Grant a machine to a project",
@@ -14338,6 +15378,13 @@ var commandGroups = [
14338
15378
  path: zListProjectModelGrantsPath,
14339
15379
  query: zListProjectModelGrantsQuery
14340
15380
  }),
15381
+ op({
15382
+ verb: "get",
15383
+ summary: "Fetch a model grant",
15384
+ fn: sdk_gen_exports.getProjectModelGrant,
15385
+ format: (response) => formatRecord()(response.grant),
15386
+ path: zGetProjectModelGrantPath
15387
+ }),
14341
15388
  op({
14342
15389
  verb: "add",
14343
15390
  summary: "Grant a configured model to a project",