@agentvault/agentvault 0.13.1 → 0.13.3
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.d.ts +14 -0
- package/dist/channel.d.ts.map +1 -1
- package/dist/channel.js +2257 -0
- package/dist/channel.js.map +1 -0
- package/dist/cli.js +114 -6
- package/dist/cli.js.map +2 -2
- package/dist/crypto-helpers.js +4 -0
- package/dist/crypto-helpers.js.map +1 -0
- package/dist/fetch-interceptor.d.ts +32 -0
- package/dist/fetch-interceptor.d.ts.map +1 -0
- package/dist/gateway-send.d.ts +14 -0
- 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 +114 -6
- package/dist/index.js.map +2 -2
- package/dist/openclaw-entry.d.ts.map +1 -1
- package/dist/openclaw-entry.js +382 -31
- package/dist/openclaw-entry.js.map +3 -3
- package/dist/openclaw-plugin.js +222 -0
- package/dist/openclaw-plugin.js.map +1 -0
- package/dist/setup.js +329 -0
- package/dist/setup.js.map +1 -0
- package/dist/state.js +61 -0
- package/dist/state.js.map +1 -0
- package/dist/transport.js +43 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +1 -1
- package/dist/__tests__/install-plugin.test.d.ts +0 -2
- package/dist/__tests__/install-plugin.test.d.ts.map +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Re-export transport utilities from shared @agentvault/crypto package.
|
|
2
|
+
// Plugin code continues importing from ./crypto-helpers.js — no import changes needed.
|
|
3
|
+
export { hexToBytes, bytesToHex, base64ToBytes, bytesToBase64, encryptedMessageToTransport, transportToEncryptedMessage, } from "@agentvault/crypto";
|
|
4
|
+
//# sourceMappingURL=crypto-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-helpers.js","sourceRoot":"","sources":["../src/crypto-helpers.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,uFAAuF;AACvF,OAAO,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,2BAA2B,EAC3B,2BAA2B,GAE5B,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface HttpCallReport {
|
|
2
|
+
method: string;
|
|
3
|
+
url: string;
|
|
4
|
+
statusCode: number;
|
|
5
|
+
latencyMs: number;
|
|
6
|
+
traceId?: string;
|
|
7
|
+
parentSpanId?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface TraceContext {
|
|
10
|
+
traceId: string;
|
|
11
|
+
parentSpanId: string;
|
|
12
|
+
}
|
|
13
|
+
export interface FetchInterceptorOptions {
|
|
14
|
+
onHttpCall: (report: HttpCallReport) => void;
|
|
15
|
+
skipPatterns?: RegExp[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Install HTTP interceptor using both undici diagnostics channels and
|
|
19
|
+
* globalThis.fetch monkey-patching. Idempotent.
|
|
20
|
+
*/
|
|
21
|
+
export declare function installFetchInterceptor(opts: FetchInterceptorOptions): void;
|
|
22
|
+
/**
|
|
23
|
+
* Uninstall all interceptors. Safe to call even if not installed.
|
|
24
|
+
*/
|
|
25
|
+
export declare function uninstallFetchInterceptor(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Run an async function with trace context attached via AsyncLocalStorage.
|
|
28
|
+
* Any HTTP calls made within `fn` (via undici or fetch) will include
|
|
29
|
+
* traceId/parentSpanId in their HttpCallReport.
|
|
30
|
+
*/
|
|
31
|
+
export declare function runWithTraceContext<T>(ctx: TraceContext, fn: () => T | Promise<T>): Promise<T>;
|
|
32
|
+
//# sourceMappingURL=fetch-interceptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-interceptor.d.ts","sourceRoot":"","sources":["../src/fetch-interceptor.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AA0CD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,uBAAuB,GAAG,IAAI,CAmK3E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAkBhD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,GAAG,EAAE,YAAY,EACjB,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvB,OAAO,CAAC,CAAC,CAAC,CAEZ"}
|
package/dist/gateway-send.d.ts
CHANGED
|
@@ -29,6 +29,20 @@ 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>;
|
|
32
46
|
/**
|
|
33
47
|
* Check gateway health / status.
|
|
34
48
|
* 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;;;GAGG;AACH,wBAAsB,YAAY,CAChC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CAmB9B"}
|
|
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,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,YAAY,EACpB,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, checkGateway } from "./gateway-send.js";
|
|
7
|
-
export type { GatewaySendOptions, GatewaySendResult, GatewayStatusResult, } from "./gateway-send.js";
|
|
8
|
-
export declare const VERSION = "0.
|
|
6
|
+
export { sendToOwner, sendAction, checkGateway } from "./gateway-send.js";
|
|
7
|
+
export type { GatewaySendOptions, GatewaySendResult, GatewayStatusResult, ActionReport, } from "./gateway-send.js";
|
|
8
|
+
export declare const VERSION = "0.12.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,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
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,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC1E,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,GACb,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -45728,6 +45728,22 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
45728
45728
|
);
|
|
45729
45729
|
}
|
|
45730
45730
|
}
|
|
45731
|
+
/**
|
|
45732
|
+
* Send an activity span to all owner devices via WS.
|
|
45733
|
+
* Ephemeral (unencrypted metadata, like typing), no ratchet advancement.
|
|
45734
|
+
*/
|
|
45735
|
+
sendActivitySpan(spanData) {
|
|
45736
|
+
if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
|
|
45737
|
+
this._ws.send(
|
|
45738
|
+
JSON.stringify({
|
|
45739
|
+
event: "activity_span",
|
|
45740
|
+
data: {
|
|
45741
|
+
...spanData,
|
|
45742
|
+
agent_name: this.config.agentName ?? "Agent"
|
|
45743
|
+
}
|
|
45744
|
+
})
|
|
45745
|
+
);
|
|
45746
|
+
}
|
|
45731
45747
|
/**
|
|
45732
45748
|
* Send a decision request to the owner.
|
|
45733
45749
|
* Builds a structured envelope with decision metadata and sends it
|
|
@@ -45907,7 +45923,9 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
45907
45923
|
data: {
|
|
45908
45924
|
room_id: roomId,
|
|
45909
45925
|
recipients,
|
|
45910
|
-
message_type: messageType
|
|
45926
|
+
message_type: messageType,
|
|
45927
|
+
priority: opts?.priority ?? "normal",
|
|
45928
|
+
metadata: opts?.metadata
|
|
45911
45929
|
}
|
|
45912
45930
|
})
|
|
45913
45931
|
);
|
|
@@ -45921,7 +45939,12 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
45921
45939
|
"Content-Type": "application/json",
|
|
45922
45940
|
Authorization: `Bearer ${this._deviceJwt}`
|
|
45923
45941
|
},
|
|
45924
|
-
body: JSON.stringify({
|
|
45942
|
+
body: JSON.stringify({
|
|
45943
|
+
recipients,
|
|
45944
|
+
message_type: messageType,
|
|
45945
|
+
priority: opts?.priority ?? "normal",
|
|
45946
|
+
metadata: opts?.metadata
|
|
45947
|
+
})
|
|
45925
45948
|
}
|
|
45926
45949
|
);
|
|
45927
45950
|
if (!res.ok) {
|
|
@@ -46066,6 +46089,27 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
46066
46089
|
}
|
|
46067
46090
|
);
|
|
46068
46091
|
}
|
|
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
|
+
}
|
|
46069
46113
|
_sendHeartbeat() {
|
|
46070
46114
|
if (this._state !== "ready" || !this._heartbeatCallback) return;
|
|
46071
46115
|
const status = this._heartbeatCallback();
|
|
@@ -46140,10 +46184,52 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
46140
46184
|
res.end(JSON.stringify({ ok: false, error: "Missing 'text' field" }));
|
|
46141
46185
|
return;
|
|
46142
46186
|
}
|
|
46143
|
-
if (parsed.
|
|
46187
|
+
if (parsed.room_id && typeof parsed.room_id === "string") {
|
|
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") {
|
|
46144
46194
|
await this.sendWithAttachment(text, parsed.file_path, { topicId: parsed.topicId });
|
|
46145
46195
|
} else {
|
|
46146
|
-
await this.send(text, {
|
|
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);
|
|
46147
46233
|
}
|
|
46148
46234
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
46149
46235
|
res.end(JSON.stringify({ ok: true }));
|
|
@@ -46162,7 +46248,7 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
46162
46248
|
}));
|
|
46163
46249
|
} else {
|
|
46164
46250
|
res.writeHead(404, { "Content-Type": "application/json" });
|
|
46165
|
-
res.end(JSON.stringify({ ok: false, error: "Not found. Use POST /send or GET /status" }));
|
|
46251
|
+
res.end(JSON.stringify({ ok: false, error: "Not found. Use POST /send, POST /action, or GET /status" }));
|
|
46166
46252
|
}
|
|
46167
46253
|
});
|
|
46168
46254
|
this._httpServer.listen(port, "127.0.0.1", () => {
|
|
@@ -48169,6 +48255,27 @@ async function sendToOwner(text, options) {
|
|
|
48169
48255
|
return { ok: false, error: friendlyError(err) };
|
|
48170
48256
|
}
|
|
48171
48257
|
}
|
|
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
|
+
}
|
|
48172
48279
|
async function checkGateway(options) {
|
|
48173
48280
|
try {
|
|
48174
48281
|
const base = resolveBaseUrl(options);
|
|
@@ -48189,7 +48296,7 @@ async function checkGateway(options) {
|
|
|
48189
48296
|
}
|
|
48190
48297
|
|
|
48191
48298
|
// src/index.ts
|
|
48192
|
-
var VERSION = "0.
|
|
48299
|
+
var VERSION = "0.12.0";
|
|
48193
48300
|
export {
|
|
48194
48301
|
SecureChannel,
|
|
48195
48302
|
VERSION,
|
|
@@ -48198,6 +48305,7 @@ export {
|
|
|
48198
48305
|
getActiveChannel,
|
|
48199
48306
|
listAccountIds,
|
|
48200
48307
|
resolveAccount,
|
|
48308
|
+
sendAction,
|
|
48201
48309
|
sendToOwner,
|
|
48202
48310
|
setOcRuntime
|
|
48203
48311
|
};
|