sim 2.2.3-preview.182.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 +10 -0
- package/dist/generated/v2-api.d.ts +140 -0
- package/dist/index.js +84 -32
- package/dist/runtime.js +84 -32
- package/package.json +1 -1
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
|
|
|
@@ -983,6 +983,124 @@ export type ChatResponse = {
|
|
|
983
983
|
toolCalls?: Array<Record<string, unknown>>;
|
|
984
984
|
};
|
|
985
985
|
};
|
|
986
|
+
/** `GET /api/v2/workflows/[workflowId]/versions/compare` */
|
|
987
|
+
export type CompareWorkflowVersionsParams = {
|
|
988
|
+
workflowId: string;
|
|
989
|
+
};
|
|
990
|
+
export type CompareWorkflowVersionsQuery = {
|
|
991
|
+
base: number;
|
|
992
|
+
target: number;
|
|
993
|
+
};
|
|
994
|
+
type CompareWorkflowVersionsResponseRef0 = {
|
|
995
|
+
workflowId: string;
|
|
996
|
+
base: number;
|
|
997
|
+
target: number;
|
|
998
|
+
diff: {
|
|
999
|
+
addedBlocks: Array<{
|
|
1000
|
+
id: string;
|
|
1001
|
+
type: string;
|
|
1002
|
+
name?: string;
|
|
1003
|
+
}>;
|
|
1004
|
+
removedBlocks: Array<{
|
|
1005
|
+
id: string;
|
|
1006
|
+
type: string;
|
|
1007
|
+
name?: string;
|
|
1008
|
+
}>;
|
|
1009
|
+
modifiedBlocks: Array<{
|
|
1010
|
+
id: string;
|
|
1011
|
+
type: string;
|
|
1012
|
+
name?: string;
|
|
1013
|
+
changes: Array<{
|
|
1014
|
+
field: string;
|
|
1015
|
+
oldValue: {
|
|
1016
|
+
kind: 'unset';
|
|
1017
|
+
} | {
|
|
1018
|
+
kind: 'redacted';
|
|
1019
|
+
} | {
|
|
1020
|
+
kind: 'value';
|
|
1021
|
+
value: unknown;
|
|
1022
|
+
};
|
|
1023
|
+
newValue: {
|
|
1024
|
+
kind: 'unset';
|
|
1025
|
+
} | {
|
|
1026
|
+
kind: 'redacted';
|
|
1027
|
+
} | {
|
|
1028
|
+
kind: 'value';
|
|
1029
|
+
value: unknown;
|
|
1030
|
+
};
|
|
1031
|
+
scope: 'block' | 'subblock';
|
|
1032
|
+
}>;
|
|
1033
|
+
}>;
|
|
1034
|
+
edgeChanges: {
|
|
1035
|
+
added: number;
|
|
1036
|
+
removed: number;
|
|
1037
|
+
addedDetails: Array<{
|
|
1038
|
+
source: string;
|
|
1039
|
+
target: string;
|
|
1040
|
+
sourceHandle?: string;
|
|
1041
|
+
targetHandle?: string;
|
|
1042
|
+
sourceName: string;
|
|
1043
|
+
targetName: string;
|
|
1044
|
+
}>;
|
|
1045
|
+
removedDetails: Array<{
|
|
1046
|
+
source: string;
|
|
1047
|
+
target: string;
|
|
1048
|
+
sourceHandle?: string;
|
|
1049
|
+
targetHandle?: string;
|
|
1050
|
+
sourceName: string;
|
|
1051
|
+
targetName: string;
|
|
1052
|
+
}>;
|
|
1053
|
+
};
|
|
1054
|
+
loopChanges: {
|
|
1055
|
+
added: number;
|
|
1056
|
+
removed: number;
|
|
1057
|
+
modified: number;
|
|
1058
|
+
};
|
|
1059
|
+
parallelChanges: {
|
|
1060
|
+
added: number;
|
|
1061
|
+
removed: number;
|
|
1062
|
+
modified: number;
|
|
1063
|
+
};
|
|
1064
|
+
containerChanges: Array<{
|
|
1065
|
+
id: string;
|
|
1066
|
+
kind: 'loop' | 'parallel';
|
|
1067
|
+
name?: string;
|
|
1068
|
+
changes: Array<{
|
|
1069
|
+
field: string;
|
|
1070
|
+
oldValue: {
|
|
1071
|
+
kind: 'unset';
|
|
1072
|
+
} | {
|
|
1073
|
+
kind: 'redacted';
|
|
1074
|
+
} | {
|
|
1075
|
+
kind: 'value';
|
|
1076
|
+
value: unknown;
|
|
1077
|
+
};
|
|
1078
|
+
newValue: {
|
|
1079
|
+
kind: 'unset';
|
|
1080
|
+
} | {
|
|
1081
|
+
kind: 'redacted';
|
|
1082
|
+
} | {
|
|
1083
|
+
kind: 'value';
|
|
1084
|
+
value: unknown;
|
|
1085
|
+
};
|
|
1086
|
+
}>;
|
|
1087
|
+
nodesAdded: Array<string>;
|
|
1088
|
+
nodesRemoved: Array<string>;
|
|
1089
|
+
}>;
|
|
1090
|
+
variableChanges: {
|
|
1091
|
+
added: number;
|
|
1092
|
+
removed: number;
|
|
1093
|
+
modified: number;
|
|
1094
|
+
addedNames: Array<string>;
|
|
1095
|
+
removedNames: Array<string>;
|
|
1096
|
+
modifiedNames: Array<string>;
|
|
1097
|
+
};
|
|
1098
|
+
hasChanges: boolean;
|
|
1099
|
+
};
|
|
1100
|
+
};
|
|
1101
|
+
export type CompareWorkflowVersionsResponse = {
|
|
1102
|
+
data: CompareWorkflowVersionsResponseRef0;
|
|
1103
|
+
};
|
|
986
1104
|
/** `POST /api/v2/files/uploads/[uploadId]/complete` */
|
|
987
1105
|
export type CompleteFileUploadParams = {
|
|
988
1106
|
uploadId: string;
|
|
@@ -10722,6 +10840,28 @@ export declare const V2_OPERATIONS: {
|
|
|
10722
10840
|
};
|
|
10723
10841
|
};
|
|
10724
10842
|
};
|
|
10843
|
+
readonly compareWorkflowVersions: {
|
|
10844
|
+
readonly method: 'GET';
|
|
10845
|
+
readonly path: '/api/v2/workflows/[workflowId]/versions/compare';
|
|
10846
|
+
readonly pathParams: readonly ['workflowId'];
|
|
10847
|
+
readonly pathParamDocs: {
|
|
10848
|
+
readonly workflowId: 'Unique workflow identifier.';
|
|
10849
|
+
};
|
|
10850
|
+
readonly responseMode: 'json';
|
|
10851
|
+
readonly summary: 'Compare Workflow Versions';
|
|
10852
|
+
readonly query: {
|
|
10853
|
+
readonly base: {
|
|
10854
|
+
readonly kind: 'integer';
|
|
10855
|
+
readonly required: true;
|
|
10856
|
+
readonly describe: 'Deployment version to compare from.';
|
|
10857
|
+
};
|
|
10858
|
+
readonly target: {
|
|
10859
|
+
readonly kind: 'integer';
|
|
10860
|
+
readonly required: true;
|
|
10861
|
+
readonly describe: 'Deployment version to compare to, in the same workflow.';
|
|
10862
|
+
};
|
|
10863
|
+
};
|
|
10864
|
+
};
|
|
10725
10865
|
readonly completeFileUpload: {
|
|
10726
10866
|
readonly method: 'POST';
|
|
10727
10867
|
readonly path: '/api/v2/files/uploads/[uploadId]/complete';
|
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
|
|
|
@@ -9946,6 +9957,22 @@ var V2_OPERATIONS = {
|
|
|
9946
9957
|
}
|
|
9947
9958
|
}
|
|
9948
9959
|
},
|
|
9960
|
+
compareWorkflowVersions: {
|
|
9961
|
+
method: "GET",
|
|
9962
|
+
path: "/api/v2/workflows/[workflowId]/versions/compare",
|
|
9963
|
+
pathParams: ["workflowId"],
|
|
9964
|
+
pathParamDocs: { workflowId: "Unique workflow identifier." },
|
|
9965
|
+
responseMode: "json",
|
|
9966
|
+
summary: "Compare Workflow Versions",
|
|
9967
|
+
query: {
|
|
9968
|
+
base: { kind: "integer", required: true, describe: "Deployment version to compare from." },
|
|
9969
|
+
target: {
|
|
9970
|
+
kind: "integer",
|
|
9971
|
+
required: true,
|
|
9972
|
+
describe: "Deployment version to compare to, in the same workflow."
|
|
9973
|
+
}
|
|
9974
|
+
}
|
|
9975
|
+
},
|
|
9949
9976
|
completeFileUpload: {
|
|
9950
9977
|
method: "POST",
|
|
9951
9978
|
path: "/api/v2/files/uploads/[uploadId]/complete",
|
|
@@ -16775,13 +16802,13 @@ function openBrowser(url) {
|
|
|
16775
16802
|
function presentAuthentication(source) {
|
|
16776
16803
|
switch (source) {
|
|
16777
16804
|
case "flag":
|
|
16778
|
-
return {
|
|
16805
|
+
return { configured: true, source: "flag" };
|
|
16779
16806
|
case "env":
|
|
16780
|
-
return {
|
|
16807
|
+
return { configured: true, source: "env" };
|
|
16781
16808
|
case "credentials":
|
|
16782
|
-
return {
|
|
16809
|
+
return { configured: true, source: "credentials" };
|
|
16783
16810
|
case "unset":
|
|
16784
|
-
return {
|
|
16811
|
+
return { configured: false, source: "unset" };
|
|
16785
16812
|
case "config":
|
|
16786
16813
|
case "default":
|
|
16787
16814
|
throw new SimApiError(`Unexpected credential source "${source}".`, 0);
|
|
@@ -17187,18 +17214,7 @@ function logoutCommand() {
|
|
|
17187
17214
|
}
|
|
17188
17215
|
});
|
|
17189
17216
|
}
|
|
17190
|
-
|
|
17191
|
-
const operation = V2_OPERATIONS.getMeta;
|
|
17192
|
-
try {
|
|
17193
|
-
const response = await client.request(operation.path, {
|
|
17194
|
-
method: operation.method
|
|
17195
|
-
});
|
|
17196
|
-
return response.data.keyType;
|
|
17197
|
-
} catch {
|
|
17198
|
-
return null;
|
|
17199
|
-
}
|
|
17200
|
-
}
|
|
17201
|
-
var CREDENTIAL_VERDICT_STATUSES = new Set([401, 403, 404]);
|
|
17217
|
+
var PROFILE_REJECTION_STATUSES = new Set([401, 403, 404]);
|
|
17202
17218
|
var WHOAMI_EXIT_CODES = {
|
|
17203
17219
|
verified: 0,
|
|
17204
17220
|
disabled: 0,
|
|
@@ -17211,15 +17227,41 @@ async function verifyProfile(client, profile) {
|
|
|
17211
17227
|
if (!profile.apiKey && !profile.oauth) {
|
|
17212
17228
|
return {
|
|
17213
17229
|
status: "unauthenticated",
|
|
17230
|
+
authenticated: false,
|
|
17214
17231
|
workspace: null,
|
|
17215
17232
|
keyType: null,
|
|
17216
17233
|
detail: `not logged in — run: sim login --profile ${safeOneLine(profile.name)}`
|
|
17217
17234
|
};
|
|
17218
17235
|
}
|
|
17219
|
-
|
|
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
|
+
}
|
|
17220
17261
|
if (!profile.workspaceId) {
|
|
17221
17262
|
return {
|
|
17222
17263
|
status: "no-workspace",
|
|
17264
|
+
authenticated,
|
|
17223
17265
|
workspace: null,
|
|
17224
17266
|
keyType,
|
|
17225
17267
|
detail: `no workspace to check against — run: sim configure --profile ${safeOneLine(profile.name)} --set-workspace <id>`
|
|
@@ -17229,12 +17271,19 @@ async function verifyProfile(client, profile) {
|
|
|
17229
17271
|
try {
|
|
17230
17272
|
const response = await client.request(resolvePath(operation.path, { workspaceId: profile.workspaceId }), { method: operation.method });
|
|
17231
17273
|
const { id, name, memberCount } = response.data;
|
|
17232
|
-
return {
|
|
17274
|
+
return {
|
|
17275
|
+
status: "verified",
|
|
17276
|
+
authenticated: true,
|
|
17277
|
+
workspace: { id, name, memberCount },
|
|
17278
|
+
keyType,
|
|
17279
|
+
detail: null
|
|
17280
|
+
};
|
|
17233
17281
|
} catch (error) {
|
|
17234
17282
|
if (!(error instanceof SimApiError))
|
|
17235
17283
|
throw error;
|
|
17236
17284
|
return {
|
|
17237
|
-
status:
|
|
17285
|
+
status: PROFILE_REJECTION_STATUSES.has(error.status) ? "rejected" : "unreachable",
|
|
17286
|
+
authenticated: error.status === 401 ? false : authenticated,
|
|
17238
17287
|
workspace: null,
|
|
17239
17288
|
keyType,
|
|
17240
17289
|
detail: error.message
|
|
@@ -17266,6 +17315,7 @@ function whoamiCommand() {
|
|
|
17266
17315
|
const authentication = presentAuthentication(sources.credential);
|
|
17267
17316
|
const verification = options.verify ? await verifyProfile(client, profile) : {
|
|
17268
17317
|
status: "disabled",
|
|
17318
|
+
authenticated: authentication.configured ? null : false,
|
|
17269
17319
|
workspace: null,
|
|
17270
17320
|
keyType: null,
|
|
17271
17321
|
detail: "not checked (--no-verify)"
|
|
@@ -17276,7 +17326,7 @@ function whoamiCommand() {
|
|
|
17276
17326
|
["Endpoint", annotate(profile.endpoint, sources.endpoint)],
|
|
17277
17327
|
[
|
|
17278
17328
|
"Login",
|
|
17279
|
-
authentication.
|
|
17329
|
+
authentication.configured ? annotate(profile.oauth ? "OAuth" : "API key", authentication.source) : styles3().yellow("not logged in")
|
|
17280
17330
|
],
|
|
17281
17331
|
[
|
|
17282
17332
|
"Key type",
|
|
@@ -17290,7 +17340,7 @@ function whoamiCommand() {
|
|
|
17290
17340
|
endpoint: profile.endpoint,
|
|
17291
17341
|
workspaceId: profile.workspaceId,
|
|
17292
17342
|
output: profile.output,
|
|
17293
|
-
authenticated:
|
|
17343
|
+
authenticated: verification.authenticated,
|
|
17294
17344
|
sources: {
|
|
17295
17345
|
endpoint: sources.endpoint,
|
|
17296
17346
|
authentication: authentication.source,
|
|
@@ -17788,7 +17838,8 @@ var CLI_CONTRACT = {
|
|
|
17788
17838
|
},
|
|
17789
17839
|
readFileText: {
|
|
17790
17840
|
command: "files read",
|
|
17791
|
-
describe: "Read a file’s text content"
|
|
17841
|
+
describe: "Read a file’s text content as JSON or YAML",
|
|
17842
|
+
document: true
|
|
17792
17843
|
},
|
|
17793
17844
|
createWorkflowMcpServer: {
|
|
17794
17845
|
flags: { workflowIds: { name: "workflow", list: true } }
|
|
@@ -17845,6 +17896,7 @@ var CLI_CONTRACT = {
|
|
|
17845
17896
|
operations: { json: true, describe: WORKFLOW_VARIABLE_OPERATIONS_HELP }
|
|
17846
17897
|
}
|
|
17847
17898
|
},
|
|
17899
|
+
compareWorkflowVersions: { command: "workflows versions compare" },
|
|
17848
17900
|
revertWorkflowVersion: {
|
|
17849
17901
|
confirm: "This overwrites the draft graph with the selected version and cannot be undone."
|
|
17850
17902
|
},
|
|
@@ -17981,7 +18033,14 @@ var CLI_CONTRACT = {
|
|
|
17981
18033
|
variants: [moveResource("knowledge mv", "knowledge base")],
|
|
17982
18034
|
flags: { folderPath: FOLDER_PATH_FLAG }
|
|
17983
18035
|
},
|
|
17984
|
-
createWorkflow: {
|
|
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
|
+
},
|
|
17985
18044
|
updateWorkflow: {
|
|
17986
18045
|
variants: [moveResource("workflows mv", "workflow")],
|
|
17987
18046
|
flags: { folderPath: FOLDER_PATH_FLAG }
|
|
@@ -18597,7 +18656,8 @@ var CLI_CONTRACT = {
|
|
|
18597
18656
|
},
|
|
18598
18657
|
readFileVersionText: {
|
|
18599
18658
|
command: "files versions read",
|
|
18600
|
-
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
|
|
18601
18661
|
},
|
|
18602
18662
|
revertFileVersion: {
|
|
18603
18663
|
command: "files versions revert",
|
|
@@ -22188,14 +22248,6 @@ function attachTableImport(tables) {
|
|
|
22188
22248
|
});
|
|
22189
22249
|
}
|
|
22190
22250
|
|
|
22191
|
-
// ../utils/src/object.ts
|
|
22192
|
-
function isRecordLike(value) {
|
|
22193
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22194
|
-
}
|
|
22195
|
-
function toRecordOrNull(value) {
|
|
22196
|
-
return isRecordLike(value) ? value : null;
|
|
22197
|
-
}
|
|
22198
|
-
|
|
22199
22251
|
// src/commands/protocol/workflow-run-follow.ts
|
|
22200
22252
|
var AGENT_STREAM_PROTOCOL_HEADER = "x-sim-stream-protocol";
|
|
22201
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
|
|
|
@@ -9995,6 +10006,22 @@ var V2_OPERATIONS = {
|
|
|
9995
10006
|
}
|
|
9996
10007
|
}
|
|
9997
10008
|
},
|
|
10009
|
+
compareWorkflowVersions: {
|
|
10010
|
+
method: "GET",
|
|
10011
|
+
path: "/api/v2/workflows/[workflowId]/versions/compare",
|
|
10012
|
+
pathParams: ["workflowId"],
|
|
10013
|
+
pathParamDocs: { workflowId: "Unique workflow identifier." },
|
|
10014
|
+
responseMode: "json",
|
|
10015
|
+
summary: "Compare Workflow Versions",
|
|
10016
|
+
query: {
|
|
10017
|
+
base: { kind: "integer", required: true, describe: "Deployment version to compare from." },
|
|
10018
|
+
target: {
|
|
10019
|
+
kind: "integer",
|
|
10020
|
+
required: true,
|
|
10021
|
+
describe: "Deployment version to compare to, in the same workflow."
|
|
10022
|
+
}
|
|
10023
|
+
}
|
|
10024
|
+
},
|
|
9998
10025
|
completeFileUpload: {
|
|
9999
10026
|
method: "POST",
|
|
10000
10027
|
path: "/api/v2/files/uploads/[uploadId]/complete",
|
|
@@ -16824,13 +16851,13 @@ function openBrowser(url) {
|
|
|
16824
16851
|
function presentAuthentication(source) {
|
|
16825
16852
|
switch (source) {
|
|
16826
16853
|
case "flag":
|
|
16827
|
-
return {
|
|
16854
|
+
return { configured: true, source: "flag" };
|
|
16828
16855
|
case "env":
|
|
16829
|
-
return {
|
|
16856
|
+
return { configured: true, source: "env" };
|
|
16830
16857
|
case "credentials":
|
|
16831
|
-
return {
|
|
16858
|
+
return { configured: true, source: "credentials" };
|
|
16832
16859
|
case "unset":
|
|
16833
|
-
return {
|
|
16860
|
+
return { configured: false, source: "unset" };
|
|
16834
16861
|
case "config":
|
|
16835
16862
|
case "default":
|
|
16836
16863
|
throw new SimApiError(`Unexpected credential source "${source}".`, 0);
|
|
@@ -17236,18 +17263,7 @@ function logoutCommand() {
|
|
|
17236
17263
|
}
|
|
17237
17264
|
});
|
|
17238
17265
|
}
|
|
17239
|
-
|
|
17240
|
-
const operation = V2_OPERATIONS.getMeta;
|
|
17241
|
-
try {
|
|
17242
|
-
const response = await client.request(operation.path, {
|
|
17243
|
-
method: operation.method
|
|
17244
|
-
});
|
|
17245
|
-
return response.data.keyType;
|
|
17246
|
-
} catch {
|
|
17247
|
-
return null;
|
|
17248
|
-
}
|
|
17249
|
-
}
|
|
17250
|
-
var CREDENTIAL_VERDICT_STATUSES = new Set([401, 403, 404]);
|
|
17266
|
+
var PROFILE_REJECTION_STATUSES = new Set([401, 403, 404]);
|
|
17251
17267
|
var WHOAMI_EXIT_CODES = {
|
|
17252
17268
|
verified: 0,
|
|
17253
17269
|
disabled: 0,
|
|
@@ -17260,15 +17276,41 @@ async function verifyProfile(client, profile) {
|
|
|
17260
17276
|
if (!profile.apiKey && !profile.oauth) {
|
|
17261
17277
|
return {
|
|
17262
17278
|
status: "unauthenticated",
|
|
17279
|
+
authenticated: false,
|
|
17263
17280
|
workspace: null,
|
|
17264
17281
|
keyType: null,
|
|
17265
17282
|
detail: `not logged in — run: sim login --profile ${safeOneLine(profile.name)}`
|
|
17266
17283
|
};
|
|
17267
17284
|
}
|
|
17268
|
-
|
|
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
|
+
}
|
|
17269
17310
|
if (!profile.workspaceId) {
|
|
17270
17311
|
return {
|
|
17271
17312
|
status: "no-workspace",
|
|
17313
|
+
authenticated,
|
|
17272
17314
|
workspace: null,
|
|
17273
17315
|
keyType,
|
|
17274
17316
|
detail: `no workspace to check against — run: sim configure --profile ${safeOneLine(profile.name)} --set-workspace <id>`
|
|
@@ -17278,12 +17320,19 @@ async function verifyProfile(client, profile) {
|
|
|
17278
17320
|
try {
|
|
17279
17321
|
const response = await client.request(resolvePath(operation.path, { workspaceId: profile.workspaceId }), { method: operation.method });
|
|
17280
17322
|
const { id, name, memberCount } = response.data;
|
|
17281
|
-
return {
|
|
17323
|
+
return {
|
|
17324
|
+
status: "verified",
|
|
17325
|
+
authenticated: true,
|
|
17326
|
+
workspace: { id, name, memberCount },
|
|
17327
|
+
keyType,
|
|
17328
|
+
detail: null
|
|
17329
|
+
};
|
|
17282
17330
|
} catch (error) {
|
|
17283
17331
|
if (!(error instanceof SimApiError))
|
|
17284
17332
|
throw error;
|
|
17285
17333
|
return {
|
|
17286
|
-
status:
|
|
17334
|
+
status: PROFILE_REJECTION_STATUSES.has(error.status) ? "rejected" : "unreachable",
|
|
17335
|
+
authenticated: error.status === 401 ? false : authenticated,
|
|
17287
17336
|
workspace: null,
|
|
17288
17337
|
keyType,
|
|
17289
17338
|
detail: error.message
|
|
@@ -17315,6 +17364,7 @@ function whoamiCommand() {
|
|
|
17315
17364
|
const authentication = presentAuthentication(sources.credential);
|
|
17316
17365
|
const verification = options.verify ? await verifyProfile(client, profile) : {
|
|
17317
17366
|
status: "disabled",
|
|
17367
|
+
authenticated: authentication.configured ? null : false,
|
|
17318
17368
|
workspace: null,
|
|
17319
17369
|
keyType: null,
|
|
17320
17370
|
detail: "not checked (--no-verify)"
|
|
@@ -17325,7 +17375,7 @@ function whoamiCommand() {
|
|
|
17325
17375
|
["Endpoint", annotate(profile.endpoint, sources.endpoint)],
|
|
17326
17376
|
[
|
|
17327
17377
|
"Login",
|
|
17328
|
-
authentication.
|
|
17378
|
+
authentication.configured ? annotate(profile.oauth ? "OAuth" : "API key", authentication.source) : styles3().yellow("not logged in")
|
|
17329
17379
|
],
|
|
17330
17380
|
[
|
|
17331
17381
|
"Key type",
|
|
@@ -17339,7 +17389,7 @@ function whoamiCommand() {
|
|
|
17339
17389
|
endpoint: profile.endpoint,
|
|
17340
17390
|
workspaceId: profile.workspaceId,
|
|
17341
17391
|
output: profile.output,
|
|
17342
|
-
authenticated:
|
|
17392
|
+
authenticated: verification.authenticated,
|
|
17343
17393
|
sources: {
|
|
17344
17394
|
endpoint: sources.endpoint,
|
|
17345
17395
|
authentication: authentication.source,
|
|
@@ -17837,7 +17887,8 @@ var CLI_CONTRACT = {
|
|
|
17837
17887
|
},
|
|
17838
17888
|
readFileText: {
|
|
17839
17889
|
command: "files read",
|
|
17840
|
-
describe: "Read a file’s text content"
|
|
17890
|
+
describe: "Read a file’s text content as JSON or YAML",
|
|
17891
|
+
document: true
|
|
17841
17892
|
},
|
|
17842
17893
|
createWorkflowMcpServer: {
|
|
17843
17894
|
flags: { workflowIds: { name: "workflow", list: true } }
|
|
@@ -17894,6 +17945,7 @@ var CLI_CONTRACT = {
|
|
|
17894
17945
|
operations: { json: true, describe: WORKFLOW_VARIABLE_OPERATIONS_HELP }
|
|
17895
17946
|
}
|
|
17896
17947
|
},
|
|
17948
|
+
compareWorkflowVersions: { command: "workflows versions compare" },
|
|
17897
17949
|
revertWorkflowVersion: {
|
|
17898
17950
|
confirm: "This overwrites the draft graph with the selected version and cannot be undone."
|
|
17899
17951
|
},
|
|
@@ -18030,7 +18082,14 @@ var CLI_CONTRACT = {
|
|
|
18030
18082
|
variants: [moveResource("knowledge mv", "knowledge base")],
|
|
18031
18083
|
flags: { folderPath: FOLDER_PATH_FLAG }
|
|
18032
18084
|
},
|
|
18033
|
-
createWorkflow: {
|
|
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
|
+
},
|
|
18034
18093
|
updateWorkflow: {
|
|
18035
18094
|
variants: [moveResource("workflows mv", "workflow")],
|
|
18036
18095
|
flags: { folderPath: FOLDER_PATH_FLAG }
|
|
@@ -18646,7 +18705,8 @@ var CLI_CONTRACT = {
|
|
|
18646
18705
|
},
|
|
18647
18706
|
readFileVersionText: {
|
|
18648
18707
|
command: "files versions read",
|
|
18649
|
-
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
|
|
18650
18710
|
},
|
|
18651
18711
|
revertFileVersion: {
|
|
18652
18712
|
command: "files versions revert",
|
|
@@ -22237,14 +22297,6 @@ function attachTableImport(tables) {
|
|
|
22237
22297
|
});
|
|
22238
22298
|
}
|
|
22239
22299
|
|
|
22240
|
-
// ../utils/src/object.ts
|
|
22241
|
-
function isRecordLike(value) {
|
|
22242
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22243
|
-
}
|
|
22244
|
-
function toRecordOrNull(value) {
|
|
22245
|
-
return isRecordLike(value) ? value : null;
|
|
22246
|
-
}
|
|
22247
|
-
|
|
22248
22300
|
// src/commands/protocol/workflow-run-follow.ts
|
|
22249
22301
|
var AGENT_STREAM_PROTOCOL_HEADER = "x-sim-stream-protocol";
|
|
22250
22302
|
var AGENT_STREAM_PROTOCOL_V1 = "agent-events-v1";
|