sim 2.2.3-preview.183.1 → 2.2.3-preview.184.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/README.md CHANGED
@@ -187,6 +187,16 @@ For each setting, the CLI uses the first available value in this order:
187
187
  4. built-in default
188
188
 
189
189
  `sim whoami` shows both the resolved values and where each one came from.
190
+ Its JSON and YAML `authenticated` field is `true` after the server accepts the
191
+ credential, `false` when it is missing or rejected, and `null` when authentication
192
+ could not be checked (including `--no-verify`). `verification.status` separately
193
+ reports whether the configured workspace is accessible; a valid credential can
194
+ still have `no-workspace` or `rejected` workspace verification.
195
+
196
+ `sim files read` and `sim files versions read` print the complete text response as
197
+ JSON, or YAML with `--output yaml`, including in table and text display modes.
198
+ The `truncated` field describes server extraction limits, not display clipping.
199
+ For the original file bytes, use `sim files get`.
190
200
 
191
201
  ## Useful commands
192
202
 
package/dist/index.js CHANGED
@@ -9327,6 +9327,17 @@ import { spawn as spawn3 } from "node:child_process";
9327
9327
  import { randomBytes as randomBytes3 } from "node:crypto";
9328
9328
  import { createInterface } from "node:readline/promises";
9329
9329
 
9330
+ // ../utils/src/object.ts
9331
+ function isRecordLike(value) {
9332
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9333
+ }
9334
+ function toRecord(value) {
9335
+ return isRecordLike(value) ? value : {};
9336
+ }
9337
+ function toRecordOrNull(value) {
9338
+ return isRecordLike(value) ? value : null;
9339
+ }
9340
+
9330
9341
  // src/auth/device-flow.ts
9331
9342
  import { createHash as createHash3, randomBytes as randomBytes2, randomInt } from "node:crypto";
9332
9343
 
@@ -16791,13 +16802,13 @@ function openBrowser(url) {
16791
16802
  function presentAuthentication(source) {
16792
16803
  switch (source) {
16793
16804
  case "flag":
16794
- return { authenticated: true, source: "flag" };
16805
+ return { configured: true, source: "flag" };
16795
16806
  case "env":
16796
- return { authenticated: true, source: "env" };
16807
+ return { configured: true, source: "env" };
16797
16808
  case "credentials":
16798
- return { authenticated: true, source: "credentials" };
16809
+ return { configured: true, source: "credentials" };
16799
16810
  case "unset":
16800
- return { authenticated: false, source: "unset" };
16811
+ return { configured: false, source: "unset" };
16801
16812
  case "config":
16802
16813
  case "default":
16803
16814
  throw new SimApiError(`Unexpected credential source "${source}".`, 0);
@@ -17203,18 +17214,7 @@ function logoutCommand() {
17203
17214
  }
17204
17215
  });
17205
17216
  }
17206
- async function readKeyType(client) {
17207
- const operation = V2_OPERATIONS.getMeta;
17208
- try {
17209
- const response = await client.request(operation.path, {
17210
- method: operation.method
17211
- });
17212
- return response.data.keyType;
17213
- } catch {
17214
- return null;
17215
- }
17216
- }
17217
- var CREDENTIAL_VERDICT_STATUSES = new Set([401, 403, 404]);
17217
+ var PROFILE_REJECTION_STATUSES = new Set([401, 403, 404]);
17218
17218
  var WHOAMI_EXIT_CODES = {
17219
17219
  verified: 0,
17220
17220
  disabled: 0,
@@ -17227,15 +17227,41 @@ async function verifyProfile(client, profile) {
17227
17227
  if (!profile.apiKey && !profile.oauth) {
17228
17228
  return {
17229
17229
  status: "unauthenticated",
17230
+ authenticated: false,
17230
17231
  workspace: null,
17231
17232
  keyType: null,
17232
17233
  detail: `not logged in — run: sim login --profile ${safeOneLine(profile.name)}`
17233
17234
  };
17234
17235
  }
17235
- const keyType = await readKeyType(client);
17236
+ let keyType = null;
17237
+ let authenticated = null;
17238
+ const metaOperation = V2_OPERATIONS.getMeta;
17239
+ try {
17240
+ const response = await client.request(metaOperation.path, {
17241
+ method: metaOperation.method
17242
+ });
17243
+ const reportedKeyType = toRecord(toRecord(response).data).keyType;
17244
+ if (reportedKeyType === "personal" || reportedKeyType === "workspace" || reportedKeyType === "oauth_access_token") {
17245
+ keyType = reportedKeyType;
17246
+ authenticated = true;
17247
+ }
17248
+ } catch (error) {
17249
+ if (!(error instanceof SimApiError))
17250
+ throw error;
17251
+ if (error.status === 401 || error.status === 403) {
17252
+ return {
17253
+ status: "rejected",
17254
+ authenticated: false,
17255
+ workspace: null,
17256
+ keyType: null,
17257
+ detail: error.message
17258
+ };
17259
+ }
17260
+ }
17236
17261
  if (!profile.workspaceId) {
17237
17262
  return {
17238
17263
  status: "no-workspace",
17264
+ authenticated,
17239
17265
  workspace: null,
17240
17266
  keyType,
17241
17267
  detail: `no workspace to check against — run: sim configure --profile ${safeOneLine(profile.name)} --set-workspace <id>`
@@ -17245,12 +17271,19 @@ async function verifyProfile(client, profile) {
17245
17271
  try {
17246
17272
  const response = await client.request(resolvePath(operation.path, { workspaceId: profile.workspaceId }), { method: operation.method });
17247
17273
  const { id, name, memberCount } = response.data;
17248
- return { status: "verified", workspace: { id, name, memberCount }, keyType, detail: null };
17274
+ return {
17275
+ status: "verified",
17276
+ authenticated: true,
17277
+ workspace: { id, name, memberCount },
17278
+ keyType,
17279
+ detail: null
17280
+ };
17249
17281
  } catch (error) {
17250
17282
  if (!(error instanceof SimApiError))
17251
17283
  throw error;
17252
17284
  return {
17253
- status: CREDENTIAL_VERDICT_STATUSES.has(error.status) ? "rejected" : "unreachable",
17285
+ status: PROFILE_REJECTION_STATUSES.has(error.status) ? "rejected" : "unreachable",
17286
+ authenticated: error.status === 401 ? false : authenticated,
17254
17287
  workspace: null,
17255
17288
  keyType,
17256
17289
  detail: error.message
@@ -17282,6 +17315,7 @@ function whoamiCommand() {
17282
17315
  const authentication = presentAuthentication(sources.credential);
17283
17316
  const verification = options.verify ? await verifyProfile(client, profile) : {
17284
17317
  status: "disabled",
17318
+ authenticated: authentication.configured ? null : false,
17285
17319
  workspace: null,
17286
17320
  keyType: null,
17287
17321
  detail: "not checked (--no-verify)"
@@ -17292,7 +17326,7 @@ function whoamiCommand() {
17292
17326
  ["Endpoint", annotate(profile.endpoint, sources.endpoint)],
17293
17327
  [
17294
17328
  "Login",
17295
- authentication.authenticated ? annotate(profile.oauth ? "OAuth" : "API key", authentication.source) : styles3().yellow("not logged in")
17329
+ authentication.configured ? annotate(profile.oauth ? "OAuth" : "API key", authentication.source) : styles3().yellow("not logged in")
17296
17330
  ],
17297
17331
  [
17298
17332
  "Key type",
@@ -17306,7 +17340,7 @@ function whoamiCommand() {
17306
17340
  endpoint: profile.endpoint,
17307
17341
  workspaceId: profile.workspaceId,
17308
17342
  output: profile.output,
17309
- authenticated: authentication.authenticated,
17343
+ authenticated: verification.authenticated,
17310
17344
  sources: {
17311
17345
  endpoint: sources.endpoint,
17312
17346
  authentication: authentication.source,
@@ -17804,7 +17838,8 @@ var CLI_CONTRACT = {
17804
17838
  },
17805
17839
  readFileText: {
17806
17840
  command: "files read",
17807
- describe: "Read a file’s text content"
17841
+ describe: "Read a file’s text content as JSON or YAML",
17842
+ document: true
17808
17843
  },
17809
17844
  createWorkflowMcpServer: {
17810
17845
  flags: { workflowIds: { name: "workflow", list: true } }
@@ -17998,7 +18033,14 @@ var CLI_CONTRACT = {
17998
18033
  variants: [moveResource("knowledge mv", "knowledge base")],
17999
18034
  flags: { folderPath: FOLDER_PATH_FLAG }
18000
18035
  },
18001
- createWorkflow: { flags: { folderPath: FOLDER_PATH_FLAG } },
18036
+ createWorkflow: {
18037
+ flags: {
18038
+ folderPath: {
18039
+ ...FOLDER_PATH_FLAG,
18040
+ describe: "Existing folder path (leading / optional); create it first with sim workflows mkdir <path>"
18041
+ }
18042
+ }
18043
+ },
18002
18044
  updateWorkflow: {
18003
18045
  variants: [moveResource("workflows mv", "workflow")],
18004
18046
  flags: { folderPath: FOLDER_PATH_FLAG }
@@ -18614,7 +18656,8 @@ var CLI_CONTRACT = {
18614
18656
  },
18615
18657
  readFileVersionText: {
18616
18658
  command: "files versions read",
18617
- describe: "Read the text content of one version of a file"
18659
+ describe: "Read the text content of one version of a file as JSON or YAML",
18660
+ document: true
18618
18661
  },
18619
18662
  revertFileVersion: {
18620
18663
  command: "files versions revert",
@@ -22205,14 +22248,6 @@ function attachTableImport(tables) {
22205
22248
  });
22206
22249
  }
22207
22250
 
22208
- // ../utils/src/object.ts
22209
- function isRecordLike(value) {
22210
- return typeof value === "object" && value !== null && !Array.isArray(value);
22211
- }
22212
- function toRecordOrNull(value) {
22213
- return isRecordLike(value) ? value : null;
22214
- }
22215
-
22216
22251
  // src/commands/protocol/workflow-run-follow.ts
22217
22252
  var AGENT_STREAM_PROTOCOL_HEADER = "x-sim-stream-protocol";
22218
22253
  var AGENT_STREAM_PROTOCOL_V1 = "agent-events-v1";
package/dist/runtime.js CHANGED
@@ -9036,6 +9036,17 @@ import { spawn as spawn3 } from "node:child_process";
9036
9036
  import { randomBytes as randomBytes3 } from "node:crypto";
9037
9037
  import { createInterface } from "node:readline/promises";
9038
9038
 
9039
+ // ../utils/src/object.ts
9040
+ function isRecordLike(value) {
9041
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9042
+ }
9043
+ function toRecord(value) {
9044
+ return isRecordLike(value) ? value : {};
9045
+ }
9046
+ function toRecordOrNull(value) {
9047
+ return isRecordLike(value) ? value : null;
9048
+ }
9049
+
9039
9050
  // src/auth/device-flow.ts
9040
9051
  import { createHash as createHash2, randomBytes, randomInt } from "node:crypto";
9041
9052
 
@@ -16840,13 +16851,13 @@ function openBrowser(url) {
16840
16851
  function presentAuthentication(source) {
16841
16852
  switch (source) {
16842
16853
  case "flag":
16843
- return { authenticated: true, source: "flag" };
16854
+ return { configured: true, source: "flag" };
16844
16855
  case "env":
16845
- return { authenticated: true, source: "env" };
16856
+ return { configured: true, source: "env" };
16846
16857
  case "credentials":
16847
- return { authenticated: true, source: "credentials" };
16858
+ return { configured: true, source: "credentials" };
16848
16859
  case "unset":
16849
- return { authenticated: false, source: "unset" };
16860
+ return { configured: false, source: "unset" };
16850
16861
  case "config":
16851
16862
  case "default":
16852
16863
  throw new SimApiError(`Unexpected credential source "${source}".`, 0);
@@ -17252,18 +17263,7 @@ function logoutCommand() {
17252
17263
  }
17253
17264
  });
17254
17265
  }
17255
- async function readKeyType(client) {
17256
- const operation = V2_OPERATIONS.getMeta;
17257
- try {
17258
- const response = await client.request(operation.path, {
17259
- method: operation.method
17260
- });
17261
- return response.data.keyType;
17262
- } catch {
17263
- return null;
17264
- }
17265
- }
17266
- var CREDENTIAL_VERDICT_STATUSES = new Set([401, 403, 404]);
17266
+ var PROFILE_REJECTION_STATUSES = new Set([401, 403, 404]);
17267
17267
  var WHOAMI_EXIT_CODES = {
17268
17268
  verified: 0,
17269
17269
  disabled: 0,
@@ -17276,15 +17276,41 @@ async function verifyProfile(client, profile) {
17276
17276
  if (!profile.apiKey && !profile.oauth) {
17277
17277
  return {
17278
17278
  status: "unauthenticated",
17279
+ authenticated: false,
17279
17280
  workspace: null,
17280
17281
  keyType: null,
17281
17282
  detail: `not logged in — run: sim login --profile ${safeOneLine(profile.name)}`
17282
17283
  };
17283
17284
  }
17284
- const keyType = await readKeyType(client);
17285
+ let keyType = null;
17286
+ let authenticated = null;
17287
+ const metaOperation = V2_OPERATIONS.getMeta;
17288
+ try {
17289
+ const response = await client.request(metaOperation.path, {
17290
+ method: metaOperation.method
17291
+ });
17292
+ const reportedKeyType = toRecord(toRecord(response).data).keyType;
17293
+ if (reportedKeyType === "personal" || reportedKeyType === "workspace" || reportedKeyType === "oauth_access_token") {
17294
+ keyType = reportedKeyType;
17295
+ authenticated = true;
17296
+ }
17297
+ } catch (error) {
17298
+ if (!(error instanceof SimApiError))
17299
+ throw error;
17300
+ if (error.status === 401 || error.status === 403) {
17301
+ return {
17302
+ status: "rejected",
17303
+ authenticated: false,
17304
+ workspace: null,
17305
+ keyType: null,
17306
+ detail: error.message
17307
+ };
17308
+ }
17309
+ }
17285
17310
  if (!profile.workspaceId) {
17286
17311
  return {
17287
17312
  status: "no-workspace",
17313
+ authenticated,
17288
17314
  workspace: null,
17289
17315
  keyType,
17290
17316
  detail: `no workspace to check against — run: sim configure --profile ${safeOneLine(profile.name)} --set-workspace <id>`
@@ -17294,12 +17320,19 @@ async function verifyProfile(client, profile) {
17294
17320
  try {
17295
17321
  const response = await client.request(resolvePath(operation.path, { workspaceId: profile.workspaceId }), { method: operation.method });
17296
17322
  const { id, name, memberCount } = response.data;
17297
- return { status: "verified", workspace: { id, name, memberCount }, keyType, detail: null };
17323
+ return {
17324
+ status: "verified",
17325
+ authenticated: true,
17326
+ workspace: { id, name, memberCount },
17327
+ keyType,
17328
+ detail: null
17329
+ };
17298
17330
  } catch (error) {
17299
17331
  if (!(error instanceof SimApiError))
17300
17332
  throw error;
17301
17333
  return {
17302
- status: CREDENTIAL_VERDICT_STATUSES.has(error.status) ? "rejected" : "unreachable",
17334
+ status: PROFILE_REJECTION_STATUSES.has(error.status) ? "rejected" : "unreachable",
17335
+ authenticated: error.status === 401 ? false : authenticated,
17303
17336
  workspace: null,
17304
17337
  keyType,
17305
17338
  detail: error.message
@@ -17331,6 +17364,7 @@ function whoamiCommand() {
17331
17364
  const authentication = presentAuthentication(sources.credential);
17332
17365
  const verification = options.verify ? await verifyProfile(client, profile) : {
17333
17366
  status: "disabled",
17367
+ authenticated: authentication.configured ? null : false,
17334
17368
  workspace: null,
17335
17369
  keyType: null,
17336
17370
  detail: "not checked (--no-verify)"
@@ -17341,7 +17375,7 @@ function whoamiCommand() {
17341
17375
  ["Endpoint", annotate(profile.endpoint, sources.endpoint)],
17342
17376
  [
17343
17377
  "Login",
17344
- authentication.authenticated ? annotate(profile.oauth ? "OAuth" : "API key", authentication.source) : styles3().yellow("not logged in")
17378
+ authentication.configured ? annotate(profile.oauth ? "OAuth" : "API key", authentication.source) : styles3().yellow("not logged in")
17345
17379
  ],
17346
17380
  [
17347
17381
  "Key type",
@@ -17355,7 +17389,7 @@ function whoamiCommand() {
17355
17389
  endpoint: profile.endpoint,
17356
17390
  workspaceId: profile.workspaceId,
17357
17391
  output: profile.output,
17358
- authenticated: authentication.authenticated,
17392
+ authenticated: verification.authenticated,
17359
17393
  sources: {
17360
17394
  endpoint: sources.endpoint,
17361
17395
  authentication: authentication.source,
@@ -17853,7 +17887,8 @@ var CLI_CONTRACT = {
17853
17887
  },
17854
17888
  readFileText: {
17855
17889
  command: "files read",
17856
- describe: "Read a file’s text content"
17890
+ describe: "Read a file’s text content as JSON or YAML",
17891
+ document: true
17857
17892
  },
17858
17893
  createWorkflowMcpServer: {
17859
17894
  flags: { workflowIds: { name: "workflow", list: true } }
@@ -18047,7 +18082,14 @@ var CLI_CONTRACT = {
18047
18082
  variants: [moveResource("knowledge mv", "knowledge base")],
18048
18083
  flags: { folderPath: FOLDER_PATH_FLAG }
18049
18084
  },
18050
- createWorkflow: { flags: { folderPath: FOLDER_PATH_FLAG } },
18085
+ createWorkflow: {
18086
+ flags: {
18087
+ folderPath: {
18088
+ ...FOLDER_PATH_FLAG,
18089
+ describe: "Existing folder path (leading / optional); create it first with sim workflows mkdir <path>"
18090
+ }
18091
+ }
18092
+ },
18051
18093
  updateWorkflow: {
18052
18094
  variants: [moveResource("workflows mv", "workflow")],
18053
18095
  flags: { folderPath: FOLDER_PATH_FLAG }
@@ -18663,7 +18705,8 @@ var CLI_CONTRACT = {
18663
18705
  },
18664
18706
  readFileVersionText: {
18665
18707
  command: "files versions read",
18666
- describe: "Read the text content of one version of a file"
18708
+ describe: "Read the text content of one version of a file as JSON or YAML",
18709
+ document: true
18667
18710
  },
18668
18711
  revertFileVersion: {
18669
18712
  command: "files versions revert",
@@ -22254,14 +22297,6 @@ function attachTableImport(tables) {
22254
22297
  });
22255
22298
  }
22256
22299
 
22257
- // ../utils/src/object.ts
22258
- function isRecordLike(value) {
22259
- return typeof value === "object" && value !== null && !Array.isArray(value);
22260
- }
22261
- function toRecordOrNull(value) {
22262
- return isRecordLike(value) ? value : null;
22263
- }
22264
-
22265
22300
  // src/commands/protocol/workflow-run-follow.ts
22266
22301
  var AGENT_STREAM_PROTOCOL_HEADER = "x-sim-stream-protocol";
22267
22302
  var AGENT_STREAM_PROTOCOL_V1 = "agent-events-v1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.2.3-preview.183.1",
3
+ "version": "2.2.3-preview.184.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "imports": {