oh-my-opencode-slim 0.9.2 → 0.9.5
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/README.md +5 -1
- package/dist/cli/index.js +155 -13690
- package/dist/config/schema.d.ts +13 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/todo-continuation/index.d.ts +25 -0
- package/dist/index.js +7273 -34569
- package/dist/multiplexer/zellij/index.d.ts +0 -2
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/smartfetch/binary.d.ts +3 -0
- package/dist/tools/smartfetch/cache.d.ts +6 -0
- package/dist/tools/smartfetch/constants.d.ts +12 -0
- package/dist/tools/smartfetch/index.d.ts +3 -0
- package/dist/tools/smartfetch/network.d.ts +38 -0
- package/dist/tools/smartfetch/secondary-model.d.ts +28 -0
- package/dist/tools/smartfetch/tool.d.ts +3 -0
- package/dist/tools/smartfetch/types.d.ts +122 -0
- package/dist/tools/smartfetch/utils.d.ts +18 -0
- package/oh-my-opencode-slim.schema.json +31 -0
- package/package.json +9 -2
|
@@ -12,8 +12,6 @@ export declare class ZellijMultiplexer implements Multiplexer {
|
|
|
12
12
|
readonly type: "zellij";
|
|
13
13
|
private binaryPath;
|
|
14
14
|
private hasChecked;
|
|
15
|
-
private storedLayout;
|
|
16
|
-
private storedMainPaneSize;
|
|
17
15
|
private agentTabId;
|
|
18
16
|
private firstPaneId;
|
|
19
17
|
private firstPaneUsed;
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export { ast_grep_replace, ast_grep_search } from './ast-grep';
|
|
|
2
2
|
export { createBackgroundTools } from './background';
|
|
3
3
|
export { createCouncilTool } from './council';
|
|
4
4
|
export { lsp_diagnostics, lsp_find_references, lsp_goto_definition, lsp_rename, lspManager, setUserLspConfig, } from './lsp';
|
|
5
|
+
export { createWebfetchTool } from './smartfetch';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { BinaryFetch } from './types';
|
|
2
|
+
export declare function buildBinaryResultMessage(fetchResult: BinaryFetch, savedPath?: string): string;
|
|
3
|
+
export declare function saveBinary(binaryDir: string, data: Uint8Array, contentType: string, filename?: string): Promise<string>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LRUCache } from 'lru-cache';
|
|
2
|
+
import type { FetchResult } from './types';
|
|
3
|
+
export declare const CACHE: LRUCache<string, FetchResult, unknown>;
|
|
4
|
+
export declare function buildCacheKey(url: string, extractMain: boolean, preferLlmsTxt: 'auto' | 'always' | 'never', saveBinary: boolean): string;
|
|
5
|
+
export declare function cacheFetchResult(fetchResult: FetchResult, extractMain: boolean, preferLlmsTxt: 'auto' | 'always' | 'never', saveBinary: boolean): void;
|
|
6
|
+
export declare function isInvalidLlmsResult(fetchResult: FetchResult | undefined): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const DOCS_HOST_SUFFIXES: string[];
|
|
2
|
+
export declare const DOCS_HOST_PREFIXES: string[];
|
|
3
|
+
export declare const MAX_REDIRECTS = 10;
|
|
4
|
+
export declare const MAX_RESPONSE_BYTES: number;
|
|
5
|
+
export declare const MAX_BINARY_DOWNLOAD_BYTES: number;
|
|
6
|
+
export declare const DEFAULT_TIMEOUT_SECONDS = 30;
|
|
7
|
+
export declare const MAX_TIMEOUT_SECONDS = 120;
|
|
8
|
+
export declare const MAX_LLMS_PROBE_TIMEOUT_MS = 8000;
|
|
9
|
+
export declare const MAX_MODEL_CONTENT_CHARS = 100000;
|
|
10
|
+
export declare const DEFAULT_ACCEPT_LANGUAGE = "en;q=0.8,*;q=0.5";
|
|
11
|
+
export declare const BINARY_PREFIXES: string[];
|
|
12
|
+
export declare const WEBFETCH_DESCRIPTION = "Fetch a URL with better extraction for static/docs pages. Supports llms.txt probing, content-focused HTML extraction, metadata, redirects, and an optional prompt processed by a cheap secondary model.";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { BinaryFetch, DecodedBody, FetchResult, FetchWithRedirectsResult, LlmsProbeResult } from './types';
|
|
2
|
+
export declare function normalizeUrl(input: string): {
|
|
3
|
+
url: string;
|
|
4
|
+
upgradedToHttps: boolean;
|
|
5
|
+
fallbackUrl: string | undefined;
|
|
6
|
+
originalUrl: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function isDocsLikeUrl(url: URL): boolean;
|
|
9
|
+
export declare function buildPermissionPatterns(normalized: ReturnType<typeof normalizeUrl>, shouldProbeLlmsTxt: boolean): string[];
|
|
10
|
+
export declare function buildAllowedOrigins(patterns: string[]): Set<string>;
|
|
11
|
+
export declare function canUseCanonicalCacheAlias(baseUrl: string, aliasUrl: string): boolean;
|
|
12
|
+
export declare function isBinaryContentType(contentType: string): boolean;
|
|
13
|
+
export declare function getBinaryKind(contentType: string): BinaryFetch['binaryKind'];
|
|
14
|
+
export declare function looksLikeHtmlText(text: string): boolean;
|
|
15
|
+
export declare function runWithScopedTimeout<T>(parentSignal: AbortSignal, timeoutMs: number, fn: (signal: AbortSignal) => Promise<T>): Promise<T>;
|
|
16
|
+
export declare function readBodyLimited(response: Response, maxBytes?: number): Promise<{
|
|
17
|
+
data: Uint8Array<ArrayBuffer>;
|
|
18
|
+
truncated: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function fetchWithRedirects(url: string, _timeoutMs: number, format: 'text' | 'markdown' | 'html', signal: AbortSignal, extraHeaders?: Record<string, string>, method?: 'GET' | 'HEAD', allowedOrigins?: Set<string>): Promise<FetchWithRedirectsResult>;
|
|
21
|
+
export declare function fetchWithUpgradeFallback(normalized: ReturnType<typeof normalizeUrl>, timeoutMs: number, format: 'text' | 'markdown' | 'html', signal: AbortSignal, extraHeaders?: Record<string, string>, method?: 'GET' | 'HEAD', allowedOrigins?: Set<string>): Promise<{
|
|
22
|
+
result: FetchWithRedirectsResult;
|
|
23
|
+
upgradedToHttps: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
export declare function isHtmlLikeContentType(contentType: string): boolean;
|
|
26
|
+
export declare function decodeBody(data: Uint8Array, charset: string | undefined, contentType?: string): DecodedBody;
|
|
27
|
+
export declare function looksLikeTextBody(data: Uint8Array): boolean;
|
|
28
|
+
export declare function isGenericBinaryMime(contentType: string): boolean;
|
|
29
|
+
export declare function extractHeaderMetadata(headers: Headers, finalUrl: string): {
|
|
30
|
+
contentType: string | undefined;
|
|
31
|
+
charset: string | undefined;
|
|
32
|
+
etag: string | undefined;
|
|
33
|
+
lastModified: string | undefined;
|
|
34
|
+
contentLength: number | undefined;
|
|
35
|
+
filename: string | undefined;
|
|
36
|
+
};
|
|
37
|
+
export declare function buildConditionalHeaders(cached: FetchResult | undefined): Record<string, string> | undefined;
|
|
38
|
+
export declare function probeLlmsText(url: URL, timeoutMs: number, signal: AbortSignal, fallbackOrigin?: string): Promise<LlmsProbeResult>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
2
|
+
import type { CachedFetch, SecondaryModel } from './types';
|
|
3
|
+
type OpenCodeClient = PluginInput['client'];
|
|
4
|
+
export declare function readSecondaryModelFromConfig(directory: string): Promise<SecondaryModel[]>;
|
|
5
|
+
export declare function decideSecondaryModelUse(fetchResult: CachedFetch, prompt: string | undefined, secondaryModels: SecondaryModel[]): {
|
|
6
|
+
use: boolean;
|
|
7
|
+
reason: "no_prompt";
|
|
8
|
+
} | {
|
|
9
|
+
use: boolean;
|
|
10
|
+
reason: "no_secondary_model_configured";
|
|
11
|
+
} | {
|
|
12
|
+
use: boolean;
|
|
13
|
+
reason: "empty_content";
|
|
14
|
+
} | {
|
|
15
|
+
use: boolean;
|
|
16
|
+
reason: "content_too_short";
|
|
17
|
+
} | {
|
|
18
|
+
use: boolean;
|
|
19
|
+
reason: "prompt_present";
|
|
20
|
+
};
|
|
21
|
+
export declare function runSecondaryModelWithFallback(client: OpenCodeClient, directory: string, models: SecondaryModel[], prompt: string, content: string): Promise<{
|
|
22
|
+
model: SecondaryModel;
|
|
23
|
+
text: string;
|
|
24
|
+
inputTruncated: boolean;
|
|
25
|
+
inputChars: number;
|
|
26
|
+
sourceChars: number;
|
|
27
|
+
}>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
export type SmartfetchOptions = {
|
|
2
|
+
binaryDir?: string;
|
|
3
|
+
};
|
|
4
|
+
export type SecondaryModel = {
|
|
5
|
+
providerID: string;
|
|
6
|
+
modelID: string;
|
|
7
|
+
};
|
|
8
|
+
export type RedirectStep = {
|
|
9
|
+
from: string;
|
|
10
|
+
to: string;
|
|
11
|
+
status: number;
|
|
12
|
+
};
|
|
13
|
+
export type CachedFetch = {
|
|
14
|
+
requestedUrl: string;
|
|
15
|
+
finalUrl: string;
|
|
16
|
+
statusCode: number;
|
|
17
|
+
contentType: string;
|
|
18
|
+
charset?: string;
|
|
19
|
+
etag?: string;
|
|
20
|
+
lastModified?: string;
|
|
21
|
+
contentLength?: number;
|
|
22
|
+
filename?: string;
|
|
23
|
+
canonicalUrl?: string;
|
|
24
|
+
headings?: string[];
|
|
25
|
+
title?: string;
|
|
26
|
+
rawContent: string;
|
|
27
|
+
markdown: string;
|
|
28
|
+
text: string;
|
|
29
|
+
html: string;
|
|
30
|
+
extractedMain: boolean;
|
|
31
|
+
usedLlmsTxt: boolean;
|
|
32
|
+
sourceKind: 'llms_txt' | 'html' | 'text';
|
|
33
|
+
upgradedToHttps: boolean;
|
|
34
|
+
redirectChain: RedirectStep[];
|
|
35
|
+
truncated: boolean;
|
|
36
|
+
wordCount: number;
|
|
37
|
+
qualitySignals?: string[];
|
|
38
|
+
llmsProbeError?: string;
|
|
39
|
+
llmsProbeTruncated?: boolean;
|
|
40
|
+
cacheRevalidated?: boolean;
|
|
41
|
+
upstreamStatusCode?: number;
|
|
42
|
+
cacheHit?: boolean;
|
|
43
|
+
decodedCharset?: string;
|
|
44
|
+
decodeFallback?: boolean;
|
|
45
|
+
decodeWarning?: string;
|
|
46
|
+
secondaryModelInputTruncated?: boolean;
|
|
47
|
+
secondaryModelInputChars?: number;
|
|
48
|
+
secondaryModelSourceChars?: number;
|
|
49
|
+
};
|
|
50
|
+
export type BinaryFetch = {
|
|
51
|
+
requestedUrl: string;
|
|
52
|
+
finalUrl: string;
|
|
53
|
+
statusCode: number;
|
|
54
|
+
contentType: string;
|
|
55
|
+
charset?: string;
|
|
56
|
+
etag?: string;
|
|
57
|
+
lastModified?: string;
|
|
58
|
+
contentLength?: number;
|
|
59
|
+
filename?: string;
|
|
60
|
+
canonicalUrl?: string;
|
|
61
|
+
redirectChain: RedirectStep[];
|
|
62
|
+
upgradedToHttps: boolean;
|
|
63
|
+
truncated: boolean;
|
|
64
|
+
binary: true;
|
|
65
|
+
binaryKind: 'image' | 'audio' | 'video' | 'pdf' | 'binary';
|
|
66
|
+
downloadLimitBytes?: number;
|
|
67
|
+
metadataOnly?: boolean;
|
|
68
|
+
data?: Uint8Array;
|
|
69
|
+
llmsProbeError?: string;
|
|
70
|
+
llmsProbeTruncated?: boolean;
|
|
71
|
+
cacheRevalidated?: boolean;
|
|
72
|
+
upstreamStatusCode?: number;
|
|
73
|
+
cacheHit?: boolean;
|
|
74
|
+
};
|
|
75
|
+
export type FetchResult = CachedFetch | BinaryFetch;
|
|
76
|
+
export type DecodedBody = {
|
|
77
|
+
text: string;
|
|
78
|
+
decodedCharset: string;
|
|
79
|
+
decodeFallback: boolean;
|
|
80
|
+
decodeWarning?: string;
|
|
81
|
+
};
|
|
82
|
+
export type ExtractedContent = {
|
|
83
|
+
title?: string;
|
|
84
|
+
rawContent: string;
|
|
85
|
+
markdown: string;
|
|
86
|
+
text: string;
|
|
87
|
+
html: string;
|
|
88
|
+
extractedMain: boolean;
|
|
89
|
+
canonicalUrl?: string;
|
|
90
|
+
headings?: string[];
|
|
91
|
+
};
|
|
92
|
+
export type FetchWithRedirectsResult = {
|
|
93
|
+
blockedRedirect: true;
|
|
94
|
+
redirectUrl: string;
|
|
95
|
+
statusCode: number;
|
|
96
|
+
redirectChain: RedirectStep[];
|
|
97
|
+
} | {
|
|
98
|
+
response: Response;
|
|
99
|
+
finalUrl: string;
|
|
100
|
+
redirectChain: RedirectStep[];
|
|
101
|
+
};
|
|
102
|
+
export type LlmsProbeResult = {
|
|
103
|
+
url: string;
|
|
104
|
+
statusCode: number;
|
|
105
|
+
redirectChain: RedirectStep[];
|
|
106
|
+
text: string;
|
|
107
|
+
headers: {
|
|
108
|
+
contentType?: string;
|
|
109
|
+
charset?: string;
|
|
110
|
+
etag?: string;
|
|
111
|
+
lastModified?: string;
|
|
112
|
+
contentLength?: number;
|
|
113
|
+
filename?: string;
|
|
114
|
+
};
|
|
115
|
+
truncated: boolean;
|
|
116
|
+
decodedCharset: string;
|
|
117
|
+
decodeFallback: boolean;
|
|
118
|
+
decodeWarning?: string;
|
|
119
|
+
upgradedToHttps: boolean;
|
|
120
|
+
} | {
|
|
121
|
+
error?: string;
|
|
122
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CachedFetch, ExtractedContent } from './types';
|
|
2
|
+
export declare function wordCount(text: string): number;
|
|
3
|
+
export declare function frontmatter(metadata: Record<string, unknown>): string;
|
|
4
|
+
export declare function trimBlankRuns(input: string): string;
|
|
5
|
+
export declare function cleanHeadingText(input: string): string;
|
|
6
|
+
export declare function cleanFetchedMarkdown(input: string): string;
|
|
7
|
+
export declare function cleanFetchedText(input: string): string;
|
|
8
|
+
export declare function escapeHtml(input: string): string;
|
|
9
|
+
export declare function withTruncationMarker(content: string, format: 'text' | 'markdown' | 'html', truncated: boolean): string;
|
|
10
|
+
export declare function joinRenderedContent(metadata: string, content: string, format: 'text' | 'markdown' | 'html'): string;
|
|
11
|
+
export declare function renderMessageForFormat(content: string, format: 'text' | 'markdown' | 'html'): string;
|
|
12
|
+
export declare function buildRedirectResultMessage(originalUrl: string, redirectUrl: string, statusCode: number): string;
|
|
13
|
+
export declare function buildLlmsRequiredMessage(originalUrl: string, reason?: string): string;
|
|
14
|
+
export declare function extractFromHtml(html: string, finalUrl: string, extractMain: boolean): ExtractedContent;
|
|
15
|
+
export declare function inferCanonicalUrlFromText(content: string, finalUrl: string): string | undefined;
|
|
16
|
+
export declare function extractHeadingsFromMarkdown(content: string): string[] | undefined;
|
|
17
|
+
export declare function detectQualitySignals(fetchResult: Pick<CachedFetch, 'text' | 'markdown' | 'rawContent' | 'wordCount' | 'sourceKind' | 'extractedMain'>): string[];
|
|
18
|
+
export declare function pickContent(fetchResult: CachedFetch, format: 'text' | 'markdown' | 'html'): string;
|
|
@@ -413,6 +413,37 @@
|
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
},
|
|
416
|
+
"todoContinuation": {
|
|
417
|
+
"type": "object",
|
|
418
|
+
"properties": {
|
|
419
|
+
"maxContinuations": {
|
|
420
|
+
"default": 5,
|
|
421
|
+
"description": "Maximum consecutive auto-continuations before stopping to ask user",
|
|
422
|
+
"type": "integer",
|
|
423
|
+
"minimum": 1,
|
|
424
|
+
"maximum": 50
|
|
425
|
+
},
|
|
426
|
+
"cooldownMs": {
|
|
427
|
+
"default": 3000,
|
|
428
|
+
"description": "Delay in ms before auto-continuing (gives user time to abort)",
|
|
429
|
+
"type": "integer",
|
|
430
|
+
"minimum": 0,
|
|
431
|
+
"maximum": 30000
|
|
432
|
+
},
|
|
433
|
+
"autoEnable": {
|
|
434
|
+
"default": false,
|
|
435
|
+
"description": "Automatically enable auto-continue when the orchestrator session has enough todos",
|
|
436
|
+
"type": "boolean"
|
|
437
|
+
},
|
|
438
|
+
"autoEnableThreshold": {
|
|
439
|
+
"default": 4,
|
|
440
|
+
"description": "Number of todos that triggers auto-enable (only used when autoEnable is true)",
|
|
441
|
+
"type": "integer",
|
|
442
|
+
"minimum": 1,
|
|
443
|
+
"maximum": 50
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
},
|
|
416
447
|
"fallback": {
|
|
417
448
|
"type": "object",
|
|
418
449
|
"properties": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oh-my-opencode-slim",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"description": "Lightweight agent orchestration plugin for OpenCode - a slimmed-down fork of oh-my-opencode",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"LICENSE"
|
|
37
37
|
],
|
|
38
38
|
"scripts": {
|
|
39
|
-
"build": "bun build src/index.ts --outdir dist --target bun --format esm && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm && tsc --emitDeclarationOnly && bun run generate-schema",
|
|
39
|
+
"build": "bun build src/index.ts --outdir dist --target bun --format esm --packages external && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --packages external && tsc --emitDeclarationOnly && bun run generate-schema",
|
|
40
40
|
"contributors:add": "all-contributors add",
|
|
41
41
|
"contributors:check": "all-contributors check",
|
|
42
42
|
"contributors:generate": "all-contributors generate",
|
|
@@ -54,10 +54,14 @@
|
|
|
54
54
|
"release:major": "npm version major && git push --follow-tags && npm publish"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
+
"@mozilla/readability": "^0.6.0",
|
|
57
58
|
"@ast-grep/cli": "^0.40.0",
|
|
58
59
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
59
60
|
"@opencode-ai/plugin": "^1.2.6",
|
|
60
61
|
"@opencode-ai/sdk": "^1.2.6",
|
|
62
|
+
"jsdom": "^26.1.0",
|
|
63
|
+
"lru-cache": "^11.2.2",
|
|
64
|
+
"turndown": "^7.2.0",
|
|
61
65
|
"vscode-jsonrpc": "^8.2.0",
|
|
62
66
|
"vscode-languageserver-protocol": "^3.17.5",
|
|
63
67
|
"which": "^6.0.0",
|
|
@@ -65,6 +69,9 @@
|
|
|
65
69
|
},
|
|
66
70
|
"devDependencies": {
|
|
67
71
|
"@biomejs/biome": "2.4.2",
|
|
72
|
+
"@types/jsdom": "^21.1.7",
|
|
73
|
+
"@types/node": "^24.6.1",
|
|
74
|
+
"@types/turndown": "^5.0.5",
|
|
68
75
|
"@types/which": "^3.0.4",
|
|
69
76
|
"all-contributors-cli": "^6.26.1",
|
|
70
77
|
"bun-types": "1.3.9",
|