@alan-ai-hq/agent-manager 0.1.89 → 0.1.90
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 +204 -57
- package/package.json +1 -1
- package/dist/__tests__/binding-switch-git.test.d.ts +0 -2
- package/dist/__tests__/binding-switch-git.test.d.ts.map +0 -1
- package/dist/__tests__/binding-switch-git.test.js +0 -610
- package/dist/__tests__/binding-switch-git.test.js.map +0 -1
- package/dist/__tests__/cli-ensure-install.test.d.ts +0 -2
- package/dist/__tests__/cli-ensure-install.test.d.ts.map +0 -1
- package/dist/__tests__/cli-ensure-install.test.js +0 -109
- package/dist/__tests__/cli-ensure-install.test.js.map +0 -1
- package/dist/__tests__/cli-executable.test.d.ts +0 -2
- package/dist/__tests__/cli-executable.test.d.ts.map +0 -1
- package/dist/__tests__/cli-executable.test.js +0 -129
- package/dist/__tests__/cli-executable.test.js.map +0 -1
- package/dist/__tests__/cli-help.test.d.ts +0 -2
- package/dist/__tests__/cli-help.test.d.ts.map +0 -1
- package/dist/__tests__/cli-help.test.js +0 -34
- package/dist/__tests__/cli-help.test.js.map +0 -1
- package/dist/__tests__/computer-readiness.test.d.ts +0 -2
- package/dist/__tests__/computer-readiness.test.d.ts.map +0 -1
- package/dist/__tests__/computer-readiness.test.js +0 -63
- package/dist/__tests__/computer-readiness.test.js.map +0 -1
- package/dist/__tests__/core-agent-workflow-context.test.d.ts +0 -2
- package/dist/__tests__/core-agent-workflow-context.test.d.ts.map +0 -1
- package/dist/__tests__/core-agent-workflow-context.test.js +0 -139
- package/dist/__tests__/core-agent-workflow-context.test.js.map +0 -1
- package/dist/__tests__/daemon-reconcile-ask.test.d.ts +0 -2
- package/dist/__tests__/daemon-reconcile-ask.test.d.ts.map +0 -1
- package/dist/__tests__/daemon-reconcile-ask.test.js +0 -86
- package/dist/__tests__/daemon-reconcile-ask.test.js.map +0 -1
- package/dist/__tests__/daemon-socket.integration.test.d.ts +0 -2
- package/dist/__tests__/daemon-socket.integration.test.d.ts.map +0 -1
- package/dist/__tests__/daemon-socket.integration.test.js +0 -450
- package/dist/__tests__/daemon-socket.integration.test.js.map +0 -1
- package/dist/__tests__/daemon.test.d.ts +0 -2
- package/dist/__tests__/daemon.test.d.ts.map +0 -1
- package/dist/__tests__/daemon.test.js +0 -3975
- package/dist/__tests__/daemon.test.js.map +0 -1
- package/dist/__tests__/ensure-shared-checkout-branch.test.d.ts +0 -2
- package/dist/__tests__/ensure-shared-checkout-branch.test.d.ts.map +0 -1
- package/dist/__tests__/ensure-shared-checkout-branch.test.js +0 -129
- package/dist/__tests__/ensure-shared-checkout-branch.test.js.map +0 -1
- package/dist/__tests__/event-outbox-persist-failure.test.d.ts +0 -2
- package/dist/__tests__/event-outbox-persist-failure.test.d.ts.map +0 -1
- package/dist/__tests__/event-outbox-persist-failure.test.js +0 -84
- package/dist/__tests__/event-outbox-persist-failure.test.js.map +0 -1
- package/dist/__tests__/event-outbox.test.d.ts +0 -2
- package/dist/__tests__/event-outbox.test.d.ts.map +0 -1
- package/dist/__tests__/event-outbox.test.js +0 -256
- package/dist/__tests__/event-outbox.test.js.map +0 -1
- package/dist/__tests__/fake-provider-cli.test.d.ts +0 -2
- package/dist/__tests__/fake-provider-cli.test.d.ts.map +0 -1
- package/dist/__tests__/fake-provider-cli.test.js +0 -46
- package/dist/__tests__/fake-provider-cli.test.js.map +0 -1
- package/dist/__tests__/generated-images.test.d.ts +0 -2
- package/dist/__tests__/generated-images.test.d.ts.map +0 -1
- package/dist/__tests__/generated-images.test.js +0 -132
- package/dist/__tests__/generated-images.test.js.map +0 -1
- package/dist/__tests__/lifecycle-logger.test.d.ts +0 -2
- package/dist/__tests__/lifecycle-logger.test.d.ts.map +0 -1
- package/dist/__tests__/lifecycle-logger.test.js +0 -49
- package/dist/__tests__/lifecycle-logger.test.js.map +0 -1
- package/dist/__tests__/local-skill-scan.test.d.ts +0 -2
- package/dist/__tests__/local-skill-scan.test.d.ts.map +0 -1
- package/dist/__tests__/local-skill-scan.test.js +0 -91
- package/dist/__tests__/local-skill-scan.test.js.map +0 -1
- package/dist/__tests__/local-workspace-migration.test.d.ts +0 -2
- package/dist/__tests__/local-workspace-migration.test.d.ts.map +0 -1
- package/dist/__tests__/local-workspace-migration.test.js +0 -195
- package/dist/__tests__/local-workspace-migration.test.js.map +0 -1
- package/dist/__tests__/mcp-inspect-timeout.test.d.ts +0 -2
- package/dist/__tests__/mcp-inspect-timeout.test.d.ts.map +0 -1
- package/dist/__tests__/mcp-inspect-timeout.test.js +0 -97
- package/dist/__tests__/mcp-inspect-timeout.test.js.map +0 -1
- package/dist/__tests__/mcp-readiness.test.d.ts +0 -2
- package/dist/__tests__/mcp-readiness.test.d.ts.map +0 -1
- package/dist/__tests__/mcp-readiness.test.js +0 -267
- package/dist/__tests__/mcp-readiness.test.js.map +0 -1
- package/dist/__tests__/mcp-registration-cli.test.d.ts +0 -2
- package/dist/__tests__/mcp-registration-cli.test.d.ts.map +0 -1
- package/dist/__tests__/mcp-registration-cli.test.js +0 -71
- package/dist/__tests__/mcp-registration-cli.test.js.map +0 -1
- package/dist/__tests__/mcp-registration.test.d.ts +0 -2
- package/dist/__tests__/mcp-registration.test.d.ts.map +0 -1
- package/dist/__tests__/mcp-registration.test.js +0 -426
- package/dist/__tests__/mcp-registration.test.js.map +0 -1
- package/dist/__tests__/model-scan-runner.test.d.ts +0 -2
- package/dist/__tests__/model-scan-runner.test.d.ts.map +0 -1
- package/dist/__tests__/model-scan-runner.test.js +0 -67
- package/dist/__tests__/model-scan-runner.test.js.map +0 -1
- package/dist/__tests__/network-diagnostics.test.d.ts +0 -2
- package/dist/__tests__/network-diagnostics.test.d.ts.map +0 -1
- package/dist/__tests__/network-diagnostics.test.js +0 -26
- package/dist/__tests__/network-diagnostics.test.js.map +0 -1
- package/dist/__tests__/observable-map.test.d.ts +0 -2
- package/dist/__tests__/observable-map.test.d.ts.map +0 -1
- package/dist/__tests__/observable-map.test.js +0 -54
- package/dist/__tests__/observable-map.test.js.map +0 -1
- package/dist/__tests__/provider-auth-preflight.test.d.ts +0 -2
- package/dist/__tests__/provider-auth-preflight.test.d.ts.map +0 -1
- package/dist/__tests__/provider-auth-preflight.test.js +0 -123
- package/dist/__tests__/provider-auth-preflight.test.js.map +0 -1
- package/dist/__tests__/provider-model-discovery.test.d.ts +0 -2
- package/dist/__tests__/provider-model-discovery.test.d.ts.map +0 -1
- package/dist/__tests__/provider-model-discovery.test.js +0 -472
- package/dist/__tests__/provider-model-discovery.test.js.map +0 -1
- package/dist/__tests__/remove-worktrees-if-clean.test.d.ts +0 -2
- package/dist/__tests__/remove-worktrees-if-clean.test.d.ts.map +0 -1
- package/dist/__tests__/remove-worktrees-if-clean.test.js +0 -221
- package/dist/__tests__/remove-worktrees-if-clean.test.js.map +0 -1
- package/dist/__tests__/resume-fallback-env.test.d.ts +0 -2
- package/dist/__tests__/resume-fallback-env.test.d.ts.map +0 -1
- package/dist/__tests__/resume-fallback-env.test.js +0 -28
- package/dist/__tests__/resume-fallback-env.test.js.map +0 -1
- package/dist/__tests__/run-journal.test.d.ts +0 -2
- package/dist/__tests__/run-journal.test.d.ts.map +0 -1
- package/dist/__tests__/run-journal.test.js +0 -121
- package/dist/__tests__/run-journal.test.js.map +0 -1
- package/dist/__tests__/run-start-gate.test.d.ts +0 -2
- package/dist/__tests__/run-start-gate.test.d.ts.map +0 -1
- package/dist/__tests__/run-start-gate.test.js +0 -29
- package/dist/__tests__/run-start-gate.test.js.map +0 -1
- package/dist/__tests__/runtime-capabilities-sync.test.d.ts +0 -2
- package/dist/__tests__/runtime-capabilities-sync.test.d.ts.map +0 -1
- package/dist/__tests__/runtime-capabilities-sync.test.js +0 -66
- package/dist/__tests__/runtime-capabilities-sync.test.js.map +0 -1
- package/dist/__tests__/runtime-config.test.d.ts +0 -2
- package/dist/__tests__/runtime-config.test.d.ts.map +0 -1
- package/dist/__tests__/runtime-config.test.js +0 -102
- package/dist/__tests__/runtime-config.test.js.map +0 -1
- package/dist/__tests__/runtime-presenter-heartbeat.test.d.ts +0 -2
- package/dist/__tests__/runtime-presenter-heartbeat.test.d.ts.map +0 -1
- package/dist/__tests__/runtime-presenter-heartbeat.test.js +0 -159
- package/dist/__tests__/runtime-presenter-heartbeat.test.js.map +0 -1
- package/dist/__tests__/sandbox-outbox.test.d.ts +0 -2
- package/dist/__tests__/sandbox-outbox.test.d.ts.map +0 -1
- package/dist/__tests__/sandbox-outbox.test.js +0 -214
- package/dist/__tests__/sandbox-outbox.test.js.map +0 -1
- package/dist/__tests__/sandbox-workflow-context.test.d.ts +0 -2
- package/dist/__tests__/sandbox-workflow-context.test.d.ts.map +0 -1
- package/dist/__tests__/sandbox-workflow-context.test.js +0 -396
- package/dist/__tests__/sandbox-workflow-context.test.js.map +0 -1
- package/dist/__tests__/service-manager.test.d.ts +0 -2
- package/dist/__tests__/service-manager.test.d.ts.map +0 -1
- package/dist/__tests__/service-manager.test.js +0 -50
- package/dist/__tests__/service-manager.test.js.map +0 -1
- package/dist/__tests__/sleep-inhibitor.test.d.ts +0 -2
- package/dist/__tests__/sleep-inhibitor.test.d.ts.map +0 -1
- package/dist/__tests__/sleep-inhibitor.test.js +0 -236
- package/dist/__tests__/sleep-inhibitor.test.js.map +0 -1
- package/dist/__tests__/status-local-workspace.test.d.ts +0 -2
- package/dist/__tests__/status-local-workspace.test.d.ts.map +0 -1
- package/dist/__tests__/status-local-workspace.test.js +0 -121
- package/dist/__tests__/status-local-workspace.test.js.map +0 -1
- package/dist/__tests__/suspension-detector.test.d.ts +0 -2
- package/dist/__tests__/suspension-detector.test.d.ts.map +0 -1
- package/dist/__tests__/suspension-detector.test.js +0 -112
- package/dist/__tests__/suspension-detector.test.js.map +0 -1
- package/dist/__tests__/web-presenter-parent-events.test.d.ts +0 -2
- package/dist/__tests__/web-presenter-parent-events.test.d.ts.map +0 -1
- package/dist/__tests__/web-presenter-parent-events.test.js +0 -130
- package/dist/__tests__/web-presenter-parent-events.test.js.map +0 -1
- package/dist/__tests__/workspace-relocation.test.d.ts +0 -2
- package/dist/__tests__/workspace-relocation.test.d.ts.map +0 -1
- package/dist/__tests__/workspace-relocation.test.js +0 -66
- package/dist/__tests__/workspace-relocation.test.js.map +0 -1
- package/dist/__tests__/workspace-run-lease.test.d.ts +0 -2
- package/dist/__tests__/workspace-run-lease.test.d.ts.map +0 -1
- package/dist/__tests__/workspace-run-lease.test.js +0 -230
- package/dist/__tests__/workspace-run-lease.test.js.map +0 -1
- package/dist/__tests__/ws-client-heartbeat-volatile.test.d.ts +0 -2
- package/dist/__tests__/ws-client-heartbeat-volatile.test.d.ts.map +0 -1
- package/dist/__tests__/ws-client-heartbeat-volatile.test.js +0 -61
- package/dist/__tests__/ws-client-heartbeat-volatile.test.js.map +0 -1
- package/dist/__tests__/ws-client-heartbeat.integration.test.d.ts +0 -2
- package/dist/__tests__/ws-client-heartbeat.integration.test.d.ts.map +0 -1
- package/dist/__tests__/ws-client-heartbeat.integration.test.js +0 -109
- package/dist/__tests__/ws-client-heartbeat.integration.test.js.map +0 -1
- package/dist/__tests__/ws-client-user-message-ack.integration.test.d.ts +0 -2
- package/dist/__tests__/ws-client-user-message-ack.integration.test.d.ts.map +0 -1
- package/dist/__tests__/ws-client-user-message-ack.integration.test.js +0 -167
- package/dist/__tests__/ws-client-user-message-ack.integration.test.js.map +0 -1
- package/dist/aiden-system-prompt.d.ts +0 -6
- package/dist/aiden-system-prompt.d.ts.map +0 -1
- package/dist/aiden-system-prompt.js +0 -6
- package/dist/aiden-system-prompt.js.map +0 -1
- package/dist/binding-switch-git.d.ts +0 -26
- package/dist/binding-switch-git.d.ts.map +0 -1
- package/dist/binding-switch-git.js +0 -973
- package/dist/binding-switch-git.js.map +0 -1
- package/dist/cli-ensure-install.d.ts +0 -39
- package/dist/cli-ensure-install.d.ts.map +0 -1
- package/dist/cli-ensure-install.js +0 -133
- package/dist/cli-ensure-install.js.map +0 -1
- package/dist/cli-executable.d.ts +0 -97
- package/dist/cli-executable.d.ts.map +0 -1
- package/dist/cli-executable.js +0 -432
- package/dist/cli-executable.js.map +0 -1
- package/dist/cli-help.d.ts +0 -7
- package/dist/cli-help.d.ts.map +0 -1
- package/dist/cli-help.js +0 -49
- package/dist/cli-help.js.map +0 -1
- package/dist/computer-readiness.d.ts +0 -42
- package/dist/computer-readiness.d.ts.map +0 -1
- package/dist/computer-readiness.js +0 -191
- package/dist/computer-readiness.js.map +0 -1
- package/dist/core-agent.d.ts +0 -47
- package/dist/core-agent.d.ts.map +0 -1
- package/dist/core-agent.js +0 -364
- package/dist/core-agent.js.map +0 -1
- package/dist/daemon.d.ts +0 -392
- package/dist/daemon.d.ts.map +0 -1
- package/dist/daemon.js +0 -4711
- package/dist/daemon.js.map +0 -1
- package/dist/event-outbox.d.ts +0 -83
- package/dist/event-outbox.d.ts.map +0 -1
- package/dist/event-outbox.js +0 -440
- package/dist/event-outbox.js.map +0 -1
- package/dist/fake-provider-cli.d.ts +0 -13
- package/dist/fake-provider-cli.d.ts.map +0 -1
- package/dist/fake-provider-cli.js +0 -53
- package/dist/fake-provider-cli.js.map +0 -1
- package/dist/generated-images.d.ts +0 -2
- package/dist/generated-images.d.ts.map +0 -1
- package/dist/generated-images.js +0 -2
- package/dist/generated-images.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -209
- package/dist/index.js.map +0 -1
- package/dist/lifecycle-logger.d.ts +0 -25
- package/dist/lifecycle-logger.d.ts.map +0 -1
- package/dist/lifecycle-logger.js +0 -73
- package/dist/lifecycle-logger.js.map +0 -1
- package/dist/local-skill-scan.d.ts +0 -21
- package/dist/local-skill-scan.d.ts.map +0 -1
- package/dist/local-skill-scan.js +0 -109
- package/dist/local-skill-scan.js.map +0 -1
- package/dist/local-workspace-migration.d.ts +0 -68
- package/dist/local-workspace-migration.d.ts.map +0 -1
- package/dist/local-workspace-migration.js +0 -157
- package/dist/local-workspace-migration.js.map +0 -1
- package/dist/mcp-readiness.d.ts +0 -59
- package/dist/mcp-readiness.d.ts.map +0 -1
- package/dist/mcp-readiness.js +0 -202
- package/dist/mcp-readiness.js.map +0 -1
- package/dist/mcp-registration.d.ts +0 -75
- package/dist/mcp-registration.d.ts.map +0 -1
- package/dist/mcp-registration.js +0 -563
- package/dist/mcp-registration.js.map +0 -1
- package/dist/model-scan-runner.d.ts +0 -15
- package/dist/model-scan-runner.d.ts.map +0 -1
- package/dist/model-scan-runner.js +0 -51
- package/dist/model-scan-runner.js.map +0 -1
- package/dist/network-diagnostics.d.ts +0 -8
- package/dist/network-diagnostics.d.ts.map +0 -1
- package/dist/network-diagnostics.js +0 -56
- package/dist/network-diagnostics.js.map +0 -1
- package/dist/observable-map.d.ts +0 -25
- package/dist/observable-map.d.ts.map +0 -1
- package/dist/observable-map.js +0 -42
- package/dist/observable-map.js.map +0 -1
- package/dist/provider-auth-preflight.d.ts +0 -22
- package/dist/provider-auth-preflight.d.ts.map +0 -1
- package/dist/provider-auth-preflight.js +0 -110
- package/dist/provider-auth-preflight.js.map +0 -1
- package/dist/provider-model-discovery.d.ts +0 -38
- package/dist/provider-model-discovery.d.ts.map +0 -1
- package/dist/provider-model-discovery.js +0 -519
- package/dist/provider-model-discovery.js.map +0 -1
- package/dist/resume-fallback-env.d.ts +0 -20
- package/dist/resume-fallback-env.d.ts.map +0 -1
- package/dist/resume-fallback-env.js +0 -30
- package/dist/resume-fallback-env.js.map +0 -1
- package/dist/run-journal.d.ts +0 -53
- package/dist/run-journal.d.ts.map +0 -1
- package/dist/run-journal.js +0 -193
- package/dist/run-journal.js.map +0 -1
- package/dist/run-start-gate.d.ts +0 -9
- package/dist/run-start-gate.d.ts.map +0 -1
- package/dist/run-start-gate.js +0 -24
- package/dist/run-start-gate.js.map +0 -1
- package/dist/runtime-backends.d.ts +0 -2
- package/dist/runtime-backends.d.ts.map +0 -1
- package/dist/runtime-backends.js +0 -2
- package/dist/runtime-backends.js.map +0 -1
- package/dist/runtime-capabilities-sync.d.ts +0 -33
- package/dist/runtime-capabilities-sync.d.ts.map +0 -1
- package/dist/runtime-capabilities-sync.js +0 -56
- package/dist/runtime-capabilities-sync.js.map +0 -1
- package/dist/runtime-config.d.ts +0 -24
- package/dist/runtime-config.d.ts.map +0 -1
- package/dist/runtime-config.js +0 -124
- package/dist/runtime-config.js.map +0 -1
- package/dist/sandbox-outbox.d.ts +0 -122
- package/dist/sandbox-outbox.d.ts.map +0 -1
- package/dist/sandbox-outbox.js +0 -180
- package/dist/sandbox-outbox.js.map +0 -1
- package/dist/sandbox.d.ts +0 -44
- package/dist/sandbox.d.ts.map +0 -1
- package/dist/sandbox.js +0 -438
- package/dist/sandbox.js.map +0 -1
- package/dist/service-manager.d.ts +0 -28
- package/dist/service-manager.d.ts.map +0 -1
- package/dist/service-manager.js +0 -259
- package/dist/service-manager.js.map +0 -1
- package/dist/sleep-inhibitor.d.ts +0 -111
- package/dist/sleep-inhibitor.d.ts.map +0 -1
- package/dist/sleep-inhibitor.js +0 -412
- package/dist/sleep-inhibitor.js.map +0 -1
- package/dist/suspension-detector.d.ts +0 -48
- package/dist/suspension-detector.d.ts.map +0 -1
- package/dist/suspension-detector.js +0 -89
- package/dist/suspension-detector.js.map +0 -1
- package/dist/types.d.ts +0 -6
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -6
- package/dist/types.js.map +0 -1
- package/dist/updater.d.ts +0 -15
- package/dist/updater.d.ts.map +0 -1
- package/dist/updater.js +0 -50
- package/dist/updater.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -2
- package/dist/version.js.map +0 -1
- package/dist/web-presenter.d.ts +0 -55
- package/dist/web-presenter.d.ts.map +0 -1
- package/dist/web-presenter.js +0 -265
- package/dist/web-presenter.js.map +0 -1
- package/dist/workspace-relocation.d.ts +0 -22
- package/dist/workspace-relocation.d.ts.map +0 -1
- package/dist/workspace-relocation.js +0 -90
- package/dist/workspace-relocation.js.map +0 -1
- package/dist/workspace-run-lease.d.ts +0 -97
- package/dist/workspace-run-lease.d.ts.map +0 -1
- package/dist/workspace-run-lease.js +0 -241
- package/dist/workspace-run-lease.js.map +0 -1
- package/dist/ws-client.d.ts +0 -194
- package/dist/ws-client.d.ts.map +0 -1
- package/dist/ws-client.js +0 -282
- package/dist/ws-client.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -15167,6 +15167,10 @@ function hasRunSessionEnv(env) {
|
|
|
15167
15167
|
env.ALAN_WS_URL && env.ALAN_SESSION_ID && env.ALAN_TASK_ID && env.ALAN_SESSION_TOKEN && env.ALAN_TASK !== void 0
|
|
15168
15168
|
);
|
|
15169
15169
|
}
|
|
15170
|
+
function resolveInstallConfigurationMode(args, configured) {
|
|
15171
|
+
if (args.includes("--setup-token")) return "setup";
|
|
15172
|
+
return configured.runtimeId && configured.runtimeToken ? "reuse" : "login";
|
|
15173
|
+
}
|
|
15170
15174
|
function resolveCommand(args, env) {
|
|
15171
15175
|
const [command, ...commandArgs] = args;
|
|
15172
15176
|
if (!command) {
|
|
@@ -15447,7 +15451,7 @@ function describeError(error61) {
|
|
|
15447
15451
|
}
|
|
15448
15452
|
|
|
15449
15453
|
// src/version.ts
|
|
15450
|
-
var AGENT_VERSION = "0.1.
|
|
15454
|
+
var AGENT_VERSION = "0.1.90";
|
|
15451
15455
|
|
|
15452
15456
|
// src/daemon-worktree.ts
|
|
15453
15457
|
var import_node_child_process3 = require("child_process");
|
|
@@ -35648,14 +35652,14 @@ function configuredConfigPathFromEnvironment() {
|
|
|
35648
35652
|
const explicit = process.env.ALAN_AGENT_CONFIG_PATH?.trim() || process.env.ALAN_AGENT_CONFIG?.trim();
|
|
35649
35653
|
return explicit || void 0;
|
|
35650
35654
|
}
|
|
35651
|
-
function resolveIsolatedAgentBaseDir(profile) {
|
|
35655
|
+
function resolveIsolatedAgentBaseDir(profile, homeDirectory2 = (0, import_node_os4.homedir)()) {
|
|
35652
35656
|
switch (profile) {
|
|
35653
35657
|
case "local":
|
|
35654
|
-
return (0, import_node_path5.join)(
|
|
35658
|
+
return (0, import_node_path5.join)(homeDirectory2, ".alan-dev", "agent");
|
|
35655
35659
|
case "staging":
|
|
35656
|
-
return (0, import_node_path5.join)(
|
|
35660
|
+
return (0, import_node_path5.join)(homeDirectory2, ".alan-staging", "agent");
|
|
35657
35661
|
case "custom":
|
|
35658
|
-
return (0, import_node_path5.join)(
|
|
35662
|
+
return (0, import_node_path5.join)(homeDirectory2, ".alan-prod", "agent");
|
|
35659
35663
|
default:
|
|
35660
35664
|
return null;
|
|
35661
35665
|
}
|
|
@@ -35732,6 +35736,9 @@ function migrateLegacyAgentConfig(input2) {
|
|
|
35732
35736
|
return false;
|
|
35733
35737
|
}
|
|
35734
35738
|
}
|
|
35739
|
+
function resolveAgentConfigDirectory(profile = "production", homeDirectory2 = (0, import_node_os4.homedir)()) {
|
|
35740
|
+
return resolveIsolatedAgentBaseDir(profile, homeDirectory2) ?? (0, import_node_path5.join)(homeDirectory2, ".alan", "agent");
|
|
35741
|
+
}
|
|
35735
35742
|
function resolveAgentConfigPath(input2) {
|
|
35736
35743
|
if (input2?.explicitPath?.trim()) return input2.explicitPath.trim();
|
|
35737
35744
|
const profile = normalizeAgentEndpointProfile(
|
|
@@ -35740,10 +35747,8 @@ function resolveAgentConfigPath(input2) {
|
|
|
35740
35747
|
if (input2?.baseDir !== void 0) {
|
|
35741
35748
|
return (0, import_node_path5.join)(input2.baseDir, resolveAgentConfigFileName(profile));
|
|
35742
35749
|
}
|
|
35743
|
-
|
|
35744
|
-
|
|
35745
|
-
migrateLegacyAgentConfig({ profile });
|
|
35746
|
-
return (0, import_node_path5.join)(DEFAULT_AGENT_DIR, resolveAgentConfigFileName(profile));
|
|
35750
|
+
if (profile === "production") migrateLegacyAgentConfig({ profile });
|
|
35751
|
+
return (0, import_node_path5.join)(resolveAgentConfigDirectory(profile), "config.json");
|
|
35747
35752
|
}
|
|
35748
35753
|
function configExistsAtPath(configPath) {
|
|
35749
35754
|
return (0, import_node_fs5.existsSync)(configPath);
|
|
@@ -49460,7 +49465,7 @@ function bindConfigPath(args) {
|
|
|
49460
49465
|
return boundAgentConfigPath;
|
|
49461
49466
|
}
|
|
49462
49467
|
function getConfigPath() {
|
|
49463
|
-
return process.env.ALAN_AGENT_CONFIG_PATH ??
|
|
49468
|
+
return boundAgentConfigPath ?? process.env.ALAN_AGENT_CONFIG_PATH ?? resolveAgentConfigPath({ profile: "production" });
|
|
49464
49469
|
}
|
|
49465
49470
|
function getEndpointDefaultsPath() {
|
|
49466
49471
|
return process.env.ALAN_AGENT_ENDPOINTS_PATH ?? (0, import_node_path11.join)((0, import_node_path11.dirname)(getConfigPath()), "endpoints.json");
|
|
@@ -49515,7 +49520,7 @@ function readLocalDaemonMaintenanceLease(configPath, nowMs = Date.now()) {
|
|
|
49515
49520
|
if (!(0, import_node_fs13.existsSync)(path2)) return null;
|
|
49516
49521
|
try {
|
|
49517
49522
|
const lease = JSON.parse((0, import_node_fs13.readFileSync)(path2, "utf8"));
|
|
49518
|
-
if (lease.version !== 1 || typeof lease.id !== "string" || lease.reason !== "credential_cleanup" && lease.reason !== "daemon_startup" && lease.reason !== "watchdog" || !(lease.reason === "credential_cleanup" && lease.expiresAtMs === null || typeof lease.expiresAtMs === "number" && Number.isFinite(lease.expiresAtMs))) {
|
|
49523
|
+
if (lease.version !== 1 || typeof lease.id !== "string" || lease.reason !== "credential_cleanup" && lease.reason !== "credential_swap" && lease.reason !== "daemon_startup" && lease.reason !== "watchdog" || !(lease.reason === "credential_cleanup" && lease.expiresAtMs === null || typeof lease.expiresAtMs === "number" && Number.isFinite(lease.expiresAtMs))) {
|
|
49519
49524
|
throw new Error("invalid maintenance lease");
|
|
49520
49525
|
}
|
|
49521
49526
|
if (lease.reason !== "credential_cleanup" && lease.expiresAtMs <= nowMs) {
|
|
@@ -76529,6 +76534,7 @@ async function createRuntimeSetupGrant(input2) {
|
|
|
76529
76534
|
}
|
|
76530
76535
|
async function exchangeRuntimeSetupGrant(input2) {
|
|
76531
76536
|
const registrationAttemptId = getOrCreateSetupAttemptId(input2.setupToken);
|
|
76537
|
+
const signal = AbortSignal.timeout(15e3);
|
|
76532
76538
|
const registrationInit = {
|
|
76533
76539
|
method: "POST",
|
|
76534
76540
|
headers: { "content-type": "application/json" },
|
|
@@ -76547,7 +76553,8 @@ async function exchangeRuntimeSetupGrant(input2) {
|
|
|
76547
76553
|
...await collectRuntimeMetadataWithProviderLimits(),
|
|
76548
76554
|
installationId: input2.installationId
|
|
76549
76555
|
}
|
|
76550
|
-
})
|
|
76556
|
+
}),
|
|
76557
|
+
signal
|
|
76551
76558
|
};
|
|
76552
76559
|
let response;
|
|
76553
76560
|
let transportError;
|
|
@@ -79398,11 +79405,24 @@ async function startDaemon(args) {
|
|
|
79398
79405
|
releaseStartupLease();
|
|
79399
79406
|
throw error61;
|
|
79400
79407
|
}
|
|
79408
|
+
let runtimeCredentialOperationTail = Promise.resolve();
|
|
79409
|
+
const runCredentialOperation = (operation) => {
|
|
79410
|
+
const result = runtimeCredentialOperationTail.catch(() => {
|
|
79411
|
+
}).then(operation);
|
|
79412
|
+
runtimeCredentialOperationTail = result.then(
|
|
79413
|
+
() => {
|
|
79414
|
+
},
|
|
79415
|
+
() => {
|
|
79416
|
+
}
|
|
79417
|
+
);
|
|
79418
|
+
return result;
|
|
79419
|
+
};
|
|
79401
79420
|
let runtimeRenewalInFlight = null;
|
|
79402
79421
|
const renewRuntimeLease = () => {
|
|
79403
79422
|
if (runtimeRenewalInFlight) return runtimeRenewalInFlight;
|
|
79404
|
-
const attempt = (async () => {
|
|
79405
|
-
|
|
79423
|
+
const attempt = runCredentialOperation(async () => {
|
|
79424
|
+
const renewalToken = runtimeRenewalToken;
|
|
79425
|
+
if (!stored.apiUrl || !renewalToken) {
|
|
79406
79426
|
return false;
|
|
79407
79427
|
}
|
|
79408
79428
|
let response = null;
|
|
@@ -79412,7 +79432,7 @@ async function startDaemon(args) {
|
|
|
79412
79432
|
response = await fetch(`${stored.apiUrl}/public/runtimes/${runtimeId}/tokens/renew`, {
|
|
79413
79433
|
method: "POST",
|
|
79414
79434
|
headers: {
|
|
79415
|
-
authorization: `Bearer ${
|
|
79435
|
+
authorization: `Bearer ${renewalToken}`,
|
|
79416
79436
|
"content-type": "application/json"
|
|
79417
79437
|
},
|
|
79418
79438
|
body: "{}",
|
|
@@ -79448,7 +79468,7 @@ async function startDaemon(args) {
|
|
|
79448
79468
|
return false;
|
|
79449
79469
|
}
|
|
79450
79470
|
const current = readConfig();
|
|
79451
|
-
if (current.runtimeId !== runtimeId || current.runtimeRenewalToken !==
|
|
79471
|
+
if (current.runtimeId !== runtimeId || current.runtimeRenewalToken !== renewalToken) {
|
|
79452
79472
|
rememberConnectErrorCode("runtime_renewal_superseded");
|
|
79453
79473
|
lastConnectError = "Runtime credentials changed while renewal was in progress";
|
|
79454
79474
|
pushLog("runtime-renewal-superseded");
|
|
@@ -79468,7 +79488,7 @@ async function startDaemon(args) {
|
|
|
79468
79488
|
pushLog("runtime-renewal-succeeded");
|
|
79469
79489
|
socket.connect();
|
|
79470
79490
|
return true;
|
|
79471
|
-
})
|
|
79491
|
+
});
|
|
79472
79492
|
runtimeRenewalInFlight = attempt;
|
|
79473
79493
|
void attempt.finally(() => {
|
|
79474
79494
|
if (runtimeRenewalInFlight === attempt) runtimeRenewalInFlight = null;
|
|
@@ -79476,10 +79496,18 @@ async function startDaemon(args) {
|
|
|
79476
79496
|
});
|
|
79477
79497
|
return attempt;
|
|
79478
79498
|
};
|
|
79499
|
+
let queueIdentityRestart = () => {
|
|
79500
|
+
};
|
|
79479
79501
|
let runtimeSetupInFlight = null;
|
|
79480
79502
|
const adoptRuntimeSetupGrant = (input2) => {
|
|
79481
79503
|
if (runtimeSetupInFlight) return runtimeSetupInFlight;
|
|
79482
|
-
const attempt = (async () => {
|
|
79504
|
+
const attempt = runCredentialOperation(async () => {
|
|
79505
|
+
const activeRunCount = activeAgents.size + pendingRunStarts.size;
|
|
79506
|
+
if (activeRunCount > 0) {
|
|
79507
|
+
throw new Error(
|
|
79508
|
+
`credential setup is deferred while ${activeRunCount} active run${activeRunCount === 1 ? " finishes" : "s finish"}`
|
|
79509
|
+
);
|
|
79510
|
+
}
|
|
79483
79511
|
const current = readConfig();
|
|
79484
79512
|
if (current.runtimeId !== runtimeId || current.installationId !== installationId || input2.installationId !== installationId) {
|
|
79485
79513
|
throw new Error("credential setup does not belong to this daemon installation");
|
|
@@ -79489,7 +79517,23 @@ async function startDaemon(args) {
|
|
|
79489
79517
|
}
|
|
79490
79518
|
const bundle = await exchangeRuntimeSetupGrant(input2);
|
|
79491
79519
|
if (bundle.runtimeId !== runtimeId) {
|
|
79492
|
-
|
|
79520
|
+
writeConfig({
|
|
79521
|
+
...current,
|
|
79522
|
+
runtimeId: bundle.runtimeId,
|
|
79523
|
+
runtimeToken: bundle.runtimeToken,
|
|
79524
|
+
runtimeRenewalToken: bundle.runtimeRenewalToken,
|
|
79525
|
+
displayName: bundle.displayName
|
|
79526
|
+
});
|
|
79527
|
+
clearPendingSetupIntent();
|
|
79528
|
+
pushLog(
|
|
79529
|
+
`runtime-identity-switch-queued from=${runtimeId} to=${bundle.runtimeId} generation=${bundle.credentialGeneration}`
|
|
79530
|
+
);
|
|
79531
|
+
const restartTimer = setTimeout(queueIdentityRestart, 100);
|
|
79532
|
+
restartTimer.unref?.();
|
|
79533
|
+
return {
|
|
79534
|
+
runtimeId: bundle.runtimeId,
|
|
79535
|
+
credentialGeneration: bundle.credentialGeneration
|
|
79536
|
+
};
|
|
79493
79537
|
}
|
|
79494
79538
|
writeConfig({
|
|
79495
79539
|
...current,
|
|
@@ -79526,7 +79570,7 @@ async function startDaemon(args) {
|
|
|
79526
79570
|
runtimeId: bundle.runtimeId,
|
|
79527
79571
|
credentialGeneration: bundle.credentialGeneration
|
|
79528
79572
|
};
|
|
79529
|
-
})
|
|
79573
|
+
});
|
|
79530
79574
|
runtimeSetupInFlight = attempt;
|
|
79531
79575
|
void attempt.finally(() => {
|
|
79532
79576
|
if (runtimeSetupInFlight === attempt) runtimeSetupInFlight = null;
|
|
@@ -79741,6 +79785,16 @@ async function startDaemon(args) {
|
|
|
79741
79785
|
const wsHint = isLocalEndpoint(wsUrl) ? ` Nothing is listening at ${wsUrl}. For local dev run setup with --profile local and start the stack (WS on ws://localhost:8401).` : ` Verify wsUrl in ${getConfigPath()} and that you can reach ${wsUrl}.`;
|
|
79742
79786
|
console.warn("[alan-agent] Daemon connection error:", `${error61.message}.${wsHint}`);
|
|
79743
79787
|
});
|
|
79788
|
+
socket.on("connection_directive", (value2) => {
|
|
79789
|
+
if (!value2 || typeof value2 !== "object") return;
|
|
79790
|
+
const directive = value2;
|
|
79791
|
+
if (directive.retryable !== false || typeof directive.code !== "string") return;
|
|
79792
|
+
rememberConnectErrorCode(directive.code);
|
|
79793
|
+
if (typeof directive.reason === "string") lastConnectError = directive.reason;
|
|
79794
|
+
pushLog(
|
|
79795
|
+
`connection_directive ${directive.code}${lastConnectError ? ` reason=${lastConnectError}` : ""}`
|
|
79796
|
+
);
|
|
79797
|
+
});
|
|
79744
79798
|
socket.on("disconnect", (reason) => {
|
|
79745
79799
|
setConnectedRuntimeSocket(null);
|
|
79746
79800
|
relocationInFlight.clear();
|
|
@@ -80093,6 +80147,9 @@ async function startDaemon(args) {
|
|
|
80093
80147
|
queueFullShutdown = () => {
|
|
80094
80148
|
void stop().then(() => controller.whenExternallyStopped?.());
|
|
80095
80149
|
};
|
|
80150
|
+
queueIdentityRestart = () => {
|
|
80151
|
+
void stop().then(() => controller.whenExternallyStopped?.("runtime_identity_changed"));
|
|
80152
|
+
};
|
|
80096
80153
|
return controller;
|
|
80097
80154
|
}
|
|
80098
80155
|
|
|
@@ -80191,17 +80248,23 @@ async function setupDaemon(args) {
|
|
|
80191
80248
|
if (!liveConfig.localApiToken) {
|
|
80192
80249
|
throw new Error("running daemon could not be authenticated for credential setup");
|
|
80193
80250
|
}
|
|
80251
|
+
const liveSetup = {
|
|
80252
|
+
...setup,
|
|
80253
|
+
apiUrl: liveConfig.apiUrl ?? setup.apiUrl,
|
|
80254
|
+
wsUrl: liveConfig.wsUrl ?? setup.wsUrl,
|
|
80255
|
+
endpointProfile: liveConfig.endpointProfile ?? setup.endpointProfile
|
|
80256
|
+
};
|
|
80194
80257
|
const body2 = await handoffRuntimeSetupGrant({
|
|
80195
80258
|
port: localApiPort,
|
|
80196
80259
|
localApiToken: liveConfig.localApiToken,
|
|
80197
|
-
setup
|
|
80260
|
+
setup: liveSetup
|
|
80198
80261
|
});
|
|
80199
80262
|
console.info("[alan-agent] Runtime credentials adopted by running daemon", {
|
|
80200
80263
|
runtimeId: body2.runtimeId,
|
|
80201
80264
|
credentialGeneration: body2.credentialGeneration,
|
|
80202
80265
|
configPath: getConfigPath()
|
|
80203
80266
|
});
|
|
80204
|
-
return;
|
|
80267
|
+
return { daemonAlreadyRunning: true };
|
|
80205
80268
|
}
|
|
80206
80269
|
if (readLocalDaemonOwnerLease(getConfigPath())) {
|
|
80207
80270
|
throw new Error(
|
|
@@ -80215,7 +80278,7 @@ async function setupDaemon(args) {
|
|
|
80215
80278
|
if (setupToken && error61 instanceof RuntimeSetupGrantExpiredError) {
|
|
80216
80279
|
console.info("[alan-agent] Setup link expired; continuing with browser authorization");
|
|
80217
80280
|
await loginWithDeviceCode(args);
|
|
80218
|
-
return;
|
|
80281
|
+
return { daemonAlreadyRunning: false };
|
|
80219
80282
|
}
|
|
80220
80283
|
throw error61;
|
|
80221
80284
|
}
|
|
@@ -80240,6 +80303,7 @@ async function setupDaemon(args) {
|
|
|
80240
80303
|
runtimeId: body.runtimeId,
|
|
80241
80304
|
configPath: getConfigPath()
|
|
80242
80305
|
});
|
|
80306
|
+
return { daemonAlreadyRunning: false };
|
|
80243
80307
|
}
|
|
80244
80308
|
async function loginWithDeviceCode(args) {
|
|
80245
80309
|
bindConfigPath(args);
|
|
@@ -80428,8 +80492,8 @@ async function runDaemon(args) {
|
|
|
80428
80492
|
return;
|
|
80429
80493
|
}
|
|
80430
80494
|
const controller = await startDaemon(args);
|
|
80431
|
-
const shutdown = () => {
|
|
80432
|
-
void controller.stop().finally(() => process.exit(
|
|
80495
|
+
const shutdown = (reason) => {
|
|
80496
|
+
void controller.stop().finally(() => process.exit(daemonExternalStopExitCode(reason)));
|
|
80433
80497
|
};
|
|
80434
80498
|
controller.whenExternallyStopped = shutdown;
|
|
80435
80499
|
process.once("SIGINT", shutdown);
|
|
@@ -80437,6 +80501,9 @@ async function runDaemon(args) {
|
|
|
80437
80501
|
await new Promise(() => {
|
|
80438
80502
|
});
|
|
80439
80503
|
}
|
|
80504
|
+
function daemonExternalStopExitCode(reason) {
|
|
80505
|
+
return reason === "runtime_identity_changed" ? 1 : 0;
|
|
80506
|
+
}
|
|
80440
80507
|
async function recoverDaemonConnection(args = [], options) {
|
|
80441
80508
|
bindConfigPath(args);
|
|
80442
80509
|
const getStatus = async () => {
|
|
@@ -95676,17 +95743,50 @@ function deriveSandboxOutboxKey(sessionToken) {
|
|
|
95676
95743
|
function sandboxOutboxSpoolPath(conversationId) {
|
|
95677
95744
|
return `/tmp/alan-agent-outbox-${conversationId}.enc`;
|
|
95678
95745
|
}
|
|
95746
|
+
function sandboxOutboxKeyPath(spoolPath) {
|
|
95747
|
+
return `${spoolPath}.key`;
|
|
95748
|
+
}
|
|
95749
|
+
function assertValidOutboxKey(key, path2) {
|
|
95750
|
+
if (Buffer.from(key, "base64url").length !== 32) {
|
|
95751
|
+
throw new Error(`sandbox event outbox key at ${path2} must contain exactly 32 bytes`);
|
|
95752
|
+
}
|
|
95753
|
+
return key;
|
|
95754
|
+
}
|
|
95755
|
+
function loadOrCreateSandboxOutboxKey(input2) {
|
|
95756
|
+
const keyPath = sandboxOutboxKeyPath(input2.spoolPath);
|
|
95757
|
+
if ((0, import_node_fs27.existsSync)(keyPath)) {
|
|
95758
|
+
(0, import_node_fs27.chmodSync)(keyPath, 384);
|
|
95759
|
+
return assertValidOutboxKey((0, import_node_fs27.readFileSync)(keyPath, "utf8").trim(), keyPath);
|
|
95760
|
+
}
|
|
95761
|
+
const initialKey = deriveSandboxOutboxKey(input2.sessionToken);
|
|
95762
|
+
try {
|
|
95763
|
+
(0, import_node_fs27.writeFileSync)(keyPath, initialKey, { encoding: "utf8", flag: "wx", mode: 384 });
|
|
95764
|
+
return initialKey;
|
|
95765
|
+
} catch (error61) {
|
|
95766
|
+
if (error61.code !== "EEXIST") throw error61;
|
|
95767
|
+
(0, import_node_fs27.chmodSync)(keyPath, 384);
|
|
95768
|
+
return assertValidOutboxKey((0, import_node_fs27.readFileSync)(keyPath, "utf8").trim(), keyPath);
|
|
95769
|
+
}
|
|
95770
|
+
}
|
|
95771
|
+
function quarantineUnusableOutbox(path2) {
|
|
95772
|
+
const suffix = `corrupt-${Date.now()}-${process.pid}`;
|
|
95773
|
+
for (const candidate of [path2, eventJournalDir(path2)]) {
|
|
95774
|
+
if ((0, import_node_fs27.existsSync)(candidate)) (0, import_node_fs27.renameSync)(candidate, `${candidate}.${suffix}`);
|
|
95775
|
+
}
|
|
95776
|
+
}
|
|
95679
95777
|
function createSandboxEventOutbox(input2) {
|
|
95680
95778
|
const path2 = input2.spoolPath ?? sandboxOutboxSpoolPath(input2.conversationId);
|
|
95681
|
-
const key =
|
|
95779
|
+
const key = loadOrCreateSandboxOutboxKey({
|
|
95780
|
+
spoolPath: path2,
|
|
95781
|
+
sessionToken: input2.sessionToken
|
|
95782
|
+
});
|
|
95682
95783
|
try {
|
|
95683
95784
|
return new EncryptedEventOutbox(path2, key, input2.pushLog, input2.options);
|
|
95684
95785
|
} catch (error61) {
|
|
95685
95786
|
input2.pushLog?.(
|
|
95686
|
-
`
|
|
95787
|
+
`sandbox_outbox_spool_quarantined ${error61 instanceof Error ? error61.message : String(error61)}`
|
|
95687
95788
|
);
|
|
95688
|
-
(
|
|
95689
|
-
(0, import_node_fs27.rmSync)(eventJournalDir(path2), { recursive: true, force: true });
|
|
95789
|
+
quarantineUnusableOutbox(path2);
|
|
95690
95790
|
return new EncryptedEventOutbox(path2, key, input2.pushLog, input2.options);
|
|
95691
95791
|
}
|
|
95692
95792
|
}
|
|
@@ -95758,6 +95858,10 @@ var SandboxEventDispatcher = class {
|
|
|
95758
95858
|
pendingCount() {
|
|
95759
95859
|
return this.outbox.pendingCount();
|
|
95760
95860
|
}
|
|
95861
|
+
/** Drain the async writer so a replacement process can recover the journal. */
|
|
95862
|
+
flushDurable() {
|
|
95863
|
+
return this.outbox.flushDurable();
|
|
95864
|
+
}
|
|
95761
95865
|
};
|
|
95762
95866
|
|
|
95763
95867
|
// src/ws-client.ts
|
|
@@ -96641,15 +96745,28 @@ function systemdArg(value2) {
|
|
|
96641
96745
|
function powershellLiteral(value2) {
|
|
96642
96746
|
return `'${value2.replaceAll("'", "''")}'`;
|
|
96643
96747
|
}
|
|
96748
|
+
function serviceNames(profile) {
|
|
96749
|
+
if (profile === "production") {
|
|
96750
|
+
return { launchd: SERVICE_LABEL, systemd: SYSTEMD_UNIT, windows: WINDOWS_TASK };
|
|
96751
|
+
}
|
|
96752
|
+
const suffix = profile === "custom" ? "prod" : profile;
|
|
96753
|
+
const title = `${suffix[0]?.toUpperCase()}${suffix.slice(1)}`;
|
|
96754
|
+
return {
|
|
96755
|
+
launchd: `${SERVICE_LABEL}.${suffix}`,
|
|
96756
|
+
systemd: `alan-agent-${suffix}.service`,
|
|
96757
|
+
windows: `${WINDOWS_TASK} ${title}`
|
|
96758
|
+
};
|
|
96759
|
+
}
|
|
96644
96760
|
function buildDaemonServicePlan(input2) {
|
|
96645
96761
|
const daemonArgs = [input2.nodeExecutable, input2.cliEntry, "daemon", "--profile", input2.profile];
|
|
96762
|
+
const names = serviceNames(input2.profile);
|
|
96646
96763
|
if (input2.platform === "darwin") {
|
|
96647
96764
|
const userId = input2.userId ?? process.getuid?.();
|
|
96648
96765
|
if (userId === void 0) throw new Error("Cannot determine the current macOS user ID");
|
|
96649
96766
|
const domain2 = `gui/${userId}`;
|
|
96650
|
-
const serviceTarget = `${domain2}/${
|
|
96651
|
-
const manifestPath = (0, import_node_path29.join)(input2.homeDir, "Library", "LaunchAgents", `${
|
|
96652
|
-
const logDir = (0, import_node_path29.join)(input2.
|
|
96767
|
+
const serviceTarget = `${domain2}/${names.launchd}`;
|
|
96768
|
+
const manifestPath = (0, import_node_path29.join)(input2.homeDir, "Library", "LaunchAgents", `${names.launchd}.plist`);
|
|
96769
|
+
const logDir = (0, import_node_path29.join)(resolveAgentConfigDirectory(input2.profile, input2.homeDir), "logs");
|
|
96653
96770
|
const programArguments = daemonArgs.map((arg) => ` <string>${xml(arg)}</string>`).join("\n");
|
|
96654
96771
|
const environmentEntries = Object.entries(input2.environment ?? {}).map(([key, value2]) => ` <key>${xml(key)}</key>
|
|
96655
96772
|
<string>${xml(value2)}</string>`).join("\n");
|
|
@@ -96663,7 +96780,7 @@ ${environmentEntries}
|
|
|
96663
96780
|
<plist version="1.0">
|
|
96664
96781
|
<dict>
|
|
96665
96782
|
<key>Label</key>
|
|
96666
|
-
<string>${
|
|
96783
|
+
<string>${names.launchd}</string>
|
|
96667
96784
|
<key>ProgramArguments</key>
|
|
96668
96785
|
<array>
|
|
96669
96786
|
${programArguments}
|
|
@@ -96688,6 +96805,7 @@ ${environmentBlock} <key>RunAtLoad</key>
|
|
|
96688
96805
|
platform: "darwin",
|
|
96689
96806
|
manifestPath,
|
|
96690
96807
|
manifest,
|
|
96808
|
+
logDirectory: logDir,
|
|
96691
96809
|
loadDefinitionCommands: [
|
|
96692
96810
|
{
|
|
96693
96811
|
command: "launchctl",
|
|
@@ -96695,6 +96813,18 @@ ${environmentBlock} <key>RunAtLoad</key>
|
|
|
96695
96813
|
tolerateFailure: true
|
|
96696
96814
|
}
|
|
96697
96815
|
],
|
|
96816
|
+
reloadDefinitionCommands: [
|
|
96817
|
+
{
|
|
96818
|
+
command: "launchctl",
|
|
96819
|
+
args: ["bootout", domain2, manifestPath],
|
|
96820
|
+
tolerateFailure: true
|
|
96821
|
+
},
|
|
96822
|
+
{
|
|
96823
|
+
command: "launchctl",
|
|
96824
|
+
args: ["bootstrap", domain2, manifestPath],
|
|
96825
|
+
tolerateFailure: false
|
|
96826
|
+
}
|
|
96827
|
+
],
|
|
96698
96828
|
enableCommands: [
|
|
96699
96829
|
{
|
|
96700
96830
|
command: "launchctl",
|
|
@@ -96754,7 +96884,7 @@ ${environmentBlock} <key>RunAtLoad</key>
|
|
|
96754
96884
|
};
|
|
96755
96885
|
}
|
|
96756
96886
|
if (input2.platform === "linux") {
|
|
96757
|
-
const manifestPath = (0, import_node_path29.join)(input2.homeDir, ".config", "systemd", "user",
|
|
96887
|
+
const manifestPath = (0, import_node_path29.join)(input2.homeDir, ".config", "systemd", "user", names.systemd);
|
|
96758
96888
|
const environmentLines = Object.entries(input2.environment ?? {}).map(([key, value2]) => `Environment=${systemdArg(`${key}=${value2}`)}`).join("\n");
|
|
96759
96889
|
const manifest = `[Unit]
|
|
96760
96890
|
Description=Alan local agent daemon
|
|
@@ -96777,6 +96907,7 @@ WantedBy=default.target
|
|
|
96777
96907
|
platform: "linux",
|
|
96778
96908
|
manifestPath,
|
|
96779
96909
|
manifest,
|
|
96910
|
+
logDirectory: null,
|
|
96780
96911
|
loadDefinitionCommands: [
|
|
96781
96912
|
{
|
|
96782
96913
|
command: "systemctl",
|
|
@@ -96784,24 +96915,31 @@ WantedBy=default.target
|
|
|
96784
96915
|
tolerateFailure: false
|
|
96785
96916
|
}
|
|
96786
96917
|
],
|
|
96918
|
+
reloadDefinitionCommands: [
|
|
96919
|
+
{
|
|
96920
|
+
command: "systemctl",
|
|
96921
|
+
args: ["--user", "daemon-reload"],
|
|
96922
|
+
tolerateFailure: false
|
|
96923
|
+
}
|
|
96924
|
+
],
|
|
96787
96925
|
enableCommands: [
|
|
96788
96926
|
{
|
|
96789
96927
|
command: "systemctl",
|
|
96790
|
-
args: ["--user", "enable",
|
|
96928
|
+
args: ["--user", "enable", names.systemd],
|
|
96791
96929
|
tolerateFailure: false
|
|
96792
96930
|
}
|
|
96793
96931
|
],
|
|
96794
96932
|
startCommands: [
|
|
96795
96933
|
{
|
|
96796
96934
|
command: "systemctl",
|
|
96797
|
-
args: ["--user", "start",
|
|
96935
|
+
args: ["--user", "start", names.systemd],
|
|
96798
96936
|
tolerateFailure: false
|
|
96799
96937
|
}
|
|
96800
96938
|
],
|
|
96801
96939
|
stopCommands: [
|
|
96802
96940
|
{
|
|
96803
96941
|
command: "systemctl",
|
|
96804
|
-
args: ["--user", "stop",
|
|
96942
|
+
args: ["--user", "stop", names.systemd],
|
|
96805
96943
|
tolerateFailure: true
|
|
96806
96944
|
}
|
|
96807
96945
|
],
|
|
@@ -96813,14 +96951,14 @@ WantedBy=default.target
|
|
|
96813
96951
|
},
|
|
96814
96952
|
{
|
|
96815
96953
|
command: "systemctl",
|
|
96816
|
-
args: ["--user", "restart",
|
|
96954
|
+
args: ["--user", "restart", names.systemd],
|
|
96817
96955
|
tolerateFailure: false
|
|
96818
96956
|
}
|
|
96819
96957
|
],
|
|
96820
96958
|
uninstallCommands: [
|
|
96821
96959
|
{
|
|
96822
96960
|
command: "systemctl",
|
|
96823
|
-
args: ["--user", "disable", "--now",
|
|
96961
|
+
args: ["--user", "disable", "--now", names.systemd],
|
|
96824
96962
|
tolerateFailure: true
|
|
96825
96963
|
},
|
|
96826
96964
|
{
|
|
@@ -96831,12 +96969,12 @@ WantedBy=default.target
|
|
|
96831
96969
|
],
|
|
96832
96970
|
statusCommand: {
|
|
96833
96971
|
command: "systemctl",
|
|
96834
|
-
args: ["--user", "status",
|
|
96972
|
+
args: ["--user", "status", names.systemd, "--no-pager"],
|
|
96835
96973
|
tolerateFailure: true
|
|
96836
96974
|
},
|
|
96837
96975
|
isActiveCommand: {
|
|
96838
96976
|
command: "systemctl",
|
|
96839
|
-
args: ["--user", "is-active",
|
|
96977
|
+
args: ["--user", "is-active", names.systemd],
|
|
96840
96978
|
tolerateFailure: true
|
|
96841
96979
|
},
|
|
96842
96980
|
lingerStatusCommand: {
|
|
@@ -96858,12 +96996,13 @@ WantedBy=default.target
|
|
|
96858
96996
|
"$trigger = New-ScheduledTaskTrigger -AtLogOn -User $currentUser",
|
|
96859
96997
|
"$principal = New-ScheduledTaskPrincipal -UserId $currentUser -LogonType Interactive -RunLevel Limited",
|
|
96860
96998
|
"$settings = New-ScheduledTaskSettingsSet -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1) -ExecutionTimeLimit ([TimeSpan]::Zero)",
|
|
96861
|
-
`Register-ScheduledTask -TaskName ${powershellLiteral(
|
|
96999
|
+
`Register-ScheduledTask -TaskName ${powershellLiteral(names.windows)} -Action $action -Trigger $trigger -Principal $principal -Settings $settings -Force | Out-Null`
|
|
96862
97000
|
].join("; ");
|
|
96863
97001
|
return {
|
|
96864
97002
|
platform: "win32",
|
|
96865
97003
|
manifestPath: null,
|
|
96866
97004
|
manifest: null,
|
|
97005
|
+
logDirectory: null,
|
|
96867
97006
|
loadDefinitionCommands: [
|
|
96868
97007
|
{
|
|
96869
97008
|
command: "powershell.exe",
|
|
@@ -96871,6 +97010,13 @@ WantedBy=default.target
|
|
|
96871
97010
|
tolerateFailure: false
|
|
96872
97011
|
}
|
|
96873
97012
|
],
|
|
97013
|
+
reloadDefinitionCommands: [
|
|
97014
|
+
{
|
|
97015
|
+
command: "powershell.exe",
|
|
97016
|
+
args: ["-NoProfile", "-NonInteractive", "-Command", registerScript],
|
|
97017
|
+
tolerateFailure: false
|
|
97018
|
+
}
|
|
97019
|
+
],
|
|
96874
97020
|
enableCommands: [],
|
|
96875
97021
|
startCommands: [
|
|
96876
97022
|
{
|
|
@@ -96879,7 +97025,7 @@ WantedBy=default.target
|
|
|
96879
97025
|
"-NoProfile",
|
|
96880
97026
|
"-NonInteractive",
|
|
96881
97027
|
"-Command",
|
|
96882
|
-
`Start-ScheduledTask -TaskName ${powershellLiteral(
|
|
97028
|
+
`Start-ScheduledTask -TaskName ${powershellLiteral(names.windows)}`
|
|
96883
97029
|
],
|
|
96884
97030
|
tolerateFailure: false
|
|
96885
97031
|
}
|
|
@@ -96891,7 +97037,7 @@ WantedBy=default.target
|
|
|
96891
97037
|
"-NoProfile",
|
|
96892
97038
|
"-NonInteractive",
|
|
96893
97039
|
"-Command",
|
|
96894
|
-
`Stop-ScheduledTask -TaskName ${powershellLiteral(
|
|
97040
|
+
`Stop-ScheduledTask -TaskName ${powershellLiteral(names.windows)} -ErrorAction SilentlyContinue`
|
|
96895
97041
|
],
|
|
96896
97042
|
tolerateFailure: true
|
|
96897
97043
|
}
|
|
@@ -96903,7 +97049,7 @@ WantedBy=default.target
|
|
|
96903
97049
|
"-NoProfile",
|
|
96904
97050
|
"-NonInteractive",
|
|
96905
97051
|
"-Command",
|
|
96906
|
-
`${registerScript}; Start-ScheduledTask -TaskName ${powershellLiteral(
|
|
97052
|
+
`${registerScript}; Start-ScheduledTask -TaskName ${powershellLiteral(names.windows)}`
|
|
96907
97053
|
],
|
|
96908
97054
|
tolerateFailure: false
|
|
96909
97055
|
}
|
|
@@ -96915,7 +97061,7 @@ WantedBy=default.target
|
|
|
96915
97061
|
"-NoProfile",
|
|
96916
97062
|
"-NonInteractive",
|
|
96917
97063
|
"-Command",
|
|
96918
|
-
`Unregister-ScheduledTask -TaskName ${powershellLiteral(
|
|
97064
|
+
`Unregister-ScheduledTask -TaskName ${powershellLiteral(names.windows)} -Confirm:$false -ErrorAction SilentlyContinue`
|
|
96919
97065
|
],
|
|
96920
97066
|
tolerateFailure: true
|
|
96921
97067
|
}
|
|
@@ -96926,7 +97072,7 @@ WantedBy=default.target
|
|
|
96926
97072
|
"-NoProfile",
|
|
96927
97073
|
"-NonInteractive",
|
|
96928
97074
|
"-Command",
|
|
96929
|
-
`Get-ScheduledTask -TaskName ${powershellLiteral(
|
|
97075
|
+
`Get-ScheduledTask -TaskName ${powershellLiteral(names.windows)} | Format-List TaskName,State`
|
|
96930
97076
|
],
|
|
96931
97077
|
tolerateFailure: true
|
|
96932
97078
|
},
|
|
@@ -96936,7 +97082,7 @@ WantedBy=default.target
|
|
|
96936
97082
|
"-NoProfile",
|
|
96937
97083
|
"-NonInteractive",
|
|
96938
97084
|
"-Command",
|
|
96939
|
-
`(Get-ScheduledTask -TaskName ${powershellLiteral(
|
|
97085
|
+
`(Get-ScheduledTask -TaskName ${powershellLiteral(names.windows)} -ErrorAction SilentlyContinue).State`
|
|
96940
97086
|
],
|
|
96941
97087
|
tolerateFailure: true
|
|
96942
97088
|
},
|
|
@@ -97075,9 +97221,7 @@ function createHostContext(options = {}) {
|
|
|
97075
97221
|
const writeManifest = options.writeManifest ?? writeManifestAtomic;
|
|
97076
97222
|
const removeManifest = options.removeManifest ?? ((path2) => (0, import_node_fs28.rmSync)(path2, { force: true }));
|
|
97077
97223
|
const ensureLogDir = options.ensureLogDir ?? (() => {
|
|
97078
|
-
if (plan.
|
|
97079
|
-
(0, import_node_fs28.mkdirSync)((0, import_node_path29.join)((0, import_node_os18.homedir)(), ".alan", "agent", "logs"), { recursive: true, mode: 448 });
|
|
97080
|
-
}
|
|
97224
|
+
if (plan.logDirectory) (0, import_node_fs28.mkdirSync)(plan.logDirectory, { recursive: true, mode: 448 });
|
|
97081
97225
|
});
|
|
97082
97226
|
return {
|
|
97083
97227
|
args,
|
|
@@ -97125,7 +97269,11 @@ function ensureDaemonServiceDefinition(options = {}) {
|
|
|
97125
97269
|
if (outcome.updatePending) {
|
|
97126
97270
|
return outcome;
|
|
97127
97271
|
}
|
|
97128
|
-
|
|
97272
|
+
if (inspection.state === "running" || inspection.state === "starting") {
|
|
97273
|
+
return outcome;
|
|
97274
|
+
}
|
|
97275
|
+
const definitionCommands = inspection.state === "stopped" ? plan.reloadDefinitionCommands : plan.loadDefinitionCommands;
|
|
97276
|
+
for (const command of definitionCommands) run(command);
|
|
97129
97277
|
return outcome;
|
|
97130
97278
|
}
|
|
97131
97279
|
function enableDaemonService(options = {}) {
|
|
@@ -97390,11 +97538,10 @@ async function main() {
|
|
|
97390
97538
|
if (command === "install") {
|
|
97391
97539
|
bindConfigPath(commandArgs);
|
|
97392
97540
|
const configured = readConfig();
|
|
97393
|
-
|
|
97394
|
-
|
|
97395
|
-
|
|
97396
|
-
|
|
97397
|
-
installDaemonService(commandArgs);
|
|
97541
|
+
const configurationMode = resolveInstallConfigurationMode(commandArgs, configured);
|
|
97542
|
+
const setup = configurationMode === "setup" ? await setupDaemon(commandArgs) : null;
|
|
97543
|
+
if (configurationMode === "login") await loginWithDeviceCode(commandArgs);
|
|
97544
|
+
if (!setup?.daemonAlreadyRunning) installDaemonService(commandArgs);
|
|
97398
97545
|
runMcpIntegrationCommand(["reconcile", ...commandArgs]);
|
|
97399
97546
|
return;
|
|
97400
97547
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"binding-switch-git.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/binding-switch-git.test.ts"],"names":[],"mappings":""}
|