@laxture/vibe-pm 0.1.0
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 +190 -0
- package/README.md +120 -0
- package/README.zh-CN.md +119 -0
- package/dist/core/commands.d.ts +17 -0
- package/dist/core/config.d.ts +12 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/logger.d.ts +23 -0
- package/dist/core/plugin.d.ts +2 -0
- package/dist/core/types.d.ts +42 -0
- package/dist/docs/template/_coding_style/general.md +114 -0
- package/dist/docs/template/_coding_style/go.md +158 -0
- package/dist/docs/template/_coding_style/java.md +154 -0
- package/dist/docs/template/_coding_style/python.md +195 -0
- package/dist/docs/template/_coding_style/rust.md +161 -0
- package/dist/docs/template/_coding_style/sql.md +321 -0
- package/dist/docs/template/_coding_style/typescript.md +237 -0
- package/dist/docs/template/agents-template.md +38 -0
- package/dist/docs/template/bug-fix/flow.md +189 -0
- package/dist/docs/template/constitution-template.md +119 -0
- package/dist/docs/template/design-spec/flow.md +194 -0
- package/dist/docs/template/dictionary-template.md +40 -0
- package/dist/docs/template/large-refactor/flow.md +242 -0
- package/dist/docs/template/large-refactor/regulations/migration-checklist.md +28 -0
- package/dist/docs/template/research/flow.md +161 -0
- package/dist/docs/template/side-job/flow.md +147 -0
- package/dist/docs/template/spec-driven-dev/flow.md +420 -0
- package/dist/docs/template/spec-template.md +190 -0
- package/dist/engine/errors.d.ts +28 -0
- package/dist/engine/flow-engine.d.ts +32 -0
- package/dist/engine/index.d.ts +3 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/loader.d.ts +23 -0
- package/dist/i18n/prompts-en-US.d.ts +47 -0
- package/dist/i18n/prompts-zh-CN.d.ts +50 -0
- package/dist/i18n/types.d.ts +51 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4886 -0
- package/dist/integration/dcp.d.ts +7 -0
- package/dist/integration/index.d.ts +1 -0
- package/dist/memory/errors.d.ts +11 -0
- package/dist/memory/index.d.ts +3 -0
- package/dist/memory/memory-system.d.ts +80 -0
- package/dist/memory/types.d.ts +157 -0
- package/dist/template/index.d.ts +3 -0
- package/dist/template/template-manager.d.ts +26 -0
- package/dist/template/types.d.ts +16 -0
- package/dist/token/backends/anthropic.d.ts +5 -0
- package/dist/token/backends/llama.d.ts +7 -0
- package/dist/token/backends/tiktoken.d.ts +7 -0
- package/dist/token/index.d.ts +3 -0
- package/dist/token/model-registry.d.ts +9 -0
- package/dist/token/token-counter.d.ts +17 -0
- package/dist/token/types.d.ts +39 -0
- package/dist/tui/components/collapsible.d.ts +9 -0
- package/dist/tui/components/empty-state.d.ts +7 -0
- package/dist/tui/data/task-status.d.ts +16 -0
- package/dist/tui/data/token-data.d.ts +16 -0
- package/dist/tui/index.d.ts +13 -0
- package/dist/tui/index.js +3293 -0
- package/dist/tui/slots/sidebar-content.d.ts +10 -0
- package/dist/tui/tui-plugin.d.ts +9 -0
- package/dist/tui/types.d.ts +63 -0
- package/package.json +63 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write DCP protection config (protectTags + protectedFilePatterns)
|
|
3
|
+
*
|
|
4
|
+
* Checks whether opencode.json/opencode.jsonc has a plugin config;
|
|
5
|
+
* both project-level and global-level are checked, and writes proceed if found.
|
|
6
|
+
*/
|
|
7
|
+
export declare function writeDcpConfig(projectDir: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { writeDcpConfig } from './dcp.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory System error classes
|
|
3
|
+
*/
|
|
4
|
+
/** Thrown when attempting to create a second Task for a session that already has an active one */
|
|
5
|
+
export declare class DuplicateTaskError extends Error {
|
|
6
|
+
constructor(sessionId: string);
|
|
7
|
+
}
|
|
8
|
+
/** Generic Data Layer error */
|
|
9
|
+
export declare class MemorySystemError extends Error {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { MemorySystem } from './memory-system.js';
|
|
2
|
+
export { DuplicateTaskError, MemorySystemError } from './errors.js';
|
|
3
|
+
export type { Task, CreateTaskInput, Discussion, CreateDiscussionInput, StepTokenMetrics, IMemorySystem, StepTokenBreakdown, SubagentTokenMetrics, SessionTokenMetrics, } from './types.js';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { CreateDiscussionInput, CreateTaskInput, Discussion, StepTokenMetrics, IMemorySystem, SessionTokenMetrics, StepTokenBreakdown, StepTransition, SubagentTokenMetrics, Task } from './types.js';
|
|
2
|
+
import { ApiTelemetry, TokenCount } from '../token';
|
|
3
|
+
/**
|
|
4
|
+
* vibe-pm's Structured Memory layer.
|
|
5
|
+
*
|
|
6
|
+
* Manages three categories of data via SQLite (better-sqlite3):
|
|
7
|
+
* - tasks: FSM-driven Task state
|
|
8
|
+
* - discussions: non-urgent Discussion items (async-time-friendly, async review)
|
|
9
|
+
* - stepTokenMetrics: per-Step metrics (Token consumption, dwell time, etc.)
|
|
10
|
+
*/
|
|
11
|
+
export declare class MemorySystem implements IMemorySystem {
|
|
12
|
+
private db;
|
|
13
|
+
private stmtInsertTask;
|
|
14
|
+
private stmtGetTaskBySession;
|
|
15
|
+
private stmtGetActiveTaskBySession;
|
|
16
|
+
private stmtUpdateTaskStep;
|
|
17
|
+
private stmtCloseTask;
|
|
18
|
+
private stmtListActiveTasks;
|
|
19
|
+
private stmtGetTaskById;
|
|
20
|
+
private stmtUpdateTaskTransitions;
|
|
21
|
+
private stmtInsertDiscussion;
|
|
22
|
+
private stmtGetDiscussionsBySession;
|
|
23
|
+
private stmtGetAllDiscussions;
|
|
24
|
+
private stmtResolveDiscussion;
|
|
25
|
+
private stmtGetMetricsBySessionStep;
|
|
26
|
+
private stmtUpdateMetrics;
|
|
27
|
+
private stmtUpsertMetrics;
|
|
28
|
+
private stmtInsertMetrics;
|
|
29
|
+
private stmtGetMetricsBySession;
|
|
30
|
+
private stmtGetMetricsByFlow;
|
|
31
|
+
private stmtGetClosedTasksBySession;
|
|
32
|
+
private stmtCheckDupUserRequest;
|
|
33
|
+
private stmtInitSessionTokens;
|
|
34
|
+
private stmtGetSessionTokens;
|
|
35
|
+
private stmtUpsertSessionTokens;
|
|
36
|
+
private stmtUpsertSubagentTokens;
|
|
37
|
+
private stmtGetSubagentTokens;
|
|
38
|
+
/**
|
|
39
|
+
* Initialize database connection and table schema.
|
|
40
|
+
*
|
|
41
|
+
* Creates a SQLite database file in the specified directory and sets up tables.
|
|
42
|
+
* Must be called once before use.
|
|
43
|
+
*
|
|
44
|
+
* @param dataDir Directory for storing database files (typically `.vibe-pm/`)
|
|
45
|
+
*/
|
|
46
|
+
init(dataDir: string): Promise<void>;
|
|
47
|
+
createTask(input: CreateTaskInput): Promise<Task>;
|
|
48
|
+
checkDuplicateUserRequest(sessionId: string, userRequest: string): Promise<boolean>;
|
|
49
|
+
getTask(sessionId: string): Promise<Task | null>;
|
|
50
|
+
getActiveTask(sessionId: string): Promise<Task | null>;
|
|
51
|
+
updateStep(id: string, step: string, stepName: string): Promise<void>;
|
|
52
|
+
closeTask(id: string): Promise<void>;
|
|
53
|
+
listActiveTasks(): Promise<Task[]>;
|
|
54
|
+
appendStepTransition(id: string, transition: StepTransition): Promise<void>;
|
|
55
|
+
createDiscussion(input: CreateDiscussionInput): Promise<Discussion>;
|
|
56
|
+
getDiscussions(sessionId: string): Promise<Discussion[]>;
|
|
57
|
+
getUnresolvedDiscussions(): Promise<Discussion[]>;
|
|
58
|
+
resolveDiscussion(id: string, decision: string): Promise<void>;
|
|
59
|
+
listDiscussions(filter?: {
|
|
60
|
+
priority?: string;
|
|
61
|
+
unresolved?: boolean;
|
|
62
|
+
}): Promise<Discussion[]>;
|
|
63
|
+
recordStepTokens(sessionId: string, flow: string, step: string, stepName: string, tokenCount: TokenCount): Promise<void>;
|
|
64
|
+
incrementStepCount(sessionId: string, flow: string, step: string, stepName: string, taskSummary: string): Promise<void>;
|
|
65
|
+
recordStepExit(sessionId: string, step: string): Promise<void>;
|
|
66
|
+
getStepTokenMetrics(sessionId: string): Promise<StepTokenMetrics[]>;
|
|
67
|
+
getStepTokenMetricsByFlow(flow: string): Promise<StepTokenMetrics[]>;
|
|
68
|
+
initSessionTokens(sessionId: string): Promise<void>;
|
|
69
|
+
recordSessionTokens(sessionId: string, tokenCount: TokenCount, apiTelemetry?: ApiTelemetry): Promise<void>;
|
|
70
|
+
getSessionTokens(sessionId: string): Promise<SessionTokenMetrics | null>;
|
|
71
|
+
getLastClosedTask(sessionId: string): Promise<Task | null>;
|
|
72
|
+
getStepTokenBreakdown(sessionId: string): Promise<StepTokenBreakdown[]>;
|
|
73
|
+
recordSubagentTokens(sessionId: string, parentSessionId: string, tokenCount: TokenCount, apiTelemetry?: ApiTelemetry): Promise<void>;
|
|
74
|
+
getSubagentTokens(parentSessionId: string): Promise<SubagentTokenMetrics[]>;
|
|
75
|
+
private rowToTask;
|
|
76
|
+
private rowToDiscussion;
|
|
77
|
+
private rowToStepTokenMetrics;
|
|
78
|
+
private rowToSessionTokenMetrics;
|
|
79
|
+
private rowToSubagentTokenMetrics;
|
|
80
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory System entity and interface definitions
|
|
3
|
+
*
|
|
4
|
+
* Manages three categories of Structured Memory: Task (Task State),
|
|
5
|
+
* Discussion (Discussion items), StepTokenMetrics (Flow Metrics).
|
|
6
|
+
*/
|
|
7
|
+
import { ApiTelemetry, TokenCount } from '../token';
|
|
8
|
+
/** Step transition record: written once per setStep call, appended in chronological order */
|
|
9
|
+
export interface StepTransition {
|
|
10
|
+
/** Source Step ID */
|
|
11
|
+
fromStep: string;
|
|
12
|
+
/** Destination Step ID */
|
|
13
|
+
toStep: string;
|
|
14
|
+
/** Transition timestamp (ISO 8601) */
|
|
15
|
+
at: string;
|
|
16
|
+
}
|
|
17
|
+
export interface Task {
|
|
18
|
+
id: string;
|
|
19
|
+
sessionId: string;
|
|
20
|
+
flow: string;
|
|
21
|
+
currentStep: string;
|
|
22
|
+
currentStepName: string;
|
|
23
|
+
startAt: string;
|
|
24
|
+
/** Task end time (ISO 8601), written by closeTask */
|
|
25
|
+
endAt?: string;
|
|
26
|
+
closed: boolean;
|
|
27
|
+
summary: string;
|
|
28
|
+
/** User's original request content (text within <user-request> tag), used for deduplication */
|
|
29
|
+
userRequest?: string;
|
|
30
|
+
/** Step transition history in chronological order. From the second record onward, dwell time can be computed from the `at` delta of adjacent records. */
|
|
31
|
+
stepTransitions?: StepTransition[];
|
|
32
|
+
}
|
|
33
|
+
export interface CreateTaskInput {
|
|
34
|
+
sessionId: string;
|
|
35
|
+
flow: string;
|
|
36
|
+
currentStep: string;
|
|
37
|
+
currentStepName: string;
|
|
38
|
+
startAt: string;
|
|
39
|
+
summary: string;
|
|
40
|
+
userRequest?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface Discussion {
|
|
43
|
+
id: string;
|
|
44
|
+
fromSessionId: string;
|
|
45
|
+
priority: 'high' | 'medium' | 'low';
|
|
46
|
+
importance: 1 | 2 | 3 | 4 | 5;
|
|
47
|
+
severity: 1 | 2 | 3 | 4 | 5;
|
|
48
|
+
issue: string;
|
|
49
|
+
reason: string;
|
|
50
|
+
solution: string;
|
|
51
|
+
decision?: string;
|
|
52
|
+
taskSummary: string;
|
|
53
|
+
createdAt: string;
|
|
54
|
+
resolvedAt?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface CreateDiscussionInput {
|
|
57
|
+
fromSessionId: string;
|
|
58
|
+
priority: 'high' | 'medium' | 'low';
|
|
59
|
+
importance: 1 | 2 | 3 | 4 | 5;
|
|
60
|
+
severity: 1 | 2 | 3 | 4 | 5;
|
|
61
|
+
issue: string;
|
|
62
|
+
reason: string;
|
|
63
|
+
solution: string;
|
|
64
|
+
taskSummary?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface StepTokenMetrics {
|
|
67
|
+
id: string;
|
|
68
|
+
sessionId: string;
|
|
69
|
+
flow: string;
|
|
70
|
+
step: string;
|
|
71
|
+
stepName: string;
|
|
72
|
+
stepInCount: number;
|
|
73
|
+
tokensConsumed: number;
|
|
74
|
+
/** Token distribution by source, independently accumulated per source */
|
|
75
|
+
tokensBySource: Record<string, number>;
|
|
76
|
+
taskSummary: string;
|
|
77
|
+
}
|
|
78
|
+
/** Per-Step Token summary */
|
|
79
|
+
export interface StepTokenBreakdown {
|
|
80
|
+
step: string;
|
|
81
|
+
stepName: string;
|
|
82
|
+
stepInCount: number;
|
|
83
|
+
tokensConsumed: number;
|
|
84
|
+
}
|
|
85
|
+
/** Session-level Token storage — hierarchical column design */
|
|
86
|
+
export interface SessionTokenMetrics {
|
|
87
|
+
sessionId: string;
|
|
88
|
+
/** Base types */
|
|
89
|
+
user: number;
|
|
90
|
+
assistant: number;
|
|
91
|
+
/** By purpose */
|
|
92
|
+
flowControl: number;
|
|
93
|
+
text: number;
|
|
94
|
+
tool: number;
|
|
95
|
+
reasoning: number;
|
|
96
|
+
/** LLM API telemetry (written only when the LLM returns data) */
|
|
97
|
+
apiInput: number;
|
|
98
|
+
apiOutput: number;
|
|
99
|
+
apiReasoning: number;
|
|
100
|
+
apiCacheRead: number;
|
|
101
|
+
apiCacheWrite: number;
|
|
102
|
+
/** Calibration factor = (apiInput + apiCacheRead + apiCacheWrite) / (user + assistant) */
|
|
103
|
+
scaleFactor: number;
|
|
104
|
+
/** Timestamp */
|
|
105
|
+
startedAt: string;
|
|
106
|
+
updatedAt: string;
|
|
107
|
+
}
|
|
108
|
+
/** Input parameters for recordSessionTokens — categorized by TokenCounter's 6 sources */
|
|
109
|
+
export interface RecordSessionTokensInput {
|
|
110
|
+
text: number;
|
|
111
|
+
user: number;
|
|
112
|
+
assistant: number;
|
|
113
|
+
flowControl: number;
|
|
114
|
+
tool: number;
|
|
115
|
+
reasoning: number;
|
|
116
|
+
}
|
|
117
|
+
/** Subagent Token storage — distinguished by role + API telemetry */
|
|
118
|
+
export interface SubagentTokenMetrics {
|
|
119
|
+
sessionId: string;
|
|
120
|
+
parentSessionId: string;
|
|
121
|
+
user: number;
|
|
122
|
+
assistant: number;
|
|
123
|
+
apiInput: number;
|
|
124
|
+
apiOutput: number;
|
|
125
|
+
apiReasoning: number;
|
|
126
|
+
apiCacheRead: number;
|
|
127
|
+
apiCacheWrite: number;
|
|
128
|
+
}
|
|
129
|
+
export interface IMemorySystem {
|
|
130
|
+
createTask(input: CreateTaskInput): Promise<Task>;
|
|
131
|
+
getTask(sessionId: string): Promise<Task | null>;
|
|
132
|
+
getActiveTask(sessionId: string): Promise<Task | null>;
|
|
133
|
+
updateStep(id: string, step: string, stepName: string): Promise<void>;
|
|
134
|
+
closeTask(id: string): Promise<void>;
|
|
135
|
+
listActiveTasks(): Promise<Task[]>;
|
|
136
|
+
createDiscussion(input: CreateDiscussionInput): Promise<Discussion>;
|
|
137
|
+
getDiscussions(sessionId: string): Promise<Discussion[]>;
|
|
138
|
+
getUnresolvedDiscussions(): Promise<Discussion[]>;
|
|
139
|
+
resolveDiscussion(id: string, decision: string): Promise<void>;
|
|
140
|
+
listDiscussions(filter?: {
|
|
141
|
+
priority?: string;
|
|
142
|
+
unresolved?: boolean;
|
|
143
|
+
}): Promise<Discussion[]>;
|
|
144
|
+
recordStepTokens(sessionId: string, flow: string, step: string, stepName: string, tokenCount: TokenCount): Promise<void>;
|
|
145
|
+
incrementStepCount(sessionId: string, flow: string, step: string, stepName: string, taskSummary: string): Promise<void>;
|
|
146
|
+
recordStepExit(sessionId: string, step: string): Promise<void>;
|
|
147
|
+
getStepTokenMetrics(sessionId: string): Promise<StepTokenMetrics[]>;
|
|
148
|
+
getStepTokenMetricsByFlow(flow: string): Promise<StepTokenMetrics[]>;
|
|
149
|
+
getLastClosedTask(sessionId: string): Promise<Task | null>;
|
|
150
|
+
getStepTokenBreakdown(sessionId: string): Promise<StepTokenBreakdown[]>;
|
|
151
|
+
initSessionTokens(sessionId: string): Promise<void>;
|
|
152
|
+
recordSessionTokens(sessionId: string, tokenCount: TokenCount, apiTelemetry?: ApiTelemetry): Promise<void>;
|
|
153
|
+
getSessionTokens(sessionId: string): Promise<SessionTokenMetrics | null>;
|
|
154
|
+
recordSubagentTokens(sessionId: string, parentSessionId: string, tokenCount: TokenCount, apiTelemetry?: ApiTelemetry): Promise<void>;
|
|
155
|
+
getSubagentTokens(parentSessionId: string): Promise<SubagentTokenMetrics[]>;
|
|
156
|
+
init(dataDir: string): Promise<void>;
|
|
157
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Manager
|
|
3
|
+
*
|
|
4
|
+
* Pure file-operation module: Template Scanning, Installation
|
|
5
|
+
* (including command file generation, regulation auto-install),
|
|
6
|
+
* Uninstall (including command file cleanup).
|
|
7
|
+
* Zero external dependencies, reads/writes filesystem by convention paths.
|
|
8
|
+
*/
|
|
9
|
+
import type { TemplateMeta } from './types.js';
|
|
10
|
+
export declare class TemplateConflictError extends Error {
|
|
11
|
+
constructor(flowName: string);
|
|
12
|
+
}
|
|
13
|
+
export declare function scanTemplates(projectDir: string): TemplateMeta[];
|
|
14
|
+
export interface InstallResult {
|
|
15
|
+
flowPath: string;
|
|
16
|
+
regulationPaths: string[];
|
|
17
|
+
codingStylePaths: string[];
|
|
18
|
+
dictionaryPath: string | null;
|
|
19
|
+
}
|
|
20
|
+
export declare function installTemplate(projectDir: string, templateId: string, options?: {
|
|
21
|
+
programmingLanguages?: string[];
|
|
22
|
+
overwrite?: boolean;
|
|
23
|
+
locale?: string;
|
|
24
|
+
}): InstallResult;
|
|
25
|
+
export declare function uninstallFlow(projectDir: string, flowName: string): void;
|
|
26
|
+
export declare function listInstalledFlows(projectDir: string): string[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Manager type definitions
|
|
3
|
+
*/
|
|
4
|
+
export interface TemplateMeta {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
category: string;
|
|
8
|
+
description: string;
|
|
9
|
+
version: string;
|
|
10
|
+
/** Associated slash command name (e.g., /pm-research) */
|
|
11
|
+
command: string;
|
|
12
|
+
/** Template file path (flow.md) */
|
|
13
|
+
flowPath: string;
|
|
14
|
+
/** Template bundle root directory */
|
|
15
|
+
bundleDir: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ModelRegistry — model → backend mapping table
|
|
3
|
+
*
|
|
4
|
+
* Selects the correct TokenizerBackend based on providerID + modelID.
|
|
5
|
+
* Unknown models fall back to cl100k_base (OpenAI GPT-4 encoding).
|
|
6
|
+
*/
|
|
7
|
+
import type { ModelInfo, TokenizerBackend } from './types.js';
|
|
8
|
+
/** Create the corresponding tokenizer backend based on model info */
|
|
9
|
+
export declare function resolveBackend(info: ModelInfo): TokenizerBackend;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MessagePack, TokenCount, ModelInfo } from './types.js';
|
|
2
|
+
export declare class TokenCounter {
|
|
3
|
+
private backend;
|
|
4
|
+
constructor(info: ModelInfo);
|
|
5
|
+
/** Encode text and return token count. Empty/whitespace returns 0 directly. */
|
|
6
|
+
countTokens(text: string): number;
|
|
7
|
+
/**
|
|
8
|
+
* Classify part token source by part.type and content.
|
|
9
|
+
*/
|
|
10
|
+
private classifyPartType;
|
|
11
|
+
/**
|
|
12
|
+
* Count tokens in a message and classify by source.
|
|
13
|
+
*/
|
|
14
|
+
countContextTokens(message: MessagePack): TokenCount;
|
|
15
|
+
/** Release backend resources */
|
|
16
|
+
dispose(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token counting module type definitions
|
|
3
|
+
*/
|
|
4
|
+
import type { Message, Part } from '@opencode-ai/sdk';
|
|
5
|
+
/** Token count classified by 6 sources */
|
|
6
|
+
export interface TokenCount {
|
|
7
|
+
user: number;
|
|
8
|
+
assistant: number;
|
|
9
|
+
text: number;
|
|
10
|
+
flowControl: number;
|
|
11
|
+
tool: number;
|
|
12
|
+
reasoning: number;
|
|
13
|
+
}
|
|
14
|
+
export interface MessagePack {
|
|
15
|
+
info: Message;
|
|
16
|
+
parts: Part[];
|
|
17
|
+
}
|
|
18
|
+
/** LLM API telemetry data — aligned with @opencode-ai/sdk tokens type */
|
|
19
|
+
export interface ApiTelemetry {
|
|
20
|
+
input: number;
|
|
21
|
+
output: number;
|
|
22
|
+
reasoning: number;
|
|
23
|
+
cache: {
|
|
24
|
+
read: number;
|
|
25
|
+
write: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** Model identifier — used to select the correct tokenizer */
|
|
29
|
+
export interface ModelInfo {
|
|
30
|
+
providerID: string;
|
|
31
|
+
modelID: string;
|
|
32
|
+
}
|
|
33
|
+
/** Tokenizer backend interface — each model family implements its own counting logic */
|
|
34
|
+
export interface TokenizerBackend {
|
|
35
|
+
/** Encode text and return token count (empty/whitespace returns 0) */
|
|
36
|
+
countTokens(text: string): number;
|
|
37
|
+
/** Release backend resources */
|
|
38
|
+
dispose(): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RGBA } from '@opentui/core';
|
|
2
|
+
import { type JSX } from 'solid-js';
|
|
3
|
+
export interface CollapsibleProps {
|
|
4
|
+
title: string;
|
|
5
|
+
defaultCollapsed?: boolean;
|
|
6
|
+
titleColor?: RGBA;
|
|
7
|
+
children: JSX.Element;
|
|
8
|
+
}
|
|
9
|
+
export declare function Collapsible(props: CollapsibleProps): JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task status data loading
|
|
3
|
+
*
|
|
4
|
+
* Loads status info for the current or previous task from IMemorySystem.
|
|
5
|
+
*/
|
|
6
|
+
import type { IMemorySystem } from '../../memory/types.js';
|
|
7
|
+
import type { TaskStatusData } from '../types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Load task status data for the specified session.
|
|
10
|
+
*
|
|
11
|
+
* Query logic:
|
|
12
|
+
* 1. Check active task first → active state
|
|
13
|
+
* 2. No active task → check last closed task → last state
|
|
14
|
+
* 3. Neither found → empty state
|
|
15
|
+
*/
|
|
16
|
+
export declare function loadTaskStatus(memory: IMemorySystem, sessionId: string): Promise<TaskStatusData>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token data loading
|
|
3
|
+
*
|
|
4
|
+
* Loads Session-level token distribution (source + step) from IMemorySystem.
|
|
5
|
+
* Session-level data comes from the session_tokens table, calibrated with display formulas.
|
|
6
|
+
* Step-level data comes from flowMetrics aggregation.
|
|
7
|
+
*/
|
|
8
|
+
import type { IMemorySystem } from '../../memory/types.js';
|
|
9
|
+
import type { TokenData } from '../types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Load token distribution data for the specified session.
|
|
12
|
+
*
|
|
13
|
+
* Session-level tokens are read from the session_tokens table with display formulas applied.
|
|
14
|
+
* Step-level tokens are read from flowMetrics aggregation (unchanged).
|
|
15
|
+
*/
|
|
16
|
+
export declare function loadTokenData(memory: IMemorySystem, sessionId: string): Promise<TokenData>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TUI extension module exports
|
|
3
|
+
*
|
|
4
|
+
* Exports TuiPluginModule for OpenCode TUI loading.
|
|
5
|
+
* OpenCode only reads the default export, not named exports.
|
|
6
|
+
* createTuiPlugin() is invoked immediately to produce a ready-to-use TuiPlugin function.
|
|
7
|
+
*/
|
|
8
|
+
import type { TuiPluginModule } from '@opencode-ai/plugin/tui';
|
|
9
|
+
declare const plugin: TuiPluginModule & {
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
export default plugin;
|
|
13
|
+
export type * from './types.js';
|