@dirgha/code 1.7.6 → 1.7.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/CHANGELOG.md +52 -5
- package/CREDITS.md +46 -0
- package/LICENSE +101 -21
- package/README.md +15 -9
- package/dist_v2/cli/config.d.ts +1 -0
- package/dist_v2/cli/config.js.map +1 -1
- package/dist_v2/cli/main.js +9 -18
- package/dist_v2/cli/main.js.map +1 -1
- package/dist_v2/cli/slash/index.d.ts +2 -1
- package/dist_v2/cli/slash/index.js +3 -1
- package/dist_v2/cli/slash/index.js.map +1 -1
- package/dist_v2/cli/slash/update.d.ts +9 -0
- package/dist_v2/cli/slash/update.js +42 -0
- package/dist_v2/cli/slash/update.js.map +1 -0
- package/dist_v2/cli/slash.js +0 -6
- package/dist_v2/cli/slash.js.map +1 -1
- package/dist_v2/cli/subcommands/index.js +2 -0
- package/dist_v2/cli/subcommands/index.js.map +1 -1
- package/dist_v2/cli/subcommands/web.d.ts +13 -0
- package/dist_v2/cli/subcommands/web.js +61 -0
- package/dist_v2/cli/subcommands/web.js.map +1 -0
- package/dist_v2/intelligence/models-dev-sync.d.ts +39 -0
- package/dist_v2/intelligence/models-dev-sync.js +103 -0
- package/dist_v2/intelligence/models-dev-sync.js.map +1 -0
- package/dist_v2/kernel/agent-loop.d.ts +8 -38
- package/dist_v2/kernel/agent-loop.js +18 -57
- package/dist_v2/kernel/agent-loop.js.map +1 -1
- package/dist_v2/kernel/index.d.ts +0 -1
- package/dist_v2/kernel/index.js +0 -1
- package/dist_v2/kernel/index.js.map +1 -1
- package/dist_v2/kernel/message.d.ts +1 -17
- package/dist_v2/kernel/message.js +0 -26
- package/dist_v2/kernel/message.js.map +1 -1
- package/dist_v2/kernel/types.d.ts +0 -29
- package/dist_v2/skills/install-npm.d.ts +16 -0
- package/dist_v2/skills/install-npm.js +97 -0
- package/dist_v2/skills/install-npm.js.map +1 -0
- package/dist_v2/tools/browser.js +6 -3
- package/dist_v2/tools/browser.js.map +1 -1
- package/dist_v2/tools/index.d.ts +1 -3
- package/dist_v2/tools/index.js +1 -5
- package/dist_v2/tools/index.js.map +1 -1
- package/dist_v2/tui/ink/App.d.ts +3 -0
- package/dist_v2/tui/ink/App.js +85 -124
- package/dist_v2/tui/ink/App.js.map +1 -1
- package/dist_v2/tui/ink/components/SlashComplete.d.ts +1 -7
- package/dist_v2/tui/ink/components/SlashComplete.js +2 -9
- package/dist_v2/tui/ink/components/SlashComplete.js.map +1 -1
- package/dist_v2/tui/ink/index.js +4 -0
- package/dist_v2/tui/ink/index.js.map +1 -1
- package/dist_v2/web/cost.d.ts +35 -0
- package/dist_v2/web/cost.js +211 -0
- package/dist_v2/web/cost.js.map +1 -0
- package/dist_v2/web/ledger.d.ts +25 -0
- package/dist_v2/web/ledger.js +156 -0
- package/dist_v2/web/ledger.js.map +1 -0
- package/dist_v2/web/server.d.ts +30 -0
- package/dist_v2/web/server.js +199 -0
- package/dist_v2/web/server.js.map +1 -0
- package/package.json +33 -53
- package/dist_v2/kernel/queues.d.ts +0 -82
- package/dist_v2/kernel/queues.js +0 -105
- package/dist_v2/kernel/queues.js.map +0 -1
- package/dist_v2/providers/faux.d.ts +0 -99
- package/dist_v2/providers/faux.js +0 -153
- package/dist_v2/providers/faux.js.map +0 -1
- package/dist_v2/tools/webfetch.d.ts +0 -11
- package/dist_v2/tools/webfetch.js +0 -130
- package/dist_v2/tools/webfetch.js.map +0 -1
- package/dist_v2/tools/websearch.d.ts +0 -14
- package/dist_v2/tools/websearch.js +0 -137
- package/dist_v2/tools/websearch.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src_v2/kernel/message.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src_v2/kernel/message.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,UAAU,gBAAgB,CAAC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AE,CAAC,YAAY,CAAC;gBAChC,YAAY,IAAI,EAAE,CAAC,YAAY,IAAI,CAAC,CAAC;gBACrC,MAAM;QACV,CAAC;IACH,CAAC;IACD,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,CAAC;IAEhB,OAAO;QACL,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE;QAC9C,WAAW;QACX,YAAY;QACZ,YAAY;KACb,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,IAAI,CAAC;QAAC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,EAAE,CAAC;IAAC,CAAC;AACvD,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,IAAI,CAAC,IAAI;QAAE,OAAO,CAAC,CAAC;IACpB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -33,35 +33,6 @@ export interface Message {
|
|
|
33
33
|
content: string | ContentPart[];
|
|
34
34
|
name?: string;
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
* UI-only metadata that may be attached to a message in agent state but
|
|
38
|
-
* MUST NOT be sent to the LLM. Use `convertToLlm` (see `./message.ts`) at
|
|
39
|
-
* the provider boundary to strip these fields.
|
|
40
|
-
*
|
|
41
|
-
* `kind` is the high-level provenance / role of the entry:
|
|
42
|
-
* - 'notification' : transient UI banner (rate-limit, model-switch, etc.)
|
|
43
|
-
* - 'skill-injection' : marker for a skill-prompt injection event
|
|
44
|
-
* - 'fleet-supervisor': supervisor commentary in fleet/multi-agent runs
|
|
45
|
-
* - 'internal' : free-form internal annotation
|
|
46
|
-
*
|
|
47
|
-
* `data` is opaque to the kernel; consumers (TUI, daemon, fleet) may shape
|
|
48
|
-
* it as they wish.
|
|
49
|
-
*/
|
|
50
|
-
export interface AgentMessageUi {
|
|
51
|
-
kind: 'notification' | 'skill-injection' | 'fleet-supervisor' | 'internal';
|
|
52
|
-
data?: unknown;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* `AgentMessage` is the in-kernel transcript entry. It is a `Message` plus
|
|
56
|
-
* optional UI-only metadata. The agent loop stores `AgentMessage[]`; only
|
|
57
|
-
* the projected `Message[]` (via `convertToLlm`) is sent to providers.
|
|
58
|
-
*
|
|
59
|
-
* `hidden: true` excludes the message from the LLM context entirely.
|
|
60
|
-
*/
|
|
61
|
-
export interface AgentMessage extends Message {
|
|
62
|
-
ui?: AgentMessageUi;
|
|
63
|
-
hidden?: boolean;
|
|
64
|
-
}
|
|
65
36
|
export type StopReason = 'end_turn' | 'tool_use' | 'max_tokens' | 'stop_sequence' | 'error' | 'aborted';
|
|
66
37
|
export interface UsageTotal {
|
|
67
38
|
inputTokens: number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill marketplace via npm: Allows installing skill packs from npm.
|
|
3
|
+
* This module provides `installNpmSkill` to fetch and install a skill from an npm package.
|
|
4
|
+
*/
|
|
5
|
+
export interface InstallNpmResult {
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
installedAt: string;
|
|
9
|
+
bytes: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Install a skill from an npm package.
|
|
13
|
+
* @param spec - "npm:@scope/pack", "npm:@scope/pack@version", or "npm:plain-pkg"
|
|
14
|
+
* @param nameOverride - optional folder name (default: derived from package.json's "name" stripped of @scope/)
|
|
15
|
+
*/
|
|
16
|
+
export declare function installNpmSkill(spec: string, nameOverride?: string): Promise<InstallNpmResult>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill marketplace via npm: Allows installing skill packs from npm.
|
|
3
|
+
* This module provides `installNpmSkill` to fetch and install a skill from an npm package.
|
|
4
|
+
*/
|
|
5
|
+
import { execFile as execFileCb } from 'node:child_process';
|
|
6
|
+
import { promisify } from 'node:util';
|
|
7
|
+
import { randomUUID } from 'node:crypto';
|
|
8
|
+
import * as fs from 'node:fs/promises';
|
|
9
|
+
import os from 'node:os';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
const execFile = promisify(execFileCb);
|
|
12
|
+
/**
|
|
13
|
+
* Install a skill from an npm package.
|
|
14
|
+
* @param spec - "npm:@scope/pack", "npm:@scope/pack@version", or "npm:plain-pkg"
|
|
15
|
+
* @param nameOverride - optional folder name (default: derived from package.json's "name" stripped of @scope/)
|
|
16
|
+
*/
|
|
17
|
+
export async function installNpmSkill(spec, nameOverride) {
|
|
18
|
+
// Parse spec
|
|
19
|
+
if (!spec.startsWith('npm:')) {
|
|
20
|
+
throw new Error(`Invalid spec: "${spec}". Must start with "npm:"`);
|
|
21
|
+
}
|
|
22
|
+
const pkgSpec = spec.slice(4).trim();
|
|
23
|
+
// Package names must start with a letter or digit — leading dashes
|
|
24
|
+
// would otherwise pass through to `npm pack` as a flag (argument
|
|
25
|
+
// injection). Regex enforces this for both scope and package parts.
|
|
26
|
+
const npmRegex = /^(@[a-z0-9][a-z0-9-]*\/)?[a-z0-9][a-z0-9._-]*(@[a-zA-Z0-9.+_-]+)?$/;
|
|
27
|
+
if (!npmRegex.test(pkgSpec)) {
|
|
28
|
+
throw new Error(`Invalid npm package spec: "${pkgSpec}". Expected something like "@scope/package" or "package@version".`);
|
|
29
|
+
}
|
|
30
|
+
const tempDir = path.join(os.tmpdir(), `dirgha-skill-${randomUUID()}`);
|
|
31
|
+
await fs.mkdir(tempDir);
|
|
32
|
+
try {
|
|
33
|
+
// npm pack — `--` separator before pkgSpec so even if a future regex
|
|
34
|
+
// gap let through a "-flag-like" name, npm treats it as positional.
|
|
35
|
+
const { stdout } = await execFile('npm', ['pack', '--silent', '--pack-destination', '.', '--', pkgSpec], { cwd: tempDir });
|
|
36
|
+
const lines = stdout.trim().split('\n');
|
|
37
|
+
const tgzName = lines[lines.length - 1].trim();
|
|
38
|
+
if (!tgzName.endsWith('.tgz')) {
|
|
39
|
+
throw new Error(`Unexpected npm pack output: ${tgzName}`);
|
|
40
|
+
}
|
|
41
|
+
// Extract tarball
|
|
42
|
+
await execFile('tar', ['-xzf', tgzName], { cwd: tempDir });
|
|
43
|
+
const packageDir = path.join(tempDir, 'package');
|
|
44
|
+
// Validate SKILL.md exists
|
|
45
|
+
const skillMdPath = path.join(packageDir, 'SKILL.md');
|
|
46
|
+
try {
|
|
47
|
+
await fs.access(skillMdPath);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
throw new Error(`Skill "${pkgSpec}" missing SKILL.md at package root`);
|
|
51
|
+
}
|
|
52
|
+
// Read package.json
|
|
53
|
+
const packageJsonPath = path.join(packageDir, 'package.json');
|
|
54
|
+
const pkgJsonRaw = await fs.readFile(packageJsonPath, 'utf8');
|
|
55
|
+
const { name: pkgName, version } = JSON.parse(pkgJsonRaw);
|
|
56
|
+
// Determine skill name (folder).
|
|
57
|
+
// Default: strip @scope/ from pkgName so "@dirgha-skills/git-helper"
|
|
58
|
+
// installs as "git-helper". nameOverride wins if provided.
|
|
59
|
+
const stripScope = (n) => {
|
|
60
|
+
if (n.startsWith('@')) {
|
|
61
|
+
const parts = n.split('/');
|
|
62
|
+
return parts.length === 2 && parts[1] ? parts[1] : n;
|
|
63
|
+
}
|
|
64
|
+
return n;
|
|
65
|
+
};
|
|
66
|
+
const folderName = nameOverride ?? stripScope(pkgName);
|
|
67
|
+
// Compute size of SKILL.md
|
|
68
|
+
const skillMdContent = await fs.readFile(skillMdPath);
|
|
69
|
+
const bytes = skillMdContent.length;
|
|
70
|
+
// Target installation directory
|
|
71
|
+
const targetDir = path.join(os.homedir(), '.dirgha', 'skills', folderName);
|
|
72
|
+
// Ensure not already installed
|
|
73
|
+
try {
|
|
74
|
+
await fs.stat(targetDir);
|
|
75
|
+
throw new Error(`Skill already installed at ${targetDir}. Uninstall first.`);
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
if (err.code !== 'ENOENT')
|
|
79
|
+
throw err;
|
|
80
|
+
}
|
|
81
|
+
// Create parent directories if needed
|
|
82
|
+
await fs.mkdir(path.dirname(targetDir), { recursive: true });
|
|
83
|
+
// Move package to target
|
|
84
|
+
await fs.rename(packageDir, targetDir);
|
|
85
|
+
return {
|
|
86
|
+
name: folderName,
|
|
87
|
+
version,
|
|
88
|
+
installedAt: targetDir,
|
|
89
|
+
bytes,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
// Clean up temp directory
|
|
94
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=install-npm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-npm.js","sourceRoot":"","sources":["../../src_v2/skills/install-npm.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,QAAQ,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;AAWvC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,IAAY,EACZ,YAAqB;IAErB,aAAa;IACb,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,2BAA2B,CAAC,CAA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;QAChC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;QAE3E,+BAA+B;QAC/B,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,oBAAoB,CAAC,CAAC;QAC/E,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;gBAAE,MAAM,GAAG,CAAC;QACvC,CAAC;QAED,sCAAsC;QACtC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE7D,yBAAyB;QACzB,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAEvC,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,OAAO;YACP,WAAW,EAAE,SAAS;YACtB,KAAK;SACN,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,0BAA0B;QAC1B,MAAM,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;AACH,CAAC"}
|
package/dist_v2/tools/browser.js
CHANGED
|
@@ -29,9 +29,12 @@ async function ensureBrowser() {
|
|
|
29
29
|
return page;
|
|
30
30
|
let chromium;
|
|
31
31
|
try {
|
|
32
|
-
// Dynamic import — resolved at runtime
|
|
33
|
-
//
|
|
34
|
-
|
|
32
|
+
// Dynamic import — resolved at runtime. Playwright is intentionally
|
|
33
|
+
// not in package.json deps (heavy + optional). Hiding the literal
|
|
34
|
+
// string behind a variable keeps TS's module resolver from looking
|
|
35
|
+
// for type definitions for an absent package.
|
|
36
|
+
const pwModuleId = 'playwright';
|
|
37
|
+
const mod = await import(pwModuleId);
|
|
35
38
|
chromium = mod.chromium ?? mod.default?.chromium;
|
|
36
39
|
if (!chromium || typeof chromium.launch !== 'function') {
|
|
37
40
|
throw new Error('playwright module shape unexpected (no chromium.launch)');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src_v2/tools/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,uDAAuD;AAEvD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAkDjC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACjC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AAEjE,IAAI,OAA8B,CAAC;AACnC,IAAI,IAAwB,CAAC;AAE7B,KAAK,UAAU,aAAa;IAC1B,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,IAAI,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAEtE,IAAI,QAAsF,CAAC;IAC3F,IAAI,CAAC;QACH,
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src_v2/tools/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,uDAAuD;AAEvD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAkDjC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACjC,MAAM,kBAAkB,GA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,CAAC,OAAO,CAAC,QAAiB,EAAE,IAAiB;QAChD,MAAM,KAAK,GAAG,QAAiB,CAAC;QAChC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/C,OAAO,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACjC,CAAC;QAED,IAAI,CAAC;YACH,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;gBACrB,KAAK,MAAM,CAAC,CAAC,OAAO,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC;gBACxC,KAAK,OAAO,CAAC,CAAC,OAAO,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;gBAC1C,KAAK,YAAY,CAAC,CAAC,OAAO,MAAM,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpD,KAAK,SAAS,CAAC,CAAC,OAAO,MAAM,SAAS,CAAC,KAAK,CAAC,CAAC;gBAC9C,KAAK,OAAO,CAAC,CAAC,OAAO,MAAM,OAAO,EAAE,CAAC;gBACrC,OAAO,CAAC,CAAC,OAAO,IAAI,CAAC,mBAAmB,MAAM,CAAE,KAA6B,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC3F,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,IAAI,CAAC,WAAW,KAAK,CAAC,MAAM,YAAa,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;CACF,CAAC;AAEF,qEAAqE;AACrE,KAAK,MAAM,CAAC;AAEZ,eAAe,WAAW,CAAC"}
|
package/dist_v2/tools/index.d.ts
CHANGED
|
@@ -14,8 +14,6 @@ import { searchGlobTool } from './search-glob.js';
|
|
|
14
14
|
import { gitTool } from './git.js';
|
|
15
15
|
import { browserTool } from './browser.js';
|
|
16
16
|
import { checkpointTool } from './checkpoint.js';
|
|
17
|
-
import { webfetchTool } from './webfetch.js';
|
|
18
|
-
import { websearchTool } from './websearch.js';
|
|
19
17
|
export { createMultimodalTool } from './multimodal.js';
|
|
20
18
|
export { createCronTool } from './cron.js';
|
|
21
19
|
declare const cronTool: Tool;
|
|
@@ -24,4 +22,4 @@ export * from './permission.js';
|
|
|
24
22
|
export * from './exec.js';
|
|
25
23
|
export * from './diff.js';
|
|
26
24
|
export declare const builtInTools: Tool[];
|
|
27
|
-
export { fsReadTool, fsWriteTool, fsEditTool, fsLsTool, shellTool, searchGrepTool, searchGlobTool, gitTool, browserTool,
|
|
25
|
+
export { fsReadTool, fsWriteTool, fsEditTool, fsLsTool, shellTool, searchGrepTool, searchGlobTool, gitTool, browserTool, checkpointTool, cronTool, };
|
package/dist_v2/tools/index.js
CHANGED
|
@@ -14,8 +14,6 @@ import { gitTool } from './git.js';
|
|
|
14
14
|
import { browserTool } from './browser.js';
|
|
15
15
|
import { checkpointTool } from './checkpoint.js';
|
|
16
16
|
import { createCronTool } from './cron.js';
|
|
17
|
-
import { webfetchTool } from './webfetch.js';
|
|
18
|
-
import { websearchTool } from './websearch.js';
|
|
19
17
|
// multimodal is a factory (needs runtime Provider) — wired in main.ts, not baked into builtInTools
|
|
20
18
|
export { createMultimodalTool } from './multimodal.js';
|
|
21
19
|
export { createCronTool } from './cron.js';
|
|
@@ -34,10 +32,8 @@ export const builtInTools = [
|
|
|
34
32
|
searchGlobTool,
|
|
35
33
|
gitTool,
|
|
36
34
|
browserTool,
|
|
37
|
-
webfetchTool,
|
|
38
|
-
websearchTool,
|
|
39
35
|
checkpointTool,
|
|
40
36
|
cronTool,
|
|
41
37
|
];
|
|
42
|
-
export { fsReadTool, fsWriteTool, fsEditTool, fsLsTool, shellTool, searchGrepTool, searchGlobTool, gitTool, browserTool,
|
|
38
|
+
export { fsReadTool, fsWriteTool, fsEditTool, fsLsTool, shellTool, searchGrepTool, searchGlobTool, gitTool, browserTool, checkpointTool, cronTool, };
|
|
43
39
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src_v2/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src_v2/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,mGAAmG;AACnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,QAAQ,GAAG,cAAc,EAAE,CAAC;AAElC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAE1B,MAAM,CAAC,MAAM,YAAY,GAAW;IAClC,UAAU;IACV,WAAW;IACX,UAAU;IACV,QAAQ;IACR,SAAS;IACT,cAAc;IACd,cAAc;IACd,OAAO;IACP,WAAW;IACX,cAAc;IACd,QAAQ;CACT,CAAC;AAEF,OAAO,EACL,UAAU,EACV,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,cAAc,EACd,cAAc,EACd,OAAO,EACP,WAAW,EACX,cAAc,EACd,QAAQ,GACT,CAAC"}
|
package/dist_v2/tui/ink/App.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type { ProviderRegistry } from '../../providers/index.js';
|
|
|
20
20
|
import type { ToolRegistry } from '../../tools/registry.js';
|
|
21
21
|
import type { SessionStore } from '../../context/session.js';
|
|
22
22
|
import type { DirghaConfig } from '../../cli/config.js';
|
|
23
|
+
import type { SlashRegistry } from '../../cli/slash.js';
|
|
23
24
|
import { type ModelEntry } from './components/ModelPicker.js';
|
|
24
25
|
import { type HelpSlashCommand } from './components/HelpOverlay.js';
|
|
25
26
|
export interface AppProps {
|
|
@@ -35,5 +36,7 @@ export interface AppProps {
|
|
|
35
36
|
slashCommands?: HelpSlashCommand[];
|
|
36
37
|
/** Model catalogue. Defaults to the prices registry. */
|
|
37
38
|
models?: ModelEntry[];
|
|
39
|
+
/** Slash registry — built by runInkTUI, dispatched on submit. */
|
|
40
|
+
slashRegistry: SlashRegistry;
|
|
38
41
|
}
|
|
39
42
|
export declare function App(props: AppProps): React.JSX.Element;
|
package/dist_v2/tui/ink/App.js
CHANGED
|
@@ -66,12 +66,13 @@ export function App(props) {
|
|
|
66
66
|
const sessionIdRef = React.useRef(randomUUID());
|
|
67
67
|
const historyRef = React.useRef(initialHistory(props));
|
|
68
68
|
const abortRef = React.useRef(null);
|
|
69
|
-
const handleSubmitRef = React.useRef(() => { });
|
|
70
69
|
const [transcript, setTranscript] = React.useState([]);
|
|
71
70
|
const [input, setInput] = React.useState('');
|
|
72
71
|
const [busy, setBusy] = React.useState(false);
|
|
73
72
|
const [currentModel, setCurrentModel] = React.useState(props.config.model);
|
|
74
|
-
|
|
73
|
+
// Mode state: SlashContext.setMode flips it live so /mode plan|act|verify|ask
|
|
74
|
+
// takes effect on the next turn (system-prompt rebuild downstream picks it up).
|
|
75
|
+
const [mode, setMode] = React.useState(props.config.mode ?? 'act');
|
|
75
76
|
const projection = useEventProjection(props.events);
|
|
76
77
|
const overlays = useOverlays();
|
|
77
78
|
// Live counters for the in-progress turn — drive the StatusBar
|
|
@@ -80,45 +81,23 @@ export function App(props) {
|
|
|
80
81
|
const [liveOutputTokens, setLiveOutputTokens] = React.useState(0);
|
|
81
82
|
const [liveDurationMs, setLiveDurationMs] = React.useState(0);
|
|
82
83
|
const turnStartRef = React.useRef(0);
|
|
83
|
-
// Throttle status-bar token updates to 200 ms windows. Refs must live at
|
|
84
|
-
// the component top level (rules of hooks) — earlier they were inside the
|
|
85
|
-
// useEffect below, which made App throw at mount and broke every test.
|
|
86
|
-
const pendingTokenDeltaRef = React.useRef(0);
|
|
87
|
-
const lastUpdateRef = React.useRef(0);
|
|
88
|
-
const TOKEN_THROTTLE_MS = 200;
|
|
89
84
|
React.useEffect(() => {
|
|
90
85
|
const unsub = props.events.subscribe(ev => {
|
|
91
86
|
if (ev.type === 'agent_start') {
|
|
92
87
|
turnStartRef.current = Date.now();
|
|
93
88
|
setLiveOutputTokens(0);
|
|
94
89
|
setLiveDurationMs(0);
|
|
95
|
-
pendingTokenDeltaRef.current = 0;
|
|
96
|
-
lastUpdateRef.current = Date.now();
|
|
97
90
|
}
|
|
98
91
|
else if (ev.type === 'text_delta' || ev.type === 'thinking_delta') {
|
|
99
92
|
// Approximate output-token count by char/4 — same heuristic
|
|
100
93
|
// the rest of the codebase uses for streaming-side estimates.
|
|
101
94
|
const delta = (ev.delta?.length ?? 0) / 4;
|
|
102
|
-
|
|
103
|
-
// Throttle updates to every THROTTLE_MS
|
|
104
|
-
const now = Date.now();
|
|
105
|
-
if (now - lastUpdateRef.current >= TOKEN_THROTTLE_MS) {
|
|
106
|
-
setLiveOutputTokens(prev => prev + pendingTokenDeltaRef.current);
|
|
107
|
-
pendingTokenDeltaRef.current = 0;
|
|
108
|
-
lastUpdateRef.current = now;
|
|
109
|
-
}
|
|
95
|
+
setLiveOutputTokens(prev => prev + delta);
|
|
110
96
|
}
|
|
111
97
|
else if (ev.type === 'usage') {
|
|
112
|
-
// Final usage event - update immediately
|
|
113
98
|
setLiveOutputTokens(ev.outputTokens ?? 0);
|
|
114
|
-
pendingTokenDeltaRef.current = 0;
|
|
115
99
|
}
|
|
116
100
|
else if (ev.type === 'agent_end') {
|
|
117
|
-
// Apply any pending deltas before ending
|
|
118
|
-
if (pendingTokenDeltaRef.current > 0) {
|
|
119
|
-
setLiveOutputTokens(prev => prev + pendingTokenDeltaRef.current);
|
|
120
|
-
pendingTokenDeltaRef.current = 0;
|
|
121
|
-
}
|
|
122
101
|
setLiveDurationMs(0);
|
|
123
102
|
setLiveOutputTokens(0);
|
|
124
103
|
}
|
|
@@ -193,40 +172,83 @@ export function App(props) {
|
|
|
193
172
|
overlays.openOverlay('theme');
|
|
194
173
|
return;
|
|
195
174
|
}
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
id: randomUUID(),
|
|
205
|
-
text: `Mode: ${next.toUpperCase()}. ${next === 'act' ? 'Ready to ship code.' : 'Read-only — exploring only.'}`,
|
|
206
|
-
};
|
|
207
|
-
setTranscript(prev => [...prev, note]);
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
// Catch-all: any unknown `/foo` shows an inline error and is NOT sent to the LLM.
|
|
175
|
+
// Anything else starting with `/` goes through the SlashRegistry — that
|
|
176
|
+
// covers /init /keys /memory /compact /setup /login /status /resume
|
|
177
|
+
// /session /history /fleet /account /upgrade /config /mode and friends.
|
|
178
|
+
// The hardcoded branches above (clear/help/model[s]/theme) ran first
|
|
179
|
+
// because they open Ink overlays and don't fit the registry string-output
|
|
180
|
+
// contract. Without this dispatch, unrecognised slash commands fell
|
|
181
|
+
// through to runTurn() and were sent to the LLM as user prompts —
|
|
182
|
+
// surprising behaviour that S1/2026-04-27 fixes.
|
|
211
183
|
if (value.startsWith('/')) {
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
184
|
+
const ctx = {
|
|
185
|
+
get model() { return currentModel; },
|
|
186
|
+
get sessionId() { return sessionIdRef.current; },
|
|
187
|
+
setModel: (m) => setCurrentModel(m),
|
|
188
|
+
showHelp: () => '',
|
|
189
|
+
compact: async () => '(compaction is automatic)',
|
|
190
|
+
clear: () => {
|
|
191
|
+
historyRef.current = initialHistory(props);
|
|
192
|
+
setTranscript([]);
|
|
193
|
+
projection.clear();
|
|
194
|
+
},
|
|
195
|
+
listSessions: async () => {
|
|
196
|
+
const ids = await props.sessions.list();
|
|
197
|
+
return ids.length === 0 ? '(no saved sessions)' : ids.map(id => `- ${id}`).join('\n');
|
|
198
|
+
},
|
|
199
|
+
loadSession: async (id) => {
|
|
200
|
+
const s = await props.sessions.open(id);
|
|
201
|
+
return s ? `Loaded ${id}.` : `Session ${id} not found.`;
|
|
202
|
+
},
|
|
203
|
+
listSkills: async () => '(run `dirgha skills` for the full list)',
|
|
204
|
+
showCost: () => `model=${currentModel}`,
|
|
205
|
+
exit: (code = 0) => { exit(); process.exit(code); },
|
|
206
|
+
getToken: () => null,
|
|
207
|
+
setToken: () => undefined,
|
|
208
|
+
apiBase: () => process.env['DIRGHA_API_BASE'] ?? process.env['DIRGHA_GATEWAY_URL'] ?? 'https://api.dirgha.ai',
|
|
209
|
+
upgradeUrl: () => process.env['DIRGHA_UPGRADE_URL'] ?? 'https://dirgha.ai/billing/upgrade',
|
|
210
|
+
status: (msg) => {
|
|
211
|
+
setTranscript(prev => [...prev, { kind: 'notice', id: randomUUID(), text: msg }]);
|
|
212
|
+
},
|
|
213
|
+
getMode: () => mode,
|
|
214
|
+
setMode: (m) => setMode(m),
|
|
215
|
+
getTheme: () => (props.config.theme ?? 'dark'),
|
|
216
|
+
setTheme: () => undefined,
|
|
217
|
+
getSession: () => null,
|
|
218
|
+
getSessionStore: () => props.sessions,
|
|
219
|
+
getProvider: () => props.providers.forModel(currentModel),
|
|
220
|
+
getSummaryModel: () => props.config.summaryModel,
|
|
216
221
|
};
|
|
217
|
-
|
|
222
|
+
void (async () => {
|
|
223
|
+
try {
|
|
224
|
+
const result = await props.slashRegistry.dispatch(value, ctx);
|
|
225
|
+
if (result.handled) {
|
|
226
|
+
const text = result.output ? String(result.output) : '(ok)';
|
|
227
|
+
setTranscript(prev => [...prev, { kind: 'notice', id: randomUUID(), text }]);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
setTranscript(prev => [...prev, {
|
|
231
|
+
kind: 'notice',
|
|
232
|
+
id: randomUUID(),
|
|
233
|
+
text: `Unknown command: ${value.split(' ')[0]}. Type /help for the list.`,
|
|
234
|
+
}]);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
catch (err) {
|
|
238
|
+
setTranscript(prev => [...prev, {
|
|
239
|
+
kind: 'notice',
|
|
240
|
+
id: randomUUID(),
|
|
241
|
+
text: `[slash error] ${err instanceof Error ? err.message : String(err)}`,
|
|
242
|
+
}]);
|
|
243
|
+
}
|
|
244
|
+
})();
|
|
218
245
|
return;
|
|
219
246
|
}
|
|
220
247
|
const userItem = { kind: 'user', id: randomUUID(), text: value };
|
|
221
248
|
setTranscript(prev => [...prev, userItem]);
|
|
222
249
|
historyRef.current.push({ role: 'user', content: value });
|
|
223
250
|
void runTurn();
|
|
224
|
-
}, [busy, exit, props, projection, overlays
|
|
225
|
-
// Always keep the ref in sync with the latest handleSubmit, so
|
|
226
|
-
// handleSlashPick can call it without stale closure.
|
|
227
|
-
React.useEffect(() => {
|
|
228
|
-
handleSubmitRef.current = handleSubmit;
|
|
229
|
-
}, [handleSubmit]);
|
|
251
|
+
}, [busy, exit, props, projection, overlays]);
|
|
230
252
|
const runTurn = async () => {
|
|
231
253
|
setBusy(true);
|
|
232
254
|
const abort = new AbortController();
|
|
@@ -319,63 +341,17 @@ export function App(props) {
|
|
|
319
341
|
overlays.setAtQuery(null);
|
|
320
342
|
overlays.setActive(null);
|
|
321
343
|
}, [overlays]);
|
|
322
|
-
const handleSlashPick = React.useCallback((name
|
|
323
|
-
//
|
|
324
|
-
//
|
|
325
|
-
//
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
if (query === name) {
|
|
329
|
-
overlays.setSlashQuery(null);
|
|
330
|
-
overlays.setActive(null);
|
|
331
|
-
setInput('');
|
|
332
|
-
// Inline-handle the well-known UI commands so we don't need to wait
|
|
333
|
-
// for handleSubmit's React state to settle. For unknown / non-UI
|
|
334
|
-
// commands, fall through to handleSubmit via the ref.
|
|
335
|
-
switch (name) {
|
|
336
|
-
case 'model':
|
|
337
|
-
case 'models':
|
|
338
|
-
overlays.openOverlay('models');
|
|
339
|
-
return;
|
|
340
|
-
case 'help':
|
|
341
|
-
overlays.openOverlay('help');
|
|
342
|
-
return;
|
|
343
|
-
case 'theme':
|
|
344
|
-
case 'themes':
|
|
345
|
-
overlays.openOverlay('theme');
|
|
346
|
-
return;
|
|
347
|
-
case 'mode': {
|
|
348
|
-
const next = mode === 'act' ? 'plan' : 'act';
|
|
349
|
-
setMode(next);
|
|
350
|
-
setTranscript(prev => [...prev, {
|
|
351
|
-
kind: 'notice',
|
|
352
|
-
id: randomUUID(),
|
|
353
|
-
text: `Mode: ${next.toUpperCase()}. ${next === 'act' ? 'Ready to ship code.' : 'Read-only — exploring only.'}`,
|
|
354
|
-
}]);
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
case 'exit':
|
|
358
|
-
case 'quit':
|
|
359
|
-
exit();
|
|
360
|
-
return;
|
|
361
|
-
case 'clear':
|
|
362
|
-
historyRef.current = initialHistory(props);
|
|
363
|
-
setTranscript([]);
|
|
364
|
-
projection.clear();
|
|
365
|
-
return;
|
|
366
|
-
default:
|
|
367
|
-
handleSubmitRef.current?.(`/${name}`);
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
// Partial match: splice picked name + trailing space for arguments.
|
|
372
|
-
overlays.setSlashQuery(null);
|
|
373
|
-
overlays.setActive(null);
|
|
374
|
-
setInput(prev => {
|
|
375
|
-
const spliced = overlays.spliceSlashSelection(prev, name);
|
|
344
|
+
const handleSlashPick = React.useCallback((name) => {
|
|
345
|
+
// Replace the leading /<typed> with /<picked> + a trailing space so
|
|
346
|
+
// the user can immediately type arguments. If there's already a
|
|
347
|
+
// tail (rare — only if they pasted), preserve it.
|
|
348
|
+
setInput(current => {
|
|
349
|
+
const spliced = overlays.spliceSlashSelection(current, name);
|
|
376
350
|
return spliced === `/${name}` ? `${spliced} ` : spliced;
|
|
377
351
|
});
|
|
378
|
-
|
|
352
|
+
overlays.setSlashQuery(null);
|
|
353
|
+
overlays.setActive(null);
|
|
354
|
+
}, [overlays]);
|
|
379
355
|
const inputFocus = overlays.active === null || overlays.active === 'atfile' || overlays.active === 'slash';
|
|
380
356
|
// Active theme name — driven by local state so the picker can flip it
|
|
381
357
|
// live. Initial value comes from config; subsequent changes are
|
|
@@ -405,9 +381,9 @@ export function App(props) {
|
|
|
405
381
|
// streaming text appears now, the Static-around-transcript pattern
|
|
406
382
|
// was suppressing the live region updates. If still not, the bug
|
|
407
383
|
// is upstream in useEventProjection.
|
|
408
|
-
return (_jsx(ThemeProvider, { activeTheme: themeName, children: _jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: [{ key: 'logo' }], children: (_item) => _jsx(Logo, { version: VERSION }, "logo") }), _jsxs(Box, { flexDirection: "column", children: [transcript.map(item => (_jsx(TranscriptRow, { item: item }, item.id))), projection.liveItems.map(item => (_jsx(TranscriptRow, { item: item }, item.id)))] }), _jsx(InputBox, { value: input, onChange: setInput, onSubmit: handleSubmit, busy: busy, vimMode: props.config.vimMode === true, onAtQueryChange: overlays.setAtQuery, onSlashQueryChange: overlays.setSlashQuery, onRequestOverlay: overlays.openOverlay, inputFocus: inputFocus && !busy }), overlays.active === 'atfile' && overlays.atQuery !== null && (_jsx(AtFileComplete, { cwd: props.cwd, query: overlays.atQuery, onPick: handleAtPick, onCancel: () => { overlays.setAtQuery(null); overlays.setActive(null); } })), overlays.active === 'slash' && overlays.slashQuery !== null && (_jsx(SlashComplete, { commands: slashCommands, query: overlays.slashQuery, onPick: handleSlashPick, onCancel: () => { overlays.setSlashQuery(null); overlays.setActive(null); } })), overlays.active === 'models' && (_jsx(ModelPicker, { models: models, current: currentModel, onPick: handleModelPick, onCancel: overlays.closeOverlay })), overlays.active === 'help' && (_jsx(HelpOverlay, { slashCommands: slashCommands, onClose: overlays.closeOverlay })), overlays.active === 'theme' && (_jsx(ThemePicker, { current: themeName, onPick: handleThemePick, onCancel: overlays.closeOverlay })), _jsx(StatusBar, { model: currentModel, provider: providerIdForModel(currentModel), inputTokens: projection.totals.inputTokens, outputTokens: projection.totals.outputTokens, costUsd: projection.totals.costUsd, cwd: props.cwd, busy: busy, mode: mode, contextWindow: contextWindowFor(currentModel), liveOutputTokens: liveOutputTokens, liveDurationMs: liveDurationMs })] }) }));
|
|
384
|
+
return (_jsx(ThemeProvider, { activeTheme: themeName, children: _jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: [{ key: 'logo' }], children: (_item) => _jsx(Logo, { version: VERSION }, "logo") }), _jsxs(Box, { flexDirection: "column", children: [transcript.map(item => (_jsx(TranscriptRow, { item: item }, item.id))), projection.liveItems.map(item => (_jsx(TranscriptRow, { item: item }, item.id)))] }), _jsx(InputBox, { value: input, onChange: setInput, onSubmit: handleSubmit, busy: busy, vimMode: props.config.vimMode === true, onAtQueryChange: overlays.setAtQuery, onSlashQueryChange: overlays.setSlashQuery, onRequestOverlay: overlays.openOverlay, inputFocus: inputFocus && !busy }), overlays.active === 'atfile' && overlays.atQuery !== null && (_jsx(AtFileComplete, { cwd: props.cwd, query: overlays.atQuery, onPick: handleAtPick, onCancel: () => { overlays.setAtQuery(null); overlays.setActive(null); } })), overlays.active === 'slash' && overlays.slashQuery !== null && (_jsx(SlashComplete, { commands: slashCommands, query: overlays.slashQuery, onPick: handleSlashPick, onCancel: () => { overlays.setSlashQuery(null); overlays.setActive(null); } })), overlays.active === 'models' && (_jsx(ModelPicker, { models: models, current: currentModel, onPick: handleModelPick, onCancel: overlays.closeOverlay })), overlays.active === 'help' && (_jsx(HelpOverlay, { slashCommands: slashCommands, onClose: overlays.closeOverlay })), overlays.active === 'theme' && (_jsx(ThemePicker, { current: themeName, onPick: handleThemePick, onCancel: overlays.closeOverlay })), _jsx(StatusBar, { model: currentModel, provider: providerIdForModel(currentModel), inputTokens: projection.totals.inputTokens, outputTokens: projection.totals.outputTokens, costUsd: projection.totals.costUsd, cwd: props.cwd, busy: busy, mode: props.config.mode ?? 'act', contextWindow: contextWindowFor(currentModel), liveOutputTokens: liveOutputTokens, liveDurationMs: liveDurationMs })] }) }));
|
|
409
385
|
}
|
|
410
|
-
|
|
386
|
+
function TranscriptRow({ item }) {
|
|
411
387
|
switch (item.kind) {
|
|
412
388
|
case 'user':
|
|
413
389
|
return (_jsxs(Box, { gap: 2, marginBottom: 1, children: [_jsx(Text, { color: "magenta", children: "\u276F" }), _jsx(Text, { color: "white", children: item.text })] }));
|
|
@@ -422,22 +398,7 @@ const TranscriptRow = React.memo(function TranscriptRow({ item }) {
|
|
|
422
398
|
case 'notice':
|
|
423
399
|
return (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "yellow", children: item.text }) }));
|
|
424
400
|
}
|
|
425
|
-
}
|
|
426
|
-
// Custom comparison: only re-render if item id or content length changes
|
|
427
|
-
if (prev.item.id !== next.item.id)
|
|
428
|
-
return false;
|
|
429
|
-
if (prev.item.kind === 'text' && next.item.kind === 'text') {
|
|
430
|
-
return prev.item.content.length === next.item.content.length;
|
|
431
|
-
}
|
|
432
|
-
if (prev.item.kind === 'thinking' && next.item.kind === 'thinking') {
|
|
433
|
-
return prev.item.content.length === next.item.content.length;
|
|
434
|
-
}
|
|
435
|
-
if (prev.item.kind === 'tool' && next.item.kind === 'tool') {
|
|
436
|
-
return prev.item.status === next.item.status &&
|
|
437
|
-
prev.item.durationMs === next.item.durationMs;
|
|
438
|
-
}
|
|
439
|
-
return true;
|
|
440
|
-
});
|
|
401
|
+
}
|
|
441
402
|
function initialHistory(props) {
|
|
442
403
|
const base = props.initialMessages ? [...props.initialMessages] : [];
|
|
443
404
|
// Boot context: mode preamble + project primer (DIRGHA.md) +
|