@honor-claw/yoyo 2026.6.9-alpha.4 → 2026.6.9-alpha.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.
Files changed (69) hide show
  1. package/dist/capabilities/admin/impl.mjs +17 -4
  2. package/dist/capabilities/admin/index.mjs +1 -0
  3. package/dist/capabilities/node/index.mjs +2 -0
  4. package/dist/capabilities/node/invoke.mjs +39 -0
  5. package/dist/capabilities/node/types.mjs +6 -0
  6. package/dist/cloud-channel/channel.mjs +36 -33
  7. package/dist/cloud-channel/dispatcher/helpers.mjs +19 -0
  8. package/dist/cloud-channel/dispatcher/impl.mjs +72 -0
  9. package/dist/cloud-channel/dispatcher/index.mjs +1 -0
  10. package/dist/cloud-channel/handlers/context/handler.mjs +59 -43
  11. package/dist/cloud-channel/log-summary.mjs +2 -2
  12. package/dist/cloud-channel/transport/index.mjs +3 -1
  13. package/dist/connection/client.mjs +3 -0
  14. package/dist/connection/registry.mjs +4 -0
  15. package/dist/core/services/admin.mjs +18 -0
  16. package/dist/core/services/entry.mjs +7 -0
  17. package/dist/gateway/session/manager.mjs +45 -44
  18. package/dist/index.mjs +7 -6
  19. package/dist/modules/configs/plugin-init.mjs +1 -1
  20. package/dist/tools/index.mjs +6 -4
  21. package/dist/tools/node-invoke/index.mjs +1 -0
  22. package/dist/tools/node-invoke/status-mapper.mjs +23 -0
  23. package/dist/tools/node-invoke/tool.mjs +48 -0
  24. package/dist/tools/nodes-status/mapper.mjs +3 -3
  25. package/openclaw.plugin.json +1 -1
  26. package/package.json +1 -1
  27. package/skills/yoyo-phone-control/SKILL.md +61 -46
  28. package/skills/yoyo-phone-control/references/airplane-mode.md +9 -77
  29. package/skills/yoyo-phone-control/references/app-close.md +260 -333
  30. package/skills/yoyo-phone-control/references/app-open.md +261 -334
  31. package/skills/yoyo-phone-control/references/app-uninstall.md +182 -229
  32. package/skills/yoyo-phone-control/references/audio-record.md +148 -211
  33. package/skills/yoyo-phone-control/references/autoscreen-onnotice.md +133 -196
  34. package/skills/yoyo-phone-control/references/battery.md +177 -252
  35. package/skills/yoyo-phone-control/references/bluetooth.md +272 -338
  36. package/skills/yoyo-phone-control/references/brightness.md +161 -224
  37. package/skills/yoyo-phone-control/references/call-phone.md +142 -187
  38. package/skills/yoyo-phone-control/references/call-search.md +141 -207
  39. package/skills/yoyo-phone-control/references/camera.md +153 -216
  40. package/skills/yoyo-phone-control/references/capture-screenshot.md +137 -211
  41. package/skills/yoyo-phone-control/references/clean-dirty.md +9 -65
  42. package/skills/yoyo-phone-control/references/contact-search.md +163 -240
  43. package/skills/yoyo-phone-control/references/dark-mode.md +137 -200
  44. package/skills/yoyo-phone-control/references/desktop.md +9 -65
  45. package/skills/yoyo-phone-control/references/device-operation.md +166 -226
  46. package/skills/yoyo-phone-control/references/express-logistics-search.md +9 -77
  47. package/skills/yoyo-phone-control/references/eyecomfort.md +163 -226
  48. package/skills/yoyo-phone-control/references/file-upload.md +286 -362
  49. package/skills/yoyo-phone-control/references/flashlight.md +9 -77
  50. package/skills/yoyo-phone-control/references/gui-task-create.md +153 -206
  51. package/skills/yoyo-phone-control/references/gui-task-pause.md +125 -188
  52. package/skills/yoyo-phone-control/references/gui-task-terminate.md +129 -192
  53. package/skills/yoyo-phone-control/references/hotspot.md +113 -183
  54. package/skills/yoyo-phone-control/references/local-search.md +224 -307
  55. package/skills/yoyo-phone-control/references/location-service.md +121 -184
  56. package/skills/yoyo-phone-control/references/message-search.md +309 -375
  57. package/skills/yoyo-phone-control/references/message-send.md +184 -251
  58. package/skills/yoyo-phone-control/references/mobile-data.md +184 -257
  59. package/skills/yoyo-phone-control/references/nfc.md +133 -196
  60. package/skills/yoyo-phone-control/references/no-disturb.md +230 -334
  61. package/skills/yoyo-phone-control/references/quiet-mode.md +160 -237
  62. package/skills/yoyo-phone-control/references/ringing-mode.md +151 -232
  63. package/skills/yoyo-phone-control/references/scan-code.md +9 -65
  64. package/skills/yoyo-phone-control/references/status-bar-show.md +149 -211
  65. package/skills/yoyo-phone-control/references/task-result-query.md +49 -59
  66. package/skills/yoyo-phone-control/references/usb-shared-network.md +136 -198
  67. package/skills/yoyo-phone-control/references/vibration-mode.md +163 -239
  68. package/skills/yoyo-phone-control/references/wlan.md +324 -410
  69. package/dist/cloud-channel/transport/outbound-port.mjs +0 -32
@@ -1,13 +1,13 @@
1
1
  import { clawLogger as e } from "../../utils/claw-logger.mjs";
2
2
  import { AdminClientManager as t } from "./manager.mjs";
3
3
  //#region src/capabilities/admin/impl.ts
4
- var n = e("admin"), r = class {
4
+ var n = e("admin"), r = null, i = class {
5
5
  manager = new t();
6
6
  constructor() {
7
7
  this.manager.init();
8
8
  }
9
- start() {
10
- this.manager.ensureConnected();
9
+ ensureConnected() {
10
+ return this.manager.ensureConnected();
11
11
  }
12
12
  destroy() {
13
13
  this.manager.destroy();
@@ -139,5 +139,18 @@ var n = e("admin"), r = class {
139
139
  }
140
140
  }
141
141
  };
142
+ function a() {
143
+ return r === null && (r = new i()), r;
144
+ }
145
+ function o() {
146
+ return a();
147
+ }
148
+ function s() {
149
+ let e = a().ensureConnected();
150
+ return n.info("admin gateway connection started", { ready: e }), e;
151
+ }
152
+ function c() {
153
+ a().destroy(), n.info("admin gateway connection stopped");
154
+ }
142
155
  //#endregion
143
- export { r as AdminCapabilityImpl };
156
+ export { s as startAdminConnection, c as stopAdminConnection, o as useAdminCapability };
@@ -0,0 +1 @@
1
+ import "./impl.mjs";
@@ -1 +1,3 @@
1
1
  import "./list.mjs";
2
+ import "./invoke.mjs";
3
+ import "./types.mjs";
@@ -0,0 +1,39 @@
1
+ import { clawLogger as e } from "../../utils/claw-logger.mjs";
2
+ import { buildEndpoint as t } from "../../cloud-channel/protocol/target.mjs";
3
+ import { ClawClient as n } from "../../connection/registry.mjs";
4
+ //#region src/capabilities/node/invoke.ts
5
+ var r = e("capabilities/node-invoke");
6
+ async function i(e) {
7
+ let r = {
8
+ to: t("node", e.nodeId),
9
+ msgType: "nodeInvokeRequest",
10
+ data: { node: {
11
+ toolCallId: e.toolCallId,
12
+ nodeId: e.nodeId,
13
+ name: e.name,
14
+ params: e.params
15
+ } }
16
+ };
17
+ return n.request(e.accountId, r, {
18
+ timeoutMs: e.timeoutMs,
19
+ matchResult: a
20
+ });
21
+ }
22
+ function a(e) {
23
+ if (e.payload.msgType !== "nodeInvokeResult") return { matched: !1 };
24
+ let t = e.data?.node;
25
+ return !t || typeof t.runStatus != "number" || !t.nodeId || !t.toolCallId ? (r.warn("nodeInvokeResult missing required fields", { node: t }), {
26
+ matched: !0,
27
+ error: "missing required fields in invoke result"
28
+ }) : {
29
+ matched: !0,
30
+ result: {
31
+ nodeId: t.nodeId,
32
+ toolCallId: t.toolCallId,
33
+ runStatus: t.runStatus,
34
+ result: t.result
35
+ }
36
+ };
37
+ }
38
+ //#endregion
39
+ export { i as invokeNodeTool };
@@ -0,0 +1,6 @@
1
+ //#region src/capabilities/node/types.ts
2
+ var e = /* @__PURE__ */ function(e) {
3
+ return e[e.Processing = 0] = "Processing", e[e.ProcessingAlt = 100] = "ProcessingAlt", e[e.Suspended = 101] = "Suspended", e[e.Success = 200] = "Success", e[e.InternalError = 300] = "InternalError", e[e.CompensationFailed = 400] = "CompensationFailed", e;
4
+ }({});
5
+ //#endregion
6
+ export { e as NodeInvokeRunStatusE };
@@ -1,9 +1,10 @@
1
1
  import { clawLogger as e } from "../utils/claw-logger.mjs";
2
2
  import { buildEndpoint as t } from "./protocol/target.mjs";
3
- import { AdminCapabilityImpl as n } from "../capabilities/admin/impl.mjs";
4
- import { GatewaySessionManager as r } from "../gateway/session/manager.mjs";
5
- import { RecurringTimer as i } from "../utils/recurring-timer.mjs";
6
- import { AuthorizationRefreshManager as a } from "./authorization/refresh-manager.mjs";
3
+ import { GatewaySessionManager as n } from "../gateway/session/manager.mjs";
4
+ import { RecurringTimer as r } from "../utils/recurring-timer.mjs";
5
+ import { AuthorizationRefreshManager as i } from "./authorization/refresh-manager.mjs";
6
+ import { createCloudDispatcher as a } from "./dispatcher/impl.mjs";
7
+ import "./dispatcher/index.mjs";
7
8
  import { registerAuthHandler as o } from "./handlers/auth.mjs";
8
9
  import { registerContextHandler as s } from "./handlers/context/handler.mjs";
9
10
  import "./handlers/context/index.mjs";
@@ -15,101 +16,103 @@ import { V2Adapter as f } from "./protocol/v2-adapter.mjs";
15
16
  import "./protocol/index.mjs";
16
17
  import { CloudSocket as p } from "./transport/cloud-socket.mjs";
17
18
  import { CloudEventBus as m } from "./transport/event-bus.mjs";
18
- import { createOutboundPort as h } from "./transport/outbound-port.mjs";
19
+ import { MessageHandler as h } from "./transport/message-handler.mjs";
19
20
  import "./transport/index.mjs";
20
- import { MessageHandler as g } from "./transport/message-handler.mjs";
21
- import { buildCloudSocketConnectParams as _ } from "./utils.mjs";
21
+ import { buildCloudSocketConnectParams as g } from "./utils.mjs";
22
22
  //#region src/cloud-channel/channel.ts
23
- var v = e("channel"), y = 3e4, b = "v2", x = class {
23
+ var _ = e("channel"), v = 3e4, y = "v2", b = class {
24
24
  config;
25
25
  cloudSocket;
26
26
  gatewaySessions;
27
- adminCapability = new n();
28
27
  authorizationRefreshManager;
29
28
  messageHandler;
30
29
  adapter;
31
- outbound;
30
+ dispatcher;
32
31
  protocol;
33
- businessPingTimer = new i("recurring");
32
+ businessPingTimer = new r("recurring");
34
33
  constructor(e) {
35
34
  this.config = e;
36
35
  let t = new m();
37
- this.protocol = e.protocol ?? b, this.messageHandler = new g(t), this.adapter = S(this.protocol), this.cloudSocket = new p({
36
+ this.protocol = e.protocol ?? y, this.messageHandler = new h(t), this.adapter = x(this.protocol), this.cloudSocket = new p({
38
37
  connectParamsProvider: this.provideConnectParams,
39
38
  onFrame: this.handleCloudFrame,
40
39
  onOpen: this.handleCloudOpen,
41
40
  onClose: this.handleCloudClose,
42
41
  onError: this.handleSocketError
43
- }), this.outbound = h(this.adapter, this.cloudSocket, e.deviceInfo), this.authorizationRefreshManager = new a({ outbound: this.outbound }), this.gatewaySessions = new r(this.adminCapability, this.outbound), c(this.gatewaySessions, t), l(this.gatewaySessions, t), s(this.adminCapability, this.outbound, t), o(this.authorizationRefreshManager, t);
42
+ }), this.dispatcher = a({
43
+ adapter: this.adapter,
44
+ cloudSocket: this.cloudSocket,
45
+ deviceInfo: e.deviceInfo
46
+ }), this.authorizationRefreshManager = new i({ outbound: this.dispatcher }), this.gatewaySessions = new n(this.dispatcher), c(this.gatewaySessions, t), l(this.gatewaySessions, t), s(this.dispatcher, t), o(this.authorizationRefreshManager, t);
44
47
  }
45
48
  start() {
46
- v.info("starting connection"), this.adminCapability.start(), this.cloudSocket.start();
49
+ _.info("starting connection"), this.cloudSocket.start();
47
50
  }
48
51
  destroy() {
49
- v.info("closing connection"), this.businessPingTimer.stop(), this.authorizationRefreshManager.destroy(), this.gatewaySessions.closeAll(), this.adminCapability.destroy(), this.cloudSocket.stop();
52
+ _.info("closing connection"), this.businessPingTimer.stop(), this.authorizationRefreshManager.destroy(), this.gatewaySessions.closeAll(), this.dispatcher.destroy(), this.cloudSocket.stop();
50
53
  }
51
54
  getOutboundPort() {
52
- return this.outbound;
55
+ return this.dispatcher;
53
56
  }
54
57
  provideConnectParams = async () => {
55
58
  let e = await this.config.credentialProvider();
56
- return e ? _(this.config.deviceInfo, e.token, this.protocol) : null;
59
+ return e ? g(this.config.deviceInfo, e.token, this.protocol) : null;
57
60
  };
58
61
  handleCloudOpen = () => {
59
- v.info("cloud connection established"), this.businessPingTimer.start(this.sendBusinessPing, y), this.authorizationRefreshManager.start(), this.config.onOpen?.();
62
+ _.info("cloud connection established"), this.businessPingTimer.start(this.sendBusinessPing, v), this.authorizationRefreshManager.start(), this.config.onOpen?.();
60
63
  };
61
64
  handleCloudClose = () => {
62
- v.info("cloud connection closed"), this.businessPingTimer.stop(), this.config.onClose?.();
65
+ _.info("cloud connection closed"), this.businessPingTimer.stop(), this.config.onClose?.();
63
66
  };
64
67
  sendBusinessPing = () => {
65
- this.outbound.send({
68
+ this.dispatcher.send({
66
69
  to: t("yoyoclawservice"),
67
70
  msgType: "pingMessage",
68
71
  silent: !0
69
- }) || v.warn("failed to send pingMessage");
72
+ }) || _.warn("failed to send pingMessage");
70
73
  };
71
74
  handleCloudFrame = (e) => {
72
75
  let t;
73
76
  try {
74
77
  t = this.adapter.normalize(e);
75
78
  } catch (e) {
76
- v.error("protocol adapter failed", e);
79
+ _.error("protocol adapter failed", e);
77
80
  return;
78
81
  }
79
82
  switch (t.kind) {
80
83
  case "SUCCESS": {
81
84
  let e = t.serviceEvent;
82
85
  if (e.payload.msgType === "pingMessage") {
83
- v.debug("ignored inbound pingMessage", u(e));
86
+ _.debug("ignored inbound pingMessage", u(e));
84
87
  return;
85
88
  }
86
- v.debug("normalized cloud message", u(e)), this.messageHandler.handleCloudMessage(e);
89
+ _.debug("normalized cloud message", u(e)), this.dispatcher.consume(e), this.messageHandler.handleCloudMessage(e);
87
90
  return;
88
91
  }
89
92
  case "TARGET_OFFLINE":
90
- v.info("remote device offline", { session: t.offlineSocketId }), this.gatewaySessions.closeSession(t.offlineSocketId);
93
+ _.info("remote device offline", { session: t.offlineSocketId }), this.gatewaySessions.closeSession(t.offlineSocketId);
91
94
  return;
92
95
  case "DEVICE_NOT_REGISTERED":
93
- v.info("device not registered, notifying connection layer"), this.config.onError?.({ type: "device-not-registered" });
96
+ _.info("device not registered, notifying connection layer"), this.config.onError?.({ type: "device-not-registered" });
94
97
  return;
95
98
  case "TOKEN_EXPIRED":
96
- v.warn("unauthorized by cloud, pausing refresh"), this.authorizationRefreshManager.pauseForUnauthorized();
99
+ _.warn("unauthorized by cloud, pausing refresh"), this.authorizationRefreshManager.pauseForUnauthorized();
97
100
  return;
98
101
  case "UNEXPECTED":
99
- v.warn("unexpected message", { rawCode: t.rawCode });
102
+ _.warn("unexpected message", { rawCode: t.rawCode });
100
103
  return;
101
104
  case "INVALID":
102
- v.error("failed to parse message", t.error);
105
+ _.error("failed to parse message", t.error);
103
106
  return;
104
- default: v.warn("non-success control code", { kind: t.kind });
107
+ default: _.warn("non-success control code", { kind: t.kind });
105
108
  }
106
109
  };
107
110
  handleSocketError = (e) => {
108
- v.info("cloud socket error, notifying connection layer", { type: e.type }), this.config.onError?.(e);
111
+ _.info("cloud socket error, notifying connection layer", { type: e.type }), this.config.onError?.(e);
109
112
  };
110
113
  };
111
- function S(e) {
114
+ function x(e) {
112
115
  return e === "v1" ? new d() : new f();
113
116
  }
114
117
  //#endregion
115
- export { x as ClawChannel };
118
+ export { b as ClawChannel };
@@ -0,0 +1,19 @@
1
+ //#region src/cloud-channel/dispatcher/helpers.ts
2
+ var e = 3e4, t = 6e5;
3
+ function n(n) {
4
+ return typeof n != "number" || n <= 0 ? e : Math.min(n, t);
5
+ }
6
+ function r(e, t, n, r, i, a) {
7
+ return {
8
+ from: e,
9
+ to: t,
10
+ payload: {
11
+ msgType: n,
12
+ traceInfo: r,
13
+ ...a ? { bizExtInfo: a } : {}
14
+ },
15
+ ...i ? { data: i } : {}
16
+ };
17
+ }
18
+ //#endregion
19
+ export { r as buildServiceEvent, n as resolveTimeoutMs };
@@ -0,0 +1,72 @@
1
+ import { clawLogger as e } from "../../utils/claw-logger.mjs";
2
+ import { buildEndpoint as t } from "../protocol/target.mjs";
3
+ import { uuid as n } from "../../utils/id.mjs";
4
+ import { buildServiceEvent as r, resolveTimeoutMs as i } from "./helpers.mjs";
5
+ //#region src/cloud-channel/dispatcher/impl.ts
6
+ var a = e("dispatcher/outbound");
7
+ function o(e) {
8
+ let { adapter: o, cloudSocket: s, deviceInfo: c } = e, l = /* @__PURE__ */ new Map(), u = t("yoyoclaw", c.deviceId, c.port), d = (e) => {
9
+ let t = e.replyTo, i = !!t, c = i && t ? t.from : e.to;
10
+ if (!c) return a.warn("missing 'to' and no replyTo", { msgType: e.msgType }), !1;
11
+ if (i && t && !t.payload.traceInfo) return a.warn("replyTo missing traceInfo", { msgType: e.msgType }), !1;
12
+ let l = e.traceInfo ?? (i && t ? t.payload.traceInfo : {
13
+ traceId: n(),
14
+ timestamp: Date.now()
15
+ }), d = r(u, c, e.msgType, l, e.data, e.bizExtInfo);
16
+ return s.send(o.serialize(d), e.silent);
17
+ };
18
+ return {
19
+ send: d,
20
+ async request(e, t) {
21
+ let { matchResult: r, timeoutMs: o } = t, s = n(), c = {
22
+ ...e,
23
+ traceInfo: {
24
+ traceId: s,
25
+ timestamp: Date.now()
26
+ }
27
+ };
28
+ return new Promise((e, t) => {
29
+ let n = setTimeout(() => {
30
+ l.has(s) && (l.delete(s), a.warn("request timeout", { traceId: s }), t(/* @__PURE__ */ Error("request timeout")));
31
+ }, i(o));
32
+ l.set(s, {
33
+ timeout: n,
34
+ resolve: e,
35
+ reject: t,
36
+ matchResult: r
37
+ }), d(c) || (l.delete(s), clearTimeout(n), t(/* @__PURE__ */ Error("send failed")));
38
+ });
39
+ },
40
+ consume(e) {
41
+ let t = e.payload.traceInfo?.traceId;
42
+ if (!t) return;
43
+ let n = l.get(t);
44
+ if (n) {
45
+ try {
46
+ let r = n.matchResult(e);
47
+ if (r.matched) {
48
+ if (l.delete(t), clearTimeout(n.timeout), "error" in r) {
49
+ n.reject(r.error);
50
+ return;
51
+ }
52
+ n.resolve(r.result);
53
+ return;
54
+ }
55
+ } catch (e) {
56
+ a.error("match request result failed", e);
57
+ return;
58
+ }
59
+ a.warn("response shape not matched, keep pending", { traceId: t });
60
+ }
61
+ },
62
+ destroy() {
63
+ if (l.size !== 0) {
64
+ a.warn("rejected all pending requests", { count: l.size });
65
+ for (let e of l.values()) clearTimeout(e.timeout), e.reject(/* @__PURE__ */ Error("connection closed"));
66
+ l.clear();
67
+ }
68
+ }
69
+ };
70
+ }
71
+ //#endregion
72
+ export { o as createCloudDispatcher };
@@ -0,0 +1 @@
1
+ import "./impl.mjs";
@@ -1,77 +1,83 @@
1
1
  import { clawLogger as e } from "../../../utils/claw-logger.mjs";
2
- import { createDeviceToolSetUpdateAck as t } from "../../../provisioning/toolset/ack.mjs";
2
+ import { useAdminCapability as t } from "../../../capabilities/admin/impl.mjs";
3
+ import "../../../capabilities/admin/index.mjs";
4
+ import { createDeviceToolSetUpdateAck as n } from "../../../provisioning/toolset/ack.mjs";
3
5
  import "../../../provisioning/toolset/index.mjs";
4
6
  //#region src/cloud-channel/handlers/context/handler.ts
5
- var n = e("context"), r = { style: "SOUL.md" }, i = new Set(["DeviceToolSet", "UniversalToolSet"]);
6
- function a(e, t, n) {
7
- let r = {
8
- adminCapability: e,
9
- outbound: t,
10
- updateHandlers: o(e),
11
- fetchHandlers: s(e)
12
- }, i = (e) => c(e, r);
13
- n.register("fetchContexts", i), n.register("updateContexts", i);
7
+ var r = e("context"), i = {
8
+ style: "SOUL.md",
9
+ soul: "SOUL.md"
10
+ }, a = new Set(["DeviceToolSet", "UniversalToolSet"]);
11
+ function o(e, n) {
12
+ let r = t(), i = {
13
+ adminCapability: r,
14
+ outbound: e,
15
+ updateHandlers: s(r),
16
+ fetchHandlers: c(r)
17
+ }, a = (e) => l(e, i);
18
+ n.register("fetchContexts", a), n.register("updateContexts", a);
14
19
  }
15
- function o(e) {
20
+ function s(e) {
16
21
  return {
17
- style: (t) => e.setAgentFile(r.style, typeof t?.content == "string" ? t.content : ""),
22
+ style: (t) => e.setAgentFile(i.style, typeof t?.content == "string" ? t.content : ""),
23
+ soul: (t) => m(e, t),
18
24
  "model.primary": (t) => e.switchPrimaryModel(typeof t?.provider == "string" ? t.provider : "", typeof t?.id == "string" ? t.id : ""),
19
- DeviceToolSet: p,
20
- UniversalToolSet: p
25
+ DeviceToolSet: h,
26
+ UniversalToolSet: h
21
27
  };
22
28
  }
23
- function s(e) {
29
+ function c(e) {
24
30
  return {
25
31
  skills: () => e.getSkillsStatus(),
26
32
  "models.list": () => e.getModelList()
27
33
  };
28
34
  }
29
- async function c(e, t) {
30
- let { from: r, payload: a } = e, o = a.msgType, s = o === "updateContexts", c = r.deviceId;
31
- n.info("handling context request", {
35
+ async function l(e, t) {
36
+ let { from: n, payload: i } = e, o = i.msgType, s = o === "updateContexts", c = n.deviceId;
37
+ r.info("handling context request", {
32
38
  msgType: o,
33
39
  sourceDeviceId: c
34
40
  });
35
- let p = e.data?.contexts?.[0], m = l(p);
41
+ let l = e.data?.contexts?.[0], m = u(l);
36
42
  if (!m.valid || !m.context) {
37
- u(t.outbound, o, e, p, m.error ?? "Invalid context");
43
+ d(t.outbound, o, e, l, m.error ?? "Invalid context");
38
44
  return;
39
45
  }
40
46
  let h = m.context, g = h.header.name;
41
- s && i.has(g) && (h.payload = {
47
+ s && a.has(g) && (h.payload = {
42
48
  ...h.payload,
43
49
  nodeId: c
44
50
  });
45
51
  try {
46
- let r = s ? t.updateHandlers[g] : t.fetchHandlers[g];
47
- if (!r) {
48
- u(t.outbound, o, e, p, `Unsupported context name: ${g}`);
52
+ let n = s ? t.updateHandlers[g] : t.fetchHandlers[g];
53
+ if (!n) {
54
+ d(t.outbound, o, e, l, `Unsupported context name: ${g}`);
49
55
  return;
50
56
  }
51
- if (f(s, g) && !await t.adminCapability.waitForReady()) {
52
- u(t.outbound, o, e, h, "Admin gateway client not ready");
57
+ if (p(s, g) && !await t.adminCapability.waitForReady()) {
58
+ d(t.outbound, o, e, h, "Admin gateway client not ready");
53
59
  return;
54
60
  }
55
- let i = s ? await r(h.payload, h) : await r();
61
+ let i = s ? await n(h.payload, h) : await n();
56
62
  if (i.noReply) {
57
- n.info(`${s ? "update" : "fetch"} context processed (no reply)`, { contextName: g });
63
+ r.info(`${s ? "update" : "fetch"} context processed (no reply)`, { contextName: g });
58
64
  return;
59
65
  }
60
- i.ok ? (n.info(`${s ? "update" : "fetch"} context successfully`), d(t.outbound, o, e, p, i.responsePayload ?? {
66
+ i.ok ? (r.info(`${s ? "update" : "fetch"} context successfully`), f(t.outbound, o, e, l, i.responsePayload ?? {
61
67
  ok: !0,
62
68
  ...i.data
63
- })) : (n.error(`failed to ${s ? "update" : "fetch"} context`, i.error, { contextName: g }), d(t.outbound, o, e, p, i.responsePayload ?? {
69
+ })) : (r.error(`failed to ${s ? "update" : "fetch"} context`, i.error, { contextName: g }), f(t.outbound, o, e, l, i.responsePayload ?? {
64
70
  ok: !1,
65
71
  error: i.error,
66
72
  ...i.data,
67
73
  ...s && { name: g }
68
74
  }));
69
- } catch (r) {
70
- let i = r instanceof Error ? r.message : String(r);
71
- n.error(`error ${s ? "updating" : "fetching"} context`, r, { contextName: g }), u(t.outbound, o, e, p, i);
75
+ } catch (n) {
76
+ let i = n instanceof Error ? n.message : String(n);
77
+ r.error(`error ${s ? "updating" : "fetching"} context`, n, { contextName: g }), d(t.outbound, o, e, l, i);
72
78
  }
73
79
  }
74
- function l(e) {
80
+ function u(e) {
75
81
  return e?.header?.name ? {
76
82
  valid: !0,
77
83
  context: e
@@ -80,13 +86,13 @@ function l(e) {
80
86
  error: "Missing context name"
81
87
  };
82
88
  }
83
- function u(e, t, r, i, a) {
84
- n.error(a), d(e, t, r, i, {
89
+ function d(e, t, n, i, a) {
90
+ r.error(a), f(e, t, n, i, {
85
91
  ok: !1,
86
92
  error: a
87
93
  });
88
94
  }
89
- function d(e, t, n, r, i) {
95
+ function f(e, t, n, r, i) {
90
96
  let a = [{
91
97
  header: r?.header ?? {
92
98
  name: "unknown",
@@ -100,12 +106,22 @@ function d(e, t, n, r, i) {
100
106
  data: { contexts: a }
101
107
  });
102
108
  }
103
- function f(e, t) {
104
- return !e || !i.has(t);
109
+ function p(e, t) {
110
+ return !e || !a.has(t);
111
+ }
112
+ async function m(e, t) {
113
+ let n = await e.setAgentFile(i.soul, typeof t?.md == "string" ? t.md : ""), r = t?.id;
114
+ return r === void 0 ? n : {
115
+ ...n,
116
+ data: {
117
+ ...n.data,
118
+ id: r
119
+ }
120
+ };
105
121
  }
106
- async function p(e, n) {
107
- let r = await t({
108
- namespace: n?.header.namespace,
122
+ async function h(e, t) {
123
+ let r = await n({
124
+ namespace: t?.header.namespace,
109
125
  payload: e
110
126
  });
111
127
  return {
@@ -115,4 +131,4 @@ async function p(e, n) {
115
131
  };
116
132
  }
117
133
  //#endregion
118
- export { a as registerContextHandler };
134
+ export { o as registerContextHandler };
@@ -13,12 +13,12 @@ function e(e) {
13
13
  }
14
14
  case "nodeInvokeRequest": {
15
15
  let e = n?.node;
16
- e && "name" in e && (i.toolcallId = e.toolcallId, i.nodeId = e.nodeId, i.tool = e.name);
16
+ e && "name" in e && (i.toolCallId = e.toolCallId, i.nodeId = e.nodeId, i.tool = e.name);
17
17
  break;
18
18
  }
19
19
  case "nodeInvokeResult": {
20
20
  let e = n?.node;
21
- e && (i.nodeId = e.nodeId, "runStatus" in e && (i.toolcallId = e.toolCallId, i.runStatus = e.runStatus));
21
+ e && (i.nodeId = e.nodeId, "runStatus" in e && (i.toolCallId = e.toolCallId, i.runStatus = e.runStatus));
22
22
  break;
23
23
  }
24
24
  case "updateContexts":
@@ -1 +1,3 @@
1
- import "./outbound-port.mjs";
1
+ import "./cloud-socket.mjs";
2
+ import "./event-bus.mjs";
3
+ import "./message-handler.mjs";
@@ -19,6 +19,9 @@ var o = e("claw-client"), s = class {
19
19
  send(e) {
20
20
  return this.channel ? this.channel.getOutboundPort().send(e) : !1;
21
21
  }
22
+ request(e, t) {
23
+ return this.channel ? this.channel.getOutboundPort().request(e, t) : Promise.reject(/* @__PURE__ */ Error("cloud connect failed"));
24
+ }
22
25
  async start(e) {
23
26
  this.exitHandle = new Promise((e, t) => {
24
27
  this.resolveExit = e, this.rejectExit = t;
@@ -15,6 +15,10 @@ var t = /* @__PURE__ */ new Map(), n = {
15
15
  send(e, n) {
16
16
  let r = t.get(e);
17
17
  return r ? r.send(n) : !1;
18
+ },
19
+ request(e, n, r) {
20
+ let i = t.get(e);
21
+ return i ? i.request(n, r) : Promise.reject(/* @__PURE__ */ Error("account connect failed"));
18
22
  }
19
23
  };
20
24
  //#endregion
@@ -0,0 +1,18 @@
1
+ import { clawLogger as e } from "../../utils/claw-logger.mjs";
2
+ import { startAdminConnection as t, stopAdminConnection as n } from "../../capabilities/admin/impl.mjs";
3
+ import "../../capabilities/admin/index.mjs";
4
+ //#region src/core/services/admin.ts
5
+ var r = e("admin-service");
6
+ function i(e) {
7
+ e.registerService({
8
+ id: "yoyo-admin-gateway",
9
+ start: () => {
10
+ t(), r.info("admin gateway service started");
11
+ },
12
+ stop: () => {
13
+ n(), r.info("admin gateway service stopped");
14
+ }
15
+ });
16
+ }
17
+ //#endregion
18
+ export { i as registerAdminService };
@@ -0,0 +1,7 @@
1
+ import { registerAdminService as e } from "./admin.mjs";
2
+ //#region src/core/services/entry.ts
3
+ function t(t) {
4
+ e(t);
5
+ }
6
+ //#endregion
7
+ export { t as registerServices };