sim 2.2.7-preview.197.1 → 2.2.7-preview.199.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.
@@ -93,6 +93,16 @@ export interface FlagSpec {
93
93
  * including a deliberate `--details basic`.
94
94
  */
95
95
  requestDefault?: string;
96
+ /**
97
+ * Value an embedded invocation sends when the caller passes nothing; wins over
98
+ * `requestDefault` there and is ignored by the installed CLI.
99
+ *
100
+ * The embedding host returns stdout to a model or writes it to the model's
101
+ * workbench, which addresses files and run state by id rather than reading
102
+ * bulk payloads inline. A field whose server default inlines such a payload
103
+ * names the leaner value here. Whatever the caller types still wins.
104
+ */
105
+ embeddedRequestDefault?: string;
96
106
  /** Accepted values when the generated descriptor cannot recover an enum. */
97
107
  choices?: readonly string[];
98
108
  /**
package/dist/index.js CHANGED
@@ -7591,7 +7591,6 @@ async function installUpdate(options = {}) {
7591
7591
  }
7592
7592
  }
7593
7593
  // src/config/profile.ts
7594
- var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
7595
7594
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
7596
7595
  import { createHash } from "node:crypto";
7597
7596
  import {
@@ -7605,6 +7604,21 @@ import {
7605
7604
  } from "node:fs";
7606
7605
  import { dirname as dirname3 } from "node:path";
7607
7606
 
7607
+ // ../utils/src/string.ts
7608
+ function truncate(str, sliceLength, suffix = "...") {
7609
+ return str.length > sliceLength ? str.slice(0, sliceLength) + suffix : str;
7610
+ }
7611
+ var MARKDOWN_ESCAPABLE = new Set("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~");
7612
+ function stripTrailingSlashes(value) {
7613
+ let end = value.length;
7614
+ while (end > 0 && value.charCodeAt(end - 1) === 47)
7615
+ end--;
7616
+ return value.slice(0, end);
7617
+ }
7618
+
7619
+ // src/config/profile.ts
7620
+ var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
7621
+
7608
7622
  // src/config/ini.ts
7609
7623
  class ProfileConfigError extends Error {
7610
7624
  constructor(message) {
@@ -7994,12 +8008,6 @@ function deleteProfile(profile) {
7994
8008
  writeIni(configPath(), configDoc, false);
7995
8009
  return { config, credentials };
7996
8010
  }
7997
- function stripTrailingSlashes(value) {
7998
- let end = value.length;
7999
- while (end > 0 && value.charCodeAt(end - 1) === 47)
8000
- end--;
8001
- return value.slice(0, end);
8002
- }
8003
8011
  function normalizeEndpoint(endpoint, source) {
8004
8012
  const trimmed = stripTrailingSlashes(endpoint.trim());
8005
8013
  if (FORBIDDEN_IN_VALUE.test(trimmed)) {
@@ -8107,12 +8115,6 @@ function resolveProfile(overrides = {}) {
8107
8115
  }
8108
8116
  };
8109
8117
  }
8110
- // ../utils/src/string.ts
8111
- function truncate(str, sliceLength, suffix = "...") {
8112
- return str.length > sliceLength ? str.slice(0, sliceLength) + suffix : str;
8113
- }
8114
- var MARKDOWN_ESCAPABLE = new Set("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~");
8115
-
8116
8118
  // src/output/io.ts
8117
8119
  import { format } from "node:util";
8118
8120
  function printLine(...args) {
@@ -17808,6 +17810,12 @@ var CLI_CONTRACT = {
17808
17810
  getLog: {
17809
17811
  describe: "Show run diagnostics",
17810
17812
  expandedTrace: true,
17813
+ flags: {
17814
+ includeWorkflowState: {
17815
+ embeddedRequestDefault: "false",
17816
+ describe: "Include the saved workflow snapshot (default: true; Sim’s in-app agent leaves it out unless this flag is passed). Set false to omit block configuration from a log read. Other run fields are unchanged."
17817
+ }
17818
+ },
17811
17819
  fields: [
17812
17820
  { header: "run", path: "runId" },
17813
17821
  { header: "workflow", path: "workflow.name" },
@@ -19046,6 +19054,9 @@ var CLI_CONTRACT = {
19046
19054
  stream: { omit: true },
19047
19055
  includeThinking: { omit: true },
19048
19056
  includeToolCalls: { omit: true },
19057
+ includeFileBase64: {
19058
+ describe: "Inline eligible output files as base64 content (default: true; Sim’s in-app agent gets file references only unless this flag is passed). Rejected when `async` is true."
19059
+ },
19049
19060
  "x-run-id": {
19050
19061
  name: "run-id",
19051
19062
  describe: "One-shot identifier for this run; NOT an idempotency key — reusing a claimed value fails with RUN_ID_CONFLICT instead of replaying the first result, and a fresh value starts another run"
@@ -20013,7 +20024,7 @@ async function buildRequest(operation, positional, flags, workspaceId) {
20013
20024
  const flagName = flagNameFor(operation, field);
20014
20025
  const omitProfileWorkspace = commandSpec.allWorkspaces && flags.allWorkspaces === true;
20015
20026
  const provided = field === PROFILE_INJECTED_FIELD ? omitProfileWorkspace ? undefined : workspaceId : flags[camel(flagName)];
20016
- const raw = provided ?? flag.requestDefault;
20027
+ const raw = provided ?? (embedStore.getStore() ? flag.embeddedRequestDefault : undefined) ?? flag.requestDefault;
20017
20028
  if ((slot === "query" || NUMERIC_KINDS.has(descriptor.kind)) && typeof raw === "string" && raw.trim() === "" && !(field === "limit" && paginatedLimit)) {
20018
20029
  throw new SimApiError(`--${flagName} cannot be empty`, 0);
20019
20030
  }
@@ -22342,6 +22353,11 @@ async function readWorkflowResult(response) {
22342
22353
  }
22343
22354
  throw new SimApiError("Workflow result stream ended without a final result", response.status);
22344
22355
  }
22356
+ function withEmbeddedFileReferences(body) {
22357
+ if (!embedStore.getStore() || body?.includeFileBase64 !== undefined)
22358
+ return body;
22359
+ return { ...body, includeFileBase64: false };
22360
+ }
22345
22361
  async function runWithResultStream(workflowId, command) {
22346
22362
  const flags = command.optsWithGlobals();
22347
22363
  const { client, profile } = clientFrom(command);
@@ -22352,7 +22368,7 @@ async function runWithResultStream(workflowId, command) {
22352
22368
  const response = await client.requestRaw(request.path, {
22353
22369
  method: operation.method,
22354
22370
  query: request.query,
22355
- body: request.body,
22371
+ body: withEmbeddedFileReferences(request.body),
22356
22372
  headers: { ...request.headers, accept: WORKFLOW_RESULT_STREAM_CONTENT_TYPE }
22357
22373
  });
22358
22374
  const payload = await readWorkflowResult(response);
@@ -22495,7 +22511,7 @@ async function followRun(workflowId, command) {
22495
22511
  method: "POST",
22496
22512
  query: request.query,
22497
22513
  body: {
22498
- ...request.body ?? {},
22514
+ ...withEmbeddedFileReferences(request.body),
22499
22515
  stream: true,
22500
22516
  ...includeThinking ? { includeThinking: true } : {},
22501
22517
  ...includeToolCalls ? { includeToolCalls: true } : {}
package/dist/runtime.js CHANGED
@@ -3394,7 +3394,6 @@ function telemetryStatePath() {
3394
3394
  return join(configDir(), "telemetry.json");
3395
3395
  }
3396
3396
  // src/config/profile.ts
3397
- var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
3398
3397
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
3399
3398
  import { createHash } from "node:crypto";
3400
3399
  import {
@@ -3408,6 +3407,21 @@ import {
3408
3407
  } from "node:fs";
3409
3408
  import { dirname } from "node:path";
3410
3409
 
3410
+ // ../utils/src/string.ts
3411
+ function truncate(str, sliceLength, suffix = "...") {
3412
+ return str.length > sliceLength ? str.slice(0, sliceLength) + suffix : str;
3413
+ }
3414
+ var MARKDOWN_ESCAPABLE = new Set("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~");
3415
+ function stripTrailingSlashes(value) {
3416
+ let end = value.length;
3417
+ while (end > 0 && value.charCodeAt(end - 1) === 47)
3418
+ end--;
3419
+ return value.slice(0, end);
3420
+ }
3421
+
3422
+ // src/config/profile.ts
3423
+ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
3424
+
3411
3425
  // src/embed-context.ts
3412
3426
  import { AsyncLocalStorage } from "node:async_hooks";
3413
3427
  function setSoftExitCode(code) {
@@ -3838,12 +3852,6 @@ function deleteProfile(profile) {
3838
3852
  writeIni(configPath(), configDoc, false);
3839
3853
  return { config, credentials };
3840
3854
  }
3841
- function stripTrailingSlashes(value) {
3842
- let end = value.length;
3843
- while (end > 0 && value.charCodeAt(end - 1) === 47)
3844
- end--;
3845
- return value.slice(0, end);
3846
- }
3847
3855
  function normalizeEndpoint(endpoint, source) {
3848
3856
  const trimmed = stripTrailingSlashes(endpoint.trim());
3849
3857
  if (FORBIDDEN_IN_VALUE.test(trimmed)) {
@@ -4006,12 +4014,6 @@ class EmbeddedOutput {
4006
4014
  }
4007
4015
  }
4008
4016
 
4009
- // ../utils/src/string.ts
4010
- function truncate(str, sliceLength, suffix = "...") {
4011
- return str.length > sliceLength ? str.slice(0, sliceLength) + suffix : str;
4012
- }
4013
- var MARKDOWN_ESCAPABLE = new Set("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~");
4014
-
4015
4017
  // src/output/io.ts
4016
4018
  import { format } from "node:util";
4017
4019
  function printLine(...args) {
@@ -17857,6 +17859,12 @@ var CLI_CONTRACT = {
17857
17859
  getLog: {
17858
17860
  describe: "Show run diagnostics",
17859
17861
  expandedTrace: true,
17862
+ flags: {
17863
+ includeWorkflowState: {
17864
+ embeddedRequestDefault: "false",
17865
+ describe: "Include the saved workflow snapshot (default: true; Sim’s in-app agent leaves it out unless this flag is passed). Set false to omit block configuration from a log read. Other run fields are unchanged."
17866
+ }
17867
+ },
17860
17868
  fields: [
17861
17869
  { header: "run", path: "runId" },
17862
17870
  { header: "workflow", path: "workflow.name" },
@@ -19095,6 +19103,9 @@ var CLI_CONTRACT = {
19095
19103
  stream: { omit: true },
19096
19104
  includeThinking: { omit: true },
19097
19105
  includeToolCalls: { omit: true },
19106
+ includeFileBase64: {
19107
+ describe: "Inline eligible output files as base64 content (default: true; Sim’s in-app agent gets file references only unless this flag is passed). Rejected when `async` is true."
19108
+ },
19098
19109
  "x-run-id": {
19099
19110
  name: "run-id",
19100
19111
  describe: "One-shot identifier for this run; NOT an idempotency key — reusing a claimed value fails with RUN_ID_CONFLICT instead of replaying the first result, and a fresh value starts another run"
@@ -20062,7 +20073,7 @@ async function buildRequest(operation, positional, flags, workspaceId) {
20062
20073
  const flagName = flagNameFor(operation, field);
20063
20074
  const omitProfileWorkspace = commandSpec.allWorkspaces && flags.allWorkspaces === true;
20064
20075
  const provided = field === PROFILE_INJECTED_FIELD ? omitProfileWorkspace ? undefined : workspaceId : flags[camel(flagName)];
20065
- const raw = provided ?? flag.requestDefault;
20076
+ const raw = provided ?? (embedStore.getStore() ? flag.embeddedRequestDefault : undefined) ?? flag.requestDefault;
20066
20077
  if ((slot === "query" || NUMERIC_KINDS.has(descriptor.kind)) && typeof raw === "string" && raw.trim() === "" && !(field === "limit" && paginatedLimit)) {
20067
20078
  throw new SimApiError(`--${flagName} cannot be empty`, 0);
20068
20079
  }
@@ -22391,6 +22402,11 @@ async function readWorkflowResult(response) {
22391
22402
  }
22392
22403
  throw new SimApiError("Workflow result stream ended without a final result", response.status);
22393
22404
  }
22405
+ function withEmbeddedFileReferences(body) {
22406
+ if (!embedStore.getStore() || body?.includeFileBase64 !== undefined)
22407
+ return body;
22408
+ return { ...body, includeFileBase64: false };
22409
+ }
22394
22410
  async function runWithResultStream(workflowId, command) {
22395
22411
  const flags = command.optsWithGlobals();
22396
22412
  const { client, profile } = clientFrom(command);
@@ -22401,7 +22417,7 @@ async function runWithResultStream(workflowId, command) {
22401
22417
  const response = await client.requestRaw(request.path, {
22402
22418
  method: operation.method,
22403
22419
  query: request.query,
22404
- body: request.body,
22420
+ body: withEmbeddedFileReferences(request.body),
22405
22421
  headers: { ...request.headers, accept: WORKFLOW_RESULT_STREAM_CONTENT_TYPE }
22406
22422
  });
22407
22423
  const payload = await readWorkflowResult(response);
@@ -22544,7 +22560,7 @@ async function followRun(workflowId, command) {
22544
22560
  method: "POST",
22545
22561
  query: request.query,
22546
22562
  body: {
22547
- ...request.body ?? {},
22563
+ ...withEmbeddedFileReferences(request.body),
22548
22564
  stream: true,
22549
22565
  ...includeThinking ? { includeThinking: true } : {},
22550
22566
  ...includeToolCalls ? { includeToolCalls: true } : {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.2.7-preview.197.1",
3
+ "version": "2.2.7-preview.199.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "imports": {