@aisac/cli 0.4.0-beta.15 → 0.4.0-beta.18
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/README.md +49 -2
- package/dist/assets/claude/hooks/context-compaction.ts +12 -4
- package/dist/assets/claude/hooks/native-host-contract-runtime.ts +1 -1
- package/dist/assets/claude/hooks/native-host-contract.test.ts +8 -4
- package/dist/assets/claude/hooks/provider-window.d.ts +83 -0
- package/dist/claude-compatibility.mjs +25 -15
- package/dist/claude-observation.mjs +2 -1
- package/dist/cli.mjs +76 -6
- package/dist/codex-compatibility.mjs +1 -0
- package/dist/codex-protocol-fingerprint.json +11 -11
- package/dist/engineering-pack.mjs +23 -3
- package/dist/engineering-scan-pins.json +42 -0
- package/dist/engineering-scan-report.mjs +1274 -0
- package/dist/engineering-scan-tools.mjs +1418 -0
- package/dist/engineering-scan.mjs +1265 -0
- package/dist/mcp.mjs +10 -2
- package/dist/package.json +1 -1
- package/dist/platform.mjs +21 -5
- package/dist/token-guide.mjs +27 -0
- package/package.json +1 -1
package/dist/mcp.mjs
CHANGED
|
@@ -556,11 +556,14 @@ function structuredErrorCode(result) {
|
|
|
556
556
|
const text = result.content.find((item) => isObject(item) && typeof item.text === 'string')?.text;
|
|
557
557
|
const prefix =
|
|
558
558
|
typeof text === 'string'
|
|
559
|
-
? /^(FEATURE_DISABLED|TOOL_UNAVAILABLE|PAID_PLAN_REQUIRED)(?::|$)/u.exec(
|
|
559
|
+
? /^(FEATURE_DISABLED|TOOL_UNAVAILABLE|PAID_PLAN_REQUIRED|INVALID_INPUT)(?::|$)/u.exec(
|
|
560
|
+
text,
|
|
561
|
+
)?.[1]
|
|
560
562
|
: undefined;
|
|
561
563
|
if (prefix === 'FEATURE_DISABLED') return 'mcp_feature_disabled';
|
|
562
564
|
if (prefix === 'TOOL_UNAVAILABLE') return 'mcp_tool_unavailable';
|
|
563
565
|
if (prefix === 'PAID_PLAN_REQUIRED') return 'mcp_paid_plan_required';
|
|
566
|
+
if (prefix === 'INVALID_INPUT') return 'mcp_invalid_input';
|
|
564
567
|
return undefined;
|
|
565
568
|
}
|
|
566
569
|
|
|
@@ -923,7 +926,12 @@ export async function providerFreeProbeV2(endpoint, token, policy, clients) {
|
|
|
923
926
|
name === 'brain_context_select',
|
|
924
927
|
)
|
|
925
928
|
)
|
|
926
|
-
|
|
929
|
+
// A tool error carries the server's own code (paid plan, cohort, clock
|
|
930
|
+
// skew, disabled feature); only a reply that breaks the v2 contract is
|
|
931
|
+
// `mcp_v2_unsupported`. Same precedence as the v1 probe.
|
|
932
|
+
throw new Error(
|
|
933
|
+
responseError(response.response, structuredErrorCode(result) ?? 'mcp_v2_unsupported'),
|
|
934
|
+
);
|
|
927
935
|
};
|
|
928
936
|
await callTool(2, 'brain_context_select', {
|
|
929
937
|
schema_version: 2,
|
package/dist/package.json
CHANGED
package/dist/platform.mjs
CHANGED
|
@@ -76,7 +76,12 @@ export function captureLockPlatformCheck(
|
|
|
76
76
|
return { ok: true };
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* An executable by name, from the absolute directories of PATH only. An empty or relative
|
|
81
|
+
* entry (`.`, `node_modules/.bin`) would resolve against the working directory, often the
|
|
82
|
+
* user's project, and turn a file planted there into a trusted binary (scan review F7).
|
|
83
|
+
* @param {string} name @param {NodeJS.ProcessEnv} [environment]
|
|
84
|
+
*/
|
|
80
85
|
export function resolveNative(name, environment = process.env) {
|
|
81
86
|
if (!/^[A-Za-z0-9._+-]+$/u.test(name)) return null;
|
|
82
87
|
const pathValue = environment.PATH ?? '';
|
|
@@ -84,7 +89,7 @@ export function resolveNative(name, environment = process.env) {
|
|
|
84
89
|
? [name]
|
|
85
90
|
: pathValue
|
|
86
91
|
.split(delimiter)
|
|
87
|
-
.filter((directory) => directory
|
|
92
|
+
.filter((directory) => isAbsolute(directory))
|
|
88
93
|
.map((directory) => join(directory, name));
|
|
89
94
|
for (const candidate of candidates) {
|
|
90
95
|
try {
|
|
@@ -123,10 +128,10 @@ export function nativeVersion(executable, environment = process.env) {
|
|
|
123
128
|
export function isTestedNativeVersion(client, version) {
|
|
124
129
|
const value = version.trim();
|
|
125
130
|
if (client === 'claude')
|
|
126
|
-
return /^(?:(?:claude(?:\s+code)?)\s+)?2\.1\.(?:294|295|296|299|300|301|302|303)(?:\s+\(Claude\s+Code\))?$/iu.test(
|
|
131
|
+
return /^(?:(?:claude(?:\s+code)?)\s+)?2\.1\.(?:294|295|296|299|300|301|302|303|311|322|323)(?:\s+\(Claude\s+Code\))?$/iu.test(
|
|
127
132
|
value,
|
|
128
133
|
);
|
|
129
|
-
return /^(?:codex(?:-cli)?\s+)?0\.16(?:1\.0|2\.0|2\.1|3\.0|4\.0|6\.0)$/iu.test(value);
|
|
134
|
+
return /^(?:codex(?:-cli)?\s+)?0\.16(?:1\.0|2\.0|2\.1|3\.0|4\.0|6\.0|7\.1)$/iu.test(value);
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
const TESTED_NATIVE_VERSIONS = Object.freeze({
|
|
@@ -139,8 +144,19 @@ const TESTED_NATIVE_VERSIONS = Object.freeze({
|
|
|
139
144
|
'2.1.301',
|
|
140
145
|
'2.1.302',
|
|
141
146
|
'2.1.303',
|
|
147
|
+
'2.1.311',
|
|
148
|
+
'2.1.322',
|
|
149
|
+
'2.1.323',
|
|
150
|
+
]),
|
|
151
|
+
codex: Object.freeze([
|
|
152
|
+
'0.161.0',
|
|
153
|
+
'0.162.0',
|
|
154
|
+
'0.162.1',
|
|
155
|
+
'0.163.0',
|
|
156
|
+
'0.164.0',
|
|
157
|
+
'0.166.0',
|
|
158
|
+
'0.167.1',
|
|
142
159
|
]),
|
|
143
|
-
codex: Object.freeze(['0.161.0', '0.162.0', '0.162.1', '0.163.0', '0.164.0', '0.166.0']),
|
|
144
160
|
});
|
|
145
161
|
|
|
146
162
|
/** @param {'claude'|'codex'} client @param {string} version */
|
package/dist/token-guide.mjs
CHANGED
|
@@ -15,6 +15,16 @@ const TOKEN_FAILURES = Object.freeze({
|
|
|
15
15
|
'provider_free_probe_failed:mcp_paid_plan_required': 'unlicensed',
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Setup failures that are not about the token but have one usual cause worth
|
|
20
|
+
* naming. `INVALID_INPUT` from the probe is almost always a system clock that
|
|
21
|
+
* is ahead of the server (the server rejects `observed_at` more than 30 s in
|
|
22
|
+
* the future); WSL2 drifts after a sleep.
|
|
23
|
+
*/
|
|
24
|
+
const SETUP_HINTS = Object.freeze({
|
|
25
|
+
'provider_free_probe_failed:mcp_invalid_input': 'clock',
|
|
26
|
+
});
|
|
27
|
+
|
|
18
28
|
const TEXT = Object.freeze({
|
|
19
29
|
'pt-BR': {
|
|
20
30
|
intro: 'O aisac precisa de um token pessoal (PAT) do seu AI Brain.',
|
|
@@ -38,6 +48,10 @@ const TEXT = Object.freeze({
|
|
|
38
48
|
unlicensed:
|
|
39
49
|
'Este token pertence a uma conta sem a licença. Gere o token entrando com o e-mail usado na compra.',
|
|
40
50
|
},
|
|
51
|
+
hints: {
|
|
52
|
+
clock:
|
|
53
|
+
'O AI Brain recusou a sondagem como entrada inválida (INVALID_INPUT). Causa mais comum: o relógio do sistema está adiantado em relação ao servidor; no WSL2 isso acontece depois de suspender o computador. Acerte o relógio (ex.: `sudo hwclock -s` ou reinicie o WSL) e rode `aisac setup` de novo. O token não precisa mudar.',
|
|
54
|
+
},
|
|
41
55
|
},
|
|
42
56
|
en: {
|
|
43
57
|
intro: 'aisac needs a personal access token (PAT) from your AI Brain.',
|
|
@@ -60,6 +74,10 @@ const TEXT = Object.freeze({
|
|
|
60
74
|
unlicensed:
|
|
61
75
|
'This token belongs to an account without the license. Create the token signed in with the purchase email.',
|
|
62
76
|
},
|
|
77
|
+
hints: {
|
|
78
|
+
clock:
|
|
79
|
+
'AI Brain rejected the probe as invalid input (INVALID_INPUT). Most common cause: the system clock is ahead of the server; on WSL2 this happens after the computer sleeps. Fix the clock (e.g. `sudo hwclock -s` or restart WSL) and run `aisac setup` again. The token does not need to change.',
|
|
80
|
+
},
|
|
63
81
|
},
|
|
64
82
|
});
|
|
65
83
|
|
|
@@ -92,6 +110,15 @@ export function tokenPromptGuide(locale, endpoint) {
|
|
|
92
110
|
return steps(locale, endpoint, 'prompt');
|
|
93
111
|
}
|
|
94
112
|
|
|
113
|
+
/**
|
|
114
|
+
* One-paragraph hint for a setup failure with a usual non-token cause, or null.
|
|
115
|
+
* @param {string} code @param {GuideLocale} locale
|
|
116
|
+
*/
|
|
117
|
+
export function setupFailureHint(code, locale) {
|
|
118
|
+
const hint = /** @type {Record<string, keyof typeof TEXT.en.hints>} */ (SETUP_HINTS)[code];
|
|
119
|
+
return hint === undefined ? null : TEXT[locale].hints[hint];
|
|
120
|
+
}
|
|
121
|
+
|
|
95
122
|
/**
|
|
96
123
|
* Guidance for a setup failure caused by a missing, rejected or unlicensed token,
|
|
97
124
|
* or null when the failure has another cause.
|
package/package.json
CHANGED