GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(server): add status filter to experimental job list · anomalyco/opencode@e1f45df

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • client/src
      • effect
        • api
          • api.ts
        • generated
          • client.ts
      • promise/generated
        • client.ts
        • types.ts
    • core/src/session
      • background.ts
    • protocol
      • openapi.json
      • src/groups
        • job.ts
    • server/test
      • job.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/client/src/effect/api/api.ts‎

Copy file name to clipboardExpand all lines: packages/client/src/effect/api/api.ts
+1Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎packages/client/src/effect/generated/client.ts‎

Copy file name to clipboardExpand all lines: packages/client/src/effect/generated/client.ts
+6-1Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎packages/client/src/promise/generated/client.ts‎

Copy file name to clipboardExpand all lines: packages/client/src/promise/generated/client.ts
+6-1Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎packages/client/src/promise/generated/types.ts‎

Copy file name to clipboardExpand all lines: packages/client/src/promise/generated/types.ts
+1Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎packages/core/src/session/background.ts‎

Copy file name to clipboardExpand all lines: packages/core/src/session/background.ts
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export * as SessionBackground from "./background.js"
22

3-
import type { Kind } from "@opencode/schema/job"
3+
import type { Kind, Status } from "@opencode/schema/job"
44
import { Effect } from "effect"
55
import type { Job } from "../job.js"
66
import type { SessionSchema } from "./schema.js"
@@ -12,6 +12,7 @@ export type Lookup = {
1212
export type ListFilter = {
1313
readonly sessionID?: SessionSchema.ID
1414
readonly kind?: Kind
15+
readonly status?: Status
1516
readonly descendants?: boolean
1617
}
1718

@@ -49,13 +50,17 @@ export const outstanding = Effect.fnUntraced(function* (
4950
})
5051
})
5152

52-
/** Active and unconsumed background jobs matching the requested Session, kind, and descendant scope. */
53+
/** Active and unconsumed background jobs matching the requested Session, kind, status, and descendant scope. */
5354
export const list = Effect.fn("SessionBackground.list")(function* (
5455
jobs: Pick<Job.Interface, "backgroundJobs">,
5556
store: Lookup,
5657
filter: ListFilter = {},
5758
) {
58-
const items = (yield* jobs.backgroundJobs).filter((item) => filter.kind === undefined || item.kind === filter.kind)
59+
const items = (yield* jobs.backgroundJobs).filter(
60+
(item) =>
61+
(filter.kind === undefined || item.kind === filter.kind) &&
62+
(filter.status === undefined || item.status === filter.status),
63+
)
5964
if (filter.sessionID === undefined) return items
6065
const sessionID = filter.sessionID
6166
if (!filter.descendants) return items.filter((item) => item.sessionID === sessionID)
Collapse file

‎packages/protocol/openapi.json‎

Copy file name to clipboardExpand all lines: packages/protocol/openapi.json
+13-9Lines changed: 13 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎packages/protocol/src/groups/job.ts‎

Copy file name to clipboardExpand all lines: packages/protocol/src/groups/job.ts
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export const ListQuery = Schema.Struct({
1818
kind: Schema.optional(Job.Kind).annotate({
1919
description: "Filter by background job kind (shell, subagent, or image).",
2020
}),
21+
status: Schema.optional(Job.Status).annotate({
22+
description: "Filter by job status (running, completed, error, or cancelled).",
23+
}),
2124
descendants: Schema.optional(BooleanFromString).annotate({
2225
description: "When sessionID is set, also include background jobs owned by child and nested subagent sessions.",
2326
}),
Collapse file

‎packages/server/test/job.test.ts‎

Copy file name to clipboardExpand all lines: packages/server/test/job.test.ts
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@ it.live("lists background jobs by session, kind, and descendants until completio
160160
time: { started: expect.any(Number), completed: expect.any(Number) },
161161
},
162162
])
163+
expect(
164+
(yield* Effect.promise(() => api.experimental.job.list({ sessionID: root.id, status: "running" }))).map(
165+
(item) => item.id,
166+
),
167+
).toEqual([child.id])
168+
expect(
169+
(yield* Effect.promise(() => api.experimental.job.list({ sessionID: root.id, status: "completed" }))).map(
170+
(item) => item.id,
171+
),
172+
).toEqual(["sh_root"])
163173

164174
if (shellBg?.notificationID) yield* jobs.completeBackground(shellBg.notificationID)
165175
expect(yield* Effect.promise(() => api.experimental.job.list({ sessionID: root.id, kind: "shell" }))).toEqual([])

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.