@tienne/gestalt 0.128.1 → 0.130.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/CLAUDE.md +1 -0
- package/README.md +3 -0
- package/dist/package.json +2 -1
- package/dist/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/plugin/skills/_shared/proactive-routing.md +1 -0
- package/dist/plugin/skills/architecture/SKILL.md +168 -140
- package/dist/plugin/skills/conductor/SKILL.md +180 -0
- package/dist/plugin/skills/handoff/SKILL.md +1 -1
- package/dist/schemas/architecture-ir.schema.json +40 -4
- package/dist/schemas/gestalt.schema.json +64 -0
- package/dist/src/agent-sync/config.d.ts +8 -8
- package/dist/src/architecture/delta.d.ts.map +1 -1
- package/dist/src/architecture/delta.js +6 -0
- package/dist/src/architecture/delta.js.map +1 -1
- package/dist/src/architecture/drilldown.d.ts +6 -2
- package/dist/src/architecture/drilldown.d.ts.map +1 -1
- package/dist/src/architecture/drilldown.js +114 -3
- package/dist/src/architecture/drilldown.js.map +1 -1
- package/dist/src/architecture/html-client.d.ts +2 -0
- package/dist/src/architecture/html-client.d.ts.map +1 -1
- package/dist/src/architecture/html-client.js +10 -4
- package/dist/src/architecture/html-client.js.map +1 -1
- package/dist/src/architecture/html-renderer.d.ts +9 -0
- package/dist/src/architecture/html-renderer.d.ts.map +1 -1
- package/dist/src/architecture/html-renderer.js +213 -64
- package/dist/src/architecture/html-renderer.js.map +1 -1
- package/dist/src/architecture/html-theme.d.ts +10 -1
- package/dist/src/architecture/html-theme.d.ts.map +1 -1
- package/dist/src/architecture/html-theme.js +102 -16
- package/dist/src/architecture/html-theme.js.map +1 -1
- package/dist/src/architecture/infra-layout.d.ts +87 -0
- package/dist/src/architecture/infra-layout.d.ts.map +1 -0
- package/dist/src/architecture/infra-layout.js +424 -0
- package/dist/src/architecture/infra-layout.js.map +1 -0
- package/dist/src/architecture/infra-placement.d.ts +16 -0
- package/dist/src/architecture/infra-placement.d.ts.map +1 -0
- package/dist/src/architecture/infra-placement.js +49 -0
- package/dist/src/architecture/infra-placement.js.map +1 -0
- package/dist/src/architecture/infra-router.d.ts +41 -0
- package/dist/src/architecture/infra-router.d.ts.map +1 -0
- package/dist/src/architecture/infra-router.js +309 -0
- package/dist/src/architecture/infra-router.js.map +1 -0
- package/dist/src/architecture/ir-schema.d.ts +28 -0
- package/dist/src/architecture/ir-schema.d.ts.map +1 -1
- package/dist/src/architecture/ir-schema.js +23 -3
- package/dist/src/architecture/ir-schema.js.map +1 -1
- package/dist/src/architecture/merge.d.ts.map +1 -1
- package/dist/src/architecture/merge.js +6 -2
- package/dist/src/architecture/merge.js.map +1 -1
- package/dist/src/architecture/store.d.ts.map +1 -1
- package/dist/src/architecture/store.js +1 -0
- package/dist/src/architecture/store.js.map +1 -1
- package/dist/src/architecture/types.d.ts +24 -2
- package/dist/src/architecture/types.d.ts.map +1 -1
- package/dist/src/architecture/types.js +19 -2
- package/dist/src/architecture/types.js.map +1 -1
- package/dist/src/architecture/validator.d.ts +9 -2
- package/dist/src/architecture/validator.d.ts.map +1 -1
- package/dist/src/architecture/validator.js +44 -1
- package/dist/src/architecture/validator.js.map +1 -1
- package/dist/src/architecture/vendor-icon-cache.d.ts +31 -0
- package/dist/src/architecture/vendor-icon-cache.d.ts.map +1 -0
- package/dist/src/architecture/vendor-icon-cache.js +358 -0
- package/dist/src/architecture/vendor-icon-cache.js.map +1 -0
- package/dist/src/architecture/vendor-icon-keys.d.ts +26 -0
- package/dist/src/architecture/vendor-icon-keys.d.ts.map +1 -0
- package/dist/src/architecture/vendor-icon-keys.js +154 -0
- package/dist/src/architecture/vendor-icon-keys.js.map +1 -0
- package/dist/src/architecture/vendor-icons.d.ts +43 -0
- package/dist/src/architecture/vendor-icons.d.ts.map +1 -0
- package/dist/src/architecture/vendor-icons.js +81 -0
- package/dist/src/architecture/vendor-icons.js.map +1 -0
- package/dist/src/cli/commands/conductor.d.ts +109 -0
- package/dist/src/cli/commands/conductor.d.ts.map +1 -0
- package/dist/src/cli/commands/conductor.js +466 -0
- package/dist/src/cli/commands/conductor.js.map +1 -0
- package/dist/src/cli/index.d.ts.map +1 -1
- package/dist/src/cli/index.js +151 -0
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/conductor/account-name.d.ts +6 -0
- package/dist/src/conductor/account-name.d.ts.map +1 -0
- package/dist/src/conductor/account-name.js +10 -0
- package/dist/src/conductor/account-name.js.map +1 -0
- package/dist/src/conductor/adapters.d.ts +101 -0
- package/dist/src/conductor/adapters.d.ts.map +1 -0
- package/dist/src/conductor/adapters.js +355 -0
- package/dist/src/conductor/adapters.js.map +1 -0
- package/dist/src/conductor/context.d.ts +12 -0
- package/dist/src/conductor/context.d.ts.map +1 -0
- package/dist/src/conductor/context.js +25 -0
- package/dist/src/conductor/context.js.map +1 -0
- package/dist/src/conductor/engine.d.ts +86 -0
- package/dist/src/conductor/engine.d.ts.map +1 -0
- package/dist/src/conductor/engine.js +730 -0
- package/dist/src/conductor/engine.js.map +1 -0
- package/dist/src/conductor/gates.d.ts +70 -0
- package/dist/src/conductor/gates.d.ts.map +1 -0
- package/dist/src/conductor/gates.js +153 -0
- package/dist/src/conductor/gates.js.map +1 -0
- package/dist/src/conductor/intake.d.ts +104 -0
- package/dist/src/conductor/intake.d.ts.map +1 -0
- package/dist/src/conductor/intake.js +263 -0
- package/dist/src/conductor/intake.js.map +1 -0
- package/dist/src/conductor/jira.d.ts +36 -0
- package/dist/src/conductor/jira.d.ts.map +1 -0
- package/dist/src/conductor/jira.js +72 -0
- package/dist/src/conductor/jira.js.map +1 -0
- package/dist/src/conductor/launcher.d.ts +196 -0
- package/dist/src/conductor/launcher.d.ts.map +1 -0
- package/dist/src/conductor/launcher.js +532 -0
- package/dist/src/conductor/launcher.js.map +1 -0
- package/dist/src/conductor/metrics.d.ts +81 -0
- package/dist/src/conductor/metrics.d.ts.map +1 -0
- package/dist/src/conductor/metrics.js +303 -0
- package/dist/src/conductor/metrics.js.map +1 -0
- package/dist/src/conductor/parent-worktree.d.ts +22 -0
- package/dist/src/conductor/parent-worktree.d.ts.map +1 -0
- package/dist/src/conductor/parent-worktree.js +113 -0
- package/dist/src/conductor/parent-worktree.js.map +1 -0
- package/dist/src/conductor/pr-ref.d.ts +5 -0
- package/dist/src/conductor/pr-ref.d.ts.map +1 -0
- package/dist/src/conductor/pr-ref.js +17 -0
- package/dist/src/conductor/pr-ref.js.map +1 -0
- package/dist/src/conductor/pr-watch.d.ts +46 -0
- package/dist/src/conductor/pr-watch.d.ts.map +1 -0
- package/dist/src/conductor/pr-watch.js +73 -0
- package/dist/src/conductor/pr-watch.js.map +1 -0
- package/dist/src/conductor/result.d.ts +24 -0
- package/dist/src/conductor/result.d.ts.map +1 -0
- package/dist/src/conductor/result.js +136 -0
- package/dist/src/conductor/result.js.map +1 -0
- package/dist/src/conductor/resume.d.ts +69 -0
- package/dist/src/conductor/resume.d.ts.map +1 -0
- package/dist/src/conductor/resume.js +187 -0
- package/dist/src/conductor/resume.js.map +1 -0
- package/dist/src/conductor/scheduler.d.ts +22 -0
- package/dist/src/conductor/scheduler.d.ts.map +1 -0
- package/dist/src/conductor/scheduler.js +13 -0
- package/dist/src/conductor/scheduler.js.map +1 -0
- package/dist/src/conductor/slack.d.ts +54 -0
- package/dist/src/conductor/slack.d.ts.map +1 -0
- package/dist/src/conductor/slack.js +105 -0
- package/dist/src/conductor/slack.js.map +1 -0
- package/dist/src/conductor/store.d.ts +68 -0
- package/dist/src/conductor/store.d.ts.map +1 -0
- package/dist/src/conductor/store.js +319 -0
- package/dist/src/conductor/store.js.map +1 -0
- package/dist/src/conductor/types.d.ts +254 -0
- package/dist/src/conductor/types.d.ts.map +1 -0
- package/dist/src/conductor/types.js +94 -0
- package/dist/src/conductor/types.js.map +1 -0
- package/dist/src/core/config.d.ts +66 -0
- package/dist/src/core/config.d.ts.map +1 -1
- package/dist/src/core/config.js +95 -3
- package/dist/src/core/config.js.map +1 -1
- package/dist/src/core/constants.d.ts +5 -0
- package/dist/src/core/constants.d.ts.map +1 -1
- package/dist/src/core/constants.js +5 -0
- package/dist/src/core/constants.js.map +1 -1
- package/dist/src/digest/lens-schema.d.ts +6 -6
- package/dist/src/digest/schema.d.ts +23 -23
- package/dist/src/lens/attach.d.ts +16 -16
- package/dist/src/mcp/tools/architecture-passthrough.d.ts.map +1 -1
- package/dist/src/mcp/tools/architecture-passthrough.js +19 -3
- package/dist/src/mcp/tools/architecture-passthrough.js.map +1 -1
- package/dist/src/research/schema.d.ts +30 -30
- package/dist/src/research/source-create.d.ts +2 -2
- package/dist/src/research/source-schema.d.ts +4 -4
- package/package.json +2 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.mcp.json +1 -1
- package/plugin/mcp.json +1 -1
- package/plugin/skills/_shared/proactive-routing.md +1 -0
- package/plugin/skills/architecture/SKILL.md +168 -140
- package/plugin/skills/conductor/SKILL.md +180 -0
- package/plugin/skills/handoff/SKILL.md +1 -1
- package/schemas/architecture-ir.schema.json +40 -4
- package/schemas/gestalt.schema.json +64 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/conductor/metrics.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,kDAAkD;AAClD,eAAO,MAAM,aAAa,uBAAuB,CAAC;AAElD,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAmBrC,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,EAAE,CAYrD;AAOD,uCAAuC;AACvC,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAWhD;AAMD,uCAAuC;AACvC,wB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M,MAAM,QAAQ,GAAG,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAE9E;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAyBxE;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,aAAa,CA0ChB"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* 끼어든 발화와 토큰 지표.
|
|
5
|
+
*
|
|
6
|
+
* 셈법은 세션 분석과 같다. 대상은 transcript(`*.jsonl`) 중 기간 안에 바뀐 것이고
|
|
7
|
+
* `subagents/` 아래는 뺀다. 스킬을 부른 세션만 센다. 스킬 호출 뒤 사람 발화 N개(기본 8)
|
|
8
|
+
* 안에 든 발화를 끼어든 발화로 센다. 도구 결과와 메타 메시지, 압축 요약, 작업 알림,
|
|
9
|
+
* 워커 알림은 사람 발화가 아니라서 뺀다. 토큰은 assistant usage의 input, output,
|
|
10
|
+
* cache_creation, cache_read를 더하고 같은 message.id는 한 번만 센다.
|
|
11
|
+
*/
|
|
12
|
+
export const DEFAULT_WINDOW = 8;
|
|
13
|
+
export const BASELINE_DAYS = 45;
|
|
14
|
+
export const INTERVENTION_REDUCTION_GOAL = 0.4;
|
|
15
|
+
export const TOKEN_INCREASE_TARGET = 0.1;
|
|
16
|
+
/** 재개 프롬프트 첫 줄에 붙는 표시. 지표가 워커 재시작 세션을 이걸로 가려낸다 */
|
|
17
|
+
export const RESUME_MARKER = '[conductor-resume]';
|
|
18
|
+
const NON_HUMAN_PATTERNS = [
|
|
19
|
+
/^<task-notification>/,
|
|
20
|
+
/^<local-command/,
|
|
21
|
+
/^<command-(?:message|args|stdout)>/,
|
|
22
|
+
/You have \d+ (?:new )?orchestration messages?/,
|
|
23
|
+
/^─+ From: /m,
|
|
24
|
+
/^This session is being continued from a previous conversation/,
|
|
25
|
+
/^\[Request interrupted by user/,
|
|
26
|
+
];
|
|
27
|
+
/** 디스패치된 워커 세션의 첫 발화. 사람이 직접 대화한 세션이 아니라 기준에서 뺀다 */
|
|
28
|
+
const WORKER_SESSION_PATTERNS = [
|
|
29
|
+
/orca orchestration (?:send|ask)/,
|
|
30
|
+
/worker_done/,
|
|
31
|
+
/GESTALT_CONDUCTOR_WORKER_ID/,
|
|
32
|
+
];
|
|
33
|
+
export function parseTranscript(text) {
|
|
34
|
+
const out = [];
|
|
35
|
+
for (const line of text.split('\n')) {
|
|
36
|
+
if (!line.trim())
|
|
37
|
+
continue;
|
|
38
|
+
try {
|
|
39
|
+
const v = JSON.parse(line);
|
|
40
|
+
if (v && typeof v === 'object' && !Array.isArray(v))
|
|
41
|
+
out.push(v);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// 쓰다 끊긴 줄은 건너뛴다
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
function message(e) {
|
|
50
|
+
const m = e['message'];
|
|
51
|
+
return m && typeof m === 'object' ? m : undefined;
|
|
52
|
+
}
|
|
53
|
+
/** 사용자 항목의 글. 도구 결과나 메타 메시지면 null이다 */
|
|
54
|
+
export function userText(e) {
|
|
55
|
+
if (e['type'] !== 'user' || e['isMeta'] === true || e['isCompactSummary'] === true)
|
|
56
|
+
return null;
|
|
57
|
+
const content = message(e)?.['content'];
|
|
58
|
+
if (typeof content === 'string')
|
|
59
|
+
return content;
|
|
60
|
+
if (!Array.isArray(content))
|
|
61
|
+
return null;
|
|
62
|
+
const parts = [];
|
|
63
|
+
for (const block of content) {
|
|
64
|
+
if (block?.['type'] === 'tool_result')
|
|
65
|
+
return null;
|
|
66
|
+
if (block?.['type'] === 'text' && typeof block['text'] === 'string')
|
|
67
|
+
parts.push(block['text']);
|
|
68
|
+
}
|
|
69
|
+
return parts.length > 0 ? parts.join('\n') : null;
|
|
70
|
+
}
|
|
71
|
+
function isSlashCommand(text) {
|
|
72
|
+
return /<command-name>/.test(text) || /^\/[a-z][\w:-]*(?:\s|$)/.test(text.trimStart());
|
|
73
|
+
}
|
|
74
|
+
/** 사람이 친 발화인지. 슬래시 명령은 스킬 호출로 따로 센다 */
|
|
75
|
+
export function isHumanUtterance(text) {
|
|
76
|
+
const t = text.trimStart();
|
|
77
|
+
if (!t)
|
|
78
|
+
return false;
|
|
79
|
+
if (isSlashCommand(t))
|
|
80
|
+
return false;
|
|
81
|
+
return !NON_HUMAN_PATTERNS.some((re) => re.test(t));
|
|
82
|
+
}
|
|
83
|
+
function toolUses(e) {
|
|
84
|
+
if (e['type'] !== 'assistant')
|
|
85
|
+
return [];
|
|
86
|
+
const content = message(e)?.['content'];
|
|
87
|
+
if (!Array.isArray(content))
|
|
88
|
+
return [];
|
|
89
|
+
return content.filter((b) => b?.['type'] === 'tool_use');
|
|
90
|
+
}
|
|
91
|
+
function isSkillCall(e, text) {
|
|
92
|
+
if (toolUses(e).some((t) => t['name'] === 'Skill'))
|
|
93
|
+
return true;
|
|
94
|
+
return text !== null && isSlashCommand(text);
|
|
95
|
+
}
|
|
96
|
+
function usageOf(e) {
|
|
97
|
+
const u = message(e)?.['usage'];
|
|
98
|
+
if (!u)
|
|
99
|
+
return 0;
|
|
100
|
+
let sum = 0;
|
|
101
|
+
for (const k of [
|
|
102
|
+
'input_tokens',
|
|
103
|
+
'output_tokens',
|
|
104
|
+
'cache_creation_input_tokens',
|
|
105
|
+
'cache_read_input_tokens',
|
|
106
|
+
]) {
|
|
107
|
+
const v = u[k];
|
|
108
|
+
if (typeof v === 'number')
|
|
109
|
+
sum += v;
|
|
110
|
+
}
|
|
111
|
+
return sum;
|
|
112
|
+
}
|
|
113
|
+
export function analyzeTranscript(entries, window = DEFAULT_WINDOW) {
|
|
114
|
+
let skillCalls = 0;
|
|
115
|
+
let humanSinceSkill = Number.POSITIVE_INFINITY;
|
|
116
|
+
let interventions = 0;
|
|
117
|
+
let tokens = 0;
|
|
118
|
+
let firstUser = null;
|
|
119
|
+
const seenIds = new Set();
|
|
120
|
+
const skills = [];
|
|
121
|
+
for (const e of entries) {
|
|
122
|
+
const text = userText(e);
|
|
123
|
+
if (firstUser === null && text !== null)
|
|
124
|
+
firstUser = text;
|
|
125
|
+
if (e['type'] === 'assistant') {
|
|
126
|
+
const id = message(e)?.['id'];
|
|
127
|
+
if (typeof id !== 'string' || !seenIds.has(id)) {
|
|
128
|
+
if (typeof id === 'string')
|
|
129
|
+
seenIds.add(id);
|
|
130
|
+
tokens += usageOf(e);
|
|
131
|
+
}
|
|
132
|
+
for (const t of toolUses(e)) {
|
|
133
|
+
const skill = t['input']?.['skill'];
|
|
134
|
+
if (t['name'] === 'Skill' && typeof skill === 'string')
|
|
135
|
+
skills.push(skill);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (text !== null) {
|
|
139
|
+
const cmd = /<command-name>\/?([^<]+)<\/command-name>/.exec(text) ??
|
|
140
|
+
/^\/([a-z][\w:-]*)(?:\s|$)/.exec(text.trimStart());
|
|
141
|
+
if (cmd)
|
|
142
|
+
skills.push(cmd[1].trim());
|
|
143
|
+
}
|
|
144
|
+
if (isSkillCall(e, text)) {
|
|
145
|
+
skillCalls += 1;
|
|
146
|
+
humanSinceSkill = 0;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (text !== null && isHumanUtterance(text) && humanSinceSkill < window) {
|
|
150
|
+
interventions += 1;
|
|
151
|
+
humanSinceSkill += 1;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const first = firstUser ?? '';
|
|
155
|
+
return {
|
|
156
|
+
skillCalls,
|
|
157
|
+
interventions,
|
|
158
|
+
tokens,
|
|
159
|
+
isWorker: WORKER_SESSION_PATTERNS.some((re) => re.test(first)),
|
|
160
|
+
isResume: first.trimStart().startsWith(RESUME_MARKER),
|
|
161
|
+
skills,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/** 기간 안에 바뀐 transcript 경로. `subagents/` 아래는 뺀다 */
|
|
165
|
+
export function collectTranscripts(root, sinceMs, untilMs = Date.now()) {
|
|
166
|
+
const out = [];
|
|
167
|
+
let entries;
|
|
168
|
+
try {
|
|
169
|
+
entries = readdirSync(root, { recursive: true, withFileTypes: true });
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
return out;
|
|
173
|
+
}
|
|
174
|
+
for (const d of entries) {
|
|
175
|
+
if (!d.isFile() || !d.name.endsWith('.jsonl'))
|
|
176
|
+
continue;
|
|
177
|
+
const path = join(d.parentPath, d.name);
|
|
178
|
+
if (path.split(/[\\/]/).includes('subagents'))
|
|
179
|
+
continue;
|
|
180
|
+
const mtime = statSync(path).mtimeMs;
|
|
181
|
+
if (mtime >= sinceMs && mtime < untilMs)
|
|
182
|
+
out.push(path);
|
|
183
|
+
}
|
|
184
|
+
return out.sort();
|
|
185
|
+
}
|
|
186
|
+
export function average(list) {
|
|
187
|
+
if (list.length === 0)
|
|
188
|
+
return { sessions: 0, interventions: 0, tokens: 0 };
|
|
189
|
+
const sum = list.reduce((a, m) => ({ i: a.i + m.interventions, t: a.t + m.tokens }), {
|
|
190
|
+
i: 0,
|
|
191
|
+
t: 0,
|
|
192
|
+
});
|
|
193
|
+
return { sessions: list.length, interventions: sum.i / list.length, tokens: sum.t / list.length };
|
|
194
|
+
}
|
|
195
|
+
/** 사람이 직접 대화한 스킬 세션. 기준을 셀 때 쓴다 */
|
|
196
|
+
export function isHumanSkillSession(m) {
|
|
197
|
+
return m.skillCalls > 0 && !m.isWorker;
|
|
198
|
+
}
|
|
199
|
+
export function compare(baseline, current) {
|
|
200
|
+
const notes = [];
|
|
201
|
+
const reduction = baseline.interventions > 0 ? 1 - current.interventions / baseline.interventions : null;
|
|
202
|
+
const delta = baseline.tokens > 0 ? current.tokens / baseline.tokens - 1 : null;
|
|
203
|
+
if (baseline.sessions === 0)
|
|
204
|
+
notes.push('기준 세션이 없어 비교할 수 없어요');
|
|
205
|
+
if (current.sessions === 0)
|
|
206
|
+
notes.push('비교할 컨덕터 세션이 없어요');
|
|
207
|
+
const interventionGoalMet = reduction !== null && reduction >= INTERVENTION_REDUCTION_GOAL;
|
|
208
|
+
const tokenTargetMet = delta !== null && delta <= TOKEN_INCREASE_TARGET;
|
|
209
|
+
if (delta !== null && !tokenTargetMet) {
|
|
210
|
+
notes.push(`토큰이 기준보다 ${(delta * 100).toFixed(1)}% 늘어 목표 +${TOKEN_INCREASE_TARGET * 100}%를 넘었어요. 끼어든 발화 목표를 먼저 지키므로 보고만 해요`);
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
baseline,
|
|
214
|
+
current,
|
|
215
|
+
interventionReduction: reduction,
|
|
216
|
+
tokenDelta: delta,
|
|
217
|
+
interventionGoalMet,
|
|
218
|
+
tokenTargetMet,
|
|
219
|
+
passed: interventionGoalMet && current.sessions > 0,
|
|
220
|
+
notes,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* 토큰이 많이 드는 네 자리를 따로 센다.
|
|
225
|
+
*
|
|
226
|
+
* 재개 세션은 통째로 restart다. 나머지는 assistant 메시지마다 그 메시지가 부른 명령으로
|
|
227
|
+
* 가른다. 상태를 들여다보는 tick과 status는 polling, 워커 결과를 받는 report와 gate
|
|
228
|
+
* 목록은 results, 그 밖은 컨덕터 컨텍스트가 쌓인 몫이다.
|
|
229
|
+
*/
|
|
230
|
+
export function leakBreakdown(entries) {
|
|
231
|
+
const out = { conductorContext: 0, polling: 0, results: 0, restart: 0 };
|
|
232
|
+
const session = analyzeTranscript(entries);
|
|
233
|
+
const seen = new Set();
|
|
234
|
+
for (const e of entries) {
|
|
235
|
+
if (e['type'] !== 'assistant')
|
|
236
|
+
continue;
|
|
237
|
+
const id = message(e)?.['id'];
|
|
238
|
+
if (typeof id === 'string') {
|
|
239
|
+
if (seen.has(id))
|
|
240
|
+
continue;
|
|
241
|
+
seen.add(id);
|
|
242
|
+
}
|
|
243
|
+
const n = usageOf(e);
|
|
244
|
+
if (session.isResume) {
|
|
245
|
+
out.restart += n;
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
const commands = toolUses(e)
|
|
249
|
+
.map((t) => t['input']?.['command'])
|
|
250
|
+
.filter((c) => typeof c === 'string');
|
|
251
|
+
if (commands.some((c) => /\bconductor\s+(?:tick|status)\b/.test(c)))
|
|
252
|
+
out.polling += n;
|
|
253
|
+
else if (commands.some((c) => /\bconductor\s+(?:worker\s+report|gate\s+list)\b/.test(c)))
|
|
254
|
+
out.results += n;
|
|
255
|
+
else
|
|
256
|
+
out.conductorContext += n;
|
|
257
|
+
}
|
|
258
|
+
return out;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* `since` 이전 45일의 사람 직접 세션을 기준으로, `since` 이후 conductor 스킬을 쓴 세션을 잰다.
|
|
262
|
+
* 컨덕터가 띄운 워커 세션은 컨덕터 세션 토큰에 더한다. 워커가 쓴 토큰도 컨덕터가 쓴 몫이라서다.
|
|
263
|
+
*/
|
|
264
|
+
export function measure(opts) {
|
|
265
|
+
const now = opts.now ?? Date.now();
|
|
266
|
+
const window = opts.window ?? DEFAULT_WINDOW;
|
|
267
|
+
const conductorSkill = opts.conductorSkill ?? 'conductor';
|
|
268
|
+
const dayMs = 24 * 60 * 60 * 1000;
|
|
269
|
+
const read = (p) => parseTranscript(readFileSync(p, 'utf-8'));
|
|
270
|
+
const baselineSessions = collectTranscripts(opts.root, opts.since - BASELINE_DAYS * dayMs, opts.since)
|
|
271
|
+
.map((p) => analyzeTranscript(read(p), window))
|
|
272
|
+
.filter(isHumanSkillSession);
|
|
273
|
+
const leaks = {
|
|
274
|
+
conductorContext: 0,
|
|
275
|
+
polling: 0,
|
|
276
|
+
results: 0,
|
|
277
|
+
restart: 0,
|
|
278
|
+
};
|
|
279
|
+
const conductorSessions = [];
|
|
280
|
+
let workerTokens = 0;
|
|
281
|
+
for (const p of collectTranscripts(opts.root, opts.since, now)) {
|
|
282
|
+
const entries = read(p);
|
|
283
|
+
const m = analyzeTranscript(entries, window);
|
|
284
|
+
if (m.isWorker) {
|
|
285
|
+
workerTokens += m.tokens;
|
|
286
|
+
const l = leakBreakdown(entries);
|
|
287
|
+
leaks.restart += l.restart;
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
if (!m.skills.some((s) => s === conductorSkill || s.endsWith(`:${conductorSkill}`)))
|
|
291
|
+
continue;
|
|
292
|
+
conductorSessions.push(m);
|
|
293
|
+
const l = leakBreakdown(entries);
|
|
294
|
+
leaks.conductorContext += l.conductorContext;
|
|
295
|
+
leaks.polling += l.polling;
|
|
296
|
+
leaks.results += l.results;
|
|
297
|
+
}
|
|
298
|
+
const current = average(conductorSessions);
|
|
299
|
+
if (conductorSessions.length > 0)
|
|
300
|
+
current.tokens += workerTokens / conductorSessions.length;
|
|
301
|
+
return { comparison: compare(average(baselineSessions), current), leaks };
|
|
302
|
+
}
|
|
303
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/conductor/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;;GAQG;AAEH,M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,CAAC,MAAM,CAAC;IAC5F,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** 동기 명령 실행기. 테스트가 바꿔 끼운다. 실패하면 던진다 */
|
|
2
|
+
export type SyncExec = (cmd: string, args: string[]) => string;
|
|
3
|
+
export interface ResolveParentOptions {
|
|
4
|
+
/** `owner/name` → 로컬 체크아웃 경로. 있으면 git 공용 디렉토리로 레포를 맞춘다 */
|
|
5
|
+
repoPaths: Record<string, string>;
|
|
6
|
+
/** 오르카 선택자를 풀 때 쓴다. 없으면 선택자는 거절하고 경로만 받는다 */
|
|
7
|
+
orcaCommand?: string;
|
|
8
|
+
cwd?: string;
|
|
9
|
+
exec?: SyncExec;
|
|
10
|
+
}
|
|
11
|
+
export declare function resolveParentWorktree(input: string, repo: string, opts: ResolveParentOptions): string;
|
|
12
|
+
/**
|
|
13
|
+
* `git@github.com:owner/name.git`, `https://github.com/owner/name` 같은 주소가 그 레포인지 본다.
|
|
14
|
+
* 호스트는 안 본다. SSH 별칭(`git@github-work:owner/name.git`)도 같은 레포로 받으려는 것이고
|
|
15
|
+
* 호스트가 다른 동명 레포를 가려야 하면 repoPaths로 git 공용 디렉토리를 맞춘다
|
|
16
|
+
*/
|
|
17
|
+
export declare function remoteMatches(url: string, repo: string): boolean;
|
|
18
|
+
/** 오르카 `worktree show`나 `worktree create`의 `--json` 응답에서 워크트리 칸 하나를 꺼낸다 */
|
|
19
|
+
export declare function worktreeField(stdout: string, field: 'path' | 'id' | 'repoId'): string | undefined;
|
|
20
|
+
/** 심링크를 푼 절대 경로. 경로가 없으면 resolve만 한다 */
|
|
21
|
+
export declare function real(path: string): string;
|
|
22
|
+
//# sourceMappingURL=parent-worktree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parent-worktree.d.ts","sourceRoot":"","sources":["../../../src/conductor/parent-worktree.ts"],"names":[],"mappings":"AAOA,uCAAuC;AACvC,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC;AA4B/D,MAAM,WAAW,oBAAoB;IACnC,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,oBAAoB,GACzB,MAAM,CA8BR;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAGhE;AAsBD,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAWjG;AAWD,wCAAwC;AACxC,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMzC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { existsSync, realpathSync, statSync } from 'node:fs';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
const EXEC_TIMEOUT_MS = 10_000;
|
|
5
|
+
class ExecTimeoutError extends Error {
|
|
6
|
+
}
|
|
7
|
+
const defaultExec = (cmd, args) => {
|
|
8
|
+
try {
|
|
9
|
+
return execFileSync(cmd, args, {
|
|
10
|
+
encoding: 'utf8',
|
|
11
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
12
|
+
timeout: EXEC_TIMEOUT_MS,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
if (err.code === 'ETIMEDOUT')
|
|
17
|
+
throw new ExecTimeoutError(`${cmd} ${args.join(' ')}가 ${EXEC_TIMEOUT_MS / 1000}초 안에 안 끝났어요`, {
|
|
18
|
+
cause: err,
|
|
19
|
+
});
|
|
20
|
+
throw err;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
/** `path:`를 뺀 오르카 선택자 접두어. 이걸로 시작하면 오르카에 경로를 묻는다 */
|
|
24
|
+
const ORCA_SELECTOR_RE = /^(identity|id|name|branch|issue|worktree|folder):./;
|
|
25
|
+
export function resolveParentWorktree(input, repo, opts) {
|
|
26
|
+
const exec = opts.exec ?? defaultExec;
|
|
27
|
+
const raw = input.trim();
|
|
28
|
+
if (!raw)
|
|
29
|
+
throw new Error('부모 워크트리가 비었어요');
|
|
30
|
+
const path = ORCA_SELECTOR_RE.test(raw)
|
|
31
|
+
? orcaPath(raw, opts.orcaCommand, exec)
|
|
32
|
+
: resolve(opts.cwd ?? process.cwd(), raw.startsWith('path:') ? raw.slice(5) : raw);
|
|
33
|
+
if (!existsSync(path) || !statSync(path).isDirectory())
|
|
34
|
+
throw new Error(`부모 워크트리 경로가 없어요: ${path}`);
|
|
35
|
+
const top = git(exec, path, ['rev-parse', '--show-toplevel']);
|
|
36
|
+
if (!top)
|
|
37
|
+
throw new Error(`부모 워크트리가 git 워크트리가 아니에요: ${path}`);
|
|
38
|
+
const root = real(top);
|
|
39
|
+
const expected = opts.repoPaths[repo];
|
|
40
|
+
if (expected) {
|
|
41
|
+
const want = git(exec, expected, ['rev-parse', '--path-format=absolute', '--git-common-dir']);
|
|
42
|
+
const got = git(exec, root, ['rev-parse', '--path-format=absolute', '--git-common-dir']);
|
|
43
|
+
if (!want || !got || real(want) !== real(got))
|
|
44
|
+
throw new Error(`부모 워크트리 ${root}가 ${repo}(${expected})의 워크트리가 아니에요`);
|
|
45
|
+
return root;
|
|
46
|
+
}
|
|
47
|
+
const origin = git(exec, root, ['remote', 'get-url', 'origin']);
|
|
48
|
+
if (!origin || !remoteMatches(origin, repo))
|
|
49
|
+
throw new Error(`부모 워크트리 ${root}의 origin(${origin ?? '없음'})이 ${repo}와 달라요. 맞는 워크트리를 주거나 repoPaths에 ${repo} 경로를 적어 주세요`);
|
|
50
|
+
return root;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* `git@github.com:owner/name.git`, `https://github.com/owner/name` 같은 주소가 그 레포인지 본다.
|
|
54
|
+
* 호스트는 안 본다. SSH 별칭(`git@github-work:owner/name.git`)도 같은 레포로 받으려는 것이고
|
|
55
|
+
* 호스트가 다른 동명 레포를 가려야 하면 repoPaths로 git 공용 디렉토리를 맞춘다
|
|
56
|
+
*/
|
|
57
|
+
export function remoteMatches(url, repo) {
|
|
58
|
+
const m = /[:/]([\w.-]+\/[\w.-]+?)(?:\.git)?\/?$/.exec(url.trim());
|
|
59
|
+
return m !== null && m[1].toLowerCase() === repo.toLowerCase();
|
|
60
|
+
}
|
|
61
|
+
function orcaPath(selector, orcaCommand, exec) {
|
|
62
|
+
if (!orcaCommand)
|
|
63
|
+
throw new Error(`오르카가 없어 선택자 ${selector}를 못 풀어요. 부모 워크트리 경로로 주세요`);
|
|
64
|
+
let out;
|
|
65
|
+
try {
|
|
66
|
+
out = exec(orcaCommand, ['worktree', 'show', '--worktree', selector, '--json']);
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
const why = err instanceof ExecTimeoutError ? err.message : '';
|
|
70
|
+
throw new Error(why
|
|
71
|
+
? `오르카에서 부모 워크트리 ${selector}를 확인하지 못했어요: ${why}`
|
|
72
|
+
: `오르카에서 부모 워크트리 ${selector}를 못 찾았어요`, { cause: err });
|
|
73
|
+
}
|
|
74
|
+
const path = worktreeField(out, 'path');
|
|
75
|
+
if (!path)
|
|
76
|
+
throw new Error(`오르카 응답에 부모 워크트리 ${selector}의 경로가 없어요`);
|
|
77
|
+
return path;
|
|
78
|
+
}
|
|
79
|
+
/** 오르카 `worktree show`나 `worktree create`의 `--json` 응답에서 워크트리 칸 하나를 꺼낸다 */
|
|
80
|
+
export function worktreeField(stdout, field) {
|
|
81
|
+
let data;
|
|
82
|
+
try {
|
|
83
|
+
data = JSON.parse(stdout);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
const d = data;
|
|
89
|
+
if (d.ok === false)
|
|
90
|
+
return undefined;
|
|
91
|
+
const v = d.result?.worktree?.[field];
|
|
92
|
+
return typeof v === 'string' && v ? v : undefined;
|
|
93
|
+
}
|
|
94
|
+
function git(exec, cwd, args) {
|
|
95
|
+
try {
|
|
96
|
+
return exec('git', ['-C', cwd, ...args]).trim() || undefined;
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
if (err instanceof ExecTimeoutError)
|
|
100
|
+
throw err;
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/** 심링크를 푼 절대 경로. 경로가 없으면 resolve만 한다 */
|
|
105
|
+
export function real(path) {
|
|
106
|
+
try {
|
|
107
|
+
return realpathSync(path);
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return resolve(path);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=parent-worktree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parent-worktree.js","sourceRoot":"","sources":["../../../src/conductor/parent-worktree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B,MAAM,gBAAiB,S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,EAAE,KAA+B;IAC3E,IAAI,IAAa,CAAC;IAClB,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,CAAC,GAAG,IAAyE,CAAC;IACpF,IAAI,CAAC,CAAC,EAAE,KAAK,KAAK;QAAE,OAAO,SAAS,CAAC;IACrC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC;IACtC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,CAAC;AAED,SAAS,GAAG,CAAC,IAAc,EAAE,GAAW,EAAE,IAAc;IACtD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;IAC/D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,gBAAgB;YAAE,MAAM,GAAG,CAAC;QAC/C,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,wCAAwC;AACxC,MAAM,UAAU,IAAI,CAAC,IAAY;IAC/B,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** `owner/name#번호`나 GitHub PR URL을 `owner/name#번호`로 바꾼다. 둘 다 아니면 null */
|
|
2
|
+
export declare function normalizePrRef(input: string): string | null;
|
|
3
|
+
/** 정규화된 prRef에서 `owner/name`을 뽑는다 */
|
|
4
|
+
export declare function repoOfPrRef(prRef: string): string | null;
|
|
5
|
+
//# sourceMappingURL=pr-ref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-ref.d.ts","sourceRoot":"","sources":["../../../src/conductor/pr-ref.ts"],"names":[],"mappings":"AAKA,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK3D;AAED,qCAAqC;AACrC,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGxD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// PR 감시의 중복 방지가 prRef 문자열 일치에 기대므로 저장 전에 한 꼴로 맞춘다
|
|
2
|
+
const SHORT = /^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)#(\d+)$/;
|
|
3
|
+
const URL_FORM = /^https?:\/\/github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\/pull\/(\d+)\/?(?:[?#].*)?$/;
|
|
4
|
+
/** `owner/name#번호`나 GitHub PR URL을 `owner/name#번호`로 바꾼다. 둘 다 아니면 null */
|
|
5
|
+
export function normalizePrRef(input) {
|
|
6
|
+
const s = input.trim();
|
|
7
|
+
const m = SHORT.exec(s) ?? URL_FORM.exec(s);
|
|
8
|
+
if (!m)
|
|
9
|
+
return null;
|
|
10
|
+
return `${m[1]}/${m[2]}#${Number(m[3])}`;
|
|
11
|
+
}
|
|
12
|
+
/** 정규화된 prRef에서 `owner/name`을 뽑는다 */
|
|
13
|
+
export function repoOfPrRef(prRef) {
|
|
14
|
+
const n = normalizePrRef(prRef);
|
|
15
|
+
return n ? n.slice(0, n.indexOf('#')) : null;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=pr-ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-ref.js","sourceRoot":"","sources":["../../../src/conductor/pr-ref.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,MAAM,KAAK,GAAG,8CAA8C,CAAC;AAC7D,MAAM,QAAQ,GACZ,2FAA2F,CAAC;AAE9F,yEAAyE;AACzE,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IACvB,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5C,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,OAAO,GAAG,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC,CAAC,CAAC,CAAE,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,EAAE,CAAC;AAC9C,CAAC;AAED,qCAAqC;AACrC,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,MAAM,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ConductorStore } from './store.js';
|
|
2
|
+
import { type Gate, type Order, type OrderScope } from './types.js';
|
|
3
|
+
/** 감시하는 PR 하나의 요약. 코멘트 본문은 싣지 않는다 */
|
|
4
|
+
export interface WatchedPr {
|
|
5
|
+
/** `owner/name#번호` */
|
|
6
|
+
ref: string;
|
|
7
|
+
repo: string;
|
|
8
|
+
title: string;
|
|
9
|
+
headSha: string;
|
|
10
|
+
/** 내가 아닌 사람이 단 코멘트 중 가장 최근 것의 id. 없으면 비운다 */
|
|
11
|
+
latestOtherCommentId?: string;
|
|
12
|
+
/** 내 마지막 리뷰가 본 head. 내가 리뷰한 PR에서만 채운다 */
|
|
13
|
+
reviewedHeadSha?: string;
|
|
14
|
+
/** 내 마지막 리뷰 뒤로 작성자가 답한 스레드 수. 내가 리뷰한 PR에서만 채운다 */
|
|
15
|
+
repliesSinceReview?: number;
|
|
16
|
+
/** 대응해야 하는데 아직 답이 없는 스레드 수. 처리 뒤에 몇 개가 남았는지 보고할 때 쓴다 */
|
|
17
|
+
unansweredThreads?: number;
|
|
18
|
+
}
|
|
19
|
+
/** 원격 PR을 읽는 어댑터. 쓰기는 워커가 스킬로 하고 여기서는 읽기만 한다 */
|
|
20
|
+
export interface PrWatchSource {
|
|
21
|
+
/** 내가 올린 열린 PR */
|
|
22
|
+
authored(): Promise<WatchedPr[]>;
|
|
23
|
+
/** 내가 리뷰를 맡은 열린 PR */
|
|
24
|
+
reviewing(): Promise<WatchedPr[]>;
|
|
25
|
+
}
|
|
26
|
+
export interface PrWatchResult {
|
|
27
|
+
created: Order[];
|
|
28
|
+
gated: Gate[];
|
|
29
|
+
/** 이번에 본 PR 전체에서 답이 없는 대응 대상 스레드 수 */
|
|
30
|
+
unansweredThreads: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 내가 올린 PR과 내가 리뷰한 PR을 보고 주문이나 게이트를 만든다.
|
|
34
|
+
*
|
|
35
|
+
* - 내 PR에 새 코멘트가 오면 review-reply 주문을 만든다.
|
|
36
|
+
* - 내가 리뷰한 PR의 head가 바뀌면 review-loop 주문을 만든다.
|
|
37
|
+
* - 답만 오고 코드가 그대로면 review-loop의 REPLIES_ONLY 규칙대로 사람에게 올린다.
|
|
38
|
+
*
|
|
39
|
+
* 같은 PR에 끝나지 않은 주문이 있으면 건드리지 않는다. 사람 결정을 기다리는 escalated 주문도
|
|
40
|
+
* 끝나지 않은 주문이다. 그 워커가 이미 PR을 다루고 있거나 승인 뒤 다시 다룰 거라
|
|
41
|
+
* 주문을 하나 더 만들면 두 워커가 같은 스레드에 답하게 된다.
|
|
42
|
+
*/
|
|
43
|
+
export declare function pollPrs(store: ConductorStore, source: PrWatchSource, config: {
|
|
44
|
+
defaultScope: OrderScope;
|
|
45
|
+
}): Promise<PrWatchResult>;
|
|
46
|
+
//# sourceMappingURL=pr-watch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-watch.d.ts","sourceRoot":"","sources":["../../../src/conductor/pr-watch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAA2B,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7F,qCAAqC;AACrC,MAAM,WAAW,SAAS;IACxB,sBAAsB;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,yCAAyC;IACzC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kDAAkD;IAClD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,wDAAwD;IACxD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,gDAAgD;AAChD,MAAM,WAAW,aAAa;IAC5B,kBAAkB;IAClB,QAAQ,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IACjC,sBAAsB;IACtB,SAAS,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,KAAK,EAAE,CAAC;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,sCAAsC;IACtC,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAC3B,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE;IAAE,YAAY,EAAE,UAAU,CAAA;CAAE,GACnC,OAAO,CAAC,aAAa,CAAC,CAoExB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { openOrReuse } from './gates.js';
|
|
2
|
+
import { intakeOrder } from './intake.js';
|
|
3
|
+
import { TERMINAL_ORDER_STATUSES } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* 내가 올린 PR과 내가 리뷰한 PR을 보고 주문이나 게이트를 만든다.
|
|
6
|
+
*
|
|
7
|
+
* - 내 PR에 새 코멘트가 오면 review-reply 주문을 만든다.
|
|
8
|
+
* - 내가 리뷰한 PR의 head가 바뀌면 review-loop 주문을 만든다.
|
|
9
|
+
* - 답만 오고 코드가 그대로면 review-loop의 REPLIES_ONLY 규칙대로 사람에게 올린다.
|
|
10
|
+
*
|
|
11
|
+
* 같은 PR에 끝나지 않은 주문이 있으면 건드리지 않는다. 사람 결정을 기다리는 escalated 주문도
|
|
12
|
+
* 끝나지 않은 주문이다. 그 워커가 이미 PR을 다루고 있거나 승인 뒤 다시 다룰 거라
|
|
13
|
+
* 주문을 하나 더 만들면 두 워커가 같은 스레드에 답하게 된다.
|
|
14
|
+
*/
|
|
15
|
+
export async function pollPrs(store, source, config) {
|
|
16
|
+
const result = { created: [], gated: [], unansweredThreads: 0 };
|
|
17
|
+
const busy = new Set(store
|
|
18
|
+
.orders()
|
|
19
|
+
.filter((o) => o.prRef && !TERMINAL_ORDER_STATUSES.has(o.status))
|
|
20
|
+
.map((o) => o.prRef));
|
|
21
|
+
const authored = await source.authored();
|
|
22
|
+
const reviewing = await source.reviewing();
|
|
23
|
+
for (const pr of [...authored, ...reviewing])
|
|
24
|
+
result.unansweredThreads += pr.unansweredThreads ?? 0;
|
|
25
|
+
for (const pr of authored) {
|
|
26
|
+
if (!pr.latestOtherCommentId || busy.has(pr.ref))
|
|
27
|
+
continue;
|
|
28
|
+
const out = intakeOrder(store, {
|
|
29
|
+
source: 'pr-watch',
|
|
30
|
+
sourceRef: `pr-watch:reply:${pr.ref}:${pr.latestOtherCommentId}`,
|
|
31
|
+
repo: pr.repo,
|
|
32
|
+
title: `리뷰 답글: ${pr.title}`,
|
|
33
|
+
prRef: pr.ref,
|
|
34
|
+
skillChain: ['review-reply'],
|
|
35
|
+
}, config);
|
|
36
|
+
if (out.created) {
|
|
37
|
+
result.created.push(out.order);
|
|
38
|
+
busy.add(pr.ref);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
for (const pr of reviewing) {
|
|
42
|
+
if (!pr.reviewedHeadSha || busy.has(pr.ref))
|
|
43
|
+
continue;
|
|
44
|
+
if (pr.headSha !== pr.reviewedHeadSha) {
|
|
45
|
+
const out = intakeOrder(store, {
|
|
46
|
+
source: 'pr-watch',
|
|
47
|
+
sourceRef: `pr-watch:review:${pr.ref}@${pr.headSha}`,
|
|
48
|
+
repo: pr.repo,
|
|
49
|
+
title: `재리뷰: ${pr.title}`,
|
|
50
|
+
prRef: pr.ref,
|
|
51
|
+
skillChain: ['review-loop'],
|
|
52
|
+
}, config);
|
|
53
|
+
if (out.created)
|
|
54
|
+
result.created.push(out.order);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if ((pr.repliesSinceReview ?? 0) > 0) {
|
|
58
|
+
const sourceRef = `pr-watch:replies:${pr.ref}@${pr.headSha}:${pr.repliesSinceReview}`;
|
|
59
|
+
const asked = Object.values(store.snapshot.gates).some((g) => g.payload?.sourceRef === sourceRef);
|
|
60
|
+
if (asked)
|
|
61
|
+
continue;
|
|
62
|
+
const { gate } = openOrReuse(store, {
|
|
63
|
+
type: 'review-manual-switch',
|
|
64
|
+
reason: `답글만 오고 코드는 그대로예요: ${pr.ref} (답 ${pr.repliesSinceReview}개)`,
|
|
65
|
+
refs: [pr.ref],
|
|
66
|
+
payload: { sourceRef, prRef: pr.ref },
|
|
67
|
+
});
|
|
68
|
+
result.gated.push(gate);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
//# s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