@triflux/remote 10.0.1 → 10.25.1
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/hub/pipe.mjs +239 -121
- package/hub/public/dashboard.html +68 -7
- package/hub/server.mjs +2181 -701
- package/hub/store-adapter.mjs +101 -37
- package/hub/store.mjs +356 -153
- package/hub/team/agent-map.json +26 -7
- package/hub/team/ansi.mjs +245 -146
- package/hub/team/backend.mjs +84 -17
- package/hub/team/build-worker-prompt.mjs +42 -0
- package/hub/team/check-mcp-hub.mjs +49 -0
- package/hub/team/claude-daemon-control.mjs +219 -0
- package/hub/team/claude-native-bridge.mjs +784 -0
- package/hub/team/claude-session-projection.mjs +65 -0
- package/hub/team/cli/commands/attach.mjs +57 -37
- package/hub/team/cli/commands/control.mjs +29 -8
- package/hub/team/cli/commands/debug.mjs +95 -74
- package/hub/team/cli/commands/focus.mjs +80 -53
- package/hub/team/cli/commands/interrupt.mjs +18 -6
- package/hub/team/cli/commands/kill.mjs +16 -5
- package/hub/team/cli/commands/list.mjs +31 -24
- package/hub/team/cli/commands/send.mjs +19 -6
- package/hub/team/cli/commands/start/index.mjs +154 -33
- package/hub/team/cli/commands/start/parse-args.mjs +89 -12
- package/hub/team/cli/commands/start/start-headless.mjs +127 -37
- package/hub/team/cli/commands/start/start-in-process.mjs +50 -40
- package/hub/team/cli/commands/start/start-mux.mjs +122 -73
- package/hub/team/cli/commands/start/start-wt.mjs +86 -69
- package/hub/team/cli/commands/status.mjs +43 -14
- package/hub/team/cli/commands/stop.mjs +11 -4
- package/hub/team/cli/commands/task.mjs +8 -3
- package/hub/team/cli/commands/tasks.mjs +13 -13
- package/hub/team/cli/index.mjs +2 -2
- package/hub/team/cli/manifest.mjs +38 -8
- package/hub/team/cli/render.mjs +52 -30
- package/hub/team/cli/services/attach-fallback.mjs +74 -54
- package/hub/team/cli/services/hub-client.mjs +45 -17
- package/hub/team/cli/services/member-selector.mjs +37 -30
- package/hub/team/cli/services/native-control.mjs +144 -116
- package/hub/team/cli/services/runtime-mode.mjs +55 -1
- package/hub/team/cli/services/state-store.mjs +66 -9
- package/hub/team/cli/services/task-model.mjs +40 -30
- package/hub/team/codex-review.mjs +521 -0
- package/hub/team/conductor-mesh-bridge.mjs +25 -24
- package/hub/team/conductor-registry.mjs +121 -0
- package/hub/team/conductor.mjs +1379 -671
- package/hub/team/consensus-meta.mjs +176 -0
- package/hub/team/dashboard-anchor.mjs +4 -5
- package/hub/team/dashboard-layout.mjs +3 -1
- package/hub/team/dashboard-open.mjs +21 -119
- package/hub/team/dashboard.mjs +76 -28
- package/hub/team/event-log.mjs +18 -10
- package/hub/team/execution-mode.mjs +241 -0
- package/hub/team/extract-completion-payload.mjs +110 -0
- package/hub/team/git-preflight.mjs +286 -0
- package/hub/team/handoff.mjs +49 -18
- package/hub/team/headless-bridge-session.mjs +17 -0
- package/hub/team/headless.mjs +2065 -1156
- package/hub/team/health-probe.mjs +232 -69
- package/hub/team/launcher-template.mjs +23 -13
- package/hub/team/lead-control.mjs +91 -4
- package/hub/team/mcp-selector.mjs +145 -0
- package/hub/team/native-supervisor.mjs +90 -26
- package/hub/team/native.mjs +74 -35
- package/hub/team/nativeProxy.mjs +184 -113
- package/hub/team/notify.mjs +147 -78
- package/hub/team/orchestrator.mjs +173 -161
- package/hub/team/pane.mjs +43 -15
- package/hub/team/process-cleanup.mjs +69 -25
- package/hub/team/psmux.mjs +1067 -264
- package/hub/team/recovery-store.mjs +149 -0
- package/hub/team/remote-probe.mjs +69 -53
- package/hub/team/remote-session.mjs +131 -59
- package/hub/team/remote-watcher.mjs +62 -34
- package/hub/team/retry-state-machine.mjs +267 -0
- package/hub/team/routing.mjs +51 -25
- package/hub/team/runtime-strategy.mjs +200 -0
- package/hub/team/schemas/worker-completion.json +39 -0
- package/hub/team/sentinel-capture.mjs +127 -0
- package/hub/team/session-sync.mjs +153 -6
- package/hub/team/session.mjs +605 -611
- package/hub/team/shared.mjs +13 -13
- package/hub/team/staleState.mjs +72 -30
- package/hub/team/swarm-cli.mjs +390 -0
- package/hub/team/swarm-hypervisor.mjs +1526 -198
- package/hub/team/swarm-intent.mjs +216 -0
- package/hub/team/swarm-locks.mjs +140 -25
- package/hub/team/swarm-planner.mjs +121 -21
- package/hub/team/swarm-preflight.mjs +317 -0
- package/hub/team/swarm-reconciler.mjs +128 -23
- package/hub/team/synapse-cli.mjs +458 -0
- package/hub/team/synapse-http.mjs +60 -0
- package/hub/team/synapse-registry.mjs +329 -0
- package/hub/team/terminal-opener.mjs +216 -0
- package/hub/team/tui-core.mjs +288 -0
- package/hub/team/tui-lite.mjs +234 -146
- package/hub/team/tui-remote-adapter.mjs +21 -37
- package/hub/team/tui-synapse.mjs +223 -0
- package/hub/team/tui-viewer.mjs +104 -45
- package/hub/team/tui-widgets.mjs +262 -0
- package/hub/team/tui.mjs +936 -449
- package/hub/team/worker-completion-validator.mjs +84 -0
- package/hub/team/worker-sandbox.mjs +93 -0
- package/hub/team/worker-signal.mjs +263 -0
- package/hub/team/worker-signal.types.d.ts +52 -0
- package/hub/team/worktree-lifecycle.mjs +518 -64
- package/hub/team/wt-manager.mjs +297 -26
- package/hub/tools.mjs +474 -252
- package/hub/tray.mjs +411 -368
- package/hub/workers/claude-worker.mjs +162 -118
- package/hub/workers/codex-app-server-worker.mjs +1015 -0
- package/hub/workers/codex-mcp.mjs +724 -507
- package/hub/workers/delegator-mcp.mjs +663 -337
- package/hub/workers/factory.mjs +100 -21
- package/hub/workers/gemini-worker.mjs +179 -86
- package/hub/workers/interface.mjs +23 -2
- package/hub/workers/lib/jsonrpc-stdio.mjs +463 -0
- package/hub/workers/worker-utils.mjs +22 -16
- package/package.json +4 -3
- package/scripts/lib/agent-json.mjs +27 -0
- package/scripts/lib/async.mjs +174 -0
- package/scripts/lib/claudemd-scanner.mjs +223 -0
- package/scripts/lib/cli-agy.mjs +62 -0
- package/scripts/lib/cli-claude.mjs +78 -0
- package/scripts/lib/cli-codex.mjs +199 -0
- package/scripts/lib/cli-gemini.mjs +67 -0
- package/scripts/lib/codex-recovery.sh +50 -0
- package/scripts/lib/context.mjs +67 -0
- package/scripts/lib/cross-review-utils.mjs +59 -0
- package/scripts/lib/doctor-env-checks.mjs +121 -0
- package/scripts/lib/dynamic-route-cli.mjs +107 -0
- package/scripts/lib/env-probe.mjs +269 -0
- package/scripts/lib/env.mjs +14 -0
- package/scripts/lib/gemini-profiles.mjs +119 -0
- package/scripts/lib/handoff.mjs +187 -0
- package/scripts/lib/hook-utils.mjs +16 -0
- package/scripts/lib/hub.mjs +48 -0
- package/scripts/lib/keyword-rules.mjs +195 -0
- package/scripts/lib/logger.mjs +105 -0
- package/scripts/lib/mcp-filter.mjs +883 -0
- package/scripts/lib/mcp-gateway-servers.mjs +70 -0
- package/scripts/lib/mcp-guard-engine.mjs +2120 -0
- package/scripts/lib/mcp-health.mjs +773 -0
- package/scripts/lib/mcp-manifest.mjs +89 -0
- package/scripts/lib/mcp-server-catalog.mjs +355 -0
- package/scripts/lib/pid.mjs +63 -0
- package/scripts/lib/process-utils.mjs +26 -0
- package/scripts/lib/psmux-info.mjs +179 -0
- package/scripts/lib/quota.mjs +47 -0
- package/scripts/lib/remote-spawn-transfer.mjs +226 -0
- package/scripts/lib/skill-state.mjs +220 -0
- package/scripts/lib/skill-template.mjs +375 -0
- package/scripts/lib/team.mjs +75 -0
- package/scripts/lib/timeout.mjs +66 -0
- package/scripts/lib/tmp.mjs +26 -0
- package/scripts/lib/toml.mjs +113 -0
package/hub/store-adapter.mjs
CHANGED
|
@@ -1,55 +1,83 @@
|
|
|
1
|
-
import { createStore, importBetterSqlite3 } from './store.mjs';
|
|
2
1
|
import {
|
|
3
|
-
createMemoryStore,
|
|
4
|
-
clone,
|
|
5
2
|
buildAdaptiveRuleRow,
|
|
6
|
-
normalizeAdaptiveRuleIdentity,
|
|
7
3
|
clampConfidence,
|
|
8
4
|
clampHitIncrement,
|
|
9
|
-
coerceTimestamp,
|
|
10
5
|
clampRetentionMs,
|
|
11
|
-
|
|
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
12
|
|
|
13
13
|
export { createMemoryStore };
|
|
14
14
|
|
|
15
15
|
function ensureAdaptiveRulesSchema(db) {
|
|
16
|
-
const schemaKey =
|
|
17
|
-
const currentVersion = db
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
+
);
|
|
35
56
|
}
|
|
36
57
|
|
|
37
58
|
function attachAdaptiveRuleStore(store) {
|
|
38
|
-
if (store.type !==
|
|
59
|
+
if (store.type !== "sqlite" || !store.db) return store;
|
|
39
60
|
ensureAdaptiveRulesSchema(store.db);
|
|
40
61
|
const statements = {
|
|
41
62
|
upsertRule: store.db.prepare(`
|
|
42
63
|
INSERT INTO adaptive_rules (
|
|
43
|
-
project_slug, pattern, confidence, hit_count, last_seen_ms, created_ms
|
|
64
|
+
project_slug, pattern, confidence, hit_count, last_seen_ms, created_ms,
|
|
65
|
+
error_message, solution, context
|
|
44
66
|
) VALUES (
|
|
45
|
-
@project_slug, @pattern, @confidence, @hit_count, @last_seen_ms, @created_ms
|
|
67
|
+
@project_slug, @pattern, @confidence, @hit_count, @last_seen_ms, @created_ms,
|
|
68
|
+
@error_message, @solution, @context
|
|
46
69
|
)
|
|
47
70
|
ON CONFLICT(project_slug, pattern) DO UPDATE SET
|
|
48
71
|
confidence = excluded.confidence,
|
|
49
72
|
hit_count = excluded.hit_count,
|
|
50
73
|
last_seen_ms = excluded.last_seen_ms,
|
|
51
|
-
created_ms = MIN(adaptive_rules.created_ms, excluded.created_ms)
|
|
52
|
-
|
|
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
|
+
),
|
|
53
81
|
updateRule: store.db.prepare(`
|
|
54
82
|
UPDATE adaptive_rules SET
|
|
55
83
|
confidence = ?,
|
|
@@ -71,13 +99,23 @@ function attachAdaptiveRuleStore(store) {
|
|
|
71
99
|
store.findAdaptiveRule = function findAdaptiveRule(projectSlug, pattern) {
|
|
72
100
|
const identity = normalizeAdaptiveRuleIdentity(projectSlug, pattern);
|
|
73
101
|
if (!identity) return null;
|
|
74
|
-
return clone(
|
|
102
|
+
return clone(
|
|
103
|
+
statements.getRule.get(identity.project_slug, identity.pattern) || null,
|
|
104
|
+
);
|
|
75
105
|
};
|
|
76
106
|
|
|
77
|
-
store.updateRuleConfidence = function updateRuleConfidence(
|
|
107
|
+
store.updateRuleConfidence = function updateRuleConfidence(
|
|
108
|
+
projectSlug,
|
|
109
|
+
pattern,
|
|
110
|
+
confidence,
|
|
111
|
+
options = {},
|
|
112
|
+
) {
|
|
78
113
|
const current = store.findAdaptiveRule(projectSlug, pattern);
|
|
79
114
|
if (!current) return null;
|
|
80
|
-
const updatedAt = Math.max(
|
|
115
|
+
const updatedAt = Math.max(
|
|
116
|
+
current.last_seen_ms,
|
|
117
|
+
coerceTimestamp(options.last_seen_ms, Date.now()),
|
|
118
|
+
);
|
|
81
119
|
statements.updateRule.run(
|
|
82
120
|
clampConfidence(confidence, current.confidence),
|
|
83
121
|
clampHitIncrement(options.hit_count_increment, 1),
|
|
@@ -88,11 +126,35 @@ function attachAdaptiveRuleStore(store) {
|
|
|
88
126
|
return store.findAdaptiveRule(current.project_slug, current.pattern);
|
|
89
127
|
};
|
|
90
128
|
|
|
91
|
-
store.pruneStaleRules = function pruneStaleRules(
|
|
92
|
-
|
|
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);
|
|
93
135
|
return statements.pruneRules.run(cutoff, minConfidence).changes;
|
|
94
136
|
};
|
|
95
137
|
|
|
138
|
+
// listAdaptiveRules: decayRules/getActiveAdaptiveRules에서 사용
|
|
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
|
+
|
|
96
158
|
return store;
|
|
97
159
|
}
|
|
98
160
|
|
|
@@ -109,10 +171,12 @@ export async function createStoreAdapter(dbPath, options = {}) {
|
|
|
109
171
|
try {
|
|
110
172
|
const DatabaseCtor = await loadDatabase();
|
|
111
173
|
const store = createStore(dbPath, { DatabaseCtor });
|
|
112
|
-
store.type =
|
|
174
|
+
store.type = "sqlite";
|
|
113
175
|
return attachAdaptiveRuleStore(store);
|
|
114
176
|
} catch (error) {
|
|
115
|
-
console.warn(
|
|
177
|
+
console.warn(
|
|
178
|
+
`[store] SQLite unavailable (${error.message}), using in-memory fallback`,
|
|
179
|
+
);
|
|
116
180
|
return createMemoryStore();
|
|
117
181
|
}
|
|
118
182
|
}
|