@wave-ai-os/wave-cli 0.1.67 → 0.1.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -14778,6 +14778,33 @@ var idSchema14 = z19.string().trim().min(1);
14778
14778
  var idempotencyKeySchema = z19.string().min(1).refine((value) => value.trim() === value, "Idempotency key must not have leading or trailing whitespace.");
14779
14779
  var skillScopeSchema = z19.enum(["ADMIN_GLOBAL", "MEMBER_PERSONAL"]);
14780
14780
  var isoDateSchema = z19.iso.date();
14781
+ var nonEmptyStringSchema = z19.string().trim().min(1);
14782
+ var agentToolAccessSchema = z19.array(
14783
+ z19.object({
14784
+ tool_key: nonEmptyStringSchema,
14785
+ scope_value: nonEmptyStringSchema
14786
+ }).strict()
14787
+ ).min(1);
14788
+ var agentPluginConnectionsSchema = z19.array(
14789
+ z19.object({
14790
+ external_tool_connection_id: nonEmptyStringSchema,
14791
+ tool_key: nonEmptyStringSchema,
14792
+ scope_value: nonEmptyStringSchema.optional(),
14793
+ allowed_tools: z19.array(nonEmptyStringSchema).optional(),
14794
+ allowed_scopes: z19.array(nonEmptyStringSchema).optional(),
14795
+ requires_confirmation: z19.boolean().optional(),
14796
+ enabled: z19.boolean().optional()
14797
+ }).strict()
14798
+ ).min(1);
14799
+ var agentTriggerSchema = z19.object({
14800
+ trigger_type: z19.literal("cron"),
14801
+ cron_expression: nonEmptyStringSchema,
14802
+ timezone: nonEmptyStringSchema,
14803
+ starts_at: z19.iso.datetime({ offset: true }).nullable().optional(),
14804
+ ends_at: z19.iso.datetime({ offset: true }).nullable().optional(),
14805
+ max_runs: z19.number().int().positive().nullable().optional(),
14806
+ enabled: z19.boolean().optional()
14807
+ }).strict();
14781
14808
  var AGENT_SELECTION = `{
14782
14809
  id
14783
14810
  type
@@ -14790,11 +14817,51 @@ var AGENT_SELECTION = `{
14790
14817
  model
14791
14818
  runWhenMentioned
14792
14819
  webAccessEnabled
14820
+ trustedUrls
14821
+ toolAccess
14822
+ agentToolConnections {
14823
+ id
14824
+ type
14825
+ attributes {
14826
+ agentId
14827
+ externalToolConnectionId
14828
+ toolKey
14829
+ scopeValue
14830
+ allowedTools
14831
+ allowedScopes
14832
+ requiresConfirmation
14833
+ enabled
14834
+ provider
14835
+ service
14836
+ }
14837
+ }
14838
+ triggers {
14839
+ id
14840
+ triggerType
14841
+ cronExpression
14842
+ timezone
14843
+ startsAt
14844
+ endsAt
14845
+ maxRuns
14846
+ enabled
14847
+ nextOccurrenceAt
14848
+ }
14793
14849
  organizationId
14794
14850
  memberId
14795
14851
  createdAt
14796
14852
  updatedAt
14797
14853
  }`;
14854
+ var AGENT_PLUGIN_CATALOG_SELECTION = `{
14855
+ externalToolConnectionId
14856
+ provider
14857
+ service
14858
+ toolKey
14859
+ displayName
14860
+ requiredScopes
14861
+ defaultConfirmationPolicy
14862
+ connectionState
14863
+ status
14864
+ }`;
14798
14865
  var AUTOMATION_SELECTION = `{
14799
14866
  id
14800
14867
  type
@@ -14855,6 +14922,10 @@ function parseJson(value, optionName) {
14855
14922
  });
14856
14923
  }
14857
14924
  }
14925
+ function parseJsonOption(value, optionName, schema) {
14926
+ if (value === void 0) return void 0;
14927
+ return schema.parse(parseJson(String(value), optionName));
14928
+ }
14858
14929
  function normalizePersistedCreatePayload(payload) {
14859
14930
  const mutation = asRecord8(payload);
14860
14931
  const mutationData = asRecord8(mutation?.data);
@@ -14892,11 +14963,25 @@ function normalizePersistedCreatePayload(payload) {
14892
14963
  }
14893
14964
  function registerAtlasAuthoringCommands(program) {
14894
14965
  const agents = program.command("agents").description("Bounded Agent authoring operations");
14895
- agents.command("create").description("Create an Agent through the API-owned createAgent contract").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--name <name>").option("--description <description>").option("--notes <notes>").option("--member-id <memberId>").option("--status <status>").option("--visibility <visibility>").option("--model <model>").option("--run-when-mentioned <boolean>", "true or false").option("--web-access-enabled <boolean>", "true or false").option("--trusted-urls <urls>", "Comma-separated trusted URLs").action(async (opts, cmd) => {
14966
+ agents.command("create").description("Create an Agent through the API-owned createAgent contract").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--name <name>").option("--description <description>").option("--notes <notes>").option("--member-id <memberId>").option("--status <status>").option("--visibility <visibility>").option("--model <model>").option("--run-when-mentioned <boolean>", "true or false").option("--web-access-enabled <boolean>", "true or false").option("--trusted-urls <urls>", "Comma-separated trusted URLs").option("--tool-access <json>", "JSON array of canonical native Agent tool scopes").option(
14967
+ "--plugin-connections <json>",
14968
+ "JSON array of persisted Agent connector grants"
14969
+ ).option("--trigger <json>", "Canonical cron Agent trigger JSON").action(async (opts, cmd) => {
14896
14970
  const idempotencyKey = idempotencyKeySchema.parse(opts.idempotencyKey);
14897
14971
  const runWhenMentioned = parseBooleanOption(opts.runWhenMentioned, "--run-when-mentioned");
14898
14972
  const webAccessEnabled = parseBooleanOption(opts.webAccessEnabled, "--web-access-enabled");
14899
14973
  const trustedUrls = parseCommaSeparatedStrings(opts.trustedUrls);
14974
+ const toolAccess = parseJsonOption(
14975
+ opts.toolAccess,
14976
+ "--tool-access",
14977
+ agentToolAccessSchema
14978
+ );
14979
+ const pluginConnections = parseJsonOption(
14980
+ opts.pluginConnections,
14981
+ "--plugin-connections",
14982
+ agentPluginConnectionsSchema
14983
+ );
14984
+ const trigger = parseJsonOption(opts.trigger, "--trigger", agentTriggerSchema);
14900
14985
  const context = await resolveCommandContext(cmd.optsWithGlobals());
14901
14986
  const organizationId = resolveOrganizationId(context.organizationId);
14902
14987
  await runGraphqlMutationCommand({
@@ -14922,7 +15007,10 @@ function registerAtlasAuthoringCommands(program) {
14922
15007
  ...opts.model !== void 0 ? { model: String(opts.model) } : {},
14923
15008
  ...runWhenMentioned !== void 0 ? { run_when_mentioned: runWhenMentioned } : {},
14924
15009
  ...webAccessEnabled !== void 0 ? { web_access_enabled: webAccessEnabled } : {},
14925
- ...trustedUrls !== void 0 ? { trusted_urls: trustedUrls } : {}
15010
+ ...trustedUrls !== void 0 ? { trusted_urls: trustedUrls } : {},
15011
+ ...toolAccess !== void 0 ? { tool_access: toolAccess } : {},
15012
+ ...pluginConnections !== void 0 ? { agent_tool_connections_attributes: pluginConnections } : {},
15013
+ ...trigger !== void 0 ? { trigger_attributes: trigger } : {}
14926
15014
  }
14927
15015
  },
14928
15016
  idempotency_key: idempotencyKey
@@ -14945,6 +15033,23 @@ function registerAtlasAuthoringCommands(program) {
14945
15033
  isShow: true
14946
15034
  });
14947
15035
  });
15036
+ agents.command("plugin-catalog").description("Read connected Agent plugin capabilities for one supported service").requiredOption(
15037
+ "--service <service>",
15038
+ "Supported service: gmail, calendar, slack, or stripe"
15039
+ ).action(async (opts, cmd) => {
15040
+ const service = z19.enum(["gmail", "calendar", "slack", "stripe"]).parse(opts.service);
15041
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
15042
+ const organizationId = resolveOrganizationId(context.organizationId);
15043
+ await runGraphqlQueryCommand({
15044
+ command: "agents.plugin-catalog",
15045
+ operationName: "AgentsPluginCatalog",
15046
+ runtimeOptions: context.runtimeOptions,
15047
+ field: "external_tool_catalog",
15048
+ variables: { organization_id: organizationId, service },
15049
+ variableTypes: { organization_id: "ID!", service: "String!" },
15050
+ selectionSet: AGENT_PLUGIN_CATALOG_SELECTION
15051
+ });
15052
+ });
14948
15053
  const automations = program.command("automations").description("Bounded Automation authoring operations");
14949
15054
  automations.command("create").description("Create an Automation through the API-owned createAutomation contract").requiredOption("--summary <summary>").requiredOption("--ai-task-config <json>", "Valid JSON for the API-owned ai_task_config field").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--description <description>").option("--notes <notes>").option("--member-id <memberId>").option("--agent-id <agentId>", "Optional executor Agent id for a repeat Automation").option("--status <status>").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").action(async (opts, cmd) => {
14950
15055
  const idempotencyKey = idempotencyKeySchema.parse(opts.idempotencyKey);
@@ -15029,6 +15134,650 @@ function registerAtlasAuthoringCommands(program) {
15029
15134
  // src/commands/discovery.ts
15030
15135
  import { existsSync as existsSync3, readFileSync } from "fs";
15031
15136
  import { join as join3 } from "path";
15137
+
15138
+ // src/operationManifest.ts
15139
+ import { createHash } from "crypto";
15140
+
15141
+ // src/version.ts
15142
+ var CLI_VERSION = "0.1.70";
15143
+
15144
+ // src/operationMetadata.ts
15145
+ var DISCOVERY_OPERATION_IDS = [
15146
+ "accountability.examples",
15147
+ "accountability.schema",
15148
+ "agents.examples",
15149
+ "agents.schema",
15150
+ "api.examples",
15151
+ "api.ls",
15152
+ "api.schema",
15153
+ "auth.examples",
15154
+ "auth.schema",
15155
+ "automations.examples",
15156
+ "automations.schema",
15157
+ "broadcast.examples",
15158
+ "broadcast.schema",
15159
+ "capabilities.examples",
15160
+ "capabilities.list",
15161
+ "capabilities.schema",
15162
+ "capabilities.tools",
15163
+ "contacts.examples",
15164
+ "contacts.schema",
15165
+ "content.examples",
15166
+ "content.schema",
15167
+ "customers.examples",
15168
+ "customers.schema",
15169
+ "datasheets.examples",
15170
+ "datasheets.schema",
15171
+ "doctor",
15172
+ "doctor.examples",
15173
+ "doctor.schema",
15174
+ "feedbacks.examples",
15175
+ "feedbacks.schema",
15176
+ "foundation.examples",
15177
+ "foundation.schema",
15178
+ "issue-groups.examples",
15179
+ "issue-groups.schema",
15180
+ "issues.examples",
15181
+ "issues.schema",
15182
+ "knowledge.examples",
15183
+ "knowledge.schema",
15184
+ "kpis.examples",
15185
+ "kpis.schema",
15186
+ "list-items.examples",
15187
+ "list-items.schema",
15188
+ "lists.examples",
15189
+ "lists.schema",
15190
+ "mail.examples",
15191
+ "mail.schema",
15192
+ "markdown-tree.examples",
15193
+ "markdown-tree.schema",
15194
+ "meetings.examples",
15195
+ "meetings.schema",
15196
+ "members.examples",
15197
+ "members.schema",
15198
+ "milestones.examples",
15199
+ "milestones.schema",
15200
+ "news.examples",
15201
+ "news.schema",
15202
+ "organizations.examples",
15203
+ "organizations.schema",
15204
+ "osmd.examples",
15205
+ "osmd.schema",
15206
+ "planner.examples",
15207
+ "planner.schema",
15208
+ "project-content.examples",
15209
+ "project-content.schema",
15210
+ "projects.examples",
15211
+ "projects.schema",
15212
+ "pulse.examples",
15213
+ "pulse.schema",
15214
+ "questions.examples",
15215
+ "questions.schema",
15216
+ "recognition.examples",
15217
+ "recognition.schema",
15218
+ "rock-collections.examples",
15219
+ "rock-collections.schema",
15220
+ "rocks.examples",
15221
+ "rocks.schema",
15222
+ "scorecard-groups.examples",
15223
+ "scorecard-groups.schema",
15224
+ "scorecards.examples",
15225
+ "scorecards.schema",
15226
+ "skills.examples",
15227
+ "skills.schema",
15228
+ "stand-ups.examples",
15229
+ "stand-ups.schema",
15230
+ "subissues.examples",
15231
+ "subissues.schema",
15232
+ "subitems.examples",
15233
+ "subitems.schema",
15234
+ "subtasks.examples",
15235
+ "subtasks.schema",
15236
+ "subtodos.examples",
15237
+ "subtodos.schema",
15238
+ "support.examples",
15239
+ "support.schema",
15240
+ "surveys.examples",
15241
+ "surveys.schema",
15242
+ "talking-points.examples",
15243
+ "talking-points.schema",
15244
+ "tasks.examples",
15245
+ "tasks.schema",
15246
+ "teams.examples",
15247
+ "teams.schema",
15248
+ "time-tracking.examples",
15249
+ "time-tracking.schema",
15250
+ "todo-groups.examples",
15251
+ "todo-groups.schema",
15252
+ "todos.examples",
15253
+ "todos.schema",
15254
+ "whiteboards.examples",
15255
+ "whiteboards.schema"
15256
+ ];
15257
+ var READ_OPERATION_IDS = [
15258
+ "accountability.list",
15259
+ "accountability.search",
15260
+ "accountability.show",
15261
+ "agents.plugin-catalog",
15262
+ "agents.show",
15263
+ "auth.status",
15264
+ "automations.show",
15265
+ "broadcast.community",
15266
+ "broadcast.list",
15267
+ "broadcast.open",
15268
+ "broadcast.workspace",
15269
+ "cat",
15270
+ "contacts.list",
15271
+ "contacts.search",
15272
+ "contacts.show",
15273
+ "content.list",
15274
+ "content.show",
15275
+ "customers.list",
15276
+ "customers.search",
15277
+ "customers.show",
15278
+ "datasheets.list",
15279
+ "datasheets.open",
15280
+ "datasheets.show",
15281
+ "feedbacks.list",
15282
+ "feedbacks.search",
15283
+ "feedbacks.show",
15284
+ "find",
15285
+ "foundation.annual-objectives.list",
15286
+ "foundation.annual-objectives.search",
15287
+ "foundation.annual-objectives.show",
15288
+ "foundation.quarterly-objectives.list",
15289
+ "foundation.quarterly-objectives.search",
15290
+ "foundation.quarterly-objectives.show",
15291
+ "foundation.strategic-objectives.show",
15292
+ "foundation.strategic-plans.show",
15293
+ "issue-groups.list",
15294
+ "issue-groups.search",
15295
+ "issue-groups.show",
15296
+ "issues.list",
15297
+ "issues.search",
15298
+ "issues.show",
15299
+ "knowledge.list",
15300
+ "knowledge.search",
15301
+ "knowledge.show",
15302
+ "kpis.list",
15303
+ "kpis.search",
15304
+ "kpis.show",
15305
+ "list-items.list",
15306
+ "list-items.search",
15307
+ "list-items.show",
15308
+ "lists.list",
15309
+ "lists.search",
15310
+ "lists.show",
15311
+ "ls",
15312
+ "mail.accounts",
15313
+ "mail.conversation",
15314
+ "mail.conversations",
15315
+ "mail.labels",
15316
+ "mail.message",
15317
+ "mail.messages",
15318
+ "mail.open",
15319
+ "mail.settings",
15320
+ "mail.snippets",
15321
+ "mail.sync-status",
15322
+ "mail.unread-count",
15323
+ "mail.validate-provider",
15324
+ "mail.workspace",
15325
+ "markdown-tree.children",
15326
+ "markdown-tree.resolve",
15327
+ "markdown-tree.root",
15328
+ "markdown-tree.subtree",
15329
+ "meetings.list",
15330
+ "meetings.search",
15331
+ "meetings.show",
15332
+ "members.list",
15333
+ "members.meta-profile",
15334
+ "members.search",
15335
+ "members.show",
15336
+ "milestones.list",
15337
+ "milestones.search",
15338
+ "news.list",
15339
+ "news.search",
15340
+ "news.show",
15341
+ "open",
15342
+ "organizations.key-metric-meta-profile.show",
15343
+ "organizations.meta-profile.show",
15344
+ "organizations.show",
15345
+ "osmd.agent.children",
15346
+ "osmd.agent.read",
15347
+ "osmd.agent.status",
15348
+ "osmd.children",
15349
+ "osmd.lint",
15350
+ "osmd.memory-quality",
15351
+ "osmd.read",
15352
+ "osmd.search",
15353
+ "osmd.status",
15354
+ "osmd.tree",
15355
+ "osmd.wiki.read",
15356
+ "osmd.wiki.status",
15357
+ "phantom.apply-operation",
15358
+ "phantom.apply-operations",
15359
+ "phantom.candidate",
15360
+ "phantom.candidates",
15361
+ "phantom.evidence",
15362
+ "phantom.evidences",
15363
+ "phantom.inventory",
15364
+ "phantom.observation",
15365
+ "phantom.observations",
15366
+ "phantom.report",
15367
+ "phantom.validation",
15368
+ "phantom.validations",
15369
+ "planner.booking-links",
15370
+ "planner.events",
15371
+ "planner.open",
15372
+ "planner.preferences",
15373
+ "planner.public-booking-link",
15374
+ "planner.state",
15375
+ "projects.list",
15376
+ "projects.search",
15377
+ "projects.show",
15378
+ "pulse.list",
15379
+ "pulse.search",
15380
+ "pulse.show",
15381
+ "questions.list",
15382
+ "questions.search",
15383
+ "questions.show",
15384
+ "recognition.list",
15385
+ "recognition.open",
15386
+ "recognition.point-balance",
15387
+ "recognition.show",
15388
+ "recognition.top-value",
15389
+ "rock-collections.list",
15390
+ "rock-collections.search",
15391
+ "rock-collections.show",
15392
+ "rocks.list",
15393
+ "rocks.search",
15394
+ "rocks.show",
15395
+ "scorecard-groups.list",
15396
+ "scorecard-groups.search",
15397
+ "scorecard-groups.show",
15398
+ "scorecards.list",
15399
+ "scorecards.search",
15400
+ "scorecards.show",
15401
+ "skills.list",
15402
+ "skills.show",
15403
+ "stand-ups.list",
15404
+ "stand-ups.search",
15405
+ "stand-ups.show",
15406
+ "subissues.list",
15407
+ "subissues.search",
15408
+ "subitems.list",
15409
+ "subitems.search",
15410
+ "subtasks.list",
15411
+ "subtasks.search",
15412
+ "subtodos.list",
15413
+ "subtodos.search",
15414
+ "support.counts",
15415
+ "support.inbox",
15416
+ "support.knowledge-articles",
15417
+ "support.knowledge-collections",
15418
+ "support.labels",
15419
+ "support.open",
15420
+ "support.settings",
15421
+ "support.ticket-counts",
15422
+ "support.tickets",
15423
+ "surveys.list",
15424
+ "surveys.search",
15425
+ "surveys.show",
15426
+ "talking-points.list",
15427
+ "talking-points.search",
15428
+ "tasks.list",
15429
+ "tasks.search",
15430
+ "tasks.show",
15431
+ "teams.list",
15432
+ "teams.show",
15433
+ "time-tracking.entries",
15434
+ "time-tracking.open",
15435
+ "time-tracking.projects",
15436
+ "time-tracking.report",
15437
+ "time-tracking.show",
15438
+ "time-tracking.timer",
15439
+ "time-tracking.timesheet",
15440
+ "todo-groups.list",
15441
+ "todo-groups.search",
15442
+ "todo-groups.show",
15443
+ "todos.list",
15444
+ "todos.search",
15445
+ "todos.show",
15446
+ "tree",
15447
+ "whiteboards.list",
15448
+ "whiteboards.open",
15449
+ "whiteboards.show"
15450
+ ];
15451
+ var WRITE_OPERATION_IDS = [
15452
+ "accountability.create",
15453
+ "accountability.update",
15454
+ "agents.create",
15455
+ "automations.create",
15456
+ "contacts.create",
15457
+ "contacts.update",
15458
+ "content.create-contact",
15459
+ "content.create-customer",
15460
+ "content.create-manager",
15461
+ "content.create-member",
15462
+ "content.create-project",
15463
+ "content.create-team",
15464
+ "content.destroy",
15465
+ "content.update",
15466
+ "customers.create",
15467
+ "customers.update",
15468
+ "datasheets.archive",
15469
+ "datasheets.cell.upsert",
15470
+ "datasheets.column.archive",
15471
+ "datasheets.column.create",
15472
+ "datasheets.column.delete",
15473
+ "datasheets.column.reorder",
15474
+ "datasheets.column.update",
15475
+ "datasheets.create",
15476
+ "datasheets.export.create",
15477
+ "datasheets.favorite",
15478
+ "datasheets.form.archive",
15479
+ "datasheets.form.close",
15480
+ "datasheets.form.create",
15481
+ "datasheets.form.delete",
15482
+ "datasheets.form.publish",
15483
+ "datasheets.form.submit",
15484
+ "datasheets.form.update",
15485
+ "datasheets.import.commit",
15486
+ "datasheets.row.archive",
15487
+ "datasheets.row.create",
15488
+ "datasheets.row.delete",
15489
+ "datasheets.row.reorder",
15490
+ "datasheets.row.update",
15491
+ "datasheets.update",
15492
+ "datasheets.view.archive",
15493
+ "datasheets.view.create",
15494
+ "datasheets.view.delete",
15495
+ "datasheets.view.reorder",
15496
+ "datasheets.view.update",
15497
+ "feedbacks.create",
15498
+ "feedbacks.update",
15499
+ "foundation.annual-objectives.create",
15500
+ "foundation.annual-objectives.update",
15501
+ "foundation.quarterly-objectives.create",
15502
+ "foundation.quarterly-objectives.update",
15503
+ "foundation.strategic-objectives.update",
15504
+ "foundation.strategic-plans.update",
15505
+ "issue-groups.create",
15506
+ "issue-groups.update",
15507
+ "issues.create",
15508
+ "issues.update",
15509
+ "knowledge.create",
15510
+ "knowledge.update",
15511
+ "kpis.create",
15512
+ "kpis.update",
15513
+ "list-items.create",
15514
+ "list-items.update",
15515
+ "lists.create",
15516
+ "lists.update",
15517
+ "meetings.create",
15518
+ "meetings.notes",
15519
+ "meetings.update",
15520
+ "members.create",
15521
+ "members.update",
15522
+ "milestones.create",
15523
+ "milestones.destroy",
15524
+ "milestones.update",
15525
+ "news.create",
15526
+ "news.update",
15527
+ "organizations.key-metric-meta-profile.update",
15528
+ "organizations.meta-profile.update",
15529
+ "organizations.update",
15530
+ "osmd.agent.create",
15531
+ "osmd.agent.init",
15532
+ "osmd.agent.update",
15533
+ "osmd.ingest.file",
15534
+ "osmd.ingest.text",
15535
+ "osmd.ingest.transcript",
15536
+ "osmd.ingest.url",
15537
+ "osmd.phantom.run",
15538
+ "osmd.wiki.append-log",
15539
+ "osmd.wiki.create",
15540
+ "osmd.wiki.index-upsert",
15541
+ "osmd.wiki.update",
15542
+ "project-content.create",
15543
+ "project-content.destroy",
15544
+ "project-content.update",
15545
+ "projects.create",
15546
+ "projects.update",
15547
+ "pulse.create",
15548
+ "pulse.update",
15549
+ "questions.create",
15550
+ "questions.update",
15551
+ "rock-collections.create",
15552
+ "rock-collections.update",
15553
+ "rocks.create",
15554
+ "rocks.update",
15555
+ "rocks.update-status",
15556
+ "scorecard-groups.create",
15557
+ "scorecard-groups.update",
15558
+ "scorecards.create",
15559
+ "scorecards.update",
15560
+ "skills.create",
15561
+ "smart-kpi-views.create",
15562
+ "stand-ups.create",
15563
+ "stand-ups.update",
15564
+ "subissues.create",
15565
+ "subissues.destroy",
15566
+ "subissues.update",
15567
+ "subitems.create",
15568
+ "subitems.destroy",
15569
+ "subitems.update",
15570
+ "subtasks.create",
15571
+ "subtasks.destroy",
15572
+ "subtasks.update",
15573
+ "subtodos.create",
15574
+ "subtodos.destroy",
15575
+ "subtodos.update",
15576
+ "surveys.create",
15577
+ "surveys.update",
15578
+ "talking-points.create",
15579
+ "talking-points.destroy",
15580
+ "talking-points.update",
15581
+ "tasks.create",
15582
+ "tasks.destroy",
15583
+ "tasks.update",
15584
+ "teams.create",
15585
+ "teams.update",
15586
+ "todo-groups.create",
15587
+ "todo-groups.update",
15588
+ "todos.create",
15589
+ "todos.update"
15590
+ ];
15591
+ var AUTH_OPERATION_IDS = ["login", "logout"];
15592
+ var DESTRUCTIVE_OPERATION_IDS = /* @__PURE__ */ new Set([
15593
+ "content.destroy",
15594
+ "datasheets.archive",
15595
+ "datasheets.column.archive",
15596
+ "datasheets.column.delete",
15597
+ "datasheets.form.archive",
15598
+ "datasheets.form.close",
15599
+ "datasheets.form.delete",
15600
+ "datasheets.form.publish",
15601
+ "datasheets.form.submit",
15602
+ "datasheets.import.commit",
15603
+ "datasheets.row.archive",
15604
+ "datasheets.row.delete",
15605
+ "datasheets.view.archive",
15606
+ "datasheets.view.delete",
15607
+ "milestones.destroy",
15608
+ "project-content.destroy",
15609
+ "subissues.destroy",
15610
+ "subitems.destroy",
15611
+ "subtasks.destroy",
15612
+ "subtodos.destroy",
15613
+ "talking-points.destroy",
15614
+ "tasks.destroy"
15615
+ ]);
15616
+ var OPERATION_IDS_BY_CLASSIFICATION = {
15617
+ discovery: DISCOVERY_OPERATION_IDS,
15618
+ read: READ_OPERATION_IDS,
15619
+ write: WRITE_OPERATION_IDS,
15620
+ auth: AUTH_OPERATION_IDS
15621
+ };
15622
+ var metadataByOperationId = /* @__PURE__ */ new Map();
15623
+ for (const [classification, operationIds] of Object.entries(OPERATION_IDS_BY_CLASSIFICATION)) {
15624
+ for (const id of operationIds) {
15625
+ if (metadataByOperationId.has(id)) {
15626
+ throw new Error(`Duplicate Wave CLI operation metadata: ${id}`);
15627
+ }
15628
+ const atlasSafetyClass = classification === "discovery" ? "discovery" : classification === "read" ? "read_only" : classification === "auth" ? "auth" : DESTRUCTIVE_OPERATION_IDS.has(id) ? "destructive" : "mutation";
15629
+ if (DESTRUCTIVE_OPERATION_IDS.has(id) && classification !== "write") {
15630
+ throw new Error(`Destructive Wave CLI operation must be a write: ${id}`);
15631
+ }
15632
+ metadataByOperationId.set(id, {
15633
+ classification,
15634
+ requiresApproval: classification === "write",
15635
+ atlasSafetyClass,
15636
+ machine: {
15637
+ supportsValidate: true,
15638
+ supportsPreview: classification === "write",
15639
+ supportsExecute: true,
15640
+ executionMode: "sync"
15641
+ }
15642
+ });
15643
+ }
15644
+ }
15645
+ function registeredOperationMetadata(id) {
15646
+ return metadataByOperationId.get(id);
15647
+ }
15648
+
15649
+ // src/operationManifest.ts
15650
+ var MACHINE_PRESENTATION_OPTIONS = /* @__PURE__ */ new Set(["json", "readable"]);
15651
+ function hasAction(command) {
15652
+ return Boolean(command._actionHandler);
15653
+ }
15654
+ function commandPath(command) {
15655
+ const path = [];
15656
+ let current = command;
15657
+ while (current) {
15658
+ const name = current.name();
15659
+ if (name) path.unshift(name);
15660
+ current = current.parent ?? null;
15661
+ }
15662
+ return path;
15663
+ }
15664
+ function operationId(path) {
15665
+ return path.slice(1).join(".");
15666
+ }
15667
+ function inputKeyForArgument(argument) {
15668
+ return argument.name().replace(/<|>|\[|\]|\.\.\./g, "");
15669
+ }
15670
+ function inputSchemaFor(command) {
15671
+ const properties = {};
15672
+ const required = [];
15673
+ for (const argument of command.registeredArguments) {
15674
+ const key = inputKeyForArgument(argument);
15675
+ properties[key] = {
15676
+ type: argument.variadic ? "array" : "string",
15677
+ ...argument.description ? { description: argument.description } : {}
15678
+ };
15679
+ if (argument.required) required.push(key);
15680
+ }
15681
+ for (const option of command.options) {
15682
+ const key = option.attributeName();
15683
+ if (MACHINE_PRESENTATION_OPTIONS.has(key)) continue;
15684
+ properties[key] = {
15685
+ type: option.required ? "string" : option.optional ? ["boolean", "string"] : "boolean",
15686
+ ...option.description ? { description: option.description } : {}
15687
+ };
15688
+ if (option.mandatory) required.push(key);
15689
+ }
15690
+ return {
15691
+ type: "object",
15692
+ additionalProperties: false,
15693
+ properties,
15694
+ required: required.sort()
15695
+ };
15696
+ }
15697
+ function exampleFor(inputSchema) {
15698
+ const input = {};
15699
+ for (const key of inputSchema.required) {
15700
+ const propertyType = inputSchema.properties[key]?.type;
15701
+ const types = Array.isArray(propertyType) ? propertyType : [propertyType];
15702
+ input[key] = types.includes("array") ? ["example"] : types.includes("boolean") ? true : "example";
15703
+ }
15704
+ return [{ name: "minimal valid input", input }];
15705
+ }
15706
+ function outputSchema() {
15707
+ return {
15708
+ $schema: "https://json-schema.org/draft/2020-12/schema",
15709
+ type: "object",
15710
+ additionalProperties: false,
15711
+ properties: {
15712
+ ok: { type: "boolean" },
15713
+ command: { type: "string" },
15714
+ status: { type: "number" },
15715
+ data: { type: ["object", "array", "string", "number", "boolean", "null"] },
15716
+ error: { type: ["object", "null"] },
15717
+ meta: { type: "object" }
15718
+ },
15719
+ required: ["ok", "command", "status", "data", "error", "meta"]
15720
+ };
15721
+ }
15722
+ function listInvocableCommands(program) {
15723
+ const result = [];
15724
+ const visit = (command) => {
15725
+ if (command.name() !== "help" && hasAction(command)) result.push(command);
15726
+ for (const child of command.commands) visit(child);
15727
+ };
15728
+ for (const command of program.commands) visit(command);
15729
+ return result;
15730
+ }
15731
+ function entryFor(command, metadata) {
15732
+ const path = commandPath(command);
15733
+ const inputSchema = inputSchemaFor(command);
15734
+ const summary = command.description() || `Run ${path.join(" ")}.`;
15735
+ return {
15736
+ id: operationId(path),
15737
+ path,
15738
+ command: path.join(" "),
15739
+ summary,
15740
+ description: summary,
15741
+ classification: metadata.classification,
15742
+ requiresApproval: metadata.requiresApproval,
15743
+ atlasSafetyClass: metadata.atlasSafetyClass,
15744
+ inputSchema,
15745
+ outputSchema: outputSchema(),
15746
+ examples: exampleFor(inputSchema),
15747
+ machine: metadata.machine
15748
+ };
15749
+ }
15750
+ function digestFor(operations) {
15751
+ const canonical = JSON.stringify(operations);
15752
+ return `sha256:${createHash("sha256").update(canonical).digest("hex")}`;
15753
+ }
15754
+ function buildOperationManifest(program) {
15755
+ const operations = listInvocableCommands(program).map((command) => {
15756
+ const path = commandPath(command);
15757
+ const id = operationId(path);
15758
+ const metadata = registeredOperationMetadata(id);
15759
+ if (!metadata) {
15760
+ throw new Error(`Missing explicit Wave CLI operation metadata: ${id}`);
15761
+ }
15762
+ return entryFor(command, metadata);
15763
+ }).sort((left, right) => left.id.localeCompare(right.id));
15764
+ const seen = /* @__PURE__ */ new Set();
15765
+ for (const operation of operations) {
15766
+ if (seen.has(operation.id)) {
15767
+ throw new Error(`Duplicate Wave CLI operation id: ${operation.id}`);
15768
+ }
15769
+ seen.add(operation.id);
15770
+ }
15771
+ return {
15772
+ manifestVersion: "1",
15773
+ cli: { package: "@wave-ai-os/wave-cli", version: CLI_VERSION },
15774
+ registryDigest: digestFor(operations),
15775
+ operationCount: operations.length,
15776
+ operations
15777
+ };
15778
+ }
15779
+
15780
+ // src/commands/discovery.ts
15032
15781
  var PRIMARY_NAMESPACES = [
15033
15782
  "osmd",
15034
15783
  "broadcast",
@@ -15185,6 +15934,7 @@ var NAMESPACE_DOCS = {
15185
15934
  description: "Bounded Agent create and persisted readback operations.",
15186
15935
  examples: [
15187
15936
  'wave agents create --name "Planning helper" --idempotency-key agent-create-001',
15937
+ `wave agents create --name "Project summary" --notes "Summarize my projects." --tool-access '[{"tool_key":"projects","scope_value":"all"}]' --trigger '{"trigger_type":"cron","cron_expression":"0 14 * * 2","timezone":"America/Phoenix","enabled":true}' --idempotency-key agent-create-002`,
15188
15938
  "wave agents show --id 123"
15189
15939
  ],
15190
15940
  schema: {
@@ -15193,6 +15943,8 @@ var NAMESPACE_DOCS = {
15193
15943
  safety: [
15194
15944
  "Create calls only createAgent with an explicit idempotency key.",
15195
15945
  "Create preserves API-owned defaults by sending only supplied typed Agent fields.",
15946
+ "Native tools, plugin connector grants, and the cron trigger use strict canonical JSON shapes.",
15947
+ "Outlook Calendar and Outlook Mail are not supported Agent plugin families in this release.",
15196
15948
  "Show uses the API-owned agent query by id; no slug fallback is implemented."
15197
15949
  ],
15198
15950
  commands: ["create", "show"]
@@ -15637,13 +16389,6 @@ function readableToolSupport(key) {
15637
16389
  ].join("\n");
15638
16390
  }).join("\n\n");
15639
16391
  }
15640
- function commandPaths(command, prefix = command.name()) {
15641
- const children = command.commands.filter((child) => !child.name().startsWith("help"));
15642
- if (children.length === 0) {
15643
- return [prefix];
15644
- }
15645
- return children.flatMap((child) => commandPaths(child, `${prefix} ${child.name()}`));
15646
- }
15647
16392
  function commandSummary(command) {
15648
16393
  return {
15649
16394
  name: command.name(),
@@ -15888,12 +16633,16 @@ function registerDiscoveryCommands(program) {
15888
16633
  });
15889
16634
  const api = program.command("api").description("Discover Wave API-backed CLI operations");
15890
16635
  api.command("ls").description("List scriptable command paths").option("--readable", "Print command paths as plain lines").option("--json", "Emit the stable JSON envelope").action((opts) => {
15891
- const paths = commandPaths(program).filter((path) => path !== "wave");
16636
+ const manifest = buildOperationManifest(program);
16637
+ const paths = manifest.operations.map((operation) => operation.command);
15892
16638
  if (opts.readable && !opts.json) {
15893
16639
  return printTextAndExit({ text: paths.join("\n") });
15894
16640
  }
15895
16641
  return printEnvelopeAndExit({
15896
16642
  envelope: buildEnvelope2("api.ls", {
16643
+ ...manifest,
16644
+ // Retained as a derived compatibility projection for existing CLI
16645
+ // callers. The manifest above is the sole inventory source.
15897
16646
  commands: paths,
15898
16647
  examples: ["wave api ls --json"]
15899
16648
  })
@@ -15990,9 +16739,6 @@ function attachDiscoveryHelp(program) {
15990
16739
  }
15991
16740
  }
15992
16741
 
15993
- // src/version.ts
15994
- var CLI_VERSION = "0.1.67";
15995
-
15996
16742
  // src/cli.ts
15997
16743
  function buildCli(options) {
15998
16744
  const program = new Command();
@@ -16074,6 +16820,371 @@ function buildCli(options) {
16074
16820
  return program;
16075
16821
  }
16076
16822
 
16823
+ // src/machine.ts
16824
+ import { createHash as createHash2 } from "crypto";
16825
+ var MACHINE_FLAGS = /* @__PURE__ */ new Set([
16826
+ "--machine",
16827
+ "--operation",
16828
+ "--phase",
16829
+ "--input-json"
16830
+ ]);
16831
+ function machineEnvelope(params) {
16832
+ return {
16833
+ ok: params.ok,
16834
+ command: params.command,
16835
+ status: params.status,
16836
+ data: params.data ?? null,
16837
+ error: params.error ?? null,
16838
+ meta: { requestId: "machine" }
16839
+ };
16840
+ }
16841
+ function isPlainObject(value) {
16842
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
16843
+ }
16844
+ function hasAction2(command) {
16845
+ return Boolean(command._actionHandler);
16846
+ }
16847
+ function commandId(command) {
16848
+ const path = [];
16849
+ let current = command;
16850
+ while (current) {
16851
+ if (current.name()) path.unshift(current.name());
16852
+ current = current.parent;
16853
+ }
16854
+ return path.slice(1).join(".");
16855
+ }
16856
+ function parseMachineArgs(argv) {
16857
+ const values = {};
16858
+ for (let index = 0; index < argv.length; index += 1) {
16859
+ const flag = argv[index];
16860
+ if (!MACHINE_FLAGS.has(flag)) {
16861
+ return { error: `Unsupported machine flag: ${flag}` };
16862
+ }
16863
+ const value = argv[index + 1];
16864
+ if (!value || value.startsWith("--")) {
16865
+ return { error: `Missing value for ${flag}` };
16866
+ }
16867
+ if (flag in values) return { error: `Machine flag may be supplied only once: ${flag}` };
16868
+ values[flag] = value;
16869
+ index += 1;
16870
+ }
16871
+ if (values["--machine"] !== "execute") {
16872
+ return { error: '--machine must be "execute".' };
16873
+ }
16874
+ return {
16875
+ operation: values["--operation"],
16876
+ phase: values["--phase"],
16877
+ inputJson: values["--input-json"]
16878
+ };
16879
+ }
16880
+ async function readMachineInput(location) {
16881
+ if (location !== "-") {
16882
+ throw new Error('Machine input must be supplied with "--input-json -".');
16883
+ }
16884
+ let raw = "";
16885
+ process.stdin.setEncoding("utf8");
16886
+ for await (const chunk of process.stdin) raw += chunk;
16887
+ if (!raw.trim()) throw new Error("Machine input JSON is required.");
16888
+ const parsed = JSON.parse(raw);
16889
+ if (!isPlainObject(parsed)) throw new Error("Machine input must be a JSON object.");
16890
+ return parsed;
16891
+ }
16892
+ function inputDigest(input) {
16893
+ return `sha256:${createHash2("sha256").update(canonicalJson(input)).digest("hex")}`;
16894
+ }
16895
+ function canonicalJson(value) {
16896
+ if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
16897
+ if (isPlainObject(value)) {
16898
+ return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key])}`).join(",")}}`;
16899
+ }
16900
+ return JSON.stringify(value);
16901
+ }
16902
+ function normalizeInput(input) {
16903
+ return Object.fromEntries(
16904
+ Object.keys(input).sort().map((key) => [key, input[key]])
16905
+ );
16906
+ }
16907
+ function parseTrustedJson(name, predicate) {
16908
+ const raw = process.env[name];
16909
+ if (!raw) return null;
16910
+ try {
16911
+ const parsed = JSON.parse(raw);
16912
+ return predicate(parsed) ? parsed : null;
16913
+ } catch {
16914
+ return null;
16915
+ }
16916
+ }
16917
+ function isTrustedAuth(value) {
16918
+ return isPlainObject(value) && typeof value.token === "string" && value.token.trim() !== "" && typeof value.baseUrl === "string" && value.baseUrl.trim() !== "" && typeof value.organizationId === "string" && value.organizationId.trim() !== "" && typeof value.actorId === "string" && value.actorId.trim() !== "";
16919
+ }
16920
+ function isTrustedApproval(value) {
16921
+ return isPlainObject(value) && typeof value.operation === "string" && typeof value.inputDigest === "string" && typeof value.cliVersion === "string" && typeof value.registryDigest === "string" && typeof value.organizationId === "string" && value.organizationId.trim() !== "" && typeof value.actorId === "string" && value.actorId.trim() !== "";
16922
+ }
16923
+ function operationCommand(program, id) {
16924
+ return listInvocableCommands(program).find((command) => commandId(command) === id);
16925
+ }
16926
+ function typeMatches(value, type) {
16927
+ if (type === "array") return Array.isArray(value);
16928
+ if (type === "null") return value === null;
16929
+ if (type === "object") return isPlainObject(value);
16930
+ return typeof value === type;
16931
+ }
16932
+ function validateInput(operation, input) {
16933
+ const allowed = new Set(Object.keys(operation.inputSchema.properties));
16934
+ const unknown = Object.keys(input).filter((key) => !allowed.has(key));
16935
+ const missing = operation.inputSchema.required.filter(
16936
+ (key) => input[key] === void 0 || input[key] === null || input[key] === ""
16937
+ );
16938
+ const typeErrors = Object.entries(input).flatMap(([key, value]) => {
16939
+ const property = operation.inputSchema.properties[key];
16940
+ if (!property) return [];
16941
+ const types = Array.isArray(property.type) ? property.type : [property.type];
16942
+ return types.some((type) => typeMatches(value, type)) ? [] : [`Invalid input type for ${key}: expected ${types.join(" or ")}.`];
16943
+ });
16944
+ return [
16945
+ ...unknown.map((key) => `Unknown input property: ${key}`),
16946
+ ...missing.map((key) => `Missing required input property: ${key}`),
16947
+ ...typeErrors
16948
+ ];
16949
+ }
16950
+ function optionValue(value) {
16951
+ return typeof value === "string" ? value : JSON.stringify(value);
16952
+ }
16953
+ function commandArgs(command, input) {
16954
+ const path = [];
16955
+ let current = command;
16956
+ while (current) {
16957
+ if (current.name()) path.unshift(current.name());
16958
+ current = current.parent;
16959
+ }
16960
+ const args = path.slice(1);
16961
+ for (const argument of command.registeredArguments) {
16962
+ const key = argument.name().replace(/<|>|\[|\]|\.\.\./g, "");
16963
+ const value = input[key];
16964
+ if (value === void 0) continue;
16965
+ if (Array.isArray(value)) args.push(...value.map(optionValue));
16966
+ else args.push(optionValue(value));
16967
+ }
16968
+ for (const option of command.options) {
16969
+ const key = option.attributeName();
16970
+ const value = input[key];
16971
+ if (value === void 0 || value === false) continue;
16972
+ const long = option.long;
16973
+ if (!long) continue;
16974
+ if (value === true) args.push(long);
16975
+ else args.push(long, optionValue(value));
16976
+ }
16977
+ return args;
16978
+ }
16979
+ function withTrustedMachineAuth(auth, callback) {
16980
+ const previousWaveEnvironment = Object.fromEntries(
16981
+ Object.entries(process.env).filter(([key]) => key.startsWith("WAVE_"))
16982
+ );
16983
+ for (const key of Object.keys(process.env)) {
16984
+ if (key.startsWith("WAVE_")) delete process.env[key];
16985
+ }
16986
+ if (auth) {
16987
+ process.env.WAVE_API_TOKEN = auth.token;
16988
+ process.env.WAVE_API_BASE_URL = auth.baseUrl;
16989
+ }
16990
+ process.env.WAVE_CLI_AUTH_STORAGE = "disabled";
16991
+ process.env.WAVE_CLI_HOME = "/dev/null";
16992
+ return callback().finally(() => {
16993
+ for (const key of Object.keys(process.env)) {
16994
+ if (key.startsWith("WAVE_")) delete process.env[key];
16995
+ }
16996
+ Object.assign(process.env, previousWaveEnvironment);
16997
+ });
16998
+ }
16999
+ function needsTrustedAuth(operation) {
17000
+ return operation.classification === "read" || operation.classification === "write" || operation.classification === "auth";
17001
+ }
17002
+ function resolveMachineOperation(program, id) {
17003
+ const manifest = buildOperationManifest(program);
17004
+ const operation = manifest.operations.find((candidate) => candidate.id === id);
17005
+ const command = operation ? operationCommand(program, id) : void 0;
17006
+ return operation && command && hasAction2(command) ? { operation, command } : null;
17007
+ }
17008
+ async function maybeRunMachineExecute(argv, program) {
17009
+ if (argv[0] !== "--machine") return false;
17010
+ const parsed = parseMachineArgs(argv);
17011
+ if (parsed.error || !parsed.operation || !parsed.phase) {
17012
+ return printEnvelopeAndExit({
17013
+ envelope: machineEnvelope({
17014
+ ok: false,
17015
+ status: 400,
17016
+ command: "machine.execute",
17017
+ error: { code: "invalid_args", message: parsed.error ?? "operation and phase are required." }
17018
+ }),
17019
+ exitCode: EXIT_CODES.invalidArgs
17020
+ });
17021
+ }
17022
+ if (!["validate", "preview", "execute"].includes(parsed.phase)) {
17023
+ return printEnvelopeAndExit({
17024
+ envelope: machineEnvelope({
17025
+ ok: false,
17026
+ status: 400,
17027
+ command: "machine.execute",
17028
+ error: { code: "invalid_phase", message: `Unsupported machine phase: ${parsed.phase}` }
17029
+ }),
17030
+ exitCode: EXIT_CODES.invalidArgs
17031
+ });
17032
+ }
17033
+ let input;
17034
+ try {
17035
+ input = await readMachineInput(parsed.inputJson);
17036
+ } catch (error) {
17037
+ return printEnvelopeAndExit({
17038
+ envelope: machineEnvelope({
17039
+ ok: false,
17040
+ status: 400,
17041
+ command: "machine.execute",
17042
+ error: { code: "invalid_input", message: error instanceof Error ? error.message : "Invalid machine input." }
17043
+ }),
17044
+ exitCode: EXIT_CODES.invalidArgs
17045
+ });
17046
+ }
17047
+ const resolved = resolveMachineOperation(program, parsed.operation);
17048
+ if (!resolved) {
17049
+ return printEnvelopeAndExit({
17050
+ envelope: machineEnvelope({
17051
+ ok: false,
17052
+ status: 404,
17053
+ command: "machine.execute",
17054
+ error: { code: "unknown_operation", message: `Unknown operation: ${parsed.operation}` }
17055
+ }),
17056
+ exitCode: EXIT_CODES.notFound
17057
+ });
17058
+ }
17059
+ const normalizedInput = normalizeInput(input);
17060
+ const errors = validateInput(resolved.operation, normalizedInput);
17061
+ const digest = inputDigest(normalizedInput);
17062
+ if (errors.length > 0) {
17063
+ return printEnvelopeAndExit({
17064
+ envelope: machineEnvelope({
17065
+ ok: false,
17066
+ status: 400,
17067
+ command: "machine.execute",
17068
+ error: { code: "invalid_input", message: "Machine input did not match the operation schema.", details: { errors } },
17069
+ data: {
17070
+ operation: resolved.operation.id,
17071
+ normalizedInput,
17072
+ inputDigest: digest
17073
+ }
17074
+ }),
17075
+ exitCode: EXIT_CODES.invalidArgs
17076
+ });
17077
+ }
17078
+ const manifest = buildOperationManifest(program);
17079
+ if (parsed.phase === "validate") {
17080
+ return printEnvelopeAndExit({
17081
+ envelope: machineEnvelope({
17082
+ ok: true,
17083
+ status: 200,
17084
+ command: "machine.execute",
17085
+ data: {
17086
+ status: "validated",
17087
+ operation: resolved.operation.id,
17088
+ normalizedInput,
17089
+ inputDigest: digest,
17090
+ cliVersion: manifest.cli.version,
17091
+ registryDigest: manifest.registryDigest
17092
+ }
17093
+ })
17094
+ });
17095
+ }
17096
+ if (parsed.phase === "preview") {
17097
+ if (resolved.operation.classification !== "write") {
17098
+ return printEnvelopeAndExit({
17099
+ envelope: machineEnvelope({
17100
+ ok: false,
17101
+ status: 400,
17102
+ command: "machine.execute",
17103
+ error: { code: "preview_not_supported", message: `${resolved.operation.id} is not a write operation.` }
17104
+ }),
17105
+ exitCode: EXIT_CODES.invalidArgs
17106
+ });
17107
+ }
17108
+ return printEnvelopeAndExit({
17109
+ envelope: machineEnvelope({
17110
+ ok: true,
17111
+ status: 200,
17112
+ command: "machine.execute",
17113
+ data: {
17114
+ status: "preview",
17115
+ operation: resolved.operation.id,
17116
+ normalizedInput,
17117
+ preview: {
17118
+ title: resolved.operation.summary,
17119
+ command: resolved.operation.command,
17120
+ requestedInput: normalizedInput,
17121
+ summary: `Execute ${resolved.operation.command} with the validated input.`
17122
+ },
17123
+ inputDigest: digest,
17124
+ cliVersion: manifest.cli.version,
17125
+ registryDigest: manifest.registryDigest
17126
+ }
17127
+ })
17128
+ });
17129
+ }
17130
+ if (resolved.operation.classification === "auth") {
17131
+ return printEnvelopeAndExit({
17132
+ envelope: machineEnvelope({
17133
+ ok: true,
17134
+ status: 202,
17135
+ command: "machine.execute",
17136
+ data: {
17137
+ status: "continuation_required",
17138
+ operation: resolved.operation.id,
17139
+ message: "Interactive authentication is not run in machine mode. Continue through the MCP OAuth flow."
17140
+ }
17141
+ })
17142
+ });
17143
+ }
17144
+ const auth = parseTrustedJson("WAVE_MACHINE_AUTH_JSON", isTrustedAuth);
17145
+ if (needsTrustedAuth(resolved.operation) && !auth) {
17146
+ return printEnvelopeAndExit({
17147
+ envelope: machineEnvelope({
17148
+ ok: false,
17149
+ status: 401,
17150
+ command: "machine.execute",
17151
+ error: {
17152
+ code: "missing_machine_auth",
17153
+ message: "Machine execution requires trusted OAuth-bound auth context."
17154
+ }
17155
+ }),
17156
+ exitCode: EXIT_CODES.missingOrInvalidAuth
17157
+ });
17158
+ }
17159
+ if (resolved.operation.classification === "write") {
17160
+ const approval = parseTrustedJson("WAVE_MACHINE_APPROVAL_JSON", isTrustedApproval);
17161
+ if (!approval || approval.operation !== resolved.operation.id || approval.inputDigest !== digest || approval.cliVersion !== manifest.cli.version || approval.registryDigest !== manifest.registryDigest || approval.organizationId !== auth?.organizationId || approval.actorId !== auth?.actorId) {
17162
+ return printEnvelopeAndExit({
17163
+ envelope: machineEnvelope({
17164
+ ok: false,
17165
+ status: 403,
17166
+ command: "machine.execute",
17167
+ error: {
17168
+ code: "approval_required",
17169
+ message: "A matching server-managed approval is required before write execution.",
17170
+ details: { operation: resolved.operation.id, inputDigest: digest }
17171
+ }
17172
+ }),
17173
+ exitCode: EXIT_CODES.forbidden
17174
+ });
17175
+ }
17176
+ }
17177
+ try {
17178
+ await withTrustedMachineAuth(auth, async () => {
17179
+ await program.parseAsync([process.execPath, "wave", ...commandArgs(resolved.command, normalizedInput)]);
17180
+ });
17181
+ } catch (error) {
17182
+ if (isEnvelopeEmittedSignal(error)) return true;
17183
+ throw error;
17184
+ }
17185
+ return true;
17186
+ }
17187
+
16077
17188
  // src/index.ts
16078
17189
  function printCliFailure(params) {
16079
17190
  printEnvelope({
@@ -16095,6 +17206,7 @@ function printCliFailure(params) {
16095
17206
  }
16096
17207
  async function main() {
16097
17208
  const program = buildCli();
17209
+ if (await maybeRunMachineExecute(process.argv.slice(2), program)) return;
16098
17210
  await program.parseAsync(process.argv);
16099
17211
  }
16100
17212
  main().catch((error) => {