sim 2.1.5-dev.77.1 → 2.1.5-dev.79.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.
Files changed (2) hide show
  1. package/dist/index.js +165 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6971,7 +6971,7 @@ var V2_OPERATIONS = {
6971
6971
  rowId: { kind: "string", describe: "Row whose runs should be canceled for row scope." },
6972
6972
  filter: {
6973
6973
  kind: "unknown",
6974
- describe: 'Recursive predicate tree. Each group node is exactly one non-empty `all` or `any` array whose members are further groups or `{ field, op, value }` conditions; the root must be a group, not a bare condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.'
6974
+ describe: 'A single `{ field, op, value }` condition or a recursive `all`/`any` group; either form is normalized to a grouped predicate after validation. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.'
6975
6975
  },
6976
6976
  excludeRowIds: { kind: "array", describe: "Rows excluded from an all-scope cancellation." }
6977
6977
  }
@@ -7535,7 +7535,7 @@ var V2_OPERATIONS = {
7535
7535
  description: { kind: "string", describe: "Optional credential description." },
7536
7536
  id: {
7537
7537
  kind: "string",
7538
- describe: "Required only when provider discovery requests a client-generated ID."
7538
+ describe: "Optional client-generated credential ID. The server mints one when it is omitted, so no provider requires it. A `slack-custom-bot` credential may supply one so its Slack Request URL, which embeds the ID, can be configured before the credential exists; every other provider ignores it."
7539
7539
  },
7540
7540
  credentials: {
7541
7541
  kind: "string",
@@ -7611,7 +7611,7 @@ var V2_OPERATIONS = {
7611
7611
  rowIds: { kind: "array", describe: "Explicit row subset to run." },
7612
7612
  filter: {
7613
7613
  kind: "unknown",
7614
- describe: 'Recursive predicate tree. Each group node is exactly one non-empty `all` or `any` array whose members are further groups or `{ field, op, value }` conditions; the root must be a group, not a bare condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.'
7614
+ describe: 'A single `{ field, op, value }` condition or a recursive `all`/`any` group; either form is normalized to a grouped predicate after validation. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.'
7615
7615
  },
7616
7616
  excludeRowIds: { kind: "array", describe: "Rows excluded from a select-all run scope." },
7617
7617
  limit: { kind: "object", describe: "Optional cap on eligible rows to run." }
@@ -8133,7 +8133,7 @@ var V2_OPERATIONS = {
8133
8133
  workspaceId: { kind: "string", required: true, describe: "Unique workspace identifier." },
8134
8134
  filter: {
8135
8135
  kind: "unknown",
8136
- describe: 'Recursive predicate tree. Each group node is exactly one non-empty `all` or `any` array whose members are further groups or `{ field, op, value }` conditions; the root must be a group, not a bare condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.'
8136
+ describe: 'A single `{ field, op, value }` condition or a recursive `all`/`any` group; either form is normalized to a grouped predicate after validation. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.'
8137
8137
  },
8138
8138
  limit: { kind: "integer", describe: "Maximum matching rows to delete." },
8139
8139
  rowIds: { kind: "array", describe: "Explicit row identifiers to delete." }
@@ -8605,7 +8605,26 @@ var V2_OPERATIONS = {
8605
8605
  segmentCount: {
8606
8606
  kind: "integer",
8607
8607
  default: 72,
8608
- describe: "Number of equal time buckets to divide the window into, from 1 to 500. Exactly this many buckets are always returned. Buckets are never narrower than one minute, so on a short window the series extends past the end of the window rather than being compressed, and the trailing buckets are empty."
8608
+ describe: "Number of equal time buckets to divide the window into, from 1 to 500. It is the ceiling on how many buckets a series carries: with `includeEmpty=true` exactly this many are returned, otherwise only the buckets holding at least one run. Buckets are never narrower than one minute, so on a short window the series extends past the end of the window rather than being compressed, and the trailing buckets are empty."
8609
+ },
8610
+ includeEmpty: {
8611
+ kind: "enum",
8612
+ values: [
8613
+ "true",
8614
+ "1",
8615
+ "yes",
8616
+ "on",
8617
+ "y",
8618
+ "enabled",
8619
+ "false",
8620
+ "0",
8621
+ "no",
8622
+ "off",
8623
+ "n",
8624
+ "disabled"
8625
+ ],
8626
+ default: false,
8627
+ describe: "Whether buckets with no runs are included in every series. Off by default, so each series carries only the buckets that hold at least one run; set it to publish exactly `segmentCount` buckets per series, empty ones included. The listed spellings are the whole accepted vocabulary and are case-sensitive; any other value is rejected."
8609
8628
  }
8610
8629
  }
8611
8630
  },
@@ -10841,7 +10860,7 @@ var V2_OPERATIONS = {
10841
10860
  q: { kind: "string", required: true, describe: "Case-insensitive cell substring to find." },
10842
10861
  predicate: {
10843
10862
  kind: "unknown",
10844
- describe: 'Recursive predicate tree. Each group node is exactly one non-empty `all` or `any` array whose members are further groups or `{ field, op, value }` conditions; the root must be a group, not a bare condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.'
10863
+ describe: 'A single `{ field, op, value }` condition or a recursive `all`/`any` group; either form is normalized to a grouped predicate after validation. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.'
10845
10864
  },
10846
10865
  sort: { kind: "array", describe: "Ordered table-row sort specification." }
10847
10866
  }
@@ -11283,7 +11302,7 @@ var V2_OPERATIONS = {
11283
11302
  filter: {
11284
11303
  kind: "unknown",
11285
11304
  required: true,
11286
- describe: 'Recursive predicate tree. Each group node is exactly one non-empty `all` or `any` array whose members are further groups or `{ field, op, value }` conditions; the root must be a group, not a bare condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.'
11305
+ describe: 'A single `{ field, op, value }` condition or a recursive `all`/`any` group; either form is normalized to a grouped predicate after validation. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.'
11287
11306
  },
11288
11307
  data: {
11289
11308
  kind: "object",
@@ -12236,7 +12255,7 @@ var CLI_CONTRACT = {
12236
12255
  },
12237
12256
  deleteTableView: { confirm: "This deletes the saved view and its filters." },
12238
12257
  deleteWorkflowGroup: {
12239
- confirm: "This deletes the group, every column it fed, and the values in them.",
12258
+ confirm: "This deletes the group AND its output columns with all of their row data; the workflow it pointed at is untouched.",
12240
12259
  fields: [
12241
12260
  { header: "id" },
12242
12261
  { header: "deleted", format: "bool" },
@@ -13102,7 +13121,7 @@ var CLI_CONTRACT = {
13102
13121
  selectedOutputs: {
13103
13122
  name: "select-output",
13104
13123
  list: true,
13105
- describe: "Include blockId or blockId.path values in JSON or YAML output; block names are not resolved on a finished run"
13124
+ describe: "Include blockName.path or blockId.path values (e.g. agent_1.content) in JSON or YAML output; names resolve against the workflow’s current blocks, and missing paths are omitted"
13106
13125
  }
13107
13126
  },
13108
13127
  fields: [
@@ -14072,6 +14091,22 @@ function countOf(value) {
14072
14091
  function lengthOf(value) {
14073
14092
  return Array.isArray(value) ? value.length : 0;
14074
14093
  }
14094
+ var RESULT_NOTES = {
14095
+ replaceWorkflowChatDeployment: (payload, body) => {
14096
+ const authType = payload.authType ?? body?.authType ?? "public";
14097
+ return authType === "public" ? "note: auth type is public — anyone with the link can chat; pass --auth-type password|email to restrict it." : null;
14098
+ }
14099
+ };
14100
+ function writeResultNote(operation, payload, body) {
14101
+ const note = RESULT_NOTES[operation];
14102
+ if (!note)
14103
+ return;
14104
+ const record = payload && typeof payload === "object" && !Array.isArray(payload) ? payload : {};
14105
+ const message = note(record, body);
14106
+ if (message)
14107
+ process.stderr.write(source_default.dim(`${message}
14108
+ `));
14109
+ }
14075
14110
  function bulkFailureMessage(operation, payload, body) {
14076
14111
  const check = BULK_OUTCOME_CHECKS[operation];
14077
14112
  if (!check)
@@ -14197,6 +14232,7 @@ async function executeOperation(operation, commandSpec, operationSpec, invocatio
14197
14232
  });
14198
14233
  const payload = result?.data ?? result;
14199
14234
  renderResult(operation, profile.output, payload, commandSpec, { expandedTrace: requestFlags.trace === true }, result);
14235
+ writeResultNote(operation, payload, request.body);
14200
14236
  const failure = runFailureMessage(operation, payload) ?? bulkFailureMessage(operation, payload, request.body);
14201
14237
  if (failure)
14202
14238
  throw new SimApiError(failure, 0);
@@ -16026,6 +16062,118 @@ function attachWorkflowRunFollow(workflows) {
16026
16062
  run.option("--manual", "Run the current saved workflow state instead of the active deployment").option("--trigger <blockId>", "Enter the run through this runnable trigger; runs the current saved workflow state (implies --manual)").option("--mock-payload", "Use the selected trigger's server-derived mock payload; runs the current saved workflow state (implies --manual)").option("--from-block <blockId>", "Run manually from this saved workflow block").option("--source-run <runId>", "Prior run whose persisted state supplies upstream outputs (requires --from-block)").option("--follow", "Stream the run as it happens; progress on stderr, result on stdout. The stream reports only success and output, so the result omits the run id and timings a non-streaming run returns").option("--include-thinking", "Show model reasoning while following (requires --follow)").option("--include-tool-calls", "Show tool calls while following (requires --follow)").action(followOrDelegate(previous));
16027
16063
  }
16028
16064
 
16065
+ // src/commands/protocol/workflow-run-get.ts
16066
+ var BLOCK_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
16067
+ var SELECT_OUTPUT_FLAG = "select-output";
16068
+ function normalizeBlockName(name) {
16069
+ return name.toLowerCase().replace(/\s+/g, "").replace(/\./g, "");
16070
+ }
16071
+ function isRecord2(value) {
16072
+ return typeof value === "object" && value !== null && !Array.isArray(value);
16073
+ }
16074
+ async function loadWorkflowBlocks(client, workflowId) {
16075
+ const operation = V2_OPERATIONS.getWorkflowState;
16076
+ const raw = await client.request(resolvePath(operation.path, { workflowId }), {
16077
+ method: operation.method
16078
+ });
16079
+ const state = isRecord2(raw) && isRecord2(raw.data) ? raw.data : raw;
16080
+ const blocks = isRecord2(state) && isRecord2(state.blocks) ? Object.entries(state.blocks) : [];
16081
+ return blocks.map(([key, block]) => ({
16082
+ id: isRecord2(block) && typeof block.id === "string" ? block.id : key,
16083
+ name: isRecord2(block) && typeof block.name === "string" ? block.name : ""
16084
+ }));
16085
+ }
16086
+ function splitSelector(selector) {
16087
+ const dot = selector.indexOf(".");
16088
+ return dot === -1 ? { head: selector, path: "" } : { head: selector.slice(0, dot), path: selector.slice(dot) };
16089
+ }
16090
+ function isIdHeaded(selector) {
16091
+ return BLOCK_ID.test(splitSelector(selector).head);
16092
+ }
16093
+ function resolveSelection(typed, blocks, workflowId) {
16094
+ const resolved = [];
16095
+ const typedBy = new Map;
16096
+ const unresolved = [];
16097
+ for (const selector of typed) {
16098
+ const { head, path } = splitSelector(selector);
16099
+ let blockId = head;
16100
+ if (!BLOCK_ID.test(head)) {
16101
+ const wanted = normalizeBlockName(head);
16102
+ const matches = blocks.filter((block) => block.id === head || normalizeBlockName(block.name) === wanted);
16103
+ if (matches.length === 0) {
16104
+ unresolved.push(selector);
16105
+ continue;
16106
+ }
16107
+ if (matches.length > 1) {
16108
+ throw new SimApiError(`--${SELECT_OUTPUT_FLAG} ${selector} names ${matches.length} blocks (${matches.map((block) => block.id).join(", ")}); pass the block id instead`, 0);
16109
+ }
16110
+ blockId = matches[0].id;
16111
+ }
16112
+ const rewritten = `${blockId}${path}`;
16113
+ resolved.push(rewritten);
16114
+ if (!typedBy.has(rewritten))
16115
+ typedBy.set(rewritten, selector);
16116
+ }
16117
+ if (unresolved.length > 0) {
16118
+ const names = blocks.map((block) => block.name).filter((name) => name !== "");
16119
+ throw new SimApiError(`--${SELECT_OUTPUT_FLAG} did not resolve to any block on this run: ${unresolved.join(", ")}. Pass a block id or its name — "blockId", "blockId.path", "blockName" or "blockName.path"; names match ignoring case, spaces and dots. Blocks on workflow ${workflowId}: ${names.length > 0 ? names.join(", ") : "none"}.`, 0);
16120
+ }
16121
+ return { resolved, typedBy };
16122
+ }
16123
+ function keyByTyped(payload, typedBy) {
16124
+ if (!isRecord2(payload) || !isRecord2(payload.blockOutputs))
16125
+ return payload;
16126
+ const blockOutputs = {};
16127
+ for (const [key, value] of Object.entries(payload.blockOutputs)) {
16128
+ blockOutputs[typedBy.get(key) ?? key] = value;
16129
+ }
16130
+ return { ...payload, blockOutputs };
16131
+ }
16132
+ async function readRunByName(runId, typed, command) {
16133
+ const flags = command.optsWithGlobals();
16134
+ const { client, profile } = clientFrom(command);
16135
+ const operation = V2_OPERATIONS.getWorkflowRun;
16136
+ const spec = CLI_CONTRACT.getWorkflowRun ?? {};
16137
+ buildRequest("getWorkflowRun", [runId], flags, profile.workspaceId);
16138
+ const workflowId = String(flags.workflow);
16139
+ const selection = resolveSelection(typed, await loadWorkflowBlocks(client, workflowId), workflowId);
16140
+ const request = buildRequest("getWorkflowRun", [runId], { ...flags, selectOutput: selection.resolved }, profile.workspaceId);
16141
+ let result;
16142
+ try {
16143
+ result = await client.request(request.path, {
16144
+ method: operation.method,
16145
+ headers: request.headers,
16146
+ query: request.query,
16147
+ body: request.body
16148
+ });
16149
+ } catch (error) {
16150
+ throw retypeApiError(error, "getWorkflowRun", spec, operation);
16151
+ }
16152
+ renderResult("getWorkflowRun", profile.output, keyByTyped(result?.data ?? result, selection.typedBy), spec, {}, result);
16153
+ }
16154
+ function attachWorkflowRunGet(runs) {
16155
+ const get = runs.commands.find((command) => command.name() === "get");
16156
+ const held = get?._actionHandler;
16157
+ if (!get || typeof held !== "function") {
16158
+ throw new Error("workflows runs get must be registered before block names can be attached to it");
16159
+ }
16160
+ const previous = held;
16161
+ get.action(async (runId, _options, command) => {
16162
+ const raw = command.optsWithGlobals().selectOutput;
16163
+ if (raw === undefined) {
16164
+ await previous(command.processedArgs);
16165
+ return;
16166
+ }
16167
+ const typed = readListValues(raw, SELECT_OUTPUT_FLAG);
16168
+ command.setOptionValue("selectOutput", typed);
16169
+ if (typed.every(isIdHeaded)) {
16170
+ await previous(command.processedArgs);
16171
+ return;
16172
+ }
16173
+ await readRunByName(runId, typed, command);
16174
+ });
16175
+ }
16176
+
16029
16177
  // src/commands/protocol/workflow-run-wait.ts
16030
16178
  var TERMINAL_STATUSES = new Set(["completed", "failed", "cancelled"]);
16031
16179
  var WAIT_EXIT_CODES = {
@@ -16040,21 +16188,21 @@ var MAX_POLL_DELAY_MS = 15000;
16040
16188
  var POLL_BACKOFF_FACTOR = 2;
16041
16189
  var DEFAULT_WAIT_TIMEOUT_SECONDS = 3600;
16042
16190
  var WAIT_TIMEOUT_FLAG = "--wait-timeout <seconds>";
16043
- function isRecord2(value) {
16191
+ function isRecord3(value) {
16044
16192
  return typeof value === "object" && value !== null && !Array.isArray(value);
16045
16193
  }
16046
16194
  function optionalString(value) {
16047
16195
  return typeof value === "string" && value !== "" ? value : null;
16048
16196
  }
16049
16197
  function runData(raw) {
16050
- return isRecord2(raw) && isRecord2(raw.data) ? raw.data : raw;
16198
+ return isRecord3(raw) && isRecord3(raw.data) ? raw.data : raw;
16051
16199
  }
16052
16200
  function readRun(raw) {
16053
- const run = isRecord2(raw) && isRecord2(raw.data) ? raw.data : raw;
16054
- if (!isRecord2(run) || typeof run.status !== "string") {
16201
+ const run = isRecord3(raw) && isRecord3(raw.data) ? raw.data : raw;
16202
+ if (!isRecord3(run) || typeof run.status !== "string") {
16055
16203
  throw new SimApiError("Run status response carried no status.", 0);
16056
16204
  }
16057
- const paused = isRecord2(run.paused) ? run.paused : null;
16205
+ const paused = isRecord3(run.paused) ? run.paused : null;
16058
16206
  return {
16059
16207
  status: run.status,
16060
16208
  pauseKind: paused ? optionalString(paused.pauseKind) : null,
@@ -16191,7 +16339,9 @@ function attachProtocolCommands(program2) {
16191
16339
  createFolder: "createWorkflowFolder"
16192
16340
  });
16193
16341
  attachWorkflowRunFollow(workflows);
16194
- attachWorkflowRunWait(group(workflows, "runs"));
16342
+ const runs = group(workflows, "runs");
16343
+ attachWorkflowRunGet(runs);
16344
+ attachWorkflowRunWait(runs);
16195
16345
  attachLogsFollow(group(program2, "logs"));
16196
16346
  attachChat(program2);
16197
16347
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.1.5-dev.77.1",
3
+ "version": "2.1.5-dev.79.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "bin": {