iterate-plugin 3.5.7 → 3.7.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 (79) hide show
  1. package/README.md +97 -22
  2. package/README.zh-CN.md +79 -19
  3. package/dist/approval-gate.js +143 -23
  4. package/dist/atomic-fs.js +148 -17
  5. package/dist/config-loader.js +516 -35
  6. package/dist/config-write.js +83 -22
  7. package/dist/evidence.js +141 -87
  8. package/dist/file-lock.js +193 -0
  9. package/dist/index.js +61 -28
  10. package/dist/jobs.js +56 -11
  11. package/dist/live.js +54 -14
  12. package/dist/meta-review.js +132 -28
  13. package/dist/method-scope.js +31 -8
  14. package/dist/review-scope.js +32 -9
  15. package/dist/review.js +96 -17
  16. package/dist/session-hooks.js +61 -14
  17. package/dist/skill-prompt.js +396 -66
  18. package/dist/tools/checkpoint.js +85 -19
  19. package/dist/tools/config.js +44 -2
  20. package/dist/tools/context.js +22 -5
  21. package/dist/tools/decision-log.js +106 -28
  22. package/dist/tools/defense-events.js +90 -31
  23. package/dist/tools/defense-store.js +28 -3
  24. package/dist/tools/experience-bank.js +108 -43
  25. package/dist/tools/experience-store.js +54 -4
  26. package/dist/tools/fix.js +347 -119
  27. package/dist/tools/history.js +68 -14
  28. package/dist/tools/present.js +80 -0
  29. package/dist/tools/prune.js +150 -53
  30. package/dist/tools/quality-gate.js +52 -2
  31. package/dist/tools/quality-store.js +17 -1
  32. package/dist/tools/review.js +158 -7
  33. package/dist/tools/transcript.js +173 -36
  34. package/dist/tools/triage.js +67 -12
  35. package/dist/tools/validate.js +115 -24
  36. package/dist/transcript.js +267 -4
  37. package/dist/working-directory.js +114 -0
  38. package/lib/client.js +1912 -512
  39. package/lib/parse.js +1001 -103
  40. package/package.json +16 -9
  41. package/src/approval-gate.ts +160 -23
  42. package/src/atomic-fs.ts +152 -17
  43. package/src/client/i18n.ts +517 -0
  44. package/src/client/index.ts +1031 -369
  45. package/src/client/session-cache.ts +54 -0
  46. package/src/config-loader.ts +549 -36
  47. package/src/config-write.ts +108 -26
  48. package/src/evidence.ts +194 -92
  49. package/src/file-lock.ts +211 -0
  50. package/src/index.ts +60 -29
  51. package/src/jobs.ts +63 -12
  52. package/src/live.ts +50 -12
  53. package/src/meta-review.ts +151 -34
  54. package/src/method-scope.ts +31 -8
  55. package/src/review-scope.ts +33 -10
  56. package/src/review.ts +96 -17
  57. package/src/session-hooks.ts +60 -13
  58. package/src/skill-prompt.ts +396 -66
  59. package/src/tools/checkpoint.ts +81 -19
  60. package/src/tools/config.ts +44 -2
  61. package/src/tools/context.ts +25 -5
  62. package/src/tools/decision-log.ts +114 -23
  63. package/src/tools/defense-events.ts +87 -31
  64. package/src/tools/defense-store.ts +30 -3
  65. package/src/tools/experience-bank.ts +112 -44
  66. package/src/tools/experience-store.ts +54 -5
  67. package/src/tools/fix.ts +258 -20
  68. package/src/tools/history.ts +74 -15
  69. package/src/tools/present.ts +89 -0
  70. package/src/tools/prune.ts +154 -51
  71. package/src/tools/quality-gate.ts +57 -2
  72. package/src/tools/quality-store.ts +18 -1
  73. package/src/tools/review.ts +155 -6
  74. package/src/tools/transcript.ts +178 -36
  75. package/src/tools/triage.ts +70 -13
  76. package/src/tools/validate.ts +138 -32
  77. package/src/transcript.ts +279 -4
  78. package/src/types.ts +29 -1
  79. package/src/working-directory.ts +126 -0
@@ -0,0 +1,54 @@
1
+ /**
2
+ * src/client/session-cache.ts — the newest session the session-scoped slots saw.
3
+ *
4
+ * Slot scopes in dsh are not uniform: `conversation.input.dock` (dashboard,
5
+ * observatory) renders inside a session and receives `props.session`, while
6
+ * `settings.section` renders at ROOT scope on the settings page and gets no
7
+ * session at all. The settings card nevertheless needs session-derived state —
8
+ * specifically the config the model echoed back through `iterate_config`, which
9
+ * is what closes the config write → read-back loop.
10
+ *
11
+ * Rather than fake a session for the root slot, the session-scoped slots
12
+ * publish what the host handed them and root-scoped panels subscribe:
13
+ *
14
+ * session slot renders → noteSession(props.session)
15
+ * settings panel → useSessionSnapshot() (via subscribeSession)
16
+ *
17
+ * Design constraints (mirrors `i18n.ts`):
18
+ * - **Pure**: no React, no DOM — the store is unit-testable on its own, and
19
+ * the React binding lives next to `useLang()` in index.ts.
20
+ * - **Identity-compared**: the same session object never notifies twice, so
21
+ * a slot that re-renders every frame cannot spin its subscribers.
22
+ * - **Never fabricated**: it only ever holds what the host really passed; an
23
+ * empty cache reads as "nothing echoed yet", which is the honest state.
24
+ */
25
+
26
+ /** Anything host-shaped; the plugins only ever pass it through opaque. */
27
+ export type CachedSession = unknown
28
+
29
+ let current: CachedSession = null
30
+
31
+ const listeners = new Set<() => void>()
32
+
33
+ /**
34
+ * Publish the session a session-scoped slot was rendered with.
35
+ * Notifies subscribers only when the identity actually changes.
36
+ */
37
+ export function noteSession(session: CachedSession): void {
38
+ if (Object.is(session, current)) return
39
+ current = session
40
+ for (const listener of [...listeners]) listener()
41
+ }
42
+
43
+ /** Last published session (or `null` before any session slot has rendered). */
44
+ export function readSession(): CachedSession {
45
+ return current
46
+ }
47
+
48
+ /** Subscribe to session changes; returns the unsubscribe function. */
49
+ export function subscribeSession(listener: () => void): () => void {
50
+ listeners.add(listener)
51
+ return () => {
52
+ listeners.delete(listener)
53
+ }
54
+ }