@integrity-labs/agt-cli 0.27.37 → 0.27.39
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/bin/agt.js +7 -3
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-J77QXLYC.js → chunk-EZMAP5WM.js} +1 -1
- package/dist/lib/manager-worker.js +36 -25
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/index.js +12 -3
- package/package.json +1 -1
- /package/dist/{chunk-J77QXLYC.js.map → chunk-EZMAP5WM.js.map} +0 -0
package/dist/mcp/index.js
CHANGED
|
@@ -21076,6 +21076,7 @@ var DeliveryTargetSchema = external_exports.union([
|
|
|
21076
21076
|
]);
|
|
21077
21077
|
var AGT_HOST = process.env.AGT_HOST;
|
|
21078
21078
|
var AGT_API_KEY = process.env.AGT_API_KEY;
|
|
21079
|
+
var AGT_AGENT_SESSION_TOKEN = process.env.AGT_AGENT_SESSION_TOKEN;
|
|
21079
21080
|
var AGT_AGENT_ID = process.env.AGT_AGENT_ID;
|
|
21080
21081
|
var AGT_AGENT_CODE_NAME = process.env.AGT_AGENT_CODE_NAME;
|
|
21081
21082
|
var AGT_APP_URL = (process.env.AGT_APP_URL?.trim() || "https://app.augmented.team").replace(/\/+$/, "");
|
|
@@ -21086,9 +21087,9 @@ function readRunId() {
|
|
|
21086
21087
|
}
|
|
21087
21088
|
var AGT_RUN_ID = readRunId();
|
|
21088
21089
|
var AGT_TOKEN = process.env.AGT_TOKEN ?? "";
|
|
21089
|
-
if (!AGT_HOST || !AGT_AGENT_ID || !AGT_TOKEN && !AGT_API_KEY) {
|
|
21090
|
+
if (!AGT_HOST || !AGT_AGENT_ID || !AGT_TOKEN && !AGT_API_KEY && !AGT_AGENT_SESSION_TOKEN) {
|
|
21090
21091
|
console.error(
|
|
21091
|
-
"augmented-mcp: Missing required env vars. Need AGT_HOST, AGT_AGENT_ID, and AGT_TOKEN or AGT_API_KEY"
|
|
21092
|
+
"augmented-mcp: Missing required env vars. Need AGT_HOST, AGT_AGENT_ID, and one of AGT_AGENT_SESSION_TOKEN, AGT_TOKEN, or AGT_API_KEY"
|
|
21092
21093
|
);
|
|
21093
21094
|
process.exit(1);
|
|
21094
21095
|
}
|
|
@@ -21110,6 +21111,9 @@ async function refreshToken() {
|
|
|
21110
21111
|
return AGT_TOKEN;
|
|
21111
21112
|
}
|
|
21112
21113
|
async function getToken() {
|
|
21114
|
+
if (AGT_AGENT_SESSION_TOKEN) {
|
|
21115
|
+
return AGT_AGENT_SESSION_TOKEN;
|
|
21116
|
+
}
|
|
21113
21117
|
if (AGT_API_KEY && (!AGT_TOKEN || Date.now() > tokenExpiresAt - 5 * 6e4)) {
|
|
21114
21118
|
if (!exchangeInFlight) {
|
|
21115
21119
|
exchangeInFlight = refreshToken().finally(() => {
|
|
@@ -21141,13 +21145,18 @@ async function apiPost(path, body, retried = false, timeoutMs = 15e3) {
|
|
|
21141
21145
|
body: JSON.stringify(body),
|
|
21142
21146
|
signal: controller.signal
|
|
21143
21147
|
});
|
|
21144
|
-
if (res.status === 401 && AGT_API_KEY && !retried) {
|
|
21148
|
+
if (res.status === 401 && AGT_API_KEY && !AGT_AGENT_SESSION_TOKEN && !retried) {
|
|
21145
21149
|
clearTimeout(timeout);
|
|
21146
21150
|
tokenExpiresAt = 0;
|
|
21147
21151
|
return apiPost(path, body, true, timeoutMs);
|
|
21148
21152
|
}
|
|
21149
21153
|
if (!res.ok) {
|
|
21150
21154
|
const text = await res.text().catch(() => res.statusText);
|
|
21155
|
+
if (res.status === 401 && AGT_AGENT_SESSION_TOKEN) {
|
|
21156
|
+
throw new Error(
|
|
21157
|
+
`API ${path} returned 401: agent-session rejected (expired or revoked). Re-run \`agt impersonate connect\` to mint a fresh session. (${text})`
|
|
21158
|
+
);
|
|
21159
|
+
}
|
|
21151
21160
|
throw new Error(`API ${path} returned ${res.status}: ${text}`);
|
|
21152
21161
|
}
|
|
21153
21162
|
return await res.json();
|
package/package.json
CHANGED
|
File without changes
|