@microvac/adapter-codex-local 0.0.0-stage → 0.1.0-rc.15

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 (300) hide show
  1. package/dist/cli/format-event.d.ts +2 -0
  2. package/dist/cli/format-event.d.ts.map +1 -0
  3. package/dist/cli/format-event.js +218 -0
  4. package/dist/cli/format-event.js.map +1 -0
  5. package/dist/cli/index.d.ts +2 -0
  6. package/dist/cli/index.d.ts.map +1 -0
  7. package/dist/cli/index.js +2 -0
  8. package/dist/cli/index.js.map +1 -0
  9. package/dist/cli/quota-probe.d.ts +3 -0
  10. package/dist/cli/quota-probe.d.ts.map +1 -0
  11. package/dist/cli/quota-probe.js +104 -0
  12. package/dist/cli/quota-probe.js.map +1 -0
  13. package/dist/index.d.ts +41 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +268 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/index.test.d.ts +2 -0
  18. package/dist/index.test.d.ts.map +1 -0
  19. package/dist/index.test.js +125 -0
  20. package/dist/index.test.js.map +1 -0
  21. package/dist/server/acp.cli-version.test.d.ts +2 -0
  22. package/dist/server/acp.cli-version.test.d.ts.map +1 -0
  23. package/dist/server/acp.cli-version.test.js +151 -0
  24. package/dist/server/acp.cli-version.test.js.map +1 -0
  25. package/dist/server/acp.d.ts +31 -0
  26. package/dist/server/acp.d.ts.map +1 -0
  27. package/dist/server/acp.js +608 -0
  28. package/dist/server/acp.js.map +1 -0
  29. package/dist/server/acp.quota.test.d.ts +2 -0
  30. package/dist/server/acp.quota.test.d.ts.map +1 -0
  31. package/dist/server/acp.quota.test.js +176 -0
  32. package/dist/server/acp.quota.test.js.map +1 -0
  33. package/dist/server/acp.test.d.ts +2 -0
  34. package/dist/server/acp.test.d.ts.map +1 -0
  35. package/dist/server/acp.test.js +1263 -0
  36. package/dist/server/acp.test.js.map +1 -0
  37. package/dist/server/adapter-auth-promotion.d.ts +102 -0
  38. package/dist/server/adapter-auth-promotion.d.ts.map +1 -0
  39. package/dist/server/adapter-auth-promotion.js +210 -0
  40. package/dist/server/adapter-auth-promotion.js.map +1 -0
  41. package/dist/server/adapter-auth-promotion.test.d.ts +2 -0
  42. package/dist/server/adapter-auth-promotion.test.d.ts.map +1 -0
  43. package/dist/server/adapter-auth-promotion.test.js +615 -0
  44. package/dist/server/adapter-auth-promotion.test.js.map +1 -0
  45. package/dist/server/auth-check.d.ts +8 -0
  46. package/dist/server/auth-check.d.ts.map +1 -0
  47. package/dist/server/auth-check.js +8 -0
  48. package/dist/server/auth-check.js.map +1 -0
  49. package/dist/server/auth-precedence.d.ts +16 -0
  50. package/dist/server/auth-precedence.d.ts.map +1 -0
  51. package/dist/server/auth-precedence.js +20 -0
  52. package/dist/server/auth-precedence.js.map +1 -0
  53. package/dist/server/auth-precedence.test.d.ts +2 -0
  54. package/dist/server/auth-precedence.test.d.ts.map +1 -0
  55. package/dist/server/auth-precedence.test.js +100 -0
  56. package/dist/server/auth-precedence.test.js.map +1 -0
  57. package/dist/server/cli-version.d.ts +45 -0
  58. package/dist/server/cli-version.d.ts.map +1 -0
  59. package/dist/server/cli-version.js +95 -0
  60. package/dist/server/cli-version.js.map +1 -0
  61. package/dist/server/codex-args.d.ts +13 -0
  62. package/dist/server/codex-args.d.ts.map +1 -0
  63. package/dist/server/codex-args.js +64 -0
  64. package/dist/server/codex-args.js.map +1 -0
  65. package/dist/server/codex-args.test.d.ts +2 -0
  66. package/dist/server/codex-args.test.d.ts.map +1 -0
  67. package/dist/server/codex-args.test.js +257 -0
  68. package/dist/server/codex-args.test.js.map +1 -0
  69. package/dist/server/codex-auth-cache.d.ts +179 -0
  70. package/dist/server/codex-auth-cache.d.ts.map +1 -0
  71. package/dist/server/codex-auth-cache.js +520 -0
  72. package/dist/server/codex-auth-cache.js.map +1 -0
  73. package/dist/server/codex-auth-cache.test.d.ts +2 -0
  74. package/dist/server/codex-auth-cache.test.d.ts.map +1 -0
  75. package/dist/server/codex-auth-cache.test.js +530 -0
  76. package/dist/server/codex-auth-cache.test.js.map +1 -0
  77. package/dist/server/codex-auth-copyback.d.ts +53 -0
  78. package/dist/server/codex-auth-copyback.d.ts.map +1 -0
  79. package/dist/server/codex-auth-copyback.js +123 -0
  80. package/dist/server/codex-auth-copyback.js.map +1 -0
  81. package/dist/server/codex-auth-copyback.test.d.ts +2 -0
  82. package/dist/server/codex-auth-copyback.test.d.ts.map +1 -0
  83. package/dist/server/codex-auth-copyback.test.js +507 -0
  84. package/dist/server/codex-auth-copyback.test.js.map +1 -0
  85. package/dist/server/codex-auth-merge-decision.cjs +170 -0
  86. package/dist/server/codex-auth-merge-decision.d.ts +22 -0
  87. package/dist/server/codex-auth-merge-decision.d.ts.map +1 -0
  88. package/dist/server/codex-auth-merge-decision.js +58 -0
  89. package/dist/server/codex-auth-merge-decision.js.map +1 -0
  90. package/dist/server/codex-auth-merge-decision.test.d.ts +2 -0
  91. package/dist/server/codex-auth-merge-decision.test.d.ts.map +1 -0
  92. package/dist/server/codex-auth-merge-decision.test.js +215 -0
  93. package/dist/server/codex-auth-merge-decision.test.js.map +1 -0
  94. package/dist/server/codex-auth-merge-extract.sh +73 -0
  95. package/dist/server/codex-auth-merge-scripts.d.ts +21 -0
  96. package/dist/server/codex-auth-merge-scripts.d.ts.map +1 -0
  97. package/dist/server/codex-auth-merge-scripts.js +40 -0
  98. package/dist/server/codex-auth-merge-scripts.js.map +1 -0
  99. package/dist/server/codex-auth-merge.test.d.ts +2 -0
  100. package/dist/server/codex-auth-merge.test.d.ts.map +1 -0
  101. package/dist/server/codex-auth-merge.test.js +714 -0
  102. package/dist/server/codex-auth-merge.test.js.map +1 -0
  103. package/dist/server/codex-auth-seed-write.d.ts +30 -0
  104. package/dist/server/codex-auth-seed-write.d.ts.map +1 -0
  105. package/dist/server/codex-auth-seed-write.js +41 -0
  106. package/dist/server/codex-auth-seed-write.js.map +1 -0
  107. package/dist/server/codex-home.d.ts +169 -0
  108. package/dist/server/codex-home.d.ts.map +1 -0
  109. package/dist/server/codex-home.js +822 -0
  110. package/dist/server/codex-home.js.map +1 -0
  111. package/dist/server/codex-home.test.d.ts +2 -0
  112. package/dist/server/codex-home.test.d.ts.map +1 -0
  113. package/dist/server/codex-home.test.js +1287 -0
  114. package/dist/server/codex-home.test.js.map +1 -0
  115. package/dist/server/config-schema.d.ts +3 -0
  116. package/dist/server/config-schema.d.ts.map +1 -0
  117. package/dist/server/config-schema.js +67 -0
  118. package/dist/server/config-schema.js.map +1 -0
  119. package/dist/server/device-login-export.d.ts +56 -0
  120. package/dist/server/device-login-export.d.ts.map +1 -0
  121. package/dist/server/device-login-export.js +230 -0
  122. package/dist/server/device-login-export.js.map +1 -0
  123. package/dist/server/device-login-export.test.d.ts +2 -0
  124. package/dist/server/device-login-export.test.d.ts.map +1 -0
  125. package/dist/server/device-login-export.test.js +245 -0
  126. package/dist/server/device-login-export.test.js.map +1 -0
  127. package/dist/server/device-login-parse.d.ts +20 -0
  128. package/dist/server/device-login-parse.d.ts.map +1 -0
  129. package/dist/server/device-login-parse.js +155 -0
  130. package/dist/server/device-login-parse.js.map +1 -0
  131. package/dist/server/device-login-parse.test.d.ts +2 -0
  132. package/dist/server/device-login-parse.test.d.ts.map +1 -0
  133. package/dist/server/device-login-parse.test.js +269 -0
  134. package/dist/server/device-login-parse.test.js.map +1 -0
  135. package/dist/server/device-login-runner.d.ts +69 -0
  136. package/dist/server/device-login-runner.d.ts.map +1 -0
  137. package/dist/server/device-login-runner.js +110 -0
  138. package/dist/server/device-login-runner.js.map +1 -0
  139. package/dist/server/device-login-runner.test.d.ts +2 -0
  140. package/dist/server/device-login-runner.test.d.ts.map +1 -0
  141. package/dist/server/device-login-runner.test.js +201 -0
  142. package/dist/server/device-login-runner.test.js.map +1 -0
  143. package/dist/server/engine-availability.test.d.ts +2 -0
  144. package/dist/server/engine-availability.test.d.ts.map +1 -0
  145. package/dist/server/engine-availability.test.js +41 -0
  146. package/dist/server/engine-availability.test.js.map +1 -0
  147. package/dist/server/execute.acp-fallback.test.d.ts +2 -0
  148. package/dist/server/execute.acp-fallback.test.d.ts.map +1 -0
  149. package/dist/server/execute.acp-fallback.test.js +123 -0
  150. package/dist/server/execute.acp-fallback.test.js.map +1 -0
  151. package/dist/server/execute.auth-precedence.test.d.ts +2 -0
  152. package/dist/server/execute.auth-precedence.test.d.ts.map +1 -0
  153. package/dist/server/execute.auth-precedence.test.js +137 -0
  154. package/dist/server/execute.auth-precedence.test.js.map +1 -0
  155. package/dist/server/execute.auth.test.d.ts +2 -0
  156. package/dist/server/execute.auth.test.d.ts.map +1 -0
  157. package/dist/server/execute.auth.test.js +197 -0
  158. package/dist/server/execute.auth.test.js.map +1 -0
  159. package/dist/server/execute.d.ts +40 -0
  160. package/dist/server/execute.d.ts.map +1 -0
  161. package/dist/server/execute.js +1485 -0
  162. package/dist/server/execute.js.map +1 -0
  163. package/dist/server/execute.remote.test.d.ts +2 -0
  164. package/dist/server/execute.remote.test.d.ts.map +1 -0
  165. package/dist/server/execute.remote.test.js +851 -0
  166. package/dist/server/execute.remote.test.js.map +1 -0
  167. package/dist/server/execute.ssh-host-auth.test.d.ts +2 -0
  168. package/dist/server/execute.ssh-host-auth.test.d.ts.map +1 -0
  169. package/dist/server/execute.ssh-host-auth.test.js +214 -0
  170. package/dist/server/execute.ssh-host-auth.test.js.map +1 -0
  171. package/dist/server/execute.stderr-error.test.d.ts +2 -0
  172. package/dist/server/execute.stderr-error.test.d.ts.map +1 -0
  173. package/dist/server/execute.stderr-error.test.js +142 -0
  174. package/dist/server/execute.stderr-error.test.js.map +1 -0
  175. package/dist/server/execute.test.d.ts +2 -0
  176. package/dist/server/execute.test.d.ts.map +1 -0
  177. package/dist/server/execute.test.js +300 -0
  178. package/dist/server/execute.test.js.map +1 -0
  179. package/dist/server/index.d.ts +18 -0
  180. package/dist/server/index.d.ts.map +1 -0
  181. package/dist/server/index.js +84 -0
  182. package/dist/server/index.js.map +1 -0
  183. package/dist/server/output-inactivity-monitor.d.ts +62 -0
  184. package/dist/server/output-inactivity-monitor.d.ts.map +1 -0
  185. package/dist/server/output-inactivity-monitor.integration.test.d.ts +2 -0
  186. package/dist/server/output-inactivity-monitor.integration.test.d.ts.map +1 -0
  187. package/dist/server/output-inactivity-monitor.integration.test.js +136 -0
  188. package/dist/server/output-inactivity-monitor.integration.test.js.map +1 -0
  189. package/dist/server/output-inactivity-monitor.js +112 -0
  190. package/dist/server/output-inactivity-monitor.js.map +1 -0
  191. package/dist/server/output-inactivity-monitor.test.d.ts +2 -0
  192. package/dist/server/output-inactivity-monitor.test.d.ts.map +1 -0
  193. package/dist/server/output-inactivity-monitor.test.js +284 -0
  194. package/dist/server/output-inactivity-monitor.test.js.map +1 -0
  195. package/dist/server/parse.d.ts +69 -0
  196. package/dist/server/parse.d.ts.map +1 -0
  197. package/dist/server/parse.js +278 -0
  198. package/dist/server/parse.js.map +1 -0
  199. package/dist/server/parse.test.d.ts +2 -0
  200. package/dist/server/parse.test.d.ts.map +1 -0
  201. package/dist/server/parse.test.js +203 -0
  202. package/dist/server/parse.test.js.map +1 -0
  203. package/dist/server/process-activity-monitor.d.ts +21 -0
  204. package/dist/server/process-activity-monitor.d.ts.map +1 -0
  205. package/dist/server/process-activity-monitor.js +103 -0
  206. package/dist/server/process-activity-monitor.js.map +1 -0
  207. package/dist/server/process-activity-monitor.test.d.ts +2 -0
  208. package/dist/server/process-activity-monitor.test.d.ts.map +1 -0
  209. package/dist/server/process-activity-monitor.test.js +82 -0
  210. package/dist/server/process-activity-monitor.test.js.map +1 -0
  211. package/dist/server/quota-spawn-error.test.d.ts +2 -0
  212. package/dist/server/quota-spawn-error.test.d.ts.map +1 -0
  213. package/dist/server/quota-spawn-error.test.js +343 -0
  214. package/dist/server/quota-spawn-error.test.js.map +1 -0
  215. package/dist/server/quota.d.ts +66 -0
  216. package/dist/server/quota.d.ts.map +1 -0
  217. package/dist/server/quota.js +577 -0
  218. package/dist/server/quota.js.map +1 -0
  219. package/dist/server/runtime-config.d.ts +11 -0
  220. package/dist/server/runtime-config.d.ts.map +1 -0
  221. package/dist/server/runtime-config.js +389 -0
  222. package/dist/server/runtime-config.js.map +1 -0
  223. package/dist/server/runtime-config.test.d.ts +2 -0
  224. package/dist/server/runtime-config.test.d.ts.map +1 -0
  225. package/dist/server/runtime-config.test.js +389 -0
  226. package/dist/server/runtime-config.test.js.map +1 -0
  227. package/dist/server/skills.d.ts +8 -0
  228. package/dist/server/skills.d.ts.map +1 -0
  229. package/dist/server/skills.js +26 -0
  230. package/dist/server/skills.js.map +1 -0
  231. package/dist/server/ssh-host-runtime.d.ts +24 -0
  232. package/dist/server/ssh-host-runtime.d.ts.map +1 -0
  233. package/dist/server/ssh-host-runtime.js +84 -0
  234. package/dist/server/ssh-host-runtime.js.map +1 -0
  235. package/dist/server/ssh-session-state.d.ts +18 -0
  236. package/dist/server/ssh-session-state.d.ts.map +1 -0
  237. package/dist/server/ssh-session-state.js +11 -0
  238. package/dist/server/ssh-session-state.js.map +1 -0
  239. package/dist/server/test.d.ts +3 -0
  240. package/dist/server/test.d.ts.map +1 -0
  241. package/dist/server/test.js +531 -0
  242. package/dist/server/test.js.map +1 -0
  243. package/dist/server/test.remote.test.d.ts +2 -0
  244. package/dist/server/test.remote.test.d.ts.map +1 -0
  245. package/dist/server/test.remote.test.js +596 -0
  246. package/dist/server/test.remote.test.js.map +1 -0
  247. package/dist/ui/build-config.d.ts +10 -0
  248. package/dist/ui/build-config.d.ts.map +1 -0
  249. package/dist/ui/build-config.js +284 -0
  250. package/dist/ui/build-config.js.map +1 -0
  251. package/dist/ui/build-config.test.d.ts +2 -0
  252. package/dist/ui/build-config.test.d.ts.map +1 -0
  253. package/dist/ui/build-config.test.js +367 -0
  254. package/dist/ui/build-config.test.js.map +1 -0
  255. package/dist/ui/index.d.ts +4 -0
  256. package/dist/ui/index.d.ts.map +1 -0
  257. package/dist/ui/index.js +8 -0
  258. package/dist/ui/index.js.map +1 -0
  259. package/dist/ui/parse-stdout.d.ts +3 -0
  260. package/dist/ui/parse-stdout.d.ts.map +1 -0
  261. package/dist/ui/parse-stdout.js +265 -0
  262. package/dist/ui/parse-stdout.js.map +1 -0
  263. package/dist/ui/parse-stdout.test.d.ts +2 -0
  264. package/dist/ui/parse-stdout.test.d.ts.map +1 -0
  265. package/dist/ui/parse-stdout.test.js +77 -0
  266. package/dist/ui/parse-stdout.test.js.map +1 -0
  267. package/package.json +55 -4
  268. package/skills/agentmail/SKILL.md +70 -0
  269. package/skills/complain/LICENSE +27 -0
  270. package/skills/complain/SKILL.md +68 -0
  271. package/skills/paperclip/SKILL.md +864 -0
  272. package/skills/paperclip/references/api-reference.md +1814 -0
  273. package/skills/paperclip/references/artifacts.md +163 -0
  274. package/skills/paperclip/references/cases.md +570 -0
  275. package/skills/paperclip/references/company-skills.md +266 -0
  276. package/skills/paperclip/references/issue-documents.md +58 -0
  277. package/skills/paperclip/references/issue-workspaces.md +94 -0
  278. package/skills/paperclip/references/routines.md +249 -0
  279. package/skills/paperclip/references/run-diagnostics.md +28 -0
  280. package/skills/paperclip/references/workflows.md +141 -0
  281. package/skills/paperclip/scripts/paperclip-issue-update.sh +166 -0
  282. package/skills/paperclip/scripts/paperclip-upload-artifact.sh +603 -0
  283. package/skills/paperclip/scripts/submit-agent-commentary.mjs +52 -0
  284. package/skills/paperclip-board/SKILL.md +633 -0
  285. package/skills/paperclip-converting-plans-to-tasks/SKILL.md +28 -0
  286. package/skills/paperclip-create-agent/SKILL.md +213 -0
  287. package/skills/paperclip-create-agent/references/agent-instruction-templates.md +24 -0
  288. package/skills/paperclip-create-agent/references/agents/coder.md +18 -0
  289. package/skills/paperclip-create-agent/references/agents/qa.md +18 -0
  290. package/skills/paperclip-create-agent/references/agents/securityengineer.md +26 -0
  291. package/skills/paperclip-create-agent/references/agents/uxdesigner.md +18 -0
  292. package/skills/paperclip-create-agent/references/api-reference.md +110 -0
  293. package/skills/paperclip-create-agent/references/baseline-role-guide.md +22 -0
  294. package/skills/paperclip-create-agent/references/draft-review-checklist.md +29 -0
  295. package/skills/para-memory-files/SKILL.md +100 -0
  296. package/skills/para-memory-files/references/schemas.md +35 -0
  297. package/skills/slack/SKILL.md +92 -0
  298. package/skills/suggestion-box/LICENSE +27 -0
  299. package/skills/suggestion-box/SKILL.md +77 -0
  300. package/README.md +0 -3
@@ -0,0 +1,28 @@
1
+ # Run diagnostics from a sandbox
2
+
3
+ The queue and HTTP/2 sandbox bridges admit these read-only routes through the
4
+ normal injected Paperclip API credential. The server still checks company,
5
+ authorization-boundary and private-task access, and applies its existing run
6
+ content and credential redaction. Admission through the bridge does not grant
7
+ access to another company's runs or a private task. A list can return a redacted
8
+ metadata stub for an unreadable run; count that as unread coverage rather than
9
+ inferring a failure cause.
10
+
11
+ | Method | Path | Description |
12
+ | ------ | ---- | ----------- |
13
+ | GET | `/api/companies/:companyId/heartbeat-runs` | Recent run history; use `?limit=200&summary=true` first (maximum 1000) |
14
+ | GET | `/api/companies/:companyId/live-runs` | Current active runs visible to this actor |
15
+ | GET | `/api/heartbeat-runs/:runId` | Run status, failure and execution details |
16
+ | GET | `/api/heartbeat-runs/:runId/events` | Run events; request bounded pages with `afterSeq` and `limit` |
17
+ | GET | `/api/heartbeat-runs/:runId/log` | Redacted log excerpt; use `offset` and `limitBytes` (maximum 1 MiB per call) |
18
+ | GET | `/api/heartbeat-runs/:runId/workspace-operations` | Workspace operation receipts for the run |
19
+ | GET | `/api/heartbeat-runs/:runId/issues` | Authorized task links for the run |
20
+ | GET | `/api/issues/:issueId/runs` | Run history for an authorized task |
21
+ | GET | `/api/issues/:issueId/recovery-actions` | Current and historical recovery records for an authorized task |
22
+
23
+ Start with recent run summaries, correlate exact task/run/workspace IDs, then
24
+ read only the necessary events or log excerpts. Report result caps and denied
25
+ reads explicitly. These routes do not authorize retry, cancellation, replay,
26
+ workspace repair, recovery resolution, or provider resource changes. Execution
27
+ control writes and provider-trace administration remain outside this bridge
28
+ diagnostic surface. Do not borrow a board token to work around a denial.
@@ -0,0 +1,141 @@
1
+ # Paperclip Workflow Playbooks
2
+
3
+ Reference material for niche workflows that are pointed to from `SKILL.md`. Load only when the task matches.
4
+
5
+ ---
6
+
7
+ ## Project Setup (CEO/Manager)
8
+
9
+ When asked to set up a new project with workspace config (local folder and/or GitHub repo):
10
+
11
+ 1. `POST /api/companies/{companyId}/projects` with project fields.
12
+ 2. Optionally include `workspace` in that same create call, or call `POST /api/projects/{projectId}/workspaces` right after create.
13
+
14
+ Workspace rules:
15
+
16
+ - Provide at least one of `cwd` (local folder) or `repoUrl` (remote repo).
17
+ - For repo-only setup, omit `cwd` and provide `repoUrl`.
18
+ - Include both `cwd` + `repoUrl` when local and remote references should both be tracked.
19
+
20
+ ---
21
+
22
+ ## OpenClaw Invite (CEO)
23
+
24
+ Use this when asked to invite a new OpenClaw employee.
25
+
26
+ 1. Generate a fresh OpenClaw invite prompt:
27
+
28
+ ```
29
+ POST /api/companies/{companyId}/openclaw/invite-prompt
30
+ { "agentMessage": "optional onboarding note for OpenClaw" }
31
+ ```
32
+
33
+ Access control:
34
+
35
+ - Board users with invite permission can call it.
36
+ - Agent callers: only the company CEO agent can call it.
37
+
38
+ 2. Build the copy-ready OpenClaw prompt for the board:
39
+
40
+ - Use `onboardingTextUrl` from the response.
41
+ - Ask the board to paste that prompt into OpenClaw.
42
+ - If the issue includes an OpenClaw URL (for example `ws://127.0.0.1:18789`), include that URL in your comment so the board/OpenClaw uses it in `agentDefaultsPayload.url`.
43
+
44
+ 3. Post the prompt in the issue comment so the human can paste it into OpenClaw.
45
+
46
+ 4. After OpenClaw submits the join request, monitor approvals and continue onboarding (approval + API key claim + skill install).
47
+
48
+ ---
49
+
50
+ ## Setting Agent Instructions Path
51
+
52
+ Use the dedicated route instead of generic `PATCH /api/agents/:id` when you need to set an agent's instructions markdown path (for example `AGENTS.md`).
53
+
54
+ ```bash
55
+ PATCH /api/agents/{agentId}/instructions-path
56
+ {
57
+ "path": "agents/cmo/AGENTS.md"
58
+ }
59
+ ```
60
+
61
+ Rules:
62
+
63
+ - Allowed for: the target agent itself, or an ancestor manager in that agent's reporting chain.
64
+ - For `codex_local` and `claude_local`, default config key is `instructionsFilePath`.
65
+ - Relative paths are resolved against the target agent's `adapterConfig.cwd`; absolute paths are accepted as-is.
66
+ - To clear the path, send `{ "path": null }`.
67
+ - For adapters with a different key, provide it explicitly:
68
+
69
+ ```bash
70
+ PATCH /api/agents/{agentId}/instructions-path
71
+ {
72
+ "path": "/absolute/path/to/AGENTS.md",
73
+ "adapterConfigKey": "yourAdapterSpecificPathField"
74
+ }
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Company Import / Export
80
+
81
+ Use the company-scoped routes when a CEO agent needs to inspect or move package content.
82
+
83
+ - CEO-safe imports:
84
+ - `POST /api/companies/{companyId}/imports/preview`
85
+ - `POST /api/companies/{companyId}/imports/apply`
86
+ - Allowed callers: board users and the CEO agent of that same company.
87
+ - Safe import rules:
88
+ - existing-company imports are non-destructive
89
+ - `replace` is rejected
90
+ - collisions resolve with `rename` or `skip`
91
+ - issues are always created as new issues
92
+ - CEO agents may use the safe routes with `target.mode = "new_company"` to create a new company directly. Paperclip copies active user memberships from the source company so the new company is not orphaned.
93
+
94
+ For export, preview first and keep tasks explicit:
95
+
96
+ - `POST /api/companies/{companyId}/exports/preview`
97
+ - `POST /api/companies/{companyId}/exports`
98
+ - Export preview defaults to `issues: false`
99
+ - Add `issues` or `projectIssues` only when you intentionally need task files
100
+ - Use `selectedFiles` to narrow the final package to specific agents, skills, projects, or tasks after you inspect the preview inventory
101
+
102
+ See `api-reference.md` for full schema examples.
103
+
104
+ ---
105
+
106
+ ## Self-Test Playbook (App-Level)
107
+
108
+ Use this when validating Paperclip itself (assignment flow, checkouts, run visibility, and status transitions).
109
+
110
+ 1. Create a throwaway issue assigned to a known local agent (`claudecoder` or `codexcoder`):
111
+
112
+ ```bash
113
+ npx paperclipai issue create \
114
+ --company-id "$PAPERCLIP_COMPANY_ID" \
115
+ --title "Self-test: assignment/watch flow" \
116
+ --description "Temporary validation issue" \
117
+ --status todo \
118
+ --assignee-agent-id "$PAPERCLIP_AGENT_ID"
119
+ ```
120
+
121
+ 2. Trigger and watch a heartbeat for that assignee:
122
+
123
+ ```bash
124
+ npx paperclipai heartbeat run --agent-id "$PAPERCLIP_AGENT_ID"
125
+ ```
126
+
127
+ 3. Verify the issue transitions (`todo -> in_progress -> done` or `blocked`) and that comments are posted:
128
+
129
+ ```bash
130
+ npx paperclipai issue get <issue-id-or-identifier>
131
+ ```
132
+
133
+ 4. Reassignment test (optional): move the same issue between `claudecoder` and `codexcoder` and confirm wake/run behavior:
134
+
135
+ ```bash
136
+ npx paperclipai issue update <issue-id> --assignee-agent-id <other-agent-id> --status todo
137
+ ```
138
+
139
+ 5. Cleanup: mark temporary issues done/cancelled with a clear note.
140
+
141
+ If you use direct `curl` during these tests, include `X-Paperclip-Run-Id` on all mutating issue requests whenever running inside a heartbeat.
@@ -0,0 +1,166 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ usage() {
6
+ cat <<'EOF'
7
+ Usage:
8
+ scripts/paperclip-issue-update.sh [--issue-id ID] [--status STATUS] [--comment TEXT] [--dry-run]
9
+
10
+ Reads a multiline markdown comment from stdin when stdin is piped. This preserves
11
+ newlines when building the JSON payload for PATCH /api/issues/{issueId}.
12
+
13
+ Examples:
14
+ scripts/paperclip-issue-update.sh --issue-id "$PAPERCLIP_TASK_ID" --status in_progress <<'MD'
15
+ Investigating formatting
16
+
17
+ - Pulled the raw comment body
18
+ - Comparing it with the run transcript
19
+ MD
20
+
21
+ scripts/paperclip-issue-update.sh --issue-id "$PAPERCLIP_TASK_ID" --status done --dry-run <<'MD'
22
+ Done
23
+
24
+ - Fixed the issue update helper
25
+ MD
26
+ EOF
27
+ }
28
+
29
+ require_command() {
30
+ if ! command -v "$1" >/dev/null 2>&1; then
31
+ printf 'Missing required command: %s\n' "$1" >&2
32
+ exit 1
33
+ fi
34
+ }
35
+
36
+ issue_id="${PAPERCLIP_TASK_ID:-}"
37
+ status=""
38
+ comment_arg=""
39
+ dry_run=0
40
+
41
+ while [[ $# -gt 0 ]]; do
42
+ case "$1" in
43
+ --issue-id)
44
+ issue_id="${2:-}"
45
+ shift 2
46
+ ;;
47
+ --status)
48
+ status="${2:-}"
49
+ shift 2
50
+ ;;
51
+ --comment)
52
+ comment_arg="${2:-}"
53
+ shift 2
54
+ ;;
55
+ --dry-run)
56
+ dry_run=1
57
+ shift
58
+ ;;
59
+ --help|-h)
60
+ usage
61
+ exit 0
62
+ ;;
63
+ *)
64
+ printf 'Unknown argument: %s\n' "$1" >&2
65
+ usage >&2
66
+ exit 1
67
+ ;;
68
+ esac
69
+ done
70
+
71
+ if [[ -z "$issue_id" ]]; then
72
+ printf 'Missing issue id. Pass --issue-id or set PAPERCLIP_TASK_ID.\n' >&2
73
+ exit 1
74
+ fi
75
+
76
+ comment=""
77
+ if [[ -n "$comment_arg" ]]; then
78
+ comment="$comment_arg"
79
+ elif [[ ! -t 0 ]]; then
80
+ comment="$(cat)"
81
+ fi
82
+
83
+ require_command jq
84
+
85
+ payload="$(
86
+ jq -nc \
87
+ --arg status "$status" \
88
+ --arg comment "$comment" \
89
+ '
90
+ (if $status == "" then {} else {status: $status} end) +
91
+ (if $comment == "" then {} else {comment: $comment} end)
92
+ '
93
+ )"
94
+
95
+ if [[ "$dry_run" == "1" ]]; then
96
+ printf '%s\n' "$payload"
97
+ exit 0
98
+ fi
99
+
100
+ if [[ -z "${PAPERCLIP_API_URL:-}" || -z "${PAPERCLIP_API_KEY:-}" || -z "${PAPERCLIP_RUN_ID:-}" ]]; then
101
+ printf 'Missing PAPERCLIP_API_URL, PAPERCLIP_API_KEY, or PAPERCLIP_RUN_ID.\n' >&2
102
+ exit 1
103
+ fi
104
+
105
+ # A successful PATCH always returns the updated issue JSON. An empty body or a
106
+ # connection-level failure means the write did NOT land, even when a pipeline
107
+ # exit code says otherwise, so verify the response instead of inferring success.
108
+ # Two attempts total: the shared heartbeat policy stops a control-plane write
109
+ # after two consecutive failures, so the helper must not send a third.
110
+ max_attempts=2
111
+ attempt=1
112
+ while :; do
113
+ http_code=""
114
+ body=""
115
+ set +e
116
+ response="$(
117
+ curl -sS -m 30 -X PATCH \
118
+ "$PAPERCLIP_API_URL/api/issues/$issue_id" \
119
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
120
+ -H "X-Paperclip-Run-Id: $PAPERCLIP_RUN_ID" \
121
+ -H 'Content-Type: application/json' \
122
+ --data-binary "$payload" \
123
+ -w '\n%{http_code}'
124
+ )"
125
+ curl_exit=$?
126
+ set -e
127
+
128
+ if [[ "$curl_exit" -eq 0 ]]; then
129
+ http_code="${response##*$'\n'}"
130
+ body="${response%$'\n'*}"
131
+ fi
132
+
133
+ if [[ "$curl_exit" -eq 0 && "$http_code" == 2* ]]; then
134
+ if [[ -z "$body" ]]; then
135
+ printf 'Issue update FAILED: HTTP %s with an empty response body. A real update echoes the issue JSON; treat this write as not saved.\n' "$http_code" >&2
136
+ exit 1
137
+ fi
138
+ if [[ -n "$status" ]]; then
139
+ returned_status="$(jq -r '.status // empty' <<<"$body" 2>/dev/null || true)"
140
+ if [[ "$returned_status" != "$status" ]]; then
141
+ printf 'Issue update FAILED: server echoed status %s instead of requested %s.\n' "${returned_status:-<none>}" "$status" >&2
142
+ printf '%s\n' "$body" >&2
143
+ exit 1
144
+ fi
145
+ fi
146
+ printf '%s\n' "$body"
147
+ exit 0
148
+ fi
149
+
150
+ # 4xx (other than 429) is a definitive rejection; retrying cannot change it.
151
+ if [[ "$curl_exit" -eq 0 && "$http_code" == 4* && "$http_code" != "429" ]]; then
152
+ printf 'Issue update rejected (HTTP %s).\n' "$http_code" >&2
153
+ [[ -n "$body" ]] && printf '%s\n' "$body" >&2
154
+ exit 1
155
+ fi
156
+
157
+ if (( attempt >= max_attempts )); then
158
+ printf 'Issue update FAILED after %d attempts (curl exit %s, HTTP %s). The status/comment was NOT saved — report this write as failed, do not assume it landed.\n' "$max_attempts" "$curl_exit" "${http_code:-000}" >&2
159
+ [[ -n "$body" ]] && printf '%s\n' "$body" >&2
160
+ exit 1
161
+ fi
162
+
163
+ printf 'Issue update attempt %d/%d failed (curl exit %s, HTTP %s); retrying...\n' "$attempt" "$max_attempts" "$curl_exit" "${http_code:-000}" >&2
164
+ sleep $((attempt * 2))
165
+ attempt=$((attempt + 1))
166
+ done