@vpxa/aikit 0.1.10 → 0.1.11
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/package.json +1 -1
- package/packages/indexer/dist/smart-index-scheduler.js +1 -1
- package/packages/server/dist/compression-interceptor.d.ts +12 -0
- package/packages/server/dist/compression-interceptor.js +1 -0
- package/packages/server/dist/server.js +2 -2
- package/packages/server/dist/tools/present/tool.js +1 -1
- package/packages/tools/dist/compact.d.ts +6 -0
- package/packages/tools/dist/compact.js +2 -2
- package/packages/tools/dist/compress-output.d.ts +38 -0
- package/packages/tools/dist/compress-output.js +1 -0
- package/packages/tools/dist/compression/delta-cache.d.ts +29 -0
- package/packages/tools/dist/compression/delta-cache.js +1 -0
- package/packages/tools/dist/compression/engine.d.ts +34 -0
- package/packages/tools/dist/compression/engine.js +4 -0
- package/packages/tools/dist/compression/litm.d.ts +20 -0
- package/packages/tools/dist/compression/litm.js +1 -0
- package/packages/tools/dist/compression/mmr.d.ts +24 -0
- package/packages/tools/dist/compression/mmr.js +1 -0
- package/packages/tools/dist/compression/rules/docker.d.ts +11 -0
- package/packages/tools/dist/compression/rules/docker.js +3 -0
- package/packages/tools/dist/compression/rules/generic.d.ts +11 -0
- package/packages/tools/dist/compression/rules/generic.js +3 -0
- package/packages/tools/dist/compression/rules/git.d.ts +11 -0
- package/packages/tools/dist/compression/rules/git.js +3 -0
- package/packages/tools/dist/compression/rules/index.d.ts +14 -0
- package/packages/tools/dist/compression/rules/index.js +1 -0
- package/packages/tools/dist/compression/rules/kubectl.d.ts +11 -0
- package/packages/tools/dist/compression/rules/kubectl.js +3 -0
- package/packages/tools/dist/compression/rules/lint.d.ts +11 -0
- package/packages/tools/dist/compression/rules/lint.js +3 -0
- package/packages/tools/dist/compression/rules/npm.d.ts +11 -0
- package/packages/tools/dist/compression/rules/npm.js +3 -0
- package/packages/tools/dist/compression/rules/test-runner.d.ts +11 -0
- package/packages/tools/dist/compression/rules/test-runner.js +3 -0
- package/packages/tools/dist/compression/scoring.d.ts +26 -0
- package/packages/tools/dist/compression/scoring.js +1 -0
- package/packages/tools/dist/compression/types.d.ts +61 -0
- package/packages/tools/dist/compression/types.js +1 -0
- package/packages/tools/dist/digest.d.ts +5 -0
- package/packages/tools/dist/digest.js +4 -4
- package/packages/tools/dist/index.d.ts +5 -1
- package/packages/tools/dist/index.js +1 -1
- package/packages/tools/dist/parse-output.d.ts +3 -1
- package/packages/tools/dist/parse-output.js +1 -1
- package/packages/tools/dist/truncation.d.ts +34 -1
- package/packages/tools/dist/truncation.js +10 -6
- package/packages/tui/dist/{App-DpjN3iS-.js → App-D8fednPY.js} +1 -1
- package/packages/tui/dist/App.js +1 -1
- package/packages/tui/dist/{CuratedPanel-BIamXLNy.js → CuratedPanel-BwkPKdX4.js} +1 -1
- package/packages/tui/dist/LogPanel-C6KagE0H.js +3320 -0
- package/packages/tui/dist/{SearchPanel-CpJGczAc.js → SearchPanel-BbvCaco0.js} +1 -1
- package/packages/tui/dist/{StatusPanel-BAbUxyqQ.js → StatusPanel-BFshFJU9.js} +1 -1
- package/packages/tui/dist/chunk-BSngPjfM.js +2 -0
- package/packages/tui/dist/{devtools-DMOZMn70.js → devtools-owCrRz12.js} +2 -2
- package/packages/tui/dist/hooks/useKBClient.js +1 -1
- package/packages/tui/dist/hooks/usePolling.js +1 -1
- package/packages/tui/dist/index.js +1 -1
- package/packages/tui/dist/{jsx-runtime-y6Gdq5PZ.js → jsx-runtime-B_2ewjsM.js} +7 -7
- package/packages/tui/dist/panels/CuratedPanel.js +1 -1
- package/packages/tui/dist/panels/LogPanel.js +1 -1
- package/packages/tui/dist/panels/SearchPanel.js +1 -1
- package/packages/tui/dist/panels/StatusPanel.js +1 -1
- package/packages/tui/dist/{react-D__J1GQe.js → react-sYq8CyFO.js} +1 -1
- package/packages/tui/dist/{useKBClient-C35iA4uG.js → useKBClient-BkBffCdd.js} +1 -1
- package/packages/tui/dist/{usePolling-BbjnRWgx.js → usePolling-D3y7u5cZ.js} +1 -1
- package/packages/tui/dist/LogPanel-Db-SeZhR.js +0 -3
- package/packages/tui/dist/chunk-D6axbAb-.js +0 -2
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//#region packages/tools/src/compression/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Compression mode determines how aggressively output is compressed.
|
|
4
|
+
*/
|
|
5
|
+
type CompressionMode = 'structural' | 'heuristic' | 'aggressive';
|
|
6
|
+
/**
|
|
7
|
+
* Context provided to compression rules for matching and processing.
|
|
8
|
+
*/
|
|
9
|
+
interface CompressionContext {
|
|
10
|
+
/** Raw output text (ANSI already stripped) */
|
|
11
|
+
text: string;
|
|
12
|
+
/** Detected tool/source (e.g., 'git', 'npm', 'vitest', 'docker') */
|
|
13
|
+
tool: string;
|
|
14
|
+
/** Compression mode */
|
|
15
|
+
mode: CompressionMode;
|
|
16
|
+
/** Maximum output characters */
|
|
17
|
+
maxChars: number;
|
|
18
|
+
/** Original character count before any processing */
|
|
19
|
+
originalChars: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Result from applying a compression rule.
|
|
23
|
+
*/
|
|
24
|
+
interface CompressionResult {
|
|
25
|
+
/** Compressed text */
|
|
26
|
+
text: string;
|
|
27
|
+
/** Original character count */
|
|
28
|
+
originalChars: number;
|
|
29
|
+
/** Compressed character count */
|
|
30
|
+
compressedChars: number;
|
|
31
|
+
/** Compression ratio (compressed / original) */
|
|
32
|
+
ratio: number;
|
|
33
|
+
/** Which rule was applied */
|
|
34
|
+
rule: string;
|
|
35
|
+
/** Detected tool */
|
|
36
|
+
tool: string;
|
|
37
|
+
/** Metadata about the compression */
|
|
38
|
+
_meta: {
|
|
39
|
+
truncated: boolean;
|
|
40
|
+
mode: CompressionMode;
|
|
41
|
+
sectionsKept?: number;
|
|
42
|
+
sectionsTotal?: number;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A compression rule that can match and process specific output formats.
|
|
47
|
+
*/
|
|
48
|
+
interface CompressionRule {
|
|
49
|
+
/** Unique rule name */
|
|
50
|
+
name: string;
|
|
51
|
+
/** Tool patterns this rule handles (regex or string) */
|
|
52
|
+
toolPatterns: (string | RegExp)[];
|
|
53
|
+
/** Priority (higher = checked first, default 0) */
|
|
54
|
+
priority: number;
|
|
55
|
+
/** Test if this rule can handle the given context */
|
|
56
|
+
match(ctx: CompressionContext): boolean;
|
|
57
|
+
/** Apply compression and return result text */
|
|
58
|
+
compress(ctx: CompressionContext): string;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { CompressionContext, CompressionMode, CompressionResult, CompressionRule };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -20,6 +20,11 @@ interface DigestOptions {
|
|
|
20
20
|
pinFields?: string[];
|
|
21
21
|
/** Segmentation strategy (default: 'paragraph') */
|
|
22
22
|
segmentation?: 'paragraph' | 'sentence' | 'line';
|
|
23
|
+
/**
|
|
24
|
+
* Enable MMR deduplication across segments (default: true).
|
|
25
|
+
* Prevents near-identical segments from consuming budget.
|
|
26
|
+
*/
|
|
27
|
+
dedup?: boolean;
|
|
23
28
|
}
|
|
24
29
|
interface DigestFieldEntry {
|
|
25
30
|
sourceId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{cosineSimilarity as e,estimateTokens as t,segment as n}from"./text-utils.js";const
|
|
2
|
-
`).map(e=>e.trim()).filter(e=>e.length>0);for(let t of n){let n=
|
|
1
|
+
import{cosineSimilarity as e,estimateTokens as t,segment as n}from"./text-utils.js";import{reorderBlocksLITM as r}from"./compression/litm.js";import{mmrSelect as i}from"./compression/mmr.js";const a=[`status`,`files`,`decisions`,`blockers`,`artifacts`,`next`],o={status:/\b(?:status|result)\s*[:=]/i,files:/\b(?:files?|modified|created|deleted)\s*[:=]/i,artifacts:/\b(?:artifacts?)\s*[:=]/i,decisions:/\b(?:decisions?|decided|chose|selected)\s*[:=]/i,blockers:/\b(?:blockers?|blocked|blocking)\s*[:=]/i,next:/\b(?:next\s*(?:steps?|actions?)|todo|follow.up)\s*[:=]/i},s={status:/(?:^|\b)(?:status|result)\s*[:=]\s*(.+)$/i,files:/(?:^|\b)(?:files?|modified|created|deleted)\s*[:=]\s*(.+)$/i,artifacts:/(?:^|\b)(?:artifacts?)\s*[:=]\s*(.+)$/i,decisions:/(?:^|\b)(?:decisions?|decided|chose|selected)\s*[:=]\s*(.+)$/i,blockers:/(?:^|\b)(?:blockers?|blocked|blocking)\s*[:=]\s*(.+)$/i,next:/(?:^|\b)(?:next\s*(?:steps?|actions?)|todo|follow.up)\s*[:=]\s*(.+)$/i},c=/\b(?:APPROVED|NEEDS_REVISION|BLOCKED|SUCCESS|PARTIAL|FAILED|ESCALATE)\b/i,l=.01;function u(e){let t=e??[...a];return[...new Set(t.map(e=>e.toLowerCase()))]}function d(e){return typeof e!=`number`||!Number.isFinite(e)||e<=0?1:e}function f(e,t){let n=new Set;for(let r of t)o[r]?.test(e)&&n.add(r);return t.includes(`status`)&&c.test(e)&&n.add(`status`),[...n]}function p(e,t){let n=t.split(`
|
|
2
|
+
`).map(e=>e.trim()).filter(e=>e.length>0);for(let t of n){let n=s[e]?.exec(t);if(n?.[1])return n[1].trim();if(e===`status`){let e=t.match(c);if(e)return e[0]}}return t.trim()}function m(e,t,n,r){e[t]||(e[t]=[]),e[t].push({sourceId:n,value:r})}function h(e,t,r,i){return e.map(e=>{let a=n(e.text,t).map((t,n)=>{let a=f(t,r);for(let n of a)m(i,n,e.id,p(n,t));return{index:n,text:t,pinnedFields:a,score:0}}),o=a.filter(e=>e.pinnedFields.length>0).reduce((e,t)=>e+t.text.length,0),s=a.filter(e=>e.pinnedFields.length===0).reduce((e,t)=>e+t.text.length,0);return{id:e.id,originalText:e.text,weight:d(e.weight),segments:a,pinnedChars:o,nonPinnedChars:s}})}function g(e,t){let n=new Map(e.map(e=>[e.id,0])),r=Math.max(0,t),i=e.filter(e=>e.nonPinnedChars>0);for(;r>l&&i.length>0;){let e=i.reduce((e,t)=>e+t.weight,0),t=0,a=[];for(let o of i){let i=n.get(o.id)??0,s=o.nonPinnedChars-i;if(s<=l)continue;let c=r*(o.weight/e),u=Math.min(c,s);n.set(o.id,i+u),t+=u,s-u>l&&a.push(o)}if(t<=l)break;r-=t,i=a}return n}function _(e){return e.map(e=>`[${e.id}]\n${e.text}`).join(`
|
|
3
3
|
|
|
4
|
-
`)}function
|
|
4
|
+
`)}function v(e,t){return e===0?0:t/e}async function y(n,a){let{sources:o,query:s,maxChars:c=4e3,pinFields:d,segmentation:f=`paragraph`}=a,p={},m=h(o,f,u(d),p),y=o.reduce((e,t)=>e+t.text.length,0);if(y<=c){let e=m.filter(e=>e.originalText.trim().length>0).map(e=>({id:e.id,text:e.originalText})),t=m.map(e=>({id:e.id,originalChars:e.originalText.length,keptChars:e.originalText.length,segmentsKept:e.segments.length,segmentsTotal:e.segments.length}));return{text:_(e),fields:p,sourceStats:t,totalOriginalChars:y,totalCompressedChars:y,ratio:y===0?0:1}}let b=await n.embedQuery(s);for(let t of m)for(let r of t.segments)r.pinnedFields.length>0||(r.score=e(b,await n.embed(r.text)));let x=g(m,c-m.reduce((e,t)=>e+t.pinnedChars,0)),S=[],C=[],w=0;for(let e of m){let n=x.get(e.id)??0,r=new Map,o=0,s=e.segments.filter(e=>e.pinnedFields.length===0).sort((e,n)=>n.score-e.score||t(e.text)-t(n.text)||e.index-n.index);if(a.dedup!==!1&&s.length>1){let e=i(s.map(e=>({index:e.index,text:e.text,relevance:e.score}))),t=new Set(e.map(e=>e.index));s=s.filter(e=>t.has(e.index))}let c;for(let e of s){let t=n-o;if(t<=l)break;if(e.text.length<=t+l){r.set(e.index,e.text),o+=e.text.length;continue}c||=e}let u=Math.floor(n-o);if(c&&u>0){let e=c.text.slice(0,u).trimEnd();e.length>0&&(r.set(c.index,e),o+=e.length)}let d=e.segments.filter(e=>e.pinnedFields.length>0||r.has(e.index)).map(e=>({index:e.index,text:r.get(e.index)??e.text})),f=d.reduce((e,t)=>e+t.text.length,0);S.push({id:e.id,originalChars:e.originalText.length,keptChars:f,segmentsKept:d.length,segmentsTotal:e.segments.length}),w+=f,d.length!==0&&C.push({id:e.id,text:d.map(e=>e.text).join(`
|
|
5
5
|
|
|
6
|
-
`)})}return{text:
|
|
6
|
+
`)})}return{text:_(r(C.map(e=>{let t=m.find(t=>t.id===e.id),n=t?Math.max(0,...t.segments.map(e=>e.score)):0;return{...e,maxScore:n}}))),fields:p,sourceStats:S,totalOriginalChars:y,totalCompressedChars:w,ratio:v(y,w)}}export{y as digest};
|
|
@@ -8,6 +8,10 @@ import { Checkpoint, checkpointLatest, checkpointList, checkpointLoad, checkpoin
|
|
|
8
8
|
import { CodemodChange, CodemodOptions, CodemodResult, CodemodRule, codemod } from "./codemod.js";
|
|
9
9
|
import { FileCache, FileCacheEntry, FileCacheStats } from "./file-cache.js";
|
|
10
10
|
import { CompactOptions, CompactResult, compact } from "./compact.js";
|
|
11
|
+
import { CompressionContext, CompressionMode, CompressionResult, CompressionRule } from "./compression/types.js";
|
|
12
|
+
import { compressOutput, detectOutputTool, getRegisteredRules, registerRule, registerRules } from "./compression/engine.js";
|
|
13
|
+
import { CompressOutputOptions, compressTerminalOutput } from "./compress-output.js";
|
|
14
|
+
import { bpeSurprise, scoreLine, scoreLines, shannonEntropy } from "./compression/scoring.js";
|
|
11
15
|
import { TransformOptions, TransformResult, dataTransform } from "./data-transform.js";
|
|
12
16
|
import { DeadSymbol, DeadSymbolOptions, DeadSymbolResult, findDeadSymbols } from "./dead-symbols.js";
|
|
13
17
|
import { DelegateOptions, DelegateResult, delegate, delegateListModels } from "./delegate.js";
|
|
@@ -54,4 +58,4 @@ import { WatchEvent, WatchHandle, WatchOptions, watchList, watchStart, watchStop
|
|
|
54
58
|
import { WebFetchMode, WebFetchOptions, WebFetchResult, webFetch } from "./web-fetch.js";
|
|
55
59
|
import { WebSearchOptions, WebSearchResult, WebSearchResultItem, parseSearchResults, webSearch } from "./web-search.js";
|
|
56
60
|
import { Workset, addToWorkset, deleteWorkset, getWorkset, listWorksets, removeFromWorkset, saveWorkset } from "./workset.js";
|
|
57
|
-
export { type AuditCheck, type AuditData, type AuditOptions, type AuditRecommendation, type BatchOperation, type BatchOptions, type BatchResult, type ChangelogEntry, type ChangelogFormat, type ChangelogOptions, type ChangelogResult, type CheckOptions, type CheckResult, type CheckSummaryResult, type Checkpoint, type ClassifyTrigger, type CodemodChange, type CodemodOptions, type CodemodResult, type CodemodRule, type CompactOptions, type CompactResult, type ConstraintRef, type DeadSymbol, type DeadSymbolOptions, type DeadSymbolResult, type DelegateOptions, type DelegateResult, type DiffChange, type DiffFile, type DiffHunk, type DiffParseOptions, type DigestFieldEntry, type DigestOptions, type DigestResult, type DigestSource, type DogfoodLogEntry, type DogfoodLogGroupedEntry, type DogfoodLogOptions, type DogfoodLogResult, type EncodeOperation, type EncodeOptions, type EncodeResult, type EnvInfoOptions, type EnvInfoResult, type EvalOptions, type EvalResult, type EvidenceEntry, type EvidenceMapAction, type EvidenceMapResult, type EvidenceMapState, type EvidenceStatus, type Example, FileCache, type FileCacheEntry, type FileCacheStats, type FileMetrics, type FileSummaryOptions, type FileSummaryResult, type FindExamplesOptions, type FindExamplesResult, type FindOptions, type FindResult, type FindResults, type ForgeClassifyCeremony, type ForgeClassifyOptions, type ForgeClassifyResult, type ForgeGroundOptions, type ForgeGroundResult, type ForgeTier, type GateDecision, type GateResult, type GitContextOptions, type GitContextResult, type GraphAugmentOptions, type GraphAugmentedResult, type GraphQueryOptions, type GraphQueryResult, type GuideRecommendation, type GuideResult, type HealthCheck, type HealthResult, type HttpMethod, type HttpRequestOptions, type HttpRequestResult, type KBError, type KBErrorCode, type KBNextHint, type KBResponse, type KBResponseMeta, type LaneDiffEntry, type LaneDiffResult, type LaneMergeResult, type LaneMeta, type ManagedProcess, type MeasureOptions, type MeasureResult, type OnboardMode, type OnboardOptions, type OnboardResult, type OnboardStepResult, type ParsedError, type ParsedGitStatus, type ParsedOutput, type ParsedTestResult, type ParsedTestSummary, type QueueItem, type QueueState, type RegexTestOptions, type RegexTestResult, type RenameChange, type RenameOptions, type RenameResult, type ReplayEntry, type ReplayOptions, type RestorePoint, type SafetyGate, type SafetyGateResult, type SchemaValidateOptions, type SchemaValidateResult, type ScopeMapEntry, type ScopeMapOptions, type ScopeMapResult, type Snippet, type SnippetAction, type SnippetOptions, type SnippetResult, type StashEntry, type StratumCard, type StratumCardOptions, type StratumCardResult, type SymbolGraphContext, type SymbolInfo, type SymbolOptions, type TestRunOptions, type TestRunResult, type TimeOptions, type TimeResult, type TraceNode, type TraceOptions, type TraceResult, type TransformOptions, type TransformResult, type TypedUnknownSeed, type UnknownType, type ValidationError, type WatchEvent, type WatchHandle, type WatchOptions, type WebFetchMode, type WebFetchOptions, type WebFetchResult, type WebSearchOptions, type WebSearchResult, type WebSearchResultItem, type Workset, addToWorkset, analyzeFile, audit, autoClaimTestFailures, batch, bookendReorder, changelog, check, checkpointLatest, checkpointList, checkpointLoad, checkpointSave, classifyExitCode, codemod, compact, cosineSimilarity, createRestorePoint, dataTransform, delegate, delegateListModels, deleteWorkset, diffParse, digest, dogfoodLog, encode, envInfo, errorResponse, escapeRegExp, estimateTokens, evaluate, evidenceMap, fileSummary, find, findDeadSymbols, findExamples, forgeClassify, forgeGround, formatChangelog, getWorkset, gitContext, graphAugmentSearch, graphQuery, guide, headTailTruncate, health, httpRequest, laneCreate, laneDiff, laneDiscard, laneList, laneMerge, laneStatus, listRestorePoints, listWorksets, measure, okResponse, onboard, paragraphTruncate, parseBiome, parseGitStatus, parseOutput, parseSearchResults, parseTsc, parseVitest, processList, processLogs, processStart, processStatus, processStop, queueClear, queueCreate, queueDelete, queueDone, queueFail, queueGet, queueList, queueNext, queuePush, regexTest, removeFromWorkset, rename, replayAppend, replayCapture, replayClear, replayList, replayTrim, resolvePath, restoreFromPoint, saveWorkset, schemaValidate, scopeMap, segment, snippet, stashClear, stashDelete, stashGet, stashList, stashSet, stratumCard, summarizeCheckResult, symbol, testRun, timeUtils, trace, truncateToTokenBudget, watchList, watchStart, watchStop, webFetch, webSearch };
|
|
61
|
+
export { type AuditCheck, type AuditData, type AuditOptions, type AuditRecommendation, type BatchOperation, type BatchOptions, type BatchResult, type ChangelogEntry, type ChangelogFormat, type ChangelogOptions, type ChangelogResult, type CheckOptions, type CheckResult, type CheckSummaryResult, type Checkpoint, type ClassifyTrigger, type CodemodChange, type CodemodOptions, type CodemodResult, type CodemodRule, type CompactOptions, type CompactResult, type CompressOutputOptions, type CompressionContext, type CompressionMode, type CompressionResult, type CompressionRule, type ConstraintRef, type DeadSymbol, type DeadSymbolOptions, type DeadSymbolResult, type DelegateOptions, type DelegateResult, type DiffChange, type DiffFile, type DiffHunk, type DiffParseOptions, type DigestFieldEntry, type DigestOptions, type DigestResult, type DigestSource, type DogfoodLogEntry, type DogfoodLogGroupedEntry, type DogfoodLogOptions, type DogfoodLogResult, type EncodeOperation, type EncodeOptions, type EncodeResult, type EnvInfoOptions, type EnvInfoResult, type EvalOptions, type EvalResult, type EvidenceEntry, type EvidenceMapAction, type EvidenceMapResult, type EvidenceMapState, type EvidenceStatus, type Example, FileCache, type FileCacheEntry, type FileCacheStats, type FileMetrics, type FileSummaryOptions, type FileSummaryResult, type FindExamplesOptions, type FindExamplesResult, type FindOptions, type FindResult, type FindResults, type ForgeClassifyCeremony, type ForgeClassifyOptions, type ForgeClassifyResult, type ForgeGroundOptions, type ForgeGroundResult, type ForgeTier, type GateDecision, type GateResult, type GitContextOptions, type GitContextResult, type GraphAugmentOptions, type GraphAugmentedResult, type GraphQueryOptions, type GraphQueryResult, type GuideRecommendation, type GuideResult, type HealthCheck, type HealthResult, type HttpMethod, type HttpRequestOptions, type HttpRequestResult, type KBError, type KBErrorCode, type KBNextHint, type KBResponse, type KBResponseMeta, type LaneDiffEntry, type LaneDiffResult, type LaneMergeResult, type LaneMeta, type ManagedProcess, type MeasureOptions, type MeasureResult, type OnboardMode, type OnboardOptions, type OnboardResult, type OnboardStepResult, type ParsedError, type ParsedGitStatus, type ParsedOutput, type ParsedTestResult, type ParsedTestSummary, type QueueItem, type QueueState, type RegexTestOptions, type RegexTestResult, type RenameChange, type RenameOptions, type RenameResult, type ReplayEntry, type ReplayOptions, type RestorePoint, type SafetyGate, type SafetyGateResult, type SchemaValidateOptions, type SchemaValidateResult, type ScopeMapEntry, type ScopeMapOptions, type ScopeMapResult, type Snippet, type SnippetAction, type SnippetOptions, type SnippetResult, type StashEntry, type StratumCard, type StratumCardOptions, type StratumCardResult, type SymbolGraphContext, type SymbolInfo, type SymbolOptions, type TestRunOptions, type TestRunResult, type TimeOptions, type TimeResult, type TraceNode, type TraceOptions, type TraceResult, type TransformOptions, type TransformResult, type TypedUnknownSeed, type UnknownType, type ValidationError, type WatchEvent, type WatchHandle, type WatchOptions, type WebFetchMode, type WebFetchOptions, type WebFetchResult, type WebSearchOptions, type WebSearchResult, type WebSearchResultItem, type Workset, addToWorkset, analyzeFile, audit, autoClaimTestFailures, batch, bookendReorder, bpeSurprise, changelog, check, checkpointLatest, checkpointList, checkpointLoad, checkpointSave, classifyExitCode, codemod, compact, compressOutput, compressTerminalOutput, cosineSimilarity, createRestorePoint, dataTransform, delegate, delegateListModels, deleteWorkset, detectOutputTool, diffParse, digest, dogfoodLog, encode, envInfo, errorResponse, escapeRegExp, estimateTokens, evaluate, evidenceMap, fileSummary, find, findDeadSymbols, findExamples, forgeClassify, forgeGround, formatChangelog, getRegisteredRules, getWorkset, gitContext, graphAugmentSearch, graphQuery, guide, headTailTruncate, health, httpRequest, laneCreate, laneDiff, laneDiscard, laneList, laneMerge, laneStatus, listRestorePoints, listWorksets, measure, okResponse, onboard, paragraphTruncate, parseBiome, parseGitStatus, parseOutput, parseSearchResults, parseTsc, parseVitest, processList, processLogs, processStart, processStatus, processStop, queueClear, queueCreate, queueDelete, queueDone, queueFail, queueGet, queueList, queueNext, queuePush, regexTest, registerRule, registerRules, removeFromWorkset, rename, replayAppend, replayCapture, replayClear, replayList, replayTrim, resolvePath, restoreFromPoint, saveWorkset, schemaValidate, scopeMap, scoreLine, scoreLines, segment, shannonEntropy, snippet, stashClear, stashDelete, stashGet, stashList, stashSet, stratumCard, summarizeCheckResult, symbol, testRun, timeUtils, trace, truncateToTokenBudget, watchList, watchStart, watchStop, webFetch, webSearch };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseBiome as e,parseGitStatus as t,parseOutput as n,parseTsc as r,parseVitest as i}from"./parse-output.js";import{check as a,summarizeCheckResult as o}from"./check.js";import{escapeRegExp as s}from"./regex-utils.js";import{findDeadSymbols as c}from"./dead-symbols.js";import{health as l}from"./health.js";import{resolvePath as u}from"./path-resolver.js";import{bookendReorder as d,cosineSimilarity as f,estimateTokens as p,segment as m}from"./text-utils.js";import{errorResponse as h,okResponse as g}from"./response-envelope.js";import{audit as _}from"./audit.js";import{batch as v}from"./batch.js";import{changelog as y,formatChangelog as b}from"./changelog.js";import{checkpointLatest as x,checkpointList as S,checkpointLoad as C,checkpointSave as w}from"./checkpoint.js";import{createRestorePoint as T,listRestorePoints as E,restoreFromPoint as D}from"./restore-points.js";import{codemod as O}from"./codemod.js";import{
|
|
1
|
+
import{parseBiome as e,parseGitStatus as t,parseOutput as n,parseTsc as r,parseVitest as i}from"./parse-output.js";import{check as a,summarizeCheckResult as o}from"./check.js";import{escapeRegExp as s}from"./regex-utils.js";import{findDeadSymbols as c}from"./dead-symbols.js";import{health as l}from"./health.js";import{resolvePath as u}from"./path-resolver.js";import{bookendReorder as d,cosineSimilarity as f,estimateTokens as p,segment as m}from"./text-utils.js";import{errorResponse as h,okResponse as g}from"./response-envelope.js";import{audit as _}from"./audit.js";import{batch as v}from"./batch.js";import{changelog as y,formatChangelog as b}from"./changelog.js";import{checkpointLatest as x,checkpointList as S,checkpointLoad as C,checkpointSave as w}from"./checkpoint.js";import{createRestorePoint as T,listRestorePoints as E,restoreFromPoint as D}from"./restore-points.js";import{codemod as O}from"./codemod.js";import{bpeSurprise as k,scoreLine as A,scoreLines as j,shannonEntropy as M}from"./compression/scoring.js";import{compact as N}from"./compact.js";import{compressOutput as P,detectOutputTool as F,getRegisteredRules as I,registerRule as L,registerRules as R}from"./compression/engine.js";import{compressTerminalOutput as z}from"./compress-output.js";import{dataTransform as B}from"./data-transform.js";import{delegate as V,delegateListModels as H}from"./delegate.js";import{diffParse as U}from"./diff-parse.js";import{digest as W}from"./digest.js";import{dogfoodLog as G}from"./dogfood-log.js";import{encode as K}from"./encode.js";import{envInfo as q}from"./env-info.js";import{evaluate as J}from"./eval.js";import{autoClaimTestFailures as Y,evidenceMap as X}from"./evidence-map.js";import{FileCache as Z}from"./file-cache.js";import{fileSummary as Q}from"./file-summary.js";import{findExamples as $}from"./find-examples.js";import{find as ee}from"./find.js";import{forgeClassify as te}from"./forge-classify.js";import{scopeMap as ne}from"./scope-map.js";import{forgeGround as re}from"./forge-ground.js";import{gitContext as ie}from"./git-context.js";import{graphAugmentSearch as ae,graphQuery as oe}from"./graph-query.js";import{guide as se}from"./guide.js";import{headTailTruncate as ce,paragraphTruncate as le,truncateToTokenBudget as ue}from"./truncation.js";import{httpRequest as de}from"./http-request.js";import{laneCreate as fe,laneDiff as pe,laneDiscard as me,laneList as he,laneMerge as ge,laneStatus as _e}from"./lane.js";import{analyzeFile as ve,measure as ye}from"./measure.js";import{onboard as be}from"./onboard.js";import{processList as xe,processLogs as Se,processStart as Ce,processStatus as we,processStop as Te}from"./process-manager.js";import{queueClear as Ee,queueCreate as De,queueDelete as Oe,queueDone as ke,queueFail as Ae,queueGet as je,queueList as Me,queueNext as Ne,queuePush as Pe}from"./queue.js";import{regexTest as Fe}from"./regex-test.js";import{rename as Ie}from"./rename.js";import{replayAppend as Le,replayCapture as Re,replayClear as ze,replayList as Be,replayTrim as Ve}from"./replay.js";import{schemaValidate as He}from"./schema-validate.js";import{snippet as Ue}from"./snippet.js";import{stashClear as We,stashDelete as Ge,stashGet as Ke,stashList as qe,stashSet as Je}from"./stash.js";import{stratumCard as Ye}from"./stratum-card.js";import{symbol as Xe}from"./symbol.js";import{classifyExitCode as Ze,testRun as Qe}from"./test-run.js";import{timeUtils as $e}from"./time-utils.js";import{trace as et}from"./trace.js";import{watchList as tt,watchStart as nt,watchStop as rt}from"./watch.js";import{webFetch as it}from"./web-fetch.js";import{parseSearchResults as at,webSearch as ot}from"./web-search.js";import{addToWorkset as st,deleteWorkset as ct,getWorkset as lt,listWorksets as ut,removeFromWorkset as dt,saveWorkset as ft}from"./workset.js";export{Z as FileCache,st as addToWorkset,ve as analyzeFile,_ as audit,Y as autoClaimTestFailures,v as batch,d as bookendReorder,k as bpeSurprise,y as changelog,a as check,x as checkpointLatest,S as checkpointList,C as checkpointLoad,w as checkpointSave,Ze as classifyExitCode,O as codemod,N as compact,P as compressOutput,z as compressTerminalOutput,f as cosineSimilarity,T as createRestorePoint,B as dataTransform,V as delegate,H as delegateListModels,ct as deleteWorkset,F as detectOutputTool,U as diffParse,W as digest,G as dogfoodLog,K as encode,q as envInfo,h as errorResponse,s as escapeRegExp,p as estimateTokens,J as evaluate,X as evidenceMap,Q as fileSummary,ee as find,c as findDeadSymbols,$ as findExamples,te as forgeClassify,re as forgeGround,b as formatChangelog,I as getRegisteredRules,lt as getWorkset,ie as gitContext,ae as graphAugmentSearch,oe as graphQuery,se as guide,ce as headTailTruncate,l as health,de as httpRequest,fe as laneCreate,pe as laneDiff,me as laneDiscard,he as laneList,ge as laneMerge,_e as laneStatus,E as listRestorePoints,ut as listWorksets,ye as measure,g as okResponse,be as onboard,le as paragraphTruncate,e as parseBiome,t as parseGitStatus,n as parseOutput,at as parseSearchResults,r as parseTsc,i as parseVitest,xe as processList,Se as processLogs,Ce as processStart,we as processStatus,Te as processStop,Ee as queueClear,De as queueCreate,Oe as queueDelete,ke as queueDone,Ae as queueFail,je as queueGet,Me as queueList,Ne as queueNext,Pe as queuePush,Fe as regexTest,L as registerRule,R as registerRules,dt as removeFromWorkset,Ie as rename,Le as replayAppend,Re as replayCapture,ze as replayClear,Be as replayList,Ve as replayTrim,u as resolvePath,D as restoreFromPoint,ft as saveWorkset,He as schemaValidate,ne as scopeMap,A as scoreLine,j as scoreLines,m as segment,M as shannonEntropy,Ue as snippet,We as stashClear,Ge as stashDelete,Ke as stashGet,qe as stashList,Je as stashSet,Ye as stratumCard,o as summarizeCheckResult,Xe as symbol,Qe as testRun,$e as timeUtils,et as trace,ue as truncateToTokenBudget,tt as watchList,nt as watchStart,rt as watchStop,it as webFetch,ot as webSearch};
|
|
@@ -59,6 +59,8 @@ type ParsedOutput = {
|
|
|
59
59
|
* Example line: `src/foo.ts(10,5): error TS2339: Property 'x' does not exist`
|
|
60
60
|
*/
|
|
61
61
|
declare function parseTsc(output: string): ParsedError[];
|
|
62
|
+
/** Strip ANSI escape codes from terminal output */
|
|
63
|
+
declare function stripAnsi(text: string): string;
|
|
62
64
|
/**
|
|
63
65
|
* Parse vitest run output into structured test results.
|
|
64
66
|
*/
|
|
@@ -79,4 +81,4 @@ declare function parseGitStatus(output: string): ParsedGitStatus;
|
|
|
79
81
|
*/
|
|
80
82
|
declare function parseOutput(output: string, tool?: string): ParsedOutput;
|
|
81
83
|
//#endregion
|
|
82
|
-
export { ParsedError, ParsedGitStatus, ParsedOutput, ParsedTestResult, ParsedTestSummary, parseBiome, parseGitStatus, parseOutput, parseTsc, parseVitest };
|
|
84
|
+
export { ParsedError, ParsedGitStatus, ParsedOutput, ParsedTestResult, ParsedTestSummary, parseBiome, parseGitStatus, parseOutput, parseTsc, parseVitest, stripAnsi };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function e(e){let t=[];for(let n of e.matchAll(/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+(TS\d+):\s+(.+)$/gm))t.push({file:n[1],line:Number.parseInt(n[2],10),column:Number.parseInt(n[3],10),severity:n[4],code:n[5],message:n[6]});if(t.length===0)for(let n of e.matchAll(/^(.+?):(\d+):(\d+)\s+-\s+(error|warning)\s+(TS\d+):\s+(.+)$/gm))t.push({file:n[1],line:Number.parseInt(n[2],10),column:Number.parseInt(n[3],10),severity:n[4],code:n[5],message:n[6]});return t}function t(e){return e.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g,``)}function n(e){let n=t(e),r=[];for(let e of n.matchAll(/^\s*([✓✕×-])\s+(.+?)(?:\s+(\d+)ms)?$/gm)){let t=e[1],n=t===`✓`?`pass`:t===`-`?`skip`:`fail`;r.push({name:e[2].trim(),status:n,duration:e[3]?Number.parseInt(e[3],10):void 0})}for(let e of n.matchAll(/^\s*([✓✕×])\s+(\S+\.test\.\w+)\s+\((\d+)\s+tests?\)\s*(\d+ms)?$/gm)){let t=e[1]===`✓`?`pass`:`fail`;r.push({name:e[2],file:e[2],status:t,duration:e[4]?Number.parseInt(e[4],10):void 0})}let i=/Tests\s+(?:(\d+)\s+passed)?(?:\s*\|\s*)?(?:(\d+)\s+failed)?(?:\s*\|\s*)?(?:(\d+)\s+skipped)?\s*\((\d+)\)/.exec(n),a=i?Number.parseInt(i[1]??`0`,10):r.filter(e=>e.status===`pass`).length,o=i?Number.parseInt(i[2]??`0`,10):r.filter(e=>e.status===`fail`).length,s=i?Number.parseInt(i[3]??`0`,10):r.filter(e=>e.status===`skip`).length,c=/Duration\s+(\d+(?:\.\d+)?)(?:ms|s)/.exec(n),l=c?c[0].includes(`s`)&&!c[0].includes(`ms`)?Number.parseFloat(c[1])*1e3:Number.parseFloat(c[1]):void 0,u=/Test Files\s+(\d+)\s+passed/.exec(n);return{tests:r,passed:a,failed:o,skipped:s,duration:l,suites:u?Number.parseInt(u[1],10):void 0}}function r(e){let t=[];for(let n of e.matchAll(/^(.+?):(\d+):(\d+)\s+([\w/]+)\s+━+$/gm)){let r=n[1],i=Number.parseInt(n[2],10),a=Number.parseInt(n[3],10),o=n[4],s=e.slice((n.index??0)+n[0].length,(n.index??0)+n[0].length+500),c=/^\s*[×!i]\s+(.+)$/m.exec(s),l=c?c[1].trim():o,u=o.includes(`lint`)?`warning`:`error`;t.push({file:r,line:i,column:a,severity:u,code:o,message:l})}return t}function i(e){let t=[],n=[],r=[],i;for(let o of e.split(`
|
|
2
|
-
`)){if(!o)continue;if(o.startsWith(`## `)){i=o.slice(3).split(`...`)[0];continue}let e=o[0],s=o[1],c=o.slice(3).trim();e===`?`&&s===`?`?r.push(c):(e!==` `&&e!==`?`&&t.push({status:a(e),file:c}),s!==` `&&s!==`?`&&n.push({status:a(s),file:c}))}return{staged:t,unstaged:n,untracked:r,branch:i}}function a(e){return{M:`modified`,A:`added`,D:`deleted`,R:`renamed`,C:`copied`,U:`unmerged`}[e]??e}function o(t,a){let o=a??s(t);switch(o){case`tsc`:return{tool:`tsc`,errors:e(t)};case`vitest`:return{tool:`vitest`,summary:n(t)};case`biome`:return{tool:`biome`,errors:r(t)};case`git-status`:return{tool:`git-status`,status:i(t)};default:throw Error(`Unknown tool: ${o}. Supported: tsc, vitest, biome, git-status`)}}function s(e){return e.includes(`error TS`)||/\(\d+,\d+\):\s+error/.test(e)?`tsc`:e.includes(`vitest`)||e.includes(`Test Files`)||e.includes(`✓`)?`vitest`:e.includes(`biome`)||/\w+\/\w+\s+━+/.test(e)?`biome`:/^##\s/.test(e)||/^[MADRCU?! ]{2}\s/.test(e)?`git-status`:`unknown`}export{r as parseBiome,i as parseGitStatus,o as parseOutput,e as parseTsc,n as parseVitest};
|
|
2
|
+
`)){if(!o)continue;if(o.startsWith(`## `)){i=o.slice(3).split(`...`)[0];continue}let e=o[0],s=o[1],c=o.slice(3).trim();e===`?`&&s===`?`?r.push(c):(e!==` `&&e!==`?`&&t.push({status:a(e),file:c}),s!==` `&&s!==`?`&&n.push({status:a(s),file:c}))}return{staged:t,unstaged:n,untracked:r,branch:i}}function a(e){return{M:`modified`,A:`added`,D:`deleted`,R:`renamed`,C:`copied`,U:`unmerged`}[e]??e}function o(t,a){let o=a??s(t);switch(o){case`tsc`:return{tool:`tsc`,errors:e(t)};case`vitest`:return{tool:`vitest`,summary:n(t)};case`biome`:return{tool:`biome`,errors:r(t)};case`git-status`:return{tool:`git-status`,status:i(t)};default:throw Error(`Unknown tool: ${o}. Supported: tsc, vitest, biome, git-status`)}}function s(e){return e.includes(`error TS`)||/\(\d+,\d+\):\s+error/.test(e)?`tsc`:e.includes(`vitest`)||e.includes(`Test Files`)||e.includes(`✓`)?`vitest`:e.includes(`biome`)||/\w+\/\w+\s+━+/.test(e)?`biome`:/^##\s/.test(e)||/^[MADRCU?! ]{2}\s/.test(e)?`git-status`:`unknown`}export{r as parseBiome,i as parseGitStatus,o as parseOutput,e as parseTsc,n as parseVitest,t as stripAnsi};
|
|
@@ -5,6 +5,26 @@
|
|
|
5
5
|
* Head/tail split: preserves both the beginning (context/setup) and
|
|
6
6
|
* end (errors/results/stack traces) of content. Snaps to line boundaries.
|
|
7
7
|
*/
|
|
8
|
+
/** Metadata about truncation for transparency */
|
|
9
|
+
interface TruncationMeta {
|
|
10
|
+
/** Whether the text was actually truncated */
|
|
11
|
+
truncated: boolean;
|
|
12
|
+
/** Original character count before truncation */
|
|
13
|
+
originalChars: number;
|
|
14
|
+
/** Character count after truncation */
|
|
15
|
+
truncatedChars: number;
|
|
16
|
+
/** Number of lines/paragraphs omitted */
|
|
17
|
+
omittedCount: number;
|
|
18
|
+
/** Type of truncation applied */
|
|
19
|
+
strategy: 'head-tail' | 'paragraph' | 'token-budget' | 'none';
|
|
20
|
+
}
|
|
21
|
+
/** Result of a truncation operation with metadata */
|
|
22
|
+
interface TruncationResult {
|
|
23
|
+
/** The truncated text */
|
|
24
|
+
text: string;
|
|
25
|
+
/** Truncation metadata for transparency */
|
|
26
|
+
_meta: TruncationMeta;
|
|
27
|
+
}
|
|
8
28
|
/**
|
|
9
29
|
* Truncate text keeping both head and tail portions.
|
|
10
30
|
* Critical for process output where errors appear at the end.
|
|
@@ -29,5 +49,18 @@ declare function paragraphTruncate(text: string, maxLen: number): string;
|
|
|
29
49
|
* @returns Original text if within budget, or truncated with notice
|
|
30
50
|
*/
|
|
31
51
|
declare function truncateToTokenBudget(text: string, maxTokens: number): string;
|
|
52
|
+
/**
|
|
53
|
+
* Head-tail truncation with metadata.
|
|
54
|
+
* Same as headTailTruncate but returns a TruncationResult with _meta.
|
|
55
|
+
*/
|
|
56
|
+
declare function headTailTruncateWithMeta(text: string, maxLen: number, headRatio?: number): TruncationResult;
|
|
57
|
+
/**
|
|
58
|
+
* Paragraph truncation with metadata.
|
|
59
|
+
*/
|
|
60
|
+
declare function paragraphTruncateWithMeta(text: string, maxLen: number): TruncationResult;
|
|
61
|
+
/**
|
|
62
|
+
* Token-budget truncation with metadata.
|
|
63
|
+
*/
|
|
64
|
+
declare function truncateToTokenBudgetWithMeta(text: string, maxTokens: number): TruncationResult;
|
|
32
65
|
//#endregion
|
|
33
|
-
export { headTailTruncate, paragraphTruncate, truncateToTokenBudget };
|
|
66
|
+
export { TruncationMeta, TruncationResult, headTailTruncate, headTailTruncateWithMeta, paragraphTruncate, paragraphTruncateWithMeta, truncateToTokenBudget, truncateToTokenBudgetWithMeta };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
function
|
|
2
|
-
`),c
|
|
3
|
-
`),f
|
|
4
|
-
`).length} + last ${
|
|
5
|
-
`).length} lines]\n\n${
|
|
1
|
+
import{estimateTokens as e}from"./text-utils.js";const t=.6;function n(e,n,r=t){if(e.length<=n)return e;let i=Math.max(0,n-120),a=Math.floor(i*r),o=i-a,s=e.slice(0,a),c=s.lastIndexOf(`
|
|
2
|
+
`),l=c>0?s.slice(0,c):s,u=e.length-o,d=e.slice(u),f=d.indexOf(`
|
|
3
|
+
`),p=f>=0?d.slice(f+1):d,m=e.length-l.length-p.length,h=1,g=l.length,_=e.length-p.length;for(let t=g;t<_;t++)e.charCodeAt(t)===10&&h++;return`${l}\n\n[… ${h} lines / ${(m/1024).toFixed(1)}KB truncated — showing first ${l.split(`
|
|
4
|
+
`).length} + last ${p.split(`
|
|
5
|
+
`).length} lines]\n\n${p}`}function r(e,t){if(e.length<=t)return e;let n=Math.max(0,t-200),r=e.slice(n,t).lastIndexOf(`
|
|
6
6
|
|
|
7
|
-
`),i=r>=0?n+r:t,a=e.slice(0,i).trimEnd(),o=Math.round(i/e.length*100);return`${a}\n\n---\n*[Truncated at ${i.toLocaleString()} chars — ${o}% of original content]*`}function
|
|
7
|
+
`),i=r>=0?n+r:t,a=e.slice(0,i).trimEnd(),o=Math.round(i/e.length*100);return`${a}\n\n---\n*[Truncated at ${i.toLocaleString()} chars — ${o}% of original content]*`}function i(e,t){let r=t*4;return e.length<=r?e:n(e,r)}function a(e,r,i=t){if(e.length<=r)return{text:e,_meta:{truncated:!1,originalChars:e.length,truncatedChars:e.length,omittedCount:0,strategy:`none`}};let a=Math.max(0,r-120),o=Math.floor(a*i),s=a-o,c=e.slice(0,o),l=c.lastIndexOf(`
|
|
8
|
+
`),u=l>0?c.slice(0,l):c,d=e.length-s,f=e.slice(d),p=f.indexOf(`
|
|
9
|
+
`),m=p>=0?f.slice(p+1):f,h=1,g=u.length,_=e.length-m.length;for(let t=g;t<_;t++)e.charCodeAt(t)===10&&h++;let v=n(e,r,i);return{text:v,_meta:{truncated:!0,originalChars:e.length,truncatedChars:v.length,omittedCount:h,strategy:`head-tail`}}}function o(e,t){if(e.length<=t)return{text:e,_meta:{truncated:!1,originalChars:e.length,truncatedChars:e.length,omittedCount:0,strategy:`none`}};let n=Math.max(0,t-200),i=e.slice(n,t).lastIndexOf(`
|
|
10
|
+
|
|
11
|
+
`),a=i>=0?n+i:t,o=e.split(/\n\s*\n/),s=e.slice(0,a).trimEnd(),c=s.length===0?0:s.split(/\n\s*\n/).length,l=r(e,t);return{text:l,_meta:{truncated:!0,originalChars:e.length,truncatedChars:l.length,omittedCount:Math.max(0,o.length-c),strategy:`paragraph`}}}function s(t,n){if(e(t)<=n)return{text:t,_meta:{truncated:!1,originalChars:t.length,truncatedChars:t.length,omittedCount:0,strategy:`none`}};let r=a(t,n*4);return{text:r.text,_meta:{...r._meta,strategy:`token-budget`}}}export{n as headTailTruncate,a as headTailTruncateWithMeta,r as paragraphTruncate,o as paragraphTruncateWithMeta,i as truncateToTokenBudget,s as truncateToTokenBudgetWithMeta};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{i as e}from"./chunk-BSngPjfM.js";import{t}from"./react-sYq8CyFO.js";import{a as n,i as r,n as i,t as a}from"./jsx-runtime-B_2ewjsM.js";import{t as o}from"./useKBClient-BkBffCdd.js";import{t as s}from"./StatusPanel-BFshFJU9.js";import{t as c}from"./SearchPanel-BbvCaco0.js";import{t as l}from"./CuratedPanel-BwkPKdX4.js";import{t as u}from"./LogPanel-C6KagE0H.js";var d=e(t()),f=a();const p=[`status`,`search`,`curated`,`log`];function m({client:e}){let[t,a]=(0,d.useState)(`status`);return i((e,n)=>{n.tab&&a(p[(p.indexOf(t)+1)%p.length]),e===`1`&&a(`status`),e===`2`&&a(`search`),e===`3`&&a(`curated`),e===`4`&&a(`log`)}),(0,f.jsx)(o,{value:e,children:(0,f.jsxs)(n,{flexDirection:`column`,width:`100%`,children:[(0,f.jsxs)(n,{borderStyle:`single`,paddingX:1,children:[(0,f.jsx)(r,{bold:!0,color:`cyan`,children:`AI Kit Dashboard`}),(0,f.jsx)(r,{children:` │ `}),p.map(e=>(0,f.jsxs)(d.Fragment,{children:[(0,f.jsxs)(r,{color:e===t?`green`:`gray`,bold:e===t,children:[`[`,p.indexOf(e)+1,`] `,e]}),(0,f.jsx)(r,{children:` `})]},e)),(0,f.jsx)(r,{color:`gray`,children:` │ Tab: switch │ Ctrl+C: quit`})]}),(0,f.jsxs)(n,{flexGrow:1,minHeight:10,children:[t===`status`&&(0,f.jsx)(s,{}),t===`search`&&(0,f.jsx)(c,{}),t===`curated`&&(0,f.jsx)(l,{}),t===`log`&&(0,f.jsx)(u,{})]})]})})}export{m as t};
|
package/packages/tui/dist/App.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{t as e}from"./App-
|
|
2
|
+
import{t as e}from"./App-D8fednPY.js";export{e as App};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-BSngPjfM.js";import{t as e}from"./react-sYq8CyFO.js";import{a as t,i as n,t as r}from"./jsx-runtime-B_2ewjsM.js";import{n as i}from"./useKBClient-BkBffCdd.js";import{t as a}from"./usePolling-D3y7u5cZ.js";e();var o=r();function s(){let e=i(),{data:r,error:s}=a(()=>e.listKnowledge(),1e4);return(0,o.jsxs)(t,{flexDirection:`column`,borderStyle:`round`,paddingX:1,children:[(0,o.jsx)(n,{bold:!0,color:`cyan`,children:`Curated Knowledge`}),(0,o.jsx)(n,{children:` `}),s&&(0,o.jsxs)(n,{color:`red`,children:[`Error: `,s.message]}),r&&r.length===0&&!s&&(0,o.jsx)(n,{color:`gray`,children:`No curated entries found`}),r?.map(e=>(0,o.jsxs)(n,{children:[(0,o.jsx)(n,{color:`magenta`,children:`•`}),` `,e.title,` `,(0,o.jsxs)(n,{color:`gray`,children:[`(`,e.category,`)`]})]},e.path)),!r&&!s&&(0,o.jsx)(n,{color:`yellow`,children:`Loading…`}),(0,o.jsx)(n,{children:` `}),(0,o.jsx)(n,{color:`gray`,children:`Refreshes every 10s`})]})}export{s as t};
|