@wirecat/cli-core 0.622.0 → 0.624.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 +108 -0
- package/dist/background/backfill.d.ts +1 -1
- package/dist/background/backfill.js +1 -1
- package/dist/background/budget.d.ts +2 -0
- package/dist/background/report/stored-templates.d.ts +21 -3
- package/dist/background/report/stored-templates.js +34 -6
- package/dist/background/schedules.d.ts +10 -27
- package/dist/background/schedules.js +8 -167
- package/dist/background/timers.d.ts +19 -0
- package/dist/background/timers.js +175 -0
- package/dist/background/when.d.ts +49 -0
- package/dist/background/when.js +84 -0
- package/dist/calendar/mcp/index.d.ts +12 -12
- package/dist/calendar/prepare.d.ts +14 -0
- package/dist/cli/app-doctor-command.js +2 -1
- package/dist/cli/envelope.d.ts +28 -0
- package/dist/cli/index.d.ts +3 -2
- package/dist/cli/index.js +3 -2
- package/dist/cli/messenger/messages-search-command.js +4 -0
- package/dist/cli/program.js +6 -3
- package/dist/cli/schedule/schedule-command.d.ts +100 -3
- package/dist/cli/schedule/schedule-command.js +277 -113
- package/dist/cli/templates-command.js +45 -20
- package/dist/domain/display-names.d.ts +19 -0
- package/dist/domain/display-names.js +59 -0
- package/dist/domain/person-kinds.d.ts +9 -0
- package/dist/domain/person-kinds.js +67 -0
- package/dist/entities/index.d.ts +2 -1
- package/dist/entities/list-results.d.ts +2 -0
- package/dist/entities/list-results.js +2 -0
- package/dist/entities/template.d.ts +1 -1
- package/dist/entities/template.js +1 -1
- package/dist/errors/reasons.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mcp/surface.js +23 -2
- package/dist/search/lucene/resolved.d.ts +1 -0
- package/dist/search/lucene/types.d.ts +8 -0
- package/dist/search/lucene/types.js +7 -0
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/messages-combined.js +3 -2
- package/dist/services/messages-discovery.js +3 -2
- package/dist/services/messages-search.js +1 -0
- package/dist/services/messages.d.ts +2 -0
- package/dist/services/people.js +1 -1
- package/dist/services/search-harder.d.ts +6 -1
- package/dist/services/search-harder.js +9 -2
- package/dist/store/identity-links.d.ts +3 -3
- package/dist/store/identity-links.js +3 -3
- package/dist/store/index.d.ts +3 -0
- package/dist/store/index.js +3 -0
- package/dist/store/people.d.ts +21 -2
- package/dist/store/people.js +35 -15
- package/dist/store/sqlite/lucene.js +12 -11
- package/dist/store/sqlite/manifest.js +1 -0
- package/dist/store/sqlite/migrations.generated.js +7 -0
- package/dist/store/sqlite/name-traces.d.ts +17 -0
- package/dist/store/sqlite/name-traces.js +112 -0
- package/dist/store/sqlite/notes.js +6 -3
- package/dist/store/sqlite/people-list.d.ts +59 -0
- package/dist/store/sqlite/people-list.js +275 -0
- package/dist/store/sqlite/person-match-scan.js +33 -0
- package/dist/store/sqlite/person-ties.d.ts +14 -0
- package/dist/store/sqlite/person-ties.js +66 -0
- package/dist/store/sqlite/schema.d.ts +16 -0
- package/dist/store/sqlite/schema.js +3 -0
- package/package.json +3 -3
- package/parity.json +29 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { rmSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { CliError, writeSecurely } from "@wirecat/cli-base";
|
|
4
|
+
import { describeWhen, localStamp, onCalendar, slotsOf, WEEKDAYS, WINDOWS_DAYS } from "./when.js";
|
|
5
|
+
const systemdQuote = (value) => `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"').replaceAll("%", "%%").replaceAll("$", "$$$$")}"`;
|
|
6
|
+
const xml = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
7
|
+
const checked = async (system, env, argv, allowFailure = false) => {
|
|
8
|
+
const ran = await system.run(argv, env);
|
|
9
|
+
if (ran.code !== 0 && !allowFailure) {
|
|
10
|
+
throw new CliError("configuration_error", `${argv[0]} failed: ${(ran.stderr || ran.stdout).trim()}`);
|
|
11
|
+
}
|
|
12
|
+
return ran;
|
|
13
|
+
};
|
|
14
|
+
export const systemdTimer = (app, system, env, home) => {
|
|
15
|
+
const folder = join(env.XDG_CONFIG_HOME ?? join(home, ".config"), "systemd", "user");
|
|
16
|
+
const unit = (name) => `${app.command}-schedule-${name}`;
|
|
17
|
+
return {
|
|
18
|
+
where: (name) => join(folder, `${unit(name)}.timer`),
|
|
19
|
+
install: async (schedule, argv) => {
|
|
20
|
+
const { when } = schedule;
|
|
21
|
+
writeSecurely(join(folder, `${unit(schedule.name)}.service`), [
|
|
22
|
+
"[Unit]",
|
|
23
|
+
`Description=${app.command} schedule ${schedule.name}`,
|
|
24
|
+
"",
|
|
25
|
+
"[Service]",
|
|
26
|
+
"Type=oneshot",
|
|
27
|
+
`ExecStart=${argv.map(systemdQuote).join(" ")}`,
|
|
28
|
+
"",
|
|
29
|
+
].join("\n"), 0o644);
|
|
30
|
+
writeSecurely(join(folder, `${unit(schedule.name)}.timer`), [
|
|
31
|
+
"[Unit]",
|
|
32
|
+
`Description=${app.command} schedule ${schedule.name} — ${describeWhen(when)}`,
|
|
33
|
+
"",
|
|
34
|
+
"[Timer]",
|
|
35
|
+
...("every" in when
|
|
36
|
+
? // From when a run ends: counted from its start, a run longer than the interval left no next run.
|
|
37
|
+
[`OnActiveSec=${when.every}min`, `OnUnitInactiveSec=${when.every}min`]
|
|
38
|
+
: // Persistent: a run missed while the machine slept happens when it wakes.
|
|
39
|
+
[...onCalendar(when).map((value) => `OnCalendar=${value}`), "Persistent=true"]),
|
|
40
|
+
"",
|
|
41
|
+
"[Install]",
|
|
42
|
+
"WantedBy=timers.target",
|
|
43
|
+
"",
|
|
44
|
+
].join("\n"), 0o644);
|
|
45
|
+
await checked(system, env, ["systemctl", "--user", "daemon-reload"]);
|
|
46
|
+
await checked(system, env, ["systemctl", "--user", "enable", "--now", `${unit(schedule.name)}.timer`]);
|
|
47
|
+
},
|
|
48
|
+
remove: async (name) => {
|
|
49
|
+
await checked(system, env, ["systemctl", "--user", "disable", "--now", `${unit(name)}.timer`], true);
|
|
50
|
+
rmSync(join(folder, `${unit(name)}.timer`), { force: true });
|
|
51
|
+
rmSync(join(folder, `${unit(name)}.service`), { force: true });
|
|
52
|
+
await checked(system, env, ["systemctl", "--user", "daemon-reload"]);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export const launchdTimer = (app, system, env, home) => {
|
|
57
|
+
const folder = join(home, "Library", "LaunchAgents");
|
|
58
|
+
const label = (name) => `${app.appName}.schedule.${name}`;
|
|
59
|
+
const plist = (name) => join(folder, `${label(name)}.plist`);
|
|
60
|
+
const domain = `gui/${system.uid}`;
|
|
61
|
+
const entry = ({ at, on }, once) => {
|
|
62
|
+
const [hour, minute] = at.split(":").map(Number);
|
|
63
|
+
return [
|
|
64
|
+
" <dict>",
|
|
65
|
+
// launchd has no year: a one-off is a yearly date, and the run removes it.
|
|
66
|
+
...(once
|
|
67
|
+
? [
|
|
68
|
+
` <key>Month</key><integer>${once.getMonth() + 1}</integer>`,
|
|
69
|
+
` <key>Day</key><integer>${once.getDate()}</integer>`,
|
|
70
|
+
]
|
|
71
|
+
: []),
|
|
72
|
+
// launchd counts Sunday as 0.
|
|
73
|
+
...(on ? [` <key>Weekday</key><integer>${(WEEKDAYS.indexOf(on) + 1) % 7}</integer>`] : []),
|
|
74
|
+
` <key>Hour</key><integer>${hour}</integer>`,
|
|
75
|
+
` <key>Minute</key><integer>${minute}</integer>`,
|
|
76
|
+
" </dict>",
|
|
77
|
+
];
|
|
78
|
+
};
|
|
79
|
+
const calendar = (when) => {
|
|
80
|
+
if ("every" in when)
|
|
81
|
+
return [` <key>StartInterval</key><integer>${when.every * 60}</integer>`];
|
|
82
|
+
const entries = "once" in when
|
|
83
|
+
? entry({ at: localStamp(when.once).slice(11, 16) }, new Date(when.once))
|
|
84
|
+
: slotsOf(when).flatMap((slot) => entry(slot));
|
|
85
|
+
return [" <key>StartCalendarInterval</key>", " <array>", ...entries, " </array>"];
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
where: plist,
|
|
89
|
+
install: async (schedule, argv) => {
|
|
90
|
+
await checked(system, env, ["launchctl", "bootout", `${domain}/${label(schedule.name)}`], true);
|
|
91
|
+
writeSecurely(plist(schedule.name), [
|
|
92
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
93
|
+
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
|
|
94
|
+
'<plist version="1.0">',
|
|
95
|
+
"<dict>",
|
|
96
|
+
` <key>Label</key><string>${xml(label(schedule.name))}</string>`,
|
|
97
|
+
" <key>ProgramArguments</key>",
|
|
98
|
+
" <array>",
|
|
99
|
+
...argv.map((word) => ` <string>${xml(word)}</string>`),
|
|
100
|
+
" </array>",
|
|
101
|
+
...calendar(schedule.when),
|
|
102
|
+
"</dict>",
|
|
103
|
+
"</plist>",
|
|
104
|
+
"",
|
|
105
|
+
].join("\n"), 0o644);
|
|
106
|
+
await checked(system, env, ["launchctl", "bootstrap", domain, plist(schedule.name)]);
|
|
107
|
+
},
|
|
108
|
+
remove: async (name) => {
|
|
109
|
+
await checked(system, env, ["launchctl", "bootout", `${domain}/${label(name)}`], true);
|
|
110
|
+
rmSync(plist(name), { force: true });
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Task Scheduler through PowerShell's ScheduledTasks module. The values travel in variables, never in
|
|
116
|
+
* the script, so nothing needs quoting for PowerShell; Windows has no per-task environment, which is why
|
|
117
|
+
* the runner reads its variables from the schedule file.
|
|
118
|
+
*/
|
|
119
|
+
export const windowsTimer = (app, system, env) => {
|
|
120
|
+
const path = `\\${app.appName}\\`;
|
|
121
|
+
const powershell = (script, values, allowFailure = false) => checked(system, { ...env, ...values }, ["powershell.exe", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", script], allowFailure);
|
|
122
|
+
return {
|
|
123
|
+
where: (name) => `Task Scheduler ${path}${name}`,
|
|
124
|
+
install: async (schedule, [exe = "", ...args]) => {
|
|
125
|
+
const { when } = schedule;
|
|
126
|
+
await powershell([
|
|
127
|
+
"$ErrorActionPreference = 'Stop'",
|
|
128
|
+
"$action = New-ScheduledTaskAction -Execute $env:WIRECAT_EXE -Argument $env:WIRECAT_ARGS",
|
|
129
|
+
"$trigger = switch ($env:WIRECAT_KIND) {",
|
|
130
|
+
" 'every' { New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes ([int]$env:WIRECAT_MINUTES)) }",
|
|
131
|
+
" 'daily' { New-ScheduledTaskTrigger -Daily -At $env:WIRECAT_AT }",
|
|
132
|
+
" 'weekly' { New-ScheduledTaskTrigger -Weekly -DaysOfWeek $env:WIRECAT_DAY -At $env:WIRECAT_AT }",
|
|
133
|
+
" 'calendar' { @(foreach ($slot in $env:WIRECAT_SLOTS.Split(';')) { $day, $at = $slot.Split('|'); if ($day) { New-ScheduledTaskTrigger -Weekly -DaysOfWeek $day -At $at } else { New-ScheduledTaskTrigger -Daily -At $at } }) }",
|
|
134
|
+
" 'once' { New-ScheduledTaskTrigger -Once -At ([datetime]::ParseExact($env:WIRECAT_AT, 'yyyy-MM-dd HH:mm:ss', $null)) }",
|
|
135
|
+
"}",
|
|
136
|
+
"$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -MultipleInstances IgnoreNew",
|
|
137
|
+
"Register-ScheduledTask -TaskName $env:WIRECAT_NAME -TaskPath $env:WIRECAT_PATH -Action $action -Trigger $trigger -Settings $settings -Force | Out-Null",
|
|
138
|
+
].join("\n"), {
|
|
139
|
+
WIRECAT_EXE: exe,
|
|
140
|
+
WIRECAT_ARGS: args.map((word) => `"${word.replaceAll('"', '\\"')}"`).join(" "),
|
|
141
|
+
WIRECAT_KIND: "every" in when
|
|
142
|
+
? "every"
|
|
143
|
+
: "once" in when
|
|
144
|
+
? "once"
|
|
145
|
+
: "calendar" in when
|
|
146
|
+
? "calendar"
|
|
147
|
+
: "daily" in when
|
|
148
|
+
? "daily"
|
|
149
|
+
: "weekly",
|
|
150
|
+
WIRECAT_MINUTES: "every" in when ? String(when.every) : "",
|
|
151
|
+
WIRECAT_AT: "once" in when ? localStamp(when.once) : "daily" in when ? when.daily : "weekly" in when ? when.weekly : "",
|
|
152
|
+
WIRECAT_DAY: "weekly" in when ? WINDOWS_DAYS[when.on] : "",
|
|
153
|
+
WIRECAT_SLOTS: "calendar" in when
|
|
154
|
+
? when.calendar.map((slot) => `${slot.on ? WINDOWS_DAYS[slot.on] : ""}|${slot.at}`).join(";")
|
|
155
|
+
: "",
|
|
156
|
+
WIRECAT_NAME: schedule.name,
|
|
157
|
+
WIRECAT_PATH: path,
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
remove: async (name) => {
|
|
161
|
+
await powershell("Unregister-ScheduledTask -TaskName $env:WIRECAT_NAME -TaskPath $env:WIRECAT_PATH -Confirm:$false", { WIRECAT_NAME: name, WIRECAT_PATH: path }, true);
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
export const timerFor = (app, system, env) => {
|
|
166
|
+
if (system.platform === "win32")
|
|
167
|
+
return windowsTimer(app, system, env);
|
|
168
|
+
if (!env.HOME)
|
|
169
|
+
throw new CliError("configuration_error", "HOME is not set, so there is nowhere to put the timer");
|
|
170
|
+
if (system.platform === "linux")
|
|
171
|
+
return systemdTimer(app, system, env, env.HOME);
|
|
172
|
+
if (system.platform === "darwin")
|
|
173
|
+
return launchdTimer(app, system, env, env.HOME);
|
|
174
|
+
throw new CliError("validation_error", `${app.command} schedule knows Linux, macOS and Windows, not ${system.platform}`);
|
|
175
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** The days `--on` takes, Monday first. */
|
|
2
|
+
export declare const WEEKDAYS: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
3
|
+
export type Weekday = (typeof WEEKDAYS)[number];
|
|
4
|
+
/** One calendar time: `HH:MM` local, every day or on one weekday. */
|
|
5
|
+
export interface Slot {
|
|
6
|
+
at: string;
|
|
7
|
+
on?: Weekday;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Minutes between runs, a daily local time, a weekday's local time, several of either, or one local moment. One
|
|
11
|
+
* `--at` keeps the `daily` or `weekly` shape that schedules were saved in before `calendar` existed.
|
|
12
|
+
*/
|
|
13
|
+
export type When = {
|
|
14
|
+
every: number;
|
|
15
|
+
} | {
|
|
16
|
+
daily: string;
|
|
17
|
+
} | {
|
|
18
|
+
weekly: string;
|
|
19
|
+
on: Weekday;
|
|
20
|
+
} | {
|
|
21
|
+
calendar: Slot[];
|
|
22
|
+
} | {
|
|
23
|
+
once: string;
|
|
24
|
+
};
|
|
25
|
+
export type CalendarWhen = Extract<When, {
|
|
26
|
+
daily: string;
|
|
27
|
+
} | {
|
|
28
|
+
weekly: string;
|
|
29
|
+
} | {
|
|
30
|
+
calendar: Slot[];
|
|
31
|
+
}>;
|
|
32
|
+
export declare const WINDOWS_DAYS: Record<Weekday, string>;
|
|
33
|
+
export declare const isCalendar: (when: When) => when is CalendarWhen;
|
|
34
|
+
/** A calendar schedule's times, whichever shape it was saved in. */
|
|
35
|
+
export declare const slotsOf: (when: CalendarWhen) => Slot[];
|
|
36
|
+
/** The shape a schedule is saved in: one slot as `daily` or `weekly`, so files and their wording stay as they were. */
|
|
37
|
+
export declare const calendarOf: (slots: readonly Slot[]) => CalendarWhen;
|
|
38
|
+
export declare const describeWhen: (when: When) => string;
|
|
39
|
+
/** systemd's `OnCalendar=` values: one per slot, as a timer may carry several. */
|
|
40
|
+
export declare const onCalendar: (when: Exclude<When, {
|
|
41
|
+
every: number;
|
|
42
|
+
}>) => string[];
|
|
43
|
+
/** The local moments of a calendar schedule's runs from `from` (inclusive) to `to` (exclusive), oldest first. */
|
|
44
|
+
export declare const runsBetween: (when: CalendarWhen, from: number, to: number) => number[];
|
|
45
|
+
/** The run a calendar schedule has next after `now`, or the one before or at it; eight days hold every slot. */
|
|
46
|
+
export declare const nextRun: (when: CalendarWhen, now: number) => number | undefined;
|
|
47
|
+
export declare const previousRun: (when: CalendarWhen, now: number) => number | undefined;
|
|
48
|
+
/** A local wall-clock time, as both systemd's `OnCalendar=` and PowerShell's parser take it. */
|
|
49
|
+
export declare const localStamp: (iso: string) => string;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/** The days `--on` takes, Monday first. */
|
|
2
|
+
export const WEEKDAYS = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
3
|
+
const SYSTEMD_DAYS = {
|
|
4
|
+
mon: "Mon",
|
|
5
|
+
tue: "Tue",
|
|
6
|
+
wed: "Wed",
|
|
7
|
+
thu: "Thu",
|
|
8
|
+
fri: "Fri",
|
|
9
|
+
sat: "Sat",
|
|
10
|
+
sun: "Sun",
|
|
11
|
+
};
|
|
12
|
+
export const WINDOWS_DAYS = {
|
|
13
|
+
mon: "Monday",
|
|
14
|
+
tue: "Tuesday",
|
|
15
|
+
wed: "Wednesday",
|
|
16
|
+
thu: "Thursday",
|
|
17
|
+
fri: "Friday",
|
|
18
|
+
sat: "Saturday",
|
|
19
|
+
sun: "Sunday",
|
|
20
|
+
};
|
|
21
|
+
export const isCalendar = (when) => "daily" in when || "weekly" in when || "calendar" in when;
|
|
22
|
+
/** A calendar schedule's times, whichever shape it was saved in. */
|
|
23
|
+
export const slotsOf = (when) => "daily" in when ? [{ at: when.daily }] : "weekly" in when ? [{ at: when.weekly, on: when.on }] : when.calendar;
|
|
24
|
+
/** The shape a schedule is saved in: one slot as `daily` or `weekly`, so files and their wording stay as they were. */
|
|
25
|
+
export const calendarOf = (slots) => {
|
|
26
|
+
const seen = new Map(slots.map((slot) => [`${slot.on ?? ""} ${slot.at}`, slot]));
|
|
27
|
+
const unique = [...seen.values()].sort((a, b) => (a.on ? WEEKDAYS.indexOf(a.on) : -1) - (b.on ? WEEKDAYS.indexOf(b.on) : -1) || a.at.localeCompare(b.at));
|
|
28
|
+
const [one] = unique;
|
|
29
|
+
if (unique.length === 1 && one)
|
|
30
|
+
return one.on ? { weekly: one.at, on: one.on } : { daily: one.at };
|
|
31
|
+
return { calendar: unique };
|
|
32
|
+
};
|
|
33
|
+
const describeSlots = (slots) => {
|
|
34
|
+
const times = [...new Set(slots.map((slot) => slot.at))].sort();
|
|
35
|
+
const days = [...new Set(slots.flatMap((slot) => (slot.on ? [slot.on] : [])))];
|
|
36
|
+
if (days.length === 0)
|
|
37
|
+
return `daily at ${times.join(", ")}`;
|
|
38
|
+
if (slots.every((slot) => slot.on) && slots.length === times.length * days.length)
|
|
39
|
+
return `weekly on ${days.map((day) => SYSTEMD_DAYS[day]).join(", ")} at ${times.join(", ")}`;
|
|
40
|
+
return `at ${slots.map((slot) => (slot.on ? `${SYSTEMD_DAYS[slot.on]} ${slot.at}` : `daily ${slot.at}`)).join(", ")}`;
|
|
41
|
+
};
|
|
42
|
+
export const describeWhen = (when) => "every" in when
|
|
43
|
+
? `every ${when.every % 1440 === 0 ? `${when.every / 1440}d` : when.every % 60 === 0 ? `${when.every / 60}h` : `${when.every}m`}`
|
|
44
|
+
: "once" in when
|
|
45
|
+
? `once at ${when.once}`
|
|
46
|
+
: describeSlots(slotsOf(when));
|
|
47
|
+
/** systemd's `OnCalendar=` values: one per slot, as a timer may carry several. */
|
|
48
|
+
export const onCalendar = (when) => "once" in when
|
|
49
|
+
? [localStamp(when.once)]
|
|
50
|
+
: slotsOf(when).map((slot) => (slot.on ? `${SYSTEMD_DAYS[slot.on]} *-*-* ${slot.at}:00` : `*-*-* ${slot.at}:00`));
|
|
51
|
+
/** The local moments of a calendar schedule's runs from `from` (inclusive) to `to` (exclusive), oldest first. */
|
|
52
|
+
export const runsBetween = (when, from, to) => {
|
|
53
|
+
const slots = slotsOf(when);
|
|
54
|
+
const moments = [];
|
|
55
|
+
const day = new Date(from);
|
|
56
|
+
day.setHours(0, 0, 0, 0);
|
|
57
|
+
for (; day.getTime() < to; day.setDate(day.getDate() + 1)) {
|
|
58
|
+
const weekday = WEEKDAYS[(day.getDay() + 6) % 7];
|
|
59
|
+
for (const slot of slots) {
|
|
60
|
+
if (slot.on && slot.on !== weekday)
|
|
61
|
+
continue;
|
|
62
|
+
const [hour, minute] = slot.at.split(":").map(Number);
|
|
63
|
+
const at = new Date(day.getFullYear(), day.getMonth(), day.getDate(), hour, minute).getTime();
|
|
64
|
+
if (at >= from && at < to)
|
|
65
|
+
moments.push(at);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return moments.sort((a, b) => a - b);
|
|
69
|
+
};
|
|
70
|
+
/** `days` calendar days from `at`, at the same wall-clock time: a week across a clock change is not 168 hours. */
|
|
71
|
+
const daysFrom = (at, days) => {
|
|
72
|
+
const moved = new Date(at);
|
|
73
|
+
moved.setDate(moved.getDate() + days);
|
|
74
|
+
return moved.getTime();
|
|
75
|
+
};
|
|
76
|
+
/** The run a calendar schedule has next after `now`, or the one before or at it; eight days hold every slot. */
|
|
77
|
+
export const nextRun = (when, now) => runsBetween(when, now + 1, daysFrom(now, 8))[0];
|
|
78
|
+
export const previousRun = (when, now) => runsBetween(when, daysFrom(now, -8), now + 1).at(-1);
|
|
79
|
+
/** A local wall-clock time, as both systemd's `OnCalendar=` and PowerShell's parser take it. */
|
|
80
|
+
export const localStamp = (iso) => {
|
|
81
|
+
const at = new Date(iso);
|
|
82
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
83
|
+
return `${at.getFullYear()}-${two(at.getMonth() + 1)}-${two(at.getDate())} ${two(at.getHours())}:${two(at.getMinutes())}:${two(at.getSeconds())}`;
|
|
84
|
+
};
|
|
@@ -10,13 +10,13 @@ export declare const calendarTools: ({
|
|
|
10
10
|
inputSchema: {
|
|
11
11
|
type: string;
|
|
12
12
|
properties: {
|
|
13
|
-
limit?: undefined;
|
|
14
13
|
account_id: {
|
|
15
14
|
type: string;
|
|
16
15
|
minimum: number;
|
|
17
16
|
};
|
|
18
17
|
query?: undefined;
|
|
19
18
|
timezone?: undefined;
|
|
19
|
+
limit?: undefined;
|
|
20
20
|
page?: undefined;
|
|
21
21
|
event?: undefined;
|
|
22
22
|
} | {
|
|
@@ -45,9 +45,9 @@ export declare const calendarTools: ({
|
|
|
45
45
|
};
|
|
46
46
|
event?: undefined;
|
|
47
47
|
} | {
|
|
48
|
-
limit?: undefined;
|
|
49
48
|
query?: undefined;
|
|
50
49
|
timezone?: undefined;
|
|
50
|
+
limit?: undefined;
|
|
51
51
|
page?: undefined;
|
|
52
52
|
event: {
|
|
53
53
|
type: string;
|
|
@@ -58,9 +58,9 @@ export declare const calendarTools: ({
|
|
|
58
58
|
minimum: number;
|
|
59
59
|
};
|
|
60
60
|
} | {
|
|
61
|
-
limit?: undefined;
|
|
62
61
|
query?: undefined;
|
|
63
62
|
timezone?: undefined;
|
|
63
|
+
limit?: undefined;
|
|
64
64
|
page?: undefined;
|
|
65
65
|
event?: undefined;
|
|
66
66
|
account_id?: undefined;
|
|
@@ -80,13 +80,13 @@ export declare const calendarTools: ({
|
|
|
80
80
|
inputSchema: {
|
|
81
81
|
type: string;
|
|
82
82
|
properties: {
|
|
83
|
-
limit?: undefined;
|
|
84
83
|
account_id: {
|
|
85
84
|
type: string;
|
|
86
85
|
minimum: number;
|
|
87
86
|
};
|
|
88
87
|
query?: undefined;
|
|
89
88
|
timezone?: undefined;
|
|
89
|
+
limit?: undefined;
|
|
90
90
|
page?: undefined;
|
|
91
91
|
event?: undefined;
|
|
92
92
|
} | {
|
|
@@ -115,9 +115,9 @@ export declare const calendarTools: ({
|
|
|
115
115
|
};
|
|
116
116
|
event?: undefined;
|
|
117
117
|
} | {
|
|
118
|
-
limit?: undefined;
|
|
119
118
|
query?: undefined;
|
|
120
119
|
timezone?: undefined;
|
|
120
|
+
limit?: undefined;
|
|
121
121
|
page?: undefined;
|
|
122
122
|
event: {
|
|
123
123
|
type: string;
|
|
@@ -128,9 +128,9 @@ export declare const calendarTools: ({
|
|
|
128
128
|
minimum: number;
|
|
129
129
|
};
|
|
130
130
|
} | {
|
|
131
|
-
limit?: undefined;
|
|
132
131
|
query?: undefined;
|
|
133
132
|
timezone?: undefined;
|
|
133
|
+
limit?: undefined;
|
|
134
134
|
page?: undefined;
|
|
135
135
|
event?: undefined;
|
|
136
136
|
account_id?: undefined;
|
|
@@ -150,13 +150,13 @@ export declare const calendarTools: ({
|
|
|
150
150
|
inputSchema: {
|
|
151
151
|
type: string;
|
|
152
152
|
properties: {
|
|
153
|
-
limit?: undefined;
|
|
154
153
|
account_id: {
|
|
155
154
|
type: string;
|
|
156
155
|
minimum: number;
|
|
157
156
|
};
|
|
158
157
|
query?: undefined;
|
|
159
158
|
timezone?: undefined;
|
|
159
|
+
limit?: undefined;
|
|
160
160
|
page?: undefined;
|
|
161
161
|
event?: undefined;
|
|
162
162
|
} | {
|
|
@@ -185,9 +185,9 @@ export declare const calendarTools: ({
|
|
|
185
185
|
};
|
|
186
186
|
event?: undefined;
|
|
187
187
|
} | {
|
|
188
|
-
limit?: undefined;
|
|
189
188
|
query?: undefined;
|
|
190
189
|
timezone?: undefined;
|
|
190
|
+
limit?: undefined;
|
|
191
191
|
page?: undefined;
|
|
192
192
|
event: {
|
|
193
193
|
type: string;
|
|
@@ -198,9 +198,9 @@ export declare const calendarTools: ({
|
|
|
198
198
|
minimum: number;
|
|
199
199
|
};
|
|
200
200
|
} | {
|
|
201
|
-
limit?: undefined;
|
|
202
201
|
query?: undefined;
|
|
203
202
|
timezone?: undefined;
|
|
203
|
+
limit?: undefined;
|
|
204
204
|
page?: undefined;
|
|
205
205
|
event?: undefined;
|
|
206
206
|
account_id?: undefined;
|
|
@@ -220,13 +220,13 @@ export declare const calendarTools: ({
|
|
|
220
220
|
inputSchema: {
|
|
221
221
|
type: string;
|
|
222
222
|
properties: {
|
|
223
|
-
limit?: undefined;
|
|
224
223
|
account_id: {
|
|
225
224
|
type: string;
|
|
226
225
|
minimum: number;
|
|
227
226
|
};
|
|
228
227
|
query?: undefined;
|
|
229
228
|
timezone?: undefined;
|
|
229
|
+
limit?: undefined;
|
|
230
230
|
page?: undefined;
|
|
231
231
|
event?: undefined;
|
|
232
232
|
} | {
|
|
@@ -255,9 +255,9 @@ export declare const calendarTools: ({
|
|
|
255
255
|
};
|
|
256
256
|
event?: undefined;
|
|
257
257
|
} | {
|
|
258
|
-
limit?: undefined;
|
|
259
258
|
query?: undefined;
|
|
260
259
|
timezone?: undefined;
|
|
260
|
+
limit?: undefined;
|
|
261
261
|
page?: undefined;
|
|
262
262
|
event: {
|
|
263
263
|
type: string;
|
|
@@ -268,9 +268,9 @@ export declare const calendarTools: ({
|
|
|
268
268
|
minimum: number;
|
|
269
269
|
};
|
|
270
270
|
} | {
|
|
271
|
-
limit?: undefined;
|
|
272
271
|
query?: undefined;
|
|
273
272
|
timezone?: undefined;
|
|
273
|
+
limit?: undefined;
|
|
274
274
|
page?: undefined;
|
|
275
275
|
event?: undefined;
|
|
276
276
|
account_id?: undefined;
|
|
@@ -139,5 +139,19 @@ export declare const eventPreparation: (details: EventDetails, options: Preparat
|
|
|
139
139
|
since?: string | undefined;
|
|
140
140
|
until?: string | undefined;
|
|
141
141
|
} | undefined;
|
|
142
|
+
ranking?: {
|
|
143
|
+
applied: boolean;
|
|
144
|
+
reason_id?: string | undefined;
|
|
145
|
+
provider: string;
|
|
146
|
+
model: string;
|
|
147
|
+
endpoint: string;
|
|
148
|
+
sent: number;
|
|
149
|
+
cost_usd: number | null;
|
|
150
|
+
usage?: {
|
|
151
|
+
input: number;
|
|
152
|
+
output: number;
|
|
153
|
+
} | undefined;
|
|
154
|
+
ms: number;
|
|
155
|
+
} | undefined;
|
|
142
156
|
}, "accounts" | "complete" | "issues" | "truncated">;
|
|
143
157
|
}>;
|
|
@@ -2,6 +2,7 @@ import { existsSync } from "node:fs";
|
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
3
|
import { CliError, configFilePath, resolvePaths } from "@wirecat/cli-base";
|
|
4
4
|
import { annotate } from "@wirecat/cli-base/commands";
|
|
5
|
+
import { hostFetch } from "@wirecat/cli-base/http";
|
|
5
6
|
import { timezoneOf } from "@wirecat/cli-base/query";
|
|
6
7
|
import { clockMeta } from "@wirecat/cli-base/standards";
|
|
7
8
|
import { isNewer, latestVersion } from "@wirecat/cli-base/update";
|
|
@@ -149,7 +150,7 @@ export const appDoctorCommand = (app, configuration, options = {}) => profileFre
|
|
|
149
150
|
const local = localCheck(env, options);
|
|
150
151
|
const answer = async () => {
|
|
151
152
|
const online = this.opts().online
|
|
152
|
-
? await onlineCheck(app, env, environment.fetch ??
|
|
153
|
+
? await onlineCheck(app, env, environment.fetch ?? hostFetch({ hosts: ["registry.npmjs.org"] }), options)
|
|
153
154
|
: undefined;
|
|
154
155
|
const output = outputFor(this);
|
|
155
156
|
renderAnswer(this, output, itemOf({ ...report, ...local.fields, ...(online ? { online } : {}) }, { meta: clockMeta(Date.now(), timezoneOf()) }));
|
package/dist/cli/envelope.d.ts
CHANGED
|
@@ -101,6 +101,20 @@ export declare const answerSchema: (item?: v.GenericSchema) => v.UnionSchema<[v.
|
|
|
101
101
|
readonly since: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
102
102
|
readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
103
103
|
}, undefined>, undefined>;
|
|
104
|
+
readonly ranking: v.OptionalSchema<v.StrictObjectSchema<{
|
|
105
|
+
readonly applied: v.BooleanSchema<undefined>;
|
|
106
|
+
readonly reason_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>, undefined>;
|
|
107
|
+
readonly provider: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
108
|
+
readonly model: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
109
|
+
readonly endpoint: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
110
|
+
readonly sent: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
111
|
+
readonly cost_usd: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
112
|
+
readonly usage: v.OptionalSchema<v.StrictObjectSchema<{
|
|
113
|
+
readonly input: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
114
|
+
readonly output: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
115
|
+
}, undefined>, undefined>;
|
|
116
|
+
readonly ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
117
|
+
}, undefined>, undefined>;
|
|
104
118
|
}, undefined>;
|
|
105
119
|
}, undefined>, v.StrictObjectSchema<{
|
|
106
120
|
readonly item: v.GenericSchema;
|
|
@@ -156,6 +170,20 @@ export declare const answerSchema: (item?: v.GenericSchema) => v.UnionSchema<[v.
|
|
|
156
170
|
readonly since: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
157
171
|
readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
158
172
|
}, undefined>, undefined>;
|
|
173
|
+
readonly ranking: v.OptionalSchema<v.StrictObjectSchema<{
|
|
174
|
+
readonly applied: v.BooleanSchema<undefined>;
|
|
175
|
+
readonly reason_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>, undefined>;
|
|
176
|
+
readonly provider: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
177
|
+
readonly model: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
178
|
+
readonly endpoint: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
179
|
+
readonly sent: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
180
|
+
readonly cost_usd: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
181
|
+
readonly usage: v.OptionalSchema<v.StrictObjectSchema<{
|
|
182
|
+
readonly input: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
183
|
+
readonly output: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
184
|
+
}, undefined>, undefined>;
|
|
185
|
+
readonly ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
186
|
+
}, undefined>, undefined>;
|
|
159
187
|
}, undefined>;
|
|
160
188
|
}, undefined>], undefined>;
|
|
161
189
|
/**
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AI_ENTRIES, AI_SETTING_KEYS, type AISettings, resolveAISettings } from "../analysis/settings.js";
|
|
2
|
-
export {
|
|
2
|
+
export { parseRoute, ROUTE_HELP, routeText } from "../background/deliver.js";
|
|
3
|
+
export { AGENT_INPUT_MAX_CHARS, type AgentCli, type AgentInput, type CalendarWhen, calendarOf, describeWhen, isCalendar, lastRun, nextRun, previousRun, readSchedule, runsBetween, SCHEDULE_DEFAULTS, type Schedule, type Slot, scheduleFile, scheduleName, slotsOf, spentToday, WEEKDAYS, type Weekday, type When, } from "../background/schedules.js";
|
|
3
4
|
export { parseDuration } from "../domain/duration.js";
|
|
4
5
|
export { openOf, PROFILE_PLACEHOLDER, type ProfilesFor, profilesOn, type RefOpen, type RefSummary, refLabel, storedProfilesFor, type WritesWith, writesWithOf, } from "../domain/ref-summaries.js";
|
|
5
6
|
/** The shared entities `person_context`, `organization_context`, `deal_context` and `deal_context.brief`. */
|
|
@@ -133,7 +134,7 @@ export { type ProjectTextHints, projectAnswerParts, projectCutoffTime, projectEv
|
|
|
133
134
|
export { type ProjectStatusHints, type ProjectStatusItem, projectStatusAnswer, projectStatusRow, projectStatusSchema, projectStatusText, } from "./project-status.js";
|
|
134
135
|
export { STATUS_ROWS, STATUS_SIGNAL_ROWS } from "./project-status-rows.js";
|
|
135
136
|
export { fieldsOf, projectFields } from "./result-fields.js";
|
|
136
|
-
export { backfillScheduleRun, SCHEDULE_SETTINGS, type ScheduleHost, type ScheduleLimits, scheduleLimitsOf, } from "./schedule/schedule-command.js";
|
|
137
|
+
export { type AgentScheduleSpec, agentSchedule, backfillScheduleRun, type Harness, pauseSchedule, removeSchedule, runScheduleNow, SCHEDULE_SETTINGS, type ScheduleHost, type ScheduleLimits, type ScheduleSite, scheduleLimitsOf, scheduleState, slotsOfAt, writeSchedule, } from "./schedule/schedule-command.js";
|
|
137
138
|
export { deniedKinds, deniedKindsOf, type LeftOut, type SearchedKind } from "./search-left-out.js";
|
|
138
139
|
export { type DeclaredSetting, type SettingRow, settingRows, withSettingDefaults } from "./setting-defaults.js";
|
|
139
140
|
export { type Config, type Configuration, count, first, flag, fromFile, type GlobalFlags, NONE_NAMED, namedProfile, type ProfileKind, plain, type ResolveOptions, type Settings, type SettingsExtension, type SettingsExtensionContext, type Source, settingsFor, } from "./settings.js";
|
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AI_ENTRIES, AI_SETTING_KEYS, resolveAISettings } from "../analysis/settings.js";
|
|
2
|
-
export {
|
|
2
|
+
export { parseRoute, ROUTE_HELP, routeText } from "../background/deliver.js";
|
|
3
|
+
export { AGENT_INPUT_MAX_CHARS, calendarOf, describeWhen, isCalendar, lastRun, nextRun, previousRun, readSchedule, runsBetween, SCHEDULE_DEFAULTS, scheduleFile, scheduleName, slotsOf, spentToday, WEEKDAYS, } from "../background/schedules.js";
|
|
3
4
|
export { parseDuration } from "../domain/duration.js";
|
|
4
5
|
export { openOf, PROFILE_PLACEHOLDER, profilesOn, refLabel, storedProfilesFor, writesWithOf, } from "../domain/ref-summaries.js";
|
|
5
6
|
/** The shared entities `person_context`, `organization_context`, `deal_context` and `deal_context.brief`. */
|
|
@@ -123,7 +124,7 @@ export { projectAnswerParts, projectCutoffTime, projectEvidenceText, projectWind
|
|
|
123
124
|
export { projectStatusAnswer, projectStatusRow, projectStatusSchema, projectStatusText, } from "./project-status.js";
|
|
124
125
|
export { STATUS_ROWS, STATUS_SIGNAL_ROWS } from "./project-status-rows.js";
|
|
125
126
|
export { fieldsOf, projectFields } from "./result-fields.js";
|
|
126
|
-
export { backfillScheduleRun, SCHEDULE_SETTINGS, scheduleLimitsOf, } from "./schedule/schedule-command.js";
|
|
127
|
+
export { agentSchedule, backfillScheduleRun, pauseSchedule, removeSchedule, runScheduleNow, SCHEDULE_SETTINGS, scheduleLimitsOf, scheduleState, slotsOfAt, writeSchedule, } from "./schedule/schedule-command.js";
|
|
127
128
|
export { deniedKinds, deniedKindsOf } from "./search-left-out.js";
|
|
128
129
|
export { settingRows, withSettingDefaults } from "./setting-defaults.js";
|
|
129
130
|
export { count, first, flag, fromFile, NONE_NAMED, namedProfile, plain, settingsFor, } from "./settings.js";
|
|
@@ -6,6 +6,7 @@ import { SAVE_HELP } from "../../meetings/index.js";
|
|
|
6
6
|
import { syncsOneChat } from "../../ports/traits.js";
|
|
7
7
|
import { renderMessages } from "../../render/messages.js";
|
|
8
8
|
import { renderThreadLinks } from "../../render/thread-context.js";
|
|
9
|
+
import { searchTimeLimit } from "../../search/lucene/types.js";
|
|
9
10
|
import { environmentOf } from "../context.js";
|
|
10
11
|
import { REMOTE_READ } from "../effects.js";
|
|
11
12
|
import { renderAnswer } from "../envelope.js";
|
|
@@ -69,6 +70,7 @@ const searchAction = (messenger) => async function (given) {
|
|
|
69
70
|
context.track({ close: async () => controller.abort() });
|
|
70
71
|
const external = environmentOf(this).signal;
|
|
71
72
|
const signal = external ? AbortSignal.any([external, controller.signal]) : controller.signal;
|
|
73
|
+
const timeLimitMs = searchTimeLimit(environmentOf(this).deadline?.());
|
|
72
74
|
const typed = {
|
|
73
75
|
...(source === undefined ? {} : { source }),
|
|
74
76
|
...(discover === undefined ? {} : { discover }),
|
|
@@ -91,6 +93,7 @@ const searchAction = (messenger) => async function (given) {
|
|
|
91
93
|
limit,
|
|
92
94
|
...withOffset(page, limit),
|
|
93
95
|
signal,
|
|
96
|
+
...(timeLimitMs === undefined ? {} : { timeLimitMs }),
|
|
94
97
|
newest: newest === true,
|
|
95
98
|
context: around ?? (context.format === "pretty" ? 2 : 0),
|
|
96
99
|
});
|
|
@@ -110,6 +113,7 @@ const searchAction = (messenger) => async function (given) {
|
|
|
110
113
|
limit,
|
|
111
114
|
...withOffset(page, limit),
|
|
112
115
|
signal,
|
|
116
|
+
...(timeLimitMs === undefined ? {} : { timeLimitMs }),
|
|
113
117
|
newest: params.newest === true,
|
|
114
118
|
...(params.discover === undefined ? {} : { discover: params.discover }),
|
|
115
119
|
...(params.exact ? { exact: true } : {}),
|
package/dist/cli/program.js
CHANGED
|
@@ -170,7 +170,10 @@ const runOnce = async (argv, definition, options) => {
|
|
|
170
170
|
let afterPhase;
|
|
171
171
|
let running;
|
|
172
172
|
const startDeadline = (ms) => {
|
|
173
|
-
running =
|
|
173
|
+
running =
|
|
174
|
+
ms === undefined
|
|
175
|
+
? undefined
|
|
176
|
+
: { endsAt: Date.now() + ms, ms, ...(explicitEnd === undefined ? {} : { explicit: true }) };
|
|
174
177
|
control.start(ms);
|
|
175
178
|
};
|
|
176
179
|
let finished = false;
|
|
@@ -418,11 +421,11 @@ const runOnce = async (argv, definition, options) => {
|
|
|
418
421
|
});
|
|
419
422
|
throw new Relayed(code);
|
|
420
423
|
}
|
|
424
|
+
if (timeout !== undefined && deadline !== undefined)
|
|
425
|
+
explicitEnd = Date.now() + deadline;
|
|
421
426
|
startDeadline(deadline);
|
|
422
427
|
oneShot = deadline;
|
|
423
428
|
afterPhase = timeout !== undefined || persistent || job || interactiveLogin ? deadline : DEFAULT_COMMAND_MS;
|
|
424
|
-
if (timeout !== undefined && deadline !== undefined)
|
|
425
|
-
explicitEnd = Date.now() + deadline;
|
|
426
429
|
// An agent's run shares this process's directory; a chat folder's name is not a path to resolve.
|
|
427
430
|
if (options.relayed && !options.agent)
|
|
428
431
|
absolutePaths(action, options.relayed.cwd);
|