@robbeverhelst/do 1.344.0 → 1.346.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/dist/do.js +352 -43
- package/package.json +1 -1
package/dist/do.js
CHANGED
|
@@ -14420,7 +14420,7 @@ var configError = (message) => new CliError("config", message, EXIT.CONFIG);
|
|
|
14420
14420
|
|
|
14421
14421
|
// src/meta.ts
|
|
14422
14422
|
var CLI_NAME = "do";
|
|
14423
|
-
var VERSION = "1.
|
|
14423
|
+
var VERSION = "1.346.0";
|
|
14424
14424
|
var API_PREFIX = "/api/v1";
|
|
14425
14425
|
var DEFAULT_API_URL = "http://localhost:3001";
|
|
14426
14426
|
|
|
@@ -28034,6 +28034,9 @@ var healthShares = pgTable("health_shares", {
|
|
|
28034
28034
|
snapshot: jsonb("snapshot").notNull(),
|
|
28035
28035
|
note: text("note"),
|
|
28036
28036
|
attachments: jsonb("attachments").notNull().default(sql`'[]'::jsonb`),
|
|
28037
|
+
periodFrom: date5("period_from", { mode: "string" }),
|
|
28038
|
+
periodTo: date5("period_to", { mode: "string" }),
|
|
28039
|
+
singleOpen: boolean4("single_open").notNull().default(false),
|
|
28037
28040
|
tokenHash: text("token_hash").notNull().unique(),
|
|
28038
28041
|
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
28039
28042
|
revokedAt: timestamp("revoked_at", { withTimezone: true }),
|
|
@@ -30066,7 +30069,7 @@ var habitOperations = defineOperations({
|
|
|
30066
30069
|
scopes: ["habits:read"],
|
|
30067
30070
|
tag: "Habits",
|
|
30068
30071
|
summary: "Habit due dates in a range",
|
|
30069
|
-
description: "Plan's Month and agendas (V3-22): every growing habit's due days from `from` through `to` (the key's member's civil days, both included, at most 62), by its schedule alone, the same rule the list and today read. A day it rests (paused, away) or before it began isn't one; quit and event-scheduled
|
|
30072
|
+
description: "Plan's Month and agendas (V3-22): every growing habit's due days from `from` through `to` (the key's member's civil days, both included, at most 62), by its schedule alone, the same rule the list and today read. A day it rests (paused, away) or before it began isn't one; quit habits are left out, and an event-scheduled one sits on its event days (V3-46). Each row is `{ habitId, title, date, time, scheduleLabel, daily, streakLabel }`: `time` its exact `HH:MM` or null, `daily` true for a habit due every day, `streakLabel` `N days` for a daily habit and `N in a row` otherwise. Sorted by date, then time.",
|
|
30070
30073
|
query: [
|
|
30071
30074
|
{ name: "from", description: "The first day (YYYY-MM-DD).", format: "date", required: true },
|
|
30072
30075
|
{
|
|
@@ -35759,6 +35762,27 @@ var orcaOperations = defineOperations({
|
|
|
35759
35762
|
status: 200,
|
|
35760
35763
|
response: { description: "The Orca overview." }
|
|
35761
35764
|
},
|
|
35765
|
+
machines: {
|
|
35766
|
+
method: "get",
|
|
35767
|
+
path: "/orca/machines",
|
|
35768
|
+
scopes: ["orca:read"],
|
|
35769
|
+
tag: "Orca",
|
|
35770
|
+
summary: "List Orca machines",
|
|
35771
|
+
description: "Every machine Orca knows, with its health (OS, disk, memory, load, updates, uptime or battery, null where it can't be read) beside its Orca reachability (`orca.reachable`, its `route`, since when, and why not), the repos and agents it runs and its sessions; `summary` holds the counts (machines awake and asleep, sessions running and waiting for you, reachable through Orca). A machine Orca can't reach is still listed. Read live; nothing is stored.",
|
|
35772
|
+
status: 200,
|
|
35773
|
+
response: { description: "The machines and their summary." },
|
|
35774
|
+
errors: { 503: unavailable }
|
|
35775
|
+
},
|
|
35776
|
+
status: {
|
|
35777
|
+
method: "get",
|
|
35778
|
+
path: "/orca/status",
|
|
35779
|
+
scopes: ["orca:read"],
|
|
35780
|
+
tag: "Orca",
|
|
35781
|
+
summary: "Read Orca status",
|
|
35782
|
+
description: "The orca-bridge itself (`bridge`: reachable, its address, the machine it runs on, its version and since when it runs; null while Orca isn't connected), the calls do and the agent made through it over the last 7 days, newest first (metadata only: when, `kind` read / send / list, a short label, who, to which machine, how it went and how long; never a session's output), `callsToday`, and the current `problems` in plain words (an `error` one always says nothing is lost).",
|
|
35783
|
+
status: 200,
|
|
35784
|
+
response: { description: "The bridge's status, its calls and problems." }
|
|
35785
|
+
},
|
|
35762
35786
|
output: {
|
|
35763
35787
|
method: "get",
|
|
35764
35788
|
path: "/orca/hosts/{host}/terminals/{handle}/output",
|
|
@@ -41013,6 +41037,118 @@ function assertDestructiveAllowed(flags, action) {
|
|
|
41013
41037
|
}
|
|
41014
41038
|
}
|
|
41015
41039
|
|
|
41040
|
+
// ../../packages/schema/src/contracts/orca-machines.ts
|
|
41041
|
+
var ORCA_MACHINE_ROUTES = ["local", "same-machine", "tailnet"];
|
|
41042
|
+
var orcaMachineRouteSchema = _enum2(ORCA_MACHINE_ROUTES);
|
|
41043
|
+
var ORCA_MACHINE_AWAKE = ["awake", "asleep", "unknown"];
|
|
41044
|
+
var orcaMachineAwakeSchema = _enum2(ORCA_MACHINE_AWAKE);
|
|
41045
|
+
var orcaMachineAmountSchema = object({
|
|
41046
|
+
usedGb: number2().nonnegative(),
|
|
41047
|
+
totalGb: number2().nonnegative()
|
|
41048
|
+
});
|
|
41049
|
+
var orcaMachineReachSchema = object({
|
|
41050
|
+
reachable: boolean2(),
|
|
41051
|
+
route: orcaMachineRouteSchema.nullable(),
|
|
41052
|
+
since: exports_coerce.date().nullable(),
|
|
41053
|
+
error: string2().nullable()
|
|
41054
|
+
});
|
|
41055
|
+
var orcaMachineHealthSchema = object({
|
|
41056
|
+
host: orcaHostNameSchema,
|
|
41057
|
+
role: string2().nullable(),
|
|
41058
|
+
os: string2().nullable(),
|
|
41059
|
+
awake: orcaMachineAwakeSchema,
|
|
41060
|
+
lastSeenAt: exports_coerce.date().nullable(),
|
|
41061
|
+
orca: orcaMachineReachSchema,
|
|
41062
|
+
disk: orcaMachineAmountSchema.nullable(),
|
|
41063
|
+
memory: orcaMachineAmountSchema.nullable(),
|
|
41064
|
+
load: object({ pct: number2().min(0), line: string2().nullable() }).nullable(),
|
|
41065
|
+
updatesWaiting: number2().int().nonnegative().nullable(),
|
|
41066
|
+
uptimeDays: number2().nonnegative().nullable(),
|
|
41067
|
+
battery: _enum2(["charging", "on battery"]).nullable(),
|
|
41068
|
+
repos: array(string2()),
|
|
41069
|
+
agentKinds: array(orcaAgentKindSchema),
|
|
41070
|
+
sleepsAfter: string2().nullable()
|
|
41071
|
+
});
|
|
41072
|
+
var orcaBridgeMachinesSchema = object({
|
|
41073
|
+
machines: array(orcaMachineHealthSchema)
|
|
41074
|
+
});
|
|
41075
|
+
var orcaMachineSchema = orcaMachineHealthSchema.extend({
|
|
41076
|
+
sessions: number2().int().nonnegative(),
|
|
41077
|
+
running: number2().int().nonnegative(),
|
|
41078
|
+
waitingForYou: number2().int().nonnegative(),
|
|
41079
|
+
pendingCalls: number2().int().nonnegative()
|
|
41080
|
+
});
|
|
41081
|
+
var orcaMachinesSummarySchema = object({
|
|
41082
|
+
machines: object({
|
|
41083
|
+
total: number2().int().nonnegative(),
|
|
41084
|
+
awake: number2().int().nonnegative(),
|
|
41085
|
+
asleep: number2().int().nonnegative()
|
|
41086
|
+
}),
|
|
41087
|
+
sessions: object({
|
|
41088
|
+
total: number2().int().nonnegative(),
|
|
41089
|
+
running: number2().int().nonnegative(),
|
|
41090
|
+
waitingForYou: number2().int().nonnegative()
|
|
41091
|
+
}),
|
|
41092
|
+
reachable: object({
|
|
41093
|
+
count: number2().int().nonnegative(),
|
|
41094
|
+
total: number2().int().nonnegative()
|
|
41095
|
+
})
|
|
41096
|
+
});
|
|
41097
|
+
var orcaMachinesSchema = object({
|
|
41098
|
+
machines: array(orcaMachineSchema),
|
|
41099
|
+
summary: orcaMachinesSummarySchema
|
|
41100
|
+
});
|
|
41101
|
+
|
|
41102
|
+
// ../../packages/schema/src/contracts/orca-status.ts
|
|
41103
|
+
var ORCA_CALLS_KEPT_DAYS = 7;
|
|
41104
|
+
var ORCA_CALL_KINDS = ["read", "send", "list"];
|
|
41105
|
+
var orcaCallKindSchema = _enum2(ORCA_CALL_KINDS);
|
|
41106
|
+
var ORCA_CALL_SOURCES = ["app", "cli", "agent"];
|
|
41107
|
+
var orcaCallSourceSchema = _enum2(ORCA_CALL_SOURCES);
|
|
41108
|
+
var orcaCallResultSchema = object({
|
|
41109
|
+
kind: _enum2(["done", "waiting", "error"]),
|
|
41110
|
+
word: string2().min(1).max(40)
|
|
41111
|
+
});
|
|
41112
|
+
var orcaCallRecordSchema = object({
|
|
41113
|
+
id: string2().min(1).max(64),
|
|
41114
|
+
at: exports_coerce.date(),
|
|
41115
|
+
kind: orcaCallKindSchema,
|
|
41116
|
+
what: string2().min(1).max(120),
|
|
41117
|
+
source: orcaCallSourceSchema,
|
|
41118
|
+
to: union([orcaHostNameSchema, literal("all")]),
|
|
41119
|
+
result: orcaCallResultSchema,
|
|
41120
|
+
durationMs: number2().int().nonnegative()
|
|
41121
|
+
});
|
|
41122
|
+
var orcaCallSchema = orcaCallRecordSchema.extend({
|
|
41123
|
+
from: string2().min(1)
|
|
41124
|
+
});
|
|
41125
|
+
var orcaProblemSchema = object({
|
|
41126
|
+
kind: _enum2(["error", "waiting"]),
|
|
41127
|
+
title: string2().min(1),
|
|
41128
|
+
body: string2().min(1),
|
|
41129
|
+
action: object({ label: string2().min(1), callIds: array(string2()) }).nullable()
|
|
41130
|
+
});
|
|
41131
|
+
var orcaBridgeInfoSchema = object({
|
|
41132
|
+
reachable: boolean2(),
|
|
41133
|
+
address: string2(),
|
|
41134
|
+
host: orcaHostNameSchema.nullable(),
|
|
41135
|
+
version: string2().nullable(),
|
|
41136
|
+
runningSince: exports_coerce.date().nullable()
|
|
41137
|
+
});
|
|
41138
|
+
var orcaBridgeHealthSchema = object({
|
|
41139
|
+
ok: boolean2(),
|
|
41140
|
+
version: string2().nullish(),
|
|
41141
|
+
startedAt: exports_coerce.date().nullish()
|
|
41142
|
+
});
|
|
41143
|
+
var orcaBridgeStatusSchema = object({
|
|
41144
|
+
bridge: orcaBridgeInfoSchema.nullable(),
|
|
41145
|
+
calls: array(orcaCallSchema),
|
|
41146
|
+
problems: array(orcaProblemSchema),
|
|
41147
|
+
callsToday: number2().int().nonnegative(),
|
|
41148
|
+
keptDays: literal(ORCA_CALLS_KEPT_DAYS),
|
|
41149
|
+
token: object({ name: string2(), scopeLine: string2() })
|
|
41150
|
+
});
|
|
41151
|
+
|
|
41016
41152
|
// ../../packages/schema/src/when.ts
|
|
41017
41153
|
var WEEKDAYS = [
|
|
41018
41154
|
{ name: "sunday", dow: 0, code: "SU" },
|
|
@@ -41728,6 +41864,143 @@ function toCollectionTypeSummary(config) {
|
|
|
41728
41864
|
}
|
|
41729
41865
|
var COLLECTION_TYPE_SUMMARIES = COLLECTION_TYPE_LIST.map(toCollectionTypeSummary);
|
|
41730
41866
|
|
|
41867
|
+
// ../../packages/domain/src/date.ts
|
|
41868
|
+
function orUndefined(value) {
|
|
41869
|
+
return value && value.trim() !== "" ? value : undefined;
|
|
41870
|
+
}
|
|
41871
|
+
var formatters = new Map;
|
|
41872
|
+
function dateTimeFormat(locale, options) {
|
|
41873
|
+
const key = `${locale ?? ""}|${JSON.stringify(options)}`;
|
|
41874
|
+
let formatter = formatters.get(key);
|
|
41875
|
+
if (!formatter) {
|
|
41876
|
+
formatter = new Intl.DateTimeFormat(locale, options);
|
|
41877
|
+
formatters.set(key, formatter);
|
|
41878
|
+
}
|
|
41879
|
+
return formatter;
|
|
41880
|
+
}
|
|
41881
|
+
var STYLES = ["dateStyle", "timeStyle"];
|
|
41882
|
+
var DATE_FIELDS = ["weekday", "year", "month", "day", ...STYLES];
|
|
41883
|
+
var hasAny = (o, keys) => keys.some((k) => o[k] !== undefined);
|
|
41884
|
+
var wordMonth = (o) => o.month !== undefined && o.month !== "numeric" && o.month !== "2-digit" || o.dateStyle !== undefined && o.dateStyle !== "short";
|
|
41885
|
+
var isEnglish = (formatter) => formatter.resolvedOptions().locale.split("-")[0] === "en";
|
|
41886
|
+
var DATE_PARTS = ["weekday", "day", "month", "year"];
|
|
41887
|
+
var CLOCK_PARTS = new Set(["hour", "minute", "second", "fractionalSecond", "dayPeriod"]);
|
|
41888
|
+
function dayFirstEnglish(formatter, at) {
|
|
41889
|
+
const parts = formatter.formatToParts(at);
|
|
41890
|
+
const clock = parts.flatMap((p, i) => CLOCK_PARTS.has(p.type) ? [i] : []);
|
|
41891
|
+
const date = DATE_PARTS.flatMap((type) => {
|
|
41892
|
+
const value = parts.find((p) => p.type === type)?.value;
|
|
41893
|
+
if (value === undefined)
|
|
41894
|
+
return [];
|
|
41895
|
+
return [type === "month" ? value.replace(/^Sept$/, "Sep") : value];
|
|
41896
|
+
}).join(" ");
|
|
41897
|
+
if (clock.length === 0)
|
|
41898
|
+
return date;
|
|
41899
|
+
const time = parts.slice(clock[0], (clock.at(-1) ?? 0) + 1).map((p) => p.value).join("");
|
|
41900
|
+
return `${date}, ${time}`;
|
|
41901
|
+
}
|
|
41902
|
+
function formatDate(value, opts = {}) {
|
|
41903
|
+
const { locale, timeZone, ...format } = opts;
|
|
41904
|
+
const options = { ...format, timeZone: orUndefined(timeZone) };
|
|
41905
|
+
if (!hasAny(options, DATE_FIELDS)) {
|
|
41906
|
+
Object.assign(options, { year: "numeric", month: "numeric", day: "numeric" });
|
|
41907
|
+
}
|
|
41908
|
+
const formatter = dateTimeFormat(orUndefined(locale), options);
|
|
41909
|
+
if (wordMonth(options) && isEnglish(formatter))
|
|
41910
|
+
return dayFirstEnglish(formatter, new Date(value));
|
|
41911
|
+
if (options.weekday && options.day && !options.month && !options.year) {
|
|
41912
|
+
const parts = formatter.formatToParts(new Date(value));
|
|
41913
|
+
const weekday = parts.findIndex((p) => p.type === "weekday");
|
|
41914
|
+
const day = parts.findIndex((p) => p.type === "day");
|
|
41915
|
+
if (day < weekday)
|
|
41916
|
+
return `${parts[weekday]?.value} ${parts[day]?.value}`;
|
|
41917
|
+
}
|
|
41918
|
+
return formatter.format(new Date(value));
|
|
41919
|
+
}
|
|
41920
|
+
function formatTime(value, opts = {}) {
|
|
41921
|
+
const { locale, timeZone, ...format } = opts;
|
|
41922
|
+
const options = {
|
|
41923
|
+
hour: "numeric",
|
|
41924
|
+
minute: "2-digit",
|
|
41925
|
+
...format,
|
|
41926
|
+
timeZone: orUndefined(timeZone)
|
|
41927
|
+
};
|
|
41928
|
+
return dateTimeFormat(orUndefined(locale), options).format(new Date(value));
|
|
41929
|
+
}
|
|
41930
|
+
function formatClock(value, opts = {}) {
|
|
41931
|
+
return formatTime(value, { ...opts, hour: "2-digit", minute: "2-digit", hourCycle: "h23" });
|
|
41932
|
+
}
|
|
41933
|
+
function dayInZone(now, zone) {
|
|
41934
|
+
return dateTimeFormat("en-CA", {
|
|
41935
|
+
timeZone: zone,
|
|
41936
|
+
year: "numeric",
|
|
41937
|
+
month: "2-digit",
|
|
41938
|
+
day: "2-digit"
|
|
41939
|
+
}).format(now);
|
|
41940
|
+
}
|
|
41941
|
+
function dayOfUtc(t) {
|
|
41942
|
+
const d = new Date(t);
|
|
41943
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
41944
|
+
return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}`;
|
|
41945
|
+
}
|
|
41946
|
+
function utcOfDay(day) {
|
|
41947
|
+
const [y, m, d] = day.split("-").map(Number);
|
|
41948
|
+
return Date.UTC(y, m - 1, d);
|
|
41949
|
+
}
|
|
41950
|
+
function shiftDay2(day, n) {
|
|
41951
|
+
return dayOfUtc(utcOfDay(day) + n * 86400000);
|
|
41952
|
+
}
|
|
41953
|
+
function mondayOfDay(day) {
|
|
41954
|
+
const weekday = (new Date(utcOfDay(day)).getUTCDay() + 6) % 7;
|
|
41955
|
+
return shiftDay2(day, -weekday);
|
|
41956
|
+
}
|
|
41957
|
+
|
|
41958
|
+
// ../../packages/domain/src/agent-machines.ts
|
|
41959
|
+
var plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
41960
|
+
function machineSummaryTiles(summary) {
|
|
41961
|
+
const { machines, sessions, reachable } = summary;
|
|
41962
|
+
return [
|
|
41963
|
+
{
|
|
41964
|
+
value: plural(machines.total, "machine", "machines"),
|
|
41965
|
+
line: `${machines.awake} awake, ${machines.asleep} asleep`
|
|
41966
|
+
},
|
|
41967
|
+
{
|
|
41968
|
+
value: plural(sessions.total, "session", "sessions"),
|
|
41969
|
+
line: `${sessions.running} running, ${sessions.waitingForYou} waiting for you`
|
|
41970
|
+
},
|
|
41971
|
+
{ value: `${reachable.count} of ${reachable.total}`, line: "reachable through Orca" }
|
|
41972
|
+
];
|
|
41973
|
+
}
|
|
41974
|
+
function reachabilityWord(m, { timeZone } = {}) {
|
|
41975
|
+
const { reachable, route, since } = m.orca;
|
|
41976
|
+
if (!reachable) {
|
|
41977
|
+
return {
|
|
41978
|
+
text: since ? `Orca unreachable since ${formatClock(since, { timeZone })}` : "Orca unreachable",
|
|
41979
|
+
kind: "error"
|
|
41980
|
+
};
|
|
41981
|
+
}
|
|
41982
|
+
const how = route === "same-machine" ? ", it lives here" : route === "local" ? ", local network" : route === "tailnet" ? ", over the tailnet" : "";
|
|
41983
|
+
return { text: `Orca reachable${how}`, kind: "done" };
|
|
41984
|
+
}
|
|
41985
|
+
function lastSeen(m, now, timeZone) {
|
|
41986
|
+
if (m.orca.reachable)
|
|
41987
|
+
return "Now";
|
|
41988
|
+
if (!m.lastSeenAt)
|
|
41989
|
+
return "Never";
|
|
41990
|
+
const zone = timeZone || Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
41991
|
+
return dayInZone(m.lastSeenAt, zone) === dayInZone(now, zone) ? formatClock(m.lastSeenAt, { timeZone }) : formatDate(m.lastSeenAt, { timeZone, day: "numeric", month: "short" });
|
|
41992
|
+
}
|
|
41993
|
+
function machineFacts(m, { now = new Date, timeZone } = {}) {
|
|
41994
|
+
const disk = m.disk && m.disk.totalGb > 0 ? `${Math.round(m.disk.usedGb / m.disk.totalGb * 100)}% used` : "Unknown";
|
|
41995
|
+
const fourth = m.updatesWaiting && m.updatesWaiting > 0 ? { label: "Updates", value: `${m.updatesWaiting} waiting` } : m.battery ? { label: "Battery", value: m.battery === "charging" ? "Charging" : "On battery" } : m.uptimeDays !== null ? { label: "Uptime", value: plural(m.uptimeDays, "day", "days") } : { label: "Uptime", value: "Unknown" };
|
|
41996
|
+
return [
|
|
41997
|
+
{ label: "Sessions", value: String(m.sessions) },
|
|
41998
|
+
{ label: "Last seen", value: lastSeen(m, now, timeZone) },
|
|
41999
|
+
{ label: "Disk", value: disk },
|
|
42000
|
+
fourth
|
|
42001
|
+
];
|
|
42002
|
+
}
|
|
42003
|
+
|
|
41731
42004
|
// src/output.ts
|
|
41732
42005
|
function resolveOutputMode(io, flags) {
|
|
41733
42006
|
const json = flags.json === true || !io.isTty;
|
|
@@ -42214,6 +42487,57 @@ var ORCA_STATUS = {
|
|
|
42214
42487
|
idle: "idle",
|
|
42215
42488
|
waiting: "waiting for you"
|
|
42216
42489
|
};
|
|
42490
|
+
function renderOrcaMachines(data, mode) {
|
|
42491
|
+
const parsed = orcaMachinesSchema.safeParse(data);
|
|
42492
|
+
if (!parsed.success)
|
|
42493
|
+
return renderRecord(data, mode);
|
|
42494
|
+
const { machines, summary } = parsed.data;
|
|
42495
|
+
if (machines.length === 0)
|
|
42496
|
+
return paint(mode, "dim", "No machines: Orca isn't connected to this Space.");
|
|
42497
|
+
const lines = [
|
|
42498
|
+
machineSummaryTiles(summary).map((t) => `${t.value} ${paint(mode, "dim", `(${t.line})`)}`).join(" \xB7 ")
|
|
42499
|
+
];
|
|
42500
|
+
for (const m of machines) {
|
|
42501
|
+
const reach = reachabilityWord(m);
|
|
42502
|
+
lines.push("");
|
|
42503
|
+
lines.push(`${m.host}${m.role ? paint(mode, "dim", ` ${m.role}`) : ""}`);
|
|
42504
|
+
lines.push(` ${paint(mode, reach.kind === "error" ? "yellow" : "green", reach.text)}`);
|
|
42505
|
+
if (m.orca.error)
|
|
42506
|
+
lines.push(paint(mode, "dim", ` ${m.orca.error}`));
|
|
42507
|
+
if (m.os)
|
|
42508
|
+
lines.push(paint(mode, "dim", ` ${m.os}`));
|
|
42509
|
+
lines.push(` ${machineFacts(m).map((f) => `${f.label}: ${f.value}`).join(" \xB7 ")}`);
|
|
42510
|
+
}
|
|
42511
|
+
return lines.join(`
|
|
42512
|
+
`);
|
|
42513
|
+
}
|
|
42514
|
+
function renderOrcaStatus(data, mode) {
|
|
42515
|
+
const parsed = orcaBridgeStatusSchema.safeParse(data);
|
|
42516
|
+
if (!parsed.success)
|
|
42517
|
+
return renderRecord(data, mode);
|
|
42518
|
+
const { bridge, calls, problems, callsToday, keptDays } = parsed.data;
|
|
42519
|
+
if (!bridge)
|
|
42520
|
+
return paint(mode, "dim", "Orca isn't connected to this Space.");
|
|
42521
|
+
const where = [bridge.address, bridge.host ? `on ${bridge.host}` : null, bridge.version].filter(Boolean).join(" \xB7 ");
|
|
42522
|
+
const lines = [
|
|
42523
|
+
`${paint(mode, bridge.reachable ? "green" : "yellow", bridge.reachable ? "Bridge answers" : "Bridge doesn't answer")} ${paint(mode, "dim", where)}`
|
|
42524
|
+
];
|
|
42525
|
+
if (bridge.runningSince) {
|
|
42526
|
+
lines.push(paint(mode, "dim", ` running since ${bridge.runningSince.toISOString()}`));
|
|
42527
|
+
}
|
|
42528
|
+
for (const p of problems) {
|
|
42529
|
+
lines.push("");
|
|
42530
|
+
lines.push(paint(mode, p.kind === "error" ? "yellow" : "dim", p.title));
|
|
42531
|
+
lines.push(` ${p.body}`);
|
|
42532
|
+
}
|
|
42533
|
+
lines.push("");
|
|
42534
|
+
lines.push(paint(mode, "dim", `${callsToday} calls today \xB7 kept ${keptDays} days`));
|
|
42535
|
+
for (const c of calls) {
|
|
42536
|
+
lines.push(` ${c.at.toISOString().slice(0, 16).replace("T", " ")} ${c.kind.padEnd(4)} ${c.what} ${paint(mode, "dim", `${c.from} \u2192 ${c.to}`)} ${c.result.word}`);
|
|
42537
|
+
}
|
|
42538
|
+
return lines.join(`
|
|
42539
|
+
`);
|
|
42540
|
+
}
|
|
42217
42541
|
function renderOrca(data, mode) {
|
|
42218
42542
|
const v = data ?? {};
|
|
42219
42543
|
if (v.state === "not_configured")
|
|
@@ -47201,45 +47525,6 @@ var commands16 = [
|
|
|
47201
47525
|
}
|
|
47202
47526
|
];
|
|
47203
47527
|
|
|
47204
|
-
// ../../packages/domain/src/date.ts
|
|
47205
|
-
var formatters = new Map;
|
|
47206
|
-
function dateTimeFormat(locale, options) {
|
|
47207
|
-
const key = `${locale ?? ""}|${JSON.stringify(options)}`;
|
|
47208
|
-
let formatter = formatters.get(key);
|
|
47209
|
-
if (!formatter) {
|
|
47210
|
-
formatter = new Intl.DateTimeFormat(locale, options);
|
|
47211
|
-
formatters.set(key, formatter);
|
|
47212
|
-
}
|
|
47213
|
-
return formatter;
|
|
47214
|
-
}
|
|
47215
|
-
var STYLES = ["dateStyle", "timeStyle"];
|
|
47216
|
-
var DATE_FIELDS = ["weekday", "year", "month", "day", ...STYLES];
|
|
47217
|
-
var CLOCK_PARTS = new Set(["hour", "minute", "second", "fractionalSecond", "dayPeriod"]);
|
|
47218
|
-
function dayInZone(now, zone) {
|
|
47219
|
-
return dateTimeFormat("en-CA", {
|
|
47220
|
-
timeZone: zone,
|
|
47221
|
-
year: "numeric",
|
|
47222
|
-
month: "2-digit",
|
|
47223
|
-
day: "2-digit"
|
|
47224
|
-
}).format(now);
|
|
47225
|
-
}
|
|
47226
|
-
function dayOfUtc(t) {
|
|
47227
|
-
const d = new Date(t);
|
|
47228
|
-
const pad = (n) => String(n).padStart(2, "0");
|
|
47229
|
-
return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}`;
|
|
47230
|
-
}
|
|
47231
|
-
function utcOfDay(day) {
|
|
47232
|
-
const [y, m, d] = day.split("-").map(Number);
|
|
47233
|
-
return Date.UTC(y, m - 1, d);
|
|
47234
|
-
}
|
|
47235
|
-
function shiftDay2(day, n) {
|
|
47236
|
-
return dayOfUtc(utcOfDay(day) + n * 86400000);
|
|
47237
|
-
}
|
|
47238
|
-
function mondayOfDay(day) {
|
|
47239
|
-
const weekday = (new Date(utcOfDay(day)).getUTCDay() + 6) % 7;
|
|
47240
|
-
return shiftDay2(day, -weekday);
|
|
47241
|
-
}
|
|
47242
|
-
|
|
47243
47528
|
// src/commands/food.ts
|
|
47244
47529
|
var commands17 = [
|
|
47245
47530
|
{
|
|
@@ -47937,7 +48222,7 @@ var SCHEDULE_FLAGS = [
|
|
|
47937
48222
|
},
|
|
47938
48223
|
{ name: "data", type: "string", description: "JSON for any other field of the contract." }
|
|
47939
48224
|
];
|
|
47940
|
-
var SCHEDULE_NOTES =
|
|
48225
|
+
var SCHEDULE_NOTES = 'One of --every-day, --on mo,we,fr, --every 3d|2w [--from YYYY-MM-DD], --monthly 1|last sets its schedule; days it isn\'t due never break the streak. Without one, it keeps `period` + `frequencyCount` (3\xD7 a week). A schedule that follows the waste calendar goes in --data: `{"schedule":{"kind":"event","sourceId":"<its connection id>","match":"bin collection","offset":"day_before_evening"}}` (or `same_day`; a match naming a kind, "PMD", follows only those pickups). The reply\'s `nextDue` lists its next 4 due days. --time 16:30|morning|midday|evening and --for 20m put it on your do calendar at that time on each due day (a part of day at 08:00, 12:30 or 19:00; 15 minutes without --for).';
|
|
47941
48226
|
function localToday() {
|
|
47942
48227
|
const now = new Date;
|
|
47943
48228
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -48246,7 +48531,7 @@ var commands20 = [
|
|
|
48246
48531
|
],
|
|
48247
48532
|
scopes: [...habitOperations.due.scopes],
|
|
48248
48533
|
returns: "HabitDueDate[]",
|
|
48249
|
-
notes: `${routeOf(habitOperations.due)}?from=&to=. Your saved time zone's days, both ends included. One row per habit per due day: \`time\` (HH:MM or null), \`scheduleLabel\`, \`daily\` (due every day) and \`streakLabel\` (\`N days\` daily, \`N in a row\` otherwise). Paused days
|
|
48534
|
+
notes: `${routeOf(habitOperations.due)}?from=&to=. Your saved time zone's days, both ends included. One row per habit per due day: \`time\` (HH:MM or null), \`scheduleLabel\`, \`daily\` (due every day) and \`streakLabel\` (\`N days\` daily, \`N in a row\` otherwise). Paused days and quit habits are left out; an event-scheduled habit sits on its event days.`
|
|
48250
48535
|
},
|
|
48251
48536
|
run: async ({ flags, requireClient }) => {
|
|
48252
48537
|
const from = flagString(flags, "from");
|
|
@@ -52890,6 +53175,30 @@ var commands35 = [
|
|
|
52890
53175
|
},
|
|
52891
53176
|
run: readOperation(orcaOperations.overview, renderOrca)
|
|
52892
53177
|
},
|
|
53178
|
+
{
|
|
53179
|
+
spec: {
|
|
53180
|
+
path: ["orca", "machines"],
|
|
53181
|
+
summary: "List the machines Orca knows: health beside Orca reachability.",
|
|
53182
|
+
args: [],
|
|
53183
|
+
flags: [],
|
|
53184
|
+
scopes: [...orcaOperations.machines.scopes],
|
|
53185
|
+
returns: "OrcaMachines",
|
|
53186
|
+
notes: "Each machine's OS, disk, memory, load, updates, uptime or battery (null where it can't be read), whether Orca reaches it (route, since, why not), its repos, agents and sessions; summary holds the counts. A machine Orca can't reach is still listed. Read live; nothing is stored."
|
|
53187
|
+
},
|
|
53188
|
+
run: readOperation(orcaOperations.machines, renderOrcaMachines)
|
|
53189
|
+
},
|
|
53190
|
+
{
|
|
53191
|
+
spec: {
|
|
53192
|
+
path: ["orca", "status"],
|
|
53193
|
+
summary: "Show the Orca bridge's status, its calls this week and its problems.",
|
|
53194
|
+
args: [],
|
|
53195
|
+
flags: [],
|
|
53196
|
+
scopes: [...orcaOperations.status.scopes],
|
|
53197
|
+
returns: "OrcaBridgeStatus",
|
|
53198
|
+
notes: "The bridge (reachable, address, the machine it runs on, version, running since), the calls do and the agent made through it over the last 7 days, newest first (metadata only, never output), callsToday, and the problems in plain words. Read live."
|
|
53199
|
+
},
|
|
53200
|
+
run: readOperation(orcaOperations.status, renderOrcaStatus)
|
|
53201
|
+
},
|
|
52893
53202
|
{
|
|
52894
53203
|
spec: {
|
|
52895
53204
|
path: ["orca", "output"],
|
package/package.json
CHANGED