@cortexkit/opencode-magic-context 0.2.0 → 0.2.2

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.
Files changed (56) hide show
  1. package/README.md +41 -6
  2. package/dist/cli/config-paths.d.ts +9 -0
  3. package/dist/cli/config-paths.d.ts.map +1 -0
  4. package/dist/cli/index.d.ts +3 -0
  5. package/dist/cli/index.d.ts.map +1 -0
  6. package/dist/cli/opencode-helpers.d.ts +19 -0
  7. package/dist/cli/opencode-helpers.d.ts.map +1 -0
  8. package/dist/cli/prompts.d.ts +12 -0
  9. package/dist/cli/prompts.d.ts.map +1 -0
  10. package/dist/cli/setup.d.ts +2 -0
  11. package/dist/cli/setup.d.ts.map +1 -0
  12. package/dist/cli.js +442 -0
  13. package/dist/config/schema/magic-context.d.ts +0 -14
  14. package/dist/config/schema/magic-context.d.ts.map +1 -1
  15. package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
  16. package/dist/features/magic-context/dreamer/queue.d.ts +0 -2
  17. package/dist/features/magic-context/dreamer/queue.d.ts.map +1 -1
  18. package/dist/features/magic-context/memory/embedding-cache.d.ts +8 -0
  19. package/dist/features/magic-context/memory/embedding-cache.d.ts.map +1 -0
  20. package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
  21. package/dist/features/magic-context/memory/index.d.ts +1 -0
  22. package/dist/features/magic-context/memory/index.d.ts.map +1 -1
  23. package/dist/features/magic-context/memory/storage-memory-fts.d.ts.map +1 -1
  24. package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
  25. package/dist/features/magic-context/message-index.d.ts +1 -0
  26. package/dist/features/magic-context/message-index.d.ts.map +1 -1
  27. package/dist/features/magic-context/scheduler.d.ts +1 -1
  28. package/dist/features/magic-context/scheduler.d.ts.map +1 -1
  29. package/dist/features/magic-context/search.d.ts.map +1 -1
  30. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  31. package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
  32. package/dist/features/magic-context/storage-ops.d.ts +0 -1
  33. package/dist/features/magic-context/storage-ops.d.ts.map +1 -1
  34. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  35. package/dist/features/magic-context/storage.d.ts +1 -1
  36. package/dist/features/magic-context/storage.d.ts.map +1 -1
  37. package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
  38. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  40. package/dist/hooks/magic-context/read-session-chunk.d.ts +1 -0
  41. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  42. package/dist/hooks/magic-context/tag-id-fallback.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/transform-context-state.d.ts +1 -1
  44. package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
  45. package/dist/hooks/magic-context/transform.d.ts +1 -0
  46. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  47. package/dist/index.js +1206 -1052
  48. package/dist/plugin/dream-timer.d.ts +1 -1
  49. package/dist/plugin/dream-timer.d.ts.map +1 -1
  50. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  51. package/dist/shared/jsonc-parser.d.ts +0 -9
  52. package/dist/shared/jsonc-parser.d.ts.map +1 -1
  53. package/package.json +6 -2
  54. package/scripts/install.sh +35 -0
  55. package/dist/plugin/hooks/create-tag-content-resolver.d.ts +0 -7
  56. package/dist/plugin/hooks/create-tag-content-resolver.d.ts.map +0 -1
@@ -10,5 +10,5 @@ import type { PluginContext } from "./types";
10
10
  export declare function startDreamScheduleTimer(args: {
11
11
  client: PluginContext["client"];
12
12
  dreamerConfig: DreamerConfig;
13
- }): void;
13
+ }): (() => void) | undefined;
14
14
  //# sourceMappingURL=dream-timer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dream-timer.d.ts","sourceRoot":"","sources":["../../src/plugin/dream-timer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAIpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC1C,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,aAAa,EAAE,aAAa,CAAC;CAChC,GAAG,IAAI,CAkCP"}
1
+ {"version":3,"file":"dream-timer.d.ts","sourceRoot":"","sources":["../../src/plugin/dream-timer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAIpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC1C,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,aAAa,EAAE,aAAa,CAAC;CAChC,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAuC3B"}
@@ -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,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;CAC1C;;;;;;qBAiBW,CAAJ;;;;;;;;;;;;qBAkBQ,CAAV;mBAAkB,CAAA;;;;;0BAOgpT,CAAC;;;;;;EADxqT"}
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,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;CAC1C;;;;;;qBAiBW,CAAJ;;;;;;;;;;;;qBAkBQ,CAAV;mBAAkB,CAAA;;;;;0BAO03T,CAAC;;;;;;EADl5T"}
@@ -1,13 +1,4 @@
1
- export interface JsoncParseResult<T> {
2
- data: T | null;
3
- errors: Array<{
4
- message: string;
5
- offset: number;
6
- length: number;
7
- }>;
8
- }
9
1
  export declare function parseJsonc<T = unknown>(content: string): T;
10
- export declare function parseJsoncSafe<T = unknown>(content: string): JsoncParseResult<T>;
11
2
  export declare function readJsoncFile<T = unknown>(filePath: string): T | null;
12
3
  export declare function detectConfigFile(basePath: string): {
13
4
  format: "json" | "jsonc" | "none";
@@ -1 +1 @@
1
- {"version":3,"file":"jsonc-parser.d.ts","sourceRoot":"","sources":["../../src/shared/jsonc-parser.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtE;AA4GD,wBAAgB,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAG1D;AAED,wBAAgB,cAAc,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAkBhF;AAED,wBAAgB,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAMrE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAChD,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;CAChB,CAaA"}
1
+ {"version":3,"file":"jsonc-parser.d.ts","sourceRoot":"","sources":["../../src/shared/jsonc-parser.ts"],"names":[],"mappings":"AA4GA,wBAAgB,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAG1D;AAED,wBAAgB,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAMrE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAChD,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;CAChB,CAaA"}
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-magic-context",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "opencode-magic-context": "dist/cli.js"
10
+ },
8
11
  "author": "ualtinok",
9
12
  "license": "MIT",
10
13
  "keywords": [
@@ -23,10 +26,11 @@
23
26
  },
24
27
  "files": [
25
28
  "dist",
29
+ "scripts/install.sh",
26
30
  "README.md"
27
31
  ],
28
32
  "scripts": {
29
- "build": "bun build src/index.ts --outdir dist --target bun --format esm --external @huggingface/transformers --external @opencode-ai/plugin && tsc --emitDeclarationOnly",
33
+ "build": "bun build src/index.ts --outdir dist --target bun --format esm --external @huggingface/transformers --external @opencode-ai/plugin && bun build src/cli/index.ts --outfile dist/cli.js --target node --format esm && tsc --emitDeclarationOnly",
30
34
  "typecheck": "tsc --noEmit && tsc -p tsconfig.scripts.json",
31
35
  "test": "bun test",
32
36
  "lint": "biome check .",
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Magic Context — Interactive Setup
5
+ # Usage: curl -fsSL https://raw.githubusercontent.com/cortexkit/opencode-magic-context/master/scripts/install.sh | bash
6
+
7
+ PACKAGE="@cortexkit/opencode-magic-context"
8
+
9
+ main() {
10
+ echo ""
11
+ echo " ✨ Magic Context — Setup"
12
+ echo " ────────────────────────"
13
+ echo ""
14
+
15
+ # Detect runtime
16
+ if command -v bun &>/dev/null; then
17
+ echo " → Using bun"
18
+ echo ""
19
+ bunx "$PACKAGE" setup
20
+ elif command -v npx &>/dev/null; then
21
+ echo " → Using npx"
22
+ echo ""
23
+ npx -y "$PACKAGE" setup
24
+ else
25
+ echo " ✗ Neither bun nor npx found."
26
+ echo ""
27
+ echo " Install one of:"
28
+ echo " • bun: curl -fsSL https://bun.sh/install | bash"
29
+ echo " • node: https://nodejs.org"
30
+ echo ""
31
+ exit 1
32
+ fi
33
+ }
34
+
35
+ main "$@"
@@ -1,7 +0,0 @@
1
- import type { openDatabase } from "../../features/magic-context/storage";
2
- import type { PluginContext } from "../types";
3
- export declare function createTagContentResolver(ctx: PluginContext, db: ReturnType<typeof openDatabase>): {
4
- resolveTagContent: (sessionId: string, tagId: number, skipCache?: boolean) => Promise<string | null>;
5
- clearCache: (sessionId?: string) => void;
6
- };
7
- //# sourceMappingURL=create-tag-content-resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-tag-content-resolver.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/create-tag-content-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAwC9C,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC;mCAsC7E,MAAM,SACV,MAAM,0BAEd,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;6BArCO,MAAM,KAAG,IAAI;EAuEhD"}