@themoltnet/agent-daemon 0.63.0 → 0.63.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/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGzD,wBAAsB,iBAAiB,CAAC,OAAO,EAAE;IAC/C,OAAO,EAAE,oBAAoB,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,GAAG,OAAO,CAAC,MAAM,CAAC,CA+ClB"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGzD,wBAAsB,iBAAiB,CAAC,OAAO,EAAE;IAC/C,OAAO,EAAE,oBAAoB,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyDlB"}
package/dist/cli.js CHANGED
@@ -3758,8 +3758,11 @@ async function resolveSelectionApiUrl(agentName, options) {
3758
3758
  * sprinkling string lookups across the codebase.
3759
3759
  */
3760
3760
  /** All daemon commands announce the same legacy alias policy as Go and Desktop. */
3761
+ function markLegacyStoreNoticeShown() {
3762
+ process.env["MOLTNET_LEGACY_STORE_NOTICE_SHOWN"] = "1";
3763
+ }
3761
3764
  function legacyStoreNotice() {
3762
- return process.env["MOLTNET_AGENT_SERVER_ROOT"] !== void 0 ? "MOLTNET_AGENT_SERVER_ROOT is deprecated; use MOLTNET_HOME. Both select the entire store; no data is migrated." : void 0;
3765
+ return process.env["MOLTNET_AGENT_SERVER_ROOT"] !== void 0 && process.env["MOLTNET_LEGACY_STORE_NOTICE_SHOWN"] !== "1" ? "MOLTNET_AGENT_SERVER_ROOT is deprecated; use MOLTNET_HOME. Both select the entire store; no data is migrated." : void 0;
3763
3766
  }
3764
3767
  function loadConfig() {
3765
3768
  assertSingleCredentialForm("MOLTNET_AGENT_KEY", "MOLTNET_AGENT_KEY_REF");
@@ -4169,7 +4172,9 @@ Example:
4169
4172
  --agent legreffier \\
4170
4173
  --state idle`;
4171
4174
  function isHelpFlag(args) {
4172
- return args.includes("--help") || args.includes("-h");
4175
+ const separator = args.indexOf("--");
4176
+ const flags = separator === -1 ? args : args.slice(0, separator);
4177
+ return flags.includes("--help") || flags.includes("-h");
4173
4178
  }
4174
4179
  var AGENT_SERVER_HELP = `\
4175
4180
  agent-daemon server — local supervisor for managed runs.
@@ -12727,7 +12732,7 @@ function corsHeadersFor(request, options) {
12727
12732
  return {};
12728
12733
  }
12729
12734
  function isConfiguredOrigin(origin, options) {
12730
- return typeof origin === "string" && (origin === "moltnet-agent-desktop://native" || options.allowedOrigins.includes(origin) || origin === options.selfOrigin);
12735
+ return typeof origin === "string" && (origin === "moltnet-agent-desktop://native" || !options.nativeOnly && (options.allowedOrigins.includes(origin) || origin === options.selfOrigin));
12731
12736
  }
12732
12737
  function normalizeAgentServerError(error) {
12733
12738
  if (error instanceof TeamCredentialError) return {
@@ -12866,6 +12871,7 @@ async function runAgentServer(argv) {
12866
12871
  name: "agent-daemon.server",
12867
12872
  level: envConfig.logLevel || "info"
12868
12873
  });
12874
+ const shutdownDisposers = [];
12869
12875
  try {
12870
12876
  try {
12871
12877
  return await withAgentServerLock(settingsRoot, async () => {
@@ -12952,7 +12958,7 @@ async function runAgentServer(argv) {
12952
12958
  else console.error(`allowed origins: ${allowedOrigins.join(", ")}`);
12953
12959
  if (nativeClient) console.error("native desktop client: authorized");
12954
12960
  if (!nativeSocket) console.error("Connect from an allowed local-control client after operator authorization.");
12955
- return await waitForAgentServerShutdown(runs, app, shutdownController, Boolean(values.supervised));
12961
+ return await waitForAgentServerShutdown(runs, app, shutdownController, Boolean(values.supervised), (dispose) => shutdownDisposers.push(dispose));
12956
12962
  } catch (cause) {
12957
12963
  await app.close().catch(() => void 0);
12958
12964
  throw cause;
@@ -12975,10 +12981,14 @@ async function runAgentServer(argv) {
12975
12981
  throw cause;
12976
12982
  }
12977
12983
  } finally {
12978
- await shutdownLogger();
12984
+ try {
12985
+ await shutdownLogger();
12986
+ } finally {
12987
+ for (const dispose of shutdownDisposers) dispose();
12988
+ }
12979
12989
  }
12980
12990
  }
12981
- function waitForAgentServerShutdown(runs, app, shutdownController, supervised) {
12991
+ function waitForAgentServerShutdown(runs, app, shutdownController, supervised, registerDisposer) {
12982
12992
  return new Promise((resolvePromise) => {
12983
12993
  let shuttingDown = false;
12984
12994
  const shutdown = (source) => {
@@ -13009,8 +13019,6 @@ function waitForAgentServerShutdown(runs, app, shutdownController, supervised) {
13009
13019
  if (forcedExitTimer) clearTimeout(forcedExitTimer);
13010
13020
  const failures = results.filter((result) => result.status === "rejected");
13011
13021
  for (const failure of failures) console.error(`shutdown cleanup failed: ${failure.reason.message}`);
13012
- handlers.dispose();
13013
- stdinGuard.dispose();
13014
13022
  const exitCode = typeof process.exitCode === "number" ? process.exitCode : 0;
13015
13023
  resolvePromise(failures.length > 0 ? 1 : exitCode);
13016
13024
  })();
@@ -13023,6 +13031,10 @@ function waitForAgentServerShutdown(runs, app, shutdownController, supervised) {
13023
13031
  enabled: supervised,
13024
13032
  shutdown: () => shutdown("stdin")
13025
13033
  });
13034
+ registerDisposer(() => {
13035
+ handlers.dispose();
13036
+ stdinGuard.dispose();
13037
+ });
13026
13038
  });
13027
13039
  }
13028
13040
  /** Makes the supervising process's stdin pipe part of the server lifecycle. */
@@ -13391,13 +13403,24 @@ async function writeCache(cache) {
13391
13403
  }
13392
13404
  //#endregion
13393
13405
  //#region src/version.ts
13394
- var DAEMON_VERSION = "0.63.0";
13406
+ var DAEMON_VERSION = "0.63.1";
13395
13407
  //#endregion
13396
13408
  //#region src/cli.ts
13397
13409
  async function runAgentDaemonCli(options) {
13398
- const notice = legacyStoreNotice();
13399
- if (notice) console.error(notice);
13400
13410
  const [subcommand, ...rest] = options.argv ?? process.argv.slice(2);
13411
+ const help = subcommand === "--help" || subcommand === "-h" || [
13412
+ "poll",
13413
+ "drain",
13414
+ "once",
13415
+ "server",
13416
+ "providers",
13417
+ "sync-sessions"
13418
+ ].includes(subcommand ?? "") && isHelpFlag(rest);
13419
+ const notice = legacyStoreNotice();
13420
+ if (notice && !help) {
13421
+ console.error(notice);
13422
+ markLegacyStoreNoticeShown();
13423
+ }
13401
13424
  if (["poll", "drain"].includes(subcommand ?? "") && !isWorkspaceInvocation()) checkDaemonUpdate({ currentVersion: DAEMON_VERSION }).then((update) => {
13402
13425
  if (update.updateAvailable) pino({ name: "moltnet.agent-daemon" }).info({
13403
13426
  event: "agent-daemon.update_available",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@themoltnet/agent-daemon",
3
- "version": "0.63.0",
3
+ "version": "0.63.1",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "description": "Universal MoltNet agent daemon host with a built-in Pi/Gondolin runtime and support for trusted operator-owned runtime modules. CLI: moltnet-agent.",
@@ -84,10 +84,10 @@
84
84
  "pino-pretty": "^13.1.3",
85
85
  "proper-lockfile": "4.1.2",
86
86
  "typebox": "^1.2.8",
87
+ "@themoltnet/os-keyring": "0.4.0",
87
88
  "@themoltnet/agent-runtime": "1.3.0",
88
89
  "@themoltnet/pi-runtime": "0.18.3",
89
- "@themoltnet/sdk": "0.145.0",
90
- "@themoltnet/os-keyring": "0.4.0"
90
+ "@themoltnet/sdk": "0.145.0"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@fastify/swagger": "^9.6.1",
@@ -98,15 +98,15 @@
98
98
  "vite-plugin-dts": "^4.5.4",
99
99
  "vitest": "^3.0.0",
100
100
  "@moltnet/agent-eval": "0.1.0",
101
- "@moltnet/api-client": "0.1.0",
102
101
  "@moltnet/crypto-service": "0.1.0",
103
102
  "@moltnet/execution-integrations": "0.1.0",
104
- "@moltnet/execution-plan": "0.1.0",
105
103
  "@moltnet/loopback-companion": "0.1.0",
106
104
  "@moltnet/bootstrap": "0.1.0",
105
+ "@moltnet/api-client": "0.1.0",
107
106
  "@moltnet/models": "0.1.0",
108
- "@moltnet/observability": "0.1.0",
107
+ "@moltnet/execution-plan": "0.1.0",
109
108
  "@moltnet/runtime-profiles": "0.1.0",
109
+ "@moltnet/observability": "0.1.0",
110
110
  "@moltnet/tasks": "0.1.0"
111
111
  },
112
112
  "nx": {