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