@masons/agent-network 0.6.23 → 0.6.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -5
- package/dist/_vendor/runtime-adapter-client/exact-target-presentation.d.ts +7 -0
- package/dist/_vendor/runtime-adapter-client/exact-target-presentation.d.ts.map +1 -0
- package/dist/_vendor/runtime-adapter-client/exact-target-presentation.js +51 -0
- package/dist/_vendor/runtime-adapter-client/index.d.ts +1 -0
- package/dist/_vendor/runtime-adapter-client/index.d.ts.map +1 -1
- package/dist/_vendor/runtime-adapter-client/index.js +1 -0
- package/dist/_vendor/runtime-adapter-client/runtime-adapter-api.d.ts +2 -2
- package/dist/_vendor/runtime-adapter-client/runtime-adapter-api.d.ts.map +1 -1
- package/dist/_vendor/runtime-adapter-client/runtime-adapter-api.js +105 -20
- package/dist/_vendor/runtime-adapter-client/types.d.ts +17 -5
- package/dist/_vendor/runtime-adapter-client/types.d.ts.map +1 -1
- package/dist/_vendor/runtime-adapter-client/types.js +13 -0
- package/dist/_vendor/runtime-adapter-client/work-target.d.ts.map +1 -1
- package/dist/_vendor/runtime-adapter-client/work-target.js +23 -5
- package/dist/channel-setup.d.ts +3 -1
- package/dist/channel-setup.d.ts.map +1 -1
- package/dist/channel-setup.js +146 -75
- package/dist/cli-setup.d.ts.map +1 -1
- package/dist/cli-setup.js +7 -7
- package/dist/config.js +1 -1
- package/dist/connector-client.d.ts.map +1 -1
- package/dist/connector-client.js +4 -2
- package/dist/handoff-acceptance.js +5 -5
- package/dist/handoff-deadline.js +1 -1
- package/dist/handoff.d.ts +14 -0
- package/dist/handoff.d.ts.map +1 -1
- package/dist/handoff.js +85 -11
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +10 -8
- package/dist/tools.d.ts +3 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +92 -68
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/openclaw.plugin.json +4 -4
- package/package.json +1 -1
- package/skills/agent-network/SKILL.md +40 -37
- package/skills/agent-network/references/maintenance.md +3 -3
- package/skills/agent-network/references/troubleshooting.md +71 -13
|
@@ -4,13 +4,19 @@ export function parseRuntimeWorkTargetRef(value) {
|
|
|
4
4
|
const raw = value;
|
|
5
5
|
if (raw.kind !== "projection_endpoint" ||
|
|
6
6
|
typeof raw.projection_endpoint_id !== "string" ||
|
|
7
|
-
raw.projection_endpoint_id.
|
|
7
|
+
raw.projection_endpoint_id.length === 0 ||
|
|
8
|
+
raw.projection_endpoint_id.trim() !== raw.projection_endpoint_id) {
|
|
8
9
|
return null;
|
|
9
10
|
}
|
|
10
|
-
const projectionEndpointId = raw.projection_endpoint_id
|
|
11
|
+
const projectionEndpointId = raw.projection_endpoint_id;
|
|
11
12
|
if (raw.background_exchange_mode === "resident_endpoint") {
|
|
12
|
-
if (raw
|
|
13
|
+
if (!hasExactKeys(raw, [
|
|
14
|
+
"kind",
|
|
15
|
+
"projection_endpoint_id",
|
|
16
|
+
"background_exchange_mode",
|
|
17
|
+
])) {
|
|
13
18
|
return null;
|
|
19
|
+
}
|
|
14
20
|
return {
|
|
15
21
|
kind: "projection_endpoint",
|
|
16
22
|
projection_endpoint_id: projectionEndpointId,
|
|
@@ -20,16 +26,28 @@ export function parseRuntimeWorkTargetRef(value) {
|
|
|
20
26
|
if ((raw.background_exchange_mode === "adapter_managed_turn" ||
|
|
21
27
|
raw.background_exchange_mode === "session_attached_pull") &&
|
|
22
28
|
typeof raw.runtime_session_id === "string" &&
|
|
23
|
-
raw.runtime_session_id.
|
|
29
|
+
raw.runtime_session_id.length > 0 &&
|
|
30
|
+
raw.runtime_session_id.trim() === raw.runtime_session_id &&
|
|
31
|
+
hasExactKeys(raw, [
|
|
32
|
+
"kind",
|
|
33
|
+
"projection_endpoint_id",
|
|
34
|
+
"runtime_session_id",
|
|
35
|
+
"background_exchange_mode",
|
|
36
|
+
])) {
|
|
24
37
|
return {
|
|
25
38
|
kind: "projection_endpoint",
|
|
26
39
|
projection_endpoint_id: projectionEndpointId,
|
|
27
|
-
runtime_session_id: raw.runtime_session_id
|
|
40
|
+
runtime_session_id: raw.runtime_session_id,
|
|
28
41
|
background_exchange_mode: raw.background_exchange_mode,
|
|
29
42
|
};
|
|
30
43
|
}
|
|
31
44
|
return null;
|
|
32
45
|
}
|
|
46
|
+
function hasExactKeys(value, expected) {
|
|
47
|
+
const actual = Object.keys(value).sort();
|
|
48
|
+
return (actual.length === expected.length &&
|
|
49
|
+
[...expected].sort().every((key, index) => actual[index] === key));
|
|
50
|
+
}
|
|
33
51
|
export function isRuntimeWorkTargetRef(value) {
|
|
34
52
|
return parseRuntimeWorkTargetRef(value) !== null;
|
|
35
53
|
}
|
package/dist/channel-setup.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ interface StartChannelSetupOptions {
|
|
|
2
2
|
apiHost: string;
|
|
3
3
|
connectorUrl?: string;
|
|
4
4
|
idpBaseUrl: string;
|
|
5
|
+
idpBaseUrlIsDefault?: boolean;
|
|
5
6
|
invitedBy?: string;
|
|
7
|
+
startOver?: boolean;
|
|
6
8
|
}
|
|
7
9
|
export interface ChannelSetupResult {
|
|
8
10
|
status: "pending" | "completed" | "expired" | "failed";
|
|
@@ -13,7 +15,7 @@ export interface ChannelSetupResult {
|
|
|
13
15
|
export declare function getDefaultChannelSetupOptions(): StartChannelSetupOptions;
|
|
14
16
|
export declare function startOrGetChannelSetup(options: StartChannelSetupOptions): Promise<ChannelSetupResult>;
|
|
15
17
|
export declare function getChannelSetupStatus(): ChannelSetupResult | null;
|
|
16
|
-
export declare function
|
|
18
|
+
export declare function getReportableSetupStatus(): ChannelSetupResult | null;
|
|
17
19
|
export declare function _resetChannelSetupForTesting(): void;
|
|
18
20
|
export declare const CHANNEL_SETUP_TTL_MS: number;
|
|
19
21
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel-setup.d.ts","sourceRoot":"","sources":["../src/channel-setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"channel-setup.d.ts","sourceRoot":"","sources":["../src/channel-setup.ts"],"names":[],"mappings":"AAkBA,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;IACjC,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAuBD,wBAAgB,6BAA6B,IAAI,wBAAwB,CAKxE;AAWD,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAkB7B;AAOD,wBAAgB,qBAAqB,IAAI,kBAAkB,GAAG,IAAI,CAQjE;AAaD,wBAAgB,wBAAwB,IAAI,kBAAkB,GAAG,IAAI,CAOpE;AAgOD,wBAAgB,4BAA4B,IAAI,IAAI,CAInD;AAED,eAAO,MAAM,oBAAoB,QAAqB,CAAC"}
|
package/dist/channel-setup.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import createDebug from "debug";
|
|
2
2
|
import { readExistingConnectorUrl } from "./config.js";
|
|
3
3
|
import { resolveConnectorUrlForSetup } from "./connector-url-boundary.js";
|
|
4
|
-
import { beginBridgeHandoff, completeBridgeHandoff, DEFAULT_IDP_BASE_URL, HANDOFF_TIMEOUT_MS, SetupFlowError, } from "./handoff.js";
|
|
4
|
+
import { beginBridgeHandoff, collectBridgeHandoffOnce, completeBridgeHandoff, DEFAULT_IDP_BASE_URL, HANDOFF_TIMEOUT_MS, SetupFlowError, } from "./handoff.js";
|
|
5
5
|
import { acceptBridgeHandoff } from "./handoff-acceptance.js";
|
|
6
6
|
import { DEFAULT_API_HOST } from "./platform-client.js";
|
|
7
7
|
const dbg = createDebug("agent-network:channel-setup");
|
|
8
|
+
const GENERIC_EXPIRY_MESSAGE = "The previous Link URL expired before the browser handoff completed.";
|
|
9
|
+
const GONE_MESSAGE = "That Link session is no longer on the handoff bridge — it expired, or its runtime key was already delivered — so it cannot complete.";
|
|
10
|
+
const SUPERSEDED_MESSAGE = "A newer Link session replaced this one while it was completing, so the runtime key that session delivered was discarded. Nothing changed — this runtime still uses the credential it had before.";
|
|
8
11
|
let pendingSetup = null;
|
|
9
12
|
let lastSetupStatus = null;
|
|
13
|
+
let setupSeq = 0;
|
|
14
|
+
let lastRecordedSeq = 0;
|
|
10
15
|
export function getDefaultChannelSetupOptions() {
|
|
11
16
|
return {
|
|
12
17
|
apiHost: DEFAULT_API_HOST,
|
|
@@ -14,49 +19,26 @@ export function getDefaultChannelSetupOptions() {
|
|
|
14
19
|
};
|
|
15
20
|
}
|
|
16
21
|
export async function startOrGetChannelSetup(options) {
|
|
22
|
+
if (options.startOver)
|
|
23
|
+
return await startNewSession(options);
|
|
17
24
|
const active = getActivePendingSetup();
|
|
18
25
|
if (active) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
expiresAt: active.session.expiresAt,
|
|
23
|
-
};
|
|
26
|
+
const collected = await collectActiveSetup(active);
|
|
27
|
+
if (collected)
|
|
28
|
+
return collected;
|
|
24
29
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const session = await beginBridgeHandoff({
|
|
33
|
-
apiHost: options.apiHost,
|
|
34
|
-
idpBaseUrl: options.idpBaseUrl,
|
|
35
|
-
});
|
|
36
|
-
const record = {
|
|
37
|
-
session,
|
|
38
|
-
apiHost: options.apiHost,
|
|
39
|
-
connectorUrl,
|
|
40
|
-
idpBaseUrl: options.idpBaseUrl,
|
|
41
|
-
invitedBy: options.invitedBy,
|
|
42
|
-
};
|
|
43
|
-
pendingSetup = record;
|
|
44
|
-
void completePendingSetup(record);
|
|
45
|
-
return {
|
|
46
|
-
status: "pending",
|
|
47
|
-
handoffUrl: session.handoffUrl,
|
|
48
|
-
expiresAt: session.expiresAt,
|
|
49
|
-
};
|
|
30
|
+
const reportable = getReportableSetupStatus();
|
|
31
|
+
if (reportable)
|
|
32
|
+
return reportable;
|
|
33
|
+
const live = getActivePendingSetup();
|
|
34
|
+
if (live)
|
|
35
|
+
return pendingResult(live);
|
|
36
|
+
return await startNewSession(options);
|
|
50
37
|
}
|
|
51
38
|
export function getChannelSetupStatus() {
|
|
52
39
|
const active = getActivePendingSetup();
|
|
53
|
-
if (active)
|
|
54
|
-
return
|
|
55
|
-
status: "pending",
|
|
56
|
-
handoffUrl: active.session.handoffUrl,
|
|
57
|
-
expiresAt: active.session.expiresAt,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
40
|
+
if (active)
|
|
41
|
+
return pendingResult(active);
|
|
60
42
|
if (!lastSetupStatus)
|
|
61
43
|
return null;
|
|
62
44
|
return {
|
|
@@ -64,31 +46,76 @@ export function getChannelSetupStatus() {
|
|
|
64
46
|
message: lastSetupStatus.message,
|
|
65
47
|
};
|
|
66
48
|
}
|
|
67
|
-
export function
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
49
|
+
export function getReportableSetupStatus() {
|
|
50
|
+
const recorded = lastSetupStatus;
|
|
51
|
+
if (!recorded)
|
|
52
|
+
return null;
|
|
53
|
+
if (pendingSetup?.seq === recorded.seq)
|
|
54
|
+
return null;
|
|
55
|
+
if (recorded.status === "completed")
|
|
56
|
+
return reportStatus(recorded);
|
|
57
|
+
if (!recorded.reported)
|
|
58
|
+
return reportStatus(recorded);
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
function pendingResult(record) {
|
|
62
|
+
return {
|
|
63
|
+
status: "pending",
|
|
64
|
+
handoffUrl: record.session.handoffUrl,
|
|
65
|
+
expiresAt: record.session.expiresAt,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function reportStatus(status) {
|
|
69
|
+
status.reported = true;
|
|
70
|
+
return { status: status.status, message: status.message };
|
|
71
|
+
}
|
|
72
|
+
function storedResult(stored) {
|
|
73
|
+
return stored ? reportStatus(stored) : null;
|
|
73
74
|
}
|
|
74
75
|
function getActivePendingSetup() {
|
|
75
76
|
if (!pendingSetup)
|
|
76
77
|
return null;
|
|
77
78
|
if (Date.now() < pendingSetup.session.expiresAt)
|
|
78
79
|
return pendingSetup;
|
|
79
|
-
|
|
80
|
-
status: "expired",
|
|
81
|
-
message: "The previous setup link expired before the browser handoff completed.",
|
|
82
|
-
finishedAt: Date.now(),
|
|
83
|
-
};
|
|
80
|
+
const lapsed = pendingSetup;
|
|
84
81
|
pendingSetup = null;
|
|
82
|
+
recordSetupStatus(lapsed, "expired", GENERIC_EXPIRY_MESSAGE, false);
|
|
85
83
|
return null;
|
|
86
84
|
}
|
|
87
|
-
async function
|
|
85
|
+
async function collectActiveSetup(record) {
|
|
86
|
+
let collection;
|
|
87
|
+
try {
|
|
88
|
+
collection = await collectBridgeHandoffOnce(record.session);
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
dbg("owner-invoked collection could not reach the bridge: %O", err);
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
switch (collection.outcome) {
|
|
95
|
+
case "delivered":
|
|
96
|
+
return storedResult(await acceptCollectedHandoff(record, collection.handoff));
|
|
97
|
+
case "spoiled":
|
|
98
|
+
return storedResult(settle(record, isExpiryError(collection.error) ? "expired" : "failed", collection.error.message));
|
|
99
|
+
case "gone":
|
|
100
|
+
return storedResult(collectGoneSession(record));
|
|
101
|
+
default:
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function collectGoneSession(record) {
|
|
106
|
+
if (!record.collected)
|
|
107
|
+
return settle(record, "expired", GONE_MESSAGE);
|
|
108
|
+
const settled = lastSetupStatus;
|
|
109
|
+
if (settled?.seq === record.seq && settled.settled)
|
|
110
|
+
return settled;
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
async function acceptCollectedHandoff(record, handoff) {
|
|
114
|
+
record.collected = true;
|
|
115
|
+
if (pendingSetup !== record) {
|
|
116
|
+
return recordSetupStatus(record, "failed", SUPERSEDED_MESSAGE, true);
|
|
117
|
+
}
|
|
88
118
|
try {
|
|
89
|
-
const handoff = await completeBridgeHandoff(record.session);
|
|
90
|
-
if (pendingSetup !== record)
|
|
91
|
-
return;
|
|
92
119
|
const receipt = await acceptBridgeHandoff({
|
|
93
120
|
handoff,
|
|
94
121
|
apiHost: record.apiHost,
|
|
@@ -97,31 +124,74 @@ async function completePendingSetup(record) {
|
|
|
97
124
|
pendingTarget: record.invitedBy,
|
|
98
125
|
expiresAt: record.session.expiresAt,
|
|
99
126
|
});
|
|
100
|
-
|
|
101
|
-
status: "completed",
|
|
102
|
-
message: receipt,
|
|
103
|
-
finishedAt: Date.now(),
|
|
104
|
-
};
|
|
127
|
+
return settle(record, "completed", receipt);
|
|
105
128
|
}
|
|
106
129
|
catch (err) {
|
|
107
|
-
|
|
108
|
-
return;
|
|
109
|
-
lastSetupStatus = {
|
|
110
|
-
status: isExpiryError(err) ? "expired" : "failed",
|
|
111
|
-
message: safeSetupErrorMessage(err),
|
|
112
|
-
finishedAt: Date.now(),
|
|
113
|
-
};
|
|
130
|
+
return settle(record, isExpiryError(err) ? "expired" : "failed", safeSetupErrorMessage(err));
|
|
114
131
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
132
|
+
}
|
|
133
|
+
function settle(record, status, message) {
|
|
134
|
+
if (pendingSetup === record)
|
|
135
|
+
pendingSetup = null;
|
|
136
|
+
return recordSetupStatus(record, status, message, true);
|
|
137
|
+
}
|
|
138
|
+
async function startNewSession(options) {
|
|
139
|
+
const existingConnectorUrl = await readExistingConnectorUrl();
|
|
140
|
+
const connectorUrl = resolveConnectorUrlForSetup({
|
|
141
|
+
apiHost: options.apiHost,
|
|
142
|
+
existingConnectorUrl,
|
|
143
|
+
configuredConnectorUrl: options.connectorUrl,
|
|
144
|
+
});
|
|
145
|
+
const session = await beginBridgeHandoff({
|
|
146
|
+
apiHost: options.apiHost,
|
|
147
|
+
idpBaseUrl: options.idpBaseUrl,
|
|
148
|
+
idpBaseUrlIsDefault: options.idpBaseUrlIsDefault,
|
|
149
|
+
});
|
|
150
|
+
const record = {
|
|
151
|
+
seq: ++setupSeq,
|
|
152
|
+
session,
|
|
153
|
+
apiHost: options.apiHost,
|
|
154
|
+
connectorUrl,
|
|
155
|
+
idpBaseUrl: options.idpBaseUrl,
|
|
156
|
+
invitedBy: options.invitedBy,
|
|
157
|
+
collected: false,
|
|
158
|
+
};
|
|
159
|
+
pendingSetup = record;
|
|
160
|
+
lastSetupStatus = null;
|
|
161
|
+
void completePendingSetup(record);
|
|
162
|
+
return pendingResult(record);
|
|
163
|
+
}
|
|
164
|
+
async function completePendingSetup(record) {
|
|
165
|
+
let handoff;
|
|
166
|
+
try {
|
|
167
|
+
handoff = await completeBridgeHandoff(record.session);
|
|
119
168
|
}
|
|
169
|
+
catch (err) {
|
|
170
|
+
recordSetupStatus(record, isExpiryError(err) ? "expired" : "failed", safeSetupErrorMessage(err), false);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
await acceptCollectedHandoff(record, handoff);
|
|
120
174
|
}
|
|
121
|
-
function
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
175
|
+
function recordSetupStatus(record, status, message, settled) {
|
|
176
|
+
const next = {
|
|
177
|
+
seq: record.seq,
|
|
178
|
+
status,
|
|
179
|
+
message,
|
|
180
|
+
reported: false,
|
|
181
|
+
settled,
|
|
182
|
+
};
|
|
183
|
+
if (!canRecord(next))
|
|
184
|
+
return null;
|
|
185
|
+
lastSetupStatus = next;
|
|
186
|
+
lastRecordedSeq = next.seq;
|
|
187
|
+
return next;
|
|
188
|
+
}
|
|
189
|
+
function canRecord(next) {
|
|
190
|
+
if (next.seq !== lastRecordedSeq)
|
|
191
|
+
return next.seq > lastRecordedSeq;
|
|
192
|
+
if (!lastSetupStatus)
|
|
193
|
+
return false;
|
|
194
|
+
return next.settled && !lastSetupStatus.settled;
|
|
125
195
|
}
|
|
126
196
|
function isExpiryError(err) {
|
|
127
197
|
if (!(err instanceof SetupFlowError))
|
|
@@ -131,11 +201,12 @@ function isExpiryError(err) {
|
|
|
131
201
|
function safeSetupErrorMessage(err) {
|
|
132
202
|
if (err instanceof SetupFlowError)
|
|
133
203
|
return err.message;
|
|
134
|
-
dbg("
|
|
135
|
-
return "
|
|
204
|
+
dbg("link failed with an unexpected error: %O", err);
|
|
205
|
+
return "Link failed for an unexpected reason; check debug logs.";
|
|
136
206
|
}
|
|
137
207
|
export function _resetChannelSetupForTesting() {
|
|
138
208
|
pendingSetup = null;
|
|
139
209
|
lastSetupStatus = null;
|
|
210
|
+
lastRecordedSeq = 0;
|
|
140
211
|
}
|
|
141
212
|
export const CHANNEL_SETUP_TTL_MS = HANDOFF_TIMEOUT_MS;
|
package/dist/cli-setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-setup.d.ts","sourceRoot":"","sources":["../src/cli-setup.ts"],"names":[],"mappings":"AA8FA,UAAU,eAAe;IACvB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAOD,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"cli-setup.d.ts","sourceRoot":"","sources":["../src/cli-setup.ts"],"names":[],"mappings":"AA8FA,UAAU,eAAe;IACvB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAOD,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAqFD,wBAAsB,KAAK,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+EhE"}
|
package/dist/cli-setup.js
CHANGED
|
@@ -3,14 +3,15 @@ import { ConnectorUrlConfigurationError, resolveConnectorUrlForSetup, } from "./
|
|
|
3
3
|
import { beginBridgeHandoff, completeBridgeHandoff, DEFAULT_IDP_BASE_URL, SetupFlowError, } from "./handoff.js";
|
|
4
4
|
import { acceptBridgeHandoff } from "./handoff-acceptance.js";
|
|
5
5
|
import { DEFAULT_API_HOST, DEFAULT_CONNECTOR_URL, PlatformApiError, } from "./platform-client.js";
|
|
6
|
-
async function serverBridgeHandoffFlow(apiHost, idpBaseUrl, runtime) {
|
|
6
|
+
async function serverBridgeHandoffFlow(apiHost, idpBaseUrl, idpBaseUrlIsDefault, runtime) {
|
|
7
7
|
const session = await beginBridgeHandoff({
|
|
8
8
|
apiHost,
|
|
9
9
|
idpBaseUrl,
|
|
10
|
+
idpBaseUrlIsDefault,
|
|
10
11
|
});
|
|
11
12
|
runtime.writeStdout([
|
|
12
13
|
"",
|
|
13
|
-
"Open this link in your browser to
|
|
14
|
+
"Open this link in your browser to complete the Link:",
|
|
14
15
|
` ${session.handoffUrl}`,
|
|
15
16
|
"",
|
|
16
17
|
"Waiting for the runtime key to be issued and delivered…",
|
|
@@ -23,12 +24,11 @@ async function serverBridgeHandoffFlow(apiHost, idpBaseUrl, runtime) {
|
|
|
23
24
|
}
|
|
24
25
|
export async function login(ctx) {
|
|
25
26
|
const apiHost = typeof ctx.cfg.apiHost === "string" ? ctx.cfg.apiHost : DEFAULT_API_HOST;
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
: DEFAULT_IDP_BASE_URL;
|
|
27
|
+
const configuredIdpBaseUrl = typeof ctx.cfg.idpBaseUrl === "string" ? ctx.cfg.idpBaseUrl : undefined;
|
|
28
|
+
const idpBaseUrl = configuredIdpBaseUrl ?? DEFAULT_IDP_BASE_URL;
|
|
29
29
|
let completed;
|
|
30
30
|
try {
|
|
31
|
-
completed = await serverBridgeHandoffFlow(apiHost, idpBaseUrl, ctx.runtime);
|
|
31
|
+
completed = await serverBridgeHandoffFlow(apiHost, idpBaseUrl, configuredIdpBaseUrl === undefined, ctx.runtime);
|
|
32
32
|
}
|
|
33
33
|
catch (err) {
|
|
34
34
|
if (err instanceof SetupFlowError) {
|
|
@@ -36,7 +36,7 @@ export async function login(ctx) {
|
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
if (err instanceof PlatformApiError) {
|
|
39
|
-
ctx.runtime.error(`
|
|
39
|
+
ctx.runtime.error(`Link failed (HTTP ${err.status} ${err.code}): ${err.message}`);
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
throw err;
|
package/dist/config.js
CHANGED
|
@@ -104,7 +104,7 @@ export function requirePlatformConfig() {
|
|
|
104
104
|
}
|
|
105
105
|
export function requireApiKey() {
|
|
106
106
|
if (!storedApiKey) {
|
|
107
|
-
throw new Error("No runtime key configured. Complete
|
|
107
|
+
throw new Error("No runtime key configured. Complete Link first.");
|
|
108
108
|
}
|
|
109
109
|
return storedApiKey;
|
|
110
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector-client.d.ts","sourceRoot":"","sources":["../src/connector-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,OAAO,EAEL,KAAK,qBAAqB,EAI1B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAEzB,KAAK,mBAAmB,EAUxB,KAAK,oBAAoB,EAMzB,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AA0B3B,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;gBACT,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM;CAMvD;AAED,MAAM,MAAM,wBAAwB,GAAG,aAAa,GAAG,mBAAmB,CAAC;AAM3E,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,EAAG,sBAAsB,CAAU;IAChD,QAAQ,CAAC,SAAS,EAAG,KAAK,CAAU;IACpC,QAAQ,CAAC,QA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AsB;IAO9B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,mBAAmB;CAW5B"}
|
package/dist/connector-client.js
CHANGED
|
@@ -476,8 +476,10 @@ export class ConnectorClient extends EventEmitter {
|
|
|
476
476
|
this.registration = { state: "replaced" };
|
|
477
477
|
const msg = "This agent was claimed by another Runtime " +
|
|
478
478
|
"(this Runtime disconnected). " +
|
|
479
|
-
"
|
|
480
|
-
"
|
|
479
|
+
"To drive this agent from here again, ask the owner to call " +
|
|
480
|
+
"masons_link with start_over: true in this conversation; as a last " +
|
|
481
|
+
"resort, `openclaw channels login --channel agent-network` in a " +
|
|
482
|
+
"terminal does the same.";
|
|
481
483
|
this.emit("error", new Error(msg));
|
|
482
484
|
if (wasRegistering) {
|
|
483
485
|
this.rejectRegister(new Error(msg));
|
|
@@ -32,20 +32,20 @@ async function refreshCanonicalNode(options) {
|
|
|
32
32
|
throw acceptanceFailure(err, options.apiHost);
|
|
33
33
|
}
|
|
34
34
|
if (node === null) {
|
|
35
|
-
throw new SetupFlowError(`The delivered runtime key is valid, but the network reports no active Node for it to represent, so it was not accepted. ${NOTHING_CHANGED} Choose or create an Agent Node in the console, then re-run
|
|
35
|
+
throw new SetupFlowError(`The delivered runtime key is valid, but the network reports no active Node for it to represent, so it was not accepted. ${NOTHING_CHANGED} Choose or create an Agent Node in the console, then re-run Link.`);
|
|
36
36
|
}
|
|
37
37
|
return node;
|
|
38
38
|
}
|
|
39
39
|
function acceptanceFailure(err, apiHost) {
|
|
40
40
|
switch (classifyIdentityError(err)) {
|
|
41
41
|
case "credential-refused":
|
|
42
|
-
return new SetupFlowError(`The network rejected the runtime key delivered by the browser${httpStatusSuffix(err)}, so it was not accepted. That is a credential-class refusal — retrying will not change it. ${NOTHING_CHANGED} Re-run
|
|
42
|
+
return new SetupFlowError(`The network rejected the runtime key delivered by the browser${httpStatusSuffix(err)}, so it was not accepted. That is a credential-class refusal — retrying will not change it. ${NOTHING_CHANGED} Re-run Link to authorize a new runtime key.`);
|
|
43
43
|
case "entity-missing":
|
|
44
|
-
return new SetupFlowError(`The delivered runtime key authenticates, but the Node it represents has no backing entity on the network — it is missing or deleted — so it was not accepted. ${NOTHING_CHANGED} Choose or create an Agent Node in the console, then re-run
|
|
44
|
+
return new SetupFlowError(`The delivered runtime key authenticates, but the Node it represents has no backing entity on the network — it is missing or deleted — so it was not accepted. ${NOTHING_CHANGED} Choose or create an Agent Node in the console, then re-run Link.`);
|
|
45
45
|
case "endpoint-absent":
|
|
46
|
-
return new SetupFlowError(`This MASONS Services deployment does not serve the identity endpoint (HTTP 404 for GET /v1/me/identity at ${apiHost}), so the delivered runtime key could not be verified and was not accepted. That is a property of this host — an older or self-hosted apps/api — not an expired link. ${NOTHING_CHANGED} Point
|
|
46
|
+
return new SetupFlowError(`This MASONS Services deployment does not serve the identity endpoint (HTTP 404 for GET /v1/me/identity at ${apiHost}), so the delivered runtime key could not be verified and was not accepted. That is a property of this host — an older or self-hosted apps/api — not an expired link. ${NOTHING_CHANGED} Point Link at a Services deployment that serves the identity endpoint, or upgrade this one, then re-run Link.`);
|
|
47
47
|
case "unavailable":
|
|
48
|
-
return new SetupFlowError(`The network could not confirm which Node the delivered runtime key represents (${unavailableDetail(err)}), so it was not accepted. ${NOTHING_CHANGED} Re-run
|
|
48
|
+
return new SetupFlowError(`The network could not confirm which Node the delivered runtime key represents (${unavailableDetail(err)}), so it was not accepted. ${NOTHING_CHANGED} Re-run Link to try again.`);
|
|
49
49
|
default:
|
|
50
50
|
return err;
|
|
51
51
|
}
|
package/dist/handoff-deadline.js
CHANGED
|
@@ -2,6 +2,6 @@ export class SetupFlowError extends Error {
|
|
|
2
2
|
}
|
|
3
3
|
export function assertHandoffDeadlineActive(expiresAt) {
|
|
4
4
|
if (Date.now() >= expiresAt) {
|
|
5
|
-
throw new SetupFlowError("Handoff session expired before the runtime key was delivered. Re-run
|
|
5
|
+
throw new SetupFlowError("Handoff session expired before the runtime key was delivered. Re-run Link.");
|
|
6
6
|
}
|
|
7
7
|
}
|
package/dist/handoff.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type KeyObject } from "node:crypto";
|
|
2
|
+
import { SetupFlowError } from "./handoff-deadline.js";
|
|
2
3
|
export { SetupFlowError } from "./handoff-deadline.js";
|
|
3
4
|
export declare const DEFAULT_IDP_BASE_URL = "https://preview.masons.ai";
|
|
4
5
|
export declare const HANDOFF_TIMEOUT_MS: number;
|
|
@@ -20,7 +21,20 @@ export interface BridgeHandoffSession {
|
|
|
20
21
|
export interface BeginBridgeHandoffOptions {
|
|
21
22
|
apiHost: string;
|
|
22
23
|
idpBaseUrl: string;
|
|
24
|
+
idpBaseUrlIsDefault?: boolean;
|
|
23
25
|
}
|
|
24
26
|
export declare function beginBridgeHandoff(options: BeginBridgeHandoffOptions): Promise<BridgeHandoffSession>;
|
|
25
27
|
export declare function completeBridgeHandoff(session: BridgeHandoffSession): Promise<BridgeHandoffResult>;
|
|
28
|
+
export type BridgeCollection = {
|
|
29
|
+
outcome: "pending";
|
|
30
|
+
} | {
|
|
31
|
+
outcome: "gone";
|
|
32
|
+
} | {
|
|
33
|
+
outcome: "delivered";
|
|
34
|
+
handoff: BridgeHandoffResult;
|
|
35
|
+
} | {
|
|
36
|
+
outcome: "spoiled";
|
|
37
|
+
error: SetupFlowError;
|
|
38
|
+
};
|
|
39
|
+
export declare function collectBridgeHandoffOnce(session: BridgeHandoffSession): Promise<BridgeCollection>;
|
|
26
40
|
//# sourceMappingURL=handoff.d.ts.map
|
package/dist/handoff.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../src/handoff.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,SAAS,EAEf,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../src/handoff.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