@cat-factory/server 0.294.0 → 0.296.0
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/dist/agents/promptOverrides.d.ts +3 -4
- package/dist/agents/promptOverrides.d.ts.map +1 -1
- package/dist/agents/promptOverrides.js +5 -9
- package/dist/agents/promptOverrides.js.map +1 -1
- package/dist/agents/toolServers.d.ts.map +1 -1
- package/dist/agents/toolServers.js +15 -1
- package/dist/agents/toolServers.js.map +1 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +10 -0
- package/dist/app.js.map +1 -1
- package/dist/github/FetchGitHubClient.d.ts +2 -0
- package/dist/github/FetchGitHubClient.d.ts.map +1 -1
- package/dist/github/FetchGitHubClient.js +17 -91
- package/dist/github/FetchGitHubClient.js.map +1 -1
- package/dist/github/githubHttpHelpers.d.ts +59 -3
- package/dist/github/githubHttpHelpers.d.ts.map +1 -1
- package/dist/github/githubHttpHelpers.js +59 -4
- package/dist/github/githubHttpHelpers.js.map +1 -1
- package/dist/github/repoContents.d.ts +31 -0
- package/dist/github/repoContents.d.ts.map +1 -0
- package/dist/github/repoContents.js +121 -0
- package/dist/github/repoContents.js.map +1 -0
- package/dist/http/env.d.ts +10 -1
- package/dist/http/env.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/agentKinds/AgentKindsController.d.ts +46 -0
- package/dist/modules/agentKinds/AgentKindsController.d.ts.map +1 -0
- package/dist/modules/agentKinds/AgentKindsController.js +56 -0
- package/dist/modules/agentKinds/AgentKindsController.js.map +1 -0
- package/dist/modules/persistence/PersistenceController.d.ts.map +1 -1
- package/dist/modules/persistence/PersistenceController.js +6 -161
- package/dist/modules/persistence/PersistenceController.js.map +1 -1
- package/dist/modules/persistence/dispatchScope.d.ts +16 -0
- package/dist/modules/persistence/dispatchScope.d.ts.map +1 -0
- package/dist/modules/persistence/dispatchScope.js +307 -0
- package/dist/modules/persistence/dispatchScope.js.map +1 -0
- package/dist/modules/publicApi/PublicProvisioningController.d.ts +57 -1
- package/dist/modules/publicApi/PublicProvisioningController.d.ts.map +1 -1
- package/dist/modules/publicApi/PublicProvisioningController.js +204 -8
- package/dist/modules/publicApi/PublicProvisioningController.js.map +1 -1
- package/dist/modules/publicApi/boardProjection.d.ts +9 -3
- package/dist/modules/publicApi/boardProjection.d.ts.map +1 -1
- package/dist/modules/publicApi/boardProjection.js +41 -8
- package/dist/modules/publicApi/boardProjection.js.map +1 -1
- package/dist/modules/publicApi/openapiDocument.generated.d.ts +1 -1
- package/dist/modules/publicApi/openapiDocument.generated.d.ts.map +1 -1
- package/dist/modules/publicApi/openapiDocument.generated.js +1 -1
- package/dist/modules/publicApi/openapiDocument.generated.js.map +1 -1
- package/dist/persistence/agentKinds.d.ts +43 -0
- package/dist/persistence/agentKinds.d.ts.map +1 -0
- package/dist/persistence/agentKinds.js +99 -0
- package/dist/persistence/agentKinds.js.map +1 -0
- package/dist/persistence/rpc-allowlist-libraries.d.ts +4 -0
- package/dist/persistence/rpc-allowlist-libraries.d.ts.map +1 -0
- package/dist/persistence/rpc-allowlist-libraries.js +209 -0
- package/dist/persistence/rpc-allowlist-libraries.js.map +1 -0
- package/dist/persistence/rpc-allowlist-vcs.d.ts +24 -0
- package/dist/persistence/rpc-allowlist-vcs.d.ts.map +1 -0
- package/dist/persistence/rpc-allowlist-vcs.js +119 -0
- package/dist/persistence/rpc-allowlist-vcs.js.map +1 -0
- package/dist/persistence/rpc-allowlist.d.ts.map +1 -1
- package/dist/persistence/rpc-allowlist.js +66 -249
- package/dist/persistence/rpc-allowlist.js.map +1 -1
- package/dist/persistence/rpc-scope.logic.d.ts +46 -0
- package/dist/persistence/rpc-scope.logic.d.ts.map +1 -1
- package/dist/persistence/rpc-scope.logic.js +109 -0
- package/dist/persistence/rpc-scope.logic.js.map +1 -1
- package/dist/persistence/rpc.d.ts +111 -0
- package/dist/persistence/rpc.d.ts.map +1 -1
- package/dist/persistence/rpc.js +42 -44
- package/dist/persistence/rpc.js.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-request READ MEMO, plus the one registry substitution it earns.
|
|
3
|
+
*
|
|
4
|
+
* Every entity-keyed scope rule resolves a row to bind the call, and for a handful of methods that
|
|
5
|
+
* row IS what the call then dispatches. Memoising each read per request keeps those to one query,
|
|
6
|
+
* and the `memoOverrides` table points the dispatched method at the same memo. Extracted from
|
|
7
|
+
* {@link buildDispatchScope} when the batched resolvers pushed it past its function-size budget:
|
|
8
|
+
* this half is about READING ONCE, the other about what a read MEANS for scope.
|
|
9
|
+
*/
|
|
10
|
+
function buildRequestReaders(registry, request) {
|
|
11
|
+
const workspaceRepository = registry.workspaceRepository;
|
|
12
|
+
const blockRepository = registry.blockRepository;
|
|
13
|
+
const serviceRepository = registry.serviceRepository;
|
|
14
|
+
const skillSourceRepository = registry.skillSourceRepository;
|
|
15
|
+
// The owner-pair content-library source tables, keyed by the `LibrarySourceEntity` the rule
|
|
16
|
+
// names, so one resolver answers for both (and a new library is one row here). Keyed by the
|
|
17
|
+
// UNION rather than by `string`: a member added to `LibrarySourceEntity` must fail to compile
|
|
18
|
+
// here rather than resolve to nothing, which the stored-half check would otherwise be entitled
|
|
19
|
+
// to read as "no such row" and admit.
|
|
20
|
+
const librarySourceRepos = {
|
|
21
|
+
fragmentSource: registry.fragmentSourceRepository,
|
|
22
|
+
foundationalServiceSource: registry.foundationalServiceSourceRepository,
|
|
23
|
+
};
|
|
24
|
+
const resolveAccountId = (workspaceId) => workspaceRepository?.accountOf?.(workspaceId) ??
|
|
25
|
+
Promise.resolve(undefined);
|
|
26
|
+
// The BATCHED account read every list-shaped rule binds through. A registry that does not wire
|
|
27
|
+
// it answers an empty map, which fails every id closed rather than admitting one: the same
|
|
28
|
+
// disposition an unresolvable `accountOf` already has.
|
|
29
|
+
const readAccountIds = async (workspaceIds) => (await workspaceRepository?.accountIdsOf?.(workspaceIds)) ?? {};
|
|
30
|
+
// The `block`/`serviceList`/`service` scope checks resolve the owning account by reading the
|
|
31
|
+
// entity (`blockRepository.findById` / `serviceRepository.listByIds`). When the request ALSO
|
|
32
|
+
// dispatches that same read, memoise it per request so the resolver's read is reused instead
|
|
33
|
+
// of issuing a second identical query. `serviceRepository.get(id)` is the single-service form:
|
|
34
|
+
// its `service` scope resolves via `listByIds([id])`, so the dispatched `get` is routed through
|
|
35
|
+
// the same memo (a single-id `listByIds` yields the same row) rather than a second point read.
|
|
36
|
+
// (For every other `serviceList` method the dispatched method differs from the resolver's read,
|
|
37
|
+
// so there is nothing to dedupe.)
|
|
38
|
+
const memoizeRead = (fn) => {
|
|
39
|
+
const cache = new Map();
|
|
40
|
+
return (...args) => {
|
|
41
|
+
const key = JSON.stringify(args);
|
|
42
|
+
const hit = cache.get(key);
|
|
43
|
+
if (hit)
|
|
44
|
+
return hit;
|
|
45
|
+
const pending = Promise.resolve(fn(...args));
|
|
46
|
+
cache.set(key, pending);
|
|
47
|
+
return pending;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const installationRepository = registry.githubInstallationRepository;
|
|
51
|
+
const blockFindById = memoizeRead((blockId) => blockRepository?.findById?.(blockId));
|
|
52
|
+
// One memo per installation id, shared by the resolver and (via the override below) the
|
|
53
|
+
// dispatched point read, exactly as the source tables do. Built only when the repository is
|
|
54
|
+
// wired, so an unwired one answers `unreadable` rather than the absence an id-keyed upsert
|
|
55
|
+
// would be entitled to read as a create.
|
|
56
|
+
const installationGet = typeof installationRepository?.getByInstallationId === 'function'
|
|
57
|
+
? memoizeRead((id) => installationRepository.getByInstallationId(id))
|
|
58
|
+
: undefined;
|
|
59
|
+
const blockFindByIds = memoizeRead((ids) => blockRepository?.findByIds?.(ids));
|
|
60
|
+
// One memo per requested SET of workspace ids, shared by the resolver and (via the override
|
|
61
|
+
// below) the dispatched `accountIdsOf`, exactly as the other self-keyed reads do.
|
|
62
|
+
const accountIdsOf = memoizeRead((ids) => readAccountIds(ids));
|
|
63
|
+
const installationListByIds = memoizeRead((ids) => installationRepository?.listByInstallationIds?.(ids));
|
|
64
|
+
const serviceListByIds = memoizeRead((ids) => serviceRepository?.listByIds?.(ids));
|
|
65
|
+
const skillSourceGet = memoizeRead((id) => skillSourceRepository?.get?.(id));
|
|
66
|
+
// One memo per source TABLE, keyed by entity: the resolver and the dispatched `get` of the same
|
|
67
|
+
// library then share a read, exactly as `skillSourceGet` does for skills. A table whose `get`
|
|
68
|
+
// this deployment does not wire gets NO reader rather than one answering `undefined`, so the
|
|
69
|
+
// resolver below can report `unreadable` instead of the absence that would admit an upsert.
|
|
70
|
+
const librarySourceReader = (entity) => {
|
|
71
|
+
const repo = librarySourceRepos[entity];
|
|
72
|
+
if (typeof repo?.get !== 'function')
|
|
73
|
+
return undefined;
|
|
74
|
+
// Called through the repository so a class-implemented `get` keeps its receiver.
|
|
75
|
+
return memoizeRead((id) => repo.get(id));
|
|
76
|
+
};
|
|
77
|
+
const librarySourceGets = {
|
|
78
|
+
fragmentSource: librarySourceReader('fragmentSource'),
|
|
79
|
+
foundationalServiceSource: librarySourceReader('foundationalServiceSource'),
|
|
80
|
+
};
|
|
81
|
+
// For the self-keyed reads, point the dispatcher's own call at the memo so it hits the
|
|
82
|
+
// resolver's already-resolved result. Only the one dispatched method is overridden; the rest
|
|
83
|
+
// of the registry is untouched. Keyed `repo.method` so a new self-keyed read is one row here
|
|
84
|
+
// rather than another rung on a ternary chain.
|
|
85
|
+
const serviceGetViaMemo = async (id) => (await serviceListByIds([id]))?.[0] ?? null;
|
|
86
|
+
const memoOverrides = {
|
|
87
|
+
'blockRepository.findById': { blockRepository: { findById: blockFindById } },
|
|
88
|
+
'blockRepository.findByIds': { blockRepository: { findByIds: blockFindByIds } },
|
|
89
|
+
'serviceRepository.listByIds': { serviceRepository: { listByIds: serviceListByIds } },
|
|
90
|
+
'serviceRepository.get': { serviceRepository: { get: serviceGetViaMemo } },
|
|
91
|
+
// The two batched self-keyed reads: the `workspaceList` rule resolves the accounts of exactly
|
|
92
|
+
// the ids `accountIdsOf` is being asked for, and `installationList` resolves the owners of
|
|
93
|
+
// exactly the ids `listByInstallationIds` is being asked for.
|
|
94
|
+
'workspaceRepository.accountIdsOf': { workspaceRepository: { accountIdsOf } },
|
|
95
|
+
'githubInstallationRepository.listByInstallationIds': {
|
|
96
|
+
githubInstallationRepository: { listByInstallationIds: installationListByIds },
|
|
97
|
+
},
|
|
98
|
+
// The `skillSource` scope resolves a source's account by reading the source; when the
|
|
99
|
+
// dispatched call IS that read (the sync service's `get`), reuse the resolver's result.
|
|
100
|
+
'skillSourceRepository.get': { skillSourceRepository: { get: skillSourceGet } },
|
|
101
|
+
// The same self-keyed read for an installation: the `installation` rule resolves the row to
|
|
102
|
+
// scope the call, and the dispatched `getByInstallationId` IS that row.
|
|
103
|
+
...(installationGet
|
|
104
|
+
? {
|
|
105
|
+
'githubInstallationRepository.getByInstallationId': {
|
|
106
|
+
githubInstallationRepository: { getByInstallationId: installationGet },
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
: {}),
|
|
110
|
+
// The same self-keyed read for the two owner-pair libraries' source tables. Contributed only
|
|
111
|
+
// where a reader exists: a table whose `get` is unwired has nothing to memoise, and the
|
|
112
|
+
// dispatcher's own wiring check answers that call with `... is not wired` regardless.
|
|
113
|
+
...(librarySourceGets.fragmentSource
|
|
114
|
+
? {
|
|
115
|
+
'fragmentSourceRepository.get': {
|
|
116
|
+
fragmentSourceRepository: { get: librarySourceGets.fragmentSource },
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
: {}),
|
|
120
|
+
...(librarySourceGets.foundationalServiceSource
|
|
121
|
+
? {
|
|
122
|
+
'foundationalServiceSourceRepository.get': {
|
|
123
|
+
foundationalServiceSourceRepository: {
|
|
124
|
+
get: librarySourceGets.foundationalServiceSource,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
}
|
|
128
|
+
: {}),
|
|
129
|
+
};
|
|
130
|
+
// Substitute ONLY for a method the real registry actually wires. `memoizeRead` returns a
|
|
131
|
+
// function unconditionally — it closes over an optional-chained call — so overriding an ABSENT
|
|
132
|
+
// repository would satisfy the dispatcher's `typeof fn !== 'function'` wiring check and answer a
|
|
133
|
+
// misconfigured deployment with a scope 404 (or a bare null) instead of the `... is not wired`
|
|
134
|
+
// that names what to fix. The key is only ever consulted after `Object.hasOwn`, so an
|
|
135
|
+
// attacker-controlled `request.repo` cannot reach an inherited member through the lookup below.
|
|
136
|
+
const memoKey = `${request.repo}.${request.method}`;
|
|
137
|
+
const override = Object.hasOwn(memoOverrides, memoKey)
|
|
138
|
+
? typeof registry[request.repo]?.[request.method] === 'function'
|
|
139
|
+
? memoOverrides[memoKey]
|
|
140
|
+
: undefined
|
|
141
|
+
: undefined;
|
|
142
|
+
const registryForDispatch = override ? { ...registry, ...override } : registry;
|
|
143
|
+
return {
|
|
144
|
+
registryForDispatch,
|
|
145
|
+
blockRepository,
|
|
146
|
+
installationRepository,
|
|
147
|
+
resolveAccountId,
|
|
148
|
+
accountIdsOf,
|
|
149
|
+
blockFindById,
|
|
150
|
+
blockFindByIds,
|
|
151
|
+
serviceListByIds,
|
|
152
|
+
skillSourceGet,
|
|
153
|
+
librarySourceGets,
|
|
154
|
+
installationGet,
|
|
155
|
+
installationListByIds,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The per-request SCOPE RESOLUTION half of `POST /internal/persistence`: the entity readers the
|
|
160
|
+
* dispatcher binds a call through (block → workspace → account, service → account, a library
|
|
161
|
+
* source's owner pair, an installation's owner, an account's roster), over the per-request memo
|
|
162
|
+
* {@link buildRequestReaders} builds.
|
|
163
|
+
*
|
|
164
|
+
* Split out of `PersistenceController` when the surface completion pushed the handler past its
|
|
165
|
+
* function-size budget. It is the half that grows: every new entity-keyed scope rule adds a
|
|
166
|
+
* resolver here, while the controller's own job (gate, parse, dispatch, relay) does not change.
|
|
167
|
+
*/
|
|
168
|
+
export function buildDispatchScope(registry, request, scope) {
|
|
169
|
+
const { registryForDispatch, blockRepository, installationRepository, resolveAccountId, accountIdsOf, blockFindById, blockFindByIds, serviceListByIds, skillSourceGet, librarySourceGets, installationGet, installationListByIds, } = buildRequestReaders(registry, request);
|
|
170
|
+
return {
|
|
171
|
+
registry: registryForDispatch,
|
|
172
|
+
scope,
|
|
173
|
+
resolveAccountId,
|
|
174
|
+
resolveAccountIds: async (workspaceIds) => {
|
|
175
|
+
const accounts = (await accountIdsOf(workspaceIds));
|
|
176
|
+
return new Map(Object.entries(accounts));
|
|
177
|
+
},
|
|
178
|
+
// A block is keyed only by its id; resolve its home workspace, then that workspace's account.
|
|
179
|
+
resolveBlockAccountId: async (blockId) => {
|
|
180
|
+
const found = (await blockFindById(blockId));
|
|
181
|
+
const workspaceId = found?.workspaceId;
|
|
182
|
+
return typeof workspaceId === 'string' ? resolveAccountId(workspaceId) : undefined;
|
|
183
|
+
},
|
|
184
|
+
// The batched form, in exactly two reads however long the list: one `findByIds` resolves every
|
|
185
|
+
// block's home workspace, then ONE `accountIdsOf` over the deduped workspaces. A block absent
|
|
186
|
+
// from either read is absent from the map.
|
|
187
|
+
resolveBlockAccountIds: async (blockIds) => {
|
|
188
|
+
const found = (await blockFindByIds(blockIds));
|
|
189
|
+
const entries = found ?? [];
|
|
190
|
+
const accounts = (await accountIdsOf([
|
|
191
|
+
...new Set(entries.map((entry) => entry.workspaceId)),
|
|
192
|
+
]));
|
|
193
|
+
const map = new Map();
|
|
194
|
+
for (const entry of entries) {
|
|
195
|
+
map.set(entry.block.id, Object.hasOwn(accounts, entry.workspaceId) ? accounts[entry.workspaceId] : undefined);
|
|
196
|
+
}
|
|
197
|
+
return map;
|
|
198
|
+
},
|
|
199
|
+
// Services are account-owned; resolve each requested id's `accountId` for the scope check.
|
|
200
|
+
resolveServiceAccountIds: async (serviceIds) => {
|
|
201
|
+
const services = (await serviceListByIds(serviceIds));
|
|
202
|
+
const map = new Map();
|
|
203
|
+
for (const service of services ?? [])
|
|
204
|
+
map.set(service.id, service.accountId);
|
|
205
|
+
return map;
|
|
206
|
+
},
|
|
207
|
+
// Skill sources are account-owned; the sync surface's methods carry only a source id, so
|
|
208
|
+
// resolve the row and project its `accountId` for the scope check. A source that does not
|
|
209
|
+
// exist resolves to undefined, which fails closed (404) exactly like a missing block/service.
|
|
210
|
+
resolveSkillSourceAccountId: async (sourceId) => {
|
|
211
|
+
const source = (await skillSourceGet(sourceId));
|
|
212
|
+
return source?.accountId;
|
|
213
|
+
},
|
|
214
|
+
// The owner-PAIR libraries' equivalent: a fragment / foundational-service source is owned by
|
|
215
|
+
// an `(ownerKind, ownerId)` tier rather than an account, so project the pair and let the rule
|
|
216
|
+
// resolve it the way it resolves a positional owner. A source that does not exist answers
|
|
217
|
+
// `absent`, which the sourceId-keyed rules fail closed on (404) exactly like a missing
|
|
218
|
+
// block/service, and which `ownerFieldUpsert` alone reads as a create.
|
|
219
|
+
resolveLibrarySourceOwner: async (entity, sourceId) => {
|
|
220
|
+
const read = librarySourceGets[entity];
|
|
221
|
+
// No reader for that table: nothing is known about the id, so say so. Answering `absent`
|
|
222
|
+
// here would let an id-keyed upsert through on its DECLARED owner alone.
|
|
223
|
+
if (!read)
|
|
224
|
+
return { status: 'unreadable' };
|
|
225
|
+
const source = (await read(sourceId));
|
|
226
|
+
return source
|
|
227
|
+
? { status: 'found', owner: { ownerKind: source.ownerKind, ownerId: source.ownerId } }
|
|
228
|
+
: { status: 'absent' };
|
|
229
|
+
},
|
|
230
|
+
// A VCS installation binds either an ACCOUNT (a GitHub App installation, shared with every
|
|
231
|
+
// board of that account) or just its connector WORKSPACE (a per-workspace PAT, which stores
|
|
232
|
+
// no account). Resolve the effective owner so both bind the same way, and keep "no such
|
|
233
|
+
// binding" apart from "this deployment cannot read the table": the batched annotation read
|
|
234
|
+
// admits the first and must refuse the second.
|
|
235
|
+
resolveInstallationOwner: async (installationId) => {
|
|
236
|
+
if (!installationGet)
|
|
237
|
+
return { status: 'unreadable' };
|
|
238
|
+
const row = (await installationGet(installationId));
|
|
239
|
+
if (!row)
|
|
240
|
+
return { status: 'absent' };
|
|
241
|
+
if (typeof row.accountId === 'string')
|
|
242
|
+
return { status: 'found', accountId: row.accountId };
|
|
243
|
+
const workspaceId = row.workspaceId;
|
|
244
|
+
return {
|
|
245
|
+
status: 'found',
|
|
246
|
+
accountId: typeof workspaceId === 'string' ? await resolveAccountId(workspaceId) : null,
|
|
247
|
+
};
|
|
248
|
+
},
|
|
249
|
+
// The batched form: one `listByInstallationIds` plus one `accountIdsOf` over the connector
|
|
250
|
+
// workspaces of the PAT bindings that store no account. Ids with no binding are absent from
|
|
251
|
+
// the read, so the rule sees them as `absent` (the admission the annotation read needs) while
|
|
252
|
+
// an UNWIRED repository yields no map at all, which the rule fails closed on.
|
|
253
|
+
resolveInstallationOwners: async (installationIds) => {
|
|
254
|
+
const owners = new Map();
|
|
255
|
+
if (typeof installationRepository?.listByInstallationIds !== 'function') {
|
|
256
|
+
for (const id of installationIds)
|
|
257
|
+
owners.set(id, { status: 'unreadable' });
|
|
258
|
+
return owners;
|
|
259
|
+
}
|
|
260
|
+
const rows = ((await installationListByIds(installationIds)) ?? []);
|
|
261
|
+
const patWorkspaces = rows
|
|
262
|
+
.filter((row) => typeof row.accountId !== 'string' && typeof row.workspaceId === 'string')
|
|
263
|
+
.map((row) => row.workspaceId);
|
|
264
|
+
const accounts = (await accountIdsOf([...new Set(patWorkspaces)]));
|
|
265
|
+
for (const row of rows) {
|
|
266
|
+
if (typeof row.accountId === 'string') {
|
|
267
|
+
owners.set(row.installationId, { status: 'found', accountId: row.accountId });
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
const workspaceId = row.workspaceId;
|
|
271
|
+
owners.set(row.installationId, {
|
|
272
|
+
status: 'found',
|
|
273
|
+
accountId: typeof workspaceId === 'string' && Object.hasOwn(accounts, workspaceId)
|
|
274
|
+
? accounts[workspaceId]
|
|
275
|
+
: null,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
for (const id of installationIds) {
|
|
279
|
+
if (!owners.has(id))
|
|
280
|
+
owners.set(id, { status: 'absent' });
|
|
281
|
+
}
|
|
282
|
+
return owners;
|
|
283
|
+
},
|
|
284
|
+
// A service's frame block, as the three states `serviceInsert` needs: the row is written
|
|
285
|
+
// BEFORE its block, so `absent` is the ordinary create and only `found` binds.
|
|
286
|
+
resolveFrameBlockOwner: async (frameBlockId) => {
|
|
287
|
+
if (typeof blockRepository?.findById !== 'function')
|
|
288
|
+
return { status: 'unreadable' };
|
|
289
|
+
const found = (await blockFindById(frameBlockId));
|
|
290
|
+
if (!found)
|
|
291
|
+
return { status: 'absent' };
|
|
292
|
+
const workspaceId = found.workspaceId;
|
|
293
|
+
return {
|
|
294
|
+
status: 'found',
|
|
295
|
+
accountId: typeof workspaceId === 'string' ? await resolveAccountId(workspaceId) : null,
|
|
296
|
+
};
|
|
297
|
+
},
|
|
298
|
+
// The member-display scope (`user`/`userList`): a userId is in scope iff a co-member of an
|
|
299
|
+
// in-scope account, so resolve each in-scope account's roster to userIds. Bounded by the
|
|
300
|
+
// token's account scope, not the requested user list.
|
|
301
|
+
resolveAccountMemberIds: async (accountId) => {
|
|
302
|
+
const memberships = (await registry.membershipRepository?.listByAccount?.(accountId));
|
|
303
|
+
return (memberships ?? []).map((m) => m.userId);
|
|
304
|
+
},
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
//# sourceMappingURL=dispatchScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatchScope.js","sourceRoot":"","sources":["../../../src/modules/persistence/dispatchScope.ts"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AACH,SAAS,mBAAmB,CAAC,QAA6B,EAAE,OAA8B;IACxF,MAAM,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAA;IACxD,MAAM,eAAe,GAAG,QAA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G,CAAC,MAAM,QAAQ,CAAC,oBAAoB,EAAE,aAAa,EAAE,CAAC,SAAS,CAAC,CAEvE,CAAA;YACb,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;QACjD,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type BootstrapJob, type GitHubAvailableRepo, type GitHubConnection, type KubernetesManifestSource, type PublicAvailableRepo, type PublicBootstrapJob, type PublicKubernetesManifestSource, type ServiceProvisioning, type UpdatePublicServiceInput } from '@cat-factory/contracts';
|
|
1
|
+
import { type BootstrapJob, type EnvironmentHandlerView, type GitHubAvailableRepo, type GitHubConnection, type KubernetesManifestSource, type PublicAvailableRepo, type PublicBootstrapJob, type PublicEnvironmentHandler, type PublicKubernetesManifestSource, type ServiceProvisioning, type UpdatePublicServiceInput } from '@cat-factory/contracts';
|
|
2
2
|
import type { RepoUseByRepoId } from '@cat-factory/orchestration';
|
|
3
|
+
import { type RepoFileContent, type RunRepoContext } from '@cat-factory/kernel';
|
|
3
4
|
import { Hono } from 'hono';
|
|
4
5
|
import type { AppEnv, ServerContainer } from '../../http/env.js';
|
|
5
6
|
/**
|
|
@@ -64,11 +65,66 @@ export declare function toPublicAvailableRepo(repo: GitHubAvailableRepo, use: Re
|
|
|
64
65
|
* prevent, on the deployment least able to tell that is what happened.
|
|
65
66
|
*/
|
|
66
67
|
export declare function asVcsRefusal(error: unknown): unknown;
|
|
68
|
+
/**
|
|
69
|
+
* Read one file, turning the two answers only this layer can name into the refusals it documents.
|
|
70
|
+
*
|
|
71
|
+
* **A blob past the PROVIDER's own contents ceiling is the same refusal as one past ours.** GitHub
|
|
72
|
+
* reports it as a `403`, which {@link asVcsRefusal} would otherwise read as a rejected credential,
|
|
73
|
+
* so an operator whose lockfile is 1.4 MB would be told to re-mint a token that works. The adapter
|
|
74
|
+
* names the fact (`VcsBlobTooLargeError`) and this maps it onto `file_too_large` with the provider's
|
|
75
|
+
* limit and NO size, because nothing here measured one.
|
|
76
|
+
*
|
|
77
|
+
* **Bytes that are not UTF-8 are refused rather than answered.** The decode is lossy for a PNG, a
|
|
78
|
+
* tarball or a Latin-1 source file, and handing back replacement characters under a field documented
|
|
79
|
+
* as the file's content is the same lie the truncation above refuses to tell: a caller comparing
|
|
80
|
+
* against its own copy sees a mismatch it cannot attribute. The `sha` rides the refusal, so the
|
|
81
|
+
* byte-exact join a grader wanted is still available.
|
|
82
|
+
*
|
|
83
|
+
* Anything else is a fact about the provider and goes through {@link asVcsRefusal} unchanged.
|
|
84
|
+
*/
|
|
85
|
+
export declare function readGradableFile(repo: RunRepoContext['repo'], at: string, path: string, ref: string | undefined): Promise<RepoFileContent | null>;
|
|
67
86
|
/**
|
|
68
87
|
* Lower a public manifest source onto the internal one, for the same reason and with the same
|
|
69
88
|
* exhaustiveness as the URL source above.
|
|
70
89
|
*/
|
|
71
90
|
export declare function toKubernetesManifestSource(source: PublicKubernetesManifestSource): KubernetesManifestSource;
|
|
91
|
+
/**
|
|
92
|
+
* Project a handler for the LIST, whatever engine services it.
|
|
93
|
+
*
|
|
94
|
+
* `engine` and `backendKind` are open strings here rather than the connect view's literal, because
|
|
95
|
+
* this read reports handlers the deployment SEEDED from its composition root, and a deployment may
|
|
96
|
+
* register an environment backend of its own: the whole point of the registry. Reporting one as
|
|
97
|
+
* `kubernetes` would be the coercion the board projection refuses next door, and omitting it would
|
|
98
|
+
* make a seeded handler indistinguishable from an absent one, which is the state this read exists to
|
|
99
|
+
* make checkable.
|
|
100
|
+
*
|
|
101
|
+
* `endpoint` and not `apiServerUrl`: the Kubernetes noun is false of every other engine, and stating
|
|
102
|
+
* it anyway is what sends an operator whose environment is a VM looking for an apiserver.
|
|
103
|
+
*
|
|
104
|
+
* BOTH manifest-id fields are reported, because the engine's own resolution
|
|
105
|
+
* (`resolveInfraHandler` → `matchesCustom`) matches a service's pinned `manifestId` against EITHER,
|
|
106
|
+
* and the two ways of registering a handler each set only one: a deployment SEEDING one keys it with
|
|
107
|
+
* `manifestId`, while a `remote-custom` connection declares `acceptsManifestId`. Publishing only the
|
|
108
|
+
* second made the commonest seed shape read as a handler serving nothing, so a setup script checking
|
|
109
|
+
* that its own seed landed found no entry naming it while a run against it resolved fine.
|
|
110
|
+
*
|
|
111
|
+
* No `config`, though `EnvironmentHandlerView` carries one for the app's connect-form prefill: it is
|
|
112
|
+
* the internal per-engine bag, deliberately open, and this surface may not freeze it (ADR 0034).
|
|
113
|
+
*/
|
|
114
|
+
export declare function toPublicHandler(view: EnvironmentHandlerView): PublicEnvironmentHandler;
|
|
115
|
+
/**
|
|
116
|
+
* Order handlers by what IDENTIFIES one, comparing code units rather than collating.
|
|
117
|
+
*
|
|
118
|
+
* `localeCompare` is ICU- and locale-dependent, so the same set of handlers can serialise in one
|
|
119
|
+
* order from a workerd isolate and in another from a Node build with a different ICU: precisely the
|
|
120
|
+
* spurious diff the ordering was added to prevent. A code-unit comparison answers the same everywhere,
|
|
121
|
+
* which is what a wire ordering needs.
|
|
122
|
+
*
|
|
123
|
+
* Both manifest ids join the key, since two `custom` handlers keyed to different manifests are
|
|
124
|
+
* otherwise equal here. A handler that ties on all four keys keeps its position from the repository
|
|
125
|
+
* read (the sort is stable), which is the honest fallback: nothing published distinguishes them.
|
|
126
|
+
*/
|
|
127
|
+
export declare function byHandlerIdentity(left: PublicEnvironmentHandler, right: PublicEnvironmentHandler): number;
|
|
72
128
|
/**
|
|
73
129
|
* Lower a public service patch onto the board patch.
|
|
74
130
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicProvisioningController.d.ts","sourceRoot":"","sources":["../../../src/modules/publicApi/PublicProvisioningController.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"PublicProvisioningController.d.ts","sourceRoot":"","sources":["../../../src/modules/publicApi/PublicProvisioningController.ts"],"names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