@renseiai/agentfactory 0.8.6 → 0.8.7
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/README.md +2 -2
- package/dist/src/governor/decision-engine.d.ts +7 -0
- package/dist/src/governor/decision-engine.d.ts.map +1 -1
- package/dist/src/governor/decision-engine.js +59 -1
- package/dist/src/governor/governor.d.ts +5 -1
- package/dist/src/governor/governor.d.ts.map +1 -1
- package/dist/src/governor/governor.js +6 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/orchestrator/activity-emitter.d.ts +3 -3
- package/dist/src/orchestrator/activity-emitter.d.ts.map +1 -1
- package/dist/src/orchestrator/activity-emitter.js +1 -1
- package/dist/src/orchestrator/detect-work-type.test.js +25 -16
- package/dist/src/orchestrator/index.d.ts +4 -0
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +1 -0
- package/dist/src/orchestrator/issue-tracker-client.d.ts +103 -0
- package/dist/src/orchestrator/issue-tracker-client.d.ts.map +1 -0
- package/dist/src/orchestrator/issue-tracker-client.js +8 -0
- package/dist/src/orchestrator/log-analyzer.d.ts +19 -4
- package/dist/src/orchestrator/log-analyzer.d.ts.map +1 -1
- package/dist/src/orchestrator/log-analyzer.js +26 -50
- package/dist/src/orchestrator/orchestrator-utils.test.js +3 -0
- package/dist/src/orchestrator/orchestrator.d.ts +4 -2
- package/dist/src/orchestrator/orchestrator.d.ts.map +1 -1
- package/dist/src/orchestrator/orchestrator.js +193 -115
- package/dist/src/orchestrator/parse-work-result.d.ts +1 -1
- package/dist/src/orchestrator/parse-work-result.d.ts.map +1 -1
- package/dist/src/orchestrator/parse-work-result.js +1 -1
- package/dist/src/orchestrator/session-logger.d.ts +1 -1
- package/dist/src/orchestrator/session-logger.d.ts.map +1 -1
- package/dist/src/orchestrator/state-recovery.d.ts +1 -1
- package/dist/src/orchestrator/state-recovery.d.ts.map +1 -1
- package/dist/src/orchestrator/state-recovery.js +1 -0
- package/dist/src/orchestrator/state-types.d.ts +1 -1
- package/dist/src/orchestrator/state-types.d.ts.map +1 -1
- package/dist/src/orchestrator/types.d.ts +22 -2
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/work-types.d.ts +50 -0
- package/dist/src/orchestrator/work-types.d.ts.map +1 -0
- package/dist/src/orchestrator/work-types.js +20 -0
- package/dist/src/templates/registry.d.ts +1 -1
- package/dist/src/templates/registry.test.js +2 -2
- package/dist/src/templates/renderer.d.ts +1 -1
- package/dist/src/templates/types.d.ts +4 -2
- package/dist/src/templates/types.d.ts.map +1 -1
- package/dist/src/templates/types.js +1 -0
- package/dist/src/templates/types.test.js +4 -3
- package/dist/src/tools/index.d.ts +0 -3
- package/dist/src/tools/index.d.ts.map +1 -1
- package/dist/src/tools/index.js +0 -2
- package/dist/src/workflow/index.d.ts +14 -0
- package/dist/src/workflow/index.d.ts.map +1 -0
- package/dist/src/workflow/index.js +10 -0
- package/dist/src/workflow/transition-engine.d.ts +44 -0
- package/dist/src/workflow/transition-engine.d.ts.map +1 -0
- package/dist/src/workflow/transition-engine.js +106 -0
- package/dist/src/workflow/transition-engine.test.d.ts +2 -0
- package/dist/src/workflow/transition-engine.test.d.ts.map +1 -0
- package/dist/src/workflow/transition-engine.test.js +313 -0
- package/dist/src/workflow/workflow-loader.d.ts +21 -0
- package/dist/src/workflow/workflow-loader.d.ts.map +1 -0
- package/dist/src/workflow/workflow-loader.js +40 -0
- package/dist/src/workflow/workflow-loader.test.d.ts +2 -0
- package/dist/src/workflow/workflow-loader.test.d.ts.map +1 -0
- package/dist/src/workflow/workflow-loader.test.js +134 -0
- package/dist/src/workflow/workflow-registry.d.ts +56 -0
- package/dist/src/workflow/workflow-registry.d.ts.map +1 -0
- package/dist/src/workflow/workflow-registry.js +107 -0
- package/dist/src/workflow/workflow-registry.test.d.ts +2 -0
- package/dist/src/workflow/workflow-registry.test.d.ts.map +1 -0
- package/dist/src/workflow/workflow-registry.test.js +201 -0
- package/dist/src/workflow/workflow-types.d.ts +269 -0
- package/dist/src/workflow/workflow-types.d.ts.map +1 -0
- package/dist/src/workflow/workflow-types.js +88 -0
- package/dist/src/workflow/workflow-types.test.d.ts +2 -0
- package/dist/src/workflow/workflow-types.test.d.ts.map +1 -0
- package/dist/src/workflow/workflow-types.test.js +440 -0
- package/package.json +3 -4
- package/dist/src/linear-cli.d.ts +0 -38
- package/dist/src/linear-cli.d.ts.map +0 -1
- package/dist/src/linear-cli.js +0 -674
- package/dist/src/tools/linear-runner.d.ts +0 -34
- package/dist/src/tools/linear-runner.d.ts.map +0 -1
- package/dist/src/tools/linear-runner.js +0 -700
- package/dist/src/tools/plugins/linear.d.ts +0 -9
- package/dist/src/tools/plugins/linear.d.ts.map +0 -1
- package/dist/src/tools/plugins/linear.js +0 -138
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Part of the [AgentFactory](https://github.com/renseiai/agentfactory) monorepo.
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install @renseiai/agentfactory @renseiai/
|
|
10
|
+
npm install @renseiai/agentfactory @renseiai/plugin-linear
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Quick Start
|
|
@@ -115,7 +115,7 @@ The governor evaluates each issue against status, active sessions, cooldowns, hu
|
|
|
115
115
|
|
|
116
116
|
| Package | Description |
|
|
117
117
|
|---------|-------------|
|
|
118
|
-
| [@renseiai/
|
|
118
|
+
| [@renseiai/plugin-linear](https://www.npmjs.com/package/@renseiai/plugin-linear) | Linear issue tracker integration |
|
|
119
119
|
| [@renseiai/agentfactory-server](https://www.npmjs.com/package/@renseiai/agentfactory-server) | Redis work queue, distributed workers |
|
|
120
120
|
| [@renseiai/agentfactory-cli](https://www.npmjs.com/package/@renseiai/agentfactory-cli) | CLI tools |
|
|
121
121
|
| [@renseiai/agentfactory-nextjs](https://www.npmjs.com/package/@renseiai/agentfactory-nextjs) | Next.js webhook server |
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* state, active sessions, cooldowns, and configuration flags.
|
|
9
9
|
*/
|
|
10
10
|
import type { GovernorAction, GovernorConfig, GovernorIssue } from './governor-types.js';
|
|
11
|
+
import type { WorkflowRegistry } from '../workflow/workflow-registry.js';
|
|
11
12
|
/**
|
|
12
13
|
* All external state the Governor gathers before asking the decision engine
|
|
13
14
|
* what to do. Callers are responsible for populating this context; the
|
|
@@ -25,6 +26,12 @@ export interface DecisionContext {
|
|
|
25
26
|
backlogCreationCompleted: boolean;
|
|
26
27
|
/** Number of completed agent sessions for this issue (for circuit breaker) */
|
|
27
28
|
completedSessionCount: number;
|
|
29
|
+
/**
|
|
30
|
+
* Optional workflow registry for declarative transition routing.
|
|
31
|
+
* When present, the transition engine is used instead of the hard-coded
|
|
32
|
+
* switch statement. Falls back to the switch statement when absent.
|
|
33
|
+
*/
|
|
34
|
+
workflowRegistry?: WorkflowRegistry;
|
|
28
35
|
}
|
|
29
36
|
/** Max agent sessions before the circuit breaker trips and the issue is held */
|
|
30
37
|
export declare const MAX_SESSION_ATTEMPTS = 3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision-engine.d.ts","sourceRoot":"","sources":["../../../src/governor/decision-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"decision-engine.d.ts","sourceRoot":"","sources":["../../../src/governor/decision-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAMxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAOxE;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,aAAa,CAAA;IACpB,MAAM,EAAE,cAAc,CAAA;IACtB,gBAAgB,EAAE,OAAO,CAAA;IACzB,MAAM,EAAE,OAAO,CAAA;IACf,gBAAgB,EAAE,OAAO,CAAA;IACzB,aAAa,EAAE,OAAO,CAAA;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,wBAAwB,EAAE,OAAO,CAAA;IACjC,8EAA8E;IAC9E,qBAAqB,EAAE,MAAM,CAAA;IAC7B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC;AAED,gFAAgF;AAChF,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAMrC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,cAAc,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;CACf;AAaD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,eAAe,GAAG,cAAc,CAsGjE"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* state, active sessions, cooldowns, and configuration flags.
|
|
9
9
|
*/
|
|
10
10
|
import { determineTopOfFunnelAction, DEFAULT_TOP_OF_FUNNEL_CONFIG, } from './top-of-funnel.js';
|
|
11
|
+
import { evaluateTransitions } from '../workflow/transition-engine.js';
|
|
11
12
|
/** Max agent sessions before the circuit breaker trips and the issue is held */
|
|
12
13
|
export const MAX_SESSION_ATTEMPTS = 3;
|
|
13
14
|
// ---------------------------------------------------------------------------
|
|
@@ -71,7 +72,35 @@ export function decideAction(ctx) {
|
|
|
71
72
|
reason: `Sub-issue ${issue.identifier} skipped — coordinator manages sub-issues via parent`,
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
|
-
// ---
|
|
75
|
+
// --- Declarative transition routing (v1.1) ---
|
|
76
|
+
// When a WorkflowRegistry is present, delegate to the transition engine
|
|
77
|
+
// for status→phase routing. This reads from the WorkflowDefinition YAML
|
|
78
|
+
// instead of the hard-coded switch statement below.
|
|
79
|
+
//
|
|
80
|
+
// Icebox is excluded: top-of-funnel heuristics (description quality, delay
|
|
81
|
+
// thresholds, label checks) are too nuanced for simple status→phase mapping
|
|
82
|
+
// and remain in the dedicated decideIcebox() path until Phase 3 conditions
|
|
83
|
+
// can express them declaratively.
|
|
84
|
+
if (ctx.workflowRegistry && issue.status !== 'Icebox') {
|
|
85
|
+
// "Started" is a no-op in the current workflow — agent is already working.
|
|
86
|
+
if (issue.status === 'Started') {
|
|
87
|
+
return { action: 'none', reason: `Issue ${issue.identifier} is in Started status (agent already working)` };
|
|
88
|
+
}
|
|
89
|
+
// Check governor enable flags before delegating to the transition engine.
|
|
90
|
+
// These are configuration guards, not workflow graph concerns.
|
|
91
|
+
const enableCheck = checkEnableFlag(issue.status, config, issue.identifier);
|
|
92
|
+
if (enableCheck)
|
|
93
|
+
return enableCheck;
|
|
94
|
+
const result = evaluateTransitions({
|
|
95
|
+
issue,
|
|
96
|
+
registry: ctx.workflowRegistry,
|
|
97
|
+
workflowStrategy: ctx.workflowStrategy,
|
|
98
|
+
isParentIssue: ctx.isParentIssue,
|
|
99
|
+
});
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
// --- Fallback: hard-coded status-specific decisions ---
|
|
103
|
+
// Used when no WorkflowRegistry is available (backward compatibility).
|
|
75
104
|
switch (issue.status) {
|
|
76
105
|
case 'Icebox':
|
|
77
106
|
return decideIcebox(ctx);
|
|
@@ -90,6 +119,35 @@ export function decideAction(ctx) {
|
|
|
90
119
|
}
|
|
91
120
|
}
|
|
92
121
|
// ---------------------------------------------------------------------------
|
|
122
|
+
// Enable-flag guard (shared between declarative and legacy paths)
|
|
123
|
+
// ---------------------------------------------------------------------------
|
|
124
|
+
/**
|
|
125
|
+
* Check whether the governor enable flag for a given status allows dispatch.
|
|
126
|
+
* Returns a DecisionResult to skip if disabled, or null to proceed.
|
|
127
|
+
*/
|
|
128
|
+
function checkEnableFlag(status, config, issueIdentifier) {
|
|
129
|
+
switch (status) {
|
|
130
|
+
case 'Backlog':
|
|
131
|
+
if (!config.enableAutoDevelopment) {
|
|
132
|
+
return { action: 'none', reason: `Auto-development is disabled for ${issueIdentifier}` };
|
|
133
|
+
}
|
|
134
|
+
break;
|
|
135
|
+
case 'Finished':
|
|
136
|
+
if (!config.enableAutoQA) {
|
|
137
|
+
return { action: 'none', reason: `Auto-QA is disabled for ${issueIdentifier}` };
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
case 'Delivered':
|
|
141
|
+
if (!config.enableAutoAcceptance) {
|
|
142
|
+
return { action: 'none', reason: `Auto-acceptance is disabled for ${issueIdentifier}` };
|
|
143
|
+
}
|
|
144
|
+
break;
|
|
145
|
+
// Rejected has no enable flag — refinement always triggers.
|
|
146
|
+
// Icebox is handled separately via top-of-funnel.
|
|
147
|
+
}
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
93
151
|
// Per-status decision helpers
|
|
94
152
|
// ---------------------------------------------------------------------------
|
|
95
153
|
/**
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { GovernorAction, GovernorConfig, GovernorIssue, ScanResult } from './governor-types.js';
|
|
12
12
|
import type { OverridePriority } from './override-parser.js';
|
|
13
|
+
import { type WorkflowRegistryConfig } from '../workflow/workflow-registry.js';
|
|
13
14
|
/**
|
|
14
15
|
* Abstract dependencies that the Governor needs to interact with
|
|
15
16
|
* external systems. Callers inject these at construction time.
|
|
@@ -53,10 +54,13 @@ export declare class WorkflowGovernor {
|
|
|
53
54
|
private readonly config;
|
|
54
55
|
private readonly deps;
|
|
55
56
|
private readonly callbacks;
|
|
57
|
+
private readonly workflowRegistry;
|
|
56
58
|
private intervalHandle;
|
|
57
59
|
private running;
|
|
58
60
|
private scanning;
|
|
59
|
-
constructor(config: Partial<GovernorConfig
|
|
61
|
+
constructor(config: Partial<GovernorConfig> & {
|
|
62
|
+
workflow?: WorkflowRegistryConfig;
|
|
63
|
+
}, deps: GovernorDependencies, callbacks?: WorkflowGovernorCallbacks);
|
|
60
64
|
/**
|
|
61
65
|
* Start the scan loop. Runs `scanOnce()` immediately, then repeats
|
|
62
66
|
* on the configured interval.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governor.d.ts","sourceRoot":"","sources":["../../../src/governor/governor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,aAAa,EACb,UAAU,EACX,MAAM,qBAAqB,CAAA;AAG5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"governor.d.ts","sourceRoot":"","sources":["../../../src/governor/governor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,aAAa,EACb,UAAU,EACX,MAAM,qBAAqB,CAAA;AAG5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAoB,KAAK,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAsChG;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,EAAE,CAAC,CAAA;IACzD,oDAAoD;IACpD,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACvD,kEAAkE;IAClE,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACvD,qDAAqD;IACrD,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACpD,mDAAmD;IACnD,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,K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AoB,EAC1B,SAAS,CAAC,EAAE,yBAAyB;IAavC;;;OAGG;IACH,KAAK,IAAI,IAAI;IAuBb;;;OAGG;IACH,IAAI,IAAI,IAAI;IAgBZ;;OAEG;IACH,SAAS,IAAI,OAAO;IAQpB;;;;;;;;;;OAUG;IACG,QAAQ,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IA4BvC;;;;;;;OAOG;YACW,WAAW;IA2GzB;;OAEG;YACW,aAAa;CAsC5B"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { DEFAULT_GOVERNOR_CONFIG } from './governor-types.js';
|
|
12
12
|
import { decideAction } from './decision-engine.js';
|
|
13
|
+
import { WorkflowRegistry } from '../workflow/workflow-registry.js';
|
|
13
14
|
// ---------------------------------------------------------------------------
|
|
14
15
|
// Logging
|
|
15
16
|
// ---------------------------------------------------------------------------
|
|
@@ -39,13 +40,16 @@ export class WorkflowGovernor {
|
|
|
39
40
|
config;
|
|
40
41
|
deps;
|
|
41
42
|
callbacks;
|
|
43
|
+
workflowRegistry;
|
|
42
44
|
intervalHandle = null;
|
|
43
45
|
running = false;
|
|
44
46
|
scanning = false;
|
|
45
47
|
constructor(config, deps, callbacks) {
|
|
46
|
-
|
|
48
|
+
const { workflow: workflowConfig, ...governorConfig } = config;
|
|
49
|
+
this.config = { ...DEFAULT_GOVERNOR_CONFIG, ...governorConfig };
|
|
47
50
|
this.deps = deps;
|
|
48
51
|
this.callbacks = callbacks ?? {};
|
|
52
|
+
this.workflowRegistry = WorkflowRegistry.create(workflowConfig);
|
|
49
53
|
}
|
|
50
54
|
// -------------------------------------------------------------------------
|
|
51
55
|
// Lifecycle
|
|
@@ -255,6 +259,7 @@ export class WorkflowGovernor {
|
|
|
255
259
|
workflowStrategy,
|
|
256
260
|
researchCompleted,
|
|
257
261
|
backlogCreationCompleted,
|
|
262
|
+
workflowRegistry: this.workflowRegistry,
|
|
258
263
|
completedSessionCount,
|
|
259
264
|
};
|
|
260
265
|
return decideAction(ctx);
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
* - result → response (persisted)
|
|
13
13
|
* - error → error (persisted)
|
|
14
14
|
*/
|
|
15
|
-
import type {
|
|
15
|
+
import type { IssueTrackerSession } from './issue-tracker-client.js';
|
|
16
16
|
/** Configuration for the activity emitter */
|
|
17
17
|
export interface ActivityEmitterConfig {
|
|
18
|
-
/**
|
|
19
|
-
session:
|
|
18
|
+
/** Issue tracker session to emit activities to */
|
|
19
|
+
session: IssueTrackerSession;
|
|
20
20
|
/** Minimum interval between activities in ms (default: 500ms) */
|
|
21
21
|
minInterval?: number;
|
|
22
22
|
/** Maximum length for tool outputs before truncation (default: 2000) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-emitter.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/activity-emitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"activity-emitter.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/activity-emitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAGpE,6CAA6C;AAC7C,MAAM,WAAW,qBAAqB;IACpC,kDAAkD;IAClD,OAAO,EAAE,mBAAmB,CAAA;IAC5B,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,wEAAwE;IACxE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3D,sDAAsD;IACtD,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9D;AAcD;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAQ;IACxC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAyC;IAC5E,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAyC;IAE9E,OAAO,CAAC,YAAY,CAAI;IACxB,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,UAAU,CAA6C;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,GAC5B,eAAe,CAEjB"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* - result → response (persisted)
|
|
13
13
|
* - error → error (persisted)
|
|
14
14
|
*/
|
|
15
|
-
import { ENVIRONMENT_ISSUE_TYPES } from '
|
|
15
|
+
import { ENVIRONMENT_ISSUE_TYPES } from './work-types.js';
|
|
16
16
|
const DEFAULT_MIN_INTERVAL = 500;
|
|
17
17
|
const DEFAULT_MAX_OUTPUT_LENGTH = 2000;
|
|
18
18
|
/**
|
|
@@ -1,50 +1,59 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
2
|
import { detectWorkType } from './orchestrator.js';
|
|
3
|
+
// Linear status mapping for tests (same as what LinearIssueTrackerClient provides)
|
|
4
|
+
const STATUS_TO_WORK_TYPE = {
|
|
5
|
+
'Icebox': 'research',
|
|
6
|
+
'Backlog': 'development',
|
|
7
|
+
'Started': 'inflight',
|
|
8
|
+
'Finished': 'qa',
|
|
9
|
+
'Delivered': 'acceptance',
|
|
10
|
+
'Rejected': 'refinement',
|
|
11
|
+
};
|
|
3
12
|
describe('detectWorkType', () => {
|
|
4
13
|
describe('leaf issues (isParent=false)', () => {
|
|
5
14
|
it('maps Backlog status to development', () => {
|
|
6
|
-
expect(detectWorkType('Backlog', false)).toBe('development');
|
|
15
|
+
expect(detectWorkType('Backlog', false, STATUS_TO_WORK_TYPE)).toBe('development');
|
|
7
16
|
});
|
|
8
17
|
it('maps Finished status to qa', () => {
|
|
9
|
-
expect(detectWorkType('Finished', false)).toBe('qa');
|
|
18
|
+
expect(detectWorkType('Finished', false, STATUS_TO_WORK_TYPE)).toBe('qa');
|
|
10
19
|
});
|
|
11
20
|
it('maps Delivered status to acceptance', () => {
|
|
12
|
-
expect(detectWorkType('Delivered', false)).toBe('acceptance');
|
|
21
|
+
expect(detectWorkType('Delivered', false, STATUS_TO_WORK_TYPE)).toBe('acceptance');
|
|
13
22
|
});
|
|
14
23
|
it('maps Rejected status to refinement', () => {
|
|
15
|
-
expect(detectWorkType('Rejected', false)).toBe('refinement');
|
|
24
|
+
expect(detectWorkType('Rejected', false, STATUS_TO_WORK_TYPE)).toBe('refinement');
|
|
16
25
|
});
|
|
17
26
|
it('maps Icebox status to research', () => {
|
|
18
|
-
expect(detectWorkType('Icebox', false)).toBe('research');
|
|
27
|
+
expect(detectWorkType('Icebox', false, STATUS_TO_WORK_TYPE)).toBe('research');
|
|
19
28
|
});
|
|
20
29
|
it('maps Started status to inflight', () => {
|
|
21
|
-
expect(detectWorkType('Started', false)).toBe('inflight');
|
|
30
|
+
expect(detectWorkType('Started', false, STATUS_TO_WORK_TYPE)).toBe('inflight');
|
|
22
31
|
});
|
|
23
32
|
it('defaults unknown status to development', () => {
|
|
24
|
-
expect(detectWorkType('SomeUnknownStatus', false)).toBe('development');
|
|
33
|
+
expect(detectWorkType('SomeUnknownStatus', false, STATUS_TO_WORK_TYPE)).toBe('development');
|
|
25
34
|
});
|
|
26
35
|
});
|
|
27
36
|
describe('parent issues (isParent=true)', () => {
|
|
28
37
|
it('upgrades Backlog/development to coordination', () => {
|
|
29
|
-
expect(detectWorkType('Backlog', true)).toBe('coordination');
|
|
38
|
+
expect(detectWorkType('Backlog', true, STATUS_TO_WORK_TYPE)).toBe('coordination');
|
|
30
39
|
});
|
|
31
40
|
it('upgrades Finished/qa to qa-coordination', () => {
|
|
32
|
-
expect(detectWorkType('Finished', true)).toBe('qa-coordination');
|
|
41
|
+
expect(detectWorkType('Finished', true, STATUS_TO_WORK_TYPE)).toBe('qa-coordination');
|
|
33
42
|
});
|
|
34
43
|
it('upgrades Delivered/acceptance to acceptance-coordination', () => {
|
|
35
|
-
expect(detectWorkType('Delivered', true)).toBe('acceptance-coordination');
|
|
44
|
+
expect(detectWorkType('Delivered', true, STATUS_TO_WORK_TYPE)).toBe('acceptance-coordination');
|
|
36
45
|
});
|
|
37
46
|
it('upgrades Rejected/refinement to refinement-coordination', () => {
|
|
38
|
-
expect(detectWorkType('Rejected', true)).toBe('refinement-coordination');
|
|
47
|
+
expect(detectWorkType('Rejected', true, STATUS_TO_WORK_TYPE)).toBe('refinement-coordination');
|
|
39
48
|
});
|
|
40
49
|
it('does not upgrade research (Icebox) — no coordination variant', () => {
|
|
41
|
-
expect(detectWorkType('Icebox', true)).toBe('research');
|
|
50
|
+
expect(detectWorkType('Icebox', true, STATUS_TO_WORK_TYPE)).toBe('research');
|
|
42
51
|
});
|
|
43
|
-
it('
|
|
44
|
-
expect(detectWorkType('Started', true)).toBe('inflight');
|
|
52
|
+
it('upgrades Started/inflight to inflight-coordination', () => {
|
|
53
|
+
expect(detectWorkType('Started', true, STATUS_TO_WORK_TYPE)).toBe('inflight-coordination');
|
|
45
54
|
});
|
|
46
55
|
it('upgrades unknown status (defaults to development → coordination)', () => {
|
|
47
|
-
expect(detectWorkType('SomeUnknownStatus', true)).toBe('coordination');
|
|
56
|
+
expect(detectWorkType('SomeUnknownStatus', true, STATUS_TO_WORK_TYPE)).toBe('coordination');
|
|
48
57
|
});
|
|
49
58
|
});
|
|
50
59
|
describe('post-refinement rework scenario (SUP-1116 bug)', () => {
|
|
@@ -54,7 +63,7 @@ describe('detectWorkType', () => {
|
|
|
54
63
|
// The orchestrator's run() previously hardcoded 'development', which loaded
|
|
55
64
|
// the wrong template and the agent asked for human input instead of
|
|
56
65
|
// autonomously dispatching sub-agents.
|
|
57
|
-
const workType = detectWorkType('Backlog', true);
|
|
66
|
+
const workType = detectWorkType('Backlog', true, STATUS_TO_WORK_TYPE);
|
|
58
67
|
expect(workType).toBe('coordination');
|
|
59
68
|
expect(workType).not.toBe('development');
|
|
60
69
|
});
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export type { AgentWorkType, WorkflowStatus, WorkTypeStatusMappings, EnvironmentIssueType } from './work-types.js';
|
|
2
|
+
export { ENVIRONMENT_ISSUE_TYPES } from './work-types.js';
|
|
3
|
+
export type { IssueTrackerClient, IssueTrackerIssue, IssueTrackerSession, SessionConfig, CommentChunk, } from './issue-tracker-client.js';
|
|
4
|
+
export type { IssueCreator } from './log-analyzer.js';
|
|
1
5
|
export type { OrchestratorConfig, OrchestratorIssue, AgentProcess, OrchestratorEvents, SpawnAgentOptions, OrchestratorResult, OrchestratorStreamConfig, StopAgentResult, ForwardPromptResult, InjectMessageResult, SpawnAgentWithResumeOptions, WorkTypeTimeoutConfig, AgentWorkResult, } from './types.js';
|
|
2
6
|
export type { ClaudeStreamEvent, ClaudeInitEvent, ClaudeSystemEvent, ClaudeAssistantEvent, ClaudeToolUseEvent, ClaudeToolResultEvent, ClaudeResultEvent, ClaudeErrorEvent, ClaudeTodoItem, ClaudeUserEvent, ClaudeEvent, ClaudeStreamHandlers, } from './stream-parser.js';
|
|
3
7
|
export type { ActivityEmitterConfig } from './activity-emitter.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,EACrB,eAAe,GAChB,MAAM,YAAY,CAAA;AAGnB,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,WAAW,EACX,oBAAoB,GACrB,MAAM,oBAAoB,CAAA;AAG3B,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAGlE,YAAY,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAG5F,YAAY,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB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AG5B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAGxD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAClH,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAGzD,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,YAAY,GACb,MAAM,2BAA2B,CAAA;AAGlC,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGrD,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,EACrB,eAAe,GAChB,MAAM,YAAY,CAAA;AAGnB,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,WAAW,EACX,oBAAoB,GACrB,MAAM,oBAAoB,CAAA;AAG3B,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAGlE,YAAY,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAG5F,YAAY,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,kBAAkB,CAAA;AAGz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AAiB,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issue Tracker Client Interface
|
|
3
|
+
*
|
|
4
|
+
* Platform-agnostic interface for issue tracker operations used by the orchestrator.
|
|
5
|
+
* Concrete implementations (e.g., LinearIssueTrackerClient) are injected at construction time,
|
|
6
|
+
* decoupling core from any specific issue tracker SDK.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Platform-agnostic issue representation.
|
|
10
|
+
* All async relations (team, labels, project) are pre-resolved.
|
|
11
|
+
*/
|
|
12
|
+
export interface IssueTrackerIssue {
|
|
13
|
+
id: string;
|
|
14
|
+
identifier: string;
|
|
15
|
+
title: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
url: string;
|
|
18
|
+
priority: number;
|
|
19
|
+
status?: string;
|
|
20
|
+
labels: string[];
|
|
21
|
+
teamName?: string;
|
|
22
|
+
projectName?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Configuration for creating an issue tracker session.
|
|
26
|
+
*/
|
|
27
|
+
export interface SessionConfig {
|
|
28
|
+
issueId: string;
|
|
29
|
+
sessionId: string;
|
|
30
|
+
autoTransition?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Platform-agnostic session for streaming agent activities to the issue tracker.
|
|
34
|
+
* Wraps provider-specific session APIs (e.g., Linear AgentSession).
|
|
35
|
+
*/
|
|
36
|
+
export interface IssueTrackerSession {
|
|
37
|
+
emitThought(content: string, ephemeral?: boolean): Promise<void>;
|
|
38
|
+
emitAction(tool: string, input: Record<string, unknown>, ephemeral?: boolean): Promise<void>;
|
|
39
|
+
emitToolResult(tool: string, output: string, ephemeral?: boolean): Promise<void>;
|
|
40
|
+
emitResponse(content: string): Promise<void>;
|
|
41
|
+
emitError(error: Error): Promise<void>;
|
|
42
|
+
reportEnvironmentIssue(title: string, description: string, options?: unknown): Promise<{
|
|
43
|
+
id: string;
|
|
44
|
+
identifier: string;
|
|
45
|
+
url: string;
|
|
46
|
+
} | null>;
|
|
47
|
+
setPullRequestUrl(url: string): Promise<void>;
|
|
48
|
+
addExternalUrl(url: {
|
|
49
|
+
url: string;
|
|
50
|
+
label: string;
|
|
51
|
+
}): Promise<void>;
|
|
52
|
+
complete(): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Comment chunk returned by buildCompletionComments.
|
|
56
|
+
*/
|
|
57
|
+
export interface CommentChunk {
|
|
58
|
+
body: string;
|
|
59
|
+
partNumber: number;
|
|
60
|
+
totalParts: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Platform-agnostic issue tracker client.
|
|
64
|
+
*
|
|
65
|
+
* The orchestrator depends on this interface instead of a concrete Linear client.
|
|
66
|
+
* Implementations are injected via `OrchestratorConfig.issueTrackerClient`.
|
|
67
|
+
*/
|
|
68
|
+
export interface IssueTrackerClient {
|
|
69
|
+
/** Fetch a single issue by ID or human-readable identifier */
|
|
70
|
+
getIssue(idOrIdentifier: string): Promise<IssueTrackerIssue>;
|
|
71
|
+
/** Check whether an issue has sub-issues (is a parent) */
|
|
72
|
+
isParentIssue(issueId: string): Promise<boolean>;
|
|
73
|
+
/** Create a comment on an issue */
|
|
74
|
+
createComment(issueId: string, body: string): Promise<{
|
|
75
|
+
id: string;
|
|
76
|
+
}>;
|
|
77
|
+
/** Update the workflow status of an issue */
|
|
78
|
+
updateIssueStatus(issueId: string, status: string): Promise<void>;
|
|
79
|
+
/** Remove the assignee from an issue */
|
|
80
|
+
unassignIssue(issueId: string): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Query issues matching the given filters.
|
|
83
|
+
* Used by the orchestrator to find backlog issues.
|
|
84
|
+
*/
|
|
85
|
+
queryIssues(options: {
|
|
86
|
+
project?: string;
|
|
87
|
+
status?: string;
|
|
88
|
+
maxResults?: number;
|
|
89
|
+
}): Promise<IssueTrackerIssue[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Get the repository URL associated with a project.
|
|
92
|
+
* Returns null if the project has no repository metadata.
|
|
93
|
+
*/
|
|
94
|
+
getProjectRepositoryUrl(projectName: string): Promise<string | null>;
|
|
95
|
+
/** Create an activity session for streaming agent progress */
|
|
96
|
+
createSession(config: SessionConfig): IssueTrackerSession;
|
|
97
|
+
/**
|
|
98
|
+
* Split a long completion message into multiple comment chunks
|
|
99
|
+
* that fit within the issue tracker's character limits.
|
|
100
|
+
*/
|
|
101
|
+
buildCompletionComments(resultMessage: string, planItems: unknown[], sessionId: string | null): CommentChunk[];
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=issue-tracker-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-tracker-client.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/issue-tracker-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAChE,UAAU,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AAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAEhD,mCAAmC;IACnC,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAErE,6CAA6C;IAC7C,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEjE,wCAAwC;IACxC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAI7C;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE;QACnB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAA;IAEhC;;;OAGG;IACH,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IAIpE,8DAA8D;IAC9D,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,mBAAmB,CAAA;IAIzD;;;OAGG;IACH,uBAAuB,CACrB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,OAAO,EAAE,EACpB,SAAS,EAAE,MAAM,GAAG,IAAI,GACvB,YAAY,EAAE,CAAA;CAClB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issue Tracker Client Interface
|
|
3
|
+
*
|
|
4
|
+
* Platform-agnostic interface for issue tracker operations used by the orchestrator.
|
|
5
|
+
* Concrete implementations (e.g., LinearIssueTrackerClient) are injected at construction time,
|
|
6
|
+
* decoupling core from any specific issue tracker SDK.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
@@ -92,6 +92,21 @@ export interface TrackedIssue {
|
|
|
92
92
|
export interface DeduplicationStore {
|
|
93
93
|
issues: Record<string, TrackedIssue>;
|
|
94
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Callback for creating issues in the issue tracker.
|
|
97
|
+
* Injected by the caller to decouple from any specific issue tracker.
|
|
98
|
+
*/
|
|
99
|
+
export interface IssueCreator {
|
|
100
|
+
createIssue(options: {
|
|
101
|
+
title: string;
|
|
102
|
+
description: string;
|
|
103
|
+
labels: string[];
|
|
104
|
+
}): Promise<{
|
|
105
|
+
id: string;
|
|
106
|
+
identifier: string;
|
|
107
|
+
} | null>;
|
|
108
|
+
createComment(issueId: string, body: string): Promise<void>;
|
|
109
|
+
}
|
|
95
110
|
/**
|
|
96
111
|
* LogAnalyzer class for analyzing session logs
|
|
97
112
|
*/
|
|
@@ -101,12 +116,12 @@ export declare class LogAnalyzer {
|
|
|
101
116
|
private readonly processedDir;
|
|
102
117
|
private readonly analysisDir;
|
|
103
118
|
private readonly deduplicationPath;
|
|
104
|
-
private
|
|
119
|
+
private issueCreator?;
|
|
105
120
|
constructor(config?: Partial<LogAnalysisConfig>);
|
|
106
121
|
/**
|
|
107
|
-
* Initialize directories and
|
|
122
|
+
* Initialize directories and optional issue creator
|
|
108
123
|
*/
|
|
109
|
-
initialize(
|
|
124
|
+
initialize(issueCreator?: IssueCreator): void;
|
|
110
125
|
/**
|
|
111
126
|
* Get list of session IDs that haven't been analyzed yet
|
|
112
127
|
*/
|
|
@@ -156,5 +171,5 @@ export declare class LogAnalyzer {
|
|
|
156
171
|
/**
|
|
157
172
|
* Create and initialize a log analyzer
|
|
158
173
|
*/
|
|
159
|
-
export declare function createLogAnalyzer(config?: Partial<LogAnalysisConfig>,
|
|
174
|
+
export declare function createLogAnalyzer(config?: Partial<LogAnalysisConfig>, issueCreator?: IssueCreator): LogAnalyzer;
|
|
160
175
|
//# sourceMappingURL=log-analyzer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-analyzer.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/log-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"log-analyzer.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/log-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAE9E;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,aAAa,GACb,kBAAkB,GAClB,mBAAmB,CAAA;AAEvB;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAA;AAEpE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,sBAAsB;IACtB,IAAI,EAAE,WAAW,CAAA;IACjB,qBAAqB;IACrB,QAAQ,EAAE,eAAe,CAAA;IACzB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAA;IACnB,6BAA6B;IAC7B,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAA;IACnB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,uBAAuB;IACvB,QAAQ,EAAE,eAAe,CAAA;IACzB,wBAAwB;IACxB,QAAQ,EAAE,eAAe,EAAE,CAAA;IAC3B,4BAA4B;IAC5B,cAAc,EAAE,MAAM,CAAA;IACtB,yBAAyB;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,iCAAiC;IACjC,eAAe,EAAE,cAAc,EAAE,CAAA;IACjC,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;GAE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