@wolfx/opencode-magic-context 0.21.8-patch.1 → 0.21.8-patch.4
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/config/index.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +14 -5
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +2 -0
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/text-complete.d.ts +39 -1
- package/dist/hooks/magic-context/text-complete.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1019 -1613
- package/dist/plugin/event.d.ts +0 -3
- package/dist/plugin/event.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/hooks/auto-update-checker/cache.d.ts +0 -23
- package/dist/hooks/auto-update-checker/cache.d.ts.map +0 -1
- package/dist/hooks/auto-update-checker/checker.d.ts +0 -13
- package/dist/hooks/auto-update-checker/checker.d.ts.map +0 -1
- package/dist/hooks/auto-update-checker/constants.d.ts +0 -10
- package/dist/hooks/auto-update-checker/constants.d.ts.map +0 -1
- package/dist/hooks/auto-update-checker/index.d.ts +0 -40
- package/dist/hooks/auto-update-checker/index.d.ts.map +0 -1
- package/dist/hooks/auto-update-checker/types.d.ts +0 -50
- package/dist/hooks/auto-update-checker/types.d.ts.map +0 -1
package/dist/plugin/event.d.ts
CHANGED
|
@@ -4,9 +4,6 @@ export declare function createEventHandler(args: {
|
|
|
4
4
|
event: import("@opencode-ai/sdk").Event;
|
|
5
5
|
}) => Promise<void>;
|
|
6
6
|
} | null;
|
|
7
|
-
autoUpdateChecker?: ((input: {
|
|
8
|
-
event: import("@opencode-ai/sdk").Event;
|
|
9
|
-
}) => Promise<void>) | null;
|
|
10
7
|
}): (input: {
|
|
11
8
|
event: import("@opencode-ai/sdk").Event;
|
|
12
9
|
}) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/plugin/event.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,YAAY,EAAE;QACV,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE;YAAE,KAAK,EAAE,OAAO,kBAAkB,EAAE,KAAK,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACjF,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/plugin/event.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,YAAY,EAAE;QACV,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE;YAAE,KAAK,EAAE,OAAO,kBAAkB,EAAE,KAAK,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACjF,GAAG,IAAI,CAAC;CACZ,GAAG,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,OAAO,kBAAkB,EAAE,KAAK,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAIxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-session-hooks.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/create-session-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAU7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;;;;;;qBAoDkuJ,CAAC;;;;;;;;;;;;qBAA9sC,CAAC;mBAAyB,CAAC;iBAAuB,CAAC;iBAAuB,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;;;;
|
|
1
|
+
{"version":3,"file":"create-session-hooks.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/create-session-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAU7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;;;;;;qBAoDkuJ,CAAC;;;;;;;;;;;;qBAA9sC,CAAC;mBAAyB,CAAC;iBAAuB,CAAC;iBAAuB,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;;;;0BAA8xuB,CAAC;;;;;;EADh61B"}
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
interface AutoUpdateInstallContext {
|
|
2
|
-
installDir: string;
|
|
3
|
-
packageJsonPath: string;
|
|
4
|
-
}
|
|
5
|
-
export declare function resolveInstallContext(runtimePackageJsonPath?: string | null): AutoUpdateInstallContext | null;
|
|
6
|
-
export declare function preparePackageUpdate(version: string, packageName?: string, runtimePackageJsonPath?: string | null): string | null;
|
|
7
|
-
/**
|
|
8
|
-
* Run `npm install` in the install dir to materialize the dependency version
|
|
9
|
-
* we just rewrote. Earlier versions used `bun install`, but OpenCode itself
|
|
10
|
-
* installs plugins via npm (the install dir always contains package-lock.json,
|
|
11
|
-
* never bun.lock), so calling npm matches the existing lockfile shape and
|
|
12
|
-
* avoids generating a parallel bun.lock that drifts from OpenCode's view.
|
|
13
|
-
*
|
|
14
|
-
* The default timeout is 60s — long enough for a typical reinstall over a
|
|
15
|
-
* mediocre network, short enough that a stuck install doesn't pin the plugin
|
|
16
|
-
* process. Caller can override.
|
|
17
|
-
*/
|
|
18
|
-
export declare function runNpmInstallSafe(installDir: string, options?: {
|
|
19
|
-
timeoutMs?: number;
|
|
20
|
-
signal?: AbortSignal;
|
|
21
|
-
}): Promise<boolean>;
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/cache.ts"],"names":[],"mappings":"AAmBA,UAAU,wBAAwB;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAgGD,wBAAgB,qBAAqB,CACjC,sBAAsB,GAAE,MAAM,GAAG,IAAyC,GAC3E,wBAAwB,GAAG,IAAI,CA2CjC;AAED,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,MAAqB,EAClC,sBAAsB,GAAE,MAAM,GAAG,IAAyC,GAC3E,MAAM,GAAG,IAAI,CAyBf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACnC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GAC3D,OAAO,CAAC,OAAO,CAAC,CA2ClB"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type PluginEntryInfo } from "./types";
|
|
2
|
-
export declare function extractChannel(version: string | null): string;
|
|
3
|
-
export declare function getLocalDevVersion(directory: string): string | null;
|
|
4
|
-
export declare function getCurrentRuntimePackageJsonPath(currentModuleUrl?: string): string | null;
|
|
5
|
-
export declare function findPluginEntry(directory: string): PluginEntryInfo | null;
|
|
6
|
-
export declare function getCachedVersion(spec?: string | null): string | null;
|
|
7
|
-
export declare function updatePinnedVersion(configPath: string, oldEntry: string, newVersion: string): boolean;
|
|
8
|
-
export declare function getLatestVersion(channel?: string, options?: {
|
|
9
|
-
registryUrl?: string;
|
|
10
|
-
timeoutMs?: number;
|
|
11
|
-
signal?: AbortSignal;
|
|
12
|
-
}): Promise<string | null>;
|
|
13
|
-
//# sourceMappingURL=checker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/checker.ts"],"names":[],"mappings":"AAeA,OAAO,EAIH,KAAK,eAAe,EACvB,MAAM,SAAS,CAAC;AAqCjB,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAY7D;AA4ED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYnE;AAED,wBAAgB,gCAAgC,CAC5C,gBAAgB,GAAE,MAAwB,GAC3C,MAAM,GAAG,IAAI,CAOf;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CA2BzE;AAQD,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CA0BpE;AAED,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACnB,OAAO,CAwBT;AAMD,wBAAsB,gBAAgB,CAClC,OAAO,SAAW,EAClB,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GACjF,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuBxB"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const PACKAGE_NAME = "@wolfx/opencode-magic-context";
|
|
2
|
-
export declare const NPM_REGISTRY_URL = "https://registry.npmjs.org";
|
|
3
|
-
export declare const NPM_FETCH_TIMEOUT = 10000;
|
|
4
|
-
/** Root directory OpenCode uses for cached npm plugin wrapper installs. */
|
|
5
|
-
export declare const CACHE_DIR: string;
|
|
6
|
-
/** Primary OpenCode configuration file path (standard JSON). */
|
|
7
|
-
export declare const USER_OPENCODE_CONFIG: string;
|
|
8
|
-
/** Alternative OpenCode configuration file path (JSON with Comments). */
|
|
9
|
-
export declare const USER_OPENCODE_CONFIG_JSONC: string;
|
|
10
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,kCAAkC,CAAC;AAC5D,eAAO,MAAM,gBAAgB,+BAA+B,CAAC;AAC7D,eAAO,MAAM,iBAAiB,QAAS,CAAC;AAgBxC,2EAA2E;AAC3E,eAAO,MAAM,SAAS,QAA2C,CAAC;AAElE,gEAAgE;AAChE,eAAO,MAAM,oBAAoB,QAAiD,CAAC;AAEnF,yEAAyE;AACzE,eAAO,MAAM,0BAA0B,QAAkD,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
import type { AutoUpdateCheckerOptions } from "./types";
|
|
3
|
-
type OpenCodeEvent = {
|
|
4
|
-
type: string;
|
|
5
|
-
properties?: unknown;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Auto-update checker.
|
|
9
|
-
*
|
|
10
|
-
* Trigger model (rewritten in v0.17.1):
|
|
11
|
-
*
|
|
12
|
-
* The check fires from plugin initialization itself via a `setTimeout`
|
|
13
|
-
* scheduled when this hook is created. We do NOT gate on
|
|
14
|
-
* `session.created` events — that gate was unreliable because:
|
|
15
|
-
*
|
|
16
|
-
* - TUI restart with a resumed session never fires `session.created`
|
|
17
|
-
* (the event fires on session creation, not on plugin reload).
|
|
18
|
-
* - Multi-project plugin reloads each get their own plugin lifetime
|
|
19
|
-
* with `hasChecked = false`, so only whichever project happens to
|
|
20
|
-
* create a fresh session first ever runs the check.
|
|
21
|
-
* - Sidebar/status polling and idle TUI use also never fire
|
|
22
|
-
* `session.created`.
|
|
23
|
-
*
|
|
24
|
-
* Multi-project coordination is now handled by an on-disk timestamp at
|
|
25
|
-
* `<storageDir>/last-update-check.json`. Every plugin instance reads
|
|
26
|
-
* the timestamp before checking; if it's within `checkIntervalMs` of
|
|
27
|
-
* now, the check is skipped. The first instance to claim the slot
|
|
28
|
-
* writes the timestamp atomically (temp + rename) so concurrent
|
|
29
|
-
* instances don't all hit npm.
|
|
30
|
-
*
|
|
31
|
-
* The returned event hook is preserved as a no-op so existing tests
|
|
32
|
-
* that pass synthetic events keep working — the hook itself never
|
|
33
|
-
* triggers a check now.
|
|
34
|
-
*/
|
|
35
|
-
export declare function createAutoUpdateCheckerHook(ctx: PluginInput, options?: AutoUpdateCheckerOptions): (_input: {
|
|
36
|
-
event: OpenCodeEvent;
|
|
37
|
-
}) => Promise<void>;
|
|
38
|
-
export declare function getAutoUpdateInstallDir(): string;
|
|
39
|
-
export type { AutoUpdateCheckerOptions } from "./types";
|
|
40
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAYvD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAExD,KAAK,aAAa,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAgBF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,2BAA2B,CACvC,GAAG,EAAE,WAAW,EAChB,OAAO,GAAE,wBAA6B,YAiBZ;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,mBAyCrD;AA0MD,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAYD,YAAY,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const NpmPackageEnvelopeSchema: z.ZodObject<{
|
|
3
|
-
"dist-tags": z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
4
|
-
}, z.core.$strip>;
|
|
5
|
-
export declare const OpencodePluginTupleSchema: z.ZodTuple<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>], null>;
|
|
6
|
-
export declare const OpencodeConfigSchema: z.ZodObject<{
|
|
7
|
-
plugin: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>], null>]>>>;
|
|
8
|
-
}, z.core.$strip>;
|
|
9
|
-
export declare const PackageJsonSchema: z.ZodObject<{
|
|
10
|
-
name: z.ZodOptional<z.ZodString>;
|
|
11
|
-
version: z.ZodOptional<z.ZodString>;
|
|
12
|
-
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
13
|
-
}, z.core.$loose>;
|
|
14
|
-
export interface AutoUpdateCheckerOptions {
|
|
15
|
-
enabled?: boolean;
|
|
16
|
-
showStartupToast?: boolean;
|
|
17
|
-
autoUpdate?: boolean;
|
|
18
|
-
npmRegistryUrl?: string;
|
|
19
|
-
fetchTimeoutMs?: number;
|
|
20
|
-
signal?: AbortSignal;
|
|
21
|
-
/**
|
|
22
|
-
* Storage directory used for cross-process check coordination. The
|
|
23
|
-
* checker writes `last-update-check.json` here so concurrent plugin
|
|
24
|
-
* instances (multi-project TUI launches) only hit npm once per
|
|
25
|
-
* `checkIntervalMs`. Pass `null`/omit for fail-open behavior — the
|
|
26
|
-
* check still runs, just without dedup. Recommended: pass the
|
|
27
|
-
* plugin's existing storage path (e.g. `getMagicContextStorageDir()`).
|
|
28
|
-
*/
|
|
29
|
-
storageDir?: string | null;
|
|
30
|
-
/**
|
|
31
|
-
* Minimum interval between checks across all plugin instances on
|
|
32
|
-
* this machine. Default: 1 hour.
|
|
33
|
-
*/
|
|
34
|
-
checkIntervalMs?: number;
|
|
35
|
-
/**
|
|
36
|
-
* Delay before the post-init check fires. Lets OpenCode finish boot
|
|
37
|
-
* before the npm round-trip starts. Default: 5000ms.
|
|
38
|
-
*/
|
|
39
|
-
initDelayMs?: number;
|
|
40
|
-
}
|
|
41
|
-
export interface PluginEntryInfo {
|
|
42
|
-
entry: string;
|
|
43
|
-
isPinned: boolean;
|
|
44
|
-
pinnedVersion: string | null;
|
|
45
|
-
configPath: string;
|
|
46
|
-
}
|
|
47
|
-
export type NpmPackageEnvelope = z.infer<typeof NpmPackageEnvelopeSchema>;
|
|
48
|
-
export type OpencodeConfig = z.infer<typeof OpencodeConfigSchema>;
|
|
49
|
-
export type PackageJson = z.infer<typeof PackageJsonSchema>;
|
|
50
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,wBAAwB;;iBAEnC,CAAC;AAEH,eAAO,MAAM,yBAAyB,yEAA2D,CAAC;AAElG,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;iBAMZ,CAAC;AAEnB,MAAM,WAAW,wBAAwB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|