@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.
- package/agents/business/talisman-ceo.md +183 -0
- package/agents/business/talisman-comms.md +257 -0
- package/agents/business/talisman-cto.md +153 -0
- package/agents/business/talisman-finance.md +246 -0
- package/agents/business/talisman-marketing.md +240 -0
- package/agents/business/talisman-sales.md +242 -0
- package/agents/business/talisman-support.md +236 -0
- package/bin/helios-rpc.js +19 -0
- package/daemon/adapters/helios-rpc-adapter.js +5 -12
- package/daemon/adapters/tui_wakeup.js +8 -0
- package/daemon/context-enrichment.js +27 -0
- package/daemon/daemon-manager.js +1 -1
- package/daemon/db/email-infrastructure-migrate.js +192 -0
- package/daemon/db/hbo-core-migrate.js +189 -0
- package/daemon/helios-api.js +863 -64
- package/daemon/helios-company-daemon.js +233 -33
- package/daemon/lib/blast-radius-analyzer.js +75 -0
- package/daemon/lib/domain-bootstrap-orchestrator.js +267 -0
- package/daemon/lib/forensic-log.js +113 -0
- package/daemon/lib/goal-research-pipeline.js +644 -0
- package/daemon/lib/harada/cascade-judge.js +84 -1
- package/daemon/lib/harada/cascade-research-dispatcher.js +282 -0
- package/daemon/lib/harada/pillar-dispatcher.js +23 -2
- package/daemon/lib/hbo-bridge.js +74 -6
- package/daemon/lib/headroom-middleware.js +129 -0
- package/daemon/lib/headroom-proxy-manager.js +309 -0
- package/daemon/lib/hed-engine.js +25 -0
- package/daemon/lib/intelligence/department-page-generator.js +46 -1
- package/daemon/lib/interpretation-engine.js +92 -0
- package/daemon/lib/mental-model-cache.js +96 -0
- package/daemon/lib/project-factory.js +47 -0
- package/daemon/lib/session-log-reader.js +93 -0
- package/daemon/lib/standard-work-bootstrap.js +87 -1
- package/daemon/lib/task-completion-processor.js +23 -0
- package/daemon/lib/wizard-engine.js +57 -6
- package/daemon/package.json +2 -1
- package/daemon/routes/agents.js +51 -6
- package/daemon/routes/channels.js +116 -2
- package/daemon/routes/crm.js +85 -0
- package/daemon/routes/dashboard.js +62 -16
- package/daemon/routes/dept.js +10 -1
- package/daemon/routes/email-triage.js +19 -10
- package/daemon/routes/hbo.js +618 -58
- package/daemon/routes/hed.js +133 -0
- package/daemon/routes/inbox.js +397 -8
- package/daemon/routes/project.js +580 -66
- package/daemon/routes/routines.js +14 -0
- package/daemon/routes/tasks.js +15 -1
- package/daemon/schema-apply.js +174 -0
- package/daemon/schema-definitions.js +433 -0
- package/daemon/schema-migrations-hbo.js +20 -0
- package/daemon/schema-migrations-hed.js +18 -0
- package/daemon/schema-migrations-proj.js +153 -0
- package/extensions/__tests__/codebase-index.test.ts +73 -0
- package/extensions/__tests__/extension-command-registration.test.ts +35 -0
- package/extensions/__tests__/git-push-guard.test.ts +68 -0
- package/extensions/context-compaction.ts +104 -76
- package/extensions/cortex/__tests__/cortex-core.test.ts +100 -0
- package/extensions/cortex/wal-replay.ts +91 -0
- package/extensions/email/actions/draft-response.ts +21 -1
- package/extensions/email/auth/accounts.ts +5 -11
- package/extensions/email/auth/inbox-dog.ts +5 -2
- package/extensions/email/backfill.ts +20 -13
- package/extensions/email/providers/gmail.ts +164 -0
- package/extensions/email/providers/google-calendar.ts +34 -5
- package/extensions/helios-browser/__tests__/browser-routing.test.ts +57 -0
- package/extensions/helios-browser/backends/playwright.ts +3 -1
- package/extensions/helios-governance/__tests__/governance-gates.test.ts +40 -0
- package/extensions/helios-governance/__tests__/tournament-consumer.test.js +66 -0
- package/extensions/hema-dispatch-v3/headroom-compress.ts +103 -0
- package/extensions/hema-dispatch-v3/index.ts +46 -72
- package/extensions/interview/__tests__/server.test.ts +117 -0
- package/extensions/lib/helios-root.cjs +46 -0
- package/extensions/subagent-mesh/__tests__/handlers.test.ts +98 -0
- package/extensions/warm-tick/warm-tick-maintenance.ts +164 -0
- package/lib/__tests__/bulk-ingest.live.test.ts +66 -0
- package/lib/__tests__/crash-fixes.test.ts +49 -0
- package/lib/__tests__/hbo-core-store.test.js +238 -0
- package/lib/__tests__/maintenance-mission-wiring.test.ts +35 -0
- package/lib/broker/__tests__/jit-subscription.test.js +44 -1
- package/lib/broker/__tests__/lifecycle-channels.test.js +25 -1
- package/lib/compression/__tests__/ccr-store.test.js +138 -0
- package/lib/compression/__tests__/pipeline.test.js +280 -0
- package/lib/compression/__tests__/smart-crusher.test.js +242 -0
- package/lib/compression/dist/server.js +34 -1
- package/lib/compression/dist/start-server.js +77 -0
- package/lib/event-bus.mts +1 -1
- package/lib/graph/learning/headroom-learn-bridge.js +175 -0
- package/lib/graph-availability.js +62 -0
- package/lib/hbo-core-store.compiled.js +834 -0
- package/lib/hbo-core-store.js +124 -0
- package/lib/hbo-core-store.ts +979 -0
- package/lib/mission-loop/__tests__/research-handler.test.ts +143 -0
- package/lib/skill-sync.js +6 -1
- package/lib/startup-integrity.js +9 -2
- package/lib/triage-core/__tests__/classifier-fixture.test.ts +254 -0
- package/lib/triage-core/__tests__/classifier-post-norm.test.ts +1 -1
- package/lib/triage-core/__tests__/classifier.test.ts +45 -7
- package/lib/triage-core/__tests__/correction-detector.test.ts +36 -0
- package/lib/triage-core/__tests__/d6-dunbar-boost.test.ts +5 -5
- package/lib/triage-core/__tests__/orchestrator-pipeline.test.ts +107 -0
- package/lib/triage-core/__tests__/orchestrator.test.ts +113 -1
- package/lib/triage-core/__tests__/signals.test.ts +357 -0
- package/lib/triage-core/__tests__/sql-parity.test.ts +216 -0
- package/lib/triage-core/backfill-cost-estimator.ts +91 -0
- package/lib/triage-core/backfill-orchestrator.ts +119 -0
- package/lib/triage-core/classifier.ts +41 -8
- package/lib/triage-core/cos/cross-channel-escalation.ts +2 -3
- package/lib/triage-core/cos/response-debt.ts +2 -2
- package/lib/triage-core/graph/__tests__/batch-persistence.test.ts +283 -0
- package/lib/triage-core/graph/batch-persistence.ts +66 -2
- package/lib/triage-core/graph/betweenness-worker.js +75 -0
- package/lib/triage-core/graph/graph-rank-sql.ts +67 -0
- package/lib/triage-core/graph/persistence.ts +1 -1
- package/lib/triage-core/graph/schema-v2.ts +2 -0
- package/lib/triage-core/graph/schema.cypher +11 -0
- package/lib/triage-core/graph/triage-query.ts +1 -1
- package/lib/triage-core/learning.ts +15 -20
- package/lib/triage-core/mental-model/bedrock-config.ts +78 -0
- package/lib/triage-core/mental-model/cos-integration.ts +1 -1
- package/lib/triage-core/mental-model/entity-extractor.ts +51 -4
- package/lib/triage-core/mental-model/identity-resolver.ts +5 -5
- package/lib/triage-core/mental-model/key-facts.ts +1 -2
- package/lib/triage-core/mental-model/model-assembler-sql.ts +200 -0
- package/lib/triage-core/mental-model/model-assembler.ts +16 -3
- package/lib/triage-core/orchestrator.ts +8 -15
- package/lib/triage-core/scheduled-sends.ts +39 -2
- package/lib/triage-core/signals/comms-style.ts +1 -1
- package/lib/triage-core/signals/cross-channel-escalation.ts +2 -2
- package/lib/triage-core/signals/favee-type.ts +6 -1
- package/lib/triage-core/signals/goal-relevance.ts +31 -2
- package/lib/triage-core/signals/personal-importance.ts +1 -1
- package/lib/triage-core/signals/referral-chain.ts +0 -1
- package/lib/triage-core/signals/relationship-decay.ts +4 -0
- package/lib/triage-core/signals/relationship-health.ts +6 -1
- package/lib/triage-core/signals/trajectory-signal.ts +38 -3
- package/lib/triage-core/tournament-runner.js +11 -1
- package/lib/triage-core/triage-llm-factory.ts +110 -0
- package/lib/triage-core/triage-local-llm.ts +145 -0
- package/lib/triage-core/triage-sql-store.ts +337 -0
- package/lib/triage-core/types.ts +2 -2
- package/lib/unified-graph.atomic.test.ts +52 -0
- package/lib/unified-graph.failure-categories.test.ts +55 -0
- package/package.json +18 -7
- package/prebuilds/darwin-arm64/better_sqlite3.node +0 -0
- package/prebuilds/linux-x64/better_sqlite3.node +0 -0
- package/prebuilds/win32-x64/better_sqlite3.node +0 -0
- package/skills/helios-bookkeeping/SKILL.md +321 -0
- package/skills/helios-briefer/SKILL.md +44 -0
- package/skills/helios-client-relations/SKILL.md +322 -0
- package/skills/helios-personal-triager/SKILL.md +45 -0
- package/skills/helios-recruitment/SKILL.md +317 -0
- package/skills/helios-relationship-nudger/SKILL.md +77 -0
- package/skills/helios-researcher/SKILL.md +44 -0
- package/skills/helios-scheduler/SKILL.md +58 -0
- package/skills/helios-tax-analyst/SKILL.md +280 -0
- package/lib/triage-core/orchestrator.ts.bak-r005-r006-r008 +0 -1823
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
module.exports = function createRoutinesRouter(handlers) {
|
|
16
16
|
const {
|
|
17
|
+
handleGetRoutines,
|
|
18
|
+
handleCreateRoutine,
|
|
17
19
|
handleGetRoutineTriggers,
|
|
18
20
|
handleCreateRoutineTrigger,
|
|
19
21
|
handleFireWebhookTrigger,
|
|
@@ -30,6 +32,18 @@ module.exports = function createRoutinesRouter(handlers) {
|
|
|
30
32
|
return true;
|
|
31
33
|
}
|
|
32
34
|
|
|
35
|
+
// P5-01: GET /api/routines — list routines for a company (must be before /:id routes)
|
|
36
|
+
if (method === 'GET' && pathname === '/api/routines') {
|
|
37
|
+
await handleGetRoutines(req, res, ctx);
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// P5-02: POST /api/routines — create a new routine
|
|
42
|
+
if (method === 'POST' && pathname === '/api/routines') {
|
|
43
|
+
await handleCreateRoutine(req, res, ctx);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
|
|
33
47
|
// PATCH /api/routines/:id (edit routine → creates revision)
|
|
34
48
|
const patchRoutineMatch = pathname.match(/^\/api\/routines\/([^/]+)$/);
|
|
35
49
|
if (method === 'PATCH' && patchRoutineMatch) {
|
package/daemon/routes/tasks.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// NOTE: Task status validation is handled in handleUpdateTask (helios-api.js VALID_STATUSES).
|
|
4
|
+
// The canonical valid statuses include: todo, in_progress, done, failed, cancelled, blocked, escalated, in_review.
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* routes/tasks.js — Task-related route dispatch
|
|
@@ -26,6 +27,7 @@ module.exports = function createTasksRouter(handlers) {
|
|
|
26
27
|
handleGetTaskComments,
|
|
27
28
|
handlePostTaskComment,
|
|
28
29
|
handlePatchTask,
|
|
30
|
+
handlePatchTaskPolicy, // P4-07: PATCH /api/tasks/:id/policy
|
|
29
31
|
} = handlers;
|
|
30
32
|
|
|
31
33
|
return async function tasksRoute(req, res, ctx, pathname, method) {
|
|
@@ -89,6 +91,18 @@ module.exports = function createTasksRouter(handlers) {
|
|
|
89
91
|
return true;
|
|
90
92
|
}
|
|
91
93
|
|
|
94
|
+
// PATCH /api/tasks/:id/policy — P4-07: set executionPolicy on a task
|
|
95
|
+
const policyMatch = pathname.match(/^\/api\/tasks\/([^/]+)\/policy$/);
|
|
96
|
+
if (method === 'PATCH' && policyMatch) {
|
|
97
|
+
if (handlePatchTaskPolicy) {
|
|
98
|
+
await handlePatchTaskPolicy(req, res, ctx, decodeURIComponent(policyMatch[1]));
|
|
99
|
+
} else {
|
|
100
|
+
res.writeHead(501, { 'Content-Type': 'application/json' });
|
|
101
|
+
res.end(JSON.stringify({ error: 'Policy endpoint not configured' }));
|
|
102
|
+
}
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
|
|
92
106
|
return false;
|
|
93
107
|
};
|
|
94
108
|
};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* schema-apply.js — Converges the Memgraph graph to the canonical schema.
|
|
4
|
+
*
|
|
5
|
+
* Uses Memgraph MAGE's schema.assert() procedure to atomically create missing
|
|
6
|
+
* indexes and uniqueness constraints, keep existing correct ones, and optionally
|
|
7
|
+
* drop anything that doesn't belong (controlled by dropExisting flag).
|
|
8
|
+
*
|
|
9
|
+
* Composite indexes (multi-property) are applied via separate Cypher statements
|
|
10
|
+
* because schema.assert() only handles single-property label indexes.
|
|
11
|
+
*
|
|
12
|
+
* Called once during daemon startup, after Memgraph connection is established
|
|
13
|
+
* and before any tick processing begins.
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* const { applySchema } = require('./schema-apply');
|
|
17
|
+
* await applySchema(mgQuery); // safe for rolling deployments
|
|
18
|
+
* await applySchema(mgQuery, true); // drop_existing — use on fresh installs
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const { INDEXES, COMPOSITE_INDEXES, UNIQUE_CONSTRAINTS } = require('./schema-definitions');
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {Function} mgQuery async (cypher, params?) => { rows, keys }
|
|
25
|
+
* @param {boolean} [dropExisting=false]
|
|
26
|
+
* false = safe for live deployments — adds missing, keeps existing, never drops.
|
|
27
|
+
* true = converge exactly — drops indexes/constraints not in the definition.
|
|
28
|
+
* Use on fresh installs or after intentional schema cleanup.
|
|
29
|
+
*/
|
|
30
|
+
async function applySchema(mgQuery, dropExisting = false) {
|
|
31
|
+
const log = (msg) => console.log('[schema-apply]', msg);
|
|
32
|
+
const warn = (msg) => console.warn('[schema-apply] WARN:', msg);
|
|
33
|
+
|
|
34
|
+
// ── Step 1: schema.assert() for single-property indexes + unique constraints
|
|
35
|
+
log(`Applying schema via schema.assert() (drop_existing=${dropExisting})…`);
|
|
36
|
+
|
|
37
|
+
let assertResult;
|
|
38
|
+
try {
|
|
39
|
+
assertResult = await mgQuery(
|
|
40
|
+
`CALL schema.assert($indices, $unique, {}, $drop)
|
|
41
|
+
YIELD action, label, key, unique
|
|
42
|
+
RETURN action, label, key, unique`,
|
|
43
|
+
{
|
|
44
|
+
indices: INDEXES,
|
|
45
|
+
unique: UNIQUE_CONSTRAINTS,
|
|
46
|
+
drop: dropExisting,
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
} catch (err) {
|
|
50
|
+
// schema.assert() is a MAGE procedure — if MAGE is not installed or the
|
|
51
|
+
// version doesn't include the schema module, fall back gracefully to the
|
|
52
|
+
// per-statement legacy approach.
|
|
53
|
+
warn(`schema.assert() unavailable: ${err.message}`);
|
|
54
|
+
warn('Falling back to per-statement legacy migration.');
|
|
55
|
+
return _legacyFallback(mgQuery);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ── Parse and log results ────────────────────────────────────────────────
|
|
59
|
+
const rows = assertResult?.rows ?? [];
|
|
60
|
+
const counts = { Created: 0, Kept: 0, Dropped: 0 };
|
|
61
|
+
|
|
62
|
+
for (const row of rows) {
|
|
63
|
+
// Memgraph returns rows as arrays or objects depending on driver config
|
|
64
|
+
const action = Array.isArray(row) ? row[0] : row.action;
|
|
65
|
+
const label = Array.isArray(row) ? row[1] : row.label;
|
|
66
|
+
const key = Array.isArray(row) ? row[2] : row.key;
|
|
67
|
+
const unique = Array.isArray(row) ? row[3] : row.unique;
|
|
68
|
+
|
|
69
|
+
const kind = unique ? 'constraint' : 'index';
|
|
70
|
+
if (action === 'Created') {
|
|
71
|
+
log(` ✓ Created ${kind}: :${label}(${key})`);
|
|
72
|
+
} else if (action === 'Dropped') {
|
|
73
|
+
log(` ✗ Dropped ${kind}: :${label}(${key})`);
|
|
74
|
+
}
|
|
75
|
+
// Kept entries are silent — too noisy otherwise
|
|
76
|
+
if (counts[action] !== undefined) counts[action]++;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
log(`schema.assert() complete — Created: ${counts.Created}, Kept: ${counts.Kept}, Dropped: ${counts.Dropped}`);
|
|
80
|
+
|
|
81
|
+
// ── Step 2: Composite indexes ─────────────────────────────────────────────
|
|
82
|
+
// schema.assert() does not support composite indexes, so we create them
|
|
83
|
+
// individually. Each uses CREATE INDEX ON :Label(propA, propB) with a
|
|
84
|
+
// try/catch to silently skip "already exists" errors.
|
|
85
|
+
let compositeCreated = 0;
|
|
86
|
+
let compositeSkipped = 0;
|
|
87
|
+
|
|
88
|
+
for (const { label, props } of COMPOSITE_INDEXES) {
|
|
89
|
+
const propList = props.join(', ');
|
|
90
|
+
const cypher = `CREATE INDEX ON :${label}(${propList})`;
|
|
91
|
+
try {
|
|
92
|
+
await mgQuery(cypher);
|
|
93
|
+
log(` ✓ Created composite index: :${label}(${propList})`);
|
|
94
|
+
compositeCreated++;
|
|
95
|
+
} catch (err) {
|
|
96
|
+
// "already exists" is the expected no-op case
|
|
97
|
+
const msg = err.message ?? '';
|
|
98
|
+
if (/already exists/i.test(msg) || /constraint.*exists/i.test(msg) || /index.*exists/i.test(msg)) {
|
|
99
|
+
compositeSkipped++;
|
|
100
|
+
} else {
|
|
101
|
+
warn(`Composite index :${label}(${propList}) failed: ${msg}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (compositeCreated > 0 || compositeSkipped > 0) {
|
|
107
|
+
log(`Composite indexes — Created: ${compositeCreated}, Already existed: ${compositeSkipped}`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
log('Schema application complete.');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ── Legacy fallback ───────────────────────────────────────────────────────────
|
|
114
|
+
// Used when schema.assert() is unavailable (MAGE not installed or older version).
|
|
115
|
+
// Runs each constraint/index as individual CREATE statements with try/catch.
|
|
116
|
+
// This is the old seven-migration-file behaviour, condensed into one function.
|
|
117
|
+
|
|
118
|
+
async function _legacyFallback(mgQuery) {
|
|
119
|
+
const log = (msg) => console.log('[schema-apply/legacy]', msg);
|
|
120
|
+
const warn = (msg) => console.warn('[schema-apply/legacy] WARN:', msg);
|
|
121
|
+
|
|
122
|
+
log('Running legacy per-statement schema migration…');
|
|
123
|
+
|
|
124
|
+
let created = 0;
|
|
125
|
+
let skipped = 0;
|
|
126
|
+
let failed = 0;
|
|
127
|
+
|
|
128
|
+
async function exec(cypher) {
|
|
129
|
+
try {
|
|
130
|
+
await mgQuery(cypher);
|
|
131
|
+
created++;
|
|
132
|
+
} catch (err) {
|
|
133
|
+
const msg = err.message ?? '';
|
|
134
|
+
if (/already exists/i.test(msg) || /constraint.*exists/i.test(msg) || /index.*exists/i.test(msg)) {
|
|
135
|
+
skipped++;
|
|
136
|
+
} else {
|
|
137
|
+
warn(`${cypher} → ${msg}`);
|
|
138
|
+
failed++;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Unique constraints
|
|
144
|
+
for (const [label, constraintGroups] of Object.entries(UNIQUE_CONSTRAINTS)) {
|
|
145
|
+
for (const props of constraintGroups) {
|
|
146
|
+
if (props.length === 1) {
|
|
147
|
+
await exec(`CREATE CONSTRAINT ON (n:${label}) ASSERT n.${props[0]} IS UNIQUE`);
|
|
148
|
+
} else {
|
|
149
|
+
// Composite unique — old syntax doesn't support this cleanly; use new syntax
|
|
150
|
+
await exec(`CREATE CONSTRAINT FOR (n:${label}) REQUIRE (${props.map(p => `n.${p}`).join(', ')}) IS UNIQUE`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Single-property indexes
|
|
156
|
+
for (const [label, props] of Object.entries(INDEXES)) {
|
|
157
|
+
for (const prop of props) {
|
|
158
|
+
if (prop === '') {
|
|
159
|
+
await exec(`CREATE INDEX ON :${label}`);
|
|
160
|
+
} else {
|
|
161
|
+
await exec(`CREATE INDEX ON :${label}(${prop})`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Composite indexes
|
|
167
|
+
for (const { label, props } of COMPOSITE_INDEXES) {
|
|
168
|
+
await exec(`CREATE INDEX ON :${label}(${props.join(', ')})`);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
log(`Legacy migration complete — Created: ${created}, Skipped: ${skipped}, Failed: ${failed}`);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
module.exports = { applySchema };
|