@7365admin1/core 3.121.0 → 3.122.0
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/CHANGELOG.md +7 -0
- package/dist/index.d.ts +126 -15
- package/dist/index.js +214 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +205 -49
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/e2e/robot-faults.e2e.test.mjs +3 -0
- package/test/e2e/robot-ounitech-company-creds.e2e.test.mjs +5 -4
- package/test/ounitech-part1.test.mjs +8 -7
- package/test/ounitech-timestamp-probe.test.mjs +64 -4
- package/test/padbot-mqtt.test.mjs +7 -3
- package/test/robot-cloud.test.mjs +4 -3
- package/test/robot-model-manifest.test.mjs +84 -0
package/dist/index.js
CHANGED
|
@@ -82,6 +82,7 @@ __export(src_exports, {
|
|
|
82
82
|
DEFAULT_SITE_TIMEZONE: () => DEFAULT_SITE_TIMEZONE,
|
|
83
83
|
DEMO_ADD_MAX: () => DEMO_ADD_MAX,
|
|
84
84
|
DEMO_BRAND: () => DEMO_BRAND,
|
|
85
|
+
DEMO_BRAND_DEFINITION: () => DEMO_BRAND_DEFINITION,
|
|
85
86
|
DEMO_CAPABILITIES: () => DEMO_CAPABILITIES,
|
|
86
87
|
DEMO_FAULT_ROBOT: () => DEMO_FAULT_ROBOT,
|
|
87
88
|
DEMO_ROUTES: () => DEMO_ROUTES,
|
|
@@ -247,20 +248,27 @@ __export(src_exports, {
|
|
|
247
248
|
ORG_OWNER_REPAIR_DEFAULT: () => ORG_OWNER_REPAIR_DEFAULT,
|
|
248
249
|
ORG_OWNER_REPAIR_OFF_REASON: () => ORG_OWNER_REPAIR_OFF_REASON,
|
|
249
250
|
OUNITECH_BRAND: () => OUNITECH_BRAND,
|
|
251
|
+
OUNITECH_BRAND_DEFINITION: () => OUNITECH_BRAND_DEFINITION,
|
|
250
252
|
OUNITECH_CAPABILITIES: () => OUNITECH_CAPABILITIES,
|
|
251
253
|
OUNITECH_PENDING_COMMANDS: () => OUNITECH_PENDING_COMMANDS,
|
|
254
|
+
OUNITECH_REGION_BASE_URLS: () => OUNITECH_REGION_BASE_URLS,
|
|
252
255
|
OUNITECH_TIMESTAMP_FORMAT: () => OUNITECH_TIMESTAMP_FORMAT,
|
|
256
|
+
OUNITECH_TIMESTAMP_ZONE: () => OUNITECH_TIMESTAMP_ZONE,
|
|
253
257
|
OpenRmfError: () => OpenRmfError,
|
|
254
258
|
OrgNature: () => OrgNature,
|
|
255
259
|
OvernightParkingRequestSort: () => OvernightParkingRequestSort,
|
|
256
260
|
OvernightParkingRequestStatus: () => OvernightParkingRequestStatus,
|
|
257
261
|
PADBOT_ACTION_TEXT: () => PADBOT_ACTION_TEXT,
|
|
262
|
+
PADBOT_ALARMS: () => PADBOT_ALARMS,
|
|
258
263
|
PADBOT_ALARM_POLL_MS: () => PADBOT_ALARM_POLL_MS,
|
|
259
264
|
PADBOT_ALARM_TEXT: () => PADBOT_ALARM_TEXT,
|
|
260
265
|
PADBOT_BRAND: () => PADBOT_BRAND,
|
|
266
|
+
PADBOT_BRAND_DEFINITION: () => PADBOT_BRAND_DEFINITION,
|
|
261
267
|
PADBOT_CAPABILITIES: () => PADBOT_CAPABILITIES,
|
|
262
268
|
PADBOT_DISPLAY_NAME: () => PADBOT_DISPLAY_NAME,
|
|
263
269
|
PADBOT_LIVE_POSE_MS: () => PADBOT_LIVE_POSE_MS,
|
|
270
|
+
PADBOT_MAKER_APP_ONLY: () => PADBOT_MAKER_APP_ONLY,
|
|
271
|
+
PADBOT_MODELS: () => PADBOT_MODELS,
|
|
264
272
|
PADBOT_MOTION: () => PADBOT_MOTION,
|
|
265
273
|
PADBOT_MQTT_SYNC_MS: () => PADBOT_MQTT_SYNC_MS,
|
|
266
274
|
PADBOT_ONLINE_WINDOW_MS: () => PADBOT_ONLINE_WINDOW_MS,
|
|
@@ -690,6 +698,7 @@ __export(src_exports, {
|
|
|
690
698
|
robotCloudTimestamp: () => robotCloudTimestamp,
|
|
691
699
|
robotCredentialsKey: () => robotCredentialsKey,
|
|
692
700
|
robotFaultSweepConfig: () => robotFaultSweepConfig,
|
|
701
|
+
robotManifest: () => robotManifest,
|
|
693
702
|
robotMode: () => robotMode,
|
|
694
703
|
robotModeFromList: () => robotModeFromList,
|
|
695
704
|
robotSchema: () => robotSchema,
|
|
@@ -62458,7 +62467,9 @@ var ROBOT_CAPABILITIES = [
|
|
|
62458
62467
|
* watchdog. Lit only where the brand offers it AND the server switched it on
|
|
62459
62468
|
* (`PADBOT_MANUAL_DRIVE=on`); Manager-only (update-robot).
|
|
62460
62469
|
*/
|
|
62461
|
-
"manualDrive"
|
|
62470
|
+
"manualDrive",
|
|
62471
|
+
/** A heat camera: alarm and patrol photos carry a thermal picture and temperatures. Reporting only. */
|
|
62472
|
+
"thermalCamera"
|
|
62462
62473
|
];
|
|
62463
62474
|
var TIER_REQUIREMENTS = {
|
|
62464
62475
|
"full-control": [
|
|
@@ -62587,6 +62598,28 @@ function commandSupported(capabilities, kind) {
|
|
|
62587
62598
|
return false;
|
|
62588
62599
|
return supports(capabilities, needed);
|
|
62589
62600
|
}
|
|
62601
|
+
var modelKey = (v) => typeof v === "string" ? v.toLowerCase().replace(/[^a-z0-9]/g, "") : "";
|
|
62602
|
+
function robotManifest(brand, reportedModel) {
|
|
62603
|
+
const b = robotBrandFor(brand);
|
|
62604
|
+
const reported = typeof reportedModel === "string" ? reportedModel.trim().slice(0, 60) : "";
|
|
62605
|
+
if (!b)
|
|
62606
|
+
return { capabilities: {}, profile: { model: reported, modelKnown: false, alarms: [], makerApp: "", makerAppOnly: [] } };
|
|
62607
|
+
const prefix = modelKey(b.brand);
|
|
62608
|
+
let key = modelKey(reported);
|
|
62609
|
+
if (prefix && key.startsWith(prefix) && key !== prefix)
|
|
62610
|
+
key = key.slice(prefix.length);
|
|
62611
|
+
const m = key ? b.models?.find((x) => x.codes.some((c) => modelKey(c) === key)) : void 0;
|
|
62612
|
+
return {
|
|
62613
|
+
capabilities: { ...b.capabilities, ...m?.capabilities ?? {} },
|
|
62614
|
+
profile: {
|
|
62615
|
+
model: m?.name ?? reported,
|
|
62616
|
+
modelKnown: Boolean(m),
|
|
62617
|
+
alarms: [...m?.alarms ?? b.info?.alarms ?? []],
|
|
62618
|
+
makerApp: m?.makerApp ?? b.info?.makerApp ?? "",
|
|
62619
|
+
makerAppOnly: [...m?.makerAppOnly ?? b.info?.makerAppOnly ?? []]
|
|
62620
|
+
}
|
|
62621
|
+
};
|
|
62622
|
+
}
|
|
62590
62623
|
var brands = /* @__PURE__ */ new Map();
|
|
62591
62624
|
function registerRobotBrand(brand) {
|
|
62592
62625
|
if (!brand?.brand)
|
|
@@ -62626,7 +62659,8 @@ function registeredRobotBrands() {
|
|
|
62626
62659
|
// brand can do ("Basic control - no battery, floor or spot clean"). The
|
|
62627
62660
|
// manifest is a property of this build, not of any client.
|
|
62628
62661
|
types: [...b.types ?? ["cleaning"]],
|
|
62629
|
-
capabilities: { ...b.capabilities }
|
|
62662
|
+
capabilities: { ...b.capabilities },
|
|
62663
|
+
models: (b.models ?? []).map((m) => ({ name: m.name, capabilities: robotManifest(b.brand, m.codes[0]).capabilities }))
|
|
62630
62664
|
}));
|
|
62631
62665
|
}
|
|
62632
62666
|
function clearRobotBrands() {
|
|
@@ -62655,10 +62689,25 @@ var ROBOT_CLOUD_TIMESTAMP_FORMATS = [
|
|
|
62655
62689
|
"unix-ms-number"
|
|
62656
62690
|
];
|
|
62657
62691
|
var OUNITECH_TIMESTAMP_FORMAT = "yyyyMMddHHmmss";
|
|
62658
|
-
|
|
62659
|
-
|
|
62660
|
-
const
|
|
62661
|
-
|
|
62692
|
+
var OUNITECH_TIMESTAMP_ZONE = "Asia/Shanghai";
|
|
62693
|
+
function zonedDateTime(now, zone) {
|
|
62694
|
+
const parts = new Intl.DateTimeFormat("en-GB", {
|
|
62695
|
+
timeZone: zone,
|
|
62696
|
+
year: "numeric",
|
|
62697
|
+
month: "2-digit",
|
|
62698
|
+
day: "2-digit",
|
|
62699
|
+
hour: "2-digit",
|
|
62700
|
+
minute: "2-digit",
|
|
62701
|
+
second: "2-digit",
|
|
62702
|
+
hourCycle: "h23"
|
|
62703
|
+
}).formatToParts(now);
|
|
62704
|
+
const get = (type) => parts.find((p) => p.type === type)?.value ?? "";
|
|
62705
|
+
return {
|
|
62706
|
+
date: `${get("year")}-${get("month")}-${get("day")}`,
|
|
62707
|
+
time: `${get("hour")}:${get("minute")}:${get("second")}`
|
|
62708
|
+
};
|
|
62709
|
+
}
|
|
62710
|
+
function robotCloudTimestamp(now = /* @__PURE__ */ new Date(), format2 = OUNITECH_TIMESTAMP_FORMAT, zone = OUNITECH_TIMESTAMP_ZONE) {
|
|
62662
62711
|
switch (format2) {
|
|
62663
62712
|
case "unix-s":
|
|
62664
62713
|
case "unix-s-number":
|
|
@@ -62666,12 +62715,18 @@ function robotCloudTimestamp(now = /* @__PURE__ */ new Date(), format2 = OUNITEC
|
|
|
62666
62715
|
case "unix-ms":
|
|
62667
62716
|
case "unix-ms-number":
|
|
62668
62717
|
return String(now.getTime());
|
|
62669
|
-
case "
|
|
62670
|
-
|
|
62671
|
-
case "iso8601":
|
|
62718
|
+
case "iso8601": {
|
|
62719
|
+
const { date, time } = zonedDateTime(now, "UTC");
|
|
62672
62720
|
return `${date}T${time}Z`;
|
|
62673
|
-
|
|
62721
|
+
}
|
|
62722
|
+
case "yyyy-MM-dd HH:mm:ss": {
|
|
62723
|
+
const { date, time } = zonedDateTime(now, zone);
|
|
62724
|
+
return `${date} ${time}`;
|
|
62725
|
+
}
|
|
62726
|
+
case "yyyyMMddHHmmss": {
|
|
62727
|
+
const { date, time } = zonedDateTime(now, zone);
|
|
62674
62728
|
return `${date}${time}`.replace(/[-:]/g, "");
|
|
62729
|
+
}
|
|
62675
62730
|
default:
|
|
62676
62731
|
throw new Error(`Robot cloud: unknown timestamp format "${format2}".`);
|
|
62677
62732
|
}
|
|
@@ -62686,8 +62741,8 @@ function robotCloudSign(appid, timestamp, path5, secret) {
|
|
|
62686
62741
|
}
|
|
62687
62742
|
return crypto10.createHash("sha1").update(robotCloudSigningString(appid, timestamp, path5, secret)).digest("hex");
|
|
62688
62743
|
}
|
|
62689
|
-
function robotCloudBody(appid, secret, path5, params = {}, now, format2 = OUNITECH_TIMESTAMP_FORMAT) {
|
|
62690
|
-
const timestamp = robotCloudTimestamp(now, format2);
|
|
62744
|
+
function robotCloudBody(appid, secret, path5, params = {}, now, format2 = OUNITECH_TIMESTAMP_FORMAT, zone = OUNITECH_TIMESTAMP_ZONE) {
|
|
62745
|
+
const timestamp = robotCloudTimestamp(now, format2, zone);
|
|
62691
62746
|
return {
|
|
62692
62747
|
appid,
|
|
62693
62748
|
timestamp: format2.endsWith("-number") ? Number(timestamp) : timestamp,
|
|
@@ -62819,9 +62874,9 @@ function planDayFromJsDay(jsDay) {
|
|
|
62819
62874
|
var ROBOT_CLOUD_DOC_CONFIRMATIONS = [
|
|
62820
62875
|
// ANSWERED 2026-09-26 (Ounitech Part 1): base URL, one appid/secret per
|
|
62821
62876
|
// company, sign = the formula with url = each endpoint's own path (the doc's
|
|
62822
|
-
// examples were a copy-paste), timestamp
|
|
62877
|
+
// examples were a copy-paste), timestamp zone proven Asia/Shanghai (UTC+8) in production. Removed from this list.
|
|
62823
62878
|
// Still open: the accepted clock-skew window.
|
|
62824
|
-
"Accepted clock-skew window for `timestamp` (UTC+
|
|
62879
|
+
"Accepted clock-skew window for `timestamp` (zone proven UTC+8 by probe; the window is not stated).",
|
|
62825
62880
|
// pixelToMetres assumes the image y-origin is top-left.
|
|
62826
62881
|
"Pixel y-origin: top-left (assumed) or bottom-left.",
|
|
62827
62882
|
// The doc labels modeFlag "1 vacuum / 2 washing / 3 dry dust mop" on the
|
|
@@ -63049,7 +63104,8 @@ function useRobotCloudService(credentials, options = {}) {
|
|
|
63049
63104
|
path5,
|
|
63050
63105
|
params,
|
|
63051
63106
|
options.now?.(),
|
|
63052
|
-
options.timestampFormat
|
|
63107
|
+
options.timestampFormat,
|
|
63108
|
+
options.timestampZone
|
|
63053
63109
|
);
|
|
63054
63110
|
const step = robotCloudStepName(path5);
|
|
63055
63111
|
let data;
|
|
@@ -63129,6 +63185,9 @@ function useRobotCloudService(credentials, options = {}) {
|
|
|
63129
63185
|
);
|
|
63130
63186
|
return data.robotList ?? [];
|
|
63131
63187
|
}
|
|
63188
|
+
async function getRobotListReply() {
|
|
63189
|
+
return post(ROBOT_CLOUD_PATHS.robotList, {}, "robotList");
|
|
63190
|
+
}
|
|
63132
63191
|
async function getMaps(robotSn) {
|
|
63133
63192
|
const data = await post(
|
|
63134
63193
|
ROBOT_CLOUD_PATHS.mapList,
|
|
@@ -63201,6 +63260,7 @@ function useRobotCloudService(credentials, options = {}) {
|
|
|
63201
63260
|
}
|
|
63202
63261
|
return {
|
|
63203
63262
|
getRobots,
|
|
63263
|
+
getRobotListReply,
|
|
63204
63264
|
getMaps,
|
|
63205
63265
|
getFileUrls,
|
|
63206
63266
|
getPlans,
|
|
@@ -63332,14 +63392,18 @@ function createOunitechAdapter(credentials, options) {
|
|
|
63332
63392
|
}
|
|
63333
63393
|
};
|
|
63334
63394
|
}
|
|
63395
|
+
var OUNITECH_BRAND_DEFINITION = {
|
|
63396
|
+
brand: OUNITECH_BRAND,
|
|
63397
|
+
displayName: "Ounitech (Q3-G / Q3-W)",
|
|
63398
|
+
capabilities: OUNITECH_CAPABILITIES,
|
|
63399
|
+
pendingCommands: OUNITECH_PENDING_COMMANDS,
|
|
63400
|
+
// The robot list carries no model, so Q3-G and Q3-W share these defaults
|
|
63401
|
+
// (their API is the same); add `models` when Ounitech reports one.
|
|
63402
|
+
info: { makerApp: "the Ounitech app", makerAppOnly: ["pausing or stopping a job", "cleaning across floors"] },
|
|
63403
|
+
create: (credentials) => createOunitechAdapter(credentials)
|
|
63404
|
+
};
|
|
63335
63405
|
function registerOunitechBrand() {
|
|
63336
|
-
registerRobotBrand(
|
|
63337
|
-
brand: OUNITECH_BRAND,
|
|
63338
|
-
displayName: "Ounitech (Q3-G / Q3-W)",
|
|
63339
|
-
capabilities: OUNITECH_CAPABILITIES,
|
|
63340
|
-
pendingCommands: OUNITECH_PENDING_COMMANDS,
|
|
63341
|
-
create: (credentials) => createOunitechAdapter(credentials)
|
|
63342
|
-
});
|
|
63406
|
+
registerRobotBrand(OUNITECH_BRAND_DEFINITION);
|
|
63343
63407
|
}
|
|
63344
63408
|
registerOunitechBrand();
|
|
63345
63409
|
|
|
@@ -63821,15 +63885,22 @@ function startDemoTracking(adapter, robotSn, onEvent, everyMs = 1200, skip) {
|
|
|
63821
63885
|
}
|
|
63822
63886
|
};
|
|
63823
63887
|
}
|
|
63888
|
+
var DEMO_BRAND_DEFINITION = {
|
|
63889
|
+
brand: DEMO_BRAND,
|
|
63890
|
+
displayName: "Demo robots (simulated)",
|
|
63891
|
+
capabilities: DEMO_CAPABILITIES,
|
|
63892
|
+
// Serial-derived demo robots are cleaning (DEMO-C-###) AND security (DEMO-S-###).
|
|
63893
|
+
types: ["cleaning", "security"],
|
|
63894
|
+
// Simulated models, so a demo fleet shows a mixed fleet's controls: the
|
|
63895
|
+
// compact CX-1 takes jobs but no point commands; the SP-1 patroller cleans nothing.
|
|
63896
|
+
models: [
|
|
63897
|
+
{ name: "Demo CX-1", codes: ["CX-1"], capabilities: { spotClean: false, navigateToPoint: false, relocalize: false } },
|
|
63898
|
+
{ name: "Demo SP-1", codes: ["SP-1"], capabilities: { spotClean: false } }
|
|
63899
|
+
],
|
|
63900
|
+
create: () => createDemoAdapter()
|
|
63901
|
+
};
|
|
63824
63902
|
function registerDemoBrand() {
|
|
63825
|
-
registerRobotBrand(
|
|
63826
|
-
brand: DEMO_BRAND,
|
|
63827
|
-
displayName: "Demo robots (simulated)",
|
|
63828
|
-
capabilities: DEMO_CAPABILITIES,
|
|
63829
|
-
// Serial-derived demo robots are cleaning (DEMO-C-###) AND security (DEMO-S-###).
|
|
63830
|
-
types: ["cleaning", "security"],
|
|
63831
|
-
create: () => createDemoAdapter()
|
|
63832
|
-
});
|
|
63903
|
+
registerRobotBrand(DEMO_BRAND_DEFINITION);
|
|
63833
63904
|
}
|
|
63834
63905
|
registerDemoBrand();
|
|
63835
63906
|
|
|
@@ -65095,11 +65166,44 @@ var PADBOT_CAPABILITIES = {
|
|
|
65095
65166
|
// §6.7 / §6.8
|
|
65096
65167
|
resolveAlerts: true,
|
|
65097
65168
|
// §6.6
|
|
65098
|
-
//
|
|
65099
|
-
|
|
65100
|
-
|
|
65101
|
-
|
|
65169
|
+
// Model-specific (see PADBOT_MODELS): the drive limits are the S2's head range,
|
|
65170
|
+
// and a heat camera is the S2's - another PadBot patrol model gets neither.
|
|
65171
|
+
manualDrive: false,
|
|
65172
|
+
thermalCamera: false
|
|
65102
65173
|
};
|
|
65174
|
+
var PADBOT_ALARMS = [
|
|
65175
|
+
"person",
|
|
65176
|
+
"high temperature",
|
|
65177
|
+
"smoke",
|
|
65178
|
+
"debris",
|
|
65179
|
+
"noise",
|
|
65180
|
+
"water on the floor",
|
|
65181
|
+
"person falling",
|
|
65182
|
+
"door open",
|
|
65183
|
+
"window open",
|
|
65184
|
+
"fire-fighting equipment"
|
|
65185
|
+
];
|
|
65186
|
+
var PADBOT_MAKER_APP_ONLY = [
|
|
65187
|
+
"patrol schedules",
|
|
65188
|
+
"maps, points and routes",
|
|
65189
|
+
"alarm thresholds and AI recognition",
|
|
65190
|
+
"lights and voice announcements",
|
|
65191
|
+
"recorded video"
|
|
65192
|
+
];
|
|
65193
|
+
var PADBOT_MODELS = [
|
|
65194
|
+
{
|
|
65195
|
+
name: "PadBot S2",
|
|
65196
|
+
codes: ["S2"],
|
|
65197
|
+
makerAppOnly: [...PADBOT_MAKER_APP_ONLY, "live thermal view"],
|
|
65198
|
+
capabilities: {
|
|
65199
|
+
thermalCamera: true,
|
|
65200
|
+
// §8.1 over MQTT, behind the server's drive watchdog; only with PADBOT_MANUAL_DRIVE=on.
|
|
65201
|
+
get manualDrive() {
|
|
65202
|
+
return padbotManualDriveEnabled();
|
|
65203
|
+
}
|
|
65204
|
+
}
|
|
65205
|
+
}
|
|
65206
|
+
];
|
|
65103
65207
|
var PADBOT_PATHS = {
|
|
65104
65208
|
robots: "/api/v1/robots/list",
|
|
65105
65209
|
states: "/api/v1/robots/states/list",
|
|
@@ -65719,18 +65823,26 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65719
65823
|
}
|
|
65720
65824
|
};
|
|
65721
65825
|
}
|
|
65826
|
+
var PADBOT_BRAND_DEFINITION = {
|
|
65827
|
+
brand: PADBOT_BRAND,
|
|
65828
|
+
displayName: PADBOT_DISPLAY_NAME,
|
|
65829
|
+
capabilities: PADBOT_CAPABILITIES,
|
|
65830
|
+
types: ["security"],
|
|
65831
|
+
info: { alarms: [...PADBOT_ALARMS], makerApp: "the PadBot app", makerAppOnly: [...PADBOT_MAKER_APP_ONLY] },
|
|
65832
|
+
models: PADBOT_MODELS,
|
|
65833
|
+
create: (credentials) => createPadbotAdapter(credentials)
|
|
65834
|
+
};
|
|
65722
65835
|
function registerPadbotBrand() {
|
|
65723
|
-
registerRobotBrand(
|
|
65724
|
-
brand: PADBOT_BRAND,
|
|
65725
|
-
displayName: PADBOT_DISPLAY_NAME,
|
|
65726
|
-
capabilities: PADBOT_CAPABILITIES,
|
|
65727
|
-
types: ["security"],
|
|
65728
|
-
create: (credentials) => createPadbotAdapter(credentials)
|
|
65729
|
-
});
|
|
65836
|
+
registerRobotBrand(PADBOT_BRAND_DEFINITION);
|
|
65730
65837
|
}
|
|
65731
65838
|
registerPadbotBrand();
|
|
65732
65839
|
|
|
65733
65840
|
// src/services/robot-fleet.service.ts
|
|
65841
|
+
var OUNITECH_REGION_BASE_URLS = [
|
|
65842
|
+
"https://app.frankfurt.robotcloud.top",
|
|
65843
|
+
"https://app.singapore.robotcloud.top",
|
|
65844
|
+
"https://app.robotcloud.top"
|
|
65845
|
+
];
|
|
65734
65846
|
var TIMESTAMP_OFFSET_CANDIDATES = [
|
|
65735
65847
|
{ offsetMinutes: 120, label: "UTC+2 (Frankfurt summer time)" },
|
|
65736
65848
|
{ offsetMinutes: 60, label: "UTC+1 (Frankfurt winter time)" },
|
|
@@ -65817,7 +65929,7 @@ function useRobotFleetService(deps) {
|
|
|
65817
65929
|
position: null,
|
|
65818
65930
|
planPosition: null,
|
|
65819
65931
|
fault: null,
|
|
65820
|
-
|
|
65932
|
+
...robotManifest(brand)
|
|
65821
65933
|
};
|
|
65822
65934
|
}
|
|
65823
65935
|
const fault = found.fault?.code ? found.fault : null;
|
|
@@ -65828,6 +65940,7 @@ function useRobotFleetService(deps) {
|
|
|
65828
65940
|
}
|
|
65829
65941
|
}
|
|
65830
65942
|
const free = found.mode === "IDLE" || found.mode === "CHARGED";
|
|
65943
|
+
const manifest = robotManifest(brand, found.model);
|
|
65831
65944
|
return {
|
|
65832
65945
|
id,
|
|
65833
65946
|
name: robot.name,
|
|
@@ -65840,7 +65953,7 @@ function useRobotFleetService(deps) {
|
|
|
65840
65953
|
dispatchable: (
|
|
65841
65954
|
// A faulted robot is not given a job however idle its mode reads. An
|
|
65842
65955
|
// alarm (smoke seen, door open) is not a machine fault: the patrol goes on.
|
|
65843
|
-
found.online && free && (!fault || fault.alarm === true) && commandSupported(
|
|
65956
|
+
found.online && free && (!fault || fault.alarm === true) && commandSupported(manifest.capabilities, "full")
|
|
65844
65957
|
),
|
|
65845
65958
|
batteryPercent: found.batteryPercent ?? null,
|
|
65846
65959
|
floorNo: found.floorNo ?? null,
|
|
@@ -65849,7 +65962,8 @@ function useRobotFleetService(deps) {
|
|
|
65849
65962
|
position: found.position ?? null,
|
|
65850
65963
|
planPosition: found.planPosition ?? null,
|
|
65851
65964
|
fault,
|
|
65852
|
-
capabilities:
|
|
65965
|
+
capabilities: manifest.capabilities,
|
|
65966
|
+
profile: manifest.profile
|
|
65853
65967
|
};
|
|
65854
65968
|
}
|
|
65855
65969
|
async function getMaps(robot) {
|
|
@@ -65899,6 +66013,9 @@ function useRobotFleetService(deps) {
|
|
|
65899
66013
|
return adapter.sendCommand(robotSn, command);
|
|
65900
66014
|
}
|
|
65901
66015
|
const state = await getFleetRobot(robot);
|
|
66016
|
+
if (!commandSupported(state.capabilities, command.kind)) {
|
|
66017
|
+
throw new import_node_server_utils163.BadRequestError(`${state.profile.model || adapter.displayName} does not support "${command.kind}" through its API.`);
|
|
66018
|
+
}
|
|
65902
66019
|
if (command.kind === "pause" || command.kind === "resume" || command.kind === "cancel" || command.kind === "relocalize" || command.kind === "patrol-resume") {
|
|
65903
66020
|
const need = command.kind === "pause" ? "WORKING" : command.kind === "resume" ? "PAUSED" : null;
|
|
65904
66021
|
if (!state.online || need && state.mode !== need) {
|
|
@@ -66105,6 +66222,43 @@ function useRobotFleetService(deps) {
|
|
|
66105
66222
|
lastTimestampProbe.set(key, Date.now());
|
|
66106
66223
|
return { id, pair };
|
|
66107
66224
|
}
|
|
66225
|
+
async function probeRegions(robot) {
|
|
66226
|
+
const { id, pair } = probeGate(robot, "region");
|
|
66227
|
+
const hosts = [];
|
|
66228
|
+
for (const baseUrl of deps?.regionBaseUrls ?? OUNITECH_REGION_BASE_URLS) {
|
|
66229
|
+
try {
|
|
66230
|
+
const reply = await useRobotCloudService(pair, { ...deps?.cloudOptions, baseUrl }).getRobotListReply();
|
|
66231
|
+
const replyShape = {};
|
|
66232
|
+
for (const [k, v] of Object.entries(reply)) {
|
|
66233
|
+
replyShape[k] = Array.isArray(v) ? `list of ${v.length}` : v === null ? "null" : typeof v;
|
|
66234
|
+
}
|
|
66235
|
+
const list = Array.isArray(reply.robotList) ? reply.robotList : [];
|
|
66236
|
+
const robots = list.map((r) => ({
|
|
66237
|
+
robotSn: String(r?.robotSn ?? ""),
|
|
66238
|
+
robotName: String(r?.robotName ?? ""),
|
|
66239
|
+
online: r?.onlineFlag === true,
|
|
66240
|
+
statusName: String(r?.statusName ?? "")
|
|
66241
|
+
}));
|
|
66242
|
+
hosts.push({
|
|
66243
|
+
host: cloudHost(baseUrl),
|
|
66244
|
+
ok: true,
|
|
66245
|
+
detail: `Signed in. Lists ${robots.length} robot${robots.length === 1 ? "" : "s"}.`,
|
|
66246
|
+
replyShape,
|
|
66247
|
+
robots
|
|
66248
|
+
});
|
|
66249
|
+
} catch (e) {
|
|
66250
|
+
hosts.push({ host: cloudHost(baseUrl), ok: false, ...describeFailure(e) });
|
|
66251
|
+
}
|
|
66252
|
+
}
|
|
66253
|
+
const withRobots = hosts.filter((h) => h.robots?.length);
|
|
66254
|
+
return {
|
|
66255
|
+
robotId: id,
|
|
66256
|
+
configuredHost: cloudHost(deps?.cloudOptions?.baseUrl ?? ROBOT_CLOUD_BASE_URL),
|
|
66257
|
+
hosts,
|
|
66258
|
+
summary: withRobots.length ? `Robots found on ${withRobots.map((h) => `${h.host} (${h.robots.length})`).join(", ")}.` : hosts.some((h) => h.ok) ? "Signed in, but no region lists a robot for this AppID - Ounitech must bind the robot to this AppID's account." : "No region accepted this AppID.",
|
|
66259
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
66260
|
+
};
|
|
66261
|
+
}
|
|
66108
66262
|
async function probeTimestampOffset(robot) {
|
|
66109
66263
|
const { id, pair } = probeGate(robot, "offset");
|
|
66110
66264
|
const baseUrl = deps?.cloudOptions?.baseUrl ?? ROBOT_CLOUD_BASE_URL;
|
|
@@ -66118,9 +66272,9 @@ function useRobotFleetService(deps) {
|
|
|
66118
66272
|
let accepted = null;
|
|
66119
66273
|
for (const c of [{ offsetMinutes: 0, label: "UTC (current)" }, ...TIMESTAMP_OFFSET_CANDIDATES]) {
|
|
66120
66274
|
const now = () => new Date(Date.now() + (skewMs ?? 0) + c.offsetMinutes * 6e4);
|
|
66121
|
-
const sent = robotCloudTimestamp(now(), "yyyyMMddHHmmss");
|
|
66275
|
+
const sent = robotCloudTimestamp(now(), "yyyyMMddHHmmss", "UTC");
|
|
66122
66276
|
try {
|
|
66123
|
-
const robots = await useRobotCloudService(pair, { ...deps?.cloudOptions, timestampFormat: "yyyyMMddHHmmss", now, onReply }).getRobots();
|
|
66277
|
+
const robots = await useRobotCloudService(pair, { ...deps?.cloudOptions, timestampFormat: "yyyyMMddHHmmss", timestampZone: "UTC", now, onReply }).getRobots();
|
|
66124
66278
|
attempts.push({ ...c, sent, ok: true, detail: `Accepted. The account lists ${robots.length} robot${robots.length === 1 ? "" : "s"}.` });
|
|
66125
66279
|
accepted = c.offsetMinutes;
|
|
66126
66280
|
break;
|
|
@@ -66174,6 +66328,7 @@ function useRobotFleetService(deps) {
|
|
|
66174
66328
|
diagnose,
|
|
66175
66329
|
probeTimestampFormat,
|
|
66176
66330
|
probeTimestampOffset,
|
|
66331
|
+
probeRegions,
|
|
66177
66332
|
getLiveVideo,
|
|
66178
66333
|
resolveAlerts,
|
|
66179
66334
|
getPatrolHistory,
|
|
@@ -69235,14 +69390,14 @@ function useRobotFleetController(deps) {
|
|
|
69235
69390
|
try {
|
|
69236
69391
|
await requirePlatformStaff(req, CROSS_CLIENT_GRANT);
|
|
69237
69392
|
const probe = req.query.probe;
|
|
69238
|
-
if (probe !== void 0 && probe !== "timestamp" && probe !== "timestamp-offset") {
|
|
69239
|
-
return fail(next, new import_node_server_utils169.BadRequestError('probe must be "timestamp"
|
|
69393
|
+
if (probe !== void 0 && probe !== "timestamp" && probe !== "timestamp-offset" && probe !== "region") {
|
|
69394
|
+
return fail(next, new import_node_server_utils169.BadRequestError('probe must be "timestamp", "timestamp-offset" or "region".'));
|
|
69240
69395
|
}
|
|
69241
69396
|
const robot = await entitleRobot(req, req.params.id);
|
|
69242
69397
|
res.set("Cache-Control", "no-store");
|
|
69243
69398
|
const fleet2 = getFleet2();
|
|
69244
69399
|
res.json(
|
|
69245
|
-
probe === "timestamp" ? await fleet2.probeTimestampFormat(robot) : probe === "timestamp-offset" ? await fleet2.probeTimestampOffset(robot) : await fleet2.diagnose(robot)
|
|
69400
|
+
probe === "timestamp" ? await fleet2.probeTimestampFormat(robot) : probe === "timestamp-offset" ? await fleet2.probeTimestampOffset(robot) : probe === "region" ? await fleet2.probeRegions(robot) : await fleet2.diagnose(robot)
|
|
69246
69401
|
);
|
|
69247
69402
|
} catch (error) {
|
|
69248
69403
|
fail(next, error);
|
|
@@ -70493,6 +70648,7 @@ async function readLiveItems(robots) {
|
|
|
70493
70648
|
planPosition: s.planPosition,
|
|
70494
70649
|
fault: s.fault,
|
|
70495
70650
|
capabilities: s.capabilities,
|
|
70651
|
+
profile: s.profile,
|
|
70496
70652
|
lastSeenAt: seen2 ? new Date(seen2) : null
|
|
70497
70653
|
});
|
|
70498
70654
|
} catch (e) {
|
|
@@ -104517,6 +104673,7 @@ function usePersonalEmergencyChainController() {
|
|
|
104517
104673
|
DEFAULT_SITE_TIMEZONE,
|
|
104518
104674
|
DEMO_ADD_MAX,
|
|
104519
104675
|
DEMO_BRAND,
|
|
104676
|
+
DEMO_BRAND_DEFINITION,
|
|
104520
104677
|
DEMO_CAPABILITIES,
|
|
104521
104678
|
DEMO_FAULT_ROBOT,
|
|
104522
104679
|
DEMO_ROUTES,
|
|
@@ -104682,20 +104839,27 @@ function usePersonalEmergencyChainController() {
|
|
|
104682
104839
|
ORG_OWNER_REPAIR_DEFAULT,
|
|
104683
104840
|
ORG_OWNER_REPAIR_OFF_REASON,
|
|
104684
104841
|
OUNITECH_BRAND,
|
|
104842
|
+
OUNITECH_BRAND_DEFINITION,
|
|
104685
104843
|
OUNITECH_CAPABILITIES,
|
|
104686
104844
|
OUNITECH_PENDING_COMMANDS,
|
|
104845
|
+
OUNITECH_REGION_BASE_URLS,
|
|
104687
104846
|
OUNITECH_TIMESTAMP_FORMAT,
|
|
104847
|
+
OUNITECH_TIMESTAMP_ZONE,
|
|
104688
104848
|
OpenRmfError,
|
|
104689
104849
|
OrgNature,
|
|
104690
104850
|
OvernightParkingRequestSort,
|
|
104691
104851
|
OvernightParkingRequestStatus,
|
|
104692
104852
|
PADBOT_ACTION_TEXT,
|
|
104853
|
+
PADBOT_ALARMS,
|
|
104693
104854
|
PADBOT_ALARM_POLL_MS,
|
|
104694
104855
|
PADBOT_ALARM_TEXT,
|
|
104695
104856
|
PADBOT_BRAND,
|
|
104857
|
+
PADBOT_BRAND_DEFINITION,
|
|
104696
104858
|
PADBOT_CAPABILITIES,
|
|
104697
104859
|
PADBOT_DISPLAY_NAME,
|
|
104698
104860
|
PADBOT_LIVE_POSE_MS,
|
|
104861
|
+
PADBOT_MAKER_APP_ONLY,
|
|
104862
|
+
PADBOT_MODELS,
|
|
104699
104863
|
PADBOT_MOTION,
|
|
104700
104864
|
PADBOT_MQTT_SYNC_MS,
|
|
104701
104865
|
PADBOT_ONLINE_WINDOW_MS,
|
|
@@ -105125,6 +105289,7 @@ function usePersonalEmergencyChainController() {
|
|
|
105125
105289
|
robotCloudTimestamp,
|
|
105126
105290
|
robotCredentialsKey,
|
|
105127
105291
|
robotFaultSweepConfig,
|
|
105292
|
+
robotManifest,
|
|
105128
105293
|
robotMode,
|
|
105129
105294
|
robotModeFromList,
|
|
105130
105295
|
robotSchema,
|