@aiwg/cli 2026.10.15 → 2026.10.18

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 (286) hide show
  1. package/agentic/code/providers/pi/aiwg-bridge.ts +45 -7
  2. package/dist/src/artifacts/citation-parser.js +7 -6
  3. package/dist/src/artifacts/corpus-tools/citation-densify.js +4 -2
  4. package/dist/src/artifacts/corpus-tools/cli.js +8 -3
  5. package/dist/src/artifacts/corpus-tools/discovery-log.js +26 -24
  6. package/dist/src/artifacts/corpus-tools/expand-cli.js +3 -2
  7. package/dist/src/artifacts/corpus-tools/expand-dates.js +107 -0
  8. package/dist/src/artifacts/corpus-tools/expand-queue.js +4 -1
  9. package/dist/src/artifacts/corpus-tools/expand-review.js +104 -0
  10. package/dist/src/artifacts/corpus-tools/expand-state.js +17 -1
  11. package/dist/src/artifacts/corpus-tools/expand.js +16 -17
  12. package/dist/src/artifacts/corpus-tools/induction-audit.js +7 -6
  13. package/dist/src/artifacts/corpus-tools/integrity-scan.js +3 -3
  14. package/dist/src/artifacts/corpus-tools/radar-shared.js +7 -9
  15. package/dist/src/artifacts/corpus-tools/ref-files.js +11 -0
  16. package/dist/src/artifacts/corpus-tools/resolve-cli.js +11 -3
  17. package/dist/src/artifacts/corpus-tools/resolve.js +42 -11
  18. package/dist/src/artifacts/corpus-tools/retrieval-lab.js +2 -1
  19. package/dist/src/artifacts/corpus-tools/sidecar-lint.js +4 -4
  20. package/dist/src/artifacts/corpus-tools/sidecar-repair.js +2 -1
  21. package/dist/src/artifacts/corpus-views/ref-parser.js +3 -17
  22. package/dist/src/artifacts/graph-query.js +5 -3
  23. package/dist/src/artifacts/hybrid-query.js +11 -2
  24. package/dist/src/artifacts/index-refresh.js +2 -0
  25. package/dist/src/artifacts/query-engine-corpus.js +217 -0
  26. package/dist/src/artifacts/query-engine-discover-output.js +229 -0
  27. package/dist/src/artifacts/query-engine-discover.js +285 -0
  28. package/dist/src/artifacts/query-engine-entries.js +188 -0
  29. package/dist/src/artifacts/query-engine-index.js +249 -0
  30. package/dist/src/artifacts/query-engine-matching.js +143 -0
  31. package/dist/src/artifacts/query-engine-options.js +2 -0
  32. package/dist/src/artifacts/query-engine-rules.js +202 -0
  33. package/dist/src/artifacts/query-engine-scoring.js +436 -0
  34. package/dist/src/artifacts/query-engine-show-card.js +194 -0
  35. package/dist/src/artifacts/query-engine-show-load.js +211 -0
  36. package/dist/src/artifacts/query-engine-show.js +300 -0
  37. package/dist/src/artifacts/query-engine.js +7 -2576
  38. package/dist/src/cli/handlers/daemon.js +17 -1
  39. package/dist/src/cli/handlers/doctor-args.js +10 -5
  40. package/dist/src/cli/handlers/doctor-help.js +4 -1
  41. package/dist/src/cli/handlers/index.js +2 -2
  42. package/dist/src/cli/handlers/mc-agents.js +111 -0
  43. package/dist/src/cli/handlers/mc-args.js +54 -0
  44. package/dist/src/cli/handlers/mc-control.js +227 -0
  45. package/dist/src/cli/handlers/mc-dispatch.js +203 -0
  46. package/dist/src/cli/handlers/mc-help.js +171 -0
  47. package/dist/src/cli/handlers/mc-run.js +343 -0
  48. package/dist/src/cli/handlers/mc-session.js +138 -0
  49. package/dist/src/cli/handlers/mc-status.js +258 -0
  50. package/dist/src/cli/handlers/mc-summary.js +43 -0
  51. package/dist/src/cli/handlers/mc-types.js +3 -0
  52. package/dist/src/cli/handlers/mc-worker.js +205 -0
  53. package/dist/src/cli/handlers/mc.js +12 -1665
  54. package/dist/src/cli/handlers/models-refusal.js +13 -0
  55. package/dist/src/cli/handlers/models-resource-sample.js +10 -0
  56. package/dist/src/cli/handlers/models.js +5 -3
  57. package/dist/src/cli/handlers/regenerate.js +8 -16
  58. package/dist/src/cli/handlers/remove-bundled.js +133 -0
  59. package/dist/src/cli/handlers/remove-options.js +31 -0
  60. package/dist/src/cli/handlers/remove-user.js +174 -0
  61. package/dist/src/cli/handlers/remove.js +201 -0
  62. package/dist/src/cli/handlers/sessions.js +7 -7
  63. package/dist/src/cli/handlers/subcommands-bundles.js +257 -0
  64. package/dist/src/cli/handlers/subcommands-discovery.js +165 -0
  65. package/dist/src/cli/handlers/subcommands-list-format.js +129 -0
  66. package/dist/src/cli/handlers/subcommands-list.js +250 -0
  67. package/dist/src/cli/handlers/subcommands-plugins.js +213 -0
  68. package/dist/src/cli/handlers/subcommands-quickref.js +58 -0
  69. package/dist/src/cli/handlers/subcommands-rlm.js +113 -0
  70. package/dist/src/cli/handlers/subcommands-services.js +66 -0
  71. package/dist/src/cli/handlers/subcommands-storage.js +259 -0
  72. package/dist/src/cli/handlers/subcommands.js +18 -1976
  73. package/dist/src/cli/handlers/update.js +157 -0
  74. package/dist/src/cli/handlers/use.js +14 -4
  75. package/dist/src/cli/handlers/utilities.js +3 -560
  76. package/dist/src/cli/handlers/utility-doctor.js +412 -0
  77. package/dist/src/cli/scope-resolver.js +1 -142
  78. package/dist/src/cli/services/deployment-verification.js +0 -1
  79. package/dist/src/cli/user-scope-mirror.js +173 -0
  80. package/dist/src/config/aiwg-config.js +2 -1
  81. package/dist/src/config/authorization-cli.js +7 -3
  82. package/dist/src/config/dispatch-host-thresholds.js +2 -0
  83. package/dist/src/config/dispatch-thresholds-runtime.d.mts +3 -2
  84. package/dist/src/config/dispatch-thresholds-runtime.mjs +21 -7
  85. package/dist/src/config/framework-aliases.js +12 -0
  86. package/dist/src/config/host-resource-report.d.mts +24 -0
  87. package/dist/src/config/host-resource-report.mjs +110 -0
  88. package/dist/src/config/host-resource-runtime.d.mts +37 -0
  89. package/dist/src/config/host-resource-runtime.mjs +296 -0
  90. package/dist/src/config/installed-selection.js +22 -0
  91. package/dist/src/config/worker-invocation-marker.d.mts +1 -0
  92. package/dist/src/config/worker-invocation-marker.mjs +2 -0
  93. package/dist/src/decision/ensemble-study/artifacts.js +7 -0
  94. package/dist/src/decision/ensemble-study/gate-policy.js +58 -0
  95. package/dist/src/decision/ensemble-study/gates.js +78 -0
  96. package/dist/src/decision/ensemble-study/protocol.js +18 -21
  97. package/dist/src/decision/ensemble-study/score.js +3 -2
  98. package/dist/src/decision/ensemble-study/statistics.js +7 -26
  99. package/dist/src/decision/heldout/access.js +74 -0
  100. package/dist/src/decision/heldout/calibration.js +1 -0
  101. package/dist/src/decision/heldout/collector.js +8 -1
  102. package/dist/src/decision/sensitivity/comparative-gates.js +135 -0
  103. package/dist/src/decision/sensitivity/comparative.js +18 -41
  104. package/dist/src/effects/verifiers/file.js +22 -5
  105. package/dist/src/extensions/claude-attribution.js +82 -0
  106. package/dist/src/extensions/claude-hooks-installer.js +133 -69
  107. package/dist/src/extensions/commands/daemon.js +109 -0
  108. package/dist/src/extensions/commands/definitions.js +5 -89
  109. package/dist/src/gates/evaluate.js +2 -358
  110. package/dist/src/gates/heldout.js +17 -7
  111. package/dist/src/gates/observations.js +363 -0
  112. package/dist/src/gates/pack-composition.js +270 -0
  113. package/dist/src/gates/pack-tightening.js +197 -0
  114. package/dist/src/gates/pack-validation.js +262 -0
  115. package/dist/src/gates/registry-error.js +5 -0
  116. package/dist/src/gates/registry.js +13 -685
  117. package/dist/src/lint/check-patterns.js +163 -0
  118. package/dist/src/lint/checks.js +268 -0
  119. package/dist/src/lint/reference-resolution.js +54 -0
  120. package/dist/src/lint/runner.js +3 -465
  121. package/dist/src/mcp/helpers.mjs +11 -1
  122. package/dist/src/mcp/json-document.mjs +29 -0
  123. package/dist/src/mcp/muse-native-config.mjs +1 -28
  124. package/dist/src/memory/project-registry.js +44 -4
  125. package/dist/src/mission-protocol/worker-review-gate.js +7 -0
  126. package/dist/src/models/worker-plan.js +36 -5
  127. package/dist/src/models/wrapper-deployment.js +25 -12
  128. package/dist/src/models/wrapper-enforcement.js +47 -7
  129. package/dist/src/network-analysis/research.js +2 -1
  130. package/dist/src/plugin/command-ownership.js +34 -0
  131. package/dist/src/plugin/skill-command-frontmatter.js +197 -0
  132. package/dist/src/plugin/skill-command-translator.js +6 -232
  133. package/dist/src/policy/hitl-check.js +14 -4
  134. package/dist/src/policy/hitl-consume.js +54 -0
  135. package/dist/src/policy/hitl-receipt.js +2 -0
  136. package/dist/src/policy/hitl.js +11 -3
  137. package/dist/src/providers/context-output-ownership.js +26 -0
  138. package/dist/src/providers/deployment-ownership.d.mts +19 -0
  139. package/dist/src/providers/deployment-ownership.mjs +226 -0
  140. package/dist/src/providers/deployment-removal.js +200 -0
  141. package/dist/src/providers/provider-context-contracts.js +162 -0
  142. package/dist/src/providers/provider-definition-schema.js +136 -0
  143. package/dist/src/providers/provider-definitions.js +8 -1298
  144. package/dist/src/providers/provider-seeds-1.js +360 -0
  145. package/dist/src/providers/provider-seeds-2.js +387 -0
  146. package/dist/src/providers/provider-seeds-3.js +262 -0
  147. package/dist/src/providers/removal-transaction.js +86 -0
  148. package/dist/src/providers/settings-document.d.mts +3 -0
  149. package/dist/src/providers/settings-document.mjs +47 -0
  150. package/dist/src/providers/settings-removal.js +190 -0
  151. package/dist/src/providers/skill-ownership.d.mts +19 -2
  152. package/dist/src/providers/skill-ownership.mjs +12 -4
  153. package/dist/src/providers/transformation-receipt-integration.js +15 -271
  154. package/dist/src/providers/transformation-receipt-outputs.js +99 -0
  155. package/dist/src/providers/transformation-receipt-source.js +194 -0
  156. package/dist/src/research/clients/arxiv.js +4 -30
  157. package/dist/src/research/clients/base.js +48 -22
  158. package/dist/src/research/identity.js +42 -4
  159. package/dist/src/research/query-cli.js +3 -87
  160. package/dist/src/research/query-options.js +87 -0
  161. package/dist/src/research/reference-match.js +105 -24
  162. package/dist/src/research/services/acquisition.js +9 -7
  163. package/dist/src/research/services/citation.js +5 -2
  164. package/dist/src/research/types.js +2 -0
  165. package/dist/src/rules/activation.mjs +15 -6
  166. package/dist/src/rules/core-startup.mjs +2 -2
  167. package/dist/src/serve/mission-conductor.js +52 -4
  168. package/dist/src/serve/mission-summary.js +56 -0
  169. package/dist/src/sessions/adapters/grok-build-native.js +23 -0
  170. package/dist/src/sessions/adapters/grok-build.js +14 -7
  171. package/dist/src/sessions/workspace-discovery.js +5 -5
  172. package/dist/src/smiths/context-pipeline/aiwg-md.js +39 -46
  173. package/dist/src/smiths/context-pipeline/claude-hook.js +1 -1
  174. package/dist/src/smiths/context-pipeline/code-regions.js +28 -0
  175. package/dist/src/smiths/context-pipeline/context-file-safety.js +3 -0
  176. package/dist/src/smiths/context-pipeline/finalization.js +81 -51
  177. package/dist/src/smiths/context-pipeline/generator.js +10 -11
  178. package/dist/src/smiths/context-pipeline/managed-hook.js +1 -1
  179. package/dist/src/smiths/context-pipeline/muse-bridge.js +2 -2
  180. package/dist/src/smiths/context-pipeline/provider-policy.js +6 -12
  181. package/dist/src/smiths/context-pipeline/workspace-audit.js +299 -0
  182. package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +148 -0
  183. package/dist/src/smiths/context-pipeline/workspace-context-shared.js +111 -0
  184. package/dist/src/smiths/context-pipeline/workspace-context.js +8 -1373
  185. package/dist/src/smiths/context-pipeline/workspace-doctor.js +192 -0
  186. package/dist/src/smiths/context-pipeline/workspace-document.js +201 -0
  187. package/dist/src/smiths/context-pipeline/workspace-extraction.js +205 -0
  188. package/dist/src/smiths/context-pipeline/workspace-migration.js +250 -0
  189. package/dist/src/smiths/hook-bridge/index.js +9 -0
  190. package/package.json +13 -1
  191. package/schemas/decision/D17StudyProtocol.v1.schema.json +39 -67
  192. package/schemas/decision/D29Study.v10.schema.json +65 -0
  193. package/tools/agents/deploy-agents.mjs +24 -675
  194. package/tools/agents/deploy-command-mirrors.mjs +229 -0
  195. package/tools/agents/deploy-options.mjs +258 -0
  196. package/tools/agents/deploy-support.mjs +165 -0
  197. package/tools/agents/providers/base-addon-discovery.mjs +139 -0
  198. package/tools/agents/providers/base-behaviors.mjs +168 -0
  199. package/tools/agents/providers/base-context.mjs +205 -0
  200. package/tools/agents/providers/base-contract.mjs +116 -0
  201. package/tools/agents/providers/base-files.mjs +252 -0
  202. package/tools/agents/providers/base-flat-artifacts.mjs +233 -0
  203. package/tools/agents/providers/base-framework-discovery.mjs +309 -0
  204. package/tools/agents/providers/base-frontmatter.mjs +196 -0
  205. package/tools/agents/providers/base-inventory.mjs +269 -0
  206. package/tools/agents/providers/base-kernel-skills.mjs +354 -0
  207. package/tools/agents/providers/base-migrations.mjs +258 -0
  208. package/tools/agents/providers/base-models-platforms.mjs +273 -0
  209. package/tools/agents/providers/base-rule-index.mjs +450 -0
  210. package/tools/agents/providers/base-runtime.mjs +60 -0
  211. package/tools/agents/providers/base-skill-copy.mjs +273 -0
  212. package/tools/agents/providers/base.mjs +16 -3364
  213. package/tools/agents/providers/claude-post-deploy.mjs +20 -1
  214. package/tools/agents/providers/context-write.mjs +4 -0
  215. package/tools/agents/providers/hermes-startup.mjs +0 -5
  216. package/tools/agents/providers/muse.mjs +7 -2
  217. package/tools/agents/providers/pi.mjs +3 -1
  218. package/tools/agents/providers/rule-delivery-surface.mjs +359 -0
  219. package/tools/agents/providers/rule-delivery.mjs +20 -1144
  220. package/tools/agents/providers/rule-deployment-commit.mjs +148 -0
  221. package/tools/agents/providers/rule-deployment-prepare.mjs +461 -0
  222. package/tools/agents/providers/rule-deployment-state.mjs +300 -0
  223. package/tools/agents/providers/rule-projection.mjs +3 -0
  224. package/tools/daemon/README.md +511 -0
  225. package/tools/daemon/adapters/base-adapter.mjs +84 -0
  226. package/tools/daemon/adapters/webhook-adapter.mjs +107 -0
  227. package/tools/daemon/agent-supervisor.mjs +299 -0
  228. package/tools/daemon/automation-engine.mjs +310 -0
  229. package/tools/daemon/autonomous-engine.mjs +346 -0
  230. package/tools/daemon/behavior-loader.mjs +316 -0
  231. package/tools/daemon/behavior.mjs +174 -0
  232. package/tools/daemon/concierge/intent-router.mjs +401 -0
  233. package/tools/daemon/concierge/orchestrator.mjs +272 -0
  234. package/tools/daemon/concierge/response-translator.mjs +462 -0
  235. package/tools/daemon/config.mjs +377 -0
  236. package/tools/daemon/cron-scheduler.mjs +178 -0
  237. package/tools/daemon/daemon-main.mjs +1169 -0
  238. package/tools/daemon/event-router.mjs +84 -0
  239. package/tools/daemon/file-watcher.mjs +383 -0
  240. package/tools/daemon/index.mjs +1181 -0
  241. package/tools/daemon/init-profile.mjs +124 -0
  242. package/tools/daemon/ipc-client.mjs +197 -0
  243. package/tools/daemon/ipc-ops-handlers.mjs +236 -0
  244. package/tools/daemon/ipc-server.mjs +275 -0
  245. package/tools/daemon/maintenance-owner.mjs +79 -0
  246. package/tools/daemon/memory-manager.mjs +386 -0
  247. package/tools/daemon/message-router.mjs +194 -0
  248. package/tools/daemon/provider-watcher.mjs +585 -0
  249. package/tools/daemon/pty-adapter.mjs +420 -0
  250. package/tools/daemon/repl-chat.mjs +359 -0
  251. package/tools/daemon/resource-bounds.mjs +88 -0
  252. package/tools/daemon/sandbox-transport.mjs +295 -0
  253. package/tools/daemon/scheduled-task-runner.mjs +535 -0
  254. package/tools/daemon/task-store.mjs +450 -0
  255. package/tools/daemon/tmux-manager.mjs +324 -0
  256. package/tools/daemon/update-policy.mjs +517 -0
  257. package/tools/daemon/web-server.mjs +399 -0
  258. package/tools/daemon/web-ui/index.html +585 -0
  259. package/tools/daemon/web-ui/styles.css +156 -0
  260. package/tools/docker/Dockerfile.daemon +35 -0
  261. package/tools/docker/container-manager.mjs +291 -0
  262. package/tools/messaging/adapter-registry.mjs +230 -0
  263. package/tools/messaging/adapters/base.mjs +326 -0
  264. package/tools/messaging/adapters/discord.mjs +462 -0
  265. package/tools/messaging/adapters/slack.mjs +402 -0
  266. package/tools/messaging/adapters/telegram.mjs +552 -0
  267. package/tools/messaging/chat-handler.mjs +297 -0
  268. package/tools/messaging/command-router.mjs +269 -0
  269. package/tools/messaging/event-bus.mjs +199 -0
  270. package/tools/messaging/index.mjs +456 -0
  271. package/tools/messaging/message-formatter.mjs +320 -0
  272. package/tools/messaging/room-manager.mjs +277 -0
  273. package/tools/messaging/types.mjs +94 -0
  274. package/tools/providers/pi-bridge-policy.mjs +4 -0
  275. package/tools/ralph-external/daemon-supervisor.mjs +394 -0
  276. package/tools/ralph-external/lib/behavior-registry.mjs +270 -0
  277. package/tools/ralph-external/lib/worker-invocation-processes.mjs +7 -4
  278. package/tools/ralph-external/lib/worker-isolation-args.mjs +217 -0
  279. package/tools/ralph-external/lib/worker-isolation-status.mjs +19 -0
  280. package/tools/ralph-external/lib/worker-isolation.mjs +11 -237
  281. package/tools/ralph-external/lib/worker-overflow.mjs +10 -2
  282. package/tools/ralph-external/lib/worker-termination.mjs +15 -8
  283. package/tools/ralph-external/lib/worker-unit-cleanup.mjs +72 -0
  284. package/tools/ralph-external/session-launcher.mjs +7 -7
  285. package/tools/scripts/resource-preflight.mjs +3 -242
  286. package/vscode-extension/schemas/aiwg.config.v1.json +2 -4
@@ -1,5 +1,5 @@
1
1
  import { createHash, randomUUID } from 'node:crypto';
2
- import { access, lstat, mkdir, readFile, readdir, rename, rm, writeFile } from 'node:fs/promises';
2
+ import { access, mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
3
3
  import { homedir } from 'node:os';
4
4
  import path from 'node:path';
5
5
  import { readAiwgConfig } from '../config/aiwg-config.js';
@@ -9,22 +9,9 @@ import { getProviderDefinition, getProviderKernelSkillPath, normalizeProviderDef
9
9
  import { createProviderTransformationReceipt, diagnoseProviderTransformationReceipt, providerTransformationReceiptPath, writeProviderTransformationReceipt, } from './transformation-receipt.js';
10
10
  const TRANSFORMER_ID = 'aiwg-provider-transformer';
11
11
  const TRANSFORMER_VERSION = '1';
12
- const MANAGED_SIDECAR = '.aiwg-manifest.json';
13
- const MANAGED_DIRECTORY_MARKER = '.aiwg-managed';
14
- const MANAGED_FILE_MARKER = /^(?:<!-- aiwg:managed |# aiwg:managed )/m;
15
- const FRAMEWORK_BUNDLE_DIRS = {
16
- all: 'sdlc-complete',
17
- sdlc: 'sdlc-complete',
18
- marketing: 'media-marketing-kit',
19
- 'media-curator': 'media-curator',
20
- research: 'research-complete',
21
- forensics: 'forensics-complete',
22
- dfir: 'forensics-complete',
23
- 'security-engineering': 'security-engineering',
24
- ops: 'ops-complete',
25
- validation: 'validation-complete',
26
- 'knowledge-base': 'knowledge-base',
27
- };
12
+ import { collectOwnedDirectory } from './transformation-receipt-outputs.js';
13
+ import { receiptBundles, sourceEvidence } from './transformation-receipt-source.js';
14
+ export { providerReceiptHasLocalSources, sourceVerificationsFromSignedWebRelease } from './transformation-receipt-source.js';
28
15
  const PROVIDER_TRANSFORMATION_EVIDENCE_STATE_SCHEMA = 'aiwg.provider-transformation-evidence-state.v1';
29
16
  export function providerTransformationEvidenceStatePath(projectRoot, provider, scope) {
30
17
  const receiptPath = providerTransformationReceiptPath(projectRoot, provider, scope);
@@ -102,93 +89,6 @@ function portablePath(root, absolute) {
102
89
  return null;
103
90
  return relative.split(path.sep).join('/');
104
91
  }
105
- async function regularFiles(root) {
106
- const files = [];
107
- let entries;
108
- try {
109
- entries = await readdir(root, { withFileTypes: true });
110
- }
111
- catch {
112
- return files;
113
- }
114
- for (const entry of entries) {
115
- const candidate = path.join(root, entry.name);
116
- if (entry.isDirectory())
117
- files.push(...await regularFiles(candidate));
118
- else if (entry.isFile())
119
- files.push(candidate);
120
- }
121
- return files;
122
- }
123
- async function addEntry(files, candidate) {
124
- try {
125
- const metadata = await lstat(candidate);
126
- if (metadata.isFile())
127
- files.add(candidate);
128
- else if (metadata.isDirectory()) {
129
- for (const file of await regularFiles(candidate))
130
- files.add(file);
131
- }
132
- }
133
- catch {
134
- // A registry or sidecar entry can describe a stale partial deployment.
135
- // Receipt finalization binds only successful on-disk outputs; an existing
136
- // receipt remains responsible for diagnosing later deletion.
137
- }
138
- }
139
- async function collectOwnedDirectory(directory, exactEntries, files) {
140
- for (const entry of exactEntries)
141
- await addEntry(files, path.join(directory, entry));
142
- const sidecarPath = path.join(directory, MANAGED_SIDECAR);
143
- try {
144
- const sidecar = JSON.parse(await readFile(sidecarPath, 'utf8'));
145
- const managed = sidecar.managed && typeof sidecar.managed === 'object'
146
- ? Object.keys(sidecar.managed)
147
- : [];
148
- if (managed.length > 0)
149
- files.add(sidecarPath);
150
- for (const name of managed) {
151
- if (name === path.basename(name) && name !== MANAGED_SIDECAR) {
152
- await addEntry(files, path.join(directory, name));
153
- }
154
- }
155
- }
156
- catch {
157
- // Missing or invalid sidecars are not ownership evidence.
158
- }
159
- let entries;
160
- try {
161
- entries = await readdir(directory, { withFileTypes: true });
162
- }
163
- catch {
164
- return;
165
- }
166
- for (const entry of entries) {
167
- const candidate = path.join(directory, entry.name);
168
- if (entry.isDirectory()) {
169
- try {
170
- const marker = await lstat(path.join(candidate, MANAGED_DIRECTORY_MARKER));
171
- if (!marker.isFile())
172
- continue;
173
- await addEntry(files, candidate);
174
- }
175
- catch {
176
- // Unmarked directories remain operator-owned.
177
- }
178
- continue;
179
- }
180
- if (!entry.isFile() || entry.name === MANAGED_SIDECAR)
181
- continue;
182
- try {
183
- const content = await readFile(candidate, 'utf8');
184
- if (MANAGED_FILE_MARKER.test(content))
185
- files.add(candidate);
186
- }
187
- catch {
188
- // Unreadable files cannot establish an ownership signal.
189
- }
190
- }
191
- }
192
92
  function artifactPaths(provider, scope) {
193
93
  const definition = getProviderDefinition(provider);
194
94
  if (!definition)
@@ -203,7 +103,7 @@ function artifactPaths(provider, scope) {
203
103
  behaviors: definition.paths.artifacts.behaviors ?? '',
204
104
  };
205
105
  }
206
- async function installedEntries(options) {
106
+ export async function installedEntries(options) {
207
107
  if (options.scope === 'user' && options.provider !== 'openhuman') {
208
108
  return (await readUserRegistry()).installed;
209
109
  }
@@ -220,172 +120,6 @@ function exactUserEntries(installed, bundles, provider, type) {
220
120
  }
221
121
  return [...entries].sort();
222
122
  }
223
- async function sourceBundleFiles(root) {
224
- const files = [];
225
- const walk = async (directory) => {
226
- const entries = await readdir(directory, { withFileTypes: true });
227
- for (const entry of entries) {
228
- const candidate = path.join(directory, entry.name);
229
- if (entry.isSymbolicLink())
230
- throw new Error(`canonical source bundle contains a symbolic link: ${candidate}`);
231
- if (entry.isDirectory())
232
- await walk(candidate);
233
- else if (entry.isFile())
234
- files.push(candidate);
235
- else
236
- throw new Error(`canonical source bundle contains a non-regular entry: ${candidate}`);
237
- }
238
- };
239
- await walk(root);
240
- const inventory = await Promise.all(files.map(async (absolutePath) => {
241
- const content = await readFile(absolutePath);
242
- return {
243
- path: path.relative(root, absolutePath).split(path.sep).join('/'),
244
- sha256: sha256(content),
245
- bytes: content.byteLength,
246
- absolutePath,
247
- };
248
- }));
249
- return inventory.sort((left, right) => left.path.localeCompare(right.path));
250
- }
251
- async function resolveSourceBundle(options, bundle, entry) {
252
- const candidates = [];
253
- if (entry?.source === 'project-local' && entry.localPath) {
254
- candidates.push(path.resolve(options.projectRoot, entry.localPath, 'manifest.json'));
255
- }
256
- const frameworkDir = FRAMEWORK_BUNDLE_DIRS[bundle] ?? bundle;
257
- candidates.push(path.join(options.frameworkRoot, 'agentic', 'code', 'frameworks', frameworkDir, 'manifest.json'), path.join(options.frameworkRoot, 'agentic', 'code', 'addons', bundle, 'manifest.json'), path.join(options.frameworkRoot, 'agentic', 'code', 'extensions', bundle, 'manifest.json'));
258
- for (const candidate of candidates) {
259
- try {
260
- await access(candidate);
261
- const root = path.dirname(candidate);
262
- const files = await sourceBundleFiles(root);
263
- if (files.length === 0)
264
- continue;
265
- return {
266
- digest: sha256(stable(files.map(({ path: file, sha256: digest, bytes }) => ({ path: file, sha256: digest, bytes })))),
267
- root,
268
- files,
269
- canonicalBytesAvailable: true,
270
- };
271
- }
272
- catch {
273
- // Continue through the canonical source locations.
274
- }
275
- }
276
- const recorded = entry?.manifestHash?.replace(/^sha256:/, '');
277
- return recorded && /^[a-f0-9]{64}$/.test(recorded)
278
- ? { digest: recorded, root: '', files: [], canonicalBytesAvailable: false }
279
- : null;
280
- }
281
- function receiptBundles(installed, options) {
282
- const deployed = Object.keys(installed)
283
- .filter(bundle => Boolean(installed[bundle]?.deployedTo[options.provider]))
284
- .sort();
285
- return deployed.length > 0 ? deployed : [...new Set(options.requestedBundles)].sort();
286
- }
287
- /**
288
- * Return whether the deployed provider surface includes project-local source
289
- * material that cannot be authenticated by an AIWG signed web release.
290
- */
291
- export async function providerReceiptHasLocalSources(rawOptions) {
292
- const provider = normalizeProviderDefinitionId(rawOptions.provider) ?? rawOptions.provider;
293
- const options = { ...rawOptions, provider };
294
- const installed = await installedEntries(options);
295
- return receiptBundles(installed, options)
296
- .some(bundle => installed[bundle]?.source === 'project-local');
297
- }
298
- /**
299
- * Convert an already signature-verified web release into the stable verifier
300
- * result contract for the complete canonical bundle consumed by deployment.
301
- * Every local file must match its signed descriptor; a registry's self-recorded
302
- * manifestHash is never an authentication boundary.
303
- */
304
- export async function sourceVerificationsFromSignedWebRelease(options, release) {
305
- const installed = await installedEntries(options);
306
- const results = {};
307
- for (const bundle of receiptBundles(installed, options)) {
308
- const entry = installed[bundle];
309
- if (entry?.source === 'project-local')
310
- continue;
311
- const source = await resolveSourceBundle(options, bundle, entry);
312
- if (!source?.canonicalBytesAvailable)
313
- continue;
314
- let matched = true;
315
- for (const file of source.files) {
316
- const relative = path.relative(options.frameworkRoot, file.absolutePath).split(path.sep).join('/');
317
- if (!relative || relative === '..' || relative.startsWith('../')) {
318
- matched = false;
319
- break;
320
- }
321
- const descriptor = release.descriptors.get(`raw/${relative}`);
322
- if (!descriptor || descriptor.sha256 !== file.sha256 || descriptor.size !== file.bytes) {
323
- matched = false;
324
- break;
325
- }
326
- }
327
- if (!matched)
328
- continue;
329
- const artifactName = `aiwg:bundle-inventory:${bundle}`;
330
- results[bundle] = {
331
- schemaVersion: 'aiwg.verify.result.v1',
332
- status: 'verified',
333
- exitCode: 0,
334
- artifact: { name: artifactName, sha256: source.digest },
335
- policy: 'aiwg-signed-web-release',
336
- identities: ['aiwg-release-publisher'],
337
- ...(release.channelSequence === undefined ? {} : {
338
- freshness: {
339
- namespace: 'aiwg',
340
- channel: release.selector,
341
- sequence: release.channelSequence,
342
- version: release.version,
343
- },
344
- }),
345
- diagnostics: [{
346
- code: 'SIGNED_RELEASE_DESCRIPTOR',
347
- message: `Exact canonical source bytes match signed release manifest ${release.manifestDigest}`,
348
- }],
349
- };
350
- }
351
- return results;
352
- }
353
- async function sourceEvidence(options, installed) {
354
- const bundles = [...new Set(options.requestedBundles)].sort();
355
- const materials = [];
356
- let authenticated = Boolean(options.sourceVerifications);
357
- for (const bundle of bundles) {
358
- const entry = installed[bundle];
359
- const source = await resolveSourceBundle(options, bundle, entry);
360
- if (!source) {
361
- return {
362
- subject: `aiwg:deployment:${sha256(bundles.join('\0')).slice(0, 24)}`,
363
- sha256: sha256(stable(materials)),
364
- verification: 'failed',
365
- };
366
- }
367
- const verification = options.sourceVerifications?.[bundle];
368
- if (!source.canonicalBytesAvailable
369
- || verification?.status !== 'verified'
370
- || verification.artifact.sha256 !== source.digest) {
371
- authenticated = false;
372
- }
373
- materials.push({
374
- bundle,
375
- digest: source.digest,
376
- source: entry?.source ?? 'unknown',
377
- version: entry?.version ?? 'unknown',
378
- });
379
- }
380
- const digest = sha256(stable(materials));
381
- return {
382
- subject: `aiwg:deployment:${digest.slice(0, 24)}`,
383
- sha256: digest,
384
- verification: options.sourceVerifications
385
- ? authenticated ? 'verified' : 'failed'
386
- : 'policy-exempt',
387
- };
388
- }
389
123
  function transformerEvidence(provider, scope) {
390
124
  const definition = getProviderDefinition(provider);
391
125
  const adapterContract = definition
@@ -415,12 +149,16 @@ export async function resolveProviderReceiptRuntimeEvidence(rawOptions) {
415
149
  const paths = artifactPaths(provider, options.scope);
416
150
  const outputRoot = path.resolve(options.outputRoot ?? (options.scope === 'user' ? homedir() : options.projectRoot));
417
151
  const ownedFiles = new Set();
152
+ const receiptDirectories = new Set([outputRoot, path.join(outputRoot, '.aiwg'), path.join(outputRoot, `.${provider}`)]);
418
153
  if (paths) {
419
154
  for (const type of ['agents', 'commands', 'skills', 'rules', 'behaviors']) {
420
155
  const configured = paths[type];
421
156
  if (!configured)
422
157
  continue;
423
158
  const directory = resolveProviderPathValue(configured, outputRoot);
159
+ receiptDirectories.add(path.dirname(directory));
160
+ if (path.basename(path.dirname(directory)) === '.aiwg')
161
+ receiptDirectories.add(path.dirname(path.dirname(directory)));
424
162
  const entries = options.scope === 'user'
425
163
  ? exactUserEntries(installed, evidenceOptions.requestedBundles, provider, type)
426
164
  : [];
@@ -432,6 +170,12 @@ export async function resolveProviderReceiptRuntimeEvidence(rawOptions) {
432
170
  await collectOwnedDirectory(kernel, [], ownedFiles);
433
171
  }
434
172
  }
173
+ // Settings, hooks and generated context now have explicit sidecars too.
174
+ for (const directory of receiptDirectories) {
175
+ await collectOwnedDirectory(directory, [], ownedFiles, outputRoot);
176
+ for (const child of ['hooks', 'plugins'])
177
+ await collectOwnedDirectory(path.join(directory, child), [], ownedFiles);
178
+ }
435
179
  const outputPaths = [...ownedFiles]
436
180
  .map(file => portablePath(outputRoot, file))
437
181
  .filter((file) => Boolean(file))
@@ -0,0 +1,99 @@
1
+ // Discover provider outputs from existing ownership evidence, including nested sidecars.
2
+ import { lstat, readFile, readdir } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ const MANAGED_SIDECAR = '.aiwg-manifest.json';
5
+ const MANAGED_DIRECTORY_MARKER = '.aiwg-managed';
6
+ const MANAGED_FILE_MARKER = /^(?:<!-- aiwg:managed |# aiwg:managed )/m;
7
+ function safeChild(root, name) {
8
+ const relative = path.relative(root, path.resolve(root, name));
9
+ return Boolean(relative) && relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
10
+ }
11
+ async function regularFiles(root) {
12
+ const files = [];
13
+ let entries;
14
+ try {
15
+ entries = await readdir(root, { withFileTypes: true });
16
+ }
17
+ catch {
18
+ return files;
19
+ }
20
+ for (const entry of entries) {
21
+ const candidate = path.join(root, entry.name);
22
+ if (entry.isDirectory())
23
+ files.push(...await regularFiles(candidate));
24
+ else if (entry.isFile())
25
+ files.push(candidate);
26
+ }
27
+ return files;
28
+ }
29
+ async function addEntry(files, candidate) {
30
+ try {
31
+ const metadata = await lstat(candidate);
32
+ if (metadata.isFile())
33
+ files.add(candidate);
34
+ else if (metadata.isDirectory()) {
35
+ for (const file of await regularFiles(candidate))
36
+ files.add(file);
37
+ }
38
+ }
39
+ catch {
40
+ // A registry or sidecar entry can describe a stale partial deployment.
41
+ // Receipt finalization binds only successful on-disk outputs; an existing
42
+ // receipt remains responsible for diagnosing later deletion.
43
+ }
44
+ }
45
+ export async function collectOwnedDirectory(directory, exactEntries, files, projectRoot) {
46
+ for (const entry of exactEntries)
47
+ await addEntry(files, path.join(directory, entry));
48
+ const sidecarPath = path.join(directory, MANAGED_SIDECAR);
49
+ try {
50
+ const sidecar = JSON.parse(await readFile(sidecarPath, 'utf8'));
51
+ const managed = sidecar.managed && typeof sidecar.managed === 'object'
52
+ ? Object.keys(sidecar.managed)
53
+ : [];
54
+ if (managed.length > 0)
55
+ files.add(sidecarPath);
56
+ const base = projectRoot && directory === path.join(projectRoot, '.aiwg') && sidecar.scope === 'project' ? projectRoot : directory;
57
+ for (const name of managed) {
58
+ if (name !== MANAGED_SIDECAR && safeChild(base, name)) {
59
+ await addEntry(files, path.join(base, name));
60
+ }
61
+ }
62
+ }
63
+ catch {
64
+ // Missing or invalid sidecars are not ownership evidence.
65
+ }
66
+ let entries;
67
+ try {
68
+ entries = await readdir(directory, { withFileTypes: true });
69
+ }
70
+ catch {
71
+ return;
72
+ }
73
+ for (const entry of entries) {
74
+ const candidate = path.join(directory, entry.name);
75
+ if (entry.isDirectory()) {
76
+ try {
77
+ const marker = await lstat(path.join(candidate, MANAGED_DIRECTORY_MARKER));
78
+ if (!marker.isFile())
79
+ continue;
80
+ await addEntry(files, candidate);
81
+ }
82
+ catch {
83
+ // Unmarked directories remain operator-owned.
84
+ }
85
+ continue;
86
+ }
87
+ if (!entry.isFile() || entry.name === MANAGED_SIDECAR)
88
+ continue;
89
+ try {
90
+ const content = await readFile(candidate, 'utf8');
91
+ if (MANAGED_FILE_MARKER.test(content))
92
+ files.add(candidate);
93
+ }
94
+ catch {
95
+ // Unreadable files cannot establish an ownership signal.
96
+ }
97
+ }
98
+ }
99
+ //# sourceMappingURL=transformation-receipt-outputs.js.map
@@ -0,0 +1,194 @@
1
+ // Authenticate canonical source inventories for provider transformation receipts.
2
+ import { createHash } from 'node:crypto';
3
+ import { access, readFile, readdir } from 'node:fs/promises';
4
+ import path from 'node:path';
5
+ import { normalizeProviderDefinitionId } from './provider-definitions.js';
6
+ import { installedEntries } from './transformation-receipt-integration.js';
7
+ const sha256 = (value) => createHash('sha256').update(value).digest('hex');
8
+ function stable(value) {
9
+ if (Array.isArray(value))
10
+ return `[${value.map(stable).join(',')}]`;
11
+ if (value && typeof value === 'object')
12
+ return `{${Object.keys(value).sort().map(key => `${JSON.stringify(key)}:${stable(value[key])}`).join(',')}}`;
13
+ return JSON.stringify(value) ?? 'null';
14
+ }
15
+ const FRAMEWORK_BUNDLE_DIRS = {
16
+ all: 'sdlc-complete',
17
+ sdlc: 'sdlc-complete',
18
+ marketing: 'media-marketing-kit',
19
+ 'media-curator': 'media-curator',
20
+ research: 'research-complete',
21
+ forensics: 'forensics-complete',
22
+ dfir: 'forensics-complete',
23
+ 'security-engineering': 'security-engineering',
24
+ ops: 'ops-complete',
25
+ validation: 'validation-complete',
26
+ 'knowledge-base': 'knowledge-base',
27
+ };
28
+ async function sourceBundleFiles(root) {
29
+ const files = [];
30
+ const walk = async (directory) => {
31
+ const entries = await readdir(directory, { withFileTypes: true });
32
+ for (const entry of entries) {
33
+ const candidate = path.join(directory, entry.name);
34
+ if (entry.isSymbolicLink())
35
+ throw new Error(`canonical source bundle contains a symbolic link: ${candidate}`);
36
+ if (entry.isDirectory())
37
+ await walk(candidate);
38
+ else if (entry.isFile())
39
+ files.push(candidate);
40
+ else
41
+ throw new Error(`canonical source bundle contains a non-regular entry: ${candidate}`);
42
+ }
43
+ };
44
+ await walk(root);
45
+ const inventory = await Promise.all(files.map(async (absolutePath) => {
46
+ const content = await readFile(absolutePath);
47
+ return {
48
+ path: path.relative(root, absolutePath).split(path.sep).join('/'),
49
+ sha256: sha256(content),
50
+ bytes: content.byteLength,
51
+ absolutePath,
52
+ };
53
+ }));
54
+ return inventory.sort((left, right) => left.path.localeCompare(right.path));
55
+ }
56
+ async function resolveSourceBundle(options, bundle, entry) {
57
+ const candidates = [];
58
+ if (entry?.source === 'project-local' && entry.localPath) {
59
+ candidates.push(path.resolve(options.projectRoot, entry.localPath, 'manifest.json'));
60
+ }
61
+ const frameworkDir = FRAMEWORK_BUNDLE_DIRS[bundle] ?? bundle;
62
+ candidates.push(path.join(options.frameworkRoot, 'agentic', 'code', 'frameworks', frameworkDir, 'manifest.json'), path.join(options.frameworkRoot, 'agentic', 'code', 'addons', bundle, 'manifest.json'), path.join(options.frameworkRoot, 'agentic', 'code', 'extensions', bundle, 'manifest.json'));
63
+ for (const candidate of candidates) {
64
+ try {
65
+ await access(candidate);
66
+ const root = path.dirname(candidate);
67
+ const files = await sourceBundleFiles(root);
68
+ if (files.length === 0)
69
+ continue;
70
+ return {
71
+ digest: sha256(stable(files.map(({ path: file, sha256: digest, bytes }) => ({ path: file, sha256: digest, bytes })))),
72
+ root,
73
+ files,
74
+ canonicalBytesAvailable: true,
75
+ };
76
+ }
77
+ catch {
78
+ // Continue through the canonical source locations.
79
+ }
80
+ }
81
+ const recorded = entry?.manifestHash?.replace(/^sha256:/, '');
82
+ return recorded && /^[a-f0-9]{64}$/.test(recorded)
83
+ ? { digest: recorded, root: '', files: [], canonicalBytesAvailable: false }
84
+ : null;
85
+ }
86
+ export function receiptBundles(installed, options) {
87
+ const deployed = Object.keys(installed)
88
+ .filter(bundle => Boolean(installed[bundle]?.deployedTo[options.provider]))
89
+ .sort();
90
+ return deployed.length > 0 ? deployed : [...new Set(options.requestedBundles)].sort();
91
+ }
92
+ /**
93
+ * Return whether the deployed provider surface includes project-local source
94
+ * material that cannot be authenticated by an AIWG signed web release.
95
+ */
96
+ export async function providerReceiptHasLocalSources(rawOptions) {
97
+ const provider = normalizeProviderDefinitionId(rawOptions.provider) ?? rawOptions.provider;
98
+ const options = { ...rawOptions, provider };
99
+ const installed = await installedEntries(options);
100
+ return receiptBundles(installed, options)
101
+ .some(bundle => installed[bundle]?.source === 'project-local');
102
+ }
103
+ /**
104
+ * Convert an already signature-verified web release into the stable verifier
105
+ * result contract for the complete canonical bundle consumed by deployment.
106
+ * Every local file must match its signed descriptor; a registry's self-recorded
107
+ * manifestHash is never an authentication boundary.
108
+ */
109
+ export async function sourceVerificationsFromSignedWebRelease(options, release) {
110
+ const installed = await installedEntries(options);
111
+ const results = {};
112
+ for (const bundle of receiptBundles(installed, options)) {
113
+ const entry = installed[bundle];
114
+ if (entry?.source === 'project-local')
115
+ continue;
116
+ const source = await resolveSourceBundle(options, bundle, entry);
117
+ if (!source?.canonicalBytesAvailable)
118
+ continue;
119
+ let matched = true;
120
+ for (const file of source.files) {
121
+ const relative = path.relative(options.frameworkRoot, file.absolutePath).split(path.sep).join('/');
122
+ if (!relative || relative === '..' || relative.startsWith('../')) {
123
+ matched = false;
124
+ break;
125
+ }
126
+ const descriptor = release.descriptors.get(`raw/${relative}`);
127
+ if (!descriptor || descriptor.sha256 !== file.sha256 || descriptor.size !== file.bytes) {
128
+ matched = false;
129
+ break;
130
+ }
131
+ }
132
+ if (!matched)
133
+ continue;
134
+ const artifactName = `aiwg:bundle-inventory:${bundle}`;
135
+ results[bundle] = {
136
+ schemaVersion: 'aiwg.verify.result.v1',
137
+ status: 'verified',
138
+ exitCode: 0,
139
+ artifact: { name: artifactName, sha256: source.digest },
140
+ policy: 'aiwg-signed-web-release',
141
+ identities: ['aiwg-release-publisher'],
142
+ ...(release.channelSequence === undefined ? {} : {
143
+ freshness: {
144
+ namespace: 'aiwg',
145
+ channel: release.selector,
146
+ sequence: release.channelSequence,
147
+ version: release.version,
148
+ },
149
+ }),
150
+ diagnostics: [{
151
+ code: 'SIGNED_RELEASE_DESCRIPTOR',
152
+ message: `Exact canonical source bytes match signed release manifest ${release.manifestDigest}`,
153
+ }],
154
+ };
155
+ }
156
+ return results;
157
+ }
158
+ export async function sourceEvidence(options, installed) {
159
+ const bundles = [...new Set(options.requestedBundles)].sort();
160
+ const materials = [];
161
+ let authenticated = Boolean(options.sourceVerifications);
162
+ for (const bundle of bundles) {
163
+ const entry = installed[bundle];
164
+ const source = await resolveSourceBundle(options, bundle, entry);
165
+ if (!source) {
166
+ return {
167
+ subject: `aiwg:deployment:${sha256(bundles.join('\0')).slice(0, 24)}`,
168
+ sha256: sha256(stable(materials)),
169
+ verification: 'failed',
170
+ };
171
+ }
172
+ const verification = options.sourceVerifications?.[bundle];
173
+ if (!source.canonicalBytesAvailable
174
+ || verification?.status !== 'verified'
175
+ || verification.artifact.sha256 !== source.digest) {
176
+ authenticated = false;
177
+ }
178
+ materials.push({
179
+ bundle,
180
+ digest: source.digest,
181
+ source: entry?.source ?? 'unknown',
182
+ version: entry?.version ?? 'unknown',
183
+ });
184
+ }
185
+ const digest = sha256(stable(materials));
186
+ return {
187
+ subject: `aiwg:deployment:${digest.slice(0, 24)}`,
188
+ sha256: digest,
189
+ verification: options.sourceVerifications
190
+ ? authenticated ? 'verified' : 'failed'
191
+ : 'policy-exempt',
192
+ };
193
+ }
194
+ //# sourceMappingURL=transformation-receipt-source.js.map
@@ -15,9 +15,9 @@ export class ArxivClient extends BaseClient {
15
15
  baseUrl: 'http://export.arxiv.org/api',
16
16
  timeout: 30000,
17
17
  rateLimit: {
18
- maxTokens: 3,
18
+ maxTokens: 1,
19
19
  refillRate: 1 / 3, // 1 request per 3 seconds
20
- currentTokens: 3,
20
+ currentTokens: 1,
21
21
  lastRefill: Date.now(),
22
22
  },
23
23
  retry: {
@@ -39,7 +39,7 @@ export class ArxivClient extends BaseClient {
39
39
  id_list: normalizedId,
40
40
  max_results: 1,
41
41
  });
42
- const xmlText = await this.requestXml(url);
42
+ const xmlText = await this.requestText(url);
43
43
  const papers = this.parseAtomFeed(xmlText);
44
44
  if (papers.length === 0) {
45
45
  throw new ResearchError(ResearchErrorCode.RF_300, `arXiv paper not found: ${arxivId}`);
@@ -56,7 +56,7 @@ export class ArxivClient extends BaseClient {
56
56
  start: offset,
57
57
  max_results: limit,
58
58
  });
59
- const xmlText = await this.requestXml(url);
59
+ const xmlText = await this.requestText(url);
60
60
  const papers = this.parseAtomFeed(xmlText);
61
61
  // arXiv doesn't provide total count, so we estimate
62
62
  const hasMore = papers.length === limit;
@@ -68,32 +68,6 @@ export class ArxivClient extends BaseClient {
68
68
  hasMore,
69
69
  };
70
70
  }
71
- /**
72
- * Request XML from arXiv API
73
- */
74
- async requestXml(url) {
75
- await this.rateLimiter.acquire();
76
- const controller = new AbortController();
77
- const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
78
- try {
79
- const response = await fetch(url, {
80
- signal: controller.signal,
81
- });
82
- if (!response.ok) {
83
- throw new ResearchError(ResearchErrorCode.RF_200, `arXiv API error: ${response.status}`);
84
- }
85
- return await response.text();
86
- }
87
- catch (error) {
88
- if (error instanceof Error && error.name === 'AbortError') {
89
- throw new ResearchError(ResearchErrorCode.RF_104, `Request timeout after ${this.config.timeout}ms`, error);
90
- }
91
- throw error;
92
- }
93
- finally {
94
- clearTimeout(timeoutId);
95
- }
96
- }
97
71
  /**
98
72
  * Parse Atom XML feed from arXiv
99
73
  */