@triflux/remote 10.51.0 → 10.52.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.
- package/cto/brief.mjs +0 -8
- package/cto/collect.mjs +1 -127
- package/cto/current.schema.json +2 -19
- package/cto/hygiene.mjs +2 -61
- package/cto/lake-root.mjs +0 -56
- package/cto/status.mjs +5 -139
- package/hub/index.mjs +0 -9
- package/hub/team/agents-row-attach.py +120 -0
- package/hub/team/agents-row.mjs +200 -0
- package/hub/team/claude-daemon-control.mjs +1 -2
- package/hub/team/claude-session-projection.mjs +5 -73
- package/hub/team/cli/commands/debug.mjs +1 -2
- package/hub/team/cli/commands/start/index.mjs +2 -1
- package/hub/team/cli/commands/start/start-mux.mjs +2 -4
- package/hub/team/cli/services/state-store.mjs +5 -20
- package/hub/team/headless.mjs +96 -543
- package/hub/team/psmux.mjs +3 -33
- package/hub/team/session-context.mjs +1 -1
- package/hub/team/tui-viewer.mjs +9 -56
- package/hub/team/tui.mjs +0 -37
- package/hub/team/uds-orchestrator.mjs +2 -580
- package/hub/workers/factory.mjs +6 -51
- package/hub/workers/interface.mjs +1 -7
- package/hub/workers/lib/jsonrpc-core.mjs +11 -0
- package/hub/workers/lib/jsonrpc-ws-uds.mjs +5 -6
- package/package.json +3 -8
- package/scripts/lib/agent-route-policy.mjs +0 -67
- package/scripts/lib/cli-claude.mjs +0 -12
- package/scripts/lib/env-probe.mjs +0 -70
- package/scripts/lib/legacy-mcp-cleanup.mjs +283 -0
- package/scripts/lib/mcp-guard-engine.mjs +40 -98
- package/hub/hub-lifecycle.mjs +0 -248
- package/hub/pipe.mjs +0 -825
- package/hub/promote-penalties.mjs +0 -138
- package/hub/public/dashboard.html +0 -416
- package/hub/schema.sql +0 -209
- package/hub/server.mjs +0 -3048
- package/hub/store-adapter.mjs +0 -182
- package/hub/store.mjs +0 -1736
- package/hub/team/cli/services/hub-client.mjs +0 -178
- package/hub/team/conductor-registry.mjs +0 -121
- package/hub/team/cto-auto-collect.mjs +0 -115
- package/hub/team/lead-control.mjs +0 -191
- package/hub/team/session-sync.mjs +0 -316
- package/hub/team/swarm-intent.mjs +0 -18
- package/hub/team/synapse-cli.mjs +0 -458
- package/hub/team/synapse-http.mjs +0 -311
- package/hub/team/synapse-registry.mjs +0 -618
- package/hub/team/tui-synapse.mjs +0 -223
- package/hub/team/worker-sandbox.mjs +0 -125
- package/hub/tools.mjs +0 -900
- package/hub/workers/codex-app-server-worker.mjs +0 -1067
- package/hub/workers/delegator-mcp.mjs +0 -1098
- package/hub/workers/lib/jsonrpc-stdio.mjs +0 -204
- package/scripts/lib/claudemd-scanner.mjs +0 -26
- package/scripts/lib/context.mjs +0 -51
- package/scripts/lib/handoff.mjs +0 -187
- package/scripts/lib/logger.mjs +0 -122
- package/scripts/lib/stealth-fetch.mjs +0 -176
package/hub/store-adapter.mjs
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildAdaptiveRuleRow,
|
|
3
|
-
clampConfidence,
|
|
4
|
-
clampHitIncrement,
|
|
5
|
-
clampRetentionMs,
|
|
6
|
-
clone,
|
|
7
|
-
coerceTimestamp,
|
|
8
|
-
createMemoryStore,
|
|
9
|
-
normalizeAdaptiveRuleIdentity,
|
|
10
|
-
} from "@triflux/core/hub/lib/memory-store.mjs";
|
|
11
|
-
import { createStore, importBetterSqlite3 } from "./store.mjs";
|
|
12
|
-
|
|
13
|
-
export { createMemoryStore };
|
|
14
|
-
|
|
15
|
-
function ensureAdaptiveRulesSchema(db) {
|
|
16
|
-
const schemaKey = "adaptive_rules_schema_version";
|
|
17
|
-
const currentVersion = db
|
|
18
|
-
.prepare("SELECT value FROM _meta WHERE key = ?")
|
|
19
|
-
.pluck()
|
|
20
|
-
.get(schemaKey);
|
|
21
|
-
if (currentVersion === "2") return;
|
|
22
|
-
if (!currentVersion) {
|
|
23
|
-
// 신규 생성
|
|
24
|
-
db.exec(`
|
|
25
|
-
CREATE TABLE IF NOT EXISTS adaptive_rules (
|
|
26
|
-
project_slug TEXT NOT NULL,
|
|
27
|
-
pattern TEXT NOT NULL,
|
|
28
|
-
confidence REAL NOT NULL DEFAULT 0.5,
|
|
29
|
-
hit_count INTEGER NOT NULL DEFAULT 1,
|
|
30
|
-
last_seen_ms INTEGER NOT NULL,
|
|
31
|
-
created_ms INTEGER NOT NULL,
|
|
32
|
-
error_message TEXT,
|
|
33
|
-
solution TEXT,
|
|
34
|
-
context TEXT,
|
|
35
|
-
PRIMARY KEY (project_slug, pattern)
|
|
36
|
-
);
|
|
37
|
-
CREATE INDEX IF NOT EXISTS idx_adaptive_rules_last_seen
|
|
38
|
-
ON adaptive_rules(project_slug, last_seen_ms DESC);
|
|
39
|
-
CREATE INDEX IF NOT EXISTS idx_adaptive_rules_confidence
|
|
40
|
-
ON adaptive_rules(project_slug, confidence DESC);
|
|
41
|
-
`);
|
|
42
|
-
} else {
|
|
43
|
-
// v1 → v2 마이그레이션: 컬럼 추가
|
|
44
|
-
const cols = db.pragma("table_info(adaptive_rules)").map((c) => c.name);
|
|
45
|
-
if (!cols.includes("error_message"))
|
|
46
|
-
db.exec("ALTER TABLE adaptive_rules ADD COLUMN error_message TEXT");
|
|
47
|
-
if (!cols.includes("solution"))
|
|
48
|
-
db.exec("ALTER TABLE adaptive_rules ADD COLUMN solution TEXT");
|
|
49
|
-
if (!cols.includes("context"))
|
|
50
|
-
db.exec("ALTER TABLE adaptive_rules ADD COLUMN context TEXT");
|
|
51
|
-
}
|
|
52
|
-
db.prepare("INSERT OR REPLACE INTO _meta (key, value) VALUES (?, ?)").run(
|
|
53
|
-
schemaKey,
|
|
54
|
-
"2",
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function attachAdaptiveRuleStore(store) {
|
|
59
|
-
if (store.type !== "sqlite" || !store.db) return store;
|
|
60
|
-
ensureAdaptiveRulesSchema(store.db);
|
|
61
|
-
const statements = {
|
|
62
|
-
upsertRule: store.db.prepare(`
|
|
63
|
-
INSERT INTO adaptive_rules (
|
|
64
|
-
project_slug, pattern, confidence, hit_count, last_seen_ms, created_ms,
|
|
65
|
-
error_message, solution, context
|
|
66
|
-
) VALUES (
|
|
67
|
-
@project_slug, @pattern, @confidence, @hit_count, @last_seen_ms, @created_ms,
|
|
68
|
-
@error_message, @solution, @context
|
|
69
|
-
)
|
|
70
|
-
ON CONFLICT(project_slug, pattern) DO UPDATE SET
|
|
71
|
-
confidence = excluded.confidence,
|
|
72
|
-
hit_count = excluded.hit_count,
|
|
73
|
-
last_seen_ms = excluded.last_seen_ms,
|
|
74
|
-
created_ms = MIN(adaptive_rules.created_ms, excluded.created_ms),
|
|
75
|
-
error_message = COALESCE(excluded.error_message, adaptive_rules.error_message),
|
|
76
|
-
solution = COALESCE(excluded.solution, adaptive_rules.solution),
|
|
77
|
-
context = COALESCE(excluded.context, adaptive_rules.context)`),
|
|
78
|
-
getRule: store.db.prepare(
|
|
79
|
-
"SELECT * FROM adaptive_rules WHERE project_slug = ? AND pattern = ?",
|
|
80
|
-
),
|
|
81
|
-
updateRule: store.db.prepare(`
|
|
82
|
-
UPDATE adaptive_rules SET
|
|
83
|
-
confidence = ?,
|
|
84
|
-
hit_count = hit_count + ?,
|
|
85
|
-
last_seen_ms = ?
|
|
86
|
-
WHERE project_slug = ? AND pattern = ?`),
|
|
87
|
-
pruneRules: store.db.prepare(`
|
|
88
|
-
DELETE FROM adaptive_rules
|
|
89
|
-
WHERE last_seen_ms < ? AND confidence < ?`),
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
store.addAdaptiveRule = function addAdaptiveRule(rule) {
|
|
93
|
-
const next = buildAdaptiveRuleRow(rule);
|
|
94
|
-
if (!next) return null;
|
|
95
|
-
statements.upsertRule.run(next);
|
|
96
|
-
return store.findAdaptiveRule(next.project_slug, next.pattern);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
store.findAdaptiveRule = function findAdaptiveRule(projectSlug, pattern) {
|
|
100
|
-
const identity = normalizeAdaptiveRuleIdentity(projectSlug, pattern);
|
|
101
|
-
if (!identity) return null;
|
|
102
|
-
return clone(
|
|
103
|
-
statements.getRule.get(identity.project_slug, identity.pattern) || null,
|
|
104
|
-
);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
store.updateRuleConfidence = function updateRuleConfidence(
|
|
108
|
-
projectSlug,
|
|
109
|
-
pattern,
|
|
110
|
-
confidence,
|
|
111
|
-
options = {},
|
|
112
|
-
) {
|
|
113
|
-
const current = store.findAdaptiveRule(projectSlug, pattern);
|
|
114
|
-
if (!current) return null;
|
|
115
|
-
const updatedAt = Math.max(
|
|
116
|
-
current.last_seen_ms,
|
|
117
|
-
coerceTimestamp(options.last_seen_ms, Date.now()),
|
|
118
|
-
);
|
|
119
|
-
statements.updateRule.run(
|
|
120
|
-
clampConfidence(confidence, current.confidence),
|
|
121
|
-
clampHitIncrement(options.hit_count_increment, 1),
|
|
122
|
-
updatedAt,
|
|
123
|
-
current.project_slug,
|
|
124
|
-
current.pattern,
|
|
125
|
-
);
|
|
126
|
-
return store.findAdaptiveRule(current.project_slug, current.pattern);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
store.pruneStaleRules = function pruneStaleRules(
|
|
130
|
-
maxAge_ms = 30 * 24 * 3600 * 1000,
|
|
131
|
-
minConfidence = 0.2,
|
|
132
|
-
) {
|
|
133
|
-
const cutoff =
|
|
134
|
-
Date.now() - clampRetentionMs(maxAge_ms, 30 * 24 * 3600 * 1000);
|
|
135
|
-
return statements.pruneRules.run(cutoff, minConfidence).changes;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// listAdaptiveRules: decayRules에서 사용
|
|
139
|
-
const listStmt = store.db.prepare(
|
|
140
|
-
"SELECT * FROM adaptive_rules WHERE project_slug = ? ORDER BY confidence DESC",
|
|
141
|
-
);
|
|
142
|
-
const listAllStmt = store.db.prepare(
|
|
143
|
-
"SELECT * FROM adaptive_rules ORDER BY confidence DESC",
|
|
144
|
-
);
|
|
145
|
-
const deleteRuleStmt = store.db.prepare(
|
|
146
|
-
"DELETE FROM adaptive_rules WHERE project_slug = ? AND pattern = ?",
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
store.listAdaptiveRules = function listAdaptiveRules(projectSlug) {
|
|
150
|
-
if (projectSlug) return listStmt.all(projectSlug).map(clone);
|
|
151
|
-
return listAllStmt.all().map(clone);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
store.deleteAdaptiveRule = function deleteAdaptiveRule(projectSlug, pattern) {
|
|
155
|
-
return deleteRuleStmt.run(projectSlug, pattern).changes > 0;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
return store;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* 환경에 따라 적절한 스토어 어댑터(SQLite 또는 인메모리)를 생성합니다.
|
|
163
|
-
*
|
|
164
|
-
* @param {string} dbPath - SQLite 데이터베이스 파일 경로
|
|
165
|
-
* @param {object} [options] - 옵션
|
|
166
|
-
* @param {Function} [options.loadDatabase] - 데이터베이스 로더 함수
|
|
167
|
-
* @returns {Promise<object>} 생성된 스토어 어댑터
|
|
168
|
-
*/
|
|
169
|
-
export async function createStoreAdapter(dbPath, options = {}) {
|
|
170
|
-
const loadDatabase = options.loadDatabase || importBetterSqlite3;
|
|
171
|
-
try {
|
|
172
|
-
const DatabaseCtor = await loadDatabase();
|
|
173
|
-
const store = createStore(dbPath, { DatabaseCtor });
|
|
174
|
-
store.type = "sqlite";
|
|
175
|
-
return attachAdaptiveRuleStore(store);
|
|
176
|
-
} catch (error) {
|
|
177
|
-
console.warn(
|
|
178
|
-
`[store] SQLite unavailable (${error.message}), using in-memory fallback`,
|
|
179
|
-
);
|
|
180
|
-
return createMemoryStore();
|
|
181
|
-
}
|
|
182
|
-
}
|