@markjaquith/agency 3.2.2 → 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -62
- package/cli-main.ts +20 -83
- package/fixtures/protocol/orchestration-recipes.json +9 -34
- package/package.json +1 -4
- package/schemas/agency-graph-v1.schema.json +2 -31
- package/src/cli-parser.test.ts +34 -132
- package/src/cli-parser.ts +45 -102
- package/src/cli.test.ts +60 -117
- package/src/commands/act.ts +2 -6
- package/src/commands/sync.ts +3 -3
- package/src/commands/validate.ts +3 -1
- package/src/commands/work.test.ts +70 -8
- package/src/commands/work.ts +15 -8
- package/src/graph-schema.ts +0 -2
- package/src/protocol.test.ts +0 -25
- package/src/protocol.ts +0 -11
- package/src/readiness.test.ts +2 -2
- package/src/services/ArchiveBulkService.test.ts +0 -88
- package/src/services/ArchiveService.ts +0 -32
- package/src/services/GraphMutationService.ts +0 -26
- package/src/services/GraphService.test.ts +1 -1
- package/src/services/IntegrationService.test.ts +7 -4
- package/src/services/LifecycleTransaction.ts +5 -1
- package/src/services/PhaseService.ts +1 -8
- package/src/services/ReadinessService.test.ts +0 -34
- package/src/services/ReadinessService.ts +1 -20
- package/src/services/ReviewService.test.ts +0 -64
- package/src/services/ReviewService.ts +0 -5
- package/src/services/SyncService.test.ts +75 -88
- package/src/services/SyncService.ts +52 -123
- package/src/services/TaskPhaseService.test.ts +13 -1
- package/src/services/TaskService.ts +1 -7
- package/src/services/WorkbaseService.ts +0 -3
- package/src/services/WorktreeService.test.ts +192 -1
- package/src/services/WorktreeService.ts +169 -34
- package/src/test-utils.ts +0 -2
- package/src/usage-log.test.ts +89 -5
- package/src/usage-log.ts +139 -31
- package/src/workbase/AGENTS.md +9 -15
- package/src/workbase/agent-command.test.ts +1 -3
- package/src/workbase/agent-command.ts +1 -6
- package/src/workbase/document-revision.ts +0 -4
- package/src/workbase/opencode-plugin-file.ts +1 -0
- package/src/workbase/schemas.test.ts +12 -25
- package/src/workbase/schemas.ts +0 -16
- package/src/commands/claim.ts +0 -122
- package/src/services/ClaimService.test.ts +0 -415
- package/src/services/ClaimService.ts +0 -608
package/README.md
CHANGED
|
@@ -26,14 +26,20 @@ Agency records privacy-safe CLI usage events locally so command journeys,
|
|
|
26
26
|
failures, and flag adoption can be analyzed. Events are stored in SQLite at
|
|
27
27
|
`$XDG_STATE_HOME/agency/usage.sqlite3` (or
|
|
28
28
|
`~/.local/state/agency/usage.sqlite3`) and retained for 90 days by default.
|
|
29
|
-
Each event contains the
|
|
30
|
-
Agency version,
|
|
29
|
+
Each event contains the parser-derived command and subcommand path, flag names,
|
|
30
|
+
timing, a bounded outcome code, Agency version, invocation source, explicit test
|
|
31
|
+
attribution, and ordered journey correlation. Journey IDs are one-way hashes of
|
|
32
|
+
`AGENCY_SESSION_ID`; raw session IDs, positional arguments, entity IDs, paths,
|
|
31
33
|
flag values, free-form input, and the current directory are never recorded.
|
|
32
34
|
|
|
33
35
|
Export events as JSON Lines with `agency usage export`. Set
|
|
34
36
|
`AGENCY_NO_USAGE_LOG=1` to opt out, `AGENCY_USAGE_RETENTION_DAYS` to change
|
|
35
|
-
retention, or `AGENCY_USAGE_DB` to select a different database path.
|
|
36
|
-
|
|
37
|
+
retention, or `AGENCY_USAGE_DB` to select a different database path. Expired
|
|
38
|
+
events are pruned on every read and write. Set `AGENCY_INVOCATION_SOURCE` to one
|
|
39
|
+
of `human`, `agent`, or `automation`, and set `AGENCY_USAGE_TEST=1` for explicit
|
|
40
|
+
test attribution. Logging is best effort and never changes command output or
|
|
41
|
+
exit behavior. Databases created by versions before this privacy boundary are
|
|
42
|
+
cleared because their command paths may contain positional values.
|
|
37
43
|
|
|
38
44
|
## Core Model
|
|
39
45
|
|
|
@@ -336,19 +342,18 @@ Custom agents are direct argv commands, never shell snippets:
|
|
|
336
342
|
```
|
|
337
343
|
|
|
338
344
|
Available placeholders are `{prompt}`, `{workbase}`, `{target}`, `{task}`,
|
|
339
|
-
`{phase}`,
|
|
345
|
+
`{phase}`, and `{sessionId}`. Task and phase
|
|
340
346
|
placeholders are empty when they do not apply. `{prompt}` is empty unless
|
|
341
347
|
`--auto` is set. If `resumeCommand` is omitted, the fresh command is also used
|
|
342
348
|
for resumed sessions. If `autoResumeCommand` is omitted, `autoCommand` is used;
|
|
343
349
|
configured agents without `autoCommand` reject `--auto`.
|
|
344
350
|
|
|
345
|
-
Every agent receives the same `AGENCY_AGENT`, `
|
|
346
|
-
`
|
|
351
|
+
Every agent receives the same `AGENCY_AGENT`, `AGENCY_SESSION_ID`,
|
|
352
|
+
`AGENCY_WORKBASE`, `AGENCY_TARGET`,
|
|
347
353
|
`AGENCY_TASK_ID`, `AGENCY_PHASE_ID`, and `AGENCY_PROMPT` environment. Configured
|
|
348
354
|
environment is added without overriding these normalized values.
|
|
349
355
|
Execution-unit agents also receive `AGENCY_WRITABLE_CHECKOUT` with the
|
|
350
356
|
authoritative writable checkout path.
|
|
351
|
-
`AGENCY_CLAIM_REVISION` is empty for local `agency work` launches.
|
|
352
357
|
`AGENCY_PROMPT` is empty unless `--auto` is set.
|
|
353
358
|
Autonomous prompts begin `Agency worker launch target: <target>.`, carrying the
|
|
354
359
|
same canonical target as `AGENCY_TARGET`. This is the process-local fallback for
|
|
@@ -624,8 +629,8 @@ untargeted `agency pr` invocations leave command semantics to `gh`.
|
|
|
624
629
|
|
|
625
630
|
`agency sync` first compares portable repository declarations with local
|
|
626
631
|
materializations, then compares every execution declaration with local branch
|
|
627
|
-
and worktree registration, checkout dirtiness, resolved reference commits,
|
|
628
|
-
|
|
632
|
+
and worktree registration, checkout dirtiness, resolved reference commits, and
|
|
633
|
+
pull request state, merge state, and mergeability. It reports
|
|
629
634
|
structured `changes`, `warnings`, `unresolved`, and per-execution evidence. The
|
|
630
635
|
default mode applies safe reconciliation transitions; `--dry-run` is explicitly
|
|
631
636
|
observational.
|
|
@@ -639,13 +644,12 @@ phase. Scoped sync does not query, materialize, or reconcile unrelated work.
|
|
|
639
644
|
- materialize declared but missing repositories from their canonical remotes;
|
|
640
645
|
- adopt legacy materializations only when they have an unambiguous portable origin;
|
|
641
646
|
- materialize missing checkouts when no registration, branch, or path conflicts;
|
|
642
|
-
- release an active claim only after its declared expiry has passed;
|
|
643
647
|
- record or refresh a single PR whose head and base match the declaration; and
|
|
644
|
-
- mark work done after its authoritative PR is merged
|
|
648
|
+
- mark work done after its authoritative PR is merged.
|
|
645
649
|
|
|
646
650
|
Apply never overwrites linked or invalid repositories, repairs remote drift,
|
|
647
651
|
modifies dirty checkouts, moves worktrees, switches branches, resets reference
|
|
648
|
-
commits, chooses among conflicting remotes or PRs
|
|
652
|
+
commits, or chooses among conflicting remotes or PRs.
|
|
649
653
|
Those conditions remain visible in `warnings` or `unresolved` with a suggested
|
|
650
654
|
action.
|
|
651
655
|
|
|
@@ -836,8 +840,8 @@ fork pull requests exposed through that ref. Review workspaces contain one
|
|
|
836
840
|
detached checkout and no writable branch. Source movement is observed separately
|
|
837
841
|
from the pin and applied only by `review refresh`; sync, doctor, work, cleanup,
|
|
838
842
|
and archive never move the pin implicitly. Dirty or structurally unexpected
|
|
839
|
-
review checkouts block refresh and cleanup. Review tasks support normal status
|
|
840
|
-
|
|
843
|
+
review checkouts block refresh and cleanup. Review tasks support the normal status
|
|
844
|
+
lifecycle, but reject phase conversion and delivery PR operations.
|
|
841
845
|
Each active or archived review task owns one internal task-scoped pin ref. A
|
|
842
846
|
refresh advances that ref transactionally; failed creation removes it. Archiving
|
|
843
847
|
retains the pin so a deleted source can still be restored and inspected.
|
|
@@ -926,23 +930,20 @@ writing anything.
|
|
|
926
930
|
|
|
927
931
|
Single-phase tasks and phases store status in YAML. New execution units start
|
|
928
932
|
`open`, and `agency work` marks the selected execution unit `working` immediately
|
|
929
|
-
before launch. Running `agency work` again can relaunch
|
|
933
|
+
before launch. Running `agency work` again can relaunch `working` work.
|
|
930
934
|
By default, `done` requires an authoritative merged pull request and is applied
|
|
931
935
|
by `agency sync`. Work whose intended outcome genuinely requires no pull
|
|
932
936
|
request may instead use an explicit `--no-pull-request --summary <text>` status
|
|
933
937
|
transition. Agency records the summary, completion time, and optional evidence
|
|
934
938
|
URL durably; reopening removes that evidence. This exceptional path refuses work
|
|
935
939
|
that already has a recorded pull request.
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
or assigned a terminal outcome. Done and dropped work are terminal and may only
|
|
940
|
+
The interactive work selector displays status markers before execution units.
|
|
941
|
+
Existing working and delegated work may be returned to `open` or assigned a
|
|
942
|
+
terminal outcome. Done and dropped work are terminal and may only
|
|
940
943
|
remain unchanged or transition to open; reopen terminal work before changing its
|
|
941
944
|
outcome.
|
|
942
945
|
|
|
943
946
|
`delegated` remains readable for existing workbases but cannot be newly assigned.
|
|
944
|
-
Delegation is now explicit: the claimant identifies the orchestrator and the
|
|
945
|
-
agent identifies the assigned agent.
|
|
946
947
|
|
|
947
948
|
Human list output is a compact table with lifecycle, readiness, parent,
|
|
948
949
|
repository, branch, recorded PR, and worktree state where applicable. List and
|
|
@@ -951,37 +952,6 @@ filters, plus `--ready`, `--blocked`, `--pr`, and `--no-pr`. Status and reposito
|
|
|
951
952
|
filters are repeatable. Rows follow task and phase declaration order; plain text
|
|
952
953
|
labels remain complete without color or icon fonts.
|
|
953
954
|
|
|
954
|
-
### Claims
|
|
955
|
-
|
|
956
|
-
Claim mutations require the SHA-256 revision exposed by `agency context` or
|
|
957
|
-
`agency graph`. Every operation compares that revision while holding an exclusive
|
|
958
|
-
document lock and atomically replaces the execution document.
|
|
959
|
-
|
|
960
|
-
```text
|
|
961
|
-
agency claim <task-id> [phase-id] --claimant <id> --agent <id>
|
|
962
|
-
--session-id <id> --revision <sha256> [--expires-at <timestamp>] [--json]
|
|
963
|
-
agency release <task-id> [phase-id] --session-id <id>
|
|
964
|
-
--revision <sha256> [--json]
|
|
965
|
-
agency finish <task-id> [phase-id] --session-id <id>
|
|
966
|
-
--revision <sha256> --outcome <done|dropped>
|
|
967
|
-
[--no-pull-request --summary <text> [--evidence-url <url>]] [--json]
|
|
968
|
-
```
|
|
969
|
-
|
|
970
|
-
An active claim sets status to `working`. Release returns it to `open`. Finish
|
|
971
|
-
records the claim outcome and ownership history; a `done` claim outcome leaves
|
|
972
|
-
the execution unit `working` until its pull request is merged, while `dropped`
|
|
973
|
-
remains terminal. For a genuine non-PR outcome, `--no-pull-request` atomically
|
|
974
|
-
records completion evidence, finishes the claim, and sets the execution unit to
|
|
975
|
-
`done`; `--summary` is required and `--evidence-url` is optional. Conflicts return
|
|
976
|
-
the current revision and complete ownership record in the machine error envelope
|
|
977
|
-
rather than overwriting it. Expired claims may be replaced with a
|
|
978
|
-
revision-guarded claim.
|
|
979
|
-
|
|
980
|
-
`agency work` does not claim execution units. It refuses active explicit claims,
|
|
981
|
-
marks open execution work `working`, and launches the agent. External
|
|
982
|
-
orchestrators use `agency claim`, launch and monitor their agent separately, and
|
|
983
|
-
later call `agency release` or `agency finish`.
|
|
984
|
-
|
|
985
955
|
### Archive
|
|
986
956
|
|
|
987
957
|
```text
|
|
@@ -1012,8 +982,8 @@ default; `--dry-run` performs the same preflight without mutation. A dependency
|
|
|
1012
982
|
is work required by a candidate, while a dependent is work that requires the
|
|
1013
983
|
candidate. Dependencies within the selected cohort can be archived together,
|
|
1014
984
|
but a retained dependent excludes its dependency, including exclusions that
|
|
1015
|
-
propagate through a dependency chain.
|
|
1016
|
-
|
|
985
|
+
propagate through a dependency chain. Dirty or otherwise unsafe managed
|
|
986
|
+
checkouts and occupied archive destinations are reported as per-task
|
|
1017
987
|
skips. Invalid workbase structure and infrastructure failures abort the command.
|
|
1018
988
|
|
|
1019
989
|
Task and phase archiving update active parent documents. Agency removes
|
|
@@ -1047,7 +1017,8 @@ promptless by default; use `--auto` to send Agency's generated context prompt.
|
|
|
1047
1017
|
|
|
1048
1018
|
`agency work prepare` resolves an execution unit and creates or reuses its
|
|
1049
1019
|
writable and reference worktrees, or its single pinned review checkout, without
|
|
1050
|
-
launching an agent or changing status.
|
|
1020
|
+
launching an agent or changing status. Its target may be a task ID or any path
|
|
1021
|
+
inside the task or phase, including its `TASK.md` or `PHASE.md` document.
|
|
1051
1022
|
Managed workbase guidance provides exact fast paths for 15 common intents:
|
|
1052
1023
|
single-phase creation; create-and-start; materialization; remote PR sync; phase
|
|
1053
1024
|
conversion; archive; review creation and start; status inspection; drop;
|
|
@@ -1065,8 +1036,8 @@ either. Use `--dry-run` to report planned fetch, branch, and worktree changes
|
|
|
1065
1036
|
without applying them. Use `--force` to prepare work blocked by readiness, such
|
|
1066
1037
|
as a follow-on phase whose dependency is still active; preparation still does
|
|
1067
1038
|
not launch an agent or change lifecycle status. Validation reuse never skips
|
|
1068
|
-
readiness,
|
|
1069
|
-
|
|
1039
|
+
readiness, repository, ownership, reference-drift, dirty-workspace, or worktree
|
|
1040
|
+
safety checks.
|
|
1070
1041
|
|
|
1071
1042
|
The authoritative implementation locations for this contract are
|
|
1072
1043
|
`src/commands/task.ts` (creation output),
|
|
@@ -1193,10 +1164,7 @@ recovery action. Version 1 defines these codes:
|
|
|
1193
1164
|
| `EPIC_ERROR` | Epic operation failed |
|
|
1194
1165
|
| `TASK_ERROR` | Task operation failed |
|
|
1195
1166
|
| `PHASE_ERROR` | Phase operation failed |
|
|
1196
|
-
| `CLAIM_ERROR` | Claim input or lifecycle state is invalid |
|
|
1197
|
-
| `CLAIM_CONFLICT` | Active or legacy ownership conflicts with an operation |
|
|
1198
1167
|
| `REVISION_CONFLICT` | A durable document changed since inspection |
|
|
1199
|
-
| `CLAIM_OWNERSHIP` | The session does not own the active claim |
|
|
1200
1168
|
| `ARCHIVE_ERROR` | Archive operation failed |
|
|
1201
1169
|
| `WORKTREE_ERROR` | Worktree operation failed |
|
|
1202
1170
|
| `PULL_REQUEST_ERROR` | Pull request operation failed |
|
|
@@ -1219,7 +1187,7 @@ Success, help, and version output exit `0`; usage and command failures exit `1`.
|
|
|
1219
1187
|
There are no error-specific exit statuses. `graph --jsonl` streams versioned
|
|
1220
1188
|
records on success instead of wrapping them in an envelope; JSONL failures still
|
|
1221
1189
|
use one error envelope. Revision and concurrency behavior is documented under
|
|
1222
|
-
Tasks
|
|
1190
|
+
Tasks and Phases; selector behavior under Noninteractive Use; projection
|
|
1223
1191
|
behavior under Target Context and Workbase Graph; and retry behavior in the
|
|
1224
1192
|
machine error contract above.
|
|
1225
1193
|
|
package/cli-main.ts
CHANGED
|
@@ -40,7 +40,6 @@ import { ArchiveService } from "./src/services/ArchiveService"
|
|
|
40
40
|
import { IntegrationService } from "./src/services/IntegrationService"
|
|
41
41
|
import { ContextService } from "./src/services/ContextService"
|
|
42
42
|
import { GraphService } from "./src/services/GraphService"
|
|
43
|
-
import { ClaimService } from "./src/services/ClaimService"
|
|
44
43
|
import { SyncService } from "./src/services/SyncService"
|
|
45
44
|
import { ReadinessService } from "./src/services/ReadinessService"
|
|
46
45
|
import { GraphMutationService } from "./src/services/GraphMutationService"
|
|
@@ -52,19 +51,17 @@ import {
|
|
|
52
51
|
} from "./src/services/VersionControlService"
|
|
53
52
|
import { review, help as reviewHelp } from "./src/commands/review"
|
|
54
53
|
import { act, help as actHelp } from "./src/commands/act"
|
|
55
|
-
import {
|
|
56
|
-
claimCommand,
|
|
57
|
-
claimHelp,
|
|
58
|
-
releaseHelp,
|
|
59
|
-
finishHelp,
|
|
60
|
-
} from "./src/commands/claim"
|
|
61
54
|
import {
|
|
62
55
|
collectCommandResult,
|
|
63
56
|
errorEnvelope,
|
|
64
57
|
successEnvelope,
|
|
65
58
|
writeEnvelope,
|
|
66
59
|
} from "./src/protocol"
|
|
67
|
-
import {
|
|
60
|
+
import {
|
|
61
|
+
exportUsageEvents,
|
|
62
|
+
recordUsageEvent,
|
|
63
|
+
usageOutcomeCode,
|
|
64
|
+
} from "./src/usage-log"
|
|
68
65
|
|
|
69
66
|
// Create CLI layer with all services
|
|
70
67
|
const CliLayer = Layer.mergeAll(
|
|
@@ -83,7 +80,6 @@ const CliLayer = Layer.mergeAll(
|
|
|
83
80
|
IntegrationService.Default,
|
|
84
81
|
ContextService.Default,
|
|
85
82
|
GraphService.Default,
|
|
86
|
-
ClaimService.Default,
|
|
87
83
|
SyncService.Default,
|
|
88
84
|
ReadinessService.Default,
|
|
89
85
|
GraphMutationService.Default,
|
|
@@ -199,67 +195,6 @@ const commands: Record<string, Command> = {
|
|
|
199
195
|
)
|
|
200
196
|
},
|
|
201
197
|
},
|
|
202
|
-
claim: {
|
|
203
|
-
run: async (args: string[], options: Record<string, any>) => {
|
|
204
|
-
if (options.help) return console.log(claimHelp)
|
|
205
|
-
await runCommand(
|
|
206
|
-
claimCommand({
|
|
207
|
-
operation: "claim",
|
|
208
|
-
taskId: args[0],
|
|
209
|
-
phaseId: args[1],
|
|
210
|
-
claimant: options.claimant,
|
|
211
|
-
agent: options.agent,
|
|
212
|
-
sessionId: options["session-id"],
|
|
213
|
-
revision: options.revision,
|
|
214
|
-
expiresAt: options["expires-at"],
|
|
215
|
-
json: options.json,
|
|
216
|
-
silent: options.silent,
|
|
217
|
-
verbose: options.verbose,
|
|
218
|
-
cwd: options.cwd,
|
|
219
|
-
}),
|
|
220
|
-
)
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
release: {
|
|
224
|
-
run: async (args: string[], options: Record<string, any>) => {
|
|
225
|
-
if (options.help) return console.log(releaseHelp)
|
|
226
|
-
await runCommand(
|
|
227
|
-
claimCommand({
|
|
228
|
-
operation: "release",
|
|
229
|
-
taskId: args[0],
|
|
230
|
-
phaseId: args[1],
|
|
231
|
-
sessionId: options["session-id"],
|
|
232
|
-
revision: options.revision,
|
|
233
|
-
json: options.json,
|
|
234
|
-
silent: options.silent,
|
|
235
|
-
verbose: options.verbose,
|
|
236
|
-
cwd: options.cwd,
|
|
237
|
-
}),
|
|
238
|
-
)
|
|
239
|
-
},
|
|
240
|
-
},
|
|
241
|
-
finish: {
|
|
242
|
-
run: async (args: string[], options: Record<string, any>) => {
|
|
243
|
-
if (options.help) return console.log(finishHelp)
|
|
244
|
-
await runCommand(
|
|
245
|
-
claimCommand({
|
|
246
|
-
operation: "finish",
|
|
247
|
-
taskId: args[0],
|
|
248
|
-
phaseId: args[1],
|
|
249
|
-
sessionId: options["session-id"],
|
|
250
|
-
revision: options.revision,
|
|
251
|
-
outcome: options.outcome,
|
|
252
|
-
noPullRequest: options["no-pull-request"],
|
|
253
|
-
summary: options.summary,
|
|
254
|
-
evidenceUrl: options["evidence-url"],
|
|
255
|
-
json: options.json,
|
|
256
|
-
silent: options.silent,
|
|
257
|
-
verbose: options.verbose,
|
|
258
|
-
cwd: options.cwd,
|
|
259
|
-
}),
|
|
260
|
-
)
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
198
|
init: {
|
|
264
199
|
run: async (args: string[], options: Record<string, any>) => {
|
|
265
200
|
if (options.help) {
|
|
@@ -779,9 +714,6 @@ Commands:
|
|
|
779
714
|
usage export Export local usage events as JSON Lines
|
|
780
715
|
epic <subcommand> Manage epics
|
|
781
716
|
phase <subcommand> Manage task phases
|
|
782
|
-
claim <task> [phase] Claim an execution unit
|
|
783
|
-
release <task> [phase] Release an execution unit
|
|
784
|
-
finish <task> [phase] Finish an execution unit
|
|
785
717
|
archive <type> Archive a work item
|
|
786
718
|
task <subcommand> Manage tasks
|
|
787
719
|
work [directory|task] Work on an epic, task, or phase
|
|
@@ -824,9 +756,7 @@ const machineMode = process.argv
|
|
|
824
756
|
const invocationStartedAt = performance.now()
|
|
825
757
|
const rawArguments = process.argv.slice(2)
|
|
826
758
|
let usageCommandPath = "invalid"
|
|
827
|
-
let usageFlagNames =
|
|
828
|
-
.filter((argument) => argument.startsWith("--"))
|
|
829
|
-
.map((argument) => argument.slice(2).split("=", 1)[0]!)
|
|
759
|
+
let usageFlagNames: string[] = []
|
|
830
760
|
|
|
831
761
|
const pushUsageDetails = (error?: unknown) => {
|
|
832
762
|
if (usageCommandPath !== "push") return {}
|
|
@@ -867,17 +797,12 @@ const pushUsageDetails = (error?: unknown) => {
|
|
|
867
797
|
try {
|
|
868
798
|
const {
|
|
869
799
|
commandName,
|
|
800
|
+
commandPath,
|
|
870
801
|
args: commandArgs,
|
|
871
802
|
passthrough,
|
|
872
803
|
values,
|
|
873
804
|
} = parseCli(rawArguments)
|
|
874
|
-
usageCommandPath =
|
|
875
|
-
[commandName, commandArgs[0]]
|
|
876
|
-
.filter(
|
|
877
|
-
(part): part is string =>
|
|
878
|
-
typeof part === "string" && part.length > 0 && !part.startsWith("-"),
|
|
879
|
-
)
|
|
880
|
-
.join("/") || "root"
|
|
805
|
+
usageCommandPath = commandPath
|
|
881
806
|
usageFlagNames = Object.entries(values)
|
|
882
807
|
.filter(([, value]) => value !== undefined && value !== false)
|
|
883
808
|
.map(([name]) => name)
|
|
@@ -895,6 +820,7 @@ try {
|
|
|
895
820
|
flagNames: usageFlagNames,
|
|
896
821
|
durationMs: performance.now() - invocationStartedAt,
|
|
897
822
|
outcome: "success",
|
|
823
|
+
outcomeCode: "SUCCESS",
|
|
898
824
|
exitStatus: 0,
|
|
899
825
|
},
|
|
900
826
|
VERSION,
|
|
@@ -913,6 +839,7 @@ try {
|
|
|
913
839
|
flagNames: usageFlagNames,
|
|
914
840
|
durationMs: performance.now() - invocationStartedAt,
|
|
915
841
|
outcome: exitStatus === 0 ? "success" : "failure",
|
|
842
|
+
outcomeCode: exitStatus === 0 ? "SUCCESS" : "NONZERO_EXIT",
|
|
916
843
|
exitStatus,
|
|
917
844
|
},
|
|
918
845
|
VERSION,
|
|
@@ -956,18 +883,28 @@ try {
|
|
|
956
883
|
flagNames: usageFlagNames,
|
|
957
884
|
durationMs: performance.now() - invocationStartedAt,
|
|
958
885
|
outcome: exitStatus === 0 ? "success" : "failure",
|
|
886
|
+
outcomeCode: exitStatus === 0 ? "SUCCESS" : "NONZERO_EXIT",
|
|
959
887
|
exitStatus,
|
|
960
888
|
...pushUsageDetails(),
|
|
961
889
|
},
|
|
962
890
|
VERSION,
|
|
963
891
|
)
|
|
964
892
|
} catch (error) {
|
|
893
|
+
if (
|
|
894
|
+
typeof error === "object" &&
|
|
895
|
+
error !== null &&
|
|
896
|
+
"commandPath" in error &&
|
|
897
|
+
typeof error.commandPath === "string"
|
|
898
|
+
) {
|
|
899
|
+
usageCommandPath = error.commandPath
|
|
900
|
+
}
|
|
965
901
|
await recordUsageEvent(
|
|
966
902
|
{
|
|
967
903
|
commandPath: usageCommandPath,
|
|
968
904
|
flagNames: usageFlagNames,
|
|
969
905
|
durationMs: performance.now() - invocationStartedAt,
|
|
970
906
|
outcome: "failure",
|
|
907
|
+
outcomeCode: usageOutcomeCode(error),
|
|
971
908
|
exitStatus: 1,
|
|
972
909
|
...pushUsageDetails(error),
|
|
973
910
|
},
|
|
@@ -22,20 +22,6 @@
|
|
|
22
22
|
"agency",
|
|
23
23
|
"--json"
|
|
24
24
|
],
|
|
25
|
-
[
|
|
26
|
-
"claim",
|
|
27
|
-
"checkout",
|
|
28
|
-
"ui",
|
|
29
|
-
"--claimant",
|
|
30
|
-
"orchestrator-1",
|
|
31
|
-
"--agent",
|
|
32
|
-
"opencode",
|
|
33
|
-
"--session-id",
|
|
34
|
-
"session-123",
|
|
35
|
-
"--revision",
|
|
36
|
-
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
37
|
-
"--json"
|
|
38
|
-
],
|
|
39
25
|
[
|
|
40
26
|
"work",
|
|
41
27
|
"prepare",
|
|
@@ -50,29 +36,18 @@
|
|
|
50
36
|
["work", "tasks/checkout/phases/ui", "--agent", "opencode"],
|
|
51
37
|
["sync", "--dry-run", "--json"],
|
|
52
38
|
["sync", "--json"],
|
|
53
|
-
["pr", "create", "checkout", "ui", "--json"],
|
|
54
39
|
[
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"--session-id",
|
|
59
|
-
"session-123",
|
|
60
|
-
"--revision",
|
|
61
|
-
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
62
|
-
"--outcome",
|
|
40
|
+
"task",
|
|
41
|
+
"status",
|
|
42
|
+
"implement-checkout",
|
|
63
43
|
"done",
|
|
44
|
+
"--no-pull-request",
|
|
45
|
+
"--summary",
|
|
46
|
+
"Completed without a pull request",
|
|
64
47
|
"--json"
|
|
65
48
|
],
|
|
49
|
+
["pr", "create", "checkout", "ui", "--json"],
|
|
50
|
+
["sync", "checkout", "ui", "--json"],
|
|
66
51
|
["doctor", "--json"],
|
|
67
|
-
["worktree", "repair", "checkout", "ui", "--dry-run", "--json"]
|
|
68
|
-
[
|
|
69
|
-
"release",
|
|
70
|
-
"checkout",
|
|
71
|
-
"ui",
|
|
72
|
-
"--session-id",
|
|
73
|
-
"session-123",
|
|
74
|
-
"--revision",
|
|
75
|
-
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
76
|
-
"--json"
|
|
77
|
-
]
|
|
52
|
+
["worktree", "repair", "checkout", "ui", "--dry-run", "--json"]
|
|
78
53
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markjaquith/agency",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"description": "Manage agentic work across repositories with durable workbases",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -67,7 +67,6 @@
|
|
|
67
67
|
"preuninstall": "bun scripts/install-pi-extension.ts uninstall",
|
|
68
68
|
"benchmark:act": "bun scripts/benchmark-act.ts",
|
|
69
69
|
"benchmark:pr": "bun scripts/benchmark-pr.ts",
|
|
70
|
-
"benchmark:release": "bun scripts/benchmark-release.ts",
|
|
71
70
|
"benchmark:repositories": "bun scripts/benchmark-repositories.ts",
|
|
72
71
|
"benchmark:status": "bun scripts/benchmark-status.ts",
|
|
73
72
|
"benchmark:next": "bun scripts/benchmark-next.ts",
|
|
@@ -76,8 +75,6 @@
|
|
|
76
75
|
"benchmark:workbase": "bun scripts/benchmark-workbase.ts",
|
|
77
76
|
"benchmark:doctor": "bun scripts/benchmark-doctor.ts",
|
|
78
77
|
"benchmark:context": "bun scripts/benchmark-context.ts",
|
|
79
|
-
"benchmark:claim": "bun scripts/benchmark-claim.ts",
|
|
80
|
-
"benchmark:finish": "bun scripts/benchmark-finish.ts",
|
|
81
78
|
"benchmark:epic": "bun scripts/benchmark-epic.ts",
|
|
82
79
|
"benchmark:phase": "bun scripts/benchmark-phase.ts",
|
|
83
80
|
"benchmark:graph": "bun scripts/benchmark-graph.ts",
|
|
@@ -344,7 +344,6 @@
|
|
|
344
344
|
"base": { "type": "string" },
|
|
345
345
|
"pr": { "type": ["string", "null"] },
|
|
346
346
|
"status": { "$ref": "#/$defs/status" },
|
|
347
|
-
"claim": { "$ref": "#/$defs/claim" },
|
|
348
347
|
"sha256": { "type": "string" }
|
|
349
348
|
}
|
|
350
349
|
},
|
|
@@ -424,7 +423,6 @@
|
|
|
424
423
|
"handoff": { "$ref": "#/$defs/taskHandoff" },
|
|
425
424
|
"review": { "$ref": "#/$defs/reviewRecord" },
|
|
426
425
|
"status": { "$ref": "#/$defs/status" },
|
|
427
|
-
"claim": { "$ref": "#/$defs/claim" },
|
|
428
426
|
"sha256": { "type": "string" }
|
|
429
427
|
}
|
|
430
428
|
},
|
|
@@ -443,7 +441,6 @@
|
|
|
443
441
|
"base": { "type": "string" },
|
|
444
442
|
"pr": { "type": ["string", "null"] },
|
|
445
443
|
"status": { "$ref": "#/$defs/status" },
|
|
446
|
-
"claim": { "$ref": "#/$defs/claim" },
|
|
447
444
|
"sha256": { "type": "string" }
|
|
448
445
|
}
|
|
449
446
|
},
|
|
@@ -469,8 +466,7 @@
|
|
|
469
466
|
"branch": { "type": "string" },
|
|
470
467
|
"base": { "type": "string" },
|
|
471
468
|
"pr": { "type": ["string", "null"] },
|
|
472
|
-
"status": { "$ref": "#/$defs/status" }
|
|
473
|
-
"claim": { "$ref": "#/$defs/claim" }
|
|
469
|
+
"status": { "$ref": "#/$defs/status" }
|
|
474
470
|
}
|
|
475
471
|
},
|
|
476
472
|
{
|
|
@@ -485,8 +481,7 @@
|
|
|
485
481
|
"purpose": { "$ref": "#/$defs/taskPurpose" },
|
|
486
482
|
"handoff": { "$ref": "#/$defs/taskHandoff" },
|
|
487
483
|
"review": { "$ref": "#/$defs/reviewRecord" },
|
|
488
|
-
"status": { "$ref": "#/$defs/status" }
|
|
489
|
-
"claim": { "$ref": "#/$defs/claim" }
|
|
484
|
+
"status": { "$ref": "#/$defs/status" }
|
|
490
485
|
}
|
|
491
486
|
}
|
|
492
487
|
]
|
|
@@ -534,30 +529,6 @@
|
|
|
534
529
|
"sourceRevision": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
|
|
535
530
|
}
|
|
536
531
|
},
|
|
537
|
-
"claim": {
|
|
538
|
-
"type": "object",
|
|
539
|
-
"additionalProperties": false,
|
|
540
|
-
"required": [
|
|
541
|
-
"claimant",
|
|
542
|
-
"agent",
|
|
543
|
-
"sessionId",
|
|
544
|
-
"startedAt",
|
|
545
|
-
"targetRevision",
|
|
546
|
-
"state"
|
|
547
|
-
],
|
|
548
|
-
"properties": {
|
|
549
|
-
"claimant": { "type": "string", "minLength": 1 },
|
|
550
|
-
"agent": { "type": "string", "minLength": 1 },
|
|
551
|
-
"sessionId": { "type": "string", "minLength": 1 },
|
|
552
|
-
"startedAt": { "type": "string", "format": "date-time" },
|
|
553
|
-
"targetRevision": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
|
554
|
-
"expiresAt": { "type": "string", "format": "date-time" },
|
|
555
|
-
"state": { "enum": ["active", "released", "finished"] },
|
|
556
|
-
"releasedAt": { "type": "string", "format": "date-time" },
|
|
557
|
-
"finishedAt": { "type": "string", "format": "date-time" },
|
|
558
|
-
"outcome": { "enum": ["done", "dropped"] }
|
|
559
|
-
}
|
|
560
|
-
},
|
|
561
532
|
"repositoryData": {
|
|
562
533
|
"type": "object",
|
|
563
534
|
"additionalProperties": false,
|