Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/mcpx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ on:
pull_request:
paths:
- "pkgs/mcpx/**"
# The dogfood copy of the plugin under .opencode/plugin, so a PR that
# only touches it still runs the sync guard below (#314).
- ".opencode/plugin/**"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Support fork PRs before enabling the plugin-only trigger

When .opencode/plugin/** is the only change in a PR from a fork, this new trigger starts the workflow, but the test job checks out github.head_ref without setting repository. Since actions/checkout defaults repository to the base github.repository, it searches the base repository for the fork-only branch and fails before reaching the sync check; the checkout project documents this exact head_ref fork failure. Use the PR head SHA (or the head repository plus ref) for the test job, while retaining branch checkout only where the repair job needs to push.

Useful? React with 👍 / 👎.

- "flake.nix"
- "flake.lock"
# Itself, so a bot bumping one of the actions below is tested by the
Expand All @@ -33,6 +36,7 @@ on:
branches: [main]
paths:
- "pkgs/mcpx/**"
- ".opencode/plugin/**"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -53,6 +57,18 @@ jobs:
ref: ${{ github.head_ref || github.ref }}
fetch-depth: 0

# The repo dogfoods the plugin: .opencode/plugin is a copy of
# pkgs/mcpx/plugin/opencode, and the two must stay identical. The
# generated ops table in the copy once fell 9 operations behind
# (secrets, reload, preflight, servers_get) because the generation
# guard inside pkgs/mcpx only compares the pkgs copy (#314). This
# guard lives here, not in pkgs/mcpx, because that package also
# stands alone in dezren39/nix with no repo-root .opencode copy.
- name: Check the dogfood plugin copy is in sync
run: |
diff -r pkgs/mcpx/plugin/opencode/mcpx .opencode/plugin/mcpx
diff pkgs/mcpx/plugin/opencode/mcpx-session.ts .opencode/plugin/mcpx-session.ts

- uses: actions/setup-go@v7
with:
go-version-file: pkgs/mcpx/go.mod
Expand Down
135 changes: 135 additions & 0 deletions .opencode/plugin/mcpx/ops.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,14 @@ export const OPS: Record<string, OpSpec> = {
params: {},
response: "json",
},
preflight: {
method: "POST",
path: "/v1/preflight",
params: {
source: { in: "body", required: true },
},
response: "json",
},
prompt_get: {
method: "POST",
path: "/v1/prompt",
Expand Down Expand Up @@ -487,6 +495,12 @@ export const OPS: Record<string, OpSpec> = {
},
response: "json",
},
reload: {
method: "POST",
path: "/v1/reload",
params: {},
response: "json",
},
resolve: {
method: "GET",
path: "/v1/resolve",
Expand Down Expand Up @@ -541,6 +555,51 @@ export const OPS: Record<string, OpSpec> = {
},
response: "json",
},
secret_request_decline: {
method: "DELETE",
path: "/v1/secret-requests/{id}",
params: {
id: { in: "path", required: true },
},
response: "json",
},
secret_request_get: {
method: "GET",
path: "/v1/secret-requests/{id}",
params: {
id: { in: "path", required: true },
},
response: "json",
},
secret_requests_list: {
method: "GET",
path: "/v1/secret-requests",
params: {},
response: "json",
},
secrets_list: {
method: "GET",
path: "/v1/secrets",
params: {},
response: "json",
},
secrets_set: {
method: "PUT",
path: "/v1/secrets/{name}",
params: {
name: { in: "path", required: true },
value: { in: "body", required: true },
},
response: "json",
},
secrets_unset: {
method: "DELETE",
path: "/v1/secrets/{name}",
params: {
name: { in: "path", required: true },
},
response: "json",
},
servers_add: {
method: "POST",
path: "/v1/servers",
Expand All @@ -558,6 +617,14 @@ export const OPS: Record<string, OpSpec> = {
},
response: "json",
},
servers_get: {
method: "GET",
path: "/v1/servers/{name}",
params: {
name: { in: "path", required: true },
},
response: "json",
},
servers_list: {
method: "GET",
path: "/v1/servers",
Expand Down Expand Up @@ -1080,6 +1147,13 @@ export class DaemonOps {
return this.invoke("openapi", args, opts) as Promise<unknown>
}

/**
* Check a script's servers are ready before running it. `POST /v1/preflight`.
*/
preflight(args: { source: string }, opts: CallOptions = {}): Promise<unknown> {
return this.invoke("preflight", args, opts) as Promise<unknown>
}

/**
* Render one prompt with its arguments filled in. `POST /v1/prompt`.
*/
Expand Down Expand Up @@ -1144,6 +1218,14 @@ export class DaemonOps {
return this.invoke("registry_search", args, opts) as Promise<unknown>
}

/**
* Re-read the configuration and swap server pools without restarting unchanged servers. `POST /v1/reload`.
* Privileged: it changes the daemon rather than reading it.
*/
reload(args: Record<string, never> = {}, opts: CallOptions = {}): Promise<unknown> {
return this.invoke("reload", args, opts) as Promise<unknown>
}

/**
* Which daemon serves a directory. `GET /v1/resolve`.
*/
Expand Down Expand Up @@ -1188,6 +1270,52 @@ export class DaemonOps {
return this.invoke("search", args, opts) as Promise<unknown>
}

/**
* Decline a secret request. `DELETE /v1/secret-requests/{id}`.
* Privileged: it changes the daemon rather than reading it.
*/
secretRequestDecline(args: { id: string }, opts: CallOptions = {}): Promise<unknown> {
return this.invoke("secret_request_decline", args, opts) as Promise<unknown>
}

/**
* One secret request, and whether it is still waiting. `GET /v1/secret-requests/{id}`.
*/
secretRequestGet(args: { id: string }, opts: CallOptions = {}): Promise<unknown> {
return this.invoke("secret_request_get", args, opts) as Promise<unknown>
}

/**
* Requests waiting for a person to give secrets. `GET /v1/secret-requests`.
*/
secretRequestsList(args: Record<string, never> = {}, opts: CallOptions = {}): Promise<unknown> {
return this.invoke("secret_requests_list", args, opts) as Promise<unknown>
}

/**
* Which secrets servers need, and which of them have a value. `GET /v1/secrets`.
*/
secretsList(args: Record<string, never> = {}, opts: CallOptions = {}): Promise<unknown> {
return this.invoke("secrets_list", args, opts) as Promise<unknown>
}

/**
* Give a secret a value, in memory only. `PUT /v1/secrets/{name}`.
* Privileged: it changes the daemon rather than reading it.
*/
secretsSet(args: { name: string; value: string }, opts: CallOptions = {}): Promise<unknown> {
return this.invoke("secrets_set", args, opts) as Promise<unknown>
}

/**
* Forget a runtime value for a secret. `DELETE /v1/secrets/{name}`.
* Privileged: it changes the daemon rather than reading it.
* Destructive: it cannot be undone, and other callers are affected.
*/
secretsUnset(args: { name: string }, opts: CallOptions = {}): Promise<unknown> {
return this.invoke("secrets_unset", args, opts) as Promise<unknown>
}

/**
* Add a server, live. `POST /v1/servers`.
* Privileged: it changes the daemon rather than reading it.
Expand All @@ -1196,6 +1324,13 @@ export class DaemonOps {
return this.invoke("servers_add", args, opts) as Promise<unknown>
}

/**
* One configured server, and whether it can run now. `GET /v1/servers/{name}`.
*/
serversGet(args: { name: string }, opts: CallOptions = {}): Promise<unknown> {
return this.invoke("servers_get", args, opts) as Promise<unknown>
}

/**
* Every configured server as it is written in the configuration. `GET /v1/servers`.
*/
Expand Down
Loading