@microvac/adapter-codex-local 0.0.0-stage → 0.1.0-rc.14
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.
- package/dist/cli/format-event.d.ts +2 -0
- package/dist/cli/format-event.d.ts.map +1 -0
- package/dist/cli/format-event.js +218 -0
- package/dist/cli/format-event.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/quota-probe.d.ts +3 -0
- package/dist/cli/quota-probe.d.ts.map +1 -0
- package/dist/cli/quota-probe.js +104 -0
- package/dist/cli/quota-probe.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +268 -0
- package/dist/index.js.map +1 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +125 -0
- package/dist/index.test.js.map +1 -0
- package/dist/server/acp.cli-version.test.d.ts +2 -0
- package/dist/server/acp.cli-version.test.d.ts.map +1 -0
- package/dist/server/acp.cli-version.test.js +151 -0
- package/dist/server/acp.cli-version.test.js.map +1 -0
- package/dist/server/acp.d.ts +31 -0
- package/dist/server/acp.d.ts.map +1 -0
- package/dist/server/acp.js +608 -0
- package/dist/server/acp.js.map +1 -0
- package/dist/server/acp.quota.test.d.ts +2 -0
- package/dist/server/acp.quota.test.d.ts.map +1 -0
- package/dist/server/acp.quota.test.js +176 -0
- package/dist/server/acp.quota.test.js.map +1 -0
- package/dist/server/acp.test.d.ts +2 -0
- package/dist/server/acp.test.d.ts.map +1 -0
- package/dist/server/acp.test.js +1263 -0
- package/dist/server/acp.test.js.map +1 -0
- package/dist/server/adapter-auth-promotion.d.ts +102 -0
- package/dist/server/adapter-auth-promotion.d.ts.map +1 -0
- package/dist/server/adapter-auth-promotion.js +210 -0
- package/dist/server/adapter-auth-promotion.js.map +1 -0
- package/dist/server/adapter-auth-promotion.test.d.ts +2 -0
- package/dist/server/adapter-auth-promotion.test.d.ts.map +1 -0
- package/dist/server/adapter-auth-promotion.test.js +615 -0
- package/dist/server/adapter-auth-promotion.test.js.map +1 -0
- package/dist/server/auth-check.d.ts +8 -0
- package/dist/server/auth-check.d.ts.map +1 -0
- package/dist/server/auth-check.js +8 -0
- package/dist/server/auth-check.js.map +1 -0
- package/dist/server/auth-precedence.d.ts +16 -0
- package/dist/server/auth-precedence.d.ts.map +1 -0
- package/dist/server/auth-precedence.js +20 -0
- package/dist/server/auth-precedence.js.map +1 -0
- package/dist/server/auth-precedence.test.d.ts +2 -0
- package/dist/server/auth-precedence.test.d.ts.map +1 -0
- package/dist/server/auth-precedence.test.js +100 -0
- package/dist/server/auth-precedence.test.js.map +1 -0
- package/dist/server/cli-version.d.ts +45 -0
- package/dist/server/cli-version.d.ts.map +1 -0
- package/dist/server/cli-version.js +95 -0
- package/dist/server/cli-version.js.map +1 -0
- package/dist/server/codex-args.d.ts +13 -0
- package/dist/server/codex-args.d.ts.map +1 -0
- package/dist/server/codex-args.js +64 -0
- package/dist/server/codex-args.js.map +1 -0
- package/dist/server/codex-args.test.d.ts +2 -0
- package/dist/server/codex-args.test.d.ts.map +1 -0
- package/dist/server/codex-args.test.js +257 -0
- package/dist/server/codex-args.test.js.map +1 -0
- package/dist/server/codex-auth-cache.d.ts +179 -0
- package/dist/server/codex-auth-cache.d.ts.map +1 -0
- package/dist/server/codex-auth-cache.js +520 -0
- package/dist/server/codex-auth-cache.js.map +1 -0
- package/dist/server/codex-auth-cache.test.d.ts +2 -0
- package/dist/server/codex-auth-cache.test.d.ts.map +1 -0
- package/dist/server/codex-auth-cache.test.js +530 -0
- package/dist/server/codex-auth-cache.test.js.map +1 -0
- package/dist/server/codex-auth-copyback.d.ts +53 -0
- package/dist/server/codex-auth-copyback.d.ts.map +1 -0
- package/dist/server/codex-auth-copyback.js +123 -0
- package/dist/server/codex-auth-copyback.js.map +1 -0
- package/dist/server/codex-auth-copyback.test.d.ts +2 -0
- package/dist/server/codex-auth-copyback.test.d.ts.map +1 -0
- package/dist/server/codex-auth-copyback.test.js +507 -0
- package/dist/server/codex-auth-copyback.test.js.map +1 -0
- package/dist/server/codex-auth-merge-decision.cjs +170 -0
- package/dist/server/codex-auth-merge-decision.d.ts +22 -0
- package/dist/server/codex-auth-merge-decision.d.ts.map +1 -0
- package/dist/server/codex-auth-merge-decision.js +58 -0
- package/dist/server/codex-auth-merge-decision.js.map +1 -0
- package/dist/server/codex-auth-merge-decision.test.d.ts +2 -0
- package/dist/server/codex-auth-merge-decision.test.d.ts.map +1 -0
- package/dist/server/codex-auth-merge-decision.test.js +215 -0
- package/dist/server/codex-auth-merge-decision.test.js.map +1 -0
- package/dist/server/codex-auth-merge-extract.sh +73 -0
- package/dist/server/codex-auth-merge-scripts.d.ts +21 -0
- package/dist/server/codex-auth-merge-scripts.d.ts.map +1 -0
- package/dist/server/codex-auth-merge-scripts.js +40 -0
- package/dist/server/codex-auth-merge-scripts.js.map +1 -0
- package/dist/server/codex-auth-merge.test.d.ts +2 -0
- package/dist/server/codex-auth-merge.test.d.ts.map +1 -0
- package/dist/server/codex-auth-merge.test.js +714 -0
- package/dist/server/codex-auth-merge.test.js.map +1 -0
- package/dist/server/codex-auth-seed-write.d.ts +30 -0
- package/dist/server/codex-auth-seed-write.d.ts.map +1 -0
- package/dist/server/codex-auth-seed-write.js +41 -0
- package/dist/server/codex-auth-seed-write.js.map +1 -0
- package/dist/server/codex-home.d.ts +169 -0
- package/dist/server/codex-home.d.ts.map +1 -0
- package/dist/server/codex-home.js +822 -0
- package/dist/server/codex-home.js.map +1 -0
- package/dist/server/codex-home.test.d.ts +2 -0
- package/dist/server/codex-home.test.d.ts.map +1 -0
- package/dist/server/codex-home.test.js +1287 -0
- package/dist/server/codex-home.test.js.map +1 -0
- package/dist/server/config-schema.d.ts +3 -0
- package/dist/server/config-schema.d.ts.map +1 -0
- package/dist/server/config-schema.js +67 -0
- package/dist/server/config-schema.js.map +1 -0
- package/dist/server/device-login-export.d.ts +56 -0
- package/dist/server/device-login-export.d.ts.map +1 -0
- package/dist/server/device-login-export.js +230 -0
- package/dist/server/device-login-export.js.map +1 -0
- package/dist/server/device-login-export.test.d.ts +2 -0
- package/dist/server/device-login-export.test.d.ts.map +1 -0
- package/dist/server/device-login-export.test.js +245 -0
- package/dist/server/device-login-export.test.js.map +1 -0
- package/dist/server/device-login-parse.d.ts +20 -0
- package/dist/server/device-login-parse.d.ts.map +1 -0
- package/dist/server/device-login-parse.js +155 -0
- package/dist/server/device-login-parse.js.map +1 -0
- package/dist/server/device-login-parse.test.d.ts +2 -0
- package/dist/server/device-login-parse.test.d.ts.map +1 -0
- package/dist/server/device-login-parse.test.js +269 -0
- package/dist/server/device-login-parse.test.js.map +1 -0
- package/dist/server/device-login-runner.d.ts +69 -0
- package/dist/server/device-login-runner.d.ts.map +1 -0
- package/dist/server/device-login-runner.js +110 -0
- package/dist/server/device-login-runner.js.map +1 -0
- package/dist/server/device-login-runner.test.d.ts +2 -0
- package/dist/server/device-login-runner.test.d.ts.map +1 -0
- package/dist/server/device-login-runner.test.js +201 -0
- package/dist/server/device-login-runner.test.js.map +1 -0
- package/dist/server/engine-availability.test.d.ts +2 -0
- package/dist/server/engine-availability.test.d.ts.map +1 -0
- package/dist/server/engine-availability.test.js +41 -0
- package/dist/server/engine-availability.test.js.map +1 -0
- package/dist/server/execute.acp-fallback.test.d.ts +2 -0
- package/dist/server/execute.acp-fallback.test.d.ts.map +1 -0
- package/dist/server/execute.acp-fallback.test.js +123 -0
- package/dist/server/execute.acp-fallback.test.js.map +1 -0
- package/dist/server/execute.auth-precedence.test.d.ts +2 -0
- package/dist/server/execute.auth-precedence.test.d.ts.map +1 -0
- package/dist/server/execute.auth-precedence.test.js +137 -0
- package/dist/server/execute.auth-precedence.test.js.map +1 -0
- package/dist/server/execute.auth.test.d.ts +2 -0
- package/dist/server/execute.auth.test.d.ts.map +1 -0
- package/dist/server/execute.auth.test.js +197 -0
- package/dist/server/execute.auth.test.js.map +1 -0
- package/dist/server/execute.d.ts +40 -0
- package/dist/server/execute.d.ts.map +1 -0
- package/dist/server/execute.js +1485 -0
- package/dist/server/execute.js.map +1 -0
- package/dist/server/execute.remote.test.d.ts +2 -0
- package/dist/server/execute.remote.test.d.ts.map +1 -0
- package/dist/server/execute.remote.test.js +851 -0
- package/dist/server/execute.remote.test.js.map +1 -0
- package/dist/server/execute.ssh-host-auth.test.d.ts +2 -0
- package/dist/server/execute.ssh-host-auth.test.d.ts.map +1 -0
- package/dist/server/execute.ssh-host-auth.test.js +214 -0
- package/dist/server/execute.ssh-host-auth.test.js.map +1 -0
- package/dist/server/execute.stderr-error.test.d.ts +2 -0
- package/dist/server/execute.stderr-error.test.d.ts.map +1 -0
- package/dist/server/execute.stderr-error.test.js +142 -0
- package/dist/server/execute.stderr-error.test.js.map +1 -0
- package/dist/server/execute.test.d.ts +2 -0
- package/dist/server/execute.test.d.ts.map +1 -0
- package/dist/server/execute.test.js +300 -0
- package/dist/server/execute.test.js.map +1 -0
- package/dist/server/index.d.ts +18 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +84 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/output-inactivity-monitor.d.ts +62 -0
- package/dist/server/output-inactivity-monitor.d.ts.map +1 -0
- package/dist/server/output-inactivity-monitor.integration.test.d.ts +2 -0
- package/dist/server/output-inactivity-monitor.integration.test.d.ts.map +1 -0
- package/dist/server/output-inactivity-monitor.integration.test.js +136 -0
- package/dist/server/output-inactivity-monitor.integration.test.js.map +1 -0
- package/dist/server/output-inactivity-monitor.js +112 -0
- package/dist/server/output-inactivity-monitor.js.map +1 -0
- package/dist/server/output-inactivity-monitor.test.d.ts +2 -0
- package/dist/server/output-inactivity-monitor.test.d.ts.map +1 -0
- package/dist/server/output-inactivity-monitor.test.js +284 -0
- package/dist/server/output-inactivity-monitor.test.js.map +1 -0
- package/dist/server/parse.d.ts +69 -0
- package/dist/server/parse.d.ts.map +1 -0
- package/dist/server/parse.js +278 -0
- package/dist/server/parse.js.map +1 -0
- package/dist/server/parse.test.d.ts +2 -0
- package/dist/server/parse.test.d.ts.map +1 -0
- package/dist/server/parse.test.js +203 -0
- package/dist/server/parse.test.js.map +1 -0
- package/dist/server/process-activity-monitor.d.ts +21 -0
- package/dist/server/process-activity-monitor.d.ts.map +1 -0
- package/dist/server/process-activity-monitor.js +103 -0
- package/dist/server/process-activity-monitor.js.map +1 -0
- package/dist/server/process-activity-monitor.test.d.ts +2 -0
- package/dist/server/process-activity-monitor.test.d.ts.map +1 -0
- package/dist/server/process-activity-monitor.test.js +82 -0
- package/dist/server/process-activity-monitor.test.js.map +1 -0
- package/dist/server/quota-spawn-error.test.d.ts +2 -0
- package/dist/server/quota-spawn-error.test.d.ts.map +1 -0
- package/dist/server/quota-spawn-error.test.js +343 -0
- package/dist/server/quota-spawn-error.test.js.map +1 -0
- package/dist/server/quota.d.ts +66 -0
- package/dist/server/quota.d.ts.map +1 -0
- package/dist/server/quota.js +577 -0
- package/dist/server/quota.js.map +1 -0
- package/dist/server/runtime-config.d.ts +11 -0
- package/dist/server/runtime-config.d.ts.map +1 -0
- package/dist/server/runtime-config.js +389 -0
- package/dist/server/runtime-config.js.map +1 -0
- package/dist/server/runtime-config.test.d.ts +2 -0
- package/dist/server/runtime-config.test.d.ts.map +1 -0
- package/dist/server/runtime-config.test.js +389 -0
- package/dist/server/runtime-config.test.js.map +1 -0
- package/dist/server/skills.d.ts +8 -0
- package/dist/server/skills.d.ts.map +1 -0
- package/dist/server/skills.js +26 -0
- package/dist/server/skills.js.map +1 -0
- package/dist/server/ssh-host-runtime.d.ts +24 -0
- package/dist/server/ssh-host-runtime.d.ts.map +1 -0
- package/dist/server/ssh-host-runtime.js +84 -0
- package/dist/server/ssh-host-runtime.js.map +1 -0
- package/dist/server/ssh-session-state.d.ts +18 -0
- package/dist/server/ssh-session-state.d.ts.map +1 -0
- package/dist/server/ssh-session-state.js +11 -0
- package/dist/server/ssh-session-state.js.map +1 -0
- package/dist/server/test.d.ts +3 -0
- package/dist/server/test.d.ts.map +1 -0
- package/dist/server/test.js +531 -0
- package/dist/server/test.js.map +1 -0
- package/dist/server/test.remote.test.d.ts +2 -0
- package/dist/server/test.remote.test.d.ts.map +1 -0
- package/dist/server/test.remote.test.js +596 -0
- package/dist/server/test.remote.test.js.map +1 -0
- package/dist/ui/build-config.d.ts +10 -0
- package/dist/ui/build-config.d.ts.map +1 -0
- package/dist/ui/build-config.js +284 -0
- package/dist/ui/build-config.js.map +1 -0
- package/dist/ui/build-config.test.d.ts +2 -0
- package/dist/ui/build-config.test.d.ts.map +1 -0
- package/dist/ui/build-config.test.js +367 -0
- package/dist/ui/build-config.test.js.map +1 -0
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +8 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/parse-stdout.d.ts +3 -0
- package/dist/ui/parse-stdout.d.ts.map +1 -0
- package/dist/ui/parse-stdout.js +265 -0
- package/dist/ui/parse-stdout.js.map +1 -0
- package/dist/ui/parse-stdout.test.d.ts +2 -0
- package/dist/ui/parse-stdout.test.d.ts.map +1 -0
- package/dist/ui/parse-stdout.test.js +77 -0
- package/dist/ui/parse-stdout.test.js.map +1 -0
- package/package.json +55 -4
- package/skills/agentmail/SKILL.md +70 -0
- package/skills/complain/LICENSE +27 -0
- package/skills/complain/SKILL.md +68 -0
- package/skills/paperclip/SKILL.md +864 -0
- package/skills/paperclip/references/api-reference.md +1814 -0
- package/skills/paperclip/references/artifacts.md +163 -0
- package/skills/paperclip/references/cases.md +570 -0
- package/skills/paperclip/references/company-skills.md +266 -0
- package/skills/paperclip/references/issue-documents.md +58 -0
- package/skills/paperclip/references/issue-workspaces.md +94 -0
- package/skills/paperclip/references/routines.md +249 -0
- package/skills/paperclip/references/run-diagnostics.md +28 -0
- package/skills/paperclip/references/workflows.md +141 -0
- package/skills/paperclip/scripts/paperclip-issue-update.sh +166 -0
- package/skills/paperclip/scripts/paperclip-upload-artifact.sh +603 -0
- package/skills/paperclip/scripts/submit-agent-commentary.mjs +52 -0
- package/skills/paperclip-board/SKILL.md +633 -0
- package/skills/paperclip-converting-plans-to-tasks/SKILL.md +28 -0
- package/skills/paperclip-create-agent/SKILL.md +213 -0
- package/skills/paperclip-create-agent/references/agent-instruction-templates.md +24 -0
- package/skills/paperclip-create-agent/references/agents/coder.md +18 -0
- package/skills/paperclip-create-agent/references/agents/qa.md +18 -0
- package/skills/paperclip-create-agent/references/agents/securityengineer.md +26 -0
- package/skills/paperclip-create-agent/references/agents/uxdesigner.md +18 -0
- package/skills/paperclip-create-agent/references/api-reference.md +110 -0
- package/skills/paperclip-create-agent/references/baseline-role-guide.md +22 -0
- package/skills/paperclip-create-agent/references/draft-review-checklist.md +29 -0
- package/skills/para-memory-files/SKILL.md +100 -0
- package/skills/para-memory-files/references/schemas.md +35 -0
- package/skills/slack/SKILL.md +92 -0
- package/skills/suggestion-box/LICENSE +27 -0
- package/skills/suggestion-box/SKILL.md +77 -0
- package/README.md +0 -3
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
# Cases
|
|
2
|
+
|
|
3
|
+
Cases are agent-owned work records for durable outputs such as blog posts,
|
|
4
|
+
research packets, release notes, incidents, QA runs, or generated asset sets.
|
|
5
|
+
They are company-scoped and live beside issues: issues coordinate work, while
|
|
6
|
+
cases preserve the structured object an agent is producing.
|
|
7
|
+
|
|
8
|
+
Cases are experimental and must be enabled with `experimental.enableCases`.
|
|
9
|
+
If a route returns `403 Cases are disabled`, stop and report that the operator
|
|
10
|
+
must enable cases before the skill can use this surface.
|
|
11
|
+
|
|
12
|
+
**Reusable workflows.**
|
|
13
|
+
|
|
14
|
+
Under the same Cases flag, use `list_workflows` to discover company-shared
|
|
15
|
+
name-and-prompt definitions, `read_workflow` to read one, and `create_workflow`
|
|
16
|
+
or `update_workflow` to author explicit reusable instructions. Creation needs
|
|
17
|
+
`name`, `prompt`, and `idempotencyKey`; update needs `workflowId`, a retry key,
|
|
18
|
+
and a name or prompt. These definitions are shared across the company. Case
|
|
19
|
+
documents are never automatically published into them.
|
|
20
|
+
|
|
21
|
+
Native `create_case` and REST kickoff accept **either** `workflowId` or the
|
|
22
|
+
inline `workflow_document_text` described below; kickoff is still required.
|
|
23
|
+
Adoption copies the prompt into the primary task's ordinary `workflow` document.
|
|
24
|
+
Read that task document for current instructions, which may contain case-specific
|
|
25
|
+
edits. Editing the shared definition leaves existing copies unchanged.
|
|
26
|
+
|
|
27
|
+
On an agent `handoff_case`, omit `workflowId` to preserve the current definition
|
|
28
|
+
and document. Supply an ID to adopt its current prompt, including the current ID
|
|
29
|
+
to refresh explicitly. Supply null to leave the workflow while retaining task
|
|
30
|
+
instructions. Free-text phases and case types are independent of definitions.
|
|
31
|
+
The handoff captures the selected prompt when accepted and applies it only on
|
|
32
|
+
transfer. If someone edits the task document in between, the handoff is held;
|
|
33
|
+
read current state, cancel the unapplied handoff, then submit new intent. Do not
|
|
34
|
+
overwrite intervening edits. The same case/task and document history survive
|
|
35
|
+
A → B → A. Generic case updates cannot change workflow routing.
|
|
36
|
+
|
|
37
|
+
`read_workflow` returns bounded JSON text in `data`. Continue with the same
|
|
38
|
+
workflow ID, returned `snapshot`, and `responseText: {offsetBytes: <nextOffsetBytes>}`
|
|
39
|
+
until `responseText.nextOffsetBytes` is null, then parse the concatenated JSON.
|
|
40
|
+
An intervening edit returns 409; restart at offset zero without `snapshot`.
|
|
41
|
+
Mutation responses contain metadata.
|
|
42
|
+
|
|
43
|
+
## Core Model
|
|
44
|
+
|
|
45
|
+
A case has:
|
|
46
|
+
|
|
47
|
+
- `identifier`: server-assigned display id such as `PAP-C42`
|
|
48
|
+
- `caseType`: skill-owned type such as `blog_post`, `image_assets`, or `incident`
|
|
49
|
+
- `key`: optional deterministic upsert key inside `(companyId, caseType)`
|
|
50
|
+
- `title` and optional `summary`
|
|
51
|
+
- `status`: `draft`, `in_progress`, `in_review`, `approved`, `done`, or `cancelled`
|
|
52
|
+
- `fields`: JSON object owned by the skill using the case
|
|
53
|
+
- `parentCaseId`: optional parent case for child work
|
|
54
|
+
- `workIssueId`: optional primary workflow task; later handoffs reuse it
|
|
55
|
+
- `phase` and `handoffVersion`: current applied phase and observed routing revision
|
|
56
|
+
- documents, attachments, issue links, labels, and events
|
|
57
|
+
|
|
58
|
+
Use deterministic `caseType` + `key` when a skill may be retried. Repeating
|
|
59
|
+
`POST /api/companies/:companyId/cases` with the same `caseType` and `key`
|
|
60
|
+
upserts the same case instead of creating a duplicate.
|
|
61
|
+
|
|
62
|
+
## Upsert Semantics
|
|
63
|
+
|
|
64
|
+
`POST /api/companies/:companyId/cases` creates or upserts a case.
|
|
65
|
+
|
|
66
|
+
Request:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"caseType": "blog_post",
|
|
71
|
+
"key": "launch-announcement",
|
|
72
|
+
"title": "Launch announcement",
|
|
73
|
+
"summary": "Draft launch post for operators.",
|
|
74
|
+
"status": "draft",
|
|
75
|
+
"fields": {
|
|
76
|
+
"slug": "launch-announcement",
|
|
77
|
+
"target_audience": "operators"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Response:
|
|
83
|
+
|
|
84
|
+
- `201` when a new case was created
|
|
85
|
+
- `200` when an existing `(caseType, key)` case was updated
|
|
86
|
+
|
|
87
|
+
Field behavior on upsert:
|
|
88
|
+
|
|
89
|
+
- `title` is required and replaces the previous title.
|
|
90
|
+
- `projectId`, `summary`, `status`, `fields`, and `parentCaseId` replace the
|
|
91
|
+
previous value when present.
|
|
92
|
+
- Omitted optional values preserve the previous value during upsert.
|
|
93
|
+
- `fields` is replaced as a whole object when provided. It is not deep-merged.
|
|
94
|
+
Send the complete desired JSON object each time.
|
|
95
|
+
- Concurrent retries with the same `(caseType, key)` converge to one case.
|
|
96
|
+
|
|
97
|
+
Do not use a random `key` for retryable skills. Use a stable content slug,
|
|
98
|
+
external id, source URL hash, or parent-derived request key.
|
|
99
|
+
|
|
100
|
+
## Start And Hand Off Work
|
|
101
|
+
|
|
102
|
+
Native `create_case` always creates a case and starts its first ordinary task.
|
|
103
|
+
`kickoff` and either `workflowId` or `workflow_document_text` are required; missing kickoff or both instruction sources is rejected
|
|
104
|
+
before any records are created. Provide the first agent, phase, instructions,
|
|
105
|
+
the full workflow description, and optional initial task documents:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"idempotencyKey":"csv-export-kickoff-1",
|
|
110
|
+
"caseType":"software_change",
|
|
111
|
+
"title":"Add a CSV export",
|
|
112
|
+
"workflow_document_text":"Agent ownership: triage=<triage-agent-uuid>, implementation=<implementation-agent-uuid>, verification=<verification-agent-uuid>. Transition ready: triage saves clear scope and research, then hands the same task to implementation; ask material questions and wait for answers first. Transition candidate_ready: implementation saves changes and check results, then hands off to verification. Transition changes_requested: verification saves concrete defects and returns to implementation; after two failed correction rounds ask for human direction. Transition verified_and_approved: checks and required human approvals are accepted; request handoff to done and complete the same task normally.\n\n```mermaid\nstateDiagram-v2\n [*] --> triage\n triage --> implementation : ready\n implementation --> verification : candidate_ready\n verification --> implementation : changes_requested\n verification --> done : verified_and_approved\n done --> [*]\n```",
|
|
113
|
+
"kickoff":{"toAgentId":"<triage-agent-uuid>","phase":"triage","instructions":"Research the request, then hand this same task to implementation."},
|
|
114
|
+
"initialDocuments":[{"key":"brief","title":"Export brief","body":"Export the filtered rows as CSV. Preserve the current column order."}]
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The harness saves `workflow_document_text` verbatim as the ordinary task document
|
|
119
|
+
`workflow`, titled **Workflow**, in Markdown format. It creates the primary task
|
|
120
|
+
and all seeded documents in the same transaction before delivery. Documents do not belong to
|
|
121
|
+
the case. Keys follow ordinary task document rules (trimmed/lowercased,
|
|
122
|
+
1–64 characters); duplicate keys and the reserved `workflow` key are rejected in
|
|
123
|
+
`initialDocuments`. A kickoff accepts up to 20 additional documents, with at most
|
|
124
|
+
200,000 body characters including the workflow text. There is no pending document
|
|
125
|
+
seed storage on the case. Read `read_document({"key":"workflow"})` before deciding
|
|
126
|
+
what to do or where to hand off. The harness supplies its reference; it does not
|
|
127
|
+
repeat the entire body in every prompt. Update the workflow through ordinary task
|
|
128
|
+
document revision tools when authorized; do not resend it on later handoffs.
|
|
129
|
+
|
|
130
|
+
Recommend both a fenced Mermaid `stateDiagram-v2` map and prose explaining
|
|
131
|
+
every transition. Include the objective, phase owners (actual agent IDs), expected
|
|
132
|
+
outputs, transition conditions, human waits, correction limits, and completion
|
|
133
|
+
criteria. For example:
|
|
134
|
+
|
|
135
|
+
```mermaid
|
|
136
|
+
stateDiagram-v2
|
|
137
|
+
[*] --> triage
|
|
138
|
+
triage --> specification : needs_spec
|
|
139
|
+
triage --> implementation : ready
|
|
140
|
+
specification --> implementation : spec_approved
|
|
141
|
+
implementation --> verification : candidate_ready
|
|
142
|
+
verification --> implementation : changes_requested
|
|
143
|
+
verification --> done : verified_and_approved
|
|
144
|
+
done --> [*]
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Follow the map with prose that defines its named outcomes:
|
|
148
|
+
|
|
149
|
+
| Transition | Prose definition |
|
|
150
|
+
| --- | --- |
|
|
151
|
+
| `triage → specification` (`needs_spec`) | Scope or acceptance criteria need a specification. Save findings and unresolved questions, then assign the named specification agent. |
|
|
152
|
+
| `triage → implementation` (`ready`) | Scope, inputs and acceptance criteria are clear. Save the research and give the named implementation agent its evidence and constraints. |
|
|
153
|
+
| `specification → implementation` (`spec_approved`) | The required approval for the saved spec revision is accepted. While pending, use the normal review wait; resume only after approval. |
|
|
154
|
+
| `implementation → verification` (`candidate_ready`) | Save the candidate, artifacts and actual check results. Give the named verification agent the read paths and acceptance criteria. |
|
|
155
|
+
| `verification → implementation` (`changes_requested`) | Persist concrete defects and failing evidence before returning to the implementation agent. Allow at most two correction rounds, then ask for human direction. |
|
|
156
|
+
| `verification → done` (`verified_and_approved`) | Evidence satisfies acceptance criteria and required reviews/approvals are accepted. Request `to: "done"` and complete the same task through its normal gates. |
|
|
157
|
+
|
|
158
|
+
Use stable state IDs matching agent phase names and map every active phase to its
|
|
159
|
+
actual agent ID. Define each transition's trigger, evidence, destination and any
|
|
160
|
+
wait/resume, correction or escalation rules; a diagram alone is insufficient.
|
|
161
|
+
Arrow labels are not executable guards. Paperclip stores this document as
|
|
162
|
+
task data and does not parse or enforce its graph. Human waits use existing
|
|
163
|
+
question/review/approval mechanisms, and `done` still requires accepted normal
|
|
164
|
+
task completion. See [Mermaid state diagrams](https://mermaid.js.org/syntax/stateDiagram.html).
|
|
165
|
+
|
|
166
|
+
Alternatively use native `handoff_case` or
|
|
167
|
+
`POST /api/companies/:companyId/case-handoffs`:
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"idempotencyKey": "launch-triage-1",
|
|
172
|
+
"case": {
|
|
173
|
+
"create": {
|
|
174
|
+
"caseType": "software_change",
|
|
175
|
+
"title": "Add a CSV export",
|
|
176
|
+
"summary": "Deliver the requested export with verification and review."
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"toAgentId": "<triage-agent-uuid>",
|
|
180
|
+
"phase": "triage",
|
|
181
|
+
"workflow_document_text": "Agent ownership: triage=<triage-agent-uuid>, implementation=<implementation-agent-uuid>, verification=<verification-agent-uuid>. Transition ready: triage saves clear scope and evidence, then sends the same task to implementation; wait for answers to material questions first. Transition candidate_ready: implementation saves changes and actual check results, then sends the task to verification. Transition changes_requested: verification saves concrete defects before returning to implementation; after two failed correction rounds request human direction. Transition verified_and_approved: checks and required approvals are accepted; hand off to done and complete normally.\n\n```mermaid\nstateDiagram-v2\n [*] --> triage\n triage --> implementation : ready\n implementation --> verification : candidate_ready\n verification --> implementation : changes_requested\n verification --> done : verified_and_approved\n done --> [*]\n```",
|
|
182
|
+
"instructions": "Research the request. Ask material questions or hand this same task to the implementation agent."
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
The harness creates the initial ordinary task and assigns it. For an existing
|
|
187
|
+
case, send `case: {"id": "<case-uuid>"}`, `expectedHandoffVersion`, and
|
|
188
|
+
`expectedIssueStatusVersion` from fresh authorized context. The existing primary
|
|
189
|
+
task is reused automatically. A passive case may explicitly bind an existing
|
|
190
|
+
ordinary task with `bindIssueId` and its observed status version.
|
|
191
|
+
New-case API creation also requires top-level `workflowId` or `workflow_document_text`. Starting
|
|
192
|
+
the first new task of an older passive case requires it too. New-case binding
|
|
193
|
+
creates the bound task's `workflow` document only if that key is absent; an
|
|
194
|
+
existing workflow key conflicts for inline text. An explicit workflowId adopts the selected prompt as a new revision instead. Later primary-task
|
|
195
|
+
handoffs omit workflow text. The agent-handoff input accepts `initialDocuments` only when
|
|
196
|
+
it creates the first primary task, including for an existing passive case.
|
|
197
|
+
Existing-task handoffs, task binding and `to: "done"` reject initial documents;
|
|
198
|
+
use ordinary task document tools to revise existing work.
|
|
199
|
+
|
|
200
|
+
Save findings, documents, and artifacts before handing off. Include the next
|
|
201
|
+
phase's objective, relevant evidence, remaining work, and any constraints in
|
|
202
|
+
`instructions`. Reuse a stable idempotency key when retrying the same operation;
|
|
203
|
+
different content under that key is a conflict. Reload on a version conflict.
|
|
204
|
+
The source run is provenance; a later run can recover the same principal's receipt.
|
|
205
|
+
|
|
206
|
+
After an accepted self-handoff, end the turn without marking the task done. The
|
|
207
|
+
harness keeps the recipient waiting until your execution and workspace settle.
|
|
208
|
+
`202` means intent accepted; `delivered` means the ordinary wake queue accepted
|
|
209
|
+
it. Neither is proof the recipient ran. Handoff to the same agent is also a new
|
|
210
|
+
phase/turn. Each returning agent may resume its own task session.
|
|
211
|
+
|
|
212
|
+
Separate work uses ordinary task creation plus a case link. It does not replace
|
|
213
|
+
the primary task. Human clarification, specification approval, code review, and
|
|
214
|
+
final approval use existing interactions. A phase called `review` is not a verdict.
|
|
215
|
+
Ordinary task completion leaves case status unchanged. To finish the case as
|
|
216
|
+
part of completing its primary task, hand off to the terminal destination:
|
|
217
|
+
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"idempotencyKey": "launch-finished-1",
|
|
221
|
+
"case": { "id": "<case-uuid>" },
|
|
222
|
+
"to": "done",
|
|
223
|
+
"instructions": "Implementation and verification are complete; saved evidence is in the case documents.",
|
|
224
|
+
"expectedHandoffVersion": 4,
|
|
225
|
+
"expectedIssueStatusVersion": 7
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
This records an intent to close an existing case with a primary task; it does
|
|
230
|
+
not create work, transfer assignment, or satisfy completion criteria. The
|
|
231
|
+
receipt has `callerMustYield: false` and `state: awaiting_completion`. Finish
|
|
232
|
+
the same task normally, including any required review, human answer or approval.
|
|
233
|
+
Once task completion is accepted, its transaction closes the case, sets phase
|
|
234
|
+
`done`, and settles the terminal handoff as `completed`. If the task was already
|
|
235
|
+
done, closing is immediate. Pending review or user input keeps the case open.
|
|
236
|
+
Do not change case status separately. An accepted terminal request survives
|
|
237
|
+
restart; Stop, task cancellation or reassignment cancels it. Cancelling the
|
|
238
|
+
request leaves the task untouched. A replay returns the original receipt.
|
|
239
|
+
|
|
240
|
+
History is at `GET /api/cases/:id/handoffs?limit=20&cursor=...`. Authorized task
|
|
241
|
+
controllers can POST to `/api/cases/:id/handoffs/:handoffId/retry` or `/cancel`.
|
|
242
|
+
Retry delivers the same intent; cancellation never reverses an applied assignment.
|
|
243
|
+
|
|
244
|
+
Cases retain task/project permission boundaries, including copied run output.
|
|
245
|
+
An inaccessible or deleted source cannot be bypassed by unlinking it. For an
|
|
246
|
+
existing private passive case, select an agent who already qualifies for those
|
|
247
|
+
source permissions. Handoff does not grant unrelated task/project access.
|
|
248
|
+
|
|
249
|
+
### Example factory instructions
|
|
250
|
+
|
|
251
|
+
Use the supplied company agent IDs for triage, specification, implementation,
|
|
252
|
+
and verification. Operate on the case's primary task throughout:
|
|
253
|
+
|
|
254
|
+
1. Triage researches the request and saves findings on the case. Clarify material
|
|
255
|
+
ambiguity through the normal question interaction. Park work that should not
|
|
256
|
+
proceed; otherwise hand off to specification or implementation.
|
|
257
|
+
2. Specification saves a revisioned `spec` document and requests normal human
|
|
258
|
+
confirmation. After acceptance, hand the task to implementation.
|
|
259
|
+
3. Implementation builds the approved work, registers artifacts/PR references,
|
|
260
|
+
records checks, and hands the task to verification.
|
|
261
|
+
4. Verification checks the actual result and saves its report. Return concrete
|
|
262
|
+
defects to implementation on the same task. After two unsuccessful correction
|
|
263
|
+
rounds, request human direction rather than starting an unbounded loop.
|
|
264
|
+
5. Follow existing code-review and human-approval requirements before completion
|
|
265
|
+
or shipping. The final agent calls `handoff_case` with `to: "done"`, the
|
|
266
|
+
existing case and current versions, then completes the same task normally.
|
|
267
|
+
Monitoring may create a new case for a new incident.
|
|
268
|
+
|
|
269
|
+
Routing belongs in these instructions. Paperclip does not require a pipeline or
|
|
270
|
+
preconfigured phase graph to execute them.
|
|
271
|
+
|
|
272
|
+
## Read And Search
|
|
273
|
+
|
|
274
|
+
Native runner agents have production case tools in standard work mode
|
|
275
|
+
when cases are enabled:
|
|
276
|
+
|
|
277
|
+
| Tool | Use |
|
|
278
|
+
| --- | --- |
|
|
279
|
+
| `create_case` | Create a case and start its first task with required `kickoff` and either `workflowId` or `workflow_document_text`, plus optional `initialDocuments`. |
|
|
280
|
+
| `read_case` | Read current case facts, fields, versions, document references, or a selected document body. |
|
|
281
|
+
| `update_case` | Change title, summary or fields; fields replaces the entire object. |
|
|
282
|
+
|
|
283
|
+
Omit `caseId` to use the current task's primary workflow case, or pass an
|
|
284
|
+
authorized standalone case UUID. These tools do not operate on pipeline cases.
|
|
285
|
+
`update_case` cannot change status, phase, assignment or access. Use
|
|
286
|
+
`handoff_case` for routing and completion. New documents belong to tasks. Use
|
|
287
|
+
`read_document({key})` and `write_document` for the active task, with its current
|
|
288
|
+
`baseRevisionId` when revising. Case detail includes `taskDocuments` references
|
|
289
|
+
with their owning task and authenticated read path. For a linked task document,
|
|
290
|
+
use `read_case` with `section: "document"`, its `documentKey` and owning
|
|
291
|
+
`documentIssueId`. Omit `documentIssueId` for a historical case-owned document.
|
|
292
|
+
This works when generic API tools are disabled. The selected task must still be
|
|
293
|
+
the primary task or linked to the case, and its current permissions must allow
|
|
294
|
+
the read. The ordinary task document tools operate on the active task;
|
|
295
|
+
`read_case_document` and `write_case_document` are not live tools.
|
|
296
|
+
|
|
297
|
+
For example, read a linked task's research document:
|
|
298
|
+
|
|
299
|
+
```json
|
|
300
|
+
{
|
|
301
|
+
"section": "document",
|
|
302
|
+
"documentKey": "research",
|
|
303
|
+
"documentIssueId": "<task-uuid-from-taskDocuments>"
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
The result uses bounded `readPage.text` JSON pages. Keep the document selector
|
|
308
|
+
and returned `snapshot` on every continuation. Pass
|
|
309
|
+
`offsetBytes: readPage.nextOffsetBytes` until it is null, then concatenate the
|
|
310
|
+
text and parse the selected document JSON. Every page checks current case and
|
|
311
|
+
source-task access. A changed document revision or routing snapshot returns 409;
|
|
312
|
+
restart from offset zero without the old snapshot. Unlinking a source task or
|
|
313
|
+
losing access prevents further reads. System and quarantined documents remain
|
|
314
|
+
unavailable through this path. This operation reads saved data; it does not grant
|
|
315
|
+
new document editing authority or turn document content into system instructions.
|
|
316
|
+
|
|
317
|
+
Writes require `idempotencyKey`. Reuse the key with identical input after a lost
|
|
318
|
+
response in the same admitted run, even if the provider uses a new tool-call ID.
|
|
319
|
+
`update_case` receipts are run-scoped; after a restart into a different run, read
|
|
320
|
+
current state and document revisions before deciding whether another write is
|
|
321
|
+
needed. An uncertain outcome requires inspection rather than blind replay.
|
|
322
|
+
`create_case` and `handoff_case` share the principal-scoped
|
|
323
|
+
handoff replay contract. Kickoff retries do not duplicate tasks or initial
|
|
324
|
+
document revisions. Reuse the original key and exact input to recover the
|
|
325
|
+
accepted kickoff receipt after response loss, including from a later run.
|
|
326
|
+
|
|
327
|
+
The task prompt identifies its primary case, current phase, incoming handoff
|
|
328
|
+
and authenticated read path. Native resumed turns use verified session context
|
|
329
|
+
to send changed case facts and new handoff instructions without repeating
|
|
330
|
+
unchanged facts. Fresh or incompatible sessions receive the full bounded
|
|
331
|
+
snapshot. Persisted session history can still contain earlier snapshots;
|
|
332
|
+
`read_case` and ordinary task document reads provide current authoritative data.
|
|
333
|
+
|
|
334
|
+
Get a case by UUID or identifier:
|
|
335
|
+
|
|
336
|
+
```http
|
|
337
|
+
GET /api/cases/PAP-C42
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
List cases for a company:
|
|
341
|
+
|
|
342
|
+
```http
|
|
343
|
+
GET /api/companies/:companyId/cases?type=blog_post&status=active&q=launch
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Useful filters:
|
|
347
|
+
|
|
348
|
+
- `type`: exact `caseType`
|
|
349
|
+
- `status`: exact lifecycle status, or `active` for non-terminal cases
|
|
350
|
+
- `projectId` / `project`: project UUID
|
|
351
|
+
- `labelId` / `label`: label UUID
|
|
352
|
+
- `q`: identifier, title, summary, or key search
|
|
353
|
+
- `limit`: 1-200, default 100
|
|
354
|
+
|
|
355
|
+
## Task Documents And Legacy Case Documents
|
|
356
|
+
|
|
357
|
+
Use ordinary task documents for new drafts, briefs, reports and plans. Seed them
|
|
358
|
+
through first-task `initialDocuments`, then use native `read_document` and
|
|
359
|
+
`write_document` on the active task. Case detail surfaces their owner and revision
|
|
360
|
+
references; it does not copy their bodies or create a second revision history.
|
|
361
|
+
|
|
362
|
+
The following REST endpoints remain compatible for historical case-owned
|
|
363
|
+
documents. They are not the new-work document workflow:
|
|
364
|
+
|
|
365
|
+
```http
|
|
366
|
+
PUT /api/cases/:caseIdOrIdentifier/documents/body
|
|
367
|
+
Content-Type: application/json
|
|
368
|
+
|
|
369
|
+
{
|
|
370
|
+
"title": "Launch announcement body",
|
|
371
|
+
"format": "markdown",
|
|
372
|
+
"body": "# Launch announcement\n\nDraft copy...",
|
|
373
|
+
"changeSummary": "Initial draft"
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Updating an existing case document requires `baseRevisionId`:
|
|
378
|
+
|
|
379
|
+
```json
|
|
380
|
+
{
|
|
381
|
+
"baseRevisionId": "latest-revision-uuid",
|
|
382
|
+
"body": "Updated body"
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
If you get `409 stale_base_revision`, refetch the case detail, read the latest
|
|
387
|
+
document revision id, merge intentionally, and retry with that `baseRevisionId`.
|
|
388
|
+
|
|
389
|
+
## Fields
|
|
390
|
+
|
|
391
|
+
Each skill owns the schema of `fields` for the `caseType` it creates. Keep fields
|
|
392
|
+
small, typed, and stable enough for other agents to inspect.
|
|
393
|
+
|
|
394
|
+
Examples:
|
|
395
|
+
|
|
396
|
+
```json
|
|
397
|
+
{
|
|
398
|
+
"slug": "launch-announcement",
|
|
399
|
+
"target_audience": "operators",
|
|
400
|
+
"publish_url": "https://example.com/blog/launch-announcement"
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Patch fields or status with:
|
|
405
|
+
|
|
406
|
+
```http
|
|
407
|
+
PATCH /api/cases/:caseIdOrIdentifier
|
|
408
|
+
Content-Type: application/json
|
|
409
|
+
|
|
410
|
+
{
|
|
411
|
+
"status": "in_review",
|
|
412
|
+
"fields": {
|
|
413
|
+
"slug": "launch-announcement",
|
|
414
|
+
"target_audience": "operators",
|
|
415
|
+
"publish_url": "https://example.com/blog/launch-announcement"
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
Remember: `fields` replaces the whole object when present.
|
|
421
|
+
|
|
422
|
+
## Issue Links
|
|
423
|
+
|
|
424
|
+
Link cases to issues explicitly when needed:
|
|
425
|
+
|
|
426
|
+
```http
|
|
427
|
+
POST /api/cases/:caseIdOrIdentifier/links
|
|
428
|
+
Content-Type: application/json
|
|
429
|
+
|
|
430
|
+
{
|
|
431
|
+
"issueId": "issue-uuid",
|
|
432
|
+
"role": "reference"
|
|
433
|
+
}
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
Roles:
|
|
437
|
+
|
|
438
|
+
- `origin`: the issue/run that created the case
|
|
439
|
+
- `work`: an issue/run that changed the case
|
|
440
|
+
- `reference`: related issue context
|
|
441
|
+
|
|
442
|
+
Agent run writes auto-link the run's issue when Paperclip can resolve it from
|
|
443
|
+
the run JWT or `X-Paperclip-Run-Id`. Creation/upsert writes use `origin`; later
|
|
444
|
+
document, patch, and attachment writes use `work` when no link already exists.
|
|
445
|
+
You do not need to manually link the current issue before writing the case.
|
|
446
|
+
|
|
447
|
+
## Child Cases
|
|
448
|
+
|
|
449
|
+
Create child cases by setting `parentCaseId` to the parent case UUID.
|
|
450
|
+
|
|
451
|
+
```json
|
|
452
|
+
{
|
|
453
|
+
"caseType": "image_assets",
|
|
454
|
+
"key": "launch-announcement:hero-images",
|
|
455
|
+
"title": "Hero images for launch announcement",
|
|
456
|
+
"parentCaseId": "parent-case-uuid",
|
|
457
|
+
"fields": {
|
|
458
|
+
"required_assets": ["hero", "social-card"]
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
Use child cases when the output has independently inspectable pieces or when
|
|
464
|
+
another agent can work on a bounded part without editing the parent case body.
|
|
465
|
+
|
|
466
|
+
## Attachments
|
|
467
|
+
|
|
468
|
+
Attach generated files with multipart form data:
|
|
469
|
+
|
|
470
|
+
```http
|
|
471
|
+
POST /api/cases/:caseIdOrIdentifier/attachments
|
|
472
|
+
Content-Type: multipart/form-data
|
|
473
|
+
|
|
474
|
+
file=@hero.png
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
The server records an asset and adds an `attachment_added` case event.
|
|
478
|
+
|
|
479
|
+
## Lifecycle
|
|
480
|
+
|
|
481
|
+
Use the lifecycle consistently:
|
|
482
|
+
|
|
483
|
+
- `draft`: case exists but useful work has not started
|
|
484
|
+
- `in_progress`: an agent is actively producing or revising it
|
|
485
|
+
- `in_review`: ready for reviewer, board, or downstream approval
|
|
486
|
+
- `approved`: accepted but not finally shipped or archived
|
|
487
|
+
- `done`: complete and no further action remains
|
|
488
|
+
- `cancelled`: intentionally abandoned
|
|
489
|
+
|
|
490
|
+
Terminal statuses are `done` and `cancelled`; setting either records
|
|
491
|
+
`completedAt`. Moving back to a non-terminal status clears `completedAt`.
|
|
492
|
+
|
|
493
|
+
## Worked Blog Post Example
|
|
494
|
+
|
|
495
|
+
Create or upsert the parent blog post:
|
|
496
|
+
|
|
497
|
+
```http
|
|
498
|
+
POST /api/companies/:companyId/cases
|
|
499
|
+
Content-Type: application/json
|
|
500
|
+
|
|
501
|
+
{
|
|
502
|
+
"caseType": "blog_post",
|
|
503
|
+
"key": "paperclip-cases-launch",
|
|
504
|
+
"title": "Introducing Paperclip Cases",
|
|
505
|
+
"summary": "Blog post explaining the cases surface for agent outputs.",
|
|
506
|
+
"status": "in_progress",
|
|
507
|
+
"fields": {
|
|
508
|
+
"slug": "paperclip-cases-launch",
|
|
509
|
+
"target_audience": "AI company operators",
|
|
510
|
+
"publish_url": null
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
Start drafting on the case's first task and seed its body document:
|
|
516
|
+
|
|
517
|
+
```json
|
|
518
|
+
{
|
|
519
|
+
"idempotencyKey": "paperclip-cases-launch-draft",
|
|
520
|
+
"case": {"id": "<blog-case-uuid>"},
|
|
521
|
+
"expectedHandoffVersion": 0,
|
|
522
|
+
"toAgentId": "<writer-agent-uuid>",
|
|
523
|
+
"phase": "draft",
|
|
524
|
+
"instructions": "Finish the draft on this same task, then hand it to editorial review.",
|
|
525
|
+
"initialDocuments": [{"key":"body","title":"Introducing Paperclip Cases","body":"# Introducing Paperclip Cases\n\n..."}]
|
|
526
|
+
}
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
Send this input to `handoff_case`. The writer uses ordinary task document tools
|
|
530
|
+
for subsequent revisions; the case page rolls up that same document.
|
|
531
|
+
|
|
532
|
+
Create the child image-assets case:
|
|
533
|
+
|
|
534
|
+
```http
|
|
535
|
+
POST /api/companies/:companyId/cases
|
|
536
|
+
Content-Type: application/json
|
|
537
|
+
|
|
538
|
+
{
|
|
539
|
+
"caseType": "image_assets",
|
|
540
|
+
"key": "paperclip-cases-launch:image-assets",
|
|
541
|
+
"title": "Image assets for Introducing Paperclip Cases",
|
|
542
|
+
"parentCaseId": "parent-case-uuid",
|
|
543
|
+
"status": "in_progress",
|
|
544
|
+
"fields": {
|
|
545
|
+
"slug": "paperclip-cases-launch",
|
|
546
|
+
"required_assets": ["hero", "social-card"],
|
|
547
|
+
"publish_url": null
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
Attach generated assets to the child, then patch both cases as they move through
|
|
553
|
+
review:
|
|
554
|
+
|
|
555
|
+
```http
|
|
556
|
+
PATCH /api/cases/PAP-C42
|
|
557
|
+
Content-Type: application/json
|
|
558
|
+
|
|
559
|
+
{
|
|
560
|
+
"status": "in_review",
|
|
561
|
+
"fields": {
|
|
562
|
+
"slug": "paperclip-cases-launch",
|
|
563
|
+
"target_audience": "AI company operators",
|
|
564
|
+
"publish_url": "https://example.com/blog/paperclip-cases-launch"
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
If the same skill retries the example with the same keys, it updates the parent
|
|
570
|
+
and child cases rather than creating duplicates.
|