@agentvault/agentvault 0.13.4 → 0.13.6
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/__tests__/install-plugin.test.d.ts +2 -0
- package/dist/__tests__/install-plugin.test.d.ts.map +1 -0
- package/dist/account-config.d.ts +1 -0
- package/dist/account-config.d.ts.map +1 -1
- package/dist/channel.d.ts +0 -9
- package/dist/channel.d.ts.map +1 -1
- package/dist/cli.js +81 -98
- package/dist/cli.js.map +2 -2
- package/dist/gateway-send.d.ts +0 -14
- package/dist/gateway-send.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +87 -101
- package/dist/index.js.map +2 -2
- package/dist/openclaw-entry.d.ts.map +1 -1
- package/dist/openclaw-entry.js +37 -228
- package/dist/openclaw-entry.js.map +3 -3
- package/package.json +1 -1
- package/dist/channel.js +0 -2257
- package/dist/channel.js.map +0 -1
- package/dist/crypto-helpers.js +0 -4
- package/dist/crypto-helpers.js.map +0 -1
- package/dist/fetch-interceptor.d.ts +0 -32
- package/dist/fetch-interceptor.d.ts.map +0 -1
- package/dist/openclaw-plugin.js +0 -222
- package/dist/openclaw-plugin.js.map +0 -1
- package/dist/setup.js +0 -329
- package/dist/setup.js.map +0 -1
- package/dist/state.js +0 -61
- package/dist/state.js.map +0 -1
- package/dist/transport.js +0 -43
- package/dist/transport.js.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
package/dist/gateway-send.d.ts
CHANGED
|
@@ -29,20 +29,6 @@ export interface GatewayStatusResult {
|
|
|
29
29
|
* Never throws — returns `{ ok: false, error }` on failure.
|
|
30
30
|
*/
|
|
31
31
|
export declare function sendToOwner(text: string, options?: GatewaySendOptions): Promise<GatewaySendResult>;
|
|
32
|
-
export interface ActionReport {
|
|
33
|
-
action: string;
|
|
34
|
-
status: "completed" | "failed" | "partial";
|
|
35
|
-
room_id?: string;
|
|
36
|
-
detail?: string;
|
|
37
|
-
estimated_cost?: number;
|
|
38
|
-
decision_id?: string;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Report an action (deploy, execute, etc.) via the gateway HTTP server.
|
|
42
|
-
* Routes to sendActionConfirmationToRoom() (if room_id) or sendActionConfirmation().
|
|
43
|
-
* Never throws — returns `{ ok: false, error }` on failure.
|
|
44
|
-
*/
|
|
45
|
-
export declare function sendAction(report: ActionReport, options?: GatewaySendOptions): Promise<GatewaySendResult>;
|
|
46
32
|
/**
|
|
47
33
|
* Check gateway health / status.
|
|
48
34
|
* Never throws — returns `{ ok: false, error }` on failure.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-send.d.ts","sourceRoot":"","sources":["../src/gateway-send.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAsBD;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CAuB5B;AAED
|
|
1
|
+
{"version":3,"file":"gateway-send.d.ts","sourceRoot":"","sources":["../src/gateway-send.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAsBD;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CAuB5B;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CAmB9B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { SecureChannelConfig, ChannelState, MessageMetadata, AttachmentData
|
|
|
3
3
|
export { listAccountIds, resolveAccount } from "./account-config.js";
|
|
4
4
|
export type { ResolvedAccount } from "./account-config.js";
|
|
5
5
|
export { agentVaultPlugin, setOcRuntime, getActiveChannel } from "./openclaw-plugin.js";
|
|
6
|
-
export { sendToOwner,
|
|
7
|
-
export type { GatewaySendOptions, GatewaySendResult, GatewayStatusResult,
|
|
8
|
-
export declare const VERSION = "0.
|
|
6
|
+
export { sendToOwner, checkGateway } from "./gateway-send.js";
|
|
7
|
+
export type { GatewaySendOptions, GatewaySendResult, GatewayStatusResult, } from "./gateway-send.js";
|
|
8
|
+
export declare const VERSION = "0.11.0";
|
|
9
9
|
//# 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":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EACV,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,WAAW,EACX,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,UAAU,EACV,UAAU,EACV,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG3D,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxF,OAAO,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EACV,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,WAAW,EACX,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,UAAU,EACV,UAAU,EACV,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG3D,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -45243,6 +45243,69 @@ function buildErrorSpan(opts) {
|
|
|
45243
45243
|
status: { code: 2, message: opts.errorMessage }
|
|
45244
45244
|
};
|
|
45245
45245
|
}
|
|
45246
|
+
function buildHttpSpan(opts) {
|
|
45247
|
+
const now = Date.now();
|
|
45248
|
+
const attributes = {
|
|
45249
|
+
"ai.agent.http.method": opts.method,
|
|
45250
|
+
"ai.agent.http.url": opts.url,
|
|
45251
|
+
"ai.agent.http.status_code": opts.statusCode,
|
|
45252
|
+
"ai.agent.http.latency_ms": opts.latencyMs
|
|
45253
|
+
};
|
|
45254
|
+
const isError = opts.status === "error" || opts.statusCode >= 400;
|
|
45255
|
+
const status = isError ? { code: 2, ...opts.statusMessage ? { message: opts.statusMessage } : {} } : { code: 0 };
|
|
45256
|
+
return {
|
|
45257
|
+
traceId: opts.traceId ?? generateTraceId(),
|
|
45258
|
+
spanId: opts.spanId ?? generateSpanId(),
|
|
45259
|
+
parentSpanId: opts.parentSpanId,
|
|
45260
|
+
name: "http.request",
|
|
45261
|
+
kind: "client",
|
|
45262
|
+
startTime: now - opts.latencyMs,
|
|
45263
|
+
endTime: now,
|
|
45264
|
+
attributes,
|
|
45265
|
+
status
|
|
45266
|
+
};
|
|
45267
|
+
}
|
|
45268
|
+
function buildActionSpan(opts) {
|
|
45269
|
+
const now = Date.now();
|
|
45270
|
+
const attributes = {
|
|
45271
|
+
"ai.agent.action.type": opts.actionType,
|
|
45272
|
+
"ai.agent.action.target": opts.target,
|
|
45273
|
+
"ai.agent.action.latency_ms": opts.latencyMs,
|
|
45274
|
+
"ai.agent.action.success": opts.success
|
|
45275
|
+
};
|
|
45276
|
+
const status = opts.success ? { code: 0 } : { code: 2, ...opts.statusMessage ? { message: opts.statusMessage } : {} };
|
|
45277
|
+
return {
|
|
45278
|
+
traceId: opts.traceId ?? generateTraceId(),
|
|
45279
|
+
spanId: opts.spanId ?? generateSpanId(),
|
|
45280
|
+
parentSpanId: opts.parentSpanId,
|
|
45281
|
+
name: "action.execute",
|
|
45282
|
+
kind: "internal",
|
|
45283
|
+
startTime: now - opts.latencyMs,
|
|
45284
|
+
endTime: now,
|
|
45285
|
+
attributes,
|
|
45286
|
+
status
|
|
45287
|
+
};
|
|
45288
|
+
}
|
|
45289
|
+
function buildNavSpan(opts) {
|
|
45290
|
+
const now = Date.now();
|
|
45291
|
+
const attributes = {
|
|
45292
|
+
"ai.agent.nav.to_url": opts.toUrl,
|
|
45293
|
+
"ai.agent.nav.latency_ms": opts.latencyMs
|
|
45294
|
+
};
|
|
45295
|
+
const isError = opts.status === "error";
|
|
45296
|
+
const status = isError ? { code: 2, ...opts.statusMessage ? { message: opts.statusMessage } : {} } : { code: 0 };
|
|
45297
|
+
return {
|
|
45298
|
+
traceId: opts.traceId ?? generateTraceId(),
|
|
45299
|
+
spanId: opts.spanId ?? generateSpanId(),
|
|
45300
|
+
parentSpanId: opts.parentSpanId,
|
|
45301
|
+
name: "nav.navigate",
|
|
45302
|
+
kind: "internal",
|
|
45303
|
+
startTime: now - opts.latencyMs,
|
|
45304
|
+
endTime: now,
|
|
45305
|
+
attributes,
|
|
45306
|
+
status
|
|
45307
|
+
};
|
|
45308
|
+
}
|
|
45246
45309
|
|
|
45247
45310
|
// ../crypto/dist/telemetry-reporter.js
|
|
45248
45311
|
function toOtlpAttributes(attrs) {
|
|
@@ -45310,6 +45373,18 @@ var TelemetryReporter = class {
|
|
|
45310
45373
|
reportError(opts) {
|
|
45311
45374
|
this._buffer.push(buildErrorSpan(opts));
|
|
45312
45375
|
}
|
|
45376
|
+
/** Record an HTTP request call. */
|
|
45377
|
+
reportHttpCall(opts) {
|
|
45378
|
+
this._buffer.push(buildHttpSpan(opts));
|
|
45379
|
+
}
|
|
45380
|
+
/** Record an action execution. */
|
|
45381
|
+
reportActionCall(opts) {
|
|
45382
|
+
this._buffer.push(buildActionSpan(opts));
|
|
45383
|
+
}
|
|
45384
|
+
/** Record a navigation event. */
|
|
45385
|
+
reportNavCall(opts) {
|
|
45386
|
+
this._buffer.push(buildNavSpan(opts));
|
|
45387
|
+
}
|
|
45313
45388
|
/** Record an arbitrary pre-built span. */
|
|
45314
45389
|
reportCustomSpan(span) {
|
|
45315
45390
|
this._buffer.push(span);
|
|
@@ -45923,9 +45998,7 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
45923
45998
|
data: {
|
|
45924
45999
|
room_id: roomId,
|
|
45925
46000
|
recipients,
|
|
45926
|
-
message_type: messageType
|
|
45927
|
-
priority: opts?.priority ?? "normal",
|
|
45928
|
-
metadata: opts?.metadata
|
|
46001
|
+
message_type: messageType
|
|
45929
46002
|
}
|
|
45930
46003
|
})
|
|
45931
46004
|
);
|
|
@@ -45939,12 +46012,7 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
45939
46012
|
"Content-Type": "application/json",
|
|
45940
46013
|
Authorization: `Bearer ${this._deviceJwt}`
|
|
45941
46014
|
},
|
|
45942
|
-
body: JSON.stringify({
|
|
45943
|
-
recipients,
|
|
45944
|
-
message_type: messageType,
|
|
45945
|
-
priority: opts?.priority ?? "normal",
|
|
45946
|
-
metadata: opts?.metadata
|
|
45947
|
-
})
|
|
46015
|
+
body: JSON.stringify({ recipients, message_type: messageType })
|
|
45948
46016
|
}
|
|
45949
46017
|
);
|
|
45950
46018
|
if (!res.ok) {
|
|
@@ -46089,27 +46157,6 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
46089
46157
|
}
|
|
46090
46158
|
);
|
|
46091
46159
|
}
|
|
46092
|
-
async sendActionConfirmationToRoom(roomId, confirmation) {
|
|
46093
|
-
const envelope = {
|
|
46094
|
-
type: "action_confirmation",
|
|
46095
|
-
action: confirmation.action,
|
|
46096
|
-
status: confirmation.status
|
|
46097
|
-
};
|
|
46098
|
-
if (confirmation.decisionId !== void 0) envelope.decision_id = confirmation.decisionId;
|
|
46099
|
-
if (confirmation.detail !== void 0) envelope.detail = confirmation.detail;
|
|
46100
|
-
const metadata = {
|
|
46101
|
-
action: confirmation.action,
|
|
46102
|
-
status: confirmation.status
|
|
46103
|
-
};
|
|
46104
|
-
if (confirmation.estimated_cost !== void 0) {
|
|
46105
|
-
metadata.estimated_cost = confirmation.estimated_cost;
|
|
46106
|
-
}
|
|
46107
|
-
await this.sendToRoom(roomId, JSON.stringify(envelope), {
|
|
46108
|
-
messageType: "action_confirmation",
|
|
46109
|
-
priority: "high",
|
|
46110
|
-
metadata
|
|
46111
|
-
});
|
|
46112
|
-
}
|
|
46113
46160
|
_sendHeartbeat() {
|
|
46114
46161
|
if (this._state !== "ready" || !this._heartbeatCallback) return;
|
|
46115
46162
|
const status = this._heartbeatCallback();
|
|
@@ -46184,52 +46231,10 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
46184
46231
|
res.end(JSON.stringify({ ok: false, error: "Missing 'text' field" }));
|
|
46185
46232
|
return;
|
|
46186
46233
|
}
|
|
46187
|
-
if (parsed.
|
|
46188
|
-
await this.sendToRoom(parsed.room_id, text, {
|
|
46189
|
-
messageType: parsed.message_type,
|
|
46190
|
-
priority: parsed.priority,
|
|
46191
|
-
metadata: parsed.metadata
|
|
46192
|
-
});
|
|
46193
|
-
} else if (parsed.file_path && typeof parsed.file_path === "string") {
|
|
46234
|
+
if (parsed.file_path && typeof parsed.file_path === "string") {
|
|
46194
46235
|
await this.sendWithAttachment(text, parsed.file_path, { topicId: parsed.topicId });
|
|
46195
46236
|
} else {
|
|
46196
|
-
await this.send(text, {
|
|
46197
|
-
topicId: parsed.topicId,
|
|
46198
|
-
messageType: parsed.message_type,
|
|
46199
|
-
metadata: parsed.metadata
|
|
46200
|
-
});
|
|
46201
|
-
}
|
|
46202
|
-
res.writeHead(200, { "Content-Type": "application/json" });
|
|
46203
|
-
res.end(JSON.stringify({ ok: true }));
|
|
46204
|
-
} catch (err) {
|
|
46205
|
-
res.writeHead(500, { "Content-Type": "application/json" });
|
|
46206
|
-
res.end(JSON.stringify({ ok: false, error: String(err) }));
|
|
46207
|
-
}
|
|
46208
|
-
});
|
|
46209
|
-
} else if (req.method === "POST" && req.url === "/action") {
|
|
46210
|
-
let body = "";
|
|
46211
|
-
req.on("data", (chunk) => {
|
|
46212
|
-
body += chunk.toString();
|
|
46213
|
-
});
|
|
46214
|
-
req.on("end", async () => {
|
|
46215
|
-
try {
|
|
46216
|
-
const parsed = JSON.parse(body);
|
|
46217
|
-
if (!parsed.action || typeof parsed.action !== "string") {
|
|
46218
|
-
res.writeHead(400, { "Content-Type": "application/json" });
|
|
46219
|
-
res.end(JSON.stringify({ ok: false, error: "Missing 'action' field" }));
|
|
46220
|
-
return;
|
|
46221
|
-
}
|
|
46222
|
-
const confirmation = {
|
|
46223
|
-
action: parsed.action,
|
|
46224
|
-
status: parsed.status ?? "completed",
|
|
46225
|
-
decisionId: parsed.decision_id,
|
|
46226
|
-
detail: parsed.detail,
|
|
46227
|
-
estimated_cost: parsed.estimated_cost
|
|
46228
|
-
};
|
|
46229
|
-
if (parsed.room_id && typeof parsed.room_id === "string") {
|
|
46230
|
-
await this.sendActionConfirmationToRoom(parsed.room_id, confirmation);
|
|
46231
|
-
} else {
|
|
46232
|
-
await this.sendActionConfirmation(confirmation);
|
|
46237
|
+
await this.send(text, { topicId: parsed.topicId });
|
|
46233
46238
|
}
|
|
46234
46239
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
46235
46240
|
res.end(JSON.stringify({ ok: true }));
|
|
@@ -46248,7 +46253,7 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
46248
46253
|
}));
|
|
46249
46254
|
} else {
|
|
46250
46255
|
res.writeHead(404, { "Content-Type": "application/json" });
|
|
46251
|
-
res.end(JSON.stringify({ ok: false, error: "Not found. Use POST /send
|
|
46256
|
+
res.end(JSON.stringify({ ok: false, error: "Not found. Use POST /send or GET /status" }));
|
|
46252
46257
|
}
|
|
46253
46258
|
});
|
|
46254
46259
|
this._httpServer.listen(port, "127.0.0.1", () => {
|
|
@@ -48009,7 +48014,8 @@ function resolveAccount(cfg, accountId) {
|
|
|
48009
48014
|
apiUrl: av.apiUrl ?? DEFAULT_API_URL,
|
|
48010
48015
|
agentName: id,
|
|
48011
48016
|
httpPort: DEFAULT_HTTP_PORT,
|
|
48012
|
-
configured: false
|
|
48017
|
+
configured: false,
|
|
48018
|
+
inviteToken: ""
|
|
48013
48019
|
};
|
|
48014
48020
|
}
|
|
48015
48021
|
let httpPort = acct.httpPort;
|
|
@@ -48024,7 +48030,8 @@ function resolveAccount(cfg, accountId) {
|
|
|
48024
48030
|
apiUrl: acct.apiUrl ?? av.apiUrl ?? DEFAULT_API_URL,
|
|
48025
48031
|
agentName: acct.agentName ?? id,
|
|
48026
48032
|
httpPort,
|
|
48027
|
-
configured: Boolean(acct.dataDir)
|
|
48033
|
+
configured: Boolean(acct.dataDir),
|
|
48034
|
+
inviteToken: acct.inviteToken ?? ""
|
|
48028
48035
|
};
|
|
48029
48036
|
}
|
|
48030
48037
|
return {
|
|
@@ -48033,7 +48040,8 @@ function resolveAccount(cfg, accountId) {
|
|
|
48033
48040
|
apiUrl: av.apiUrl ?? DEFAULT_API_URL,
|
|
48034
48041
|
agentName: av.agentName ?? "OpenClaw Agent",
|
|
48035
48042
|
httpPort: av.httpPort ?? DEFAULT_HTTP_PORT,
|
|
48036
|
-
configured: Boolean(av.dataDir)
|
|
48043
|
+
configured: Boolean(av.dataDir),
|
|
48044
|
+
inviteToken: av.inviteToken ?? ""
|
|
48037
48045
|
};
|
|
48038
48046
|
}
|
|
48039
48047
|
|
|
@@ -48255,27 +48263,6 @@ async function sendToOwner(text, options) {
|
|
|
48255
48263
|
return { ok: false, error: friendlyError(err) };
|
|
48256
48264
|
}
|
|
48257
48265
|
}
|
|
48258
|
-
async function sendAction(report, options) {
|
|
48259
|
-
if (typeof report.action !== "string" || report.action.trim().length === 0) {
|
|
48260
|
-
return { ok: false, error: "Action must be a non-empty string" };
|
|
48261
|
-
}
|
|
48262
|
-
try {
|
|
48263
|
-
const base = resolveBaseUrl(options);
|
|
48264
|
-
const res = await fetch(`${base}/action`, {
|
|
48265
|
-
method: "POST",
|
|
48266
|
-
headers: { "Content-Type": "application/json" },
|
|
48267
|
-
body: JSON.stringify(report),
|
|
48268
|
-
signal: options?.signal
|
|
48269
|
-
});
|
|
48270
|
-
if (!res.ok) {
|
|
48271
|
-
const body = await res.text().catch(() => "");
|
|
48272
|
-
return { ok: false, error: `HTTP ${res.status}${body ? `: ${body}` : ""}` };
|
|
48273
|
-
}
|
|
48274
|
-
return { ok: true };
|
|
48275
|
-
} catch (err) {
|
|
48276
|
-
return { ok: false, error: friendlyError(err) };
|
|
48277
|
-
}
|
|
48278
|
-
}
|
|
48279
48266
|
async function checkGateway(options) {
|
|
48280
48267
|
try {
|
|
48281
48268
|
const base = resolveBaseUrl(options);
|
|
@@ -48296,7 +48283,7 @@ async function checkGateway(options) {
|
|
|
48296
48283
|
}
|
|
48297
48284
|
|
|
48298
48285
|
// src/index.ts
|
|
48299
|
-
var VERSION = "0.
|
|
48286
|
+
var VERSION = "0.11.0";
|
|
48300
48287
|
export {
|
|
48301
48288
|
SecureChannel,
|
|
48302
48289
|
VERSION,
|
|
@@ -48305,7 +48292,6 @@ export {
|
|
|
48305
48292
|
getActiveChannel,
|
|
48306
48293
|
listAccountIds,
|
|
48307
48294
|
resolveAccount,
|
|
48308
|
-
sendAction,
|
|
48309
48295
|
sendToOwner,
|
|
48310
48296
|
setOcRuntime
|
|
48311
48297
|
};
|