sim 2.0.0-preview.14.1 → 2.0.0-preview.16.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 +15 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6142,6 +6142,8 @@ function sleep(ms) {
|
|
|
6142
6142
|
var PAIRING_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
|
|
6143
6143
|
var POLL_INTERVAL_MS = 2000;
|
|
6144
6144
|
var POLL_TIMEOUT_MS = 15 * 60 * 1000;
|
|
6145
|
+
var APPROVAL_PATH = "/cli/auth";
|
|
6146
|
+
var POLL_PATH = "/api/cli/auth/poll";
|
|
6145
6147
|
var RETRYABLE_POLL_STATUSES = new Set([409, 429, 500, 502, 503, 504]);
|
|
6146
6148
|
function token() {
|
|
6147
6149
|
return randomBytes(32).toString("base64url");
|
|
@@ -6160,16 +6162,14 @@ function createAuthRequest() {
|
|
|
6160
6162
|
};
|
|
6161
6163
|
}
|
|
6162
6164
|
function buildApprovalUrl(endpoint, auth, scope, workspaceId) {
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
return url.toString();
|
|
6165
|
+
return buildUrl(endpoint, APPROVAL_PATH, {
|
|
6166
|
+
request: auth.request,
|
|
6167
|
+
challenge: auth.challenge,
|
|
6168
|
+
pairing: auth.pairing,
|
|
6169
|
+
scope,
|
|
6170
|
+
workspace: workspaceId
|
|
6171
|
+
});
|
|
6171
6172
|
}
|
|
6172
|
-
var POLL_PATH = "/api/cli/auth/poll";
|
|
6173
6173
|
function toRedirectError(endpoint, response) {
|
|
6174
6174
|
const location = response.headers.get("location")?.trim();
|
|
6175
6175
|
let target = null;
|
|
@@ -6194,7 +6194,7 @@ async function pollForKey(endpoint, auth, signal) {
|
|
|
6194
6194
|
throw new SimApiError("Login cancelled.", 0);
|
|
6195
6195
|
let response = null;
|
|
6196
6196
|
try {
|
|
6197
|
-
response = await fetch(
|
|
6197
|
+
response = await fetch(buildUrl(endpoint, POLL_PATH), {
|
|
6198
6198
|
method: "POST",
|
|
6199
6199
|
headers: {
|
|
6200
6200
|
"content-type": "application/json",
|
|
@@ -9818,7 +9818,7 @@ var CLI_CONTRACT = {
|
|
|
9818
9818
|
},
|
|
9819
9819
|
itemsPath: "results",
|
|
9820
9820
|
columns: [
|
|
9821
|
-
{ header: "score", path: "similarity" },
|
|
9821
|
+
{ header: "score", path: "similarity", format: "score" },
|
|
9822
9822
|
{ header: "document", path: "documentName" },
|
|
9823
9823
|
{ header: "chunk", path: "chunkIndex" },
|
|
9824
9824
|
{ header: "content" }
|
|
@@ -10809,6 +10809,8 @@ function renderCell(value, format, options = {}) {
|
|
|
10809
10809
|
return bool2(value);
|
|
10810
10810
|
case "cost":
|
|
10811
10811
|
return typeof value === "number" ? `$${value.toFixed(4)}` : text(null);
|
|
10812
|
+
case "score":
|
|
10813
|
+
return typeof value === "number" ? value.toFixed(4) : text(null);
|
|
10812
10814
|
case "count":
|
|
10813
10815
|
return Array.isArray(value) ? String(value.length) : text(null);
|
|
10814
10816
|
case "folder-path":
|
|
@@ -12185,7 +12187,8 @@ function buildGeneratedCommands() {
|
|
|
12185
12187
|
var PROGRAM_DESCRIPTION = "Talk to the Sim API from your terminal";
|
|
12186
12188
|
var HELP_EPILOGUE = `
|
|
12187
12189
|
Profiles work like the AWS CLI: settings live in ~/.sim/config, keys in
|
|
12188
|
-
~/.sim/credentials (0600)
|
|
12190
|
+
~/.sim/credentials (0600), or under SIM_CONFIG_DIR when it is set. Select one
|
|
12191
|
+
with -P, --profile, or SIM_PROFILE.
|
|
12189
12192
|
|
|
12190
12193
|
Examples:
|
|
12191
12194
|
$ sim login Authorize the default profile
|