@markjaquith/agency 2.48.0 → 2.49.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.
@@ -43,7 +43,8 @@ reason to edit `agency.json` or `repos/` by hand.
43
43
  Require explicit user intent before initializing a workbase; changing repository
44
44
  aliases or applying repository setup or workbase sync changes; launching another
45
45
  agent from an active agent session; creating a pull request; archiving, restoring,
46
- dropping, or reopening work; or using `--force` to override readiness.
46
+ dropping, reopening, or completing work without a pull request; or using `--force`
47
+ to override readiness.
47
48
 
48
49
  ## Safety
49
50
 
@@ -80,7 +81,9 @@ release the claim with the current document revision.
80
81
  An execution unit remains `working` after implementation is committed and while
81
82
  its pull request is open. It becomes `done` only after its authoritative pull
82
83
  request is merged and Agency reconciles that state. Do not mark committed or
83
- review-ready work `done` manually.
84
+ review-ready work `done` manually. A genuine investigation, operational action,
85
+ or no-change result may complete without a pull request only with explicit user
86
+ intent, `--no-pull-request`, and a durable outcome summary.
84
87
 
85
88
  At each closeout trigger (creating or updating a PR, marking it ready, completing
86
89
  a refinement loop, or pausing or handing off completed implementation work):
@@ -90,6 +93,8 @@ a refinement loop, or pausing or handing off completed implementation work):
90
93
  keep the execution unit `working` through review and merge.
91
94
  - After merge, run `agency sync --apply` to reconcile the execution unit to
92
95
  `done`.
96
+ - For an approved non-PR outcome, finish an active claim or update unclaimed
97
+ status with `--no-pull-request --summary <text>` and optional supporting URL.
93
98
  - Refresh durable delivery context in `TASK.md` or `PHASE.md`, including recorded
94
99
  PR state, current head, diff summary, and verification results after later
95
100
  pushes when those details are maintained there.
@@ -100,15 +105,15 @@ a refinement loop, or pausing or handing off completed implementation work):
100
105
  `agency integration status` reports `managed`, `drifted`, `customized`, or
101
106
  `missing` generated files. Agency keeps these instructions in
102
107
  `.agency/AGENTS.md`, and its managed OpenCode config loads them automatically.
103
- It also installs `.opencode/command/agency.md`, which provides safe `/agency`
104
- workflows for active OpenCode sessions, a managed server plugin that exposes
105
- skills from the authoritative writable checkout, and an explicitly registered
106
- TUI companion providing `/agency-debug` without submitting an LLM prompt.
108
+ It also installs a managed server plugin that exposes skills from the
109
+ authoritative writable checkout and an explicitly registered TUI companion
110
+ providing `/agency-debug` without submitting an LLM prompt.
107
111
  The workbase-root `AGENTS.md`, when present, belongs entirely to the workbase
108
112
  owner and composes with these instructions through OpenCode's normal discovery.
109
113
  `agency integration sync` updates only missing or checksum-safe drifted managed
110
- files and preserves user-customized files. `agency init` creates the managed
111
- files, and `agency work` reconciles them before launching an agent.
114
+ files, removes checksum-valid retired artifacts, and preserves user-customized
115
+ files. `agency init` creates the managed files, and `agency work` reconciles them
116
+ before launching an agent.
112
117
 
113
118
  OpenCode can access the complete workbase tree, but this filesystem permission
114
119
  does not expand Agency write authority beyond the checkout reported by
@@ -0,0 +1,28 @@
1
+ import type { CompletionRecord } from "./schemas"
2
+
3
+ export interface NonPrCompletionInput {
4
+ readonly summary: string
5
+ readonly evidenceUrl?: string
6
+ }
7
+
8
+ export const buildNonPrCompletion = (
9
+ input: NonPrCompletionInput,
10
+ now: Date,
11
+ ): { readonly value: CompletionRecord } | { readonly error: string } => {
12
+ const summary = input.summary.trim()
13
+ if (!summary) return { error: "Non-PR completion summary must not be empty" }
14
+
15
+ const evidenceUrl = input.evidenceUrl?.trim()
16
+ if (evidenceUrl && !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(evidenceUrl)) {
17
+ return { error: `Invalid completion evidence URL: ${evidenceUrl}` }
18
+ }
19
+
20
+ return {
21
+ value: {
22
+ mode: "non-pr",
23
+ completedAt: now.toISOString(),
24
+ summary,
25
+ ...(evidenceUrl ? { evidenceUrl } : {}),
26
+ },
27
+ }
28
+ }
@@ -75,6 +75,13 @@ export const PullRequestRecord = Schema.Struct({
75
75
  mergeable: Schema.optional(Schema.NullOr(Schema.Boolean)),
76
76
  })
77
77
 
78
+ export const CompletionRecord = Schema.Struct({
79
+ mode: Schema.Literal("non-pr"),
80
+ completedAt: IsoTimestamp,
81
+ summary: NonEmptyString,
82
+ evidenceUrl: Schema.optional(Url),
83
+ })
84
+
78
85
  const DeliveryProvider = Schema.Struct({
79
86
  provider: EntityId,
80
87
  remote: Schema.optional(NonEmptyString),
@@ -141,6 +148,7 @@ const ExecutionUnit = {
141
148
  pr: Schema.NullOr(Schema.Union(GitHubPullRequestUrl, PullRequestRecord)),
142
149
  status: Schema.optionalWith(WorkStatus, { default: () => "open" as const }),
143
150
  claim: Schema.optional(ClaimRecord),
151
+ completion: Schema.optional(CompletionRecord),
144
152
  }
145
153
 
146
154
  export const EpicFrontmatter = Schema.Struct({
@@ -187,6 +195,7 @@ export type RepositoryDeclaration = Schema.Schema.Type<
187
195
  export type WorkStatus = Schema.Schema.Type<typeof WorkStatus>
188
196
  export type ClaimRecord = Schema.Schema.Type<typeof ClaimRecord>
189
197
  export type PullRequestRecord = Schema.Schema.Type<typeof PullRequestRecord>
198
+ export type CompletionRecord = Schema.Schema.Type<typeof CompletionRecord>
190
199
  export type EpicFrontmatter = Schema.Schema.Type<typeof EpicFrontmatter>
191
200
  export type TaskFrontmatter = Schema.Schema.Type<typeof TaskFrontmatter>
192
201
  export type PhaseFrontmatter = Schema.Schema.Type<typeof PhaseFrontmatter>
@@ -1,48 +0,0 @@
1
- ---
2
- description: Operate Agency work with safe start, status, next, validate, and finish workflows
3
- ---
4
-
5
- Operate the current Agency workbase using the managed Agency instructions.
6
-
7
- Invocation inputs:
8
-
9
- - Workflow: `$1`
10
- - Optional target: `$2`
11
- - Complete request: `$ARGUMENTS`
12
-
13
- Use `status` when the workflow is empty. Treat words after the optional target as
14
- additional user instructions. If the workflow is unknown, make no changes and
15
- list the supported workflows.
16
-
17
- Always follow these rules:
18
-
19
- - Run `agency context . --json` first when no target is provided. With a target,
20
- pass that target to `agency context` instead.
21
- - Use the returned document paths, readiness, authority, checkout state, claim,
22
- and validation result. Do not infer them from directory names.
23
- - Stop on validation errors, dependency blockers, an unexpected writable
24
- repository, or a conflicting active claim.
25
- - Write code only in `authority.writable.checkoutPath`; references are read-only.
26
- - Never run `agency work` to start the current agent again.
27
- - Create a pull request only when the complete request explicitly asks for one.
28
-
29
- Dispatch the workflow as follows:
30
-
31
- - `start`: Read the returned task and phase documents, inspect the writable
32
- checkout, then begin or resume the requested work in this session. Keep durable
33
- decisions current and carry the work through focused verification.
34
- - `status`: Make no changes. Summarize the target, readiness, authority, durable
35
- status, claim and PR state, checkout state, current Git changes, blockers, and
36
- the most useful next action.
37
- - `next`: Run `agency next --json`, summarize ready and blocked execution units,
38
- and recommend the highest-priority ready unit. Do not launch another agent.
39
- - `validate`: Run Agency validation for the discovered workbase. Explain every
40
- issue and, when safe and within authority, repair requested non-structural
41
- problems before validating again.
42
- - `finish`: Complete any remaining requested implementation first. Run focused
43
- repository checks, refresh the task or phase delivery context, and run
44
- `agency validate`. Finish an active claim with its current revision; otherwise
45
- update unclaimed status only when the requested outcome and delivery work are
46
- actually complete. Do not create a PR unless explicitly requested.
47
- - `help`: Make no changes. Briefly explain these workflows and the positional
48
- form `/agency <workflow> [target] [additional instructions]`.
@@ -1,30 +0,0 @@
1
- import { createHash } from "node:crypto"
2
- import commandTemplate from "./AGENCY_COMMAND.md" with { type: "text" }
3
-
4
- const managedHeaderPattern =
5
- /^---\r?\n# agency-managed: sha256=([a-f0-9]{64})\r?\n/
6
-
7
- const checksum = (content: string) =>
8
- createHash("sha256").update(content).digest("hex")
9
-
10
- const canonicalBody = commandTemplate.endsWith("\n")
11
- ? commandTemplate
12
- : `${commandTemplate}\n`
13
-
14
- const renderManagedWorkbaseOpencodeCommand = (
15
- content: string = canonicalBody,
16
- ) =>
17
- content.replace(
18
- /^---\n/,
19
- `---\n# agency-managed: sha256=${checksum(content)}\n`,
20
- )
21
-
22
- export const managedWorkbaseOpencodeCommand =
23
- renderManagedWorkbaseOpencodeCommand()
24
-
25
- export const canUpdateManagedWorkbaseOpencodeCommand = (content: string) => {
26
- const match = content.match(managedHeaderPattern)
27
- if (!match?.[1]) return false
28
-
29
- return checksum(content.replace(managedHeaderPattern, "---\n")) === match[1]
30
- }