@illumiarq/lumis 1.2.9 → 1.2.11
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/bridges/project-bridge.d.ts +2 -0
- package/dist/bridges/project-bridge.d.ts.map +1 -0
- package/dist/bridges/project-bridge.js +174 -0
- package/dist/bridges/project-bridge.js.map +1 -0
- package/dist/cli.d.ts +1 -16
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +538 -170
- package/dist/cli.js.map +1 -1
- package/dist/commands/app/cache-workflows.d.ts +7 -0
- package/dist/commands/app/cache-workflows.d.ts.map +1 -0
- package/dist/commands/app/cache-workflows.js +139 -0
- package/dist/commands/app/cache-workflows.js.map +1 -0
- package/dist/commands/app/command-runtime.d.ts +11 -0
- package/dist/commands/app/command-runtime.d.ts.map +1 -0
- package/dist/commands/app/command-runtime.js +41 -0
- package/dist/commands/app/command-runtime.js.map +1 -0
- package/dist/commands/app/config-cache.d.ts +3 -0
- package/dist/commands/app/config-cache.d.ts.map +1 -0
- package/dist/commands/app/config-cache.js +75 -0
- package/dist/commands/app/config-cache.js.map +1 -0
- package/dist/commands/app/config-publish.d.ts +2 -0
- package/dist/commands/app/config-publish.d.ts.map +1 -0
- package/dist/commands/app/config-publish.js +68 -0
- package/dist/commands/app/config-publish.js.map +1 -0
- package/dist/commands/app/config-stubs.d.ts +3 -0
- package/dist/commands/app/config-stubs.d.ts.map +1 -0
- package/dist/commands/app/config-stubs.js +154 -0
- package/dist/commands/app/config-stubs.js.map +1 -0
- package/dist/commands/app/database.d.ts +3 -0
- package/dist/commands/app/database.d.ts.map +1 -0
- package/dist/commands/app/database.js +221 -0
- package/dist/commands/app/database.js.map +1 -0
- package/dist/commands/app/docs.d.ts +7 -0
- package/dist/commands/app/docs.d.ts.map +1 -0
- package/dist/commands/app/docs.js +61 -0
- package/dist/commands/app/docs.js.map +1 -0
- package/dist/commands/app/routes.d.ts +5 -0
- package/dist/commands/app/routes.d.ts.map +1 -0
- package/dist/commands/app/routes.js +95 -0
- package/dist/commands/app/routes.js.map +1 -0
- package/dist/commands/app/security.d.ts +3 -0
- package/dist/commands/app/security.d.ts.map +1 -0
- package/dist/commands/app/security.js +15 -0
- package/dist/commands/app/security.js.map +1 -0
- package/dist/commands/app/worker-schedule.d.ts +5 -0
- package/dist/commands/app/worker-schedule.d.ts.map +1 -0
- package/dist/commands/app/worker-schedule.js +94 -0
- package/dist/commands/app/worker-schedule.js.map +1 -0
- package/dist/commands/app-commands.d.ts +19 -0
- package/dist/commands/app-commands.d.ts.map +1 -0
- package/dist/commands/app-commands.js +77 -0
- package/dist/commands/app-commands.js.map +1 -0
- package/dist/commands/build-vercel-fn.d.ts +9 -0
- package/dist/commands/build-vercel-fn.d.ts.map +1 -0
- package/dist/commands/build-vercel-fn.js +32 -0
- package/dist/commands/build-vercel-fn.js.map +1 -0
- package/dist/commands/build.d.ts +14 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +24 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/info.d.ts +9 -0
- package/dist/commands/info.d.ts.map +1 -0
- package/dist/commands/info.js +41 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/keys.d.ts +3 -0
- package/dist/commands/keys.d.ts.map +1 -0
- package/dist/commands/keys.js +60 -0
- package/dist/commands/keys.js.map +1 -0
- package/dist/commands/maintenance.d.ts +9 -0
- package/dist/commands/maintenance.d.ts.map +1 -0
- package/dist/commands/maintenance.js +38 -0
- package/dist/commands/maintenance.js.map +1 -0
- package/dist/commands/module-list.d.ts +2 -0
- package/dist/commands/module-list.d.ts.map +1 -0
- package/dist/commands/module-list.js +27 -0
- package/dist/commands/module-list.js.map +1 -0
- package/dist/commands/preview.d.ts +14 -0
- package/dist/commands/preview.d.ts.map +1 -0
- package/dist/commands/preview.js +49 -0
- package/dist/commands/preview.js.map +1 -0
- package/dist/commands/serve.d.ts +16 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +61 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/{output/ansi.d.ts → console.d.ts} +8 -4
- package/dist/console.d.ts.map +1 -0
- package/dist/{output/ansi.js → console.js} +12 -4
- package/dist/console.js.map +1 -0
- package/dist/index.d.ts +15 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/paths.d.ts +26 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +83 -0
- package/dist/paths.js.map +1 -0
- package/dist/server-wrapper.d.ts +12 -0
- package/dist/server-wrapper.d.ts.map +1 -0
- package/dist/server-wrapper.js +63 -0
- package/dist/server-wrapper.js.map +1 -0
- package/dist/vercel-wrapper.d.ts +6 -0
- package/dist/vercel-wrapper.d.ts.map +1 -0
- package/dist/vercel-wrapper.js +50 -0
- package/dist/vercel-wrapper.js.map +1 -0
- package/package.json +19 -37
- package/README.md +0 -38
- package/dist/adapter-loader.d.ts +0 -67
- package/dist/adapter-loader.d.ts.map +0 -1
- package/dist/adapter-loader.js +0 -273
- package/dist/adapter-loader.js.map +0 -1
- package/dist/commands/commands.command.d.ts +0 -38
- package/dist/commands/commands.command.d.ts.map +0 -1
- package/dist/commands/commands.command.js +0 -176
- package/dist/commands/commands.command.js.map +0 -1
- package/dist/commands/doctor.command.d.ts +0 -9
- package/dist/commands/doctor.command.d.ts.map +0 -1
- package/dist/commands/doctor.command.js +0 -640
- package/dist/commands/doctor.command.js.map +0 -1
- package/dist/commands/init.command.d.ts +0 -9
- package/dist/commands/init.command.d.ts.map +0 -1
- package/dist/commands/init.command.js +0 -121
- package/dist/commands/init.command.js.map +0 -1
- package/dist/commands/intent.command.d.ts +0 -26
- package/dist/commands/intent.command.d.ts.map +0 -1
- package/dist/commands/intent.command.js +0 -211
- package/dist/commands/intent.command.js.map +0 -1
- package/dist/commands/ir-rebuild.command.d.ts +0 -9
- package/dist/commands/ir-rebuild.command.d.ts.map +0 -1
- package/dist/commands/ir-rebuild.command.js +0 -36
- package/dist/commands/ir-rebuild.command.js.map +0 -1
- package/dist/commands/ir-show.command.d.ts +0 -9
- package/dist/commands/ir-show.command.d.ts.map +0 -1
- package/dist/commands/ir-show.command.js +0 -32
- package/dist/commands/ir-show.command.js.map +0 -1
- package/dist/commands/make.command.d.ts +0 -9
- package/dist/commands/make.command.d.ts.map +0 -1
- package/dist/commands/make.command.js +0 -93
- package/dist/commands/make.command.js.map +0 -1
- package/dist/commands/pack.command.d.ts +0 -16
- package/dist/commands/pack.command.d.ts.map +0 -1
- package/dist/commands/pack.command.js +0 -44
- package/dist/commands/pack.command.js.map +0 -1
- package/dist/commands/runtime.command.d.ts +0 -6
- package/dist/commands/runtime.command.d.ts.map +0 -1
- package/dist/commands/runtime.command.js +0 -379
- package/dist/commands/runtime.command.js.map +0 -1
- package/dist/commands/runtime.d.ts +0 -45
- package/dist/commands/runtime.d.ts.map +0 -1
- package/dist/commands/runtime.js +0 -66
- package/dist/commands/runtime.js.map +0 -1
- package/dist/commands/tinker-agent-plan.d.ts +0 -26
- package/dist/commands/tinker-agent-plan.d.ts.map +0 -1
- package/dist/commands/tinker-agent-plan.js +0 -115
- package/dist/commands/tinker-agent-plan.js.map +0 -1
- package/dist/commands/tinker-chat-commands.d.ts +0 -19
- package/dist/commands/tinker-chat-commands.d.ts.map +0 -1
- package/dist/commands/tinker-chat-commands.js +0 -263
- package/dist/commands/tinker-chat-commands.js.map +0 -1
- package/dist/commands/tinker-chat-runtime.d.ts +0 -30
- package/dist/commands/tinker-chat-runtime.d.ts.map +0 -1
- package/dist/commands/tinker-chat-runtime.js +0 -227
- package/dist/commands/tinker-chat-runtime.js.map +0 -1
- package/dist/commands/tinker-classic-mode.d.ts +0 -15
- package/dist/commands/tinker-classic-mode.d.ts.map +0 -1
- package/dist/commands/tinker-classic-mode.js +0 -160
- package/dist/commands/tinker-classic-mode.js.map +0 -1
- package/dist/commands/tinker-eval.command.d.ts +0 -3
- package/dist/commands/tinker-eval.command.d.ts.map +0 -1
- package/dist/commands/tinker-eval.command.js +0 -151
- package/dist/commands/tinker-eval.command.js.map +0 -1
- package/dist/commands/tinker-repl-display.d.ts +0 -15
- package/dist/commands/tinker-repl-display.d.ts.map +0 -1
- package/dist/commands/tinker-repl-display.js +0 -147
- package/dist/commands/tinker-repl-display.js.map +0 -1
- package/dist/commands/tinker-session-runtime.d.ts +0 -27
- package/dist/commands/tinker-session-runtime.d.ts.map +0 -1
- package/dist/commands/tinker-session-runtime.js +0 -196
- package/dist/commands/tinker-session-runtime.js.map +0 -1
- package/dist/commands/tinker.command.d.ts +0 -9
- package/dist/commands/tinker.command.d.ts.map +0 -1
- package/dist/commands/tinker.command.js +0 -142
- package/dist/commands/tinker.command.js.map +0 -1
- package/dist/commands/use.command.d.ts +0 -10
- package/dist/commands/use.command.d.ts.map +0 -1
- package/dist/commands/use.command.js +0 -69
- package/dist/commands/use.command.js.map +0 -1
- package/dist/config-loader.d.ts +0 -68
- package/dist/config-loader.d.ts.map +0 -1
- package/dist/config-loader.js +0 -81
- package/dist/config-loader.js.map +0 -1
- package/dist/launcher.d.ts +0 -16
- package/dist/launcher.d.ts.map +0 -1
- package/dist/launcher.js +0 -301
- package/dist/launcher.js.map +0 -1
- package/dist/lib/file-scanner.d.ts +0 -8
- package/dist/lib/file-scanner.d.ts.map +0 -1
- package/dist/lib/file-scanner.js +0 -70
- package/dist/lib/file-scanner.js.map +0 -1
- package/dist/lib/tinker-memory.d.ts +0 -19
- package/dist/lib/tinker-memory.d.ts.map +0 -1
- package/dist/lib/tinker-memory.js +0 -107
- package/dist/lib/tinker-memory.js.map +0 -1
- package/dist/lib/tinker-observer.d.ts +0 -47
- package/dist/lib/tinker-observer.d.ts.map +0 -1
- package/dist/lib/tinker-observer.js +0 -77
- package/dist/lib/tinker-observer.js.map +0 -1
- package/dist/lib/tinker-policy.d.ts +0 -21
- package/dist/lib/tinker-policy.d.ts.map +0 -1
- package/dist/lib/tinker-policy.js +0 -102
- package/dist/lib/tinker-policy.js.map +0 -1
- package/dist/lib/tinker-replay.d.ts +0 -51
- package/dist/lib/tinker-replay.d.ts.map +0 -1
- package/dist/lib/tinker-replay.js +0 -123
- package/dist/lib/tinker-replay.js.map +0 -1
- package/dist/output/ansi.d.ts.map +0 -1
- package/dist/output/ansi.js.map +0 -1
- package/dist/output/plan-display.d.ts +0 -4
- package/dist/output/plan-display.d.ts.map +0 -1
- package/dist/output/plan-display.js +0 -49
- package/dist/output/plan-display.js.map +0 -1
- package/dist/output/result-display.d.ts +0 -5
- package/dist/output/result-display.d.ts.map +0 -1
- package/dist/output/result-display.js +0 -17
- package/dist/output/result-display.js.map +0 -1
- package/dist/plugins/tinker-plugin.d.ts +0 -86
- package/dist/plugins/tinker-plugin.d.ts.map +0 -1
- package/dist/plugins/tinker-plugin.js +0 -42
- package/dist/plugins/tinker-plugin.js.map +0 -1
- package/dist/router-preferences.d.ts +0 -5
- package/dist/router-preferences.d.ts.map +0 -1
- package/dist/router-preferences.js +0 -22
- package/dist/router-preferences.js.map +0 -1
- package/dist/runtime/executor.d.ts +0 -33
- package/dist/runtime/executor.d.ts.map +0 -1
- package/dist/runtime/executor.js +0 -180
- package/dist/runtime/executor.js.map +0 -1
- package/dist/runtime/orchestration.d.ts +0 -43
- package/dist/runtime/orchestration.d.ts.map +0 -1
- package/dist/runtime/orchestration.js +0 -209
- package/dist/runtime/orchestration.js.map +0 -1
- package/dist/runtime/policy.d.ts +0 -23
- package/dist/runtime/policy.d.ts.map +0 -1
- package/dist/runtime/policy.js +0 -43
- package/dist/runtime/policy.js.map +0 -1
- package/dist/runtime/profiles.d.ts +0 -15
- package/dist/runtime/profiles.d.ts.map +0 -1
- package/dist/runtime/profiles.js +0 -131
- package/dist/runtime/profiles.js.map +0 -1
- package/dist/runtime/transcripts.d.ts +0 -59
- package/dist/runtime/transcripts.d.ts.map +0 -1
- package/dist/runtime/transcripts.js +0 -172
- package/dist/runtime/transcripts.js.map +0 -1
- package/dist/tools/git-diff.d.ts +0 -3
- package/dist/tools/git-diff.d.ts.map +0 -1
- package/dist/tools/git-diff.js +0 -16
- package/dist/tools/git-diff.js.map +0 -1
- package/dist/tools/index.d.ts +0 -24
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -88
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/lint.d.ts +0 -3
- package/dist/tools/lint.d.ts.map +0 -1
- package/dist/tools/lint.js +0 -35
- package/dist/tools/lint.js.map +0 -1
- package/dist/tools/read-file.d.ts +0 -3
- package/dist/tools/read-file.d.ts.map +0 -1
- package/dist/tools/read-file.js +0 -47
- package/dist/tools/read-file.js.map +0 -1
- package/dist/tools/run-command.d.ts +0 -3
- package/dist/tools/run-command.d.ts.map +0 -1
- package/dist/tools/run-command.js +0 -71
- package/dist/tools/run-command.js.map +0 -1
- package/dist/tools/run-tests.d.ts +0 -3
- package/dist/tools/run-tests.d.ts.map +0 -1
- package/dist/tools/run-tests.js +0 -49
- package/dist/tools/run-tests.js.map +0 -1
- package/dist/tools/tool-dispatch.d.ts +0 -32
- package/dist/tools/tool-dispatch.d.ts.map +0 -1
- package/dist/tools/tool-dispatch.js +0 -120
- package/dist/tools/tool-dispatch.js.map +0 -1
- package/dist/tools/typecheck.d.ts +0 -3
- package/dist/tools/typecheck.d.ts.map +0 -1
- package/dist/tools/typecheck.js +0 -48
- package/dist/tools/typecheck.js.map +0 -1
- package/dist/tools/types.d.ts +0 -62
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/types.js +0 -7
- package/dist/tools/types.js.map +0 -1
- package/dist/tools/write-file.d.ts +0 -15
- package/dist/tools/write-file.d.ts.map +0 -1
- package/dist/tools/write-file.js +0 -52
- package/dist/tools/write-file.js.map +0 -1
- package/dist/tracing/types.d.ts +0 -10
- package/dist/tracing/types.d.ts.map +0 -1
- package/dist/tracing/types.js +0 -2
- package/dist/tracing/types.js.map +0 -1
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
const TOOL_CALL_FENCE_RE = /```tool_call\s*\n([\s\S]*?)```/g;
|
|
2
|
-
/**
|
|
3
|
-
* Extract all tool_call fenced blocks from an LLM reply text.
|
|
4
|
-
* Returns the parsed ToolCall objects (invalid JSON blocks are skipped).
|
|
5
|
-
*/
|
|
6
|
-
export function extractToolCalls(text) {
|
|
7
|
-
const calls = [];
|
|
8
|
-
let match;
|
|
9
|
-
// Reset lastIndex for each invocation
|
|
10
|
-
TOOL_CALL_FENCE_RE.lastIndex = 0;
|
|
11
|
-
while ((match = TOOL_CALL_FENCE_RE.exec(text)) !== null) {
|
|
12
|
-
const raw = match[1]?.trim();
|
|
13
|
-
if (!raw)
|
|
14
|
-
continue;
|
|
15
|
-
try {
|
|
16
|
-
const parsed = JSON.parse(raw);
|
|
17
|
-
if (isValidToolCall(parsed)) {
|
|
18
|
-
calls.push(parsed);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
// Skip malformed JSON
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return calls;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Narrow an unknown value to a ToolCall.
|
|
29
|
-
*/
|
|
30
|
-
function isValidToolCall(value) {
|
|
31
|
-
if (typeof value !== 'object' || value === null)
|
|
32
|
-
return false;
|
|
33
|
-
const v = value;
|
|
34
|
-
const tool = v['tool'];
|
|
35
|
-
if (typeof tool !== 'string')
|
|
36
|
-
return false;
|
|
37
|
-
const validTools = new Set([
|
|
38
|
-
'read-file',
|
|
39
|
-
'write-file',
|
|
40
|
-
'run-command',
|
|
41
|
-
'search-repo',
|
|
42
|
-
'git-diff',
|
|
43
|
-
'typecheck',
|
|
44
|
-
'run-tests',
|
|
45
|
-
'lint',
|
|
46
|
-
]);
|
|
47
|
-
if (!validTools.has(tool))
|
|
48
|
-
return false;
|
|
49
|
-
// Minimal required field checks per tool
|
|
50
|
-
switch (tool) {
|
|
51
|
-
case 'read-file':
|
|
52
|
-
return typeof v['path'] === 'string';
|
|
53
|
-
case 'write-file':
|
|
54
|
-
return typeof v['path'] === 'string' && typeof v['content'] === 'string';
|
|
55
|
-
case 'run-command':
|
|
56
|
-
return Array.isArray(v['cmd']) && v['cmd'].every((c) => typeof c === 'string');
|
|
57
|
-
case 'search-repo':
|
|
58
|
-
return typeof v['query'] === 'string';
|
|
59
|
-
case 'git-diff':
|
|
60
|
-
case 'typecheck':
|
|
61
|
-
case 'run-tests':
|
|
62
|
-
case 'lint':
|
|
63
|
-
return true;
|
|
64
|
-
default:
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Format a ToolResult as a `tool` role message content block.
|
|
70
|
-
* The LLM sees this verbatim to continue reasoning.
|
|
71
|
-
*/
|
|
72
|
-
export function formatToolResult(result) {
|
|
73
|
-
const header = `[tool:${result.tool} outcome:${result.outcome} ${result.durationMs}ms]`;
|
|
74
|
-
const body = result.output.length > 6000
|
|
75
|
-
? result.output.slice(0, 6000) + '\n... (truncated)'
|
|
76
|
-
: result.output;
|
|
77
|
-
const errorPart = result.error ? `\nError: ${result.error}` : '';
|
|
78
|
-
const diagPart = result.diagnostics && result.diagnostics.length > 0
|
|
79
|
-
? '\n' + result.diagnostics
|
|
80
|
-
.slice(0, 20)
|
|
81
|
-
.map((d) => ` ${d.severity} ${d.file ? `${d.file}${d.line ? `:${d.line}` : ''}` : ''}: ${d.message}`)
|
|
82
|
-
.join('\n')
|
|
83
|
-
: '';
|
|
84
|
-
return `${header}\n${body}${errorPart}${diagPart}`;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Strip tool_call fences from LLM reply text so only the
|
|
88
|
-
* conversational prose is shown to the user.
|
|
89
|
-
*/
|
|
90
|
-
export function stripToolCalls(text) {
|
|
91
|
-
return text.replace(TOOL_CALL_FENCE_RE, '').replace(/\n{3,}/g, '\n\n').trim();
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Build the tool-call capability section for the Tinker system prompt.
|
|
95
|
-
* Describes available tools and their JSON schemas.
|
|
96
|
-
*/
|
|
97
|
-
export const TOOL_CALL_SYSTEM_SECTION = `
|
|
98
|
-
You have access to the following tools. When you need information or want to perform an action, emit a tool_call block:
|
|
99
|
-
\`\`\`tool_call
|
|
100
|
-
{ "tool": "<tool-name>", ...args }
|
|
101
|
-
\`\`\`
|
|
102
|
-
|
|
103
|
-
Available tools and their argument shapes:
|
|
104
|
-
- read-file { "tool": "read-file", "path": "<relative-path>" }
|
|
105
|
-
- write-file { "tool": "write-file", "path": "<relative-path>", "content": "<full-file-content>" }
|
|
106
|
-
- run-command { "tool": "run-command", "cmd": ["<executable>", "...args"], "cwd"?: "<dir>", "timeoutMs"?: 30000 }
|
|
107
|
-
- search-repo { "tool": "search-repo", "query": "<text>", "fileGlob"?: "*.ts", "maxResults"?: 20 }
|
|
108
|
-
- git-diff { "tool": "git-diff", "base"?: "<ref>", "path"?: "<file>" }
|
|
109
|
-
- typecheck { "tool": "typecheck", "cwd"?: "<dir>" }
|
|
110
|
-
- run-tests { "tool": "run-tests", "pattern"?: "<glob>", "cwd"?: "<dir>" }
|
|
111
|
-
- lint { "tool": "lint", "fix"?: true, "paths"?: ["<dir>"], "cwd"?: "<dir>" }
|
|
112
|
-
|
|
113
|
-
Rules:
|
|
114
|
-
1. Emit at most ONE tool_call block per reply.
|
|
115
|
-
2. After receiving tool results, continue reasoning or emit another tool_call.
|
|
116
|
-
3. When all needed information is gathered or all changes are made, reply with your final answer — no tool_call block.
|
|
117
|
-
4. ALWAYS typecheck after writing files.
|
|
118
|
-
5. For write-file, provide the COMPLETE new file content — never partial diffs.
|
|
119
|
-
`.trim();
|
|
120
|
-
//# sourceMappingURL=tool-dispatch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-dispatch.js","sourceRoot":"","sources":["../../src/tools/tool-dispatch.ts"],"names":[],"mappings":"AAYA,MAAM,kBAAkB,GAAG,iCAAiC,CAAA;AAE5D;;;GAGG;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I,GAAG,MAAM,CAAC,WAAW;aACzB,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;aACZ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;aACrG,IAAI,CAAC,IAAI,CAAC;QACZ,CAAC,CAAC,EAAE,CAAA;IAEL,OAAO,GAAG,MAAM,KAAK,IAAI,GAAG,SAAS,GAAG,QAAQ,EAAE,CAAA;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAA;AAC9E,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;CAsBvC,CAAC,IAAI,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typecheck.d.ts","sourceRoot":"","sources":["../../src/tools/typecheck.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,YAAY,CAAA;AA6BxD,wBAAsB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAwB5E"}
|
package/dist/tools/typecheck.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { runCommandTool } from './run-command.js';
|
|
2
|
-
/**
|
|
3
|
-
* Parse tsc --noEmit output into structured Diagnostic[].
|
|
4
|
-
* Handles the standard `file(line,col): error/warning TSxxxx: message` format.
|
|
5
|
-
*/
|
|
6
|
-
function parseTscOutput(output) {
|
|
7
|
-
const diagnostics = [];
|
|
8
|
-
// e.g.: src/foo.ts(10,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
9
|
-
const lineRegex = /^(.+?)\((\d+),(\d+)\):\s+(error|warning|info)\s+(TS\d+):\s+(.+)$/gm;
|
|
10
|
-
let match;
|
|
11
|
-
while ((match = lineRegex.exec(output)) !== null) {
|
|
12
|
-
const [, file, line, column, severity, code, message] = match;
|
|
13
|
-
if (!file || !line || !column || !severity || !message)
|
|
14
|
-
continue;
|
|
15
|
-
diagnostics.push({
|
|
16
|
-
severity: severity,
|
|
17
|
-
file: file.trim(),
|
|
18
|
-
line: parseInt(line, 10),
|
|
19
|
-
column: parseInt(column, 10),
|
|
20
|
-
message: message.trim(),
|
|
21
|
-
...(code ? { code } : {}),
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return diagnostics;
|
|
25
|
-
}
|
|
26
|
-
export async function typecheckTool(projectRoot) {
|
|
27
|
-
const result = await runCommandTool(['pnpm', 'typecheck'], projectRoot, 60_000);
|
|
28
|
-
const diagnostics = parseTscOutput(result.output);
|
|
29
|
-
const errorCount = diagnostics.filter((d) => d.severity === 'error').length;
|
|
30
|
-
const warnCount = diagnostics.filter((d) => d.severity === 'warning').length;
|
|
31
|
-
const summary = [
|
|
32
|
-
result.outcome === 'success' ? 'Typecheck passed.' : `Typecheck failed.`,
|
|
33
|
-
errorCount > 0 ? `${errorCount} error(s).` : '',
|
|
34
|
-
warnCount > 0 ? `${warnCount} warning(s).` : '',
|
|
35
|
-
]
|
|
36
|
-
.filter(Boolean)
|
|
37
|
-
.join(' ');
|
|
38
|
-
return {
|
|
39
|
-
...result,
|
|
40
|
-
tool: 'typecheck',
|
|
41
|
-
output: result.output.length > 8000
|
|
42
|
-
? result.output.slice(-8000) + '\n... (output truncated)'
|
|
43
|
-
: result.output,
|
|
44
|
-
diagnostics,
|
|
45
|
-
...(result.error ? { error: result.error + '\n' + summary } : {}),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=typecheck.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typecheck.js","sourceRoot":"","sources":["../../src/tools/typecheck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGjD;;;GAGG;AACH,SAAS,cAAc,CAAC,MAAc;IACrC,MAAM,WAAW,GAAiB,EAAE,CAAA;IACpC,0FAA0F;IAC1F,MAAM,SAAS,GAAG,oEAAoE,CAAA;IACtF,IAAI,KAA6B,CAAA;IAEjC,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAClD,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAA;QAC7D,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,IAAI,CAAC,OAAO;YAAE,SAAQ;QAEhE,WAAW,CAAC,IAAI,CAAC;YAChB,QAAQ,EAAE,QAAwC;YAClD,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;YACjB,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;YACxB,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5B,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE;YACvB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACzB,CAAC,CAAA;IACH,CAAC;IAED,OAAO,WAAW,CAAA;AACnB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,WAAmB;IACtD,MAAM,MAAM,GAAG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,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tinker tool call types and execution result contracts.
|
|
3
|
-
* All tools are synchronous or async file-safe operations only.
|
|
4
|
-
* No network calls, no spawning shells without the run-command tool.
|
|
5
|
-
*/
|
|
6
|
-
export type ToolCallType = 'read-file' | 'write-file' | 'run-command' | 'search-repo' | 'git-diff' | 'typecheck' | 'run-tests' | 'lint';
|
|
7
|
-
export type ToolCall = {
|
|
8
|
-
tool: 'read-file';
|
|
9
|
-
path: string;
|
|
10
|
-
} | {
|
|
11
|
-
tool: 'write-file';
|
|
12
|
-
path: string;
|
|
13
|
-
content: string;
|
|
14
|
-
} | {
|
|
15
|
-
tool: 'run-command';
|
|
16
|
-
cmd: string[];
|
|
17
|
-
cwd?: string;
|
|
18
|
-
timeoutMs?: number;
|
|
19
|
-
} | {
|
|
20
|
-
tool: 'search-repo';
|
|
21
|
-
query: string;
|
|
22
|
-
fileGlob?: string;
|
|
23
|
-
maxResults?: number;
|
|
24
|
-
} | {
|
|
25
|
-
tool: 'git-diff';
|
|
26
|
-
base?: string;
|
|
27
|
-
path?: string;
|
|
28
|
-
} | {
|
|
29
|
-
tool: 'typecheck';
|
|
30
|
-
cwd?: string;
|
|
31
|
-
} | {
|
|
32
|
-
tool: 'run-tests';
|
|
33
|
-
pattern?: string;
|
|
34
|
-
cwd?: string;
|
|
35
|
-
} | {
|
|
36
|
-
tool: 'lint';
|
|
37
|
-
fix?: boolean;
|
|
38
|
-
paths?: string[];
|
|
39
|
-
cwd?: string;
|
|
40
|
-
};
|
|
41
|
-
export type ToolOutcome = 'success' | 'failure' | 'skipped';
|
|
42
|
-
export type ToolResult = {
|
|
43
|
-
tool: ToolCallType;
|
|
44
|
-
outcome: ToolOutcome;
|
|
45
|
-
output: string;
|
|
46
|
-
/** Non-empty when outcome is 'failure'. */
|
|
47
|
-
error?: string;
|
|
48
|
-
/** Structured diagnostics (compile errors, lint warnings, test failures). */
|
|
49
|
-
diagnostics?: Diagnostic[];
|
|
50
|
-
/** Wall-clock milliseconds. */
|
|
51
|
-
durationMs: number;
|
|
52
|
-
};
|
|
53
|
-
export type DiagnosticSeverity = 'error' | 'warning' | 'info';
|
|
54
|
-
export type Diagnostic = {
|
|
55
|
-
severity: DiagnosticSeverity;
|
|
56
|
-
file?: string;
|
|
57
|
-
line?: number;
|
|
58
|
-
column?: number;
|
|
59
|
-
message: string;
|
|
60
|
-
code?: string;
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,YAAY,GACrB,WAAW,GACX,YAAY,GACZ,aAAa,GACb,aAAa,GACb,UAAU,GACV,WAAW,GACX,WAAW,GACX,MAAM,CAAA;AAET,MAAM,MAAM,QAAQ,GACjB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,GAAG,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACxE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9E;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAElE,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAA;AAE3D,MAAM,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,EAAE,WAAW,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6EAA6E;IAC7E,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;IAC1B,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAE7D,MAAM,MAAM,UAAU,GAAG;IACxB,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACb,CAAA"}
|
package/dist/tools/types.js
DELETED
package/dist/tools/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ToolResult } from './types.js';
|
|
2
|
-
export type WriteRecord = {
|
|
3
|
-
path: string;
|
|
4
|
-
previousContent: string | null;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Write `content` to `filePath` (relative to projectRoot or absolute).
|
|
8
|
-
* Captures original content for rollback via the returned WriteRecord.
|
|
9
|
-
*/
|
|
10
|
-
export declare function writeFileTool(filePath: string, content: string, projectRoot: string, writeLog: WriteRecord[]): Promise<ToolResult>;
|
|
11
|
-
/**
|
|
12
|
-
* Undo the last write captured by writeLog.
|
|
13
|
-
*/
|
|
14
|
-
export declare function rollbackLastWrite(writeLog: WriteRecord[]): Promise<string | null>;
|
|
15
|
-
//# sourceMappingURL=write-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-file.d.ts","sourceRoot":"","sources":["../../src/tools/write-file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAA;AAE1E;;;GAGG;AACH,wBAAsB,aAAa,CAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,WAAW,EAAE,GACrB,OAAO,CAAC,UAAU,CAAC,CAgCrB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWvF"}
|
package/dist/tools/write-file.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
/**
|
|
4
|
-
* Write `content` to `filePath` (relative to projectRoot or absolute).
|
|
5
|
-
* Captures original content for rollback via the returned WriteRecord.
|
|
6
|
-
*/
|
|
7
|
-
export async function writeFileTool(filePath, content, projectRoot, writeLog) {
|
|
8
|
-
const start = Date.now();
|
|
9
|
-
const absolute = path.isAbsolute(filePath) ? filePath : path.join(projectRoot, filePath);
|
|
10
|
-
try {
|
|
11
|
-
let previousContent = null;
|
|
12
|
-
try {
|
|
13
|
-
previousContent = await fs.readFile(absolute, 'utf8');
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
// File does not exist yet — previousContent stays null
|
|
17
|
-
}
|
|
18
|
-
await fs.mkdir(path.dirname(absolute), { recursive: true });
|
|
19
|
-
await fs.writeFile(absolute, content, 'utf8');
|
|
20
|
-
writeLog.push({ path: absolute, previousContent });
|
|
21
|
-
return {
|
|
22
|
-
tool: 'write-file',
|
|
23
|
-
outcome: 'success',
|
|
24
|
-
output: `Wrote ${content.length} chars to ${filePath}`,
|
|
25
|
-
durationMs: Date.now() - start,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
return {
|
|
30
|
-
tool: 'write-file',
|
|
31
|
-
outcome: 'failure',
|
|
32
|
-
output: '',
|
|
33
|
-
error: error instanceof Error ? error.message : String(error),
|
|
34
|
-
durationMs: Date.now() - start,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Undo the last write captured by writeLog.
|
|
40
|
-
*/
|
|
41
|
-
export async function rollbackLastWrite(writeLog) {
|
|
42
|
-
const record = writeLog.pop();
|
|
43
|
-
if (!record)
|
|
44
|
-
return null;
|
|
45
|
-
if (record.previousContent === null) {
|
|
46
|
-
await fs.unlink(record.path);
|
|
47
|
-
return `Deleted new file: ${record.path}`;
|
|
48
|
-
}
|
|
49
|
-
await fs.writeFile(record.path, record.previousContent, 'utf8');
|
|
50
|
-
return `Restored: ${record.path}`;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=write-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-file.js","sourceRoot":"","sources":["../../src/tools/write-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAA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,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAC7D,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;SAC9B,CAAA;IACF,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,QAAuB;IAC9D,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAA;IAC7B,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IAExB,IAAI,MAAM,CAAC,eAAe,KAAK,IAAI,EAAE,CAAC;QACrC,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAC5B,OAAO,qBAAqB,MAAM,CAAC,IAAI,EAAE,CAAA;IAC1C,CAAC;IAED,MAAM,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;IAC/D,OAAO,aAAa,MAAM,CAAC,IAAI,EAAE,CAAA;AAClC,CAAC"}
|
package/dist/tracing/types.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type LumisTraceStatus = 'start' | 'success' | 'failure' | 'info';
|
|
2
|
-
export type LumisTraceEvent = {
|
|
3
|
-
type: 'config-load' | 'command-dispatch' | 'plan-execution' | 'runtime-task';
|
|
4
|
-
status: LumisTraceStatus;
|
|
5
|
-
name: string;
|
|
6
|
-
message?: string;
|
|
7
|
-
context?: Record<string, unknown>;
|
|
8
|
-
};
|
|
9
|
-
export type LumisTraceListener = (event: LumisTraceEvent) => void | Promise<void>;
|
|
10
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tracing/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAA;AAEvE,MAAM,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,aAAa,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,cAAc,CAAA;IAC5E,MAAM,EAAE,gBAAgB,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA"}
|
package/dist/tracing/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tracing/types.ts"],"names":[],"mappings":""}
|