@alan-ai-hq/agent-manager 0.1.104 → 0.1.105
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.cjs +79 -34
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -15504,7 +15504,7 @@ function describeError(error61) {
|
|
|
15504
15504
|
}
|
|
15505
15505
|
|
|
15506
15506
|
// src/version.ts
|
|
15507
|
-
var AGENT_VERSION = "0.1.
|
|
15507
|
+
var AGENT_VERSION = "0.1.105";
|
|
15508
15508
|
|
|
15509
15509
|
// src/daemon-worktree.ts
|
|
15510
15510
|
var import_node_child_process3 = require("child_process");
|
|
@@ -35724,6 +35724,8 @@ var AGENT_CONFIG_KEYS = /* @__PURE__ */ new Map([
|
|
|
35724
35724
|
["teamId", "string"],
|
|
35725
35725
|
["runtimeId", "string"],
|
|
35726
35726
|
["runtimeToken", "string"],
|
|
35727
|
+
["runtimeRenewalToken", "string"],
|
|
35728
|
+
["runtimeTokenExpiresAt", "string"],
|
|
35727
35729
|
["localApiPort", "number"],
|
|
35728
35730
|
["localApiToken", "string"],
|
|
35729
35731
|
["displayName", "string"]
|
|
@@ -36556,7 +36558,7 @@ function isBrowserRecordingToolName(toolName) {
|
|
|
36556
36558
|
}
|
|
36557
36559
|
|
|
36558
36560
|
// ../shared/dist/agent/mcp-config.js
|
|
36559
|
-
var
|
|
36561
|
+
var ALAN_MCP_AUTHORIZATION_ENV = "ALAN_MCP_AUTHORIZATION";
|
|
36560
36562
|
var ALAN_RUN_ID_ENV = "ALAN_RUN_ID";
|
|
36561
36563
|
var MCP_CONFIG_KEY = /^[A-Za-z0-9_-]+$/;
|
|
36562
36564
|
function isExternalMcpServerName(name) {
|
|
@@ -40806,8 +40808,12 @@ function requiredHeader(registration, name) {
|
|
|
40806
40808
|
if (!value2) throw new Error(`Alan MCP ${name} header is missing`);
|
|
40807
40809
|
return value2;
|
|
40808
40810
|
}
|
|
40809
|
-
function
|
|
40810
|
-
|
|
40811
|
+
function requireManagedAuthorization(registration) {
|
|
40812
|
+
const authorization = requiredHeader(registration, "authorization");
|
|
40813
|
+
if (!authorization.startsWith("Bearer ") || !authorization.slice(7).trim()) {
|
|
40814
|
+
throw new Error("Alan MCP authorization header must contain a bearer token");
|
|
40815
|
+
}
|
|
40816
|
+
return authorization;
|
|
40811
40817
|
}
|
|
40812
40818
|
function requireManagedRunId(registration) {
|
|
40813
40819
|
return requiredHeader(registration, "x-alan-run-id");
|
|
@@ -41288,7 +41294,7 @@ function buildClaudeManagedMcpArgs(registration, options = {}) {
|
|
|
41288
41294
|
type: "http",
|
|
41289
41295
|
url: registration.url,
|
|
41290
41296
|
headers: {
|
|
41291
|
-
|
|
41297
|
+
Authorization: `\${${ALAN_MCP_AUTHORIZATION_ENV}}`,
|
|
41292
41298
|
"x-alan-run-id": `\${${ALAN_RUN_ID_ENV}}`
|
|
41293
41299
|
}
|
|
41294
41300
|
};
|
|
@@ -41310,7 +41316,7 @@ function createClaudeCliBackend(command = "claude", defaultArgs = []) {
|
|
|
41310
41316
|
env: {
|
|
41311
41317
|
...context.env,
|
|
41312
41318
|
...externalMcp?.env,
|
|
41313
|
-
[
|
|
41319
|
+
[ALAN_MCP_AUTHORIZATION_ENV]: requireManagedAuthorization(managedRegistration),
|
|
41314
41320
|
[ALAN_RUN_ID_ENV]: requireManagedRunId(managedRegistration)
|
|
41315
41321
|
}
|
|
41316
41322
|
} : context;
|
|
@@ -42566,7 +42572,7 @@ function buildCodexManagedMcpArgs(registration, options = {}) {
|
|
|
42566
42572
|
"-c",
|
|
42567
42573
|
`mcp_servers.alan.url=${JSON.stringify(registration.url)}`,
|
|
42568
42574
|
"-c",
|
|
42569
|
-
`mcp_servers.alan.env_http_headers.
|
|
42575
|
+
`mcp_servers.alan.env_http_headers.Authorization=${JSON.stringify(ALAN_MCP_AUTHORIZATION_ENV)}`,
|
|
42570
42576
|
"-c",
|
|
42571
42577
|
`mcp_servers.alan.env_http_headers.x-alan-run-id=${JSON.stringify(ALAN_RUN_ID_ENV)}`,
|
|
42572
42578
|
"-c",
|
|
@@ -42613,7 +42619,7 @@ function createCodexRuntimeBackend(command = "codex", defaultArgs = []) {
|
|
|
42613
42619
|
env: {
|
|
42614
42620
|
...context.env,
|
|
42615
42621
|
...externalMcp?.env,
|
|
42616
|
-
[
|
|
42622
|
+
[ALAN_MCP_AUTHORIZATION_ENV]: requireManagedAuthorization(managedRegistration),
|
|
42617
42623
|
[ALAN_RUN_ID_ENV]: requireManagedRunId(managedRegistration)
|
|
42618
42624
|
}
|
|
42619
42625
|
} : context;
|
|
@@ -43579,7 +43585,7 @@ function createCursorAgentCliBackend(command = "cursor-agent", defaultArgs = [])
|
|
|
43579
43585
|
...context,
|
|
43580
43586
|
env: {
|
|
43581
43587
|
...context.env,
|
|
43582
|
-
[
|
|
43588
|
+
[ALAN_MCP_AUTHORIZATION_ENV]: requireManagedAuthorization(context.config.alanMcp),
|
|
43583
43589
|
[ALAN_RUN_ID_ENV]: requireManagedRunId(context.config.alanMcp)
|
|
43584
43590
|
}
|
|
43585
43591
|
} : context;
|
|
@@ -44735,7 +44741,7 @@ function buildKimiMcpConfig(registration, externalServers = {}) {
|
|
|
44735
44741
|
mcpServers[managedMcpServerName()] = {
|
|
44736
44742
|
url: registration.url,
|
|
44737
44743
|
headers: {
|
|
44738
|
-
|
|
44744
|
+
Authorization: requireManagedAuthorization(registration),
|
|
44739
44745
|
"x-alan-run-id": requireManagedRunId(registration)
|
|
44740
44746
|
}
|
|
44741
44747
|
};
|
|
@@ -44827,7 +44833,7 @@ function buildManagedOpenCodeConfigContent(existing, registration) {
|
|
|
44827
44833
|
type: "remote",
|
|
44828
44834
|
url: registration.url,
|
|
44829
44835
|
headers: {
|
|
44830
|
-
|
|
44836
|
+
Authorization: `{env:${ALAN_MCP_AUTHORIZATION_ENV}}`,
|
|
44831
44837
|
"x-alan-run-id": `{env:${ALAN_RUN_ID_ENV}}`
|
|
44832
44838
|
},
|
|
44833
44839
|
oauth: false,
|
|
@@ -44843,7 +44849,7 @@ function withManagedOpenCodeMcp(context) {
|
|
|
44843
44849
|
...context,
|
|
44844
44850
|
env: {
|
|
44845
44851
|
...context.env,
|
|
44846
|
-
[
|
|
44852
|
+
[ALAN_MCP_AUTHORIZATION_ENV]: requireManagedAuthorization(registration),
|
|
44847
44853
|
[ALAN_RUN_ID_ENV]: requireManagedRunId(registration),
|
|
44848
44854
|
OPENCODE_CONFIG_CONTENT: buildManagedOpenCodeConfigContent(
|
|
44849
44855
|
context.env.OPENCODE_CONFIG_CONTENT,
|
|
@@ -55520,7 +55526,7 @@ var CoreAgent = class _CoreAgent extends BaseMachineAgent {
|
|
|
55520
55526
|
childProcess = null;
|
|
55521
55527
|
_aborted = false;
|
|
55522
55528
|
runId;
|
|
55523
|
-
|
|
55529
|
+
runtimeToken;
|
|
55524
55530
|
providerApiKey;
|
|
55525
55531
|
onProviderSpawned;
|
|
55526
55532
|
cliEnvOverrides;
|
|
@@ -55529,7 +55535,7 @@ var CoreAgent = class _CoreAgent extends BaseMachineAgent {
|
|
|
55529
55535
|
constructor(presenter, runtime) {
|
|
55530
55536
|
super(presenter, runtime);
|
|
55531
55537
|
this.runId = runtime.runId?.trim() || void 0;
|
|
55532
|
-
this.
|
|
55538
|
+
this.runtimeToken = runtime.runtimeToken?.trim() || void 0;
|
|
55533
55539
|
this.providerApiKey = runtime.providerApiKey;
|
|
55534
55540
|
this.onProviderSpawned = runtime.onProviderSpawned;
|
|
55535
55541
|
this.cliEnvOverrides = runtime.cliEnvOverrides ?? {};
|
|
@@ -55667,8 +55673,8 @@ var CoreAgent = class _CoreAgent extends BaseMachineAgent {
|
|
|
55667
55673
|
augmented.ALAN_MANAGED_RUN = "1";
|
|
55668
55674
|
if (this.runId) augmented.ALAN_RUN_ID = this.runId;
|
|
55669
55675
|
else delete augmented.ALAN_RUN_ID;
|
|
55670
|
-
if (this.
|
|
55671
|
-
else delete augmented.
|
|
55676
|
+
if (this.runtimeToken) augmented.ALAN_MCP_AUTHORIZATION = `Bearer ${this.runtimeToken}`;
|
|
55677
|
+
else delete augmented.ALAN_MCP_AUTHORIZATION;
|
|
55672
55678
|
const backendKind = this.runtime.backendKind ?? "";
|
|
55673
55679
|
const providerApiKey = this.providerApiKey ?? "";
|
|
55674
55680
|
if (backendKind === "antigravity_cli" && providerApiKey.trim()) {
|
|
@@ -55843,14 +55849,14 @@ ${meta3.description}`);
|
|
|
55843
55849
|
|
|
55844
55850
|
// src/managed-mcp.ts
|
|
55845
55851
|
function buildManagedAlanMcp(input2) {
|
|
55846
|
-
const
|
|
55852
|
+
const runtimeToken = input2.runtimeToken.trim();
|
|
55847
55853
|
const runId = input2.runId.trim();
|
|
55848
|
-
if (!
|
|
55854
|
+
if (!runtimeToken) throw new Error("Alan runtime token is missing");
|
|
55849
55855
|
if (!runId) throw new Error("Alan run ID is missing");
|
|
55850
55856
|
return {
|
|
55851
55857
|
url: new URL("/mcp", input2.apiUrl).toString(),
|
|
55852
55858
|
headers: {
|
|
55853
|
-
|
|
55859
|
+
Authorization: `Bearer ${runtimeToken}`,
|
|
55854
55860
|
"x-alan-run-id": runId
|
|
55855
55861
|
}
|
|
55856
55862
|
};
|
|
@@ -56379,6 +56385,7 @@ async function handleAgentExecute(ctx, payload) {
|
|
|
56379
56385
|
runtimeId,
|
|
56380
56386
|
runtimeSkillManager,
|
|
56381
56387
|
getRuntimeToken,
|
|
56388
|
+
ensureRuntimeTokenForLaunch,
|
|
56382
56389
|
eventOutbox,
|
|
56383
56390
|
daemonSessionId,
|
|
56384
56391
|
daemonEpoch,
|
|
@@ -56396,12 +56403,22 @@ async function handleAgentExecute(ctx, payload) {
|
|
|
56396
56403
|
maintenanceReason,
|
|
56397
56404
|
verifyActiveWorkspaceLease
|
|
56398
56405
|
} = ctx;
|
|
56399
|
-
const runtimeToken = getRuntimeToken();
|
|
56400
56406
|
const heartbeatSeq = getHeartbeatSeq();
|
|
56401
56407
|
const disconnectedSinceMs = getDisconnectedSinceMs();
|
|
56402
56408
|
if (!payload?.runId || !payload.conversationId || typeof payload.content !== "string") {
|
|
56403
56409
|
return;
|
|
56404
56410
|
}
|
|
56411
|
+
const tokenReadiness = ensureRuntimeTokenForLaunch();
|
|
56412
|
+
const tokenReady = typeof tokenReadiness === "boolean" ? tokenReadiness : await tokenReadiness;
|
|
56413
|
+
if (!tokenReady) {
|
|
56414
|
+
socket.emit("agent.rejected", {
|
|
56415
|
+
runId: payload.runId,
|
|
56416
|
+
message: "This Computer could not renew its expired Alan credential. Run setup again.",
|
|
56417
|
+
code: "runtime_token_expired"
|
|
56418
|
+
});
|
|
56419
|
+
return;
|
|
56420
|
+
}
|
|
56421
|
+
const runtimeToken = getRuntimeToken();
|
|
56405
56422
|
const isTaskWorkspacePayload = Boolean(
|
|
56406
56423
|
payload.worktreeInfo?.worktreePath || payload.worktreeInfo?.allWorktrees?.length
|
|
56407
56424
|
);
|
|
@@ -56641,7 +56658,7 @@ async function handleAgentExecute(ctx, payload) {
|
|
|
56641
56658
|
};
|
|
56642
56659
|
const alanMcp = buildManagedAlanMcp({
|
|
56643
56660
|
apiUrl,
|
|
56644
|
-
|
|
56661
|
+
runtimeToken,
|
|
56645
56662
|
runId: payload.runId
|
|
56646
56663
|
});
|
|
56647
56664
|
if (!socket.connected) {
|
|
@@ -56811,7 +56828,7 @@ async function handleAgentExecute(ctx, payload) {
|
|
|
56811
56828
|
backendKind,
|
|
56812
56829
|
runtimeCommand,
|
|
56813
56830
|
runId: payload.runId,
|
|
56814
|
-
|
|
56831
|
+
runtimeToken,
|
|
56815
56832
|
providerApiKey: payload.providerApiKey,
|
|
56816
56833
|
onProviderSpawned: (pid) => {
|
|
56817
56834
|
const entry = activeAgents.get(payload.runId);
|
|
@@ -58201,7 +58218,7 @@ async function exchangeRuntimeSetupGrant(input2, setupSignal) {
|
|
|
58201
58218
|
throw new Error(`runtime registration failed: ${response.status} ${responseBody}`);
|
|
58202
58219
|
}
|
|
58203
58220
|
const body = await response.json();
|
|
58204
|
-
if (typeof body.runtime?.id !== "string" || typeof body.runtime.credentialGeneration !== "number" || typeof body.runtimeToken !== "string" || !body.runtimeToken.startsWith("alan_runtime_") || typeof body.runtimeRenewalToken !== "string" || !body.runtimeRenewalToken.startsWith("alan_runtime_renew_")) {
|
|
58221
|
+
if (typeof body.runtime?.id !== "string" || typeof body.runtime.credentialGeneration !== "number" || typeof body.runtimeToken !== "string" || !body.runtimeToken.startsWith("alan_runtime_") || typeof body.runtimeRenewalToken !== "string" || !body.runtimeRenewalToken.startsWith("alan_runtime_renew_") || body.runtimeTokenExpiresAt !== void 0 && (typeof body.runtimeTokenExpiresAt !== "string" || !Number.isFinite(Date.parse(body.runtimeTokenExpiresAt)))) {
|
|
58205
58222
|
throw new Error("runtime registration returned an invalid credential bundle");
|
|
58206
58223
|
}
|
|
58207
58224
|
return {
|
|
@@ -58209,7 +58226,8 @@ async function exchangeRuntimeSetupGrant(input2, setupSignal) {
|
|
|
58209
58226
|
displayName: typeof body.runtime.displayName === "string" ? body.runtime.displayName : input2.displayName,
|
|
58210
58227
|
credentialGeneration: body.runtime.credentialGeneration,
|
|
58211
58228
|
runtimeToken: body.runtimeToken,
|
|
58212
|
-
runtimeRenewalToken: body.runtimeRenewalToken
|
|
58229
|
+
runtimeRenewalToken: body.runtimeRenewalToken,
|
|
58230
|
+
runtimeTokenExpiresAt: typeof body.runtimeTokenExpiresAt === "string" ? body.runtimeTokenExpiresAt : void 0
|
|
58213
58231
|
};
|
|
58214
58232
|
}
|
|
58215
58233
|
async function handoffRuntimeSetupGrant(input2) {
|
|
@@ -61479,6 +61497,12 @@ var SuspensionDetector = class {
|
|
|
61479
61497
|
};
|
|
61480
61498
|
|
|
61481
61499
|
// src/daemon-start.ts
|
|
61500
|
+
var RUNTIME_TOKEN_RENEWAL_WINDOW_MS = 24 * 60 * 60 * 1e3;
|
|
61501
|
+
function runtimeTokenNeedsRenewal(expiresAt, nowMs = Date.now()) {
|
|
61502
|
+
if (!expiresAt) return true;
|
|
61503
|
+
const expiresAtMs = Date.parse(expiresAt);
|
|
61504
|
+
return !Number.isFinite(expiresAtMs) || expiresAtMs <= nowMs + RUNTIME_TOKEN_RENEWAL_WINDOW_MS;
|
|
61505
|
+
}
|
|
61482
61506
|
async function startDaemon(args) {
|
|
61483
61507
|
bindConfigPath(args);
|
|
61484
61508
|
const stored = readConfig();
|
|
@@ -61491,6 +61515,7 @@ async function startDaemon(args) {
|
|
|
61491
61515
|
const runtimeTokenOverride = argValue(args, "--token") ?? process.env.ALAN_RUNTIME_TOKEN;
|
|
61492
61516
|
let runtimeToken = runtimeTokenOverride ?? stored.runtimeToken;
|
|
61493
61517
|
let runtimeRenewalToken = runtimeTokenOverride ? void 0 : stored.runtimeRenewalToken;
|
|
61518
|
+
let runtimeTokenExpiresAt = runtimeTokenOverride ? void 0 : stored.runtimeTokenExpiresAt;
|
|
61494
61519
|
const wsUrlOverride = argValue(args, "--ws-url") ?? process.env.ALAN_WS_URL;
|
|
61495
61520
|
const endpointMismatch = wsUrlOverride ? null : checkStoredEndpointConsistency(stored, readEndpointDefaults());
|
|
61496
61521
|
let wsUrl = wsUrlOverride ?? stored.wsUrl;
|
|
@@ -61835,14 +61860,14 @@ async function startDaemon(args) {
|
|
|
61835
61860
|
if (runtimeRenewalInFlight) return runtimeRenewalInFlight;
|
|
61836
61861
|
const attempt = runCredentialOperation(async () => {
|
|
61837
61862
|
const renewalToken = runtimeRenewalToken;
|
|
61838
|
-
if (!
|
|
61863
|
+
if (!renewalToken) {
|
|
61839
61864
|
return false;
|
|
61840
61865
|
}
|
|
61841
61866
|
let response = null;
|
|
61842
61867
|
let transportError = null;
|
|
61843
61868
|
for (let retry = 1; retry <= 3; retry += 1) {
|
|
61844
61869
|
try {
|
|
61845
|
-
response = await fetch(`${
|
|
61870
|
+
response = await fetch(`${apiUrl}/public/runtimes/${runtimeId}/tokens/renew`, {
|
|
61846
61871
|
method: "POST",
|
|
61847
61872
|
headers: {
|
|
61848
61873
|
authorization: `Bearer ${renewalToken}`,
|
|
@@ -61874,7 +61899,7 @@ async function startDaemon(args) {
|
|
|
61874
61899
|
return false;
|
|
61875
61900
|
}
|
|
61876
61901
|
const body = await response.json();
|
|
61877
|
-
if (typeof body.runtimeToken !== "string" || !body.runtimeToken.startsWith("alan_runtime_")) {
|
|
61902
|
+
if (typeof body.runtimeToken !== "string" || !body.runtimeToken.startsWith("alan_runtime_") || typeof body.runtimeTokenExpiresAt !== "string" || !Number.isFinite(Date.parse(body.runtimeTokenExpiresAt))) {
|
|
61878
61903
|
rememberConnectErrorCode("runtime_renewal_failed");
|
|
61879
61904
|
lastConnectError = "Runtime renewal returned an invalid access token";
|
|
61880
61905
|
pushLog("runtime-renewal-invalid-response");
|
|
@@ -61887,8 +61912,13 @@ async function startDaemon(args) {
|
|
|
61887
61912
|
pushLog("runtime-renewal-superseded");
|
|
61888
61913
|
return false;
|
|
61889
61914
|
}
|
|
61915
|
+
const replacementExpiresAt = body.runtimeTokenExpiresAt;
|
|
61890
61916
|
try {
|
|
61891
|
-
writeConfig({
|
|
61917
|
+
writeConfig({
|
|
61918
|
+
...current,
|
|
61919
|
+
runtimeToken: body.runtimeToken,
|
|
61920
|
+
runtimeTokenExpiresAt: replacementExpiresAt
|
|
61921
|
+
});
|
|
61892
61922
|
} catch (error61) {
|
|
61893
61923
|
rememberConnectErrorCode("config_write_failed");
|
|
61894
61924
|
lastConnectError = `Runtime renewal could not save its replacement: ${error61.message}`;
|
|
@@ -61896,6 +61926,7 @@ async function startDaemon(args) {
|
|
|
61896
61926
|
return false;
|
|
61897
61927
|
}
|
|
61898
61928
|
runtimeToken = body.runtimeToken;
|
|
61929
|
+
runtimeTokenExpiresAt = replacementExpiresAt;
|
|
61899
61930
|
socket.auth = { token: body.runtimeToken };
|
|
61900
61931
|
clearConnectErrors();
|
|
61901
61932
|
pushLog("runtime-renewal-succeeded");
|
|
@@ -61909,6 +61940,14 @@ async function startDaemon(args) {
|
|
|
61909
61940
|
});
|
|
61910
61941
|
return attempt;
|
|
61911
61942
|
};
|
|
61943
|
+
const ensureRuntimeTokenForLaunch = () => {
|
|
61944
|
+
if (!runtimeRenewalToken || !runtimeTokenNeedsRenewal(runtimeTokenExpiresAt)) return true;
|
|
61945
|
+
return renewRuntimeLease().then((renewed) => {
|
|
61946
|
+
if (renewed) return true;
|
|
61947
|
+
if (!runtimeTokenExpiresAt) return socket.connected;
|
|
61948
|
+
return Date.parse(runtimeTokenExpiresAt) > Date.now();
|
|
61949
|
+
});
|
|
61950
|
+
};
|
|
61912
61951
|
let queueIdentityRestart = () => {
|
|
61913
61952
|
};
|
|
61914
61953
|
let runtimeSetupInFlight = null;
|
|
@@ -61935,6 +61974,7 @@ async function startDaemon(args) {
|
|
|
61935
61974
|
runtimeId: bundle.runtimeId,
|
|
61936
61975
|
runtimeToken: bundle.runtimeToken,
|
|
61937
61976
|
runtimeRenewalToken: bundle.runtimeRenewalToken,
|
|
61977
|
+
runtimeTokenExpiresAt: bundle.runtimeTokenExpiresAt,
|
|
61938
61978
|
displayName: bundle.displayName
|
|
61939
61979
|
});
|
|
61940
61980
|
clearPendingSetupIntent();
|
|
@@ -61952,11 +61992,13 @@ async function startDaemon(args) {
|
|
|
61952
61992
|
...current,
|
|
61953
61993
|
runtimeToken: bundle.runtimeToken,
|
|
61954
61994
|
runtimeRenewalToken: bundle.runtimeRenewalToken,
|
|
61995
|
+
runtimeTokenExpiresAt: bundle.runtimeTokenExpiresAt,
|
|
61955
61996
|
displayName: bundle.displayName
|
|
61956
61997
|
});
|
|
61957
61998
|
clearPendingSetupIntent();
|
|
61958
61999
|
runtimeToken = bundle.runtimeToken;
|
|
61959
62000
|
runtimeRenewalToken = bundle.runtimeRenewalToken;
|
|
62001
|
+
runtimeTokenExpiresAt = bundle.runtimeTokenExpiresAt;
|
|
61960
62002
|
socket.auth = { token: bundle.runtimeToken };
|
|
61961
62003
|
clearConnectErrors();
|
|
61962
62004
|
const ready = new Promise((resolveReady, rejectReady) => {
|
|
@@ -62272,6 +62314,7 @@ async function startDaemon(args) {
|
|
|
62272
62314
|
runtimeId,
|
|
62273
62315
|
runtimeSkillManager,
|
|
62274
62316
|
getRuntimeToken: () => runtimeToken,
|
|
62317
|
+
ensureRuntimeTokenForLaunch,
|
|
62275
62318
|
eventOutbox,
|
|
62276
62319
|
daemonSessionId,
|
|
62277
62320
|
daemonEpoch,
|
|
@@ -62725,6 +62768,7 @@ async function setupDaemon(args, options = {}) {
|
|
|
62725
62768
|
runtimeId: body.runtimeId,
|
|
62726
62769
|
runtimeToken: body.runtimeToken,
|
|
62727
62770
|
runtimeRenewalToken: body.runtimeRenewalToken,
|
|
62771
|
+
runtimeTokenExpiresAt: body.runtimeTokenExpiresAt,
|
|
62728
62772
|
displayName: body.displayName,
|
|
62729
62773
|
installationId
|
|
62730
62774
|
});
|
|
@@ -62829,6 +62873,7 @@ async function loginWithDeviceCode(args) {
|
|
|
62829
62873
|
runtimeId: body.runtime.id,
|
|
62830
62874
|
runtimeToken: body.runtimeToken,
|
|
62831
62875
|
runtimeRenewalToken: body.runtimeRenewalToken,
|
|
62876
|
+
runtimeTokenExpiresAt: body.runtimeTokenExpiresAt,
|
|
62832
62877
|
displayName: body.runtime.displayName ?? displayName,
|
|
62833
62878
|
installationId
|
|
62834
62879
|
});
|
|
@@ -63046,7 +63091,8 @@ async function rotateRuntimeToken(args) {
|
|
|
63046
63091
|
apiUrl,
|
|
63047
63092
|
runtimeId,
|
|
63048
63093
|
runtimeToken: body.runtimeToken,
|
|
63049
|
-
runtimeRenewalToken: body.runtimeRenewalToken
|
|
63094
|
+
runtimeRenewalToken: body.runtimeRenewalToken,
|
|
63095
|
+
runtimeTokenExpiresAt: body.runtimeTokenExpiresAt
|
|
63050
63096
|
});
|
|
63051
63097
|
console.info("[alan-agent] Runtime token rotated", { runtimeId });
|
|
63052
63098
|
}
|
|
@@ -63348,7 +63394,7 @@ var cursorAdapter = {
|
|
|
63348
63394
|
type: "http",
|
|
63349
63395
|
url: s.url,
|
|
63350
63396
|
headers: s.name === "alan" ? {
|
|
63351
|
-
|
|
63397
|
+
Authorization: `\${env:ALAN_MCP_AUTHORIZATION}`,
|
|
63352
63398
|
"x-alan-run-id": `\${env:ALAN_RUN_ID}`
|
|
63353
63399
|
} : s.headers
|
|
63354
63400
|
};
|
|
@@ -63583,7 +63629,6 @@ var ALAN_SESSION_HEADER_NAMES = /* @__PURE__ */ new Set([
|
|
|
63583
63629
|
"x-team-id",
|
|
63584
63630
|
"x-allowed-tools",
|
|
63585
63631
|
"x-alan-run-reference",
|
|
63586
|
-
"x-alan-agent-credential",
|
|
63587
63632
|
"x-alan-run-id"
|
|
63588
63633
|
]);
|
|
63589
63634
|
function normalizeAlanSessionHeaders(actual, expected) {
|
|
@@ -63903,7 +63948,7 @@ function buildAlanMcpServers(apiUrl) {
|
|
|
63903
63948
|
type: "http",
|
|
63904
63949
|
url: new URL("/mcp", apiUrl).toString(),
|
|
63905
63950
|
headers: {
|
|
63906
|
-
|
|
63951
|
+
Authorization: `\${ALAN_MCP_AUTHORIZATION}`,
|
|
63907
63952
|
"x-alan-run-id": `\${ALAN_RUN_ID}`
|
|
63908
63953
|
}
|
|
63909
63954
|
}
|
|
@@ -67661,7 +67706,7 @@ async function runSandbox(config2) {
|
|
|
67661
67706
|
const agent = new CoreAgent(presenter, {
|
|
67662
67707
|
backendKind: activeBackendKind,
|
|
67663
67708
|
runId: activeRunId,
|
|
67664
|
-
|
|
67709
|
+
runtimeToken: config2.sessionToken,
|
|
67665
67710
|
providerApiKey: activeProviderApiKey
|
|
67666
67711
|
});
|
|
67667
67712
|
currentAgent = agent;
|
|
@@ -67710,7 +67755,7 @@ async function runSandbox(config2) {
|
|
|
67710
67755
|
}
|
|
67711
67756
|
const alanMcp = buildManagedAlanMcp({
|
|
67712
67757
|
apiUrl: config2.apiUrl,
|
|
67713
|
-
|
|
67758
|
+
runtimeToken: config2.sessionToken,
|
|
67714
67759
|
runId: activeRunId
|
|
67715
67760
|
});
|
|
67716
67761
|
const preparedTask = await prepareSkillInvocationTask({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alan-ai-hq/agent-manager",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.105",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Alan agent runtime — cloud sandbox and local daemon (alan-agent CLI)",
|
|
6
6
|
"bin": {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"tsup": "^8.5.1",
|
|
25
25
|
"tsx": "^4.19.0",
|
|
26
26
|
"typescript": "~5.9.3",
|
|
27
|
-
"@alan-ai/agent-core": "0.1.0",
|
|
28
27
|
"@alan-ai/sandbox-runtime-spec": "0.1.0",
|
|
28
|
+
"@alan-ai/agent-core": "0.1.0",
|
|
29
29
|
"@alan-ai/shared": "0.1.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|