@best-agent/cli 0.0.2-beta.7 → 0.0.2-beta.9

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.
Files changed (70) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -181
  3. package/dist/launcher.js +32 -0
  4. package/package.json +15 -27
  5. package/dist/best-agent-native-bridge.d.ts +0 -389
  6. package/dist/best-agent-native-bridge.js +0 -4645
  7. package/dist/cli-storage.d.ts +0 -5
  8. package/dist/cli-storage.js +0 -7
  9. package/dist/dimsdk/ask-user.d.ts +0 -21
  10. package/dist/dimsdk/ask-user.js +0 -131
  11. package/dist/dimsdk/cli/version.d.ts +0 -6
  12. package/dist/dimsdk/cli/version.js +0 -36
  13. package/dist/dimsdk/compat/archships/dim-agent/runtime-host.d.ts +0 -49
  14. package/dist/dimsdk/compat/archships/dim-agent/runtime-host.js +0 -215
  15. package/dist/dimsdk/compat/runtime-host.d.ts +0 -2
  16. package/dist/dimsdk/compat/runtime-host.js +0 -2
  17. package/dist/dimsdk/core/debug-log.d.ts +0 -8
  18. package/dist/dimsdk/core/debug-log.js +0 -100
  19. package/dist/dimsdk/core/env.d.ts +0 -26
  20. package/dist/dimsdk/core/env.js +0 -130
  21. package/dist/dimsdk/core/markdown/sanitize.d.ts +0 -2
  22. package/dist/dimsdk/core/markdown/sanitize.js +0 -43
  23. package/dist/dimsdk/core/markdown/wrap.d.ts +0 -9
  24. package/dist/dimsdk/core/markdown/wrap.js +0 -139
  25. package/dist/dimsdk/core/markdown.d.ts +0 -18
  26. package/dist/dimsdk/core/markdown.js +0 -62
  27. package/dist/dimsdk/core/model.d.ts +0 -273
  28. package/dist/dimsdk/core/model.js +0 -16
  29. package/dist/dimsdk/core/observability/perf-log.d.ts +0 -18
  30. package/dist/dimsdk/core/observability/perf-log.js +0 -236
  31. package/dist/dimsdk/core/store/agent-event-mappers.d.ts +0 -26
  32. package/dist/dimsdk/core/store/agent-event-mappers.js +0 -109
  33. package/dist/dimsdk/core/store/message-mutations.d.ts +0 -105
  34. package/dist/dimsdk/core/store/message-mutations.js +0 -1528
  35. package/dist/dimsdk/core/store/semantic-readers.d.ts +0 -2
  36. package/dist/dimsdk/core/store/semantic-readers.js +0 -4
  37. package/dist/dimsdk/core/store/transcript-projector.d.ts +0 -164
  38. package/dist/dimsdk/core/store/transcript-projector.js +0 -580
  39. package/dist/dimsdk/core/tool-metadata.d.ts +0 -12
  40. package/dist/dimsdk/core/tool-metadata.js +0 -70
  41. package/dist/dimsdk/core/transcript-part-id.d.ts +0 -6
  42. package/dist/dimsdk/core/transcript-part-id.js +0 -22
  43. package/dist/dimsdk/i18n/index.d.ts +0 -18
  44. package/dist/dimsdk/i18n/index.js +0 -141
  45. package/dist/dimsdk/i18n/locales/en.d.ts +0 -988
  46. package/dist/dimsdk/i18n/locales/en.js +0 -987
  47. package/dist/dimsdk/i18n/locales/index.d.ts +0 -1976
  48. package/dist/dimsdk/i18n/locales/index.js +0 -8
  49. package/dist/dimsdk/i18n/locales/zh-CN.d.ts +0 -988
  50. package/dist/dimsdk/i18n/locales/zh-CN.js +0 -987
  51. package/dist/dimsdk/i18n/types.d.ts +0 -13
  52. package/dist/dimsdk/i18n/types.js +0 -2
  53. package/dist/dimsdk/shared/value-normalizers.d.ts +0 -7
  54. package/dist/dimsdk/shared/value-normalizers.js +0 -48
  55. package/dist/dimsdk-tui.bundle-size.json +0 -169
  56. package/dist/dimsdk-tui.bundle.js +0 -330756
  57. package/dist/goatchain-adapter.d.ts +0 -41
  58. package/dist/goatchain-adapter.js +0 -499
  59. package/dist/index.d.ts +0 -3
  60. package/dist/index.js +0 -1405
  61. package/dist/native-runtime-bridge.d.ts +0 -387
  62. package/dist/native-runtime-bridge.js +0 -4624
  63. package/dist/provider-config-env.d.ts +0 -7
  64. package/dist/provider-config-env.js +0 -286
  65. package/dist/provider-model-limit-index.generated.d.ts +0 -3
  66. package/dist/provider-model-limit-index.generated.js +0 -7818
  67. package/dist/provider-model-limits.d.ts +0 -8
  68. package/dist/provider-model-limits.js +0 -43
  69. package/dist/runtime.d.ts +0 -47
  70. package/dist/runtime.js +0 -516
@@ -1,130 +0,0 @@
1
- export const DIMCODE_ENV_PREFIX = "DIMCODE_";
2
- function parseBool(value) {
3
- const s = value.toLowerCase();
4
- if (!s)
5
- return undefined;
6
- if (s === "1" || s === "true" || s === "yes" || s === "on")
7
- return true;
8
- if (s === "0" || s === "false" || s === "no" || s === "off")
9
- return false;
10
- return undefined;
11
- }
12
- function parseIntValue(value) {
13
- if (!value)
14
- return undefined;
15
- const n = Number.parseInt(value, 10);
16
- return Number.isFinite(n) ? n : undefined;
17
- }
18
- function parseFloatValue(value) {
19
- if (!value)
20
- return undefined;
21
- const n = Number.parseFloat(value);
22
- return Number.isFinite(n) ? n : undefined;
23
- }
24
- function runtimeGlobals() {
25
- return globalThis;
26
- }
27
- export function readProcessEnv() {
28
- return runtimeGlobals().process?.env ?? {};
29
- }
30
- export function resolveEnv(primary, fallback) {
31
- return { ...fallback, ...primary };
32
- }
33
- export function prefixedEnvKeys(name) {
34
- return [`${DIMCODE_ENV_PREFIX}${name}`];
35
- }
36
- export function createEnvReader(env, fallback) {
37
- const merged = resolveEnv(env, fallback);
38
- const strAny = (keys) => {
39
- for (const key of keys) {
40
- const raw = String(merged?.[key] ?? "").trim();
41
- if (raw)
42
- return raw;
43
- }
44
- return "";
45
- };
46
- const str = (key, ...aliases) => {
47
- const raw = String(merged?.[key] ?? "").trim();
48
- if (raw)
49
- return raw;
50
- if (aliases.length)
51
- return strAny(aliases);
52
- return "";
53
- };
54
- const boolAny = (keys) => {
55
- const raw = strAny(keys);
56
- return parseBool(raw);
57
- };
58
- const bool = (key, ...aliases) => {
59
- const raw = str(key, ...aliases);
60
- return parseBool(raw);
61
- };
62
- const intAny = (keys) => {
63
- const raw = strAny(keys);
64
- return parseIntValue(raw);
65
- };
66
- const int = (key, ...aliases) => {
67
- const raw = str(key, ...aliases);
68
- return parseIntValue(raw);
69
- };
70
- const floatAny = (keys) => {
71
- const raw = strAny(keys);
72
- return parseFloatValue(raw);
73
- };
74
- const float = (key, ...aliases) => {
75
- const raw = str(key, ...aliases);
76
- return parseFloatValue(raw);
77
- };
78
- const prefixedStr = (name, ...aliases) => {
79
- return strAny([...prefixedEnvKeys(name), ...aliases]);
80
- };
81
- const prefixedBool = (name, ...aliases) => {
82
- return boolAny([...prefixedEnvKeys(name), ...aliases]);
83
- };
84
- const prefixedInt = (name, ...aliases) => {
85
- return intAny([...prefixedEnvKeys(name), ...aliases]);
86
- };
87
- const prefixedFloat = (name, ...aliases) => {
88
- return floatAny([...prefixedEnvKeys(name), ...aliases]);
89
- };
90
- return {
91
- env: merged,
92
- str,
93
- strAny,
94
- bool,
95
- boolAny,
96
- int,
97
- intAny,
98
- float,
99
- floatAny,
100
- prefixedStr,
101
- prefixedBool,
102
- prefixedInt,
103
- prefixedFloat,
104
- };
105
- }
106
- export function readPrefixedEnv(env, name) {
107
- const [primary] = prefixedEnvKeys(name);
108
- const source = env ?? readProcessEnv();
109
- return String(source?.[primary] ?? "").trim();
110
- }
111
- export function readPrefixedEnvFlag(env, name) {
112
- return readPrefixedEnv(env, name).toLowerCase();
113
- }
114
- export function setPrefixedEnvValue(env, name, value) {
115
- const [primary] = prefixedEnvKeys(name);
116
- const raw = String(value ?? "").trim();
117
- if (!raw) {
118
- delete env[primary];
119
- return;
120
- }
121
- env[primary] = raw;
122
- }
123
- export function ensurePrefixedEnvValue(env, name, fallback) {
124
- const [primary] = prefixedEnvKeys(name);
125
- const value = String(env[primary] ?? fallback ?? "").trim();
126
- if (!env[primary] && value)
127
- env[primary] = value;
128
- return value;
129
- }
130
- //# sourceMappingURL=env.js.map
@@ -1,2 +0,0 @@
1
- export declare function sanitizeMarkdownText(s: string): string;
2
- //# sourceMappingURL=sanitize.d.ts.map
@@ -1,43 +0,0 @@
1
- function stripAnsi(s) {
2
- const ESC = '\u001B';
3
- const out = [];
4
- for (let i = 0; i < s.length; i++) {
5
- if (s[i] !== ESC || s[i + 1] !== '[') {
6
- out.push(s[i]);
7
- continue;
8
- }
9
- let j = i + 2;
10
- while (j < s.length) {
11
- const c = s.charCodeAt(j);
12
- if ((c >= 48 && c <= 57) || c === 59) {
13
- j++;
14
- continue;
15
- }
16
- break;
17
- }
18
- if (j < s.length && s[j] === 'm') {
19
- i = j;
20
- continue;
21
- }
22
- out.push(s[i]);
23
- }
24
- return out.join('');
25
- }
26
- export function sanitizeMarkdownText(s) {
27
- s = stripAnsi(s);
28
- const out = [];
29
- for (let i = 0; i < s.length;) {
30
- const cp = s.codePointAt(i);
31
- const ch = cp > 0xFFFF ? String.fromCodePoint(cp) : s[i];
32
- // Security: Strip ASCII control chars (except newline and tab) and C1 control chars (U+0080-U+009F)
33
- // This prevents ANSI escape sequences, cursor movements, and other control sequences
34
- if (!((cp <= 0x1F && cp !== 0x0A && cp !== 0x09)
35
- || cp === 0x7F
36
- || (cp >= 0x80 && cp <= 0x9F))) {
37
- out.push(ch);
38
- }
39
- i += cp > 0xFFFF ? 2 : 1;
40
- }
41
- return out.join('');
42
- }
43
- //# sourceMappingURL=sanitize.js.map
@@ -1,9 +0,0 @@
1
- export declare function textCellWidth(text: string): number;
2
- export declare function takeByCells(text: string, maxCells: number): {
3
- chunk: string;
4
- rest: string;
5
- };
6
- export declare function sliceByCells(text: string, maxCells: number): string;
7
- export declare function padEndByCells(text: string, width: number): string;
8
- export declare function wrapLineByCells(text: string, width: number): string[];
9
- //# sourceMappingURL=wrap.d.ts.map
@@ -1,139 +0,0 @@
1
- const fullWidthRanges = [
2
- [0x1100, 0x115F],
3
- [0x2329, 0x232A],
4
- [0x2E80, 0xA4CF],
5
- [0xAC00, 0xD7A3],
6
- [0xF900, 0xFAFF],
7
- [0xFE10, 0xFE19],
8
- [0xFE30, 0xFE6F],
9
- [0xFF00, 0xFF60],
10
- [0xFFE0, 0xFFE6],
11
- ];
12
- function isFullWidthCodePoint(codePoint) {
13
- // Quick reject: below first or above last full-width range
14
- if (codePoint < 0x1100 || codePoint > 0xFFE6)
15
- return false;
16
- // Ranges are sorted — exit as soon as we pass the candidate
17
- for (const [start, end] of fullWidthRanges) {
18
- if (codePoint < start)
19
- return false;
20
- if (codePoint <= end)
21
- return true;
22
- }
23
- return false;
24
- }
25
- function isEmojiLike(codePoint) {
26
- return ((codePoint >= 0x1F300 && codePoint <= 0x1FAFF)
27
- || (codePoint >= 0x1F1E6 && codePoint <= 0x1F1FF));
28
- }
29
- const extendedPictographicRe = /\p{Extended_Pictographic}/u;
30
- const emojiPresentationRe = /\p{Emoji_Presentation}/u;
31
- const emojiRe = /\p{Emoji}/u;
32
- function charCellWidth(text) {
33
- if (!text)
34
- return 1;
35
- // Fast path: single BMP character below all full-width / emoji ranges.
36
- if (text.length === 1) {
37
- const code = text.charCodeAt(0);
38
- if (code < 0x1100)
39
- return 1;
40
- }
41
- const codePoint = text.codePointAt(0);
42
- if (codePoint == null)
43
- return 1;
44
- const hasVs16 = text.includes('\uFE0F');
45
- if (isFullWidthCodePoint(codePoint) || isEmojiLike(codePoint))
46
- return 2;
47
- if (emojiPresentationRe?.test(text))
48
- return 2;
49
- if (text.includes('\u20E3'))
50
- return 2;
51
- if (hasVs16 && emojiRe?.test(text))
52
- return 2;
53
- if (extendedPictographicRe?.test(text))
54
- return codePoint <= 0xFFFF ? (hasVs16 ? 2 : 1) : 2;
55
- return 1;
56
- }
57
- let graphemeSegmenter = null;
58
- try {
59
- graphemeSegmenter
60
- = typeof Intl !== 'undefined' && 'Segmenter' in Intl
61
- ? new Intl.Segmenter(undefined, { granularity: 'grapheme' })
62
- : null;
63
- }
64
- catch {
65
- graphemeSegmenter = null;
66
- }
67
- function forEachGraphemeWithIndex(text, cb) {
68
- if (!text)
69
- return;
70
- if (graphemeSegmenter) {
71
- for (const part of graphemeSegmenter.segment(text))
72
- cb(part);
73
- return;
74
- }
75
- // Fallback: code point iteration with best-effort indices.
76
- let i = 0;
77
- while (i < text.length) {
78
- const cp = text.codePointAt(i) ?? 0;
79
- const ch = String.fromCodePoint(cp);
80
- cb({ segment: ch, index: i });
81
- i += ch.length;
82
- }
83
- }
84
- export function textCellWidth(text) {
85
- let cells = 0;
86
- forEachGraphemeWithIndex(text, (g) => {
87
- cells += charCellWidth(g.segment);
88
- });
89
- return cells;
90
- }
91
- export function takeByCells(text, maxCells) {
92
- maxCells = Math.max(0, Math.floor(maxCells));
93
- if (maxCells <= 0)
94
- return { chunk: '', rest: text };
95
- let cells = 0;
96
- let end = 0;
97
- const graphemes = [];
98
- forEachGraphemeWithIndex(text, (g) => {
99
- graphemes.push({ segment: g.segment, index: g.index });
100
- });
101
- for (let gi = 0; gi < graphemes.length; gi++) {
102
- const { segment, index } = graphemes[gi];
103
- const nextIndex = index + segment.length;
104
- const w = charCellWidth(segment);
105
- if (cells + w > maxCells)
106
- break;
107
- cells += w;
108
- end = nextIndex;
109
- if (cells >= maxCells)
110
- break;
111
- }
112
- return { chunk: text.slice(0, end), rest: text.slice(end) };
113
- }
114
- export function sliceByCells(text, maxCells) {
115
- return takeByCells(text, maxCells).chunk;
116
- }
117
- export function padEndByCells(text, width) {
118
- width = Math.max(0, Math.floor(width));
119
- const cells = textCellWidth(text);
120
- if (cells >= width)
121
- return sliceByCells(text, width);
122
- return `${text}${' '.repeat(width - cells)}`;
123
- }
124
- export function wrapLineByCells(text, width) {
125
- width = Math.max(1, Math.floor(width));
126
- if (!text)
127
- return [''];
128
- const out = [];
129
- let remaining = text;
130
- while (true) {
131
- const { chunk, rest } = takeByCells(remaining, width);
132
- out.push(chunk);
133
- if (!rest)
134
- break;
135
- remaining = rest;
136
- }
137
- return out;
138
- }
139
- //# sourceMappingURL=wrap.js.map
@@ -1,18 +0,0 @@
1
- export type FencedMarkdownBlock = Readonly<{
2
- type: "text";
3
- text: string;
4
- }> | Readonly<{
5
- type: "code";
6
- language: string;
7
- code: string;
8
- closed: boolean;
9
- }>;
10
- /**
11
- * Split a markdown string into alternating text/code blocks for triple-backtick fences.
12
- * Keeps the original newline structure (excluding the fence marker lines themselves).
13
- *
14
- * Note: For streaming markdown, the last code block may be `closed: false` if the closing
15
- * fence hasn't arrived yet.
16
- */
17
- export declare function splitMarkdownByFencedCodeBlocks(markdown: string): FencedMarkdownBlock[];
18
- //# sourceMappingURL=markdown.d.ts.map
@@ -1,62 +0,0 @@
1
- /**
2
- * Split a markdown string into alternating text/code blocks for triple-backtick fences.
3
- * Keeps the original newline structure (excluding the fence marker lines themselves).
4
- *
5
- * Note: For streaming markdown, the last code block may be `closed: false` if the closing
6
- * fence hasn't arrived yet.
7
- */
8
- export function splitMarkdownByFencedCodeBlocks(markdown) {
9
- const raw = String(markdown ?? "").replace(/\r/g, "");
10
- if (!raw)
11
- return [{ type: "text", text: "" }];
12
- const lines = raw.split("\n");
13
- const out = [];
14
- let inCode = false;
15
- let codeLang = "";
16
- let textBuf = [];
17
- let codeBuf = [];
18
- const flushText = () => {
19
- if (textBuf.length === 0)
20
- return;
21
- out.push({ type: "text", text: textBuf.join("\n") });
22
- textBuf = [];
23
- };
24
- const flushCode = (closed) => {
25
- out.push({
26
- type: "code",
27
- language: codeLang,
28
- code: codeBuf.join("\n"),
29
- closed,
30
- });
31
- codeBuf = [];
32
- codeLang = "";
33
- };
34
- for (const line of lines) {
35
- if (line.startsWith("```")) {
36
- if (!inCode) {
37
- flushText();
38
- inCode = true;
39
- codeLang = line.slice(3).trim();
40
- continue;
41
- }
42
- inCode = false;
43
- flushCode(true);
44
- continue;
45
- }
46
- if (inCode) {
47
- codeBuf.push(line);
48
- }
49
- else {
50
- textBuf.push(line);
51
- }
52
- }
53
- if (inCode) {
54
- flushText();
55
- flushCode(false);
56
- }
57
- else {
58
- flushText();
59
- }
60
- return out.length > 0 ? out : [{ type: "text", text: "" }];
61
- }
62
- //# sourceMappingURL=markdown.js.map
@@ -1,273 +0,0 @@
1
- export declare const MessageRoles: readonly ["user", "assistant", "tool"];
2
- export type MessageRole = (typeof MessageRoles)[number];
3
- export type ToolName = string;
4
- export declare const ToolPermissions: readonly ["pass", "require_action"];
5
- export type ToolPermission = (typeof ToolPermissions)[number];
6
- export type ToolCallStreamMeta = Readonly<{
7
- argsTextFullLen?: number;
8
- argsTextTailLimit?: number;
9
- }>;
10
- export type MarkdownStreamMeta = Readonly<{
11
- appendSeq?: number;
12
- chunks?: string[];
13
- fullLen?: number;
14
- lastAppendDelta?: string;
15
- settled?: boolean;
16
- tailLimit?: number;
17
- }>;
18
- export type ToolCall = Readonly<{
19
- id: string;
20
- name: ToolName;
21
- subagentId?: string;
22
- subagentTurnId?: string;
23
- /**
24
- * Optional timestamp (ms since epoch) for when the tool call first appeared.
25
- * Used for UI effects like staggered status blinking.
26
- */
27
- startedAtMs?: number;
28
- arguments: Record<string, unknown>;
29
- thoughtSignature?: string;
30
- /**
31
- * Optional raw (streaming) arguments text, used to represent `tool_call_delta`.
32
- * When present, UI should prefer this for preview rendering.
33
- */
34
- argumentsText?: string;
35
- streamMeta?: ToolCallStreamMeta;
36
- /**
37
- * Optional precomputed diff preview metadata for tools that emit old/new strings (e.g. Edit).
38
- * This is populated asynchronously (optional dependency: shiki).
39
- */
40
- diffPreview?: DiffPreview;
41
- /**
42
- * Optional precomputed preview metadata for Read tool output (file content).
43
- * This is populated asynchronously (optional dependency: shiki).
44
- */
45
- readPreview?: ReadPreview;
46
- /**
47
- * Optional line count hint for Write tool content (streamed from SDK).
48
- */
49
- linesWritten?: number;
50
- }>;
51
- export type ShikiToken = Readonly<{
52
- content: string;
53
- color?: string;
54
- fontStyle?: number;
55
- }>;
56
- export type DiffPreviewLine = Readonly<{
57
- type: "context" | "added" | "removed";
58
- content: string;
59
- tokens: readonly ShikiToken[] | null;
60
- }>;
61
- export type DiffPreview = Readonly<{
62
- kind: "shiki";
63
- language: string;
64
- theme: string;
65
- oldString: string;
66
- newString: string;
67
- lines: readonly DiffPreviewLine[];
68
- }>;
69
- export type ReadPreviewLine = Readonly<{
70
- gutter: string;
71
- content: string;
72
- tokens: readonly ShikiToken[] | null;
73
- }>;
74
- export type MarkdownCodeBlockPreviewLine = Readonly<{
75
- content: string;
76
- tokens: readonly ShikiToken[] | null;
77
- }>;
78
- export type MarkdownCodeBlockPreview = Readonly<{
79
- kind: "shiki";
80
- language: string;
81
- theme: string;
82
- /**
83
- * Hash of the normalized code content (language-aware).
84
- */
85
- hash: string;
86
- totalLines: number;
87
- lines: readonly MarkdownCodeBlockPreviewLine[];
88
- }> | Readonly<{
89
- kind: "skipped";
90
- hash: string;
91
- totalLines: number;
92
- reason: "too_large" | "shiki_unavailable";
93
- }>;
94
- export type ReadPreview = Readonly<{
95
- kind: "shiki";
96
- mode: "collapsed" | "expanded";
97
- language: string;
98
- theme: string;
99
- /**
100
- * Hash of the normalized (gutter-preserving) output; used for stale checks.
101
- */
102
- hash: string;
103
- /**
104
- * Total number of normalized output lines.
105
- */
106
- totalLines: number;
107
- lines: readonly ReadPreviewLine[];
108
- }> | Readonly<{
109
- kind: "skipped";
110
- mode: "collapsed" | "expanded";
111
- hash: string;
112
- totalLines: number;
113
- reason: "too_large" | "shiki_unavailable";
114
- }>;
115
- /**
116
- * Tool approval behavior for the TUI.
117
- *
118
- * - `always`: auto-approve approval requests with reusable scopes.
119
- * - `auto`: auto-approve non-high-risk approvals.
120
- * - `normal`: auto-approve read-only tools; prompt for write/execute.
121
- * - `strict`: prompt for every tool call.
122
- */
123
- export type ToolApprovalsMode = "always" | "auto" | "normal" | "strict";
124
- export type ApprovalScope = "once" | "session" | "thread" | "workspace";
125
- export type ApprovalRequest = Readonly<{
126
- id: string;
127
- subagentId?: string;
128
- toolCallId: string;
129
- tool: ToolName;
130
- permission: ToolPermission;
131
- reason: string;
132
- args?: Record<string, unknown>;
133
- availableScopes?: readonly ApprovalScope[];
134
- source?: "local" | "runtime";
135
- riskLevel?: "safe" | "low" | "medium" | "high" | "critical" | (string & {});
136
- status: "pending" | "approved" | "denied";
137
- }>;
138
- export type ToolResult = Readonly<{
139
- toolCallId: string;
140
- output: string;
141
- errorCode?: string;
142
- failureKind?: string;
143
- subagentId?: string;
144
- /**
145
- * Optional ANSI-colored preview of `output` for UI rendering.
146
- * Should contain only SGR sequences (no cursor movement).
147
- */
148
- outputAnsi?: string;
149
- status: "success" | "error";
150
- /**
151
- * Optional structured content from the tool (e.g. WebSearch results/context payload).
152
- */
153
- structuredContent?: Record<string, unknown>;
154
- }>;
155
- export type ChecklistItem = Readonly<{
156
- id: string;
157
- text: string;
158
- done: boolean;
159
- /**
160
- * Status as reported by tool outputs (e.g. TodoWrite/TodoPlan).
161
- * Older persisted sessions may omit this field; renderers should fall back to `done`.
162
- */
163
- status?: "completed" | "in_progress" | "pending" | (string & {});
164
- }>;
165
- export declare const AssistantContentPartTypes: readonly ["status", "thinking", "markdown", "tool_call", "tool_output", "tool_result", "approve", "todo", "plan", "llm_meta", "info"];
166
- export type AssistantContentPartType = (typeof AssistantContentPartTypes)[number];
167
- export type ToolOutputStreamMeta = Readonly<{
168
- fullLen?: number;
169
- lineBreaks?: number;
170
- tailLines?: readonly string[];
171
- tailLimit?: number;
172
- tailLinesLimit?: number;
173
- }>;
174
- export type LlmMetaChangedFile = Readonly<{
175
- path: string;
176
- added?: number;
177
- removed?: number;
178
- }>;
179
- export type AssistantContentPart = Readonly<{
180
- type: "status";
181
- text: string;
182
- }> | Readonly<{
183
- type: "thinking";
184
- partId: string;
185
- title: string;
186
- collapsed: boolean;
187
- content: string;
188
- }> | Readonly<{
189
- type: "markdown";
190
- markdown: string;
191
- codeBlocks?: readonly MarkdownCodeBlockPreview[];
192
- streamMeta?: MarkdownStreamMeta;
193
- }> | Readonly<{
194
- type: "tool_call";
195
- call: ToolCall;
196
- }> | Readonly<{
197
- type: "tool_output";
198
- toolCallId: string;
199
- toolName: ToolName;
200
- output: string;
201
- subagentId?: string;
202
- streamMeta?: ToolOutputStreamMeta;
203
- }> | Readonly<{
204
- type: "tool_result";
205
- result: ToolResult;
206
- }> | Readonly<{
207
- type: "approve";
208
- request: ApprovalRequest;
209
- }> | Readonly<{
210
- type: "todo";
211
- partId: string;
212
- title: string;
213
- collapsed: boolean;
214
- items: ChecklistItem[];
215
- toolCallId?: string;
216
- }> | Readonly<{
217
- type: "plan";
218
- partId: string;
219
- title: string;
220
- collapsed: boolean;
221
- items: ChecklistItem[];
222
- toolCallId?: string;
223
- }> | Readonly<{
224
- type: "llm_meta";
225
- durationMs: number;
226
- modelId?: string;
227
- toolCalls?: number;
228
- tokensUsed?: number;
229
- changedFiles?: readonly string[];
230
- changedFileDetails?: readonly LlmMetaChangedFile[];
231
- }> | Readonly<{
232
- type: "info";
233
- text: string;
234
- }>;
235
- export type Message = Readonly<{
236
- id: string;
237
- role: "user";
238
- content: string;
239
- focusFiles?: readonly string[];
240
- createdAtMs?: number;
241
- modelId?: string;
242
- metadata?: Record<string, unknown>;
243
- }> | Readonly<{
244
- id: string;
245
- role: "assistant";
246
- parts: AssistantContentPart[];
247
- createdAtMs?: number;
248
- modelId?: string;
249
- }> | Readonly<{
250
- id: string;
251
- role: "tool";
252
- result: ToolResult;
253
- createdAtMs?: number;
254
- }>;
255
- export type RunConfig = Readonly<{
256
- model: string;
257
- context_window: number;
258
- temperature?: number;
259
- interleaved_thinking?: boolean;
260
- }>;
261
- export type TokenUsage = Readonly<{
262
- prompt_tokens: number;
263
- completion_tokens: number;
264
- total_tokens: number;
265
- budget: number;
266
- }>;
267
- export type DimSdkContext = Readonly<{
268
- system: string;
269
- cwd: string;
270
- env: Readonly<Record<string, string | undefined>>;
271
- focusFiles?: readonly string[];
272
- }>;
273
- //# sourceMappingURL=model.d.ts.map
@@ -1,16 +0,0 @@
1
- export const MessageRoles = ["user", "assistant", "tool"];
2
- export const ToolPermissions = ["pass", "require_action"];
3
- export const AssistantContentPartTypes = [
4
- "status",
5
- "thinking",
6
- "markdown",
7
- "tool_call",
8
- "tool_output",
9
- "tool_result",
10
- "approve",
11
- "todo",
12
- "plan",
13
- "llm_meta",
14
- "info",
15
- ];
16
- //# sourceMappingURL=model.js.map