@aitne/daemon 0.1.2 → 0.1.4

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 (253) hide show
  1. package/LICENSE +21 -0
  2. package/dist/adapters/whatsapp-adapter.d.ts.map +1 -1
  3. package/dist/adapters/whatsapp-adapter.js +0 -1
  4. package/dist/adapters/whatsapp-adapter.js.map +1 -1
  5. package/dist/api/integration-route-gate.d.ts +15 -11
  6. package/dist/api/integration-route-gate.d.ts.map +1 -1
  7. package/dist/api/integration-route-gate.js +60 -23
  8. package/dist/api/integration-route-gate.js.map +1 -1
  9. package/dist/api/json-body.d.ts +22 -7
  10. package/dist/api/json-body.d.ts.map +1 -1
  11. package/dist/api/json-body.js +27 -8
  12. package/dist/api/json-body.js.map +1 -1
  13. package/dist/api/routes/agent.d.ts.map +1 -1
  14. package/dist/api/routes/agent.js +18 -0
  15. package/dist/api/routes/agent.js.map +1 -1
  16. package/dist/api/routes/backends.d.ts.map +1 -1
  17. package/dist/api/routes/backends.js +96 -1
  18. package/dist/api/routes/backends.js.map +1 -1
  19. package/dist/api/routes/books.js +1 -1
  20. package/dist/api/routes/books.js.map +1 -1
  21. package/dist/api/routes/context.d.ts.map +1 -1
  22. package/dist/api/routes/context.js +13 -1
  23. package/dist/api/routes/context.js.map +1 -1
  24. package/dist/api/routes/dashboard.d.ts.map +1 -1
  25. package/dist/api/routes/dashboard.js +75 -5
  26. package/dist/api/routes/dashboard.js.map +1 -1
  27. package/dist/api/routes/github.d.ts.map +1 -1
  28. package/dist/api/routes/github.js +38 -5
  29. package/dist/api/routes/github.js.map +1 -1
  30. package/dist/api/routes/integrations.d.ts +35 -6
  31. package/dist/api/routes/integrations.d.ts.map +1 -1
  32. package/dist/api/routes/integrations.js +191 -16
  33. package/dist/api/routes/integrations.js.map +1 -1
  34. package/dist/api/routes/mail.d.ts.map +1 -1
  35. package/dist/api/routes/mail.js +112 -46
  36. package/dist/api/routes/mail.js.map +1 -1
  37. package/dist/api/routes/observations.d.ts.map +1 -1
  38. package/dist/api/routes/observations.js +161 -8
  39. package/dist/api/routes/observations.js.map +1 -1
  40. package/dist/api/routes/setup-migrate.d.ts +9 -1
  41. package/dist/api/routes/setup-migrate.d.ts.map +1 -1
  42. package/dist/api/routes/setup-migrate.js +4 -2
  43. package/dist/api/routes/setup-migrate.js.map +1 -1
  44. package/dist/api/routes/skills.d.ts.map +1 -1
  45. package/dist/api/routes/skills.js +39 -1
  46. package/dist/api/routes/skills.js.map +1 -1
  47. package/dist/api/routes/voice.d.ts.map +1 -1
  48. package/dist/api/routes/voice.js +154 -14
  49. package/dist/api/routes/voice.js.map +1 -1
  50. package/dist/bootstrap/adapters.d.ts +109 -0
  51. package/dist/bootstrap/adapters.d.ts.map +1 -0
  52. package/dist/bootstrap/adapters.js +237 -0
  53. package/dist/bootstrap/adapters.js.map +1 -0
  54. package/dist/bootstrap/catchup.d.ts +23 -0
  55. package/dist/bootstrap/catchup.d.ts.map +1 -0
  56. package/dist/bootstrap/catchup.js +124 -0
  57. package/dist/bootstrap/catchup.js.map +1 -0
  58. package/dist/bootstrap/schedule-helpers.d.ts +18 -0
  59. package/dist/bootstrap/schedule-helpers.d.ts.map +1 -0
  60. package/dist/bootstrap/schedule-helpers.js +96 -0
  61. package/dist/bootstrap/schedule-helpers.js.map +1 -0
  62. package/dist/bootstrap/services.d.ts +60 -0
  63. package/dist/bootstrap/services.d.ts.map +1 -0
  64. package/dist/bootstrap/services.js +209 -0
  65. package/dist/bootstrap/services.js.map +1 -0
  66. package/dist/core/backends/backend-router.d.ts +23 -0
  67. package/dist/core/backends/backend-router.d.ts.map +1 -1
  68. package/dist/core/backends/backend-router.js +48 -3
  69. package/dist/core/backends/backend-router.js.map +1 -1
  70. package/dist/core/backends/claude-auth.d.ts +70 -0
  71. package/dist/core/backends/claude-auth.d.ts.map +1 -0
  72. package/dist/core/backends/claude-auth.js +198 -0
  73. package/dist/core/backends/claude-auth.js.map +1 -0
  74. package/dist/core/backends/claude-code-core.d.ts +47 -119
  75. package/dist/core/backends/claude-code-core.d.ts.map +1 -1
  76. package/dist/core/backends/claude-code-core.js +112 -1565
  77. package/dist/core/backends/claude-code-core.js.map +1 -1
  78. package/dist/core/backends/claude-delegated.d.ts +86 -0
  79. package/dist/core/backends/claude-delegated.d.ts.map +1 -0
  80. package/dist/core/backends/claude-delegated.js +801 -0
  81. package/dist/core/backends/claude-delegated.js.map +1 -0
  82. package/dist/core/backends/claude-errors.d.ts +39 -0
  83. package/dist/core/backends/claude-errors.d.ts.map +1 -0
  84. package/dist/core/backends/claude-errors.js +71 -0
  85. package/dist/core/backends/claude-errors.js.map +1 -0
  86. package/dist/core/backends/claude-probe.d.ts +103 -0
  87. package/dist/core/backends/claude-probe.d.ts.map +1 -0
  88. package/dist/core/backends/claude-probe.js +336 -0
  89. package/dist/core/backends/claude-probe.js.map +1 -0
  90. package/dist/core/backends/claude-tool-collection.d.ts +135 -0
  91. package/dist/core/backends/claude-tool-collection.d.ts.map +1 -0
  92. package/dist/core/backends/claude-tool-collection.js +831 -0
  93. package/dist/core/backends/claude-tool-collection.js.map +1 -0
  94. package/dist/core/backends/gemini-cli-core.d.ts +21 -0
  95. package/dist/core/backends/gemini-cli-core.d.ts.map +1 -1
  96. package/dist/core/backends/gemini-cli-core.js +84 -6
  97. package/dist/core/backends/gemini-cli-core.js.map +1 -1
  98. package/dist/core/backends/prompt-utils.d.ts +1 -0
  99. package/dist/core/backends/prompt-utils.d.ts.map +1 -1
  100. package/dist/core/backends/prompt-utils.js +60 -3
  101. package/dist/core/backends/prompt-utils.js.map +1 -1
  102. package/dist/core/context-builder.d.ts +36 -12
  103. package/dist/core/context-builder.d.ts.map +1 -1
  104. package/dist/core/context-builder.js +179 -89
  105. package/dist/core/context-builder.js.map +1 -1
  106. package/dist/core/dispatcher-date-utils.d.ts +49 -0
  107. package/dist/core/dispatcher-date-utils.d.ts.map +1 -0
  108. package/dist/core/dispatcher-date-utils.js +132 -0
  109. package/dist/core/dispatcher-date-utils.js.map +1 -0
  110. package/dist/core/dispatcher-error-handling.d.ts +159 -0
  111. package/dist/core/dispatcher-error-handling.d.ts.map +1 -0
  112. package/dist/core/dispatcher-error-handling.js +393 -0
  113. package/dist/core/dispatcher-error-handling.js.map +1 -0
  114. package/dist/core/dispatcher-hourly-check.d.ts +150 -0
  115. package/dist/core/dispatcher-hourly-check.d.ts.map +1 -0
  116. package/dist/core/dispatcher-hourly-check.js +665 -0
  117. package/dist/core/dispatcher-hourly-check.js.map +1 -0
  118. package/dist/core/dispatcher-message-handler.d.ts +170 -0
  119. package/dist/core/dispatcher-message-handler.d.ts.map +1 -0
  120. package/dist/core/dispatcher-message-handler.js +1054 -0
  121. package/dist/core/dispatcher-message-handler.js.map +1 -0
  122. package/dist/core/dispatcher-morning-routine.d.ts +169 -0
  123. package/dist/core/dispatcher-morning-routine.d.ts.map +1 -0
  124. package/dist/core/dispatcher-morning-routine.js +434 -0
  125. package/dist/core/dispatcher-morning-routine.js.map +1 -0
  126. package/dist/core/dispatcher-prompt.d.ts +107 -0
  127. package/dist/core/dispatcher-prompt.d.ts.map +1 -0
  128. package/dist/core/dispatcher-prompt.js +227 -0
  129. package/dist/core/dispatcher-prompt.js.map +1 -0
  130. package/dist/core/dispatcher-repository-helpers.d.ts +39 -0
  131. package/dist/core/dispatcher-repository-helpers.d.ts.map +1 -0
  132. package/dist/core/dispatcher-repository-helpers.js +86 -0
  133. package/dist/core/dispatcher-repository-helpers.js.map +1 -0
  134. package/dist/core/dispatcher-result-processor.d.ts +145 -0
  135. package/dist/core/dispatcher-result-processor.d.ts.map +1 -0
  136. package/dist/core/dispatcher-result-processor.js +414 -0
  137. package/dist/core/dispatcher-result-processor.js.map +1 -0
  138. package/dist/core/dispatcher-scheduled-tasks.d.ts +406 -0
  139. package/dist/core/dispatcher-scheduled-tasks.d.ts.map +1 -0
  140. package/dist/core/dispatcher-scheduled-tasks.js +998 -0
  141. package/dist/core/dispatcher-scheduled-tasks.js.map +1 -0
  142. package/dist/core/dispatcher-types.d.ts +296 -0
  143. package/dist/core/dispatcher-types.d.ts.map +1 -0
  144. package/dist/core/dispatcher-types.js +106 -0
  145. package/dist/core/dispatcher-types.js.map +1 -0
  146. package/dist/core/dispatcher.d.ts +86 -610
  147. package/dist/core/dispatcher.d.ts.map +1 -1
  148. package/dist/core/dispatcher.js +293 -3542
  149. package/dist/core/dispatcher.js.map +1 -1
  150. package/dist/core/integration-health.d.ts +18 -10
  151. package/dist/core/integration-health.d.ts.map +1 -1
  152. package/dist/core/integration-health.js +31 -1
  153. package/dist/core/integration-health.js.map +1 -1
  154. package/dist/core/integration-lifecycle.d.ts +65 -0
  155. package/dist/core/integration-lifecycle.d.ts.map +1 -1
  156. package/dist/core/integration-lifecycle.js +167 -16
  157. package/dist/core/integration-lifecycle.js.map +1 -1
  158. package/dist/core/integration-main-backend.d.ts +40 -0
  159. package/dist/core/integration-main-backend.d.ts.map +1 -1
  160. package/dist/core/integration-main-backend.js +89 -2
  161. package/dist/core/integration-main-backend.js.map +1 -1
  162. package/dist/core/management-md.d.ts +51 -17
  163. package/dist/core/management-md.d.ts.map +1 -1
  164. package/dist/core/management-md.js +233 -56
  165. package/dist/core/management-md.js.map +1 -1
  166. package/dist/core/output-language-policy.d.ts +74 -0
  167. package/dist/core/output-language-policy.d.ts.map +1 -0
  168. package/dist/core/output-language-policy.js +194 -0
  169. package/dist/core/output-language-policy.js.map +1 -0
  170. package/dist/core/prompts.d.ts +1 -0
  171. package/dist/core/prompts.d.ts.map +1 -1
  172. package/dist/core/prompts.js +121 -3
  173. package/dist/core/prompts.js.map +1 -1
  174. package/dist/core/repository-management-docs.d.ts +24 -0
  175. package/dist/core/repository-management-docs.d.ts.map +1 -1
  176. package/dist/core/repository-management-docs.js +210 -26
  177. package/dist/core/repository-management-docs.js.map +1 -1
  178. package/dist/core/routine-acquisition-plan.d.ts +131 -0
  179. package/dist/core/routine-acquisition-plan.d.ts.map +1 -0
  180. package/dist/core/routine-acquisition-plan.js +268 -0
  181. package/dist/core/routine-acquisition-plan.js.map +1 -0
  182. package/dist/core/routine-fetch-window-runner.d.ts +201 -0
  183. package/dist/core/routine-fetch-window-runner.d.ts.map +1 -0
  184. package/dist/core/routine-fetch-window-runner.js +661 -0
  185. package/dist/core/routine-fetch-window-runner.js.map +1 -0
  186. package/dist/core/routine-windows.d.ts +156 -0
  187. package/dist/core/routine-windows.d.ts.map +1 -0
  188. package/dist/core/routine-windows.js +330 -0
  189. package/dist/core/routine-windows.js.map +1 -0
  190. package/dist/core/skills-compiler.d.ts +11 -0
  191. package/dist/core/skills-compiler.d.ts.map +1 -1
  192. package/dist/core/skills-compiler.js +102 -13
  193. package/dist/core/skills-compiler.js.map +1 -1
  194. package/dist/core/skills-manifest.d.ts.map +1 -1
  195. package/dist/core/skills-manifest.js +26 -0
  196. package/dist/core/skills-manifest.js.map +1 -1
  197. package/dist/core/system-reset.d.ts.map +1 -1
  198. package/dist/core/system-reset.js +25 -2
  199. package/dist/core/system-reset.js.map +1 -1
  200. package/dist/db/observations.d.ts +45 -2
  201. package/dist/db/observations.d.ts.map +1 -1
  202. package/dist/db/observations.js +112 -14
  203. package/dist/db/observations.js.map +1 -1
  204. package/dist/db/schema.d.ts.map +1 -1
  205. package/dist/db/schema.js +13 -25
  206. package/dist/db/schema.js.map +1 -1
  207. package/dist/index.js +83 -610
  208. package/dist/index.js.map +1 -1
  209. package/dist/observers/delegated-sync-worker.d.ts +45 -2
  210. package/dist/observers/delegated-sync-worker.d.ts.map +1 -1
  211. package/dist/observers/delegated-sync-worker.js +71 -21
  212. package/dist/observers/delegated-sync-worker.js.map +1 -1
  213. package/dist/observers/mail-poller.d.ts +12 -5
  214. package/dist/observers/mail-poller.d.ts.map +1 -1
  215. package/dist/observers/mail-poller.js +36 -14
  216. package/dist/observers/mail-poller.js.map +1 -1
  217. package/dist/observers/manager.d.ts +37 -5
  218. package/dist/observers/manager.d.ts.map +1 -1
  219. package/dist/observers/manager.js +28 -10
  220. package/dist/observers/manager.js.map +1 -1
  221. package/dist/safety/risk-classifier.d.ts.map +1 -1
  222. package/dist/safety/risk-classifier.js +5 -0
  223. package/dist/safety/risk-classifier.js.map +1 -1
  224. package/dist/services/delegated-backend-invoker.d.ts +1 -51
  225. package/dist/services/delegated-backend-invoker.d.ts.map +1 -1
  226. package/dist/services/delegated-backend-invoker.js +41 -480
  227. package/dist/services/delegated-backend-invoker.js.map +1 -1
  228. package/dist/services/delegated-invoker-audit.d.ts +94 -0
  229. package/dist/services/delegated-invoker-audit.d.ts.map +1 -0
  230. package/dist/services/delegated-invoker-audit.js +238 -0
  231. package/dist/services/delegated-invoker-audit.js.map +1 -0
  232. package/dist/services/delegated-invoker-cache-hits.d.ts +34 -0
  233. package/dist/services/delegated-invoker-cache-hits.d.ts.map +1 -0
  234. package/dist/services/delegated-invoker-cache-hits.js +104 -0
  235. package/dist/services/delegated-invoker-cache-hits.js.map +1 -0
  236. package/dist/services/delegated-invoker-janitors.d.ts +28 -0
  237. package/dist/services/delegated-invoker-janitors.d.ts.map +1 -0
  238. package/dist/services/delegated-invoker-janitors.js +104 -0
  239. package/dist/services/delegated-invoker-janitors.js.map +1 -0
  240. package/dist/services/delegated-invoker-utils.d.ts +42 -0
  241. package/dist/services/delegated-invoker-utils.d.ts.map +1 -0
  242. package/dist/services/delegated-invoker-utils.js +100 -0
  243. package/dist/services/delegated-invoker-utils.js.map +1 -0
  244. package/dist/services/delegated-task-runtime.d.ts +1 -1
  245. package/dist/services/delegated-task-runtime.js +1 -1
  246. package/dist/services/integrations/snapshot-partitions.d.ts +5 -0
  247. package/dist/services/integrations/snapshot-partitions.d.ts.map +1 -1
  248. package/dist/services/integrations/snapshot-partitions.js +12 -0
  249. package/dist/services/integrations/snapshot-partitions.js.map +1 -1
  250. package/dist/services/voice/transcriber-impl.d.ts.map +1 -1
  251. package/dist/services/voice/transcriber-impl.js +46 -0
  252. package/dist/services/voice/transcriber-impl.js.map +1 -1
  253. package/package.json +12 -12
@@ -0,0 +1,198 @@
1
+ /**
2
+ * Claude-backend auth probe + error-introspection helpers — pure module split
3
+ * out of `claude-code-core.ts` as part of the file-split plan (Tier 2, §8).
4
+ *
5
+ * Two responsibilities, both stateless:
6
+ *
7
+ * 1. **Error introspection** (pattern A in the split plan) — pure helpers
8
+ * over `error: unknown` used by the SDK error-mapping paths in
9
+ * `ClaudeCodeCore`. Each helper narrows the structural shape captured by
10
+ * `ErrorLike` in `claude-errors.ts`. No instance state.
11
+ *
12
+ * 2. **Auth probes** (pattern B) — `checkAuth` is the cheap presence check
13
+ * used by the reactive execute path; `checkAuthDetailed` is the deeper
14
+ * probe consumed by `AuthHealthMonitor` and the setup wizard. Both are
15
+ * standalone async functions taking a `ClaudeAuthDeps` record holding
16
+ * the small subset of state they need (`cliPath` + `AgentConfig`).
17
+ * The deps record is a deliberate seam so the functions can be unit
18
+ * tested without spinning up a `ClaudeCodeCore` instance.
19
+ *
20
+ * The thin `checkAuth` / `checkAuthDetailed` / `isAuthError` / `getError*`
21
+ * methods on `ClaudeCodeCore` remain as transitional shims (file-split-plan
22
+ * §15) — they forward to the functions here so that test files which call
23
+ * `(core as any).isAuthError(...)` keep working without modification.
24
+ */
25
+ import { probeApiKeyServerSide } from "./api-key-probe.js";
26
+ import { readClaudeCredentials } from "./claude-credentials-store.js";
27
+ import { isPlausibleAnthropicApiKey } from "./cli-utils.js";
28
+ import { detectCloudProviderEnv } from "./claude-probe.js";
29
+ // ---------- Pattern A: error introspection helpers ----------
30
+ export function getErrorStatus(error) {
31
+ return typeof error === "object" && error !== null && "status" in error
32
+ ? error.status
33
+ : undefined;
34
+ }
35
+ export function getErrorCode(error) {
36
+ return typeof error === "object" && error !== null && typeof error.code === "string"
37
+ ? error.code
38
+ : undefined;
39
+ }
40
+ export function getErrorType(error) {
41
+ return typeof error === "object" && error !== null && typeof error.type === "string"
42
+ ? error.type
43
+ : undefined;
44
+ }
45
+ export function getErrorMessage(error) {
46
+ if (error instanceof Error) {
47
+ return error.message;
48
+ }
49
+ if (typeof error === "string") {
50
+ return error;
51
+ }
52
+ return "Claude backend execution failed";
53
+ }
54
+ export function isAuthError(error) {
55
+ const status = getErrorStatus(error);
56
+ if (status === 401 || status === 403) {
57
+ return true;
58
+ }
59
+ const code = getErrorCode(error)?.toLowerCase() ?? "";
60
+ const type = getErrorType(error)?.toLowerCase() ?? "";
61
+ if (code.includes("auth") ||
62
+ code.includes("forbidden") ||
63
+ code.includes("unauthorized") ||
64
+ type.includes("auth") ||
65
+ type.includes("forbidden") ||
66
+ type.includes("unauthorized")) {
67
+ return true;
68
+ }
69
+ return /unauthorized|forbidden|authentication|invalid api key|login required/i.test(getErrorMessage(error));
70
+ }
71
+ // ---------- Pattern B: auth probes ----------
72
+ /**
73
+ * Cheap presence check used by the reactive execute path. Returns a
74
+ * narrowed `method` so the dispatcher can include it in error telemetry,
75
+ * but never makes a network call.
76
+ */
77
+ export async function checkAuth(deps) {
78
+ const cloud = detectCloudProviderEnv();
79
+ if (cloud) {
80
+ if (cloud.missing.length > 0) {
81
+ return {
82
+ ok: false,
83
+ reason: `${cloud.flagEnvVar}=1 but missing required env vars: ${cloud.missing.join(", ")}`,
84
+ };
85
+ }
86
+ return { ok: true, method: cloud.method };
87
+ }
88
+ const rawApiKey = process.env.ANTHROPIC_API_KEY?.trim();
89
+ if (rawApiKey) {
90
+ if (!isPlausibleAnthropicApiKey(rawApiKey)) {
91
+ return {
92
+ ok: false,
93
+ reason: "ANTHROPIC_API_KEY is set but does not look like an Anthropic key (expected `sk-ant-…`).",
94
+ };
95
+ }
96
+ return { ok: true, method: "api_key" };
97
+ }
98
+ if (!deps.cliPath) {
99
+ return {
100
+ ok: false,
101
+ reason: "Claude Code CLI is not installed or not on PATH. Run `npm install -g @anthropic-ai/claude-code`.",
102
+ };
103
+ }
104
+ return { ok: true, method: "cli_login" };
105
+ }
106
+ /**
107
+ * Detailed auth probe used by AuthHealthMonitor and the dashboard setup
108
+ * wizard. Two modes:
109
+ * - **API key** (`ANTHROPIC_API_KEY`): format check + server-side probe
110
+ * via `probeApiKeyServerSide("anthropic", ...)` (roadmap §9.1).
111
+ * Throws on network/timeout so `checkAll()` records `probe_network_error`.
112
+ * - **CLI login**: reads `~/.claude/credentials.json` for `refreshToken`.
113
+ * Never writes to the Keychain or credentials file — refresh is left
114
+ * to the CLI (Phase 0 confirmed rotating refresh_tokens; daemon-driven
115
+ * refresh would race and corrupt state).
116
+ */
117
+ export async function checkAuthDetailed(deps) {
118
+ const cloud = detectCloudProviderEnv();
119
+ if (cloud) {
120
+ if (cloud.missing.length > 0) {
121
+ return {
122
+ ok: false,
123
+ status: "missing",
124
+ method: cloud.method,
125
+ detail: `${cloud.flagEnvVar}=1 but missing: ${cloud.missing.join(", ")}`,
126
+ recoveryCommand: `Set the missing env vars or unset ${cloud.flagEnvVar}`,
127
+ };
128
+ }
129
+ // Real auth happens inside the SDK against AWS / GCP / Azure. The
130
+ // daemon does not run a server-side probe for cloud providers — the
131
+ // first execution will surface any credential failure. Mark the
132
+ // status as `ok` here so the dashboard reports "Configured (cloud)";
133
+ // AuthHealthMonitor still re-runs this check hourly so a malformed
134
+ // env (env vars cleared after launch) flips the cache to `missing`.
135
+ return {
136
+ ok: true,
137
+ status: "ok",
138
+ method: cloud.method,
139
+ detail: `Configured via ${cloud.label} — runtime auth verified by Claude Code SDK`,
140
+ };
141
+ }
142
+ const rawApiKey = process.env.ANTHROPIC_API_KEY?.trim();
143
+ if (rawApiKey) {
144
+ if (!isPlausibleAnthropicApiKey(rawApiKey)) {
145
+ return {
146
+ ok: false,
147
+ status: "expired",
148
+ method: "api_key",
149
+ detail: "ANTHROPIC_API_KEY does not match Anthropic key format (expected `sk-ant-…`).",
150
+ recoveryCommand: "Unset ANTHROPIC_API_KEY or replace it with a valid Anthropic API key",
151
+ };
152
+ }
153
+ // Format is plausible — attempt a server-side probe to detect
154
+ // revoked keys within 1 hourly cycle (roadmap §9.1). On network
155
+ // failure, the probe throws and the caller (checkAll or check-auth
156
+ // route) records `probe_network_error` without flipping DB cache.
157
+ const probe = await probeApiKeyServerSide("anthropic", rawApiKey);
158
+ return {
159
+ ok: probe.ok,
160
+ status: probe.ok ? "ok" : "expired",
161
+ method: "api_key",
162
+ detail: probe.detail,
163
+ ...(!probe.ok && {
164
+ recoveryCommand: "Unset ANTHROPIC_API_KEY or replace it with a valid Anthropic API key",
165
+ }),
166
+ };
167
+ }
168
+ if (!deps.cliPath) {
169
+ return {
170
+ ok: false,
171
+ status: "missing",
172
+ method: "cli_login",
173
+ detail: "Claude Code CLI not found on PATH",
174
+ recoveryCommand: "npm install -g @anthropic-ai/claude-code",
175
+ };
176
+ }
177
+ const bundle = await readClaudeCredentials();
178
+ if (!bundle) {
179
+ return {
180
+ ok: false,
181
+ status: "expired",
182
+ method: "cli_login",
183
+ detail: "No Claude credentials found",
184
+ recoveryCommand: "claude auth login",
185
+ };
186
+ }
187
+ if (!bundle.refreshToken) {
188
+ return {
189
+ ok: false,
190
+ status: "expired",
191
+ method: "cli_login",
192
+ detail: "Credentials lack refresh_token — run `claude auth login`",
193
+ recoveryCommand: "claude auth login",
194
+ };
195
+ }
196
+ return { ok: true, status: "ok", method: "oauth" };
197
+ }
198
+ //# sourceMappingURL=claude-auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-auth.js","sourceRoot":"","sources":["../../../src/core/backends/claude-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAmB3D,+DAA+D;AAE/D,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAA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ey, type IntegrationState } from "@aitne/shared";
1
+ import { type AgentResult, type BackendModel } from "@aitne/shared";
2
2
  import type { AgentConfig } from "../../config.js";
3
3
  import type { AgentExecuteParams, AgentResumeParams, AuthCheckResult, DelegatedTaskInvokeParams, DelegatedTaskResultRaw, DelegatedToolInvokeParams, DelegatedToolResult, IAgentCore, McpSessionContext, ReadSensitiveTokenManager, StreamCallbacks } from "../agent-core.js";
4
4
  import { BackendQuotaError, BackendDecisiveFailure } from "../agent-core.js";
5
5
  import type { AgentWriteTracker } from "../../safety/agent-write-tracker.js";
6
- export declare const CLAUDE_PROBE_TOOLS_PROMPT: string;
7
- /**
8
- * Registry-driven allowlist entries for integrations currently delegated to
9
- * Claude. Under `permissionMode: "dontAsk"`, any tool not in the SDK's
10
- * `allowedTools` is silently denied — so a delegated Gmail / Calendar
11
- * integration whose skill instructs the agent to call
12
- * `mcp__claude_ai_Gmail__search_threads` will fail with "permission denied"
13
- * unless that exact tool name is pre-authorized here.
14
- *
15
- * Pure over `(integrations)` — callers pass the record read from
16
- * `db/integrations-store.ts#readIntegrations`. The SDK's MCP tool matcher is
17
- * literal (`mcp__<server>__<tool>` — see `services/mcp/risk.ts`), so we
18
- * enumerate every capability tool the registry declares rather than using a
19
- * wildcard. This guarantees the allowlist only widens by what the registry
20
- * explicitly advertises; adding a new connector tool demands a registry
21
- * update first.
22
- *
23
- * Only integrations whose `delegatedBackend === "claude"` contribute — a
24
- * Codex-delegated Gmail integration must not widen Claude's surface.
25
- */
26
- export declare function computeDelegatedClaudeTools(integrations: Partial<Record<IntegrationKey, IntegrationState>>): readonly string[];
27
- export declare class AgentTimeoutError extends Error {
28
- readonly timeoutMs: number;
29
- constructor(timeoutMs: number);
30
- }
31
- export interface ClaudeCodeQuotaResetHint {
32
- hour: number;
33
- minute: number;
34
- timeZone?: string;
35
- rawLabel: string;
36
- }
37
- export declare function isClaudeCodeQuotaError(error: unknown): boolean;
38
- export declare function isClaudeCodeMaxBudgetError(error: unknown): boolean;
39
- export declare function extractClaudeCodeQuotaResetHint(error: unknown): ClaudeCodeQuotaResetHint | null;
6
+ import { CLAUDE_PROBE_TOOLS_PROMPT, computeDelegatedClaudeTools, computeNativeClaudeTools } from "./claude-probe.js";
7
+ import { AgentTimeoutError, extractClaudeCodeQuotaResetHint, isClaudeCodeQuotaError } from "./claude-errors.js";
8
+ import { checkAuth as checkAuthFn } from "./claude-auth.js";
9
+ export { AgentTimeoutError, CLAUDE_PROBE_TOOLS_PROMPT, computeDelegatedClaudeTools, computeNativeClaudeTools, extractClaudeCodeQuotaResetHint, isClaudeCodeQuotaError, };
40
10
  /**
41
11
  * ClaudeCodeCore intentionally does NOT run a pre-flight `checkAuth()`
42
12
  * gate inside `execute()` / `runTurn()`. Codex and Gemini each call
@@ -155,23 +125,18 @@ export declare class ClaudeCodeCore implements IAgentCore {
155
125
  private getErrorMessage;
156
126
  private sleep;
157
127
  summarize(conversationText: string): Promise<string>;
158
- checkAuth(): Promise<{
159
- ok: true;
160
- method: "cli_login" | "api_key" | "oauth" | "vertex" | "bedrock" | "foundry";
161
- } | {
162
- ok: false;
163
- reason: string;
164
- }>;
165
128
  /**
166
- * Detailed auth probe used by AuthHealthMonitor and the dashboard setup
167
- * wizard. Two modes:
168
- * - **API key** (`ANTHROPIC_API_KEY`): format check + server-side probe
169
- * via `probeApiKeyServerSide("anthropic", ...)` (roadmap §9.1).
170
- * Throws on network/timeout so `checkAll()` records `probe_network_error`.
171
- * - **CLI login**: reads `~/.claude/credentials.json` for `refreshToken`.
172
- * Never writes to the Keychain or credentials file — refresh is left
173
- * to the CLI (Phase 0 confirmed rotating refresh_tokens; daemon-driven
174
- * refresh would race and corrupt state).
129
+ * Cheap presence check used by the reactive execute path. Detailed probe
130
+ * lives in `checkAuthDetailed`. Implementation moved to `./claude-auth.ts`
131
+ * (file-split-plan §8, Tier 2); this stays as a thin forwarder so the
132
+ * `IAgentCore` interface contract is unchanged and existing call sites in
133
+ * `BackendRouter` / `AuthHealthMonitor` continue to work.
134
+ */
135
+ checkAuth(): ReturnType<typeof checkAuthFn>;
136
+ /**
137
+ * Detailed auth probe used by `AuthHealthMonitor` and the dashboard setup
138
+ * wizard. Implementation moved to `./claude-auth.ts`; see the comment on
139
+ * `checkAuth` above.
175
140
  */
176
141
  checkAuthDetailed(): Promise<AuthCheckResult>;
177
142
  /**
@@ -215,84 +180,47 @@ export declare class ClaudeCodeCore implements IAgentCore {
215
180
  * whatever the registry already advertised.
216
181
  */
217
182
  private getAllowedTools;
218
- /**
219
- * Thin wrapper around the pure `computeDelegatedClaudeTools` helper that
220
- * pulls the integrations record from the wired mcp context. Returns `[]`
221
- * when the context is not yet wired (tests, startup ordering) — which
222
- * matches the pre-fix behavior for sessions that ran before the daemon
223
- * finished composing. A one-shot warning is emitted in `setMcpContext`
224
- * confirming wiring.
225
- */
226
183
  private getDelegatedClaudeTools;
227
- /**
228
- * DELEGATED-MODE-V2-DESIGN.md §4.3.3 — same-backend deny enforcement at
229
- * the SDK boundary. For every integration whose `delegatedBackend === "claude"`,
230
- * expand `state.deniedTools` against the connector's known tools and emit
231
- * the namespaced names (`mcp__claude_ai_<X>__<tool>`). The SDK refuses any
232
- * tool listed in `disallowedTools` regardless of `allowedTools` — hard
233
- * enforcement.
234
- *
235
- * Returns `[]` when context isn't wired (tests / pre-startup) and on read
236
- * failures, matching the conservative pattern used by
237
- * `getDelegatedClaudeTools`.
238
- */
184
+ private getNativeClaudeTools;
239
185
  private getSessionDeniedTools;
240
186
  /**
241
- * Security hooks:
242
- * 1. Bash(curl *) restrict to localhost Daemon API, block connection-override flags. (strict only)
243
- * 2. Bash(jq *) — block file-access flags and the `env` filter (process env exfiltration). (strict only)
244
- * 3. Write/Edit — block writes into the session helper dir and context dir, mark vault writes.
245
- *
246
- * In allow mode the curl and jq hooks are dropped, but the Write/Edit hook
247
- * stays: the context-dir chokepoint exists for memory integrity (today-write
248
- * lock, md_file_snapshots, CONTEXT_WRITE_PERMISSIONS), not permissions.
187
+ * Security hooks — thin shim that forwards to `buildSecurityHooks` in
188
+ * `./claude-tool-collection.ts`. The implementation lives there as a
189
+ * pure factory consuming a `SecurityHooksDeps` record. See that module
190
+ * for hook semantics; see `file-split-plan.md` §8 + §15 for why the
191
+ * shim stays here.
249
192
  */
250
193
  private getSecurityHooks;
251
194
  /**
252
- * Delegated proxy invocation Claude SDK path.
253
- *
254
- * Spawns a one-shot SDK `query()` constrained to a single `allowedTools`
255
- * entry (the requested connector tool), parses the structured stream
256
- * for the matching `tool_use` → `tool_result` pair, and returns the raw
257
- * tool result. The model's surrounding text is discarded — the route
258
- * handler only sees the connector's structured payload.
195
+ * Delegated-execution deps bundle. Built fresh per call so the captured
196
+ * `readTokenManager` / `readToken` reflect the latest state of the core's
197
+ * mutable fields (both can be re-wired post-construction via
198
+ * `setReadToken` / `setReadTokenManager`).
259
199
  *
260
- * Error classes (DelegatedToolErrorClass):
261
- * - `wrong_tool` — model called a tool we did not request (anti-prompt-injection).
262
- * - `no_tool_call` — model never invoked the tool within `maxTurns`.
263
- * - `tool_error` connector returned `is_error: true`.
264
- * - `parse_error` — stream produced no terminal `result` event.
265
- * - `auth_error` SDK reported `authentication_failed`.
266
- * - `timeout` — invoker's wall-clock signal aborted the stream.
267
- * - `subprocess_crashed` exception thrown out of the iterator.
268
- *
269
- * Cost is captured from the terminal `SDKResultMessage` regardless of
270
- * subtype so the invoker can attribute partial spend on the failure
271
- * paths (no_tool_call, wrong_tool, tool_error).
200
+ * Snapshot semantics — once handed to `runDelegated{Tool,Task}Fn`, the
201
+ * deps record is treated as immutable for the duration of the call. This
202
+ * is a deliberate, narrow strengthening of the pre-split behavior: the
203
+ * original re-read `this.readTokenManager` at revoke time, so a
204
+ * (hypothetical) mid-call replacement would revoke on the *new* manager
205
+ * — leaving a scope leak on the manager that issued the token.
206
+ * Production never replaces the manager after boot (`index.ts` wires it
207
+ * exactly once via `setReadTokenManager?`), so the two behaviors converge
208
+ * in practice; the new shape is simply more robust by construction.
209
+ */
210
+ private delegatedDeps;
211
+ /**
212
+ * Delegated proxy invocation — DELEGATED-PROXY-API-DESIGN.md §4.5.
213
+ * Implementation moved to `./claude-delegated.ts` (file-split-plan §8,
214
+ * Tier 2); this stays as a thin forwarder so the `IAgentCore` interface
215
+ * contract and existing call sites in `BackendRouter` /
216
+ * `DelegatedBackendInvoker` continue to dispatch through
217
+ * `core.runDelegatedTool`.
272
218
  */
273
219
  runDelegatedTool(params: DelegatedToolInvokeParams): Promise<DelegatedToolResult>;
274
220
  /**
275
- * DELEGATED-TASK-MODE-DESIGN.md §9.1 — Claude SDK task mode. The
276
- * subprocess plans + executes 1..N MCP calls within `allowedTools` and
277
- * emits a final assistant message that the runtime helper validates
278
- * against the caller's `outputSchema`.
279
- *
280
- * Stream parsing differences from `runDelegatedTool`:
281
- * - We accept multiple `tool_use` blocks (counted against `maxToolCalls`).
282
- * - We track per-tool durations to feed `onToolStep`.
283
- * - We capture the *final* assistant text (after the last tool turn)
284
- * as the validation target, not a single tool's `tool_result`.
285
- *
286
- * Safety:
287
- * - `allowedTools` already excludes the destructive set when
288
- * `allowDestructive: false`; the SDK will not surface those tools.
289
- * - `disallowedTools` is the absolute-block layer + the destructive
290
- * set as defense-in-depth (so a future relaxation of allowedTools
291
- * can't accidentally widen the surface).
292
- *
293
- * The §6.2 "no retry after write" rule is enforced at the invoker
294
- * layer; this method just signals via `writeClassToolFired` whether
295
- * any destructive tool ran during the task.
221
+ * Delegated task-mode invocation — DELEGATED-TASK-MODE-DESIGN.md §9.1.
222
+ * Implementation moved to `./claude-delegated.ts`; see the comment on
223
+ * `runDelegatedTool` above.
296
224
  */
297
225
  runDelegatedTask(params: DelegatedTaskInvokeParams): Promise<DelegatedTaskResultRaw>;
298
226
  }
@@ -1 +1 @@
1
- {"version":3,"file":"claude-code-core.d.ts","sourceRoot":"","sources":["../../../src/core/backends/claude-code-core.ts"],"names":[],"mappings":"AAWA,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,cAAc,EAC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;;;;;;;;;;;OAsBG;IACG,gBAAgB,CACpB,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,sBAAsB,CAAC;CA+YnC"}
1
+ {"version":3,"file":"claude-code-core.d.ts","sourceRoot":"","sources":["../../../src/core/backends/claude-code-core.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAKvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,yBAAyB,EACzB,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,EACnB,UAAU,EAEV,iBAAiB,EACjB,yBAAyB,EACzB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAO1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAgB7E,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EAGzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,+BAA+B,EAE/B,sBAAsB,EAEvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,SAAS,IAAI,WAAW,EAOzB,MAAM,kBAAkB,CAAC;AAgB1B,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,+BAA+B,EAC/B,sBAAsB,GACvB,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,cAAe,YAAW,UAAU;IAsB7C,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IA7BhC,QAAQ,CAAC,SAAS,EAAG,QAAQ,CAAU;IACvC,OAAO,CAAC,MAAM,CAAC,Q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