deepclause-sdk 0.0.68 → 0.0.69
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 +10 -2
- package/dist/agent.d.ts +1 -0
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +127 -57
- package/dist/agent.js.map +1 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +4 -0
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/tui.d.ts +1 -0
- package/dist/cli/tui.d.ts.map +1 -1
- package/dist/cli/tui.js +84 -14
- package/dist/cli/tui.js.map +1 -1
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +1 -0
- package/dist/runner.js.map +1 -1
- package/dist/system/assets/docs/DML_COMPILER_PROMPT.md +7 -3
- package/dist/system/assets/docs/TASK_PROMPT.md +33 -0
- package/dist/system/assets/index.d.ts +9 -7
- package/dist/system/assets/index.d.ts.map +1 -1
- package/dist/system/assets/index.js +33 -9
- package/dist/system/assets/index.js.map +1 -1
- package/dist/system/runtime/catalog-skills.d.ts +1 -1
- package/dist/system/runtime/catalog-skills.d.ts.map +1 -1
- package/dist/system/runtime/catalog-skills.js +19 -5
- package/dist/system/runtime/catalog-skills.js.map +1 -1
- package/dist/system/runtime/conductor.d.ts +5 -1
- package/dist/system/runtime/conductor.d.ts.map +1 -1
- package/dist/system/runtime/conductor.js +22 -0
- package/dist/system/runtime/conductor.js.map +1 -1
- package/dist/system/runtime/dml-executor.d.ts +1 -1
- package/dist/system/runtime/dml-executor.d.ts.map +1 -1
- package/dist/system/runtime/dml-params.d.ts +2 -2
- package/dist/system/runtime/dml-params.d.ts.map +1 -1
- package/dist/system/runtime/dml-params.js +3 -0
- package/dist/system/runtime/dml-params.js.map +1 -1
- package/dist/system/runtime/skill-creator.d.ts.map +1 -1
- package/dist/system/runtime/skill-creator.js +52 -21
- package/dist/system/runtime/skill-creator.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/tui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../../src/cli/tui.ts"],"names":[],"mappings":"AAOA,OAAO,EAAyD,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EAAO,KAAK,SAAS,IAAI,YAAY,EAAE,MAAM,UAAU,CAAC;AAE/D,OAAO,
|
|
1
|
+
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../../src/cli/tui.ts"],"names":[],"mappings":"AAOA,OAAO,EAAyD,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EAAO,KAAK,SAAS,IAAI,YAAY,EAAE,MAAM,UAAU,CAAC;AAE/D,OAAO,EAQL,KAAK,iBAAiB,EAGvB,MAAM,gCAAgC,CAAC;AAiBxC,QAAA,MAAM,sBAAsB,yGAA0G,CAAC;AA0DvI,KAAK,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAsInE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;CAC9B;AAmBD,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,mBAAmB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GAC/E;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,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Ac,GAAG,MAAM,EAAE,CAc7E;AAyMD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA8BnE;AAUD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ7D;AA2WD,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAM5F;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,aAAa,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EACvC,KAAK,EAAE,MAAM,EACb,YAAY,SAAK,GAChB,MAAM,CAiBR;AASD,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EAAE,EACd,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,GACZ;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CA4BzC;AAwDD,wBAAgB,iBAAiB,CAAC,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EACjG,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,KAAK,EAAE,MAAM,GACZ,CAAC,EAAE,CAWL"}
|
package/dist/cli/tui.js
CHANGED
|
@@ -7,7 +7,7 @@ import { listCommands } from './commands.js';
|
|
|
7
7
|
import { getConfigPath, loadConfig, resolveModelSlot, setModel } from './config.js';
|
|
8
8
|
import { run } from './run.js';
|
|
9
9
|
import { formatToolArgs } from './tool-args.js';
|
|
10
|
-
import { createSessionExecutionLogWriter, createLocalSkill, createConductorSession, getConductorSessionDetail, listConductorSessions, runConductorTurn, } from '../system/runtime/conductor.js';
|
|
10
|
+
import { appendConductorSessionMessages, createSessionExecutionLogWriter, createLocalSkill, createConductorSession, getConductorSessionDetail, listConductorSessions, runConductorTurn, } from '../system/runtime/conductor.js';
|
|
11
11
|
import { getSystemAssetSourcePaths } from '../system/assets/index.js';
|
|
12
12
|
import { createShellManager, describeShellExecutionBackend, } from '../system/runtime/shell-manager.js';
|
|
13
13
|
import { buildToolCompletionEvent, buildToolFailureEvent, buildToolStartEvent, createShellToolEventBridge, } from '../system/runtime/shell-tool-events.js';
|
|
@@ -23,6 +23,7 @@ const BUSY_RENDER_INTERVAL_MS = 40;
|
|
|
23
23
|
const TYPING_RENDER_INTERVAL_MS = 90;
|
|
24
24
|
const COMBINING_MARK_RE = /\p{Mark}/u;
|
|
25
25
|
const EXTENDED_PICTOGRAPHIC_RE = /\p{Extended_Pictographic}/u;
|
|
26
|
+
const MAX_PERSISTED_SHELL_STREAM_CHARS = 4000;
|
|
26
27
|
const TEXT_FILE_EXTENSIONS = new Set([
|
|
27
28
|
'.dml', '.md', '.txt', '.json', '.yaml', '.yml', '.toml', '.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs',
|
|
28
29
|
'.css', '.scss', '.html', '.sql', '.py', '.sh', '.bash', '.zsh', '.pro', '.pl', '.csv', '.env', '.example',
|
|
@@ -1021,16 +1022,16 @@ class FullscreenTui {
|
|
|
1021
1022
|
}
|
|
1022
1023
|
}
|
|
1023
1024
|
}
|
|
1024
|
-
async executeShellCommand(commandText) {
|
|
1025
|
+
async executeShellCommand(commandText, persistOutput = false) {
|
|
1025
1026
|
const trimmedCommand = commandText.trim();
|
|
1026
1027
|
if (!trimmedCommand) {
|
|
1027
|
-
this.statusLine = 'Enter a shell command after
|
|
1028
|
+
this.statusLine = 'Enter a shell command after ! or !!.';
|
|
1028
1029
|
this.requestRender();
|
|
1029
1030
|
return;
|
|
1030
1031
|
}
|
|
1031
1032
|
const sessionId = this.selectedSessionId || 'global';
|
|
1032
1033
|
const activity = this.activityFor(sessionId);
|
|
1033
|
-
this.lastSubmittedInput = { kind: 'shell', command: trimmedCommand };
|
|
1034
|
+
this.lastSubmittedInput = { kind: 'shell', command: trimmedCommand, persistOutput };
|
|
1034
1035
|
this.focusedPane = 'messages';
|
|
1035
1036
|
this.paneScroll.messages = 0;
|
|
1036
1037
|
this.paneScroll.process = 0;
|
|
@@ -1038,14 +1039,15 @@ class FullscreenTui {
|
|
|
1038
1039
|
role: 'system',
|
|
1039
1040
|
kind: 'output',
|
|
1040
1041
|
tag: 'shell',
|
|
1041
|
-
content:
|
|
1042
|
+
content: `${persistOutput ? '!!' : '!'}${trimmedCommand}`,
|
|
1042
1043
|
}, 'shell');
|
|
1043
|
-
activity.pushLine(`shell
|
|
1044
|
+
activity.pushLine(`shell ${persistOutput ? '!!' : '!'}${trimmedCommand}`);
|
|
1044
1045
|
this.busy = true;
|
|
1045
1046
|
this.currentAbortController = new AbortController();
|
|
1046
1047
|
this.startAnimation();
|
|
1047
|
-
this.statusLine = `Running
|
|
1048
|
+
this.statusLine = `Running ${persistOutput ? '!!' : '!'}${trimmedCommand}...`;
|
|
1048
1049
|
this.requestRender();
|
|
1050
|
+
let persistenceStarted = false;
|
|
1049
1051
|
try {
|
|
1050
1052
|
const result = await runShellCommand(this.workspaceRoot, trimmedCommand, {
|
|
1051
1053
|
sandbox: this.options.sandbox,
|
|
@@ -1057,16 +1059,31 @@ class FullscreenTui {
|
|
|
1057
1059
|
});
|
|
1058
1060
|
activity.finish();
|
|
1059
1061
|
await this.refreshCommands();
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1062
|
+
if (persistOutput) {
|
|
1063
|
+
persistenceStarted = true;
|
|
1064
|
+
const persistedSessionId = await this.persistShellCommandResult(trimmedCommand, result);
|
|
1065
|
+
await this.refreshSessions({ createIfMissing: true, selectedSessionId: persistedSessionId });
|
|
1066
|
+
this.finishExecutionPreview({ persist: false });
|
|
1067
|
+
this.statusLine = result.success
|
|
1068
|
+
? 'Shell command finished and was added to the session.'
|
|
1069
|
+
: 'Shell command failed and its output was added to the session.';
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
this.finishExecutionPreview(result.success
|
|
1073
|
+
? { persist: true, finalText: formatShellCommandSummary(result) }
|
|
1074
|
+
: { persist: true, error: formatShellCommandSummary(result) });
|
|
1075
|
+
this.statusLine = result.success ? 'Shell command finished.' : 'Shell command failed.';
|
|
1076
|
+
}
|
|
1064
1077
|
}
|
|
1065
1078
|
catch (error) {
|
|
1066
1079
|
activity.finish();
|
|
1067
1080
|
const message = error.message;
|
|
1068
1081
|
this.finishExecutionPreview({ persist: true, error: message });
|
|
1069
|
-
this.statusLine = isAbortError(error)
|
|
1082
|
+
this.statusLine = isAbortError(error)
|
|
1083
|
+
? 'Shell command cancelled.'
|
|
1084
|
+
: persistOutput && persistenceStarted
|
|
1085
|
+
? 'Shell command finished, but saving its transcript failed.'
|
|
1086
|
+
: 'Shell command failed.';
|
|
1070
1087
|
}
|
|
1071
1088
|
finally {
|
|
1072
1089
|
this.busy = false;
|
|
@@ -1423,6 +1440,7 @@ class FullscreenTui {
|
|
|
1423
1440
|
'',
|
|
1424
1441
|
'Use F10 or Ctrl+G for the menu bar, Ctrl+W to cycle panes, and /cancel to stop a running execution.',
|
|
1425
1442
|
'Type !<command> to run a direct shell command in the configured workspace shell.',
|
|
1443
|
+
'Type !!<command> to run a shell command and append its transcript to the active session.',
|
|
1426
1444
|
'The Skills and Files menus open searchable pickers, and Ctrl+P opens the action palette directly.',
|
|
1427
1445
|
].join('\n'), { preferredExtension: '.txt' });
|
|
1428
1446
|
return;
|
|
@@ -1974,7 +1992,7 @@ class FullscreenTui {
|
|
|
1974
1992
|
return;
|
|
1975
1993
|
}
|
|
1976
1994
|
if (this.lastSubmittedInput.kind === 'shell') {
|
|
1977
|
-
await this.executeShellCommand(this.lastSubmittedInput.command);
|
|
1995
|
+
await this.executeShellCommand(this.lastSubmittedInput.command, this.lastSubmittedInput.persistOutput);
|
|
1978
1996
|
return;
|
|
1979
1997
|
}
|
|
1980
1998
|
if (this.lastSubmittedInput.kind === 'builtin') {
|
|
@@ -2333,6 +2351,18 @@ class FullscreenTui {
|
|
|
2333
2351
|
this.activityBySessionId.set(key, created);
|
|
2334
2352
|
return created;
|
|
2335
2353
|
}
|
|
2354
|
+
async persistShellCommandResult(command, result) {
|
|
2355
|
+
let sessionId = this.selectedSessionId;
|
|
2356
|
+
if (!sessionId) {
|
|
2357
|
+
await this.refreshSessions({ createIfMissing: true });
|
|
2358
|
+
sessionId = this.selectedSessionId;
|
|
2359
|
+
}
|
|
2360
|
+
if (!sessionId) {
|
|
2361
|
+
throw new Error('No conductor session available to persist shell output.');
|
|
2362
|
+
}
|
|
2363
|
+
await appendConductorSessionMessages(this.workspaceRoot, sessionId, buildPersistedShellTranscript(command, result));
|
|
2364
|
+
return sessionId;
|
|
2365
|
+
}
|
|
2336
2366
|
requestRender() {
|
|
2337
2367
|
if (this.renderTimer) {
|
|
2338
2368
|
return;
|
|
@@ -2561,6 +2591,7 @@ class FullscreenTui {
|
|
|
2561
2591
|
`Conductor Prompt ${formatSystemAssetSourcePath(this.workspaceRoot, systemAssetSources.conductorPrompt)}`,
|
|
2562
2592
|
`Skill Creator DML ${formatSystemAssetSourcePath(this.workspaceRoot, systemAssetSources.skillCreatorDml)}`,
|
|
2563
2593
|
`Skill Creator Prompt ${formatSystemAssetSourcePath(this.workspaceRoot, systemAssetSources.skillCreatorPrompt)}`,
|
|
2594
|
+
`Task Prompt ${formatSystemAssetSourcePath(this.workspaceRoot, systemAssetSources.taskPrompt)}`,
|
|
2564
2595
|
'Changes apply on the next turn or /compile run. No TUI reload is required.',
|
|
2565
2596
|
'',
|
|
2566
2597
|
'Shell Execution',
|
|
@@ -3163,6 +3194,41 @@ function formatShellCommandSummary(result) {
|
|
|
3163
3194
|
}
|
|
3164
3195
|
return result.summary || `Shell command failed with exit code ${result.exitCode}.`;
|
|
3165
3196
|
}
|
|
3197
|
+
function buildPersistedShellTranscript(command, result) {
|
|
3198
|
+
const sections = [
|
|
3199
|
+
'[shell result]',
|
|
3200
|
+
`Command: ${command}`,
|
|
3201
|
+
`Summary: ${formatShellCommandSummary(result)}`,
|
|
3202
|
+
`Backend: ${result.backendLabel ?? result.backend}`,
|
|
3203
|
+
`Exit code: ${result.exitCode}`,
|
|
3204
|
+
];
|
|
3205
|
+
const stdout = truncateShellTranscriptStream(result.stdout, 'stdout');
|
|
3206
|
+
const stderr = truncateShellTranscriptStream(result.stderr, 'stderr');
|
|
3207
|
+
if (stdout) {
|
|
3208
|
+
sections.push(`stdout:\n${stdout}`);
|
|
3209
|
+
}
|
|
3210
|
+
if (stderr) {
|
|
3211
|
+
sections.push(`stderr:\n${stderr}`);
|
|
3212
|
+
}
|
|
3213
|
+
if (!stdout && !stderr) {
|
|
3214
|
+
sections.push('No stdout or stderr output.');
|
|
3215
|
+
}
|
|
3216
|
+
return [
|
|
3217
|
+
{ role: 'user', content: `[shell command]\n${command}` },
|
|
3218
|
+
{ role: 'assistant', content: sections.join('\n\n') },
|
|
3219
|
+
];
|
|
3220
|
+
}
|
|
3221
|
+
function truncateShellTranscriptStream(content, label) {
|
|
3222
|
+
const trimmed = content.trim();
|
|
3223
|
+
if (!trimmed) {
|
|
3224
|
+
return '';
|
|
3225
|
+
}
|
|
3226
|
+
if (trimmed.length <= MAX_PERSISTED_SHELL_STREAM_CHARS) {
|
|
3227
|
+
return trimmed;
|
|
3228
|
+
}
|
|
3229
|
+
const omitted = trimmed.length - MAX_PERSISTED_SHELL_STREAM_CHARS;
|
|
3230
|
+
return `${trimmed.slice(0, MAX_PERSISTED_SHELL_STREAM_CHARS).trimEnd()}\n\n[${label} truncated: ${omitted} more chars omitted]`;
|
|
3231
|
+
}
|
|
3166
3232
|
function isAbortError(error) {
|
|
3167
3233
|
return error instanceof Error && error.name === 'AbortError';
|
|
3168
3234
|
}
|
|
@@ -3254,8 +3320,11 @@ export function parseCommandBarInput(line) {
|
|
|
3254
3320
|
if (trimmedStart.startsWith('\\!')) {
|
|
3255
3321
|
return { kind: 'text', prompt: trimmedStart.slice(1).trim() };
|
|
3256
3322
|
}
|
|
3323
|
+
if (trimmedStart.startsWith('!!')) {
|
|
3324
|
+
return { kind: 'shell', command: trimmedStart.slice(2).trim(), persistOutput: true };
|
|
3325
|
+
}
|
|
3257
3326
|
if (trimmedStart.startsWith('!')) {
|
|
3258
|
-
return { kind: 'shell', command: trimmedStart.slice(1).trim() };
|
|
3327
|
+
return { kind: 'shell', command: trimmedStart.slice(1).trim(), persistOutput: false };
|
|
3259
3328
|
}
|
|
3260
3329
|
const trimmed = line.trim();
|
|
3261
3330
|
if (!trimmed.startsWith('/')) {
|
|
@@ -3621,6 +3690,7 @@ function buildHelpLines() {
|
|
|
3621
3690
|
'/quit exit the TUI',
|
|
3622
3691
|
'/<skill> [args] run a compiled skill directly',
|
|
3623
3692
|
'!<command> run a shell command directly in the workspace shell',
|
|
3693
|
+
'!!<command> run a shell command and add its result to the session transcript',
|
|
3624
3694
|
'keys',
|
|
3625
3695
|
'F10 / Ctrl+G open the menu bar',
|
|
3626
3696
|
'Ctrl+P open the action palette',
|