deepclause-sdk 0.0.65 → 0.0.66
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 +83 -6
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +131 -30
- package/dist/agent.js.map +1 -1
- package/dist/cli/commands.d.ts +5 -0
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +75 -5
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/compile.d.ts +3 -0
- package/dist/cli/compile.d.ts.map +1 -1
- package/dist/cli/compile.js.map +1 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +31 -2
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/index.js +34 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/tui.d.ts +9 -0
- package/dist/cli/tui.d.ts.map +1 -1
- package/dist/cli/tui.js +100 -30
- package/dist/cli/tui.js.map +1 -1
- package/dist/compiler.d.ts.map +1 -1
- package/dist/compiler.js +6 -8
- package/dist/compiler.js.map +1 -1
- package/dist/prolog/bridge.d.ts +10 -1
- package/dist/prolog/bridge.d.ts.map +1 -1
- package/dist/prolog/bridge.js +26 -1
- package/dist/prolog/bridge.js.map +1 -1
- package/dist/runner.d.ts +2 -1
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +19 -16
- package/dist/runner.js.map +1 -1
- package/dist/system/assets/docs/CONDUCTOR_PROMPT.md +39 -5
- package/dist/system/assets/docs/DML_COMPILER_PROMPT.md +17 -4
- package/dist/system/assets/index.d.ts +2 -0
- package/dist/system/assets/index.d.ts.map +1 -1
- package/dist/system/assets/index.js +7 -0
- package/dist/system/assets/index.js.map +1 -1
- package/dist/system/assets/recipes/deepclause-coding-workflow/SKILL.md +45 -0
- package/dist/system/assets/skills/conductor.dml +20 -14
- package/dist/system/runtime/catalog-recipes.d.ts +24 -0
- package/dist/system/runtime/catalog-recipes.d.ts.map +1 -0
- package/dist/system/runtime/catalog-recipes.js +273 -0
- package/dist/system/runtime/catalog-recipes.js.map +1 -0
- package/dist/system/runtime/catalog-skills.d.ts +6 -1
- package/dist/system/runtime/catalog-skills.d.ts.map +1 -1
- package/dist/system/runtime/catalog-skills.js +28 -0
- package/dist/system/runtime/catalog-skills.js.map +1 -1
- package/dist/system/runtime/conductor.d.ts +29 -0
- package/dist/system/runtime/conductor.d.ts.map +1 -1
- package/dist/system/runtime/conductor.js +199 -59
- package/dist/system/runtime/conductor.js.map +1 -1
- package/dist/system/runtime/runtime-tools.d.ts +6 -0
- package/dist/system/runtime/runtime-tools.d.ts.map +1 -1
- package/dist/system/runtime/runtime-tools.js +26 -1
- package/dist/system/runtime/runtime-tools.js.map +1 -1
- package/dist/system/runtime/shell-manager.d.ts.map +1 -1
- package/dist/system/runtime/shell-manager.js +112 -29
- package/dist/system/runtime/shell-manager.js.map +1 -1
- package/dist/system/runtime/skill-creator.d.ts +2 -0
- package/dist/system/runtime/skill-creator.d.ts.map +1 -1
- package/dist/system/runtime/skill-creator.js +199 -15
- package/dist/system/runtime/skill-creator.js.map +1 -1
- package/package.json +2 -2
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 { createLocalSkill, createConductorSession, getConductorSessionDetail, listConductorSessions, runConductorTurn, } from '../system/runtime/conductor.js';
|
|
10
|
+
import { createSessionExecutionLogWriter, createLocalSkill, createConductorSession, getConductorSessionDetail, listConductorSessions, runConductorTurn, } from '../system/runtime/conductor.js';
|
|
11
11
|
import { getSystemAssetSourcePaths } from '../system/assets/index.js';
|
|
12
12
|
import { createShellManager } from '../system/runtime/shell-manager.js';
|
|
13
13
|
import { buildToolCompletionEvent, buildToolFailureEvent, buildToolStartEvent, createShellToolEventBridge, } from '../system/runtime/shell-tool-events.js';
|
|
@@ -917,6 +917,7 @@ class FullscreenTui {
|
|
|
917
917
|
this.requestRender();
|
|
918
918
|
try {
|
|
919
919
|
const result = await runSkillCommand(this.workspaceRoot, skillName, args, {
|
|
920
|
+
sessionId: this.selectedSessionId || undefined,
|
|
920
921
|
sandbox: this.options.sandbox,
|
|
921
922
|
signal: this.currentAbortController.signal,
|
|
922
923
|
onUserInput: (question) => this.requestClarification(question),
|
|
@@ -2507,12 +2508,7 @@ class FullscreenTui {
|
|
|
2507
2508
|
for (const entry of visibleEntries) {
|
|
2508
2509
|
const header = this.formatMessageHeader(entry);
|
|
2509
2510
|
lines.push(header);
|
|
2510
|
-
const bodyLines = entry
|
|
2511
|
-
? entry.content.split(/\r?\n/)
|
|
2512
|
-
: (entry.pending ? [''] : ['(empty)']);
|
|
2513
|
-
if (entry.pending && !entry.content) {
|
|
2514
|
-
bodyLines[0] = 'thinking...';
|
|
2515
|
-
}
|
|
2511
|
+
const bodyLines = formatDisplayMessageBodyLines(entry);
|
|
2516
2512
|
for (const line of bodyLines) {
|
|
2517
2513
|
lines.push(` ${line}`);
|
|
2518
2514
|
}
|
|
@@ -2936,6 +2932,7 @@ async function startLineTui(workspaceRoot = process.cwd(), options = {}) {
|
|
|
2936
2932
|
const printer = new LiveExecutionPrinter();
|
|
2937
2933
|
try {
|
|
2938
2934
|
await runSkillCommand(workspaceRoot, parsed.name, parsed.args, {
|
|
2935
|
+
sessionId: session.id,
|
|
2939
2936
|
sandbox: options.sandbox,
|
|
2940
2937
|
onUserInput: async (question) => {
|
|
2941
2938
|
printer.finish();
|
|
@@ -3010,23 +3007,52 @@ export async function runPromptHeadless(prompt, workspaceRoot = process.cwd(), o
|
|
|
3010
3007
|
throw new Error(result.error);
|
|
3011
3008
|
}
|
|
3012
3009
|
}
|
|
3013
|
-
async function runSkillCommand(workspaceRoot, skillName, args, options = {}) {
|
|
3010
|
+
export async function runSkillCommand(workspaceRoot, skillName, args, options = {}) {
|
|
3014
3011
|
const commands = await listCommands(workspaceRoot);
|
|
3015
3012
|
const command = commands.find((entry) => entry.name === skillName);
|
|
3016
3013
|
if (!command) {
|
|
3017
3014
|
throw new Error(`Unknown skill: ${skillName}`);
|
|
3018
3015
|
}
|
|
3019
|
-
const
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3016
|
+
const executionLog = options.sessionId
|
|
3017
|
+
? createSessionExecutionLogWriter({
|
|
3018
|
+
workspaceRoot,
|
|
3019
|
+
sessionId: options.sessionId,
|
|
3020
|
+
executionKind: 'skill',
|
|
3021
|
+
inputText: `/${skillName}${args.length > 0 ? ` ${args.join(' ')}` : ''}`,
|
|
3022
|
+
skillName,
|
|
3023
|
+
args,
|
|
3024
|
+
})
|
|
3025
|
+
: null;
|
|
3026
|
+
const emitLogEvent = (event) => {
|
|
3027
|
+
executionLog?.recordEvent(event);
|
|
3028
|
+
options.onEvent?.(event);
|
|
3029
|
+
};
|
|
3030
|
+
try {
|
|
3031
|
+
const result = await run(command.path, args, {
|
|
3032
|
+
configRoot: workspaceRoot,
|
|
3033
|
+
headless: true,
|
|
3034
|
+
stream: true,
|
|
3035
|
+
sandbox: options.sandbox,
|
|
3036
|
+
signal: options.signal,
|
|
3037
|
+
onUserInput: options.onUserInput,
|
|
3038
|
+
onEvent: (event) => emitLogEvent({ scope: 'child', childSlug: skillName, event }),
|
|
3039
|
+
onChildEvent: (childSlug, event) => emitLogEvent({ scope: 'child', childSlug, event }),
|
|
3040
|
+
});
|
|
3041
|
+
await executionLog?.finish({
|
|
3042
|
+
status: result.error ? 'error' : 'success',
|
|
3043
|
+
answer: result.answer,
|
|
3044
|
+
error: result.error,
|
|
3045
|
+
outputCount: result.output.length,
|
|
3046
|
+
});
|
|
3047
|
+
return result;
|
|
3048
|
+
}
|
|
3049
|
+
catch (error) {
|
|
3050
|
+
await executionLog?.finish({
|
|
3051
|
+
status: 'error',
|
|
3052
|
+
error: error.message,
|
|
3053
|
+
});
|
|
3054
|
+
throw error;
|
|
3055
|
+
}
|
|
3030
3056
|
}
|
|
3031
3057
|
async function runSkillCreatorCommand(workspaceRoot, sessionId, spec, options = {}) {
|
|
3032
3058
|
const trimmedSpec = spec.trim();
|
|
@@ -3036,19 +3062,41 @@ async function runSkillCreatorCommand(workspaceRoot, sessionId, spec, options =
|
|
|
3036
3062
|
const config = await loadConfig(workspaceRoot);
|
|
3037
3063
|
const compileSelection = resolveModelSlot(config, 'compile');
|
|
3038
3064
|
const runSelection = resolveModelSlot(config, 'run');
|
|
3039
|
-
|
|
3040
|
-
spec: trimmedSpec,
|
|
3065
|
+
const executionLog = createSessionExecutionLogWriter({
|
|
3041
3066
|
workspaceRoot,
|
|
3042
|
-
workspacePath: path.resolve(workspaceRoot, config.workspace || './workspace'),
|
|
3043
|
-
config,
|
|
3044
|
-
compileSelection,
|
|
3045
|
-
runSelection,
|
|
3046
3067
|
sessionId,
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
onEvent: options.onEvent,
|
|
3068
|
+
executionKind: 'skill-creator',
|
|
3069
|
+
inputText: trimmedSpec,
|
|
3070
|
+
skillName: 'skill-creator',
|
|
3051
3071
|
});
|
|
3072
|
+
const emitLogEvent = (event) => {
|
|
3073
|
+
executionLog.recordEvent(event);
|
|
3074
|
+
options.onEvent?.(event);
|
|
3075
|
+
};
|
|
3076
|
+
try {
|
|
3077
|
+
const result = await createLocalSkill({
|
|
3078
|
+
spec: trimmedSpec,
|
|
3079
|
+
workspaceRoot,
|
|
3080
|
+
workspacePath: path.resolve(workspaceRoot, config.workspace || './workspace'),
|
|
3081
|
+
config,
|
|
3082
|
+
compileSelection,
|
|
3083
|
+
runSelection,
|
|
3084
|
+
sessionId,
|
|
3085
|
+
sandbox: options.sandbox ?? false,
|
|
3086
|
+
signal: options.signal,
|
|
3087
|
+
onUserInput: options.onUserInput ?? (async () => ''),
|
|
3088
|
+
onEvent: emitLogEvent,
|
|
3089
|
+
});
|
|
3090
|
+
await executionLog.finish({ status: 'success' });
|
|
3091
|
+
return result;
|
|
3092
|
+
}
|
|
3093
|
+
catch (error) {
|
|
3094
|
+
await executionLog.finish({
|
|
3095
|
+
status: 'error',
|
|
3096
|
+
error: error.message,
|
|
3097
|
+
});
|
|
3098
|
+
throw error;
|
|
3099
|
+
}
|
|
3052
3100
|
}
|
|
3053
3101
|
async function runShellCommand(workspaceRoot, command, options = {}) {
|
|
3054
3102
|
const trimmedCommand = command.trim();
|
|
@@ -3454,7 +3502,11 @@ export function formatDisplayMessageHeader(entry, spinner = '') {
|
|
|
3454
3502
|
case 'user':
|
|
3455
3503
|
return '[You]';
|
|
3456
3504
|
case 'assistant': {
|
|
3457
|
-
const base = entry.error
|
|
3505
|
+
const base = entry.error
|
|
3506
|
+
? 'Assistant Error'
|
|
3507
|
+
: entry.pending
|
|
3508
|
+
? 'Thinking'
|
|
3509
|
+
: 'Assistant';
|
|
3458
3510
|
return entry.tag
|
|
3459
3511
|
? `[${base}: ${entry.tag}${spinner}]`
|
|
3460
3512
|
: `[${base}${spinner}]`;
|
|
@@ -3463,6 +3515,18 @@ export function formatDisplayMessageHeader(entry, spinner = '') {
|
|
|
3463
3515
|
return formatSystemMessageHeader(entry, spinner);
|
|
3464
3516
|
}
|
|
3465
3517
|
}
|
|
3518
|
+
export function formatDisplayMessageBodyLines(entry) {
|
|
3519
|
+
const bodyLines = entry.content
|
|
3520
|
+
? entry.content.split(/\r?\n/)
|
|
3521
|
+
: (entry.pending ? [''] : ['(empty)']);
|
|
3522
|
+
if (!entry.pending) {
|
|
3523
|
+
return bodyLines;
|
|
3524
|
+
}
|
|
3525
|
+
if (!entry.content) {
|
|
3526
|
+
return ['thinking> generating intermediate output...'];
|
|
3527
|
+
}
|
|
3528
|
+
return bodyLines.map((line) => line ? `thinking> ${line}` : 'thinking>');
|
|
3529
|
+
}
|
|
3466
3530
|
function formatSystemAssetSourcePath(workspaceRoot, filePath) {
|
|
3467
3531
|
const relativePath = path.relative(workspaceRoot, filePath);
|
|
3468
3532
|
if (relativePath && !relativePath.startsWith('..') && !path.isAbsolute(relativePath)) {
|
|
@@ -3874,9 +3938,15 @@ function renderWindowBody(text, innerWidth, kind) {
|
|
|
3874
3938
|
if (text.startsWith('[Assistant Error]')) {
|
|
3875
3939
|
return `${border}${paint(content, ANSI.red, ANSI.bgBlue, ANSI.bold)}${border}`;
|
|
3876
3940
|
}
|
|
3941
|
+
if (text.startsWith('[Thinking')) {
|
|
3942
|
+
return `${border}${paint(content, ANSI.cyan, ANSI.bgBlue, ANSI.bold)}${border}`;
|
|
3943
|
+
}
|
|
3877
3944
|
if (text.startsWith('[Assistant')) {
|
|
3878
3945
|
return `${border}${paint(content, ANSI.brightYellow, ANSI.bgBlue, ANSI.bold)}${border}`;
|
|
3879
3946
|
}
|
|
3947
|
+
if (text.startsWith(' thinking>')) {
|
|
3948
|
+
return `${border}${paint(content, ANSI.cyan, ANSI.bgBlue, ANSI.dim)}${border}`;
|
|
3949
|
+
}
|
|
3880
3950
|
if (text.startsWith('[System')) {
|
|
3881
3951
|
return `${border}${paint(content, ANSI.cyan, ANSI.bgBlue, ANSI.bold)}${border}`;
|
|
3882
3952
|
}
|