@nyte-ai/host 0.0.19 → 0.0.23
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/chunks/{canvas-preview-n2a35zv5.js → canvas-preview-1f8h0he1.js} +1 -1
- package/dist/chunks/{canvas-preview-w54ymtb3.js → canvas-preview-9e15hp6q.js} +1 -1
- package/dist/chunks/{canvas-preview-cawy6vbz.js → canvas-preview-ayayyd43.js} +4 -4
- package/dist/chunks/{canvas-preview-aq5j4p25.js → canvas-preview-d97wvref.js} +1 -1
- package/dist/chunks/{canvas-preview-jeddjex8.js → canvas-preview-dsb5829c.js} +15 -15
- package/dist/chunks/{canvas-preview-k1yg4fgp.js → canvas-preview-eehzfefa.js} +1 -1
- package/dist/chunks/{canvas-preview-11nadadc.js → canvas-preview-geg2gckp.js} +1 -1
- package/dist/chunks/{canvas-preview-g5fkjs34.js → canvas-preview-gh7c9831.js} +19 -15
- package/dist/chunks/{canvas-preview-55s0y68g.js → canvas-preview-gm0frf4b.js} +2 -2
- package/dist/chunks/{canvas-preview-fxa0rfb0.js → canvas-preview-k2xaz0ym.js} +2 -2
- package/dist/chunks/{canvas-preview-b2v8wfnz.js → canvas-preview-kzmp015w.js} +1 -1
- package/dist/chunks/{canvas-preview-tnqe7k0b.js → canvas-preview-mstbvwz3.js} +11 -1
- package/dist/chunks/{canvas-preview-ycepb05s.js → canvas-preview-whfdhma6.js} +1 -1
- package/dist/src/deploy/cloudflare/worker.js +1 -1
- package/dist/src/deploy/vercel/server/routes/[...].js +2 -2
- package/dist/src/deploy/vercel/server/utils/host.js +1 -1
- package/dist/src/deploy/vercel/server/workflows/drive.js +2 -2
- package/dist/src/index.js +7 -7
- package/dist/src/listen-fetch.js +3 -3
- package/dist/src/listen.js +4 -4
- package/dist/src/mcp/hub.js +1 -1
- package/dist/src/open.js +7 -7
- package/dist/src/serve/binding.d.ts +1 -1
- package/dist/src/serve/binding.js +1 -1
- package/dist/src/serve/handler.js +2 -2
- package/dist/src/sqlite.js +1 -1
- package/dist/src/store-usage.js +2 -2
- package/dist/src/usage-service.js +4 -4
- package/dist/src/usage-worker.js +4 -4
- package/dist/src/usage.js +3 -3
- package/package.json +20 -20
- package/src/mcp/hub.ts +18 -9
- package/src/serve/binding.ts +3 -3
- package/src/sqlite.ts +13 -1
|
@@ -21,13 +21,13 @@ import {
|
|
|
21
21
|
} from "./canvas-preview-4e0pxa32.js";
|
|
22
22
|
import {
|
|
23
23
|
listen2
|
|
24
|
-
} from "./canvas-preview-
|
|
24
|
+
} from "./canvas-preview-whfdhma6.js";
|
|
25
25
|
import {
|
|
26
26
|
nodeImages2
|
|
27
27
|
} from "./canvas-preview-y5y6ghaw.js";
|
|
28
28
|
import {
|
|
29
29
|
createMcpHub2
|
|
30
|
-
} from "./canvas-preview-
|
|
30
|
+
} from "./canvas-preview-gh7c9831.js";
|
|
31
31
|
import {
|
|
32
32
|
loadPluginDirectory2,
|
|
33
33
|
pluginLoader2
|
|
@@ -38,10 +38,10 @@ import {
|
|
|
38
38
|
import {
|
|
39
39
|
storePath2,
|
|
40
40
|
sqliteStore2
|
|
41
|
-
} from "./canvas-preview-
|
|
41
|
+
} from "./canvas-preview-mstbvwz3.js";
|
|
42
42
|
import {
|
|
43
43
|
package_default
|
|
44
|
-
} from "./canvas-preview-
|
|
44
|
+
} from "./canvas-preview-dsb5829c.js";
|
|
45
45
|
|
|
46
46
|
// src/open.ts
|
|
47
47
|
import { watch } from "node:fs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@nyte-ai/host",
|
|
4
|
-
version: "0.0.
|
|
4
|
+
version: "0.0.23",
|
|
5
5
|
private: false,
|
|
6
6
|
license: "MIT",
|
|
7
7
|
repository: {
|
|
@@ -122,33 +122,33 @@ var package_default = {
|
|
|
122
122
|
"build:package": "bun ../../scripts/sdk-packages.mjs build host"
|
|
123
123
|
},
|
|
124
124
|
dependencies: {
|
|
125
|
-
"@earendil-works/pi-mcp": "1.3.0",
|
|
126
|
-
"@lydell/node-pty": "1.2.0-beta.15",
|
|
125
|
+
"@earendil-works/pi-mcp": "^1.3.0",
|
|
126
|
+
"@lydell/node-pty": "^1.2.0-beta.15",
|
|
127
127
|
"@nyte-ai/ai": "workspace:*",
|
|
128
128
|
"@nyte-ai/core": "workspace:*",
|
|
129
129
|
"@nyte-ai/plugin": "workspace:*",
|
|
130
130
|
"@nyte-ai/protocol": "workspace:*",
|
|
131
131
|
"@nyte-ai/schema": "workspace:*",
|
|
132
|
-
"@silvia-odwyer/photon": "0.3.3",
|
|
133
|
-
fflate: "0.8.3",
|
|
134
|
-
ignore: "7.0.
|
|
135
|
-
pg: "8.23.
|
|
136
|
-
typebox: "1.
|
|
132
|
+
"@silvia-odwyer/photon": "^0.3.3",
|
|
133
|
+
fflate: "^0.8.3",
|
|
134
|
+
ignore: "^7.0.13",
|
|
135
|
+
pg: "^8.23.1",
|
|
136
|
+
typebox: "^1.4.2"
|
|
137
137
|
},
|
|
138
138
|
devDependencies: {
|
|
139
|
-
"@electric-sql/pglite": "0.5.
|
|
139
|
+
"@electric-sql/pglite": "^0.5.11",
|
|
140
140
|
"@nyte-ai/canvas": "workspace:*",
|
|
141
141
|
"@types/node": "^26.6.5",
|
|
142
|
-
"@types/pg": "8.23.1",
|
|
143
|
-
"fast-check": "4.10.2",
|
|
144
|
-
nitro: "3.0.260903-beta",
|
|
142
|
+
"@types/pg": "^8.23.1",
|
|
143
|
+
"fast-check": "^4.10.2",
|
|
144
|
+
nitro: "^3.0.260903-beta",
|
|
145
145
|
typescript: "6.0.3",
|
|
146
146
|
vitest: "^5.0.5",
|
|
147
|
-
workflow: "
|
|
147
|
+
workflow: "^5.2.3"
|
|
148
148
|
},
|
|
149
149
|
peerDependencies: {
|
|
150
|
-
nitro: "3.0.260903-beta",
|
|
151
|
-
workflow: "
|
|
150
|
+
nitro: "^3.0.260903-beta",
|
|
151
|
+
workflow: "^5.2.3"
|
|
152
152
|
},
|
|
153
153
|
peerDependenciesMeta: {
|
|
154
154
|
nitro: {
|
|
@@ -44,7 +44,18 @@ function hub(input) {
|
|
|
44
44
|
const contents = new Map;
|
|
45
45
|
const watched = new Map;
|
|
46
46
|
const userPath = join(input.home, ".nyte", "mcp.json");
|
|
47
|
+
const retiring = new Set;
|
|
47
48
|
let closed = false;
|
|
49
|
+
const retire = (client) => {
|
|
50
|
+
if (client === null)
|
|
51
|
+
return Promise.resolve();
|
|
52
|
+
const done = client.close().catch(() => {
|
|
53
|
+
return;
|
|
54
|
+
});
|
|
55
|
+
retiring.add(done);
|
|
56
|
+
done.then(() => retiring.delete(done));
|
|
57
|
+
return done;
|
|
58
|
+
};
|
|
48
59
|
const notify = (pool) => {
|
|
49
60
|
for (const listener of pool.listeners)
|
|
50
61
|
listener();
|
|
@@ -73,6 +84,7 @@ function hub(input) {
|
|
|
73
84
|
let listed = null;
|
|
74
85
|
let bridged = null;
|
|
75
86
|
let client = null;
|
|
87
|
+
let opening = null;
|
|
76
88
|
let stderr = () => null;
|
|
77
89
|
let challenge = null;
|
|
78
90
|
let ended = false;
|
|
@@ -104,9 +116,7 @@ function hub(input) {
|
|
|
104
116
|
const drop = (message) => {
|
|
105
117
|
const previous = client;
|
|
106
118
|
client = null;
|
|
107
|
-
previous
|
|
108
|
-
return;
|
|
109
|
-
});
|
|
119
|
+
retire(previous);
|
|
110
120
|
if (ended)
|
|
111
121
|
return;
|
|
112
122
|
set({ kind: "failed", message, stderr: stderr() });
|
|
@@ -118,11 +128,7 @@ function hub(input) {
|
|
|
118
128
|
await processEnvironment();
|
|
119
129
|
if (ended)
|
|
120
130
|
return;
|
|
121
|
-
const next = new TracingMcpClient2({
|
|
122
|
-
name: "nyte",
|
|
123
|
-
version: "0.1.0",
|
|
124
|
-
requestTimeoutMs: link.entry.timeoutMs
|
|
125
|
-
});
|
|
131
|
+
const next = new TracingMcpClient2({ name: "nyte", version: "0.1.0" });
|
|
126
132
|
next.onClose(() => {
|
|
127
133
|
if (client === next)
|
|
128
134
|
drop(`The connection to ${entry.name} closed.`);
|
|
@@ -143,9 +149,10 @@ function hub(input) {
|
|
|
143
149
|
}
|
|
144
150
|
try {
|
|
145
151
|
stderr = () => transport instanceof StdioTransport && transport.stderr !== "" ? transport.stderr.slice(-STDERR_TAIL) : null;
|
|
152
|
+
opening = next;
|
|
146
153
|
await next.connect(transport);
|
|
147
154
|
if (ended) {
|
|
148
|
-
await next
|
|
155
|
+
await retire(next);
|
|
149
156
|
return;
|
|
150
157
|
}
|
|
151
158
|
const refresh = async () => {
|
|
@@ -171,9 +178,7 @@ function hub(input) {
|
|
|
171
178
|
} catch (error) {
|
|
172
179
|
if (client === next)
|
|
173
180
|
client = null;
|
|
174
|
-
await next
|
|
175
|
-
return;
|
|
176
|
-
});
|
|
181
|
+
await retire(next);
|
|
177
182
|
if (ended)
|
|
178
183
|
return;
|
|
179
184
|
if (error instanceof McpOAuthAuthorizationRequiredError) {
|
|
@@ -223,9 +228,7 @@ function hub(input) {
|
|
|
223
228
|
clearTimeout(timer);
|
|
224
229
|
const previous = client;
|
|
225
230
|
client = null;
|
|
226
|
-
await
|
|
227
|
-
return;
|
|
228
|
-
});
|
|
231
|
+
await Promise.all([retire(previous), retire(opening)]);
|
|
229
232
|
}
|
|
230
233
|
};
|
|
231
234
|
connectTraced();
|
|
@@ -553,6 +556,7 @@ function hub(input) {
|
|
|
553
556
|
for (const pool of live)
|
|
554
557
|
shut(pool);
|
|
555
558
|
await Promise.all(links.map((link) => link.close()));
|
|
559
|
+
await Promise.all(retiring);
|
|
556
560
|
}
|
|
557
561
|
};
|
|
558
562
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/serve/binding.ts
|
|
2
2
|
import { isJson, SdkError } from "@nyte-ai/schema";
|
|
3
|
-
import { mapped, viewFrames } from "@nyte-ai/protocol";
|
|
3
|
+
import { mapped, sessionsFrames, viewFrames } from "@nyte-ai/protocol";
|
|
4
4
|
var LOGIN_LIFETIME = 10 * 60 * 1000;
|
|
5
5
|
var attempts = new WeakMap;
|
|
6
6
|
var holds = new WeakMap;
|
|
@@ -116,7 +116,7 @@ function bindConnection2(connection, options) {
|
|
|
116
116
|
"workspaces.inspect": ({ target }) => connection.workspaces.inspect(target),
|
|
117
117
|
"workspaces.add": ({ target, options }) => connection.workspaces.add(target, options),
|
|
118
118
|
"workspaces.forget": ({ id }) => connection.workspaces.forget(id),
|
|
119
|
-
"sessions.watch": async (input) => connection.sessions.watch(input),
|
|
119
|
+
"sessions.watch": async (input) => sessionsFrames(connection.sessions.watch(input)),
|
|
120
120
|
"sessions.start": async (input) => {
|
|
121
121
|
const { session, receipt } = await connection.sessions.start(input);
|
|
122
122
|
return { session: session.id, receipt: receipt.id, message: receipt.message };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readNyteUsage2
|
|
3
|
-
} from "./canvas-preview-
|
|
3
|
+
} from "./canvas-preview-geg2gckp.js";
|
|
4
4
|
import {
|
|
5
5
|
loadUsageScanCaches2,
|
|
6
6
|
saveUsageScanCaches2,
|
|
7
7
|
readLocalUsage2
|
|
8
|
-
} from "./canvas-preview-
|
|
8
|
+
} from "./canvas-preview-eehzfefa.js";
|
|
9
9
|
|
|
10
10
|
// src/usage-service.ts
|
|
11
11
|
import { join } from "node:path";
|
|
@@ -87,7 +87,8 @@ function sqliteStore2(input) {
|
|
|
87
87
|
return;
|
|
88
88
|
});
|
|
89
89
|
await workers?.close();
|
|
90
|
-
database
|
|
90
|
+
if (database !== null)
|
|
91
|
+
closeDatabase(database);
|
|
91
92
|
workers = null;
|
|
92
93
|
database = null;
|
|
93
94
|
opening = null;
|
|
@@ -98,6 +99,15 @@ function sqliteStore2(input) {
|
|
|
98
99
|
}
|
|
99
100
|
};
|
|
100
101
|
}
|
|
102
|
+
function closeDatabase(database) {
|
|
103
|
+
if ("bun" in process.versions) {
|
|
104
|
+
const empty = new DatabaseSync(":memory:");
|
|
105
|
+
empty.exec("CREATE TABLE closed (id INTEGER)");
|
|
106
|
+
database.deserialize(empty.serialize());
|
|
107
|
+
empty.close();
|
|
108
|
+
}
|
|
109
|
+
database.close();
|
|
110
|
+
}
|
|
101
111
|
function hasTable(database, name) {
|
|
102
112
|
return database.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(name) !== undefined;
|
|
103
113
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import"../../../../../chunks/canvas-preview-2zdyh9ny.js";
|
|
2
2
|
import {
|
|
3
3
|
vercelHost2
|
|
4
|
-
} from "../../../../../chunks/canvas-preview-
|
|
4
|
+
} from "../../../../../chunks/canvas-preview-1f8h0he1.js";
|
|
5
5
|
import"../../../../../chunks/canvas-preview-65xqjw7f.js";
|
|
6
6
|
import {
|
|
7
7
|
dispatchHead2
|
|
8
|
-
} from "../../../../../chunks/canvas-preview-
|
|
8
|
+
} from "../../../../../chunks/canvas-preview-kzmp015w.js";
|
|
9
9
|
|
|
10
10
|
// src/deploy/vercel/server/routes/[...].ts
|
|
11
11
|
import { defineHandler } from "nitro/h3";
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
dispatchHead2,
|
|
3
3
|
driveHead2,
|
|
4
4
|
advanceHead2
|
|
5
|
-
} from "../../../../../chunks/canvas-preview-
|
|
6
|
-
import"../../../../../chunks/canvas-preview-
|
|
5
|
+
} from "../../../../../chunks/canvas-preview-kzmp015w.js";
|
|
6
|
+
import"../../../../../chunks/canvas-preview-1f8h0he1.js";
|
|
7
7
|
import"../../../../../chunks/canvas-preview-2zdyh9ny.js";
|
|
8
8
|
import"../../../../../chunks/canvas-preview-65xqjw7f.js";
|
|
9
9
|
export {
|
package/dist/src/index.js
CHANGED
|
@@ -11,15 +11,15 @@ import"../chunks/canvas-preview-wg80rbc2.js";
|
|
|
11
11
|
import {
|
|
12
12
|
identitySigner2
|
|
13
13
|
} from "../chunks/canvas-preview-5mex725c.js";
|
|
14
|
-
import"../chunks/canvas-preview-
|
|
14
|
+
import"../chunks/canvas-preview-gm0frf4b.js";
|
|
15
15
|
import"../chunks/canvas-preview-rp4x6y1h.js";
|
|
16
|
-
import"../chunks/canvas-preview-
|
|
16
|
+
import"../chunks/canvas-preview-d97wvref.js";
|
|
17
17
|
import {
|
|
18
18
|
listenFetch2
|
|
19
|
-
} from "../chunks/canvas-preview-
|
|
19
|
+
} from "../chunks/canvas-preview-9e15hp6q.js";
|
|
20
20
|
import {
|
|
21
21
|
listen2
|
|
22
|
-
} from "../chunks/canvas-preview-
|
|
22
|
+
} from "../chunks/canvas-preview-whfdhma6.js";
|
|
23
23
|
import"../chunks/canvas-preview-0nq75h9k.js";
|
|
24
24
|
import"../chunks/canvas-preview-bxnqt8cd.js";
|
|
25
25
|
import"../chunks/canvas-preview-yjz0f7n4.js";
|
|
@@ -61,7 +61,7 @@ import"../chunks/canvas-preview-pkzqg96v.js";
|
|
|
61
61
|
import"../chunks/canvas-preview-vaatfznm.js";
|
|
62
62
|
import {
|
|
63
63
|
createMcpHub2
|
|
64
|
-
} from "../chunks/canvas-preview-
|
|
64
|
+
} from "../chunks/canvas-preview-gh7c9831.js";
|
|
65
65
|
import"../chunks/canvas-preview-9aqczacs.js";
|
|
66
66
|
import"../chunks/canvas-preview-4e0pxa32.js";
|
|
67
67
|
import"../chunks/canvas-preview-befkjea2.js";
|
|
@@ -81,10 +81,10 @@ import"../chunks/canvas-preview-0cmbkp2j.js";
|
|
|
81
81
|
import {
|
|
82
82
|
storePath2,
|
|
83
83
|
sqliteStore2
|
|
84
|
-
} from "../chunks/canvas-preview-
|
|
84
|
+
} from "../chunks/canvas-preview-mstbvwz3.js";
|
|
85
85
|
import {
|
|
86
86
|
openHost2
|
|
87
|
-
} from "../chunks/canvas-preview-
|
|
87
|
+
} from "../chunks/canvas-preview-ayayyd43.js";
|
|
88
88
|
import {
|
|
89
89
|
postgresStore2
|
|
90
90
|
} from "../chunks/canvas-preview-4b6sayhg.js";
|
package/dist/src/listen-fetch.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listenFetch2
|
|
3
|
-
} from "../chunks/canvas-preview-
|
|
4
|
-
import"../chunks/canvas-preview-
|
|
5
|
-
import"../chunks/canvas-preview-
|
|
3
|
+
} from "../chunks/canvas-preview-9e15hp6q.js";
|
|
4
|
+
import"../chunks/canvas-preview-d97wvref.js";
|
|
5
|
+
import"../chunks/canvas-preview-gm0frf4b.js";
|
|
6
6
|
import"../chunks/canvas-preview-rp4x6y1h.js";
|
|
7
7
|
export {
|
|
8
8
|
listenFetch2 as listenFetch
|
package/dist/src/listen.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listen2
|
|
3
|
-
} from "../chunks/canvas-preview-
|
|
4
|
-
import"../chunks/canvas-preview-
|
|
5
|
-
import"../chunks/canvas-preview-
|
|
6
|
-
import"../chunks/canvas-preview-
|
|
3
|
+
} from "../chunks/canvas-preview-whfdhma6.js";
|
|
4
|
+
import"../chunks/canvas-preview-9e15hp6q.js";
|
|
5
|
+
import"../chunks/canvas-preview-d97wvref.js";
|
|
6
|
+
import"../chunks/canvas-preview-gm0frf4b.js";
|
|
7
7
|
import"../chunks/canvas-preview-rp4x6y1h.js";
|
|
8
8
|
export {
|
|
9
9
|
listen2 as listen
|
package/dist/src/mcp/hub.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createMcpHub2
|
|
3
|
-
} from "../../chunks/canvas-preview-
|
|
3
|
+
} from "../../chunks/canvas-preview-gh7c9831.js";
|
|
4
4
|
import"../../chunks/canvas-preview-pkzqg96v.js";
|
|
5
5
|
import"../../chunks/canvas-preview-5z63am63.js";
|
|
6
6
|
import"../../chunks/canvas-preview-vaatfznm.js";
|
package/dist/src/open.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openHost2
|
|
3
|
-
} from "../chunks/canvas-preview-
|
|
3
|
+
} from "../chunks/canvas-preview-ayayyd43.js";
|
|
4
4
|
import"../chunks/canvas-preview-4e0pxa32.js";
|
|
5
5
|
import"../chunks/canvas-preview-y5y6ghaw.js";
|
|
6
6
|
import"../chunks/canvas-preview-ec2mt7es.js";
|
|
@@ -14,7 +14,7 @@ import"../chunks/canvas-preview-1sq7z9jq.js";
|
|
|
14
14
|
import"../chunks/canvas-preview-vm9zdp2t.js";
|
|
15
15
|
import"../chunks/canvas-preview-crmzxxt8.js";
|
|
16
16
|
import"../chunks/canvas-preview-tjhabynd.js";
|
|
17
|
-
import"../chunks/canvas-preview-
|
|
17
|
+
import"../chunks/canvas-preview-gh7c9831.js";
|
|
18
18
|
import"../chunks/canvas-preview-pkzqg96v.js";
|
|
19
19
|
import"../chunks/canvas-preview-5z63am63.js";
|
|
20
20
|
import"../chunks/canvas-preview-vaatfznm.js";
|
|
@@ -24,12 +24,12 @@ import"../chunks/canvas-preview-yjz0f7n4.js";
|
|
|
24
24
|
import"../chunks/canvas-preview-af86jz8t.js";
|
|
25
25
|
import"../chunks/canvas-preview-s94ebwf5.js";
|
|
26
26
|
import"../chunks/canvas-preview-kdqgrstc.js";
|
|
27
|
-
import"../chunks/canvas-preview-
|
|
27
|
+
import"../chunks/canvas-preview-mstbvwz3.js";
|
|
28
28
|
import"../chunks/canvas-preview-zaaj99wd.js";
|
|
29
|
-
import"../chunks/canvas-preview-
|
|
30
|
-
import"../chunks/canvas-preview-
|
|
31
|
-
import"../chunks/canvas-preview-
|
|
32
|
-
import"../chunks/canvas-preview-
|
|
29
|
+
import"../chunks/canvas-preview-whfdhma6.js";
|
|
30
|
+
import"../chunks/canvas-preview-9e15hp6q.js";
|
|
31
|
+
import"../chunks/canvas-preview-d97wvref.js";
|
|
32
|
+
import"../chunks/canvas-preview-gm0frf4b.js";
|
|
33
33
|
import"../chunks/canvas-preview-rp4x6y1h.js";
|
|
34
34
|
import"../chunks/canvas-preview-skzwvw4d.js";
|
|
35
35
|
import"../chunks/canvas-preview-bxnqt8cd.js";
|
|
@@ -34,6 +34,6 @@ export type Binding = CallBinding & FrameBinding & ByteBinding & OutputBinding;
|
|
|
34
34
|
export type BindingOptions = {
|
|
35
35
|
readonly server: ServerHost;
|
|
36
36
|
};
|
|
37
|
-
/** Returns each row bound to the call it names: ids bind handles on the connection, handles returned become ids, `Set`s and `Map`s become their wire forms; `head.move`, `files.batch` and `browser.open` go through the server port's wire operations with their wire id (§40o, §40x). `head.watch` sends the head's view from the host's fold whole, then each later view as its changes (`viewFrames`), the core watch marking the principal's seen tip (§40a, §54a). Authority is the caller's gate: the server checks each row's before binding. */
|
|
37
|
+
/** Returns each row bound to the call it names: ids bind handles on the connection, handles returned become ids, `Set`s and `Map`s become their wire forms; `head.move`, `files.batch` and `browser.open` go through the server port's wire operations with their wire id (§40o, §40x). `head.watch` sends the head's view from the host's fold whole, then each later view as its changes (`viewFrames`), the core watch marking the principal's seen tip (§40a, §54a); `sessions.watch` sends the list whole, then each later list as its order and changed rows (`sessionsFrames`). Authority is the caller's gate: the server checks each row's before binding. */
|
|
38
38
|
export declare function bindConnection(connection: Connection, options: BindingOptions): Binding;
|
|
39
39
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createHandler2
|
|
3
|
-
} from "../../chunks/canvas-preview-
|
|
4
|
-
import"../../chunks/canvas-preview-
|
|
3
|
+
} from "../../chunks/canvas-preview-d97wvref.js";
|
|
4
|
+
import"../../chunks/canvas-preview-gm0frf4b.js";
|
|
5
5
|
import"../../chunks/canvas-preview-rp4x6y1h.js";
|
|
6
6
|
export {
|
|
7
7
|
createHandler2 as createHandler
|
package/dist/src/sqlite.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
storePath2,
|
|
3
3
|
sqliteStore2
|
|
4
|
-
} from "../chunks/canvas-preview-
|
|
4
|
+
} from "../chunks/canvas-preview-mstbvwz3.js";
|
|
5
5
|
import"../chunks/canvas-preview-zaaj99wd.js";
|
|
6
6
|
import"../chunks/canvas-preview-0cmbkp2j.js";
|
|
7
7
|
import"../chunks/canvas-preview-69fkk9yn.js";
|
package/dist/src/store-usage.js
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
shiftDay2,
|
|
5
5
|
projectUsageReport2,
|
|
6
6
|
readNyteUsage2
|
|
7
|
-
} from "../chunks/canvas-preview-
|
|
7
|
+
} from "../chunks/canvas-preview-geg2gckp.js";
|
|
8
8
|
import"../chunks/canvas-preview-srgfpdmf.js";
|
|
9
|
-
import"../chunks/canvas-preview-
|
|
9
|
+
import"../chunks/canvas-preview-mstbvwz3.js";
|
|
10
10
|
import"../chunks/canvas-preview-zaaj99wd.js";
|
|
11
11
|
import"../chunks/canvas-preview-0cmbkp2j.js";
|
|
12
12
|
import"../chunks/canvas-preview-69fkk9yn.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
catalogForUsage2,
|
|
3
3
|
UsageScanner2
|
|
4
|
-
} from "../chunks/canvas-preview-
|
|
5
|
-
import"../chunks/canvas-preview-
|
|
6
|
-
import"../chunks/canvas-preview-
|
|
4
|
+
} from "../chunks/canvas-preview-k2xaz0ym.js";
|
|
5
|
+
import"../chunks/canvas-preview-eehzfefa.js";
|
|
6
|
+
import"../chunks/canvas-preview-geg2gckp.js";
|
|
7
7
|
import"../chunks/canvas-preview-kp75gb63.js";
|
|
8
8
|
import"../chunks/canvas-preview-srgfpdmf.js";
|
|
9
|
-
import"../chunks/canvas-preview-
|
|
9
|
+
import"../chunks/canvas-preview-mstbvwz3.js";
|
|
10
10
|
import"../chunks/canvas-preview-zaaj99wd.js";
|
|
11
11
|
import"../chunks/canvas-preview-0cmbkp2j.js";
|
|
12
12
|
import"../chunks/canvas-preview-69fkk9yn.js";
|
package/dist/src/usage-worker.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import"../chunks/canvas-preview-69fkk9yn.js";
|
|
2
2
|
import"../chunks/canvas-preview-zaaj99wd.js";
|
|
3
3
|
import"../chunks/canvas-preview-0cmbkp2j.js";
|
|
4
|
-
import"../chunks/canvas-preview-
|
|
4
|
+
import"../chunks/canvas-preview-mstbvwz3.js";
|
|
5
5
|
import"../chunks/canvas-preview-srgfpdmf.js";
|
|
6
|
-
import"../chunks/canvas-preview-
|
|
6
|
+
import"../chunks/canvas-preview-geg2gckp.js";
|
|
7
7
|
import"../chunks/canvas-preview-kp75gb63.js";
|
|
8
|
-
import"../chunks/canvas-preview-
|
|
8
|
+
import"../chunks/canvas-preview-eehzfefa.js";
|
|
9
9
|
import {
|
|
10
10
|
UsageScanner2
|
|
11
|
-
} from "../chunks/canvas-preview-
|
|
11
|
+
} from "../chunks/canvas-preview-k2xaz0ym.js";
|
|
12
12
|
|
|
13
13
|
// src/usage-worker.ts
|
|
14
14
|
import { parentPort } from "node:worker_threads";
|
package/dist/src/usage.js
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
loadUsageScanCaches2,
|
|
6
6
|
saveUsageScanCaches2,
|
|
7
7
|
readLocalUsage2
|
|
8
|
-
} from "../chunks/canvas-preview-
|
|
9
|
-
import"../chunks/canvas-preview-
|
|
8
|
+
} from "../chunks/canvas-preview-eehzfefa.js";
|
|
9
|
+
import"../chunks/canvas-preview-geg2gckp.js";
|
|
10
10
|
import"../chunks/canvas-preview-kp75gb63.js";
|
|
11
11
|
import"../chunks/canvas-preview-srgfpdmf.js";
|
|
12
|
-
import"../chunks/canvas-preview-
|
|
12
|
+
import"../chunks/canvas-preview-mstbvwz3.js";
|
|
13
13
|
import"../chunks/canvas-preview-zaaj99wd.js";
|
|
14
14
|
import"../chunks/canvas-preview-0cmbkp2j.js";
|
|
15
15
|
import"../chunks/canvas-preview-69fkk9yn.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyte-ai/host",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -94,33 +94,33 @@
|
|
|
94
94
|
"provenance": true
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@earendil-works/pi-mcp": "1.3.0",
|
|
98
|
-
"@lydell/node-pty": "1.2.0-beta.15",
|
|
99
|
-
"@nyte-ai/ai": "0.0.
|
|
100
|
-
"@nyte-ai/core": "0.0.
|
|
101
|
-
"@nyte-ai/plugin": "0.0.
|
|
102
|
-
"@nyte-ai/protocol": "0.0.
|
|
103
|
-
"@nyte-ai/schema": "0.0.
|
|
104
|
-
"@silvia-odwyer/photon": "0.3.3",
|
|
105
|
-
"fflate": "0.8.3",
|
|
106
|
-
"ignore": "7.0.
|
|
107
|
-
"pg": "8.23.
|
|
108
|
-
"typebox": "1.
|
|
97
|
+
"@earendil-works/pi-mcp": "^1.3.0",
|
|
98
|
+
"@lydell/node-pty": "^1.2.0-beta.15",
|
|
99
|
+
"@nyte-ai/ai": "0.0.23",
|
|
100
|
+
"@nyte-ai/core": "0.0.23",
|
|
101
|
+
"@nyte-ai/plugin": "0.0.23",
|
|
102
|
+
"@nyte-ai/protocol": "0.0.23",
|
|
103
|
+
"@nyte-ai/schema": "0.0.23",
|
|
104
|
+
"@silvia-odwyer/photon": "^0.3.3",
|
|
105
|
+
"fflate": "^0.8.3",
|
|
106
|
+
"ignore": "^7.0.13",
|
|
107
|
+
"pg": "^8.23.1",
|
|
108
|
+
"typebox": "^1.4.2"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@electric-sql/pglite": "0.5.
|
|
111
|
+
"@electric-sql/pglite": "^0.5.11",
|
|
112
112
|
"@nyte-ai/canvas": "0.0.0",
|
|
113
113
|
"@types/node": "^26.6.5",
|
|
114
|
-
"@types/pg": "8.23.1",
|
|
115
|
-
"fast-check": "4.10.2",
|
|
116
|
-
"nitro": "3.0.260903-beta",
|
|
114
|
+
"@types/pg": "^8.23.1",
|
|
115
|
+
"fast-check": "^4.10.2",
|
|
116
|
+
"nitro": "^3.0.260903-beta",
|
|
117
117
|
"typescript": "6.0.3",
|
|
118
118
|
"vitest": "^5.0.5",
|
|
119
|
-
"workflow": "
|
|
119
|
+
"workflow": "^5.2.3"
|
|
120
120
|
},
|
|
121
121
|
"peerDependencies": {
|
|
122
|
-
"nitro": "3.0.260903-beta",
|
|
123
|
-
"workflow": "
|
|
122
|
+
"nitro": "^3.0.260903-beta",
|
|
123
|
+
"workflow": "^5.2.3"
|
|
124
124
|
},
|
|
125
125
|
"peerDependenciesMeta": {
|
|
126
126
|
"nitro": {
|
package/src/mcp/hub.ts
CHANGED
|
@@ -104,8 +104,18 @@ function hub(input: {
|
|
|
104
104
|
const contents = new Map<string, McpFileContents>();
|
|
105
105
|
const watched = new Map<string, Disposer>();
|
|
106
106
|
const userPath = join(input.home, ".nyte", "mcp.json");
|
|
107
|
+
const retiring = new Set<Promise<void>>();
|
|
107
108
|
let closed = false;
|
|
108
109
|
|
|
110
|
+
const retire = (client: McpClient | null): Promise<void> => {
|
|
111
|
+
if (client === null) return Promise.resolve();
|
|
112
|
+
const done = client.close().catch(() => undefined);
|
|
113
|
+
retiring.add(done);
|
|
114
|
+
void done.then(() => retiring.delete(done));
|
|
115
|
+
|
|
116
|
+
return done;
|
|
117
|
+
};
|
|
118
|
+
|
|
109
119
|
const notify = (pool: Pool): void => {
|
|
110
120
|
for (const listener of pool.listeners) listener();
|
|
111
121
|
};
|
|
@@ -149,6 +159,7 @@ function hub(input: {
|
|
|
149
159
|
} | null = null;
|
|
150
160
|
|
|
151
161
|
let client: McpClient | null = null;
|
|
162
|
+
let opening: McpClient | null = null;
|
|
152
163
|
let stderr: () => string | null = () => null;
|
|
153
164
|
let challenge: OAuthChallenge | null = null;
|
|
154
165
|
let ended = false;
|
|
@@ -184,7 +195,7 @@ function hub(input: {
|
|
|
184
195
|
const drop = (message: string): void => {
|
|
185
196
|
const previous = client;
|
|
186
197
|
client = null;
|
|
187
|
-
void previous
|
|
198
|
+
void retire(previous);
|
|
188
199
|
|
|
189
200
|
if (ended) return;
|
|
190
201
|
set({ kind: "failed", message, stderr: stderr() });
|
|
@@ -197,11 +208,7 @@ function hub(input: {
|
|
|
197
208
|
|
|
198
209
|
if (ended) return;
|
|
199
210
|
|
|
200
|
-
const next = new TracingMcpClient({
|
|
201
|
-
name: "nyte",
|
|
202
|
-
version: "0.1.0",
|
|
203
|
-
requestTimeoutMs: link.entry.timeoutMs,
|
|
204
|
-
});
|
|
211
|
+
const next = new TracingMcpClient({ name: "nyte", version: "0.1.0" });
|
|
205
212
|
|
|
206
213
|
next.onClose(() => {
|
|
207
214
|
if (client === next) drop(`The connection to ${entry.name} closed.`);
|
|
@@ -229,10 +236,11 @@ function hub(input: {
|
|
|
229
236
|
transport instanceof StdioTransport && transport.stderr !== ""
|
|
230
237
|
? transport.stderr.slice(-STDERR_TAIL)
|
|
231
238
|
: null;
|
|
239
|
+
opening = next;
|
|
232
240
|
await next.connect(transport);
|
|
233
241
|
|
|
234
242
|
if (ended) {
|
|
235
|
-
await next
|
|
243
|
+
await retire(next);
|
|
236
244
|
|
|
237
245
|
return;
|
|
238
246
|
}
|
|
@@ -261,7 +269,7 @@ function hub(input: {
|
|
|
261
269
|
await refresh();
|
|
262
270
|
} catch (error) {
|
|
263
271
|
if (client === next) client = null;
|
|
264
|
-
await next
|
|
272
|
+
await retire(next);
|
|
265
273
|
|
|
266
274
|
if (ended) return;
|
|
267
275
|
|
|
@@ -321,7 +329,7 @@ function hub(input: {
|
|
|
321
329
|
clearTimeout(timer);
|
|
322
330
|
const previous = client;
|
|
323
331
|
client = null;
|
|
324
|
-
await
|
|
332
|
+
await Promise.all([retire(previous), retire(opening)]);
|
|
325
333
|
},
|
|
326
334
|
};
|
|
327
335
|
|
|
@@ -788,6 +796,7 @@ function hub(input: {
|
|
|
788
796
|
|
|
789
797
|
for (const pool of live) shut(pool);
|
|
790
798
|
await Promise.all(links.map((link) => link.close()));
|
|
799
|
+
await Promise.all(retiring);
|
|
791
800
|
},
|
|
792
801
|
};
|
|
793
802
|
}
|
package/src/serve/binding.ts
CHANGED
|
@@ -30,7 +30,7 @@ import type {
|
|
|
30
30
|
Receipt,
|
|
31
31
|
} from "@nyte-ai/core";
|
|
32
32
|
import type { ServerHost } from "@nyte-ai/core/server";
|
|
33
|
-
import { mapped, viewFrames } from "@nyte-ai/protocol";
|
|
33
|
+
import { mapped, sessionsFrames, viewFrames } from "@nyte-ai/protocol";
|
|
34
34
|
import type {
|
|
35
35
|
ByteName,
|
|
36
36
|
CallName,
|
|
@@ -103,7 +103,7 @@ const attempts = new WeakMap<ServerHost, Map<string, Attempt>>();
|
|
|
103
103
|
|
|
104
104
|
const holds = new WeakMap<ServerHost, Map<string, Page[]>>();
|
|
105
105
|
|
|
106
|
-
/** Returns each row bound to the call it names: ids bind handles on the connection, handles returned become ids, `Set`s and `Map`s become their wire forms; `head.move`, `files.batch` and `browser.open` go through the server port's wire operations with their wire id (§40o, §40x). `head.watch` sends the head's view from the host's fold whole, then each later view as its changes (`viewFrames`), the core watch marking the principal's seen tip (§40a, §54a). Authority is the caller's gate: the server checks each row's before binding. */
|
|
106
|
+
/** Returns each row bound to the call it names: ids bind handles on the connection, handles returned become ids, `Set`s and `Map`s become their wire forms; `head.move`, `files.batch` and `browser.open` go through the server port's wire operations with their wire id (§40o, §40x). `head.watch` sends the head's view from the host's fold whole, then each later view as its changes (`viewFrames`), the core watch marking the principal's seen tip (§40a, §54a); `sessions.watch` sends the list whole, then each later list as its order and changed rows (`sessionsFrames`). Authority is the caller's gate: the server checks each row's before binding. */
|
|
107
107
|
export function bindConnection(connection: Connection, options: BindingOptions): Binding {
|
|
108
108
|
const { wire } = options.server;
|
|
109
109
|
const { principal } = connection;
|
|
@@ -257,7 +257,7 @@ export function bindConnection(connection: Connection, options: BindingOptions):
|
|
|
257
257
|
"workspaces.add": ({ target, options }) => connection.workspaces.add(target, options),
|
|
258
258
|
"workspaces.forget": ({ id }) => connection.workspaces.forget(id),
|
|
259
259
|
|
|
260
|
-
"sessions.watch": async (input) => connection.sessions.watch(input),
|
|
260
|
+
"sessions.watch": async (input) => sessionsFrames(connection.sessions.watch(input)),
|
|
261
261
|
"sessions.start": async (input) => {
|
|
262
262
|
const { session, receipt } = await connection.sessions.start(input);
|
|
263
263
|
|
package/src/sqlite.ts
CHANGED
|
@@ -98,7 +98,8 @@ export function sqliteStore(input: { readonly path: string } | { readonly memory
|
|
|
98
98
|
closing ??= (async () => {
|
|
99
99
|
await opening?.catch(() => undefined);
|
|
100
100
|
await workers?.close();
|
|
101
|
-
|
|
101
|
+
|
|
102
|
+
if (database !== null) closeDatabase(database);
|
|
102
103
|
workers = null;
|
|
103
104
|
database = null;
|
|
104
105
|
opening = null;
|
|
@@ -111,6 +112,17 @@ export function sqliteStore(input: { readonly path: string } | { readonly memory
|
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
function closeDatabase(database: DatabaseSync): void {
|
|
116
|
+
if ("bun" in process.versions) {
|
|
117
|
+
const empty = new DatabaseSync(":memory:");
|
|
118
|
+
empty.exec("CREATE TABLE closed (id INTEGER)");
|
|
119
|
+
database.deserialize(empty.serialize());
|
|
120
|
+
empty.close();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
database.close();
|
|
124
|
+
}
|
|
125
|
+
|
|
114
126
|
function hasTable(database: DatabaseSync, name: string): boolean {
|
|
115
127
|
return (
|
|
116
128
|
database.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(name) !==
|