@retaw106/mmc-oc 2.1.1 → 2.2.0

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 (101) hide show
  1. package/dist/agents/memory-maintainer.d.ts +9 -0
  2. package/dist/agents/memory-maintainer.d.ts.map +1 -1
  3. package/dist/cli.js +0 -1
  4. package/dist/config/project-security.d.ts +0 -2
  5. package/dist/config/project-security.d.ts.map +1 -1
  6. package/dist/config/schema/magic-context.d.ts +0 -5
  7. package/dist/config/schema/magic-context.d.ts.map +1 -1
  8. package/dist/config-init.js +0 -1
  9. package/dist/{context-cx3y8abt.js → context-mrvm92n8.js} +3469 -3134
  10. package/dist/features/magic-context/memory-maintainer/oc2-adapter.d.ts +0 -6
  11. package/dist/features/magic-context/memory-maintainer/oc2-adapter.d.ts.map +1 -1
  12. package/dist/features/magic-context/migrations.d.ts +5 -0
  13. package/dist/features/magic-context/migrations.d.ts.map +1 -1
  14. package/dist/features/magic-context/session-project-backfill.d.ts +1 -1
  15. package/dist/features/magic-context/session-project-backfill.d.ts.map +1 -1
  16. package/dist/features/magic-context/storage-clone.d.ts.map +1 -1
  17. package/dist/features/magic-context/storage-db.d.ts +8 -0
  18. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  19. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  20. package/dist/features/magic-context/storage.d.ts +1 -1
  21. package/dist/features/magic-context/storage.d.ts.map +1 -1
  22. package/dist/hooks/magic-context/cache-busting-signals.d.ts +6 -3
  23. package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
  24. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +0 -1
  25. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  26. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
  27. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
  28. package/dist/hooks/magic-context/default-protection-pressure.test-support.d.ts +37 -0
  29. package/dist/hooks/magic-context/default-protection-pressure.test-support.d.ts.map +1 -0
  30. package/dist/hooks/magic-context/drop-stale-reduce-calls.d.ts +4 -0
  31. package/dist/hooks/magic-context/drop-stale-reduce-calls.d.ts.map +1 -1
  32. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  33. package/dist/hooks/magic-context/latest-thinking-recovery.d.ts +61 -0
  34. package/dist/hooks/magic-context/latest-thinking-recovery.d.ts.map +1 -0
  35. package/dist/hooks/magic-context/lkg-replay.d.ts +9 -0
  36. package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
  37. package/dist/hooks/magic-context/lkg-slot.d.ts +2 -0
  38. package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/read-session-chunk.d.ts +8 -1
  40. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
  42. package/dist/hooks/magic-context/strip-content.d.ts +4 -2
  43. package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
  44. package/dist/hooks/magic-context/system-injection-stripper.d.ts +7 -0
  45. package/dist/hooks/magic-context/system-injection-stripper.d.ts.map +1 -1
  46. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  47. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
  48. package/dist/hooks/magic-context/tool-drop-target.d.ts +5 -0
  49. package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
  50. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +23 -7
  51. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  52. package/dist/hooks/magic-context/transform.d.ts +0 -6
  53. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  54. package/dist/{index-wtb9hzk6.js → index-5b7x80ec.js} +126 -44
  55. package/dist/{index-dr0gepzw.js → index-btp5tdc8.js} +182 -31
  56. package/dist/{index-n0vnzz6h.js → index-g2z2k5m4.js} +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  59. package/dist/{read-session-chunk-82rkqa8j.js → read-session-chunk-2xm4sc4y.js} +1 -1
  60. package/dist/{recomp-orchestrator-vc5dkzy2.js → recomp-orchestrator-frmwj9hz.js} +3 -3
  61. package/dist/shared/pi-executable.d.ts +1 -1
  62. package/dist/shared/pi-executable.d.ts.map +1 -1
  63. package/dist/shared/prompt-surface-runtime.d.ts +1 -1
  64. package/dist/shared/subagent-runner.d.ts +22 -1
  65. package/dist/shared/subagent-runner.d.ts.map +1 -1
  66. package/dist/tools/light-descriptions.d.ts +1 -1
  67. package/dist/tools/light-descriptions.d.ts.map +1 -1
  68. package/dist/tools/parameter-descriptions.d.ts +1 -3
  69. package/dist/tools/parameter-descriptions.d.ts.map +1 -1
  70. package/dist/v2/hooks/context.d.ts.map +1 -1
  71. package/dist/v2/hooks/hidden-child.d.ts +15 -2
  72. package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
  73. package/dist/v2/hooks/store.d.ts.map +1 -1
  74. package/dist/v2/server.js +3472 -2907
  75. package/dist/web/main.js +9 -3
  76. package/dist/{wrapup-orchestrator-x9xamts2.js → wrapup-orchestrator-yknks3ad.js} +3 -3
  77. package/package.json +1 -1
  78. package/src/agents/memory-maintainer.ts +12 -0
  79. package/src/config/index.test.ts +0 -17
  80. package/src/config/project-security.test.ts +0 -8
  81. package/src/config/project-security.ts +0 -9
  82. package/src/config/protected-tools.test.ts +72 -0
  83. package/src/config/schema/magic-context.test.ts +0 -6
  84. package/src/config/schema/magic-context.ts +1 -10
  85. package/src/shared/fold-render-lock-fence.test.ts +84 -0
  86. package/src/shared/fold-render-lock-fixtures.test.ts +270 -0
  87. package/src/shared/pi-executable.ts +3 -3
  88. package/src/shared/rpc-utils.test.ts +4 -5
  89. package/src/shared/sqlite-640-review.test.ts +184 -0
  90. package/src/shared/sqlite-context-pragmas.test.ts +105 -0
  91. package/src/shared/sqlite-writer-diagnostics.test.ts +136 -0
  92. package/src/shared/subagent-runner.ts +24 -0
  93. package/src/shared/tag-transcript.test.ts +55 -0
  94. package/src/shared/tag-transcript.ts +6 -0
  95. package/src/shared/write-transaction-attribution.test.ts +4 -0
  96. package/src/shared/write-transaction-timing.test.ts +39 -0
  97. package/dist/hooks/magic-context/historian-state-file.d.ts +0 -43
  98. package/dist/hooks/magic-context/historian-state-file.d.ts.map +0 -1
  99. package/dist/shared/auto-update-provenance.d.ts +0 -9
  100. package/dist/shared/auto-update-provenance.d.ts.map +0 -1
  101. package/src/shared/auto-update-provenance.ts +0 -42
@@ -1,43 +0,0 @@
1
- /**
2
- * Historian state-file offloading.
3
- *
4
- * When the existing-state XML (prior compartments + facts + project memory)
5
- * exceeds {@link HISTORIAN_STATE_INLINE_THRESHOLD} characters, the historian
6
- * caller writes it to a temp file under the project-local historian dir
7
- * (`<project>/.opencode/magic-context/historian/`) and the prompt instructs
8
- * the model to `Read this file first`. This avoids pushing 100K+ chars of
9
- * inline reference state through the model's input on long sessions, which
10
- * on some provider/model combinations (notably github-copilot/gpt-5.4 via
11
- * the openai-responses API) causes the model to stall before emitting any
12
- * output tokens.
13
- *
14
- * The state file lives INSIDE the project directory rather than under
15
- * `os.tmpdir()` because OpenCode's `external_directory` permission system
16
- * asks the user before letting the historian subagent's Read tool open any
17
- * file outside the project. Anchoring under `<project>/.opencode/` keeps
18
- * the file inside the project boundary so historian runs never trigger a
19
- * permission prompt.
20
- *
21
- * The caller MUST delete the file in finally{} via
22
- * {@link cleanupHistorianStateFile}.
23
- *
24
- * Shared between OpenCode (`compartment-runner-incremental.ts`,
25
- * `compartment-runner-recomp.ts`) and Pi (`pi-historian-runner.ts`). The
26
- * directory is resolved from the project directory the caller passes in —
27
- * both harnesses already track this on their runner deps.
28
- */
29
- export declare const HISTORIAN_STATE_INLINE_THRESHOLD = 30000;
30
- /**
31
- * When existingState is large, write it to a project-local file and return the
32
- * path. Returns undefined when existingState is small enough to inline OR when
33
- * writing fails (in which case the caller should fall back to inline).
34
- *
35
- * `directory` is the project directory; the helper writes under
36
- * `<directory>/.opencode/magic-context/historian/`. The dir is created
37
- * recursively on first write, so the call is safe on fresh projects that have
38
- * never had a `.opencode/` subtree.
39
- */
40
- export declare function maybeWriteHistorianStateFile(sessionId: string, existingState: string, directory: string): string | undefined;
41
- /** Delete a previously written state file. Safe to call with undefined. */
42
- export declare function cleanupHistorianStateFile(path: string | undefined): void;
43
- //# sourceMappingURL=historian-state-file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"historian-state-file.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/historian-state-file.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,gCAAgC,QAAS,CAAC;AAEvD;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CACxC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAClB,MAAM,GAAG,SAAS,CAapB;AAED,2EAA2E;AAC3E,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAOxE"}
@@ -1,9 +0,0 @@
1
- export declare const AUTO_UPDATE_CHECK_STATE_FILENAME = "last-update-check.json";
2
- export interface AutoUpdateCheckState {
3
- lastCheckedMs?: number;
4
- updaterPinnedSpec?: string;
5
- updaterPinnedAt?: number;
6
- }
7
- export declare function readAutoUpdateCheckState(path: string): AutoUpdateCheckState | null;
8
- export declare function isUpdaterPinnedSpec(state: AutoUpdateCheckState | null, configuredSpec: string): boolean;
9
- //# sourceMappingURL=auto-update-provenance.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-update-provenance.d.ts","sourceRoot":"","sources":["../../src/shared/auto-update-provenance.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gCAAgC,2BAA2B,CAAC;AAEzE,MAAM,WAAW,oBAAoB;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAoBlF;AAED,wBAAgB,mBAAmB,CAC/B,KAAK,EAAE,oBAAoB,GAAG,IAAI,EAClC,cAAc,EAAE,MAAM,GACvB,OAAO,CAMT"}
@@ -1,42 +0,0 @@
1
- import { existsSync, readFileSync } from "node:fs";
2
-
3
- export const AUTO_UPDATE_CHECK_STATE_FILENAME = "last-update-check.json";
4
-
5
- export interface AutoUpdateCheckState {
6
- lastCheckedMs?: number;
7
- updaterPinnedSpec?: string;
8
- updaterPinnedAt?: number;
9
- }
10
-
11
- export function readAutoUpdateCheckState(path: string): AutoUpdateCheckState | null {
12
- if (!existsSync(path)) return null;
13
- try {
14
- const value = JSON.parse(readFileSync(path, "utf-8")) as unknown;
15
- if (!value || typeof value !== "object" || Array.isArray(value)) return null;
16
- const raw = value as Record<string, unknown>;
17
- const state: AutoUpdateCheckState = {};
18
- if (typeof raw.lastCheckedMs === "number" && Number.isFinite(raw.lastCheckedMs)) {
19
- state.lastCheckedMs = raw.lastCheckedMs;
20
- }
21
- if (typeof raw.updaterPinnedSpec === "string" && raw.updaterPinnedSpec.length > 0) {
22
- state.updaterPinnedSpec = raw.updaterPinnedSpec;
23
- }
24
- if (typeof raw.updaterPinnedAt === "number" && Number.isFinite(raw.updaterPinnedAt)) {
25
- state.updaterPinnedAt = raw.updaterPinnedAt;
26
- }
27
- return state;
28
- } catch {
29
- return null;
30
- }
31
- }
32
-
33
- export function isUpdaterPinnedSpec(
34
- state: AutoUpdateCheckState | null,
35
- configuredSpec: string,
36
- ): boolean {
37
- return (
38
- state?.updaterPinnedSpec === configuredSpec &&
39
- typeof state.updaterPinnedAt === "number" &&
40
- Number.isFinite(state.updaterPinnedAt)
41
- );
42
- }