@bubblebrain-ai/bubble 0.0.46 → 0.0.48
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/agent/child-runner.js +11 -0
- package/dist/agent/internal-reminder-sanitizer.d.ts +7 -0
- package/dist/agent/internal-reminder-sanitizer.js +13 -0
- package/dist/agent/subagent/router.d.ts +65 -0
- package/dist/agent/subagent/router.js +198 -0
- package/dist/agent/subagent/runtime.d.ts +203 -0
- package/dist/agent/subagent/runtime.js +789 -0
- package/dist/agent/subagent-control.d.ts +5 -0
- package/dist/agent/subagent-store.d.ts +18 -2
- package/dist/agent/subagent-store.js +32 -1
- package/dist/agent/tool-intent.d.ts +10 -0
- package/dist/agent/tool-intent.js +18 -0
- package/dist/agent/tool-visibility.d.ts +10 -0
- package/dist/agent/tool-visibility.js +6 -0
- package/dist/agent/workflow/runs.d.ts +72 -0
- package/dist/agent/workflow/runs.js +157 -0
- package/dist/agent.d.ts +78 -96
- package/dist/agent.js +266 -1072
- package/dist/context/compact-llm.js +14 -5
- package/dist/context/compact.d.ts +9 -0
- package/dist/context/compact.js +36 -10
- package/dist/context/compaction-files.d.ts +44 -0
- package/dist/context/compaction-files.js +148 -0
- package/dist/context/llm-compactor.js +24 -5
- package/dist/feishu/agent-host/run-driver.js +3 -0
- package/dist/feishu/serve.js +13 -9
- package/dist/goal/tools.js +12 -3
- package/dist/main.js +24 -19
- package/dist/model-catalog.js +36 -2
- package/dist/model-config.d.ts +2 -0
- package/dist/model-data.generated.d.ts +16 -0
- package/dist/model-data.generated.js +275 -0
- package/dist/model-pricing.d.ts +11 -7
- package/dist/model-pricing.js +0 -0
- package/dist/oauth/grok.d.ts +1 -1
- package/dist/oauth/grok.js +5 -2
- package/dist/oauth/storage.d.ts +9 -2
- package/dist/oauth/storage.js +16 -9
- package/dist/orchestrator/default-hooks.d.ts +20 -0
- package/dist/orchestrator/default-hooks.js +47 -295
- package/dist/orchestrator/hooks.d.ts +6 -39
- package/dist/permission/mode.js +1 -1
- package/dist/prompt/reminders.d.ts +9 -35
- package/dist/prompt/reminders.js +30 -136
- package/dist/prompt/task-reminders.d.ts +0 -31
- package/dist/prompt/task-reminders.js +0 -87
- package/dist/provider-ai-sdk.d.ts +2 -0
- package/dist/provider-ai-sdk.js +1 -0
- package/dist/provider-anthropic.d.ts +2 -0
- package/dist/provider-anthropic.js +3 -1
- package/dist/provider-ark-responses.d.ts +2 -0
- package/dist/provider-ark-responses.js +1 -0
- package/dist/provider-grok.d.ts +26 -0
- package/dist/provider-grok.js +39 -0
- package/dist/provider-registry.d.ts +14 -1
- package/dist/provider-registry.js +131 -3
- package/dist/provider-transform.js +37 -1
- package/dist/provider.d.ts +7 -0
- package/dist/provider.js +13 -1
- package/dist/sdk/index.d.ts +152 -0
- package/dist/sdk/index.js +400 -0
- package/dist/session.js +9 -1
- package/dist/slash-commands/commands.js +33 -19
- package/dist/tools/exit-plan-mode.js +8 -0
- package/dist/tui/detect-theme.d.ts +1 -0
- package/dist/tui/detect-theme.js +11 -5
- package/dist/tui-ink/app.d.ts +2 -6
- package/dist/tui-ink/app.js +11 -18
- package/dist/tui-ink/display-history.d.ts +0 -2
- package/dist/tui-ink/display-history.js +0 -52
- package/dist/tui-ink/footer.js +2 -2
- package/dist/tui-ink/input-box.js +18 -6
- package/dist/tui-ink/message-list.js +62 -23
- package/dist/tui-ink/run.js +10 -5
- package/dist/tui-ink/sync-output.d.ts +17 -0
- package/dist/tui-ink/sync-output.js +35 -0
- package/dist/tui-ink/theme.d.ts +0 -1
- package/dist/tui-ink/theme.js +0 -2
- package/dist/tui-ink/trace-groups.js +1 -1
- package/dist/types.d.ts +21 -1
- package/package.json +16 -2
- package/dist/agent/discovery-barrier.d.ts +0 -21
- package/dist/agent/discovery-barrier.js +0 -173
- package/dist/agent/evidence-tracker.d.ts +0 -15
- package/dist/agent/evidence-tracker.js +0 -93
- package/dist/agent/execution-governor.d.ts +0 -36
- package/dist/agent/execution-governor.js +0 -218
- package/dist/agent/task-classifier.d.ts +0 -3
- package/dist/agent/task-classifier.js +0 -114
- package/dist/agent/task-size.d.ts +0 -9
- package/dist/agent/task-size.js +0 -33
- package/dist/agent/tool-arbiter.d.ts +0 -7
- package/dist/agent/tool-arbiter.js +0 -33
- package/dist/orchestrator/workflow.d.ts +0 -10
- package/dist/orchestrator/workflow.js +0 -22
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
const SECURITY_PATTERNS = [
|
|
2
|
-
/\bapi[\s_-]?key\b/i,
|
|
3
|
-
/\bsecret(s)?\b/i,
|
|
4
|
-
/\btoken(s)?\b/i,
|
|
5
|
-
/\bcredential(s)?\b/i,
|
|
6
|
-
/\bleak(ed|age)?\b/i,
|
|
7
|
-
/\bexpos(e|ed|ure)\b/i,
|
|
8
|
-
/\bstored?\b/i,
|
|
9
|
-
/\bwhere\b/i,
|
|
10
|
-
/\bconfig\b/i,
|
|
11
|
-
/\benv\b/i,
|
|
12
|
-
];
|
|
13
|
-
const SEARCH_PATTERNS = [
|
|
14
|
-
/\bfind\b/i,
|
|
15
|
-
/\bsearch\b/i,
|
|
16
|
-
/\blook for\b/i,
|
|
17
|
-
/\bwhere\b/i,
|
|
18
|
-
/\blocate\b/i,
|
|
19
|
-
/\btrace\b/i,
|
|
20
|
-
];
|
|
21
|
-
const REVIEW_PATTERNS = [
|
|
22
|
-
/\breview\b/i,
|
|
23
|
-
/\bcode review\b/i,
|
|
24
|
-
/帮我看看.*(代码|改动|diff)/i,
|
|
25
|
-
/看下.*(风险|问题|bug)/i,
|
|
26
|
-
];
|
|
27
|
-
const DEBUG_PATTERNS = [
|
|
28
|
-
/\bdebug\b/i,
|
|
29
|
-
/\bbug\b/i,
|
|
30
|
-
/\bfail(ing|ed|ure)?\b/i,
|
|
31
|
-
/\berror\b/i,
|
|
32
|
-
/\bregression\b/i,
|
|
33
|
-
/报错|失败|不对|有问题|修复|定位/i,
|
|
34
|
-
];
|
|
35
|
-
const IMPLEMENTATION_PATTERNS = [
|
|
36
|
-
/\bimplement\b/i,
|
|
37
|
-
/\bbuild\b/i,
|
|
38
|
-
/\badd\b/i,
|
|
39
|
-
/\bchange\b/i,
|
|
40
|
-
/\bupdate\b/i,
|
|
41
|
-
/\brefactor\b/i,
|
|
42
|
-
/实现|开发|改一下|加一个|调整|优化/i,
|
|
43
|
-
];
|
|
44
|
-
const EXPLANATION_PATTERNS = [
|
|
45
|
-
/\bexplain\b/i,
|
|
46
|
-
/\bhow does\b/i,
|
|
47
|
-
/\bwhat does\b/i,
|
|
48
|
-
/解释|讲讲|怎么看|在干嘛|如何运转/i,
|
|
49
|
-
];
|
|
50
|
-
const ORIENTATION_PATTERNS = [
|
|
51
|
-
/\bwhat is this project\b/i,
|
|
52
|
-
/\bwhat is this (repo|repository)\b/i,
|
|
53
|
-
/\borient/i,
|
|
54
|
-
/\boverview\b/i,
|
|
55
|
-
/\b(repo|repository|project) overview\b/i,
|
|
56
|
-
/这个项目.*(干嘛|做什么)|这项目.*(干嘛|做什么)|这个\s*repo.*(干嘛|做什么)|看下(这个|这)?项目|项目.*概览|快速了解.*项目/i,
|
|
57
|
-
];
|
|
58
|
-
const CONCRETE_ORIENTATION_EXCLUSIONS = [
|
|
59
|
-
/项目[中里内]\s*[,,]?\s*\S{2,}/i,
|
|
60
|
-
/帮我.*(实现|开发|改|加|调整|优化|修复)/i,
|
|
61
|
-
/(实现|开发|改一下|加一个|调整|优化|修复|支持|报错|失败|不对|有问题|bug|commit|push)/i,
|
|
62
|
-
/(?:\.[a-z][\w-]*|\b[A-Z]{2,}\b)/,
|
|
63
|
-
];
|
|
64
|
-
const PRODUCT_PATTERNS = [
|
|
65
|
-
/\bproduct\b/i,
|
|
66
|
-
/\bdesign\b/i,
|
|
67
|
-
/\bstrategy\b/i,
|
|
68
|
-
/\broadmap\b/i,
|
|
69
|
-
/产品|方案|设计|体验|取舍|方向/i,
|
|
70
|
-
];
|
|
71
|
-
export function classifyTask(input) {
|
|
72
|
-
const text = typeof input === "string"
|
|
73
|
-
? input
|
|
74
|
-
: input
|
|
75
|
-
.filter((part) => part.type === "text")
|
|
76
|
-
.map((part) => part.text)
|
|
77
|
-
.join("\n");
|
|
78
|
-
const securityHits = SECURITY_PATTERNS.filter((pattern) => pattern.test(text)).length;
|
|
79
|
-
if (securityHits >= 2) {
|
|
80
|
-
return "security_investigation";
|
|
81
|
-
}
|
|
82
|
-
if (REVIEW_PATTERNS.some((pattern) => pattern.test(text))) {
|
|
83
|
-
return "code_review";
|
|
84
|
-
}
|
|
85
|
-
if (DEBUG_PATTERNS.some((pattern) => pattern.test(text))) {
|
|
86
|
-
return "debugging";
|
|
87
|
-
}
|
|
88
|
-
if (IMPLEMENTATION_PATTERNS.some((pattern) => pattern.test(text))) {
|
|
89
|
-
return "implementation";
|
|
90
|
-
}
|
|
91
|
-
if (isLikelyRepoOrientation(text)) {
|
|
92
|
-
return "repo_orientation";
|
|
93
|
-
}
|
|
94
|
-
if (EXPLANATION_PATTERNS.some((pattern) => pattern.test(text))) {
|
|
95
|
-
return "code_explanation";
|
|
96
|
-
}
|
|
97
|
-
if (PRODUCT_PATTERNS.some((pattern) => pattern.test(text))) {
|
|
98
|
-
return "product_discussion";
|
|
99
|
-
}
|
|
100
|
-
if (SEARCH_PATTERNS.some((pattern) => pattern.test(text))) {
|
|
101
|
-
return "code_search";
|
|
102
|
-
}
|
|
103
|
-
return "general";
|
|
104
|
-
}
|
|
105
|
-
function isLikelyRepoOrientation(text) {
|
|
106
|
-
const normalized = text.trim().replace(/\s+/g, " ");
|
|
107
|
-
if (!ORIENTATION_PATTERNS.some((pattern) => pattern.test(normalized))) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
if (CONCRETE_ORIENTATION_EXCLUSIONS.some((pattern) => pattern.test(normalized))) {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
return normalized.length <= 80;
|
|
114
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ContentPart } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Coarse "is this a small / focused task" classifier. Used to inject a hint
|
|
4
|
-
* that suppresses the default exploration-first protocol when the user's
|
|
5
|
-
* request is clearly a one-shot create or single-file tweak. Counterpart to
|
|
6
|
-
* `task-classifier.ts` which categorizes by *kind*, not *size*.
|
|
7
|
-
*/
|
|
8
|
-
export type TaskSize = "small" | "normal";
|
|
9
|
-
export declare function classifyTaskSize(input: string | ContentPart[]): TaskSize;
|
package/dist/agent/task-size.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Two-part match: a "create" verb AND a "deliverable" noun in the same
|
|
2
|
-
// sentence is a strong signal of a focused, one-shot task.
|
|
3
|
-
const SMALL_TASK_VERBS = [
|
|
4
|
-
/\b(write|create|generate|make|draft|build|add)\b/i,
|
|
5
|
-
/帮我写|帮我创建|帮我生成|写(个|一个|一份)|新建一个|做(个|一个|一份)|生成(个|一个|一份)|搞(个|一个|一份)/i,
|
|
6
|
-
];
|
|
7
|
-
const SMALL_TASK_NOUNS = [
|
|
8
|
-
/\b(file|page|component|script|snippet|function|class|test|html|css|js|ts|tsx|jsx|md|markdown|hello world)\b/i,
|
|
9
|
-
/(文件|页面|组件|脚本|片段|函数|类|测试|html|css|介绍|文章|页|说明|示例|demo)/i,
|
|
10
|
-
];
|
|
11
|
-
function matchesSmallTaskPattern(text) {
|
|
12
|
-
return SMALL_TASK_VERBS.some((re) => re.test(text))
|
|
13
|
-
&& SMALL_TASK_NOUNS.some((re) => re.test(text));
|
|
14
|
-
}
|
|
15
|
-
const LARGE_TASK_NEGATIONS = [
|
|
16
|
-
/\b(refactor|rewrite|migrate|overhaul|integrate|architect|review the codebase|whole project|across the codebase)\b/i,
|
|
17
|
-
/多个|批量|全部|所有|整个项目|整个仓库|架构|重构|端到端|跨模块/i,
|
|
18
|
-
];
|
|
19
|
-
export function classifyTaskSize(input) {
|
|
20
|
-
const text = (typeof input === "string"
|
|
21
|
-
? input
|
|
22
|
-
: input
|
|
23
|
-
.filter((part) => part.type === "text")
|
|
24
|
-
.map((part) => part.text)
|
|
25
|
-
.join("\n")).trim();
|
|
26
|
-
if (!text)
|
|
27
|
-
return "normal";
|
|
28
|
-
// Up to ~120 chars with a small-task verb+noun match and no negation: small.
|
|
29
|
-
if (text.length <= 120 && matchesSmallTaskPattern(text)) {
|
|
30
|
-
return LARGE_TASK_NEGATIONS.some((re) => re.test(text)) ? "normal" : "small";
|
|
31
|
-
}
|
|
32
|
-
return "normal";
|
|
33
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ParsedToolCall } from "../types.js";
|
|
2
|
-
export interface ToolArbitration {
|
|
3
|
-
toolCall: ParsedToolCall;
|
|
4
|
-
note?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function arbitrateToolCall(toolCall: ParsedToolCall): ToolArbitration;
|
|
7
|
-
export declare function isSearchLikeToolCall(toolCall: ParsedToolCall): boolean;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { analyzeToolIntent, parseSearchBashCommand } from "./tool-intent.js";
|
|
2
|
-
export function arbitrateToolCall(toolCall) {
|
|
3
|
-
if (toolCall.name !== "bash") {
|
|
4
|
-
return { toolCall };
|
|
5
|
-
}
|
|
6
|
-
const command = typeof toolCall.parsedArgs.command === "string"
|
|
7
|
-
? toolCall.parsedArgs.command
|
|
8
|
-
: "";
|
|
9
|
-
const parsedSearch = parseSearchBashCommand(command);
|
|
10
|
-
if (!parsedSearch) {
|
|
11
|
-
return { toolCall };
|
|
12
|
-
}
|
|
13
|
-
return {
|
|
14
|
-
toolCall: {
|
|
15
|
-
...toolCall,
|
|
16
|
-
name: "grep",
|
|
17
|
-
parsedArgs: {
|
|
18
|
-
pattern: parsedSearch.pattern,
|
|
19
|
-
...(parsedSearch.path ? { path: parsedSearch.path } : {}),
|
|
20
|
-
...(parsedSearch.include ? { glob: parsedSearch.include } : {}),
|
|
21
|
-
},
|
|
22
|
-
arguments: JSON.stringify({
|
|
23
|
-
pattern: parsedSearch.pattern,
|
|
24
|
-
...(parsedSearch.path ? { path: parsedSearch.path } : {}),
|
|
25
|
-
...(parsedSearch.include ? { glob: parsedSearch.include } : {}),
|
|
26
|
-
}),
|
|
27
|
-
},
|
|
28
|
-
note: `Rewrote bash search to grep for structured execution: ${command}`,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export function isSearchLikeToolCall(toolCall) {
|
|
32
|
-
return analyzeToolIntent(toolCall).family === "search";
|
|
33
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { InvestigationCoverage } from "../agent/evidence-tracker.js";
|
|
2
|
-
export type WorkflowPhase = "investigate" | "correlate" | "conclude";
|
|
3
|
-
export declare function resolveWorkflowPhase(input: {
|
|
4
|
-
coreCoverageComplete: boolean;
|
|
5
|
-
searchFrozen: boolean;
|
|
6
|
-
}): WorkflowPhase;
|
|
7
|
-
export declare function formatCoverageSummary(coverage: InvestigationCoverage): {
|
|
8
|
-
covered: string[];
|
|
9
|
-
pending: string[];
|
|
10
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export function resolveWorkflowPhase(input) {
|
|
2
|
-
if (input.coreCoverageComplete) {
|
|
3
|
-
return "conclude";
|
|
4
|
-
}
|
|
5
|
-
if (input.searchFrozen) {
|
|
6
|
-
return "correlate";
|
|
7
|
-
}
|
|
8
|
-
return "investigate";
|
|
9
|
-
}
|
|
10
|
-
export function formatCoverageSummary(coverage) {
|
|
11
|
-
const items = [
|
|
12
|
-
{ label: "config load paths", done: coverage.configLoadPaths },
|
|
13
|
-
{ label: "environment variable reads", done: coverage.envReads },
|
|
14
|
-
{ label: "persistence paths", done: coverage.persistencePaths },
|
|
15
|
-
{ label: "exposure paths", done: coverage.exposurePaths },
|
|
16
|
-
{ label: "masking or redaction signals", done: coverage.maskingSignals },
|
|
17
|
-
];
|
|
18
|
-
return {
|
|
19
|
-
covered: items.filter((item) => item.done).map((item) => item.label),
|
|
20
|
-
pending: items.filter((item) => !item.done).map((item) => item.label),
|
|
21
|
-
};
|
|
22
|
-
}
|