@cohortapp/agent-sdk 2.3.0

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 (731) hide show
  1. package/.claude/commands/init-agent.md +104 -0
  2. package/.claude/commands/init-maestro.md +1187 -0
  3. package/.claude/settings.json +161 -0
  4. package/.env.example +216 -0
  5. package/README.md +632 -0
  6. package/agents/browser-operator/agent.md +52 -0
  7. package/agents/calendar-ops/agent.md +50 -0
  8. package/agents/communications/agent.md +96 -0
  9. package/agents/decision-log/agent.md +65 -0
  10. package/agents/desktop-operator/agent.md +59 -0
  11. package/agents/gmail-operator/agent.md +62 -0
  12. package/agents/inbound-dispatcher/agent.md +66 -0
  13. package/agents/inbox-processor/agent.md +39 -0
  14. package/agents/pmo-execution/agent.md +60 -0
  15. package/agents/session-spawner/agent.md +64 -0
  16. package/agents/slack-operator/agent.md +60 -0
  17. package/agents/whatsapp-operator/agent.md +60 -0
  18. package/agents/workflow-automation/agent.md +61 -0
  19. package/archetypes/altitudes/c-suite.yaml +58 -0
  20. package/archetypes/altitudes/founder.yaml +68 -0
  21. package/archetypes/altitudes/senior-manager.yaml +63 -0
  22. package/archetypes/altitudes/svp.yaml +60 -0
  23. package/archetypes/altitudes/vp.yaml +50 -0
  24. package/archetypes/archetype.schema.json +77 -0
  25. package/archetypes/base.yaml +47 -0
  26. package/archetypes/capabilities/commercial-leader.yaml +159 -0
  27. package/archetypes/capabilities/compliance-officer.yaml +159 -0
  28. package/archetypes/capabilities/executive-operator.yaml +169 -0
  29. package/archetypes/capabilities/finance-leader.yaml +162 -0
  30. package/archetypes/capabilities/operations-leader.yaml +154 -0
  31. package/archetypes/capabilities/product-leader.yaml +148 -0
  32. package/archetypes/capabilities/technical-leader.yaml +146 -0
  33. package/archetypes/functions/commercial-leader.yaml +62 -0
  34. package/archetypes/functions/compliance-officer.yaml +64 -0
  35. package/archetypes/functions/executive-operator.yaml +70 -0
  36. package/archetypes/functions/finance-leader.yaml +70 -0
  37. package/archetypes/functions/operations-leader.yaml +62 -0
  38. package/archetypes/functions/product-leader.yaml +61 -0
  39. package/archetypes/functions/technical-leader.yaml +57 -0
  40. package/bin/cohort-mcp.mjs +81 -0
  41. package/bin/maestro.mjs +3516 -0
  42. package/bin/maestro.test.mjs +1015 -0
  43. package/desktop-control/README.md +56 -0
  44. package/desktop-control/app-profiles/gmail.yaml +120 -0
  45. package/desktop-control/app-profiles/slack.yaml +315 -0
  46. package/desktop-control/app-profiles/whatsapp.yaml +107 -0
  47. package/docs/architecture/agent-topology.md +2239 -0
  48. package/docs/architecture/archetype-agent-factory.md +110 -0
  49. package/docs/architecture/collective-memory-and-org-mesh.md +115 -0
  50. package/docs/architecture/continuous-monitoring.md +221 -0
  51. package/docs/architecture/mcp-capability-map.md +585 -0
  52. package/docs/architecture/system-architecture.md +1272 -0
  53. package/docs/company-context/README.md +40 -0
  54. package/docs/guides/agent-persona-setup.md +600 -0
  55. package/docs/guides/agents-observe-setup.md +64 -0
  56. package/docs/guides/billing-console-keys.md +88 -0
  57. package/docs/guides/ccxray-diagnostics.md +65 -0
  58. package/docs/guides/channel-bus.md +127 -0
  59. package/docs/guides/claude-mem-setup.md +79 -0
  60. package/docs/guides/claude-pace-setup.md +56 -0
  61. package/docs/guides/claudraband-sessions.md +98 -0
  62. package/docs/guides/clawteam-swarm.md +116 -0
  63. package/docs/guides/code-review-graph-setup.md +86 -0
  64. package/docs/guides/email-setup.md +431 -0
  65. package/docs/guides/mac-mini.md +119 -0
  66. package/docs/guides/media-generation-setup.md +349 -0
  67. package/docs/guides/model-routing.md +162 -0
  68. package/docs/guides/observability-otel.md +265 -0
  69. package/docs/guides/org-onboarding.md +132 -0
  70. package/docs/guides/outbound-governance-setup.md +437 -0
  71. package/docs/guides/pdf-generation-setup.md +315 -0
  72. package/docs/guides/poller-daemon-setup.md +563 -0
  73. package/docs/guides/rag-context-setup.md +459 -0
  74. package/docs/guides/self-optimization-pattern.md +82 -0
  75. package/docs/guides/setup-wizard.md +178 -0
  76. package/docs/guides/slack-setup.md +350 -0
  77. package/docs/guides/telegram-setup.md +227 -0
  78. package/docs/guides/twilio-subaccounts-setup.md +223 -0
  79. package/docs/guides/verification.md +128 -0
  80. package/docs/guides/voice-mode.md +188 -0
  81. package/docs/guides/voice-sms-setup.md +698 -0
  82. package/docs/guides/webhook-relay-setup.md +349 -0
  83. package/docs/guides/whatsapp-setup.md +288 -0
  84. package/docs/prompts/board-pack-cover-template.md +36 -0
  85. package/docs/prompts/decision-recommendation-template.md +88 -0
  86. package/docs/prompts/followup-message-template.md +141 -0
  87. package/docs/prompts/investor-letter-template.md +52 -0
  88. package/docs/prompts/morning-brief-template.md +82 -0
  89. package/docs/prompts/presentation-template.md +58 -0
  90. package/docs/prompts/weekly-strategic-memo-template.md +104 -0
  91. package/docs/research/hallucinated-tool-output-investigation.md +151 -0
  92. package/docs/runbooks/backup-restore.md +205 -0
  93. package/docs/runbooks/cohort-cutover.md +129 -0
  94. package/docs/runbooks/fleet-operations.md +200 -0
  95. package/docs/runbooks/incident-response.md +226 -0
  96. package/docs/runbooks/mac-mini-bootstrap.md +431 -0
  97. package/docs/runbooks/perpetual-operations.md +509 -0
  98. package/docs/runbooks/recovery-and-failover.md +260 -0
  99. package/framework-features.json +267 -0
  100. package/ingest/README.md +87 -0
  101. package/lib/action-executor.js +689 -0
  102. package/lib/action-executor.test.mjs +871 -0
  103. package/lib/agent-root.mjs +37 -0
  104. package/lib/archetype.mjs +236 -0
  105. package/lib/archetype.test.mjs +132 -0
  106. package/lib/autonomy.mjs +114 -0
  107. package/lib/autonomy.test.mjs +66 -0
  108. package/lib/backlog.mjs +358 -0
  109. package/lib/backlog.test.mjs +266 -0
  110. package/lib/budget-guard.mjs +279 -0
  111. package/lib/budget-guard.test.mjs +291 -0
  112. package/lib/cadence-bus-schedule.test.mjs +194 -0
  113. package/lib/cadence-bus.mjs +1120 -0
  114. package/lib/cadence-bus.test.mjs +720 -0
  115. package/lib/cadences.mjs +205 -0
  116. package/lib/cadences.test.mjs +125 -0
  117. package/lib/capability.mjs +154 -0
  118. package/lib/capability.test.mjs +78 -0
  119. package/lib/channels/base-adapter.mjs +719 -0
  120. package/lib/channels/base-adapter.test.mjs +590 -0
  121. package/lib/channels/channel.mjs +128 -0
  122. package/lib/channels/channels.test.mjs +371 -0
  123. package/lib/channels/contract.mjs +215 -0
  124. package/lib/channels/contract.test.mjs +137 -0
  125. package/lib/channels/conversation-resolver.mjs +95 -0
  126. package/lib/channels/gmail/adapter.mjs +87 -0
  127. package/lib/channels/inbox-item.mjs +255 -0
  128. package/lib/channels/inbox-item.test.mjs +335 -0
  129. package/lib/channels/index.mjs +94 -0
  130. package/lib/channels/orgmail/adapter.mjs +353 -0
  131. package/lib/channels/orgmail/adapter.test.mjs +311 -0
  132. package/lib/channels/pairing.mjs +363 -0
  133. package/lib/channels/pairing.test.mjs +270 -0
  134. package/lib/channels/registry.mjs +164 -0
  135. package/lib/channels/slack/adapter.mjs +317 -0
  136. package/lib/channels/slack-adapter.test.mjs +212 -0
  137. package/lib/channels/sms/adapter.mjs +43 -0
  138. package/lib/channels/telegram/adapter.mjs +432 -0
  139. package/lib/channels/telegram-adapter.test.mjs +306 -0
  140. package/lib/channels/voice/adapter.mjs +301 -0
  141. package/lib/channels/voice/adapter.test.mjs +278 -0
  142. package/lib/channels/whatsapp/adapter-baileys.mjs +587 -0
  143. package/lib/channels/whatsapp/adapter-baileys.test.mjs +359 -0
  144. package/lib/channels/whatsapp/adapter-twilio.mjs +65 -0
  145. package/lib/channels/whatsapp/baileys-typing.test.mjs +154 -0
  146. package/lib/charter.mjs +256 -0
  147. package/lib/charter.test.mjs +89 -0
  148. package/lib/claude-bin.mjs +134 -0
  149. package/lib/claude-bin.test.mjs +75 -0
  150. package/lib/collective/capture.mjs +185 -0
  151. package/lib/collective/capture.test.mjs +121 -0
  152. package/lib/collective/cards.mjs +201 -0
  153. package/lib/collective/cards.test.mjs +114 -0
  154. package/lib/collective/config.mjs +186 -0
  155. package/lib/collective/config.test.mjs +123 -0
  156. package/lib/collective/global-config.mjs +113 -0
  157. package/lib/collective/global-config.test.mjs +75 -0
  158. package/lib/collective/presence.mjs +201 -0
  159. package/lib/collective/presence.test.mjs +95 -0
  160. package/lib/collective/recall.mjs +215 -0
  161. package/lib/collective/recall.test.mjs +116 -0
  162. package/lib/comms/send-gate.mjs +554 -0
  163. package/lib/comms/send-gate.test.mjs +577 -0
  164. package/lib/comms.mjs +67 -0
  165. package/lib/comms.test.mjs +41 -0
  166. package/lib/diagnostics/alerts.mjs +424 -0
  167. package/lib/diagnostics/alerts.test.mjs +318 -0
  168. package/lib/diagnostics/backup-freshness.mjs +188 -0
  169. package/lib/diagnostics/backup-freshness.test.mjs +185 -0
  170. package/lib/diagnostics/counters.mjs +269 -0
  171. package/lib/diagnostics/counters.test.mjs +206 -0
  172. package/lib/diagnostics/events.mjs +188 -0
  173. package/lib/diagnostics/events.test.mjs +290 -0
  174. package/lib/diagnostics/otel.mjs +237 -0
  175. package/lib/diagnostics/otel.test.mjs +196 -0
  176. package/lib/diagnostics/trace.mjs +216 -0
  177. package/lib/diagnostics/trace.test.mjs +251 -0
  178. package/lib/env-compat.mjs +74 -0
  179. package/lib/env-compat.test.mjs +104 -0
  180. package/lib/feature-init.mjs +331 -0
  181. package/lib/fs-atomic.mjs +112 -0
  182. package/lib/fs-atomic.test.mjs +72 -0
  183. package/lib/fs-ownership.mjs +111 -0
  184. package/lib/fs-ownership.test.mjs +158 -0
  185. package/lib/hooks/bus.mjs +347 -0
  186. package/lib/hooks/bus.test.mjs +387 -0
  187. package/lib/index.js +16 -0
  188. package/lib/learning/config.mjs +106 -0
  189. package/lib/learning/config.test.mjs +75 -0
  190. package/lib/learning/counters.mjs +156 -0
  191. package/lib/learning/counters.test.mjs +69 -0
  192. package/lib/learning/curator-consolidate.test.mjs +238 -0
  193. package/lib/learning/curator.mjs +453 -0
  194. package/lib/learning/curator.test.mjs +106 -0
  195. package/lib/learning/log.mjs +40 -0
  196. package/lib/learning/reflect.mjs +534 -0
  197. package/lib/learning/reflect.test.mjs +0 -0
  198. package/lib/learning/session-index.mjs +352 -0
  199. package/lib/learning/session-index.test.mjs +125 -0
  200. package/lib/learning/skill-writer.mjs +474 -0
  201. package/lib/learning/skill-writer.test.mjs +210 -0
  202. package/lib/mcp/server.mjs +328 -0
  203. package/lib/mcp/server.test.mjs +400 -0
  204. package/lib/model-router/auth-profiles.mjs +758 -0
  205. package/lib/model-router/auth-profiles.test.mjs +580 -0
  206. package/lib/model-router/catalog/anthropic.yaml +153 -0
  207. package/lib/model-router/catalog/deepseek.yaml +86 -0
  208. package/lib/model-router/catalog/moonshot.yaml +81 -0
  209. package/lib/model-router/catalog/qwen.yaml +114 -0
  210. package/lib/model-router/catalog.mjs +925 -0
  211. package/lib/model-router/catalog.test.mjs +385 -0
  212. package/lib/model-router/economics.mjs +564 -0
  213. package/lib/model-router/economics.test.mjs +344 -0
  214. package/lib/model-router/failover.mjs +298 -0
  215. package/lib/model-router/failover.test.mjs +439 -0
  216. package/lib/model-router/health.mjs +453 -0
  217. package/lib/model-router/health.test.mjs +338 -0
  218. package/lib/model-router/integration-coverage.test.mjs +829 -0
  219. package/lib/model-router/integration.test.mjs +564 -0
  220. package/lib/model-router/ledger.mjs +402 -0
  221. package/lib/model-router/ledger.test.mjs +382 -0
  222. package/lib/model-router/llm-task.mjs +515 -0
  223. package/lib/model-router/llm-task.test.mjs +392 -0
  224. package/lib/model-router/org-credentials.mjs +260 -0
  225. package/lib/model-router/org-credentials.test.mjs +265 -0
  226. package/lib/model-router/pricing-refresh.mjs +463 -0
  227. package/lib/model-router/pricing-refresh.test.mjs +286 -0
  228. package/lib/model-router/reconcile.mjs +429 -0
  229. package/lib/model-router/reconcile.test.mjs +316 -0
  230. package/lib/model-router/repair.mjs +471 -0
  231. package/lib/model-router/repair.test.mjs +180 -0
  232. package/lib/model-router/resolve.mjs +1206 -0
  233. package/lib/model-router/spawn.mjs +497 -0
  234. package/lib/model-router/spawn.test.mjs +425 -0
  235. package/lib/model-router/taxonomy.mjs +893 -0
  236. package/lib/model-router/taxonomy.test.mjs +410 -0
  237. package/lib/model-router.mjs +677 -0
  238. package/lib/model-router.test.mjs +907 -0
  239. package/lib/org/activity.mjs +211 -0
  240. package/lib/org/activity.test.mjs +134 -0
  241. package/lib/org/approvals.mjs +448 -0
  242. package/lib/org/approvals.test.mjs +216 -0
  243. package/lib/org/awareness.mjs +222 -0
  244. package/lib/org/awareness.test.mjs +159 -0
  245. package/lib/org/board.mjs +229 -0
  246. package/lib/org/board.test.mjs +177 -0
  247. package/lib/org/bootstrap-context.mjs +169 -0
  248. package/lib/org/bootstrap-context.test.mjs +153 -0
  249. package/lib/org/client.mjs +1628 -0
  250. package/lib/org/client.test.mjs +1107 -0
  251. package/lib/org/cohort-client.mjs +67 -0
  252. package/lib/org/cohort-client.test.mjs +126 -0
  253. package/lib/org/cost-sync.mjs +227 -0
  254. package/lib/org/cost-sync.test.mjs +153 -0
  255. package/lib/org/doctor.mjs +212 -0
  256. package/lib/org/doctor.test.mjs +212 -0
  257. package/lib/org/handoff.mjs +293 -0
  258. package/lib/org/handoff.test.mjs +269 -0
  259. package/lib/org/integration-tools.mjs +182 -0
  260. package/lib/org/integration-tools.test.mjs +160 -0
  261. package/lib/org/keys.mjs +131 -0
  262. package/lib/org/keys.test.mjs +92 -0
  263. package/lib/org/knowledge.mjs +463 -0
  264. package/lib/org/knowledge.test.mjs +319 -0
  265. package/lib/org/leases.mjs +335 -0
  266. package/lib/org/leases.test.mjs +235 -0
  267. package/lib/org/mesh-integration.test.mjs +127 -0
  268. package/lib/org/mesh.mjs +459 -0
  269. package/lib/org/mesh.test.mjs +345 -0
  270. package/lib/org/messaging.mjs +503 -0
  271. package/lib/org/messaging.test.mjs +238 -0
  272. package/lib/org/policy.mjs +345 -0
  273. package/lib/org/policy.test.mjs +237 -0
  274. package/lib/org/protocol.checksum +1 -0
  275. package/lib/org/protocol.checksum.test.mjs +90 -0
  276. package/lib/org/protocol.mjs +967 -0
  277. package/lib/org/protocol.test.mjs +264 -0
  278. package/lib/org/registry.mjs +194 -0
  279. package/lib/org/registry.test.mjs +100 -0
  280. package/lib/org/tool-surface-integration.test.mjs +120 -0
  281. package/lib/org/tool-surface.mjs +2535 -0
  282. package/lib/org/tool-surface.test.mjs +589 -0
  283. package/lib/org/ui-parity.mjs +3236 -0
  284. package/lib/org/ui-parity.test.mjs +348 -0
  285. package/lib/org/verify.mjs +176 -0
  286. package/lib/org/verify.test.mjs +194 -0
  287. package/lib/rag/embed.mjs +188 -0
  288. package/lib/rag/indexer.mjs +425 -0
  289. package/lib/rag/rag.test.mjs +505 -0
  290. package/lib/rag/search.mjs +475 -0
  291. package/lib/rate-guard.mjs +246 -0
  292. package/lib/rate-guard.test.mjs +201 -0
  293. package/lib/render.mjs +112 -0
  294. package/lib/render.test.mjs +68 -0
  295. package/lib/resource-governor.mjs +297 -0
  296. package/lib/resource-governor.test.mjs +262 -0
  297. package/lib/scheduling/dynamic-jobs.mjs +675 -0
  298. package/lib/scheduling/dynamic-jobs.test.mjs +344 -0
  299. package/lib/scheduling/jitter.mjs +0 -0
  300. package/lib/scheduling/jitter.test.mjs +140 -0
  301. package/lib/secrets/broker.mjs +315 -0
  302. package/lib/secrets/broker.test.mjs +280 -0
  303. package/lib/secrets/providers.mjs +461 -0
  304. package/lib/secrets/providers.test.mjs +274 -0
  305. package/lib/security/audit-engine.mjs +684 -0
  306. package/lib/security/audit-engine.test.mjs +389 -0
  307. package/lib/security/coerce-args.mjs +552 -0
  308. package/lib/security/coerce-args.test.mjs +281 -0
  309. package/lib/security/dangerous-tools.mjs +97 -0
  310. package/lib/security/dangerous-tools.test.mjs +68 -0
  311. package/lib/security/external-content.mjs +145 -0
  312. package/lib/security/external-content.test.mjs +67 -0
  313. package/lib/security/redact.mjs +592 -0
  314. package/lib/security/redact.test.mjs +441 -0
  315. package/lib/security/secret-equal.mjs +73 -0
  316. package/lib/security/secret-equal.test.mjs +55 -0
  317. package/lib/session-permissions.mjs +101 -0
  318. package/lib/session-permissions.test.mjs +100 -0
  319. package/lib/setup/claude-probe.mjs +74 -0
  320. package/lib/setup/completeness.mjs +175 -0
  321. package/lib/setup/completeness.test.mjs +110 -0
  322. package/lib/setup/context-pack.mjs +173 -0
  323. package/lib/setup/context-pack.test.mjs +89 -0
  324. package/lib/setup/enrich.mjs +277 -0
  325. package/lib/setup/enrich.test.mjs +115 -0
  326. package/lib/setup/enroll-from-cohort.mjs +441 -0
  327. package/lib/setup/enroll-from-cohort.test.mjs +233 -0
  328. package/lib/setup/integration.test.mjs +162 -0
  329. package/lib/setup/io.mjs +360 -0
  330. package/lib/setup/io.test.mjs +77 -0
  331. package/lib/setup/run-generator.mjs +81 -0
  332. package/lib/setup/runner.mjs +244 -0
  333. package/lib/setup/runner.test.mjs +132 -0
  334. package/lib/setup/sections/comms.mjs +173 -0
  335. package/lib/setup/sections/company.mjs +120 -0
  336. package/lib/setup/sections/enrich.mjs +138 -0
  337. package/lib/setup/sections/identity.mjs +182 -0
  338. package/lib/setup/sections/identity.test.mjs +140 -0
  339. package/lib/setup/sections/learning.mjs +153 -0
  340. package/lib/setup/sections/learning.test.mjs +81 -0
  341. package/lib/setup/sections/messaging.mjs +219 -0
  342. package/lib/setup/sections/messaging.test.mjs +127 -0
  343. package/lib/setup/sections/model.mjs +102 -0
  344. package/lib/setup/sections/operating-model.mjs +78 -0
  345. package/lib/setup/sections/org.mjs +475 -0
  346. package/lib/setup/sections/org.test.mjs +313 -0
  347. package/lib/setup/sections/orgmail.mjs +173 -0
  348. package/lib/setup/sections/orgmail.test.mjs +118 -0
  349. package/lib/setup/sections/recovery.mjs +159 -0
  350. package/lib/setup/sections/recovery.test.mjs +98 -0
  351. package/lib/setup/sections/tools.mjs +132 -0
  352. package/lib/setup/sections/verify.mjs +97 -0
  353. package/lib/setup/sot.mjs +205 -0
  354. package/lib/setup/sot.test.mjs +81 -0
  355. package/lib/setup/state.mjs +151 -0
  356. package/lib/setup/state.test.mjs +92 -0
  357. package/lib/singleton.js +229 -0
  358. package/lib/singleton.test.mjs +135 -0
  359. package/lib/telemetry/alerts.mjs +216 -0
  360. package/lib/telemetry/alerts.test.mjs +109 -0
  361. package/lib/telemetry/collect.mjs +512 -0
  362. package/lib/telemetry/collect.test.mjs +202 -0
  363. package/lib/tool-definitions-integration.test.mjs +83 -0
  364. package/lib/tool-definitions.js +738 -0
  365. package/lib/tool-definitions.test.mjs +437 -0
  366. package/lib/util/fetch-timeout.mjs +136 -0
  367. package/lib/util/fetch-timeout.test.mjs +202 -0
  368. package/lib/util/reconnect.mjs +343 -0
  369. package/lib/util/reconnect.test.mjs +369 -0
  370. package/lib/util/unhandled.mjs +205 -0
  371. package/lib/util/unhandled.test.mjs +216 -0
  372. package/lib/voice/context-loader.mjs +466 -0
  373. package/lib/voice/index.mjs +100 -0
  374. package/lib/voice/openai-realtime.mjs +510 -0
  375. package/lib/voice/outbound.mjs +542 -0
  376. package/lib/voice/outbound.test.mjs +69 -0
  377. package/lib/voice/post-call-brief.mjs +428 -0
  378. package/lib/voice/provider.mjs +52 -0
  379. package/lib/voice/session-rotation.mjs +257 -0
  380. package/lib/voice/stt.mjs +161 -0
  381. package/lib/voice/stt.test.mjs +226 -0
  382. package/lib/voice/tool-bridge.mjs +370 -0
  383. package/lib/voice/tts.mjs +104 -0
  384. package/lib/voice/twilio-sip-bridge.mjs +288 -0
  385. package/lib/voice/voice.test.mjs +990 -0
  386. package/mcp/README.md +80 -0
  387. package/package.json +151 -0
  388. package/plugins/maestro-skills/plugin.json +139 -0
  389. package/plugins/maestro-skills/skills/agents-observe.md +110 -0
  390. package/plugins/maestro-skills/skills/board-deck.md +68 -0
  391. package/plugins/maestro-skills/skills/books-close.md +77 -0
  392. package/plugins/maestro-skills/skills/brand-steward.md +121 -0
  393. package/plugins/maestro-skills/skills/calendar-plan.md +57 -0
  394. package/plugins/maestro-skills/skills/call-working-sessions.md +124 -0
  395. package/plugins/maestro-skills/skills/ccxray-diagnostics.md +91 -0
  396. package/plugins/maestro-skills/skills/claude-pace.md +61 -0
  397. package/plugins/maestro-skills/skills/code-review-graph.md +99 -0
  398. package/plugins/maestro-skills/skills/crm-pipeline.md +65 -0
  399. package/plugins/maestro-skills/skills/decision-brief.md +89 -0
  400. package/plugins/maestro-skills/skills/directory-hygiene.md +125 -0
  401. package/plugins/maestro-skills/skills/draft-comms.md +84 -0
  402. package/plugins/maestro-skills/skills/evening-wrap.md +53 -0
  403. package/plugins/maestro-skills/skills/files-find.md +65 -0
  404. package/plugins/maestro-skills/skills/generative-ui.md +228 -0
  405. package/plugins/maestro-skills/skills/hiring-triage.md +74 -0
  406. package/plugins/maestro-skills/skills/inbox-triage.md +61 -0
  407. package/plugins/maestro-skills/skills/mail-triage.md +86 -0
  408. package/plugins/maestro-skills/skills/morning-brief.md +54 -0
  409. package/plugins/maestro-skills/skills/native-artifacts.md +157 -0
  410. package/plugins/maestro-skills/skills/org-board.md +133 -0
  411. package/plugins/maestro-skills/skills/org-credential.md +68 -0
  412. package/plugins/maestro-skills/skills/org-recall.md +81 -0
  413. package/plugins/maestro-skills/skills/pipeline-review.md +76 -0
  414. package/plugins/maestro-skills/skills/regulatory-status.md +81 -0
  415. package/plugins/maestro-skills/skills/router-why.md +78 -0
  416. package/plugins/maestro-skills/skills/schedule-meeting.md +91 -0
  417. package/plugins/maestro-skills/skills/session-search.md +71 -0
  418. package/plugins/maestro-skills/skills/set-reminder.md +93 -0
  419. package/plugins/maestro-skills/skills/slack-followup.md +64 -0
  420. package/plugins/maestro-skills/skills/team-activity.md +86 -0
  421. package/plugins/maestro-skills/skills/weekly-memo.md +70 -0
  422. package/policies/action-classification.yaml +114 -0
  423. package/policies/ai-disclosure.yaml +294 -0
  424. package/policies/communication-style.md +139 -0
  425. package/policies/information-barriers.yaml +118 -0
  426. package/policies/prompt-injection-defence.yaml +138 -0
  427. package/public/assets/icon-dark.png +0 -0
  428. package/public/assets/icon-dark.svg +9 -0
  429. package/public/assets/icon-light.svg +9 -0
  430. package/public/assets/logo-dark.svg +15 -0
  431. package/public/assets/logo-light.svg +15 -0
  432. package/scaffold/.mcp.json +7 -0
  433. package/scaffold/CLAUDE.md +368 -0
  434. package/scaffold/config/agent.json +55 -0
  435. package/scaffold/config/agent.ts +76 -0
  436. package/scaffold/config/agent.ts.example +89 -0
  437. package/scaffold/config/alerts.yaml +23 -0
  438. package/scaffold/config/allowlist.yaml.example +25 -0
  439. package/scaffold/config/caller-id-map.yaml +46 -0
  440. package/scaffold/config/collective.yaml +49 -0
  441. package/scaffold/config/company.json +20 -0
  442. package/scaffold/config/known-agents.json +6 -0
  443. package/scaffold/config/learning.yaml +55 -0
  444. package/scaffold/config/model-routing.yaml.example +104 -0
  445. package/scaffold/config/org.yaml +25 -0
  446. package/scaffold/config/orgmail.yaml.example +19 -0
  447. package/scaffold/config/recovery.yaml +72 -0
  448. package/scaffold/config/secrets.yaml +27 -0
  449. package/scaffold/config/slack.yaml.example +35 -0
  450. package/scaffold/config/telegram.yaml.example +38 -0
  451. package/scaffold/config/voice.yaml.example +89 -0
  452. package/scaffold/config/whatsapp.yaml.example +39 -0
  453. package/schedules/README.md +49 -0
  454. package/schedules/triggers/backlog-executor.md +102 -0
  455. package/schedules/triggers/brand-steward.md +72 -0
  456. package/schedules/triggers/daily-evening-wrap.md +159 -0
  457. package/schedules/triggers/daily-midday-sweep.md +58 -0
  458. package/schedules/triggers/daily-morning-brief.md +55 -0
  459. package/schedules/triggers/directory-hygiene.md +81 -0
  460. package/schedules/triggers/dynamic-jobs.md +40 -0
  461. package/schedules/triggers/inbox-processor.md +115 -0
  462. package/schedules/triggers/meeting-action-capture.md +60 -0
  463. package/schedules/triggers/meeting-prep.md +69 -0
  464. package/schedules/triggers/messaging-inbound.md +50 -0
  465. package/schedules/triggers/org-pulse.md +24 -0
  466. package/schedules/triggers/quarterly-self-assessment.md +54 -0
  467. package/schedules/triggers/weekly-engineering-health.md +37 -0
  468. package/schedules/triggers/weekly-execution.md +65 -0
  469. package/schedules/triggers/weekly-hiring.md +53 -0
  470. package/schedules/triggers/weekly-priorities.md +38 -0
  471. package/schedules/triggers/weekly-strategic-memo.md +124 -0
  472. package/scripts/archive-email.sh +55 -0
  473. package/scripts/cadence/cadence-status.mjs +36 -0
  474. package/scripts/cadence/enqueue-cadence-tick.mjs +174 -0
  475. package/scripts/cadence/enqueue-cadence-tick.test.mjs +187 -0
  476. package/scripts/cadence/launchd-cadence-wrapper.sh +85 -0
  477. package/scripts/cadence/launchd-cloud-relay-wrapper.sh +95 -0
  478. package/scripts/cadence/launchd-socket-mode-wrapper.sh +95 -0
  479. package/scripts/ci/check-docs-accuracy.mjs +493 -0
  480. package/scripts/ci/check-docs-accuracy.test.mjs +409 -0
  481. package/scripts/ci/check-exports-exist.mjs +140 -0
  482. package/scripts/ci/check-files-exist.mjs +107 -0
  483. package/scripts/ci/check-no-build-artifacts.mjs +111 -0
  484. package/scripts/ci/check-no-build-artifacts.test.mjs +71 -0
  485. package/scripts/ci/check-no-confidential.mjs +198 -0
  486. package/scripts/ci/check-no-conflict-markers.mjs +169 -0
  487. package/scripts/ci/check-no-residual-identity.mjs +163 -0
  488. package/scripts/ci/check-no-residual-identity.test.mjs +89 -0
  489. package/scripts/ci/check-tarball-fidelity.mjs +205 -0
  490. package/scripts/ci/check-unresolved-tokens.mjs +83 -0
  491. package/scripts/ci/check.mjs +109 -0
  492. package/scripts/ci/check.test.mjs +194 -0
  493. package/scripts/ci/run-coverage.mjs +82 -0
  494. package/scripts/ci/run-tests.mjs +71 -0
  495. package/scripts/cloud-relay/README.md +59 -0
  496. package/scripts/cloud-relay/index.mjs +233 -0
  497. package/scripts/cloud-relay/package.json +15 -0
  498. package/scripts/cloud-relay/railway.json +13 -0
  499. package/scripts/cloud-relay/voice/README.md +94 -0
  500. package/scripts/cloud-relay/voice/package-lock.json +39 -0
  501. package/scripts/cloud-relay/voice/package.json +16 -0
  502. package/scripts/cloud-relay/voice/railway.json +13 -0
  503. package/scripts/cloud-relay/voice/server.mjs +532 -0
  504. package/scripts/collective/hook-runner.mjs +211 -0
  505. package/scripts/collective/hook-runner.test.mjs +90 -0
  506. package/scripts/collective/org-pulse.mjs +72 -0
  507. package/scripts/collective/org-sync.mjs +61 -0
  508. package/scripts/collective/recall.mjs +45 -0
  509. package/scripts/collective/who.mjs +30 -0
  510. package/scripts/comms-monitor.sh +288 -0
  511. package/scripts/configure-whatsapp-sandbox.sh +201 -0
  512. package/scripts/continuous-monitor.sh +91 -0
  513. package/scripts/cost/fleet-digest.mjs +407 -0
  514. package/scripts/cost/fleet-digest.test.mjs +207 -0
  515. package/scripts/cost/track-claude-usage.mjs +169 -0
  516. package/scripts/daemon/agent-daemon.mjs +989 -0
  517. package/scripts/daemon/agent-daemon.test.mjs +525 -0
  518. package/scripts/daemon/cadence-consumer-governance.test.mjs +220 -0
  519. package/scripts/daemon/cadence-consumer.mjs +1080 -0
  520. package/scripts/daemon/cadence-consumer.test.mjs +770 -0
  521. package/scripts/daemon/cadence-handlers.mjs +1121 -0
  522. package/scripts/daemon/cadence-handlers.test.mjs +617 -0
  523. package/scripts/daemon/classifier.mjs +704 -0
  524. package/scripts/daemon/classifier.test.mjs +238 -0
  525. package/scripts/daemon/classify-kind.mjs +54 -0
  526. package/scripts/daemon/classify-kind.test.mjs +40 -0
  527. package/scripts/daemon/context-compiler.mjs +605 -0
  528. package/scripts/daemon/context-compiler.test.mjs +300 -0
  529. package/scripts/daemon/dispatcher-cooldown.test.mjs +122 -0
  530. package/scripts/daemon/dispatcher-governance.test.mjs +886 -0
  531. package/scripts/daemon/dispatcher.mjs +1516 -0
  532. package/scripts/daemon/health.mjs +72 -0
  533. package/scripts/daemon/inbox-deferral.mjs +210 -0
  534. package/scripts/daemon/inbox-deferral.test.mjs +242 -0
  535. package/scripts/daemon/integration.test.mjs +149 -0
  536. package/scripts/daemon/launchd-wrapper-generic.sh +96 -0
  537. package/scripts/daemon/launchd-wrapper-slack-events.sh +37 -0
  538. package/scripts/daemon/launchd-wrapper.sh +91 -0
  539. package/scripts/daemon/lib/session-router.mjs +274 -0
  540. package/scripts/daemon/lib/session-router.test.mjs +295 -0
  541. package/scripts/daemon/maestro-daemon.mjs +275 -0
  542. package/scripts/daemon/prompt-builder.mjs +685 -0
  543. package/scripts/daemon/prompt-builder.test.mjs +213 -0
  544. package/scripts/daemon/responder.mjs +854 -0
  545. package/scripts/daemon/session-lock.mjs +721 -0
  546. package/scripts/daemon/session-lock.test.mjs +252 -0
  547. package/scripts/daemon/session-outcomes.mjs +640 -0
  548. package/scripts/daemon/session-outcomes.test.mjs +533 -0
  549. package/scripts/daemon/typing-registry.mjs +90 -0
  550. package/scripts/daemon/typing-registry.test.mjs +77 -0
  551. package/scripts/daemon/voice-webhook-server.mjs +804 -0
  552. package/scripts/decisions/capture-decision.mjs +116 -0
  553. package/scripts/disclosure_assessment.py +873 -0
  554. package/scripts/disclosure_boundaries.py +562 -0
  555. package/scripts/email-signature-principal.html +52 -0
  556. package/scripts/email-signature.html +60 -0
  557. package/scripts/email_quote_thread.py +167 -0
  558. package/scripts/email_thread_dedup.py +362 -0
  559. package/scripts/emergency-stop.sh +81 -0
  560. package/scripts/healthcheck.sh +116 -0
  561. package/scripts/hooks/block-mcp-cohort-send.sh +15 -0
  562. package/scripts/hooks/block-mcp-slack-send.sh +7 -0
  563. package/scripts/hooks/post-action-log.sh +126 -0
  564. package/scripts/hooks/pre-send-audit.sh +174 -0
  565. package/scripts/hooks/pre-send-audit.test.mjs +215 -0
  566. package/scripts/hooks/session-end-log.sh +27 -0
  567. package/scripts/hooks/session-start-banner.sh +115 -0
  568. package/scripts/huddle/audio-bridge.mjs +664 -0
  569. package/scripts/huddle/boot-slack-cdp.sh +102 -0
  570. package/scripts/huddle/huddle-controller.mjs +942 -0
  571. package/scripts/huddle/huddle-server.mjs +1229 -0
  572. package/scripts/huddle/launch-slack.sh +232 -0
  573. package/scripts/huddle/openai-realtime-bridge.mjs +462 -0
  574. package/scripts/huddle/package-lock.json +62 -0
  575. package/scripts/huddle/package.json +22 -0
  576. package/scripts/huddle/setup-audio.sh +239 -0
  577. package/scripts/huddle/start-call.mjs +318 -0
  578. package/scripts/huddle/test-pipeline.mjs +263 -0
  579. package/scripts/learning/consolidate-skills.mjs +72 -0
  580. package/scripts/learning/session-search.mjs +125 -0
  581. package/scripts/llm_email_dedup.py +442 -0
  582. package/scripts/local-triggers/generate-plists.sh +432 -0
  583. package/scripts/local-triggers/generate-plists.test.mjs +413 -0
  584. package/scripts/local-triggers/install-all.sh +49 -0
  585. package/scripts/local-triggers/plists/.gitkeep +0 -0
  586. package/scripts/local-triggers/run-trigger.sh +63 -0
  587. package/scripts/local-triggers/templates/rag-reindex.plist.template +47 -0
  588. package/scripts/local-triggers/templates/voice-relay-poller.plist.template +54 -0
  589. package/scripts/local-triggers/templates/voice-tunnel.plist.template +55 -0
  590. package/scripts/local-triggers/templates/voice-webhook.plist.template +51 -0
  591. package/scripts/maintenance/backup-to-cloud.sh +124 -0
  592. package/scripts/maintenance/health-check.sh +377 -0
  593. package/scripts/media-generation/README.md +105 -0
  594. package/scripts/media-generation/gemini-image-client.mjs +173 -0
  595. package/scripts/media-generation/generate-assets.mjs +289 -0
  596. package/scripts/media-generation/veo-video-client.mjs +219 -0
  597. package/scripts/org/send-orgmail.mjs +227 -0
  598. package/scripts/outbound-dedup-cleanup.sh +43 -0
  599. package/scripts/outbound-dedup.sh +477 -0
  600. package/scripts/outbound_dedup.py +115 -0
  601. package/scripts/parse-voice-transcript.mjs +481 -0
  602. package/scripts/pdf-generation/README.md +63 -0
  603. package/scripts/pdf-generation/build-document.mjs +247 -0
  604. package/scripts/pdf-generation/templates/board-pack.latex +136 -0
  605. package/scripts/pdf-generation/templates/corporate-letter.latex +126 -0
  606. package/scripts/pdf-generation/templates/memo.latex +114 -0
  607. package/scripts/poll-slack-events.sh +35 -0
  608. package/scripts/poller/calendar-poller.mjs +12 -0
  609. package/scripts/poller/gmail-poller.mjs +192 -0
  610. package/scripts/poller/imap-client.mjs +289 -0
  611. package/scripts/poller/inbox-scan-poller.mjs +156 -0
  612. package/scripts/poller/inbox-scan-poller.test.mjs +231 -0
  613. package/scripts/poller/index.mjs +73 -0
  614. package/scripts/poller/intra-session-check.mjs +285 -0
  615. package/scripts/poller/lib/cloud-relay-dedup.mjs +88 -0
  616. package/scripts/poller/lib/cloud-relay-dedup.test.mjs +133 -0
  617. package/scripts/poller/lib/slash-command-handlers.mjs +177 -0
  618. package/scripts/poller/secondary-gmail-poller.mjs +132 -0
  619. package/scripts/poller/slack-cloud-relay-client.mjs +368 -0
  620. package/scripts/poller/slack-poller.mjs +854 -0
  621. package/scripts/poller/slack-socket-mode.mjs +917 -0
  622. package/scripts/poller/slack-socket-mode.test.mjs +753 -0
  623. package/scripts/poller/trigger.mjs +75 -0
  624. package/scripts/poller/utils.mjs +371 -0
  625. package/scripts/poller/voice-cloud-relay-client.mjs +179 -0
  626. package/scripts/poller/voice-poller.mjs +236 -0
  627. package/scripts/poller-launchd/install.sh +66 -0
  628. package/scripts/poller-launchd/poller.plist.template +40 -0
  629. package/scripts/poller-launchd/whatsapp-handler.plist.template +39 -0
  630. package/scripts/post-interaction-indexer.py +1598 -0
  631. package/scripts/pre-draft-context.py +994 -0
  632. package/scripts/pre_draft_lookup.py +258 -0
  633. package/scripts/rag/build-index.mjs +47 -0
  634. package/scripts/rag/ingest.mjs +111 -0
  635. package/scripts/rag/search.mjs +119 -0
  636. package/scripts/rag-indexer.py +629 -0
  637. package/scripts/restore-from-backup.sh +248 -0
  638. package/scripts/restore-from-backup.test.mjs +178 -0
  639. package/scripts/resume-operations.sh +80 -0
  640. package/scripts/search-secondary-inbox.py +181 -0
  641. package/scripts/secondary-inbox-poller.py +437 -0
  642. package/scripts/self-optimization/compute-metrics.py +398 -0
  643. package/scripts/send-email-as-principal.py +369 -0
  644. package/scripts/send-email-threaded.py +392 -0
  645. package/scripts/send-email-with-attachment.py +377 -0
  646. package/scripts/send-email.sh +131 -0
  647. package/scripts/send-sms.sh +175 -0
  648. package/scripts/send-whatsapp.sh +292 -0
  649. package/scripts/session-start.sh +106 -0
  650. package/scripts/setup/boot-claude-session.sh +94 -0
  651. package/scripts/setup/configure-macos.sh +674 -0
  652. package/scripts/setup/configure-twilio-sip-trunk.mjs +207 -0
  653. package/scripts/setup/configure-voice-tunnel.mjs +182 -0
  654. package/scripts/setup/generate-agent-env.mjs +92 -0
  655. package/scripts/setup/generate-agent-package-json.mjs +222 -0
  656. package/scripts/setup/generate-agent-package-json.test.mjs +143 -0
  657. package/scripts/setup/generate-autonomy.mjs +60 -0
  658. package/scripts/setup/generate-backlog.mjs +101 -0
  659. package/scripts/setup/generate-cadences.mjs +92 -0
  660. package/scripts/setup/generate-capability.mjs +162 -0
  661. package/scripts/setup/generate-charter.mjs +76 -0
  662. package/scripts/setup/generate-comms.mjs +59 -0
  663. package/scripts/setup/generate-company.mjs +92 -0
  664. package/scripts/setup/init-agent.sh +547 -0
  665. package/scripts/setup/init-agent.test.mjs +151 -0
  666. package/scripts/setup/init-archetype.mjs +74 -0
  667. package/scripts/setup/init-backup.mjs +54 -0
  668. package/scripts/setup/init-cadence-bus.mjs +60 -0
  669. package/scripts/setup/init-channel-bus.mjs +46 -0
  670. package/scripts/setup/init-cost-tracking.mjs +45 -0
  671. package/scripts/setup/init-decision-capture.mjs +66 -0
  672. package/scripts/setup/init-known-agents.mjs +57 -0
  673. package/scripts/setup/init-learning.mjs +70 -0
  674. package/scripts/setup/init-memory-executive.mjs +45 -0
  675. package/scripts/setup/init-model-router.mjs +124 -0
  676. package/scripts/setup/init-rag.mjs +174 -0
  677. package/scripts/setup/init-session-router.mjs +38 -0
  678. package/scripts/setup/init-slack-socket-mode.mjs +260 -0
  679. package/scripts/setup/init-telegram.mjs +165 -0
  680. package/scripts/setup/init-voice-realtime.mjs +204 -0
  681. package/scripts/setup/init-whatsapp-baileys.mjs +77 -0
  682. package/scripts/setup/install-dev-tools.sh +150 -0
  683. package/scripts/setup/lib/install-plist.mjs +95 -0
  684. package/scripts/setup/migrate-agent-to-sot.mjs +192 -0
  685. package/scripts/setup/render-environment-yaml.mjs +133 -0
  686. package/scripts/slack-events-ctl.sh +177 -0
  687. package/scripts/slack-events-server.mjs +1045 -0
  688. package/scripts/slack-react.mjs +89 -0
  689. package/scripts/slack-responded.sh +232 -0
  690. package/scripts/slack-send.sh +287 -0
  691. package/scripts/slack-typing.mjs +196 -0
  692. package/scripts/slack-upload-v2.py +95 -0
  693. package/scripts/sms-handler.mjs +450 -0
  694. package/scripts/spawn-session.sh +120 -0
  695. package/scripts/sync-protocol.mjs +217 -0
  696. package/scripts/system-verify.sh +184 -0
  697. package/scripts/test-email-thread-dedup.py +239 -0
  698. package/scripts/test-information-barriers.py +484 -0
  699. package/scripts/test-llm-email-dedup.py +251 -0
  700. package/scripts/test-pre-draft-integration.py +203 -0
  701. package/scripts/test-rag-phase2.sh +442 -0
  702. package/scripts/test-rag-search.sh +251 -0
  703. package/scripts/test-voice-parser.mjs +316 -0
  704. package/scripts/user-context-search.py +659 -0
  705. package/scripts/validate_outbound.py +1504 -0
  706. package/scripts/watchdog/ai.maestro.memory-watchdog.plist +41 -0
  707. package/scripts/watchdog/force-reboot.sh +157 -0
  708. package/scripts/watchdog/memory-watchdog.sh +473 -0
  709. package/scripts/whatsapp-handler.mjs +538 -0
  710. package/teams/desktop-operations.yaml +34 -0
  711. package/teams/executive-office.yaml +27 -0
  712. package/teams/legal-and-regulatory.yaml +24 -0
  713. package/teams/platform-and-engineering.yaml +23 -0
  714. package/teams/strategy-and-growth.yaml +29 -0
  715. package/workflows/continuous/backlog-executor.yaml +141 -0
  716. package/workflows/continuous/inbound-monitor.yaml +168 -0
  717. package/workflows/daily/applicant-triage.yaml +197 -0
  718. package/workflows/daily/comms-triage.yaml +80 -0
  719. package/workflows/daily/evening-wrap.yaml +105 -0
  720. package/workflows/daily/morning-brief.yaml +164 -0
  721. package/workflows/daily/slack-followup-sweep.yaml +87 -0
  722. package/workflows/event-driven/README.md +50 -0
  723. package/workflows/event-driven/agent-failure-investigation.yaml +137 -0
  724. package/workflows/event-driven/pr-review.yaml +107 -0
  725. package/workflows/monthly/board-readiness.yaml +76 -0
  726. package/workflows/quarterly/strategic-scenario-analysis.yaml +85 -0
  727. package/workflows/session-protocol.md +171 -0
  728. package/workflows/weekly/engineering-health.yaml +154 -0
  729. package/workflows/weekly/hiring-review.yaml +169 -0
  730. package/workflows/weekly/rollup-pipeline-review.yaml +76 -0
  731. package/workflows/weekly/strategic-memo.yaml +79 -0
@@ -0,0 +1,3236 @@
1
+ /**
2
+ * lib/org/ui-parity.mjs — Agent UI-parity helpers (full human-action mirror).
3
+ *
4
+ * A 1:1 mirror of the human Cohort UI: 328 named convenience wrappers over the
5
+ * /v1 RPC binding, one per agent-facing org method the human app exposes (charter,
6
+ * member, team, channel, persona, profile, sop, escalation, annotation, contact,
7
+ * file, memory, compact, notification, decision, messaging, board, invitation,
8
+ * user, settings, billing, org, integration, email + the Inbox app, artifact, and
9
+ * the agent desks: books, calendar, crm, directory, files, meetings.recapFile).
10
+ * The `branding.*` (product section: Design) wrappers live in ./client.mjs beside
11
+ * the rest of that family, not here. Every wrapper is a thin one-liner over
12
+ * `call()` from ./client.mjs, so they inherit the SAME contract:
13
+ *
14
+ * - POST {base}/v1/{method}, body = params JSON, res frame {ok,result|error}.
15
+ * - Bearer auth + x-org-protocol on every request; x-idempotency-key on the
16
+ * side-effecting methods (auto-derived from a stable `params.id` when present,
17
+ * else supply `o.idempotencyKey`).
18
+ * - Fail-open: a network/parse error or a disabled integration yields a benign
19
+ * error res frame — never a throw.
20
+ *
21
+ * IMPORTANT — even the READ-ONLY methods here (charter.get, member.list, …) are
22
+ * POST RPC METHODS, not GET reads. They are dispatched over POST /api/v1/<name>
23
+ * via `call()`, exactly like the writes; they are simply non-side-effecting (no
24
+ * idempotency key, the server makes no mutation). Do NOT route them through
25
+ * client.read() — that is the distinct GET read surface (snapshot/events/etc.).
26
+ *
27
+ * IDEMPOTENCY — methods marked idempotent in the protocol (the create/add/upsert/
28
+ * pin verbs) carry no natural `id` at creation time, so `call()` cannot synthesise
29
+ * a key. The caller SHOULD pass a stable `o.idempotencyKey` so a retried creation
30
+ * collapses to one row rather than spawning duplicates. Each such wrapper says so.
31
+ *
32
+ * Node builtins only. ESM. Re-exported from package.json as "@cohortapp/agent-sdk/org/ui-parity".
33
+ *
34
+ * @module lib/org/ui-parity
35
+ */
36
+
37
+ "use strict";
38
+
39
+ import { call } from "./client.mjs";
40
+
41
+ // ---------------------------------------------------------------------------
42
+ // charter — member charters, clauses, sections, colleague-charter fields
43
+ // ---------------------------------------------------------------------------
44
+
45
+ /**
46
+ * Save the full clause set of a channel's operating charter (charter.updateClauses).
47
+ * @param {object} params - { channelId, clauses[]{ id, title, body?, version? } }
48
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
49
+ */
50
+ export function charterUpdateClauses(params, o = {}) {
51
+ return call("charter.updateClauses", params || {}, o);
52
+ }
53
+
54
+ /**
55
+ * Update a member charter's approval line + gates text (charter.update; creates if absent).
56
+ * @param {object} params - { memberId, approvedByLine?, gatesText? }
57
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
58
+ */
59
+ export function charterUpdate(params, o = {}) {
60
+ return call("charter.update", params || {}, o);
61
+ }
62
+
63
+ /**
64
+ * Append a new section to a member's charter (charter.addSection). Idempotent —
65
+ * pass a stable `o.idempotencyKey` so a retried add doesn't duplicate the section.
66
+ * @param {object} params - { memberId, kind, title?, body }
67
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
68
+ */
69
+ export function charterAddSection(params, o = {}) {
70
+ return call("charter.addSection", params || {}, o);
71
+ }
72
+
73
+ /**
74
+ * Update a charter section's kind/title/body (charter.updateSection; provided fields only).
75
+ * @param {object} params - { id, kind?, title?, body? }
76
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
77
+ */
78
+ export function charterUpdateSection(params, o = {}) {
79
+ return call("charter.updateSection", params || {}, o);
80
+ }
81
+
82
+ /**
83
+ * Delete a charter section (charter.deleteSection).
84
+ * @param {object} params - { id }
85
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
86
+ */
87
+ export function charterDeleteSection(params, o = {}) {
88
+ return call("charter.deleteSection", params || {}, o);
89
+ }
90
+
91
+ /**
92
+ * Persist a full ordering of a charter's sections (charter.reorderSections).
93
+ * @param {object} params - { charterId, orderedIds[] }
94
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
95
+ */
96
+ export function charterReorderSections(params, o = {}) {
97
+ return call("charter.reorderSections", params || {}, o);
98
+ }
99
+
100
+ /**
101
+ * Commit a charter amendment (charter.amend): bump version, persist the governance
102
+ * vector + signed YAML.
103
+ * @param {object} params - { memberId, yaml, tier?, permissionMode?, model?, reviewCycle?, tools?, autonomousAuthority?, hardConstraints?, escalationTriggers?, rewardWeights? }
104
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
105
+ */
106
+ export function charterAmend(params, o = {}) {
107
+ return call("charter.amend", params || {}, o);
108
+ }
109
+
110
+ /**
111
+ * Inline-edit one targeted field of an AI colleague's charter (charter.editColleagueField); bumps version.
112
+ * @param {object} params - { memberId, target, value }
113
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
114
+ */
115
+ export function charterEditColleagueField(params, o = {}) {
116
+ return call("charter.editColleagueField", params || {}, o);
117
+ }
118
+
119
+ /**
120
+ * Read a member's full charter with sections (charter.get). Non-side-effecting RPC method.
121
+ * @param {object} params - { memberId }
122
+ * @param {object} o - { base, token, fetchImpl? }
123
+ */
124
+ export function charterGet(params, o = {}) {
125
+ return call("charter.get", params || {}, o);
126
+ }
127
+
128
+ // ---------------------------------------------------------------------------
129
+ // member — directory seats, profile/contact/AI-operating fields, chart nodes
130
+ // ---------------------------------------------------------------------------
131
+
132
+ /**
133
+ * Create a human/AI colleague (member.create): auto seat slug, upserts Role,
134
+ * attaches empty OrgChartNode + Charter. Idempotent — pass a stable
135
+ * `o.idempotencyKey` so a retried create doesn't spawn a duplicate seat.
136
+ * @param {object} params - { kind, displayName, roleTitle, roleLevel, teamId, status?, tagline?, officeLocation?, activationWave?, contactEmail?, contactPhone?, agentEmail?, agentPhone?, operatingChannel?, modelRuntimeNotes?, autonomyLevel?, escalationPath?, supervisorId? }
137
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
138
+ */
139
+ export function memberCreate(params, o = {}) {
140
+ return call("member.create", params || {}, o);
141
+ }
142
+
143
+ /**
144
+ * Patch identity/profile/contact/AI-operating fields + supervisor link (member.update).
145
+ * @param {object} params - { id, displayName?, roleTitle?, roleLevel?, status?, tagline?, officeLocation?, activationWave?, contactEmail?, contactPhone?, agentEmail?, agentPhone?, operatingChannel?, modelRuntimeNotes?, autonomyLevel?, escalationPath?, supervisorId? }
146
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
147
+ */
148
+ export function memberUpdate(params, o = {}) {
149
+ return call("member.update", params || {}, o);
150
+ }
151
+
152
+ /**
153
+ * Set a member's status to INACTIVE (member.archive).
154
+ * @param {object} params - { id }
155
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
156
+ */
157
+ export function memberArchive(params, o = {}) {
158
+ return call("member.archive", params || {}, o);
159
+ }
160
+
161
+ /**
162
+ * Move a member to another team (or none) (member.assignTeam).
163
+ * @param {object} params - { memberId, teamId|null }
164
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
165
+ */
166
+ export function memberAssignTeam(params, o = {}) {
167
+ return call("member.assignTeam", params || {}, o);
168
+ }
169
+
170
+ /**
171
+ * Repoint a report's manager (member.reassignReporting; validates seats, active manager, no cycle).
172
+ * @param {object} params - { reportSlug, newManagerSlug }
173
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
174
+ */
175
+ export function memberReassignReporting(params, o = {}) {
176
+ return call("member.reassignReporting", params || {}, o);
177
+ }
178
+
179
+ /**
180
+ * Persist a manual org-chart node position (member.savePosition; arrange mode).
181
+ * @param {object} params - { slug, posX, posY }
182
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
183
+ */
184
+ export function memberSavePosition(params, o = {}) {
185
+ return call("member.savePosition", params || {}, o);
186
+ }
187
+
188
+ /**
189
+ * Clear every manual node-position override (member.resetPositions; back to auto-layout).
190
+ * @param {object} params - {}
191
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
192
+ */
193
+ export function memberResetPositions(params, o = {}) {
194
+ return call("member.resetPositions", params || {}, o);
195
+ }
196
+
197
+ /**
198
+ * Read a member's full payload by slug (member.get). Non-side-effecting RPC method.
199
+ * @param {object} params - { slug }
200
+ * @param {object} o - { base, token, fetchImpl? }
201
+ */
202
+ export function memberGet(params, o = {}) {
203
+ return call("member.get", params || {}, o);
204
+ }
205
+
206
+ /**
207
+ * List org members / directory (member.list). Non-side-effecting RPC method.
208
+ * @param {object} params - { status?, teamId? }
209
+ * @param {object} o - { base, token, fetchImpl? }
210
+ */
211
+ export function memberList(params, o = {}) {
212
+ return call("member.list", params || {}, o);
213
+ }
214
+
215
+ /**
216
+ * Option lists for the member editor (member.getEditorOptions). Non-side-effecting RPC method.
217
+ * @param {object} params - {}
218
+ * @param {object} o - { base, token, fetchImpl? }
219
+ */
220
+ export function memberGetEditorOptions(params, o = {}) {
221
+ return call("member.getEditorOptions", params || {}, o);
222
+ }
223
+
224
+ // ---------------------------------------------------------------------------
225
+ // team — palette-colored swimlanes / groupings
226
+ // ---------------------------------------------------------------------------
227
+
228
+ /**
229
+ * Create a team (team.create): unique slug, palette colorKey, appended sortOrder.
230
+ * Idempotent — pass a stable `o.idempotencyKey` for safe retries.
231
+ * @param {object} params - { name, shortLabel?, colorKey, charter? }
232
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
233
+ */
234
+ export function teamCreate(params, o = {}) {
235
+ return call("team.create", params || {}, o);
236
+ }
237
+
238
+ /**
239
+ * Update a team's name/shortLabel/colorKey/charter (team.update).
240
+ * @param {object} params - { id, name?, shortLabel?, colorKey?, charter? }
241
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
242
+ */
243
+ export function teamUpdate(params, o = {}) {
244
+ return call("team.update", params || {}, o);
245
+ }
246
+
247
+ /**
248
+ * Delete a team (team.delete; only when it has zero assigned members).
249
+ * @param {object} params - { id }
250
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
251
+ */
252
+ export function teamDelete(params, o = {}) {
253
+ return call("team.delete", params || {}, o);
254
+ }
255
+
256
+ /**
257
+ * List org teams (team.list). Non-side-effecting RPC method.
258
+ * @param {object} params - {}
259
+ * @param {object} o - { base, token, fetchImpl? }
260
+ */
261
+ export function teamList(params, o = {}) {
262
+ return call("team.list", params || {}, o);
263
+ }
264
+
265
+ // ---------------------------------------------------------------------------
266
+ // channel — org channels, membership, read state, DMs/conversations
267
+ // ---------------------------------------------------------------------------
268
+
269
+ /**
270
+ * Create an org-scoped channel (channel.create): seats creator as owner + seed
271
+ * members. Idempotent — pass a stable `o.idempotencyKey` for safe retries.
272
+ * @param {object} params - { slug, name, kind, topic?, members[]? }
273
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
274
+ */
275
+ export function channelCreate(params, o = {}) {
276
+ return call("channel.create", params || {}, o);
277
+ }
278
+
279
+ /**
280
+ * Patch a channel's name/topic/archived (channel.update; slug+kind immutable).
281
+ * @param {object} params - { channelId, name?, topic?, archived? }
282
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
283
+ */
284
+ export function channelUpdate(params, o = {}) {
285
+ return call("channel.update", params || {}, o);
286
+ }
287
+
288
+ /**
289
+ * Add a member row to a channel (channel.addMember; idempotent if present). Pass a
290
+ * stable `o.idempotencyKey` for safe retries.
291
+ * @param {object} params - { channelId, memberId, role }
292
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
293
+ */
294
+ export function channelAddMember(params, o = {}) {
295
+ return call("channel.addMember", params || {}, o);
296
+ }
297
+
298
+ /**
299
+ * Remove a member row from a channel (channel.removeMember; no-op if absent).
300
+ * @param {object} params - { channelId, memberId }
301
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
302
+ */
303
+ export function channelRemoveMember(params, o = {}) {
304
+ return call("channel.removeMember", params || {}, o);
305
+ }
306
+
307
+ /**
308
+ * Change an existing member's channel role (channel.updateMemberRole).
309
+ * @param {object} params - { channelId, memberId, role }
310
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
311
+ */
312
+ export function channelUpdateMemberRole(params, o = {}) {
313
+ return call("channel.updateMemberRole", params || {}, o);
314
+ }
315
+
316
+ /**
317
+ * Stamp the caller's own lastReadAt = now (channel.markRead).
318
+ * @param {object} params - { channelId }
319
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
320
+ */
321
+ export function channelMarkRead(params, o = {}) {
322
+ return call("channel.markRead", params || {}, o);
323
+ }
324
+
325
+ /**
326
+ * Move the caller's own lastReadAt back to recompute unread (channel.markUnreadFrom).
327
+ * @param {object} params - { channelId, fromTimestamp }
328
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
329
+ */
330
+ export function channelMarkUnreadFrom(params, o = {}) {
331
+ return call("channel.markUnreadFrom", params || {}, o);
332
+ }
333
+
334
+ /**
335
+ * Find or create the deterministic 1:1 DM channel with another member
336
+ * (channel.resolveOrCreateDm). Idempotent — pass a stable `o.idempotencyKey`.
337
+ * @param {object} params - { memberId }
338
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
339
+ */
340
+ export function channelResolveOrCreateDm(params, o = {}) {
341
+ return call("channel.resolveOrCreateDm", params || {}, o);
342
+ }
343
+
344
+ /**
345
+ * Open a 1:1 DM (one other) or create a GROUP_DM (2+) (channel.createConversation).
346
+ * Idempotent — pass a stable `o.idempotencyKey`.
347
+ * @param {object} params - { memberIds[], name? }
348
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
349
+ */
350
+ export function channelCreateConversation(params, o = {}) {
351
+ return call("channel.createConversation", params || {}, o);
352
+ }
353
+
354
+ // ---------------------------------------------------------------------------
355
+ // persona — canonical persona fields, AI regeneration, durable agent id
356
+ // ---------------------------------------------------------------------------
357
+
358
+ /**
359
+ * Edit one whitelisted canonical persona field (persona.editField; sets
360
+ * personaEditedByUser, bumps personaVersion).
361
+ * @param {object} params - { memberId, field, stringValue? | arrayValue[]? | numberValue? }
362
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
363
+ */
364
+ export function personaEditField(params, o = {}) {
365
+ return call("persona.editField", params || {}, o);
366
+ }
367
+
368
+ /**
369
+ * AI-regenerate one persona field (persona.regenerate; field ∈ shortBio|longBio|
370
+ * headline|skills|imagePrompt|image — prompt/size only for image).
371
+ * @param {object} params - { memberId, field, prompt?, size? }
372
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
373
+ */
374
+ export function personaRegenerate(params, o = {}) {
375
+ return call("persona.regenerate", params || {}, o);
376
+ }
377
+
378
+ /**
379
+ * Mint and persist a durable cohortAgentId on a member (persona.generateAgentId;
380
+ * race-safe, returns existing if set). Idempotent — pass a stable `o.idempotencyKey`.
381
+ * @param {object} params - { memberId }
382
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
383
+ */
384
+ export function personaGenerateAgentId(params, o = {}) {
385
+ return call("persona.generateAgentId", params || {}, o);
386
+ }
387
+
388
+ // ---------------------------------------------------------------------------
389
+ // profile — tagline/bio/skills, profile sections, avatar
390
+ // ---------------------------------------------------------------------------
391
+
392
+ /**
393
+ * Update a member's tagline/bio/skills/languages (profile.update).
394
+ * @param {object} params - { memberId, tagline?, bio?, skills[]?, languages[]? }
395
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
396
+ */
397
+ export function profileUpdate(params, o = {}) {
398
+ return call("profile.update", params || {}, o);
399
+ }
400
+
401
+ /**
402
+ * Append a new profile section (profile.addSection). Idempotent — pass a stable
403
+ * `o.idempotencyKey` so a retried add doesn't duplicate the section.
404
+ * @param {object} params - { memberId, kind, title?, body }
405
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
406
+ */
407
+ export function profileAddSection(params, o = {}) {
408
+ return call("profile.addSection", params || {}, o);
409
+ }
410
+
411
+ /**
412
+ * Update a profile section's kind/title/body (profile.updateSection).
413
+ * @param {object} params - { id, kind?, title?, body? }
414
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
415
+ */
416
+ export function profileUpdateSection(params, o = {}) {
417
+ return call("profile.updateSection", params || {}, o);
418
+ }
419
+
420
+ /**
421
+ * Delete a profile section (profile.deleteSection).
422
+ * @param {object} params - { id }
423
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
424
+ */
425
+ export function profileDeleteSection(params, o = {}) {
426
+ return call("profile.deleteSection", params || {}, o);
427
+ }
428
+
429
+ /**
430
+ * Set/clear the caller's own avatar (profile.updateAvatar; writes User.image + WorkforceMember.avatarUrl).
431
+ * @param {object} params - { image }
432
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
433
+ */
434
+ export function profileUpdateAvatar(params, o = {}) {
435
+ return call("profile.updateAvatar", params || {}, o);
436
+ }
437
+
438
+ /**
439
+ * Read a member's profile + sections (profile.get). Non-side-effecting RPC method.
440
+ * @param {object} params - { memberId }
441
+ * @param {object} o - { base, token, fetchImpl? }
442
+ */
443
+ export function profileGet(params, o = {}) {
444
+ return call("profile.get", params || {}, o);
445
+ }
446
+
447
+ // ---------------------------------------------------------------------------
448
+ // sop — channel-scoped standard operating procedures
449
+ // ---------------------------------------------------------------------------
450
+
451
+ /**
452
+ * Create a channel-scoped SOP (sop.create; body parsed to steps, posts channel
453
+ * notice). Idempotent — pass a stable `o.idempotencyKey` for safe retries.
454
+ * @param {object} params - { channelId, title, body? }
455
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
456
+ */
457
+ export function sopCreate(params, o = {}) {
458
+ return call("sop.create", params || {}, o);
459
+ }
460
+
461
+ /**
462
+ * Update a SOP's title/steps and bump its version (sop.update).
463
+ * @param {object} params - { id, title, body? }
464
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
465
+ */
466
+ export function sopUpdate(params, o = {}) {
467
+ return call("sop.update", params || {}, o);
468
+ }
469
+
470
+ /**
471
+ * Delete a SOP (sop.delete; channel-visibility gated).
472
+ * @param {object} params - { id }
473
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
474
+ */
475
+ export function sopDelete(params, o = {}) {
476
+ return call("sop.delete", params || {}, o);
477
+ }
478
+
479
+ /**
480
+ * List SOPs, optionally for one channel (sop.list). Non-side-effecting RPC method.
481
+ * @param {object} params - { channelId? }
482
+ * @param {object} o - { base, token, fetchImpl? }
483
+ */
484
+ export function sopList(params, o = {}) {
485
+ return call("sop.list", params || {}, o);
486
+ }
487
+
488
+ // ---------------------------------------------------------------------------
489
+ // escalation — raise/resolve escalations against tasks/channels
490
+ // ---------------------------------------------------------------------------
491
+
492
+ /**
493
+ * Raise an escalation against a task/channel (escalation.create; at least one
494
+ * target required). Idempotent — pass a stable `o.idempotencyKey` for safe retries.
495
+ * @param {object} params - { title, severity?, detail?, waitingOn?, resolvable?, taskId?, channelId? }
496
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
497
+ */
498
+ export function escalationCreate(params, o = {}) {
499
+ return call("escalation.create", params || {}, o);
500
+ }
501
+
502
+ /**
503
+ * Resolve a resolvable, not-yet-resolved escalation (escalation.resolve).
504
+ * @param {object} params - { escalationId, resolution? }
505
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
506
+ */
507
+ export function escalationResolve(params, o = {}) {
508
+ return call("escalation.resolve", params || {}, o);
509
+ }
510
+
511
+ /**
512
+ * List escalations, optionally filtered (escalation.list). Non-side-effecting RPC method.
513
+ * @param {object} params - { status?, channelId? }
514
+ * @param {object} o - { base, token, fetchImpl? }
515
+ */
516
+ export function escalationList(params, o = {}) {
517
+ return call("escalation.list", params || {}, o);
518
+ }
519
+
520
+ // ---------------------------------------------------------------------------
521
+ // annotation — polymorphic annotation threads + comments
522
+ // ---------------------------------------------------------------------------
523
+
524
+ /**
525
+ * Create an annotation thread + first comment on a polymorphic entity
526
+ * (annotation.create). Idempotent — pass a stable `o.idempotencyKey`.
527
+ * @param {object} params - { entityType, entityId, anchor?, body }
528
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
529
+ */
530
+ export function annotationCreate(params, o = {}) {
531
+ return call("annotation.create", params || {}, o);
532
+ }
533
+
534
+ /**
535
+ * Append a comment to an OPEN annotation thread (annotation.comment).
536
+ * @param {object} params - { annotationId, body }
537
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
538
+ */
539
+ export function annotationComment(params, o = {}) {
540
+ return call("annotation.comment", params || {}, o);
541
+ }
542
+
543
+ /**
544
+ * Close an OPEN annotation as RESOLVED (annotation.resolve).
545
+ * @param {object} params - { annotationId }
546
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
547
+ */
548
+ export function annotationResolve(params, o = {}) {
549
+ return call("annotation.resolve", params || {}, o);
550
+ }
551
+
552
+ /**
553
+ * Close an OPEN annotation as DISMISSED (annotation.dismiss).
554
+ * @param {object} params - { annotationId }
555
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
556
+ */
557
+ export function annotationDismiss(params, o = {}) {
558
+ return call("annotation.dismiss", params || {}, o);
559
+ }
560
+
561
+ /**
562
+ * List every OPEN annotation in the org (annotation.list; nav-badge feed). Non-side-effecting RPC method.
563
+ * @param {object} params - { orgId }
564
+ * @param {object} o - { base, token, fetchImpl? }
565
+ */
566
+ export function annotationList(params, o = {}) {
567
+ return call("annotation.list", params || {}, o);
568
+ }
569
+
570
+ /**
571
+ * Read an annotation thread with all comments (annotation.getThread). Non-side-effecting RPC method.
572
+ * @param {object} params - { annotationId }
573
+ * @param {object} o - { base, token, fetchImpl? }
574
+ */
575
+ export function annotationGetThread(params, o = {}) {
576
+ return call("annotation.getThread", params || {}, o);
577
+ }
578
+
579
+ // ---------------------------------------------------------------------------
580
+ // contact — per-member contact detail rows
581
+ // ---------------------------------------------------------------------------
582
+
583
+ /**
584
+ * Add a contact detail row to a member (contact.add). Idempotent — pass a stable
585
+ * `o.idempotencyKey` for safe retries.
586
+ * @param {object} params - { memberId, type, label?, value, isFabricated? }
587
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
588
+ */
589
+ export function contactAdd(params, o = {}) {
590
+ return call("contact.add", params || {}, o);
591
+ }
592
+
593
+ /**
594
+ * Patch a contact detail row (contact.update).
595
+ * @param {object} params - { id, type?, label?, value?, isFabricated? }
596
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
597
+ */
598
+ export function contactUpdate(params, o = {}) {
599
+ return call("contact.update", params || {}, o);
600
+ }
601
+
602
+ /**
603
+ * Remove a contact detail row (contact.delete).
604
+ * @param {object} params - { id }
605
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
606
+ */
607
+ export function contactDelete(params, o = {}) {
608
+ return call("contact.delete", params || {}, o);
609
+ }
610
+
611
+ /**
612
+ * List a member's contact details (contact.list). Non-side-effecting RPC method.
613
+ * @param {object} params - { memberId }
614
+ * @param {object} o - { base, token, fetchImpl? }
615
+ */
616
+ export function contactList(params, o = {}) {
617
+ return call("contact.list", params || {}, o);
618
+ }
619
+
620
+ // ---------------------------------------------------------------------------
621
+ // file — channel Pinned tab + per-file comment threads
622
+ // ---------------------------------------------------------------------------
623
+
624
+ /**
625
+ * Pin an inline-data-URL file to a channel's Pinned tab (file.pin; posts a system
626
+ * message). Idempotent — pass a stable `o.idempotencyKey` for safe retries.
627
+ * @param {object} params - { channelId, name, mimeType?, sizeBytes?, dataUrl }
628
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
629
+ */
630
+ export function filePin(params, o = {}) {
631
+ return call("file.pin", params || {}, o);
632
+ }
633
+
634
+ /**
635
+ * Remove a pinned file (file.unpin; posts a system message).
636
+ * @param {object} params - { id }
637
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
638
+ */
639
+ export function fileUnpin(params, o = {}) {
640
+ return call("file.unpin", params || {}, o);
641
+ }
642
+
643
+ /**
644
+ * Add a comment to an opaque fileKey (file.addComment; optional channel-visibility gate).
645
+ * @param {object} params - { fileKey, fileName?, body, channelId? }
646
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
647
+ */
648
+ export function fileAddComment(params, o = {}) {
649
+ return call("file.addComment", params || {}, o);
650
+ }
651
+
652
+ /**
653
+ * List comments for a file, oldest-first (file.listComments). Non-side-effecting RPC method.
654
+ * @param {object} params - { fileKey, channelId? }
655
+ * @param {object} o - { base, token, fetchImpl? }
656
+ */
657
+ export function fileListComments(params, o = {}) {
658
+ return call("file.listComments", params || {}, o);
659
+ }
660
+
661
+ /**
662
+ * List pinned files for a channel (file.listPinned). Non-side-effecting RPC method.
663
+ * @param {object} params - { channelId }
664
+ * @param {object} o - { base, token, fetchImpl? }
665
+ */
666
+ export function fileListPinned(params, o = {}) {
667
+ return call("file.listPinned", params || {}, o);
668
+ }
669
+
670
+ // ---------------------------------------------------------------------------
671
+ // memory — Cortex index-hint MemoryEntry authoring + amendment lifecycle
672
+ // ---------------------------------------------------------------------------
673
+
674
+ /**
675
+ * Author (add) or amend a Cortex index-hint MemoryEntry (memory.author; amend path
676
+ * bumps version + history). Idempotent — pass a stable `o.idempotencyKey`.
677
+ * @param {object} params - { memoryClass, title, summary?, scopes[]?, amendOf?, note? }
678
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
679
+ */
680
+ export function memoryAuthor(params, o = {}) {
681
+ return call("memory.author", params || {}, o);
682
+ }
683
+
684
+ /**
685
+ * Stage an amendment proposal onto an entry (memory.proposeAmendment; live fields untouched).
686
+ * @param {object} params - { entryId, title, summary?, scopes[]?, note, proposedByKind? }
687
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
688
+ */
689
+ export function memoryProposeAmendment(params, o = {}) {
690
+ return call("memory.proposeAmendment", params || {}, o);
691
+ }
692
+
693
+ /**
694
+ * Ratify a staged proposal (memory.mergeAmendment; version bump, merger != proposer).
695
+ * @param {object} params - { entryId, proposalId }
696
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
697
+ */
698
+ export function memoryMergeAmendment(params, o = {}) {
699
+ return call("memory.mergeAmendment", params || {}, o);
700
+ }
701
+
702
+ /**
703
+ * List Cortex MemoryEntry index hints (memory.list). Non-side-effecting RPC method.
704
+ * @param {object} params - { memoryClass?, scope? }
705
+ * @param {object} o - { base, token, fetchImpl? }
706
+ */
707
+ export function memoryList(params, o = {}) {
708
+ return call("memory.list", params || {}, o);
709
+ }
710
+
711
+ // ---------------------------------------------------------------------------
712
+ // compact — 1:1 DM working compacts (one row per channel)
713
+ // ---------------------------------------------------------------------------
714
+
715
+ /**
716
+ * Create/version a 1:1 DM compact (compact.upsert; one row per channel, full
717
+ * history in the ledger). Idempotent — pass a stable `o.idempotencyKey`.
718
+ * @param {object} params - { channelId, cadence?, voice?, withoutAsking[]?, alwaysAsks[]?, standing[]? }
719
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
720
+ */
721
+ export function compactUpsert(params, o = {}) {
722
+ return call("compact.upsert", params || {}, o);
723
+ }
724
+
725
+ // ---------------------------------------------------------------------------
726
+ // notification — the caller's own notification preferences
727
+ // ---------------------------------------------------------------------------
728
+
729
+ /**
730
+ * Upsert the caller's notification preferences (notification.updatePreferences; all fields partial).
731
+ * @param {object} params - { emailOnCharterChange?, emailOnRoleChange?, emailOnReportingChange?, emailOnTeamChange?, emailOnComment?, emailOnMention?, emailOnDecision?, emailOnEscalation?, emailOnReviewRequest?, emailOnFleetAlert?, emailOnSecurityAlert?, emailDailyBrief?, dmFromHumans?, dmFromAgents?, mentionScope?, quietHoursEnabled?, quietHoursStart?, quietHoursEnd?, muteWeekends?, digestHourUtc? }
732
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
733
+ */
734
+ export function notificationUpdatePreferences(params, o = {}) {
735
+ return call("notification.updatePreferences", params || {}, o);
736
+ }
737
+
738
+ /**
739
+ * Read the caller's notification preferences or defaults (notification.getPreferences). Non-side-effecting RPC method.
740
+ * @param {object} params - {}
741
+ * @param {object} o - { base, token, fetchImpl? }
742
+ */
743
+ export function notificationGetPreferences(params, o = {}) {
744
+ return call("notification.getPreferences", params || {}, o);
745
+ }
746
+
747
+ // ---------------------------------------------------------------------------
748
+ // decision — human-side comment/sign/reverse/adjust on live decisions
749
+ // (decision.propose/adopt/supersede/list live in client.mjs)
750
+ // ---------------------------------------------------------------------------
751
+
752
+ /**
753
+ * Add a human comment to a live decision (decision.comment; append-only Decision row untouched).
754
+ * @param {object} params - { decisionId, text }
755
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
756
+ */
757
+ export function decisionComment(params, o = {}) {
758
+ return call("decision.comment", params || {}, o);
759
+ }
760
+
761
+ /**
762
+ * Append an attestation to Decision.signedBy (decision.sign; idempotent per member, rejects superseded).
763
+ * @param {object} params - { decisionId, memberSlug, ts? }
764
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
765
+ */
766
+ export function decisionSign(params, o = {}) {
767
+ return call("decision.sign", params || {}, o);
768
+ }
769
+
770
+ /**
771
+ * CAS-reverse a reversible, non-superseded/non-reversed decision (decision.reverse).
772
+ * @param {object} params - { decisionId, reason? }
773
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
774
+ */
775
+ export function decisionReverse(params, o = {}) {
776
+ return call("decision.reverse", params || {}, o);
777
+ }
778
+
779
+ /**
780
+ * Record an adjustment ask as a DecisionComment(isAdjustment=true) (decision.requestAdjustment).
781
+ * @param {object} params - { decisionId, feedback }
782
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
783
+ */
784
+ export function decisionRequestAdjustment(params, o = {}) {
785
+ return call("decision.requestAdjustment", params || {}, o);
786
+ }
787
+
788
+ /**
789
+ * List comments on a decision (decision.listComments). Non-side-effecting RPC method.
790
+ * @param {object} params - { decisionId }
791
+ * @param {object} o - { base, token, fetchImpl? }
792
+ */
793
+ export function decisionListComments(params, o = {}) {
794
+ return call("decision.listComments", params || {}, o);
795
+ }
796
+
797
+ // ---------------------------------------------------------------------------
798
+ // messaging — schedule/delete/pin/unpin/bookmark (send/react/edit live in client.mjs)
799
+ // ---------------------------------------------------------------------------
800
+
801
+ /**
802
+ * Queue a future-dated message in a channel (messaging.schedule).
803
+ * @param {object} params - { channelId, body, scheduledFor }
804
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
805
+ */
806
+ export function messagingSchedule(params, o = {}) {
807
+ return call("messaging.schedule", params || {}, o);
808
+ }
809
+
810
+ /**
811
+ * Author-only soft-delete of a message (messaging.delete; REDACTED audit).
812
+ * @param {object} params - { messageId }
813
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
814
+ */
815
+ export function messagingDelete(params, o = {}) {
816
+ return call("messaging.delete", params || {}, o);
817
+ }
818
+
819
+ /**
820
+ * Per-user pin of a visible message (messaging.pin).
821
+ * @param {object} params - { messageId }
822
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
823
+ */
824
+ export function messagingPin(params, o = {}) {
825
+ return call("messaging.pin", params || {}, o);
826
+ }
827
+
828
+ /**
829
+ * Remove the caller's own MessagePin (messaging.unpin).
830
+ * @param {object} params - { messageId }
831
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
832
+ */
833
+ export function messagingUnpin(params, o = {}) {
834
+ return call("messaging.unpin", params || {}, o);
835
+ }
836
+
837
+ /**
838
+ * Per-user bookmark of a visible message (messaging.bookmark).
839
+ * @param {object} params - { messageId }
840
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
841
+ */
842
+ export function messagingBookmark(params, o = {}) {
843
+ return call("messaging.bookmark", params || {}, o);
844
+ }
845
+
846
+ /**
847
+ * Remove the caller's own MessageBookmark (messaging.unbookmark).
848
+ * @param {object} params - { messageId }
849
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
850
+ */
851
+ export function messagingUnbookmark(params, o = {}) {
852
+ return call("messaging.unbookmark", params || {}, o);
853
+ }
854
+
855
+ // ---------------------------------------------------------------------------
856
+ // board (human kanban) — workstreams/lanes + tasks, comments, attachments
857
+ // (board.create/claim/complete/decompose/assign/link live in client.mjs)
858
+ // Named entity-first (taskUpdate, workstreamCreate, …) to read ergonomically.
859
+ // ---------------------------------------------------------------------------
860
+
861
+ /**
862
+ * Create a workstream/swimlane (board.createWorkstream). Idempotent — pass a
863
+ * stable `o.idempotencyKey` for safe retries.
864
+ * @param {object} params - { name, objective?, status?, priority?, channelId?, ownerId?, strategyStreamId? }
865
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
866
+ */
867
+ export function workstreamCreate(params, o = {}) {
868
+ return call("board.createWorkstream", params || {}, o);
869
+ }
870
+
871
+ /**
872
+ * Patch changed lane fields only (board.updateWorkstream).
873
+ * @param {object} params - { workstreamId, name?, objective?, ownerId?, status? }
874
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
875
+ */
876
+ export function workstreamUpdate(params, o = {}) {
877
+ return call("board.updateWorkstream", params || {}, o);
878
+ }
879
+
880
+ /**
881
+ * Delete a lane; tasks fall to unassigned (board.deleteWorkstream).
882
+ * @param {object} params - { workstreamId }
883
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
884
+ */
885
+ export function workstreamDelete(params, o = {}) {
886
+ return call("board.deleteWorkstream", params || {}, o);
887
+ }
888
+
889
+ /**
890
+ * Swap a lane's position with its up/down neighbor (board.moveWorkstream).
891
+ * @param {object} params - { workstreamId, direction }
892
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
893
+ */
894
+ export function workstreamMove(params, o = {}) {
895
+ return call("board.moveWorkstream", params || {}, o);
896
+ }
897
+
898
+ /**
899
+ * Create a task (board.createTask; refs validated in-org, channel visibility
900
+ * enforced). Idempotent — pass a stable `o.idempotencyKey` for safe retries.
901
+ * @param {object} params - { title, detail?, col?, priority?, channelId?, workstreamId?, assigneeId?, reviewerId?, strategyStreamId?, blockedById?, why? }
902
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
903
+ */
904
+ export function taskCreate(params, o = {}) {
905
+ return call("board.createTask", params || {}, o);
906
+ }
907
+
908
+ /**
909
+ * Diff-based task field patch (board.updateTask; blockedBy merged into why).
910
+ * @param {object} params - { taskId, title?, detail?, priority?, col?, blockedBy?, dueAt?, tags[]?, checklist[]? }
911
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
912
+ */
913
+ export function taskUpdate(params, o = {}) {
914
+ return call("board.updateTask", params || {}, o);
915
+ }
916
+
917
+ /**
918
+ * Kanban drag: update col + optional lane move (board.moveTask; visibility checked both sides).
919
+ * @param {object} params - { taskId, col, workstreamId?, why? }
920
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
921
+ */
922
+ export function taskMove(params, o = {}) {
923
+ return call("board.moveTask", params || {}, o);
924
+ }
925
+
926
+ /**
927
+ * Set/clear task owner (board.assignTask; assignee must be ACTIVE in-org).
928
+ * @param {object} params - { taskId, assigneeId|null }
929
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
930
+ */
931
+ export function taskAssign(params, o = {}) {
932
+ return call("board.assignTask", params || {}, o);
933
+ }
934
+
935
+ /**
936
+ * Post a task-thread comment (board.addTaskComment; server-resolved author).
937
+ * @param {object} params - { taskId, body, kind? }
938
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
939
+ */
940
+ export function taskAddComment(params, o = {}) {
941
+ return call("board.addTaskComment", params || {}, o);
942
+ }
943
+
944
+ /**
945
+ * Inline a data-URL file as a new task attachment (board.addTaskAttachment).
946
+ * Idempotent — pass a stable `o.idempotencyKey` for safe retries.
947
+ * @param {object} params - { taskId, name, mimeType?, sizeBytes?, dataUrl }
948
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
949
+ */
950
+ export function taskAddAttachment(params, o = {}) {
951
+ return call("board.addTaskAttachment", params || {}, o);
952
+ }
953
+
954
+ /**
955
+ * Save edited inline content of an existing attachment (board.updateTaskAttachment).
956
+ * @param {object} params - { id, sizeBytes?, dataUrl }
957
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
958
+ */
959
+ export function taskUpdateAttachment(params, o = {}) {
960
+ return call("board.updateTaskAttachment", params || {}, o);
961
+ }
962
+
963
+ /**
964
+ * Delete a task attachment (board.removeTaskAttachment).
965
+ * @param {object} params - { id }
966
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
967
+ */
968
+ export function taskRemoveAttachment(params, o = {}) {
969
+ return call("board.removeTaskAttachment", params || {}, o);
970
+ }
971
+
972
+ /**
973
+ * List a task's comments (board.taskComments). Non-side-effecting RPC method.
974
+ * @param {object} params - { taskId }
975
+ * @param {object} o - { base, token, fetchImpl? }
976
+ */
977
+ export function taskComments(params, o = {}) {
978
+ return call("board.taskComments", params || {}, o);
979
+ }
980
+
981
+ /**
982
+ * List a task's attachments (board.taskAttachments). Non-side-effecting RPC method.
983
+ * @param {object} params - { taskId }
984
+ * @param {object} o - { base, token, fetchImpl? }
985
+ */
986
+ export function taskAttachments(params, o = {}) {
987
+ return call("board.taskAttachments", params || {}, o);
988
+ }
989
+
990
+ // ---------------------------------------------------------------------------
991
+ // invitation — workspace invitations (admin scope)
992
+ // ---------------------------------------------------------------------------
993
+
994
+ /**
995
+ * Create a 14-day invitation, optionally pre-linked to a seat, and email it
996
+ * (invitation.create). Idempotent — pass a stable `o.idempotencyKey`.
997
+ * @param {object} params - { email, role, workforceMemberId? }
998
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
999
+ */
1000
+ export function invitationCreate(params, o = {}) {
1001
+ return call("invitation.create", params || {}, o);
1002
+ }
1003
+
1004
+ /**
1005
+ * Revoke a pending/expired invitation (invitation.revoke; rejects if ACCEPTED).
1006
+ * @param {object} params - { id }
1007
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1008
+ */
1009
+ export function invitationRevoke(params, o = {}) {
1010
+ return call("invitation.revoke", params || {}, o);
1011
+ }
1012
+
1013
+ /**
1014
+ * Re-issue a pending/expired invitation with a fresh token + window (invitation.resend).
1015
+ * @param {object} params - { id }
1016
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1017
+ */
1018
+ export function invitationResend(params, o = {}) {
1019
+ return call("invitation.resend", params || {}, o);
1020
+ }
1021
+
1022
+ // ---------------------------------------------------------------------------
1023
+ // user — role / access administration (admin scope)
1024
+ // ---------------------------------------------------------------------------
1025
+
1026
+ /**
1027
+ * Change a user's role (user.updateRole; OWNER-only for ADMIN/OWNER tiers, never your own).
1028
+ * @param {object} params - { userId, role }
1029
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1030
+ */
1031
+ export function userUpdateRole(params, o = {}) {
1032
+ return call("user.updateRole", params || {}, o);
1033
+ }
1034
+
1035
+ /**
1036
+ * OWNER-only hard removal of a user's access (user.deactivate; never self).
1037
+ * @param {object} params - { userId }
1038
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1039
+ */
1040
+ export function userDeactivate(params, o = {}) {
1041
+ return call("user.deactivate", params || {}, o);
1042
+ }
1043
+
1044
+ // ---------------------------------------------------------------------------
1045
+ // settings — workspace API keys, secrets, offices, company profile, design tokens
1046
+ // ---------------------------------------------------------------------------
1047
+
1048
+ /**
1049
+ * Mint a workspace API key (settings.mintApiKey; raw secret returned once).
1050
+ * Idempotent — pass a stable `o.idempotencyKey` for safe retries.
1051
+ * @param {object} params - { name }
1052
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1053
+ */
1054
+ export function settingsMintApiKey(params, o = {}) {
1055
+ return call("settings.mintApiKey", params || {}, o);
1056
+ }
1057
+
1058
+ /**
1059
+ * Rename a workspace API key label (settings.renameApiKey).
1060
+ * @param {object} params - { keyId, name }
1061
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1062
+ */
1063
+ export function settingsRenameApiKey(params, o = {}) {
1064
+ return call("settings.renameApiKey", params || {}, o);
1065
+ }
1066
+
1067
+ /**
1068
+ * Soft-revoke a workspace API key (settings.revokeApiKey; idempotent).
1069
+ * @param {object} params - { keyId }
1070
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1071
+ */
1072
+ export function settingsRevokeApiKey(params, o = {}) {
1073
+ return call("settings.revokeApiKey", params || {}, o);
1074
+ }
1075
+
1076
+ /**
1077
+ * Record a secret lifecycle event in the ledger with non-secret metadata
1078
+ * (settings.recordSecretRotation).
1079
+ * @param {object} params - { keyName, provider, scope?, action }
1080
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1081
+ */
1082
+ export function settingsRecordSecretRotation(params, o = {}) {
1083
+ return call("settings.recordSecretRotation", params || {}, o);
1084
+ }
1085
+
1086
+ /**
1087
+ * Create/update a sealed shared Secret (settings.upsertSecret; value AES-256-GCM,
1088
+ * never returned). Idempotent — pass a stable `o.idempotencyKey`.
1089
+ * @param {object} params - { id?, name, provider?, scope?, value? }
1090
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1091
+ */
1092
+ export function settingsUpsertSecret(params, o = {}) {
1093
+ return call("settings.upsertSecret", params || {}, o);
1094
+ }
1095
+
1096
+ /**
1097
+ * Delete a Secret (settings.deleteSecret; idempotent).
1098
+ * @param {object} params - { id }
1099
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1100
+ */
1101
+ export function settingsDeleteSecret(params, o = {}) {
1102
+ return call("settings.deleteSecret", params || {}, o);
1103
+ }
1104
+
1105
+ /**
1106
+ * Create/update an office location (settings.upsertOfficeLocation; name or city
1107
+ * required). Idempotent — pass a stable `o.idempotencyKey`.
1108
+ * @param {object} params - { id?, name, status?, street?, city?, region?, postal?, country?, email?, phone?, facilities? }
1109
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1110
+ */
1111
+ export function settingsUpsertOfficeLocation(params, o = {}) {
1112
+ return call("settings.upsertOfficeLocation", params || {}, o);
1113
+ }
1114
+
1115
+ /**
1116
+ * Delete an office location (settings.deleteOfficeLocation; idempotent).
1117
+ * @param {object} params - { id }
1118
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1119
+ */
1120
+ export function settingsDeleteOfficeLocation(params, o = {}) {
1121
+ return call("settings.deleteOfficeLocation", params || {}, o);
1122
+ }
1123
+
1124
+ /**
1125
+ * Persist company profile + keep authoritative Org.name in sync
1126
+ * (settings.saveCompanyProfile). Idempotent — pass a stable `o.idempotencyKey`.
1127
+ * @param {object} params - { name, legalEntity?, website?, headquarters?, oneLiner?, logoUrl? }
1128
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1129
+ */
1130
+ export function settingsSaveCompanyProfile(params, o = {}) {
1131
+ return call("settings.saveCompanyProfile", params || {}, o);
1132
+ }
1133
+
1134
+ /**
1135
+ * Upsert the org's opaque design-token blob verbatim (settings.saveDesignTokens;
1136
+ * one row per org). Idempotent — pass a stable `o.idempotencyKey`.
1137
+ * @param {object} params - { tokens }
1138
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1139
+ */
1140
+ export function settingsSaveDesignTokens(params, o = {}) {
1141
+ return call("settings.saveDesignTokens", params || {}, o);
1142
+ }
1143
+
1144
+ /**
1145
+ * Read the org's design-token blob or null (settings.getDesignTokens). Non-side-effecting RPC method.
1146
+ * @param {object} params - {}
1147
+ * @param {object} o - { base, token, fetchImpl? }
1148
+ */
1149
+ export function settingsGetDesignTokens(params, o = {}) {
1150
+ return call("settings.getDesignTokens", params || {}, o);
1151
+ }
1152
+
1153
+ /**
1154
+ * List workspace API key metadata, no secrets (settings.listApiKeys). Non-side-effecting RPC method.
1155
+ * @param {object} params - {}
1156
+ * @param {object} o - { base, token, fetchImpl? }
1157
+ */
1158
+ export function settingsListApiKeys(params, o = {}) {
1159
+ return call("settings.listApiKeys", params || {}, o);
1160
+ }
1161
+
1162
+ // ---------------------------------------------------------------------------
1163
+ // billing — org subscription
1164
+ // ---------------------------------------------------------------------------
1165
+
1166
+ /**
1167
+ * Update the org subscription (billing.update; upsert by orgId).
1168
+ * @param {object} params - { plan?, interval?, amountUsd?, billingOwnerId? }
1169
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1170
+ */
1171
+ export function billingUpdate(params, o = {}) {
1172
+ return call("billing.update", params || {}, o);
1173
+ }
1174
+
1175
+ // ---------------------------------------------------------------------------
1176
+ // org — workspace lifecycle + org-scoped API keys (admin scope)
1177
+ // ---------------------------------------------------------------------------
1178
+
1179
+ /**
1180
+ * Create an org (org.create; creator seated as OWNER, default scaffold). Idempotent
1181
+ * — pass a stable `o.idempotencyKey` for safe retries.
1182
+ * @param {object} params - { name, slug? }
1183
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1184
+ */
1185
+ export function orgCreate(params, o = {}) {
1186
+ return call("org.create", params || {}, o);
1187
+ }
1188
+
1189
+ /**
1190
+ * OWNER-only permanent workspace delete (org.delete; refuses the founding org, cascades tenant).
1191
+ * @param {object} params - { orgId, confirmSlug? }
1192
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1193
+ */
1194
+ export function orgDelete(params, o = {}) {
1195
+ return call("org.delete", params || {}, o);
1196
+ }
1197
+
1198
+ /**
1199
+ * Mint an org API key for a target org (org.mintApiKey; raw secret returned once).
1200
+ * Idempotent — pass a stable `o.idempotencyKey` for safe retries.
1201
+ * @param {object} params - { orgId, name }
1202
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1203
+ */
1204
+ export function orgMintApiKey(params, o = {}) {
1205
+ return call("org.mintApiKey", params || {}, o);
1206
+ }
1207
+
1208
+ /**
1209
+ * Soft-revoke an org API key (org.revokeApiKey; idempotent).
1210
+ * @param {object} params - { orgId, keyId }
1211
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1212
+ */
1213
+ export function orgRevokeApiKey(params, o = {}) {
1214
+ return call("org.revokeApiKey", params || {}, o);
1215
+ }
1216
+
1217
+ /**
1218
+ * List all orgs the caller is seated in (org.list). Non-side-effecting RPC method.
1219
+ * @param {object} params - {}
1220
+ * @param {object} o - { base, token, fetchImpl? }
1221
+ */
1222
+ export function orgList(params, o = {}) {
1223
+ return call("org.list", params || {}, o);
1224
+ }
1225
+
1226
+ // ---------------------------------------------------------------------------
1227
+ // integration — sealed provider connections (admin scope)
1228
+ // ---------------------------------------------------------------------------
1229
+
1230
+ /**
1231
+ * Connect a provider by sealing a pasted token into an Integration row
1232
+ * (integration.connect; upsert by [orgId,provider]). Idempotent — pass a stable
1233
+ * `o.idempotencyKey` for safe retries.
1234
+ * @param {object} params - { provider, token, externalAccountId?, scope? }
1235
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1236
+ */
1237
+ export function integrationConnect(params, o = {}) {
1238
+ return call("integration.connect", params || {}, o);
1239
+ }
1240
+
1241
+ /**
1242
+ * Revoke a connected integration (integration.disconnect; status->revoked, token zeroed).
1243
+ * @param {object} params - { provider }
1244
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1245
+ */
1246
+ export function integrationDisconnect(params, o = {}) {
1247
+ return call("integration.disconnect", params || {}, o);
1248
+ }
1249
+
1250
+ /**
1251
+ * List connected provider ids, no tokens (integration.list). Non-side-effecting RPC method.
1252
+ * @param {object} params - {}
1253
+ * @param {object} o - { base, token, fetchImpl? }
1254
+ */
1255
+ export function integrationList(params, o = {}) {
1256
+ return call("integration.list", params || {}, o);
1257
+ }
1258
+
1259
+ // ---------------------------------------------------------------------------
1260
+ // email — the agent workspace mailbox (companion spec 2026-07-21 §8)
1261
+ // ---------------------------------------------------------------------------
1262
+ //
1263
+ // Five wrappers over the additive `email.*` family. All POST METHODS (the
1264
+ // reads follow the messaging.history `sideEffecting:false` precedent — they
1265
+ // ride call(), never client.read()). Bodies NEVER ride the chain: org events
1266
+ // show redacted `email.*` kinds only; content comes from emailMessage /
1267
+ // emailThread. When this SDK's vendored protocol predates the family, call()
1268
+ // returns its standard NOT_FOUND error frame — nothing throws — and the
1269
+ // orgmail adapter's healthCheck surfaces it.
1270
+
1271
+ /**
1272
+ * Send workspace email from the acting agent's mailbox (email.send; outbox-
1273
+ * queued server-side, `sideEffecting:true, idempotent:true`). Thread replies
1274
+ * may omit to/subject — hq's reply rule derives them from the thread's newest
1275
+ * delivered inbound message. May return a NORMAL result
1276
+ * `{status:"approval_required", approval:{actionClass:"external_comms",
1277
+ * payloadHash, intent}, firstContactRecipients}` for first-contact recipients:
1278
+ * approval.request that exact payload → approval.wait → re-send with
1279
+ * `approvalId`, the SAME `idempotencyId`, and a FRESH `o.idempotencyKey` (the
1280
+ * dispatcher cached the refusal under the old header key).
1281
+ * @param {object} params - { to?, cc?, bcc?, subject?, text, html?, threadId?,
1282
+ * replyToMessageId?, idempotencyId, approvalId? }
1283
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1284
+ */
1285
+ export function emailSend(params, o = {}) {
1286
+ return call("email.send", params || {}, o);
1287
+ }
1288
+
1289
+ /**
1290
+ * Advance the server-side read cursor (email.markRead) for one message or a
1291
+ * whole thread — exactly one of {messageId | threadId}. THE cursor: the
1292
+ * orgmail adapter keeps no local cursor file; an unmarked item simply
1293
+ * re-delivers on the next inbox poll (at-least-once by design).
1294
+ * @param {object} params - { messageId? | threadId? }
1295
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1296
+ */
1297
+ export function emailMarkRead(params, o = {}) {
1298
+ return call("email.markRead", params || {}, o);
1299
+ }
1300
+
1301
+ /**
1302
+ * Keyset-paged own-mailbox listing (email.inbox; `sideEffecting:false` METHOD).
1303
+ * Result: `{ mailbox:{address,status,domain,domainStatus}, messages:[summary…],
1304
+ * nextCursor }` — summaries + snippet only; bodies via emailMessage. Excludes
1305
+ * quarantined/auto-submitted rows (those exist for admins, not agents).
1306
+ * @param {object} params - { unreadOnly?, cursor?, limit? }
1307
+ * @param {object} o - { base, token, fetchImpl? }
1308
+ */
1309
+ export function emailInbox(params, o = {}) {
1310
+ return call("email.inbox", params || {}, o);
1311
+ }
1312
+
1313
+ /**
1314
+ * Full body/headers/attachment-metadata DTO for ONE own-mailbox message
1315
+ * (email.message). Cross-mailbox ids return NOT_FOUND — no probing.
1316
+ * @param {object} params - { id }
1317
+ * @param {object} o - { base, token, fetchImpl? }
1318
+ */
1319
+ export function emailMessage(params, o = {}) {
1320
+ return call("email.message", params || {}, o);
1321
+ }
1322
+
1323
+ /**
1324
+ * A whole email thread with bodies, ascending (email.thread; own-mailbox only).
1325
+ * @param {object} params - { threadId, limit? }
1326
+ * @param {object} o - { base, token, fetchImpl? }
1327
+ */
1328
+ export function emailThread(params, o = {}) {
1329
+ return call("email.thread", params || {}, o);
1330
+ }
1331
+
1332
+ // ---------------------------------------------------------------------------
1333
+ // artifact — generative-UI artifact cards (GU program 2026-07)
1334
+ // ---------------------------------------------------------------------------
1335
+ //
1336
+ // Six wrappers over the additive `artifact.*` family — interactive cards agents
1337
+ // post into conversational feeds, every rendered action equally invocable
1338
+ // programmatically (the two-sided law). ALL six are `sideEffecting:false` at
1339
+ // the DISPATCHER: the hq artifact service owns its own multi-write (Message +
1340
+ // Artifact rows + self-appended chain events + approval gating), so dedup for
1341
+ // the write verbs rides BUSINESS ids in params — `clientMsgId` on create,
1342
+ // `idempotencyKey` on act ((artifact, actor, action, key) dedupe service-side)
1343
+ // — NOT the `o.idempotencyKey` header (call() only attaches that header to
1344
+ // protocol-side-effecting methods). When this SDK's vendored protocol predates
1345
+ // the family, call() returns its standard NOT_FOUND error frame — nothing throws.
1346
+
1347
+ /**
1348
+ * Post a generative-UI artifact into a channel (artifact.create): one Message +
1349
+ * one Artifact row. `envelope` is genui/v2 ({genui:"v2", artifact:{class,
1350
+ * version, state, source, provenance?, ttlAt?, deepLink?}, actions:[≤12],
1351
+ * root:{type:"card", tone, title?, blocks:[…]}}); genui/v1 {genui:"v1",
1352
+ * root:card} stays valid for simple static cards. Post state:"streaming" with
1353
+ * skeleton blocks, then artifactPatch to hydrate. Supply a stable
1354
+ * `params.clientMsgId` so a retried create collapses to one artifact.
1355
+ * @param {object} params - { channelId, envelope, threadRootId?, clientMsgId? }
1356
+ * @param {object} o - { base, token, fetchImpl? }
1357
+ * @returns {Promise<object>} res frame {ok:true, result:{artifactId, messageId}}
1358
+ */
1359
+ export function artifactCreate(params, o = {}) {
1360
+ return call("artifact.create", params || {}, o);
1361
+ }
1362
+
1363
+ /**
1364
+ * Invoke an artifact action (artifact.act) — the SAME action a human clicking
1365
+ * the rendered button invokes, same params schema (see artifactCatalog).
1366
+ * Address by artifactId or messageId. The result carries the action outcome;
1367
+ * `{held:true, approvalId}` = approval-gated: await the approval, then
1368
+ * re-invoke with the SAME `params.idempotencyKey` to consume the grant;
1369
+ * `{replay:true}` = idempotent replay (already ran under this key). Supply a
1370
+ * stable `params.idempotencyKey` whenever you may retry.
1371
+ * @param {object} params - { artifactId? | messageId?, action, params?, idempotencyKey? }
1372
+ * @param {object} o - { base, token, fetchImpl? }
1373
+ */
1374
+ export function artifactAct(params, o = {}) {
1375
+ return call("artifact.act", params || {}, o);
1376
+ }
1377
+
1378
+ /**
1379
+ * Patch an artifact's lifecycle/envelope (artifact.patch): hydrate a
1380
+ * state:"streaming" skeleton with the full envelope, transition `toState`
1381
+ * (draft|streaming|complete|acted|expired|error), or attach a `receipt`.
1382
+ * Authoring-side verb — acting on buttons is artifactAct.
1383
+ * @param {object} params - { artifactId, toState?, envelope?, receipt? }
1384
+ * @param {object} o - { base, token, fetchImpl? }
1385
+ */
1386
+ export function artifactPatch(params, o = {}) {
1387
+ return call("artifact.patch", params || {}, o);
1388
+ }
1389
+
1390
+ /**
1391
+ * One artifact row (artifact.get): envelope, state, class, messageId,
1392
+ * channelId. Non-side-effecting RPC method.
1393
+ * @param {object} params - { artifactId }
1394
+ * @param {object} o - { base, token, fetchImpl? }
1395
+ */
1396
+ export function artifactGet(params, o = {}) {
1397
+ return call("artifact.get", params || {}, o);
1398
+ }
1399
+
1400
+ /**
1401
+ * List artifact rows (artifact.list), filterable by channel/class/lifecycle
1402
+ * state; newest first, server-capped limit. Non-side-effecting RPC method.
1403
+ * @param {object} params - { channelId?, class?, state?, limit? }
1404
+ * @param {object} o - { base, token, fetchImpl? }
1405
+ */
1406
+ export function artifactList(params, o = {}) {
1407
+ return call("artifact.list", params || {}, o);
1408
+ }
1409
+
1410
+ /**
1411
+ * The native artifact class catalog (artifact.catalog): {version, classes:[{
1412
+ * class, version, title, describe, actions:[{name, label, kind, description?,
1413
+ * params? (JSON Schema), confirm?, gate?, audience, roles?}]}]}. THE discovery
1414
+ * surface — read it before composing a native-class create or an act so class
1415
+ * versions, action names, and params match the server registry.
1416
+ * @param {object} params - {}
1417
+ * @param {object} o - { base, token, fetchImpl? }
1418
+ */
1419
+ export function artifactCatalog(params, o = {}) {
1420
+ return call("artifact.catalog", params || {}, o);
1421
+ }
1422
+
1423
+ // ---------------------------------------------------------------------------
1424
+ // email (Inbox app) — the agent lane of the human Inbox (mailboxes/viewpoints,
1425
+ // governed drafts, rules, folders, signatures). Same domain services as the
1426
+ // human server actions: mailbox entitlements, per-thread holds and the
1427
+ // guardian-only verbs are enforced identically. Bodies stay REDACTED on-chain.
1428
+ // ---------------------------------------------------------------------------
1429
+
1430
+ /**
1431
+ * Entitled mailboxes/viewpoints with unread + approval counts (email.mailboxes). Non-side-effecting RPC method (POST via call(), never client.read()).
1432
+ * @param {object} params - {}
1433
+ * @param {object} o - { base, token, fetchImpl? }
1434
+ */
1435
+ export function emailMailboxes(params, o = {}) {
1436
+ return call("email.mailboxes", params || {}, o);
1437
+ }
1438
+
1439
+ /**
1440
+ * Thread rows for one mailbox; folder = inbox|archive|starred|assigned|tag:<name>|<folderId> (email.threads). Non-side-effecting RPC method (POST via call(), never client.read()).
1441
+ * @param {object} params - { mailboxId, folder?, unreadOnly?, limit? }
1442
+ * @param {object} o - { base, token, fetchImpl? }
1443
+ */
1444
+ export function emailThreads(params, o = {}) {
1445
+ return call("email.threads", params || {}, o);
1446
+ }
1447
+
1448
+ /**
1449
+ * One thread's messages (bcc visible on OUTBOUND only) (email.messages). Non-side-effecting RPC method (POST via call(), never client.read()).
1450
+ * @param {object} params - { threadId }
1451
+ * @param {object} o - { base, token, fetchImpl? }
1452
+ */
1453
+ export function emailMessages(params, o = {}) {
1454
+ return call("email.messages", params || {}, o);
1455
+ }
1456
+
1457
+ /**
1458
+ * COMPOSING/RETURNED drafts visible to the acting seat (email.drafts). Non-side-effecting RPC method (POST via call(), never client.read()).
1459
+ * @param {object} params - { mailboxId? }
1460
+ * @param {object} o - { base, token, fetchImpl? }
1461
+ */
1462
+ export function emailDrafts(params, o = {}) {
1463
+ return call("email.drafts", params || {}, o);
1464
+ }
1465
+
1466
+ /**
1467
+ * HELD drafts awaiting guardian approval on guarded mailboxes (email.approvals). Non-side-effecting RPC method (POST via call(), never client.read()).
1468
+ * @param {object} params - { mailboxId? }
1469
+ * @param {object} o - { base, token, fetchImpl? }
1470
+ */
1471
+ export function emailApprovals(params, o = {}) {
1472
+ return call("email.approvals", params || {}, o);
1473
+ }
1474
+
1475
+ /**
1476
+ * Compiled mailbox rules + their recent rule events (email.rules). Non-side-effecting RPC method (POST via call(), never client.read()).
1477
+ * @param {object} params - { mailboxId }
1478
+ * @param {object} o - { base, token, fetchImpl? }
1479
+ */
1480
+ export function emailRules(params, o = {}) {
1481
+ return call("email.rules", params || {}, o);
1482
+ }
1483
+
1484
+ /**
1485
+ * Signatures for one mailbox (email.signatures). Non-side-effecting RPC method (POST via call(), never client.read()).
1486
+ * @param {object} params - { mailboxId }
1487
+ * @param {object} o - { base, token, fetchImpl? }
1488
+ */
1489
+ export function emailSignatures(params, o = {}) {
1490
+ return call("email.signatures", params || {}, o);
1491
+ }
1492
+
1493
+ /**
1494
+ * One triage facet per call: priority/category/tags/star/read OR assignment (email.triage).
1495
+ * @param {object} params - { threadId, priority?|category?|tags?|starred?|read?|assigneeMemberId? }
1496
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1497
+ */
1498
+ export function emailTriage(params, o = {}) {
1499
+ return call("email.triage", params || {}, o);
1500
+ }
1501
+
1502
+ /**
1503
+ * Run deterministic triage over the mailbox now (no model call) (email.triageNow).
1504
+ * @param {object} params - { mailboxId }
1505
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1506
+ */
1507
+ export function emailTriageNow(params, o = {}) {
1508
+ return call("email.triageNow", params || {}, o);
1509
+ }
1510
+
1511
+ /**
1512
+ * Move a thread: target = inbox|archive|delete|restore|snooze|folder (email.move).
1513
+ * @param {object} params - { threadId, target, folderId?, snoozeUntil? }
1514
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1515
+ */
1516
+ export function emailMove(params, o = {}) {
1517
+ return call("email.move", params || {}, o);
1518
+ }
1519
+
1520
+ /**
1521
+ * Mark every thread in the mailbox read (email.markAllRead). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1522
+ * @param {object} params - { mailboxId }
1523
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1524
+ */
1525
+ export function emailMarkAllRead(params, o = {}) {
1526
+ return call("email.markAllRead", params || {}, o);
1527
+ }
1528
+
1529
+ /**
1530
+ * Delegate a thread to another member (email.delegate).
1531
+ * @param {object} params - { threadId, delegateMemberId, note? }
1532
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1533
+ */
1534
+ export function emailDelegate(params, o = {}) {
1535
+ return call("email.delegate", params || {}, o);
1536
+ }
1537
+
1538
+ /**
1539
+ * Set/clear the per-thread outbound hold (email.holdReplies). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1540
+ * @param {object} params - { threadId, hold }
1541
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1542
+ */
1543
+ export function emailHoldReplies(params, o = {}) {
1544
+ return call("email.holdReplies", params || {}, o);
1545
+ }
1546
+
1547
+ /**
1548
+ * GUARDIAN-ONLY: redirect a thread to the guardian's own inbox (email.redirect).
1549
+ * @param {object} params - { threadId }
1550
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1551
+ */
1552
+ export function emailRedirect(params, o = {}) {
1553
+ return call("email.redirect", params || {}, o);
1554
+ }
1555
+
1556
+ /**
1557
+ * Create/update a draft (attachments may carry live workspaceFileId links) (email.draftSave). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1558
+ * @param {object} params - { draftId?, mailboxId, threadId?, mode, to?, cc?, bcc?, subject?, bodyText?, bodyHtml?, attachments?[{name,workspaceFileId?}] }
1559
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1560
+ */
1561
+ export function emailDraftSave(params, o = {}) {
1562
+ return call("email.draftSave", params || {}, o);
1563
+ }
1564
+
1565
+ /**
1566
+ * Discard a COMPOSING/RETURNED draft (held drafts cannot be discarded) (email.draftDiscard).
1567
+ * @param {object} params - { draftId }
1568
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1569
+ */
1570
+ export function emailDraftDiscard(params, o = {}) {
1571
+ return call("email.draftDiscard", params || {}, o);
1572
+ }
1573
+
1574
+ /**
1575
+ * Governance send — may return {status:"held", draftId, policyCite} instead of sending (never a silent send) (email.draftSend).
1576
+ * @param {object} params - { mailboxId, threadId?, mode?, to, cc?, bcc?, subject?, bodyText, bodyHtml?, attachments?, draftId? }
1577
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1578
+ */
1579
+ export function emailDraftSend(params, o = {}) {
1580
+ return call("email.draftSend", params || {}, o);
1581
+ }
1582
+
1583
+ /**
1584
+ * Undo a queued send (fails honestly once the message left QUEUED) (email.undoSend).
1585
+ * @param {object} params - { messageId }
1586
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1587
+ */
1588
+ export function emailUndoSend(params, o = {}) {
1589
+ return call("email.undoSend", params || {}, o);
1590
+ }
1591
+
1592
+ /**
1593
+ * GUARDIAN: approve (optionally amend-and-approve) a held draft (email.approve).
1594
+ * @param {object} params - { draftId, editedBody? }
1595
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1596
+ */
1597
+ export function emailApprove(params, o = {}) {
1598
+ return call("email.approve", params || {}, o);
1599
+ }
1600
+
1601
+ /**
1602
+ * GUARDIAN: approve every held draft; per-draft charter-§ refusals are honest (email.approveAll).
1603
+ * @param {object} params - { mailboxId }
1604
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1605
+ */
1606
+ export function emailApproveAll(params, o = {}) {
1607
+ return call("email.approveAll", params || {}, o);
1608
+ }
1609
+
1610
+ /**
1611
+ * GUARDIAN: amend a held draft (distinct mail.draft.amended event) (email.amend).
1612
+ * @param {object} params - { draftId, editedBody }
1613
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1614
+ */
1615
+ export function emailAmend(params, o = {}) {
1616
+ return call("email.amend", params || {}, o);
1617
+ }
1618
+
1619
+ /**
1620
+ * GUARDIAN: return a held draft to its author with a note (email.return).
1621
+ * @param {object} params - { draftId, note? }
1622
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1623
+ */
1624
+ export function emailReturn(params, o = {}) {
1625
+ return call("email.return", params || {}, o);
1626
+ }
1627
+
1628
+ /**
1629
+ * Save + versioned-compile a mailbox rule (email.ruleSave).
1630
+ * @param {object} params - { mailboxId, ruleId?, name, instruction, withFolder? }
1631
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1632
+ */
1633
+ export function emailRuleSave(params, o = {}) {
1634
+ return call("email.ruleSave", params || {}, o);
1635
+ }
1636
+
1637
+ /**
1638
+ * Enable/disable a compiled rule (email.ruleSetEnabled). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1639
+ * @param {object} params - { ruleId, enabled }
1640
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1641
+ */
1642
+ export function emailRuleSetEnabled(params, o = {}) {
1643
+ return call("email.ruleSetEnabled", params || {}, o);
1644
+ }
1645
+
1646
+ /**
1647
+ * Rename a mailbox folder (email.folderRename).
1648
+ * @param {object} params - { folderId, name }
1649
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1650
+ */
1651
+ export function emailFolderRename(params, o = {}) {
1652
+ return call("email.folderRename", params || {}, o);
1653
+ }
1654
+
1655
+ /**
1656
+ * Delete a folder (threads return to Inbox; the feeding rule pauses) (email.folderDelete).
1657
+ * @param {object} params - { folderId }
1658
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1659
+ */
1660
+ export function emailFolderDelete(params, o = {}) {
1661
+ return call("email.folderDelete", params || {}, o);
1662
+ }
1663
+
1664
+ /**
1665
+ * Create/update a signature (email.signatureSave).
1666
+ * @param {object} params - { signatureId?, mailboxId, name, bodyHtml, isDefault }
1667
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1668
+ */
1669
+ export function emailSignatureSave(params, o = {}) {
1670
+ return call("email.signatureSave", params || {}, o);
1671
+ }
1672
+
1673
+ /**
1674
+ * Delete a signature (last-one guard refuses) (email.signatureDelete).
1675
+ * @param {object} params - { signatureId }
1676
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1677
+ */
1678
+ export function emailSignatureDelete(params, o = {}) {
1679
+ return call("email.signatureDelete", params || {}, o);
1680
+ }
1681
+
1682
+ /**
1683
+ * Log a REAL org Decision from a thread (decision-family event) (email.logDecision).
1684
+ * @param {object} params - { threadId, title, rationale? }
1685
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1686
+ */
1687
+ export function emailLogDecision(params, o = {}) {
1688
+ return call("email.logDecision", params || {}, o);
1689
+ }
1690
+
1691
+ /**
1692
+ * SANDBOX extraction of action items from a thread (mail.extract.actioned) (email.extractAction).
1693
+ * @param {object} params - { threadId }
1694
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1695
+ */
1696
+ export function emailExtractAction(params, o = {}) {
1697
+ return call("email.extractAction", params || {}, o);
1698
+ }
1699
+
1700
+ /**
1701
+ * File a message attachment into the workspace drive as a REAL WorkspaceFile (provenance.bytesPresent honest) (email.fileAttachment).
1702
+ * @param {object} params - { messageId, attachmentIndex? }
1703
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1704
+ */
1705
+ export function emailFileAttachment(params, o = {}) {
1706
+ return call("email.fileAttachment", params || {}, o);
1707
+ }
1708
+
1709
+ /**
1710
+ * Report spam / not-spam: stamps the disposition AND maintains the mailbox's Blocked-senders rule (email.reportSpam).
1711
+ * @param {object} params - { threadId, spam? }
1712
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1713
+ */
1714
+ export function emailReportSpam(params, o = {}) {
1715
+ return call("email.reportSpam", params || {}, o);
1716
+ }
1717
+
1718
+ /**
1719
+ * Toggle the acting member's reaction pill on a message — new emoji replaces, same emoji removes (email.react).
1720
+ * @param {object} params - { messageId, emoji }
1721
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1722
+ */
1723
+ export function emailReact(params, o = {}) {
1724
+ return call("email.react", params || {}, o);
1725
+ }
1726
+
1727
+ /**
1728
+ * Reassign a thread to another desk the actor holds — filing rules follow (email.moveMailbox).
1729
+ * @param {object} params - { threadId, mailboxId }
1730
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1731
+ */
1732
+ export function emailMoveMailbox(params, o = {}) {
1733
+ return call("email.moveMailbox", params || {}, o);
1734
+ }
1735
+
1736
+ /**
1737
+ * Generate AND STORE the thread's grounded brief — gateway-metered, one chain event (email.summarise).
1738
+ * @param {object} params - { threadId }
1739
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1740
+ */
1741
+ export function emailSummarise(params, o = {}) {
1742
+ return call("email.summarise", params || {}, o);
1743
+ }
1744
+
1745
+ /**
1746
+ * Grounded ask over the acting seat's entitled mailboxes — triage-level rows, never bodies (email.ask). Non-side-effecting RPC method (POST via call(), never client.read()).
1747
+ * @param {object} params - { question, mailboxId? }
1748
+ * @param {object} o - { base, token, fetchImpl? }
1749
+ */
1750
+ export function emailAsk(params, o = {}) {
1751
+ return call("email.ask", params || {}, o);
1752
+ }
1753
+
1754
+ // ---------------------------------------------------------------------------
1755
+ // files — the workspace drive (Docs/Sheets/Decks/folders + uploads). Binds the
1756
+ // same Workspace DomainCtx as the server actions: VIEW/COMMENT/EDIT shares
1757
+ // govern agents exactly as humans.
1758
+ // ---------------------------------------------------------------------------
1759
+
1760
+ /**
1761
+ * Drive listing with human-surface filters (soft-deleted only when deleted:true) (files.list). Non-side-effecting RPC method (POST via call(), never client.read()).
1762
+ * @param {object} params - { parentId?, kind?, starred?, byAgents?, q?, deleted?, limit? }
1763
+ * @param {object} o - { base, token, fetchImpl? }
1764
+ */
1765
+ export function filesList(params, o = {}) {
1766
+ return call("files.list", params || {}, o);
1767
+ }
1768
+
1769
+ /**
1770
+ * One file + the acting seat's effective permission + shares (files.get). Non-side-effecting RPC method (POST via call(), never client.read()).
1771
+ * @param {object} params - { fileId }
1772
+ * @param {object} o - { base, token, fetchImpl? }
1773
+ */
1774
+ export function filesGet(params, o = {}) {
1775
+ return call("files.get", params || {}, o);
1776
+ }
1777
+
1778
+ /**
1779
+ * A DOC's HEAD revision as HTML (files.docRead). Non-side-effecting RPC method (POST via call(), never client.read()).
1780
+ * @param {object} params - { fileId }
1781
+ * @param {object} o - { base, token, fetchImpl? }
1782
+ */
1783
+ export function filesDocRead(params, o = {}) {
1784
+ return call("files.docRead", params || {}, o);
1785
+ }
1786
+
1787
+ /**
1788
+ * A SHEET's cells (computed values from the shared engine) (files.sheetRead). Non-side-effecting RPC method (POST via call(), never client.read()).
1789
+ * @param {object} params - { fileId }
1790
+ * @param {object} o - { base, token, fetchImpl? }
1791
+ */
1792
+ export function filesSheetRead(params, o = {}) {
1793
+ return call("files.sheetRead", params || {}, o);
1794
+ }
1795
+
1796
+ /**
1797
+ * A DECK's slides (files.deckRead). Non-side-effecting RPC method (POST via call(), never client.read()).
1798
+ * @param {object} params - { fileId }
1799
+ * @param {object} o - { base, token, fetchImpl? }
1800
+ */
1801
+ export function filesDeckRead(params, o = {}) {
1802
+ return call("files.deckRead", params || {}, o);
1803
+ }
1804
+
1805
+ /**
1806
+ * Create a file/folder (files.create). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1807
+ * @param {object} params - { kind: DOC|SHEET|DECK|FOLDER, name, parentId? }
1808
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1809
+ */
1810
+ export function filesCreate(params, o = {}) {
1811
+ return call("files.create", params || {}, o);
1812
+ }
1813
+
1814
+ /**
1815
+ * Register a binary upload from a data: URL (files.uploadRegister). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1816
+ * @param {object} params - { name, dataUrl (≤2MB), parentId? }
1817
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1818
+ */
1819
+ export function filesUploadRegister(params, o = {}) {
1820
+ return call("files.uploadRegister", params || {}, o);
1821
+ }
1822
+
1823
+ /**
1824
+ * Rename (files.rename). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1825
+ * @param {object} params - { fileId, name }
1826
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1827
+ */
1828
+ export function filesRename(params, o = {}) {
1829
+ return call("files.rename", params || {}, o);
1830
+ }
1831
+
1832
+ /**
1833
+ * Move (re-syncs inherited shares) (files.move). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1834
+ * @param {object} params - { fileId, parentId }
1835
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1836
+ */
1837
+ export function filesMove(params, o = {}) {
1838
+ return call("files.move", params || {}, o);
1839
+ }
1840
+
1841
+ /**
1842
+ * Duplicate (files.duplicate). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1843
+ * @param {object} params - { fileId }
1844
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1845
+ */
1846
+ export function filesDuplicate(params, o = {}) {
1847
+ return call("files.duplicate", params || {}, o);
1848
+ }
1849
+
1850
+ /**
1851
+ * Star/unstar (files.star). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1852
+ * @param {object} params - { fileId, starred }
1853
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1854
+ */
1855
+ export function filesStar(params, o = {}) {
1856
+ return call("files.star", params || {}, o);
1857
+ }
1858
+
1859
+ /**
1860
+ * Pin for the paired member (files.pin). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1861
+ * @param {object} params - { fileId, pinned }
1862
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1863
+ */
1864
+ export function filesPin(params, o = {}) {
1865
+ return call("files.pin", params || {}, o);
1866
+ }
1867
+
1868
+ /**
1869
+ * Soft-delete (30-day recovery; folder cascade) (files.delete). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1870
+ * @param {object} params - { fileId }
1871
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1872
+ */
1873
+ export function filesDelete(params, o = {}) {
1874
+ return call("files.delete", params || {}, o);
1875
+ }
1876
+
1877
+ /**
1878
+ * Recover from the 30-day bin (files.recover). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1879
+ * @param {object} params - { fileId }
1880
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1881
+ */
1882
+ export function filesRecover(params, o = {}) {
1883
+ return call("files.recover", params || {}, o);
1884
+ }
1885
+
1886
+ /**
1887
+ * Grant shares (folder grants materialize inherited rows) (files.shareGrant). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1888
+ * @param {object} params - { fileId, permission: VIEW|COMMENT|EDIT, subjects[{type:member|channel|email,…}], message? }
1889
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1890
+ */
1891
+ export function filesShareGrant(params, o = {}) {
1892
+ return call("files.shareGrant", params || {}, o);
1893
+ }
1894
+
1895
+ /**
1896
+ * Revoke a share (direct + inherited-from-this-file) (files.shareRevoke). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1897
+ * @param {object} params - { fileId, subject }
1898
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1899
+ */
1900
+ export function filesShareRevoke(params, o = {}) {
1901
+ return call("files.shareRevoke", params || {}, o);
1902
+ }
1903
+
1904
+ /**
1905
+ * Write a DOC revision (EDIT required; bumps HEAD + DocRevision) (files.docWriteRevision). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1906
+ * @param {object} params - { fileId, html, summary?, aiDrafted?, costCents? }
1907
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1908
+ */
1909
+ export function filesDocWriteRevision(params, o = {}) {
1910
+ return call("files.docWriteRevision", params || {}, o);
1911
+ }
1912
+
1913
+ /**
1914
+ * Write SHEET cells (server recompute, shared engine) (files.sheetWriteCells). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1915
+ * @param {object} params - { fileId, cells }
1916
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1917
+ */
1918
+ export function filesSheetWriteCells(params, o = {}) {
1919
+ return call("files.sheetWriteCells", params || {}, o);
1920
+ }
1921
+
1922
+ /**
1923
+ * Write DECK slides (files.deckWriteSlides). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1924
+ * @param {object} params - { fileId, slides }
1925
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1926
+ */
1927
+ export function filesDeckWriteSlides(params, o = {}) {
1928
+ return call("files.deckWriteSlides", params || {}, o);
1929
+ }
1930
+
1931
+ /**
1932
+ * AUDITED export (DIRECT_CONTENT|PRINT_VIEW|SANDBOX_CONVERTER) — rides files.read but lands on the chain (files.exportRequest). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
1933
+ * @param {object} params - { fileId, path? }
1934
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1935
+ */
1936
+ export function filesExportRequest(params, o = {}) {
1937
+ return call("files.exportRequest", params || {}, o);
1938
+ }
1939
+
1940
+ /**
1941
+ * Multi-tab sheet structure ops: create | rename | duplicate | delete | restore — delete returns the snapshot restore takes back (files.sheetTabOp).
1942
+ * @param {object} params - { fileId, op, tabId?, name?, snapshot? }
1943
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1944
+ */
1945
+ export function filesSheetTabOp(params, o = {}) {
1946
+ return call("files.sheetTabOp", params || {}, o);
1947
+ }
1948
+
1949
+ /**
1950
+ * Multi-tab doc structure ops: create | rename | delete (content-restoring snapshot revisions) (files.docTabOp).
1951
+ * @param {object} params - { fileId, op, tabId?, name? }
1952
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1953
+ */
1954
+ export function filesDocTabOp(params, o = {}) {
1955
+ return call("files.docTabOp", params || {}, o);
1956
+ }
1957
+
1958
+ /**
1959
+ * Accept (commits a real head revision) or reject a held doc suggestion (files.docSuggestResolve).
1960
+ * @param {object} params - { revisionId, action, summary? }
1961
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1962
+ */
1963
+ export function filesDocSuggestResolve(params, o = {}) {
1964
+ return call("files.docSuggestResolve", params || {}, o);
1965
+ }
1966
+
1967
+ /**
1968
+ * The doc's held SUGGESTED revisions, content included for diffing (files.docSuggestions). Non-side-effecting RPC method (POST via call(), never client.read()).
1969
+ * @param {object} params - { fileId }
1970
+ * @param {object} o - { base, token, fetchImpl? }
1971
+ */
1972
+ export function filesDocSuggestions(params, o = {}) {
1973
+ return call("files.docSuggestions", params || {}, o);
1974
+ }
1975
+
1976
+ /**
1977
+ * File a comment on a doc ({section?, quote?}) or anchor one to a deck slide (slideId + elementKey?) (files.commentAdd).
1978
+ * @param {object} params - { fileId, body, anchor?, slideId?, elementKey?, parentId? }
1979
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1980
+ */
1981
+ export function filesCommentAdd(params, o = {}) {
1982
+ return call("files.commentAdd", params || {}, o);
1983
+ }
1984
+
1985
+ /**
1986
+ * Resolve a comment thread — author or the file's editors (files.commentResolve).
1987
+ * @param {object} params - { commentId }
1988
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
1989
+ */
1990
+ export function filesCommentResolve(params, o = {}) {
1991
+ return call("files.commentResolve", params || {}, o);
1992
+ }
1993
+
1994
+ /**
1995
+ * A file's comment threads — doc sections + deck slides, open by default (files.comments). Non-side-effecting RPC method (POST via call(), never client.read()).
1996
+ * @param {object} params - { fileId, includeResolved?, limit? }
1997
+ * @param {object} o - { base, token, fetchImpl? }
1998
+ */
1999
+ export function filesComments(params, o = {}) {
2000
+ return call("files.comments", params || {}, o);
2001
+ }
2002
+
2003
+ /**
2004
+ * Register or clear an agent-fed sheet range — non-owning writes inside it are allowed but LOGGED (files.sheetFedRange).
2005
+ * @param {object} params - { fileId, action, range?, agentMemberId?, tabId?, cadence?, label?, rangeId? }
2006
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2007
+ */
2008
+ export function filesSheetFedRange(params, o = {}) {
2009
+ return call("files.sheetFedRange", params || {}, o);
2010
+ }
2011
+
2012
+ /**
2013
+ * Grounded ask over the drive's names/kinds/owners/share facts — never file content (files.ask). Non-side-effecting RPC method (POST via call(), never client.read()).
2014
+ * @param {object} params - { question, limit? }
2015
+ * @param {object} o - { base, token, fetchImpl? }
2016
+ */
2017
+ export function filesAsk(params, o = {}) {
2018
+ return call("files.ask", params || {}, o);
2019
+ }
2020
+
2021
+ // ---------------------------------------------------------------------------
2022
+ // calendar — the workspace calendar. Writes queue REAL invite/update/cancel
2023
+ // emails (invitesQueued/Skipped honest in payloads); findATime is a
2024
+ // deterministic 15-min-lattice scan, Mon–Fri 08–18.
2025
+ // ---------------------------------------------------------------------------
2026
+
2027
+ /**
2028
+ * Events in a window with attendee rows (calendar.list). Non-side-effecting RPC method (POST via call(), never client.read()).
2029
+ * @param {object} params - { fromIso?, toIso?, calendarMemberId?, limit? }
2030
+ * @param {object} o - { base, token, fetchImpl? }
2031
+ */
2032
+ export function calendarList(params, o = {}) {
2033
+ return call("calendar.list", params || {}, o);
2034
+ }
2035
+
2036
+ /**
2037
+ * One event + records (calendar.get). Non-side-effecting RPC method (POST via call(), never client.read()).
2038
+ * @param {object} params - { eventId }
2039
+ * @param {object} o - { base, token, fetchImpl? }
2040
+ */
2041
+ export function calendarGet(params, o = {}) {
2042
+ return call("calendar.get", params || {}, o);
2043
+ }
2044
+
2045
+ /**
2046
+ * Deterministic free-slot scan (proposes times, changes nothing) (calendar.findATime). Non-side-effecting RPC method (POST via call(), never client.read()).
2047
+ * @param {object} params - { attendeeMemberIds (≤20), durationMinutes, fromDay, scanDays? }
2048
+ * @param {object} o - { base, token, fetchImpl? }
2049
+ */
2050
+ export function calendarFindATime(params, o = {}) {
2051
+ return call("calendar.findATime", params || {}, o);
2052
+ }
2053
+
2054
+ /**
2055
+ * Grounded ask over the calendar window this seat may see — restricted events of other seats ABSENT (calendar.ask). Non-side-effecting RPC method (POST via call(), never client.read()).
2056
+ * @param {object} params - { question, fromIso?, toIso? }
2057
+ * @param {object} o - { base, token, fetchImpl? }
2058
+ */
2059
+ export function calendarAsk(params, o = {}) {
2060
+ return call("calendar.ask", params || {}, o);
2061
+ }
2062
+
2063
+ /**
2064
+ * Create a typed event (MEETING/REVIEW/FOCUS/AGENT_BLOCK/ALL_HANDS/HOLD); queues real invite emails (calendar.create). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2065
+ * @param {object} params - { title, kind?, startsAt, endsAt, allDay?, location?, description?, calendarMemberId?, companyCalendar?, agendaFileId?, estCostCents?, attendees?, recurrence? }
2066
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2067
+ */
2068
+ export function calendarCreate(params, o = {}) {
2069
+ return call("calendar.create", params || {}, o);
2070
+ }
2071
+
2072
+ /**
2073
+ * Update an event (substantive changes queue update emails) (calendar.update). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2074
+ * @param {object} params - { eventId, …fields }
2075
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2076
+ */
2077
+ export function calendarUpdate(params, o = {}) {
2078
+ return call("calendar.update", params || {}, o);
2079
+ }
2080
+
2081
+ /**
2082
+ * Move an event (queues new-time emails) (calendar.reschedule). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2083
+ * @param {object} params - { eventId, startsAt, endsAt }
2084
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2085
+ */
2086
+ export function calendarReschedule(params, o = {}) {
2087
+ return call("calendar.reschedule", params || {}, o);
2088
+ }
2089
+
2090
+ /**
2091
+ * Cancel an event (queues cancellation emails) (calendar.delete). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2092
+ * @param {object} params - { eventId }
2093
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2094
+ */
2095
+ export function calendarDelete(params, o = {}) {
2096
+ return call("calendar.delete", params || {}, o);
2097
+ }
2098
+
2099
+ /**
2100
+ * RSVP the acting seat's own invite (calendar.rsvp). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2101
+ * @param {object} params - { eventId, rsvp: INVITED|ACCEPTED|DECLINED|TENTATIVE|COMMITTED }
2102
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2103
+ */
2104
+ export function calendarRsvp(params, o = {}) {
2105
+ return call("calendar.rsvp", params || {}, o);
2106
+ }
2107
+
2108
+ // ---------------------------------------------------------------------------
2109
+ // meetings (desk addition) — recapFile lands a held meeting's recap +
2110
+ // transcript into the workspace drive (two DOCs + MeetingRecord links).
2111
+ // ---------------------------------------------------------------------------
2112
+
2113
+ /**
2114
+ * File recap + transcript DOCs with links back to the meeting (meetings.recapFile). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2115
+ * @param {object} params - { meetingId, callId?, occurredAt?, recap:{bullets, decisions?, actions?}, transcript? }
2116
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2117
+ */
2118
+ export function meetingsRecapFile(params, o = {}) {
2119
+ return call("meetings.recapFile", params || {}, o);
2120
+ }
2121
+
2122
+ // ---------------------------------------------------------------------------
2123
+ // crm — the CRM desk (deals, escalations, accounts, contacts, interactions,
2124
+ // playbooks, targets). Human-only verbs (signEscalation/returnEscalation,
2125
+ // targetCents) refuse agent actors in the domain layer.
2126
+ // ---------------------------------------------------------------------------
2127
+
2128
+ /**
2129
+ * Grounded ask over the deals this seat may see — value/stage/owner/held state (crm.ask). Non-side-effecting RPC method (POST via call(), never client.read()).
2130
+ * @param {object} params - { question, limit? }
2131
+ * @param {object} o - { base, token, fetchImpl? }
2132
+ */
2133
+ export function crmAsk(params, o = {}) {
2134
+ return call("crm.ask", params || {}, o);
2135
+ }
2136
+
2137
+ /**
2138
+ * Deal listing (crm.listDeals). Non-side-effecting RPC method (POST via call(), never client.read()).
2139
+ * @param {object} params - { stage?, accountId?, ownerId?, openOnly?, limit? }
2140
+ * @param {object} o - { base, token, fetchImpl? }
2141
+ */
2142
+ export function crmListDeals(params, o = {}) {
2143
+ return call("crm.listDeals", params || {}, o);
2144
+ }
2145
+
2146
+ /**
2147
+ * One deal + account/contacts/hold detail (crm.getDeal). Non-side-effecting RPC method (POST via call(), never client.read()).
2148
+ * @param {object} params - { dealId }
2149
+ * @param {object} o - { base, token, fetchImpl? }
2150
+ */
2151
+ export function crmGetDeal(params, o = {}) {
2152
+ return call("crm.getDeal", params || {}, o);
2153
+ }
2154
+
2155
+ /**
2156
+ * Held deals pending resolution (crm.listEscalations). Non-side-effecting RPC method (POST via call(), never client.read()).
2157
+ * @param {object} params - { limit? }
2158
+ * @param {object} o - { base, token, fetchImpl? }
2159
+ */
2160
+ export function crmListEscalations(params, o = {}) {
2161
+ return call("crm.listEscalations", params || {}, o);
2162
+ }
2163
+
2164
+ /**
2165
+ * Accounts (crm.listAccounts). Non-side-effecting RPC method (POST via call(), never client.read()).
2166
+ * @param {object} params - { q?, limit? }
2167
+ * @param {object} o - { base, token, fetchImpl? }
2168
+ */
2169
+ export function crmListAccounts(params, o = {}) {
2170
+ return call("crm.listAccounts", params || {}, o);
2171
+ }
2172
+
2173
+ /**
2174
+ * Contacts (crm.listContacts). Non-side-effecting RPC method (POST via call(), never client.read()).
2175
+ * @param {object} params - { accountId?, q?, limit? }
2176
+ * @param {object} o - { base, token, fetchImpl? }
2177
+ */
2178
+ export function crmListContacts(params, o = {}) {
2179
+ return call("crm.listContacts", params || {}, o);
2180
+ }
2181
+
2182
+ /**
2183
+ * Interaction log (crm.listInteractions). Non-side-effecting RPC method (POST via call(), never client.read()).
2184
+ * @param {object} params - { dealId?, contactId?, limit? }
2185
+ * @param {object} o - { base, token, fetchImpl? }
2186
+ */
2187
+ export function crmListInteractions(params, o = {}) {
2188
+ return call("crm.listInteractions", params || {}, o);
2189
+ }
2190
+
2191
+ /**
2192
+ * Playbooks + versions (crm.listPlaybooks). Non-side-effecting RPC method (POST via call(), never client.read()).
2193
+ * @param {object} params - {}
2194
+ * @param {object} o - { base, token, fetchImpl? }
2195
+ */
2196
+ export function crmListPlaybooks(params, o = {}) {
2197
+ return call("crm.listPlaybooks", params || {}, o);
2198
+ }
2199
+
2200
+ /**
2201
+ * Targets (committed/best-case vs targetCents) (crm.getTargets). Non-side-effecting RPC method (POST via call(), never client.read()).
2202
+ * @param {object} params - { period? }
2203
+ * @param {object} o - { base, token, fetchImpl? }
2204
+ */
2205
+ export function crmGetTargets(params, o = {}) {
2206
+ return call("crm.getTargets", params || {}, o);
2207
+ }
2208
+
2209
+ /**
2210
+ * PURE compile preview — nothing persisted (crm.compilePlaybook). Non-side-effecting RPC method (POST via call(), never client.read()).
2211
+ * @param {object} params - { source }
2212
+ * @param {object} o - { base, token, fetchImpl? }
2213
+ */
2214
+ export function crmCompilePlaybook(params, o = {}) {
2215
+ return call("crm.compilePlaybook", params || {}, o);
2216
+ }
2217
+
2218
+ /**
2219
+ * Create a deal (crm.createDeal).
2220
+ * @param {object} params - { company, name?, valueCents?, ownerId?, source? }
2221
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2222
+ */
2223
+ export function crmCreateDeal(params, o = {}) {
2224
+ return call("crm.createDeal", params || {}, o);
2225
+ }
2226
+
2227
+ /**
2228
+ * Update deal fields (crm.updateDeal). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2229
+ * @param {object} params - { dealId, …fields }
2230
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2231
+ */
2232
+ export function crmUpdateDeal(params, o = {}) {
2233
+ return call("crm.updateDeal", params || {}, o);
2234
+ }
2235
+
2236
+ /**
2237
+ * Soft-delete a deal (crm.deleteDeal). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2238
+ * @param {object} params - { dealId }
2239
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2240
+ */
2241
+ export function crmDeleteDeal(params, o = {}) {
2242
+ return call("crm.deleteDeal", params || {}, o);
2243
+ }
2244
+
2245
+ /**
2246
+ * Move stage (CLOSED-without-outcome refused) (crm.moveStage). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2247
+ * @param {object} params - { dealId, stage, sortOrder? }
2248
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2249
+ */
2250
+ export function crmMoveStage(params, o = {}) {
2251
+ return call("crm.moveStage", params || {}, o);
2252
+ }
2253
+
2254
+ /**
2255
+ * Close a deal — WON drafts a Books SalesInvoice (payload draftedInvoiceId/Number; never auto-SENDs) (crm.closeDeal). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2256
+ * @param {object} params - { dealId, outcome, … }
2257
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2258
+ */
2259
+ export function crmCloseDeal(params, o = {}) {
2260
+ return call("crm.closeDeal", params || {}, o);
2261
+ }
2262
+
2263
+ /**
2264
+ * HUMAN-ONLY: sign a held escalation (agent actors refused in-domain) (crm.signEscalation).
2265
+ * @param {object} params - { dealId, … }
2266
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2267
+ */
2268
+ export function crmSignEscalation(params, o = {}) {
2269
+ return call("crm.signEscalation", params || {}, o);
2270
+ }
2271
+
2272
+ /**
2273
+ * HUMAN-ONLY: return a held escalation (crm.returnEscalation).
2274
+ * @param {object} params - { dealId, note? }
2275
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2276
+ */
2277
+ export function crmReturnEscalation(params, o = {}) {
2278
+ return call("crm.returnEscalation", params || {}, o);
2279
+ }
2280
+
2281
+ /**
2282
+ * Update held terms — real playbook re-evaluation on both lanes (crm.updateHeldTerms). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2283
+ * @param {object} params - { dealId, terms }
2284
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2285
+ */
2286
+ export function crmUpdateHeldTerms(params, o = {}) {
2287
+ return call("crm.updateHeldTerms", params || {}, o);
2288
+ }
2289
+
2290
+ /**
2291
+ * Delegate a deal — creates a real board handover Task (payload boardTaskId) (crm.delegate). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2292
+ * @param {object} params - { dealId, delegateMemberId, note? }
2293
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2294
+ */
2295
+ export function crmDelegate(params, o = {}) {
2296
+ return call("crm.delegate", params || {}, o);
2297
+ }
2298
+
2299
+ /**
2300
+ * Hold the next step (crm.holdNextStep).
2301
+ * @param {object} params - { dealId }
2302
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2303
+ */
2304
+ export function crmHoldNextStep(params, o = {}) {
2305
+ return call("crm.holdNextStep", params || {}, o);
2306
+ }
2307
+
2308
+ /**
2309
+ * Run next-best-action (refused while the deal is held) (crm.runNextBestAction).
2310
+ * @param {object} params - { dealId }
2311
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2312
+ */
2313
+ export function crmRunNextBestAction(params, o = {}) {
2314
+ return call("crm.runNextBestAction", params || {}, o);
2315
+ }
2316
+
2317
+ /**
2318
+ * Share a deal — real channel post + queryable DealShare ACL rows (crm.shareDeal).
2319
+ * @param {object} params - { dealId, subjects }
2320
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2321
+ */
2322
+ export function crmShareDeal(params, o = {}) {
2323
+ return call("crm.shareDeal", params || {}, o);
2324
+ }
2325
+
2326
+ /**
2327
+ * Revoke a member's or channel's share on a deal (crm.revokeDealShare).
2328
+ * @param {object} params - { dealId, memberId?, channelId? }
2329
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2330
+ */
2331
+ export function crmRevokeDealShare(params, o = {}) {
2332
+ return call("crm.revokeDealShare", params || {}, o);
2333
+ }
2334
+
2335
+ /**
2336
+ * Propose non-standard terms on a deal — re-evaluates playbooks and may raise a signature hold (crm.proposeTerms).
2337
+ * @param {object} params - { dealId, discountPct, term?, nonStandard? }
2338
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2339
+ */
2340
+ export function crmProposeTerms(params, o = {}) {
2341
+ return call("crm.proposeTerms", params || {}, o);
2342
+ }
2343
+
2344
+ /**
2345
+ * Add an external guest to a deal call (crm.addCallGuest). Idempotent — pass a stable `o.idempotencyKey`.
2346
+ * @param {object} params - { callId, email?, name? }
2347
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2348
+ */
2349
+ export function crmAddCallGuest(params, o = {}) {
2350
+ return call("crm.addCallGuest", params || {}, o);
2351
+ }
2352
+
2353
+ /**
2354
+ * Mint a single-use guest join token for a contact on a call (crm.mintGuestToken).
2355
+ * @param {object} params - { callId, contactId }
2356
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2357
+ */
2358
+ export function crmMintGuestToken(params, o = {}) {
2359
+ return call("crm.mintGuestToken", params || {}, o);
2360
+ }
2361
+
2362
+ /**
2363
+ * Attach an email address to a CRM contact (crm.linkEmail). Idempotent — pass a stable `o.idempotencyKey`.
2364
+ * @param {object} params - { contactId, email, label? }
2365
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2366
+ */
2367
+ export function crmLinkEmail(params, o = {}) {
2368
+ return call("crm.linkEmail", params || {}, o);
2369
+ }
2370
+
2371
+ /**
2372
+ * Link workspace files to a deal (crm.linkFiles).
2373
+ * @param {object} params - { dealId, fileIds }
2374
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2375
+ */
2376
+ export function crmLinkFiles(params, o = {}) {
2377
+ return call("crm.linkFiles", params || {}, o);
2378
+ }
2379
+
2380
+ /**
2381
+ * Link a contact to a deal (crm.linkContact). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2382
+ * @param {object} params - { dealId, contactId }
2383
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2384
+ */
2385
+ export function crmLinkContact(params, o = {}) {
2386
+ return call("crm.linkContact", params || {}, o);
2387
+ }
2388
+
2389
+ /**
2390
+ * Create a follow-through board task (board item.created) (crm.taskFollowThrough).
2391
+ * @param {object} params - { dealId, title, … }
2392
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2393
+ */
2394
+ export function crmTaskFollowThrough(params, o = {}) {
2395
+ return call("crm.taskFollowThrough", params || {}, o);
2396
+ }
2397
+
2398
+ /**
2399
+ * Propose a REAL org Decision from a deal (decision.proposed) (crm.logDealDecision).
2400
+ * @param {object} params - { dealId, title, rationale? }
2401
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2402
+ */
2403
+ export function crmLogDealDecision(params, o = {}) {
2404
+ return call("crm.logDealDecision", params || {}, o);
2405
+ }
2406
+
2407
+ /**
2408
+ * Create an account (crm.createAccount). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2409
+ * @param {object} params - { name, … }
2410
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2411
+ */
2412
+ export function crmCreateAccount(params, o = {}) {
2413
+ return call("crm.createAccount", params || {}, o);
2414
+ }
2415
+
2416
+ /**
2417
+ * Update an account (crm.updateAccount). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2418
+ * @param {object} params - { accountId, …fields }
2419
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2420
+ */
2421
+ export function crmUpdateAccount(params, o = {}) {
2422
+ return call("crm.updateAccount", params || {}, o);
2423
+ }
2424
+
2425
+ /**
2426
+ * Archive an account (crm.archiveAccount). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2427
+ * @param {object} params - { accountId }
2428
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2429
+ */
2430
+ export function crmArchiveAccount(params, o = {}) {
2431
+ return call("crm.archiveAccount", params || {}, o);
2432
+ }
2433
+
2434
+ /**
2435
+ * Create a contact (crm.createContact).
2436
+ * @param {object} params - { displayName, accountId?, … }
2437
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2438
+ */
2439
+ export function crmCreateContact(params, o = {}) {
2440
+ return call("crm.createContact", params || {}, o);
2441
+ }
2442
+
2443
+ /**
2444
+ * Update a contact (crm.updateContact). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2445
+ * @param {object} params - { contactId, …fields }
2446
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2447
+ */
2448
+ export function crmUpdateContact(params, o = {}) {
2449
+ return call("crm.updateContact", params || {}, o);
2450
+ }
2451
+
2452
+ /**
2453
+ * Delete a contact (crm.deleteContact). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2454
+ * @param {object} params - { contactId }
2455
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2456
+ */
2457
+ export function crmDeleteContact(params, o = {}) {
2458
+ return call("crm.deleteContact", params || {}, o);
2459
+ }
2460
+
2461
+ /**
2462
+ * Log an interaction (crm.logInteraction).
2463
+ * @param {object} params - { kind: note|call|email|meeting, text, dealId?, contactId? }
2464
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2465
+ */
2466
+ export function crmLogInteraction(params, o = {}) {
2467
+ return call("crm.logInteraction", params || {}, o);
2468
+ }
2469
+
2470
+ /**
2471
+ * Pin/unpin a note (crm.pinNote). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2472
+ * @param {object} params - { interactionId, pinned }
2473
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2474
+ */
2475
+ export function crmPinNote(params, o = {}) {
2476
+ return call("crm.pinNote", params || {}, o);
2477
+ }
2478
+
2479
+ /**
2480
+ * Soft-redact an interaction (crm.redactInteraction). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2481
+ * @param {object} params - { interactionId }
2482
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2483
+ */
2484
+ export function crmRedactInteraction(params, o = {}) {
2485
+ return call("crm.redactInteraction", params || {}, o);
2486
+ }
2487
+
2488
+ /**
2489
+ * Save a playbook (versioned) (crm.savePlaybook).
2490
+ * @param {object} params - { playbookId?, source, … }
2491
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2492
+ */
2493
+ export function crmSavePlaybook(params, o = {}) {
2494
+ return call("crm.savePlaybook", params || {}, o);
2495
+ }
2496
+
2497
+ /**
2498
+ * Enable/disable a playbook (locked refuses) (crm.togglePlaybook). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2499
+ * @param {object} params - { playbookId, enabled }
2500
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2501
+ */
2502
+ export function crmTogglePlaybook(params, o = {}) {
2503
+ return call("crm.togglePlaybook", params || {}, o);
2504
+ }
2505
+
2506
+ /**
2507
+ * Delete a playbook (locked refuses) (crm.deletePlaybook). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2508
+ * @param {object} params - { playbookId }
2509
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2510
+ */
2511
+ export function crmDeletePlaybook(params, o = {}) {
2512
+ return call("crm.deletePlaybook", params || {}, o);
2513
+ }
2514
+
2515
+ /**
2516
+ * Set targets — targetCents is HUMAN-ONLY; agents maintain committed/bestCase (crm.setTarget). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2517
+ * @param {object} params - { period, committedCents?, bestCaseCents?, targetCents? }
2518
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2519
+ */
2520
+ export function crmSetTarget(params, o = {}) {
2521
+ return call("crm.setTarget", params || {}, o);
2522
+ }
2523
+
2524
+ // ---------------------------------------------------------------------------
2525
+ // books — the Books desk (PB-B1..B4). The signature law lives in the domain
2526
+ // layer: payrollSign / taxSignLodge (and floor/new-payee billApprove releases)
2527
+ // require a verified HUMAN signature — books.write alone cannot move money.
2528
+ // ---------------------------------------------------------------------------
2529
+
2530
+ /**
2531
+ * Chart of accounts (books.accounts). Non-side-effecting RPC method (POST via call(), never client.read()).
2532
+ * @param {object} params - {}
2533
+ * @param {object} o - { base, token, fetchImpl? }
2534
+ */
2535
+ export function booksAccounts(params, o = {}) {
2536
+ return call("books.accounts", params || {}, o);
2537
+ }
2538
+
2539
+ /**
2540
+ * Journals with lines (books.journals). Non-side-effecting RPC method (POST via call(), never client.read()).
2541
+ * @param {object} params - { limit? }
2542
+ * @param {object} o - { base, token, fetchImpl? }
2543
+ */
2544
+ export function booksJournals(params, o = {}) {
2545
+ return call("books.journals", params || {}, o);
2546
+ }
2547
+
2548
+ /**
2549
+ * Bank-feed lines + match state (books.feedLines). Non-side-effecting RPC method (POST via call(), never client.read()).
2550
+ * @param {object} params - { status?, limit? }
2551
+ * @param {object} o - { base, token, fetchImpl? }
2552
+ */
2553
+ export function booksFeedLines(params, o = {}) {
2554
+ return call("books.feedLines", params || {}, o);
2555
+ }
2556
+
2557
+ /**
2558
+ * AR invoices with chase state (books.invoices). Non-side-effecting RPC method (POST via call(), never client.read()).
2559
+ * @param {object} params - { status?, limit? }
2560
+ * @param {object} o - { base, token, fetchImpl? }
2561
+ */
2562
+ export function booksInvoices(params, o = {}) {
2563
+ return call("books.invoices", params || {}, o);
2564
+ }
2565
+
2566
+ /**
2567
+ * AP bills with hold reasons + run linkage (books.bills). Non-side-effecting RPC method (POST via call(), never client.read()).
2568
+ * @param {object} params - { status?, limit? }
2569
+ * @param {object} o - { base, token, fetchImpl? }
2570
+ */
2571
+ export function booksBills(params, o = {}) {
2572
+ return call("books.bills", params || {}, o);
2573
+ }
2574
+
2575
+ /**
2576
+ * Tax obligations + lodgement state (books.taxObligations). Non-side-effecting RPC method (POST via call(), never client.read()).
2577
+ * @param {object} params - { status? }
2578
+ * @param {object} o - { base, token, fetchImpl? }
2579
+ */
2580
+ export function booksTaxObligations(params, o = {}) {
2581
+ return call("books.taxObligations", params || {}, o);
2582
+ }
2583
+
2584
+ /**
2585
+ * Ledger-current reports (figures carry journal-line ids) (books.reports). Non-side-effecting RPC method (POST via call(), never client.read()).
2586
+ * @param {object} params - { report: pl|balance|cashflow|agedAr|agedAp, from?, to? }
2587
+ * @param {object} o - { base, token, fetchImpl? }
2588
+ */
2589
+ export function booksReports(params, o = {}) {
2590
+ return call("books.reports", params || {}, o);
2591
+ }
2592
+
2593
+ /**
2594
+ * Fixed assets + depreciation state (books.assets). Non-side-effecting RPC method (POST via call(), never client.read()).
2595
+ * @param {object} params - {}
2596
+ * @param {object} o - { base, token, fetchImpl? }
2597
+ */
2598
+ export function booksAssets(params, o = {}) {
2599
+ return call("books.assets", params || {}, o);
2600
+ }
2601
+
2602
+ /**
2603
+ * Grounded ask-the-books via the shared AI gateway ({content, grounding[], costCents, auditId}) (books.ask). Non-side-effecting RPC method (POST via call(), never client.read()).
2604
+ * @param {object} params - { question }
2605
+ * @param {object} o - { base, token, fetchImpl? }
2606
+ */
2607
+ export function booksAsk(params, o = {}) {
2608
+ return call("books.ask", params || {}, o);
2609
+ }
2610
+
2611
+ /**
2612
+ * Post a manual journal (books.journalPost). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2613
+ * @param {object} params - { lines, memo?, … }
2614
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2615
+ */
2616
+ export function booksJournalPost(params, o = {}) {
2617
+ return call("books.journalPost", params || {}, o);
2618
+ }
2619
+
2620
+ /**
2621
+ * Accept a feed-line match (books.matchAccept). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2622
+ * @param {object} params - { feedLineId, … }
2623
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2624
+ */
2625
+ export function booksMatchAccept(params, o = {}) {
2626
+ return call("books.matchAccept", params || {}, o);
2627
+ }
2628
+
2629
+ /**
2630
+ * Resolve a held match (books.matchHoldResolve). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2631
+ * @param {object} params - { feedLineId, … }
2632
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2633
+ */
2634
+ export function booksMatchHoldResolve(params, o = {}) {
2635
+ return call("books.matchHoldResolve", params || {}, o);
2636
+ }
2637
+
2638
+ /**
2639
+ * Register receipts (OCR is SANDBOX-labelled) (books.receiptsRegister). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2640
+ * @param {object} params - { receipts }
2641
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2642
+ */
2643
+ export function booksReceiptsRegister(params, o = {}) {
2644
+ return call("books.receiptsRegister", params || {}, o);
2645
+ }
2646
+
2647
+ /**
2648
+ * Recode a journal line (each recode is a new act) (books.lineRecode).
2649
+ * @param {object} params - { journalLineId, accountId }
2650
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2651
+ */
2652
+ export function booksLineRecode(params, o = {}) {
2653
+ return call("books.lineRecode", params || {}, o);
2654
+ }
2655
+
2656
+ /**
2657
+ * Draft an AR invoice (send:true queues a real email) (books.invoiceDraft). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2658
+ * @param {object} params - { payeeId?|payeeName?, description, totalCents, dueDays?, dealId? }
2659
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2660
+ */
2661
+ export function booksInvoiceDraft(params, o = {}) {
2662
+ return call("books.invoiceDraft", params || {}, o);
2663
+ }
2664
+
2665
+ /**
2666
+ * Send a drafted invoice — posts AR journal, arms the PB-B2 chase ladder, queues a REAL customer email (emailQueued/emailSkipped honest) (books.invoiceSend). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2667
+ * @param {object} params - { id }
2668
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2669
+ */
2670
+ export function booksInvoiceSend(params, o = {}) {
2671
+ return call("books.invoiceSend", params || {}, o);
2672
+ }
2673
+
2674
+ /**
2675
+ * Advance the chase ladder (steps ≥2 are human-gated per PB-B2) (books.invoiceChaseStep). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2676
+ * @param {object} params - { id, step }
2677
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2678
+ */
2679
+ export function booksInvoiceChaseStep(params, o = {}) {
2680
+ return call("books.invoiceChaseStep", params || {}, o);
2681
+ }
2682
+
2683
+ /**
2684
+ * Record a payment (books.invoiceRecordPayment). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2685
+ * @param {object} params - { id, amountCents, … }
2686
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2687
+ */
2688
+ export function booksInvoiceRecordPayment(params, o = {}) {
2689
+ return call("books.invoiceRecordPayment", params || {}, o);
2690
+ }
2691
+
2692
+ /**
2693
+ * Issue a credit note (books.invoiceCreditNote). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2694
+ * @param {object} params - { id, … }
2695
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2696
+ */
2697
+ export function booksInvoiceCreditNote(params, o = {}) {
2698
+ return call("books.invoiceCreditNote", params || {}, o);
2699
+ }
2700
+
2701
+ /**
2702
+ * Void (idempotent by state; undo mirror exists) (books.invoiceVoid). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2703
+ * @param {object} params - { id }
2704
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2705
+ */
2706
+ export function booksInvoiceVoid(params, o = {}) {
2707
+ return call("books.invoiceVoid", params || {}, o);
2708
+ }
2709
+
2710
+ /**
2711
+ * Record a payment promise (books.invoicePromise).
2712
+ * @param {object} params - { id, promisedAt, note? }
2713
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2714
+ */
2715
+ export function booksInvoicePromise(params, o = {}) {
2716
+ return call("books.invoicePromise", params || {}, o);
2717
+ }
2718
+
2719
+ /**
2720
+ * Run a statement — queues a REAL statement email from accounts@ (books.statementRun).
2721
+ * @param {object} params - { payeeId? }
2722
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2723
+ */
2724
+ export function booksStatementRun(params, o = {}) {
2725
+ return call("books.statementRun", params || {}, o);
2726
+ }
2727
+
2728
+ /**
2729
+ * Capture an AP bill (books.billCapture). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2730
+ * @param {object} params - { …bill }
2731
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2732
+ */
2733
+ export function booksBillCapture(params, o = {}) {
2734
+ return call("books.billCapture", params || {}, o);
2735
+ }
2736
+
2737
+ /**
2738
+ * Release a held bill (PB-B1 floor/new-payee holds require the human signature token) (books.billApprove). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2739
+ * @param {object} params - { id, humanSignatureMemberId? }
2740
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2741
+ */
2742
+ export function booksBillApprove(params, o = {}) {
2743
+ return call("books.billApprove", params || {}, o);
2744
+ }
2745
+
2746
+ /**
2747
+ * Hold a bill (books.billHold). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2748
+ * @param {object} params - { id, reason? }
2749
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2750
+ */
2751
+ export function booksBillHold(params, o = {}) {
2752
+ return call("books.billHold", params || {}, o);
2753
+ }
2754
+
2755
+ /**
2756
+ * Return a bill to its capturer (books.billReturn). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2757
+ * @param {object} params - { id, note? }
2758
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2759
+ */
2760
+ export function booksBillReturn(params, o = {}) {
2761
+ return call("books.billReturn", params || {}, o);
2762
+ }
2763
+
2764
+ /**
2765
+ * Schedule a payment run (books.billScheduleRun). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2766
+ * @param {object} params - { billIds?, runDate? }
2767
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2768
+ */
2769
+ export function booksBillScheduleRun(params, o = {}) {
2770
+ return call("books.billScheduleRun", params || {}, o);
2771
+ }
2772
+
2773
+ /**
2774
+ * File an expense claim (books.expenseClaim). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2775
+ * @param {object} params - { …claim }
2776
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2777
+ */
2778
+ export function booksExpenseClaim(params, o = {}) {
2779
+ return call("books.expenseClaim", params || {}, o);
2780
+ }
2781
+
2782
+ /**
2783
+ * Approve an expense claim (books.expenseApprove). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2784
+ * @param {object} params - { id }
2785
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2786
+ */
2787
+ export function booksExpenseApprove(params, o = {}) {
2788
+ return call("books.expenseApprove", params || {}, o);
2789
+ }
2790
+
2791
+ /**
2792
+ * Draft a pay run (+ company-calendar pay-date HOLD marker) (books.payrollDraft). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2793
+ * @param {object} params - { period? }
2794
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2795
+ */
2796
+ export function booksPayrollDraft(params, o = {}) {
2797
+ return call("books.payrollDraft", params || {}, o);
2798
+ }
2799
+
2800
+ /**
2801
+ * HUMAN-SIGNATURE (PB-B3): sign a pay run (books.payrollSign). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2802
+ * @param {object} params - { id, humanSignatureMemberId }
2803
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2804
+ */
2805
+ export function booksPayrollSign(params, o = {}) {
2806
+ return call("books.payrollSign", params || {}, o);
2807
+ }
2808
+
2809
+ /**
2810
+ * Recall a drafted/signed-but-unlodged pay run (books.payrollRecall). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2811
+ * @param {object} params - { id }
2812
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2813
+ */
2814
+ export function booksPayrollRecall(params, o = {}) {
2815
+ return call("books.payrollRecall", params || {}, o);
2816
+ }
2817
+
2818
+ /**
2819
+ * Start employee onboarding (books.onboardingStart). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2820
+ * @param {object} params - { …employee }
2821
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2822
+ */
2823
+ export function booksOnboardingStart(params, o = {}) {
2824
+ return call("books.onboardingStart", params || {}, o);
2825
+ }
2826
+
2827
+ /**
2828
+ * Advance onboarding (books.onboardingAdvance). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2829
+ * @param {object} params - { id, step? }
2830
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2831
+ */
2832
+ export function booksOnboardingAdvance(params, o = {}) {
2833
+ return call("books.onboardingAdvance", params || {}, o);
2834
+ }
2835
+
2836
+ /**
2837
+ * File a leave request (books.leaveRequest). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2838
+ * @param {object} params - { …request }
2839
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2840
+ */
2841
+ export function booksLeaveRequest(params, o = {}) {
2842
+ return call("books.leaveRequest", params || {}, o);
2843
+ }
2844
+
2845
+ /**
2846
+ * Approve leave (books.leaveApprove). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2847
+ * @param {object} params - { id }
2848
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2849
+ */
2850
+ export function booksLeaveApprove(params, o = {}) {
2851
+ return call("books.leaveApprove", params || {}, o);
2852
+ }
2853
+
2854
+ /**
2855
+ * Prepare an obligation (+ lodgement-due HOLD marker) (books.taxPrepare). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2856
+ * @param {object} params - { obligationId }
2857
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2858
+ */
2859
+ export function booksTaxPrepare(params, o = {}) {
2860
+ return call("books.taxPrepare", params || {}, o);
2861
+ }
2862
+
2863
+ /**
2864
+ * Hold an obligation (books.taxHold). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2865
+ * @param {object} params - { obligationId, reason? }
2866
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2867
+ */
2868
+ export function booksTaxHold(params, o = {}) {
2869
+ return call("books.taxHold", params || {}, o);
2870
+ }
2871
+
2872
+ /**
2873
+ * Return an obligation to preparation (books.taxReturn).
2874
+ * @param {object} params - { obligationId, note? }
2875
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2876
+ */
2877
+ export function booksTaxReturn(params, o = {}) {
2878
+ return call("books.taxReturn", params || {}, o);
2879
+ }
2880
+
2881
+ /**
2882
+ * HUMAN-SIGNATURE LAW (PB-B4): sign + lodge (lodgement is SANDBOX-labelled — never silently fakes a government filing) (books.taxSignLodge). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2883
+ * @param {object} params - { obligationId, humanSignatureMemberId }
2884
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2885
+ */
2886
+ export function booksTaxSignLodge(params, o = {}) {
2887
+ return call("books.taxSignLodge", params || {}, o);
2888
+ }
2889
+
2890
+ /**
2891
+ * Run depreciation (idempotent per period) (books.assetDepreciationRun). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2892
+ * @param {object} params - { period? }
2893
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2894
+ */
2895
+ export function booksAssetDepreciationRun(params, o = {}) {
2896
+ return call("books.assetDepreciationRun", params || {}, o);
2897
+ }
2898
+
2899
+ /**
2900
+ * Dispose an asset (idempotent by state) (books.assetDispose). Idempotent — pass a stable `o.idempotencyKey` so a retry collapses to one act.
2901
+ * @param {object} params - { assetId, … }
2902
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2903
+ */
2904
+ export function booksAssetDispose(params, o = {}) {
2905
+ return call("books.assetDispose", params || {}, o);
2906
+ }
2907
+
2908
+ /**
2909
+ * Resubmit STP (remediation only — no signature act) (books.stpResubmit).
2910
+ * @param {object} params - { payRunId }
2911
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2912
+ */
2913
+ export function booksStpResubmit(params, o = {}) {
2914
+ return call("books.stpResubmit", params || {}, o);
2915
+ }
2916
+
2917
+ // ---------------------------------------------------------------------------
2918
+ // directory — the Directory desk (external people + organisations, channels,
2919
+ // captures, duplicates, awareness, links, contact lists). Colleagues are NOT
2920
+ // directory records; the domain refuses to archive one from here.
2921
+ //
2922
+ // Two invariants ride every wrapper below and neither is enforced client-side:
2923
+ // - Awareness (DECISIONS D-4): a NAMED record is ABSENT — not redacted, not
2924
+ // a refusal — from every read for a seat without a grant. An empty page or
2925
+ // a NOT_FOUND is a legitimate answer; never infer non-existence from it.
2926
+ // - Propose-only (D-7): mergeExecute/revert, setAwareness, resolveCapture,
2927
+ // resolveAwarenessRequest and the two archive verbs are HUMAN-GATED in the
2928
+ // domain. An agent seat calling them files a review item instead of acting.
2929
+ // That refusal is correct behaviour, not an error to route around.
2930
+ // ---------------------------------------------------------------------------
2931
+
2932
+ /**
2933
+ * One-box search across external people + organisations (directory.search). Non-side-effecting RPC method (POST via call(), never client.read()).
2934
+ * @param {object} params - { q, scope?, limit? }
2935
+ * @param {object} o - { base, token, fetchImpl? }
2936
+ */
2937
+ export function directorySearch(params, o = {}) {
2938
+ return call("directory.search", params || {}, o);
2939
+ }
2940
+
2941
+ /**
2942
+ * The People view — filter/sort/paginate external people (directory.listPeople). Non-side-effecting RPC method (POST via call(), never client.read()).
2943
+ * @param {object} params - { scope?, relationship?, accountId?, awareness?, listId?, q?, sort?, includeArchived?, limit?, cursor? }
2944
+ * @param {object} o - { base, token, fetchImpl? }
2945
+ */
2946
+ export function directoryListPeople(params, o = {}) {
2947
+ return call("directory.listPeople", params || {}, o);
2948
+ }
2949
+
2950
+ /**
2951
+ * The Organisations view (directory.listOrgs). Non-side-effecting RPC method (POST via call(), never client.read()).
2952
+ * @param {object} params - { relationship?, q?, includeArchived?, limit?, cursor? }
2953
+ * @param {object} o - { base, token, fetchImpl? }
2954
+ */
2955
+ export function directoryListOrgs(params, o = {}) {
2956
+ return call("directory.listOrgs", params || {}, o);
2957
+ }
2958
+
2959
+ /**
2960
+ * One person record + channels, provenance, links, awareness (directory.getPerson). Non-side-effecting RPC method (POST via call(), never client.read()).
2961
+ * @param {object} params - { contactId }
2962
+ * @param {object} o - { base, token, fetchImpl? }
2963
+ */
2964
+ export function directoryGetPerson(params, o = {}) {
2965
+ return call("directory.getPerson", params || {}, o);
2966
+ }
2967
+
2968
+ /**
2969
+ * One organisation record + channels, relationships, people (directory.getOrg). Non-side-effecting RPC method (POST via call(), never client.read()).
2970
+ * @param {object} params - { accountId }
2971
+ * @param {object} o - { base, token, fetchImpl? }
2972
+ */
2973
+ export function directoryGetOrg(params, o = {}) {
2974
+ return call("directory.getOrg", params || {}, o);
2975
+ }
2976
+
2977
+ /**
2978
+ * Grounded directory Q&A via the shared AI gateway ({content, grounding[], costCents, auditId}) (directory.ask). Grounding is awareness-scoped.
2979
+ * @param {object} params - { question, limit? }
2980
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2981
+ */
2982
+ export function directoryAsk(params, o = {}) {
2983
+ return call("directory.ask", params || {}, o);
2984
+ }
2985
+
2986
+ /**
2987
+ * Export selected people as vCards (directory.exportVcard). Awareness-scoped — restricted records are absent from the export.
2988
+ * @param {object} params - { contactIds }
2989
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
2990
+ */
2991
+ export function directoryExportVcard(params, o = {}) {
2992
+ return call("directory.exportVcard", params || {}, o);
2993
+ }
2994
+
2995
+ /**
2996
+ * The Review view's capture queue (directory.listCaptures). Non-side-effecting RPC method (POST via call(), never client.read()).
2997
+ * @param {object} params - { status?, limit? }
2998
+ * @param {object} o - { base, token, fetchImpl? }
2999
+ */
3000
+ export function directoryListCaptures(params, o = {}) {
3001
+ return call("directory.listCaptures", params || {}, o);
3002
+ }
3003
+
3004
+ /**
3005
+ * Proposed duplicate pairs + the evidence that flagged them (directory.listMerges). Non-side-effecting RPC method (POST via call(), never client.read()).
3006
+ * @param {object} params - { status?, limit? }
3007
+ * @param {object} o - { base, token, fetchImpl? }
3008
+ */
3009
+ export function directoryListMerges(params, o = {}) {
3010
+ return call("directory.listMerges", params || {}, o);
3011
+ }
3012
+
3013
+ /**
3014
+ * Open awareness requests awaiting a human decision (directory.listAwarenessRequests). Non-side-effecting RPC method (POST via call(), never client.read()).
3015
+ * @param {object} params - { status?, limit? }
3016
+ * @param {object} o - { base, token, fetchImpl? }
3017
+ */
3018
+ export function directoryListAwarenessRequests(params, o = {}) {
3019
+ return call("directory.listAwarenessRequests", params || {}, o);
3020
+ }
3021
+
3022
+ /**
3023
+ * Contact lists visible to this seat (directory.listLists). Non-side-effecting RPC method (POST via call(), never client.read()).
3024
+ * @param {object} params - { includeArchived? }
3025
+ * @param {object} o - { base, token, fetchImpl? }
3026
+ */
3027
+ export function directoryListLists(params, o = {}) {
3028
+ return call("directory.listLists", params || {}, o);
3029
+ }
3030
+
3031
+ /**
3032
+ * Create an EXTERNAL person record (directory.createPerson). Idempotent — pass a stable `o.idempotencyKey` so a retried create doesn't duplicate the record.
3033
+ * @param {object} params - { displayName, accountId?|organisationName?, relationship?, email?, phone?, awareness?, granteeMemberIds?, source?, … }
3034
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3035
+ */
3036
+ export function directoryCreatePerson(params, o = {}) {
3037
+ return call("directory.createPerson", params || {}, o);
3038
+ }
3039
+
3040
+ /**
3041
+ * Edit a person record; `verifiedFrom` records how a channel written by this edit was learned (directory.updatePerson). Idempotent — pass a stable `o.idempotencyKey`.
3042
+ * @param {object} params - { contactId, …fields }
3043
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3044
+ */
3045
+ export function directoryUpdatePerson(params, o = {}) {
3046
+ return call("directory.updatePerson", params || {}, o);
3047
+ }
3048
+
3049
+ /**
3050
+ * Archive a person — HUMAN-GATED (directory.archivePerson). An agent seat files an approval instead of archiving; a colleague refuses outright.
3051
+ * @param {object} params - { contactId }
3052
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3053
+ */
3054
+ export function directoryArchivePerson(params, o = {}) {
3055
+ return call("directory.archivePerson", params || {}, o);
3056
+ }
3057
+
3058
+ /**
3059
+ * Create an organisation record (directory.createOrg). Idempotent — pass a stable `o.idempotencyKey`.
3060
+ * @param {object} params - { name, domain?, industry?, relationships?, contactEmail?, address?, … }
3061
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3062
+ */
3063
+ export function directoryCreateOrg(params, o = {}) {
3064
+ return call("directory.createOrg", params || {}, o);
3065
+ }
3066
+
3067
+ /**
3068
+ * Edit an organisation record (directory.updateOrg). Idempotent — pass a stable `o.idempotencyKey`.
3069
+ * @param {object} params - { accountId, …fields }
3070
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3071
+ */
3072
+ export function directoryUpdateOrg(params, o = {}) {
3073
+ return call("directory.updateOrg", params || {}, o);
3074
+ }
3075
+
3076
+ /**
3077
+ * Archive an organisation — HUMAN-GATED (directory.archiveOrg). An agent seat files an approval instead of archiving.
3078
+ * @param {object} params - { accountId }
3079
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3080
+ */
3081
+ export function directoryArchiveOrg(params, o = {}) {
3082
+ return call("directory.archiveOrg", params || {}, o);
3083
+ }
3084
+
3085
+ /**
3086
+ * Attach an email/phone/handle/URL with its provenance (directory.addChannel). THE enrichment verb — re-adding a known channel with a fresh `verifiedFrom` re-verifies it. Idempotent — pass a stable `o.idempotencyKey`.
3087
+ * @param {object} params - { subjectType, subjectId, type, value, isPrimary?, verifiedFrom?, label?, source?, sourceRef?, confidence? }
3088
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3089
+ */
3090
+ export function directoryAddChannel(params, o = {}) {
3091
+ return call("directory.addChannel", params || {}, o);
3092
+ }
3093
+
3094
+ /**
3095
+ * Remove a channel from a record (directory.removeChannel).
3096
+ * @param {object} params - { channelId }
3097
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3098
+ */
3099
+ export function directoryRemoveChannel(params, o = {}) {
3100
+ return call("directory.removeChannel", params || {}, o);
3101
+ }
3102
+
3103
+ /**
3104
+ * Promote a channel to primary for its type (directory.setPrimaryChannel). Idempotent — pass a stable `o.idempotencyKey`.
3105
+ * @param {object} params - { channelId }
3106
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3107
+ */
3108
+ export function directorySetPrimaryChannel(params, o = {}) {
3109
+ return call("directory.setPrimaryChannel", params || {}, o);
3110
+ }
3111
+
3112
+ /**
3113
+ * Propose a record for the Review queue from observed traffic (directory.proposeCapture). Writes NO record. `sourceFingerprint` dedupes, so re-proposing the same observation is safe. Idempotent — pass a stable `o.idempotencyKey`.
3114
+ * @param {object} params - { kind, payload, source, sourceRef?, sourceFingerprint, confidence? }
3115
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3116
+ */
3117
+ export function directoryProposeCapture(params, o = {}) {
3118
+ return call("directory.proposeCapture", params || {}, o);
3119
+ }
3120
+
3121
+ /**
3122
+ * Approve (optionally edited) or dismiss a capture — HUMAN-GATED (directory.resolveCapture). Approving is what writes the record.
3123
+ * @param {object} params - { captureId, decision, patch? }
3124
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3125
+ */
3126
+ export function directoryResolveCapture(params, o = {}) {
3127
+ return call("directory.resolveCapture", params || {}, o);
3128
+ }
3129
+
3130
+ /**
3131
+ * Flag two records as the same party, with evidence (directory.proposeMerge). Files a candidate; does NOT merge. Idempotent — pass a stable `o.idempotencyKey`.
3132
+ * @param {object} params - { aRef, bRef, evidence? }
3133
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3134
+ */
3135
+ export function directoryProposeMerge(params, o = {}) {
3136
+ return call("directory.proposeMerge", params || {}, o);
3137
+ }
3138
+
3139
+ /**
3140
+ * Execute a merge with per-field picks — HUMAN-GATED (directory.executeMerge).
3141
+ * @param {object} params - { candidateId, survivorRef, fieldPicks?, keepBothChannels? }
3142
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3143
+ */
3144
+ export function directoryExecuteMerge(params, o = {}) {
3145
+ return call("directory.executeMerge", params || {}, o);
3146
+ }
3147
+
3148
+ /**
3149
+ * Undo an executed merge — HUMAN-GATED (directory.revertMerge).
3150
+ * @param {object} params - { candidateId }
3151
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3152
+ */
3153
+ export function directoryRevertMerge(params, o = {}) {
3154
+ return call("directory.revertMerge", params || {}, o);
3155
+ }
3156
+
3157
+ /**
3158
+ * Ask for awareness of a restricted record; the reason is shown verbatim to the decider (directory.requestAwareness). Idempotent — pass a stable `o.idempotencyKey`.
3159
+ * @param {object} params - { contactId, reason? }
3160
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3161
+ */
3162
+ export function directoryRequestAwareness(params, o = {}) {
3163
+ return call("directory.requestAwareness", params || {}, o);
3164
+ }
3165
+
3166
+ /**
3167
+ * Set a record's awareness + the FULL grantee set — HUMAN-GATED (directory.setAwareness). The acting human is always included.
3168
+ * @param {object} params - { contactIds, awareness, granteeMemberIds?, reason? }
3169
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3170
+ */
3171
+ export function directorySetAwareness(params, o = {}) {
3172
+ return call("directory.setAwareness", params || {}, o);
3173
+ }
3174
+
3175
+ /**
3176
+ * Grant or decline an awareness request — HUMAN-GATED (directory.resolveAwarenessRequest). Logged either way.
3177
+ * @param {object} params - { requestId, decision, note? }
3178
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3179
+ */
3180
+ export function directoryResolveAwarenessRequest(params, o = {}) {
3181
+ return call("directory.resolveAwarenessRequest", params || {}, o);
3182
+ }
3183
+
3184
+ /**
3185
+ * Link a party to a mail message/thread, meeting attendee, file share or bank-feed line (directory.linkParty). Idempotent — pass a stable `o.idempotencyKey`.
3186
+ * @param {object} params - { partyRef, refType, refId, role, address? }
3187
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3188
+ */
3189
+ export function directoryLinkParty(params, o = {}) {
3190
+ return call("directory.linkParty", params || {}, o);
3191
+ }
3192
+
3193
+ /**
3194
+ * Remove a cross-suite link (directory.unlinkParty).
3195
+ * @param {object} params - { partyRef, refType, refId, role }
3196
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3197
+ */
3198
+ export function directoryUnlinkParty(params, o = {}) {
3199
+ return call("directory.unlinkParty", params || {}, o);
3200
+ }
3201
+
3202
+ /**
3203
+ * Create a contact list, optionally seeded + shared (directory.createList). Idempotent — pass a stable `o.idempotencyKey`.
3204
+ * @param {object} params - { name, memberRefs?, shareMemberIds? }
3205
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3206
+ */
3207
+ export function directoryCreateList(params, o = {}) {
3208
+ return call("directory.createList", params || {}, o);
3209
+ }
3210
+
3211
+ /**
3212
+ * Add parties to a contact list (directory.addToList). Idempotent — pass a stable `o.idempotencyKey`.
3213
+ * @param {object} params - { listId, partyRefs }
3214
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3215
+ */
3216
+ export function directoryAddToList(params, o = {}) {
3217
+ return call("directory.addToList", params || {}, o);
3218
+ }
3219
+
3220
+ /**
3221
+ * Remove parties from a contact list (directory.removeFromList).
3222
+ * @param {object} params - { listId, partyRefs }
3223
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3224
+ */
3225
+ export function directoryRemoveFromList(params, o = {}) {
3226
+ return call("directory.removeFromList", params || {}, o);
3227
+ }
3228
+
3229
+ /**
3230
+ * Share a contact list with other seats (directory.shareList). Idempotent — pass a stable `o.idempotencyKey`.
3231
+ * @param {object} params - { listId, memberIds }
3232
+ * @param {object} o - { base, token, idempotencyKey?, fetchImpl? }
3233
+ */
3234
+ export function directoryShareList(params, o = {}) {
3235
+ return call("directory.shareList", params || {}, o);
3236
+ }