@masons/agent-network 0.6.26 → 0.6.27
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/channel-setup.d.ts.map +1 -1
- package/dist/constants.d.ts +0 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/platform-client.d.ts.map +1 -1
- package/dist/plugin.js +2 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +6 -6
- package/dist/update-check.d.ts +4 -0
- package/dist/update-check.d.ts.map +1 -1
- package/dist/update-check.js +28 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -5
- package/skills/agent-network/SKILL.md +1 -1
- package/dist/runtime-endpoint-client.d.ts +0 -97
- package/dist/runtime-endpoint-client.d.ts.map +0 -1
- package/dist/runtime-endpoint-client.js +0 -163
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel-setup.d.ts","sourceRoot":"","sources":["../src/channel-setup.ts"],"names":[],"mappings":"AA+BA,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IAEnB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAM9B,SAAS,CAAC,EAAE,MAAM,CAAC;IAOnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AA4CD,MAAM,WAAW,kBAAkB;IAKjC,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA4BD,wBAAgB,6BAA6B,IAAI,wBAAwB,CAKxE;AAWD,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAqB7B;AAyDD,wBAAgB,qBAAqB,IAAI,kBAAkB,GAAG,IAAI,CAQjE;AAaD,wBAAgB,wBAAwB,IAAI,kBAAkB,GAAG,IAAI,CAOpE;
|
|
1
|
+
{"version":3,"file":"channel-setup.d.ts","sourceRoot":"","sources":["../src/channel-setup.ts"],"names":[],"mappings":"AA+BA,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IAEnB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAM9B,SAAS,CAAC,EAAE,MAAM,CAAC;IAOnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AA4CD,MAAM,WAAW,kBAAkB;IAKjC,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA4BD,wBAAgB,6BAA6B,IAAI,wBAAwB,CAKxE;AAWD,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAqB7B;AAyDD,wBAAgB,qBAAqB,IAAI,kBAAkB,GAAG,IAAI,CAQjE;AAaD,wBAAgB,wBAAwB,IAAI,kBAAkB,GAAG,IAAI,CAOpE;AAyOD,wBAAgB,4BAA4B,IAAI,IAAI,CAInD;AAED,eAAO,MAAM,oBAAoB,QAAqB,CAAC"}
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,QAAiB,CAAC"}
|
package/dist/constants.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AUTHORIZED_TOKEN_TTL_MS
|
|
1
|
+
export { AUTHORIZED_TOKEN_TTL_MS } from "./constants.js";
|
|
2
2
|
export type { AgentNetworkAccount } from "./config-schema.js";
|
|
3
3
|
export type { AddressedMessageEvent, DeliveryPendingEvent, DeliverySkipEvent, DeliveryStatusEvent, ObservedSendAckEvent, RegisterAckEvent, SendAckEvent, StructuredErrorEvent, } from "./types.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAIzD,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AUTHORIZED_TOKEN_TTL_MS
|
|
1
|
+
export { AUTHORIZED_TOKEN_TTL_MS } from "./constants.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-client.d.ts","sourceRoot":"","sources":["../src/platform-client.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,gBAAgB,0BAA0B,CAAC;AASxD,eAAO,MAAM,qB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WAAW,CAC/B,GAAG,EAAE,oBAAoB,EACzB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAyBnC"}
|
package/dist/plugin.js
CHANGED
|
@@ -10,7 +10,7 @@ import { isServicesRetainedReplyContext } from "./services-retained-reply-contex
|
|
|
10
10
|
import { evaluateServicesRetainedToolPolicy, SERVICES_RETAINED_TOOL_POLICY_ID, } from "./services-retained-tool-policy.js";
|
|
11
11
|
import { registerTools } from "./tools.js";
|
|
12
12
|
import { setCurrentTurnChannelId, setCurrentTurnIsOwnerForTools, setCurrentTurnOwnerSignalForTools, } from "./turn-context.js";
|
|
13
|
-
import { getUpdateInfo } from "./update-check.js";
|
|
13
|
+
import { getUpdateInfo, NPM_PACKAGE_NAME } from "./update-check.js";
|
|
14
14
|
import { PLUGIN_VERSION } from "./version.js";
|
|
15
15
|
function formatTimeAgo(timestamp) {
|
|
16
16
|
const diff = Date.now() - timestamp;
|
|
@@ -125,7 +125,7 @@ const plugin = {
|
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
catch (err) {
|
|
128
|
-
console.error(
|
|
128
|
+
console.error(`[${NPM_PACKAGE_NAME}] api.registerChannel failed — channel will be unavailable:`, err);
|
|
129
129
|
throw err;
|
|
130
130
|
}
|
|
131
131
|
let cachedState = null;
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAuBA,OAAO,EAEL,KAAK,kBAAkB,EAGxB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAuBA,OAAO,EAEL,KAAK,kBAAkB,EAGxB,MAAM,oBAAoB,CAAC;AA2D5B,UAAU,WAAW;IACnB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,CACP,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,OAAO,CAAC,WAAW,CAAC,CAAC;CAC3B;AAED,UAAU,WAAW;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,KAAK,WAAW,GAAG,CAAC,GAAG,EAAE,WAAW,KAAK,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC;AAE3E,UAAU,OAAO;IACf,YAAY,CACV,IAAI,EAAE,cAAc,GAAG,WAAW,EAWlC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAC7D,IAAI,CAAC;CACT;AAqED,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C;AAkYD,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,iBAAiB,GAAG,WAAW,GACtC,MAAM,CAqBR;AAGD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAyC3E;AA+CD,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAqoChD"}
|
package/dist/tools.js
CHANGED
|
@@ -9,7 +9,7 @@ import { ownerNotesQueue } from "./owner-notes.js";
|
|
|
9
9
|
import { acceptRequest, getIdentity, ignoreRequest, isPackagedTombstone, listConnections, listRequests, PlatformApiError, PlatformNetworkError, requestConnection, updateProfile, withdrawRequest, } from "./platform-client.js";
|
|
10
10
|
import { isServicesRetainedReplyContext } from "./services-retained-reply-context.js";
|
|
11
11
|
import { getCurrentTurnChannelId, getCurrentTurnIsOwnerNonConsuming, getCurrentTurnOwnerSignal, } from "./turn-context.js";
|
|
12
|
-
import { getLatestPublishedVersion, getPluginVersion, getUpdateInfo, } from "./update-check.js";
|
|
12
|
+
import { getLatestPublishedVersion, getPluginVersion, getUpdateInfo, NPM_PACKAGE_NAME, } from "./update-check.js";
|
|
13
13
|
const PROFILE_FIELDS = new Set(["name", "scope", "about", "audience"]);
|
|
14
14
|
const GATEWAY_RESTART_CMD = "openclaw gateway restart";
|
|
15
15
|
const PACKAGED_TOOL_ROSTER = pluginManifest.contracts.tools;
|
|
@@ -18,7 +18,7 @@ function withRoster(text) {
|
|
|
18
18
|
return `${text}\n\n${ROSTER_HEADER}\n${PACKAGED_TOOL_ROSTER.join(", ")}`;
|
|
19
19
|
}
|
|
20
20
|
function upgradeCmd(version) {
|
|
21
|
-
return `openclaw plugins install
|
|
21
|
+
return `openclaw plugins install ${NPM_PACKAGE_NAME}@${version} --force`;
|
|
22
22
|
}
|
|
23
23
|
const SEMVER_RE = /^\d+\.\d+\.\d+$/;
|
|
24
24
|
export function _resetToolsForTesting() {
|
|
@@ -429,7 +429,7 @@ export function registerTools(api) {
|
|
|
429
429
|
catch (err) {
|
|
430
430
|
if (err instanceof PlatformApiError) {
|
|
431
431
|
if (err.status === 401) {
|
|
432
|
-
return textResult("Authentication failed. The runtime key may be invalid. Ask the owner to re-link here: call masons_link
|
|
432
|
+
return textResult("Authentication failed. The runtime key may be invalid. Ask the owner to re-link here: call masons_link.");
|
|
433
433
|
}
|
|
434
434
|
if (err.status === 422) {
|
|
435
435
|
return textResult(`Validation error: ${err.message}`);
|
|
@@ -510,7 +510,7 @@ export function registerTools(api) {
|
|
|
510
510
|
: "This Services deployment does not serve the connection-request endpoint. Nothing was sent.");
|
|
511
511
|
}
|
|
512
512
|
if (err.status === 401) {
|
|
513
|
-
return textResult("Authentication failed. The runtime key may be invalid. Ask the owner to re-link here: call masons_link
|
|
513
|
+
return textResult("Authentication failed. The runtime key may be invalid. Ask the owner to re-link here: call masons_link.");
|
|
514
514
|
}
|
|
515
515
|
return textResult(`Connection request failed: ${err.message}`);
|
|
516
516
|
}
|
|
@@ -594,7 +594,7 @@ export function registerTools(api) {
|
|
|
594
594
|
catch (err) {
|
|
595
595
|
if (err instanceof PlatformApiError) {
|
|
596
596
|
if (err.status === 401) {
|
|
597
|
-
return textResult("Authentication failed. The runtime key may be invalid. Ask the owner to re-link here: call masons_link
|
|
597
|
+
return textResult("Authentication failed. The runtime key may be invalid. Ask the owner to re-link here: call masons_link.");
|
|
598
598
|
}
|
|
599
599
|
if (err.status === 404) {
|
|
600
600
|
return textResult("This Services deployment does not serve the packaged connection-request endpoint. Nothing was read.");
|
|
@@ -782,7 +782,7 @@ export function registerTools(api) {
|
|
|
782
782
|
catch (err) {
|
|
783
783
|
if (err instanceof PlatformApiError) {
|
|
784
784
|
if (err.status === 401) {
|
|
785
|
-
return textResult("Authentication failed. The runtime key may be invalid. Ask the owner to re-link here: call masons_link
|
|
785
|
+
return textResult("Authentication failed. The runtime key may be invalid. Ask the owner to re-link here: call masons_link.");
|
|
786
786
|
}
|
|
787
787
|
return textResult(`Failed to list connections: ${err.message}`);
|
|
788
788
|
}
|
package/dist/update-check.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { UpdateCheckCache } from "./update-cache.js";
|
|
2
|
+
export declare const NPM_PACKAGE_NAME: string;
|
|
3
|
+
export declare function resolveRegistryBase(pkgLike: {
|
|
4
|
+
publishConfig?: Record<string, unknown>;
|
|
5
|
+
}): string;
|
|
2
6
|
export interface UpdateInfo {
|
|
3
7
|
currentVersion: string;
|
|
4
8
|
latestVersion: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-check.d.ts","sourceRoot":"","sources":["../src/update-check.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-check.d.ts","sourceRoot":"","sources":["../src/update-check.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAmB1D,eAAO,MAAM,gBAAgB,EAAE,MAAiB,CAAC;AAgBjD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC,GAAG,MAAM,CAmCT;AAWD,MAAM,WAAW,UAAU;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAGD,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAajC,wBAAgB,aAAa,IAAI,UAAU,GAAG,IAAI,CAEjD;AAGD,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAUD,wBAAsB,cAAc,CAAC,OAAO,UAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAiClE;AAUD,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiBxE;AAYD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAarD;AAOD,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|
package/dist/update-check.js
CHANGED
|
@@ -1,7 +1,33 @@
|
|
|
1
|
+
import createDebug from "debug";
|
|
2
|
+
import pkg from "../package.json" with { type: "json" };
|
|
1
3
|
import { readCache, writeCache } from "./update-cache.js";
|
|
2
4
|
import { PLUGIN_VERSION } from "./version.js";
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
+
const dbg = createDebug("agent-network:update-check");
|
|
6
|
+
export const NPM_PACKAGE_NAME = pkg.name;
|
|
7
|
+
const DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org";
|
|
8
|
+
export function resolveRegistryBase(pkgLike) {
|
|
9
|
+
const configured = pkgLike.publishConfig?.registry;
|
|
10
|
+
if (configured === undefined)
|
|
11
|
+
return DEFAULT_NPM_REGISTRY;
|
|
12
|
+
if (typeof configured !== "string") {
|
|
13
|
+
dbg("publishConfig.registry is not a string — using %s", DEFAULT_NPM_REGISTRY);
|
|
14
|
+
return DEFAULT_NPM_REGISTRY;
|
|
15
|
+
}
|
|
16
|
+
let parsed;
|
|
17
|
+
try {
|
|
18
|
+
parsed = new URL(configured);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
dbg("publishConfig.registry %s is not a valid URL — using %s", configured, DEFAULT_NPM_REGISTRY);
|
|
22
|
+
return DEFAULT_NPM_REGISTRY;
|
|
23
|
+
}
|
|
24
|
+
if (parsed.protocol !== "https:") {
|
|
25
|
+
dbg("publishConfig.registry %s is not https — using %s", configured, DEFAULT_NPM_REGISTRY);
|
|
26
|
+
return DEFAULT_NPM_REGISTRY;
|
|
27
|
+
}
|
|
28
|
+
return configured.replace(/\/+$/, "");
|
|
29
|
+
}
|
|
30
|
+
const NPM_REGISTRY_URL = `${resolveRegistryBase(pkg)}/${NPM_PACKAGE_NAME}/latest`;
|
|
5
31
|
const CHECK_INTERVAL_MS = 86_400_000;
|
|
6
32
|
const FETCH_TIMEOUT_MS = 5_000;
|
|
7
33
|
let updateInfo = null;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PLUGIN_VERSION = "0.6.
|
|
1
|
+
export declare const PLUGIN_VERSION = "0.6.27";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PLUGIN_VERSION = "0.6.
|
|
1
|
+
export const PLUGIN_VERSION = "0.6.27";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@masons/agent-network",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.27",
|
|
4
4
|
"description": "MASONS Agent Network — OpenClaw channel plugin for connecting agent runtimes to the Agent Network over MSTP.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "MASONS.ai <hello@masons.ai> (https://masons.ai)",
|
|
@@ -71,10 +71,6 @@
|
|
|
71
71
|
"types": "./dist/platform-client.d.ts",
|
|
72
72
|
"default": "./dist/platform-client.js"
|
|
73
73
|
},
|
|
74
|
-
"./runtime-endpoint": {
|
|
75
|
-
"types": "./dist/runtime-endpoint-client.d.ts",
|
|
76
|
-
"default": "./dist/runtime-endpoint-client.js"
|
|
77
|
-
},
|
|
78
74
|
"./handoff": {
|
|
79
75
|
"types": "./dist/handoff.d.ts",
|
|
80
76
|
"default": "./dist/handoff.js"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agent-network
|
|
3
|
-
description: "Connects to the agent network through MASONS and enables real-time communication between AI agents. Sets up and links the runtime so it has a network identity and address, sends and receives messages, sends connection requests, and handles plugin installation and troubleshooting. Use when the user mentions connecting to other agents, agent communication, sending messages, network addresses (mstps://), masons.ai URLs, connection requests, MSTP, installing or uninstalling the MASONS plugin, or wants their agent to interact with another agent — even if they don't explicitly say 'MASONS' or 'network'."
|
|
3
|
+
description: "Connects to the agent network through MASONS and enables real-time communication between AI agents. Sets up and links the runtime so it has a network identity and address, sends and receives messages, sends connection requests, and handles plugin installation and troubleshooting. Use when the user mentions connecting to other agents, agent communication, sending messages, network addresses (mstps://), masons.ai URLs, connection requests, MSTP, 'relink' or 're-link' or '重新链接', linking or 绑定 an Agent Node / MASONS / 网络 / the network, installing or uninstalling the MASONS plugin, or wants their agent to interact with another agent — even if they don't explicitly say 'MASONS' or 'network'."
|
|
4
4
|
metadata:
|
|
5
5
|
openclaw:
|
|
6
6
|
emoji: "🌐"
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { PlatformApiError, type PlatformClientConfig } from "./platform-client.js";
|
|
2
|
-
export { PlatformApiError, type PlatformClientConfig };
|
|
3
|
-
export type RuntimeKind = "claude-code" | "openclaw" | "codex" | "passport" | "custom" | (string & {});
|
|
4
|
-
export type RuntimeEndpointCapability = "remote_spawn_v1" | "background_exchange_v1" | "foreground_channel_v1" | (string & {});
|
|
5
|
-
export type EndpointExecutionSurface = "owner_attached" | "headless" | (string & {});
|
|
6
|
-
export type EndpointBackgroundExchangeMode = "resident_endpoint" | "adapter_managed_turn" | (string & {});
|
|
7
|
-
export type RuntimeWorkTargetRef = {
|
|
8
|
-
kind: "projection_endpoint";
|
|
9
|
-
projection_endpoint_id: string;
|
|
10
|
-
background_exchange_mode: "resident_endpoint";
|
|
11
|
-
} | {
|
|
12
|
-
kind: "projection_endpoint";
|
|
13
|
-
projection_endpoint_id: string;
|
|
14
|
-
runtime_session_id: string;
|
|
15
|
-
background_exchange_mode: "adapter_managed_turn";
|
|
16
|
-
};
|
|
17
|
-
export interface WorkspaceMetadata {
|
|
18
|
-
root: string;
|
|
19
|
-
cwd: string;
|
|
20
|
-
remote?: string;
|
|
21
|
-
branch?: string;
|
|
22
|
-
}
|
|
23
|
-
export type ShareWithPeerField = "workspace" | "tracking_ref" | "fingerprint" | (string & {});
|
|
24
|
-
export interface RegisterRuntimeEndpointParams {
|
|
25
|
-
as?: string;
|
|
26
|
-
runtime_kind: RuntimeKind;
|
|
27
|
-
runtime_session_id?: string;
|
|
28
|
-
endpoint_nonce: string;
|
|
29
|
-
display_label: string;
|
|
30
|
-
workspace?: WorkspaceMetadata;
|
|
31
|
-
tracking_ref?: string;
|
|
32
|
-
runtime_capabilities?: RuntimeEndpointCapability[];
|
|
33
|
-
execution_surface?: EndpointExecutionSurface;
|
|
34
|
-
background_exchange_mode?: EndpointBackgroundExchangeMode;
|
|
35
|
-
share_with_peer?: ShareWithPeerField[];
|
|
36
|
-
}
|
|
37
|
-
export interface RegisterRuntimeEndpointResponse {
|
|
38
|
-
endpoint_id: string;
|
|
39
|
-
node_id: string;
|
|
40
|
-
display_label: string;
|
|
41
|
-
runtime_capabilities?: RuntimeEndpointCapability[];
|
|
42
|
-
execution_surface?: EndpointExecutionSurface;
|
|
43
|
-
background_exchange_mode?: EndpointBackgroundExchangeMode;
|
|
44
|
-
heartbeat_after_seconds: number;
|
|
45
|
-
lease_ttl_seconds: number;
|
|
46
|
-
soft_retention_seconds: number;
|
|
47
|
-
registered_at: string;
|
|
48
|
-
}
|
|
49
|
-
export interface OwnedRuntimeEndpointView {
|
|
50
|
-
endpoint_id: string;
|
|
51
|
-
node_id: string;
|
|
52
|
-
node_handle?: string;
|
|
53
|
-
runtime_kind: RuntimeKind;
|
|
54
|
-
runtime_session_id?: string;
|
|
55
|
-
display_label: string;
|
|
56
|
-
workspace?: WorkspaceMetadata;
|
|
57
|
-
tracking_ref?: string;
|
|
58
|
-
fingerprint?: {
|
|
59
|
-
workspace_hash_per_peer?: Record<string, string>;
|
|
60
|
-
};
|
|
61
|
-
runtime_capabilities?: RuntimeEndpointCapability[];
|
|
62
|
-
execution_surface?: EndpointExecutionSurface;
|
|
63
|
-
background_exchange_mode?: EndpointBackgroundExchangeMode;
|
|
64
|
-
runtime_work_target_ref?: RuntimeWorkTargetRef;
|
|
65
|
-
registered_at: string;
|
|
66
|
-
retired_at?: string;
|
|
67
|
-
is_self: boolean;
|
|
68
|
-
}
|
|
69
|
-
export interface ListOwnedRuntimeEndpointsResponse {
|
|
70
|
-
total: number;
|
|
71
|
-
items: OwnedRuntimeEndpointView[];
|
|
72
|
-
}
|
|
73
|
-
export type HeartbeatRuntimeEndpointResponse = Record<string, unknown>;
|
|
74
|
-
export type UnregisterRuntimeEndpointResponse = Record<string, unknown>;
|
|
75
|
-
export interface TransitionRuntimeEndpointStateParams {
|
|
76
|
-
state: "active" | "reconnecting" | "closed";
|
|
77
|
-
reason: string;
|
|
78
|
-
ts: string;
|
|
79
|
-
}
|
|
80
|
-
export type TransitionRuntimeEndpointStateResponse = Record<string, unknown>;
|
|
81
|
-
export declare function registerRuntimeEndpoint(cfg: PlatformClientConfig, runtimeKey: string, params: RegisterRuntimeEndpointParams): Promise<RegisterRuntimeEndpointResponse>;
|
|
82
|
-
export declare function heartbeatRuntimeEndpoint(cfg: PlatformClientConfig, runtimeKey: string, endpointId: string): Promise<HeartbeatRuntimeEndpointResponse>;
|
|
83
|
-
export declare function transitionRuntimeEndpointState(cfg: PlatformClientConfig, runtimeKey: string, endpointId: string, params: TransitionRuntimeEndpointStateParams): Promise<TransitionRuntimeEndpointStateResponse>;
|
|
84
|
-
export declare function unregisterRuntimeEndpoint(cfg: PlatformClientConfig, runtimeKey: string, endpointId: string, asNodeId?: string): Promise<UnregisterRuntimeEndpointResponse>;
|
|
85
|
-
export declare function listOwnedRuntimeEndpoints(cfg: PlatformClientConfig, runtimeKey: string, asNodeId: string): Promise<ListOwnedRuntimeEndpointsResponse>;
|
|
86
|
-
export declare function getOwnedRuntimeEndpoint(cfg: PlatformClientConfig, runtimeKey: string, endpointId: string, asNodeId: string): Promise<OwnedRuntimeEndpointView>;
|
|
87
|
-
export declare function emitRuntimeUndispatchedChanged(cfg: PlatformClientConfig, runtimeKey: string, event: Readonly<Record<string, unknown>>): Promise<EmitUndispatchedChangedOutcome>;
|
|
88
|
-
export type EmitUndispatchedChangedOutcome = {
|
|
89
|
-
ok: true;
|
|
90
|
-
} | {
|
|
91
|
-
ok: false;
|
|
92
|
-
terminal: boolean;
|
|
93
|
-
status?: number;
|
|
94
|
-
detail?: string;
|
|
95
|
-
};
|
|
96
|
-
export declare function emitRuntimeNetworkPresenceChanged(cfg: PlatformClientConfig, runtimeKey: string, event: Readonly<Record<string, unknown>>): Promise<EmitUndispatchedChangedOutcome>;
|
|
97
|
-
//# sourceMappingURL=runtime-endpoint-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-endpoint-client.d.ts","sourceRoot":"","sources":["../src/runtime-endpoint-client.ts"],"names":[],"mappings":"AAuBA,OAAO,EAEL,gBAAgB,EAChB,KAAK,oBAAoB,EAC1B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,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,oBAAoB,EACzB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,iCAAiC,CAAC,CAO5C;AAWD,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,oBAAoB,EACzB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,wBAAwB,CAAC,CAUnC;AA2BD,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,oBAAoB,EACzB,UAAU,EAAE,MAAM,EAOlB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACvC,OAAO,CAAC,8BAA8B,CAAC,CAyCzC;AAED,MAAM,MAAM,8BAA8B,GACtC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GACZ;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAsBvE,wBAAsB,iCAAiC,CACrD,GAAG,EAAE,oBAAoB,EACzB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACvC,OAAO,CAAC,8BAA8B,CAAC,CAkCzC"}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { apiFetch, PlatformApiError, } from "./platform-client.js";
|
|
2
|
-
export { PlatformApiError };
|
|
3
|
-
function baseUrl(cfg) {
|
|
4
|
-
const trimmed = cfg.apiHost.replace(/\/+$/, "");
|
|
5
|
-
const origin = /^https?:\/\//.test(trimmed) ? trimmed : `https://${trimmed}`;
|
|
6
|
-
return `${origin}/v1`;
|
|
7
|
-
}
|
|
8
|
-
async function handleError(res) {
|
|
9
|
-
const body = (await res.json().catch(() => ({})));
|
|
10
|
-
const code = typeof body.error === "string" ? body.error : "unknown";
|
|
11
|
-
const message = typeof body.message === "string" ? body.message : res.statusText;
|
|
12
|
-
throw new PlatformApiError(res.status, code, message);
|
|
13
|
-
}
|
|
14
|
-
function authHeaders(runtimeKey) {
|
|
15
|
-
return { Authorization: `Bearer ${runtimeKey}` };
|
|
16
|
-
}
|
|
17
|
-
function jsonHeaders(runtimeKey) {
|
|
18
|
-
return {
|
|
19
|
-
...authHeaders(runtimeKey),
|
|
20
|
-
"Content-Type": "application/json",
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export async function registerRuntimeEndpoint(cfg, runtimeKey, params) {
|
|
24
|
-
const res = await apiFetch(`${baseUrl(cfg)}/runtime-endpoints`, {
|
|
25
|
-
method: "POST",
|
|
26
|
-
headers: jsonHeaders(runtimeKey),
|
|
27
|
-
body: JSON.stringify(params),
|
|
28
|
-
});
|
|
29
|
-
if (!res.ok)
|
|
30
|
-
return handleError(res);
|
|
31
|
-
return (await res.json());
|
|
32
|
-
}
|
|
33
|
-
export async function heartbeatRuntimeEndpoint(cfg, runtimeKey, endpointId) {
|
|
34
|
-
const res = await apiFetch(`${baseUrl(cfg)}/runtime-endpoints/${encodeURIComponent(endpointId)}/heartbeat`, {
|
|
35
|
-
method: "POST",
|
|
36
|
-
headers: authHeaders(runtimeKey),
|
|
37
|
-
});
|
|
38
|
-
if (!res.ok)
|
|
39
|
-
return handleError(res);
|
|
40
|
-
return ((await res.json().catch(() => ({}))) ??
|
|
41
|
-
{});
|
|
42
|
-
}
|
|
43
|
-
export async function transitionRuntimeEndpointState(cfg, runtimeKey, endpointId, params) {
|
|
44
|
-
const res = await apiFetch(`${baseUrl(cfg)}/runtime-endpoints/${encodeURIComponent(endpointId)}/state`, {
|
|
45
|
-
method: "POST",
|
|
46
|
-
headers: jsonHeaders(runtimeKey),
|
|
47
|
-
body: JSON.stringify(params),
|
|
48
|
-
});
|
|
49
|
-
if (!res.ok)
|
|
50
|
-
return handleError(res);
|
|
51
|
-
return ((await res.json().catch(() => ({}))) ??
|
|
52
|
-
{});
|
|
53
|
-
}
|
|
54
|
-
export async function unregisterRuntimeEndpoint(cfg, runtimeKey, endpointId, asNodeId) {
|
|
55
|
-
const query = asNodeId
|
|
56
|
-
? `?${new URLSearchParams({ as: asNodeId }).toString()}`
|
|
57
|
-
: "";
|
|
58
|
-
const res = await apiFetch(`${baseUrl(cfg)}/runtime-endpoints/${encodeURIComponent(endpointId)}${query}`, {
|
|
59
|
-
method: "DELETE",
|
|
60
|
-
headers: authHeaders(runtimeKey),
|
|
61
|
-
});
|
|
62
|
-
if (!res.ok)
|
|
63
|
-
return handleError(res);
|
|
64
|
-
return ((await res.json().catch(() => ({}))) ??
|
|
65
|
-
{});
|
|
66
|
-
}
|
|
67
|
-
export async function listOwnedRuntimeEndpoints(cfg, runtimeKey, asNodeId) {
|
|
68
|
-
const query = new URLSearchParams({ as: asNodeId }).toString();
|
|
69
|
-
const res = await apiFetch(`${baseUrl(cfg)}/runtime-endpoints?${query}`, {
|
|
70
|
-
headers: authHeaders(runtimeKey),
|
|
71
|
-
});
|
|
72
|
-
if (!res.ok)
|
|
73
|
-
return handleError(res);
|
|
74
|
-
return (await res.json());
|
|
75
|
-
}
|
|
76
|
-
export async function getOwnedRuntimeEndpoint(cfg, runtimeKey, endpointId, asNodeId) {
|
|
77
|
-
const query = new URLSearchParams({ as: asNodeId }).toString();
|
|
78
|
-
const res = await apiFetch(`${baseUrl(cfg)}/runtime-endpoints/${encodeURIComponent(endpointId)}?${query}`, {
|
|
79
|
-
headers: authHeaders(runtimeKey),
|
|
80
|
-
});
|
|
81
|
-
if (!res.ok)
|
|
82
|
-
return handleError(res);
|
|
83
|
-
return (await res.json());
|
|
84
|
-
}
|
|
85
|
-
export async function emitRuntimeUndispatchedChanged(cfg, runtimeKey, event) {
|
|
86
|
-
let res;
|
|
87
|
-
try {
|
|
88
|
-
res = await apiFetch(`${baseUrl(cfg)}/runtime/undispatched-changed`, {
|
|
89
|
-
method: "POST",
|
|
90
|
-
headers: jsonHeaders(runtimeKey),
|
|
91
|
-
body: JSON.stringify(event),
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
catch (err) {
|
|
95
|
-
return {
|
|
96
|
-
ok: false,
|
|
97
|
-
terminal: false,
|
|
98
|
-
detail: err instanceof Error ? err.message : String(err),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
if (res.status === 204)
|
|
102
|
-
return { ok: true };
|
|
103
|
-
if (res.status === 401 || res.status === 422) {
|
|
104
|
-
return {
|
|
105
|
-
ok: false,
|
|
106
|
-
terminal: true,
|
|
107
|
-
status: res.status,
|
|
108
|
-
detail: await readErrorDetail(res),
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
ok: false,
|
|
113
|
-
terminal: false,
|
|
114
|
-
status: res.status,
|
|
115
|
-
detail: await readErrorDetail(res),
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
export async function emitRuntimeNetworkPresenceChanged(cfg, runtimeKey, event) {
|
|
119
|
-
let res;
|
|
120
|
-
try {
|
|
121
|
-
res = await apiFetch(`${baseUrl(cfg)}/runtime/network-presence-changed`, {
|
|
122
|
-
method: "POST",
|
|
123
|
-
headers: jsonHeaders(runtimeKey),
|
|
124
|
-
body: JSON.stringify(event),
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
catch (err) {
|
|
128
|
-
return {
|
|
129
|
-
ok: false,
|
|
130
|
-
terminal: false,
|
|
131
|
-
detail: err instanceof Error ? err.message : String(err),
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
if (res.status === 204)
|
|
135
|
-
return { ok: true };
|
|
136
|
-
if (res.status === 401 || res.status === 422) {
|
|
137
|
-
return {
|
|
138
|
-
ok: false,
|
|
139
|
-
terminal: true,
|
|
140
|
-
status: res.status,
|
|
141
|
-
detail: await readErrorDetail(res),
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
return {
|
|
145
|
-
ok: false,
|
|
146
|
-
terminal: false,
|
|
147
|
-
status: res.status,
|
|
148
|
-
detail: await readErrorDetail(res),
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
async function readErrorDetail(res) {
|
|
152
|
-
try {
|
|
153
|
-
const body = (await res.json().catch(() => null));
|
|
154
|
-
if (!body)
|
|
155
|
-
return undefined;
|
|
156
|
-
const code = typeof body.error === "string" ? body.error : undefined;
|
|
157
|
-
const message = typeof body.message === "string" ? body.message : undefined;
|
|
158
|
-
return [code, message].filter(Boolean).join(": ") || undefined;
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
161
|
-
return undefined;
|
|
162
|
-
}
|
|
163
|
-
}
|