@markjaquith/agency 2.47.1 → 2.47.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markjaquith/agency",
3
- "version": "2.47.1",
3
+ "version": "2.47.2",
4
4
  "description": "Manage agentic work across repositories with durable workbases",
5
5
  "keywords": [
6
6
  "agents",
@@ -164,7 +164,14 @@ describe("IntegrationService", () => {
164
164
  const module = await import(pathToFileURL(path).href)
165
165
  let clientReads = 0
166
166
 
167
- const runDiagnostic = async (paths: string[], ready = true) => {
167
+ const runDiagnostic = async (
168
+ paths: string[],
169
+ options: {
170
+ ready?: boolean
171
+ managedReference?: boolean
172
+ externalDirectory?: Record<string, string>
173
+ } = {},
174
+ ) => {
168
175
  let command:
169
176
  | {
170
177
  slashName?: string
@@ -178,7 +185,25 @@ describe("IntegrationService", () => {
178
185
  clientReads += 1
179
186
  throw new Error("diagnostic must not access the server client")
180
187
  },
181
- state: { ready, config: { skills: { paths } } },
188
+ state: {
189
+ ready: options.ready ?? true,
190
+ config: {
191
+ skills: { paths },
192
+ references: options.managedReference
193
+ ? {
194
+ workbase: {
195
+ path: "..",
196
+ description:
197
+ "Complete Agency workbase context; write authority still comes only from agency context",
198
+ },
199
+ }
200
+ : undefined,
201
+ permission: options.externalDirectory
202
+ ? { external_directory: options.externalDirectory }
203
+ : undefined,
204
+ },
205
+ path: { directory: join(root, "tasks", "example") },
206
+ },
182
207
  keymap: {
183
208
  registerLayer: (layer: { commands: (typeof command)[] }) => {
184
209
  command = layer.commands[0]
@@ -202,6 +227,23 @@ describe("IntegrationService", () => {
202
227
  variant: "success",
203
228
  message: expect.stringContaining("Server plugin: initialized"),
204
229
  })
230
+ expect(
231
+ await runDiagnostic([], {
232
+ managedReference: true,
233
+ externalDirectory: { [join(root, "*")]: "allow" },
234
+ }),
235
+ ).toMatchObject({
236
+ variant: "success",
237
+ message: expect.stringContaining("workbase access registered"),
238
+ })
239
+ expect(
240
+ await runDiagnostic([], {
241
+ externalDirectory: { [join(root, "*")]: "allow" },
242
+ }),
243
+ ).toMatchObject({
244
+ variant: "warning",
245
+ message: expect.stringContaining("Server plugin: indeterminate"),
246
+ })
205
247
  expect(await runDiagnostic([])).toMatchObject({
206
248
  variant: "warning",
207
249
  message: expect.stringContaining("Server plugin: indeterminate"),
@@ -6,10 +6,22 @@ const managedHeaderPattern =
6
6
  const checksum = (content: string) =>
7
7
  createHash("sha256").update(content).digest("hex")
8
8
 
9
- const body = `import type { TuiPlugin, TuiPluginModule } from "@opencode-ai/plugin/tui"
9
+ const body = `import { existsSync } from "node:fs"
10
+ import { dirname, join } from "node:path"
11
+ import type { TuiPlugin, TuiPluginModule } from "@opencode-ai/plugin/tui"
10
12
 
11
13
  const serverMarker = /[\\\\/]\\.$/
12
14
 
15
+ const findWorkbase = (start: string) => {
16
+ let directory = start
17
+ while (true) {
18
+ if (existsSync(join(directory, "agency.json"))) return directory
19
+ const parent = dirname(directory)
20
+ if (parent === directory) return
21
+ directory = parent
22
+ }
23
+ }
24
+
13
25
  const tui: TuiPlugin = async (api) => {
14
26
  api.keymap.registerLayer({
15
27
  commands: [
@@ -21,14 +33,35 @@ const tui: TuiPlugin = async (api) => {
21
33
  namespace: "palette",
22
34
  slashName: "agency-debug",
23
35
  run() {
24
- const paths = api.state.config.skills?.paths
25
- const serverInitialized = paths?.some(
36
+ const config = api.state.config
37
+ const checkoutSkillsRegistered = config.skills?.paths?.some(
26
38
  (path) => typeof path === "string" && serverMarker.test(path),
27
39
  )
40
+ const reference = config.references?.workbase
41
+ const managedReference =
42
+ typeof reference === "object" &&
43
+ reference.path === ".." &&
44
+ reference.description ===
45
+ "Complete Agency workbase context; write authority still comes only from agency context"
46
+ const workbase = managedReference
47
+ ? findWorkbase(api.state.path.directory)
48
+ : undefined
49
+ const external =
50
+ typeof config.permission === "object"
51
+ ? config.permission.external_directory
52
+ : undefined
53
+ const workbaseAccessRegistered =
54
+ workbase !== undefined &&
55
+ typeof external === "object" &&
56
+ external[join(workbase, "*")] === "allow"
57
+ const serverInitialized =
58
+ checkoutSkillsRegistered || workbaseAccessRegistered
28
59
  const message = serverInitialized
29
- ? "TUI companion: initialized. Server plugin: initialized; checkout skills registered."
60
+ ? checkoutSkillsRegistered
61
+ ? "TUI companion: initialized. Server plugin: initialized; checkout skills registered."
62
+ : "TUI companion: initialized. Server plugin: initialized; workbase access registered."
30
63
  : api.state.ready
31
- ? "TUI companion: initialized. Server plugin: indeterminate; no checkout skill marker is present."
64
+ ? "TUI companion: initialized. Server plugin: indeterminate; no Agency config marker is present."
32
65
  : "TUI companion: initialized. Server plugin: indeterminate; server state is not ready."
33
66
 
34
67
  api.ui.toast({