@garygentry/system1 0.4.0 → 0.4.1
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-NJIZOMS4.mjs} +11 -11
- package/dist/bundle/chunks/{chunk-XNRV73UE.mjs → chunk-A7OWKSHE.mjs} +2 -2
- package/dist/bundle/chunks/{chunk-WZIVOY5Q.mjs → chunk-B62DSXC3.mjs} +1 -1
- package/dist/bundle/chunks/{chunk-QYUSJUFX.mjs → chunk-CUKOJ7OM.mjs} +48 -12
- package/dist/bundle/chunks/{config-KXGUNAJR.mjs → config-7OESN6WC.mjs} +3 -3
- package/dist/bundle/chunks/{decide-HI5CUH3C.mjs → decide-QXDMZDNT.mjs} +3 -3
- package/dist/bundle/chunks/{doctor-NDV3Y6T7.mjs → doctor-EXJQQ7NY.mjs} +3 -3
- package/dist/bundle/chunks/{misc-6SDKH2PI.mjs → misc-2SNIZHU6.mjs} +3 -3
- package/dist/bundle/chunks/{opportunities-ONEIYAG3.mjs → opportunities-I6VON6X7.mjs} +3 -3
- package/dist/bundle/chunks/{route-BF5J2NLU.mjs → route-JQO5EDAN.mjs} +3 -3
- package/dist/bundle/chunks/{spec-GLTPEEON.mjs → spec-56ZXLEYW.mjs} +3 -3
- package/dist/bundle/decide.mjs +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
VERSION,
|
|
7
7
|
emit,
|
|
8
8
|
extractFormat
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-B62DSXC3.mjs";
|
|
10
10
|
|
|
11
11
|
// src/bin.ts
|
|
12
12
|
import { readFileSync } from "node:fs";
|
|
@@ -66,25 +66,25 @@ async function main(argv, io) {
|
|
|
66
66
|
}
|
|
67
67
|
switch (command) {
|
|
68
68
|
case "ask":
|
|
69
|
-
return (await import("./decide-
|
|
69
|
+
return (await import("./decide-QXDMZDNT.mjs")).runAskCommand(rest, io, format);
|
|
70
70
|
case "many":
|
|
71
|
-
return (await import("./decide-
|
|
71
|
+
return (await import("./decide-QXDMZDNT.mjs")).runManyCommand(rest, io, format);
|
|
72
72
|
case "usage":
|
|
73
|
-
return (await import("./misc-
|
|
73
|
+
return (await import("./misc-2SNIZHU6.mjs")).runUsageCommand(rest, io, format);
|
|
74
74
|
case "config":
|
|
75
|
-
return (await import("./config-
|
|
75
|
+
return (await import("./config-7OESN6WC.mjs")).runConfigCommand(rest, io, format);
|
|
76
76
|
case "spec":
|
|
77
|
-
return (await import("./spec-
|
|
77
|
+
return (await import("./spec-56ZXLEYW.mjs")).runSpecCommand(rest, io, format);
|
|
78
78
|
case "opportunities":
|
|
79
|
-
return (await import("./opportunities-
|
|
79
|
+
return (await import("./opportunities-I6VON6X7.mjs")).runOpportunitiesCommand(rest, io, format);
|
|
80
80
|
case "schema":
|
|
81
|
-
return (await import("./misc-
|
|
81
|
+
return (await import("./misc-2SNIZHU6.mjs")).runSchemaCommand(rest, io, format);
|
|
82
82
|
case "route":
|
|
83
|
-
return (await import("./route-
|
|
83
|
+
return (await import("./route-JQO5EDAN.mjs")).runRouteCommand(rest, io, format);
|
|
84
84
|
case "ping":
|
|
85
|
-
return (await import("./misc-
|
|
85
|
+
return (await import("./misc-2SNIZHU6.mjs")).runPingCommand(io, format);
|
|
86
86
|
case "doctor":
|
|
87
|
-
return (await import("./doctor-
|
|
87
|
+
return (await import("./doctor-EXJQQ7NY.mjs")).runDoctorCommand(io, format);
|
|
88
88
|
case "version":
|
|
89
89
|
case "--version":
|
|
90
90
|
case "-v":
|
|
@@ -2,10 +2,10 @@ import { createRequire as __decideRequire } from "node:module"; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
parseFileRef,
|
|
4
4
|
parseQuestionSet
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CUKOJ7OM.mjs";
|
|
6
6
|
import {
|
|
7
7
|
DecisionsError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-B62DSXC3.mjs";
|
|
9
9
|
|
|
10
10
|
// src/args.ts
|
|
11
11
|
import { readFileSync } from "node:fs";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
__require,
|
|
10
10
|
__toESM,
|
|
11
11
|
isDecisionsError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-B62DSXC3.mjs";
|
|
13
13
|
|
|
14
14
|
// ../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/nodes/identity.js
|
|
15
15
|
var require_identity = __commonJS({
|
|
@@ -9598,6 +9598,7 @@ function loadConfig(options = {}) {
|
|
|
9598
9598
|
repoRoot,
|
|
9599
9599
|
apiKey: key?.value,
|
|
9600
9600
|
apiKeySource: key?.source,
|
|
9601
|
+
apiKeyQuoted: key?.quoted ?? false,
|
|
9601
9602
|
replay: /^(1|true|yes)$/i.test(env.SYSTEM1_REPLAY ?? ""),
|
|
9602
9603
|
session: session?.id,
|
|
9603
9604
|
sessionOrigin: session?.origin,
|
|
@@ -9841,18 +9842,36 @@ function triggerList(value, file) {
|
|
|
9841
9842
|
});
|
|
9842
9843
|
}
|
|
9843
9844
|
function resolveApiKey(env, userDir) {
|
|
9844
|
-
const fromEnv =
|
|
9845
|
+
const fromEnv = unquoteKey(env.OPENROUTER_API_KEY);
|
|
9845
9846
|
if (fromEnv)
|
|
9846
|
-
return {
|
|
9847
|
+
return { ...fromEnv, source: "env" };
|
|
9847
9848
|
const file = join(userDir, "credentials");
|
|
9848
9849
|
if (!existsSync(file))
|
|
9849
9850
|
return void 0;
|
|
9850
9851
|
if (process.platform !== "win32" && (statSync(file).mode & 63) !== 0) {
|
|
9851
9852
|
throw new DecisionsError("config-error", `${file} is readable by other users. Run \`chmod 600 ${file}\`.`, { file });
|
|
9852
9853
|
}
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9854
|
+
let parsed;
|
|
9855
|
+
try {
|
|
9856
|
+
parsed = readLayer(file);
|
|
9857
|
+
} catch {
|
|
9858
|
+
throw new DecisionsError("config-error", `${file} is not a valid YAML mapping; it should hold one line, \`openrouter_api_key: <key>\``, { file });
|
|
9859
|
+
}
|
|
9860
|
+
const key = unquoteKey(typeof parsed?.openrouter_api_key === "string" ? parsed.openrouter_api_key : void 0, `openrouter_api_key in ${file}`);
|
|
9861
|
+
return key ? { ...key, source: "credentials", file } : void 0;
|
|
9862
|
+
}
|
|
9863
|
+
function unquoteKey(raw, source = "OPENROUTER_API_KEY") {
|
|
9864
|
+
const value = nonEmpty2(raw);
|
|
9865
|
+
if (!value)
|
|
9866
|
+
return void 0;
|
|
9867
|
+
const quoted = /^(["']).*\1$/s.test(value);
|
|
9868
|
+
const key = quoted ? nonEmpty2(value.slice(1, -1)) : value;
|
|
9869
|
+
if (!key)
|
|
9870
|
+
return void 0;
|
|
9871
|
+
if (/[^\x21-\x7e]/.test(key)) {
|
|
9872
|
+
throw new DecisionsError("config-error", `${source} contains a space, line break or other character an API key can't have; set it again`);
|
|
9873
|
+
}
|
|
9874
|
+
return { value: key, quoted };
|
|
9856
9875
|
}
|
|
9857
9876
|
function nonEmpty2(value) {
|
|
9858
9877
|
return value === void 0 || value.trim() === "" ? void 0 : value.trim();
|
|
@@ -21082,12 +21101,23 @@ async function runDoctor(options) {
|
|
|
21082
21101
|
fix: "correct or remove these keys (docs/configuration.md lists every key)"
|
|
21083
21102
|
});
|
|
21084
21103
|
}
|
|
21085
|
-
|
|
21104
|
+
const credentials = join6(userConfigDir(env, options.home), "credentials");
|
|
21105
|
+
checks.push(config.apiKey && config.apiKeyQuoted ? {
|
|
21106
|
+
name: "key",
|
|
21107
|
+
status: "warn",
|
|
21108
|
+
detail: `OPENROUTER_API_KEY present (${config.apiKeySource}), but wrapped in quotes; they were removed`,
|
|
21109
|
+
fix: config.apiKeySource === "env" ? "set OPENROUTER_API_KEY without the surrounding quotes" : `remove the extra quotes around openrouter_api_key in ${credentials}`,
|
|
21110
|
+
advisory: true
|
|
21111
|
+
} : config.apiKey ? {
|
|
21112
|
+
name: "key",
|
|
21113
|
+
status: "ok",
|
|
21114
|
+
detail: `OPENROUTER_API_KEY present (${config.apiKeySource})`
|
|
21115
|
+
} : {
|
|
21086
21116
|
name: "key",
|
|
21087
21117
|
status: "warn",
|
|
21088
21118
|
detail: "no API key: only replay works",
|
|
21089
21119
|
// The file this shell would read: XDG_CONFIG_HOME moves it.
|
|
21090
|
-
fix: `set OPENROUTER_API_KEY, or write \`openrouter_api_key: <key>\` to ${
|
|
21120
|
+
fix: `set OPENROUTER_API_KEY, or write \`openrouter_api_key: <key>\` to ${credentials} (create its directory first; chmod 600)`
|
|
21091
21121
|
});
|
|
21092
21122
|
checks.push(config.egress.consent.granted ? { name: "consent", status: "ok", detail: `egress consent granted for ${config.repoRoot}` } : {
|
|
21093
21123
|
name: "consent",
|
|
@@ -21141,8 +21171,8 @@ function pathCheck(harness, env) {
|
|
|
21141
21171
|
return {
|
|
21142
21172
|
name: "path",
|
|
21143
21173
|
status: "warn",
|
|
21144
|
-
detail: "decide is not on PATH, so the
|
|
21145
|
-
fix:
|
|
21174
|
+
detail: "decide is not on PATH, so the System 1 plugin's bin/ is not loaded",
|
|
21175
|
+
fix: `npm i -g ${CLI_PACKAGE}@${VERSION} (also puts decide in your own terminal), or install the System 1 plugin from its marketplace`
|
|
21146
21176
|
};
|
|
21147
21177
|
}
|
|
21148
21178
|
return {
|
|
@@ -21374,7 +21404,6 @@ function lintSpec(spec) {
|
|
|
21374
21404
|
var NUMERIC = /* @__PURE__ */ new Set([">=", ">", "<=", "<"]);
|
|
21375
21405
|
function lintQuestion(name, q) {
|
|
21376
21406
|
const out = [];
|
|
21377
|
-
const texts = [q.instructions, ...criteriaTexts(q)];
|
|
21378
21407
|
if (q.type === "choice") {
|
|
21379
21408
|
const options = Object.entries(q.criteria);
|
|
21380
21409
|
const wayOut = ([key, desc]) => key.split(/[_\-\s/]+/).some((t) => WAY_OUT_KEY.test(t)) || WAY_OUT_TEXT.test(desc);
|
|
@@ -21636,10 +21665,17 @@ function resolveConnection(env = process.env) {
|
|
|
21636
21665
|
return {
|
|
21637
21666
|
endpoint: nonEmpty3(env.SYSTEM1_ENDPOINT) ?? DEFAULT_ENDPOINT,
|
|
21638
21667
|
model: nonEmpty3(env.SYSTEM1_MODEL) ?? DEFAULT_MODEL,
|
|
21639
|
-
apiKey:
|
|
21668
|
+
apiKey: envKey(env),
|
|
21640
21669
|
replay: /^(1|true|yes)$/i.test(env.SYSTEM1_REPLAY ?? "")
|
|
21641
21670
|
};
|
|
21642
21671
|
}
|
|
21672
|
+
function envKey(env) {
|
|
21673
|
+
try {
|
|
21674
|
+
return unquoteKey(env.OPENROUTER_API_KEY)?.value;
|
|
21675
|
+
} catch {
|
|
21676
|
+
return void 0;
|
|
21677
|
+
}
|
|
21678
|
+
}
|
|
21643
21679
|
function nonEmpty3(value) {
|
|
21644
21680
|
return value === void 0 || value.trim() === "" ? void 0 : value.trim();
|
|
21645
21681
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
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-A7OWKSHE.mjs";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_EXCLUDES,
|
|
7
7
|
activeTriggers,
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
loadConfig,
|
|
11
11
|
repoConfigPath,
|
|
12
12
|
setConsent
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CUKOJ7OM.mjs";
|
|
14
14
|
import {
|
|
15
15
|
DecisionsError,
|
|
16
16
|
emit
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-B62DSXC3.mjs";
|
|
18
18
|
|
|
19
19
|
// src/commands/config.ts
|
|
20
20
|
function runConfigCommand(argv, io, format) {
|
|
@@ -6,17 +6,17 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
buildInput,
|
|
8
8
|
parseDecideFlags
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-A7OWKSHE.mjs";
|
|
10
10
|
import {
|
|
11
11
|
createContext,
|
|
12
12
|
runAsk,
|
|
13
13
|
runMany
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CUKOJ7OM.mjs";
|
|
15
15
|
import {
|
|
16
16
|
DecisionsError,
|
|
17
17
|
ENVELOPE_VERSION,
|
|
18
18
|
emit
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-B62DSXC3.mjs";
|
|
20
20
|
|
|
21
21
|
// src/commands/decide.ts
|
|
22
22
|
import { readFileSync } from "node:fs";
|
|
@@ -1,10 +1,10 @@
|
|
|
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-CUKOJ7OM.mjs";
|
|
5
5
|
import {
|
|
6
6
|
emit
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-B62DSXC3.mjs";
|
|
8
8
|
|
|
9
9
|
// src/commands/doctor.ts
|
|
10
10
|
import { execFile } from "node:child_process";
|
|
@@ -35,7 +35,7 @@ function brief(r) {
|
|
|
35
35
|
}
|
|
36
36
|
function headline(r) {
|
|
37
37
|
if (!r.healthy) return "PROBLEMS FOUND";
|
|
38
|
-
const missing = r.checks.filter((c) => c.status === "warn").map((c) => c.name);
|
|
38
|
+
const missing = r.checks.filter((c) => c.status === "warn" && !c.advisory).map((c) => c.name);
|
|
39
39
|
return !r.live && missing.length > 0 ? `SETUP NEEDED (${missing.join(", ")})` : "healthy";
|
|
40
40
|
}
|
|
41
41
|
function probeVersion(path, env, timeoutMs = 2e3) {
|
|
@@ -1,7 +1,7 @@
|
|
|
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-A7OWKSHE.mjs";
|
|
5
5
|
import {
|
|
6
6
|
TOOL_SCHEMAS,
|
|
7
7
|
createContext,
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
probeUrl,
|
|
11
11
|
resolveConnection,
|
|
12
12
|
runUsage
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CUKOJ7OM.mjs";
|
|
14
14
|
import {
|
|
15
15
|
DecisionsError,
|
|
16
16
|
EXIT,
|
|
17
17
|
emit,
|
|
18
18
|
isDecisionsError
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-B62DSXC3.mjs";
|
|
20
20
|
|
|
21
21
|
// src/commands/misc.ts
|
|
22
22
|
function runSchemaCommand(argv, io, format) {
|
|
@@ -1,17 +1,17 @@
|
|
|
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-A7OWKSHE.mjs";
|
|
5
5
|
import {
|
|
6
6
|
createContext,
|
|
7
7
|
runOpportunitiesAdd,
|
|
8
8
|
runOpportunitiesCheck,
|
|
9
9
|
runOpportunitiesList
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CUKOJ7OM.mjs";
|
|
11
11
|
import {
|
|
12
12
|
DecisionsError,
|
|
13
13
|
emit
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-B62DSXC3.mjs";
|
|
15
15
|
|
|
16
16
|
// src/commands/opportunities.ts
|
|
17
17
|
import { readFileSync } from "node:fs";
|
|
@@ -1,14 +1,14 @@
|
|
|
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-A7OWKSHE.mjs";
|
|
5
5
|
import {
|
|
6
6
|
runRoute
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CUKOJ7OM.mjs";
|
|
8
8
|
import {
|
|
9
9
|
DecisionsError,
|
|
10
10
|
emit
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-B62DSXC3.mjs";
|
|
12
12
|
|
|
13
13
|
// src/commands/route.ts
|
|
14
14
|
import { readFileSync } from "node:fs";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-FU3D2MBS.mjs";
|
|
6
6
|
import {
|
|
7
7
|
typedParse
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-A7OWKSHE.mjs";
|
|
9
9
|
import {
|
|
10
10
|
assertExamples,
|
|
11
11
|
createContext,
|
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
loadSpec,
|
|
15
15
|
runSpecCheck,
|
|
16
16
|
runSpecLint
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-CUKOJ7OM.mjs";
|
|
18
18
|
import {
|
|
19
19
|
DecisionsError,
|
|
20
20
|
EXIT,
|
|
21
21
|
emit
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-B62DSXC3.mjs";
|
|
23
23
|
|
|
24
24
|
// src/commands/spec.ts
|
|
25
25
|
function runSpecCommand(argv, io, format) {
|
package/dist/bundle/decide.mjs
CHANGED