@agentshouse/kit 0.2.1-cb6679d048e60 → 0.2.1-cd9cbd8b6428c
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/api.js +2 -1
- package/dist/bootstrap.json +4 -4
- package/dist/bridge.js +3 -2
- package/dist/copies.js +2 -1
- package/dist/files.js +2 -1
- package/dist/mcp.js +2 -1
- package/dist/relay.js +10 -0
- package/dist/stream.js +2 -1
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readEnrolment } from './home.js';
|
|
2
|
+
import { relayed } from './relay.js';
|
|
2
3
|
export class HouseRefusal extends Error {
|
|
3
4
|
status;
|
|
4
5
|
text;
|
|
@@ -12,7 +13,7 @@ export function retryDelay(attempt) {
|
|
|
12
13
|
return Math.random() * Math.min(30_000, 1000 * 2 ** attempt);
|
|
13
14
|
}
|
|
14
15
|
export async function post(house, path, body, credential, signal) {
|
|
15
|
-
const answer = await fetch(new URL(path, house), {
|
|
16
|
+
const answer = await fetch(relayed(new URL(path, house)), {
|
|
16
17
|
method: 'POST',
|
|
17
18
|
headers: {
|
|
18
19
|
'content-type': 'application/json',
|
package/dist/bootstrap.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
|
-
"version": "0.2.1-
|
|
3
|
+
"version": "0.2.1-cd9cbd8b6428c",
|
|
4
4
|
"hosts": {
|
|
5
5
|
"macos": {
|
|
6
6
|
"asset": {
|
|
7
7
|
"name": "connect-linux.sh",
|
|
8
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-
|
|
8
|
+
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-cd9cbd8b6428c/connect-linux.sh"
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
"linux": {
|
|
12
12
|
"asset": {
|
|
13
13
|
"name": "connect-linux.sh",
|
|
14
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-
|
|
14
|
+
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-cd9cbd8b6428c/connect-linux.sh"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"windows": {
|
|
18
18
|
"asset": {
|
|
19
19
|
"name": "connect-windows.ps1",
|
|
20
|
-
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-
|
|
20
|
+
"url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-cd9cbd8b6428c/connect-windows.ps1"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
package/dist/bridge.js
CHANGED
|
@@ -13,6 +13,7 @@ import { kitHome, readEnrolment } from './home.js';
|
|
|
13
13
|
import { callHouse, mcpBody, rpc, UNREACHABLE } from './mcp.js';
|
|
14
14
|
import { operationId, uuidOf } from './operation.js';
|
|
15
15
|
import { refusalOf } from './refusals.js';
|
|
16
|
+
import { relayed } from './relay.js';
|
|
16
17
|
const MCP_REQUEST_BYTES = 4 * 1024 * 1024;
|
|
17
18
|
const ATTACHMENTS = '/kit/attachments/upload';
|
|
18
19
|
export async function received(request) {
|
|
@@ -117,7 +118,7 @@ export async function openBridge(house, copies, conversationId, signal) {
|
|
|
117
118
|
if ('refused' in prepared)
|
|
118
119
|
return prepared;
|
|
119
120
|
const { transfer } = parse(prepared.text);
|
|
120
|
-
const posted = await fetch(transfer.url, {
|
|
121
|
+
const posted = await fetch(relayed(transfer.url), {
|
|
121
122
|
method: 'POST',
|
|
122
123
|
headers: { 'content-type': 'text/plain; charset=utf-8' },
|
|
123
124
|
body: Buffer.concat([Buffer.from(`${transfer.operation}\n`), bytes]),
|
|
@@ -150,7 +151,7 @@ export async function openBridge(house, copies, conversationId, signal) {
|
|
|
150
151
|
const tool = message.method === 'tools/call' ? String(message.params.name) : null;
|
|
151
152
|
return send(message, tool !== null && (await writes(tool)) ? operationId() : null);
|
|
152
153
|
}
|
|
153
|
-
const answer = await fetch(new URL(path, origin), {
|
|
154
|
+
const answer = await fetch(relayed(new URL(path, origin)), {
|
|
154
155
|
method: 'POST',
|
|
155
156
|
headers: { 'content-type': 'application/json', authorization: `Bearer ${credential}` },
|
|
156
157
|
body: versioned(conversationId, text),
|
package/dist/copies.js
CHANGED
|
@@ -8,6 +8,7 @@ import { kitHome } from './home.js';
|
|
|
8
8
|
import { operationId } from './operation.js';
|
|
9
9
|
import { refusalOf } from './refusals.js';
|
|
10
10
|
import { changed } from './translate.js';
|
|
11
|
+
import { relayed } from './relay.js';
|
|
11
12
|
const BRANCH = 'main';
|
|
12
13
|
const PROVENANCE = '_provenance';
|
|
13
14
|
const REPLICA_RETRY_MS = 30_000;
|
|
@@ -300,7 +301,7 @@ export class LocalCopies {
|
|
|
300
301
|
const discovery = await this.house.post('/kit/door/discover', { prefixes });
|
|
301
302
|
let bundle = await this.house.post('/kit/door/bootstrap', { prefixes });
|
|
302
303
|
if ('transfer' in bundle)
|
|
303
|
-
bundle = (await (await fetch(bundle.transfer.url)).json());
|
|
304
|
+
bundle = (await (await fetch(relayed(bundle.transfer.url))).json());
|
|
304
305
|
const [view] = bundle.scopes;
|
|
305
306
|
if (view === undefined)
|
|
306
307
|
return null;
|
package/dist/files.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
+
import { relayed } from './relay.js';
|
|
3
4
|
export async function placeFiles(house, directory, files, signal) {
|
|
4
5
|
const paths = [];
|
|
5
6
|
for (const file of files) {
|
|
6
7
|
const original = await house.post('/kit/conversation/originals/get', { version: file.version, download: true }, signal);
|
|
7
|
-
const answer = await fetch(original.download.url, { signal });
|
|
8
|
+
const answer = await fetch(relayed(original.download.url), { signal });
|
|
8
9
|
if (!answer.ok)
|
|
9
10
|
throw new Error(`${file.name} did not download: ${answer.status}`);
|
|
10
11
|
const folder = join(directory, '.house', 'files', original.message, file.version);
|
package/dist/mcp.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import { KIT_VERSION } from './clis.js';
|
|
3
|
+
import { relayed } from './relay.js';
|
|
3
4
|
const MCP_PROTOCOL_VERSION = '2026-07-28';
|
|
4
5
|
export const UNREACHABLE = 'House is unreachable; call again in a minute';
|
|
5
6
|
export function rpc(method, params) {
|
|
@@ -21,7 +22,7 @@ export function mcpBody(message, operation) {
|
|
|
21
22
|
}
|
|
22
23
|
export async function callHouse(origin, credential, message, operation = null, signal) {
|
|
23
24
|
const tool = message.method === 'tools/call' ? String(message.params.name) : null;
|
|
24
|
-
const answer = await fetch(new URL('/', origin), {
|
|
25
|
+
const answer = await fetch(relayed(new URL('/', origin)), {
|
|
25
26
|
method: 'POST',
|
|
26
27
|
headers: {
|
|
27
28
|
'content-type': 'application/json',
|
package/dist/relay.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function relayed(target) {
|
|
2
|
+
const url = new URL(target);
|
|
3
|
+
const relay = process.env.HOUSE_KIT_RELAY;
|
|
4
|
+
if (relay === undefined || relay === '')
|
|
5
|
+
return url;
|
|
6
|
+
const through = new URL(`${url.host}${url.pathname}${url.search}`, `${relay}/`);
|
|
7
|
+
if (url.protocol === 'wss:' || url.protocol === 'ws:')
|
|
8
|
+
through.protocol = 'wss:';
|
|
9
|
+
return through;
|
|
10
|
+
}
|
package/dist/stream.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { retryDelay } from './api.js';
|
|
2
2
|
import { readEnrolment } from './home.js';
|
|
3
|
+
import { relayed } from './relay.js';
|
|
3
4
|
const SUBPROTOCOL = 'house.kit.stream.1';
|
|
4
5
|
function streamUrl(house) {
|
|
5
6
|
const url = new URL('/kit/stream', house);
|
|
@@ -11,7 +12,7 @@ export function holdStream(handlers) {
|
|
|
11
12
|
let failures = 0;
|
|
12
13
|
const connect = async () => {
|
|
13
14
|
const { house, credential } = (await readEnrolment());
|
|
14
|
-
const opening = new WebSocket(streamUrl(house), {
|
|
15
|
+
const opening = new WebSocket(relayed(streamUrl(house)), {
|
|
15
16
|
protocols: [SUBPROTOCOL],
|
|
16
17
|
headers: { authorization: `Bearer ${credential}` },
|
|
17
18
|
});
|