@cat-factory/server 0.274.0 → 0.275.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/providerCapabilities.d.ts +14 -1
- package/dist/agents/providerCapabilities.d.ts.map +1 -1
- package/dist/agents/providerCapabilities.js +10 -1
- package/dist/agents/providerCapabilities.js.map +1 -1
- package/dist/http/runAdmission.d.ts +27 -1
- package/dist/http/runAdmission.d.ts.map +1 -1
- package/dist/http/runAdmission.js +32 -0
- package/dist/http/runAdmission.js.map +1 -1
- package/dist/modules/models/workspaceCatalog.d.ts.map +1 -1
- package/dist/modules/models/workspaceCatalog.js +4 -0
- package/dist/modules/models/workspaceCatalog.js.map +1 -1
- package/dist/modules/providers/personalCredentialGate.d.ts +31 -3
- package/dist/modules/providers/personalCredentialGate.d.ts.map +1 -1
- package/dist/modules/providers/personalCredentialGate.js +46 -4
- package/dist/modules/providers/personalCredentialGate.js.map +1 -1
- package/dist/modules/publicApi/PublicApiController.d.ts.map +1 -1
- package/dist/modules/publicApi/PublicApiController.js +85 -43
- package/dist/modules/publicApi/PublicApiController.js.map +1 -1
- package/dist/modules/publicApi/PublicApiKeyController.d.ts.map +1 -1
- package/dist/modules/publicApi/PublicApiKeyController.js +18 -2
- package/dist/modules/publicApi/PublicApiKeyController.js.map +1 -1
- package/dist/modules/publicApi/PublicKeyController.d.ts.map +1 -1
- package/dist/modules/publicApi/PublicKeyController.js +6 -0
- package/dist/modules/publicApi/PublicKeyController.js.map +1 -1
- package/dist/modules/publicApi/PublicProvisioningController.d.ts.map +1 -1
- package/dist/modules/publicApi/PublicProvisioningController.js +33 -11
- package/dist/modules/publicApi/PublicProvisioningController.js.map +1 -1
- package/dist/modules/publicApi/decisions/scope.d.ts +10 -1
- package/dist/modules/publicApi/decisions/scope.d.ts.map +1 -1
- package/dist/modules/publicApi/decisions/scope.js +59 -2
- package/dist/modules/publicApi/decisions/scope.js.map +1 -1
- package/dist/modules/publicApi/keyProjection.d.ts.map +1 -1
- package/dist/modules/publicApi/keyProjection.js +1 -0
- package/dist/modules/publicApi/keyProjection.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/modules/publicApi/personalUnlock.d.ts +51 -0
- package/dist/modules/publicApi/personalUnlock.d.ts.map +1 -0
- package/dist/modules/publicApi/personalUnlock.js +45 -0
- package/dist/modules/publicApi/personalUnlock.js.map +1 -0
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapiDocument.generated.js","sourceRoot":"","sources":["../../../src/modules/publicApi/openapiDocument.generated.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,EAAE;AACF,0FAA0F;AAC1F,8FAA8F;AAC9F,8FAA8F;AAC9F,8EAA8E;AAE9E,MAAM,CAAC,MAAM,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"openapiDocument.generated.js","sourceRoot":"","sources":["../../../src/modules/publicApi/openapiDocument.generated.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,EAAE;AACF,0FAA0F;AAC1F,8FAA8F;AAC9F,8FAA8F;AAC9F,8EAA8E;AAE9E,MAAM,CAAC,MAAM,YAAY,GAAG,4/hqBAA4/hqB,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { PublicApiKeyAuth } from '@cat-factory/integrations';
|
|
2
|
+
import type { Context } from 'hono';
|
|
3
|
+
import type { AppEnv } from '../../http/env.js';
|
|
4
|
+
import { type PersonalCredentialOwner } from '../providers/personalCredentialGate.js';
|
|
5
|
+
/** The two inputs the personal-credential gate takes, resolved from a key-authenticated call. */
|
|
6
|
+
export interface PublicPersonalUnlock {
|
|
7
|
+
/**
|
|
8
|
+
* The user this key was bound to, or `undefined` for an unbound key (the default). Also the
|
|
9
|
+
* run's INITIATOR: a bound key's runs are that person's runs, whatever model they resolve to.
|
|
10
|
+
*
|
|
11
|
+
* Attributing every run rather than only the ones that need an unlock is deliberate. The
|
|
12
|
+
* alternative makes a key's own runs attributed or unattributed depending on which model a task
|
|
13
|
+
* happened to pin, so the same key would produce runs under two different identities, with two
|
|
14
|
+
* different credential scopes and two different merge-policy roles, and nothing in the request
|
|
15
|
+
* would say which. One binding, one answer.
|
|
16
|
+
*/
|
|
17
|
+
user: PersonalCredentialOwner | undefined;
|
|
18
|
+
/** The `X-Personal-Password` this call carried, if any. Never stored, never logged. */
|
|
19
|
+
password: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolve what this call may unlock. Both halves are absent for an ordinary key, which is exactly
|
|
23
|
+
* the pre-binding behaviour: the gate then refuses an individual-usage run as it always did.
|
|
24
|
+
*/
|
|
25
|
+
export declare function personalUnlockFor<E extends AppEnv>(c: Context<E>, auth: PublicApiKeyAuth): PublicPersonalUnlock;
|
|
26
|
+
/**
|
|
27
|
+
* Whether a `CredentialRequiredError` from the gate should be flattened into the surface's
|
|
28
|
+
* `409 individual_model_unsupported`, or left to propagate as its own `428 credential_required`.
|
|
29
|
+
*
|
|
30
|
+
* The distinction is whether the caller can DO anything about it. An unbound key cannot: no
|
|
31
|
+
* password would help, so a 428 inviting one is a prompt to nowhere and the flat 409 naming the
|
|
32
|
+
* unsupported case is the honest answer. A bound key can, and the 428 carries the two things it
|
|
33
|
+
* needs — which vendor, and whether the password was missing or wrong — so flattening it there
|
|
34
|
+
* would throw away the only actionable part of the refusal.
|
|
35
|
+
*/
|
|
36
|
+
export declare function unlockIsUnavailable(unlock: PublicPersonalUnlock): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The `409` body every public start/retry surface answers when {@link unlockIsUnavailable} holds.
|
|
39
|
+
*
|
|
40
|
+
* One factory rather than a literal per route, because a caller that hits this on `POST /jobs`,
|
|
41
|
+
* again on `POST /tasks/:id/start` and again on `retry` must not be told three different stories
|
|
42
|
+
* about the same key. The `code` is the machine-readable half and is identical everywhere; only the
|
|
43
|
+
* remedy tail differs, and it differs because it has to be TRUE: a board task can also be started
|
|
44
|
+
* by its owner in the app, while a headless job has no board affordance to fall back on, so
|
|
45
|
+
* offering one there would send an operator looking for a button that does not exist.
|
|
46
|
+
*/
|
|
47
|
+
export declare function individualModelUnsupported(subject: 'task' | 'job'): {
|
|
48
|
+
code: string;
|
|
49
|
+
message: string;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=personalUnlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personalUnlock.d.ts","sourceRoot":"","sources":["../../../src/modules/publicApi/personalUnlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,wCAAwC,CAAA;AAY/C,iGAAiG;AACjG,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;OASG;IACH,IAAI,EAAE,uBAAuB,GAAG,SAAS,CAAA;IACzC,uFAAuF;IACvF,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EACb,IAAI,EAAE,gBAAgB,GACrB,oBAAoB,CAKtB;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAEzE;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG;IACnE,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB,CAWA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { readPersonalPassword, } from '../providers/personalCredentialGate.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve what this call may unlock. Both halves are absent for an ordinary key, which is exactly
|
|
4
|
+
* the pre-binding behaviour: the gate then refuses an individual-usage run as it always did.
|
|
5
|
+
*/
|
|
6
|
+
export function personalUnlockFor(c, auth) {
|
|
7
|
+
return {
|
|
8
|
+
user: auth.actsAsUserId ? { id: auth.actsAsUserId } : undefined,
|
|
9
|
+
password: readPersonalPassword(c),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Whether a `CredentialRequiredError` from the gate should be flattened into the surface's
|
|
14
|
+
* `409 individual_model_unsupported`, or left to propagate as its own `428 credential_required`.
|
|
15
|
+
*
|
|
16
|
+
* The distinction is whether the caller can DO anything about it. An unbound key cannot: no
|
|
17
|
+
* password would help, so a 428 inviting one is a prompt to nowhere and the flat 409 naming the
|
|
18
|
+
* unsupported case is the honest answer. A bound key can, and the 428 carries the two things it
|
|
19
|
+
* needs — which vendor, and whether the password was missing or wrong — so flattening it there
|
|
20
|
+
* would throw away the only actionable part of the refusal.
|
|
21
|
+
*/
|
|
22
|
+
export function unlockIsUnavailable(unlock) {
|
|
23
|
+
return unlock.user === undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The `409` body every public start/retry surface answers when {@link unlockIsUnavailable} holds.
|
|
27
|
+
*
|
|
28
|
+
* One factory rather than a literal per route, because a caller that hits this on `POST /jobs`,
|
|
29
|
+
* again on `POST /tasks/:id/start` and again on `retry` must not be told three different stories
|
|
30
|
+
* about the same key. The `code` is the machine-readable half and is identical everywhere; only the
|
|
31
|
+
* remedy tail differs, and it differs because it has to be TRUE: a board task can also be started
|
|
32
|
+
* by its owner in the app, while a headless job has no board affordance to fall back on, so
|
|
33
|
+
* offering one there would send an operator looking for a button that does not exist.
|
|
34
|
+
*/
|
|
35
|
+
export function individualModelUnsupported(subject) {
|
|
36
|
+
const remedy = subject === 'task'
|
|
37
|
+
? 'start or retry it from the app, or use a key bound to the subscription owner and send the'
|
|
38
|
+
: 'use a key bound to the subscription owner and send the';
|
|
39
|
+
return {
|
|
40
|
+
code: 'individual_model_unsupported',
|
|
41
|
+
message: `This ${subject} runs on an individual-usage model that needs a personal-credential ` +
|
|
42
|
+
`unlock; ${remedy} X-Personal-Password header`,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=personalUnlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personalUnlock.js","sourceRoot":"","sources":["../../../src/modules/publicApi/personalUnlock.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,GAErB,MAAM,wCAAwC,CAAA;AA6B/C;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,CAAa,EACb,IAAsB;IAEtB,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,SAAS;QAC/D,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC;KAClC,CAAA;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAA4B;IAC9D,OAAO,MAAM,CAAC,IAAI,KAAK,SAAS,CAAA;AAClC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAAuB;IAIhE,MAAM,MAAM,GACV,OAAO,KAAK,MAAM;QAChB,CAAC,CAAC,2FAA2F;QAC7F,CAAC,CAAC,wDAAwD,CAAA;IAC9D,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,OAAO,EACL,QAAQ,OAAO,sEAAsE;YACrF,WAAW,MAAM,6BAA6B;KACjD,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cat-factory/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.275.0",
|
|
4
4
|
"description": "Runtime-neutral HTTP layer for the Agent Architecture Board: the Hono controllers, middleware (auth/authz/CORS/error), request helpers and the gateway seams shared by every deployment facade (Cloudflare Worker, Node service).",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"jose": "^6.2.8",
|
|
32
32
|
"pino": "^10.3.1",
|
|
33
33
|
"valibot": "^1.4.2",
|
|
34
|
-
"@cat-factory/agents": "0.126.
|
|
35
|
-
"@cat-factory/contracts": "0.
|
|
36
|
-
"@cat-factory/
|
|
37
|
-
"@cat-factory/
|
|
38
|
-
"@cat-factory/
|
|
39
|
-
"@cat-factory/
|
|
40
|
-
"@cat-factory/
|
|
34
|
+
"@cat-factory/agents": "0.126.1",
|
|
35
|
+
"@cat-factory/contracts": "0.298.0",
|
|
36
|
+
"@cat-factory/mcp-server": "0.33.0",
|
|
37
|
+
"@cat-factory/integrations": "0.159.0",
|
|
38
|
+
"@cat-factory/kernel": "0.289.0",
|
|
39
|
+
"@cat-factory/orchestration": "0.260.1",
|
|
40
|
+
"@cat-factory/spend": "0.15.74"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^26.2.0",
|