@markjaquith/agency 2.39.1 → 2.39.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.39.1",
3
+ "version": "2.39.2",
4
4
  "description": "Manage agentic work across repositories with durable workbases",
5
5
  "keywords": [
6
6
  "agents",
package/src/cli.test.ts CHANGED
@@ -1019,7 +1019,13 @@ status: open
1019
1019
  const contract = JSON.parse(printed.stdout)
1020
1020
  expect(contract.cwd).toBe(launch.cwd)
1021
1021
  expect(contract.environment.OPENCODE_CONFIG).toBeUndefined()
1022
- expect(contract.environment.OPENCODE_CONFIG_CONTENT).toBeUndefined()
1022
+ expect(
1023
+ JSON.parse(contract.environment.OPENCODE_CONFIG_CONTENT),
1024
+ ).toEqual({
1025
+ permission: {
1026
+ external_directory: { [join(workbaseRoot, "*")]: "allow" },
1027
+ },
1028
+ })
1023
1029
  const environment = {
1024
1030
  ...process.env,
1025
1031
  ...contract.environment,
@@ -45,6 +45,9 @@ const multiPhaseWorkspace: ExecutionWorkspace = {
45
45
  }
46
46
 
47
47
  const taskDirectory = "/workbase/tasks/example"
48
+ const workbasePermission = JSON.stringify({
49
+ permission: { external_directory: { "/workbase/*": "allow" } },
50
+ })
48
51
 
49
52
  interface HarnessOptions {
50
53
  readonly workspace?: ExecutionWorkspace
@@ -487,9 +490,9 @@ describe("work command", () => {
487
490
  cwd: "/workbase/epics/delivery",
488
491
  })
489
492
  expect(harness.launchEnvironments[0]?.OPENCODE_CONFIG).toBeUndefined()
490
- expect(
491
- harness.launchEnvironments[0]?.OPENCODE_CONFIG_CONTENT,
492
- ).toBeUndefined()
493
+ expect(harness.launchEnvironments[0]?.OPENCODE_CONFIG_CONTENT).toBe(
494
+ workbasePermission,
495
+ )
493
496
  })
494
497
 
495
498
  test("resolves an existing positional path before treating it as a task ID", async () => {
@@ -915,7 +918,7 @@ describe("work command", () => {
915
918
  expect(harness.taskStatuses.example).toBe("done")
916
919
  })
917
920
 
918
- test("does not inject runtime OpenCode configuration", async () => {
921
+ test("grants managed OpenCode launches absolute workbase access", async () => {
919
922
  const harness = createHarness()
920
923
  const output = await captureLogs(() =>
921
924
  harness.run({ taskId: "example", opencode: true, printCommand: true }),
@@ -923,7 +926,7 @@ describe("work command", () => {
923
926
  const printed = JSON.parse(output.join("\n"))
924
927
 
925
928
  expect(printed.environment.OPENCODE_CONFIG).toBeUndefined()
926
- expect(printed.environment.OPENCODE_CONFIG_CONTENT).toBeUndefined()
929
+ expect(printed.environment.OPENCODE_CONFIG_CONTENT).toBe(workbasePermission)
927
930
  })
928
931
 
929
932
  test("does not override customized OpenCode access policy", async () => {
@@ -122,7 +122,10 @@ export const work = (
122
122
  const inputAllowed = options.inputAllowed ?? true
123
123
  const root = yield* resolveWorkbase(startPath, pickBase, inputAllowed)
124
124
  if (!root) return
125
- yield* integrations.sync(root)
125
+ const integration = yield* integrations.sync(root)
126
+ const managedOpencode = integration.files.some(
127
+ (file) => file.name === "opencode" && file.state === "managed",
128
+ )
126
129
  const { config } = yield* workbase.loadConfig(root)
127
130
 
128
131
  let target: WorkTarget | null = null
@@ -331,6 +334,13 @@ export const work = (
331
334
  ...resolved.environment,
332
335
  ...runnerEnvironment(runner, variables),
333
336
  }
337
+ if (runner === "opencode" && managedOpencode) {
338
+ environment.OPENCODE_CONFIG_CONTENT = JSON.stringify({
339
+ permission: {
340
+ external_directory: { [join(root, "*")]: "allow" },
341
+ },
342
+ })
343
+ }
334
344
  if (options.printCommand) {
335
345
  log(
336
346
  JSON.stringify(