@bahulam/code 0.1.6 → 0.1.8
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/LICENSE +1 -1
- package/NOTICE +6 -6
- package/README.md +11 -18
- package/package.json +11 -11
- package/src/agents/loader.mjs +1 -1
- package/src/agents/workflow_loader.mjs +2 -2
- package/src/auth/{tarang-auth.mjs → bahulam-auth.mjs} +4 -3
- package/src/commands/agent.mjs +3 -3
- package/src/commands/device.mjs +2 -2
- package/src/commands/pair.mjs +2 -2
- package/src/commands/remote.mjs +3 -3
- package/src/commands/workflow.mjs +5 -5
- package/src/config/env.mjs +9 -2
- package/src/config/memory-loader.mjs +1 -1
- package/src/config/model-catalog-default.json +4 -3
- package/src/config/model-catalog.mjs +2 -0
- package/src/config/settings.mjs +2 -2
- package/src/context/prose-chunker.mjs +162 -5
- package/src/core/agent-loop.mjs +17 -0
- package/src/core/attachments.mjs +66 -4
- package/src/core/backend-url.mjs +11 -12
- package/src/core/bundled-runtime.mjs +1 -1
- package/src/core/callback-client.mjs +1 -1
- package/src/core/headless.mjs +18 -4
- package/src/core/jsonl-writer.mjs +18 -18
- package/src/core/lint-resolver.mjs +472 -0
- package/src/core/local-agent.mjs +40 -8
- package/src/core/local-store.mjs +5 -1
- package/src/core/mode-selector.mjs +1 -1
- package/src/core/output-filter.mjs +22 -26
- package/src/core/pricing.mjs +10 -3
- package/src/core/project-artifacts.mjs +3 -3
- package/src/core/project-context-loader.mjs +9 -9
- package/src/core/settings-sync.mjs +1 -1
- package/src/core/stagnation.mjs +61 -1
- package/src/core/stream-client.mjs +13 -8
- package/src/core/system-prompt.mjs +2 -2
- package/src/core/tool-executor.mjs +178 -84
- package/src/daemon/http-dashboard.mjs +400 -0
- package/src/daemon/session-core.mjs +1 -0
- package/src/local-service/agent-relay.mjs +868 -0
- package/src/local-service/approval-bridge.mjs +222 -0
- package/src/local-service/browser.mjs +24 -0
- package/src/local-service/command.mjs +155 -0
- package/src/local-service/file-access.mjs +393 -0
- package/src/local-service/machine.mjs +86 -0
- package/src/local-service/paths.mjs +29 -0
- package/src/local-service/preview-converters.mjs +260 -0
- package/src/local-service/server.mjs +2644 -0
- package/src/local-service/session-store.mjs +221 -0
- package/src/mcp/client.mjs +4 -4
- package/src/onboarding/preflight.mjs +2 -2
- package/src/terminal/agents.mjs +2 -2
- package/src/terminal/analytics.mjs +2 -6
- package/src/terminal/ansi.mjs +11 -3
- package/src/terminal/main.mjs +43 -17
- package/src/terminal/model-catalog-display.mjs +111 -0
- package/src/terminal/repl-format.mjs +4 -1
- package/src/terminal/repl-model-form.mjs +81 -14
- package/src/terminal/repl-render.mjs +37 -7
- package/src/terminal/repl-resume.mjs +2 -2
- package/src/terminal/repl-state.mjs +12 -0
- package/src/terminal/repl.mjs +248 -70
- package/src/terminal/tool-display.mjs +32 -0
- package/src/terminal/watch-state.mjs +118 -0
- package/src/tools/agent.mjs +2 -2
- package/src/tools/analyze-image.mjs +158 -0
- package/src/tools/bash.mjs +11 -9
- package/src/tools/generate-image.mjs +411 -0
- package/src/tools/lint.mjs +24 -43
- package/src/tools/project-overview.mjs +12 -12
- package/src/tools/registry.mjs +4 -0
- package/src/ui/formatter.mjs +2 -2
- package/src/ui/icons.mjs +2 -0
- package/src/ui/input-dock.mjs +7 -7
- package/src/ui/palette.mjs +1 -1
- package/src/ui/slash-commands.mjs +4 -6
- package/src/ui/spinner.mjs +1 -1
- package/src/ui/term.mjs +2 -6
- package/src/ui/tool-card.mjs +81 -6
- package/pulse/app/activity/page.tsx +0 -190
- package/pulse/app/api/activity/route.ts +0 -138
- package/pulse/app/api/benchmark/route.ts +0 -113
- package/pulse/app/api/benchmarks/route.ts +0 -195
- package/pulse/app/api/costs/route.ts +0 -88
- package/pulse/app/api/export/route.ts +0 -77
- package/pulse/app/api/history/route.ts +0 -11
- package/pulse/app/api/import/route.ts +0 -31
- package/pulse/app/api/memory/route.ts +0 -50
- package/pulse/app/api/plans/route.ts +0 -9
- package/pulse/app/api/projects/[slug]/route.ts +0 -96
- package/pulse/app/api/projects/route.ts +0 -121
- package/pulse/app/api/sessions/[id]/replay/route.ts +0 -20
- package/pulse/app/api/sessions/[id]/route.ts +0 -31
- package/pulse/app/api/sessions/route.ts +0 -112
- package/pulse/app/api/settings/route.ts +0 -14
- package/pulse/app/api/stats/route.ts +0 -143
- package/pulse/app/api/todos/route.ts +0 -9
- package/pulse/app/api/tools/route.ts +0 -160
- package/pulse/app/benchmarks/page.tsx +0 -224
- package/pulse/app/costs/page.tsx +0 -179
- package/pulse/app/export/page.tsx +0 -465
- package/pulse/app/favicon.ico +0 -0
- package/pulse/app/globals.css +0 -263
- package/pulse/app/help/page.tsx +0 -143
- package/pulse/app/history/page.tsx +0 -157
- package/pulse/app/layout.tsx +0 -46
- package/pulse/app/memory/page.tsx +0 -365
- package/pulse/app/overview-client.tsx +0 -393
- package/pulse/app/page.tsx +0 -14
- package/pulse/app/plans/page.tsx +0 -308
- package/pulse/app/projects/[slug]/page.tsx +0 -390
- package/pulse/app/projects/page.tsx +0 -110
- package/pulse/app/sessions/[id]/page.tsx +0 -243
- package/pulse/app/sessions/page.tsx +0 -39
- package/pulse/app/settings/page.tsx +0 -188
- package/pulse/app/todos/page.tsx +0 -211
- package/pulse/app/tools/page.tsx +0 -249
- package/pulse/cli.js +0 -164
- package/pulse/components/activity/day-of-week-chart.tsx +0 -35
- package/pulse/components/activity/streak-card.tsx +0 -36
- package/pulse/components/costs/cache-efficiency-panel.tsx +0 -76
- package/pulse/components/costs/cost-by-project-chart.tsx +0 -48
- package/pulse/components/costs/cost-over-time-chart.tsx +0 -95
- package/pulse/components/costs/model-token-table.tsx +0 -60
- package/pulse/components/global-search.tsx +0 -193
- package/pulse/components/keyboard-nav-provider.tsx +0 -23
- package/pulse/components/layout/bottom-nav.tsx +0 -53
- package/pulse/components/layout/client-layout.tsx +0 -31
- package/pulse/components/layout/sidebar-context.tsx +0 -50
- package/pulse/components/layout/sidebar.tsx +0 -183
- package/pulse/components/layout/top-bar.tsx +0 -121
- package/pulse/components/overview/activity-heatmap.tsx +0 -107
- package/pulse/components/overview/conversation-table.tsx +0 -148
- package/pulse/components/overview/model-breakdown-donut.tsx +0 -95
- package/pulse/components/overview/peak-hours-chart.tsx +0 -87
- package/pulse/components/overview/project-activity-donut.tsx +0 -96
- package/pulse/components/overview/stat-card.tsx +0 -102
- package/pulse/components/overview/usage-over-time-chart.tsx +0 -166
- package/pulse/components/projects/project-card.tsx +0 -175
- package/pulse/components/sessions/replay/assistant-markdown.tsx +0 -94
- package/pulse/components/sessions/replay/compaction-card.tsx +0 -25
- package/pulse/components/sessions/replay/session-sidebar.tsx +0 -231
- package/pulse/components/sessions/replay/token-accumulation-chart.tsx +0 -98
- package/pulse/components/sessions/replay/tool-call-badge.tsx +0 -127
- package/pulse/components/sessions/replay/turn-cards.tsx +0 -220
- package/pulse/components/sessions/replay/user-tool-result.tsx +0 -158
- package/pulse/components/sessions/session-badges.tsx +0 -49
- package/pulse/components/sessions/session-table.tsx +0 -299
- package/pulse/components/theme-provider.tsx +0 -44
- package/pulse/components/tools/feature-adoption-table.tsx +0 -58
- package/pulse/components/tools/mcp-server-panel.tsx +0 -45
- package/pulse/components/tools/tool-ranking-chart.tsx +0 -57
- package/pulse/components/tools/version-history-table.tsx +0 -32
- package/pulse/components/ui/alert.tsx +0 -66
- package/pulse/components/ui/badge.tsx +0 -48
- package/pulse/components/ui/breadcrumb.tsx +0 -109
- package/pulse/components/ui/button.tsx +0 -64
- package/pulse/components/ui/calendar.tsx +0 -220
- package/pulse/components/ui/card.tsx +0 -92
- package/pulse/components/ui/command.tsx +0 -158
- package/pulse/components/ui/dialog.tsx +0 -158
- package/pulse/components/ui/input.tsx +0 -21
- package/pulse/components/ui/popover.tsx +0 -89
- package/pulse/components/ui/progress.tsx +0 -31
- package/pulse/components/ui/select.tsx +0 -190
- package/pulse/components/ui/separator.tsx +0 -28
- package/pulse/components/ui/sheet.tsx +0 -143
- package/pulse/components/ui/skeleton.tsx +0 -13
- package/pulse/components/ui/table.tsx +0 -116
- package/pulse/components/ui/tabs.tsx +0 -91
- package/pulse/components/ui/tooltip.tsx +0 -57
- package/pulse/components/use-global-keyboard-nav.ts +0 -79
- package/pulse/components.json +0 -23
- package/pulse/eslint.config.mjs +0 -18
- package/pulse/lib/bahulam-paths.ts +0 -23
- package/pulse/lib/claude-reader.ts +0 -592
- package/pulse/lib/decode.ts +0 -129
- package/pulse/lib/pricing.ts +0 -102
- package/pulse/lib/replay-parser.ts +0 -165
- package/pulse/lib/tool-categories.ts +0 -140
- package/pulse/lib/utils.ts +0 -6
- package/pulse/next-env.d.ts +0 -6
- package/pulse/next.config.ts +0 -16
- package/pulse/package.json +0 -45
- package/pulse/postcss.config.mjs +0 -7
- package/pulse/public/activity.png +0 -0
- package/pulse/public/cc-lens.png +0 -0
- package/pulse/public/command-k.png +0 -0
- package/pulse/public/costs.png +0 -0
- package/pulse/public/dashboard-dark.png +0 -0
- package/pulse/public/dashboard-white.png +0 -0
- package/pulse/public/export.png +0 -0
- package/pulse/public/file.svg +0 -1
- package/pulse/public/globe.svg +0 -1
- package/pulse/public/next.svg +0 -1
- package/pulse/public/projects.png +0 -0
- package/pulse/public/session-chat.png +0 -0
- package/pulse/public/todos.png +0 -0
- package/pulse/public/tools.png +0 -0
- package/pulse/public/vercel.svg +0 -1
- package/pulse/public/window.svg +0 -1
- package/pulse/tsconfig.json +0 -34
- package/pulse/types/claude.ts +0 -294
package/src/core/pricing.mjs
CHANGED
|
@@ -282,7 +282,7 @@ export function formatCostValue(cost) {
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
/**
|
|
285
|
-
* Convert provider cost to
|
|
285
|
+
* Convert provider cost to Bahulam credits.
|
|
286
286
|
* 100 credits = $1 of retail model usage, 2x multiplier.
|
|
287
287
|
* @param {number} costUsd
|
|
288
288
|
* @returns {number}
|
|
@@ -304,14 +304,21 @@ export function formatCredits(credits) {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
/**
|
|
307
|
-
* Format a token count for display
|
|
307
|
+
* Format a token count for display.
|
|
308
|
+
* 42 → '42'
|
|
309
|
+
* 42100 → '42.1k'
|
|
310
|
+
* 1_500_000 → '1.5M'
|
|
311
|
+
* Session-cumulative counts easily cross millions on tool-heavy runs;
|
|
312
|
+
* without the M suffix they render as multi-thousand-'k' strings like
|
|
313
|
+
* '53148.2k' that read as broken.
|
|
308
314
|
* @param {number} tokens
|
|
309
315
|
* @returns {string}
|
|
310
316
|
*/
|
|
311
317
|
export function formatTokens(tokens) {
|
|
312
318
|
if (tokens === 0) return '0';
|
|
313
319
|
if (tokens < 1000) return String(tokens);
|
|
314
|
-
return `${(tokens / 1000).toFixed(1)}k`;
|
|
320
|
+
if (tokens < 1_000_000) return `${(tokens / 1000).toFixed(1)}k`;
|
|
321
|
+
return `${(tokens / 1_000_000).toFixed(1)}M`;
|
|
315
322
|
}
|
|
316
323
|
|
|
317
324
|
/**
|
|
@@ -23,9 +23,9 @@ export function persistProjectArtifacts(data, resources, log = () => {}) {
|
|
|
23
23
|
for (const [field, filename] of artifacts) {
|
|
24
24
|
try {
|
|
25
25
|
// Resolver honors legacy .kepler/ when it's the only dir that exists.
|
|
26
|
-
const
|
|
27
|
-
fs.mkdirSync(
|
|
28
|
-
const artifactPath = path.join(
|
|
26
|
+
const bahulamDir = projectConfigDir(resource.root);
|
|
27
|
+
fs.mkdirSync(bahulamDir, { recursive: true });
|
|
28
|
+
const artifactPath = path.join(bahulamDir, filename);
|
|
29
29
|
fs.writeFileSync(artifactPath, data[field], 'utf-8');
|
|
30
30
|
resource[field] = data[field];
|
|
31
31
|
written.push(artifactPath);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as crypto from 'node:crypto';
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
|
-
import {
|
|
4
|
+
import { loadBahulamMemory } from '../config/memory-loader.mjs';
|
|
5
5
|
import { bahulamHome, projectConfigDir } from './paths.mjs';
|
|
6
6
|
|
|
7
7
|
function sha(content) {
|
|
@@ -27,8 +27,8 @@ function readFile(filePath, label, maxChars = 12000) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
function readTasks(
|
|
31
|
-
const tasksDir = path.join(
|
|
30
|
+
function readTasks(bahulamDir) {
|
|
31
|
+
const tasksDir = path.join(bahulamDir, 'tasks');
|
|
32
32
|
const files = [];
|
|
33
33
|
try {
|
|
34
34
|
if (!fs.existsSync(tasksDir)) return files;
|
|
@@ -66,9 +66,9 @@ function scanSkills(dir, scope) {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
export function loadProjectContext({ cwd = process.cwd(), previous = null } = {}) {
|
|
69
|
-
const
|
|
69
|
+
const bahulamDir = projectConfigDir(cwd);
|
|
70
70
|
const files = [];
|
|
71
|
-
for (const file of
|
|
71
|
+
for (const file of loadBahulamMemory({ cwd })) {
|
|
72
72
|
const label = file.path.endsWith(path.join('.bahulam', 'KEPLER.md'))
|
|
73
73
|
? 'KEPLER.md'
|
|
74
74
|
: path.basename(file.path);
|
|
@@ -83,10 +83,10 @@ export function loadProjectContext({ cwd = process.cwd(), previous = null } = {}
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
for (const name of ['config.json', 'project.md', 'style.md', 'goal.md', 'plan.md', 'hitl.md']) {
|
|
86
|
-
const file = readFile(path.join(
|
|
86
|
+
const file = readFile(path.join(bahulamDir, name), name, name.endsWith('.json') ? 4000 : 12000);
|
|
87
87
|
if (file) files.push(file);
|
|
88
88
|
}
|
|
89
|
-
files.push(...readTasks(
|
|
89
|
+
files.push(...readTasks(bahulamDir));
|
|
90
90
|
|
|
91
91
|
const previousHashes = new Map((previous?.files || []).map(f => [f.path, f.hash]));
|
|
92
92
|
const changed = files.filter(f => f.hash && previousHashes.get(f.path) && previousHashes.get(f.path) !== f.hash);
|
|
@@ -102,14 +102,14 @@ export function loadProjectContext({ cwd = process.cwd(), previous = null } = {}
|
|
|
102
102
|
|
|
103
103
|
const skills = [
|
|
104
104
|
...scanSkills(bahulamHome(), 'global'),
|
|
105
|
-
...scanSkills(
|
|
105
|
+
...scanSkills(bahulamDir, 'project'),
|
|
106
106
|
];
|
|
107
107
|
const byName = new Map();
|
|
108
108
|
for (const skill of skills) byName.set(skill.name, skill);
|
|
109
109
|
|
|
110
110
|
return {
|
|
111
111
|
root: cwd,
|
|
112
|
-
kepler_dir:
|
|
112
|
+
kepler_dir: bahulamDir,
|
|
113
113
|
files,
|
|
114
114
|
loaded,
|
|
115
115
|
changed,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Settings Sync — fetch user settings from
|
|
2
|
+
* Settings Sync — fetch user settings from Bahulam web and cache locally.
|
|
3
3
|
*
|
|
4
4
|
* Syncs: gateway_type, model preferences, configured providers.
|
|
5
5
|
* Cached in ~/.bahulam/config.json alongside auth token.
|
package/src/core/stagnation.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const DEFAULT_STAGNATION_THRESHOLD = 3;
|
|
2
|
+
const NO_CHANGE_EDIT_TOOLS = new Set(['edit_file']);
|
|
2
3
|
|
|
3
4
|
function canonicalize(value) {
|
|
4
5
|
if (Array.isArray(value)) return value.map(canonicalize);
|
|
@@ -12,6 +13,26 @@ function canonicalize(value) {
|
|
|
12
13
|
return value;
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
function editTarget(input = {}, result = {}) {
|
|
17
|
+
return String(
|
|
18
|
+
input.file_path || input.path || result.file_path || result.path || '',
|
|
19
|
+
).trim();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function isNoChangeEdit(tool, result = {}) {
|
|
23
|
+
if (!NO_CHANGE_EDIT_TOOLS.has(tool)) return false;
|
|
24
|
+
if (!result || typeof result !== 'object') return false;
|
|
25
|
+
if (result._no_change || result.no_change) return true;
|
|
26
|
+
if (
|
|
27
|
+
result.success !== false
|
|
28
|
+
&& result.lines_added === 0
|
|
29
|
+
&& result.lines_removed === 0
|
|
30
|
+
) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
15
36
|
export function createStagnationTracker({
|
|
16
37
|
enabled = true,
|
|
17
38
|
threshold = DEFAULT_STAGNATION_THRESHOLD,
|
|
@@ -21,6 +42,8 @@ export function createStagnationTracker({
|
|
|
21
42
|
: DEFAULT_STAGNATION_THRESHOLD;
|
|
22
43
|
let previousSignature = null;
|
|
23
44
|
let consecutiveCount = 0;
|
|
45
|
+
let previousResultSignature = null;
|
|
46
|
+
let consecutiveResultCount = 0;
|
|
24
47
|
|
|
25
48
|
return {
|
|
26
49
|
record(tool, input) {
|
|
@@ -43,14 +66,51 @@ export function createStagnationTracker({
|
|
|
43
66
|
};
|
|
44
67
|
},
|
|
45
68
|
|
|
69
|
+
recordResult(tool, input, result) {
|
|
70
|
+
if (!enabled) return { detected: false, count: 0 };
|
|
71
|
+
if (!isNoChangeEdit(tool, result)) {
|
|
72
|
+
previousResultSignature = null;
|
|
73
|
+
consecutiveResultCount = 0;
|
|
74
|
+
return { detected: false, count: 0 };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const target = editTarget(input, result);
|
|
78
|
+
const signature = JSON.stringify({
|
|
79
|
+
kind: 'no_change_edit',
|
|
80
|
+
tool,
|
|
81
|
+
target,
|
|
82
|
+
});
|
|
83
|
+
if (signature === previousResultSignature) {
|
|
84
|
+
consecutiveResultCount++;
|
|
85
|
+
} else {
|
|
86
|
+
previousResultSignature = signature;
|
|
87
|
+
consecutiveResultCount = 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
detected: consecutiveResultCount >= effectiveThreshold,
|
|
92
|
+
count: consecutiveResultCount,
|
|
93
|
+
kind: 'no_change_edit',
|
|
94
|
+
target,
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
|
|
46
98
|
reset() {
|
|
47
99
|
previousSignature = null;
|
|
48
100
|
consecutiveCount = 0;
|
|
101
|
+
previousResultSignature = null;
|
|
102
|
+
consecutiveResultCount = 0;
|
|
49
103
|
},
|
|
50
104
|
};
|
|
51
105
|
}
|
|
52
106
|
|
|
53
|
-
export function stagnationMessage(tool, count) {
|
|
107
|
+
export function stagnationMessage(tool, count, details = {}) {
|
|
108
|
+
if (details.kind === 'no_change_edit') {
|
|
109
|
+
const target = details.target ? ` for "${details.target}"` : '';
|
|
110
|
+
return `STAGNATION WARNING: Tool "${tool}" made no file changes ${count} consecutive times${target}. ` +
|
|
111
|
+
`The duplicate edit loop was stopped. Re-read the target range, compare the current file content, ` +
|
|
112
|
+
`change the edit strategy, or finish the task.`;
|
|
113
|
+
}
|
|
54
114
|
return `STAGNATION WARNING: Tool "${tool}" was called ${count} consecutive times ` +
|
|
55
115
|
`with identical arguments. The duplicate call was skipped. Review the previous ` +
|
|
56
116
|
`result, change the arguments, try another tool, or finish the task.`;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* BahulamStreamClient — SSE consumer for Bahulam backend.
|
|
3
3
|
*
|
|
4
4
|
* Replaces OCC's agent-loop.mjs. Instead of calling the LLM API directly,
|
|
5
|
-
* this client POSTs to the
|
|
5
|
+
* this client POSTs to the Bahulam backend, parses the SSE stream, intercepts
|
|
6
6
|
* tool_request/tool_call events (executes locally, POSTs callback), and
|
|
7
7
|
* yields all other events to the caller for rendering.
|
|
8
8
|
*
|
|
@@ -117,10 +117,10 @@ function isOfflineLikelyError(err) {
|
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
export class
|
|
120
|
+
export class BahulamStreamClient {
|
|
121
121
|
/**
|
|
122
122
|
* @param {Object} opts
|
|
123
|
-
* @param {string} opts.baseUrl -
|
|
123
|
+
* @param {string} opts.baseUrl - Bahulam backend URL (ignored when mode='bundled')
|
|
124
124
|
* @param {string} opts.token - CLI auth token
|
|
125
125
|
* @param {Object} opts.toolExecutor - { execute(name, args) }
|
|
126
126
|
* @param {boolean} [opts.verbose=false]
|
|
@@ -820,7 +820,7 @@ export class TarangStreamClient {
|
|
|
820
820
|
tool,
|
|
821
821
|
args || {},
|
|
822
822
|
true,
|
|
823
|
-
{ risk, reason },
|
|
823
|
+
{ risk, reason, tool_id, call_id: tool_id, request_id: tool_id },
|
|
824
824
|
);
|
|
825
825
|
|
|
826
826
|
// Map ApprovalManager decision to framework scope
|
|
@@ -930,9 +930,10 @@ export class TarangStreamClient {
|
|
|
930
930
|
}
|
|
931
931
|
|
|
932
932
|
/**
|
|
933
|
-
* Submit a live-steering follow-up on the current running task
|
|
934
|
-
* Unlike resume(), this does NOT pause/unpause — the text
|
|
935
|
-
* delivered at the next tool boundary
|
|
933
|
+
* Submit a live-steering user follow-up on the current running task
|
|
934
|
+
* (PRD-081 §5.2). Unlike resume(), this does NOT pause/unpause — the text
|
|
935
|
+
* is queued and delivered at the next tool boundary as a high-priority user
|
|
936
|
+
* intervention, never as a tool call.
|
|
936
937
|
*
|
|
937
938
|
* Returns a status object; callers should NOT swallow errors:
|
|
938
939
|
* { status: 'accepted', interventionId } — queued on backend, SSE ack forthcoming
|
|
@@ -946,6 +947,7 @@ export class TarangStreamClient {
|
|
|
946
947
|
* @param {string} [opts.idempotencyKey] Optional client-generated id.
|
|
947
948
|
* Auto-generated when omitted; pass the same key
|
|
948
949
|
* for retries to stay idempotent.
|
|
950
|
+
* @param {string} [opts.priority] User-message priority metadata.
|
|
949
951
|
*/
|
|
950
952
|
async sendIntervention(instruction, opts = {}) {
|
|
951
953
|
if (!this.currentTaskId) {
|
|
@@ -967,6 +969,9 @@ export class TarangStreamClient {
|
|
|
967
969
|
body: JSON.stringify({
|
|
968
970
|
instruction: text,
|
|
969
971
|
intervention_id: interventionId,
|
|
972
|
+
role: 'user',
|
|
973
|
+
message_type: 'user_intervention',
|
|
974
|
+
priority: opts.priority || 'high',
|
|
970
975
|
}),
|
|
971
976
|
},
|
|
972
977
|
);
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import fs from 'fs';
|
|
11
11
|
import path from 'path';
|
|
12
12
|
import os from 'os';
|
|
13
|
-
import {
|
|
13
|
+
import { loadBahulamMemory } from '../config/memory-loader.mjs';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Load all CLAUDE.md files and merge them in order.
|
|
@@ -89,7 +89,7 @@ export function buildSystemPrompt({ cwd, tools, override, addDirs } = {}) {
|
|
|
89
89
|
parts.push(f.content);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
for (const f of
|
|
92
|
+
for (const f of loadBahulamMemory({ cwd })) {
|
|
93
93
|
parts.push(f.content);
|
|
94
94
|
}
|
|
95
95
|
|