@procedures/peer 0.2.3 → 0.4.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/CHANGELOG.md +75 -0
- package/README.md +3 -3
- package/dist/.tsbuildinfo +1 -1
- package/dist/connection/index.d.ts +3 -2
- package/dist/connection/index.d.ts.map +1 -1
- package/dist/connection/index.js +6 -2
- package/dist/connection/index.js.map +1 -1
- package/dist/discovery/index.d.ts +4 -2
- package/dist/discovery/index.d.ts.map +1 -1
- package/dist/discovery/index.js +22 -34
- package/dist/discovery/index.js.map +1 -1
- package/dist/input-schemas.d.ts +5 -7
- package/dist/input-schemas.d.ts.map +1 -1
- package/dist/input-schemas.js +4 -15
- package/dist/input-schemas.js.map +1 -1
- package/dist/module.d.ts +2 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +2 -7
- package/dist/module.js.map +1 -1
- package/dist/output-schemas.d.ts +1 -4
- package/dist/output-schemas.d.ts.map +1 -1
- package/dist/output-schemas.js +0 -23
- package/dist/output-schemas.js.map +1 -1
- package/dist/peer/index.d.ts +16 -3
- package/dist/peer/index.d.ts.map +1 -1
- package/dist/peer/index.js +45 -6
- package/dist/peer/index.js.map +1 -1
- package/dist/procedures/index.d.ts +0 -6
- package/dist/procedures/index.d.ts.map +1 -1
- package/dist/procedures/index.js +1 -3
- package/dist/procedures/index.js.map +1 -1
- package/dist/procedures/manifest.generate.d.ts.map +1 -1
- package/dist/procedures/manifest.generate.js +10 -33
- package/dist/procedures/manifest.generate.js.map +1 -1
- package/dist/procedures/server.call.d.ts.map +1 -1
- package/dist/procedures/server.call.js +8 -3
- package/dist/procedures/server.call.js.map +1 -1
- package/dist/procedures/server.connect.d.ts.map +1 -1
- package/dist/procedures/server.connect.js +3 -1
- package/dist/procedures/server.connect.js.map +1 -1
- package/dist/types.d.ts +2 -58
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/connection/index.ts +8 -5
- package/src/discovery/index.ts +26 -35
- package/src/input-schemas.ts +4 -27
- package/src/module.ts +2 -7
- package/src/output-schemas.ts +0 -29
- package/src/peer/index.ts +70 -7
- package/src/procedures/index.ts +1 -8
- package/src/procedures/manifest.generate.ts +10 -33
- package/src/procedures/server.call.ts +8 -3
- package/src/procedures/server.connect.ts +3 -1
- package/src/types.ts +2 -76
- package/dist/procedures/server.start.d.ts +0 -14
- package/dist/procedures/server.start.d.ts.map +0 -1
- package/dist/procedures/server.start.js +0 -182
- package/dist/procedures/server.start.js.map +0 -1
- package/dist/procedures/server.status.d.ts +0 -13
- package/dist/procedures/server.status.d.ts.map +0 -1
- package/dist/procedures/server.status.js +0 -118
- package/dist/procedures/server.status.js.map +0 -1
- package/dist/procedures/server.stop.d.ts +0 -12
- package/dist/procedures/server.stop.d.ts.map +0 -1
- package/dist/procedures/server.stop.js +0 -98
- package/dist/procedures/server.stop.js.map +0 -1
- package/src/procedures/server.start.ts +0 -212
- package/src/procedures/server.status.ts +0 -141
- package/src/procedures/server.stop.ts +0 -123
package/dist/peer/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/peer/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EAExB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/peer/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EAExB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,MAAM,GAIP,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE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Y,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7F,CAAC;CACF;AAED,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAoB;IACnD,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -11,12 +11,6 @@ export { serverDisconnectProcedure } from "./server.disconnect.js";
|
|
|
11
11
|
export type { ServerDisconnectInput, ServerDisconnectOutput } from "./server.disconnect.js";
|
|
12
12
|
export { manifestGenerateProcedure } from "./manifest.generate.js";
|
|
13
13
|
export type { ManifestGenerateInput, ManifestGenerateOutput } from "./manifest.generate.js";
|
|
14
|
-
export { serverStartProcedure } from "./server.start.js";
|
|
15
|
-
export type { ServerStartInput, ServerStartOutput } from "./server.start.js";
|
|
16
|
-
export { serverStopProcedure } from "./server.stop.js";
|
|
17
|
-
export type { ServerStopInput, ServerStopOutput } from "./server.stop.js";
|
|
18
|
-
export { serverStatusProcedure } from "./server.status.js";
|
|
19
|
-
export type { ServerStatusInput, ServerStatusOutput } from "./server.status.js";
|
|
20
14
|
export { serverCallProcedure } from "./server.call.js";
|
|
21
15
|
export type { ServerCallInput, ServerCallOutput } from "./server.call.js";
|
|
22
16
|
export { serverConnectionsProcedure } from "./server.connections.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/procedures/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtF,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEhF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAE5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/procedures/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtF,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEhF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAE5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAI5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/procedures/index.js
CHANGED
|
@@ -7,9 +7,7 @@ export { serverCreateProcedure, getPeer, getActivePeerIds } from "./server.creat
|
|
|
7
7
|
export { serverConnectProcedure } from "./server.connect.js";
|
|
8
8
|
export { serverDisconnectProcedure } from "./server.disconnect.js";
|
|
9
9
|
export { manifestGenerateProcedure } from "./manifest.generate.js";
|
|
10
|
-
|
|
11
|
-
export { serverStopProcedure } from "./server.stop.js";
|
|
12
|
-
export { serverStatusProcedure } from "./server.status.js";
|
|
10
|
+
// server.start, server.stop and server.status are in @procedures/server (the package of the host)
|
|
13
11
|
export { serverCallProcedure } from "./server.call.js";
|
|
14
12
|
export { serverConnectionsProcedure } from "./server.connections.js";
|
|
15
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/procedures/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/procedures/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,kGAAkG;AAElG,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.generate.d.ts","sourceRoot":"","sources":["../../src/procedures/manifest.generate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"manifest.generate.d.ts","sourceRoot":"","sources":["../../src/procedures/manifest.generate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAwD,KAAK,OAAO,EAAE,KAAK,SAAS,EAA6C,MAAM,oBAAoB,CAAC;AAKnK,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAiB,MAAM,aAAa,CAAC;AAShG,eAAO,MAAM,yBAAyB,EAAE,SAAS,CAC/C,qBAAqB,EACrB,sBAAsB,EACtB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CA0DjC,CAAC;AAaX,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Procedure: manifest.generate
|
|
3
3
|
* Generates procedure manifests in various formats
|
|
4
4
|
*/
|
|
5
|
-
import { createProcedure,
|
|
5
|
+
import { createProcedure, describeRegistry, PROCEDURE_REGISTRY } from "@procedures/client";
|
|
6
|
+
import { infoOf } from "../discovery/index.js";
|
|
6
7
|
import { wrapSchema } from "../schema.js";
|
|
7
8
|
import { ManifestGenerateOutputSchema } from "../output-schemas.js";
|
|
8
9
|
import { manifestGenerateInputSchema } from "../input-schemas.js";
|
|
@@ -22,39 +23,15 @@ export const manifestGenerateProcedure = createProcedure()
|
|
|
22
23
|
effects: { reads: ["registry"], writes: ["fs"], idempotent: true },
|
|
23
24
|
})
|
|
24
25
|
.handler(async (input, ctx) => {
|
|
25
|
-
// The
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
for (let i = 0; i < input.namespace.length; i++) {
|
|
33
|
-
if (proc.path[i] !== input.namespace[i]) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return true;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
// Convert to ProcedureInfo format
|
|
41
|
-
const procedureInfos = procedures.map((proc) => {
|
|
42
|
-
const meta = proc.metadata;
|
|
43
|
-
const info = {
|
|
44
|
-
path: proc.path,
|
|
45
|
-
};
|
|
46
|
-
if (meta?.description !== undefined) {
|
|
47
|
-
info.description = meta.description;
|
|
48
|
-
}
|
|
49
|
-
// The JSON Schemas of the input and the output, when the schemas can describe themselves
|
|
50
|
-
const inputSchema = jsonSchemaOf(proc.input, { io: "input" });
|
|
51
|
-
const outputSchema = jsonSchemaOf(proc.output, { io: "output" });
|
|
52
|
-
if (inputSchema)
|
|
53
|
-
info.inputSchema = inputSchema;
|
|
54
|
-
if (outputSchema)
|
|
55
|
-
info.outputSchema = outputSchema;
|
|
56
|
-
return info;
|
|
26
|
+
// The one manifest of the core (roadmap R17): the procedures that the host exposes, with
|
|
27
|
+
// their JSON Schemas, under the namespace when the input gives one
|
|
28
|
+
const namespace = input.namespace ?? [];
|
|
29
|
+
const manifest = describeRegistry(ctx?.registry ?? PROCEDURE_REGISTRY, {
|
|
30
|
+
...(ctx?.expose ? { expose: ctx.expose } : {}),
|
|
31
|
+
withoutHandler: true,
|
|
32
|
+
include: (proc) => namespace.every((segment, index) => proc.path[index] === segment),
|
|
57
33
|
});
|
|
34
|
+
const procedureInfos = manifest.procedures.map(infoOf);
|
|
58
35
|
// Determine formats to generate
|
|
59
36
|
const formats = input.formats ?? ["json"];
|
|
60
37
|
const result = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.generate.js","sourceRoot":"","sources":["../../src/procedures/manifest.generate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"manifest.generate.js","sourceRoot":"","sources":["../../src/procedures/manifest.generate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,gBAAgB,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,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;YAC1D,MAAM,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;YACnC,MAAM,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YACtC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;KACD,KAAK,EAAE,CAAC;AAEX;;GAEG;AACH,KAAK,UAAU,SAAS,CAAC,GAAW;IAClC,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,8BAA8B;IAChC,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.call.d.ts","sourceRoot":"","sources":["../../src/procedures/server.call.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"server.call.d.ts","sourceRoot":"","sources":["../../src/procedures/server.call.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAuD,KAAK,OAAO,EAAE,KAAK,SAAS,EAAyB,MAAM,oBAAoB,CAAC;AAU9I,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,wEAAwE;IACxE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,MAAM,EAAE,OAAO,CAAC;IAChB,yBAAyB;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAQD,eAAO,MAAM,mBAAmB,EAAE,SAAS,CACzC,eAAe,EACf,gBAAgB,EAChB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CA0DjG,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Procedure: server.call
|
|
3
3
|
* Call a procedure on a remote peer through an outbound connection
|
|
4
4
|
*/
|
|
5
|
-
import { createProcedure, pathToMethod } from "@procedures/client";
|
|
5
|
+
import { TIMEOUT_METADATA_KEY, createProcedure, pathToMethod } from "@procedures/client";
|
|
6
6
|
import { wrapSchema } from "../schema.js";
|
|
7
7
|
import { ServerCallOutputSchema } from "../output-schemas.js";
|
|
8
8
|
import { serverCallInputSchema } from "../input-schemas.js";
|
|
@@ -23,7 +23,7 @@ export const serverCallProcedure = createProcedure()
|
|
|
23
23
|
shorts: { connectionId: "c", address: "a" },
|
|
24
24
|
output: "json",
|
|
25
25
|
})
|
|
26
|
-
.handler(async (input) => {
|
|
26
|
+
.handler(async (input, ctx) => {
|
|
27
27
|
// Normalize path: accept dot-separated string or array
|
|
28
28
|
const pathArray = typeof input.path === "string"
|
|
29
29
|
? input.path.split(".")
|
|
@@ -51,7 +51,12 @@ export const serverCallProcedure = createProcedure()
|
|
|
51
51
|
// Convert procedure path to Method format for client.call: the core mapping of every host
|
|
52
52
|
// (deep dive architecture review 3.3)
|
|
53
53
|
const method = pathToMethod(pathArray);
|
|
54
|
-
|
|
54
|
+
// The signal and the remaining time of this call go with the relayed call (roadmap R14)
|
|
55
|
+
const deadline = ctx?.capability?.deadline;
|
|
56
|
+
const result = await client.call(method, input.input ?? {}, {
|
|
57
|
+
...(ctx?.signal ? { signal: ctx.signal } : {}),
|
|
58
|
+
...(deadline !== undefined ? { context: { [TIMEOUT_METADATA_KEY]: Math.max(0, deadline - Date.now()) } } : {}),
|
|
59
|
+
});
|
|
55
60
|
return {
|
|
56
61
|
result,
|
|
57
62
|
connectionId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.call.js","sourceRoot":"","sources":["../../src/procedures/server.call.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"server.call.js","sourceRoot":"","sources":["../../src/procedures/server.call.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,YAAY,EAAuD,MAAM,oBAAoB,CAAC;AAC9I,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AA0BhE,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAM,sBAAsB,GAAG,UAAU,CAAmB,sBAAsB,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,mBAAmB,GAI5B,eAAe,EAAE;KAClB,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;KACxB,KAAK,CAAC,qBAAqB,CAAC;KAC5B,MAAM,CAAC,sBAAsB,CAAC;KAC9B,IAAI,CAAC;IACJ,WAAW,EAAE,kEAAkE;IAC/E,uDAAuD;IACvD,OAAO,EAAE,EAAE,KA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,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAEvC,wFAAwF;IACxF,MAAM,QAAQ,GAAG,GAAG,EAAE,UAAU,EAAE,QAAQ,CAAC;IAC3C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE;QAC1D,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,oBAAoB,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/G,CAAC,CAAC;IAEH,OAAO;QACL,MAAM;QACN,YAAY;QACZ,IAAI,EAAE,SAAS;KAChB,CAAC;AACJ,CAAC,CAAC;KACD,KAAK,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.connect.d.ts","sourceRoot":"","sources":["../../src/procedures/server.connect.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAmB,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAInF,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"server.connect.d.ts","sourceRoot":"","sources":["../../src/procedures/server.connect.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAmB,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAInF,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAO3E,eAAO,MAAM,sBAAsB,EAAE,SAAS,CAC5C,kBAAkB,EAClB,mBAAmB,EACnB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CA8BjC,CAAC;AAEX,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { wrapSchema } from "../schema.js";
|
|
|
7
7
|
import { ServerConnectOutputSchema } from "../output-schemas.js";
|
|
8
8
|
import { serverConnectInputSchema } from "../input-schemas.js";
|
|
9
9
|
import { connect } from "../connection/index.js";
|
|
10
|
+
import { ms } from "@procedures/client";
|
|
10
11
|
// Use pass-through schemas
|
|
11
12
|
const serverConnectOutputSchema = wrapSchema(ServerConnectOutputSchema);
|
|
12
13
|
export const serverConnectProcedure = createProcedure()
|
|
@@ -27,7 +28,8 @@ export const serverConnectProcedure = createProcedure()
|
|
|
27
28
|
connectOptions.transport = input.transport;
|
|
28
29
|
}
|
|
29
30
|
if (input.timeout !== undefined) {
|
|
30
|
-
|
|
31
|
+
// The input is data: a number of milliseconds
|
|
32
|
+
connectOptions.timeout = ms(input.timeout);
|
|
31
33
|
}
|
|
32
34
|
const connection = await connect(connectOptions);
|
|
33
35
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.connect.js","sourceRoot":"","sources":["../../src/procedures/server.connect.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAgC,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.connect.js","sourceRoot":"","sources":["../../src/procedures/server.connect.ts"],"names":[],"mappings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OAAO,CAAC,cAAc,CAAC,CAAC;IAEjD,OAAO;QACL,YAAY,EAAE,UAAU,CAAC,EAAE;QAC3B,YAAY,EAAE,UAAU,CAAC,MAAM,CAAC,YAAY;QAC5C,gBAAgB,EAAE,UAAU,CAAC,MAAM,CAAC,gBAAgB;KACrD,CAAC;AACJ,CAAC,CAAC;KACD,KAAK,EAAE,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export interface HttpTransportConfig {
|
|
|
15
15
|
urlStrategy?: "rest" | "rpc" | undefined;
|
|
16
16
|
/** A secret that every request must send as `Authorization: Bearer <token>` */
|
|
17
17
|
token?: string | undefined;
|
|
18
|
+
/** The largest request body in bytes. The default is 1 MiB. */
|
|
19
|
+
bodyLimit?: number | undefined;
|
|
18
20
|
}
|
|
19
21
|
export interface WebSocketTransportConfig {
|
|
20
22
|
type: "websocket";
|
|
@@ -131,62 +133,4 @@ export interface ProcedureUpdateMessage {
|
|
|
131
133
|
added?: ProcedureInfo[];
|
|
132
134
|
removed?: string[];
|
|
133
135
|
}
|
|
134
|
-
export interface ServerStartInput {
|
|
135
|
-
/** Port to listen on */
|
|
136
|
-
port?: number | undefined;
|
|
137
|
-
/** Host to bind to */
|
|
138
|
-
host?: string | undefined;
|
|
139
|
-
/** Transport type */
|
|
140
|
-
transport?: "http" | "websocket" | "both" | undefined;
|
|
141
|
-
}
|
|
142
|
-
export interface ServerStartOutput {
|
|
143
|
-
/** Whether start succeeded */
|
|
144
|
-
success: boolean;
|
|
145
|
-
/** Process ID of server */
|
|
146
|
-
pid?: number | undefined;
|
|
147
|
-
/** Port server is running on */
|
|
148
|
-
port?: number | undefined;
|
|
149
|
-
/** Endpoint URL */
|
|
150
|
-
endpoint?: string | undefined;
|
|
151
|
-
/** Log file path */
|
|
152
|
-
logFile?: string | undefined;
|
|
153
|
-
/** Status message */
|
|
154
|
-
message: string;
|
|
155
|
-
}
|
|
156
|
-
export interface ServerStopInput {
|
|
157
|
-
/** Port of server to stop (stops all if omitted) */
|
|
158
|
-
port?: number | undefined;
|
|
159
|
-
/** Force kill with SIGKILL instead of SIGTERM */
|
|
160
|
-
force?: boolean | undefined;
|
|
161
|
-
}
|
|
162
|
-
export interface ServerStopOutput {
|
|
163
|
-
/** Whether stop succeeded */
|
|
164
|
-
success: boolean;
|
|
165
|
-
/** Status message */
|
|
166
|
-
message: string;
|
|
167
|
-
}
|
|
168
|
-
export interface ServerStatusInput {
|
|
169
|
-
/** Port to check (shows all if omitted) */
|
|
170
|
-
port?: number | undefined;
|
|
171
|
-
}
|
|
172
|
-
export interface ServerStatusOutput {
|
|
173
|
-
/** Whether server is running */
|
|
174
|
-
running: boolean;
|
|
175
|
-
/** Process ID */
|
|
176
|
-
pid?: number | undefined;
|
|
177
|
-
/** Port */
|
|
178
|
-
port?: number | undefined;
|
|
179
|
-
/** Endpoint URL */
|
|
180
|
-
endpoint?: string | undefined;
|
|
181
|
-
/** Transport type */
|
|
182
|
-
transport?: string | undefined;
|
|
183
|
-
/** When server started (ISO string) */
|
|
184
|
-
startedAt?: string | undefined;
|
|
185
|
-
/** Human-readable uptime */
|
|
186
|
-
uptime?: string | undefined;
|
|
187
|
-
/** Log file path */
|
|
188
|
-
logFile?: string | undefined;
|
|
189
|
-
/** Status message */
|
|
190
|
-
message: string;
|
|
191
|
-
}
|
|
192
136
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,CAAC,E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AAW,GAAG,cAAc,GAAG,OAAO,CAAC;IAC7D,wBAAwB;IACxB,gBAAgB,EAAE,aAAa,EAAE,CAAC;IAClC,sCAAsC;IACtC,WAAW,CAAC,EAAE,IAAI,CAAC;CACpB;AAMD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,aAAa,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@procedures/peer",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"description": "Serve procedures: HTTP and WebSocket peers with token authentication, browser checks, an expose list, server.create,
|
|
4
|
+
"version": "0.4.0",
|
|
5
|
+
"description": "Serve procedures: HTTP and WebSocket peers with token authentication, browser checks, an expose list, server.create, server.call and server.connections, and manifests.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"server",
|
|
8
8
|
"rpc",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"procedures": "./dist/register.js"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@procedures/client": "0.
|
|
80
|
+
"@procedures/client": "0.4.0",
|
|
81
81
|
"zod": "^4.6.5"
|
|
82
82
|
},
|
|
83
83
|
"optionalDependencies": {
|
package/src/connection/index.ts
CHANGED
|
@@ -8,17 +8,20 @@
|
|
|
8
8
|
import {
|
|
9
9
|
Client,
|
|
10
10
|
HttpTransport,
|
|
11
|
-
WebSocketTransport,
|
|
12
11
|
defaultUrlPattern,
|
|
13
12
|
postOnlyStrategy,
|
|
14
13
|
type HttpTransportOptions,
|
|
15
14
|
} from "@procedures/client";
|
|
15
|
+
// The Node entry: its WebSocketTransport uses the ws class, so a drop ends the socket at once with
|
|
16
|
+
// terminate(). The peer package runs in Node only.
|
|
17
|
+
import { WebSocketTransport } from "@procedures/client/node";
|
|
16
18
|
import type {
|
|
17
19
|
TransportType,
|
|
18
20
|
PeerConnection,
|
|
19
21
|
ProcedureInfo,
|
|
20
22
|
ProcedureAnnounceMessage,
|
|
21
23
|
} from "../types.js";
|
|
24
|
+
import { ms, type Duration } from "@procedures/client";
|
|
22
25
|
|
|
23
26
|
// =============================================================================
|
|
24
27
|
// Types
|
|
@@ -29,8 +32,8 @@ export interface ConnectOptions {
|
|
|
29
32
|
address: string;
|
|
30
33
|
/** Transport type (auto-detected from URL if not specified) */
|
|
31
34
|
transport?: TransportType;
|
|
32
|
-
/**
|
|
33
|
-
timeout?:
|
|
35
|
+
/** The time limit of the connection, for example `seconds(10)` */
|
|
36
|
+
timeout?: Duration;
|
|
34
37
|
/** Local peer ID to identify ourselves */
|
|
35
38
|
localPeerId?: string;
|
|
36
39
|
}
|
|
@@ -143,7 +146,7 @@ function detectTransport(address: string): TransportType {
|
|
|
143
146
|
function createClient(
|
|
144
147
|
address: string,
|
|
145
148
|
transport: TransportType,
|
|
146
|
-
timeout?:
|
|
149
|
+
timeout?: Duration
|
|
147
150
|
): Client {
|
|
148
151
|
switch (transport) {
|
|
149
152
|
case "http": {
|
|
@@ -164,7 +167,7 @@ function createClient(
|
|
|
164
167
|
return new Client({
|
|
165
168
|
transport: new WebSocketTransport({
|
|
166
169
|
url: address,
|
|
167
|
-
connectionTimeout: timeout ?? 10000,
|
|
170
|
+
connectionTimeout: timeout ?? ms(10000),
|
|
168
171
|
reconnect: {
|
|
169
172
|
enabled: true,
|
|
170
173
|
maxAttempts: 3,
|
package/src/discovery/index.ts
CHANGED
|
@@ -14,6 +14,10 @@ import {
|
|
|
14
14
|
type ProcedureRegistryLike,
|
|
15
15
|
PROCEDURE_REGISTRY,
|
|
16
16
|
REGISTRY_READ_EFFECTS,
|
|
17
|
+
describeRegistry,
|
|
18
|
+
type AnyProcedure,
|
|
19
|
+
type ProcedureEntry,
|
|
20
|
+
type ProcedurePath,
|
|
17
21
|
} from "@procedures/client";
|
|
18
22
|
import { schema } from "../schema.js";
|
|
19
23
|
import type {
|
|
@@ -55,27 +59,14 @@ export const discoveryAnnounceProcedure: Procedure<
|
|
|
55
59
|
effects: REGISTRY_READ_EFFECTS,
|
|
56
60
|
})
|
|
57
61
|
.handler(async (_input: DiscoveryAnnounceInput, ctx?: ProcedureContext) => {
|
|
58
|
-
// The procedures of the registry that serves this
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return !meta?.internal;
|
|
67
|
-
})
|
|
68
|
-
.map((proc) => {
|
|
69
|
-
const meta = proc.metadata as { description?: string } | undefined;
|
|
70
|
-
const info: ProcedureInfo = {
|
|
71
|
-
path: proc.path,
|
|
72
|
-
};
|
|
73
|
-
if (meta?.description !== undefined) {
|
|
74
|
-
info.description = meta.description;
|
|
75
|
-
}
|
|
76
|
-
// TODO: Generate JSON schema from input/output schemas
|
|
77
|
-
return info;
|
|
78
|
-
});
|
|
62
|
+
// The one manifest of the core (roadmap R17): the procedures of the registry that serves this
|
|
63
|
+
// call and that the host exposes, with their JSON Schemas, without the internal ones.
|
|
64
|
+
// Before, the announce gave no schemas and listed the procedures that the host hides.
|
|
65
|
+
const manifest = describeRegistry(ctx?.registry ?? PROCEDURE_REGISTRY, {
|
|
66
|
+
...(ctx?.expose ? { expose: ctx.expose } : {}),
|
|
67
|
+
include: (proc: AnyProcedure) => !(proc.metadata as { internal?: boolean } | undefined)?.internal,
|
|
68
|
+
});
|
|
69
|
+
const procedureInfos: ProcedureInfo[] = manifest.procedures.map(infoOf);
|
|
79
70
|
|
|
80
71
|
// Generate a peer ID based on process (could be configured)
|
|
81
72
|
const peerId = `peer-${process.pid}-${Date.now().toString(36)}`;
|
|
@@ -95,21 +86,21 @@ export const discoveryAnnounceProcedure: Procedure<
|
|
|
95
86
|
/**
|
|
96
87
|
* Get procedure info for all registered procedures of a registry (default: the global registry)
|
|
97
88
|
*/
|
|
98
|
-
export function getProcedureInfos(
|
|
99
|
-
|
|
89
|
+
export function getProcedureInfos(
|
|
90
|
+
registry: ProcedureRegistryLike = PROCEDURE_REGISTRY,
|
|
91
|
+
expose?: (path: ProcedurePath) => boolean
|
|
92
|
+
): ProcedureInfo[] {
|
|
93
|
+
// The one manifest of the core (roadmap R17), without the schemas
|
|
94
|
+
return describeRegistry(registry, { schemas: false, ...(expose ? { expose } : {}) }).procedures.map(infoOf);
|
|
95
|
+
}
|
|
100
96
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (meta?.description !== undefined) {
|
|
109
|
-
info.description = meta.description;
|
|
110
|
-
}
|
|
111
|
-
return info;
|
|
112
|
-
});
|
|
97
|
+
/** The ProcedureInfo of a manifest entry: the form that the peers exchange. */
|
|
98
|
+
export function infoOf(entry: ProcedureEntry): ProcedureInfo {
|
|
99
|
+
const info: ProcedureInfo = { path: [...entry.path] };
|
|
100
|
+
if (entry.description !== undefined) info.description = entry.description;
|
|
101
|
+
if (entry.input) info.inputSchema = entry.input;
|
|
102
|
+
if (entry.output) info.outputSchema = entry.output;
|
|
103
|
+
return info;
|
|
113
104
|
}
|
|
114
105
|
|
|
115
106
|
/**
|
package/src/input-schemas.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Input schemas of the `server.*` and `manifest.*` procedures.
|
|
2
|
+
* Input schemas of the `server.*` and `manifest.*` procedures of the peer package.
|
|
3
3
|
*
|
|
4
|
-
* Before, these procedures used pass-through schemas: `mark server
|
|
4
|
+
* Before, these procedures used pass-through schemas: `mark server create --help` listed no
|
|
5
5
|
* options, and a port such as "abc" reached the handler. Each schema now validates its input,
|
|
6
|
-
* and the CLI help shows the fields.
|
|
6
|
+
* and the CLI help shows the fields. The schemas of `server.start`, `server.stop` and
|
|
7
|
+
* `server.status` are in `@procedures/server`.
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import { z } from "zod";
|
|
@@ -13,9 +14,6 @@ import type {
|
|
|
13
14
|
ServerConnectInput,
|
|
14
15
|
ServerCreateInput,
|
|
15
16
|
ServerDisconnectInput,
|
|
16
|
-
ServerStartInput,
|
|
17
|
-
ServerStatusInput,
|
|
18
|
-
ServerStopInput,
|
|
19
17
|
} from "./types.js";
|
|
20
18
|
import type { ServerCallInput } from "./procedures/server.call.js";
|
|
21
19
|
import type { ServerConnectionsInput } from "./procedures/server.connections.js";
|
|
@@ -59,27 +57,6 @@ export const serverCreateInputSchema: ZodLikeSchema<ServerCreateInput> = zodAdap
|
|
|
59
57
|
})
|
|
60
58
|
);
|
|
61
59
|
|
|
62
|
-
export const serverStartInputSchema: ZodLikeSchema<ServerStartInput> = zodAdapter<ServerStartInput>(
|
|
63
|
-
z.object({
|
|
64
|
-
port: port.optional().describe("The port to listen on (default: 3000)"),
|
|
65
|
-
host: z.string().min(1).optional().describe("The host to bind to (default: 127.0.0.1)"),
|
|
66
|
-
transport: z.enum(["http", "websocket", "both"]).optional().describe("The transport (default: http)"),
|
|
67
|
-
})
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
export const serverStopInputSchema: ZodLikeSchema<ServerStopInput> = zodAdapter<ServerStopInput>(
|
|
71
|
-
z.object({
|
|
72
|
-
port: port.optional().describe("The port of the server to stop (default: all servers)"),
|
|
73
|
-
force: z.boolean().optional().describe("Stop with SIGKILL instead of SIGTERM"),
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
export const serverStatusInputSchema: ZodLikeSchema<ServerStatusInput> = zodAdapter<ServerStatusInput>(
|
|
78
|
-
z.object({
|
|
79
|
-
port: port.optional().describe("The port of the server (default: all servers)"),
|
|
80
|
-
})
|
|
81
|
-
);
|
|
82
|
-
|
|
83
60
|
export const serverConnectInputSchema: ZodLikeSchema<ServerConnectInput> = zodAdapter<ServerConnectInput>(
|
|
84
61
|
z.object({
|
|
85
62
|
address: z.string().min(1).describe("The address of the remote peer"),
|
package/src/module.ts
CHANGED
|
@@ -15,14 +15,12 @@ import { serverConnectProcedure } from "./procedures/server.connect.js";
|
|
|
15
15
|
import { serverDisconnectProcedure } from "./procedures/server.disconnect.js";
|
|
16
16
|
import { manifestGenerateProcedure } from "./procedures/manifest.generate.js";
|
|
17
17
|
import { discoveryAnnounceProcedure } from "./discovery/index.js";
|
|
18
|
-
import { serverStartProcedure } from "./procedures/server.start.js";
|
|
19
|
-
import { serverStopProcedure } from "./procedures/server.stop.js";
|
|
20
|
-
import { serverStatusProcedure } from "./procedures/server.status.js";
|
|
21
18
|
import { serverCallProcedure } from "./procedures/server.call.js";
|
|
22
19
|
import { serverConnectionsProcedure } from "./procedures/server.connections.js";
|
|
23
20
|
|
|
24
21
|
/**
|
|
25
|
-
* All server procedures
|
|
22
|
+
* All server procedures. `server.start`, `server.stop` and `server.status` manage the background
|
|
23
|
+
* server of the `mark` CLI: they are in `@procedures/server`, the package of the host.
|
|
26
24
|
*/
|
|
27
25
|
export const procedures: readonly AnyProcedure[] = [
|
|
28
26
|
serverCreateProcedure,
|
|
@@ -30,9 +28,6 @@ export const procedures: readonly AnyProcedure[] = [
|
|
|
30
28
|
serverDisconnectProcedure,
|
|
31
29
|
manifestGenerateProcedure,
|
|
32
30
|
discoveryAnnounceProcedure,
|
|
33
|
-
serverStartProcedure,
|
|
34
|
-
serverStopProcedure,
|
|
35
|
-
serverStatusProcedure,
|
|
36
31
|
serverCallProcedure,
|
|
37
32
|
serverConnectionsProcedure,
|
|
38
33
|
];
|
package/src/output-schemas.ts
CHANGED
|
@@ -12,9 +12,6 @@ import type {
|
|
|
12
12
|
ServerConnectOutput,
|
|
13
13
|
ServerCreateOutput,
|
|
14
14
|
ServerDisconnectOutput,
|
|
15
|
-
ServerStartOutput,
|
|
16
|
-
ServerStatusOutput,
|
|
17
|
-
ServerStopOutput,
|
|
18
15
|
} from "./types.js";
|
|
19
16
|
import type { ServerCallOutput } from "./procedures/server.call.js";
|
|
20
17
|
import type { ServerConnectionsOutput } from "./procedures/server.connections.js";
|
|
@@ -62,32 +59,6 @@ export const ManifestGenerateOutputSchema: z.ZodType<ManifestGenerateOutput> = z
|
|
|
62
59
|
filesWritten: z.array(z.string()).optional().describe("The files that the call wrote, with outputDir"),
|
|
63
60
|
});
|
|
64
61
|
|
|
65
|
-
export const ServerStartOutputSchema: z.ZodType<ServerStartOutput> = z.looseObject({
|
|
66
|
-
success: z.boolean().describe("True when the server started"),
|
|
67
|
-
pid: z.number().optional().describe("The process id of the server"),
|
|
68
|
-
port: z.number().optional().describe("The port of the server"),
|
|
69
|
-
endpoint: z.string().optional().describe("The URL of the server"),
|
|
70
|
-
logFile: z.string().optional().describe("The log file of the server"),
|
|
71
|
-
message: z.string().describe("A message about the result"),
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
export const ServerStopOutputSchema: z.ZodType<ServerStopOutput> = z.looseObject({
|
|
75
|
-
success: z.boolean().describe("True when the server stopped"),
|
|
76
|
-
message: z.string().describe("A message about the result"),
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
export const ServerStatusOutputSchema: z.ZodType<ServerStatusOutput> = z.looseObject({
|
|
80
|
-
running: z.boolean().describe("True when a server runs"),
|
|
81
|
-
pid: z.number().optional().describe("The process id of the server"),
|
|
82
|
-
port: z.number().optional().describe("The port of the server"),
|
|
83
|
-
endpoint: z.string().optional().describe("The URL of the server"),
|
|
84
|
-
transport: z.string().optional().describe("The transport of the server"),
|
|
85
|
-
startedAt: z.string().optional().describe("The start time (ISO 8601)"),
|
|
86
|
-
uptime: z.string().optional().describe("The time since the start, as text"),
|
|
87
|
-
logFile: z.string().optional().describe("The log file of the server"),
|
|
88
|
-
message: z.string().describe("A message about the result"),
|
|
89
|
-
});
|
|
90
|
-
|
|
91
62
|
export const ServerCallOutputSchema: z.ZodType<ServerCallOutput> = z.looseObject({
|
|
92
63
|
result: z.unknown().describe("The result of the remote procedure"),
|
|
93
64
|
connectionId: z.string().describe("The connection that the call used"),
|