openhermes 4.3.0 → 4.11.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 (143) hide show
  1. package/CONTEXT.md +10 -1
  2. package/README.md +54 -42
  3. package/bootstrap.ts +396 -142
  4. package/harness/agents/oh-browser.md +97 -0
  5. package/harness/agents/oh-builder.md +78 -0
  6. package/harness/agents/oh-facade.md +75 -0
  7. package/harness/agents/oh-fusion.md +45 -0
  8. package/harness/agents/oh-gauntlet.md +71 -0
  9. package/harness/agents/oh-grill.md +71 -0
  10. package/harness/agents/oh-investigate.md +60 -0
  11. package/harness/agents/oh-manifest.md +95 -0
  12. package/harness/agents/oh-plan-review.md +40 -0
  13. package/harness/agents/oh-planner.md +50 -0
  14. package/harness/agents/oh-refactor.md +37 -0
  15. package/harness/agents/oh-retro.md +46 -0
  16. package/harness/agents/oh-review.md +85 -0
  17. package/harness/agents/oh-security.md +83 -0
  18. package/harness/agents/oh-ship.md +76 -0
  19. package/harness/agents/oh-skill-craft.md +38 -0
  20. package/harness/agents/openhermes.md +28 -73
  21. package/harness/codex/AUTOPILOT.md +235 -87
  22. package/harness/codex/CHARTER.md +80 -0
  23. package/harness/instructions/SHELL.md +76 -0
  24. package/harness/lib/background/background.test.ts +197 -0
  25. package/harness/lib/background/index.ts +7 -0
  26. package/harness/lib/background/interfaces.ts +31 -0
  27. package/harness/lib/background/manager.ts +320 -0
  28. package/harness/lib/composer/compose.test.ts +168 -0
  29. package/harness/lib/composer/compose.ts +65 -0
  30. package/harness/lib/composer/fragments/01-identity.md +1 -0
  31. package/harness/lib/composer/fragments/02-delegation.md +6 -0
  32. package/harness/lib/composer/fragments/03-permissions.md +13 -0
  33. package/harness/lib/composer/fragments/04-task-flow.md +15 -0
  34. package/harness/lib/composer/fragments/05-confidence.md +5 -0
  35. package/harness/lib/composer/fragments/06-parallelization.md +17 -0
  36. package/harness/lib/composer/fragments/07-shell.md +41 -0
  37. package/harness/lib/composer/fragments/08-routing.md +8 -0
  38. package/harness/lib/composer/fragments/09-guardrails.md +12 -0
  39. package/harness/lib/composer/index.ts +1 -0
  40. package/harness/lib/hooks/builtins/confidence-gate-hook.ts +70 -0
  41. package/harness/lib/hooks/builtins/delegation-depth-hook.ts +59 -0
  42. package/harness/lib/hooks/builtins/error-recovery-hook.ts +107 -0
  43. package/harness/lib/hooks/builtins/memory-sync-hook.ts +73 -0
  44. package/harness/lib/hooks/builtins/plan-check-hook.ts +43 -0
  45. package/harness/lib/hooks/builtins/route-tracking-hook.ts +147 -0
  46. package/harness/lib/hooks/builtins/sanity-check-hook.ts +52 -0
  47. package/harness/lib/hooks/builtins/shell-detect-hook.ts +96 -0
  48. package/harness/lib/hooks/hooks.test.ts +1016 -0
  49. package/harness/lib/hooks/index.ts +30 -0
  50. package/harness/lib/hooks/registry.ts +416 -0
  51. package/harness/lib/hooks/types.ts +71 -0
  52. package/harness/lib/memory/index.ts +18 -0
  53. package/harness/lib/memory/interfaces.ts +53 -0
  54. package/harness/lib/memory/memory-manager.ts +205 -0
  55. package/harness/lib/memory/memory.test.ts +491 -0
  56. package/harness/lib/memory/plan-store.ts +366 -0
  57. package/harness/lib/recovery/handler.ts +243 -0
  58. package/harness/lib/recovery/index.ts +14 -0
  59. package/harness/lib/recovery/interfaces.ts +48 -0
  60. package/harness/lib/recovery/patterns.ts +149 -0
  61. package/harness/lib/recovery/recovery.test.ts +312 -0
  62. package/harness/lib/sanity/anomaly-tracker.ts +127 -0
  63. package/harness/lib/sanity/checker.ts +178 -0
  64. package/harness/lib/sanity/index.ts +13 -0
  65. package/harness/lib/sanity/interfaces.ts +24 -0
  66. package/harness/lib/sanity/sanity.test.ts +472 -0
  67. package/harness/lib/sync/file-watcher.ts +174 -0
  68. package/harness/lib/sync/index.ts +11 -0
  69. package/harness/lib/sync/interfaces.ts +27 -0
  70. package/harness/lib/sync/plan-sync.ts +536 -0
  71. package/harness/lib/sync/sync.test.ts +832 -0
  72. package/harness/skills/oh-ascii/DEEP.md +292 -0
  73. package/harness/skills/oh-ascii/SKILL.md +31 -0
  74. package/harness/skills/oh-ascii/scripts/check_ascii_alignment.py +596 -0
  75. package/harness/skills/oh-browser/DEEP.md +54 -0
  76. package/harness/skills/oh-browser/SKILL.md +30 -0
  77. package/harness/skills/oh-builder/DEEP.md +63 -0
  78. package/harness/skills/oh-builder/SKILL.md +12 -90
  79. package/harness/skills/oh-expert/DEEP.md +85 -0
  80. package/harness/skills/oh-expert/SKILL.md +13 -106
  81. package/harness/skills/oh-facade/DEEP.md +182 -0
  82. package/harness/skills/oh-facade/SKILL.md +15 -279
  83. package/harness/skills/oh-freeze/DEEP.md +18 -0
  84. package/harness/skills/oh-freeze/SKILL.md +10 -19
  85. package/harness/skills/oh-full-output/DEEP.md +25 -0
  86. package/harness/skills/oh-full-output/SKILL.md +12 -65
  87. package/harness/skills/oh-fusion/DEEP.md +120 -0
  88. package/harness/skills/oh-fusion/SKILL.md +17 -295
  89. package/harness/skills/oh-gauntlet/DEEP.md +77 -0
  90. package/harness/skills/oh-gauntlet/SKILL.md +13 -105
  91. package/harness/skills/oh-grill/DEEP.md +51 -0
  92. package/harness/skills/oh-grill/SKILL.md +12 -63
  93. package/harness/skills/oh-guard/DEEP.md +19 -0
  94. package/harness/skills/oh-guard/SKILL.md +10 -24
  95. package/harness/skills/oh-handoff/DEEP.md +48 -0
  96. package/harness/skills/oh-handoff/SKILL.md +13 -23
  97. package/harness/skills/oh-health/DEEP.md +74 -0
  98. package/harness/skills/oh-health/SKILL.md +13 -76
  99. package/harness/skills/oh-init/DEEP.md +85 -0
  100. package/harness/skills/oh-init/SKILL.md +13 -127
  101. package/harness/skills/oh-investigate/DEEP.md +171 -0
  102. package/harness/skills/oh-investigate/SKILL.md +13 -66
  103. package/harness/skills/oh-issue/DEEP.md +21 -0
  104. package/harness/skills/oh-issue/SKILL.md +11 -27
  105. package/harness/skills/oh-manifest/DEEP.md +92 -0
  106. package/harness/skills/oh-manifest/SKILL.md +12 -109
  107. package/harness/skills/oh-plan-review/DEEP.md +90 -0
  108. package/harness/skills/oh-plan-review/SKILL.md +13 -115
  109. package/harness/skills/oh-planner/DEEP.md +172 -0
  110. package/harness/skills/oh-planner/SKILL.md +12 -149
  111. package/harness/skills/oh-prd/DEEP.md +45 -0
  112. package/harness/skills/oh-prd/SKILL.md +10 -26
  113. package/harness/skills/oh-refactor/DEEP.md +122 -0
  114. package/harness/skills/oh-refactor/SKILL.md +17 -410
  115. package/harness/skills/oh-retro/DEEP.md +26 -0
  116. package/harness/skills/oh-retro/SKILL.md +12 -24
  117. package/harness/skills/oh-review/DEEP.md +87 -0
  118. package/harness/skills/oh-review/SKILL.md +11 -97
  119. package/harness/skills/oh-security/DEEP.md +83 -0
  120. package/harness/skills/oh-security/SKILL.md +14 -96
  121. package/harness/skills/oh-ship/DEEP.md +141 -0
  122. package/harness/skills/oh-ship/SKILL.md +14 -32
  123. package/harness/skills/oh-skill-craft/DEEP.md +369 -0
  124. package/harness/skills/oh-skill-craft/SKILL.md +13 -177
  125. package/harness/skills/oh-skills-link/DEEP.md +16 -0
  126. package/harness/skills/oh-skills-link/SKILL.md +10 -20
  127. package/harness/skills/oh-skills-list/DEEP.md +20 -0
  128. package/harness/skills/oh-skills-list/SKILL.md +9 -22
  129. package/harness/skills/oh-triage/DEEP.md +23 -0
  130. package/harness/skills/oh-triage/SKILL.md +8 -24
  131. package/harness/skills/oh-worktree/DEEP.md +169 -0
  132. package/harness/skills/oh-worktree/SKILL.md +32 -0
  133. package/lib/harness-resolver.ts +8 -10
  134. package/package.json +7 -5
  135. package/tsconfig.json +1 -1
  136. package/harness/codex/CONSTITUTION.md +0 -73
  137. package/harness/codex/ROUTING.md +0 -92
  138. package/harness/commands/oh-doctor.md +0 -26
  139. package/harness/commands/oh-log.md +0 -18
  140. package/harness/instructions/RUNTIME.md +0 -30
  141. package/harness/skills/oh-caveman/SKILL.md +0 -42
  142. package/harness/skills/oh-learn/SKILL.md +0 -101
  143. package/lib/logger.ts +0 -75
@@ -0,0 +1,174 @@
1
+ // PlanFileWatcher — singleton that monitors plan files for external changes
2
+ // using fs.watch with debounced callbacks.
3
+
4
+ import fs from "node:fs";
5
+ import path from "node:path";
6
+
7
+ // ---------------------------------------------------------------------------
8
+ // Constants
9
+ // ---------------------------------------------------------------------------
10
+
11
+ const DEBOUNCE_MS = 500; // Debounce window for file-change events
12
+
13
+ // ---------------------------------------------------------------------------
14
+ // PlanFileWatcher
15
+ // ---------------------------------------------------------------------------
16
+
17
+ export class PlanFileWatcher {
18
+ private static instance: PlanFileWatcher;
19
+
20
+ /** Active fs.FSWatcher instances keyed by directory path. */
21
+ private watchers = new Map<string, fs.FSWatcher>();
22
+
23
+ /** Registered callbacks keyed by directory path. */
24
+ private callbacks = new Map<string, (path: string) => void>();
25
+
26
+ /** Pending debounce timers keyed by directory path. */
27
+ private debounceTimers = new Map<string, ReturnType<typeof setTimeout>>();
28
+
29
+ /** Whether change-notifications are paused. */
30
+ private _paused = false;
31
+
32
+ private constructor() {}
33
+
34
+ /** Get the singleton instance. */
35
+ static getInstance(): PlanFileWatcher {
36
+ if (!PlanFileWatcher.instance) {
37
+ PlanFileWatcher.instance = new PlanFileWatcher();
38
+ }
39
+ return PlanFileWatcher.instance;
40
+ }
41
+
42
+ /** Reset singleton — used in tests. */
43
+ static resetInstance(): void {
44
+ const inst = PlanFileWatcher.instance;
45
+ if (inst) {
46
+ inst.destroy();
47
+ PlanFileWatcher.instance = null as unknown as PlanFileWatcher;
48
+ }
49
+ }
50
+
51
+ // -----------------------------------------------------------------------
52
+ // Public API
53
+ // -----------------------------------------------------------------------
54
+
55
+ /**
56
+ * Start watching `directory` for plan-file changes.
57
+ *
58
+ * When a change is detected, `callback` is invoked with the path of the
59
+ * changed file. Multiple events within DEBOUNCE_MS are coalesced.
60
+ *
61
+ * @param directory — absolute path to the directory containing plan files.
62
+ * @param callback — fired once per debounced change event.
63
+ */
64
+ watch(directory: string, callback: (path: string) => void): void {
65
+ // Unwatch first if already watching this directory (re-registration)
66
+ if (this.watchers.has(directory)) {
67
+ this.unwatch(directory);
68
+ }
69
+
70
+ this.callbacks.set(directory, callback);
71
+
72
+ try {
73
+ const watcher = fs.watch(
74
+ directory,
75
+ { recursive: false },
76
+ (eventType: string, filename: string | null) => {
77
+ // fs.watch may pass null filename on some platforms
78
+ const targetPath = filename ? path.join(directory, filename) : directory;
79
+
80
+ // Debounce — cancel any pending timer, schedule a new one.
81
+ // The _paused check happens at fire time, not here, so events
82
+ // received during pause are debounced and fire on resume.
83
+ const existing = this.debounceTimers.get(directory);
84
+ if (existing) clearTimeout(existing);
85
+
86
+ this.debounceTimers.set(
87
+ directory,
88
+ setTimeout(() => {
89
+ this.debounceTimers.delete(directory);
90
+ const cb = this.callbacks.get(directory);
91
+ if (cb && !this._paused) {
92
+ cb(targetPath);
93
+ }
94
+ }, DEBOUNCE_MS),
95
+ );
96
+ },
97
+ );
98
+
99
+ this.watchers.set(directory, watcher);
100
+ } catch (err) {
101
+ // fs.watch can throw if directory doesn't exist or permissions issues
102
+ console.error(`[PlanFileWatcher] Failed to watch "${directory}":`, err);
103
+ this.watchers.delete(directory);
104
+ this.callbacks.delete(directory);
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Stop watching `directory`.
110
+ */
111
+ unwatch(directory: string): void {
112
+ this.clearDebounce(directory);
113
+
114
+ const watcher = this.watchers.get(directory);
115
+ if (watcher) {
116
+ watcher.close();
117
+ this.watchers.delete(directory);
118
+ }
119
+
120
+ this.callbacks.delete(directory);
121
+ }
122
+
123
+ /**
124
+ * Pause change-notification without losing watch-registrations.
125
+ * While paused, events are still debounced but callbacks are suppressed.
126
+ */
127
+ pause(): void {
128
+ this._paused = true;
129
+ }
130
+
131
+ /**
132
+ * Resume change-notification after a pause.
133
+ * Pending debounced callbacks will fire on the next event.
134
+ */
135
+ resume(): void {
136
+ this._paused = false;
137
+ }
138
+
139
+ /** Check if the watcher is currently paused. */
140
+ get paused(): boolean {
141
+ return this._paused;
142
+ }
143
+
144
+ /** Return the list of currently watched directories. */
145
+ watchedDirectories(): string[] {
146
+ return Array.from(this.watchers.keys());
147
+ }
148
+
149
+ // -----------------------------------------------------------------------
150
+ // Lifecycle
151
+ // -----------------------------------------------------------------------
152
+
153
+ /** Shut down all watchers and clear state. */
154
+ destroy(): void {
155
+ for (const [dir] of this.watchers) {
156
+ this.unwatch(dir);
157
+ }
158
+ this.debounceTimers.clear();
159
+ this.callbacks.clear();
160
+ this._paused = false;
161
+ }
162
+
163
+ // -----------------------------------------------------------------------
164
+ // Internals
165
+ // -----------------------------------------------------------------------
166
+
167
+ private clearDebounce(directory: string): void {
168
+ const timer = this.debounceTimers.get(directory);
169
+ if (timer) {
170
+ clearTimeout(timer);
171
+ this.debounceTimers.delete(directory);
172
+ }
173
+ }
174
+ }
@@ -0,0 +1,11 @@
1
+ // MVCC-Style Plan Synchronization — barrel export.
2
+
3
+ export type {
4
+ SyncPlanEntry,
5
+ PlanSyncState,
6
+ SyncConflict,
7
+ ConflictStrategy,
8
+ } from "./interfaces.ts";
9
+
10
+ export { PlanSync } from "./plan-sync.ts";
11
+ export { PlanFileWatcher } from "./file-watcher.ts";
@@ -0,0 +1,27 @@
1
+ // MVCC-Style Plan Synchronization — type definitions for concurrent-safe plan file access.
2
+
3
+ export interface SyncPlanEntry {
4
+ id: string;
5
+ description: string;
6
+ status: 'pending' | 'in_progress' | 'completed' | 'blocked' | 'cancelled';
7
+ agent?: string;
8
+ timestamp: number;
9
+ version: number;
10
+ }
11
+
12
+ export interface PlanSyncState {
13
+ entries: Map<string, SyncPlanEntry>;
14
+ version: number; // global version counter
15
+ lastWriter: string; // agent/session that last wrote
16
+ lastWriteTime: number;
17
+ }
18
+
19
+ export interface SyncConflict {
20
+ entryId: string;
21
+ localVersion: number;
22
+ remoteVersion: number;
23
+ localStatus: string;
24
+ remoteStatus: string;
25
+ }
26
+
27
+ export type ConflictStrategy = 'last-writer-wins' | 'manual';