@routinecrew/routinecode 2.31.57 → 2.31.58
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/bin/cli.sh +65 -41
- package/bin/prompt-vault.js +1 -1
- package/bin/rc-credit-turn.js +30 -4
- package/bin/rc-grant.js +79 -0
- package/bin/seal-open.js +5 -2
- package/bin/setup.js +1 -1
- package/hooks/lib/i18n.py +7 -0
- package/hooks/lib/rt_cleanup.py +61 -0
- package/hooks/lib/scrub_stream.py +43 -0
- package/hooks/lib/secret_filter.py +298 -1
- package/hooks/lib/supplements_sig.py +70 -0
- package/hooks/post-knowledge-query.sh +14 -0
- package/hooks/post-secret-detect.sh +12 -27
- package/hooks/pre-account-guard.sh +5 -1
- package/hooks/pre-agent-spawn.mjs +1 -1
- package/hooks/pre-bash-guard.sh +11 -0
- package/hooks/pre-credit-guard.sh +33 -27
- package/hooks/pre-edit-domain-gate.sh +3 -1
- package/hooks/pre-edit-knowledge-gate.sh +3 -1
- package/hooks/pre-grep-guard.sh +11 -0
- package/hooks/pre-read-guard.sh +9 -0
- package/hooks/pre-read-knowledge-inject.sh +3 -1
- package/hooks/session-start.sh +11 -5
- package/hooks/stop-knowledge-remind.sh +45 -10
- package/hooks/tests/in-project-relax.test.py +2 -1
- package/hooks/tests/knowledge-loop.test.sh +89 -0
- package/hooks/tests/secret-guard.test.sh +2 -1
- package/hooks/tests/secret-premask.test.py +166 -0
- package/hooks/user-prompt-submit.sh +18 -12
- package/mcp-db-manager/dist/analyzers/duplicate-detector.js +1 -1
- package/mcp-db-manager/dist/core/model-parser.js +1 -1
- package/mcp-db-manager/dist/core/schema-reader.js +1 -1
- package/mcp-db-manager/dist/executors/migration-executor.js +1 -1
- package/mcp-db-manager/dist/generators/migration-generator.js +1 -1
- package/mcp-db-manager/dist/index.js +1 -1
- package/mcp-db-manager/dist/validators/schema-validator.js +1 -1
- package/mcp-dev-tester/dist/analyzers/auth-diagnoser.js +1 -1
- package/mcp-dev-tester/dist/analyzers/backend-analyzer.js +1 -1
- package/mcp-dev-tester/dist/analyzers/endpoint-diagnoser.js +1 -1
- package/mcp-dev-tester/dist/analyzers/frontend-analyzer.js +1 -1
- package/mcp-dev-tester/dist/analyzers/runtime-diagnoser.js +1 -1
- package/mcp-dev-tester/dist/analyzers/type-comparator.js +1 -1
- package/mcp-dev-tester/dist/analyzers/validation-diagnoser.js +1 -1
- package/mcp-dev-tester/dist/attestation.js +1 -1
- package/mcp-dev-tester/dist/browser/playwright-manager.js +1 -1
- package/mcp-dev-tester/dist/browser/ui-tester.js +1 -1
- package/mcp-dev-tester/dist/config/project-config.js +1 -1
- package/mcp-dev-tester/dist/index.js +1 -1
- package/mcp-dev-tester/dist/testers/api-tester.js +1 -1
- package/mcp-doc-fetcher/dist/index.js +1 -1
- package/mcp-html-renderer/dist/index.js +1 -1
- package/mcp-html-renderer/dist/preview.js +1 -1
- package/mcp-html-renderer/dist/template-engine.js +1 -1
- package/mcp-intelligence/dist/concept-catalog.js +1 -1
- package/mcp-intelligence/dist/concept-server-proxy.js +1 -1
- package/mcp-intelligence/dist/config-auth.js +1 -1
- package/mcp-intelligence/dist/contracts.generated.js +1 -1
- package/mcp-intelligence/dist/domain-templates.js +1 -1
- package/mcp-intelligence/dist/grounding.d.ts +1 -0
- package/mcp-intelligence/dist/grounding.d.ts.map +1 -1
- package/mcp-intelligence/dist/grounding.js +1 -1
- package/mcp-intelligence/dist/handlers.js +1 -1
- package/mcp-intelligence/dist/index.js +1 -1
- package/mcp-intelligence/dist/intelligence-file.js +1 -1
- package/mcp-intelligence/dist/knowledge-critic.js +1 -1
- package/mcp-intelligence/dist/knowledge-handlers.d.ts +20 -0
- package/mcp-intelligence/dist/knowledge-handlers.d.ts.map +1 -1
- package/mcp-intelligence/dist/knowledge-handlers.js +1 -1
- package/mcp-intelligence/dist/mention-extractor.js +1 -1
- package/mcp-intelligence/dist/provenance.js +1 -1
- package/mcp-intelligence/dist/semantic-embedder.js +1 -1
- package/mcp-log-watcher/dist/config-auth.js +1 -1
- package/mcp-log-watcher/dist/file-watcher.js +1 -1
- package/mcp-log-watcher/dist/index.js +1 -1
- package/mcp-log-watcher/dist/known-solutions.js +1 -1
- package/mcp-log-watcher/dist/log-store.js +1 -1
- package/mcp-log-watcher/dist/websocket-server.js +1 -1
- package/mcp-plan-manager/dist/__tests__/plan-parser.test.js +1 -1
- package/mcp-plan-manager/dist/file-ops.js +1 -1
- package/mcp-plan-manager/dist/index.js +1 -1
- package/mcp-plan-manager/dist/plan-parser.js +1 -1
- package/mcp-project-context/dist/git-ops.js +1 -1
- package/mcp-project-context/dist/index.js +1 -1
- package/mcp-project-context/dist/project-analysis.js +1 -1
- package/mcp-routinecode/dist/agent-tracker.js +1 -1
- package/mcp-routinecode/dist/attestation.js +1 -1
- package/mcp-routinecode/dist/blast-radius.js +1 -1
- package/mcp-routinecode/dist/changeset.js +1 -1
- package/mcp-routinecode/dist/config-auth.js +1 -1
- package/mcp-routinecode/dist/contracts.generated.js +1 -1
- package/mcp-routinecode/dist/coverage.js +1 -1
- package/mcp-routinecode/dist/explorer-advisor.js +1 -1
- package/mcp-routinecode/dist/failure-tracker.js +1 -1
- package/mcp-routinecode/dist/file-lock-registry.js +1 -1
- package/mcp-routinecode/dist/file-risk-scorer.js +1 -1
- package/mcp-routinecode/dist/index.js +1 -1
- package/mcp-routinecode/dist/known-solutions.js +1 -1
- package/mcp-routinecode/dist/ledger-miner.js +1 -1
- package/mcp-routinecode/dist/observed-draft.js +1 -1
- package/mcp-routinecode/dist/pattern-matcher.js +1 -1
- package/mcp-routinecode/dist/route-match.js +1 -1
- package/mcp-routinecode/dist/routines.js +1 -1
- package/mcp-routinecode/dist/rule-engine.js +1 -1
- package/mcp-routinecode/dist/rule-promoter.js +1 -1
- package/mcp-routinecode/dist/telemetry-analyzer.js +1 -1
- package/mcp-routinecode/dist/test-runner.js +1 -1
- package/mcp-routinecode/dist/verification.js +0 -0
- package/mcp-routinecode/dist/viral-loop.js +1 -1
- package/package.json +1 -1
- package/plugin/agents/analyzer.md.sealed +1 -0
- package/plugin/agents/crawler.md.sealed +1 -0
- package/plugin/agents/explorer.md.sealed +1 -0
- package/plugin/agents/implementor.md.sealed +1 -0
- package/plugin/agents/looker.md.sealed +1 -0
- package/plugin/agents/planner.md.sealed +1 -0
- package/plugin/agents/recorder.md.sealed +1 -0
- package/plugin/agents/reviewer.md.sealed +1 -0
- package/plugin/agents/verifier.md.sealed +1 -0
- package/plugin/commands/analyze.md.sealed +1 -0
- package/plugin/commands/plan.md.sealed +1 -0
- package/plugin/commands/rc.md.sealed +1 -0
- package/plugin/commands/receipt.md.sealed +1 -0
- package/plugin/commands/routines.md.sealed +1 -0
- package/plugin/commands/share.md.sealed +1 -0
- package/plugin/routinecode-prompt.md.sealed +1 -0
package/bin/rc-credit-turn.js
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
import { readFileSync, writeFileSync, renameSync, mkdirSync } from 'node:fs';
|
|
27
27
|
import { homedir } from 'node:os';
|
|
28
28
|
import { join, dirname } from 'node:path';
|
|
29
|
+
import { createHmac, randomBytes } from 'node:crypto';
|
|
29
30
|
|
|
30
31
|
const DEFAULT_SERVER_BASE = 'https://knowledge.routinecrew.net';
|
|
31
32
|
const TIMEOUT_MS = 3000;
|
|
@@ -50,11 +51,36 @@ function atomicWrite(p, obj) {
|
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
// 결정 파일 서명 — pre-credit-guard 는 서명된 '허용' 결정만 믿는다(무서명 blocked=false 덮어쓰기 무효).
|
|
55
|
+
// 키는 attestation 과 같은 로컬 HMAC 키(KNOWLEDGE_DIR/attest/.key, 없으면 생성).
|
|
56
|
+
function attestKey() {
|
|
57
|
+
const dir = join(process.env.ROUTINECODE_KNOWLEDGE_DIR || join(RC_DIR, 'knowledge'), 'attest');
|
|
58
|
+
const p = join(dir, '.key');
|
|
59
|
+
try {
|
|
60
|
+
return readFileSync(p);
|
|
61
|
+
} catch {
|
|
62
|
+
try {
|
|
63
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
64
|
+
writeFileSync(p, randomBytes(32), { flag: 'wx', mode: 0o600 });
|
|
65
|
+
} catch {
|
|
66
|
+
// 동시 생성 경합 — 아래 재읽기
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
return readFileSync(p);
|
|
70
|
+
} catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
53
76
|
function writeDecision(blocked) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
77
|
+
const at = new Date().toISOString();
|
|
78
|
+
const rec = { blocked: !!blocked, at };
|
|
79
|
+
const key = attestKey();
|
|
80
|
+
if (key) {
|
|
81
|
+
rec.mac = createHmac('sha256', key).update(`credit-decision|${blocked ? 1 : 0}|${at}`).digest('hex');
|
|
82
|
+
}
|
|
83
|
+
atomicWrite(join(RC_DIR, 'credit-decision.json'), rec);
|
|
58
84
|
}
|
|
59
85
|
|
|
60
86
|
function mirrorBalance(balance) {
|
package/bin/rc-grant.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* rc-grant — Sealed Core 세션 출입증(Session Grant) 수령기 (zero-dep runner).
|
|
4
|
+
*
|
|
5
|
+
* bin/cli.sh 가 seal-open 직전에 호출한다. 서버(growth, knowledge /growth-proxy 경유)가 Ed25519 로
|
|
6
|
+
* 서명한 { claims, signature } 를 받아 ~/.routinecode/session-grant.json 에 캐시한다.
|
|
7
|
+
* claims.sealedContentKey 가 이 사용자 전용으로 포장된 프롬프트 복호 키다(seal-open 이 검증·언랩).
|
|
8
|
+
*
|
|
9
|
+
* 캐시 정책: 유효 기간이 2시간 넘게 남았으면 서버를 부르지 않는다(실행 지연 0).
|
|
10
|
+
* 실패(오프라인·서버 장애·미로그인)는 조용히 무시 — 기존 캐시가 만료 전까지 계속 쓰인다(장애 내성 ~24h).
|
|
11
|
+
* 출력 없음, 항상 exit 0 — routinecode 실행을 절대 막지 않는다.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { readFileSync, writeFileSync, renameSync, mkdirSync, unlinkSync } from 'node:fs';
|
|
15
|
+
import { homedir } from 'node:os';
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
|
|
18
|
+
const RC_DIR = join(homedir(), '.routinecode');
|
|
19
|
+
const CACHE = join(RC_DIR, 'session-grant.json');
|
|
20
|
+
const DENIED = join(RC_DIR, 'grant-denied.json'); // 서버가 키를 무효로 판정한 표시(cli.sh 가 재로그인 요구)
|
|
21
|
+
const DEFAULT_SERVER_BASE = 'https://knowledge.routinecrew.net';
|
|
22
|
+
const TIMEOUT_MS = 3000;
|
|
23
|
+
const REFRESH_BEFORE_MS = 2 * 60 * 60 * 1000;
|
|
24
|
+
|
|
25
|
+
function readJson(p) {
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(readFileSync(p, 'utf-8'));
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function stillFresh(g) {
|
|
34
|
+
const exp = g && g.claims && Date.parse(g.claims.expiresAt);
|
|
35
|
+
return Number.isFinite(exp) && exp - Date.now() > REFRESH_BEFORE_MS;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function main() {
|
|
39
|
+
const cached = readJson(CACHE);
|
|
40
|
+
const cfg = readJson(join(RC_DIR, 'config.json')) || {};
|
|
41
|
+
const apiKey = process.env.ROUTINECODE_API_KEY || cfg.apiKey;
|
|
42
|
+
if (!apiKey) return;
|
|
43
|
+
// 다른 계정의 출입증이 남아 있으면(계정 전환) 갱신 대상
|
|
44
|
+
if (stillFresh(cached) && (!cfg.userId || cached.claims.userId === cfg.userId)) return;
|
|
45
|
+
|
|
46
|
+
const base = (process.env.ROUTINECODE_SERVER_URL || cfg.serverUrl || DEFAULT_SERVER_BASE).replace(/\/+$/, '');
|
|
47
|
+
const controller = new AbortController();
|
|
48
|
+
const timer = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
49
|
+
try {
|
|
50
|
+
const resp = await fetch(base + '/api/v1/growth-proxy/session-grant', {
|
|
51
|
+
method: 'POST',
|
|
52
|
+
headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + apiKey },
|
|
53
|
+
body: JSON.stringify({ tenantId: Number(cfg.tenantId) || 0, serviceId: 'routinecode' }),
|
|
54
|
+
signal: controller.signal,
|
|
55
|
+
});
|
|
56
|
+
const body = await resp.json().catch(() => null);
|
|
57
|
+
if (!resp.ok) {
|
|
58
|
+
// 서버가 '이 키는 무효'라고 명시(401 + code=INVALID_API_KEY)했을 때만 거부 표시 → cli.sh 가 재로그인 요구.
|
|
59
|
+
// 장애(5xx·타임아웃·코드 없는 401)는 거부로 보지 않는다 — 서버 문제가 사용자 차단으로 번지지 않게.
|
|
60
|
+
if (resp.status === 401 && body && body.code === 'INVALID_API_KEY') {
|
|
61
|
+
writeFileSync(DENIED, JSON.stringify({ at: new Date().toISOString() }), { mode: 0o600 });
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const g = body && body.data;
|
|
66
|
+
if (!g || typeof g.signature !== 'string' || !g.claims || typeof g.claims.expiresAt !== 'string') return;
|
|
67
|
+
mkdirSync(RC_DIR, { recursive: true });
|
|
68
|
+
try { unlinkSync(DENIED); } catch { /* 없음 */ }
|
|
69
|
+
const tmp = CACHE + '.' + process.pid + '.tmp';
|
|
70
|
+
writeFileSync(tmp, JSON.stringify(g), { mode: 0o600 });
|
|
71
|
+
renameSync(tmp, CACHE);
|
|
72
|
+
} catch {
|
|
73
|
+
// 오프라인·타임아웃 — 기존 캐시 유지
|
|
74
|
+
} finally {
|
|
75
|
+
clearTimeout(timer);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
main().catch(() => {}).finally(() => process.exit(0));
|
package/bin/seal-open.js
CHANGED
|
@@ -20,7 +20,7 @@ import { fileURLToPath } from "node:url";
|
|
|
20
20
|
// 임베드 공개키(spki DER base64). 배포 시 embed-pubkey.js 가 아래 `?? ""` 의 빈 문자열을
|
|
21
21
|
// env GRANT_ED25519_PUBLIC_KEY_B64 실값으로 치환한다(session-grant.ts 와 동일 패턴/정규식).
|
|
22
22
|
// 비어 있으면(미배포/미치환) 검증 비활성 → 평문 fallback(무붕괴, 점진 롤아웃 안전).
|
|
23
|
-
const GRANT_PUBKEY_B64 = process.env.ROUTINECODE_GRANT_PUBKEY ?? "";
|
|
23
|
+
const GRANT_PUBKEY_B64 = process.env.ROUTINECODE_GRANT_PUBKEY ?? "MCowBQYDK2VwAyEAjuZ6jXHaucTciaaPD/dUQvFOYlhm1gX8wajEAumLqFg=";
|
|
24
24
|
|
|
25
25
|
const GRANT_CACHE = join(homedir(), ".routinecode", "session-grant.json");
|
|
26
26
|
|
|
@@ -139,7 +139,10 @@ function main() {
|
|
|
139
139
|
// 5. 복호 → temp(평문 비영속).
|
|
140
140
|
try {
|
|
141
141
|
const plaintext = unseal(readFileSync(sealed, "utf8"), key, pluginRelpath(target));
|
|
142
|
-
|
|
142
|
+
// 폴더명 '<세션 PID>-<rand>' — cli.sh 가 넘긴 RC_LAUNCH_PID(exec 후 Claude Code 의 PID)로 세션 생존을 판정해
|
|
143
|
+
// 정리한다(hooks/lib/rt_cleanup.py). PID 를 못 받으면 이전 형식(시간 기준 정리).
|
|
144
|
+
const lp = /^\d+$/.test(process.env.RC_LAUNCH_PID || "") ? process.env.RC_LAUNCH_PID + "-" : "";
|
|
145
|
+
const rtDir = join(homedir(), ".routinecode", ".rt", lp + randomBytes(8).toString("hex"));
|
|
143
146
|
mkdirSync(rtDir, { recursive: true, mode: 0o700 });
|
|
144
147
|
const outPath = join(rtDir, basename(target));
|
|
145
148
|
writeFileSync(outPath, plaintext, { encoding: "utf8", mode: 0o600 });
|