Skip to content

Commit d0c8d95

Browse files
sepo-engFelicityclaude
authored
feat(project): V2 project ownership, preferences, protocol + server (slice 3, core-server half) (#8)
* feat(project): V2 project ownership, preferences, protocol + server TKT-315 slice 3 (core through server; app half held per Ethan, in flight behind Henry's TKT-314 session-entities slice). Core: ProjectV2.Service now owns list/get/updateMetadata directly over ProjectTable (build post, "Projects: finish the V2 move before adding favorites") -- moved from the V1 opencode Project service, which becomes a thin adapter over the same core calls. ProjectV2.Info is now the full public Project.Info schema type (was a 1-field {id} placeholder). ProjectPreferenceTable + packages/core/src/project/preference.ts: a compare-and-set service for favorite/rank/hidden/lastOpenedAt, keyed by project_id alone (no principal key yet -- OpenCode has no durable user principal; see the schema comment for why that's deliberate, not an oversight). expectedRevision absent/0 means "create"; a stale or missing revision fails with a typed Conflict carrying the row's actual revision, so a client can retry without a second read. Protocol + server: packages/protocol/src/groups/project.ts (list, get, updateMetadata, preference.read, preference.write) and packages/server/src/handlers/project.ts. Publishing project.updated / project.preference.updated happens at the CALLERS (server handler, V1 adapter), not inside ProjectV2.Service itself -- core cannot depend on EventV2 without a circular import (event.ts -> location.ts -> project.ts, which needs Project.node); see the comment on ProjectV2.Info for the full explanation and a pointer for whoever touches this next. Client regenerated. Migration: project_preference table, additive, no backfill needed (a project with no preference row reads as the untouched default). Fixed along the way, found by tests not typecheck: preference Conflict was originally Effect.died like the session-lifecycle Conflict it was modeled on, but nothing here catches defects the way session.ts does for that one -- it would have escaped as an unhandled crash instead of a 409. Made it a plain typed failure since this CAS has no durable- event-transaction rollback reason to need the defect trick. Also fixed: extending ProjectV2.Interface broke the full monorepo typecheck in packages/cli and packages/sdk-next, both of which build their own explicit AppNodeBuilder node lists rather than relying on transitive discovery. cli needed ProjectV2.node added to its list; sdk-next needed HttpRouter.provideRequest (not Layer.provide) for the same node, since HttpRouter.toWebHandler's type distinguishes "Requires" from "GlobalRequires" request-kinds and only the former API discharges the latter. Neither package is otherwise touched. Tests: packages/core/test/project.test.ts (list/get/updateMetadata, five preference CAS scenarios including create-conflict and stale- revision-conflict). Six new httpapi-exercise scenarios for the v2 routes, three test modes, 221/0 (was 215/0). Full packages/opencode suite 3257/1/22/1 -- the 1 fail is the documented local-environment umask caveat (tool.write sensitive-file-permissions), not new. packages/core 1118/0 (was 1108/0). packages/app unchanged, 722+41/0. bun typecheck 30/30. bun run lint 4859/1, matching FORK.md's baseline exactly. * fix(project): preference-create 404 not 500; explicit node wiring Two real bugs, both caught by the httpapi exerciser's automatic per-route bad-ID probe, not by typecheck: 1. ProjectPreference.patch's create path (no expectedRevision) relied on the project_preference table's FK constraint to reject a nonexistent project, wrapped in Effect.orDie -- so a bad project ID crashed with an unhandled SQLite FOREIGN KEY error (500) instead of a typed 404. Added an explicit existence check with a new ProjectPreference.ProjectNotFound error, mapped to the same 404 the other project routes already use. 2. Extending ProjectV2's interface (this ticket) and adding SessionGoal/SessionLedger (TKT-317, #7) together pushed past whatever threshold makes AppNodeBuilder's transitive auto-discovery of a new global .node's own dependencies unreliable -- confirmed via clean-dev isolation before attributing anything (dev alone: 227/0; my branch before this fix: crashes and "Service not found" errors in three separate full-app composition sites). Explicit node listing needed in: - packages/server/src/routes.ts (v2 API, used by cli/sdk-next) - packages/opencode/src/server/routes/instance/httpapi/server.ts (the V1 HttpApiApp -- what test:httpapi actually runs against; SessionGoal/SessionLedger gap here is pre-existing from #7, not from this PR, but blocks this PR's own gate, so fixed here per Ethan's ruling rather than serialized on its own ticket) - packages/opencode/src/effect/app-runtime.ts (the CLI/TUI runtime -- the same gap here is invisible to any HTTP-shaped test, since nothing exercises it that way; found by enumeration, not by a failing test) Per Ethan's follow-up ask: enumerated every AppNodeBuilder/LayerNode .group assembly site in the repo (grep in FORK.md's new section), distinguished the five full-app composition sites (need every global node) from location-services.ts (a different category -- per-location services, global nodes don't belong) and everything else (narrow, single-feature builds). Documented in FORK.md so the next new global .node has a checklist instead of a minefield. Fixing #2 unmasked a third, unrelated issue: v2.session.goal.get now reaches its assertion instead of crashing first, and fails it in test:httpapi's mode=effect only ("a session with no goal set should report no data") -- coverage and auth modes both pass. Not caused by this diff (unrelated code, TKT-317's), filed as feedback anomalyco#145 and recorded as a new named exception in FORK.md's known-red table, matching the TKT-305 convention exactly. Full validation after all of the above: bun typecheck 30/30. Core 1126/0 (new: a regression test asserting patch-on-nonexistent-project fails typed, not crashed). App 722+41/0, unchanged. Full opencode suite 3257/1/22/1, the 1 is the documented umask caveat, unchanged. test:httpapi 227/0 in mode=coverage and mode=auth, 226/1 in mode=effect (the newly-filed, newly-named exception above) -- was 221/6 (all crashes) before this commit. lint 4865/1 against a freshly-verified clean-dev-with-Gemma's-merge baseline of 4864/1 (not the stale 4859/4860 figures from before her PR landed) -- a 1-count difference already inside the noise band FORK.md documents as not meaningful, confirmed by checking each of the touched files' findings against clean dev individually: all pre-existing, none new. * fix(project): trace app-runtime.ts node reachability; interim timeout widen Per Ethan's ruling: the earlier "every list gets every node" framing in FORK.md's node-assembly-sites section was too broad. The correct rule is every list whose runtime can actually reach the node -- traced, not assumed. Confirmed reachable, kept in app-runtime.ts (CLI/TUI AppLayer): - ProjectV2: the V1 project/project.ts adapter it backs is imported by project/bootstrap.ts, which app-node-builder-v1.ts (this site's own builder) depends on unconditionally. - SessionGoal/SessionLedger: consumed by the built-in goal_get / goal_update_progress / ledger_add tools, part of the standard toolset every session gets regardless of runtime. Both traced with concrete import chains, documented in FORK.md so the next node addition has a method, not just a checklist. Separately: cold-spawn distribution measurement (isolated single-test runs vs. full-file concurrent runs, 6-8x each, branch vs. dev-baseline) confirmed a real, reproducible ~0.2-0.5s slowdown under concurrent subprocess load from building 3 more global nodes at every CLI boot -- invisible in isolation, real under packages/opencode/test/cli/run/ run-process.test.ts's 13 concurrent cliIt.concurrent() subprocesses. None of the three nodes do eager I/O; this is inherent per-node construction cost. On CI's more constrained runners this plausibly tips several already-borderline subprocess spawns over their 30s timeout at once (7 additional failures observed, none reproducing locally). The real fix is lazy node construction -- architecture, not a rider on this PR. Filed as feedback anomalyco#150. Interim mitigation landed here: raised timeoutMs from the 30_000 default to 45_000 on the 7 affected tests only (each commented, linked to anomalyco#150), with the outer bun-test timeout raised to match where a test makes multiple sequential subprocess calls. FORK.md's known-red table and milestone-1 gate section updated to record this as mitigated-not-currently-red. Full validation after all of the above: bun typecheck 30/30. Full packages/opencode suite 3257/1/22/1 -- unchanged from baseline. run-process.test.ts itself: 13/13 pass locally, matching pre-existing behavior. Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Felicity <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent 627eaaa commit d0c8d95

31 files changed

Lines changed: 1364 additions & 43 deletions

File tree

‎FORK.md‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,83 @@ been reconciled, not just what is currently outstanding.
9898
confirmed, with evidence, as of TKT-305). Say so explicitly in every PR and report — local
9999
per-package tests are the gate, and an absence of review comments is not evidence of a clean diff.
100100

101+
## Adding a new global `.node`? Check every assembly site that actually serves it.
102+
103+
A `makeGlobalNode`-tagged service (`ProjectV2.node`, `SessionGoal.node`, `EventV2.node`, …) is a
104+
process-wide singleton, and `AppNodeBuilder`/`AppNodeBuilderV1`'s transitive auto-discovery of a
105+
new node's *own* dependencies is **not reliable past a certain graph size** — TKT-315 and TKT-317
106+
independently hit this from both directions: adding `ProjectV2.node`'s own new dependencies broke
107+
type-level resolution in two unrelated packages, and *not* explicitly listing `SessionGoal.node`/
108+
`SessionLedger.node` in a full-app composition site left those routes returning `500: Service not
109+
found` at runtime, silently, because nothing forced the omission to surface until something else
110+
exercised that exact path. **Do not rely on auto-discovery for a new global node. List it
111+
explicitly at every full-app assembly site whose runtime can actually reach it.**
112+
113+
**"Every site" is not "every site, uniformly."** The five sites exist because different runtimes
114+
serve different features — that is the reason there are five instead of one. Adding a node
115+
everywhere by default defeats the split: it was tried once (an earlier version of this section
116+
said exactly that), and it is wrong, because it makes "listed" stop meaning "reachable" and turns
117+
every future audit back into a guess. Before adding a node to a site, trace whether that site's
118+
own consumers can actually reach the service — grep for direct imports of the service/its data
119+
type from code the runtime executes (not just from HTTP-only handlers), the way TKT-315 confirmed
120+
`ProjectV2` for the CLI/TUI runtime via `project/bootstrap.ts` (imported by
121+
`app-node-builder-v1.ts` itself — always-on, not conditional) and confirmed `SessionGoal`/
122+
`SessionLedger` via the built-in `goal_get`/`goal_update_progress`/`ledger_add` tools every
123+
session gets regardless of runtime.
124+
125+
- **If reachable: list it, with a one-line comment naming what reaches it** (a route, a tool, a
126+
bootstrap dependency) — so the entry is a traced fact, not a copy-paste.
127+
- **If not reachable: leave it out, with a one-line comment saying so** (`// absent by decision:
128+
this runtime does not serve <feature> — see TKT-nnn`). Absence is a decision, and it needs the
129+
same trail a presence does, or the next person can't tell "checked, doesn't apply" from
130+
"forgot."
131+
132+
Every global node adds real per-process construction cost at the site that builds it, even when
133+
it never does I/O — see the eager-construction note in the milestone-1 gate section below
134+
(feedback #150). Uniform addition does not just blur the checklist, it taxes every runtime for
135+
every feature whether that runtime uses it or not.
136+
137+
**The five full-app composition sites** (each lists most/all global nodes; found by `grep -rln
138+
"AppNodeBuilder\.build\|AppNodeBuilderV1\.build\|LayerNode\.group(" packages/ --include="*.ts"
139+
--include="*.tsx" | grep -v "/test/" | grep -v "\.test\.ts$"`, then narrowed to the entries whose
140+
own node count made clear they were "assemble everything" sites rather than one narrow feature):
141+
142+
1. `packages/opencode/src/server/routes/instance/httpapi/server.ts` — the `app` list (~63 nodes).
143+
The V1 `HttpApiApp`; this is what `test:httpapi`'s exerciser actually runs against.
144+
2. `packages/opencode/src/effect/app-runtime.ts` — `AppLayer` (~52 nodes). Powers the interactive
145+
CLI/TUI (`opencode` run directly, not through the HTTP server) — a gap here is invisible to any
146+
HTTP-shaped test. `ProjectV2.node`/`SessionGoal.node`/`SessionLedger.node` are listed here,
147+
traced reachable: `ProjectV2` through the V1 `project/project.ts` adapter, imported by
148+
`project/bootstrap.ts`, which `app-node-builder-v1.ts` (this site's own builder) depends on
149+
unconditionally; `SessionGoal`/`SessionLedger` through the built-in `goal_get`/
150+
`goal_update_progress`/`ledger_add` tools, part of the standard toolset every session gets
151+
regardless of runtime. Listing them here has a real, measured cost — see feedback #150 in the
152+
milestone-1 gate section below.
153+
3. `packages/server/src/routes.ts` — `applicationServices` (~15 nodes). The current v2
154+
`createRoutes`/`createEmbeddedRoutes`, used by `packages/cli` and `packages/sdk-next`.
155+
4. `packages/cli/src/commands/handlers/serve.ts` — the CLI daemon's own explicit
156+
`AppNodeBuilder.build(LayerNode.group([...]))` in `bind()`.
157+
5. `packages/sdk-next/src/opencode.ts` — the embedded-server SDK's own explicit list. Also needs
158+
the type-level `HttpRouter.provideRequest(...)` treatment below, not just the node list.
159+
160+
**Not on this list, and shouldn't be added to it:** `packages/core/src/location-services.ts`
161+
(`locationServices`, ~36 nodes) looks similar by node count but is a **different category** —
162+
per-location/per-workspace scoped services (`LayerNode.unbound`/`LocationServiceMap`), rebuilt per
163+
directory, not process-wide singletons. A global `.node` does not belong there. Everything else
164+
`grep` finds under `packages/` outside `test/` is a narrow, single- or few-node build for one
165+
specific feature (e.g. `packages/opencode/src/control-plane/workspace.ts`'s two `InstanceStore.node`
166+
uses) — not a checklist target.
167+
168+
**If the new node is consumed through `HttpRouter.toWebHandler`** (as in `sdk-next/opencode.ts`),
169+
listing it in the node graph is necessary but not sufficient. `HttpRouter.toWebHandler`'s type
170+
distinguishes `"Requires"` from `"GlobalRequires"` request-kinds, and only
171+
`HttpRouter.provideRequest(layer)` discharges the latter — plain `Layer.provide(...)` silently
172+
leaves it unsatisfied and the handler's call signature shifts from one argument to two
173+
(`(request, context: Context<...>) => Promise<Response>`), a type error at the call site, not at
174+
the provide site. `HttpRouter.serve` (used by `packages/cli`'s daemon) does not draw this same
175+
distinction, which is why the equivalent fix there was just adding the node to the existing
176+
`Layer.provide(AppNodeBuilder.build(...))` list.
177+
101178
## Merge-blocking gates
102179

103180
These gates are **merge-blocking conditions**, not aspirations. A PR that trips one does not
@@ -228,6 +305,7 @@ your own regression** — check whether it matches one of these first.
228305
| `unit (windows)` — **mode B, intermittent** | `bun install --linker hoisted` fails applying the `@ai-sdk/[email protected]` patch | `error: renaming changes to cache dir: ENOTEMPTY: ... Directory not empty (NtSetInformationFile())` — matches the exact race described in [`oven-sh/bun#28147`](https://github.com/oven-sh/bun/issues/28147), which the workflow's own `bun install --linker hoisted` comment already references. Identical failure on 2/2 independent reruns at the time it was recorded. `ubuntu-latest` is unaffected. Listed alongside mode A rather than replaced by it: this mode is real and was observed, it simply is not the only way Windows goes red, and in later runs install succeeded and the job reached the tests instead. | feedback #136 (internal tracker) | Resolves when bun's patch-apply race is fixed upstream, or worked around (e.g. serialize patch application on Windows, or pin an unaffected bun patch-apply path). |
229306
| `unit (linux)` | `packages/opencode/test/cli/run/run-process.test.ts:79` — "exits nonzero promptly when the model is unknown (regression for #27371)" | `expect(result.durationMs).toBeLessThan(15_000)` received `15285ms` then `15275ms` on two independent reruns — consistently ~275–285ms *over* the `timeoutMs: 15_000` configured two lines above the assertion. The pattern (always just past the exact configured timeout, not randomly distributed) suggests the "unknown model" fast-fail path is not triggering on GitHub Actions' network, and the process is instead being killed by its own `timeoutMs` — which structurally cannot finish before the timeout it races against. Not exercised by TKT-304's local baseline (that baseline ran `packages/core test` + `packages/opencode test:httpapi` + `packages/app test` specifically, not `packages/opencode`'s own broader suite that `bun turbo test` pulls in). | feedback #136 (internal tracker) | Resolves when #136 is triaged — either the fast-fail detection is fixed, or the test's timing assumption is loosened for CI network conditions. |
230307
| `packages/opencode test:httpapi` — **`mode=effect` only** | `GET /api/session/{sessionID}/goal` — `v2.session.goal.get` — "a session with no goal set should report no data" | Was masked by a crash: `session.goal`/`session.ledger` routes 500'd with "Service not found" on every mode, because the app's `LayerNode.group` in `packages/opencode/src/server/routes/instance/httpapi/server.ts` never listed `SessionGoal.node`/`SessionLedger.node` (a gap in [#7](https://github.com/Draugur-AI/opencode/pull/7), fixed standalone once found while working TKT-315). Fixing that crash let this route reach its own assertion, which fails only in `mode=effect` — `mode=coverage` and `mode=auth` both pass. Confirmed deterministic across reruns. | feedback #145 (internal tracker) | Resolves when #145 is triaged against TKT-317's own code — not a node-wiring issue, the route runs now, its behavior is wrong. |
308+
| `unit (linux)` — **run-process under load, MITIGATED not currently red** | Up to 7 additional tests in `packages/opencode/test/cli/run/run-process.test.ts`, all clustered 700-800ms over the harness's 30\_000ms default `timeoutMs` (e.g. 30740-30800ms) | TKT-315 added `ProjectV2.node`/`SessionGoal.node`/`SessionLedger.node` to `app-runtime.ts`'s `AppLayer` (see "Adding a new global `.node`?" above -- all three traced reachable, not removable). None of the three do eager I/O at layer construction, but building 3 more global nodes has nonzero cost, and `run-process.test.ts` spawns 13 real CLI subprocesses concurrently (`cliIt.concurrent`) -- isolated single-test timing showed no difference between branches (8 runs each, fully overlapping), but 6x full-file runs did: dev-baseline [11.23s-11.69s] vs the branch with these 3 nodes [11.73s-11.91s], non-overlapping. Invisible locally (this machine has headroom the CI runners don't); on CI this plausibly tips several already-borderline subprocess spawns over their timeout at once. A CI rerun of the pre-fix commit came back fully clean (0 fail) on one attempt, so the failure is a mix of this real overhead and environmental variance, not 100% deterministic either way. Interim mitigation landed in the same PR: `timeoutMs` raised from 30\_000 to 45\_000 (and the outer test timeout to match) on the 7 affected tests only, each commented and linked here -- the real fix is lazy node construction, not a rider on a feature PR. | feedback #150 (internal tracker) | Resolves when #150 is triaged and global nodes construct lazily on first use instead of eagerly at `AppLayer` boot; the `timeoutMs` widen reverts once that lands. |
231309

232310
## The milestone-1 required gate
233311

‎packages/cli/src/commands/handlers/serve.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { NodeHttpServer } from "@effect/platform-node"
22
import { Credential } from "@opencode-ai/core/credential"
33
import { AppNodeBuilder } from "@opencode-ai/core/effect/app-node-builder"
4+
import { EventV2 } from "@opencode-ai/core/event"
45
import { LayerNode } from "@opencode-ai/core/effect/layer-node"
56
import { PermissionSaved } from "@opencode-ai/core/permission/saved"
7+
import { ProjectV2 } from "@opencode-ai/core/project"
68
import { SessionGoal } from "@opencode-ai/core/session/goal"
79
import { SessionLedger } from "@opencode-ai/core/session/ledger"
810
import { Context, Layer, Option } from "effect"
@@ -43,7 +45,16 @@ function bind(hostname: string, port: number, password: string) {
4345
HttpRouter.serve(createRoutes(password), { disableListenLog: true, disableLogger: true }).pipe(
4446
Layer.provideMerge(NodeHttpServer.layer(() => createServer(), { port, host: hostname })),
4547
Layer.provide(
46-
AppNodeBuilder.build(LayerNode.group([Credential.node, PermissionSaved.node, SessionGoal.node, SessionLedger.node])),
48+
AppNodeBuilder.build(
49+
LayerNode.group([
50+
Credential.node,
51+
EventV2.node,
52+
PermissionSaved.node,
53+
ProjectV2.node,
54+
SessionGoal.node,
55+
SessionLedger.node,
56+
]),
57+
),
4758
),
4859
),
4960
).pipe(Effect.map((context) => Context.get(context, HttpServer.HttpServer).address))

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

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,76 @@ const adaptGroup19 = (raw: RawClient["server.projectCopy"]) => ({
870870
refresh: Endpoint19_2(raw),
871871
})
872872

873+
const Endpoint20_0 = (raw: RawClient["server.project"]) => () =>
874+
raw["project.list"]({}).pipe(
875+
Effect.mapError(mapClientError),
876+
Effect.map((value) => value.data),
877+
)
878+
879+
type Endpoint20_1Request = Parameters<RawClient["server.project"]["project.get"]>[0]
880+
type Endpoint20_1Input = { readonly projectID: Endpoint20_1Request["params"]["projectID"] }
881+
const Endpoint20_1 = (raw: RawClient["server.project"]) => (input: Endpoint20_1Input) =>
882+
raw["project.get"]({ params: { projectID: input["projectID"] } }).pipe(
883+
Effect.mapError(mapClientError),
884+
Effect.map((value) => value.data),
885+
)
886+
887+
type Endpoint20_2Request = Parameters<RawClient["server.project"]["project.updateMetadata"]>[0]
888+
type Endpoint20_2Input = {
889+
readonly projectID: Endpoint20_2Request["params"]["projectID"]
890+
readonly name?: Endpoint20_2Request["payload"]["name"]
891+
readonly icon?: Endpoint20_2Request["payload"]["icon"]
892+
readonly commands?: Endpoint20_2Request["payload"]["commands"]
893+
}
894+
const Endpoint20_2 = (raw: RawClient["server.project"]) => (input: Endpoint20_2Input) =>
895+
raw["project.updateMetadata"]({
896+
params: { projectID: input["projectID"] },
897+
payload: { name: input["name"], icon: input["icon"], commands: input["commands"] },
898+
}).pipe(
899+
Effect.mapError(mapClientError),
900+
Effect.map((value) => value.data),
901+
)
902+
903+
type Endpoint20_3Request = Parameters<RawClient["server.project"]["project.preference.read"]>[0]
904+
type Endpoint20_3Input = { readonly projectID: Endpoint20_3Request["params"]["projectID"] }
905+
const Endpoint20_3 = (raw: RawClient["server.project"]) => (input: Endpoint20_3Input) =>
906+
raw["project.preference.read"]({ params: { projectID: input["projectID"] } }).pipe(
907+
Effect.mapError(mapClientError),
908+
Effect.map((value) => value.data),
909+
)
910+
911+
type Endpoint20_4Request = Parameters<RawClient["server.project"]["project.preference.write"]>[0]
912+
type Endpoint20_4Input = {
913+
readonly projectID: Endpoint20_4Request["params"]["projectID"]
914+
readonly favorite?: Endpoint20_4Request["payload"]["favorite"]
915+
readonly rank?: Endpoint20_4Request["payload"]["rank"]
916+
readonly hidden?: Endpoint20_4Request["payload"]["hidden"]
917+
readonly lastOpenedAt?: Endpoint20_4Request["payload"]["lastOpenedAt"]
918+
readonly expectedRevision?: Endpoint20_4Request["payload"]["expectedRevision"]
919+
}
920+
const Endpoint20_4 = (raw: RawClient["server.project"]) => (input: Endpoint20_4Input) =>
921+
raw["project.preference.write"]({
922+
params: { projectID: input["projectID"] },
923+
payload: {
924+
favorite: input["favorite"],
925+
rank: input["rank"],
926+
hidden: input["hidden"],
927+
lastOpenedAt: input["lastOpenedAt"],
928+
expectedRevision: input["expectedRevision"],
929+
},
930+
}).pipe(
931+
Effect.mapError(mapClientError),
932+
Effect.map((value) => value.data),
933+
)
934+
935+
const adaptGroup20 = (raw: RawClient["server.project"]) => ({
936+
list: Endpoint20_0(raw),
937+
get: Endpoint20_1(raw),
938+
updateMetadata: Endpoint20_2(raw),
939+
read: Endpoint20_3(raw),
940+
write: Endpoint20_4(raw),
941+
})
942+
873943
const adaptClient = (raw: RawClient) => ({
874944
health: adaptGroup0(raw["server.health"]),
875945
location: adaptGroup1(raw["server.location"]),
@@ -891,6 +961,7 @@ const adaptClient = (raw: RawClient) => ({
891961
questions: adaptGroup17(raw["server.question"]),
892962
references: adaptGroup18(raw["server.reference"]),
893963
projectCopies: adaptGroup19(raw["server.projectCopy"]),
964+
"server.project": adaptGroup20(raw["server.project"]),
894965
})
895966

896967
export const make = (options?: { readonly baseUrl?: URL | string }) =>

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

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,15 @@ import type {
136136
ProjectCopiesRemoveOutput,
137137
ProjectCopiesRefreshInput,
138138
ProjectCopiesRefreshOutput,
139+
ServerProjectListOutput,
140+
ServerProjectGetInput,
141+
ServerProjectGetOutput,
142+
ServerProjectUpdateMetadataInput,
143+
ServerProjectUpdateMetadataOutput,
144+
ServerProjectReadInput,
145+
ServerProjectReadOutput,
146+
ServerProjectWriteInput,
147+
ServerProjectWriteOutput,
139148
} from "./types"
140149
import { ClientError } from "./client-error"
141150

@@ -1164,6 +1173,65 @@ export function make(options: ClientOptions) {
11641173
requestOptions,
11651174
),
11661175
},
1176+
"server.project": {
1177+
list: (requestOptions?: RequestOptions) =>
1178+
request<{ readonly data: ServerProjectListOutput }>(
1179+
{ method: "GET", path: `/api/project`, successStatus: 200, declaredStatuses: [401, 400], empty: false },
1180+
requestOptions,
1181+
).then((value) => value.data),
1182+
get: (input: ServerProjectGetInput, requestOptions?: RequestOptions) =>
1183+
request<{ readonly data: ServerProjectGetOutput }>(
1184+
{
1185+
method: "GET",
1186+
path: `/api/project/${encodeURIComponent(input.projectID)}`,
1187+
successStatus: 200,
1188+
declaredStatuses: [404, 401, 400],
1189+
empty: false,
1190+
},
1191+
requestOptions,
1192+
).then((value) => value.data),
1193+
updateMetadata: (input: ServerProjectUpdateMetadataInput, requestOptions?: RequestOptions) =>
1194+
request<{ readonly data: ServerProjectUpdateMetadataOutput }>(
1195+
{
1196+
method: "PATCH",
1197+
path: `/api/project/${encodeURIComponent(input.projectID)}`,
1198+
body: { name: input["name"], icon: input["icon"], commands: input["commands"] },
1199+
successStatus: 200,
1200+
declaredStatuses: [404, 401, 400],
1201+
empty: false,
1202+
},
1203+
requestOptions,
1204+
).then((value) => value.data),
1205+
read: (input: ServerProjectReadInput, requestOptions?: RequestOptions) =>
1206+
request<{ readonly data: ServerProjectReadOutput }>(
1207+
{
1208+
method: "GET",
1209+
path: `/api/project/${encodeURIComponent(input.projectID)}/preference`,
1210+
successStatus: 200,
1211+
declaredStatuses: [401, 400],
1212+
empty: false,
1213+
},
1214+
requestOptions,
1215+
).then((value) => value.data),
1216+
write: (input: ServerProjectWriteInput, requestOptions?: RequestOptions) =>
1217+
request<{ readonly data: ServerProjectWriteOutput }>(
1218+
{
1219+
method: "PATCH",
1220+
path: `/api/project/${encodeURIComponent(input.projectID)}/preference`,
1221+
body: {
1222+
favorite: input["favorite"],
1223+
rank: input["rank"],
1224+
hidden: input["hidden"],
1225+
lastOpenedAt: input["lastOpenedAt"],
1226+
expectedRevision: input["expectedRevision"],
1227+
},
1228+
successStatus: 200,
1229+
declaredStatuses: [409, 404, 401, 400],
1230+
empty: false,
1231+
},
1232+
requestOptions,
1233+
).then((value) => value.data),
1234+
},
11671235
}
11681236
}
11691237

0 commit comments

Comments
 (0)