omnara 1.0.41 → 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 +1354 -293
  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}$/)
@@ -3918,7 +4060,6 @@ var zCreateMachinePath = z.object({
3918
4060
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/)
3919
4061
  });
3920
4062
  var zCreateMachineResponse = zMachine;
3921
- var zConnectByoMachineBody = zConnectByoMachineRequest;
3922
4063
  var zConnectByoMachinePath = z.object({
3923
4064
  orgID: zOrganizationId
3924
4065
  });
@@ -3996,6 +4137,12 @@ var zDeleteConfiguredModelPath = z.object({
3996
4137
  configuredModelID: z.string().regex(/^mdl_[a-z2-7]{26}$/)
3997
4138
  });
3998
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;
3999
4146
  var zUpdateConfiguredModelBody = zUpdateConfiguredModelRequest;
4000
4147
  var zUpdateConfiguredModelPath = z.object({
4001
4148
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
@@ -4026,6 +4173,12 @@ var zDeleteProjectModelGrantPath = z.object({
4026
4173
  modelGrantID: z.string().regex(/^pmog_[a-z2-7]{26}$/)
4027
4174
  });
4028
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;
4029
4182
  var zUpdateProjectModelGrantBody = zUpdateProjectModelGrantRequest;
4030
4183
  var zUpdateProjectModelGrantPath = z.object({
4031
4184
  orgID: z.string().regex(/^org_[a-z2-7]{26}$/),
@@ -4235,6 +4388,13 @@ var zDeleteIntegrationSubscriptionPath = z.object({
4235
4388
  subscriptionID: zIntegrationSubscriptionId
4236
4389
  });
4237
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;
4238
4398
  var zConfigureIntegrationBody = zConfigureIntegrationRequest;
4239
4399
  var zConfigureIntegrationPath = z.object({
4240
4400
  orgID: zOrganizationId,
@@ -4367,6 +4527,32 @@ function parseRetryAfter(value) {
4367
4527
  return Math.max(at - Date.now(), 0);
4368
4528
  }
4369
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
+
4370
4556
  // ../sdk/src/server-sent-events.ts
4371
4557
  function createServerSentEventParser() {
4372
4558
  let parts = [];
@@ -4429,9 +4615,6 @@ var AgentEventStreamError = class extends Error {
4429
4615
  }
4430
4616
  };
4431
4617
  var streamUrl = "/orgs/{orgID}/projects/{projectID}/agents/{agentID}/events/stream";
4432
- var retryBaseDelayMs = 1e3;
4433
- var retryMaximumDelayMs = 3e4;
4434
- var retryAfterMaximumDelayMs = 6e4;
4435
4618
  var stableConnectionResetMs = 1e4;
4436
4619
  var stallTimeoutMs = 35e3;
4437
4620
  var zDurableCursor = z5.object({
@@ -4448,27 +4631,6 @@ function retryable(error) {
4448
4631
  if (error.kind === "api") return error.code === "service_unavailable";
4449
4632
  return error.kind === "http" && (error.status === 408 || error.status === 429 || error.status != null && error.status >= 500);
4450
4633
  }
4451
- function reconnectDelay(attempt) {
4452
- const maximum = Math.min(retryBaseDelayMs * 2 ** Math.max(attempt - 1, 0), retryMaximumDelayMs);
4453
- return Math.floor(Math.random() * maximum);
4454
- }
4455
- function abortableDelay(ms, signal) {
4456
- if (signal?.aborted === true) return Promise.resolve(false);
4457
- return new Promise((resolve3) => {
4458
- const timeout = globalThis.setTimeout(() => {
4459
- finish(true);
4460
- }, ms);
4461
- const onAbort = () => {
4462
- finish(false);
4463
- };
4464
- function finish(completed) {
4465
- globalThis.clearTimeout(timeout);
4466
- signal?.removeEventListener("abort", onAbort);
4467
- resolve3(completed);
4468
- }
4469
- signal?.addEventListener("abort", onAbort, { once: true });
4470
- });
4471
- }
4472
4634
  async function settleWithin(pending, ms, attempt) {
4473
4635
  let timer;
4474
4636
  const deadline = new Promise((_, reject) => {
@@ -4486,7 +4648,8 @@ async function settleWithin(pending, ms, attempt) {
4486
4648
  }
4487
4649
  async function* openConnection(client2, { path, query, headers }, callerSignal) {
4488
4650
  const attempt = new AbortController();
4489
- const signal = callerSignal == null ? attempt.signal : AbortSignal.any([callerSignal, attempt.signal]);
4651
+ const disposeCaller = forwardAbort(callerSignal, attempt);
4652
+ const { signal } = attempt;
4490
4653
  let reader;
4491
4654
  try {
4492
4655
  const dispatch = { started: false };
@@ -4550,7 +4713,9 @@ async function* openConnection(client2, { path, query, headers }, callerSignal)
4550
4713
  } catch (error) {
4551
4714
  throw error instanceof AgentEventStreamError ? error : streamError("transport", "Agent event stream disconnected", { cause: error });
4552
4715
  } finally {
4716
+ disposeCaller();
4553
4717
  await reader?.cancel().catch(() => void 0);
4718
+ reader?.releaseLock();
4554
4719
  }
4555
4720
  }
4556
4721
  function decodeFrame(text) {
@@ -4614,7 +4779,7 @@ async function* openAgentEventStream({
4614
4779
  consecutiveFailures = 0;
4615
4780
  }
4616
4781
  consecutiveFailures += 1;
4617
- const delayMs = Math.max(reconnectDelay(consecutiveFailures), error.retryAfterMs ?? 0);
4782
+ const delayMs = Math.max(retryDelay(consecutiveFailures), error.retryAfterMs ?? 0);
4618
4783
  onConnectionStateChange?.({
4619
4784
  state: "reconnecting",
4620
4785
  attempt: consecutiveFailures,
@@ -4708,7 +4873,7 @@ function createSseClient({
4708
4873
  let lastEventId;
4709
4874
  const sleep = sseSleepFn ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
4710
4875
  const createStream = async function* () {
4711
- let retryDelay = sseDefaultRetryDelay ?? 3e3;
4876
+ let retryDelay2 = sseDefaultRetryDelay ?? 3e3;
4712
4877
  let attempt = 0;
4713
4878
  const signal = options.signal ?? new AbortController().signal;
4714
4879
  while (true) {
@@ -4765,7 +4930,7 @@ function createSseClient({
4765
4930
  } else if (line.startsWith("retry:")) {
4766
4931
  const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
4767
4932
  if (!Number.isNaN(parsed)) {
4768
- retryDelay = parsed;
4933
+ retryDelay2 = parsed;
4769
4934
  }
4770
4935
  }
4771
4936
  }
@@ -4792,7 +4957,7 @@ function createSseClient({
4792
4957
  data,
4793
4958
  event: eventName,
4794
4959
  id: lastEventId,
4795
- retry: retryDelay
4960
+ retry: retryDelay2
4796
4961
  });
4797
4962
  if (dataLines.length) {
4798
4963
  yield data;
@@ -4809,7 +4974,7 @@ function createSseClient({
4809
4974
  if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
4810
4975
  break;
4811
4976
  }
4812
- const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
4977
+ const backoff = Math.min(retryDelay2 * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
4813
4978
  await sleep(backoff);
4814
4979
  }
4815
4980
  }
@@ -5465,6 +5630,508 @@ var createClient = (config2 = {}) => {
5465
5630
  // ../sdk/src/generated/client.gen.ts
5466
5631
  var client = createClient(createConfig({ baseUrl: "https://api.omnara.com/v1", throwOnError: true }));
5467
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
+
5468
6135
  // ../sdk/src/client.ts
5469
6136
  var httpMethods = [
5470
6137
  "connect",
@@ -5504,28 +6171,43 @@ function normalizeRequestOptions(options) {
5504
6171
  }
5505
6172
  return normalized;
5506
6173
  }
5507
- 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
+ };
5508
6181
  const { request } = client2;
5509
- client2.request = (options) => request(normalizeRequestOptions(options));
6182
+ client2.request = (options) => requestWithPolicy(
6183
+ client2.getConfig(),
6184
+ normalizeRequestOptions(options),
6185
+ (overrides) => request(normalizeRequestOptions({ ...options, ...overrides }))
6186
+ );
5510
6187
  for (const method of httpMethods) {
5511
- const dispatch = client2[method];
5512
- client2[method] = (options) => dispatch(normalizeRequestOptions(options));
6188
+ const requestMethod = method.toUpperCase();
6189
+ client2[method] = (options) => client2.request({ ...options, method: requestMethod });
5513
6190
  const sseDispatch = client2.sse[method];
5514
6191
  client2.sse[method] = (options) => sseDispatch(normalizeRequestOptions(options));
5515
6192
  }
5516
6193
  }
5517
- patchGeneratedRequests(client);
6194
+ client.setConfig({ maxRetries: 0, timeoutMs: 0 });
6195
+ configureRequests(client);
5518
6196
  function createOmnaraClient(options = {}) {
5519
6197
  const client2 = createClient(
5520
6198
  createConfig({
5521
6199
  throwOnError: true
5522
6200
  })
5523
6201
  );
6202
+ configureRequests(client2);
5524
6203
  client2.setConfig({
5525
6204
  baseUrl: options.baseUrl ?? client.getConfig().baseUrl,
5526
6205
  credentials: options.credentials,
5527
6206
  headers: options.headers,
5528
- fetch: options.fetch
6207
+ fetch: options.fetch,
6208
+ maxRetries: options.maxRetries,
6209
+ timeoutMs: options.timeoutMs,
6210
+ onRequestComplete: options.onRequestComplete
5529
6211
  });
5530
6212
  const { auth } = options;
5531
6213
  if (auth) {
@@ -5538,139 +6220,9 @@ function createOmnaraClient(options = {}) {
5538
6220
  if (!response.ok) throw await ApiError.fromResponse(response);
5539
6221
  return response;
5540
6222
  });
5541
- patchGeneratedRequests(client2);
5542
6223
  return client2;
5543
6224
  }
5544
6225
 
5545
- // ../sdk/src/device.ts
5546
- import * as z7 from "zod";
5547
- var OMNARA_CLI_OAUTH_CLIENT_ID = "omnara-cli";
5548
- var OAUTH_DEVICE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
5549
- var zAuthorizationServerMetadata = z7.object({
5550
- issuer: z7.url(),
5551
- device_authorization_endpoint: z7.url(),
5552
- token_endpoint: z7.url(),
5553
- grant_types_supported: z7.array(z7.string()),
5554
- token_endpoint_auth_methods_supported: z7.array(z7.string())
5555
- });
5556
- var zDeviceAuthStartResponse = z7.object({
5557
- device_code: z7.string().min(1),
5558
- user_code: z7.string().min(1),
5559
- verification_uri: z7.string().min(1),
5560
- verification_uri_complete: z7.string().min(1),
5561
- expires_in: z7.number().int().positive(),
5562
- interval: z7.number().int().positive()
5563
- });
5564
- var zDeviceAuthErrorResponse = z7.object({
5565
- error: z7.string().min(1),
5566
- error_description: z7.string().optional()
5567
- });
5568
- var zDeviceAuthFailure = zJsonText.pipe(zDeviceAuthErrorResponse);
5569
- var zDeviceAuthApprovedResponse = z7.object({
5570
- access_token: z7.string().min(1),
5571
- token_type: z7.string()
5572
- });
5573
- var DEVICE_AUTH_FAILURE_MESSAGES = {
5574
- access_denied: "the login request was denied",
5575
- expired_token: "the login request expired before it was approved"
5576
- };
5577
- var DeviceAuthError = class extends Error {
5578
- code;
5579
- constructor(code) {
5580
- super(DEVICE_AUTH_FAILURE_MESSAGES[code]);
5581
- this.name = "DeviceAuthError";
5582
- this.code = code;
5583
- }
5584
- };
5585
- async function postOAuthForm(fetchImpl, endpoint, body) {
5586
- return fetchImpl(endpoint, {
5587
- method: "POST",
5588
- headers: {
5589
- Accept: "application/json",
5590
- "Content-Type": "application/x-www-form-urlencoded"
5591
- },
5592
- body: body.toString()
5593
- });
5594
- }
5595
- function normalizeIssuer(raw) {
5596
- const issuer = new URL(raw);
5597
- if (issuer.username !== "" || issuer.password !== "" || issuer.pathname !== "/" || issuer.search !== "" || issuer.hash !== "") {
5598
- throw new Error("authorization server issuer must be an origin");
5599
- }
5600
- return issuer.origin;
5601
- }
5602
- async function startDeviceAuth(options) {
5603
- const fetchImpl = options.fetch ?? fetch;
5604
- const expectedIssuer = normalizeIssuer(options.issuerUrl);
5605
- const metadataUrl = new URL("/.well-known/oauth-authorization-server", `${expectedIssuer}/`);
5606
- const metadataResponse = await fetchImpl(metadataUrl, { headers: { Accept: "application/json" } });
5607
- if (!metadataResponse.ok) throw await ApiError.fromResponse(metadataResponse);
5608
- const metadata = zAuthorizationServerMetadata.parse(await metadataResponse.json());
5609
- if (normalizeIssuer(metadata.issuer) !== expectedIssuer) {
5610
- throw new Error(
5611
- `authorization server issuer mismatch: expected ${expectedIssuer}, received ${metadata.issuer}`
5612
- );
5613
- }
5614
- if (!metadata.grant_types_supported.includes(OAUTH_DEVICE_GRANT_TYPE)) {
5615
- throw new Error("authorization server does not support the OAuth device grant");
5616
- }
5617
- if (!metadata.token_endpoint_auth_methods_supported.includes("none")) {
5618
- throw new Error("authorization server does not support public OAuth clients");
5619
- }
5620
- const body = new URLSearchParams({ client_id: options.clientId });
5621
- if (options.tokenName !== void 0) body.set("token_name", options.tokenName);
5622
- const response = await postOAuthForm(fetchImpl, metadata.device_authorization_endpoint, body);
5623
- if (!response.ok) throw await ApiError.fromResponse(response);
5624
- const data = zDeviceAuthStartResponse.parse(await response.json());
5625
- return {
5626
- deviceCode: data.device_code,
5627
- userCode: data.user_code,
5628
- verificationUri: new URL(data.verification_uri, metadata.issuer).toString(),
5629
- verificationUriComplete: new URL(data.verification_uri_complete, metadata.issuer).toString(),
5630
- expiresInSeconds: data.expires_in,
5631
- intervalSeconds: data.interval,
5632
- tokenEndpoint: metadata.token_endpoint,
5633
- clientId: options.clientId
5634
- };
5635
- }
5636
- function defaultSleep(seconds) {
5637
- return new Promise((resolve3) => setTimeout(resolve3, seconds * 1e3));
5638
- }
5639
- async function pollDeviceAuthToken(options) {
5640
- const fetchImpl = options.fetch ?? fetch;
5641
- const sleep = options.sleep ?? defaultSleep;
5642
- let interval = options.intervalSeconds;
5643
- while (true) {
5644
- await sleep(interval);
5645
- const response = await postOAuthForm(
5646
- fetchImpl,
5647
- options.tokenEndpoint,
5648
- new URLSearchParams({
5649
- grant_type: OAUTH_DEVICE_GRANT_TYPE,
5650
- device_code: options.deviceCode,
5651
- client_id: options.clientId
5652
- })
5653
- );
5654
- if (response.status === 200) {
5655
- return zDeviceAuthApprovedResponse.parse(await response.json()).access_token;
5656
- }
5657
- if (response.status === 400) {
5658
- const failure = zDeviceAuthFailure.safeParse(await response.clone().text());
5659
- if (failure.success) {
5660
- if (failure.data.error === "authorization_pending") continue;
5661
- if (failure.data.error === "slow_down") {
5662
- interval += 5;
5663
- continue;
5664
- }
5665
- if (failure.data.error === "access_denied" || failure.data.error === "expired_token") {
5666
- throw new DeviceAuthError(failure.data.error);
5667
- }
5668
- }
5669
- }
5670
- throw await ApiError.fromResponse(response);
5671
- }
5672
- }
5673
-
5674
6226
  // ../sdk/src/generated/sdk.gen.ts
5675
6227
  var sdk_gen_exports = {};
5676
6228
  __export(sdk_gen_exports, {
@@ -5749,11 +6301,14 @@ __export(sdk_gen_exports, {
5749
6301
  getAgentUsage: () => getAgentUsage,
5750
6302
  getArtifact: () => getArtifact,
5751
6303
  getArtifactContent: () => getArtifactContent,
6304
+ getConfiguredModel: () => getConfiguredModel,
5752
6305
  getCronTrigger: () => getCronTrigger,
5753
6306
  getCurrentUser: () => getCurrentUser,
5754
6307
  getDaemonGitCredentials: () => getDaemonGitCredentials,
5755
6308
  getDaemonSkillArchive: () => getDaemonSkillArchive,
6309
+ getEventWebhook: () => getEventWebhook,
5756
6310
  getIntegration: () => getIntegration,
6311
+ getIntegrationSubscription: () => getIntegrationSubscription,
5757
6312
  getMachine: () => getMachine,
5758
6313
  getMachinePool: () => getMachinePool,
5759
6314
  getMemoryStore: () => getMemoryStore,
@@ -5763,11 +6318,17 @@ __export(sdk_gen_exports, {
5763
6318
  getOrgOverview: () => getOrgOverview,
5764
6319
  getOrgUsage: () => getOrgUsage,
5765
6320
  getOrgUsageTimeseries: () => getOrgUsageTimeseries,
6321
+ getProject: () => getProject,
5766
6322
  getProjectAvailableSecret: () => getProjectAvailableSecret,
6323
+ getProjectMachineGrant: () => getProjectMachineGrant,
5767
6324
  getProjectMachinePoolGrant: () => getProjectMachinePoolGrant,
6325
+ getProjectModelGrant: () => getProjectModelGrant,
5768
6326
  getProjectUsage: () => getProjectUsage,
5769
6327
  getSecret: () => getSecret,
6328
+ getSecretGrant: () => getSecretGrant,
5770
6329
  getSkill: () => getSkill,
6330
+ getSkillGrant: () => getSkillGrant,
6331
+ getToolCall: () => getToolCall,
5771
6332
  getToolCatalog: () => getToolCatalog,
5772
6333
  inspectIntegrationGitHubInstallations: () => inspectIntegrationGitHubInstallations,
5773
6334
  listActors: () => listActors,
@@ -5803,9 +6364,11 @@ __export(sdk_gen_exports, {
5803
6364
  listPersonalAccessTokens: () => listPersonalAccessTokens,
5804
6365
  listProjectAvailableSecrets: () => listProjectAvailableSecrets,
5805
6366
  listProjectAvailableSkills: () => listProjectAvailableSkills,
6367
+ listProjectInteractions: () => listProjectInteractions,
5806
6368
  listProjectMachineGrants: () => listProjectMachineGrants,
5807
6369
  listProjectMachinePoolGrants: () => listProjectMachinePoolGrants,
5808
6370
  listProjectModelGrants: () => listProjectModelGrants,
6371
+ listProjectToolCalls: () => listProjectToolCalls,
5809
6372
  listQueuedBacklogInputs: () => listQueuedBacklogInputs,
5810
6373
  listSecretGrants: () => listSecretGrants,
5811
6374
  listSecrets: () => listSecrets,
@@ -5850,6 +6413,7 @@ __export(sdk_gen_exports, {
5850
6413
  updateModelProviderConfig: () => updateModelProviderConfig,
5851
6414
  updateOrgApiKey: () => updateOrgApiKey,
5852
6415
  updateOrgMember: () => updateOrgMember,
6416
+ updateProject: () => updateProject,
5853
6417
  updateProjectMachinePoolGrant: () => updateProjectMachinePoolGrant,
5854
6418
  updateProjectModelGrant: () => updateProjectModelGrant,
5855
6419
  updateSecret: () => updateSecret,
@@ -5911,6 +6475,20 @@ var deleteEventWebhook = (options) => (options.client ?? client).delete({
5911
6475
  url: "/orgs/{orgID}/projects/{projectID}/event-webhooks/{webhookID}",
5912
6476
  ...options
5913
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
+ });
5914
6492
  var updateEventWebhook = (options) => (options.client ?? client).patch({
5915
6493
  responseValidator: relaxedResponseValidator(zUpdateEventWebhookResponse),
5916
6494
  security: [
@@ -6264,6 +6842,42 @@ var deleteProject = (options) => (options.client ?? client).delete({
6264
6842
  url: "/orgs/{orgID}/projects/{projectID}",
6265
6843
  ...options
6266
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
+ });
6267
6881
  var getProjectUsage = (options) => (options.client ?? client).get({
6268
6882
  responseValidator: relaxedResponseValidator(zGetProjectUsageResponse),
6269
6883
  security: [{
@@ -6690,6 +7304,20 @@ var deleteSkillGrant = (options) => (options.client ?? client).delete({
6690
7304
  url: "/orgs/{orgID}/skills/{skillID}/grants/{grantID}",
6691
7305
  ...options
6692
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
+ });
6693
7321
  var listProjectAvailableSkills = (options) => (options.client ?? client).get({
6694
7322
  responseValidator: relaxedResponseValidator(zListProjectAvailableSkillsResponse),
6695
7323
  security: [{
@@ -7065,6 +7693,20 @@ var deleteSecretGrant = (options) => (options.client ?? client).delete({
7065
7693
  url: "/orgs/{orgID}/secrets/{secretID}/grants/{grantID}",
7066
7694
  ...options
7067
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
+ });
7068
7710
  var resolveAgentConfigTools = (options) => (options.client ?? client).post({
7069
7711
  responseValidator: relaxedResponseValidator(zResolveAgentConfigToolsResponse),
7070
7712
  security: [
@@ -7601,6 +8243,20 @@ var createAgentInput = (options) => (options.client ?? client).post({
7601
8243
  ...options.headers
7602
8244
  }
7603
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
+ });
7604
8260
  var listToolCalls = (options) => (options.client ?? client).get({
7605
8261
  responseValidator: relaxedResponseValidator(zListToolCallsResponse2),
7606
8262
  security: [{
@@ -7615,6 +8271,20 @@ var listToolCalls = (options) => (options.client ?? client).get({
7615
8271
  url: "/orgs/{orgID}/projects/{projectID}/agents/{agentID}/tool-calls",
7616
8272
  ...options
7617
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
+ });
7618
8288
  var submitToolCallResult = (options) => (options.client ?? client).post({
7619
8289
  responseValidator: relaxedResponseValidator(zSubmitToolCallResultResponse2),
7620
8290
  security: [
@@ -7715,6 +8385,20 @@ var cancelAgent = (options) => (options.client ?? client).post({
7715
8385
  ...options.headers
7716
8386
  }
7717
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
+ });
7718
8402
  var listAgentInteractions = (options) => (options.client ?? client).get({
7719
8403
  responseValidator: relaxedResponseValidator(zListAgentInteractionsResponse2),
7720
8404
  security: [{
@@ -7941,6 +8625,20 @@ var deleteProjectMachineGrant = (options) => (options.client ?? client).delete({
7941
8625
  url: "/orgs/{orgID}/projects/{projectID}/machine-grants/{grantID}",
7942
8626
  ...options
7943
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
+ });
7944
8642
  var listProjectAvailableSecrets = (options) => (options.client ?? client).get({
7945
8643
  responseValidator: relaxedResponseValidator(zListProjectAvailableSecretsResponse),
7946
8644
  security: [{
@@ -8289,6 +8987,20 @@ var deleteConfiguredModel = (options) => (options.client ?? client).delete({
8289
8987
  url: "/orgs/{orgID}/model-provider-configs/{modelProviderConfigID}/models/{configuredModelID}",
8290
8988
  ...options
8291
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
+ });
8292
9004
  var updateConfiguredModel = (options) => (options.client ?? client).put({
8293
9005
  responseValidator: relaxedResponseValidator(zUpdateConfiguredModelResponse),
8294
9006
  security: [
@@ -8365,6 +9077,20 @@ var deleteProjectModelGrant = (options) => (options.client ?? client).delete({
8365
9077
  url: "/orgs/{orgID}/projects/{projectID}/model-grants/{modelGrantID}",
8366
9078
  ...options
8367
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
+ });
8368
9094
  var updateProjectModelGrant = (options) => (options.client ?? client).patch({
8369
9095
  responseValidator: relaxedResponseValidator(zUpdateProjectModelGrantResponse),
8370
9096
  security: [
@@ -8889,6 +9615,20 @@ var deleteIntegrationSubscription = (options) => (options.client ?? client).dele
8889
9615
  url: "/orgs/{orgID}/projects/{projectID}/integrations/{integrationID}/subscriptions/{subscriptionID}",
8890
9616
  ...options
8891
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
+ });
8892
9632
  var configureIntegration = (options) => (options.client ?? client).post({
8893
9633
  responseValidator: relaxedResponseValidator(zConfigureIntegrationResponse),
8894
9634
  security: [
@@ -8958,6 +9698,138 @@ var listIntegrationDefinitions = (options) => (options.client ?? client).get({
8958
9698
  ...options
8959
9699
  });
8960
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
+
8961
9833
  // ../sdk/src/memory.ts
8962
9834
  var MAX_MEMORY_FILE_BYTES = 10 * 1024 * 1024;
8963
9835
  var FILE_DIGEST_HEADER = "X-Omnara-File-Digest";
@@ -9186,6 +10058,12 @@ var zConfigFile = z10.looseObject({
9186
10058
  org_id: zOrganizationId.optional(),
9187
10059
  project_id: zProjectId.optional()
9188
10060
  });
10061
+ function firstPresentSetting(...values) {
10062
+ for (const value of values) {
10063
+ if (value !== void 0 && value.trim() !== "") return value;
10064
+ }
10065
+ return void 0;
10066
+ }
9189
10067
  function configFilePath() {
9190
10068
  return join(homedir(), ".config", "omnara", "config.json");
9191
10069
  }
@@ -9483,7 +10361,7 @@ async function loginWithDevice(options) {
9483
10361
  report.success(loginMessage);
9484
10362
  report.info(`Token saved to ${store.path}`);
9485
10363
  if (validationWarning !== void 0) report.warn(validationWarning);
9486
- if (process.env.OMNARA_API_KEY !== void 0) {
10364
+ if (firstPresentSetting(process.env.OMNARA_API_KEY) !== void 0) {
9487
10365
  report.warn("OMNARA_API_KEY is set and takes precedence over the saved token");
9488
10366
  }
9489
10367
  return { token, orgId, projectId, hasOrganizations };
@@ -9492,18 +10370,47 @@ async function loginWithDevice(options) {
9492
10370
  // src/poll.ts
9493
10371
  var POLL_INTERVAL_SECONDS = 2;
9494
10372
  var MAX_CONSECUTIVE_POLL_FAILURES = 3;
10373
+ var MAX_TIMER_MS = 2 ** 31 - 1;
9495
10374
  function sleepSeconds(seconds) {
9496
10375
  return new Promise((resolve3) => setTimeout(resolve3, seconds * 1e3));
9497
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
+ }
9498
10401
  async function pollUntilDeadline(options) {
9499
10402
  const deadline = Date.parse(options.expiresAt);
10403
+ const abortAt = deadline + POLL_INTERVAL_SECONDS * 1e3;
9500
10404
  let consecutiveFailures = 0;
9501
10405
  while (true) {
9502
10406
  try {
9503
- const found = await options.fetchOnce();
10407
+ const found = await fetchBeforeDeadline(abortAt, options.fetchOnce);
10408
+ if (Date.now() >= abortAt) break;
9504
10409
  consecutiveFailures = 0;
9505
10410
  if (found !== void 0) return found;
9506
10411
  } catch (error) {
10412
+ if (error instanceof PollTerminalError) throw error;
10413
+ if (error instanceof DeadlineExceeded || Date.now() >= deadline) break;
9507
10414
  consecutiveFailures += 1;
9508
10415
  if (consecutiveFailures >= MAX_CONSECUTIVE_POLL_FAILURES) throw error;
9509
10416
  }
@@ -9519,10 +10426,13 @@ var DEFAULT_API_URL = "https://api.omnara.com/v1";
9519
10426
  var DEFAULT_ISSUER_URL = "https://app.omnara.com";
9520
10427
  function resolveUrls(file, env) {
9521
10428
  return {
9522
- apiUrl: env.OMNARA_API_URL ?? file.api_url ?? DEFAULT_API_URL,
9523
- issuerUrl: env.OMNARA_ISSUER_URL ?? file.issuer_url ?? DEFAULT_ISSUER_URL
10429
+ apiUrl: firstPresentSetting(env.OMNARA_API_URL, file.api_url) ?? DEFAULT_API_URL,
10430
+ issuerUrl: firstPresentSetting(env.OMNARA_ISSUER_URL, file.issuer_url) ?? DEFAULT_ISSUER_URL
9524
10431
  };
9525
10432
  }
10433
+ function resolveSavedToken(env, fileToken) {
10434
+ return firstPresentSetting(env.OMNARA_API_KEY, fileToken);
10435
+ }
9526
10436
  function migrateLegacyBaseUrl(file) {
9527
10437
  const { base_url: baseUrl, ...rest } = file;
9528
10438
  if (baseUrl === void 0) return void 0;
@@ -9553,7 +10463,7 @@ function loadConfig() {
9553
10463
  const { apiUrl, issuerUrl } = resolveUrls(file, process.env);
9554
10464
  let saved = { orgId: file.org_id, projectId: file.project_id };
9555
10465
  const resolveToken = createTokenResolver({
9556
- savedToken: process.env.OMNARA_API_KEY ?? file.token,
10466
+ savedToken: resolveSavedToken(process.env, file.token),
9557
10467
  canPrompt: canPromptInteractively,
9558
10468
  login: async () => {
9559
10469
  const report = createLoginReporter(`Not logged in yet. Log in to ${issuerUrl}`);
@@ -9584,10 +10494,10 @@ function loadConfig() {
9584
10494
  fetch: globalThis.fetch,
9585
10495
  sleep: sleepSeconds,
9586
10496
  get defaultOrgId() {
9587
- return process.env.OMNARA_ORG_ID ?? saved.orgId;
10497
+ return firstPresentSetting(process.env.OMNARA_ORG_ID, saved.orgId);
9588
10498
  },
9589
10499
  get defaultProjectId() {
9590
- return process.env.OMNARA_PROJECT_ID ?? saved.projectId;
10500
+ return firstPresentSetting(process.env.OMNARA_PROJECT_ID, saved.projectId);
9591
10501
  },
9592
10502
  ensureLoggedIn: async () => {
9593
10503
  await resolveToken();
@@ -9595,7 +10505,7 @@ function loadConfig() {
9595
10505
  };
9596
10506
  }
9597
10507
  function describeValue(envName, fileValue, defaultValue) {
9598
- const envValue = process.env[envName];
10508
+ const envValue = firstPresentSetting(process.env[envName]);
9599
10509
  if (envValue !== void 0) {
9600
10510
  const shadowed = fileValue !== void 0 ? ` (config has ${fileValue})` : "";
9601
10511
  return `${envValue} [from ${envName}${shadowed}]`;
@@ -9999,7 +10909,9 @@ function collectFlagValues(specs, options) {
9999
10909
  return root;
10000
10910
  }
10001
10911
  function parseWithSchema(schema, value, label) {
10002
- const result = schema.safeParse(value);
10912
+ const result = schema.safeParse(value, {
10913
+ error: (issue) => issue.input === "" ? "value is empty" : void 0
10914
+ });
10003
10915
  if (!result.success) {
10004
10916
  throw new CliInputError(`invalid ${label}:
10005
10917
  ${z13.prettifyError(result.error)}`);
@@ -10168,7 +11080,7 @@ function registerLoginCommand(program2, cli) {
10168
11080
  report.finish(
10169
11081
  `This account has no organization yet. Create one at ${new URL("/onboarding", cli.issuerUrl).toString()}, then run 'omnara config select'.`
10170
11082
  );
10171
- } else if ((process.env.OMNARA_ORG_ID ?? orgId) === void 0) {
11083
+ } else if (firstPresentSetting(process.env.OMNARA_ORG_ID, orgId) === void 0) {
10172
11084
  report.finish("Run 'omnara config select' to choose a default organization and project.");
10173
11085
  } else {
10174
11086
  report.finish();
@@ -10190,7 +11102,7 @@ function registerLoginCommand(program2, cli) {
10190
11102
  }
10191
11103
 
10192
11104
  // src/manifest.ts
10193
- import * as z28 from "zod";
11105
+ import * as z29 from "zod";
10194
11106
 
10195
11107
  // src/agent-commands.ts
10196
11108
  import * as z19 from "zod";
@@ -10318,20 +11230,11 @@ function projectActorsQueryPredicate(orgID, projectID) {
10318
11230
  }
10319
11231
 
10320
11232
  // ../react/src/domains/agent-activity.ts
10321
- var activeAgentPollIntervalMs = 5e3;
10322
11233
  function isAgentActive(agent) {
10323
11234
  const activity = agent.activity;
10324
11235
  if (!activity) return false;
10325
11236
  return activity.state === "running" || activity.state === "waiting_on_interaction" || activity.running_processes.count > 0 || activity.working_subagents.count > 0;
10326
11237
  }
10327
- function activeAgentsRefetchInterval(getAgents, refetchInterval) {
10328
- return (query) => {
10329
- const data = query.state.data;
10330
- const own = refetchInterval?.(data);
10331
- if (own) return own;
10332
- return getAgents(data).some(isAgentActive) ? activeAgentPollIntervalMs : false;
10333
- };
10334
- }
10335
11238
 
10336
11239
  // ../react/src/domains/agent-chat.ts
10337
11240
  import { useQueryClient as useQueryClient3 } from "@tanstack/react-query";
@@ -10507,10 +11410,8 @@ function agentEventsToMessages(events, { hasOlderEvents = false } = {}) {
10507
11410
  toolType: part.toolType,
10508
11411
  state: "output-available",
10509
11412
  input: part.input,
10510
- output: {
10511
- outcome: event.outcome,
10512
- contentBlocks
10513
- }
11413
+ output: { contentBlocks },
11414
+ toolOutcome: event.outcome
10514
11415
  };
10515
11416
  if (toolErrorCode != null) toolPart.toolErrorCode = toolErrorCode;
10516
11417
  const mediaParts = contentBlocks.flatMap(
@@ -11542,46 +12443,47 @@ import {
11542
12443
  useQueryClient as useQueryClient6,
11543
12444
  useSuspenseQuery as useSuspenseQuery3
11544
12445
  } from "@tanstack/react-query";
11545
- var agentListRefetchInterval = activeAgentsRefetchInterval(
11546
- (data) => data?.pages.flatMap((page) => page.data) ?? []
11547
- );
11548
12446
 
11549
12447
  // ../react/src/domains/cron-triggers.ts
11550
12448
  import { useInfiniteQuery as useInfiniteQuery4, useMutation as useMutation6, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
11551
12449
 
11552
12450
  // ../react/src/domains/event-webhooks.ts
11553
- 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";
11554
12456
 
11555
12457
  // ../react/src/domains/integration-subscriptions.ts
11556
12458
  import {
11557
- useInfiniteQuery as useInfiniteQuery5,
12459
+ useInfiniteQuery as useInfiniteQuery6,
11558
12460
  useMutation as useMutation8,
11559
12461
  useQueryClient as useQueryClient9
11560
12462
  } from "@tanstack/react-query";
11561
12463
 
11562
12464
  // ../react/src/domains/integrations.ts
11563
12465
  import {
11564
- useInfiniteQuery as useInfiniteQuery6,
12466
+ useInfiniteQuery as useInfiniteQuery7,
11565
12467
  useMutation as useMutation9,
11566
- useQuery as useQuery8,
12468
+ useQuery as useQuery7,
11567
12469
  useQueryClient as useQueryClient10
11568
12470
  } from "@tanstack/react-query";
11569
12471
 
11570
12472
  // ../react/src/domains/invitations.ts
11571
- 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";
11572
12474
 
11573
12475
  // ../react/src/domains/machine-pools.ts
11574
- 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";
11575
12477
 
11576
12478
  // ../react/src/domains/machines.ts
11577
- 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";
11578
12480
 
11579
12481
  // ../react/src/domains/mcp-registry.ts
11580
- 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";
11581
12483
  var serverInfoStaleTime = 5 * 60 * 1e3;
11582
12484
 
11583
12485
  // ../react/src/domains/mcp-server-tools.ts
11584
- import { useQuery as useQuery13 } from "@tanstack/react-query";
12486
+ import { useQuery as useQuery12 } from "@tanstack/react-query";
11585
12487
  var mcpServerToolsStaleTime = 60 * 1e3;
11586
12488
 
11587
12489
  // ../react/src/domains/me.ts
@@ -11589,10 +12491,9 @@ import { useMutation as useMutation13, useQueryClient as useQueryClient15, useSu
11589
12491
 
11590
12492
  // ../react/src/domains/memory.ts
11591
12493
  import {
11592
- skipToken,
11593
- useInfiniteQuery as useInfiniteQuery10,
12494
+ useInfiniteQuery as useInfiniteQuery11,
11594
12495
  useMutation as useMutation14,
11595
- useQuery as useQuery14,
12496
+ useQuery as useQuery13,
11596
12497
  useQueryClient as useQueryClient16
11597
12498
  } from "@tanstack/react-query";
11598
12499
  import * as z16 from "zod";
@@ -11600,55 +12501,50 @@ var memoryFileDigest = z16.object({ digest: z16.string() });
11600
12501
 
11601
12502
  // ../react/src/domains/model-providers.ts
11602
12503
  import {
11603
- useInfiniteQuery as useInfiniteQuery11,
12504
+ useInfiniteQuery as useInfiniteQuery12,
11604
12505
  useMutation as useMutation15,
11605
12506
  useQueries,
11606
- useQuery as useQuery15,
12507
+ useQuery as useQuery14,
11607
12508
  useQueryClient as useQueryClient17
11608
12509
  } from "@tanstack/react-query";
11609
12510
  import { useEffect as useEffect2 } from "react";
11610
12511
 
11611
12512
  // ../react/src/domains/org-api-keys.ts
11612
- 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";
11613
12514
 
11614
12515
  // ../react/src/domains/org-members.ts
11615
- 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";
11616
12517
 
11617
12518
  // ../react/src/domains/orgs.ts
11618
- 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";
11619
12520
 
11620
12521
  // ../react/src/domains/personal-access-tokens.ts
11621
- 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";
11622
12523
 
11623
12524
  // ../react/src/domains/project-grants.ts
11624
- 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";
11625
12526
 
11626
12527
  // ../react/src/domains/projects.ts
11627
- import {
11628
- skipToken as skipToken2,
11629
- useInfiniteQuery as useInfiniteQuery16,
11630
- useQueryClient as useQueryClient23,
11631
- useSuspenseInfiniteQuery
11632
- } from "@tanstack/react-query";
12528
+ import { useInfiniteQuery as useInfiniteQuery17, useQueryClient as useQueryClient23, useSuspenseInfiniteQuery } from "@tanstack/react-query";
11633
12529
 
11634
12530
  // ../react/src/domains/secrets.ts
11635
12531
  import {
11636
- useInfiniteQuery as useInfiniteQuery17,
12532
+ useInfiniteQuery as useInfiniteQuery18,
11637
12533
  useMutation as useMutation21,
11638
- useQuery as useQuery19,
12534
+ useQuery as useQuery18,
11639
12535
  useQueryClient as useQueryClient24
11640
12536
  } from "@tanstack/react-query";
11641
12537
 
11642
12538
  // ../react/src/domains/skills.ts
11643
12539
  import {
11644
- useInfiniteQuery as useInfiniteQuery18,
12540
+ useInfiniteQuery as useInfiniteQuery19,
11645
12541
  useMutation as useMutation22,
11646
- useQuery as useQuery20,
12542
+ useQuery as useQuery19,
11647
12543
  useQueryClient as useQueryClient25
11648
12544
  } from "@tanstack/react-query";
11649
12545
 
11650
12546
  // ../react/src/domains/tool-catalog.ts
11651
- import { useQuery as useQuery21 } from "@tanstack/react-query";
12547
+ import { useQuery as useQuery20 } from "@tanstack/react-query";
11652
12548
 
11653
12549
  // src/chat.tsx
11654
12550
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
@@ -11774,6 +12670,7 @@ function SelectList({
11774
12670
  }
11775
12671
  function InteractionPrompt({
11776
12672
  interaction,
12673
+ agentID,
11777
12674
  onAnswer
11778
12675
  }) {
11779
12676
  const approval = interaction.interaction_kind === "permission";
@@ -11799,11 +12696,11 @@ function InteractionPrompt({
11799
12696
  " ",
11800
12697
  form.title
11801
12698
  ] }),
11802
- interaction.agent_name != null && /* @__PURE__ */ jsxs(Text, { children: [
12699
+ interaction.agent_id !== agentID && /* @__PURE__ */ jsxs(Text, { children: [
11803
12700
  " ",
11804
12701
  /* @__PURE__ */ jsx2(Text, { dimColor: true, children: "from subagent" }),
11805
12702
  " ",
11806
- interaction.agent_name
12703
+ (interaction.agent_name ?? "") || interaction.agent_id
11807
12704
  ] }),
11808
12705
  (form.context ?? []).map((item) => /* @__PURE__ */ jsxs(Text, { children: [
11809
12706
  " ",
@@ -11876,7 +12773,6 @@ var streamingTailLines = 8;
11876
12773
  var streamingTailChars = 1500;
11877
12774
  var zToolInput2 = z18.record(z18.string(), z18.json());
11878
12775
  var zToolOutput = z18.object({
11879
- outcome: zToolCallOutcome,
11880
12776
  contentBlocks: z18.array(zToolResultContentBlock)
11881
12777
  });
11882
12778
  function formatDuration(ms) {
@@ -11896,12 +12792,13 @@ function toolOutput(part) {
11896
12792
  if (part.state !== "output-available") return void 0;
11897
12793
  const output = zToolOutput.safeParse(part.output);
11898
12794
  if (!output.success) return void 0;
12795
+ const outcome = part.toolOutcome ?? "succeeded";
11899
12796
  for (const block of output.data.contentBlocks) {
11900
12797
  if (block.type !== "text" && block.type !== "structured_data") continue;
11901
12798
  const text = blockText(block);
11902
- if (text.trim() !== "") return { outcome: output.data.outcome, text };
12799
+ if (text.trim() !== "") return { outcome, text };
11903
12800
  }
11904
- return { outcome: output.data.outcome, text: void 0 };
12801
+ return { outcome, text: void 0 };
11905
12802
  }
11906
12803
  function ToolPartView({ part }) {
11907
12804
  const summary = useMemo2(() => toolSummary(part), [part]);
@@ -12177,6 +13074,7 @@ function Chat({ scope }) {
12177
13074
  InteractionPrompt,
12178
13075
  {
12179
13076
  interaction,
13077
+ agentID: scope.agentID,
12180
13078
  onAnswer: (answers) => {
12181
13079
  void resolveInteraction.mutateAsync({
12182
13080
  interactionID: interaction.id,
@@ -12258,14 +13156,110 @@ var agentEventsStreamOp = customOp({
12258
13156
  }
12259
13157
  });
12260
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
+
12261
13255
  // src/config-attachment.ts
12262
13256
  import { readFileSync as readFileSync2 } from "node:fs";
12263
- import * as z20 from "zod";
12264
- var zConfigSourceAttachment = z20.object({
12265
- file: z20.string().min(1).optional().describe("path to an agent config file (.yaml, .yml, or .json)"),
12266
- 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)")
12267
13261
  });
12268
- var zConfigAttachment = z20.object({
13262
+ var zConfigAttachment = z21.object({
12269
13263
  config: zAgentConfigId.optional().describe("existing agent config ID"),
12270
13264
  ...zConfigSourceAttachment.shape
12271
13265
  });
@@ -12282,8 +13276,8 @@ function fileFormat(filePath) {
12282
13276
  throw new CliInputError(`config file must end in .yaml, .yml, or .json: ${filePath}`);
12283
13277
  }
12284
13278
  var zDefinitionText = zJsonText.pipe(
12285
- z20.custom(
12286
- (value) => z20.record(z20.string(), z20.unknown()).safeParse(value).success,
13279
+ z21.custom(
13280
+ (value) => z21.record(z21.string(), z21.unknown()).safeParse(value).success,
12287
13281
  "expected a JSON object"
12288
13282
  )
12289
13283
  );
@@ -12369,13 +13363,13 @@ function formatVoid(message = "ok") {
12369
13363
  }
12370
13364
 
12371
13365
  // src/integration-setup.ts
12372
- import * as z23 from "zod";
13366
+ import * as z24 from "zod";
12373
13367
 
12374
13368
  // src/slack-setup.ts
12375
- import * as z22 from "zod";
13369
+ import * as z23 from "zod";
12376
13370
 
12377
13371
  // src/mcp-oauth.ts
12378
- import * as z21 from "zod";
13372
+ import * as z22 from "zod";
12379
13373
  async function authorizeMcpOAuthSecret(options) {
12380
13374
  const { data: start } = await sdk_gen_exports.startSecretMcpoAuth({
12381
13375
  client: options.client,
@@ -12386,17 +13380,18 @@ async function authorizeMcpOAuthSecret(options) {
12386
13380
  return pollUntilDeadline({
12387
13381
  expiresAt: start.expires_at,
12388
13382
  expiredMessage: "MCP OAuth authorization expired before the secret was created",
12389
- async fetchOnce() {
13383
+ async fetchOnce(signal) {
12390
13384
  const { data } = await sdk_gen_exports.listSecrets({
12391
13385
  client: options.client,
12392
13386
  path: { orgID: options.orgId },
12393
- query: { mcp_oauth_flow_id: start.flow_id, limit: 1 }
13387
+ query: { mcp_oauth_flow_id: start.flow_id, limit: 1 },
13388
+ signal
12394
13389
  });
12395
13390
  return data.data[0];
12396
13391
  }
12397
13392
  });
12398
13393
  }
12399
- 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");
12400
13395
  function openAuthorizationUrl(report, title, url4, browser) {
12401
13396
  report.url(title, url4);
12402
13397
  if (browser) {
@@ -12430,15 +13425,15 @@ async function runMcpOAuth(context) {
12430
13425
  }
12431
13426
 
12432
13427
  // src/slack-setup.ts
12433
- var zSlackBody = z22.object({
12434
- app_name: z22.string().optional().describe("name for a new Slack app"),
12435
- app_configuration_token: z22.string().optional().describe("Slack app configuration token for a new app"),
12436
- icon_filename: z22.string().optional().describe("filename for the new Slack app icon"),
12437
- icon_data_base64: z22.string().optional().describe("base64-encoded Slack app icon"),
12438
- client_id: z22.string().optional().describe("existing Slack app client ID"),
12439
- client_secret: z22.string().optional().describe("existing Slack app client secret"),
12440
- signing_secret: z22.string().optional().describe("existing Slack app signing secret"),
12441
- 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"),
12442
13437
  browser: zBrowserFlag
12443
13438
  });
12444
13439
  function parseRequest(body) {
@@ -12467,7 +13462,7 @@ function parseRequest(body) {
12467
13462
  if (!result2.success) {
12468
13463
  throw new CliInputError(
12469
13464
  `invalid existing Slack app parameters:
12470
- ${z22.prettifyError(result2.error)}`
13465
+ ${z23.prettifyError(result2.error)}`
12471
13466
  );
12472
13467
  }
12473
13468
  return { kind: "existing-app", body: result2.data };
@@ -12488,7 +13483,7 @@ ${z22.prettifyError(result2.error)}`
12488
13483
  if (!result.success) {
12489
13484
  throw new CliInputError(
12490
13485
  `invalid Slack app parameters:
12491
- ${z22.prettifyError(result.error)}
13486
+ ${z23.prettifyError(result.error)}
12492
13487
  Pass --app-name and --app-configuration-token, or existing app credentials.`
12493
13488
  );
12494
13489
  }
@@ -12532,8 +13527,8 @@ async function runSlackIntegration(context) {
12532
13527
  integration = await pollUntilDeadline({
12533
13528
  expiresAt: start.expires_at,
12534
13529
  expiredMessage: "Slack authorization expired before the integration connected",
12535
- async fetchOnce() {
12536
- 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 });
12537
13532
  return data.state === "active" && data.last_oauth_flow_id === start.flow_id ? data : void 0;
12538
13533
  }
12539
13534
  });
@@ -12553,8 +13548,8 @@ async function runSlackIntegration(context) {
12553
13548
  }
12554
13549
 
12555
13550
  // src/integration-setup.ts
12556
- var zIntegrationProfilesBody = z23.object({
12557
- 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")
12558
13553
  });
12559
13554
  async function runIntegrationProfilesUpdate(context) {
12560
13555
  const { client: client2, path, body, report } = context;
@@ -12655,8 +13650,12 @@ import { spawn as spawn2, spawnSync } from "node:child_process";
12655
13650
  import { accessSync, constants, existsSync as existsSync2, readdirSync, readFileSync as readFileSync3 } from "node:fs";
12656
13651
  import { homedir as homedir2, release } from "node:os";
12657
13652
  import { basename, dirname as dirname2, isAbsolute, join as join2, resolve } from "node:path";
12658
- import * as z24 from "zod";
12659
- var zMachineSetupBody = zConnectByoMachineRequest;
13653
+ import * as z25 from "zod";
13654
+ var zMachineSetupBody = zConnectByoMachineRequest.extend({
13655
+ project_ids: zConnectByoMachineRequest.shape.project_ids.describe(
13656
+ "project ID to grant the machine to, from omnara projects list"
13657
+ )
13658
+ });
12660
13659
  async function connectMachine(context) {
12661
13660
  const { client: client2, path, body, report } = context;
12662
13661
  report.start("Creating machine with a daemon token");
@@ -12692,9 +13691,9 @@ var daemonConfigFileName = "daemon.json";
12692
13691
  var installLockFileName = "install.lock";
12693
13692
  var daemonLockFileName = "daemon.lock";
12694
13693
  var daemonLockPollMs = 250;
12695
- var zDaemonConfigFile = z24.looseObject({
12696
- machine_id: z24.string().optional(),
12697
- api_url: z24.string().optional()
13694
+ var zDaemonConfigFile = z25.looseObject({
13695
+ machine_id: z25.string().optional(),
13696
+ api_url: z25.string().optional()
12698
13697
  });
12699
13698
  function daemonHome() {
12700
13699
  const override = process.env.OMNARA_HOME;
@@ -12976,10 +13975,10 @@ function runInstaller(report, apiUrl, token, machineId, home) {
12976
13975
 
12977
13976
  // src/mcp-add.ts
12978
13977
  import { isMap, isScalar as isScalar2, parseDocument } from "yaml";
12979
- import * as z25 from "zod";
13978
+ import * as z26 from "zod";
12980
13979
  var SERVER_KEY_PATTERN = /^[a-zA-Z][a-zA-Z0-9-]{0,31}$/;
12981
13980
  var zMcpAddBody = zMcpoAuthStartRequest.omit({ owner: true, name: true }).extend({
12982
- server_name: z25.string().regex(
13981
+ server_name: z26.string().regex(
12983
13982
  SERVER_KEY_PATTERN,
12984
13983
  "must start with a letter and contain at most 32 letters, digits, or hyphens"
12985
13984
  ).describe("MCP server key used in the agent config"),
@@ -12992,9 +13991,9 @@ function targetLabel(target) {
12992
13991
  function serverEntry(url4, secretId) {
12993
13992
  return { url: url4, auth: { type: "oauth", secret_id: secretId } };
12994
13993
  }
12995
- var zJsonRecord = z25.record(z25.string(), z25.json());
13994
+ var zJsonRecord = z26.record(z26.string(), z26.json());
12996
13995
  var zDefinitionText2 = zJsonText.pipe(
12997
- z25.custom((value) => zJsonRecord.safeParse(value).success)
13996
+ z26.custom((value) => zJsonRecord.safeParse(value).success)
12998
13997
  );
12999
13998
  function prepareJsonConfig(configId, source, serverName, mcpUrl) {
13000
13999
  const parsed = zDefinitionText2.safeParse(source);
@@ -13164,9 +14163,9 @@ function runProfileMcpAdd(context) {
13164
14163
  // src/memory-files.ts
13165
14164
  import { open, writeFile } from "node:fs/promises";
13166
14165
  import { buffer } from "node:stream/consumers";
13167
- import * as z26 from "zod";
13168
- var zMemoryUploadBody = z26.object({
13169
- 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")
13170
14169
  });
13171
14170
  async function loadMemoryUpload(file) {
13172
14171
  const handle = await open(file, "r");
@@ -13198,7 +14197,7 @@ var memoryDownloadOp = customOp({
13198
14197
  { path: options.path ?? null },
13199
14198
  "query flags"
13200
14199
  );
13201
- const output = parseWithSchema(z26.string().min(1), options.output, "--output");
14200
+ const output = parseWithSchema(z27.string().min(1), options.output, "--output");
13202
14201
  const { response } = await sdk_gen_exports.downloadMemoryFile({ client: client2, path, query, parseAs: "stream" });
13203
14202
  const digest = response.headers.get(FILE_DIGEST_HEADER);
13204
14203
  if (!digest) throw new CliInputError("file response is missing its digest");
@@ -13212,10 +14211,10 @@ var memoryDownloadOp = customOp({
13212
14211
  import { readdirSync as readdirSync2, readFileSync as readFileSync4, statSync } from "node:fs";
13213
14212
  import { basename as basename2, dirname as dirname3, join as join3, resolve as resolve2 } from "node:path";
13214
14213
  import * as tar from "tar";
13215
- import * as z27 from "zod";
13216
- var zCreateSkillCliBody = z27.object({
14214
+ import * as z28 from "zod";
14215
+ var zCreateSkillCliBody = z28.object({
13217
14216
  owner: zSkillOwnerInput,
13218
- 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")
13219
14218
  });
13220
14219
  var ARCHIVE_SUFFIXES = [".zip", ".tar.gz", ".tgz"];
13221
14220
  function assertPackable(dir) {
@@ -13268,9 +14267,18 @@ var commandGroups = [
13268
14267
  verb: "list",
13269
14268
  summary: "List agents in a project",
13270
14269
  fn: sdk_gen_exports.listAgents,
13271
- 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
+ ])({
13272
14279
  data: response.data.map((agent) => ({
13273
14280
  ...agent,
14281
+ activity: agent.activity?.state,
13274
14282
  model: agent.model?.name,
13275
14283
  parent_agent_id: agent.parent_agent_id ?? ""
13276
14284
  })),
@@ -13286,6 +14294,7 @@ var commandGroups = [
13286
14294
  format: formatRecord(),
13287
14295
  path: zGetAgentPath
13288
14296
  }),
14297
+ agentWaitOp,
13289
14298
  op({
13290
14299
  verb: "launch",
13291
14300
  summary: "Launch a new agent",
@@ -13295,7 +14304,7 @@ var commandGroups = [
13295
14304
  body: zConfigAttachment.extend({
13296
14305
  profile: zAgentProfileId.optional().describe("agent profile ID; runs its current config unless a config is given"),
13297
14306
  name: zAgentName.optional(),
13298
- message: z28.string().optional()
14307
+ message: z29.string().optional()
13299
14308
  }),
13300
14309
  transformBody: ({ profile, name, message, ...attachment }) => ({
13301
14310
  name,
@@ -13335,7 +14344,7 @@ var commandGroups = [
13335
14344
  flowOp({
13336
14345
  verb: "mcp-add",
13337
14346
  summary: "Create an OAuth secret and add an MCP server to an agent",
13338
- path: z28.object({
14347
+ path: z29.object({
13339
14348
  orgID: zOrganizationId,
13340
14349
  projectID: zProjectId,
13341
14350
  agentID: zAgentId
@@ -13351,7 +14360,7 @@ var commandGroups = [
13351
14360
  format: (response) => formatRecord()(response.agent_input),
13352
14361
  path: zCreateAgentInputPath,
13353
14362
  body: zCreateAgentInputBody.partial({ content_blocks: true }).extend({
13354
- 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")
13355
14364
  }).transform(({ message, content_blocks, ...rest }, ctx) => {
13356
14365
  if (content_blocks !== void 0 && message === void 0) {
13357
14366
  return { ...rest, content_blocks };
@@ -13360,7 +14369,7 @@ var commandGroups = [
13360
14369
  return { ...rest, content_blocks: [{ type: "text", text: message }] };
13361
14370
  }
13362
14371
  ctx.addIssue("pass exactly one of --message or --content-blocks");
13363
- return z28.NEVER;
14372
+ return z29.NEVER;
13364
14373
  })
13365
14374
  })
13366
14375
  ],
@@ -13377,8 +14386,8 @@ var commandGroups = [
13377
14386
  format: formatAgentEventList,
13378
14387
  path: zListEventsPath,
13379
14388
  query: zListEventsQuery.extend({
13380
- before_sequence: z28.int().gte(0).optional(),
13381
- after_sequence: z28.int().gte(0).optional()
14389
+ before_sequence: z29.int().gte(0).optional(),
14390
+ after_sequence: z29.int().gte(0).optional()
13382
14391
  })
13383
14392
  }),
13384
14393
  agentEventsStreamOp
@@ -13465,6 +14474,23 @@ var commandGroups = [
13465
14474
  path: zCreateProjectPath,
13466
14475
  body: zCreateProjectBody
13467
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
+ }),
13468
14494
  op({
13469
14495
  verb: "delete",
13470
14496
  summary: "Delete a project",
@@ -13654,7 +14680,7 @@ var commandGroups = [
13654
14680
  fn: sdk_gen_exports.connectByoMachine,
13655
14681
  format: formatMachineSetup,
13656
14682
  path: zConnectByoMachinePath,
13657
- body: zConnectByoMachineBody
14683
+ body: zMachineSetupBody
13658
14684
  }),
13659
14685
  flowOp({
13660
14686
  verb: "create-local",
@@ -13796,6 +14822,13 @@ var commandGroups = [
13796
14822
  path: zListConfiguredModelsPath,
13797
14823
  query: zListConfiguredModelsQuery
13798
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
+ }),
13799
14832
  op({
13800
14833
  verb: "create",
13801
14834
  summary: "Configure a model",
@@ -13874,7 +14907,7 @@ var commandGroups = [
13874
14907
  flowOp({
13875
14908
  verb: "mcp-oauth",
13876
14909
  summary: "Create a secret through an MCP server OAuth flow",
13877
- path: z28.object({ orgID: zOrganizationId }),
14910
+ path: z29.object({ orgID: zOrganizationId }),
13878
14911
  body: zMcpOAuthBody,
13879
14912
  run: runMcpOAuth
13880
14913
  })
@@ -14081,7 +15114,7 @@ var commandGroups = [
14081
15114
  flowOp({
14082
15115
  verb: "mcp-add",
14083
15116
  summary: "Create an OAuth secret and add an MCP server to an agent profile",
14084
- path: z28.object({
15117
+ path: z29.object({
14085
15118
  orgID: zOrganizationId,
14086
15119
  projectID: zProjectId,
14087
15120
  agentProfileID: zAgentProfileId
@@ -14168,6 +15201,13 @@ var commandGroups = [
14168
15201
  path: zListSkillGrantsPath,
14169
15202
  query: zListSkillGrantsQuery
14170
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
+ }),
14171
15211
  op({
14172
15212
  verb: "add",
14173
15213
  summary: "Grant a skill to a project",
@@ -14204,6 +15244,13 @@ var commandGroups = [
14204
15244
  path: zListSecretGrantsPath,
14205
15245
  query: zListSecretGrantsQuery
14206
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
+ }),
14207
15254
  op({
14208
15255
  verb: "add",
14209
15256
  summary: "Grant a secret to a project",
@@ -14240,6 +15287,13 @@ var commandGroups = [
14240
15287
  path: zListProjectMachineGrantsPath,
14241
15288
  query: zListProjectMachineGrantsQuery
14242
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
+ }),
14243
15297
  op({
14244
15298
  verb: "add",
14245
15299
  summary: "Grant a machine to a project",
@@ -14324,6 +15378,13 @@ var commandGroups = [
14324
15378
  path: zListProjectModelGrantsPath,
14325
15379
  query: zListProjectModelGrantsQuery
14326
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
+ }),
14327
15388
  op({
14328
15389
  verb: "add",
14329
15390
  summary: "Grant a configured model to a project",