@kl-c/matrixos 0.3.48 → 0.3.49
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/cli/cron.d.ts +5 -0
- package/dist/cli/index.js +1336 -119
- package/dist/cli/service.d.ts +1 -0
- package/dist/cli-node/index.js +1336 -119
- package/dist/features/cron/store.d.ts +2 -3
- package/dist/features/dashboard/data-provider.d.ts +16 -0
- package/dist/features/dashboard/frontend/css/style.css +9 -0
- package/dist/features/dashboard/frontend/index.html +22 -0
- package/dist/features/dashboard/frontend/js/api.js +3 -0
- package/dist/features/dashboard/frontend/js/app.js +39 -5
- package/dist/index.js +53 -14
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2163,7 +2163,7 @@ var package_default;
|
|
|
2163
2163
|
var init_package = __esm(() => {
|
|
2164
2164
|
package_default = {
|
|
2165
2165
|
name: "@kl-c/matrixos",
|
|
2166
|
-
version: "0.3.
|
|
2166
|
+
version: "0.3.49",
|
|
2167
2167
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
2168
2168
|
main: "./dist/index.js",
|
|
2169
2169
|
types: "dist/index.d.ts",
|
|
@@ -164733,15 +164733,35 @@ var require_picomatch2 = __commonJS((exports2, module2) => {
|
|
|
164733
164733
|
});
|
|
164734
164734
|
|
|
164735
164735
|
// packages/omo-opencode/src/features/cron/store.ts
|
|
164736
|
+
import { Database as Database2 } from "bun:sqlite";
|
|
164737
|
+
import { homedir as homedir22 } from "os";
|
|
164738
|
+
import { resolve as resolve12 } from "path";
|
|
164739
|
+
function openDb() {
|
|
164740
|
+
const db = new Database2(DB_PATH);
|
|
164741
|
+
db.run(`CREATE TABLE IF NOT EXISTS matrixos_cron (
|
|
164742
|
+
id TEXT PRIMARY KEY,
|
|
164743
|
+
name TEXT NOT NULL,
|
|
164744
|
+
schedule TEXT NOT NULL,
|
|
164745
|
+
command TEXT NOT NULL,
|
|
164746
|
+
channel TEXT,
|
|
164747
|
+
recipient TEXT,
|
|
164748
|
+
enabled INTEGER NOT NULL DEFAULT 1,
|
|
164749
|
+
created_at TEXT NOT NULL,
|
|
164750
|
+
updated_at TEXT NOT NULL
|
|
164751
|
+
)`);
|
|
164752
|
+
return db;
|
|
164753
|
+
}
|
|
164754
|
+
function nextId() {
|
|
164755
|
+
counter += 1;
|
|
164756
|
+
return `cron-${Date.now()}-${counter}`;
|
|
164757
|
+
}
|
|
164736
164758
|
function createCronStore() {
|
|
164737
|
-
const
|
|
164738
|
-
let counter = 0;
|
|
164759
|
+
const db = openDb();
|
|
164739
164760
|
return {
|
|
164740
164761
|
add(input) {
|
|
164741
|
-
counter += 1;
|
|
164742
164762
|
const now = new Date().toISOString();
|
|
164743
164763
|
const job = {
|
|
164744
|
-
id:
|
|
164764
|
+
id: nextId(),
|
|
164745
164765
|
name: input.name,
|
|
164746
164766
|
schedule: input.schedule,
|
|
164747
164767
|
command: input.command,
|
|
@@ -164752,15 +164772,17 @@ function createCronStore() {
|
|
|
164752
164772
|
updatedAt: now
|
|
164753
164773
|
};
|
|
164754
164774
|
CronJobSchema.parse(job);
|
|
164755
|
-
|
|
164775
|
+
db.query(`INSERT INTO matrixos_cron (id, name, schedule, command, channel, recipient, enabled, created_at, updated_at)
|
|
164776
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(job.id, job.name, job.schedule, job.command, job.channel ?? null, job.recipient ?? null, job.enabled ? 1 : 0, job.createdAt, job.updatedAt);
|
|
164756
164777
|
return job;
|
|
164757
164778
|
},
|
|
164758
164779
|
get(id) {
|
|
164759
|
-
|
|
164780
|
+
const row = db.query("SELECT * FROM matrixos_cron WHERE id = ?").get(id);
|
|
164781
|
+
return row ? rowToJob(row) : undefined;
|
|
164760
164782
|
},
|
|
164761
164783
|
list(filter) {
|
|
164762
|
-
const all =
|
|
164763
|
-
return all.filter((j) => {
|
|
164784
|
+
const all = db.query("SELECT * FROM matrixos_cron ORDER BY created_at DESC").all();
|
|
164785
|
+
return all.map(rowToJob).filter((j) => {
|
|
164764
164786
|
if (filter?.enabled !== undefined && j.enabled !== filter.enabled)
|
|
164765
164787
|
return false;
|
|
164766
164788
|
if (filter?.channel && j.channel !== filter.channel)
|
|
@@ -164769,14 +164791,29 @@ function createCronStore() {
|
|
|
164769
164791
|
});
|
|
164770
164792
|
},
|
|
164771
164793
|
remove(id) {
|
|
164772
|
-
|
|
164794
|
+
const res = db.query("DELETE FROM matrixos_cron WHERE id = ?").run(id);
|
|
164795
|
+
return res.changes > 0;
|
|
164773
164796
|
},
|
|
164774
164797
|
size() {
|
|
164775
|
-
|
|
164798
|
+
const row = db.query("SELECT COUNT(*) as c FROM matrixos_cron").get();
|
|
164799
|
+
return row.c;
|
|
164776
164800
|
}
|
|
164777
164801
|
};
|
|
164778
164802
|
}
|
|
164779
|
-
|
|
164803
|
+
function rowToJob(row) {
|
|
164804
|
+
return {
|
|
164805
|
+
id: String(row.id),
|
|
164806
|
+
name: String(row.name),
|
|
164807
|
+
schedule: String(row.schedule),
|
|
164808
|
+
command: String(row.command),
|
|
164809
|
+
channel: row.channel ? row.channel : undefined,
|
|
164810
|
+
recipient: row.recipient ? String(row.recipient) : undefined,
|
|
164811
|
+
enabled: Number(row.enabled) === 1,
|
|
164812
|
+
createdAt: String(row.created_at),
|
|
164813
|
+
updatedAt: String(row.updated_at)
|
|
164814
|
+
};
|
|
164815
|
+
}
|
|
164816
|
+
var CronJobSchema, DB_PATH, counter = 0;
|
|
164780
164817
|
var init_store = __esm(() => {
|
|
164781
164818
|
init_zod();
|
|
164782
164819
|
CronJobSchema = object({
|
|
@@ -164790,6 +164827,1117 @@ var init_store = __esm(() => {
|
|
|
164790
164827
|
createdAt: string2(),
|
|
164791
164828
|
updatedAt: string2()
|
|
164792
164829
|
}).strict();
|
|
164830
|
+
DB_PATH = resolve12(homedir22(), ".local", "share", "opencode", "opencode.db");
|
|
164831
|
+
});
|
|
164832
|
+
|
|
164833
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/task.js
|
|
164834
|
+
var require_task = __commonJS((exports2, module2) => {
|
|
164835
|
+
var EventEmitter = __require("events");
|
|
164836
|
+
|
|
164837
|
+
class Task extends EventEmitter {
|
|
164838
|
+
constructor(execution) {
|
|
164839
|
+
super();
|
|
164840
|
+
if (typeof execution !== "function") {
|
|
164841
|
+
throw "execution must be a function";
|
|
164842
|
+
}
|
|
164843
|
+
this._execution = execution;
|
|
164844
|
+
}
|
|
164845
|
+
execute(now) {
|
|
164846
|
+
let exec2;
|
|
164847
|
+
try {
|
|
164848
|
+
exec2 = this._execution(now);
|
|
164849
|
+
} catch (error51) {
|
|
164850
|
+
return this.emit("task-failed", error51);
|
|
164851
|
+
}
|
|
164852
|
+
if (exec2 instanceof Promise) {
|
|
164853
|
+
return exec2.then(() => this.emit("task-finished")).catch((error51) => this.emit("task-failed", error51));
|
|
164854
|
+
} else {
|
|
164855
|
+
this.emit("task-finished");
|
|
164856
|
+
return exec2;
|
|
164857
|
+
}
|
|
164858
|
+
}
|
|
164859
|
+
}
|
|
164860
|
+
module2.exports = Task;
|
|
164861
|
+
});
|
|
164862
|
+
|
|
164863
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/convert-expression/month-names-conversion.js
|
|
164864
|
+
var require_month_names_conversion = __commonJS((exports2, module2) => {
|
|
164865
|
+
module2.exports = (() => {
|
|
164866
|
+
const months = [
|
|
164867
|
+
"january",
|
|
164868
|
+
"february",
|
|
164869
|
+
"march",
|
|
164870
|
+
"april",
|
|
164871
|
+
"may",
|
|
164872
|
+
"june",
|
|
164873
|
+
"july",
|
|
164874
|
+
"august",
|
|
164875
|
+
"september",
|
|
164876
|
+
"october",
|
|
164877
|
+
"november",
|
|
164878
|
+
"december"
|
|
164879
|
+
];
|
|
164880
|
+
const shortMonths = [
|
|
164881
|
+
"jan",
|
|
164882
|
+
"feb",
|
|
164883
|
+
"mar",
|
|
164884
|
+
"apr",
|
|
164885
|
+
"may",
|
|
164886
|
+
"jun",
|
|
164887
|
+
"jul",
|
|
164888
|
+
"aug",
|
|
164889
|
+
"sep",
|
|
164890
|
+
"oct",
|
|
164891
|
+
"nov",
|
|
164892
|
+
"dec"
|
|
164893
|
+
];
|
|
164894
|
+
function convertMonthName(expression, items) {
|
|
164895
|
+
for (let i3 = 0;i3 < items.length; i3++) {
|
|
164896
|
+
expression = expression.replace(new RegExp(items[i3], "gi"), parseInt(i3, 10) + 1);
|
|
164897
|
+
}
|
|
164898
|
+
return expression;
|
|
164899
|
+
}
|
|
164900
|
+
function interprete(monthExpression) {
|
|
164901
|
+
monthExpression = convertMonthName(monthExpression, months);
|
|
164902
|
+
monthExpression = convertMonthName(monthExpression, shortMonths);
|
|
164903
|
+
return monthExpression;
|
|
164904
|
+
}
|
|
164905
|
+
return interprete;
|
|
164906
|
+
})();
|
|
164907
|
+
});
|
|
164908
|
+
|
|
164909
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/convert-expression/week-day-names-conversion.js
|
|
164910
|
+
var require_week_day_names_conversion = __commonJS((exports2, module2) => {
|
|
164911
|
+
module2.exports = (() => {
|
|
164912
|
+
const weekDays = [
|
|
164913
|
+
"sunday",
|
|
164914
|
+
"monday",
|
|
164915
|
+
"tuesday",
|
|
164916
|
+
"wednesday",
|
|
164917
|
+
"thursday",
|
|
164918
|
+
"friday",
|
|
164919
|
+
"saturday"
|
|
164920
|
+
];
|
|
164921
|
+
const shortWeekDays = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
|
164922
|
+
function convertWeekDayName(expression, items) {
|
|
164923
|
+
for (let i3 = 0;i3 < items.length; i3++) {
|
|
164924
|
+
expression = expression.replace(new RegExp(items[i3], "gi"), parseInt(i3, 10));
|
|
164925
|
+
}
|
|
164926
|
+
return expression;
|
|
164927
|
+
}
|
|
164928
|
+
function convertWeekDays(expression) {
|
|
164929
|
+
expression = expression.replace("7", "0");
|
|
164930
|
+
expression = convertWeekDayName(expression, weekDays);
|
|
164931
|
+
return convertWeekDayName(expression, shortWeekDays);
|
|
164932
|
+
}
|
|
164933
|
+
return convertWeekDays;
|
|
164934
|
+
})();
|
|
164935
|
+
});
|
|
164936
|
+
|
|
164937
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/convert-expression/asterisk-to-range-conversion.js
|
|
164938
|
+
var require_asterisk_to_range_conversion = __commonJS((exports2, module2) => {
|
|
164939
|
+
module2.exports = (() => {
|
|
164940
|
+
function convertAsterisk(expression, replecement) {
|
|
164941
|
+
if (expression.indexOf("*") !== -1) {
|
|
164942
|
+
return expression.replace("*", replecement);
|
|
164943
|
+
}
|
|
164944
|
+
return expression;
|
|
164945
|
+
}
|
|
164946
|
+
function convertAsterisksToRanges(expressions) {
|
|
164947
|
+
expressions[0] = convertAsterisk(expressions[0], "0-59");
|
|
164948
|
+
expressions[1] = convertAsterisk(expressions[1], "0-59");
|
|
164949
|
+
expressions[2] = convertAsterisk(expressions[2], "0-23");
|
|
164950
|
+
expressions[3] = convertAsterisk(expressions[3], "1-31");
|
|
164951
|
+
expressions[4] = convertAsterisk(expressions[4], "1-12");
|
|
164952
|
+
expressions[5] = convertAsterisk(expressions[5], "0-6");
|
|
164953
|
+
return expressions;
|
|
164954
|
+
}
|
|
164955
|
+
return convertAsterisksToRanges;
|
|
164956
|
+
})();
|
|
164957
|
+
});
|
|
164958
|
+
|
|
164959
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/convert-expression/range-conversion.js
|
|
164960
|
+
var require_range_conversion = __commonJS((exports2, module2) => {
|
|
164961
|
+
module2.exports = (() => {
|
|
164962
|
+
function replaceWithRange(expression, text, init, end) {
|
|
164963
|
+
const numbers = [];
|
|
164964
|
+
let last = parseInt(end);
|
|
164965
|
+
let first = parseInt(init);
|
|
164966
|
+
if (first > last) {
|
|
164967
|
+
last = parseInt(init);
|
|
164968
|
+
first = parseInt(end);
|
|
164969
|
+
}
|
|
164970
|
+
for (let i3 = first;i3 <= last; i3++) {
|
|
164971
|
+
numbers.push(i3);
|
|
164972
|
+
}
|
|
164973
|
+
return expression.replace(new RegExp(text, "i"), numbers.join());
|
|
164974
|
+
}
|
|
164975
|
+
function convertRange(expression) {
|
|
164976
|
+
const rangeRegEx = /(\d+)-(\d+)/;
|
|
164977
|
+
let match = rangeRegEx.exec(expression);
|
|
164978
|
+
while (match !== null && match.length > 0) {
|
|
164979
|
+
expression = replaceWithRange(expression, match[0], match[1], match[2]);
|
|
164980
|
+
match = rangeRegEx.exec(expression);
|
|
164981
|
+
}
|
|
164982
|
+
return expression;
|
|
164983
|
+
}
|
|
164984
|
+
function convertAllRanges(expressions) {
|
|
164985
|
+
for (let i3 = 0;i3 < expressions.length; i3++) {
|
|
164986
|
+
expressions[i3] = convertRange(expressions[i3]);
|
|
164987
|
+
}
|
|
164988
|
+
return expressions;
|
|
164989
|
+
}
|
|
164990
|
+
return convertAllRanges;
|
|
164991
|
+
})();
|
|
164992
|
+
});
|
|
164993
|
+
|
|
164994
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/convert-expression/step-values-conversion.js
|
|
164995
|
+
var require_step_values_conversion = __commonJS((exports2, module2) => {
|
|
164996
|
+
module2.exports = (() => {
|
|
164997
|
+
function convertSteps(expressions) {
|
|
164998
|
+
var stepValuePattern = /^(.+)\/(\w+)$/;
|
|
164999
|
+
for (var i3 = 0;i3 < expressions.length; i3++) {
|
|
165000
|
+
var match = stepValuePattern.exec(expressions[i3]);
|
|
165001
|
+
var isStepValue = match !== null && match.length > 0;
|
|
165002
|
+
if (isStepValue) {
|
|
165003
|
+
var baseDivider = match[2];
|
|
165004
|
+
if (isNaN(baseDivider)) {
|
|
165005
|
+
throw baseDivider + " is not a valid step value";
|
|
165006
|
+
}
|
|
165007
|
+
var values = match[1].split(",");
|
|
165008
|
+
var stepValues = [];
|
|
165009
|
+
var divider = parseInt(baseDivider, 10);
|
|
165010
|
+
for (var j = 0;j <= values.length; j++) {
|
|
165011
|
+
var value = parseInt(values[j], 10);
|
|
165012
|
+
if (value % divider === 0) {
|
|
165013
|
+
stepValues.push(value);
|
|
165014
|
+
}
|
|
165015
|
+
}
|
|
165016
|
+
expressions[i3] = stepValues.join(",");
|
|
165017
|
+
}
|
|
165018
|
+
}
|
|
165019
|
+
return expressions;
|
|
165020
|
+
}
|
|
165021
|
+
return convertSteps;
|
|
165022
|
+
})();
|
|
165023
|
+
});
|
|
165024
|
+
|
|
165025
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/convert-expression/index.js
|
|
165026
|
+
var require_convert_expression = __commonJS((exports2, module2) => {
|
|
165027
|
+
var monthNamesConversion = require_month_names_conversion();
|
|
165028
|
+
var weekDayNamesConversion = require_week_day_names_conversion();
|
|
165029
|
+
var convertAsterisksToRanges = require_asterisk_to_range_conversion();
|
|
165030
|
+
var convertRanges = require_range_conversion();
|
|
165031
|
+
var convertSteps = require_step_values_conversion();
|
|
165032
|
+
module2.exports = (() => {
|
|
165033
|
+
function appendSeccondExpression(expressions) {
|
|
165034
|
+
if (expressions.length === 5) {
|
|
165035
|
+
return ["0"].concat(expressions);
|
|
165036
|
+
}
|
|
165037
|
+
return expressions;
|
|
165038
|
+
}
|
|
165039
|
+
function removeSpaces(str3) {
|
|
165040
|
+
return str3.replace(/\s{2,}/g, " ").trim();
|
|
165041
|
+
}
|
|
165042
|
+
function normalizeIntegers(expressions) {
|
|
165043
|
+
for (let i3 = 0;i3 < expressions.length; i3++) {
|
|
165044
|
+
const numbers = expressions[i3].split(",");
|
|
165045
|
+
for (let j = 0;j < numbers.length; j++) {
|
|
165046
|
+
numbers[j] = parseInt(numbers[j]);
|
|
165047
|
+
}
|
|
165048
|
+
expressions[i3] = numbers;
|
|
165049
|
+
}
|
|
165050
|
+
return expressions;
|
|
165051
|
+
}
|
|
165052
|
+
function interprete(expression) {
|
|
165053
|
+
let expressions = removeSpaces(expression).split(" ");
|
|
165054
|
+
expressions = appendSeccondExpression(expressions);
|
|
165055
|
+
expressions[4] = monthNamesConversion(expressions[4]);
|
|
165056
|
+
expressions[5] = weekDayNamesConversion(expressions[5]);
|
|
165057
|
+
expressions = convertAsterisksToRanges(expressions);
|
|
165058
|
+
expressions = convertRanges(expressions);
|
|
165059
|
+
expressions = convertSteps(expressions);
|
|
165060
|
+
expressions = normalizeIntegers(expressions);
|
|
165061
|
+
return expressions.join(" ");
|
|
165062
|
+
}
|
|
165063
|
+
return interprete;
|
|
165064
|
+
})();
|
|
165065
|
+
});
|
|
165066
|
+
|
|
165067
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/pattern-validation.js
|
|
165068
|
+
var require_pattern_validation = __commonJS((exports2, module2) => {
|
|
165069
|
+
var convertExpression = require_convert_expression();
|
|
165070
|
+
var validationRegex = /^(?:\d+|\*|\*\/\d+)$/;
|
|
165071
|
+
function isValidExpression(expression, min2, max2) {
|
|
165072
|
+
const options = expression.split(",");
|
|
165073
|
+
for (const option of options) {
|
|
165074
|
+
const optionAsInt = parseInt(option, 10);
|
|
165075
|
+
if (!Number.isNaN(optionAsInt) && (optionAsInt < min2 || optionAsInt > max2) || !validationRegex.test(option))
|
|
165076
|
+
return false;
|
|
165077
|
+
}
|
|
165078
|
+
return true;
|
|
165079
|
+
}
|
|
165080
|
+
function isInvalidSecond(expression) {
|
|
165081
|
+
return !isValidExpression(expression, 0, 59);
|
|
165082
|
+
}
|
|
165083
|
+
function isInvalidMinute(expression) {
|
|
165084
|
+
return !isValidExpression(expression, 0, 59);
|
|
165085
|
+
}
|
|
165086
|
+
function isInvalidHour(expression) {
|
|
165087
|
+
return !isValidExpression(expression, 0, 23);
|
|
165088
|
+
}
|
|
165089
|
+
function isInvalidDayOfMonth(expression) {
|
|
165090
|
+
return !isValidExpression(expression, 1, 31);
|
|
165091
|
+
}
|
|
165092
|
+
function isInvalidMonth(expression) {
|
|
165093
|
+
return !isValidExpression(expression, 1, 12);
|
|
165094
|
+
}
|
|
165095
|
+
function isInvalidWeekDay(expression) {
|
|
165096
|
+
return !isValidExpression(expression, 0, 7);
|
|
165097
|
+
}
|
|
165098
|
+
function validateFields(patterns, executablePatterns) {
|
|
165099
|
+
if (isInvalidSecond(executablePatterns[0]))
|
|
165100
|
+
throw new Error(`${patterns[0]} is a invalid expression for second`);
|
|
165101
|
+
if (isInvalidMinute(executablePatterns[1]))
|
|
165102
|
+
throw new Error(`${patterns[1]} is a invalid expression for minute`);
|
|
165103
|
+
if (isInvalidHour(executablePatterns[2]))
|
|
165104
|
+
throw new Error(`${patterns[2]} is a invalid expression for hour`);
|
|
165105
|
+
if (isInvalidDayOfMonth(executablePatterns[3]))
|
|
165106
|
+
throw new Error(`${patterns[3]} is a invalid expression for day of month`);
|
|
165107
|
+
if (isInvalidMonth(executablePatterns[4]))
|
|
165108
|
+
throw new Error(`${patterns[4]} is a invalid expression for month`);
|
|
165109
|
+
if (isInvalidWeekDay(executablePatterns[5]))
|
|
165110
|
+
throw new Error(`${patterns[5]} is a invalid expression for week day`);
|
|
165111
|
+
}
|
|
165112
|
+
function validate(pattern) {
|
|
165113
|
+
if (typeof pattern !== "string")
|
|
165114
|
+
throw new TypeError("pattern must be a string!");
|
|
165115
|
+
const patterns = pattern.split(" ");
|
|
165116
|
+
const executablePatterns = convertExpression(pattern).split(" ");
|
|
165117
|
+
if (patterns.length === 5)
|
|
165118
|
+
patterns.unshift("0");
|
|
165119
|
+
validateFields(patterns, executablePatterns);
|
|
165120
|
+
}
|
|
165121
|
+
module2.exports = validate;
|
|
165122
|
+
});
|
|
165123
|
+
|
|
165124
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/time-matcher.js
|
|
165125
|
+
var require_time_matcher = __commonJS((exports2, module2) => {
|
|
165126
|
+
var validatePattern = require_pattern_validation();
|
|
165127
|
+
var convertExpression = require_convert_expression();
|
|
165128
|
+
function matchPattern(pattern, value) {
|
|
165129
|
+
if (pattern.indexOf(",") !== -1) {
|
|
165130
|
+
const patterns = pattern.split(",");
|
|
165131
|
+
return patterns.indexOf(value.toString()) !== -1;
|
|
165132
|
+
}
|
|
165133
|
+
return pattern === value.toString();
|
|
165134
|
+
}
|
|
165135
|
+
|
|
165136
|
+
class TimeMatcher {
|
|
165137
|
+
constructor(pattern, timezone) {
|
|
165138
|
+
validatePattern(pattern);
|
|
165139
|
+
this.pattern = convertExpression(pattern);
|
|
165140
|
+
this.timezone = timezone;
|
|
165141
|
+
this.expressions = this.pattern.split(" ");
|
|
165142
|
+
this.dtf = this.timezone ? new Intl.DateTimeFormat("en-US", {
|
|
165143
|
+
year: "numeric",
|
|
165144
|
+
month: "2-digit",
|
|
165145
|
+
day: "2-digit",
|
|
165146
|
+
hour: "2-digit",
|
|
165147
|
+
minute: "2-digit",
|
|
165148
|
+
second: "2-digit",
|
|
165149
|
+
hourCycle: "h23",
|
|
165150
|
+
fractionalSecondDigits: 3,
|
|
165151
|
+
timeZone: this.timezone
|
|
165152
|
+
}) : null;
|
|
165153
|
+
}
|
|
165154
|
+
match(date5) {
|
|
165155
|
+
date5 = this.apply(date5);
|
|
165156
|
+
const runOnSecond = matchPattern(this.expressions[0], date5.getSeconds());
|
|
165157
|
+
const runOnMinute = matchPattern(this.expressions[1], date5.getMinutes());
|
|
165158
|
+
const runOnHour = matchPattern(this.expressions[2], date5.getHours());
|
|
165159
|
+
const runOnDay = matchPattern(this.expressions[3], date5.getDate());
|
|
165160
|
+
const runOnMonth = matchPattern(this.expressions[4], date5.getMonth() + 1);
|
|
165161
|
+
const runOnWeekDay = matchPattern(this.expressions[5], date5.getDay());
|
|
165162
|
+
return runOnSecond && runOnMinute && runOnHour && runOnDay && runOnMonth && runOnWeekDay;
|
|
165163
|
+
}
|
|
165164
|
+
apply(date5) {
|
|
165165
|
+
if (this.dtf) {
|
|
165166
|
+
return new Date(this.dtf.format(date5));
|
|
165167
|
+
}
|
|
165168
|
+
return date5;
|
|
165169
|
+
}
|
|
165170
|
+
}
|
|
165171
|
+
module2.exports = TimeMatcher;
|
|
165172
|
+
});
|
|
165173
|
+
|
|
165174
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/scheduler.js
|
|
165175
|
+
var require_scheduler = __commonJS((exports2, module2) => {
|
|
165176
|
+
var EventEmitter = __require("events");
|
|
165177
|
+
var TimeMatcher = require_time_matcher();
|
|
165178
|
+
|
|
165179
|
+
class Scheduler extends EventEmitter {
|
|
165180
|
+
constructor(pattern, timezone, autorecover) {
|
|
165181
|
+
super();
|
|
165182
|
+
this.timeMatcher = new TimeMatcher(pattern, timezone);
|
|
165183
|
+
this.autorecover = autorecover;
|
|
165184
|
+
}
|
|
165185
|
+
start() {
|
|
165186
|
+
this.stop();
|
|
165187
|
+
let lastCheck = process.hrtime();
|
|
165188
|
+
let lastExecution = this.timeMatcher.apply(new Date);
|
|
165189
|
+
const matchTime = () => {
|
|
165190
|
+
const delay = 1000;
|
|
165191
|
+
const elapsedTime = process.hrtime(lastCheck);
|
|
165192
|
+
const elapsedMs = (elapsedTime[0] * 1e9 + elapsedTime[1]) / 1e6;
|
|
165193
|
+
const missedExecutions = Math.floor(elapsedMs / 1000);
|
|
165194
|
+
for (let i3 = missedExecutions;i3 >= 0; i3--) {
|
|
165195
|
+
const date5 = new Date(new Date().getTime() - i3 * 1000);
|
|
165196
|
+
let date_tmp = this.timeMatcher.apply(date5);
|
|
165197
|
+
if (lastExecution.getTime() < date_tmp.getTime() && (i3 === 0 || this.autorecover) && this.timeMatcher.match(date5)) {
|
|
165198
|
+
this.emit("scheduled-time-matched", date_tmp);
|
|
165199
|
+
date_tmp.setMilliseconds(0);
|
|
165200
|
+
lastExecution = date_tmp;
|
|
165201
|
+
}
|
|
165202
|
+
}
|
|
165203
|
+
lastCheck = process.hrtime();
|
|
165204
|
+
this.timeout = setTimeout(matchTime, delay);
|
|
165205
|
+
};
|
|
165206
|
+
matchTime();
|
|
165207
|
+
}
|
|
165208
|
+
stop() {
|
|
165209
|
+
if (this.timeout) {
|
|
165210
|
+
clearTimeout(this.timeout);
|
|
165211
|
+
}
|
|
165212
|
+
this.timeout = null;
|
|
165213
|
+
}
|
|
165214
|
+
}
|
|
165215
|
+
module2.exports = Scheduler;
|
|
165216
|
+
});
|
|
165217
|
+
|
|
165218
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/rng.js
|
|
165219
|
+
var require_rng = __commonJS((exports2) => {
|
|
165220
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165221
|
+
value: true
|
|
165222
|
+
});
|
|
165223
|
+
exports2.default = rng;
|
|
165224
|
+
var _crypto = _interopRequireDefault(__require("crypto"));
|
|
165225
|
+
function _interopRequireDefault(obj) {
|
|
165226
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
165227
|
+
}
|
|
165228
|
+
var rnds8Pool = new Uint8Array(256);
|
|
165229
|
+
var poolPtr = rnds8Pool.length;
|
|
165230
|
+
function rng() {
|
|
165231
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
|
165232
|
+
_crypto.default.randomFillSync(rnds8Pool);
|
|
165233
|
+
poolPtr = 0;
|
|
165234
|
+
}
|
|
165235
|
+
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
165236
|
+
}
|
|
165237
|
+
});
|
|
165238
|
+
|
|
165239
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/regex.js
|
|
165240
|
+
var require_regex = __commonJS((exports2) => {
|
|
165241
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165242
|
+
value: true
|
|
165243
|
+
});
|
|
165244
|
+
exports2.default = undefined;
|
|
165245
|
+
var _default4 = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
165246
|
+
exports2.default = _default4;
|
|
165247
|
+
});
|
|
165248
|
+
|
|
165249
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/validate.js
|
|
165250
|
+
var require_validate = __commonJS((exports2) => {
|
|
165251
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165252
|
+
value: true
|
|
165253
|
+
});
|
|
165254
|
+
exports2.default = undefined;
|
|
165255
|
+
var _regex2 = _interopRequireDefault(require_regex());
|
|
165256
|
+
function _interopRequireDefault(obj) {
|
|
165257
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
165258
|
+
}
|
|
165259
|
+
function validate(uuid3) {
|
|
165260
|
+
return typeof uuid3 === "string" && _regex2.default.test(uuid3);
|
|
165261
|
+
}
|
|
165262
|
+
var _default4 = validate;
|
|
165263
|
+
exports2.default = _default4;
|
|
165264
|
+
});
|
|
165265
|
+
|
|
165266
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/stringify.js
|
|
165267
|
+
var require_stringify = __commonJS((exports2) => {
|
|
165268
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165269
|
+
value: true
|
|
165270
|
+
});
|
|
165271
|
+
exports2.default = undefined;
|
|
165272
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
165273
|
+
function _interopRequireDefault(obj) {
|
|
165274
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
165275
|
+
}
|
|
165276
|
+
var byteToHex = [];
|
|
165277
|
+
for (let i3 = 0;i3 < 256; ++i3) {
|
|
165278
|
+
byteToHex.push((i3 + 256).toString(16).substr(1));
|
|
165279
|
+
}
|
|
165280
|
+
function stringify(arr, offset = 0) {
|
|
165281
|
+
const uuid3 = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
165282
|
+
if (!(0, _validate.default)(uuid3)) {
|
|
165283
|
+
throw TypeError("Stringified UUID is invalid");
|
|
165284
|
+
}
|
|
165285
|
+
return uuid3;
|
|
165286
|
+
}
|
|
165287
|
+
var _default4 = stringify;
|
|
165288
|
+
exports2.default = _default4;
|
|
165289
|
+
});
|
|
165290
|
+
|
|
165291
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/v1.js
|
|
165292
|
+
var require_v1 = __commonJS((exports2) => {
|
|
165293
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165294
|
+
value: true
|
|
165295
|
+
});
|
|
165296
|
+
exports2.default = undefined;
|
|
165297
|
+
var _rng = _interopRequireDefault(require_rng());
|
|
165298
|
+
var _stringify = _interopRequireDefault(require_stringify());
|
|
165299
|
+
function _interopRequireDefault(obj) {
|
|
165300
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
165301
|
+
}
|
|
165302
|
+
var _nodeId;
|
|
165303
|
+
var _clockseq;
|
|
165304
|
+
var _lastMSecs = 0;
|
|
165305
|
+
var _lastNSecs = 0;
|
|
165306
|
+
function v1(options, buf, offset) {
|
|
165307
|
+
let i3 = buf && offset || 0;
|
|
165308
|
+
const b2 = buf || new Array(16);
|
|
165309
|
+
options = options || {};
|
|
165310
|
+
let node = options.node || _nodeId;
|
|
165311
|
+
let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
|
|
165312
|
+
if (node == null || clockseq == null) {
|
|
165313
|
+
const seedBytes = options.random || (options.rng || _rng.default)();
|
|
165314
|
+
if (node == null) {
|
|
165315
|
+
node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
|
165316
|
+
}
|
|
165317
|
+
if (clockseq == null) {
|
|
165318
|
+
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383;
|
|
165319
|
+
}
|
|
165320
|
+
}
|
|
165321
|
+
let msecs = options.msecs !== undefined ? options.msecs : Date.now();
|
|
165322
|
+
let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
|
|
165323
|
+
const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4;
|
|
165324
|
+
if (dt < 0 && options.clockseq === undefined) {
|
|
165325
|
+
clockseq = clockseq + 1 & 16383;
|
|
165326
|
+
}
|
|
165327
|
+
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
|
165328
|
+
nsecs = 0;
|
|
165329
|
+
}
|
|
165330
|
+
if (nsecs >= 1e4) {
|
|
165331
|
+
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
|
|
165332
|
+
}
|
|
165333
|
+
_lastMSecs = msecs;
|
|
165334
|
+
_lastNSecs = nsecs;
|
|
165335
|
+
_clockseq = clockseq;
|
|
165336
|
+
msecs += 12219292800000;
|
|
165337
|
+
const tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296;
|
|
165338
|
+
b2[i3++] = tl >>> 24 & 255;
|
|
165339
|
+
b2[i3++] = tl >>> 16 & 255;
|
|
165340
|
+
b2[i3++] = tl >>> 8 & 255;
|
|
165341
|
+
b2[i3++] = tl & 255;
|
|
165342
|
+
const tmh = msecs / 4294967296 * 1e4 & 268435455;
|
|
165343
|
+
b2[i3++] = tmh >>> 8 & 255;
|
|
165344
|
+
b2[i3++] = tmh & 255;
|
|
165345
|
+
b2[i3++] = tmh >>> 24 & 15 | 16;
|
|
165346
|
+
b2[i3++] = tmh >>> 16 & 255;
|
|
165347
|
+
b2[i3++] = clockseq >>> 8 | 128;
|
|
165348
|
+
b2[i3++] = clockseq & 255;
|
|
165349
|
+
for (let n3 = 0;n3 < 6; ++n3) {
|
|
165350
|
+
b2[i3 + n3] = node[n3];
|
|
165351
|
+
}
|
|
165352
|
+
return buf || (0, _stringify.default)(b2);
|
|
165353
|
+
}
|
|
165354
|
+
var _default4 = v1;
|
|
165355
|
+
exports2.default = _default4;
|
|
165356
|
+
});
|
|
165357
|
+
|
|
165358
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/parse.js
|
|
165359
|
+
var require_parse4 = __commonJS((exports2) => {
|
|
165360
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165361
|
+
value: true
|
|
165362
|
+
});
|
|
165363
|
+
exports2.default = undefined;
|
|
165364
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
165365
|
+
function _interopRequireDefault(obj) {
|
|
165366
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
165367
|
+
}
|
|
165368
|
+
function parse8(uuid3) {
|
|
165369
|
+
if (!(0, _validate.default)(uuid3)) {
|
|
165370
|
+
throw TypeError("Invalid UUID");
|
|
165371
|
+
}
|
|
165372
|
+
let v;
|
|
165373
|
+
const arr = new Uint8Array(16);
|
|
165374
|
+
arr[0] = (v = parseInt(uuid3.slice(0, 8), 16)) >>> 24;
|
|
165375
|
+
arr[1] = v >>> 16 & 255;
|
|
165376
|
+
arr[2] = v >>> 8 & 255;
|
|
165377
|
+
arr[3] = v & 255;
|
|
165378
|
+
arr[4] = (v = parseInt(uuid3.slice(9, 13), 16)) >>> 8;
|
|
165379
|
+
arr[5] = v & 255;
|
|
165380
|
+
arr[6] = (v = parseInt(uuid3.slice(14, 18), 16)) >>> 8;
|
|
165381
|
+
arr[7] = v & 255;
|
|
165382
|
+
arr[8] = (v = parseInt(uuid3.slice(19, 23), 16)) >>> 8;
|
|
165383
|
+
arr[9] = v & 255;
|
|
165384
|
+
arr[10] = (v = parseInt(uuid3.slice(24, 36), 16)) / 1099511627776 & 255;
|
|
165385
|
+
arr[11] = v / 4294967296 & 255;
|
|
165386
|
+
arr[12] = v >>> 24 & 255;
|
|
165387
|
+
arr[13] = v >>> 16 & 255;
|
|
165388
|
+
arr[14] = v >>> 8 & 255;
|
|
165389
|
+
arr[15] = v & 255;
|
|
165390
|
+
return arr;
|
|
165391
|
+
}
|
|
165392
|
+
var _default4 = parse8;
|
|
165393
|
+
exports2.default = _default4;
|
|
165394
|
+
});
|
|
165395
|
+
|
|
165396
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/v35.js
|
|
165397
|
+
var require_v35 = __commonJS((exports2) => {
|
|
165398
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165399
|
+
value: true
|
|
165400
|
+
});
|
|
165401
|
+
exports2.default = _default4;
|
|
165402
|
+
exports2.URL = exports2.DNS = undefined;
|
|
165403
|
+
var _stringify = _interopRequireDefault(require_stringify());
|
|
165404
|
+
var _parse2 = _interopRequireDefault(require_parse4());
|
|
165405
|
+
function _interopRequireDefault(obj) {
|
|
165406
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
165407
|
+
}
|
|
165408
|
+
function stringToBytes(str3) {
|
|
165409
|
+
str3 = unescape(encodeURIComponent(str3));
|
|
165410
|
+
const bytes = [];
|
|
165411
|
+
for (let i3 = 0;i3 < str3.length; ++i3) {
|
|
165412
|
+
bytes.push(str3.charCodeAt(i3));
|
|
165413
|
+
}
|
|
165414
|
+
return bytes;
|
|
165415
|
+
}
|
|
165416
|
+
var DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
|
165417
|
+
exports2.DNS = DNS;
|
|
165418
|
+
var URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
|
|
165419
|
+
exports2.URL = URL2;
|
|
165420
|
+
function _default4(name2, version3, hashfunc) {
|
|
165421
|
+
function generateUUID(value, namespace, buf, offset) {
|
|
165422
|
+
if (typeof value === "string") {
|
|
165423
|
+
value = stringToBytes(value);
|
|
165424
|
+
}
|
|
165425
|
+
if (typeof namespace === "string") {
|
|
165426
|
+
namespace = (0, _parse2.default)(namespace);
|
|
165427
|
+
}
|
|
165428
|
+
if (namespace.length !== 16) {
|
|
165429
|
+
throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
|
|
165430
|
+
}
|
|
165431
|
+
let bytes = new Uint8Array(16 + value.length);
|
|
165432
|
+
bytes.set(namespace);
|
|
165433
|
+
bytes.set(value, namespace.length);
|
|
165434
|
+
bytes = hashfunc(bytes);
|
|
165435
|
+
bytes[6] = bytes[6] & 15 | version3;
|
|
165436
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
165437
|
+
if (buf) {
|
|
165438
|
+
offset = offset || 0;
|
|
165439
|
+
for (let i3 = 0;i3 < 16; ++i3) {
|
|
165440
|
+
buf[offset + i3] = bytes[i3];
|
|
165441
|
+
}
|
|
165442
|
+
return buf;
|
|
165443
|
+
}
|
|
165444
|
+
return (0, _stringify.default)(bytes);
|
|
165445
|
+
}
|
|
165446
|
+
try {
|
|
165447
|
+
generateUUID.name = name2;
|
|
165448
|
+
} catch (err) {}
|
|
165449
|
+
generateUUID.DNS = DNS;
|
|
165450
|
+
generateUUID.URL = URL2;
|
|
165451
|
+
return generateUUID;
|
|
165452
|
+
}
|
|
165453
|
+
});
|
|
165454
|
+
|
|
165455
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/md5.js
|
|
165456
|
+
var require_md5 = __commonJS((exports2) => {
|
|
165457
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165458
|
+
value: true
|
|
165459
|
+
});
|
|
165460
|
+
exports2.default = undefined;
|
|
165461
|
+
var _crypto = _interopRequireDefault(__require("crypto"));
|
|
165462
|
+
function _interopRequireDefault(obj) {
|
|
165463
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
165464
|
+
}
|
|
165465
|
+
function md5(bytes) {
|
|
165466
|
+
if (Array.isArray(bytes)) {
|
|
165467
|
+
bytes = Buffer.from(bytes);
|
|
165468
|
+
} else if (typeof bytes === "string") {
|
|
165469
|
+
bytes = Buffer.from(bytes, "utf8");
|
|
165470
|
+
}
|
|
165471
|
+
return _crypto.default.createHash("md5").update(bytes).digest();
|
|
165472
|
+
}
|
|
165473
|
+
var _default4 = md5;
|
|
165474
|
+
exports2.default = _default4;
|
|
165475
|
+
});
|
|
165476
|
+
|
|
165477
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/v3.js
|
|
165478
|
+
var require_v3 = __commonJS((exports2) => {
|
|
165479
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165480
|
+
value: true
|
|
165481
|
+
});
|
|
165482
|
+
exports2.default = undefined;
|
|
165483
|
+
var _v = _interopRequireDefault(require_v35());
|
|
165484
|
+
var _md = _interopRequireDefault(require_md5());
|
|
165485
|
+
function _interopRequireDefault(obj) {
|
|
165486
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
165487
|
+
}
|
|
165488
|
+
var v3 = (0, _v.default)("v3", 48, _md.default);
|
|
165489
|
+
var _default4 = v3;
|
|
165490
|
+
exports2.default = _default4;
|
|
165491
|
+
});
|
|
165492
|
+
|
|
165493
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/v4.js
|
|
165494
|
+
var require_v4 = __commonJS((exports2) => {
|
|
165495
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165496
|
+
value: true
|
|
165497
|
+
});
|
|
165498
|
+
exports2.default = undefined;
|
|
165499
|
+
var _rng = _interopRequireDefault(require_rng());
|
|
165500
|
+
var _stringify = _interopRequireDefault(require_stringify());
|
|
165501
|
+
function _interopRequireDefault(obj) {
|
|
165502
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
165503
|
+
}
|
|
165504
|
+
function v4(options, buf, offset) {
|
|
165505
|
+
options = options || {};
|
|
165506
|
+
const rnds = options.random || (options.rng || _rng.default)();
|
|
165507
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
165508
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
165509
|
+
if (buf) {
|
|
165510
|
+
offset = offset || 0;
|
|
165511
|
+
for (let i3 = 0;i3 < 16; ++i3) {
|
|
165512
|
+
buf[offset + i3] = rnds[i3];
|
|
165513
|
+
}
|
|
165514
|
+
return buf;
|
|
165515
|
+
}
|
|
165516
|
+
return (0, _stringify.default)(rnds);
|
|
165517
|
+
}
|
|
165518
|
+
var _default4 = v4;
|
|
165519
|
+
exports2.default = _default4;
|
|
165520
|
+
});
|
|
165521
|
+
|
|
165522
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/sha1.js
|
|
165523
|
+
var require_sha1 = __commonJS((exports2) => {
|
|
165524
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165525
|
+
value: true
|
|
165526
|
+
});
|
|
165527
|
+
exports2.default = undefined;
|
|
165528
|
+
var _crypto = _interopRequireDefault(__require("crypto"));
|
|
165529
|
+
function _interopRequireDefault(obj) {
|
|
165530
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
165531
|
+
}
|
|
165532
|
+
function sha1(bytes) {
|
|
165533
|
+
if (Array.isArray(bytes)) {
|
|
165534
|
+
bytes = Buffer.from(bytes);
|
|
165535
|
+
} else if (typeof bytes === "string") {
|
|
165536
|
+
bytes = Buffer.from(bytes, "utf8");
|
|
165537
|
+
}
|
|
165538
|
+
return _crypto.default.createHash("sha1").update(bytes).digest();
|
|
165539
|
+
}
|
|
165540
|
+
var _default4 = sha1;
|
|
165541
|
+
exports2.default = _default4;
|
|
165542
|
+
});
|
|
165543
|
+
|
|
165544
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/v5.js
|
|
165545
|
+
var require_v5 = __commonJS((exports2) => {
|
|
165546
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165547
|
+
value: true
|
|
165548
|
+
});
|
|
165549
|
+
exports2.default = undefined;
|
|
165550
|
+
var _v = _interopRequireDefault(require_v35());
|
|
165551
|
+
var _sha = _interopRequireDefault(require_sha1());
|
|
165552
|
+
function _interopRequireDefault(obj) {
|
|
165553
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
165554
|
+
}
|
|
165555
|
+
var v5 = (0, _v.default)("v5", 80, _sha.default);
|
|
165556
|
+
var _default4 = v5;
|
|
165557
|
+
exports2.default = _default4;
|
|
165558
|
+
});
|
|
165559
|
+
|
|
165560
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/nil.js
|
|
165561
|
+
var require_nil = __commonJS((exports2) => {
|
|
165562
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165563
|
+
value: true
|
|
165564
|
+
});
|
|
165565
|
+
exports2.default = undefined;
|
|
165566
|
+
var _default4 = "00000000-0000-0000-0000-000000000000";
|
|
165567
|
+
exports2.default = _default4;
|
|
165568
|
+
});
|
|
165569
|
+
|
|
165570
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/version.js
|
|
165571
|
+
var require_version = __commonJS((exports2) => {
|
|
165572
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165573
|
+
value: true
|
|
165574
|
+
});
|
|
165575
|
+
exports2.default = undefined;
|
|
165576
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
165577
|
+
function _interopRequireDefault(obj) {
|
|
165578
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
165579
|
+
}
|
|
165580
|
+
function version3(uuid3) {
|
|
165581
|
+
if (!(0, _validate.default)(uuid3)) {
|
|
165582
|
+
throw TypeError("Invalid UUID");
|
|
165583
|
+
}
|
|
165584
|
+
return parseInt(uuid3.substr(14, 1), 16);
|
|
165585
|
+
}
|
|
165586
|
+
var _default4 = version3;
|
|
165587
|
+
exports2.default = _default4;
|
|
165588
|
+
});
|
|
165589
|
+
|
|
165590
|
+
// node_modules/.bun/uuid@8.3.2/node_modules/uuid/dist/index.js
|
|
165591
|
+
var require_dist11 = __commonJS((exports2) => {
|
|
165592
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
165593
|
+
value: true
|
|
165594
|
+
});
|
|
165595
|
+
Object.defineProperty(exports2, "v1", {
|
|
165596
|
+
enumerable: true,
|
|
165597
|
+
get: function() {
|
|
165598
|
+
return _v.default;
|
|
165599
|
+
}
|
|
165600
|
+
});
|
|
165601
|
+
Object.defineProperty(exports2, "v3", {
|
|
165602
|
+
enumerable: true,
|
|
165603
|
+
get: function() {
|
|
165604
|
+
return _v2.default;
|
|
165605
|
+
}
|
|
165606
|
+
});
|
|
165607
|
+
Object.defineProperty(exports2, "v4", {
|
|
165608
|
+
enumerable: true,
|
|
165609
|
+
get: function() {
|
|
165610
|
+
return _v3.default;
|
|
165611
|
+
}
|
|
165612
|
+
});
|
|
165613
|
+
Object.defineProperty(exports2, "v5", {
|
|
165614
|
+
enumerable: true,
|
|
165615
|
+
get: function() {
|
|
165616
|
+
return _v4.default;
|
|
165617
|
+
}
|
|
165618
|
+
});
|
|
165619
|
+
Object.defineProperty(exports2, "NIL", {
|
|
165620
|
+
enumerable: true,
|
|
165621
|
+
get: function() {
|
|
165622
|
+
return _nil.default;
|
|
165623
|
+
}
|
|
165624
|
+
});
|
|
165625
|
+
Object.defineProperty(exports2, "version", {
|
|
165626
|
+
enumerable: true,
|
|
165627
|
+
get: function() {
|
|
165628
|
+
return _version.default;
|
|
165629
|
+
}
|
|
165630
|
+
});
|
|
165631
|
+
Object.defineProperty(exports2, "validate", {
|
|
165632
|
+
enumerable: true,
|
|
165633
|
+
get: function() {
|
|
165634
|
+
return _validate.default;
|
|
165635
|
+
}
|
|
165636
|
+
});
|
|
165637
|
+
Object.defineProperty(exports2, "stringify", {
|
|
165638
|
+
enumerable: true,
|
|
165639
|
+
get: function() {
|
|
165640
|
+
return _stringify.default;
|
|
165641
|
+
}
|
|
165642
|
+
});
|
|
165643
|
+
Object.defineProperty(exports2, "parse", {
|
|
165644
|
+
enumerable: true,
|
|
165645
|
+
get: function() {
|
|
165646
|
+
return _parse2.default;
|
|
165647
|
+
}
|
|
165648
|
+
});
|
|
165649
|
+
var _v = _interopRequireDefault(require_v1());
|
|
165650
|
+
var _v2 = _interopRequireDefault(require_v3());
|
|
165651
|
+
var _v3 = _interopRequireDefault(require_v4());
|
|
165652
|
+
var _v4 = _interopRequireDefault(require_v5());
|
|
165653
|
+
var _nil = _interopRequireDefault(require_nil());
|
|
165654
|
+
var _version = _interopRequireDefault(require_version());
|
|
165655
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
165656
|
+
var _stringify = _interopRequireDefault(require_stringify());
|
|
165657
|
+
var _parse2 = _interopRequireDefault(require_parse4());
|
|
165658
|
+
function _interopRequireDefault(obj) {
|
|
165659
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
165660
|
+
}
|
|
165661
|
+
});
|
|
165662
|
+
|
|
165663
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/scheduled-task.js
|
|
165664
|
+
var require_scheduled_task = __commonJS((exports2, module2) => {
|
|
165665
|
+
var EventEmitter = __require("events");
|
|
165666
|
+
var Task = require_task();
|
|
165667
|
+
var Scheduler = require_scheduler();
|
|
165668
|
+
var uuid3 = require_dist11();
|
|
165669
|
+
|
|
165670
|
+
class ScheduledTask extends EventEmitter {
|
|
165671
|
+
constructor(cronExpression, func, options) {
|
|
165672
|
+
super();
|
|
165673
|
+
if (!options) {
|
|
165674
|
+
options = {
|
|
165675
|
+
scheduled: true,
|
|
165676
|
+
recoverMissedExecutions: false
|
|
165677
|
+
};
|
|
165678
|
+
}
|
|
165679
|
+
this.options = options;
|
|
165680
|
+
this.options.name = this.options.name || uuid3.v4();
|
|
165681
|
+
this._task = new Task(func);
|
|
165682
|
+
this._scheduler = new Scheduler(cronExpression, options.timezone, options.recoverMissedExecutions);
|
|
165683
|
+
this._scheduler.on("scheduled-time-matched", (now) => {
|
|
165684
|
+
this.now(now);
|
|
165685
|
+
});
|
|
165686
|
+
if (options.scheduled !== false) {
|
|
165687
|
+
this._scheduler.start();
|
|
165688
|
+
}
|
|
165689
|
+
if (options.runOnInit === true) {
|
|
165690
|
+
this.now("init");
|
|
165691
|
+
}
|
|
165692
|
+
}
|
|
165693
|
+
now(now = "manual") {
|
|
165694
|
+
let result = this._task.execute(now);
|
|
165695
|
+
this.emit("task-done", result);
|
|
165696
|
+
}
|
|
165697
|
+
start() {
|
|
165698
|
+
this._scheduler.start();
|
|
165699
|
+
}
|
|
165700
|
+
stop() {
|
|
165701
|
+
this._scheduler.stop();
|
|
165702
|
+
}
|
|
165703
|
+
}
|
|
165704
|
+
module2.exports = ScheduledTask;
|
|
165705
|
+
});
|
|
165706
|
+
|
|
165707
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/background-scheduled-task/index.js
|
|
165708
|
+
var require_background_scheduled_task = __commonJS((exports2, module2) => {
|
|
165709
|
+
var __dirname = "/root/Projets/MaTrixOS/node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/background-scheduled-task";
|
|
165710
|
+
var EventEmitter = __require("events");
|
|
165711
|
+
var path18 = __require("path");
|
|
165712
|
+
var { fork } = __require("child_process");
|
|
165713
|
+
var uuid3 = require_dist11();
|
|
165714
|
+
var daemonPath = `${__dirname}/daemon.js`;
|
|
165715
|
+
|
|
165716
|
+
class BackgroundScheduledTask extends EventEmitter {
|
|
165717
|
+
constructor(cronExpression, taskPath, options) {
|
|
165718
|
+
super();
|
|
165719
|
+
if (!options) {
|
|
165720
|
+
options = {
|
|
165721
|
+
scheduled: true,
|
|
165722
|
+
recoverMissedExecutions: false
|
|
165723
|
+
};
|
|
165724
|
+
}
|
|
165725
|
+
this.cronExpression = cronExpression;
|
|
165726
|
+
this.taskPath = taskPath;
|
|
165727
|
+
this.options = options;
|
|
165728
|
+
this.options.name = this.options.name || uuid3.v4();
|
|
165729
|
+
if (options.scheduled) {
|
|
165730
|
+
this.start();
|
|
165731
|
+
}
|
|
165732
|
+
}
|
|
165733
|
+
start() {
|
|
165734
|
+
this.stop();
|
|
165735
|
+
this.forkProcess = fork(daemonPath);
|
|
165736
|
+
this.forkProcess.on("message", (message) => {
|
|
165737
|
+
switch (message.type) {
|
|
165738
|
+
case "task-done":
|
|
165739
|
+
this.emit("task-done", message.result);
|
|
165740
|
+
break;
|
|
165741
|
+
}
|
|
165742
|
+
});
|
|
165743
|
+
let options = this.options;
|
|
165744
|
+
options.scheduled = true;
|
|
165745
|
+
this.forkProcess.send({
|
|
165746
|
+
type: "register",
|
|
165747
|
+
path: path18.resolve(this.taskPath),
|
|
165748
|
+
cron: this.cronExpression,
|
|
165749
|
+
options
|
|
165750
|
+
});
|
|
165751
|
+
}
|
|
165752
|
+
stop() {
|
|
165753
|
+
if (this.forkProcess) {
|
|
165754
|
+
this.forkProcess.kill();
|
|
165755
|
+
}
|
|
165756
|
+
}
|
|
165757
|
+
pid() {
|
|
165758
|
+
if (this.forkProcess) {
|
|
165759
|
+
return this.forkProcess.pid;
|
|
165760
|
+
}
|
|
165761
|
+
}
|
|
165762
|
+
isRunning() {
|
|
165763
|
+
return !this.forkProcess.killed;
|
|
165764
|
+
}
|
|
165765
|
+
}
|
|
165766
|
+
module2.exports = BackgroundScheduledTask;
|
|
165767
|
+
});
|
|
165768
|
+
|
|
165769
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/storage.js
|
|
165770
|
+
var require_storage = __commonJS((exports2, module2) => {
|
|
165771
|
+
module2.exports = (() => {
|
|
165772
|
+
if (!global.scheduledTasks) {
|
|
165773
|
+
global.scheduledTasks = new Map;
|
|
165774
|
+
}
|
|
165775
|
+
return {
|
|
165776
|
+
save: (task2) => {
|
|
165777
|
+
if (!task2.options) {
|
|
165778
|
+
const uuid3 = require_dist11();
|
|
165779
|
+
task2.options = {};
|
|
165780
|
+
task2.options.name = uuid3.v4();
|
|
165781
|
+
}
|
|
165782
|
+
global.scheduledTasks.set(task2.options.name, task2);
|
|
165783
|
+
},
|
|
165784
|
+
getTasks: () => {
|
|
165785
|
+
return global.scheduledTasks;
|
|
165786
|
+
}
|
|
165787
|
+
};
|
|
165788
|
+
})();
|
|
165789
|
+
});
|
|
165790
|
+
|
|
165791
|
+
// node_modules/.bun/node-cron@3.0.3/node_modules/node-cron/src/node-cron.js
|
|
165792
|
+
var require_node_cron = __commonJS((exports2, module2) => {
|
|
165793
|
+
var ScheduledTask = require_scheduled_task();
|
|
165794
|
+
var BackgroundScheduledTask = require_background_scheduled_task();
|
|
165795
|
+
var validation = require_pattern_validation();
|
|
165796
|
+
var storage3 = require_storage();
|
|
165797
|
+
function schedule(expression, func, options) {
|
|
165798
|
+
const task2 = createTask(expression, func, options);
|
|
165799
|
+
storage3.save(task2);
|
|
165800
|
+
return task2;
|
|
165801
|
+
}
|
|
165802
|
+
function createTask(expression, func, options) {
|
|
165803
|
+
if (typeof func === "string")
|
|
165804
|
+
return new BackgroundScheduledTask(expression, func, options);
|
|
165805
|
+
return new ScheduledTask(expression, func, options);
|
|
165806
|
+
}
|
|
165807
|
+
function validate(expression) {
|
|
165808
|
+
try {
|
|
165809
|
+
validation(expression);
|
|
165810
|
+
return true;
|
|
165811
|
+
} catch (_2) {
|
|
165812
|
+
return false;
|
|
165813
|
+
}
|
|
165814
|
+
}
|
|
165815
|
+
function getTasks() {
|
|
165816
|
+
return storage3.getTasks();
|
|
165817
|
+
}
|
|
165818
|
+
module2.exports = { schedule, validate, getTasks };
|
|
165819
|
+
});
|
|
165820
|
+
|
|
165821
|
+
// packages/omo-opencode/src/features/cron/runner.ts
|
|
165822
|
+
var exports_runner = {};
|
|
165823
|
+
__export(exports_runner, {
|
|
165824
|
+
CronRunner: () => CronRunner
|
|
165825
|
+
});
|
|
165826
|
+
|
|
165827
|
+
class CronRunner {
|
|
165828
|
+
store;
|
|
165829
|
+
deps;
|
|
165830
|
+
tasks = [];
|
|
165831
|
+
constructor(store2, deps) {
|
|
165832
|
+
this.store = store2;
|
|
165833
|
+
this.deps = deps;
|
|
165834
|
+
}
|
|
165835
|
+
start() {
|
|
165836
|
+
const jobs = this.store.list({ enabled: true });
|
|
165837
|
+
for (const job of jobs) {
|
|
165838
|
+
if (cron2.validate(job.schedule)) {
|
|
165839
|
+
const task2 = cron2.schedule(job.schedule, () => {
|
|
165840
|
+
this.deps.onTick(job);
|
|
165841
|
+
});
|
|
165842
|
+
this.tasks.push(task2);
|
|
165843
|
+
}
|
|
165844
|
+
}
|
|
165845
|
+
}
|
|
165846
|
+
stop() {
|
|
165847
|
+
for (const t2 of this.tasks) {
|
|
165848
|
+
t2.stop();
|
|
165849
|
+
}
|
|
165850
|
+
this.tasks = [];
|
|
165851
|
+
}
|
|
165852
|
+
}
|
|
165853
|
+
var cron2;
|
|
165854
|
+
var init_runner3 = __esm(() => {
|
|
165855
|
+
cron2 = __toESM(require_node_cron(), 1);
|
|
165856
|
+
});
|
|
165857
|
+
|
|
165858
|
+
// packages/omo-opencode/src/cli/cron.ts
|
|
165859
|
+
var exports_cron = {};
|
|
165860
|
+
__export(exports_cron, {
|
|
165861
|
+
cronStop: () => cronStop,
|
|
165862
|
+
cronStart: () => cronStart,
|
|
165863
|
+
cronRemove: () => cronRemove,
|
|
165864
|
+
cronList: () => cronList,
|
|
165865
|
+
cronAdd: () => cronAdd
|
|
165866
|
+
});
|
|
165867
|
+
function cronAdd(options) {
|
|
165868
|
+
const job = store2.add({
|
|
165869
|
+
name: options.name,
|
|
165870
|
+
schedule: options.schedule,
|
|
165871
|
+
command: options.command,
|
|
165872
|
+
channel: options.channel,
|
|
165873
|
+
recipient: options.recipient,
|
|
165874
|
+
enabled: options.enabled ?? true
|
|
165875
|
+
});
|
|
165876
|
+
console.log(`Added: ${job.id} \u2014 ${job.name} [${job.schedule}]`);
|
|
165877
|
+
return 0;
|
|
165878
|
+
}
|
|
165879
|
+
function cronList(options = {}) {
|
|
165880
|
+
const jobs = store2.list({
|
|
165881
|
+
enabled: options.enabled,
|
|
165882
|
+
channel: options.channel
|
|
165883
|
+
});
|
|
165884
|
+
if (options.json) {
|
|
165885
|
+
console.log(JSON.stringify(jobs, null, 2));
|
|
165886
|
+
} else {
|
|
165887
|
+
if (jobs.length === 0) {
|
|
165888
|
+
console.log("No cron jobs.");
|
|
165889
|
+
return 0;
|
|
165890
|
+
}
|
|
165891
|
+
for (const j of jobs) {
|
|
165892
|
+
const status2 = j.enabled ? "enabled" : "disabled";
|
|
165893
|
+
const delivery = j.channel ? ` \u2192 ${j.channel}/${j.recipient ?? "*"}` : "";
|
|
165894
|
+
console.log(` ${j.id.padEnd(14)} ${status2.padEnd(9)} ${j.schedule.padEnd(12)} ${j.name}${delivery}`);
|
|
165895
|
+
}
|
|
165896
|
+
console.log(`
|
|
165897
|
+
Total: ${jobs.length}`);
|
|
165898
|
+
}
|
|
165899
|
+
return 0;
|
|
165900
|
+
}
|
|
165901
|
+
function cronRemove(options) {
|
|
165902
|
+
const ok = store2.remove(options.id);
|
|
165903
|
+
if (ok) {
|
|
165904
|
+
console.log(`Removed: ${options.id}`);
|
|
165905
|
+
return 0;
|
|
165906
|
+
}
|
|
165907
|
+
console.error(`Not found: ${options.id}`);
|
|
165908
|
+
return 1;
|
|
165909
|
+
}
|
|
165910
|
+
function cronStart(options = {}) {
|
|
165911
|
+
const { CronRunner: CronRunner2 } = (init_runner3(), __toCommonJS(exports_runner));
|
|
165912
|
+
const runner3 = new CronRunner2(store2, {
|
|
165913
|
+
onTick: async (job) => {
|
|
165914
|
+
const { spawnSync: spawnSync4 } = __require("child_process");
|
|
165915
|
+
console.log(`[cron] firing ${job.name} \u2192 ${job.command}`);
|
|
165916
|
+
const res = spawnSync4("bash", ["-lc", job.command], { encoding: "utf-8" });
|
|
165917
|
+
if (res.status !== 0) {
|
|
165918
|
+
console.error(`[cron] ${job.name} failed:`, res.stderr || res.stdout);
|
|
165919
|
+
} else if (job.channel) {
|
|
165920
|
+
console.log(`[cron] ${job.name} done (delivery to ${job.channel} not yet wired)`);
|
|
165921
|
+
}
|
|
165922
|
+
}
|
|
165923
|
+
});
|
|
165924
|
+
runner3.start();
|
|
165925
|
+
if (options.daemon) {
|
|
165926
|
+
console.log("[cron] scheduler started (daemon). Ctrl-C or 'matrixos cron stop' to exit.");
|
|
165927
|
+
process.stdin.resume();
|
|
165928
|
+
} else {
|
|
165929
|
+
console.log("[cron] scheduler started. Jobs will fire per their schedule. Press Ctrl-C to stop.");
|
|
165930
|
+
}
|
|
165931
|
+
return 0;
|
|
165932
|
+
}
|
|
165933
|
+
function cronStop() {
|
|
165934
|
+
console.log("[cron] stop is handled by terminating the scheduler process (Ctrl-C / systemd stop).");
|
|
165935
|
+
return 0;
|
|
165936
|
+
}
|
|
165937
|
+
var store2;
|
|
165938
|
+
var init_cron = __esm(() => {
|
|
165939
|
+
init_store();
|
|
165940
|
+
store2 = createCronStore();
|
|
164793
165941
|
});
|
|
164794
165942
|
|
|
164795
165943
|
// packages/task-ledger-core/src/schema.ts
|
|
@@ -165042,9 +166190,9 @@ var init_ledger = __esm(() => {
|
|
|
165042
166190
|
});
|
|
165043
166191
|
|
|
165044
166192
|
// packages/task-ledger-core/src/sqlite.ts
|
|
165045
|
-
import { Database as
|
|
166193
|
+
import { Database as Database3 } from "bun:sqlite";
|
|
165046
166194
|
function createSqliteDatabase(dbPath) {
|
|
165047
|
-
const db = new
|
|
166195
|
+
const db = new Database3(dbPath);
|
|
165048
166196
|
db.exec("PRAGMA journal_mode = WAL");
|
|
165049
166197
|
db.exec("PRAGMA foreign_keys = ON");
|
|
165050
166198
|
return {
|
|
@@ -165087,7 +166235,7 @@ __export(exports_generate, {
|
|
|
165087
166235
|
ProfileNotFoundError: () => ProfileNotFoundError
|
|
165088
166236
|
});
|
|
165089
166237
|
import { existsSync as existsSync72, readFileSync as readFileSync59, realpathSync as realpathSync10 } from "fs";
|
|
165090
|
-
import { dirname as dirname30, isAbsolute as isAbsolute6, join as join78, resolve as
|
|
166238
|
+
import { dirname as dirname30, isAbsolute as isAbsolute6, join as join78, resolve as resolve17 } from "path";
|
|
165091
166239
|
function profilesDirFor(opts) {
|
|
165092
166240
|
if (opts.profilesDir)
|
|
165093
166241
|
return opts.profilesDir;
|
|
@@ -165128,7 +166276,7 @@ function runGenerate(options) {
|
|
|
165128
166276
|
profilesDir: options.profilesDir,
|
|
165129
166277
|
fs: options.fs
|
|
165130
166278
|
});
|
|
165131
|
-
const targetDir = isAbsolute6(options.targetDir) ? options.targetDir :
|
|
166279
|
+
const targetDir = isAbsolute6(options.targetDir) ? options.targetDir : resolve17(process.cwd(), options.targetDir);
|
|
165132
166280
|
return generateMiniOS({
|
|
165133
166281
|
profile: profile2,
|
|
165134
166282
|
targetDir,
|
|
@@ -165183,7 +166331,7 @@ var REPO_ROOT, defaultFS2, PROFILES_RELATIVE = "assets/profiles", ProfileNotFoun
|
|
|
165183
166331
|
var init_generate = __esm(() => {
|
|
165184
166332
|
init_src5();
|
|
165185
166333
|
init_src5();
|
|
165186
|
-
REPO_ROOT =
|
|
166334
|
+
REPO_ROOT = resolve17(dirname30(new URL(import.meta.url).pathname), "..", "..", "..", "..", "..");
|
|
165187
166335
|
defaultFS2 = { existsSync: existsSync72, readFileSync: readFileSync59, realpathSync: realpathSync10 };
|
|
165188
166336
|
ProfileNotFoundError = class ProfileNotFoundError extends Error {
|
|
165189
166337
|
profileName;
|
|
@@ -165302,7 +166450,7 @@ var exports_cost_report = {};
|
|
|
165302
166450
|
__export(exports_cost_report, {
|
|
165303
166451
|
executeCostReportCommand: () => executeCostReportCommand
|
|
165304
166452
|
});
|
|
165305
|
-
import { Database as
|
|
166453
|
+
import { Database as Database7 } from "bun:sqlite";
|
|
165306
166454
|
import { existsSync as existsSync73 } from "fs";
|
|
165307
166455
|
import * as path28 from "path";
|
|
165308
166456
|
import * as os14 from "os";
|
|
@@ -165318,7 +166466,7 @@ function executeCostReportCommand(args) {
|
|
|
165318
166466
|
` };
|
|
165319
166467
|
}
|
|
165320
166468
|
try {
|
|
165321
|
-
const db = new
|
|
166469
|
+
const db = new Database7(dbPath);
|
|
165322
166470
|
const rows = queryReport(db, period);
|
|
165323
166471
|
if (args.options.json) {
|
|
165324
166472
|
return { exitCode: 0, stdout: JSON.stringify(rows, null, 2) + `
|
|
@@ -165439,7 +166587,7 @@ __export(exports_profile_resolve, {
|
|
|
165439
166587
|
executeProfileResolveCommand: () => executeProfileResolveCommand
|
|
165440
166588
|
});
|
|
165441
166589
|
import { existsSync as existsSync74, readdirSync as readdirSync16, readFileSync as readFileSync60 } from "fs";
|
|
165442
|
-
import { join as join81, resolve as
|
|
166590
|
+
import { join as join81, resolve as resolve18, dirname as dirname31 } from "path";
|
|
165443
166591
|
function executeProfileResolveCommand(args) {
|
|
165444
166592
|
if (args.options.help) {
|
|
165445
166593
|
return {
|
|
@@ -165537,7 +166685,7 @@ function executeProfileResolveCommand(args) {
|
|
|
165537
166685
|
var REPO_ROOT2, PROFILES_RELATIVE2 = "assets/profiles";
|
|
165538
166686
|
var init_profile_resolve = __esm(() => {
|
|
165539
166687
|
init_src5();
|
|
165540
|
-
REPO_ROOT2 =
|
|
166688
|
+
REPO_ROOT2 = resolve18(dirname31(new URL(import.meta.url).pathname), "..", "..", "..", "..");
|
|
165541
166689
|
});
|
|
165542
166690
|
|
|
165543
166691
|
// packages/omo-opencode/src/cli/export.ts
|
|
@@ -165548,7 +166696,7 @@ __export(exports_export, {
|
|
|
165548
166696
|
executeExportCommand: () => executeExportCommand
|
|
165549
166697
|
});
|
|
165550
166698
|
import { existsSync as existsSync75, readFileSync as readFileSync61, writeFileSync as writeFileSync26, copyFileSync as copyFileSync8, realpathSync as realpathSync11, mkdirSync as mkdirSync27 } from "fs";
|
|
165551
|
-
import { isAbsolute as isAbsolute7, join as join82, resolve as
|
|
166699
|
+
import { isAbsolute as isAbsolute7, join as join82, resolve as resolve19, dirname as dirname32 } from "path";
|
|
165552
166700
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
165553
166701
|
function setShell(shell) {
|
|
165554
166702
|
activeShell = shell;
|
|
@@ -165575,7 +166723,7 @@ function executeExportCommand(args) {
|
|
|
165575
166723
|
` };
|
|
165576
166724
|
}
|
|
165577
166725
|
const targetDir = args.options.targetDir ?? `./${name2}-mini-os`;
|
|
165578
|
-
const absoluteTargetDir = isAbsolute7(targetDir) ? targetDir :
|
|
166726
|
+
const absoluteTargetDir = isAbsolute7(targetDir) ? targetDir : resolve19(process.cwd(), targetDir);
|
|
165579
166727
|
let result;
|
|
165580
166728
|
try {
|
|
165581
166729
|
result = runGenerate({
|
|
@@ -165632,7 +166780,7 @@ ${packResult.stdout}
|
|
|
165632
166780
|
let tgzPath = join82(absoluteTargetDir, tgzName);
|
|
165633
166781
|
if (args.options.output) {
|
|
165634
166782
|
const outputPath = args.options.output;
|
|
165635
|
-
const absoluteOutput = isAbsolute7(outputPath) ? outputPath :
|
|
166783
|
+
const absoluteOutput = isAbsolute7(outputPath) ? outputPath : resolve19(process.cwd(), outputPath);
|
|
165636
166784
|
const outputDir = dirname32(absoluteOutput);
|
|
165637
166785
|
if (!fs24.existsSync(outputDir)) {
|
|
165638
166786
|
fs24.mkdirSync(outputDir, { recursive: true });
|
|
@@ -165947,7 +167095,7 @@ import { chmod } from "fs/promises";
|
|
|
165947
167095
|
import { createInterface as createInterface4 } from "readline";
|
|
165948
167096
|
async function askMasked(prompt) {
|
|
165949
167097
|
const rl = createInterface4({ input: process.stdin, output: process.stdout });
|
|
165950
|
-
const answer = await new Promise((
|
|
167098
|
+
const answer = await new Promise((resolve20) => {
|
|
165951
167099
|
process.stdout.write(prompt);
|
|
165952
167100
|
process.stdin.setRawMode?.(true);
|
|
165953
167101
|
process.stdin.resume();
|
|
@@ -165962,7 +167110,7 @@ async function askMasked(prompt) {
|
|
|
165962
167110
|
process.stdout.write(`
|
|
165963
167111
|
`);
|
|
165964
167112
|
rl.close();
|
|
165965
|
-
|
|
167113
|
+
resolve20(value);
|
|
165966
167114
|
return;
|
|
165967
167115
|
} else if (ch === "\x03") {
|
|
165968
167116
|
process.exit(130);
|
|
@@ -165984,10 +167132,10 @@ async function askMasked(prompt) {
|
|
|
165984
167132
|
async function ask(question, defaultValue) {
|
|
165985
167133
|
const rl = createInterface4({ input: process.stdin, output: process.stdout });
|
|
165986
167134
|
const d = defaultValue ? ` (${defaultValue})` : "";
|
|
165987
|
-
const answer = await new Promise((
|
|
167135
|
+
const answer = await new Promise((resolve20) => {
|
|
165988
167136
|
rl.question(`${question}${d}: `, (a2) => {
|
|
165989
167137
|
rl.close();
|
|
165990
|
-
|
|
167138
|
+
resolve20(a2);
|
|
165991
167139
|
});
|
|
165992
167140
|
});
|
|
165993
167141
|
return answer.trim() || defaultValue || "";
|
|
@@ -166090,7 +167238,7 @@ function isValidType(type2) {
|
|
|
166090
167238
|
return VALID_TYPES.includes(type2);
|
|
166091
167239
|
}
|
|
166092
167240
|
async function readMaskedToken(prompt) {
|
|
166093
|
-
return new Promise((
|
|
167241
|
+
return new Promise((resolve20, reject) => {
|
|
166094
167242
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
166095
167243
|
reject(new Error("Interactive mode requires a TTY. Use --token <value> instead."));
|
|
166096
167244
|
return;
|
|
@@ -166110,7 +167258,7 @@ async function readMaskedToken(prompt) {
|
|
|
166110
167258
|
process.stdin.setRawMode(false);
|
|
166111
167259
|
process.stdin.pause();
|
|
166112
167260
|
process.stdin.off("data", onData);
|
|
166113
|
-
|
|
167261
|
+
resolve20(token);
|
|
166114
167262
|
return;
|
|
166115
167263
|
}
|
|
166116
167264
|
if (code === 127 || code === 8) {
|
|
@@ -166295,13 +167443,13 @@ function isTelegramAdoptCommand(env5) {
|
|
|
166295
167443
|
}
|
|
166296
167444
|
async function runCliCommand(args, replyMsg) {
|
|
166297
167445
|
const started = Date.now();
|
|
166298
|
-
return new Promise((
|
|
167446
|
+
return new Promise((resolve20) => {
|
|
166299
167447
|
let settled = false;
|
|
166300
167448
|
const finish = (result) => {
|
|
166301
167449
|
if (settled)
|
|
166302
167450
|
return;
|
|
166303
167451
|
settled = true;
|
|
166304
|
-
|
|
167452
|
+
resolve20({ ...result, durationMs: Date.now() - started });
|
|
166305
167453
|
};
|
|
166306
167454
|
let child;
|
|
166307
167455
|
try {
|
|
@@ -166327,7 +167475,7 @@ async function handleGatewayMessage(env5, opts = {}) {
|
|
|
166327
167475
|
const cwd = opts.cwd ?? process.cwd();
|
|
166328
167476
|
const timeoutMs = opts.timeoutMs ?? 120000;
|
|
166329
167477
|
const started = Date.now();
|
|
166330
|
-
return new Promise((
|
|
167478
|
+
return new Promise((resolve20) => {
|
|
166331
167479
|
let stdout2 = "";
|
|
166332
167480
|
let stderr = "";
|
|
166333
167481
|
let settled = false;
|
|
@@ -166335,7 +167483,7 @@ async function handleGatewayMessage(env5, opts = {}) {
|
|
|
166335
167483
|
if (settled)
|
|
166336
167484
|
return;
|
|
166337
167485
|
settled = true;
|
|
166338
|
-
|
|
167486
|
+
resolve20({ ...result, durationMs: Date.now() - started });
|
|
166339
167487
|
};
|
|
166340
167488
|
let child;
|
|
166341
167489
|
try {
|
|
@@ -166416,7 +167564,7 @@ __export(exports_gateway_start, {
|
|
|
166416
167564
|
buildGatewayConfig: () => buildGatewayConfig
|
|
166417
167565
|
});
|
|
166418
167566
|
import { readFileSync as readFileSync64, existsSync as existsSync79 } from "fs";
|
|
166419
|
-
import { resolve as
|
|
167567
|
+
import { resolve as resolve20 } from "path";
|
|
166420
167568
|
import { execSync as execSync2 } from "child_process";
|
|
166421
167569
|
function resolveMatrixosCommand(fallback = "matrixos") {
|
|
166422
167570
|
try {
|
|
@@ -166556,7 +167704,7 @@ var ENV_PATH, DEFAULT_MATRIXOS_COMMAND;
|
|
|
166556
167704
|
var init_gateway_start = __esm(() => {
|
|
166557
167705
|
init_src4();
|
|
166558
167706
|
init_gateway_handler();
|
|
166559
|
-
ENV_PATH =
|
|
167707
|
+
ENV_PATH = resolve20(process.cwd(), ".klc-gateway.env");
|
|
166560
167708
|
DEFAULT_MATRIXOS_COMMAND = resolveMatrixosCommand();
|
|
166561
167709
|
});
|
|
166562
167710
|
|
|
@@ -166578,18 +167726,18 @@ var init_deployment_core = __esm(() => {
|
|
|
166578
167726
|
// packages/omo-opencode/src/deployment/deploy-static.ts
|
|
166579
167727
|
import { spawn as spawn6 } from "child_process";
|
|
166580
167728
|
import { existsSync as existsSync80 } from "fs";
|
|
166581
|
-
import { resolve as
|
|
167729
|
+
import { resolve as resolve21 } from "path";
|
|
166582
167730
|
function pushStage(stage, message, ok = true) {
|
|
166583
167731
|
return { stage, message, ok };
|
|
166584
167732
|
}
|
|
166585
167733
|
function run2(cmd, args, cwd) {
|
|
166586
|
-
return new Promise((
|
|
167734
|
+
return new Promise((resolve22) => {
|
|
166587
167735
|
let output = "";
|
|
166588
167736
|
let error51 = "";
|
|
166589
167737
|
const child = spawn6(cmd, args, { cwd, shell: false });
|
|
166590
167738
|
child.stdout.on("data", (d) => output += d.toString());
|
|
166591
167739
|
child.stderr.on("data", (d) => error51 += d.toString());
|
|
166592
|
-
child.on("close", (code) =>
|
|
167740
|
+
child.on("close", (code) => resolve22({ ok: code === 0, output, error: error51 }));
|
|
166593
167741
|
});
|
|
166594
167742
|
}
|
|
166595
167743
|
var deployStatic;
|
|
@@ -166598,7 +167746,7 @@ var init_deploy_static = __esm(() => {
|
|
|
166598
167746
|
name: "static",
|
|
166599
167747
|
async deploy(ctx, params) {
|
|
166600
167748
|
const stages = [];
|
|
166601
|
-
const buildDir =
|
|
167749
|
+
const buildDir = resolve21(ctx.projectRoot, params.buildDir ?? "dist");
|
|
166602
167750
|
const destination = params.destination;
|
|
166603
167751
|
const prebuild = params.prebuild ?? "bun run build";
|
|
166604
167752
|
try {
|
|
@@ -166671,13 +167819,13 @@ function pushStage2(stage, message, ok = true) {
|
|
|
166671
167819
|
return { stage, message, ok };
|
|
166672
167820
|
}
|
|
166673
167821
|
function run3(cmd, args, cwd, env5) {
|
|
166674
|
-
return new Promise((
|
|
167822
|
+
return new Promise((resolve22) => {
|
|
166675
167823
|
let output = "";
|
|
166676
167824
|
let error51 = "";
|
|
166677
167825
|
const child = spawn7(cmd, args, { cwd, env: { ...process.env, ...env5 }, shell: false });
|
|
166678
167826
|
child.stdout.on("data", (d) => output += d.toString());
|
|
166679
167827
|
child.stderr.on("data", (d) => error51 += d.toString());
|
|
166680
|
-
child.on("close", (code) =>
|
|
167828
|
+
child.on("close", (code) => resolve22({ ok: code === 0, output, error: error51 }));
|
|
166681
167829
|
});
|
|
166682
167830
|
}
|
|
166683
167831
|
var deployVercel;
|
|
@@ -166743,13 +167891,13 @@ function pushStage3(stage, message, ok = true) {
|
|
|
166743
167891
|
return { stage, message, ok };
|
|
166744
167892
|
}
|
|
166745
167893
|
function run4(cmd, args, cwd, env5) {
|
|
166746
|
-
return new Promise((
|
|
167894
|
+
return new Promise((resolve22) => {
|
|
166747
167895
|
let output = "";
|
|
166748
167896
|
let error51 = "";
|
|
166749
167897
|
const child = spawn8(cmd, args, { cwd, env: { ...process.env, ...env5 }, shell: false });
|
|
166750
167898
|
child.stdout.on("data", (d) => output += d.toString());
|
|
166751
167899
|
child.stderr.on("data", (d) => error51 += d.toString());
|
|
166752
|
-
child.on("close", (code) =>
|
|
167900
|
+
child.on("close", (code) => resolve22({ ok: code === 0, output, error: error51 }));
|
|
166753
167901
|
});
|
|
166754
167902
|
}
|
|
166755
167903
|
var deployVps;
|
|
@@ -166831,7 +167979,7 @@ var init_deploy_vps = __esm(() => {
|
|
|
166831
167979
|
});
|
|
166832
167980
|
|
|
166833
167981
|
// packages/omo-opencode/src/deployment/deploy-cli.ts
|
|
166834
|
-
import { resolve as
|
|
167982
|
+
import { resolve as resolve22 } from "path";
|
|
166835
167983
|
async function runDeploy(options) {
|
|
166836
167984
|
const target = getTarget(options.target);
|
|
166837
167985
|
if (!target) {
|
|
@@ -166844,7 +167992,7 @@ async function runDeploy(options) {
|
|
|
166844
167992
|
console.error("No active project. Run `matrixos project switch <slug>` or pass --project-root.");
|
|
166845
167993
|
return 1;
|
|
166846
167994
|
}
|
|
166847
|
-
const projectRoot =
|
|
167995
|
+
const projectRoot = resolve22(options.projectRoot ?? getProjectDir(project.slug));
|
|
166848
167996
|
const ctx = {
|
|
166849
167997
|
projectRoot,
|
|
166850
167998
|
projectSlug: project?.slug,
|
|
@@ -167319,6 +168467,26 @@ WantedBy=${opts.user ? "default.target" : "multi-user.target"}
|
|
|
167319
168467
|
`;
|
|
167320
168468
|
writeFileEnsureDir(path29.join(unitDir, "matrixos-gateway.service"), unit);
|
|
167321
168469
|
}
|
|
168470
|
+
if (opts.cron !== false) {
|
|
168471
|
+
const unit = `[Unit]
|
|
168472
|
+
Description=MaTrixOS Cron Scheduler
|
|
168473
|
+
After=network.target
|
|
168474
|
+
|
|
168475
|
+
[Service]
|
|
168476
|
+
Type=simple
|
|
168477
|
+
User=${os15.userInfo().username}
|
|
168478
|
+
WorkingDirectory=${os15.homedir()}
|
|
168479
|
+
Environment=PATH=${envPath}
|
|
168480
|
+
Environment=HOME=${os15.homedir()}
|
|
168481
|
+
ExecStart=${bin} cron start --daemon
|
|
168482
|
+
Restart=always
|
|
168483
|
+
RestartSec=5
|
|
168484
|
+
|
|
168485
|
+
[Install]
|
|
168486
|
+
WantedBy=${opts.user ? "default.target" : "multi-user.target"}
|
|
168487
|
+
`;
|
|
168488
|
+
writeFileEnsureDir(path29.join(unitDir, "matrixos-cron.service"), unit);
|
|
168489
|
+
}
|
|
167322
168490
|
console.log("[service] reloading systemd...");
|
|
167323
168491
|
if (scope) {
|
|
167324
168492
|
execSync3(`${scope} systemctl --user daemon-reload`, { stdio: "inherit" });
|
|
@@ -167326,20 +168494,28 @@ WantedBy=${opts.user ? "default.target" : "multi-user.target"}
|
|
|
167326
168494
|
execSync3(`${scope} systemctl --user enable matrixos-dashboard.service`, { stdio: "inherit" });
|
|
167327
168495
|
if (opts.gateway !== false)
|
|
167328
168496
|
execSync3(`${scope} systemctl --user enable matrixos-gateway.service`, { stdio: "inherit" });
|
|
168497
|
+
if (opts.cron !== false)
|
|
168498
|
+
execSync3(`${scope} systemctl --user enable matrixos-cron.service`, { stdio: "inherit" });
|
|
167329
168499
|
if (opts.dashboard !== false)
|
|
167330
168500
|
execSync3(`${scope} systemctl --user start matrixos-dashboard.service`, { stdio: "inherit" });
|
|
167331
168501
|
if (opts.gateway !== false)
|
|
167332
168502
|
execSync3(`${scope} systemctl --user start matrixos-gateway.service`, { stdio: "inherit" });
|
|
168503
|
+
if (opts.cron !== false)
|
|
168504
|
+
execSync3(`${scope} systemctl --user start matrixos-cron.service`, { stdio: "inherit" });
|
|
167333
168505
|
} else {
|
|
167334
168506
|
execSync3("systemctl daemon-reload", { stdio: "inherit" });
|
|
167335
168507
|
if (opts.dashboard !== false)
|
|
167336
168508
|
execSync3("systemctl enable matrixos-dashboard.service", { stdio: "inherit" });
|
|
167337
168509
|
if (opts.gateway !== false)
|
|
167338
168510
|
execSync3("systemctl enable matrixos-gateway.service", { stdio: "inherit" });
|
|
168511
|
+
if (opts.cron !== false)
|
|
168512
|
+
execSync3("systemctl enable matrixos-cron.service", { stdio: "inherit" });
|
|
167339
168513
|
if (opts.dashboard !== false)
|
|
167340
168514
|
execSync3("systemctl start matrixos-dashboard.service", { stdio: "inherit" });
|
|
167341
168515
|
if (opts.gateway !== false)
|
|
167342
168516
|
execSync3("systemctl start matrixos-gateway.service", { stdio: "inherit" });
|
|
168517
|
+
if (opts.cron !== false)
|
|
168518
|
+
execSync3("systemctl start matrixos-cron.service", { stdio: "inherit" });
|
|
167343
168519
|
}
|
|
167344
168520
|
console.log("[service] systemd units installed and started.");
|
|
167345
168521
|
}
|
|
@@ -182042,52 +183218,8 @@ async function boulder(options) {
|
|
|
182042
183218
|
`);
|
|
182043
183219
|
return 0;
|
|
182044
183220
|
}
|
|
182045
|
-
// packages/omo-opencode/src/cli/
|
|
182046
|
-
|
|
182047
|
-
var store2 = createCronStore();
|
|
182048
|
-
function cronAdd(options) {
|
|
182049
|
-
const job = store2.add({
|
|
182050
|
-
name: options.name,
|
|
182051
|
-
schedule: options.schedule,
|
|
182052
|
-
command: options.command,
|
|
182053
|
-
channel: options.channel,
|
|
182054
|
-
recipient: options.recipient,
|
|
182055
|
-
enabled: options.enabled ?? true
|
|
182056
|
-
});
|
|
182057
|
-
console.log(`Added: ${job.id} \u2014 ${job.name} [${job.schedule}]`);
|
|
182058
|
-
return 0;
|
|
182059
|
-
}
|
|
182060
|
-
function cronList(options = {}) {
|
|
182061
|
-
const jobs = store2.list({
|
|
182062
|
-
enabled: options.enabled,
|
|
182063
|
-
channel: options.channel
|
|
182064
|
-
});
|
|
182065
|
-
if (options.json) {
|
|
182066
|
-
console.log(JSON.stringify(jobs, null, 2));
|
|
182067
|
-
} else {
|
|
182068
|
-
if (jobs.length === 0) {
|
|
182069
|
-
console.log("No cron jobs.");
|
|
182070
|
-
return 0;
|
|
182071
|
-
}
|
|
182072
|
-
for (const j of jobs) {
|
|
182073
|
-
const status2 = j.enabled ? "enabled" : "disabled";
|
|
182074
|
-
const delivery = j.channel ? ` \u2192 ${j.channel}/${j.recipient ?? "*"}` : "";
|
|
182075
|
-
console.log(` ${j.id.padEnd(14)} ${status2.padEnd(9)} ${j.schedule.padEnd(12)} ${j.name}${delivery}`);
|
|
182076
|
-
}
|
|
182077
|
-
console.log(`
|
|
182078
|
-
Total: ${jobs.length}`);
|
|
182079
|
-
}
|
|
182080
|
-
return 0;
|
|
182081
|
-
}
|
|
182082
|
-
function cronRemove(options) {
|
|
182083
|
-
const ok = store2.remove(options.id);
|
|
182084
|
-
if (ok) {
|
|
182085
|
-
console.log(`Removed: ${options.id}`);
|
|
182086
|
-
return 0;
|
|
182087
|
-
}
|
|
182088
|
-
console.error(`Not found: ${options.id}`);
|
|
182089
|
-
return 1;
|
|
182090
|
-
}
|
|
183221
|
+
// packages/omo-opencode/src/cli/runtime-commands.ts
|
|
183222
|
+
init_cron();
|
|
182091
183223
|
|
|
182092
183224
|
// packages/daily-brief-core/src/schema.ts
|
|
182093
183225
|
init_zod();
|
|
@@ -182486,13 +183618,13 @@ function isValidTransition(from, to) {
|
|
|
182486
183618
|
}
|
|
182487
183619
|
function createKanbanStore() {
|
|
182488
183620
|
const cards = new Map;
|
|
182489
|
-
let
|
|
183621
|
+
let counter2 = 0;
|
|
182490
183622
|
return {
|
|
182491
183623
|
add(input) {
|
|
182492
|
-
|
|
183624
|
+
counter2 += 1;
|
|
182493
183625
|
const now = new Date().toISOString();
|
|
182494
183626
|
const card = {
|
|
182495
|
-
id: `kanban-${
|
|
183627
|
+
id: `kanban-${counter2}`,
|
|
182496
183628
|
title: input.title,
|
|
182497
183629
|
description: input.description ?? "",
|
|
182498
183630
|
status: input.status ?? "backlog",
|
|
@@ -182638,8 +183770,8 @@ import { basename as basename12, dirname as dirname24, join as join60 } from "pa
|
|
|
182638
183770
|
|
|
182639
183771
|
// packages/skills-loader-core/src/shared/opencode-config-dir.ts
|
|
182640
183772
|
import { existsSync as existsSync64, realpathSync as realpathSync8 } from "fs";
|
|
182641
|
-
import { homedir as
|
|
182642
|
-
import { join as join59, posix as posix5, resolve as
|
|
183773
|
+
import { homedir as homedir23 } from "os";
|
|
183774
|
+
import { join as join59, posix as posix5, resolve as resolve13, win32 as win325 } from "path";
|
|
182643
183775
|
|
|
182644
183776
|
// packages/skills-loader-core/src/shared/plugin-identity.ts
|
|
182645
183777
|
init_src();
|
|
@@ -182672,14 +183804,14 @@ function getTauriConfigDir2(identifier) {
|
|
|
182672
183804
|
const platform2 = process.platform;
|
|
182673
183805
|
switch (platform2) {
|
|
182674
183806
|
case "darwin":
|
|
182675
|
-
return join59(
|
|
183807
|
+
return join59(homedir23(), "Library", "Application Support", identifier);
|
|
182676
183808
|
case "win32": {
|
|
182677
|
-
const appData = process.env.APPDATA || join59(
|
|
183809
|
+
const appData = process.env.APPDATA || join59(homedir23(), "AppData", "Roaming");
|
|
182678
183810
|
return win325.join(appData, identifier);
|
|
182679
183811
|
}
|
|
182680
183812
|
case "linux":
|
|
182681
183813
|
default: {
|
|
182682
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME || join59(
|
|
183814
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join59(homedir23(), ".config");
|
|
182683
183815
|
return join59(xdgConfig, identifier);
|
|
182684
183816
|
}
|
|
182685
183817
|
}
|
|
@@ -182688,7 +183820,7 @@ function resolveConfigPath3(pathValue) {
|
|
|
182688
183820
|
if (isWslEnvironment2() && pathValue.startsWith("/")) {
|
|
182689
183821
|
return posix5.normalize(pathValue);
|
|
182690
183822
|
}
|
|
182691
|
-
const resolvedPath =
|
|
183823
|
+
const resolvedPath = resolve13(pathValue);
|
|
182692
183824
|
if (!existsSync64(resolvedPath))
|
|
182693
183825
|
return resolvedPath;
|
|
182694
183826
|
try {
|
|
@@ -182723,7 +183855,7 @@ function getWslLinuxHomeDir2(windowsConfigRoot) {
|
|
|
182723
183855
|
function getCliDefaultConfigDir2() {
|
|
182724
183856
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
182725
183857
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment2() && isWindowsUserConfigRoot2(envXdgConfig);
|
|
182726
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join59(
|
|
183858
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join59(homedir23(), ".config");
|
|
182727
183859
|
const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") : join59(xdgConfig, "opencode");
|
|
182728
183860
|
return resolveConfigPath3(configDir);
|
|
182729
183861
|
}
|
|
@@ -182790,10 +183922,10 @@ function getOpenCodeSkillDirs2(options) {
|
|
|
182790
183922
|
// packages/skills-loader-core/src/shared/project-discovery-dirs.ts
|
|
182791
183923
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
182792
183924
|
import { existsSync as existsSync65, realpathSync as realpathSync9 } from "fs";
|
|
182793
|
-
import { dirname as dirname25, join as join61, resolve as
|
|
183925
|
+
import { dirname as dirname25, join as join61, resolve as resolve14, win32 as win326 } from "path";
|
|
182794
183926
|
var worktreePathCache2 = new Map;
|
|
182795
183927
|
function normalizePath2(path18) {
|
|
182796
|
-
const resolvedPath = process.platform !== "win32" && win326.isAbsolute(path18) ? path18 :
|
|
183928
|
+
const resolvedPath = process.platform !== "win32" && win326.isAbsolute(path18) ? path18 : resolve14(path18);
|
|
182797
183929
|
if (!existsSync65(resolvedPath)) {
|
|
182798
183930
|
return resolvedPath;
|
|
182799
183931
|
}
|
|
@@ -182848,7 +183980,7 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
|
|
|
182848
183980
|
}
|
|
182849
183981
|
}
|
|
182850
183982
|
function detectWorktreePath(directory) {
|
|
182851
|
-
const resolvedDirectory =
|
|
183983
|
+
const resolvedDirectory = resolve14(directory);
|
|
182852
183984
|
const cacheKey = pathKey2(normalizePath2(resolvedDirectory));
|
|
182853
183985
|
if (worktreePathCache2.has(cacheKey)) {
|
|
182854
183986
|
return worktreePathCache2.get(cacheKey);
|
|
@@ -186299,7 +187431,7 @@ function applySnapshotRetention(options) {
|
|
|
186299
187431
|
}
|
|
186300
187432
|
|
|
186301
187433
|
// packages/omo-opencode/src/cli/snapshot/snapshot.ts
|
|
186302
|
-
import { Database as
|
|
187434
|
+
import { Database as Database4 } from "bun:sqlite";
|
|
186303
187435
|
import {
|
|
186304
187436
|
existsSync as existsSync67,
|
|
186305
187437
|
mkdirSync as mkdirSync21,
|
|
@@ -186330,7 +187462,7 @@ async function snapshotCli(options = {}) {
|
|
|
186330
187462
|
};
|
|
186331
187463
|
const sqlitePort = {
|
|
186332
187464
|
vacuumInto(source, dest) {
|
|
186333
|
-
const db = new
|
|
187465
|
+
const db = new Database4(source);
|
|
186334
187466
|
try {
|
|
186335
187467
|
db.run(`VACUUM INTO '${dest.replace(/'/g, "''")}'`);
|
|
186336
187468
|
} finally {
|
|
@@ -186793,7 +187925,7 @@ function printHumanReadable2(r2) {
|
|
|
186793
187925
|
init_data_path();
|
|
186794
187926
|
import * as path23 from "path";
|
|
186795
187927
|
import { writeFileSync as writeFileSync23 } from "fs";
|
|
186796
|
-
import { Database as
|
|
187928
|
+
import { Database as Database5 } from "bun:sqlite";
|
|
186797
187929
|
function defaultDbPath() {
|
|
186798
187930
|
return path23.join(getDataDir(), "opencode", "opencode.db");
|
|
186799
187931
|
}
|
|
@@ -186857,7 +187989,7 @@ function summarizeMessage(row) {
|
|
|
186857
187989
|
return { label: text, role, agent: agent2, detail: row.id };
|
|
186858
187990
|
}
|
|
186859
187991
|
function buildTrace(dbPath, rootSessionId, options = {}) {
|
|
186860
|
-
const db = new
|
|
187992
|
+
const db = new Database5(dbPath, { readonly: true });
|
|
186861
187993
|
try {
|
|
186862
187994
|
const sessions = readSessions(db);
|
|
186863
187995
|
const anomalies = [];
|
|
@@ -187033,8 +188165,9 @@ import { readFileSync as readFileSync58 } from "fs";
|
|
|
187033
188165
|
import * as os12 from "os";
|
|
187034
188166
|
import * as fs21 from "fs";
|
|
187035
188167
|
import * as path24 from "path";
|
|
187036
|
-
import { Database as
|
|
188168
|
+
import { Database as Database6 } from "bun:sqlite";
|
|
187037
188169
|
init_config_context();
|
|
188170
|
+
init_store();
|
|
187038
188171
|
var BUILTIN_AGENT_NAMES2 = BuiltinAgentNameSchema.options.map((v) => v);
|
|
187039
188172
|
var AGENT_DISPLAY_NAMES2 = {
|
|
187040
188173
|
morpheus: "Morpheus",
|
|
@@ -187128,7 +188261,7 @@ function getDb() {
|
|
|
187128
188261
|
if (!fs21.existsSync(OPENCODE_DB_PATH))
|
|
187129
188262
|
return;
|
|
187130
188263
|
try {
|
|
187131
|
-
return new
|
|
188264
|
+
return new Database6(OPENCODE_DB_PATH, { readonly: true });
|
|
187132
188265
|
} catch {
|
|
187133
188266
|
return;
|
|
187134
188267
|
}
|
|
@@ -187137,7 +188270,7 @@ function getDbWrite() {
|
|
|
187137
188270
|
if (!fs21.existsSync(OPENCODE_DB_PATH))
|
|
187138
188271
|
return;
|
|
187139
188272
|
try {
|
|
187140
|
-
const db = new
|
|
188273
|
+
const db = new Database6(OPENCODE_DB_PATH);
|
|
187141
188274
|
db.exec("PRAGMA journal_mode = WAL");
|
|
187142
188275
|
return db;
|
|
187143
188276
|
} catch {
|
|
@@ -187762,6 +188895,35 @@ ${row.description ? `Description: ${row.description}
|
|
|
187762
188895
|
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
187763
188896
|
}
|
|
187764
188897
|
},
|
|
188898
|
+
listCron() {
|
|
188899
|
+
try {
|
|
188900
|
+
return createCronStore().list();
|
|
188901
|
+
} catch {
|
|
188902
|
+
return [];
|
|
188903
|
+
}
|
|
188904
|
+
},
|
|
188905
|
+
addCron(input) {
|
|
188906
|
+
try {
|
|
188907
|
+
const job = createCronStore().add({
|
|
188908
|
+
name: input.name,
|
|
188909
|
+
schedule: input.schedule,
|
|
188910
|
+
command: input.command,
|
|
188911
|
+
channel: input.channel ?? undefined,
|
|
188912
|
+
enabled: true
|
|
188913
|
+
});
|
|
188914
|
+
return { ok: true, id: job.id };
|
|
188915
|
+
} catch (e) {
|
|
188916
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
188917
|
+
}
|
|
188918
|
+
},
|
|
188919
|
+
removeCron(id) {
|
|
188920
|
+
try {
|
|
188921
|
+
const ok = createCronStore().remove(id);
|
|
188922
|
+
return ok ? { ok: true } : { ok: false, error: "not found" };
|
|
188923
|
+
} catch (e) {
|
|
188924
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
188925
|
+
}
|
|
188926
|
+
},
|
|
187765
188927
|
async getIncidents(limit = 50) {
|
|
187766
188928
|
const lines = readJsonl("anti-loop.jsonl");
|
|
187767
188929
|
if (lines.length === 0) {
|
|
@@ -187873,7 +189035,7 @@ ${row.description ? `Description: ${row.description}
|
|
|
187873
189035
|
const dbPath = path24.resolve(os12.homedir(), ".matrixos", "memory", "episodic.db");
|
|
187874
189036
|
try {
|
|
187875
189037
|
if (fs21.existsSync(dbPath)) {
|
|
187876
|
-
const db = new
|
|
189038
|
+
const db = new Database6(dbPath);
|
|
187877
189039
|
const tables = db.query("SELECT name FROM sqlite_master WHERE type='table'").all();
|
|
187878
189040
|
const tableNames = tables.map((t2) => String(t2.name ?? ""));
|
|
187879
189041
|
if (tableNames.includes("memories")) {
|
|
@@ -188169,8 +189331,25 @@ function createDashboardServer(dataProvider, config5) {
|
|
|
188169
189331
|
}
|
|
188170
189332
|
case "/api/memory":
|
|
188171
189333
|
return Response.json(dataProvider.getMemory(), { headers: jsonHeaders });
|
|
188172
|
-
case "/api/
|
|
188173
|
-
|
|
189334
|
+
case "/api/cron": {
|
|
189335
|
+
if (req.method === "POST") {
|
|
189336
|
+
const body = await req.json();
|
|
189337
|
+
if (!body.name || !body.schedule || !body.command) {
|
|
189338
|
+
return Response.json({ ok: false, error: "name, schedule and command required" }, { status: 400, headers: jsonHeaders });
|
|
189339
|
+
}
|
|
189340
|
+
const result = dataProvider.addCron(body);
|
|
189341
|
+
return Response.json(result, { status: result.ok ? 201 : 500, headers: jsonHeaders });
|
|
189342
|
+
}
|
|
189343
|
+
if (req.method === "DELETE") {
|
|
189344
|
+
const id = url3.searchParams.get("id");
|
|
189345
|
+
if (!id) {
|
|
189346
|
+
return Response.json({ ok: false, error: "id required" }, { status: 400, headers: jsonHeaders });
|
|
189347
|
+
}
|
|
189348
|
+
const result = dataProvider.removeCron(id);
|
|
189349
|
+
return Response.json(result, { status: result.ok ? 200 : 500, headers: jsonHeaders });
|
|
189350
|
+
}
|
|
189351
|
+
return Response.json(dataProvider.listCron(), { headers: jsonHeaders });
|
|
189352
|
+
}
|
|
188174
189353
|
case "/api/skills/create": {
|
|
188175
189354
|
if (req.method !== "POST") {
|
|
188176
189355
|
return new Response("Method Not Allowed", { status: 405, headers: corsHeaders });
|
|
@@ -188282,14 +189461,14 @@ async function dashboardCli(options) {
|
|
|
188282
189461
|
console.log(`[dashboard] ready \u2014 http://${host}:${port3}`);
|
|
188283
189462
|
if (!options.daemon) {
|
|
188284
189463
|
console.log("[dashboard] press Ctrl+C to stop");
|
|
188285
|
-
await new Promise((
|
|
189464
|
+
await new Promise((resolve17) => {
|
|
188286
189465
|
process.on("SIGINT", () => {
|
|
188287
189466
|
server2.stop();
|
|
188288
|
-
|
|
189467
|
+
resolve17();
|
|
188289
189468
|
});
|
|
188290
189469
|
process.on("SIGTERM", () => {
|
|
188291
189470
|
server2.stop();
|
|
188292
|
-
|
|
189471
|
+
resolve17();
|
|
188293
189472
|
});
|
|
188294
189473
|
});
|
|
188295
189474
|
} else {
|
|
@@ -189039,6 +190218,43 @@ For channel-specific setup, use:
|
|
|
189039
190218
|
function runCli() {
|
|
189040
190219
|
program2.parse();
|
|
189041
190220
|
}
|
|
190221
|
+
var cron3 = program2.command("cron").description("Cron / Scheduled jobs (durable, SQLite-backed)");
|
|
190222
|
+
cron3.command("add <name> <schedule> <command>").description("Add a scheduled job. Schedule is a cron expression, e.g. '0 9 * * 1'").option("-c, --channel <channel>", "Delivery channel (telegram/discord/whatsapp)").option("-r, --recipient <id>", "Delivery recipient id").option("--disabled", "Create disabled").option("--json", "Output as JSON").addHelpText("after", `
|
|
190223
|
+
Examples:
|
|
190224
|
+
$ matrixos cron add "daily brief" "0 9 * * *" "matrixos run --agent TheOracle 'daily brief'"
|
|
190225
|
+
$ matrixos cron add "weekly audit" "0 22 * * 0" "matrixos self-audit" --channel telegram
|
|
190226
|
+
`).action(async (name2, schedule2, command, options) => {
|
|
190227
|
+
const { cronAdd: cronAdd2 } = await Promise.resolve().then(() => (init_cron(), exports_cron));
|
|
190228
|
+
const code = cronAdd2({
|
|
190229
|
+
name: name2,
|
|
190230
|
+
schedule: schedule2,
|
|
190231
|
+
command,
|
|
190232
|
+
channel: options.channel,
|
|
190233
|
+
recipient: options.recipient,
|
|
190234
|
+
enabled: !options.disabled
|
|
190235
|
+
});
|
|
190236
|
+
process.exit(code);
|
|
190237
|
+
});
|
|
190238
|
+
cron3.command("list").description("List scheduled jobs").option("--enabled", "Only enabled jobs").option("--channel <channel>", "Filter by channel").option("--json", "Output as JSON").action(async (options) => {
|
|
190239
|
+
const { cronList: cronList2 } = await Promise.resolve().then(() => (init_cron(), exports_cron));
|
|
190240
|
+
const code = cronList2({ enabled: options.enabled, channel: options.channel, json: options.json });
|
|
190241
|
+
process.exit(code);
|
|
190242
|
+
});
|
|
190243
|
+
cron3.command("remove <id>").description("Remove a scheduled job by id").action(async (id) => {
|
|
190244
|
+
const { cronRemove: cronRemove2 } = await Promise.resolve().then(() => (init_cron(), exports_cron));
|
|
190245
|
+
const code = cronRemove2({ id });
|
|
190246
|
+
process.exit(code);
|
|
190247
|
+
});
|
|
190248
|
+
cron3.command("start").description("Start the cron scheduler (runs in foreground; pair with systemd for daemon mode)").option("--daemon", "Park the event loop (for systemd service)").action(async (options) => {
|
|
190249
|
+
const { cronStart: cronStart2 } = await Promise.resolve().then(() => (init_cron(), exports_cron));
|
|
190250
|
+
const code = cronStart2({ daemon: options.daemon });
|
|
190251
|
+
process.exit(code);
|
|
190252
|
+
});
|
|
190253
|
+
cron3.command("stop").description("Stop the cron scheduler (terminates the running scheduler process)").action(async () => {
|
|
190254
|
+
const { cronStop: cronStop2 } = await Promise.resolve().then(() => (init_cron(), exports_cron));
|
|
190255
|
+
const code = cronStop2();
|
|
190256
|
+
process.exit(code);
|
|
190257
|
+
});
|
|
189042
190258
|
var rgpd = program2.command("rgpd").description("RGPD compliance commands \u2014 consent, forget, export (\xA718.2)");
|
|
189043
190259
|
rgpd.command("forget").description("Delete user data (right to erasure)").option("--all", "Full wipe of all MaTrixOS data").option("--session-id <id>", "Delete data related to a specific session ID").option("--user-id <id>", "Delete data related to a specific user/sender ID").option("--dry-run", "Simulate only \u2014 print what would be deleted").option("--json", "Output as JSON").addHelpText("after", `
|
|
189044
190260
|
Examples:
|
|
@@ -189102,7 +190318,7 @@ Examples:
|
|
|
189102
190318
|
process.stdout.write(result.stdout);
|
|
189103
190319
|
process.exit(result.exitCode);
|
|
189104
190320
|
});
|
|
189105
|
-
program2.command("service").description("Install MaTrixOS as a persistent OS service (dashboard + gateway)").argument("<action>", "install | uninstall").option("--no-dashboard", "Skip dashboard service").option("--no-gateway", "Skip gateway service").option("--user", "Install as current user (systemd --user / launchd user agent)").action(async (action, options) => {
|
|
190321
|
+
program2.command("service").description("Install MaTrixOS as a persistent OS service (dashboard + gateway)").argument("<action>", "install | uninstall").option("--no-dashboard", "Skip dashboard service").option("--no-gateway", "Skip gateway service").option("--no-cron", "Skip cron scheduler service").option("--user", "Install as current user (systemd --user / launchd user agent)").action(async (action, options) => {
|
|
189106
190322
|
if (action !== "install" && action !== "uninstall") {
|
|
189107
190323
|
console.error(`[service] unknown action: ${action}. Use 'install' or 'uninstall'.`);
|
|
189108
190324
|
process.exit(1);
|
|
@@ -189115,6 +190331,7 @@ program2.command("service").description("Install MaTrixOS as a persistent OS ser
|
|
|
189115
190331
|
const exitCode = await serviceInstallCommand2({
|
|
189116
190332
|
dashboard: options.dashboard ?? true,
|
|
189117
190333
|
gateway: options.gateway ?? true,
|
|
190334
|
+
cron: options.cron ?? true,
|
|
189118
190335
|
user: options.user ?? false
|
|
189119
190336
|
});
|
|
189120
190337
|
process.exit(exitCode);
|