deepclause-sdk 0.0.72 → 0.0.74
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/cli/tui.d.ts +6 -0
- package/dist/cli/tui.d.ts.map +1 -1
- package/dist/cli/tui.js +99 -16
- package/dist/cli/tui.js.map +1 -1
- package/dist/compaction.d.ts +25 -2
- package/dist/compaction.d.ts.map +1 -1
- package/dist/compaction.js +167 -8
- package/dist/compaction.js.map +1 -1
- package/dist/prolog/bridge.d.ts +16 -0
- package/dist/prolog/bridge.d.ts.map +1 -1
- package/dist/prolog/bridge.js +12 -0
- package/dist/prolog/bridge.js.map +1 -1
- package/dist/prolog-src/deepclause_mi.pl +69 -5
- package/dist/runner.d.ts +10 -5
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +89 -23
- package/dist/runner.js.map +1 -1
- package/dist/system/assets/compactors/default-loop-compactor.dml +15 -5
- package/dist/system/assets/compactors/default-session-compactor.dml +15 -5
- package/dist/system/runtime/conductor.d.ts.map +1 -1
- package/dist/system/runtime/conductor.js +13 -28
- package/dist/system/runtime/conductor.js.map +1 -1
- package/dist/system/runtime/dml-executor.d.ts +2 -5
- package/dist/system/runtime/dml-executor.d.ts.map +1 -1
- package/dist/types.d.ts +3 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/prolog-src/deepclause_mi.pl +69 -5
package/dist/cli/tui.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ import { type RunResult as CliRunResult } from './run.js';
|
|
|
3
3
|
import { type ConductorLogEvent } from '../system/runtime/conductor.js';
|
|
4
4
|
declare const BUILTIN_SLASH_COMMANDS: readonly ["new", "sessions", "help", "run", "compile", "skill-creator", "set-model", "cancel", "exit", "quit"];
|
|
5
5
|
type BuiltinSlashCommand = (typeof BUILTIN_SLASH_COMMANDS)[number];
|
|
6
|
+
type TuiInputStream = {
|
|
7
|
+
isTTY?: boolean;
|
|
8
|
+
pause(): void;
|
|
9
|
+
setRawMode?(mode: boolean): void;
|
|
10
|
+
};
|
|
6
11
|
export interface DisplayMessage {
|
|
7
12
|
role: 'user' | 'assistant' | 'system';
|
|
8
13
|
content: string;
|
|
@@ -63,6 +68,7 @@ export declare class ActivityBuffer {
|
|
|
63
68
|
private handleToolCall;
|
|
64
69
|
private buildActiveToolLines;
|
|
65
70
|
}
|
|
71
|
+
export declare function releaseTuiInputStream(stream: TuiInputStream): void;
|
|
66
72
|
export declare function startTui(workspaceRoot?: string, options?: {
|
|
67
73
|
sandbox?: boolean;
|
|
68
74
|
}): Promise<void>;
|
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,EAQL,KAAK,iBAAiB,EAGvB,MAAM,gCAAgC,CAAC;AAiBxC,QAAA,MAAM,sBAAsB,gHAAiH,CAAC;AA0D9I,KAAK,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;
|
|
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,gHAAiH,CAAC;AA0D9I,KAAK,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnE,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EA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AAgB,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
|
@@ -299,6 +299,12 @@ export class ActivityBuffer {
|
|
|
299
299
|
return lines;
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
|
+
export function releaseTuiInputStream(stream) {
|
|
303
|
+
if (stream.isTTY && typeof stream.setRawMode === 'function') {
|
|
304
|
+
stream.setRawMode(false);
|
|
305
|
+
}
|
|
306
|
+
stream.pause();
|
|
307
|
+
}
|
|
302
308
|
class FullscreenTui {
|
|
303
309
|
workspaceRoot;
|
|
304
310
|
options;
|
|
@@ -323,6 +329,12 @@ class FullscreenTui {
|
|
|
323
329
|
process: 0,
|
|
324
330
|
context: 0,
|
|
325
331
|
};
|
|
332
|
+
lastPaneMetrics = {
|
|
333
|
+
sessions: { maxStart: 0, viewportLines: 0, maxStartIsExact: true },
|
|
334
|
+
messages: { maxStart: 0, viewportLines: 0, maxStartIsExact: true },
|
|
335
|
+
process: { maxStart: 0, viewportLines: 0, maxStartIsExact: true },
|
|
336
|
+
context: { maxStart: 0, viewportLines: 0, maxStartIsExact: true },
|
|
337
|
+
};
|
|
326
338
|
currentPreview = null;
|
|
327
339
|
currentAbortController = null;
|
|
328
340
|
inputValue = '';
|
|
@@ -375,9 +387,7 @@ class FullscreenTui {
|
|
|
375
387
|
this.animationTimer = null;
|
|
376
388
|
}
|
|
377
389
|
input.off('keypress', this.onKeypress);
|
|
378
|
-
|
|
379
|
-
input.setRawMode(false);
|
|
380
|
-
}
|
|
390
|
+
releaseTuiInputStream(input);
|
|
381
391
|
this.previousFrameLines = null;
|
|
382
392
|
this.previousFrameSize = null;
|
|
383
393
|
output.write('\u001b[?25h\u001b[?1049l');
|
|
@@ -1704,14 +1714,25 @@ class FullscreenTui {
|
|
|
1704
1714
|
case 'skills.run': {
|
|
1705
1715
|
this.closeWorkspaceMode();
|
|
1706
1716
|
const rawArgs = await this.promptForValue(`Arguments for /${item.skillName} (optional):`);
|
|
1707
|
-
|
|
1717
|
+
const skillName = item.skillName ?? item.label;
|
|
1718
|
+
const commands = await listCommands(this.workspaceRoot, { detailed: true });
|
|
1719
|
+
const command = commands.find((entry) => entry.name === skillName);
|
|
1720
|
+
const collapsedArgs = command?.parameters?.length === 1 && rawArgs.length > 0
|
|
1721
|
+
? [rawArgs]
|
|
1722
|
+
: parseCommandArgs(rawArgs);
|
|
1723
|
+
await this.executeSkill(skillName, collapsedArgs);
|
|
1708
1724
|
return;
|
|
1709
1725
|
}
|
|
1710
1726
|
case 'run':
|
|
1711
1727
|
if (item.skillName) {
|
|
1712
1728
|
this.closeWorkspaceMode();
|
|
1713
1729
|
const rawArgs = await this.promptForValue(`Arguments for /${item.skillName} (optional):`);
|
|
1714
|
-
await this.
|
|
1730
|
+
const commands = await listCommands(this.workspaceRoot, { detailed: true });
|
|
1731
|
+
const command = commands.find((entry) => entry.name === item.skillName);
|
|
1732
|
+
const collapsedArgs = command?.parameters?.length === 1 && rawArgs.length > 0
|
|
1733
|
+
? [rawArgs]
|
|
1734
|
+
: parseCommandArgs(rawArgs);
|
|
1735
|
+
await this.executeSkill(item.skillName, collapsedArgs);
|
|
1715
1736
|
}
|
|
1716
1737
|
return;
|
|
1717
1738
|
case 'edit':
|
|
@@ -2263,13 +2284,13 @@ class FullscreenTui {
|
|
|
2263
2284
|
this.animationTimer = null;
|
|
2264
2285
|
}
|
|
2265
2286
|
scrollFocusedPane(direction, amount) {
|
|
2266
|
-
const metrics = this.getPaneMetrics(this.focusedPane);
|
|
2267
|
-
if (metrics.maxStart === 0) {
|
|
2268
|
-
this.statusLine = `${paneDisplayName(this.focusedPane)} fits on screen.`;
|
|
2269
|
-
this.requestRender();
|
|
2270
|
-
return;
|
|
2271
|
-
}
|
|
2272
2287
|
if (this.focusedPane === 'sessions') {
|
|
2288
|
+
const metrics = this.getLastPaneMetrics(this.focusedPane) ?? this.getPaneMetrics(this.focusedPane);
|
|
2289
|
+
if (metrics.maxStart === 0) {
|
|
2290
|
+
this.statusLine = `${paneDisplayName(this.focusedPane)} fits on screen.`;
|
|
2291
|
+
this.requestRender();
|
|
2292
|
+
return;
|
|
2293
|
+
}
|
|
2273
2294
|
const delta = direction === 'down' ? amount : -amount;
|
|
2274
2295
|
this.paneScroll.sessions = clamp(this.paneScroll.sessions + delta, 0, metrics.maxStart);
|
|
2275
2296
|
this.statusLine = `Sessions scroll ${this.paneScroll.sessions + 1}/${metrics.maxStart + 1}.`;
|
|
@@ -2277,8 +2298,19 @@ class FullscreenTui {
|
|
|
2277
2298
|
return;
|
|
2278
2299
|
}
|
|
2279
2300
|
const pane = this.focusedPane;
|
|
2301
|
+
const metrics = this.getLastPaneMetrics(pane)
|
|
2302
|
+
?? (this.paneScroll[pane] === 0 ? this.getRenderPaneMetrics(pane) : this.getPaneMetrics(pane));
|
|
2303
|
+
if (metrics.maxStart === 0) {
|
|
2304
|
+
this.paneScroll[pane] = 0;
|
|
2305
|
+
this.statusLine = `${paneDisplayName(pane)} fits on screen.`;
|
|
2306
|
+
this.requestRender();
|
|
2307
|
+
return;
|
|
2308
|
+
}
|
|
2280
2309
|
const delta = direction === 'up' ? amount : -amount;
|
|
2281
|
-
|
|
2310
|
+
const nextScroll = this.paneScroll[pane] + delta;
|
|
2311
|
+
this.paneScroll[pane] = metrics.maxStartIsExact
|
|
2312
|
+
? clamp(nextScroll, 0, metrics.maxStart)
|
|
2313
|
+
: Math.max(0, nextScroll);
|
|
2282
2314
|
this.statusLine = this.paneScroll[pane] === 0
|
|
2283
2315
|
? `${paneDisplayName(pane)} following newest content.`
|
|
2284
2316
|
: `${paneDisplayName(pane)} scrolled ${this.paneScroll[pane]} line${this.paneScroll[pane] === 1 ? '' : 's'} above latest.`;
|
|
@@ -2693,6 +2725,11 @@ class FullscreenTui {
|
|
|
2693
2725
|
}
|
|
2694
2726
|
buildPaneView(kind, title, width, height) {
|
|
2695
2727
|
const metrics = this.getRenderPaneMetrics(kind, width, height);
|
|
2728
|
+
this.lastPaneMetrics[kind] = {
|
|
2729
|
+
maxStart: metrics.maxStart,
|
|
2730
|
+
viewportLines: metrics.viewportLines,
|
|
2731
|
+
maxStartIsExact: metrics.maxStartIsExact,
|
|
2732
|
+
};
|
|
2696
2733
|
const paneTitle = this.buildPaneTitle(title, kind, metrics);
|
|
2697
2734
|
return buildPane(paneTitle, metrics.lines.slice(metrics.start, metrics.start + metrics.viewportLines), width, height, kind, this.focusedPane === kind);
|
|
2698
2735
|
}
|
|
@@ -2855,10 +2892,15 @@ class FullscreenTui {
|
|
|
2855
2892
|
start: 0,
|
|
2856
2893
|
maxStart: tail.truncated ? 1 : 0,
|
|
2857
2894
|
viewportLines,
|
|
2895
|
+
maxStartIsExact: !tail.truncated,
|
|
2858
2896
|
};
|
|
2859
2897
|
}
|
|
2860
2898
|
return this.getPaneMetrics(kind, width, height);
|
|
2861
2899
|
}
|
|
2900
|
+
getLastPaneMetrics(kind) {
|
|
2901
|
+
const metrics = this.lastPaneMetrics[kind];
|
|
2902
|
+
return metrics.viewportLines > 0 ? metrics : null;
|
|
2903
|
+
}
|
|
2862
2904
|
getPaneMetrics(kind, width = paneDimensionsForKind(kind, output.columns ?? 120, output.rows ?? 40).width, height = paneDimensionsForKind(kind, output.columns ?? 120, output.rows ?? 40).height) {
|
|
2863
2905
|
const innerWidth = Math.max(1, width - 2);
|
|
2864
2906
|
const rawBody = this.getPaneBody(kind);
|
|
@@ -2872,6 +2914,7 @@ class FullscreenTui {
|
|
|
2872
2914
|
start: this.paneScroll.sessions,
|
|
2873
2915
|
maxStart,
|
|
2874
2916
|
viewportLines,
|
|
2917
|
+
maxStartIsExact: true,
|
|
2875
2918
|
};
|
|
2876
2919
|
}
|
|
2877
2920
|
this.paneScroll[kind] = clamp(this.paneScroll[kind], 0, maxStart);
|
|
@@ -2880,6 +2923,7 @@ class FullscreenTui {
|
|
|
2880
2923
|
start: Math.max(0, maxStart - this.paneScroll[kind]),
|
|
2881
2924
|
maxStart,
|
|
2882
2925
|
viewportLines,
|
|
2926
|
+
maxStartIsExact: true,
|
|
2883
2927
|
};
|
|
2884
2928
|
}
|
|
2885
2929
|
getPaneBody(kind) {
|
|
@@ -3123,6 +3167,7 @@ async function startLineTui(workspaceRoot = process.cwd(), options = {}) {
|
|
|
3123
3167
|
}
|
|
3124
3168
|
finally {
|
|
3125
3169
|
rl.close();
|
|
3170
|
+
releaseTuiInputStream(input);
|
|
3126
3171
|
}
|
|
3127
3172
|
}
|
|
3128
3173
|
export async function runPromptHeadless(prompt, workspaceRoot = process.cwd(), options = {}) {
|
|
@@ -3152,28 +3197,36 @@ export async function runPromptHeadless(prompt, workspaceRoot = process.cwd(), o
|
|
|
3152
3197
|
}
|
|
3153
3198
|
}
|
|
3154
3199
|
export async function runSkillCommand(workspaceRoot, skillName, args, options = {}) {
|
|
3155
|
-
const commands = await listCommands(workspaceRoot);
|
|
3200
|
+
const commands = await listCommands(workspaceRoot, { detailed: true });
|
|
3156
3201
|
const command = commands.find((entry) => entry.name === skillName);
|
|
3157
3202
|
if (!command) {
|
|
3158
3203
|
throw new Error(`Unknown skill: ${skillName}`);
|
|
3159
3204
|
}
|
|
3205
|
+
// Collapse args for single-parameter skills
|
|
3206
|
+
const collapsedArgs = command.parameters?.length === 1 && args.length > 0
|
|
3207
|
+
? [args.join(' ')]
|
|
3208
|
+
: args;
|
|
3160
3209
|
return executeRunnableCommand(workspaceRoot, {
|
|
3161
3210
|
inputText: `/${skillName}${args.length > 0 ? ` ${args.join(' ')}` : ''}`,
|
|
3162
3211
|
runPath: command.path,
|
|
3163
3212
|
childSlug: skillName,
|
|
3164
3213
|
skillName,
|
|
3165
|
-
},
|
|
3214
|
+
}, collapsedArgs, options);
|
|
3166
3215
|
}
|
|
3167
3216
|
export async function runSlashCommand(workspaceRoot, name, args, options = {}) {
|
|
3168
|
-
const commands = await listCommands(workspaceRoot);
|
|
3217
|
+
const commands = await listCommands(workspaceRoot, { detailed: true });
|
|
3169
3218
|
const command = commands.find((entry) => entry.name === name);
|
|
3170
3219
|
if (command) {
|
|
3220
|
+
// Collapse args for single-parameter skills
|
|
3221
|
+
const slashCmdCollapsedArgs = command.parameters?.length === 1 && args.length > 0
|
|
3222
|
+
? [args.join(' ')]
|
|
3223
|
+
: args;
|
|
3171
3224
|
return executeRunnableCommand(workspaceRoot, {
|
|
3172
3225
|
inputText: `/${name}${args.length > 0 ? ` ${args.join(' ')}` : ''}`,
|
|
3173
3226
|
runPath: command.path,
|
|
3174
3227
|
childSlug: name,
|
|
3175
3228
|
skillName: name,
|
|
3176
|
-
},
|
|
3229
|
+
}, slashCmdCollapsedArgs, options);
|
|
3177
3230
|
}
|
|
3178
3231
|
const resolvedPlanPath = await resolveWorkspaceDmlPath(workspaceRoot, name, { mode: 'plans-only' });
|
|
3179
3232
|
if (!resolvedPlanPath) {
|
|
@@ -3226,6 +3279,9 @@ async function executeRunnableCommand(workspaceRoot, target, args, options = {})
|
|
|
3226
3279
|
onEvent: (event) => emitLogEvent({ scope: 'child', childSlug: target.childSlug, event }),
|
|
3227
3280
|
onChildEvent: (childSlug, event) => emitLogEvent({ scope: 'child', childSlug, event }),
|
|
3228
3281
|
});
|
|
3282
|
+
if (options.sessionId) {
|
|
3283
|
+
await appendConductorSessionMessages(workspaceRoot, options.sessionId, buildPersistedRunnableTranscript(target.inputText, result));
|
|
3284
|
+
}
|
|
3229
3285
|
await executionLog?.finish({
|
|
3230
3286
|
status: result.error ? 'error' : 'success',
|
|
3231
3287
|
answer: result.answer,
|
|
@@ -3235,6 +3291,12 @@ async function executeRunnableCommand(workspaceRoot, target, args, options = {})
|
|
|
3235
3291
|
return result;
|
|
3236
3292
|
}
|
|
3237
3293
|
catch (error) {
|
|
3294
|
+
if (options.sessionId) {
|
|
3295
|
+
await appendConductorSessionMessages(workspaceRoot, options.sessionId, buildPersistedRunnableTranscript(target.inputText, {
|
|
3296
|
+
output: [],
|
|
3297
|
+
error: error.message,
|
|
3298
|
+
}));
|
|
3299
|
+
}
|
|
3238
3300
|
await executionLog?.finish({
|
|
3239
3301
|
status: 'error',
|
|
3240
3302
|
error: error.message,
|
|
@@ -3394,6 +3456,18 @@ function formatShellCommandSummary(result) {
|
|
|
3394
3456
|
}
|
|
3395
3457
|
return result.summary || `Shell command failed with exit code ${result.exitCode}.`;
|
|
3396
3458
|
}
|
|
3459
|
+
function buildPersistedRunnableTranscript(inputText, result) {
|
|
3460
|
+
const transcript = [];
|
|
3461
|
+
const trimmedInput = inputText.trim();
|
|
3462
|
+
if (trimmedInput) {
|
|
3463
|
+
transcript.push({ role: 'user', content: trimmedInput });
|
|
3464
|
+
}
|
|
3465
|
+
const assistantContent = summarizeRunResult(result).trim();
|
|
3466
|
+
if (assistantContent) {
|
|
3467
|
+
transcript.push({ role: 'assistant', content: assistantContent });
|
|
3468
|
+
}
|
|
3469
|
+
return transcript;
|
|
3470
|
+
}
|
|
3397
3471
|
function buildPersistedShellTranscript(command, result) {
|
|
3398
3472
|
const sections = [
|
|
3399
3473
|
'[shell result]',
|
|
@@ -3449,6 +3523,15 @@ export function previewMessageFromEvent(logEvent) {
|
|
|
3449
3523
|
return null;
|
|
3450
3524
|
}
|
|
3451
3525
|
return previewQuestionMessage(logEvent.event.prompt, logEvent.scope === 'child' ? logEvent.childSlug : undefined);
|
|
3526
|
+
case 'memory_compaction':
|
|
3527
|
+
return {
|
|
3528
|
+
role: 'system',
|
|
3529
|
+
kind: 'output',
|
|
3530
|
+
tag: logEvent.scope === 'child' ? logEvent.childSlug : undefined,
|
|
3531
|
+
content: logEvent.event.content
|
|
3532
|
+
? `Memory compaction: ${logEvent.event.content}`
|
|
3533
|
+
: 'Memory compaction triggered.',
|
|
3534
|
+
};
|
|
3452
3535
|
default:
|
|
3453
3536
|
return null;
|
|
3454
3537
|
}
|