@garygentry/system1 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/chunks/{bin-TIEUYIP3.mjs → bin-X4SS2GSC.mjs} +26 -15
- package/dist/bundle/chunks/chunk-45YUIPYC.mjs +914 -0
- package/dist/bundle/chunks/chunk-7OZLIHEM.mjs +46 -0
- package/dist/bundle/chunks/chunk-MH6THLCO.mjs +73 -0
- package/dist/bundle/chunks/{chunk-XNRV73UE.mjs → chunk-SUUJE62R.mjs} +2 -2
- package/dist/bundle/chunks/{chunk-QYUSJUFX.mjs → chunk-TMAJXDTE.mjs} +944 -1226
- package/dist/bundle/chunks/chunk-WVMA3PGV.mjs +69 -0
- package/dist/bundle/chunks/{config-KXGUNAJR.mjs → config-54JZCBR5.mjs} +15 -4
- package/dist/bundle/chunks/{decide-HI5CUH3C.mjs → decide-AU2C3U6C.mjs} +10 -5
- package/dist/bundle/chunks/{doctor-NDV3Y6T7.mjs → doctor-JKWORTJP.mjs} +6 -3
- package/dist/bundle/chunks/done-check-PCXUZT7Q.mjs +661 -0
- package/dist/bundle/chunks/guard-TZPV4JV3.mjs +113 -0
- package/dist/bundle/chunks/hook-LZ37YGT4.mjs +189 -0
- package/dist/bundle/chunks/{misc-6SDKH2PI.mjs → misc-CZLLPSHU.mjs} +14 -8
- package/dist/bundle/chunks/{opportunities-ONEIYAG3.mjs → opportunities-ICJLJYG4.mjs} +10 -5
- package/dist/bundle/chunks/{route-BF5J2NLU.mjs → route-D7T7YYDE.mjs} +8 -4
- package/dist/bundle/chunks/{spec-GLTPEEON.mjs → spec-6E5RXMGH.mjs} +14 -8
- package/dist/bundle/decide.mjs +1 -1
- package/package.json +1 -1
- package/dist/bundle/chunks/chunk-WZIVOY5Q.mjs +0 -171
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { createRequire as __decideRequire } from "node:module"; const require = __decideRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
EXIT,
|
|
4
|
+
exitFor
|
|
5
|
+
} from "./chunk-7OZLIHEM.mjs";
|
|
6
|
+
import {
|
|
7
|
+
DecisionsError,
|
|
8
|
+
isDecisionsError
|
|
9
|
+
} from "./chunk-MH6THLCO.mjs";
|
|
10
|
+
|
|
11
|
+
// src/envelope.ts
|
|
12
|
+
var ENVELOPE_VERSION = 1;
|
|
13
|
+
var FORMATS = ["json", "jsonl", "brief"];
|
|
14
|
+
function ok(command, result) {
|
|
15
|
+
return { v: ENVELOPE_VERSION, ok: true, command, result };
|
|
16
|
+
}
|
|
17
|
+
function fail(command, code, message, details) {
|
|
18
|
+
return {
|
|
19
|
+
v: ENVELOPE_VERSION,
|
|
20
|
+
ok: false,
|
|
21
|
+
command,
|
|
22
|
+
error: { code, message, ...details && Object.keys(details).length ? { details } : {} }
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/run.ts
|
|
27
|
+
async function emit(io, command, format, body, render = () => void 0) {
|
|
28
|
+
try {
|
|
29
|
+
const result = await body();
|
|
30
|
+
io.out(render(result, format) ?? JSON.stringify(ok(command, result)));
|
|
31
|
+
return EXIT.ok;
|
|
32
|
+
} catch (error) {
|
|
33
|
+
const code = isDecisionsError(error) ? error.code : "error";
|
|
34
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
35
|
+
const details = isDecisionsError(error) ? error.details : void 0;
|
|
36
|
+
io.out(
|
|
37
|
+
format === "brief" ? `decide ${command}: error ${code} \u2014 ${message}` : JSON.stringify(fail(command, code, message, details))
|
|
38
|
+
);
|
|
39
|
+
if (!isDecisionsError(error) && error instanceof Error && io.env.SYSTEM1_DEBUG)
|
|
40
|
+
io.err(error.stack ?? "");
|
|
41
|
+
return exitFor(code);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function extractFormat(argv, fallback) {
|
|
45
|
+
const rest = [];
|
|
46
|
+
let format;
|
|
47
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
48
|
+
const arg = argv[i];
|
|
49
|
+
if (arg === "--format") {
|
|
50
|
+
format = argv[i + 1];
|
|
51
|
+
i += 1;
|
|
52
|
+
} else if (arg.startsWith("--format=")) {
|
|
53
|
+
format = arg.slice("--format=".length);
|
|
54
|
+
} else {
|
|
55
|
+
rest.push(arg);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (format === void 0) return { format: fallback, rest, explicit: false };
|
|
59
|
+
if (!FORMATS.includes(format)) {
|
|
60
|
+
throw new DecisionsError("invalid-request", `--format must be one of ${FORMATS.join(", ")}`);
|
|
61
|
+
}
|
|
62
|
+
return { format, rest, explicit: true };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
ENVELOPE_VERSION,
|
|
67
|
+
emit,
|
|
68
|
+
extractFormat
|
|
69
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createRequire as __decideRequire } from "node:module"; const require = __decideRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
typedParse
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SUUJE62R.mjs";
|
|
5
|
+
import "./chunk-45YUIPYC.mjs";
|
|
5
6
|
import {
|
|
6
7
|
DEFAULT_EXCLUDES,
|
|
7
8
|
activeTriggers,
|
|
@@ -10,11 +11,14 @@ import {
|
|
|
10
11
|
loadConfig,
|
|
11
12
|
repoConfigPath,
|
|
12
13
|
setConsent
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TMAJXDTE.mjs";
|
|
14
15
|
import {
|
|
15
|
-
DecisionsError,
|
|
16
16
|
emit
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WVMA3PGV.mjs";
|
|
18
|
+
import "./chunk-7OZLIHEM.mjs";
|
|
19
|
+
import {
|
|
20
|
+
DecisionsError
|
|
21
|
+
} from "./chunk-MH6THLCO.mjs";
|
|
18
22
|
|
|
19
23
|
// src/commands/config.ts
|
|
20
24
|
function runConfigCommand(argv, io, format) {
|
|
@@ -106,6 +110,7 @@ function show(io, cwd) {
|
|
|
106
110
|
*/
|
|
107
111
|
profiles: allProfiles(config).filter((p) => config.profiles.some((c) => c.id === p.id)),
|
|
108
112
|
route: config.route,
|
|
113
|
+
guard: config.guard,
|
|
109
114
|
files: config.layers,
|
|
110
115
|
specDirs: ctx.specDirs,
|
|
111
116
|
warnings: config.warnings
|
|
@@ -126,10 +131,16 @@ function brief(r) {
|
|
|
126
131
|
`budget: ${r.budget.maxCalls} calls / $${r.budget.maxUsd} per request \xB7 concurrency ${r.concurrency} \xB7 timeout ${r.timeoutMs} ms`,
|
|
127
132
|
...r.profiles.length ? [`profiles: ${r.profiles.map((p) => p.id).join(", ")}`] : [],
|
|
128
133
|
`route: ${routeLine(r.route)}`,
|
|
134
|
+
`guard: ${guardLine(r.guard, c.granted)}`,
|
|
129
135
|
`session: ${r.session ? `${r.session} (${r.sessionOrigin === "env" ? "SYSTEM1_SESSION" : `detected from ${r.sessionOrigin}`})` : "none"}`,
|
|
130
136
|
...r.warnings.length ? [`ignored: ${r.warnings.join("; ")}`] : []
|
|
131
137
|
].join("\n");
|
|
132
138
|
}
|
|
139
|
+
function guardLine(guard, consent) {
|
|
140
|
+
const on = Object.entries(guard.packs).filter(([, p]) => p.enabled).map(([name]) => name);
|
|
141
|
+
if (on.length === 0) return "no pack enabled";
|
|
142
|
+
return `${on.join(", ")} enabled${consent ? "" : " (dormant: no egress consent)"}`;
|
|
143
|
+
}
|
|
133
144
|
function routeLine(route) {
|
|
134
145
|
if (!route.enabled) return "off";
|
|
135
146
|
try {
|
|
@@ -6,17 +6,22 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
buildInput,
|
|
8
8
|
parseDecideFlags
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SUUJE62R.mjs";
|
|
10
10
|
import {
|
|
11
|
-
createContext,
|
|
12
11
|
runAsk,
|
|
13
12
|
runMany
|
|
14
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-45YUIPYC.mjs";
|
|
14
|
+
import {
|
|
15
|
+
createContext
|
|
16
|
+
} from "./chunk-TMAJXDTE.mjs";
|
|
15
17
|
import {
|
|
16
|
-
DecisionsError,
|
|
17
18
|
ENVELOPE_VERSION,
|
|
18
19
|
emit
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-WVMA3PGV.mjs";
|
|
21
|
+
import "./chunk-7OZLIHEM.mjs";
|
|
22
|
+
import {
|
|
23
|
+
DecisionsError
|
|
24
|
+
} from "./chunk-MH6THLCO.mjs";
|
|
20
25
|
|
|
21
26
|
// src/commands/decide.ts
|
|
22
27
|
import { readFileSync } from "node:fs";
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { createRequire as __decideRequire } from "node:module"; const require = __decideRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
runDoctor
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-45YUIPYC.mjs";
|
|
5
|
+
import "./chunk-TMAJXDTE.mjs";
|
|
5
6
|
import {
|
|
6
7
|
emit
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WVMA3PGV.mjs";
|
|
9
|
+
import "./chunk-7OZLIHEM.mjs";
|
|
10
|
+
import "./chunk-MH6THLCO.mjs";
|
|
8
11
|
|
|
9
12
|
// src/commands/doctor.ts
|
|
10
13
|
import { execFile } from "node:child_process";
|
|
@@ -35,7 +38,7 @@ function brief(r) {
|
|
|
35
38
|
}
|
|
36
39
|
function headline(r) {
|
|
37
40
|
if (!r.healthy) return "PROBLEMS FOUND";
|
|
38
|
-
const missing = r.checks.filter((c) => c.status === "warn").map((c) => c.name);
|
|
41
|
+
const missing = r.checks.filter((c) => c.status === "warn" && !c.advisory).map((c) => c.name);
|
|
39
42
|
return !r.live && missing.length > 0 ? `SETUP NEEDED (${missing.join(", ")})` : "healthy";
|
|
40
43
|
}
|
|
41
44
|
function probeVersion(path, env, timeoutMs = 2e3) {
|