@superforge/infra 0.1.0 → 0.1.1
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/README.md +12 -6
- package/output/agents.js +3 -1
- package/output/client.d.ts +5 -3
- package/output/client.js +11 -4
- package/output/index.d.ts +1 -0
- package/output/index.js +2 -0
- package/output/version.d.ts +6 -0
- package/output/version.js +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,6 +103,14 @@ A message is for a person: it can be reworded any time, so code branches on
|
|
|
103
103
|
`reason`, never on `message`. Show it to the app's own team; a visitor
|
|
104
104
|
should only learn that login isn't working.
|
|
105
105
|
|
|
106
|
+
## What every call tells Infra
|
|
107
|
+
|
|
108
|
+
Every call, Claude's OAuth calls passed through included, carries
|
|
109
|
+
`Infra-Client: @superforge/infra/<version>`, so Infra knows which version
|
|
110
|
+
each app is on, and can say when one's out of date (`PACKAGE_VERSION` and
|
|
111
|
+
`CLIENT_HEADER` are exported). The version is written in
|
|
112
|
+
`source/version.ts`, which a test checks against `package.json`.
|
|
113
|
+
|
|
106
114
|
## Releases
|
|
107
115
|
|
|
108
116
|
Each release is a version on npm, `@superforge/infra@x.y.z`, published by
|
|
@@ -116,12 +124,10 @@ dependency (Dependabot opens a PR a month), never by copying code.
|
|
|
116
124
|
CI signs in to npm with trusted publishing: npm trusts this repository's
|
|
117
125
|
`ci.yml` to publish the package (the package's settings on npmjs.com,
|
|
118
126
|
"Trusted publisher"), so no npm token is kept anywhere. npm only lets a
|
|
119
|
-
package that exists trust a workflow, so
|
|
120
|
-
checkout signed in with `npm login
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
pnpm install && pnpm check && npm publish --access public
|
|
124
|
-
```
|
|
127
|
+
package that exists trust a workflow, so the package was made by hand
|
|
128
|
+
first: a staged 0.1.0 from a checkout signed in with `npm login`, which
|
|
129
|
+
was never approved, since 0.1.1 replaced it. 0.1.1 was the first CI
|
|
130
|
+
published.
|
|
125
131
|
|
|
126
132
|
Infra keeps answering the versions apps are on: a change to a call is
|
|
127
133
|
additive, and a call Infra retires answers 410 `retired` with a message
|
package/output/agents.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createRemoteJWKSet, jwtVerify } from "jose";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { AGENT_SCOPES, MCP_PATH, SECOND } from "./primitives.js";
|
|
4
|
+
import { CLIENT, CLIENT_HEADER } from "./version.js";
|
|
4
5
|
// Claude logging in to an app's own MCP, through Infra: Infra is the OAuth
|
|
5
6
|
// server, and the app only checks the tokens it signs, with Infra's public
|
|
6
7
|
// keys, never asking Infra (Infra's README, "Claude"). This is what of it
|
|
@@ -35,7 +36,8 @@ export async function passThrough({ url, key, send, request, path, origin }) {
|
|
|
35
36
|
const { search } = new URL(request.url);
|
|
36
37
|
const headers = new Headers({
|
|
37
38
|
Authorization: `Bearer ${key}`,
|
|
38
|
-
[APP_ORIGIN_HEADER]: origin
|
|
39
|
+
[APP_ORIGIN_HEADER]: origin,
|
|
40
|
+
[CLIENT_HEADER]: CLIENT
|
|
39
41
|
});
|
|
40
42
|
for (const name of PASSED_HEADERS) {
|
|
41
43
|
const value = request.headers.get(name);
|
package/output/client.d.ts
CHANGED
|
@@ -11,9 +11,11 @@ export declare const INFRA_URL = "https://infra.superforge.studio/v1";
|
|
|
11
11
|
* code spent, and a comment sent again is kept twice); the visitor asks
|
|
12
12
|
* again instead. `send` is `fetch`, or a test's own.
|
|
13
13
|
*
|
|
14
|
-
* Every
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* Every call says which version of the package made it (`Infra-Client`,
|
|
15
|
+
* version.ts). Every answer is logged with its call and status, and a
|
|
16
|
+
* refusal with its `error` and Infra's `message`, which says what went
|
|
17
|
+
* wrong and what fixes it (Infra's README, "Errors"), so an app's logs say
|
|
18
|
+
* why a call failed.
|
|
17
19
|
*/
|
|
18
20
|
export declare function infraClient({ key, url, send }: {
|
|
19
21
|
key: string;
|
package/output/client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { agent_connections, agent_ended, agent_redirect, agent_refused, agent_request, checkToken, infraKeys, passThrough } from "./agents.js";
|
|
2
2
|
import { any_refusal, comment_refused, infra_project, kept_comment, start_refused, started_login, verified_login, verify_refused } from "./answers.js";
|
|
3
3
|
import { SECOND } from "./primitives.js";
|
|
4
|
+
import { CLIENT, CLIENT_HEADER } from "./version.js";
|
|
4
5
|
/**
|
|
5
6
|
* Infra's API, which a project's keys call. A server can be pointed at
|
|
6
7
|
* another Infra with `INFRA_URL` (choose.ts).
|
|
@@ -16,9 +17,11 @@ const TIMEOUT = 15 * SECOND;
|
|
|
16
17
|
* code spent, and a comment sent again is kept twice); the visitor asks
|
|
17
18
|
* again instead. `send` is `fetch`, or a test's own.
|
|
18
19
|
*
|
|
19
|
-
* Every
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* Every call says which version of the package made it (`Infra-Client`,
|
|
21
|
+
* version.ts). Every answer is logged with its call and status, and a
|
|
22
|
+
* refusal with its `error` and Infra's `message`, which says what went
|
|
23
|
+
* wrong and what fixes it (Infra's README, "Errors"), so an app's logs say
|
|
24
|
+
* why a call failed.
|
|
22
25
|
*/
|
|
23
26
|
export function infraClient({ key, url = INFRA_URL, send = fetch }) {
|
|
24
27
|
// One call: its status and its JSON, or why there's none, which is
|
|
@@ -27,9 +30,13 @@ export function infraClient({ key, url = INFRA_URL, send = fetch }) {
|
|
|
27
30
|
const response = await send(`${url}${call}`, {
|
|
28
31
|
method,
|
|
29
32
|
headers: body === undefined
|
|
30
|
-
? {
|
|
33
|
+
? {
|
|
34
|
+
Authorization: `Bearer ${key}`,
|
|
35
|
+
[CLIENT_HEADER]: CLIENT
|
|
36
|
+
}
|
|
31
37
|
: {
|
|
32
38
|
Authorization: `Bearer ${key}`,
|
|
39
|
+
[CLIENT_HEADER]: CLIENT,
|
|
33
40
|
"Content-Type": "application/json"
|
|
34
41
|
},
|
|
35
42
|
body: body === undefined ? undefined : JSON.stringify(body),
|
package/output/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export type { AgentConnection, AgentRefused, AgentRequest, AgentToken, CommentRe
|
|
|
6
6
|
export { AGENT_SCOPES, type AgentScope, MCP_PATH } from "./primitives.js";
|
|
7
7
|
export type { AsyncOperationResult, OperationResult } from "./results.js";
|
|
8
8
|
export { standInAgentToken, standInInfra, type WaitingLogin } from "./stand-in.js";
|
|
9
|
+
export { CLIENT_HEADER, PACKAGE_VERSION } from "./version.js";
|
package/output/index.js
CHANGED
|
@@ -13,3 +13,5 @@ export { INFRA_URL, infraClient } from "./client.js";
|
|
|
13
13
|
export { COMMENT_BODY_LIMIT, filed_comment, LONGEST_COMMENT } from "./comments.js";
|
|
14
14
|
export { AGENT_SCOPES, MCP_PATH } from "./primitives.js";
|
|
15
15
|
export { standInAgentToken, standInInfra } from "./stand-in.js";
|
|
16
|
+
// Which version this is, which every call tells Infra in `Infra-Client`
|
|
17
|
+
export { CLIENT_HEADER, PACKAGE_VERSION } from "./version.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The package's version, as package.json says it */
|
|
2
|
+
export declare const PACKAGE_VERSION = "0.1.1";
|
|
3
|
+
/** The header every call to Infra carries, its OAuth calls passed through included */
|
|
4
|
+
export declare const CLIENT_HEADER = "Infra-Client";
|
|
5
|
+
/** What it says: the package and its version, `@superforge/infra/0.1.1` */
|
|
6
|
+
export declare const CLIENT = "@superforge/infra/0.1.1";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Which release of the package this is, which every call tells Infra in
|
|
2
|
+
// `Infra-Client`, so Infra knows which version each app is on and can say
|
|
3
|
+
// when one's out of date. It's written here rather than read from
|
|
4
|
+
// package.json as the package runs, since an app's build can bundle the
|
|
5
|
+
// package away from its package.json; a test checks the two agree, so a
|
|
6
|
+
// release that bumps one and not the other fails `pnpm check`.
|
|
7
|
+
/** The package's version, as package.json says it */
|
|
8
|
+
export const PACKAGE_VERSION = "0.1.1";
|
|
9
|
+
/** The header every call to Infra carries, its OAuth calls passed through included */
|
|
10
|
+
export const CLIENT_HEADER = "Infra-Client";
|
|
11
|
+
/** What it says: the package and its version, `@superforge/infra/0.1.1` */
|
|
12
|
+
export const CLIENT = `@superforge/infra/${PACKAGE_VERSION}`;
|
package/package.json
CHANGED