@wave-ai-os/wave-cli 0.1.82 → 0.1.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.cjs +503 -27
  2. package/dist/index.js +501 -25
  3. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -1219,6 +1219,7 @@ var RESOURCE_QUERY_FIELDS = {
1219
1219
  "organizationSlug",
1220
1220
  "userId",
1221
1221
  "coachId",
1222
+ "reportTo",
1222
1223
  "timezone",
1223
1224
  "province",
1224
1225
  "birthdate",
@@ -7899,7 +7900,7 @@ import { Option } from "commander";
7899
7900
  import { createHash } from "crypto";
7900
7901
 
7901
7902
  // src/version.ts
7902
- var CLI_VERSION = "0.1.81";
7903
+ var CLI_VERSION = "0.1.84";
7903
7904
 
7904
7905
  // src/operationMetadata.ts
7905
7906
  var DISCOVERY_OPERATION_IDS = [
@@ -8359,6 +8360,7 @@ var WRITE_OPERATION_IDS = [
8359
8360
  "todos.create",
8360
8361
  "todos.update"
8361
8362
  ];
8363
+ var DIRECT_MACHINE_WRITE_OPERATION_IDS = /* @__PURE__ */ new Set(["automations.create"]);
8362
8364
  var AUTH_OPERATION_IDS = ["login", "logout"];
8363
8365
  var DESTRUCTIVE_OPERATION_IDS = /* @__PURE__ */ new Set([
8364
8366
  "content.destroy",
@@ -8402,7 +8404,7 @@ for (const [classification, operationIds] of Object.entries(OPERATION_IDS_BY_CLA
8402
8404
  }
8403
8405
  metadataByOperationId.set(id, {
8404
8406
  classification,
8405
- requiresApproval: classification === "write",
8407
+ requiresApproval: classification === "write" && !DIRECT_MACHINE_WRITE_OPERATION_IDS.has(id),
8406
8408
  atlasSafetyClass,
8407
8409
  machine: {
8408
8410
  supportsValidate: true,
@@ -15728,9 +15730,481 @@ function registerDatasheetsCommands(program) {
15728
15730
  });
15729
15731
  }
15730
15732
 
15733
+ // src/commands/signatures.ts
15734
+ import { basename as basename2 } from "path";
15735
+ import { readFile as readFile4 } from "fs/promises";
15736
+ import { createHash as createHash2 } from "crypto";
15737
+ import { PDFDocument } from "pdf-lib";
15738
+ var idSchema14 = (value, label = "id") => {
15739
+ const parsed = typeof value === "string" ? value.trim() : "";
15740
+ if (parsed.length === 0) {
15741
+ throw new CliError({
15742
+ message: label + " is required.",
15743
+ kind: "invalid_args",
15744
+ status: 400,
15745
+ exitCode: EXIT_CODES.invalidArgs
15746
+ });
15747
+ }
15748
+ return parsed;
15749
+ };
15750
+ var MAX_SIGNATURE_PDF_BYTES = 50 * 1024 * 1024;
15751
+ var URL_OR_TRANSPORT_KEY = /(?:^|_)(?:url|uri|token|nonce|post_fields|postfields|headers|authorization|secret|credential)(?:$|_)/i;
15752
+ function isRecord7(value) {
15753
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
15754
+ }
15755
+ function asNonEmptyString6(value) {
15756
+ if (typeof value !== "string") return null;
15757
+ const trimmed = value.trim();
15758
+ return trimmed.length > 0 ? trimmed : null;
15759
+ }
15760
+ function parseJsonObject4(raw, optionName) {
15761
+ try {
15762
+ const parsed = JSON.parse(raw);
15763
+ if (!isRecord7(parsed)) {
15764
+ throw new Error("JSON must be an object.");
15765
+ }
15766
+ return parsed;
15767
+ } catch (error) {
15768
+ throw new CliError({
15769
+ message: error instanceof Error ? "Invalid " + optionName + ": " + error.message : "Invalid " + optionName + ".",
15770
+ kind: "invalid_args",
15771
+ status: 400,
15772
+ exitCode: EXIT_CODES.invalidArgs
15773
+ });
15774
+ }
15775
+ }
15776
+ function unwrapSignaturePayload(raw) {
15777
+ const wrapped = raw.signature_envelope ?? raw.signatureEnvelope ?? raw.signature ?? raw.envelope;
15778
+ return isRecord7(wrapped) ? wrapped : raw;
15779
+ }
15780
+ function onlyAllowedKeys(payload, allowed, optionName) {
15781
+ const unsupported = Object.keys(payload).filter((key) => !allowed.includes(key));
15782
+ if (unsupported.length > 0) {
15783
+ throw new CliError({
15784
+ message: "Invalid " + optionName + ": unsupported fields " + unsupported.join(", ") + ".",
15785
+ kind: "invalid_args",
15786
+ status: 400,
15787
+ exitCode: EXIT_CODES.invalidArgs,
15788
+ details: { unsupportedFields: unsupported, allowedFields: allowed }
15789
+ });
15790
+ }
15791
+ return payload;
15792
+ }
15793
+ function parseCreatePayload(raw, mode) {
15794
+ const data = raw ? unwrapSignaturePayload(parseJsonObject4(raw, "--data-json")) : {};
15795
+ onlyAllowedKeys(
15796
+ data,
15797
+ ["name", "subject", "message", "expires_at", "visibility", "metadata", "recipients"],
15798
+ "--data-json"
15799
+ );
15800
+ const parsedMode = asNonEmptyString6(mode);
15801
+ if (parsedMode !== "request" && parsedMode !== "self_sign") {
15802
+ throw new CliError({
15803
+ message: "signatures create requires --mode request or --mode self_sign.",
15804
+ kind: "invalid_args",
15805
+ status: 400,
15806
+ exitCode: EXIT_CODES.invalidArgs
15807
+ });
15808
+ }
15809
+ return { ...data, mode: parsedMode };
15810
+ }
15811
+ function parseUpdatePayload(raw, options) {
15812
+ const data = raw ? unwrapSignaturePayload(parseJsonObject4(raw, "--data-json")) : {};
15813
+ onlyAllowedKeys(
15814
+ data,
15815
+ ["name", "subject", "message", "expires_at", "visibility", "recipients", "fields"],
15816
+ "--data-json"
15817
+ );
15818
+ const name = asNonEmptyString6(options.name);
15819
+ const subject = asNonEmptyString6(options.subject);
15820
+ const message = asNonEmptyString6(options.message);
15821
+ const patch = {
15822
+ ...data,
15823
+ ...name ? { name } : {},
15824
+ ...subject ? { subject } : {},
15825
+ ...message ? { message } : {}
15826
+ };
15827
+ if (Object.keys(patch).length === 0) {
15828
+ throw new CliError({
15829
+ message: "signatures update requires --data-json, --name, --subject, or --message.",
15830
+ kind: "invalid_args",
15831
+ status: 400,
15832
+ exitCode: EXIT_CODES.invalidArgs
15833
+ });
15834
+ }
15835
+ return patch;
15836
+ }
15837
+ function sanitizeSignatureValue(value) {
15838
+ if (Array.isArray(value)) return value.map(sanitizeSignatureValue);
15839
+ if (!isRecord7(value)) return value;
15840
+ return Object.fromEntries(
15841
+ Object.entries(value).filter(([key]) => {
15842
+ const normalizedKey2 = key.replace(/([a-z0-9])([A-Z])/g, "$1_$2");
15843
+ return !URL_OR_TRANSPORT_KEY.test(normalizedKey2);
15844
+ }).map(([key, child]) => [key, sanitizeSignatureValue(child)])
15845
+ );
15846
+ }
15847
+ function safeSignatureMutationPayload(payload) {
15848
+ if (!isRecord7(payload)) return payload;
15849
+ return {
15850
+ ...payload,
15851
+ ...Object.prototype.hasOwnProperty.call(payload, "data") ? { data: sanitizeSignatureValue(payload.data) } : {}
15852
+ };
15853
+ }
15854
+ function safeSignatureQueryPayload(payload) {
15855
+ return sanitizeSignatureValue(payload);
15856
+ }
15857
+ function cliErrorEnvelope(command, error) {
15858
+ return {
15859
+ ok: false,
15860
+ command,
15861
+ status: error.status,
15862
+ data: null,
15863
+ error: {
15864
+ code: error.kind,
15865
+ message: error.message,
15866
+ details: error.details
15867
+ },
15868
+ meta: { requestId: "local_error" }
15869
+ };
15870
+ }
15871
+ async function inspectSignaturePdf(path) {
15872
+ const resolvedPath = idSchema14(path, "file");
15873
+ const filename = basename2(resolvedPath);
15874
+ if (!filename.toLowerCase().endsWith(".pdf")) {
15875
+ throw new CliError({
15876
+ message: "Signature source files must have a .pdf extension.",
15877
+ kind: "invalid_args",
15878
+ status: 400,
15879
+ exitCode: EXIT_CODES.invalidArgs
15880
+ });
15881
+ }
15882
+ let bytes;
15883
+ try {
15884
+ bytes = await readFile4(resolvedPath);
15885
+ } catch (error) {
15886
+ throw new CliError({
15887
+ message: "Unable to read the Signature PDF: " + (error instanceof Error ? error.message : "unknown error"),
15888
+ kind: "invalid_args",
15889
+ status: 400,
15890
+ exitCode: EXIT_CODES.invalidArgs
15891
+ });
15892
+ }
15893
+ if (bytes.byteLength === 0 || bytes.byteLength > MAX_SIGNATURE_PDF_BYTES) {
15894
+ throw new CliError({
15895
+ message: "Signature PDFs must be between 1 byte and 50 MB.",
15896
+ kind: "invalid_args",
15897
+ status: 400,
15898
+ exitCode: EXIT_CODES.invalidArgs
15899
+ });
15900
+ }
15901
+ if (Buffer.from(bytes).subarray(0, 5).toString("ascii") !== "%PDF-") {
15902
+ throw new CliError({
15903
+ message: "Only valid PDF documents can be used for signatures.",
15904
+ kind: "invalid_args",
15905
+ status: 400,
15906
+ exitCode: EXIT_CODES.invalidArgs
15907
+ });
15908
+ }
15909
+ let pageCount;
15910
+ try {
15911
+ const document = await PDFDocument.load(bytes, { ignoreEncryption: false });
15912
+ pageCount = document.getPageCount();
15913
+ } catch {
15914
+ throw new CliError({
15915
+ message: "Only valid, non-password-protected PDF documents can be used for signatures.",
15916
+ kind: "invalid_args",
15917
+ status: 400,
15918
+ exitCode: EXIT_CODES.invalidArgs
15919
+ });
15920
+ }
15921
+ if (pageCount < 1 || pageCount > 500) {
15922
+ throw new CliError({
15923
+ message: "Signature PDFs must contain between 1 and 500 pages.",
15924
+ kind: "invalid_args",
15925
+ status: 400,
15926
+ exitCode: EXIT_CODES.invalidArgs
15927
+ });
15928
+ }
15929
+ return {
15930
+ bytes,
15931
+ filename,
15932
+ byteSize: bytes.byteLength,
15933
+ pageCount,
15934
+ sha256: createHash2("sha256").update(bytes).digest("hex")
15935
+ };
15936
+ }
15937
+ function requireUploadTarget(payload) {
15938
+ if (!isRecord7(payload) || !isRecord7(payload.data) || !isRecord7(payload.data.data)) {
15939
+ throw new CliError({
15940
+ message: "Signature upload initialization returned an invalid payload.",
15941
+ kind: "malformed_response",
15942
+ status: 502,
15943
+ exitCode: EXIT_CODES.networkOrUpstream
15944
+ });
15945
+ }
15946
+ const attributes = payload.data.data.attributes;
15947
+ if (!isRecord7(attributes)) {
15948
+ throw new CliError({
15949
+ message: "Signature upload initialization did not return upload attributes.",
15950
+ kind: "malformed_response",
15951
+ status: 502,
15952
+ exitCode: EXIT_CODES.networkOrUpstream
15953
+ });
15954
+ }
15955
+ const postUrl = asNonEmptyString6(attributes.postUrl);
15956
+ const fileKey = asNonEmptyString6(attributes.getUrl);
15957
+ const rawPostFields = attributes.postFields;
15958
+ if (!postUrl || !fileKey || !isRecord7(rawPostFields) || !fileKey.startsWith("uploads/signatures/")) {
15959
+ throw new CliError({
15960
+ message: "Signature upload initialization returned an invalid storage target.",
15961
+ kind: "malformed_response",
15962
+ status: 502,
15963
+ exitCode: EXIT_CODES.networkOrUpstream
15964
+ });
15965
+ }
15966
+ const postFields = Object.entries(rawPostFields).reduce((result, [key, value]) => {
15967
+ if (typeof value === "string") result[key] = value;
15968
+ return result;
15969
+ }, {});
15970
+ if (Object.keys(postFields).length === 0) {
15971
+ throw new CliError({
15972
+ message: "Signature upload initialization returned no upload form fields.",
15973
+ kind: "malformed_response",
15974
+ status: 502,
15975
+ exitCode: EXIT_CODES.networkOrUpstream
15976
+ });
15977
+ }
15978
+ return { postUrl, postFields, fileKey };
15979
+ }
15980
+ async function uploadSignaturePdf(target, pdf) {
15981
+ const form = new FormData();
15982
+ Object.entries(target.postFields).forEach(([key, value]) => form.set(key, value));
15983
+ const uploadBytes = new Uint8Array(pdf.bytes.byteLength);
15984
+ uploadBytes.set(pdf.bytes);
15985
+ form.set("file", new Blob([uploadBytes.buffer], { type: "application/pdf" }), pdf.filename);
15986
+ let response;
15987
+ try {
15988
+ response = await fetch(target.postUrl, { method: "POST", body: form });
15989
+ } catch (error) {
15990
+ throw new CliError({
15991
+ message: "Signature PDF upload failed: " + (error instanceof Error ? error.message : "network error"),
15992
+ kind: "network_error",
15993
+ status: 502,
15994
+ exitCode: EXIT_CODES.networkOrUpstream
15995
+ });
15996
+ }
15997
+ if (!response.ok) {
15998
+ throw new CliError({
15999
+ message: "Signature PDF upload failed with HTTP " + response.status + ".",
16000
+ kind: "upstream_error",
16001
+ status: 502,
16002
+ exitCode: EXIT_CODES.networkOrUpstream
16003
+ });
16004
+ }
16005
+ }
16006
+ async function runCreateSignatureCommand(params) {
16007
+ try {
16008
+ const config = getConfig(params.runtimeOptions);
16009
+ const pdf = await inspectSignaturePdf(params.file);
16010
+ const uploadResult = await graphqlRequest({
16011
+ config,
16012
+ command: "signatures.create.upload",
16013
+ operationName: "SignaturesCreateUpload",
16014
+ operationType: "mutation",
16015
+ field: "create_s3_upload",
16016
+ variables: {
16017
+ params: {
16018
+ filename: pdf.filename,
16019
+ file_type: "pdf",
16020
+ content_type: "application/pdf",
16021
+ directory: "signatures"
16022
+ }
16023
+ },
16024
+ variableTypes: { params: "CreateS3UploadParamsInput!" },
16025
+ selectionSet: "{ ok status errorCode data errors }"
16026
+ });
16027
+ if (!uploadResult.envelope.ok) {
16028
+ return printEnvelopeAndExit({
16029
+ envelope: uploadResult.envelope,
16030
+ exitCode: uploadResult.exitCode
16031
+ });
16032
+ }
16033
+ const uploadPayload = uploadResult.envelope.data?.create_s3_upload;
16034
+ const target = requireUploadTarget(uploadPayload);
16035
+ await uploadSignaturePdf(target, pdf);
16036
+ const createResult = await graphqlRequest({
16037
+ config,
16038
+ command: "signatures.create",
16039
+ operationName: "SignaturesCreate",
16040
+ operationType: "mutation",
16041
+ field: "create_signature_envelope",
16042
+ variables: {
16043
+ organization_id: params.organizationId,
16044
+ params: {
16045
+ ...params.payload,
16046
+ file_key: target.fileKey,
16047
+ filename: pdf.filename,
16048
+ byte_size: pdf.byteSize,
16049
+ page_count: pdf.pageCount,
16050
+ sha256: pdf.sha256
16051
+ }
16052
+ },
16053
+ variableTypes: {
16054
+ organization_id: "ID!",
16055
+ params: "JSON!"
16056
+ },
16057
+ selectionSet: "{ ok status errorCode data errors }"
16058
+ });
16059
+ if (createResult.envelope.ok && createResult.envelope.data) {
16060
+ const data = createResult.envelope.data;
16061
+ createResult.envelope.data = {
16062
+ ...data,
16063
+ create_signature_envelope: safeSignatureMutationPayload(data.create_signature_envelope)
16064
+ };
16065
+ }
16066
+ return printEnvelopeAndExit({
16067
+ envelope: createResult.envelope,
16068
+ exitCode: createResult.exitCode
16069
+ });
16070
+ } catch (error) {
16071
+ if (error instanceof CliError) {
16072
+ return printEnvelopeAndExit({
16073
+ envelope: cliErrorEnvelope("signatures.create", error),
16074
+ exitCode: error.exitCode
16075
+ });
16076
+ }
16077
+ throw error;
16078
+ }
16079
+ }
16080
+ function requireConfirmation(value, optionName) {
16081
+ if (value === true) return;
16082
+ throw new CliError({
16083
+ message: "This Signature action requires " + optionName + ".",
16084
+ kind: "invalid_args",
16085
+ status: 400,
16086
+ exitCode: EXIT_CODES.invalidArgs
16087
+ });
16088
+ }
16089
+ function registerSignatureCommands(program) {
16090
+ const signatures = program.command("signatures").description("Signature envelope operations");
16091
+ signatures.command("list").option("--folder <folder>").option("--status <status>").option("--query <query>").option("--mine").option("--page <page>").option("--per <per>").action(async (opts, cmd) => {
16092
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
16093
+ const organizationId = resolveOrganizationId(context.organizationId);
16094
+ await runGraphqlQueryCommand({
16095
+ command: "signatures.list",
16096
+ operationName: "SignaturesList",
16097
+ runtimeOptions: context.runtimeOptions,
16098
+ field: "signature_envelopes",
16099
+ variables: {
16100
+ organization_id: organizationId,
16101
+ params: normalizeGraphqlVariables2({
16102
+ folder: opts.folder,
16103
+ status: opts.status,
16104
+ query: opts.query,
16105
+ mine: opts.mine,
16106
+ page: opts.page,
16107
+ per: opts.per
16108
+ })
16109
+ },
16110
+ variableTypes: { organization_id: "ID!", params: "JSON" },
16111
+ selectionSet: "",
16112
+ isList: true,
16113
+ transformData: safeSignatureQueryPayload
16114
+ });
16115
+ });
16116
+ signatures.command("show").requiredOption("--id <id>").option("--include-events").action(async (opts, cmd) => {
16117
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
16118
+ const organizationId = resolveOrganizationId(context.organizationId);
16119
+ await runGraphqlQueryCommand({
16120
+ command: "signatures.show",
16121
+ operationName: "SignaturesShow",
16122
+ runtimeOptions: context.runtimeOptions,
16123
+ field: "signature_envelope",
16124
+ variables: {
16125
+ organization_id: organizationId,
16126
+ id: idSchema14(opts.id),
16127
+ include_events: Boolean(opts.includeEvents)
16128
+ },
16129
+ variableTypes: {
16130
+ organization_id: "ID!",
16131
+ id: "ID!",
16132
+ include_events: "Boolean!"
16133
+ },
16134
+ selectionSet: "",
16135
+ isShow: true,
16136
+ transformData: safeSignatureQueryPayload
16137
+ });
16138
+ });
16139
+ signatures.command("create").requiredOption("--file <file>").requiredOption("--mode <mode>", "request or self_sign").option("--data-json <dataJson>", "JSON object for additional draft fields").action(async (opts, cmd) => {
16140
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
16141
+ await runCreateSignatureCommand({
16142
+ runtimeOptions: context.runtimeOptions,
16143
+ organizationId: resolveOrganizationId(context.organizationId),
16144
+ file: String(opts.file),
16145
+ payload: parseCreatePayload(opts.dataJson, opts.mode)
16146
+ });
16147
+ });
16148
+ signatures.command("update").requiredOption("--id <id>").option("--name <name>").option("--subject <subject>").option("--message <message>").option("--data-json <dataJson>", "JSON object for draft fields, recipients, and fields").action(async (opts, cmd) => {
16149
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
16150
+ const organizationId = resolveOrganizationId(context.organizationId);
16151
+ await runGraphqlMutationCommand({
16152
+ command: "signatures.update",
16153
+ operationName: "SignaturesUpdate",
16154
+ runtimeOptions: context.runtimeOptions,
16155
+ field: "update_signature_envelope",
16156
+ variables: {
16157
+ organization_id: organizationId,
16158
+ id: idSchema14(opts.id),
16159
+ params: parseUpdatePayload(opts.dataJson, opts)
16160
+ },
16161
+ variableTypes: {
16162
+ organization_id: "ID!",
16163
+ id: "ID!",
16164
+ params: "JSON!"
16165
+ },
16166
+ transformMutationPayload: safeSignatureMutationPayload
16167
+ });
16168
+ });
16169
+ const lifecycle = (name, field, confirmation) => {
16170
+ const command = signatures.command(name).requiredOption("--id <id>");
16171
+ if (name === "void") command.requiredOption("--reason <reason>");
16172
+ if (confirmation === "--confirm-send") command.option("--confirm-send");
16173
+ if (confirmation === "--confirm") command.option("--confirm");
16174
+ command.action(async (opts, cmd) => {
16175
+ if (confirmation === "--confirm-send") requireConfirmation(opts.confirmSend, "--confirm-send");
16176
+ if (confirmation === "--confirm") requireConfirmation(opts.confirm, "--confirm");
16177
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
16178
+ const organizationId = resolveOrganizationId(context.organizationId);
16179
+ await runGraphqlMutationCommand({
16180
+ command: "signatures." + name,
16181
+ operationName: "Signatures" + name.slice(0, 1).toUpperCase() + name.slice(1),
16182
+ runtimeOptions: context.runtimeOptions,
16183
+ field,
16184
+ variables: {
16185
+ organization_id: organizationId,
16186
+ id: idSchema14(opts.id),
16187
+ ...name === "void" ? { reason: idSchema14(opts.reason, "reason") } : {}
16188
+ },
16189
+ variableTypes: {
16190
+ organization_id: "ID!",
16191
+ id: "ID!",
16192
+ ...name === "void" ? { reason: "String" } : {}
16193
+ },
16194
+ transformMutationPayload: safeSignatureMutationPayload
16195
+ });
16196
+ });
16197
+ };
16198
+ lifecycle("send", "send_signature_envelope", "--confirm-send");
16199
+ lifecycle("archive", "archive_signature_envelope", null);
16200
+ lifecycle("unarchive", "unarchive_signature_envelope", null);
16201
+ lifecycle("destroy", "delete_signature_envelope", "--confirm");
16202
+ lifecycle("void", "void_signature_envelope", "--confirm");
16203
+ }
16204
+
15731
16205
  // src/commands/atlasAuthoring.ts
15732
16206
  import { z as z20 } from "zod";
15733
- var idSchema14 = z20.string().trim().min(1);
16207
+ var idSchema15 = z20.string().trim().min(1);
15734
16208
  var idempotencyKeySchema = z20.string().min(1).refine((value) => value.trim() === value, "Idempotency key must not have leading or trailing whitespace.");
15735
16209
  var skillScopeSchema = z20.enum(["ADMIN_GLOBAL", "MEMBER_PERSONAL"]);
15736
16210
  var isoDateSchema = z20.iso.date();
@@ -15802,7 +16276,6 @@ var AGENT_SELECTION = `{
15802
16276
  slug
15803
16277
  status
15804
16278
  visibility
15805
- model
15806
16279
  runWhenMentioned
15807
16280
  webAccessEnabled
15808
16281
  webFetchEnabled
@@ -16083,6 +16556,7 @@ function normalizePersistedCreatePayload(payload) {
16083
16556
  const mutationData = asRecord7(mutation?.data);
16084
16557
  const persisted = asRecord7(mutationData?.data) ?? mutationData;
16085
16558
  const attributes = asRecord7(persisted?.attributes);
16559
+ const automationExecution = asRecord7(attributes?.automation_execution) ?? asRecord7(attributes?.automationExecution);
16086
16560
  const meta = asRecord7(mutationData?.meta);
16087
16561
  const idempotency = asRecord7(meta?.atlas_idempotency);
16088
16562
  const id = asRequiredString(persisted?.id);
@@ -16110,7 +16584,8 @@ function normalizePersistedCreatePayload(payload) {
16110
16584
  fingerprint: asRequiredString(idempotency.fingerprint),
16111
16585
  replay,
16112
16586
  action: asRequiredString(idempotency.action)
16113
- }
16587
+ },
16588
+ ...automationExecution ? { automation_execution: automationExecution } : {}
16114
16589
  };
16115
16590
  }
16116
16591
  function normalizePersistedUpdatePayload(payload) {
@@ -16262,7 +16737,7 @@ function parseAutomationConfig(value) {
16262
16737
  exitCode: EXIT_CODES.invalidArgs
16263
16738
  });
16264
16739
  }
16265
- return config;
16740
+ return config.cycle === "single" ? { ...config, cycle: "single_use" } : config;
16266
16741
  }
16267
16742
  function parseExpectedUpdateVersion(value) {
16268
16743
  return nonEmptyStringSchema.parse(String(value));
@@ -16332,7 +16807,7 @@ function registerAtlasAuthoringCommands(program) {
16332
16807
  ...opts.name !== void 0 ? { name: String(opts.name) } : {},
16333
16808
  ...opts.description !== void 0 ? { description: String(opts.description) } : {},
16334
16809
  ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
16335
- ...opts.memberId !== void 0 ? { member_id: idSchema14.parse(opts.memberId) } : {},
16810
+ ...opts.memberId !== void 0 ? { member_id: idSchema15.parse(opts.memberId) } : {},
16336
16811
  ...opts.status !== void 0 ? { status: String(opts.status) } : {},
16337
16812
  ...opts.visibility !== void 0 ? { visibility: String(opts.visibility) } : {},
16338
16813
  ...opts.model !== void 0 ? { model: String(opts.model) } : {},
@@ -16355,7 +16830,7 @@ function registerAtlasAuthoringCommands(program) {
16355
16830
  });
16356
16831
  });
16357
16832
  agents.command("show").description("Read one persisted Agent by id or slug").requiredOption("--id <idOrSlug>", "Agent id or slug").action(async (opts, cmd) => {
16358
- const id = idSchema14.parse(opts.id);
16833
+ const id = idSchema15.parse(opts.id);
16359
16834
  const context = await resolveCommandContext(cmd.optsWithGlobals());
16360
16835
  const organizationId = resolveOrganizationId(context.organizationId);
16361
16836
  await runGraphqlQueryCommand({
@@ -16443,7 +16918,7 @@ function registerAtlasAuthoringCommands(program) {
16443
16918
  exitCode: EXIT_CODES.invalidArgs
16444
16919
  });
16445
16920
  }
16446
- const id = idSchema14.parse(opts.id);
16921
+ const id = idSchema15.parse(opts.id);
16447
16922
  const expectedUpdateVersion = parseExpectedUpdateVersion(opts.expectedUpdateVersion);
16448
16923
  const context = await resolveCommandContext(cmd.optsWithGlobals());
16449
16924
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -16527,12 +17002,12 @@ function registerAtlasAuthoringCommands(program) {
16527
17002
  variables: {
16528
17003
  organization_id: organizationId,
16529
17004
  input: {
16530
- summary: idSchema14.parse(opts.summary),
17005
+ summary: idSchema15.parse(opts.summary),
16531
17006
  ai_task_config: parseAutomationConfig(opts.aiTaskConfig),
16532
17007
  ...opts.description !== void 0 ? { description: String(opts.description) } : {},
16533
17008
  ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
16534
- ...opts.memberId !== void 0 ? { member_id: idSchema14.parse(opts.memberId) } : {},
16535
- ...opts.agentId !== void 0 ? { agent_id: idSchema14.parse(opts.agentId) } : {},
17009
+ ...opts.memberId !== void 0 ? { member_id: idSchema15.parse(opts.memberId) } : {},
17010
+ ...opts.agentId !== void 0 ? { agent_id: idSchema15.parse(opts.agentId) } : {},
16536
17011
  ...opts.priority !== void 0 ? { priority: String(opts.priority) } : {},
16537
17012
  ...opts.dueDate !== void 0 ? { due_date: isoDateSchema.parse(opts.dueDate) } : {}
16538
17013
  },
@@ -16542,7 +17017,7 @@ function registerAtlasAuthoringCommands(program) {
16542
17017
  });
16543
17018
  });
16544
17019
  automations.command("show").description("Read one persisted Automation by id or slug").requiredOption("--id <idOrSlug>", "Automation id or slug").action(async (opts, cmd) => {
16545
- const id = idSchema14.parse(opts.id);
17020
+ const id = idSchema15.parse(opts.id);
16546
17021
  const context = await resolveCommandContext(cmd.optsWithGlobals());
16547
17022
  const organizationId = resolveOrganizationId(context.organizationId);
16548
17023
  await runGraphqlQueryCommand({
@@ -16557,7 +17032,7 @@ function registerAtlasAuthoringCommands(program) {
16557
17032
  });
16558
17033
  });
16559
17034
  automations.command("run").description("Queue one Automation by id or slug and return exact status readback identifiers").requiredOption("--id <idOrSlug>", "Automation id or slug").action(async (opts, cmd) => {
16560
- const automationId = idSchema14.parse(opts.id);
17035
+ const automationId = idSchema15.parse(opts.id);
16561
17036
  const context = await resolveCommandContext(cmd.optsWithGlobals());
16562
17037
  const organizationId = resolveOrganizationId(context.organizationId);
16563
17038
  await runGraphqlMutationCommand({
@@ -16571,9 +17046,9 @@ function registerAtlasAuthoringCommands(program) {
16571
17046
  });
16572
17047
  });
16573
17048
  automations.command("run-status").description("Read one queued or terminal Automation execution by its run identity").requiredOption("--id <idOrSlug>", "Automation id or slug returned by automations run").requiredOption("--message-id <messageId>", "Message id returned by automations run").requiredOption("--run-id <runId>", "Run id returned by automations run").action(async (opts, cmd) => {
16574
- const automationId = idSchema14.parse(opts.id);
16575
- const messageId = idSchema14.parse(opts.messageId);
16576
- const runId = idSchema14.parse(opts.runId);
17049
+ const automationId = idSchema15.parse(opts.id);
17050
+ const messageId = idSchema15.parse(opts.messageId);
17051
+ const runId = idSchema15.parse(opts.runId);
16577
17052
  const context = await resolveCommandContext(cmd.optsWithGlobals());
16578
17053
  const organizationId = resolveOrganizationId(context.organizationId);
16579
17054
  await runGraphqlQueryCommand({
@@ -16598,8 +17073,8 @@ function registerAtlasAuthoringCommands(program) {
16598
17073
  });
16599
17074
  });
16600
17075
  automations.command("run-show").description("Read one Automation run artifact by Agent id and execution slug").requiredOption("--agent-id <agentIdOrSlug>", "Agent id or slug").requiredOption("--execution-slug <executionSlug>", "Execution slug returned by automations run").action(async (opts, cmd) => {
16601
- const agentId = idSchema14.parse(opts.agentId);
16602
- const executionSlug = idSchema14.parse(opts.executionSlug);
17076
+ const agentId = idSchema15.parse(opts.agentId);
17077
+ const executionSlug = idSchema15.parse(opts.executionSlug);
16603
17078
  const context = await resolveCommandContext(cmd.optsWithGlobals());
16604
17079
  const organizationId = resolveOrganizationId(context.organizationId);
16605
17080
  await runGraphqlQueryCommand({
@@ -16653,7 +17128,7 @@ function registerAtlasAuthoringCommands(program) {
16653
17128
  exitCode: EXIT_CODES.invalidArgs
16654
17129
  });
16655
17130
  }
16656
- const id = idSchema14.parse(opts.id);
17131
+ const id = idSchema15.parse(opts.id);
16657
17132
  const expectedUpdateVersion = parseExpectedUpdateVersion(opts.expectedUpdateVersion);
16658
17133
  const context = await resolveCommandContext(cmd.optsWithGlobals());
16659
17134
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -16698,7 +17173,7 @@ function registerAtlasAuthoringCommands(program) {
16698
17173
  variables: {
16699
17174
  organization_id: organizationId,
16700
17175
  input: {
16701
- name: idSchema14.parse(opts.name),
17176
+ name: idSchema15.parse(opts.name),
16702
17177
  scope: skillScopeSchema.parse(opts.scope),
16703
17178
  ...opts.emoji !== void 0 ? { emoji: String(opts.emoji) } : {},
16704
17179
  ...opts.description !== void 0 ? { description: String(opts.description) } : {}
@@ -16725,7 +17200,7 @@ function registerAtlasAuthoringCommands(program) {
16725
17200
  exitCode: EXIT_CODES.invalidArgs
16726
17201
  });
16727
17202
  }
16728
- const id = idSchema14.parse(opts.id);
17203
+ const id = idSchema15.parse(opts.id);
16729
17204
  const expectedUpdateVersion = parseExpectedUpdateVersion(opts.expectedUpdateVersion);
16730
17205
  const context = await resolveCommandContext(cmd.optsWithGlobals());
16731
17206
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -17810,6 +18285,7 @@ function buildCli(options) {
17810
18285
  registerMailCommands(program);
17811
18286
  registerPhantomCommands(program);
17812
18287
  registerDatasheetsCommands(program);
18288
+ registerSignatureCommands(program);
17813
18289
  registerAuthCommands(program);
17814
18290
  registerDiscoveryCommands(program);
17815
18291
  attachNamespaceDiscovery(program);
@@ -17818,7 +18294,7 @@ function buildCli(options) {
17818
18294
  }
17819
18295
 
17820
18296
  // src/machine.ts
17821
- import { createHash as createHash2 } from "crypto";
18297
+ import { createHash as createHash3 } from "crypto";
17822
18298
  import { readSync } from "fs";
17823
18299
  var MACHINE_FLAGS = /* @__PURE__ */ new Set([
17824
18300
  "--machine",
@@ -17924,7 +18400,7 @@ async function readMachineInput(location) {
17924
18400
  return parsed;
17925
18401
  }
17926
18402
  function inputDigest(input) {
17927
- return `sha256:${createHash2("sha256").update(canonicalJson(input)).digest("hex")}`;
18403
+ return `sha256:${createHash3("sha256").update(canonicalJson(input)).digest("hex")}`;
17928
18404
  }
17929
18405
  function canonicalJson(value) {
17930
18406
  if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
@@ -18255,7 +18731,7 @@ async function maybeRunMachineExecute(argv, program) {
18255
18731
  exitCode: EXIT_CODES.missingOrInvalidAuth
18256
18732
  });
18257
18733
  }
18258
- if (resolved.operation.classification === "write") {
18734
+ if (resolved.operation.requiresApproval) {
18259
18735
  const approval = parseTrustedJsonFromFd(parsed.approvalFd, isTrustedApproval);
18260
18736
  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) {
18261
18737
  return printEnvelopeAndExit({