@geotechcli/core 0.4.20 → 0.4.22
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/agents/brain.d.ts +1 -5
- package/dist/agents/brain.d.ts.map +1 -1
- package/dist/agents/brain.js +17 -119
- package/dist/agents/brain.js.map +1 -1
- package/dist/agents/filesystem-tools.js +11 -6
- package/dist/agents/filesystem-tools.js.map +1 -1
- package/dist/agents/orchestrator.d.ts.map +1 -1
- package/dist/agents/orchestrator.js +20 -6
- package/dist/agents/orchestrator.js.map +1 -1
- package/dist/agents/proprietary-internals.d.ts +4 -0
- package/dist/agents/proprietary-internals.d.ts.map +1 -0
- package/dist/agents/proprietary-internals.js +32 -0
- package/dist/agents/proprietary-internals.js.map +1 -0
- package/dist/agents/runtime-bootstrap.d.ts +6 -0
- package/dist/agents/runtime-bootstrap.d.ts.map +1 -0
- package/dist/agents/runtime-bootstrap.js +8 -0
- package/dist/agents/runtime-bootstrap.js.map +1 -0
- package/dist/agents/runtime-fallbacks.d.ts +7 -0
- package/dist/agents/runtime-fallbacks.d.ts.map +1 -0
- package/dist/agents/runtime-fallbacks.js +87 -0
- package/dist/agents/runtime-fallbacks.js.map +1 -0
- package/dist/agents/sandbox.d.ts +4 -23
- package/dist/agents/sandbox.d.ts.map +1 -1
- package/dist/agents/sandbox.js +423 -77
- package/dist/agents/sandbox.js.map +1 -1
- package/dist/agents/shell-tools.js +4 -4
- package/dist/agents/shell-tools.js.map +1 -1
- package/dist/agents/swarm.d.ts +1 -4
- package/dist/agents/swarm.d.ts.map +1 -1
- package/dist/agents/swarm.js +74 -6
- package/dist/agents/swarm.js.map +1 -1
- package/dist/meta/metadata.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { buildGeotechnicalFallbackAnswer, buildGeotechnicalPreflightAnswer, } from './intake.js';
|
|
2
|
+
export function isHostedBetaUnavailable(message) {
|
|
3
|
+
const normalized = message.toLowerCase();
|
|
4
|
+
return (normalized.includes('provider is busy') ||
|
|
5
|
+
normalized.includes('rate limit') ||
|
|
6
|
+
normalized.includes('timed out') ||
|
|
7
|
+
normalized.includes('upstream request failed') ||
|
|
8
|
+
normalized.includes('retry in about') ||
|
|
9
|
+
normalized.includes('hosted beta ai request failed') ||
|
|
10
|
+
normalized.includes('hosted beta upstream returned no content') ||
|
|
11
|
+
normalized.includes('empty completion') ||
|
|
12
|
+
normalized.includes('fetch failed'));
|
|
13
|
+
}
|
|
14
|
+
export function getHostedFallbackMode(message) {
|
|
15
|
+
const normalized = message.toLowerCase();
|
|
16
|
+
if (normalized.includes('timed out') ||
|
|
17
|
+
normalized.includes('timeout budget') ||
|
|
18
|
+
normalized.includes('warming up') ||
|
|
19
|
+
normalized.includes('modal.com gpu')) {
|
|
20
|
+
return 'warming_timeout';
|
|
21
|
+
}
|
|
22
|
+
return 'temporary';
|
|
23
|
+
}
|
|
24
|
+
function extractNumericValue(query, pattern) {
|
|
25
|
+
const match = query.match(pattern);
|
|
26
|
+
return match ? Number(match[1]) : null;
|
|
27
|
+
}
|
|
28
|
+
export function buildDeterministicPreflightAnswer(userQuery, config, sessionContext) {
|
|
29
|
+
return buildGeotechnicalPreflightAnswer(userQuery, config, sessionContext);
|
|
30
|
+
}
|
|
31
|
+
export function buildDeterministicFallbackAnswer(userQuery, sessionContext, mode = 'temporary') {
|
|
32
|
+
const normalized = userQuery.toLowerCase();
|
|
33
|
+
const fallbackLead = mode === 'warming_timeout'
|
|
34
|
+
? 'Hosted model on Modal.com GPU is warming up or exceeded the current timeout budget, so the agent switched to deterministic fallback reasoning instead of returning no analysis.'
|
|
35
|
+
: 'Hosted beta was temporarily unavailable, so the agent switched to deterministic fallback reasoning instead of returning no analysis.';
|
|
36
|
+
const intakeFallback = buildGeotechnicalFallbackAnswer(userQuery, sessionContext);
|
|
37
|
+
if (intakeFallback) {
|
|
38
|
+
return intakeFallback;
|
|
39
|
+
}
|
|
40
|
+
if (/(tbm|epb|slurry|shield|tunnel boring)/.test(normalized)) {
|
|
41
|
+
const rpm = extractNumericValue(normalized, /(\d+(?:\.\d+)?)\s*rpm/);
|
|
42
|
+
const thrust = extractNumericValue(normalized, /(\d+(?:\.\d+)?)\s*k\s*n/);
|
|
43
|
+
const diameter = extractNumericValue(normalized, /(\d+(?:\.\d+)?)\s*m\s*(?:diameter|tbm|tunnel)/) ??
|
|
44
|
+
extractNumericValue(normalized, /(\d+(?:\.\d+)?)\s*m\b/);
|
|
45
|
+
const hasSoftGround = /(clay|silt|sand|soft ground|soft soil)/.test(normalized);
|
|
46
|
+
const hasRockInputs = /(ucs|rqd|cai|joint spacing|jointspacing)/.test(normalized);
|
|
47
|
+
const lines = [
|
|
48
|
+
fallbackLead,
|
|
49
|
+
'',
|
|
50
|
+
'Engineering assessment:',
|
|
51
|
+
];
|
|
52
|
+
if (hasSoftGround || normalized.includes('epb')) {
|
|
53
|
+
lines.push('- The ground description points to soft-ground tunnelling, so EPB remains the appropriate screening-level machine class.');
|
|
54
|
+
}
|
|
55
|
+
if (rpm != null) {
|
|
56
|
+
lines.push(`- Provided cutterhead speed: ${rpm} rpm.`);
|
|
57
|
+
}
|
|
58
|
+
if (thrust != null) {
|
|
59
|
+
lines.push(`- Provided thrust: ${thrust} kN.`);
|
|
60
|
+
}
|
|
61
|
+
lines.push('');
|
|
62
|
+
lines.push('Deterministic limitation:');
|
|
63
|
+
if (diameter == null) {
|
|
64
|
+
lines.push('- Tunnel / TBM diameter is not provided, which is required for any defensible advance-rate estimate.');
|
|
65
|
+
}
|
|
66
|
+
if (hasSoftGround && !hasRockInputs) {
|
|
67
|
+
lines.push('- The current built-in TBM performance engine in geotechCLI is a rock disc-cutter model requiring diameter, UCS, and RQD-type inputs. It does not yet include a validated EPB-in-clay penetration model.');
|
|
68
|
+
}
|
|
69
|
+
else if (!hasRockInputs) {
|
|
70
|
+
lines.push('- The current built-in TBM performance engine needs rock-mechanics inputs such as UCS and RQD before it can calculate penetration rate.');
|
|
71
|
+
}
|
|
72
|
+
lines.push('- RPM and thrust alone are not sufficient for a validated penetration-rate calculation in soft ground without diameter plus material/operational parameters.');
|
|
73
|
+
lines.push('');
|
|
74
|
+
lines.push('Next best deterministic path in geotechCLI:');
|
|
75
|
+
lines.push('- Use `geotech tunnel tbm-select --diameter <m> --ground soft_ground` for a machine-class recommendation.');
|
|
76
|
+
lines.push('- Use `geotech tunnel tbm-predict --diameter <m> --ucs <MPa> --rqd <percent> ...` only for the existing rock-TBM predictor.');
|
|
77
|
+
lines.push('- If you want EPB soft-ground penetration screening in-clay, that needs a new validated deterministic model to be added to the toolset.');
|
|
78
|
+
return lines.join('\n');
|
|
79
|
+
}
|
|
80
|
+
return [
|
|
81
|
+
mode === 'warming_timeout'
|
|
82
|
+
? 'Hosted model on Modal.com GPU is warming up or exceeded the current timeout budget, and this request does not currently have a direct deterministic fallback in geotechCLI.'
|
|
83
|
+
: 'Hosted beta was temporarily unavailable, and this request does not currently have a direct deterministic fallback in geotechCLI.',
|
|
84
|
+
'Retry shortly, or reformulate the task as one of the built-in deterministic commands so the CLI can continue without the hosted model.',
|
|
85
|
+
].join('\n\n');
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=runtime-fallbacks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-fallbacks.js","sourceRoot":"","sources":["../../src/agents/runtime-fallbacks.ts"],"names":[],"mappings":"AACA,OAAO,EACL,+BAA+B,EAC/B,gCAAgC,GACjC,MAAM,aAAa,CAAC;AAIrB,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACrD,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IACzC,OAAO,CACL,UAAU,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QACvC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;QACjC,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC;QAChC,UAAU,CAAC,QAAQ,CAAC,yBAAyB,CAAC;Q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D,IAAI,aAAa,IAAI,CAAC,aAAa,EAAE,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,0MAA0M,CAAC,CAAC;QACzN,CAAC;aAAM,IAAI,CAAC,aAAa,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,CAAC,yIAAyI,CAAC,CAAC;QACxJ,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,8JAA8J,CAAC,CAAC;QAC3K,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;QAC1D,KAAK,CAAC,IAAI,CAAC,2GAA2G,CAAC,CAAC;QACxH,KAAK,CAAC,IAAI,CAAC,6HAA6H,CAAC,CAAC;QAC1I,KAAK,CAAC,IAAI,CAAC,yIAAyI,CAAC,CAAC;QAEtJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO;QACL,IAAI,KAAK,iBAAiB;YACxB,CAAC,CAAC,6KAA6K;YAC/K,CAAC,CAAC,kIAAkI;QACtI,wIAAwI;KACzI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjB,CAAC"}
|
package/dist/agents/sandbox.d.ts
CHANGED
|
@@ -3,32 +3,13 @@ export interface SandboxCheck {
|
|
|
3
3
|
resolved: string;
|
|
4
4
|
error?: string;
|
|
5
5
|
}
|
|
6
|
+
export declare function validateEnumerationPath(targetPath: string, extraAllowed?: string[]): SandboxCheck;
|
|
6
7
|
export declare function ensureWorkspace(): string;
|
|
7
8
|
export declare function getWorkspaceDir(): string;
|
|
8
|
-
/**
|
|
9
|
-
* Validate that a path is inside an allowed zone and does not target
|
|
10
|
-
* sensitive files. Call this BEFORE any read/write/list operation.
|
|
11
|
-
*
|
|
12
|
-
* Allowed zones:
|
|
13
|
-
* - process.cwd() and its children
|
|
14
|
-
* - WORKSPACE_DIR and its children
|
|
15
|
-
* - Any additional directories passed in `extraAllowed`
|
|
16
|
-
*
|
|
17
|
-
* For WRITE operations, pass mode='write' to additionally block
|
|
18
|
-
* the config directory itself (only workspace subdir is writable).
|
|
19
|
-
*/
|
|
20
9
|
export declare function validatePath(targetPath: string, mode?: 'read' | 'write', extraAllowed?: string[]): SandboxCheck;
|
|
21
|
-
/**
|
|
22
|
-
* Convenience: validate for reading.
|
|
23
|
-
*/
|
|
24
10
|
export declare function validateReadPath(targetPath: string, extraAllowed?: string[]): SandboxCheck;
|
|
25
|
-
/**
|
|
26
|
-
* Convenience: validate for writing.
|
|
27
|
-
*/
|
|
28
11
|
export declare function validateWritePath(targetPath: string, extraAllowed?: string[]): SandboxCheck;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*/
|
|
33
|
-
export declare function validateShellCommand(command: string): SandboxCheck;
|
|
12
|
+
export declare function validateShellCommand(command: string, options?: {
|
|
13
|
+
cwd?: string;
|
|
14
|
+
}): SandboxCheck;
|
|
34
15
|
//# sourceMappingURL=sandbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/agents/sandbox.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/agents/sandbox.ts"],"names":[],"mappings":"AAgFA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAgGD,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,YAAY,CAejG;AAMD,wBAAgB,eAAe,IAAI,MAAM,CAKxC;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAMD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE,MAAM,GAAG,OAAgB,EAC/B,YAAY,CAAC,EAAE,MAAM,EAAE,GACtB,YAAY,CAiHd;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,YAAY,CAE1F;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,YAAY,CAE3F;AAMD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,YAAY,CAiW9F"}
|