@cgh567/agent 2.4.2 → 2.4.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.
Files changed (157) hide show
  1. package/agents/business/talisman-ceo.md +183 -0
  2. package/agents/business/talisman-comms.md +257 -0
  3. package/agents/business/talisman-cto.md +153 -0
  4. package/agents/business/talisman-finance.md +246 -0
  5. package/agents/business/talisman-marketing.md +240 -0
  6. package/agents/business/talisman-sales.md +242 -0
  7. package/agents/business/talisman-support.md +236 -0
  8. package/bin/helios-rpc.js +19 -0
  9. package/daemon/adapters/helios-rpc-adapter.js +5 -12
  10. package/daemon/adapters/tui_wakeup.js +8 -0
  11. package/daemon/context-enrichment.js +27 -0
  12. package/daemon/daemon-manager.js +1 -1
  13. package/daemon/db/email-infrastructure-migrate.js +192 -0
  14. package/daemon/db/hbo-core-migrate.js +189 -0
  15. package/daemon/helios-api.js +863 -64
  16. package/daemon/helios-company-daemon.js +233 -33
  17. package/daemon/lib/blast-radius-analyzer.js +75 -0
  18. package/daemon/lib/domain-bootstrap-orchestrator.js +267 -0
  19. package/daemon/lib/forensic-log.js +113 -0
  20. package/daemon/lib/goal-research-pipeline.js +644 -0
  21. package/daemon/lib/harada/cascade-judge.js +84 -1
  22. package/daemon/lib/harada/cascade-research-dispatcher.js +282 -0
  23. package/daemon/lib/harada/pillar-dispatcher.js +23 -2
  24. package/daemon/lib/hbo-bridge.js +74 -6
  25. package/daemon/lib/headroom-middleware.js +129 -0
  26. package/daemon/lib/headroom-proxy-manager.js +309 -0
  27. package/daemon/lib/hed-engine.js +25 -0
  28. package/daemon/lib/intelligence/department-page-generator.js +46 -1
  29. package/daemon/lib/interpretation-engine.js +92 -0
  30. package/daemon/lib/mental-model-cache.js +96 -0
  31. package/daemon/lib/project-factory.js +47 -0
  32. package/daemon/lib/session-log-reader.js +93 -0
  33. package/daemon/lib/standard-work-bootstrap.js +87 -1
  34. package/daemon/lib/task-completion-processor.js +23 -0
  35. package/daemon/lib/wizard-engine.js +57 -6
  36. package/daemon/package.json +2 -1
  37. package/daemon/routes/agents.js +51 -6
  38. package/daemon/routes/channels.js +116 -2
  39. package/daemon/routes/crm.js +85 -0
  40. package/daemon/routes/dashboard.js +62 -16
  41. package/daemon/routes/dept.js +10 -1
  42. package/daemon/routes/email-triage.js +19 -10
  43. package/daemon/routes/hbo.js +618 -58
  44. package/daemon/routes/hed.js +133 -0
  45. package/daemon/routes/inbox.js +397 -8
  46. package/daemon/routes/project.js +580 -66
  47. package/daemon/routes/routines.js +14 -0
  48. package/daemon/routes/tasks.js +15 -1
  49. package/daemon/schema-apply.js +174 -0
  50. package/daemon/schema-definitions.js +433 -0
  51. package/daemon/schema-migrations-hbo.js +20 -0
  52. package/daemon/schema-migrations-hed.js +18 -0
  53. package/daemon/schema-migrations-proj.js +153 -0
  54. package/extensions/__tests__/codebase-index.test.ts +73 -0
  55. package/extensions/__tests__/extension-command-registration.test.ts +35 -0
  56. package/extensions/__tests__/git-push-guard.test.ts +68 -0
  57. package/extensions/context-compaction.ts +104 -76
  58. package/extensions/cortex/__tests__/cortex-core.test.ts +100 -0
  59. package/extensions/cortex/wal-replay.ts +91 -0
  60. package/extensions/email/actions/draft-response.ts +21 -1
  61. package/extensions/email/auth/accounts.ts +5 -11
  62. package/extensions/email/auth/inbox-dog.ts +5 -2
  63. package/extensions/email/backfill.ts +20 -13
  64. package/extensions/email/providers/gmail.ts +164 -0
  65. package/extensions/email/providers/google-calendar.ts +34 -5
  66. package/extensions/helios-browser/__tests__/browser-routing.test.ts +57 -0
  67. package/extensions/helios-browser/backends/playwright.ts +3 -1
  68. package/extensions/helios-governance/__tests__/governance-gates.test.ts +40 -0
  69. package/extensions/helios-governance/__tests__/tournament-consumer.test.js +66 -0
  70. package/extensions/hema-dispatch-v3/headroom-compress.ts +103 -0
  71. package/extensions/hema-dispatch-v3/index.ts +46 -72
  72. package/extensions/interview/__tests__/server.test.ts +117 -0
  73. package/extensions/lib/helios-root.cjs +46 -0
  74. package/extensions/subagent-mesh/__tests__/handlers.test.ts +98 -0
  75. package/extensions/warm-tick/warm-tick-maintenance.ts +164 -0
  76. package/lib/__tests__/bulk-ingest.live.test.ts +66 -0
  77. package/lib/__tests__/crash-fixes.test.ts +49 -0
  78. package/lib/__tests__/hbo-core-store.test.js +238 -0
  79. package/lib/__tests__/maintenance-mission-wiring.test.ts +35 -0
  80. package/lib/broker/__tests__/jit-subscription.test.js +44 -1
  81. package/lib/broker/__tests__/lifecycle-channels.test.js +25 -1
  82. package/lib/compression/__tests__/ccr-store.test.js +138 -0
  83. package/lib/compression/__tests__/pipeline.test.js +280 -0
  84. package/lib/compression/__tests__/smart-crusher.test.js +242 -0
  85. package/lib/compression/dist/server.js +34 -1
  86. package/lib/compression/dist/start-server.js +77 -0
  87. package/lib/event-bus.mts +1 -1
  88. package/lib/graph/learning/headroom-learn-bridge.js +175 -0
  89. package/lib/graph-availability.js +62 -0
  90. package/lib/hbo-core-store.compiled.js +834 -0
  91. package/lib/hbo-core-store.js +124 -0
  92. package/lib/hbo-core-store.ts +979 -0
  93. package/lib/mission-loop/__tests__/research-handler.test.ts +143 -0
  94. package/lib/skill-sync.js +6 -1
  95. package/lib/startup-integrity.js +9 -2
  96. package/lib/triage-core/__tests__/classifier-fixture.test.ts +254 -0
  97. package/lib/triage-core/__tests__/classifier-post-norm.test.ts +1 -1
  98. package/lib/triage-core/__tests__/classifier.test.ts +45 -7
  99. package/lib/triage-core/__tests__/correction-detector.test.ts +36 -0
  100. package/lib/triage-core/__tests__/d6-dunbar-boost.test.ts +5 -5
  101. package/lib/triage-core/__tests__/orchestrator-pipeline.test.ts +107 -0
  102. package/lib/triage-core/__tests__/orchestrator.test.ts +113 -1
  103. package/lib/triage-core/__tests__/signals.test.ts +357 -0
  104. package/lib/triage-core/__tests__/sql-parity.test.ts +216 -0
  105. package/lib/triage-core/backfill-cost-estimator.ts +91 -0
  106. package/lib/triage-core/backfill-orchestrator.ts +119 -0
  107. package/lib/triage-core/classifier.ts +41 -8
  108. package/lib/triage-core/cos/cross-channel-escalation.ts +2 -3
  109. package/lib/triage-core/cos/response-debt.ts +2 -2
  110. package/lib/triage-core/graph/__tests__/batch-persistence.test.ts +283 -0
  111. package/lib/triage-core/graph/batch-persistence.ts +66 -2
  112. package/lib/triage-core/graph/betweenness-worker.js +75 -0
  113. package/lib/triage-core/graph/graph-rank-sql.ts +67 -0
  114. package/lib/triage-core/graph/persistence.ts +1 -1
  115. package/lib/triage-core/graph/schema-v2.ts +2 -0
  116. package/lib/triage-core/graph/schema.cypher +11 -0
  117. package/lib/triage-core/graph/triage-query.ts +1 -1
  118. package/lib/triage-core/learning.ts +15 -20
  119. package/lib/triage-core/mental-model/bedrock-config.ts +78 -0
  120. package/lib/triage-core/mental-model/cos-integration.ts +1 -1
  121. package/lib/triage-core/mental-model/entity-extractor.ts +51 -4
  122. package/lib/triage-core/mental-model/identity-resolver.ts +5 -5
  123. package/lib/triage-core/mental-model/key-facts.ts +1 -2
  124. package/lib/triage-core/mental-model/model-assembler-sql.ts +200 -0
  125. package/lib/triage-core/mental-model/model-assembler.ts +16 -3
  126. package/lib/triage-core/orchestrator.ts +8 -15
  127. package/lib/triage-core/scheduled-sends.ts +39 -2
  128. package/lib/triage-core/signals/comms-style.ts +1 -1
  129. package/lib/triage-core/signals/cross-channel-escalation.ts +2 -2
  130. package/lib/triage-core/signals/favee-type.ts +6 -1
  131. package/lib/triage-core/signals/goal-relevance.ts +31 -2
  132. package/lib/triage-core/signals/personal-importance.ts +1 -1
  133. package/lib/triage-core/signals/referral-chain.ts +0 -1
  134. package/lib/triage-core/signals/relationship-decay.ts +4 -0
  135. package/lib/triage-core/signals/relationship-health.ts +6 -1
  136. package/lib/triage-core/signals/trajectory-signal.ts +38 -3
  137. package/lib/triage-core/tournament-runner.js +11 -1
  138. package/lib/triage-core/triage-llm-factory.ts +110 -0
  139. package/lib/triage-core/triage-local-llm.ts +145 -0
  140. package/lib/triage-core/triage-sql-store.ts +337 -0
  141. package/lib/triage-core/types.ts +2 -2
  142. package/lib/unified-graph.atomic.test.ts +52 -0
  143. package/lib/unified-graph.failure-categories.test.ts +55 -0
  144. package/package.json +18 -7
  145. package/prebuilds/darwin-arm64/better_sqlite3.node +0 -0
  146. package/prebuilds/linux-x64/better_sqlite3.node +0 -0
  147. package/prebuilds/win32-x64/better_sqlite3.node +0 -0
  148. package/skills/helios-bookkeeping/SKILL.md +321 -0
  149. package/skills/helios-briefer/SKILL.md +44 -0
  150. package/skills/helios-client-relations/SKILL.md +322 -0
  151. package/skills/helios-personal-triager/SKILL.md +45 -0
  152. package/skills/helios-recruitment/SKILL.md +317 -0
  153. package/skills/helios-relationship-nudger/SKILL.md +77 -0
  154. package/skills/helios-researcher/SKILL.md +44 -0
  155. package/skills/helios-scheduler/SKILL.md +58 -0
  156. package/skills/helios-tax-analyst/SKILL.md +280 -0
  157. package/lib/triage-core/orchestrator.ts.bak-r005-r006-r008 +0 -1823
@@ -0,0 +1,124 @@
1
+ /**
2
+ * hbo-core-store.js — CommonJS wrapper for hbo-core-store.ts
3
+ *
4
+ * Load priority:
5
+ * 1. hbo-core-store.compiled.js — pre-compiled CJS, no jiti/flags needed (Node 16+)
6
+ * 2. jiti — transpiles .ts at runtime (requires jiti in node_modules)
7
+ * 3. node:module.stripTypeScriptTypes — Node 22.12+ native strip
8
+ * 4. Direct .ts require — only works under ts-node/vitest
9
+ * 5. Warn + no-op proxy (all hboStore.* calls silently no-op)
10
+ */
11
+ 'use strict';
12
+
13
+ const path = require('path');
14
+ const fs = require('fs');
15
+ const Module = require('module');
16
+
17
+ const JITI_PATHS = [
18
+ path.join(__dirname, '..', 'node_modules', '@mariozechner', 'jiti', 'lib', 'jiti.cjs'),
19
+ path.join(__dirname, '..', 'node_modules', '@helios-agent', 'pi-coding-agent', 'node_modules', 'jiti', 'lib', 'jiti.cjs'),
20
+ path.join(__dirname, '..', 'node_modules', '@earendil-works', 'pi-coding-agent', 'node_modules', 'jiti', 'lib', 'jiti.cjs'),
21
+ ];
22
+
23
+ let _mod = null;
24
+
25
+ function _loadViaNativeTypeStrip() {
26
+ try {
27
+ const { stripTypeScriptTypes } = require('node:module');
28
+ if (typeof stripTypeScriptTypes !== 'function') return null;
29
+
30
+ const tsPath = path.join(__dirname, 'hbo-core-store.ts');
31
+ let source = fs.readFileSync(tsPath, 'utf8');
32
+ source = stripTypeScriptTypes(source, { mode: 'transform', sourceMap: false });
33
+
34
+ const exportNames = [];
35
+ source = source.replace(/^import \* as (\w+) from ['"]([^'"]+)['"];?$/gm, "const $1 = require('$2');");
36
+ source = source.replace(/^import \{([^}]+)\} from ['"]([^'"]+)['"];?$/gm, "const {$1} = require('$2');");
37
+ // C-4 fix: matches both 'export function' and 'export async function'
38
+ source = source.replace(/^export (?:async )?function\s+([A-Za-z0-9_$]+)/gm, (_match, name) => {
39
+ exportNames.push(name);
40
+ return `function ${name}`;
41
+ });
42
+
43
+ const child = new Module(tsPath, module);
44
+ child.filename = tsPath;
45
+ child.paths = Module._nodeModulePaths(__dirname);
46
+ child._compile(`${source}\nmodule.exports = { ${exportNames.join(', ')} };\n`, tsPath);
47
+ return child.exports;
48
+ } catch (_) {
49
+ return null;
50
+ }
51
+ }
52
+
53
+ function _load() {
54
+ if (_mod) return _mod;
55
+
56
+ // Step 0: pre-compiled CJS bundle — no jiti, no --experimental-sqlite, Node 16+
57
+ // Ships in the npm tarball as lib/hbo-core-store.compiled.js.
58
+ // Uses node:sqlite when available (Node 22+) and better-sqlite3 as fallback.
59
+ try {
60
+ const compiled = require('./hbo-core-store.compiled.js');
61
+ if (compiled && typeof compiled.createTask === 'function') {
62
+ _mod = compiled;
63
+ return _mod;
64
+ }
65
+ } catch (_) {}
66
+
67
+ // Step 1: jiti — transpiles hbo-core-store.ts at runtime
68
+ for (const jitiPath of JITI_PATHS) {
69
+ try {
70
+ const jitiFactory = require(jitiPath);
71
+ const jiti = jitiFactory(__filename, { interopDefault: true });
72
+ const loaded = jiti(path.join(__dirname, 'hbo-core-store.ts'));
73
+ if (loaded && (typeof loaded.createTask === 'function' || (loaded.default && typeof loaded.default.createTask === 'function'))) {
74
+ _mod = (loaded.default && typeof loaded.default.createTask === 'function') ? loaded.default : loaded;
75
+ return _mod;
76
+ }
77
+ } catch (_) {}
78
+ }
79
+
80
+ // Step 2: node:module.stripTypeScriptTypes (Node 22.12+)
81
+ _mod = _loadViaNativeTypeStrip();
82
+ if (_mod && typeof _mod.createTask === 'function') return _mod;
83
+
84
+ // Step 3: direct .ts require (works under ts-node/vitest with a registered TS loader)
85
+ try {
86
+ _mod = require('./hbo-core-store.ts');
87
+ return _mod;
88
+ } catch (_) {}
89
+
90
+ // All load paths failed — emit a single warning so operators know SQLite fallback is disabled.
91
+ process.stderr.write(
92
+ '[hbo-core-store] WARN: Failed to load hbo-core-store (tried compiled.js, jiti, native strip, ts-node). ' +
93
+ 'SQLite fallback is DISABLED. All hboStore.* calls will no-op silently. ' +
94
+ 'Ensure better-sqlite3 is installed or NODE_OPTIONS=--experimental-sqlite is set.\n'
95
+ );
96
+ return null;
97
+ }
98
+
99
+ module.exports = new Proxy({}, {
100
+ get(_, prop) {
101
+ const m = _load();
102
+ if (!m) {
103
+ if (prop === 'resetHboCoreStore') return () => { _mod = null; };
104
+ return undefined;
105
+ }
106
+ const val = m[prop];
107
+ return typeof val === 'function' ? val.bind(m) : val;
108
+ },
109
+ has(_, prop) {
110
+ const m = _load();
111
+ return m ? prop in m : false;
112
+ },
113
+ ownKeys() {
114
+ const m = _load();
115
+ return m ? Object.keys(m) : [];
116
+ },
117
+ getOwnPropertyDescriptor(_, prop) {
118
+ const m = _load();
119
+ if (!m) return undefined;
120
+ const val = m[prop];
121
+ if (val === undefined) return undefined;
122
+ return { value: typeof val === 'function' ? val.bind(m) : val, writable: true, enumerable: true, configurable: true };
123
+ },
124
+ });