sim 2.2.9-preview.212.1 → 2.2.9-preview.214.1

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
@@ -7615,6 +7615,8 @@ import { dirname as dirname3 } from "node:path";
7615
7615
  function truncate(str, sliceLength, suffix = "...") {
7616
7616
  return str.length > sliceLength ? str.slice(0, sliceLength) + suffix : str;
7617
7617
  }
7618
+ var UNPAIRED_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
7619
+ var JSONB_UNSAFE = new RegExp(`${UNPAIRED_SURROGATE.source}|\\u0000`, "g");
7618
7620
  var MARKDOWN_ESCAPABLE = new Set("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~");
7619
7621
  function stripTrailingSlashes(value) {
7620
7622
  let end = value.length;
@@ -17330,6 +17332,11 @@ var V2_OPERATIONS = {
17330
17332
 
17331
17333
  // src/runtime/called-operations.ts
17332
17334
  var CALLED_OPERATIONS = new WeakMap;
17335
+ var RUNS_OPERATION = new WeakMap;
17336
+ function runsOperation(command, operation) {
17337
+ RUNS_OPERATION.set(command, operation);
17338
+ return command;
17339
+ }
17333
17340
  function callsOperations(command, operations) {
17334
17341
  CALLED_OPERATIONS.set(command, operations);
17335
17342
  return command;
@@ -21387,6 +21394,7 @@ function refuseHelpAfterUnknownCommand(program) {
21387
21394
  }
21388
21395
  function configureOperation(command, operation, spec) {
21389
21396
  const operationSpec = V2_OPERATIONS[operation];
21397
+ runsOperation(command, operation);
21390
21398
  command.allowExcessArguments(false);
21391
21399
  for (const alias of spec.aliases ?? [])
21392
21400
  command.alias(alias);
@@ -21672,7 +21680,9 @@ function attachCredentialCommands(program) {
21672
21680
  if (!credentials)
21673
21681
  throw new Error("The generated credentials command group is missing");
21674
21682
  acceptNameOnUpdate(credentials);
21675
- credentials.command("create").argument("<providerId>", "Service-account provider to create a credential for").description(describeOperation(V2_OPERATIONS.createServiceAccountCredential, "Create a service-account credential using its discovered provider schema")).requiredOption("--name <displayName>", "Name shown for the credential in Sim (required)").requiredOption("--credentials <json|@file>", "Provider credentials as JSON (or @path / @- to read a file or stdin) (required)").option("--description <description>", "Optional credential description").option("--id <credentialId>", "Client-generated credential ID when provider discovery requires it").action((providerId, options, command) => createServiceAccount(command, providerId, options));
21683
+ const create = credentials.command("create").argument("<providerId>", "Service-account provider to create a credential for").description(describeOperation(V2_OPERATIONS.createServiceAccountCredential, "Create a service-account credential using its discovered provider schema")).requiredOption("--name <displayName>", "Name shown for the credential in Sim (required)").requiredOption("--credentials <json|@file>", "Provider credentials as JSON (or @path / @- to read a file or stdin) (required)").option("--description <description>", "Optional credential description").option("--id <credentialId>", "Client-generated credential ID when provider discovery requires it").action((providerId, options, command) => createServiceAccount(command, providerId, options));
21684
+ callsOperations(create, ["listCredentialProviders", "createServiceAccountCredential"]);
21685
+ runsOperation(create, "createServiceAccountCredential");
21676
21686
  credentials.command("connect").argument("<providerId>", "OAuth provider to connect").description(describeOperation(V2_OPERATIONS.createCredentialConnection, "Create a short-lived link for connecting an OAuth provider")).requiredOption("--name <displayName>", "Name shown for the new credential in Sim (required)").action(async (providerId, options, command) => createConnectionLink(command, { providerId, displayName: options.name }));
21677
21687
  credentials.command("reconnect").argument("<credentialId>", "Existing OAuth credential to re-authorize").description(describeOperation(V2_OPERATIONS.createCredentialConnection, "Create a short-lived link for reconnecting an OAuth credential")).action((credentialId, _options, command) => createConnectionLink(command, { credentialId }));
21678
21688
  }
@@ -22040,7 +22050,8 @@ async function downloadToOutput(command, operation, pathParams, options) {
22040
22050
  });
22041
22051
  }
22042
22052
  function attachFileGet(files) {
22043
- files.command("get").argument("<fileId>", "File whose content to read").allowExcessArguments(false).description("Download a file’s content to stdout or a local file").option("-o, --output-file <path>", "Write content to a file instead of stdout").option("--force", "Overwrite --output-file if it already exists").action((fileId, options, command) => downloadToOutput(command, V2_OPERATIONS.downloadFile, { fileId }, options));
22053
+ const get = files.command("get").argument("<fileId>", "File whose content to read").allowExcessArguments(false).description("Download a file’s content to stdout or a local file").option("-o, --output-file <path>", "Write content to a file instead of stdout").option("--force", "Overwrite --output-file if it already exists").action((fileId, options, command) => downloadToOutput(command, V2_OPERATIONS.downloadFile, { fileId }, options));
22054
+ callsOperations(get, ["downloadFile"]);
22044
22055
  }
22045
22056
  function attachFileVersionDownload(versions) {
22046
22057
  const download = versions.command("download").argument("<fileId>", "File identifier.").argument("<version>", "Version number.").allowExcessArguments(false).description("Download the content of one version of a file").option("-o, --output-file <path>", "Write content to a file instead of stdout").option("--force", "Overwrite --output-file if it already exists").action((fileId, version, options, command) => downloadToOutput(command, V2_OPERATIONS.downloadFileVersion, { fileId, version }, options));
@@ -22353,7 +22364,7 @@ function safeBaseName(name) {
22353
22364
  return base && base !== "." && base !== ".." ? base : null;
22354
22365
  }
22355
22366
  function attachKnowledgeExport(knowledge) {
22356
- knowledge.command("export").argument("<knowledgeBaseId>", "Knowledge base to export").allowExcessArguments(false).description("Export a knowledge base as a .simkb.zip bundle").option("-o, --output-file <path>", "Write the bundle to this path instead of the name the server suggests; pass - to stream it to stdout").option("--force", "Overwrite --output-file if it already exists").option("--no-vectors", "Leave chunk vectors out of the bundle, so an import re-embeds every chunk").action(async (knowledgeBaseId, options, command) => {
22367
+ const exportCommand = knowledge.command("export").argument("<knowledgeBaseId>", "Knowledge base to export").allowExcessArguments(false).description("Export a knowledge base as a .simkb.zip bundle").option("-o, --output-file <path>", "Write the bundle to this path instead of the name the server suggests; pass - to stream it to stdout").option("--force", "Overwrite --output-file if it already exists").option("--no-vectors", "Leave chunk vectors out of the bundle, so an import re-embeds every chunk").action(async (knowledgeBaseId, options, command) => {
22357
22368
  const writesToStdout = options.outputFile === "-";
22358
22369
  if (writesToStdout && options.force) {
22359
22370
  throw new SimApiError("--force requires --output-file <path>", 0);
@@ -22386,6 +22397,7 @@ function attachKnowledgeExport(knowledge) {
22386
22397
  vectors: options.vectors
22387
22398
  });
22388
22399
  });
22400
+ callsOperations(exportCommand, ["exportKnowledgeBase"]);
22389
22401
  }
22390
22402
 
22391
22403
  // src/commands/protocol/logs-follow.ts
@@ -1,11 +1,21 @@
1
1
  import type { Command } from 'commander';
2
2
  import type { V2OperationName } from '../generated/v2-api';
3
+ /**
4
+ * Records the one v2 operation whose request and response a command presents as its
5
+ * own: every generated command, and a hand-written one that prints a single call's result.
6
+ *
7
+ * The command inventory reads it here rather than mapping paths back to operations: a
8
+ * derived path can equal another operation's (`undeployWorkflow` derives
9
+ * `workflows deploy`), and a reverse lookup by path then describes the wrong one.
10
+ */
11
+ export declare function runsOperation(command: Command, operation: V2OperationName): Command;
12
+ export declare function operationOf(command: Command): V2OperationName | undefined;
3
13
  /**
4
14
  * Records the v2 operations a hand-written command calls.
5
15
  *
6
- * A generated command is one operation and the command inventory finds it by path. A
7
- * hand-written one is opaque until it says what it calls, and the inventory needs that
8
- * to describe it truthfully, such as whether every call is open to a Mothership caller.
16
+ * A hand-written command is opaque until it says what it calls, and the inventory needs
17
+ * that to describe it truthfully, such as whether every call is open to a Mothership
18
+ * caller.
9
19
  */
10
20
  export declare function callsOperations(command: Command, operations: readonly V2OperationName[]): Command;
11
21
  export declare function calledOperations(command: Command): readonly V2OperationName[] | undefined;
package/dist/runtime.js CHANGED
@@ -3411,6 +3411,8 @@ import { dirname } from "node:path";
3411
3411
  function truncate(str, sliceLength, suffix = "...") {
3412
3412
  return str.length > sliceLength ? str.slice(0, sliceLength) + suffix : str;
3413
3413
  }
3414
+ var UNPAIRED_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
3415
+ var JSONB_UNSAFE = new RegExp(`${UNPAIRED_SURROGATE.source}|\\u0000`, "g");
3414
3416
  var MARKDOWN_ESCAPABLE = new Set("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~");
3415
3417
  function stripTrailingSlashes(value) {
3416
3418
  let end = value.length;
@@ -17379,6 +17381,11 @@ var V2_OPERATIONS = {
17379
17381
 
17380
17382
  // src/runtime/called-operations.ts
17381
17383
  var CALLED_OPERATIONS = new WeakMap;
17384
+ var RUNS_OPERATION = new WeakMap;
17385
+ function runsOperation(command, operation) {
17386
+ RUNS_OPERATION.set(command, operation);
17387
+ return command;
17388
+ }
17382
17389
  function callsOperations(command, operations) {
17383
17390
  CALLED_OPERATIONS.set(command, operations);
17384
17391
  return command;
@@ -21436,6 +21443,7 @@ function refuseHelpAfterUnknownCommand(program) {
21436
21443
  }
21437
21444
  function configureOperation(command, operation, spec) {
21438
21445
  const operationSpec = V2_OPERATIONS[operation];
21446
+ runsOperation(command, operation);
21439
21447
  command.allowExcessArguments(false);
21440
21448
  for (const alias of spec.aliases ?? [])
21441
21449
  command.alias(alias);
@@ -21721,7 +21729,9 @@ function attachCredentialCommands(program) {
21721
21729
  if (!credentials)
21722
21730
  throw new Error("The generated credentials command group is missing");
21723
21731
  acceptNameOnUpdate(credentials);
21724
- credentials.command("create").argument("<providerId>", "Service-account provider to create a credential for").description(describeOperation(V2_OPERATIONS.createServiceAccountCredential, "Create a service-account credential using its discovered provider schema")).requiredOption("--name <displayName>", "Name shown for the credential in Sim (required)").requiredOption("--credentials <json|@file>", "Provider credentials as JSON (or @path / @- to read a file or stdin) (required)").option("--description <description>", "Optional credential description").option("--id <credentialId>", "Client-generated credential ID when provider discovery requires it").action((providerId, options, command) => createServiceAccount(command, providerId, options));
21732
+ const create = credentials.command("create").argument("<providerId>", "Service-account provider to create a credential for").description(describeOperation(V2_OPERATIONS.createServiceAccountCredential, "Create a service-account credential using its discovered provider schema")).requiredOption("--name <displayName>", "Name shown for the credential in Sim (required)").requiredOption("--credentials <json|@file>", "Provider credentials as JSON (or @path / @- to read a file or stdin) (required)").option("--description <description>", "Optional credential description").option("--id <credentialId>", "Client-generated credential ID when provider discovery requires it").action((providerId, options, command) => createServiceAccount(command, providerId, options));
21733
+ callsOperations(create, ["listCredentialProviders", "createServiceAccountCredential"]);
21734
+ runsOperation(create, "createServiceAccountCredential");
21725
21735
  credentials.command("connect").argument("<providerId>", "OAuth provider to connect").description(describeOperation(V2_OPERATIONS.createCredentialConnection, "Create a short-lived link for connecting an OAuth provider")).requiredOption("--name <displayName>", "Name shown for the new credential in Sim (required)").action(async (providerId, options, command) => createConnectionLink(command, { providerId, displayName: options.name }));
21726
21736
  credentials.command("reconnect").argument("<credentialId>", "Existing OAuth credential to re-authorize").description(describeOperation(V2_OPERATIONS.createCredentialConnection, "Create a short-lived link for reconnecting an OAuth credential")).action((credentialId, _options, command) => createConnectionLink(command, { credentialId }));
21727
21737
  }
@@ -22089,7 +22099,8 @@ async function downloadToOutput(command, operation, pathParams, options) {
22089
22099
  });
22090
22100
  }
22091
22101
  function attachFileGet(files) {
22092
- files.command("get").argument("<fileId>", "File whose content to read").allowExcessArguments(false).description("Download a file’s content to stdout or a local file").option("-o, --output-file <path>", "Write content to a file instead of stdout").option("--force", "Overwrite --output-file if it already exists").action((fileId, options, command) => downloadToOutput(command, V2_OPERATIONS.downloadFile, { fileId }, options));
22102
+ const get = files.command("get").argument("<fileId>", "File whose content to read").allowExcessArguments(false).description("Download a file’s content to stdout or a local file").option("-o, --output-file <path>", "Write content to a file instead of stdout").option("--force", "Overwrite --output-file if it already exists").action((fileId, options, command) => downloadToOutput(command, V2_OPERATIONS.downloadFile, { fileId }, options));
22103
+ callsOperations(get, ["downloadFile"]);
22093
22104
  }
22094
22105
  function attachFileVersionDownload(versions) {
22095
22106
  const download = versions.command("download").argument("<fileId>", "File identifier.").argument("<version>", "Version number.").allowExcessArguments(false).description("Download the content of one version of a file").option("-o, --output-file <path>", "Write content to a file instead of stdout").option("--force", "Overwrite --output-file if it already exists").action((fileId, version, options, command) => downloadToOutput(command, V2_OPERATIONS.downloadFileVersion, { fileId, version }, options));
@@ -22402,7 +22413,7 @@ function safeBaseName(name) {
22402
22413
  return base && base !== "." && base !== ".." ? base : null;
22403
22414
  }
22404
22415
  function attachKnowledgeExport(knowledge) {
22405
- knowledge.command("export").argument("<knowledgeBaseId>", "Knowledge base to export").allowExcessArguments(false).description("Export a knowledge base as a .simkb.zip bundle").option("-o, --output-file <path>", "Write the bundle to this path instead of the name the server suggests; pass - to stream it to stdout").option("--force", "Overwrite --output-file if it already exists").option("--no-vectors", "Leave chunk vectors out of the bundle, so an import re-embeds every chunk").action(async (knowledgeBaseId, options, command) => {
22416
+ const exportCommand = knowledge.command("export").argument("<knowledgeBaseId>", "Knowledge base to export").allowExcessArguments(false).description("Export a knowledge base as a .simkb.zip bundle").option("-o, --output-file <path>", "Write the bundle to this path instead of the name the server suggests; pass - to stream it to stdout").option("--force", "Overwrite --output-file if it already exists").option("--no-vectors", "Leave chunk vectors out of the bundle, so an import re-embeds every chunk").action(async (knowledgeBaseId, options, command) => {
22406
22417
  const writesToStdout = options.outputFile === "-";
22407
22418
  if (writesToStdout && options.force) {
22408
22419
  throw new SimApiError("--force requires --output-file <path>", 0);
@@ -22435,6 +22446,7 @@ function attachKnowledgeExport(knowledge) {
22435
22446
  vectors: options.vectors
22436
22447
  });
22437
22448
  });
22449
+ callsOperations(exportCommand, ["exportKnowledgeBase"]);
22438
22450
  }
22439
22451
 
22440
22452
  // src/commands/protocol/logs-follow.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.2.9-preview.212.1",
3
+ "version": "2.2.9-preview.214.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "imports": {