dsh-cliworker-now 0.7.6 → 0.7.7

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.
Files changed (144) hide show
  1. package/README.en.md +29 -9
  2. package/README.md +31 -9
  3. package/lib/account-models.mjs +16 -13
  4. package/lib/client.js +658 -61
  5. package/lib/client.js.map +1 -1
  6. package/lib/grok-catalog.mjs +2 -2
  7. package/lib/hermes-native-entry.py +48 -13
  8. package/lib/hermes-nous-refresh.py +331 -0
  9. package/lib/index.js +3724 -1589
  10. package/lib/index.js.map +1 -1
  11. package/lib/native-launch.mjs +62 -7
  12. package/lib/native-spawn.mjs +32 -0
  13. package/lib/pi-installation.mjs +27 -3
  14. package/lib/pi-native-catalog.mjs +2 -2
  15. package/lib/pi-omp-bridge.mjs +2 -2
  16. package/lib/private-launch.mjs +6 -2
  17. package/lib/terminal-bridge.mjs +2 -2
  18. package/lib/typert.host.js +83 -11
  19. package/lib/typert.remote-client.d.ts +2 -0
  20. package/lib/typert.remote-client.d.ts.map +1 -1
  21. package/lib/typert.remote-client.js +77 -11
  22. package/lib/types/client/account-query-queue.d.ts +16 -0
  23. package/lib/types/client/account-query-queue.js +61 -0
  24. package/lib/types/client/account-query-queue.js.map +1 -0
  25. package/lib/types/client/account-terminal.d.ts +6 -2
  26. package/lib/types/client/account-terminal.js +260 -31
  27. package/lib/types/client/account-terminal.js.map +1 -1
  28. package/lib/types/client/settings-dialog.js +65 -38
  29. package/lib/types/client/settings-dialog.js.map +1 -1
  30. package/lib/types/client/zcode-login-link-provider.d.ts +9 -0
  31. package/lib/types/client/zcode-login-link-provider.js +105 -0
  32. package/lib/types/client/zcode-login-link-provider.js.map +1 -0
  33. package/lib/types/client/zcode-login-link.d.ts +16 -0
  34. package/lib/types/client/zcode-login-link.js +194 -0
  35. package/lib/types/client/zcode-login-link.js.map +1 -0
  36. package/lib/types/host/account-models.d.mts +3 -1
  37. package/lib/types/host/account-models.mjs +16 -13
  38. package/lib/types/host/accounts.d.ts +3 -2
  39. package/lib/types/host/accounts.js +129 -22
  40. package/lib/types/host/accounts.js.map +1 -1
  41. package/lib/types/host/adapters.d.ts +1 -1
  42. package/lib/types/host/adapters.js +60 -11
  43. package/lib/types/host/adapters.js.map +1 -1
  44. package/lib/types/host/agy-models.d.ts +2 -1
  45. package/lib/types/host/agy-models.js +6 -6
  46. package/lib/types/host/agy-models.js.map +1 -1
  47. package/lib/types/host/agy-windows-account.d.ts +14 -0
  48. package/lib/types/host/agy-windows-account.js +104 -0
  49. package/lib/types/host/agy-windows-account.js.map +1 -0
  50. package/lib/types/host/authorized-catalog.js +13 -4
  51. package/lib/types/host/authorized-catalog.js.map +1 -1
  52. package/lib/types/host/claude-native-oauth.d.ts +17 -0
  53. package/lib/types/host/claude-native-oauth.js +272 -0
  54. package/lib/types/host/claude-native-oauth.js.map +1 -0
  55. package/lib/types/host/claude-own-route.d.ts +33 -0
  56. package/lib/types/host/claude-own-route.js +250 -0
  57. package/lib/types/host/claude-own-route.js.map +1 -0
  58. package/lib/types/host/cli-account-binding.d.ts +2 -1
  59. package/lib/types/host/cli-account-binding.js +59 -21
  60. package/lib/types/host/cli-account-binding.js.map +1 -1
  61. package/lib/types/host/codex-models.js +4 -0
  62. package/lib/types/host/codex-models.js.map +1 -1
  63. package/lib/types/host/extended-adapters.d.ts +3 -2
  64. package/lib/types/host/extended-adapters.js +9 -7
  65. package/lib/types/host/extended-adapters.js.map +1 -1
  66. package/lib/types/host/first-party-models.d.ts +1 -0
  67. package/lib/types/host/first-party-models.js +136 -47
  68. package/lib/types/host/first-party-models.js.map +1 -1
  69. package/lib/types/host/hermes-accounts.js +15 -1
  70. package/lib/types/host/hermes-accounts.js.map +1 -1
  71. package/lib/types/host/hermes-adapter.d.ts +3 -0
  72. package/lib/types/host/hermes-adapter.js +13 -4
  73. package/lib/types/host/hermes-adapter.js.map +1 -1
  74. package/lib/types/host/hermes-installation.js +54 -35
  75. package/lib/types/host/hermes-installation.js.map +1 -1
  76. package/lib/types/host/hermes-native-entry.py +48 -13
  77. package/lib/types/host/hermes-nous-refresh.py +331 -0
  78. package/lib/types/host/hermes-nous.d.ts +5 -1
  79. package/lib/types/host/hermes-nous.js +5 -5
  80. package/lib/types/host/hermes-nous.js.map +1 -1
  81. package/lib/types/host/hermes-renewal.d.ts +27 -0
  82. package/lib/types/host/hermes-renewal.js +292 -0
  83. package/lib/types/host/hermes-renewal.js.map +1 -0
  84. package/lib/types/host/hermes-windows-installation.d.ts +5 -0
  85. package/lib/types/host/hermes-windows-installation.js +91 -0
  86. package/lib/types/host/hermes-windows-installation.js.map +1 -0
  87. package/lib/types/host/index.d.ts +2 -0
  88. package/lib/types/host/index.js +17 -2
  89. package/lib/types/host/index.js.map +1 -1
  90. package/lib/types/host/kimi-accounts.d.ts +2 -0
  91. package/lib/types/host/kimi-accounts.js +4 -2
  92. package/lib/types/host/kimi-accounts.js.map +1 -1
  93. package/lib/types/host/kimi-oauth-models.d.ts +14 -0
  94. package/lib/types/host/kimi-oauth-models.js +246 -0
  95. package/lib/types/host/kimi-oauth-models.js.map +1 -0
  96. package/lib/types/host/mimo-metadata-cache.d.ts +22 -0
  97. package/lib/types/host/mimo-metadata-cache.js +121 -0
  98. package/lib/types/host/mimo-metadata-cache.js.map +1 -0
  99. package/lib/types/host/native-capability-cache.d.ts +11 -0
  100. package/lib/types/host/native-capability-cache.js +94 -0
  101. package/lib/types/host/native-capability-cache.js.map +1 -0
  102. package/lib/types/host/native-launch.mjs +62 -7
  103. package/lib/types/host/native-process.d.ts +3 -1
  104. package/lib/types/host/native-process.js +18 -3
  105. package/lib/types/host/native-process.js.map +1 -1
  106. package/lib/types/host/native-spawn.mjs +32 -0
  107. package/lib/types/host/pi-installation.d.mts +1 -1
  108. package/lib/types/host/pi-installation.mjs +27 -3
  109. package/lib/types/host/pi-omp-adapter.js +15 -1
  110. package/lib/types/host/pi-omp-adapter.js.map +1 -1
  111. package/lib/types/host/private-launch.mjs +23 -0
  112. package/lib/types/host/routing.js +25 -2
  113. package/lib/types/host/routing.js.map +1 -1
  114. package/lib/types/host/runtime.js +17 -5
  115. package/lib/types/host/runtime.js.map +1 -1
  116. package/lib/types/host/windows-account-bootstrap.ps1 +44 -0
  117. package/lib/types/host/windows-account-launch.mjs +47 -0
  118. package/lib/types/host/windows-account-owner.ps1 +137 -0
  119. package/lib/types/host/windows-account-stdio.mjs +19 -0
  120. package/lib/types/host/windows-account-terminal.d.ts +17 -0
  121. package/lib/types/host/windows-account-terminal.js +208 -0
  122. package/lib/types/host/windows-account-terminal.js.map +1 -0
  123. package/lib/types/host/windows-agy-account.ps1 +81 -0
  124. package/lib/types/host/windows-cli-installation.d.ts +31 -0
  125. package/lib/types/host/windows-cli-installation.js +157 -0
  126. package/lib/types/host/windows-cli-installation.js.map +1 -0
  127. package/lib/types/host/windows-hidden-launch.mjs +49 -0
  128. package/lib/types/host/windows-hidden-process.d.ts +12 -0
  129. package/lib/types/host/windows-hidden-process.js +116 -0
  130. package/lib/types/host/windows-hidden-process.js.map +1 -0
  131. package/lib/types/host/zcode-adapter.js +5 -1
  132. package/lib/types/host/zcode-adapter.js.map +1 -1
  133. package/lib/types/host/zcode-grok-accounts.d.ts +3 -1
  134. package/lib/types/host/zcode-grok-accounts.js +60 -11
  135. package/lib/types/host/zcode-grok-accounts.js.map +1 -1
  136. package/lib/types/shared/accounts.d.ts +4 -0
  137. package/lib/windows-account-bootstrap.ps1 +44 -0
  138. package/lib/windows-account-launch.mjs +47 -0
  139. package/lib/windows-account-owner.ps1 +137 -0
  140. package/lib/windows-account-stdio.mjs +19 -0
  141. package/lib/windows-agy-account.ps1 +81 -0
  142. package/lib/windows-hidden-launch.mjs +49 -0
  143. package/lib/zcode-resume.mjs +2 -2
  144. package/package.json +1 -1
@@ -4,6 +4,7 @@ import { createHash } from 'node:crypto';
4
4
  import { dirname, join, sep } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { nativeLaunchArgv } from './native-launch.mjs';
7
+ import { windowsHermesCheckout } from "./hermes-windows-installation.js";
7
8
  export class HermesExecutableError extends Error {
8
9
  }
9
10
  export function hermesCommandInstallationHome(argv) {
@@ -16,15 +17,6 @@ export function hermesCommandInstallationHome(argv) {
16
17
  * the installer's borrowed-home sync. Older/self-contained entries retain their
17
18
  * native launcher contract. The child rechecks this selection under its native lock. */
18
19
  export async function hermesNativeCommand(executable, args, signal) {
19
- // The official Windows distlib exe selects the recorded store Python itself.
20
- // Its fixed fallback cmd is decoded as data, never interpreted by cmd.exe.
21
- // Keep bootstrap and update/lease behavior owned by the installed CLI.
22
- if (process.platform === 'win32') {
23
- signal?.throwIfAborted();
24
- const command = nativeLaunchArgv([executable, ...args]);
25
- await access(command[0], constants.R_OK);
26
- return command;
27
- }
28
20
  let current = executable;
29
21
  const read = async (path, limit) => {
30
22
  const file = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
@@ -42,29 +34,7 @@ export async function hermesNativeCommand(executable, args, signal) {
42
34
  await file.close();
43
35
  }
44
36
  };
45
- for (let depth = 0; depth < 4; depth++) {
46
- signal?.throwIfAborted();
47
- let path, source;
48
- try {
49
- path = await realpath(current);
50
- source = await read(path, 128 * 1024);
51
- }
52
- catch (error) {
53
- signal?.throwIfAborted();
54
- if (error.code === 'ENOENT')
55
- return [executable, ...args];
56
- throw new HermesExecutableError('启动入口不可用,请修复安装');
57
- }
58
- const shim = /^#![^\r\n]*\b(?:sh|bash|zsh)\s*\r?\n\s*exec\s+(?:"(\/[^"\r\n$`]+)"|(\/[^\s$`"'\\;|&<>]+))\s+"\$@"\s*$/.exec(source);
59
- if (shim) {
60
- current = shim[1] ?? shim[2];
61
- continue;
62
- }
63
- if (!path.endsWith(`${sep}.hermes${sep}bin${sep}hermes`) || !source.includes('hermes_bootstrap'))
64
- return [executable, ...args];
65
- const checkout = dirname(dirname(dirname(path)));
66
- if (!source.includes(checkout))
67
- throw new HermesExecutableError('Hermes 安装入口与源码不匹配');
37
+ const pinned = async (checkout) => {
68
38
  const owner = dirname(checkout), key = createHash('sha256').update(checkout).digest('hex').slice(0, 16);
69
39
  const install = join(owner, 'installs', key), facts = join(install, 'facts.json');
70
40
  try {
@@ -75,11 +45,17 @@ export async function hermesNativeCommand(executable, args, signal) {
75
45
  (await realpath(environment)) !== environment)
76
46
  throw new Error('Invalid Hermes dependency selection');
77
47
  await read(join(environment, 'pyvenv.cfg'), 64 * 1024);
78
- await access(join(environment, 'bin/python'), constants.X_OK);
79
- for (const file of ['hermes_bootstrap.py', 'hermes_cli/main.py', 'pm/environments.py'])
48
+ const python = join(environment, ...(process.platform === 'win32' ? ['Scripts', 'python.exe'] : ['bin', 'python']));
49
+ await access(python, process.platform === 'win32' ? constants.R_OK : constants.X_OK);
50
+ for (const file of [
51
+ 'hermes_bootstrap.py',
52
+ 'hermes_cli/main.py',
53
+ 'pm/environments.py',
54
+ ...(process.platform === 'win32' ? ['pm/filesystem.py'] : []),
55
+ ])
80
56
  await access(join(checkout, file), constants.R_OK);
81
57
  return [
82
- join(environment, 'bin/python'),
58
+ python,
83
59
  '-I',
84
60
  fileURLToPath(new URL('./hermes-native-entry.py', import.meta.url)),
85
61
  checkout,
@@ -92,6 +68,49 @@ export async function hermesNativeCommand(executable, args, signal) {
92
68
  signal?.throwIfAborted();
93
69
  throw new HermesExecutableError('Hermes 当前安装依赖不可用,请在原生终端修复安装');
94
70
  }
71
+ };
72
+ if (process.platform === 'win32') {
73
+ signal?.throwIfAborted();
74
+ try {
75
+ const command = nativeLaunchArgv([executable, ...args]);
76
+ await access(command[0], constants.R_OK);
77
+ const checkout = await windowsHermesCheckout(executable, command, signal);
78
+ // A native source-install launcher records its checkout. Pin that install's
79
+ // committed venv while retaining the isolated HERMES_HOME. Other native
80
+ // installations keep their own launch contract; never guess a generation.
81
+ return checkout ? await pinned(checkout) : command;
82
+ }
83
+ catch (error) {
84
+ signal?.throwIfAborted();
85
+ if (error instanceof HermesExecutableError)
86
+ throw error;
87
+ throw new HermesExecutableError('启动入口不可用,请修复安装');
88
+ }
89
+ }
90
+ for (let depth = 0; depth < 4; depth++) {
91
+ signal?.throwIfAborted();
92
+ let path, source;
93
+ try {
94
+ path = await realpath(current);
95
+ source = await read(path, 128 * 1024);
96
+ }
97
+ catch (error) {
98
+ signal?.throwIfAborted();
99
+ if (error.code === 'ENOENT')
100
+ return [executable, ...args];
101
+ throw new HermesExecutableError('启动入口不可用,请修复安装');
102
+ }
103
+ const shim = /^#![^\r\n]*\b(?:sh|bash|zsh)\s*\r?\n\s*exec\s+(?:"(\/[^"\r\n$`]+)"|(\/[^\s$`"'\\;|&<>]+))\s+"\$@"\s*$/.exec(source);
104
+ if (shim) {
105
+ current = shim[1] ?? shim[2];
106
+ continue;
107
+ }
108
+ if (!path.endsWith(`${sep}.hermes${sep}bin${sep}hermes`) || !source.includes('hermes_bootstrap'))
109
+ return [executable, ...args];
110
+ const checkout = dirname(dirname(dirname(path)));
111
+ if (!source.includes(checkout))
112
+ throw new HermesExecutableError('Hermes 安装入口与源码不匹配');
113
+ return pinned(checkout);
95
114
  }
96
115
  throw new HermesExecutableError('启动脚本异常,请修复安装');
97
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hermes-installation.js","sourceRoot":"","sources":["../../../src/host/hermes-installation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,MAAM,OAAO,qBAAsB,SAAQ,KAAK;CAAG;AAEnD,MAAM,UAAU,6BAA6B,CAAC,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AC,wCAAwC,CAAC,CAAA;gBAC3D,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;YACxD,CAAC;oBAAS,CAAC;gBACT,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACf,CAAC;YACD,MAAM,CAAC,cAAc,EAAE,CAAA;YACvB,MAAM,IAAI,GACR,uGAAuG,CAAC,IAAI,CAC1G,MAAM,CACP,CAAA;YACH,IAAI,CAAC,IAAI;gBAAE,OAAM;YACjB,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAE,CAAA;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,CAAC,cAAc,EAAE,CAAA;YACvB,MAAM,IAAI,qBAAqB,CAAC,eAAe,CAAC,CAAA;QAClD,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,EAAE,KAAK,EAAE,CAAA;QACrB,CAAC;IACH,CAAC;IACD,MAAM,IAAI,qBAAqB,CAAC,cAAc,CAAC,CAAA;AACjD,CAAC"}
@@ -4,35 +4,53 @@ The official launcher, checkout-derived install key and committed facts are chec
4
4
  Host. Recheck facts under the same install lock, then use Hermes' own generation lease.
5
5
  No account/config content is copied, imported from another home, or printed here.
6
6
  """
7
- import fcntl
8
7
  import json
9
8
  import os
10
9
  from pathlib import Path
10
+ import contextlib
11
+ import logging
12
+ import runpy
11
13
  import stat
12
14
  import sys
13
15
 
14
16
  checkout, facts, environment = map(Path, sys.argv[1:4])
15
17
  arguments = sys.argv[4:]
16
- if any(path.resolve() != path for path in (checkout, facts, environment)):
17
- raise SystemExit("Hermes installation changed; reopen login settings")
18
18
 
19
19
  def selected():
20
- fd = os.open(facts, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK)
21
- with os.fdopen(fd) as stream:
20
+ if facts.is_symlink():
21
+ raise RuntimeError("Invalid Hermes installation record")
22
+ fd = os.open(facts, os.O_RDONLY | getattr(os, "O_NOFOLLOW", 0) | getattr(os, "O_NONBLOCK", 0))
23
+ with os.fdopen(fd, encoding="utf-8-sig") as stream:
22
24
  info = os.fstat(stream.fileno())
23
25
  if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1 or info.st_size > 4 * 1024 * 1024:
24
26
  raise RuntimeError("Invalid Hermes installation record")
25
27
  return json.load(stream).get("packages", {}).get("venv", {}).get("environment") == str(environment)
26
28
 
27
- release = None
28
- try:
29
+ def run_entry():
30
+ release_holder = []
31
+ try:
32
+ return enter(release_holder)
33
+ finally:
34
+ for release in release_holder:
35
+ release()
36
+
37
+
38
+ def enter(release_holder):
39
+ if any(path.resolve() != path for path in (checkout, facts, environment)):
40
+ raise RuntimeError("Hermes installation changed; reopen login settings")
41
+ sys.path.insert(0, str(checkout))
29
42
  with open(facts.parent / ".install.lock", "a+b") as lock:
30
- fcntl.flock(lock.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB)
43
+ if os.name == "nt":
44
+ from pm.filesystem import lock_fd
45
+ if not lock_fd(lock.fileno(), wait=False):
46
+ raise RuntimeError("Hermes installation is being updated; retry after it finishes")
47
+ else:
48
+ import fcntl
49
+ fcntl.flock(lock.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB)
31
50
  if not selected():
32
51
  raise RuntimeError("Hermes installation changed; reopen login settings")
33
- sys.path.insert(0, str(checkout))
34
52
  from hermes_cli.runtime_state import lease_generation
35
- release = lease_generation(environment)
53
+ release_holder.append(lease_generation(environment))
36
54
  os.environ["HERMES_DISABLE_LAZY_INSTALLS"] = "1"
37
55
  os.environ.pop("PYTHONHOME", None)
38
56
  os.environ.pop("PYTHONPATH", None)
@@ -54,8 +72,25 @@ try:
54
72
  raise RuntimeError("Hermes plugin login supports its own .env; external secret stores are unavailable")
55
73
  return native_dotenv(hermes_home=account_home, project_env=None, load_external_secrets=False)
56
74
  env_loader.load_hermes_dotenv = own_dotenv
75
+ if arguments and arguments[0].startswith("--cliworker-"):
76
+ if len(arguments) != 2 or arguments[0] != "--cliworker-nous-refresh":
77
+ return "unsupported"
78
+ own_dotenv()
79
+ operation = runpy.run_path(str(Path(__file__).with_name("hermes-nous-refresh.py")))
80
+ return operation["refresh_selected_nous"](account_home, arguments[1])
57
81
  from hermes_cli.main import main
58
82
  raise SystemExit(main())
59
- finally:
60
- if release is not None:
61
- release()
83
+
84
+
85
+ if arguments and arguments[0].startswith("--cliworker-"):
86
+ # Fixed private operation has no native diagnostic/credential output. Keep
87
+ # SystemExit/KeyboardInterrupt semantics; ordinary failures are classified.
88
+ with open(os.devnull, "w") as quiet, contextlib.redirect_stdout(quiet), contextlib.redirect_stderr(quiet):
89
+ logging.disable(logging.CRITICAL)
90
+ try:
91
+ result = run_entry()
92
+ except Exception:
93
+ result = "unavailable"
94
+ print(json.dumps({"version": 1, "state": result}, separators=(",", ":")))
95
+ else:
96
+ run_entry()
@@ -0,0 +1,331 @@
1
+ """One bounded, same-account Nous renewal inside the verified native environment.
2
+
3
+ This module is loaded only by our fixed native-entry operation. Native OAuth
4
+ owns token exchange and atomic persistence. No resolver, pool selection, login,
5
+ anonymous identity, browser, model request or credential output is permitted.
6
+ """
7
+ import base64
8
+ import contextlib
9
+ import hashlib
10
+ import inspect
11
+ import json
12
+ import logging
13
+ import math
14
+ import os
15
+ from pathlib import Path
16
+ import re
17
+ import signal
18
+ import stat
19
+ import time
20
+
21
+ PORTAL = "https://portal.nousresearch.com"
22
+ INFERENCE = "https://inference-api.nousresearch.com/v1"
23
+ CLIENT = "hermes-cli"
24
+ MAX_FILE = 4 * 1024 * 1024
25
+ TOKEN_FIELDS = (
26
+ "access_token", "refresh_token", "token_type", "scope", "client_id",
27
+ "portal_base_url", "inference_base_url", "obtained_at", "expires_at", "expires_in",
28
+ "agent_key", "agent_key_id", "agent_key_expires_at", "agent_key_expires_in",
29
+ "agent_key_reused", "agent_key_obtained_at", "tls",
30
+ )
31
+ TERMINAL = {"invalid_grant", "invalid_token", "refresh_token_reused", "nous_auth_missing_refresh_token"}
32
+
33
+
34
+ class Refusal(Exception):
35
+ def __init__(self, state="changed"):
36
+ self.state = state
37
+
38
+
39
+ def text(value):
40
+ return isinstance(value, str) and 0 < len(value) <= 32768 and not re.search(r"[\x00-\x20\x7f]", value)
41
+
42
+
43
+ def canonical(value, expected):
44
+ return isinstance(value, str) and value.rstrip("/") == expected
45
+
46
+
47
+ def claims(token):
48
+ if not text(token) or not re.fullmatch(r"[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+", token):
49
+ raise Refusal()
50
+ raw = token.split(".")[1]
51
+ value = json.loads(base64.urlsafe_b64decode(raw + "=" * (-len(raw) % 4)))
52
+ if not isinstance(value, dict):
53
+ raise Refusal()
54
+ return value
55
+
56
+
57
+ def scope_values(value):
58
+ if isinstance(value, str):
59
+ return re.split(r"[\s,]+", value)
60
+ if isinstance(value, list):
61
+ return [part for item in value for part in scope_values(item)]
62
+ return []
63
+
64
+
65
+ def identity(state):
66
+ if not isinstance(state, dict) or state.get("auth_method") == "anonymous" or state.get("account_tier") == "anonymous":
67
+ raise Refusal()
68
+ token = claims(state.get("access_token"))
69
+ if token.get("account_tier") == "anonymous" or any(not text(token.get(key)) for key in ("sub", "org_id", "iss")):
70
+ raise Refusal()
71
+ client = token.get("client_id", "")
72
+ if client is None:
73
+ client = ""
74
+ if client != "" and not text(client):
75
+ raise Refusal()
76
+ expiry = token.get("exp")
77
+ if isinstance(expiry, bool) or not isinstance(expiry, (int, float)) or not math.isfinite(expiry):
78
+ raise Refusal()
79
+ if "inference:invoke" not in (scope_values(state.get("scope")) + scope_values(token.get("scope")) + scope_values(token.get("scp"))):
80
+ raise Refusal()
81
+ if not canonical(state.get("portal_base_url"), PORTAL) or not canonical(state.get("inference_base_url"), INFERENCE):
82
+ raise Refusal()
83
+ native_client = state.get("client_id") or CLIENT
84
+ if not text(native_client):
85
+ raise Refusal()
86
+ key = ["hermes-nous-v1", token["sub"], token["org_id"], token["iss"], client, PORTAL, INFERENCE]
87
+ digest = hashlib.sha256(json.dumps(key, ensure_ascii=False, separators=(",", ":")).encode("utf-8")).hexdigest()
88
+ return digest, native_client, float(expiry)
89
+
90
+
91
+ def regular_file(path, *, optional=False):
92
+ try:
93
+ info = path.lstat()
94
+ except FileNotFoundError:
95
+ if optional:
96
+ return False
97
+ raise Refusal("unavailable")
98
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1 or info.st_size > MAX_FILE:
99
+ raise Refusal()
100
+ return True
101
+
102
+
103
+ def read_json(path):
104
+ value = json.loads(read_private_text(path))
105
+ if not isinstance(value, dict):
106
+ raise Refusal()
107
+ return value
108
+
109
+
110
+ def read_private_text(path):
111
+ regular_file(path)
112
+ fd = os.open(path, os.O_RDONLY | getattr(os, "O_NOFOLLOW", 0) | getattr(os, "O_NONBLOCK", 0))
113
+ with os.fdopen(fd, "rb") as stream:
114
+ opened = os.fstat(stream.fileno())
115
+ current = path.lstat()
116
+ if (not stat.S_ISREG(opened.st_mode) or opened.st_nlink != 1 or opened.st_size > MAX_FILE
117
+ or stat.S_ISLNK(current.st_mode) or (opened.st_dev, opened.st_ino) != (current.st_dev, current.st_ino)):
118
+ raise Refusal()
119
+ data = stream.read(MAX_FILE + 1)
120
+ if len(data) > MAX_FILE:
121
+ raise Refusal()
122
+ return data.decode("utf-8-sig")
123
+
124
+
125
+ def check_configuration(home):
126
+ # The native entry has already loaded only this home's dotenv. Do not import
127
+ # main/config resolution, which can consult profiles or external sources.
128
+ import hermes_yaml as yaml
129
+ config_path = home / "config.yaml"
130
+ config = yaml.safe_load(read_private_text(config_path))
131
+ if not isinstance(config, dict) or not isinstance(config.get("model"), dict):
132
+ raise Refusal()
133
+ if (config.get("auth") or {}).get("adopt_external_logins") is not False:
134
+ raise Refusal()
135
+ model = config["model"]
136
+ if model.get("provider") != "nous" or (config.get("providers") or {}).get("nous", {}).get("enabled") is False:
137
+ raise Refusal()
138
+ if model.get("api_key") or model.get("extra_headers") or any(os.environ.get(k) for k in ("NOUS_API_KEY", "CUSTOM_API_KEY")):
139
+ raise Refusal()
140
+ if any(re.fullmatch(r"NOUS_API_KEY_\d+", k) and v for k, v in os.environ.items()):
141
+ raise Refusal()
142
+ for value in (model.get("base_url"), os.environ.get("NOUS_INFERENCE_BASE_URL"), os.environ.get("CUSTOM_BASE_URL")):
143
+ if value and not canonical(value, INFERENCE):
144
+ raise Refusal()
145
+ for name in ("NOUS_PORTAL_BASE_URL", "HERMES_PORTAL_BASE_URL"):
146
+ if os.environ.get(name) and not canonical(os.environ[name], PORTAL):
147
+ raise Refusal()
148
+ if model.get("api_mode") not in (None, "chat_completions", "anthropic_messages"):
149
+ raise Refusal()
150
+ if (config.get("nous") or {}).get("anthropic_wire", "chat") not in ("chat", "native", "auto"):
151
+ raise Refusal()
152
+
153
+
154
+ def check_available(row):
155
+ if row.get("disabled") is True or row.get("status") == "exhausted" or row.get("last_status") == "dead":
156
+ raise Refusal("unavailable")
157
+ if row.get("last_status") == "exhausted":
158
+ until = row.get("last_error_reset_at")
159
+ if not isinstance(until, (int, float)) or isinstance(until, bool) or not math.isfinite(until) or until <= 0 or until > time.time():
160
+ raise Refusal("unavailable")
161
+ cooldowns = row.get("model_cooldowns", {})
162
+ if not isinstance(cooldowns, dict) or any(
163
+ isinstance(until, (int, float)) and not isinstance(until, bool) and until > time.time()
164
+ for until in cooldowns.values()
165
+ ):
166
+ raise Refusal("unavailable")
167
+
168
+
169
+ def checked_pool(store, state, expected):
170
+ if store.get("active_provider") != "nous" or state.get("agent_key") != state.get("access_token"):
171
+ raise Refusal()
172
+ if state.get("last_auth_error", {}).get("relogin_required") is True and not (state.get("access_token") or state.get("refresh_token")):
173
+ raise Refusal("relogin")
174
+ check_available(state)
175
+ rows = store.get("credential_pool", {}).get("nous")
176
+ if not isinstance(rows, list) or not 1 <= len(rows) <= 8:
177
+ raise Refusal()
178
+ for row in rows:
179
+ if not isinstance(row, dict) or row.get("auth_type") != "oauth" or row.get("source") not in ("device_code", "manual:device_code"):
180
+ raise Refusal()
181
+ if row.get("access_token") != state.get("access_token") or row.get("agent_key") != state.get("agent_key"):
182
+ raise Refusal()
183
+ if row.get("refresh_token") not in (None, state.get("refresh_token")):
184
+ raise Refusal()
185
+ for field, endpoint in (("portal_base_url", PORTAL), ("inference_base_url", INFERENCE), ("base_url", INFERENCE)):
186
+ if row.get(field) and not canonical(row[field], endpoint):
187
+ raise Refusal()
188
+ if (row.get("client_id") or CLIENT) != expected[1]:
189
+ raise Refusal()
190
+ check_available(row)
191
+ return rows
192
+
193
+
194
+ def checked_shared(shared, expected):
195
+ if shared.get("_schema") != 1 or not text(shared.get("refresh_token")):
196
+ raise Refusal()
197
+ found = identity(shared)
198
+ if found[:2] != expected[:2]:
199
+ raise Refusal()
200
+ return found
201
+
202
+
203
+ def _run(home, expected_digest, cancelled):
204
+ if not re.fullmatch(r"[a-f0-9]{64}", expected_digest or ""):
205
+ raise Refusal("unsupported")
206
+ from hermes_cli import auth
207
+ from hermes_constants import get_default_hermes_root
208
+ required = ("_provider_state_transaction", "_auth_file_path", "_nous_shared_store_path", "_nous_shared_store_lock",
209
+ "_save_provider_state_to_source", "_write_shared_nous_state", "_select_nous_invoke_jwt", "refresh_nous_oauth_from_state")
210
+ if any(not callable(getattr(auth, key, None)) for key in required):
211
+ raise Refusal("unsupported")
212
+ if "on_state_update" not in inspect.signature(auth.refresh_nous_oauth_from_state).parameters:
213
+ raise Refusal("unsupported")
214
+ home = Path(home)
215
+ if home != home.resolve() or not home.is_dir() or get_default_hermes_root().resolve() != home:
216
+ raise Refusal()
217
+ auth_path = home / "auth.json"
218
+ shared_path = auth._nous_shared_store_path()
219
+ if auth._auth_file_path().resolve() != auth_path or shared_path.parent != home / "shared" or shared_path.resolve() != shared_path:
220
+ raise Refusal()
221
+ if (home / "shared").exists() and not (home / "shared").is_dir():
222
+ raise Refusal()
223
+ check_configuration(home)
224
+ raw_ttl = os.environ.get("HERMES_NOUS_MIN_KEY_TTL_SECONDS", "120")
225
+ if not re.fullmatch(r"\d+", raw_ttl) or len(raw_ttl) > 9:
226
+ raise Refusal()
227
+ ttl = max(120, int(raw_ttl))
228
+ # Native cross-process ordering: auth first, shared second. No profile/global
229
+ # fallback or shared merge is allowed without the exact selected identity.
230
+ # Confirm the local provider exists before the native transaction can even
231
+ # consult a global fallback. Re-read under its lock to bind the snapshot.
232
+ if not isinstance(read_json(auth_path).get("providers", {}).get("nous"), dict):
233
+ raise Refusal()
234
+ with auth._provider_state_transaction("nous", timeout_seconds=1.0) as (store, state, source):
235
+ snapshot = read_json(auth_path)
236
+ if source is None or Path(source).resolve() != auth_path or not isinstance(store.get("providers", {}).get("nous"), dict):
237
+ raise Refusal()
238
+ if snapshot.get("providers", {}).get("nous") != state or snapshot.get("credential_pool") != store.get("credential_pool"):
239
+ raise Refusal()
240
+ check_configuration(home)
241
+ expected = identity(state)
242
+ if expected[0] != expected_digest:
243
+ raise Refusal()
244
+ rows = checked_pool(store, state, expected)
245
+ if cancelled[0]:
246
+ raise Refusal("unavailable")
247
+ with auth._nous_shared_store_lock(timeout_seconds=1.0):
248
+ shared = read_json(shared_path) if regular_file(shared_path, optional=True) else None
249
+ if shared is not None:
250
+ shared_identity = checked_shared(shared, expected)
251
+ different_pair = (shared.get("access_token"), shared.get("refresh_token")) != (state.get("access_token"), state.get("refresh_token"))
252
+ if different_pair and shared_identity[2] == expected[2]:
253
+ raise Refusal()
254
+ else:
255
+ shared_identity, different_pair = None, False
256
+
257
+ def persist(update, _reason=None):
258
+ nonlocal state
259
+ merged = {**state, **{key: update[key] for key in TOKEN_FIELDS if key in update}}
260
+ if identity(merged)[:2] != expected[:2]:
261
+ raise Refusal()
262
+ # Select only this already identity-checked invoke JWT. This has
263
+ # no network/I/O and keeps pool aliases consistent even if the
264
+ # pure refresher's later validation fails after token rotation.
265
+ auth._select_nous_invoke_jwt(merged)
266
+ if merged.get("agent_key") != merged.get("access_token"):
267
+ raise Refusal("unsupported")
268
+ for row in rows:
269
+ for key in TOKEN_FIELDS:
270
+ if key in merged:
271
+ row[key] = merged[key]
272
+ auth._save_provider_state_to_source(store, "nous", merged, source)
273
+ state = merged
274
+ # Native mirror is best-effort, so verify the saved pair before
275
+ # reporting ready. No outside-home store is ever touched.
276
+ auth._write_shared_nous_state(state)
277
+ saved = read_json(shared_path)
278
+ if checked_shared(saved, expected)[:2] != expected[:2] or any(saved.get(k) != state.get(k) for k in ("access_token", "refresh_token")):
279
+ raise Refusal("unavailable")
280
+
281
+ # A newer peer rotation for this exact principal/client/route may
282
+ # be adopted. Equal-expiry differing tokens are not a proven chain.
283
+ if different_pair and shared_identity[2] > expected[2]:
284
+ persist(shared)
285
+ elif different_pair:
286
+ # The selected store is provably newer. Repair this same-home,
287
+ # same-principal mirror before a native resolver can adopt its
288
+ # older single-use refresh token back into the selected store.
289
+ persist(state)
290
+ current = identity(state)
291
+ if current[2] > time.time() + ttl:
292
+ return "ready"
293
+ if not text(state.get("refresh_token")):
294
+ raise Refusal("relogin")
295
+ if cancelled[0]:
296
+ raise Refusal("unavailable")
297
+ refreshed = auth.refresh_nous_oauth_from_state(
298
+ state, timeout_seconds=4.0, force_refresh=True, on_state_update=persist)
299
+ persist(refreshed)
300
+ if identity(state)[2] <= time.time() + 120:
301
+ raise Refusal("unavailable")
302
+ return "unavailable" if cancelled[0] else "ready"
303
+
304
+
305
+ def refresh_selected_nous(home, expected_digest):
306
+ """Fixed safe receipt only. Exceptions and logs never cross the boundary."""
307
+ cancelled = [False]
308
+ handlers = {}
309
+ def on_cancel(_signal, _frame):
310
+ # Do not interrupt a successful single-use token exchange before its
311
+ # callback saves the rotation. Host must also await this bounded child
312
+ # on Windows, where Job termination cannot be deferred by Python.
313
+ cancelled[0] = True
314
+ for number in (signal.SIGTERM, signal.SIGINT):
315
+ handlers[number] = signal.signal(number, on_cancel)
316
+ old_disable = logging.root.manager.disable
317
+ try:
318
+ with open(os.devnull, "w") as quiet, contextlib.redirect_stdout(quiet), contextlib.redirect_stderr(quiet):
319
+ logging.disable(logging.CRITICAL)
320
+ try:
321
+ return _run(home, expected_digest, cancelled)
322
+ except Refusal as error:
323
+ return error.state
324
+ except Exception as error:
325
+ if getattr(error, "code", None) in TERMINAL and bool(getattr(error, "relogin_required", False)):
326
+ return "relogin"
327
+ return "unavailable"
328
+ finally:
329
+ logging.disable(old_disable)
330
+ for number, handler in handlers.items():
331
+ signal.signal(number, handler)
@@ -28,7 +28,9 @@ export interface HermesNousSource {
28
28
  }
29
29
  /** Hermes 6c80c327: flat providers.nous, native device-code pool and invoke JWT.
30
30
  * No refresh-only, guest, fallback store or different pooled principal is promoted. */
31
- export declare function projectHermesNousSource(auth: any, minTtlSeconds?: number): HermesNousSource;
31
+ export declare function projectHermesNousSource(auth: any, minTtlSeconds?: number, options?: {
32
+ allowExpired?: boolean;
33
+ }): HermesNousSource;
32
34
  export declare function hermesNousMinimumTtl(env: Record<string, string>): number;
33
35
  /** Runtime uses its supported MIN_KEY_TTL override (120s), matching the native
34
36
  * invoke-JWT skew. The native default 1800s is a proactive-refresh optimization,
@@ -37,6 +39,8 @@ export declare function selectHermesNousSource(material: {
37
39
  config: any;
38
40
  auth: any;
39
41
  env: Record<string, string>;
42
+ }, options?: {
43
+ allowExpired?: boolean;
40
44
  }): HermesNousSource;
41
45
  export declare function hermesNousEfforts(home: string, source: HermesNousSource, model: string): Effort[];
42
46
  export declare function beginHermesNousCapabilities(home: string, source: HermesNousSource): symbol;
@@ -45,13 +45,13 @@ function unavailable(row) {
45
45
  }
46
46
  /** Hermes 6c80c327: flat providers.nous, native device-code pool and invoke JWT.
47
47
  * No refresh-only, guest, fallback store or different pooled principal is promoted. */
48
- export function projectHermesNousSource(auth, minTtlSeconds = 0) {
48
+ export function projectHermesNousSource(auth, minTtlSeconds = 0, options = {}) {
49
49
  const state = auth?.providers?.nous;
50
50
  if (!object(state) ||
51
51
  auth.active_provider !== 'nous' ||
52
52
  state.auth_method === 'anonymous' ||
53
53
  state.account_tier === 'anonymous' ||
54
- state.last_auth_error?.relogin_required === true ||
54
+ (state.last_auth_error?.relogin_required === true && !state.access_token && !state.refresh_token) ||
55
55
  unavailable(state))
56
56
  invalid();
57
57
  const access = state.access_token, agentKey = state.agent_key;
@@ -67,7 +67,7 @@ export function projectHermesNousSource(auth, minTtlSeconds = 0) {
67
67
  !Number.isFinite(token.exp) ||
68
68
  ![...scopes(state.scope), ...scopes(token.scope), ...scopes(token.scp)].includes('inference:invoke'))
69
69
  invalid();
70
- if (token.exp * 1000 <= Date.now() + minTtlSeconds * 1000)
70
+ if (!options.allowExpired && token.exp * 1000 <= Date.now() + minTtlSeconds * 1000)
71
71
  throw new HermesNousError('Nous 登录即将过期或已过期,请在 Hermes 登录设置中重新登录');
72
72
  if (!canonical(state.portal_base_url, NOUS_PORTAL) || !canonical(state.inference_base_url, NOUS_INFERENCE))
73
73
  throw new HermesNousError('Nous 当前路由暂不支持账号模型查询');
@@ -111,7 +111,7 @@ export function hermesNousMinimumTtl(env) {
111
111
  /** Runtime uses its supported MIN_KEY_TTL override (120s), matching the native
112
112
  * invoke-JWT skew. The native default 1800s is a proactive-refresh optimization,
113
113
  * not invalid-account evidence. An explicit own-home setting still takes precedence. */
114
- export function selectHermesNousSource(material) {
114
+ export function selectHermesNousSource(material, options = {}) {
115
115
  const { config, auth, env } = material;
116
116
  const cfg = config.model;
117
117
  if (!object(cfg) || cfg.provider !== 'nous' || config.providers?.nous?.enabled === false)
@@ -127,7 +127,7 @@ export function selectHermesNousSource(material) {
127
127
  [env.NOUS_PORTAL_BASE_URL, env.HERMES_PORTAL_BASE_URL].some((url) => url && !canonical(url, NOUS_PORTAL)) ||
128
128
  (cfg.api_mode && !['chat_completions', 'anthropic_messages'].includes(cfg.api_mode)))
129
129
  throw new HermesNousError('Nous 当前路由暂不支持账号模型查询');
130
- const source = projectHermesNousSource(auth, hermesNousMinimumTtl(env));
130
+ const source = projectHermesNousSource(auth, hermesNousMinimumTtl(env), options);
131
131
  const wire = config.nous?.anthropic_wire ?? 'chat';
132
132
  if (!['chat', 'native', 'auto'].includes(wire))
133
133
  throw new HermesNousError('Nous 当前路由暂不支持账号模型查询');