@cortexkit/aft-opencode 0.17.3 → 0.18.1
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/dist/bg-notifications.d.ts +41 -0
- package/dist/bg-notifications.d.ts.map +1 -0
- package/dist/bridge.d.ts +9 -1
- package/dist/bridge.d.ts.map +1 -1
- package/dist/config.d.ts +27 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1259 -495
- package/dist/logger.d.ts +9 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/lsp-auto-install.d.ts +2 -0
- package/dist/lsp-auto-install.d.ts.map +1 -1
- package/dist/lsp-github-install.d.ts +2 -0
- package/dist/lsp-github-install.d.ts.map +1 -1
- package/dist/notifications.d.ts.map +1 -1
- package/dist/patch-parser.d.ts.map +1 -1
- package/dist/shared/status.d.ts +2 -2
- package/dist/shared/status.d.ts.map +1 -1
- package/dist/tools/_shared.d.ts +2 -2
- package/dist/tools/_shared.d.ts.map +1 -1
- package/dist/tools/ast.d.ts.map +1 -1
- package/dist/tools/bash.d.ts +4 -0
- package/dist/tools/bash.d.ts.map +1 -0
- package/dist/tools/hoisted.d.ts.map +1 -1
- package/dist/tui.js +377 -11
- package/dist/types.d.ts +15 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/shared/status.ts +10 -8
- package/src/tui/index.tsx +13 -0
- package/src/tui/sidebar.tsx +331 -0
package/dist/logger.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
export declare function log(message: string, data?: unknown): void;
|
|
2
2
|
export declare function warn(message: string, data?: unknown): void;
|
|
3
3
|
export declare function error(message: string, data?: unknown): void;
|
|
4
|
+
/**
|
|
5
|
+
* Log with a session-id prefix. Use for messages that originate from a
|
|
6
|
+
* specific OpenCode session (per-request errors, timeouts, crashes during
|
|
7
|
+
* a session's tool call). Bridge-lifecycle logs (spawn, version, idle) are
|
|
8
|
+
* project-scoped, not session-scoped — use `log`/`warn`/`error` for those.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sessionLog(sessionId: string, message: string, data?: unknown): void;
|
|
11
|
+
export declare function sessionWarn(sessionId: string, message: string, data?: unknown): void;
|
|
12
|
+
export declare function sessionError(sessionId: string, message: string, data?: unknown): void;
|
|
4
13
|
export declare function getLogFilePath(): string;
|
|
5
14
|
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAkEA,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAEzD;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAE1D;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAEnF;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAEpF;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAErF;AAED,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}
|
|
@@ -44,6 +44,8 @@ export interface AutoInstallResult {
|
|
|
44
44
|
cachedBinDirs: string[];
|
|
45
45
|
/** Number of background installs kicked off. */
|
|
46
46
|
installsStarted: number;
|
|
47
|
+
/** Binary names whose installs are actively in flight at return time. */
|
|
48
|
+
installingBinaries: string[];
|
|
47
49
|
/**
|
|
48
50
|
* Servers that were disabled or skipped at decision time (synchronous).
|
|
49
51
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-auto-install.d.ts","sourceRoot":"","sources":["../src/lsp-auto-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAsBH,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,kGAAkG;IAClG,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gDAAgD;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB;;;;;;;OAOG;IACH,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C;;;;;;;;;OASG;IACH,gBAAgB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAkDD,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM/D;AAwTD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,iBAAiB,EACzB,SAAS,GAAE,OAAO,KAAa,GAC9B,iBAAiB,
|
|
1
|
+
{"version":3,"file":"lsp-auto-install.d.ts","sourceRoot":"","sources":["../src/lsp-auto-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAsBH,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,kGAAkG;IAClG,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gDAAgD;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B;;;;;;;OAOG;IACH,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C;;;;;;;;;OASG;IACH,gBAAgB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAkDD,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM/D;AAwTD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,iBAAiB,EACzB,SAAS,GAAE,OAAO,KAAa,GAC9B,iBAAiB,CAwEnB"}
|
|
@@ -61,6 +61,8 @@ export declare function validateExtraction(stagingRoot: string): void;
|
|
|
61
61
|
export interface GithubAutoInstallResult {
|
|
62
62
|
cachedBinDirs: string[];
|
|
63
63
|
installsStarted: number;
|
|
64
|
+
/** Binary names whose installs are actively in flight at return time. */
|
|
65
|
+
installingBinaries: string[];
|
|
64
66
|
skipped: Array<{
|
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,EAAE,GACxB,MAAM,CAyGR"}
|
package/dist/shared/status.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export interface AftStatusSnapshot {
|
|
|
5
5
|
format_on_edit: boolean;
|
|
6
6
|
validate_on_edit: string;
|
|
7
7
|
restrict_to_project_root: boolean;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
search_index: boolean;
|
|
9
|
+
semantic_search: boolean;
|
|
10
10
|
};
|
|
11
11
|
search_index: {
|
|
12
12
|
status: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/shared/status.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE;QACR,cAAc,EAAE,OAAO,CAAC;QACxB,gBAAgB,EAAE,MAAM,CAAC;QACzB,wBAAwB,EAAE,OAAO,CAAC;QAClC,
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/shared/status.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE;QACR,cAAc,EAAE,OAAO,CAAC;QACxB,gBAAgB,EAAE,MAAM,CAAC;QACzB,wBAAwB,EAAE,OAAO,CAAC;QAClC,YAAY,EAAE,OAAO,CAAC;QACtB,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,YAAY,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,CAAC;IACF,cAAc,EAAE;QACd,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,KAA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* `bridge.send()` multiple times with shared state) should use `bridgeFor()`
|
|
16
16
|
* and still pass `session_id` explicitly.
|
|
17
17
|
*/
|
|
18
|
-
import type { BinaryBridge } from "../bridge.js";
|
|
18
|
+
import type { BinaryBridge, BridgeRequestOptions } from "../bridge.js";
|
|
19
19
|
import type { PluginContext } from "../types.js";
|
|
20
20
|
/**
|
|
21
21
|
* Per-command timeout overrides (milliseconds).
|
|
@@ -70,5 +70,5 @@ export declare function bridgeFor(ctx: PluginContext, runtime: ToolRuntime): Bin
|
|
|
70
70
|
* is absent (see `RawRequest::session()`), so hosts that don't expose a
|
|
71
71
|
* session identifier still work — they just share undo/checkpoint state.
|
|
72
72
|
*/
|
|
73
|
-
export declare function callBridge(ctx: PluginContext, runtime: ToolRuntime, command: string, params?: Record<string, unknown
|
|
73
|
+
export declare function callBridge(ctx: PluginContext, runtime: ToolRuntime, command: string, params?: Record<string, unknown>, options?: BridgeRequestOptions): ReturnType<BinaryBridge["send"]>;
|
|
74
74
|
//# sourceMappingURL=_shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/tools/_shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/tools/_shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAQlE,CAAC;AAEF,wFAAwF;AACxF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAErE;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAa3D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,GAAG,YAAY,CAEhF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACpC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAiBlC"}
|
package/dist/tools/ast.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/tools/ast.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAyCjD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/tools/ast.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAyCjD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAgR3E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAsDjD,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CA8IjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hoisted.d.ts","sourceRoot":"","sources":["../../src/tools/hoisted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"hoisted.d.ts","sourceRoot":"","sources":["../../src/tools/hoisted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAkEjD,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,GAAI,IAAI,MAAM,EAAE,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,MAChD,CAAC;AA+QtC;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CAgJjE;AA08BD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAU/E;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAmEnF"}
|
package/dist/tui.js
CHANGED
|
@@ -1,4 +1,68 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
// package.json
|
|
3
|
+
var package_default = {
|
|
4
|
+
name: "@cortexkit/aft-opencode",
|
|
5
|
+
version: "0.18.1",
|
|
6
|
+
type: "module",
|
|
7
|
+
description: "OpenCode plugin for Agent File Tools (AFT) \u2014 tree-sitter and lsp powered code analysis",
|
|
8
|
+
main: "dist/index.js",
|
|
9
|
+
types: "dist/index.d.ts",
|
|
10
|
+
license: "MIT",
|
|
11
|
+
repository: {
|
|
12
|
+
type: "git",
|
|
13
|
+
url: "https://github.com/cortexkit/aft"
|
|
14
|
+
},
|
|
15
|
+
files: [
|
|
16
|
+
"dist",
|
|
17
|
+
"src/tui",
|
|
18
|
+
"src/shared",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
scripts: {
|
|
22
|
+
build: "bun build src/index.ts --outdir dist --target bun --format esm --external @opencode-ai/plugin && bun build src/tui/index.tsx --outfile dist/tui.js --target bun --format esm --external @opencode-ai/plugin --external @opencode-ai/plugin/tui --external @opentui/solid --external solid-js && tsc --emitDeclarationOnly",
|
|
23
|
+
typecheck: "tsc --noEmit",
|
|
24
|
+
pretest: "cd ../.. && cargo build",
|
|
25
|
+
test: "bun test",
|
|
26
|
+
"test:e2e": "bun test src/__tests__/e2e/",
|
|
27
|
+
prepublishOnly: "bun run build"
|
|
28
|
+
},
|
|
29
|
+
dependencies: {
|
|
30
|
+
"@clack/prompts": "^1.2.0",
|
|
31
|
+
"@opencode-ai/plugin": "^1.2.26",
|
|
32
|
+
"@opencode-ai/sdk": "^1.2.26",
|
|
33
|
+
"comment-json": "^4.6.2",
|
|
34
|
+
zod: "^4.1.8"
|
|
35
|
+
},
|
|
36
|
+
optionalDependencies: {
|
|
37
|
+
"@cortexkit/aft-darwin-arm64": "0.18.1",
|
|
38
|
+
"@cortexkit/aft-darwin-x64": "0.18.1",
|
|
39
|
+
"@cortexkit/aft-linux-arm64": "0.18.1",
|
|
40
|
+
"@cortexkit/aft-linux-x64": "0.18.1",
|
|
41
|
+
"@cortexkit/aft-win32-x64": "0.18.1"
|
|
42
|
+
},
|
|
43
|
+
devDependencies: {
|
|
44
|
+
"@types/node": "^22.0.0",
|
|
45
|
+
typescript: "^5.8.0"
|
|
46
|
+
},
|
|
47
|
+
exports: {
|
|
48
|
+
".": {
|
|
49
|
+
types: "./dist/index.d.ts",
|
|
50
|
+
import: "./dist/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./tui": {
|
|
53
|
+
types: "./src/tui/index.tsx",
|
|
54
|
+
import: "./src/tui/index.tsx"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"oc-plugin": [
|
|
58
|
+
"server",
|
|
59
|
+
"tui"
|
|
60
|
+
],
|
|
61
|
+
peerDependencies: {
|
|
62
|
+
"@opencode-ai/plugin": ">=1.2.0"
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
2
66
|
// src/shared/rpc-client.ts
|
|
3
67
|
import { readFileSync } from "fs";
|
|
4
68
|
|
|
@@ -37,11 +101,12 @@ function scheduleFlush() {
|
|
|
37
101
|
flushTimer.unref();
|
|
38
102
|
}
|
|
39
103
|
}
|
|
40
|
-
function write(level, message, data) {
|
|
104
|
+
function write(level, message, data, sessionId) {
|
|
41
105
|
try {
|
|
42
106
|
const timestamp = new Date().toISOString();
|
|
43
107
|
const serialized = data === undefined ? "" : ` ${JSON.stringify(data)}`;
|
|
44
|
-
const
|
|
108
|
+
const sessionPrefix = sessionId ? ` [${sessionId}]` : "";
|
|
109
|
+
const line = `[${timestamp}] ${level} ${TAG}${sessionPrefix} ${message}${serialized}
|
|
45
110
|
`;
|
|
46
111
|
if (useStderr) {
|
|
47
112
|
process.stderr.write(line);
|
|
@@ -246,8 +311,8 @@ function coerceAftStatus(response) {
|
|
|
246
311
|
format_on_edit: readBoolean(features.format_on_edit),
|
|
247
312
|
validate_on_edit: readString(features.validate_on_edit, "off"),
|
|
248
313
|
restrict_to_project_root: readBoolean(features.restrict_to_project_root),
|
|
249
|
-
|
|
250
|
-
|
|
314
|
+
search_index: readBoolean(features.search_index ?? features.experimental_search_index),
|
|
315
|
+
semantic_search: readBoolean(features.semantic_search ?? features.experimental_semantic_search)
|
|
251
316
|
},
|
|
252
317
|
search_index: {
|
|
253
318
|
status: readString(searchIndex.status, "unknown"),
|
|
@@ -292,8 +357,8 @@ function formatStatusDialogMessage(status) {
|
|
|
292
357
|
"",
|
|
293
358
|
"Enabled features",
|
|
294
359
|
`- format_on_edit: ${formatFlag(status.features.format_on_edit)}`,
|
|
295
|
-
`-
|
|
296
|
-
`-
|
|
360
|
+
`- search_index: ${formatFlag(status.features.search_index)}`,
|
|
361
|
+
`- semantic_search: ${formatFlag(status.features.semantic_search)}`,
|
|
297
362
|
"",
|
|
298
363
|
"Search index",
|
|
299
364
|
`- status: ${status.search_index.status}`,
|
|
@@ -334,8 +399,306 @@ function formatStatusDialogMessage(status) {
|
|
|
334
399
|
`);
|
|
335
400
|
}
|
|
336
401
|
|
|
337
|
-
// src/tui/
|
|
402
|
+
// src/tui/sidebar.tsx
|
|
403
|
+
import { createEffect, createMemo, createSignal, on, onCleanup } from "solid-js";
|
|
338
404
|
import { jsxDEV } from "@opentui/solid/jsx-dev-runtime";
|
|
405
|
+
var SINGLE_BORDER = { type: "single" };
|
|
406
|
+
var REFRESH_DEBOUNCE_MS = 200;
|
|
407
|
+
var POLL_INTERVAL_MS = 1500;
|
|
408
|
+
function formatBytes2(n) {
|
|
409
|
+
if (!Number.isFinite(n) || n <= 0)
|
|
410
|
+
return "\u2014";
|
|
411
|
+
if (n >= 1073741824)
|
|
412
|
+
return `${(n / 1073741824).toFixed(1)} GB`;
|
|
413
|
+
if (n >= 1048576)
|
|
414
|
+
return `${(n / 1048576).toFixed(1)} MB`;
|
|
415
|
+
if (n >= 1024)
|
|
416
|
+
return `${Math.round(n / 1024)} KB`;
|
|
417
|
+
return `${n} B`;
|
|
418
|
+
}
|
|
419
|
+
function formatCount2(n) {
|
|
420
|
+
if (n == null || !Number.isFinite(n))
|
|
421
|
+
return "\u2014";
|
|
422
|
+
if (n >= 1e6)
|
|
423
|
+
return `${(n / 1e6).toFixed(1)}M`;
|
|
424
|
+
if (n >= 1000)
|
|
425
|
+
return `${Math.round(n / 1000)}K`;
|
|
426
|
+
return String(n);
|
|
427
|
+
}
|
|
428
|
+
function statusDisplay(status) {
|
|
429
|
+
switch (status) {
|
|
430
|
+
case "ready":
|
|
431
|
+
return { label: "ready", tone: "ok" };
|
|
432
|
+
case "loading":
|
|
433
|
+
case "building":
|
|
434
|
+
return { label: status, tone: "warn" };
|
|
435
|
+
case "failed":
|
|
436
|
+
case "error":
|
|
437
|
+
return { label: status, tone: "err" };
|
|
438
|
+
case "disabled":
|
|
439
|
+
return { label: "disabled", tone: "muted" };
|
|
440
|
+
default:
|
|
441
|
+
return { label: status || "unknown", tone: "muted" };
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
var StatRow = (props) => {
|
|
445
|
+
const fg = createMemo(() => {
|
|
446
|
+
switch (props.tone) {
|
|
447
|
+
case "ok":
|
|
448
|
+
return props.theme.success ?? props.theme.accent;
|
|
449
|
+
case "warn":
|
|
450
|
+
return props.theme.warning;
|
|
451
|
+
case "err":
|
|
452
|
+
return props.theme.error;
|
|
453
|
+
case "muted":
|
|
454
|
+
return props.theme.textMuted;
|
|
455
|
+
case "accent":
|
|
456
|
+
return props.theme.accent;
|
|
457
|
+
default:
|
|
458
|
+
return props.theme.text;
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
return /* @__PURE__ */ jsxDEV("box", {
|
|
462
|
+
width: "100%",
|
|
463
|
+
flexDirection: "row",
|
|
464
|
+
justifyContent: "space-between",
|
|
465
|
+
children: [
|
|
466
|
+
/* @__PURE__ */ jsxDEV("text", {
|
|
467
|
+
fg: props.theme.textMuted,
|
|
468
|
+
children: props.label
|
|
469
|
+
}, undefined, false, undefined, this),
|
|
470
|
+
/* @__PURE__ */ jsxDEV("text", {
|
|
471
|
+
fg: fg(),
|
|
472
|
+
children: /* @__PURE__ */ jsxDEV("b", {
|
|
473
|
+
children: props.value
|
|
474
|
+
}, undefined, false, undefined, this)
|
|
475
|
+
}, undefined, false, undefined, this)
|
|
476
|
+
]
|
|
477
|
+
}, undefined, true, undefined, this);
|
|
478
|
+
};
|
|
479
|
+
var SectionHeader = (props) => /* @__PURE__ */ jsxDEV("box", {
|
|
480
|
+
width: "100%",
|
|
481
|
+
marginTop: props.marginTop ?? 1,
|
|
482
|
+
children: /* @__PURE__ */ jsxDEV("text", {
|
|
483
|
+
fg: props.theme.text,
|
|
484
|
+
children: /* @__PURE__ */ jsxDEV("b", {
|
|
485
|
+
children: props.title
|
|
486
|
+
}, undefined, false, undefined, this)
|
|
487
|
+
}, undefined, false, undefined, this)
|
|
488
|
+
}, undefined, false, undefined, this);
|
|
489
|
+
var sidebarClients = new Map;
|
|
490
|
+
function getClient(directory) {
|
|
491
|
+
let client = sidebarClients.get(directory);
|
|
492
|
+
if (client)
|
|
493
|
+
return client;
|
|
494
|
+
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
495
|
+
const dataHome = process.env.XDG_DATA_HOME || `${home}/.local/share`;
|
|
496
|
+
const storageDir = `${dataHome}/opencode/storage/plugin/aft`;
|
|
497
|
+
client = new AftRpcClient(storageDir, directory);
|
|
498
|
+
sidebarClients.set(directory, client);
|
|
499
|
+
return client;
|
|
500
|
+
}
|
|
501
|
+
var SidebarContent = (props) => {
|
|
502
|
+
const [status, setStatus] = createSignal(null);
|
|
503
|
+
let inflight = false;
|
|
504
|
+
let debounceTimer;
|
|
505
|
+
let pollTimer;
|
|
506
|
+
const refresh = async () => {
|
|
507
|
+
const sid = props.sessionID();
|
|
508
|
+
if (!sid)
|
|
509
|
+
return;
|
|
510
|
+
if (inflight)
|
|
511
|
+
return;
|
|
512
|
+
const directory = props.api.state.path.directory ?? "";
|
|
513
|
+
if (!directory)
|
|
514
|
+
return;
|
|
515
|
+
inflight = true;
|
|
516
|
+
try {
|
|
517
|
+
const client = getClient(directory);
|
|
518
|
+
const response = await client.call("status", { sessionID: sid });
|
|
519
|
+
if (response && response.success !== false) {
|
|
520
|
+
const snapshot = coerceAftStatus(response);
|
|
521
|
+
setStatus(snapshot);
|
|
522
|
+
try {
|
|
523
|
+
props.api.renderer.requestRender();
|
|
524
|
+
} catch {}
|
|
525
|
+
}
|
|
526
|
+
} catch {} finally {
|
|
527
|
+
inflight = false;
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
const scheduleRefresh = () => {
|
|
531
|
+
if (debounceTimer)
|
|
532
|
+
clearTimeout(debounceTimer);
|
|
533
|
+
debounceTimer = setTimeout(() => {
|
|
534
|
+
debounceTimer = undefined;
|
|
535
|
+
refresh();
|
|
536
|
+
}, REFRESH_DEBOUNCE_MS);
|
|
537
|
+
};
|
|
538
|
+
onCleanup(() => {
|
|
539
|
+
if (debounceTimer)
|
|
540
|
+
clearTimeout(debounceTimer);
|
|
541
|
+
if (pollTimer)
|
|
542
|
+
clearInterval(pollTimer);
|
|
543
|
+
});
|
|
544
|
+
createEffect(on(props.sessionID, () => {
|
|
545
|
+
refresh();
|
|
546
|
+
}));
|
|
547
|
+
createEffect(on(props.sessionID, (sessionID) => {
|
|
548
|
+
if (!sessionID)
|
|
549
|
+
return;
|
|
550
|
+
const unsubs = [
|
|
551
|
+
props.api.event.on("message.updated", (event) => {
|
|
552
|
+
if (event.properties?.info?.sessionID !== sessionID)
|
|
553
|
+
return;
|
|
554
|
+
scheduleRefresh();
|
|
555
|
+
}),
|
|
556
|
+
props.api.event.on("session.updated", (event) => {
|
|
557
|
+
if (event.properties?.info?.id !== sessionID)
|
|
558
|
+
return;
|
|
559
|
+
scheduleRefresh();
|
|
560
|
+
})
|
|
561
|
+
];
|
|
562
|
+
if (!pollTimer) {
|
|
563
|
+
pollTimer = setInterval(() => {
|
|
564
|
+
scheduleRefresh();
|
|
565
|
+
}, POLL_INTERVAL_MS);
|
|
566
|
+
}
|
|
567
|
+
onCleanup(() => {
|
|
568
|
+
for (const unsub of unsubs) {
|
|
569
|
+
try {
|
|
570
|
+
unsub();
|
|
571
|
+
} catch {}
|
|
572
|
+
}
|
|
573
|
+
if (pollTimer) {
|
|
574
|
+
clearInterval(pollTimer);
|
|
575
|
+
pollTimer = undefined;
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
}, { defer: false }));
|
|
579
|
+
const s = createMemo(() => status());
|
|
580
|
+
const searchStatus = () => statusDisplay(s()?.search_index?.status ?? "disabled");
|
|
581
|
+
const semanticStatus = () => statusDisplay(s()?.semantic_index?.status ?? "disabled");
|
|
582
|
+
const trigramBytes = () => s()?.disk?.trigram_disk_bytes ?? 0;
|
|
583
|
+
const semanticBytes = () => s()?.disk?.semantic_disk_bytes ?? 0;
|
|
584
|
+
return /* @__PURE__ */ jsxDEV("box", {
|
|
585
|
+
width: "100%",
|
|
586
|
+
flexDirection: "column",
|
|
587
|
+
border: SINGLE_BORDER,
|
|
588
|
+
borderColor: props.theme.borderActive,
|
|
589
|
+
paddingTop: 1,
|
|
590
|
+
paddingBottom: 1,
|
|
591
|
+
paddingLeft: 1,
|
|
592
|
+
paddingRight: 1,
|
|
593
|
+
children: [
|
|
594
|
+
/* @__PURE__ */ jsxDEV("box", {
|
|
595
|
+
flexDirection: "row",
|
|
596
|
+
justifyContent: "space-between",
|
|
597
|
+
alignItems: "center",
|
|
598
|
+
children: [
|
|
599
|
+
/* @__PURE__ */ jsxDEV("box", {
|
|
600
|
+
paddingLeft: 1,
|
|
601
|
+
paddingRight: 1,
|
|
602
|
+
backgroundColor: props.theme.accent,
|
|
603
|
+
children: /* @__PURE__ */ jsxDEV("text", {
|
|
604
|
+
fg: props.theme.background,
|
|
605
|
+
children: /* @__PURE__ */ jsxDEV("b", {
|
|
606
|
+
children: "AFT"
|
|
607
|
+
}, undefined, false, undefined, this)
|
|
608
|
+
}, undefined, false, undefined, this)
|
|
609
|
+
}, undefined, false, undefined, this),
|
|
610
|
+
/* @__PURE__ */ jsxDEV("text", {
|
|
611
|
+
fg: props.theme.textMuted,
|
|
612
|
+
children: [
|
|
613
|
+
"v",
|
|
614
|
+
s()?.version ?? props.pluginVersion
|
|
615
|
+
]
|
|
616
|
+
}, undefined, true, undefined, this)
|
|
617
|
+
]
|
|
618
|
+
}, undefined, true, undefined, this),
|
|
619
|
+
/* @__PURE__ */ jsxDEV(SectionHeader, {
|
|
620
|
+
theme: props.theme,
|
|
621
|
+
title: "Search Index"
|
|
622
|
+
}, undefined, false, undefined, this),
|
|
623
|
+
/* @__PURE__ */ jsxDEV(StatRow, {
|
|
624
|
+
theme: props.theme,
|
|
625
|
+
label: "Status",
|
|
626
|
+
value: searchStatus().label,
|
|
627
|
+
tone: searchStatus().tone
|
|
628
|
+
}, undefined, false, undefined, this),
|
|
629
|
+
(s()?.search_index?.files ?? null) != null && /* @__PURE__ */ jsxDEV(StatRow, {
|
|
630
|
+
theme: props.theme,
|
|
631
|
+
label: "Files",
|
|
632
|
+
value: formatCount2(s().search_index.files),
|
|
633
|
+
tone: "muted"
|
|
634
|
+
}, undefined, false, undefined, this),
|
|
635
|
+
/* @__PURE__ */ jsxDEV(StatRow, {
|
|
636
|
+
theme: props.theme,
|
|
637
|
+
label: "Disk",
|
|
638
|
+
value: formatBytes2(trigramBytes()),
|
|
639
|
+
tone: "muted"
|
|
640
|
+
}, undefined, false, undefined, this),
|
|
641
|
+
/* @__PURE__ */ jsxDEV(SectionHeader, {
|
|
642
|
+
theme: props.theme,
|
|
643
|
+
title: "Semantic Index"
|
|
644
|
+
}, undefined, false, undefined, this),
|
|
645
|
+
/* @__PURE__ */ jsxDEV(StatRow, {
|
|
646
|
+
theme: props.theme,
|
|
647
|
+
label: "Status",
|
|
648
|
+
value: semanticStatus().label,
|
|
649
|
+
tone: semanticStatus().tone
|
|
650
|
+
}, undefined, false, undefined, this),
|
|
651
|
+
s()?.semantic_index?.status === "loading" && s()?.semantic_index?.entries_total != null && s().semantic_index.entries_total > 0 && /* @__PURE__ */ jsxDEV(StatRow, {
|
|
652
|
+
theme: props.theme,
|
|
653
|
+
label: "Progress",
|
|
654
|
+
value: `${formatCount2(s().semantic_index.entries_done)} / ${formatCount2(s().semantic_index.entries_total)}`,
|
|
655
|
+
tone: "warn"
|
|
656
|
+
}, undefined, false, undefined, this),
|
|
657
|
+
(s()?.semantic_index?.entries ?? null) != null && /* @__PURE__ */ jsxDEV(StatRow, {
|
|
658
|
+
theme: props.theme,
|
|
659
|
+
label: "Entries",
|
|
660
|
+
value: formatCount2(s().semantic_index.entries),
|
|
661
|
+
tone: "muted"
|
|
662
|
+
}, undefined, false, undefined, this),
|
|
663
|
+
/* @__PURE__ */ jsxDEV(StatRow, {
|
|
664
|
+
theme: props.theme,
|
|
665
|
+
label: "Disk",
|
|
666
|
+
value: formatBytes2(semanticBytes()),
|
|
667
|
+
tone: "muted"
|
|
668
|
+
}, undefined, false, undefined, this),
|
|
669
|
+
s()?.semantic_index?.status === "failed" && s()?.semantic_index?.error && /* @__PURE__ */ jsxDEV("box", {
|
|
670
|
+
marginTop: 1,
|
|
671
|
+
width: "100%",
|
|
672
|
+
children: /* @__PURE__ */ jsxDEV("text", {
|
|
673
|
+
fg: props.theme.error,
|
|
674
|
+
children: [
|
|
675
|
+
"\u26A0 ",
|
|
676
|
+
s().semantic_index.error
|
|
677
|
+
]
|
|
678
|
+
}, undefined, true, undefined, this)
|
|
679
|
+
}, undefined, false, undefined, this)
|
|
680
|
+
]
|
|
681
|
+
}, undefined, true, undefined, this);
|
|
682
|
+
};
|
|
683
|
+
function createAftSidebarSlot(api, pluginVersion) {
|
|
684
|
+
return {
|
|
685
|
+
order: 160,
|
|
686
|
+
slots: {
|
|
687
|
+
sidebar_content: (ctx, value) => {
|
|
688
|
+
const theme = createMemo(() => ctx.theme.current);
|
|
689
|
+
return /* @__PURE__ */ jsxDEV(SidebarContent, {
|
|
690
|
+
api,
|
|
691
|
+
sessionID: () => value.session_id,
|
|
692
|
+
theme: theme(),
|
|
693
|
+
pluginVersion
|
|
694
|
+
}, undefined, false, undefined, this);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
// src/tui/index.tsx
|
|
701
|
+
import { jsxDEV as jsxDEV2 } from "@opentui/solid/jsx-dev-runtime";
|
|
339
702
|
var STATUS_COMMAND = "aft-status";
|
|
340
703
|
var rpcClients = new Map;
|
|
341
704
|
function getRpcClient(directory) {
|
|
@@ -398,7 +761,7 @@ async function showStatusDialog(api) {
|
|
|
398
761
|
const newMessage = formatStatusDialogMessage(status);
|
|
399
762
|
if (newMessage !== currentMessage) {
|
|
400
763
|
currentMessage = newMessage;
|
|
401
|
-
api.ui.dialog.replace(() => /* @__PURE__ */
|
|
764
|
+
api.ui.dialog.replace(() => /* @__PURE__ */ jsxDEV2(api.ui.DialogAlert, {
|
|
402
765
|
title: "AFT Status",
|
|
403
766
|
message: currentMessage,
|
|
404
767
|
onConfirm: () => {
|
|
@@ -418,7 +781,7 @@ async function showStatusDialog(api) {
|
|
|
418
781
|
} catch {}
|
|
419
782
|
}, 1500);
|
|
420
783
|
}
|
|
421
|
-
return /* @__PURE__ */
|
|
784
|
+
return /* @__PURE__ */ jsxDEV2(api.ui.DialogAlert, {
|
|
422
785
|
title: "AFT Status",
|
|
423
786
|
message: currentMessage,
|
|
424
787
|
onConfirm: () => {
|
|
@@ -445,7 +808,7 @@ async function showStartupNotifications(api) {
|
|
|
445
808
|
if (announcement.show && announcement.version && announcement.features?.length) {
|
|
446
809
|
const featureText = announcement.features.map((f) => ` \u2022 ${f}`).join(`
|
|
447
810
|
`);
|
|
448
|
-
api.ui.dialog.replace(() => /* @__PURE__ */
|
|
811
|
+
api.ui.dialog.replace(() => /* @__PURE__ */ jsxDEV2(api.ui.DialogAlert, {
|
|
449
812
|
title: `AFT v${announcement.version}`,
|
|
450
813
|
message: `What's new:
|
|
451
814
|
|
|
@@ -465,7 +828,7 @@ ${featureText}`,
|
|
|
465
828
|
const warningText = result.warnings.join(`
|
|
466
829
|
|
|
467
830
|
`);
|
|
468
|
-
api.ui.dialog.replace(() => /* @__PURE__ */
|
|
831
|
+
api.ui.dialog.replace(() => /* @__PURE__ */ jsxDEV2(api.ui.DialogAlert, {
|
|
469
832
|
title: "AFT Warning",
|
|
470
833
|
message: warningText,
|
|
471
834
|
onConfirm: () => {}
|
|
@@ -474,6 +837,9 @@ ${featureText}`,
|
|
|
474
837
|
} catch {}
|
|
475
838
|
}
|
|
476
839
|
var tui = async (api) => {
|
|
840
|
+
try {
|
|
841
|
+
api.slots.register(createAftSidebarSlot(api, package_default.version));
|
|
842
|
+
} catch {}
|
|
477
843
|
api.command.register(() => [
|
|
478
844
|
{
|
|
479
845
|
title: "AFT: Status",
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
2
|
import type { AftConfig } from "./config.js";
|
|
3
3
|
import type { BridgePool } from "./pool.js";
|
|
4
|
+
interface ShellEnvPluginHost {
|
|
5
|
+
trigger?: (name: "shell.env", context: {
|
|
6
|
+
cwd: string;
|
|
7
|
+
sessionID?: string;
|
|
8
|
+
callID?: string;
|
|
9
|
+
}, input: {
|
|
10
|
+
env: Record<string, string>;
|
|
11
|
+
}) => Promise<{
|
|
12
|
+
env?: Record<string, string>;
|
|
13
|
+
}> | {
|
|
14
|
+
env?: Record<string, string>;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
4
17
|
/**
|
|
5
18
|
* Shared context passed to all tool factory functions.
|
|
6
19
|
* Bundles the binary bridge, the OpenCode SDK client, and plugin config.
|
|
@@ -8,8 +21,10 @@ import type { BridgePool } from "./pool.js";
|
|
|
8
21
|
export interface PluginContext {
|
|
9
22
|
pool: BridgePool;
|
|
10
23
|
client: PluginInput["client"];
|
|
24
|
+
plugin?: ShellEnvPluginHost;
|
|
11
25
|
config: AftConfig;
|
|
12
26
|
/** Absolute path to AFT's storage dir (e.g. ~/.local/share/opencode/storage/plugin/aft) */
|
|
13
27
|
storageDir: string;
|
|
14
28
|
}
|
|
29
|
+
export {};
|
|
15
30
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9B,MAAM,EAAE,SAAS,CAAC;IAClB,2FAA2F;IAC3F,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,UAAU,kBAAkB;IAC1B,OAAO,CAAC,EAAE,CACR,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,EAC7D,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KACnC,OAAO,CAAC;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC,GAAG;QAAE,GAAG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