@generacy-ai/generacy-plugin-claude-code 0.5.0 → 0.7.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/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/launch/claude-code-launch-plugin.d.ts +30 -2
- package/dist/launch/claude-code-launch-plugin.d.ts.map +1 -1
- package/dist/launch/claude-code-launch-plugin.js +68 -21
- package/dist/launch/claude-code-launch-plugin.js.map +1 -1
- package/dist/launch/route.d.ts +59 -0
- package/dist/launch/route.d.ts.map +1 -0
- package/dist/launch/route.js +77 -0
- package/dist/launch/route.js.map +1 -0
- package/dist/launch/types.d.ts +27 -11
- package/dist/launch/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,9 @@ export { createOutputStream, createOutputStreamFromData, collectOutputChunks, fi
|
|
|
14
14
|
export { OutputParser } from './streaming/output-parser.js';
|
|
15
15
|
export { buildClaudeCommand, buildModeCommand, DEFAULT_INVOCATION_TIMEOUT_MS, DEFAULT_MAX_TURNS, } from './invocation/types.js';
|
|
16
16
|
export { ClaudeCodeLaunchPlugin } from './launch/claude-code-launch-plugin.js';
|
|
17
|
+
export type { ClaudeCodeLaunchPluginOptions } from './launch/claude-code-launch-plugin.js';
|
|
17
18
|
export { PTY_WRAPPER } from './launch/constants.js';
|
|
18
|
-
export
|
|
19
|
+
export { resolveRoute, GatewayRouteUnavailableError, DEFAULT_GATEWAY_CONFIG_DIR, _resetGatewayProvisionCacheForTests, } from './launch/route.js';
|
|
20
|
+
export type { Route } from './launch/route.js';
|
|
21
|
+
export type { PhaseIntent, PrFeedbackIntent, MergeConflictIntent, ReviewIntent, RemediateIntent, ConversationTurnIntent, InvokeIntent, } from './launch/types.js';
|
|
19
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EAEV,OAAO,EACP,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,eAAe,EAEf,eAAe,EACf,KAAK,EACL,cAAc,EAEd,YAAY,EACZ,aAAa,EACb,gBAAgB,EAEhB,WAAW,EACX,eAAe,EACf,cAAc,EACd,YAAY,EACZ,eAAe,EAEf,eAAe,EACf,SAAS,EAET,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,SAAS,GACV,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,YAAY,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAG9E,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5D,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,6BAA6B,EAC7B,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","s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Z,4BAA4B,EAC5B,0BAA0B,EAC1B,mCAAmC,GACpC,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,YAAY,GACb,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -21,4 +21,6 @@ export { buildClaudeCommand, buildModeCommand, DEFAULT_INVOCATION_TIMEOUT_MS, DE
|
|
|
21
21
|
// Launch plugin (Phase 2 — AgentLauncher integration)
|
|
22
22
|
export { ClaudeCodeLaunchPlugin } from './launch/claude-code-launch-plugin.js';
|
|
23
23
|
export { PTY_WRAPPER } from './launch/constants.js';
|
|
24
|
+
// Launch route resolution (#1198 — gateway model routing)
|
|
25
|
+
export { resolveRoute, GatewayRouteUnavailableError, DEFAULT_GATEWAY_CONFIG_DIR, _resetGatewayProvisionCacheForTests, } from './launch/route.js';
|
|
24
26
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA+BH,cAAc;AACd,OAAO,EACL,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,qBAAqB;AACrB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAEtB,gBAAgB;AAChB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,2BAA2B;AAC3B,OAAO,EAAE,gBAAgB,EAAE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BAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B,sDAAsD;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,0DAA0D;AAC1D,OAAO,EACL,YAAY,EACZ,4BAA4B,EAC5B,0BAA0B,EAC1B,mCAAmC,GACpC,MAAM,mBAAmB,CAAC"}
|
|
@@ -2,12 +2,28 @@ import type { ClaudeCodeIntent } from './types.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Structurally compatible with orchestrator's LaunchSpec.
|
|
4
4
|
* Defined locally to avoid circular dependency between packages.
|
|
5
|
+
*
|
|
6
|
+
* `route` is additive (width subtyping keeps the plugin assignable to the
|
|
7
|
+
* orchestrator's `AgentLaunchPlugin`). It is deliberately typed as the literal
|
|
8
|
+
* `'gateway'` — the subscription route never stamps it, so it cannot be set on
|
|
9
|
+
* a subscription launch.
|
|
5
10
|
*/
|
|
6
11
|
interface LaunchSpec {
|
|
7
12
|
command: string;
|
|
8
13
|
args: string[];
|
|
9
14
|
env?: Record<string, string>;
|
|
10
15
|
stdioProfile?: string;
|
|
16
|
+
route?: 'gateway';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Options for constructing a {@link ClaudeCodeLaunchPlugin}.
|
|
20
|
+
*/
|
|
21
|
+
export interface ClaudeCodeLaunchPluginOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Override the gateway config dir. Falls back to
|
|
24
|
+
* `GENERACY_CLAUDE_GATEWAY_CONFIG_DIR`, then the built-in default.
|
|
25
|
+
*/
|
|
26
|
+
gatewayConfigDir?: string;
|
|
11
27
|
}
|
|
12
28
|
/**
|
|
13
29
|
* Structurally compatible with orchestrator's OutputParser.
|
|
@@ -31,7 +47,18 @@ interface OutputParser {
|
|
|
31
47
|
export declare class ClaudeCodeLaunchPlugin {
|
|
32
48
|
readonly pluginId = "claude-code";
|
|
33
49
|
readonly provider = "claude-code";
|
|
34
|
-
readonly supportedKinds: readonly ["phase", "pr-feedback", "
|
|
50
|
+
readonly supportedKinds: readonly ["phase", "pr-feedback", "merge-conflict", "review", "remediate", "conversation-turn", "invoke"];
|
|
51
|
+
private readonly gatewayConfigDir;
|
|
52
|
+
constructor(options?: ClaudeCodeLaunchPluginOptions);
|
|
53
|
+
/**
|
|
54
|
+
* Apply the model-derived route to a builder's base spec.
|
|
55
|
+
*
|
|
56
|
+
* Subscription route → the base spec unchanged (no `env`, no `route`), so
|
|
57
|
+
* pre-change launches stay byte-identical. Gateway route → asserts the
|
|
58
|
+
* gateway config dir is provisioned, then injects `CLAUDE_CONFIG_DIR` and
|
|
59
|
+
* stamps `route: 'gateway'`.
|
|
60
|
+
*/
|
|
61
|
+
private applyRoute;
|
|
35
62
|
/**
|
|
36
63
|
* Whether the installed CLI supports a delivery mechanism for reasoning effort.
|
|
37
64
|
*
|
|
@@ -58,8 +85,9 @@ export declare class ClaudeCodeLaunchPlugin {
|
|
|
58
85
|
createOutputParser(_intent: ClaudeCodeIntent): OutputParser;
|
|
59
86
|
private buildPhaseLaunch;
|
|
60
87
|
private buildPrFeedbackLaunch;
|
|
61
|
-
private buildValidateFixLaunch;
|
|
62
88
|
private buildMergeConflictLaunch;
|
|
89
|
+
private buildReviewLaunch;
|
|
90
|
+
private buildRemediateLaunch;
|
|
63
91
|
private buildInvokeLaunch;
|
|
64
92
|
private buildConversationTurnLaunch;
|
|
65
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code-launch-plugin.d.ts","sourceRoot":"","sources":["../../src/launch/claude-code-launch-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,
|
|
1
|
+
{"version":3,"file":"claude-code-launch-plugin.d.ts","sourceRoot":"","sources":["../../src/launch/claude-code-launch-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAQjB,MAAM,YAAY,CAAC;AAIpB;;;;;;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C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { execFileSync } from 'node:child_process';
|
|
2
2
|
import { PHASE_TO_COMMAND, PTY_WRAPPER } from './constants.js';
|
|
3
|
+
import { resolveRoute, resolveGatewayConfigDir, assertGatewayProvisioned } from './route.js';
|
|
3
4
|
/**
|
|
4
5
|
* Process-lifetime cache for the `--effort` capability probe. `undefined`
|
|
5
6
|
* means the probe has not yet run; `true`/`false` is the resolved answer.
|
|
@@ -21,7 +22,25 @@ let effortMechanismCache = undefined;
|
|
|
21
22
|
export class ClaudeCodeLaunchPlugin {
|
|
22
23
|
pluginId = 'claude-code';
|
|
23
24
|
provider = 'claude-code';
|
|
24
|
-
supportedKinds = ['phase', 'pr-feedback', '
|
|
25
|
+
supportedKinds = ['phase', 'pr-feedback', 'merge-conflict', 'review', 'remediate', 'conversation-turn', 'invoke'];
|
|
26
|
+
gatewayConfigDir;
|
|
27
|
+
constructor(options) {
|
|
28
|
+
this.gatewayConfigDir = resolveGatewayConfigDir(options?.gatewayConfigDir);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Apply the model-derived route to a builder's base spec.
|
|
32
|
+
*
|
|
33
|
+
* Subscription route → the base spec unchanged (no `env`, no `route`), so
|
|
34
|
+
* pre-change launches stay byte-identical. Gateway route → asserts the
|
|
35
|
+
* gateway config dir is provisioned, then injects `CLAUDE_CONFIG_DIR` and
|
|
36
|
+
* stamps `route: 'gateway'`.
|
|
37
|
+
*/
|
|
38
|
+
applyRoute(spec, model) {
|
|
39
|
+
if (resolveRoute(model) === 'subscription')
|
|
40
|
+
return spec;
|
|
41
|
+
assertGatewayProvisioned(model, this.gatewayConfigDir);
|
|
42
|
+
return { ...spec, env: { CLAUDE_CONFIG_DIR: this.gatewayConfigDir }, route: 'gateway' };
|
|
43
|
+
}
|
|
25
44
|
/**
|
|
26
45
|
* Whether the installed CLI supports a delivery mechanism for reasoning effort.
|
|
27
46
|
*
|
|
@@ -71,10 +90,12 @@ export class ClaudeCodeLaunchPlugin {
|
|
|
71
90
|
return this.buildPhaseLaunch(intent);
|
|
72
91
|
case 'pr-feedback':
|
|
73
92
|
return this.buildPrFeedbackLaunch(intent);
|
|
74
|
-
case 'validate-fix':
|
|
75
|
-
return this.buildValidateFixLaunch(intent);
|
|
76
93
|
case 'merge-conflict':
|
|
77
94
|
return this.buildMergeConflictLaunch(intent);
|
|
95
|
+
case 'review':
|
|
96
|
+
return this.buildReviewLaunch(intent);
|
|
97
|
+
case 'remediate':
|
|
98
|
+
return this.buildRemediateLaunch(intent);
|
|
78
99
|
case 'conversation-turn':
|
|
79
100
|
return this.buildConversationTurnLaunch(intent);
|
|
80
101
|
case 'invoke':
|
|
@@ -113,11 +134,11 @@ export class ClaudeCodeLaunchPlugin {
|
|
|
113
134
|
}
|
|
114
135
|
const command = PHASE_TO_COMMAND[intent.phase];
|
|
115
136
|
args.push(`${command} ${intent.prompt}`);
|
|
116
|
-
return {
|
|
137
|
+
return this.applyRoute({
|
|
117
138
|
command: 'claude',
|
|
118
139
|
args,
|
|
119
140
|
stdioProfile: 'default',
|
|
120
|
-
};
|
|
141
|
+
}, intent.model);
|
|
121
142
|
}
|
|
122
143
|
buildPrFeedbackLaunch(intent) {
|
|
123
144
|
const args = [
|
|
@@ -133,16 +154,16 @@ export class ClaudeCodeLaunchPlugin {
|
|
|
133
154
|
args.push('--effort', intent.effort);
|
|
134
155
|
}
|
|
135
156
|
args.push(intent.prompt);
|
|
136
|
-
return {
|
|
157
|
+
return this.applyRoute({
|
|
137
158
|
command: 'claude',
|
|
138
159
|
args,
|
|
139
160
|
stdioProfile: 'default',
|
|
140
|
-
};
|
|
161
|
+
}, intent.model);
|
|
141
162
|
}
|
|
142
|
-
|
|
143
|
-
// Same shape as pr-feedback — one bounded agent turn with
|
|
144
|
-
//
|
|
145
|
-
//
|
|
163
|
+
buildMergeConflictLaunch(intent) {
|
|
164
|
+
// Same shape as pr-feedback — one bounded agent turn with
|
|
165
|
+
// a prepared prompt. See specs/898-found-during-cockpit-v1/contracts/
|
|
166
|
+
// handler-contract.md §"Sibling-owned path constraint".
|
|
146
167
|
const args = [
|
|
147
168
|
'-p',
|
|
148
169
|
'--output-format', 'stream-json',
|
|
@@ -156,16 +177,18 @@ export class ClaudeCodeLaunchPlugin {
|
|
|
156
177
|
args.push('--effort', intent.effort);
|
|
157
178
|
}
|
|
158
179
|
args.push(intent.prompt);
|
|
159
|
-
return {
|
|
180
|
+
return this.applyRoute({
|
|
160
181
|
command: 'claude',
|
|
161
182
|
args,
|
|
162
183
|
stdioProfile: 'default',
|
|
163
|
-
};
|
|
184
|
+
}, intent.model);
|
|
164
185
|
}
|
|
165
|
-
|
|
166
|
-
// Same shape as pr-feedback /
|
|
167
|
-
//
|
|
168
|
-
//
|
|
186
|
+
buildReviewLaunch(intent) {
|
|
187
|
+
// Same shape as pr-feedback / merge-conflict — one bounded
|
|
188
|
+
// agent turn with an engine-built charter prompt (#1124). The charter is
|
|
189
|
+
// constructed in-process by the ReviewExecutor (Q4→B — no /speckit:review
|
|
190
|
+
// slash command). See specs/1124-context-new-review-phase/contracts/
|
|
191
|
+
// review-executor.md.
|
|
169
192
|
const args = [
|
|
170
193
|
'-p',
|
|
171
194
|
'--output-format', 'stream-json',
|
|
@@ -179,11 +202,35 @@ export class ClaudeCodeLaunchPlugin {
|
|
|
179
202
|
args.push('--effort', intent.effort);
|
|
180
203
|
}
|
|
181
204
|
args.push(intent.prompt);
|
|
182
|
-
return {
|
|
205
|
+
return this.applyRoute({
|
|
183
206
|
command: 'claude',
|
|
184
207
|
args,
|
|
185
208
|
stdioProfile: 'default',
|
|
186
|
-
};
|
|
209
|
+
}, intent.model);
|
|
210
|
+
}
|
|
211
|
+
buildRemediateLaunch(intent) {
|
|
212
|
+
// Byte-identical to buildReviewLaunch — one bounded agent turn with an
|
|
213
|
+
// engine-built remediation charter prompt (#1128). The charter is
|
|
214
|
+
// constructed in-process by the RemediateExecutor via buildRemediateCharter.
|
|
215
|
+
// See specs/1128-context-remediate-single-code/contracts/remediate-executor.md.
|
|
216
|
+
const args = [
|
|
217
|
+
'-p',
|
|
218
|
+
'--output-format', 'stream-json',
|
|
219
|
+
'--dangerously-skip-permissions',
|
|
220
|
+
'--verbose',
|
|
221
|
+
];
|
|
222
|
+
if (intent.model) {
|
|
223
|
+
args.push('--model', intent.model);
|
|
224
|
+
}
|
|
225
|
+
if (intent.effort) {
|
|
226
|
+
args.push('--effort', intent.effort);
|
|
227
|
+
}
|
|
228
|
+
args.push(intent.prompt);
|
|
229
|
+
return this.applyRoute({
|
|
230
|
+
command: 'claude',
|
|
231
|
+
args,
|
|
232
|
+
stdioProfile: 'default',
|
|
233
|
+
}, intent.model);
|
|
187
234
|
}
|
|
188
235
|
buildInvokeLaunch(intent) {
|
|
189
236
|
return {
|
|
@@ -211,11 +258,11 @@ export class ClaudeCodeLaunchPlugin {
|
|
|
211
258
|
if (intent.effort) {
|
|
212
259
|
claudeArgs.push('--effort', intent.effort);
|
|
213
260
|
}
|
|
214
|
-
return {
|
|
261
|
+
return this.applyRoute({
|
|
215
262
|
command: 'python3',
|
|
216
263
|
args: ['-u', '-c', PTY_WRAPPER, ...claudeArgs],
|
|
217
264
|
stdioProfile: 'interactive',
|
|
218
|
-
};
|
|
265
|
+
}, intent.model);
|
|
219
266
|
}
|
|
220
267
|
}
|
|
221
268
|
//# sourceMappingURL=claude-code-launch-plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code-launch-plugin.js","sourceRoot":"","sources":["../../src/launch/claude-code-launch-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"claude-code-launch-plugin.js","sourceRoot":"","sources":["../../src/launch/claude-code-launch-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAWlD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EA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AE,CAAC;YACrB,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;QAChD,CAAC;QAED,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;YAC3B,UAAU,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;QAED,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7C,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC;YACrB,OAAO,EAAE,SAAS;YAClB,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC;YAC9C,YAAY,EAAE,aAAa;SAC5B,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which config/auth route a launch takes.
|
|
3
|
+
*
|
|
4
|
+
* - `subscription`: the CLI's default config dir; Anthropic-native models the
|
|
5
|
+
* CLI validates against `api.anthropic.com`.
|
|
6
|
+
* - `gateway`: a second config dir whose `settings.json` points the CLI at the
|
|
7
|
+
* Generacy LLM gateway (`ANTHROPIC_BASE_URL`), letting any provider/model
|
|
8
|
+
* string through.
|
|
9
|
+
*/
|
|
10
|
+
export type Route = 'subscription' | 'gateway';
|
|
11
|
+
/**
|
|
12
|
+
* Default location of the gateway config dir. The gateway `settings.json` is
|
|
13
|
+
* provisioned out-of-band; this feature only checks for its presence.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_GATEWAY_CONFIG_DIR = "/home/node/.claude-gateway";
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the launch route purely from the model name.
|
|
18
|
+
*
|
|
19
|
+
* A provider-qualified model (containing `/`, e.g. `openai/gpt-5.5`) routes to
|
|
20
|
+
* the gateway; a bare Anthropic id/alias (`opus`, `claude-sonnet-4-5[1m]`) —
|
|
21
|
+
* and an absent model — routes to the subscription config dir.
|
|
22
|
+
*
|
|
23
|
+
* Pure: no I/O, no env reads, no cache. Consumers needing route comparison
|
|
24
|
+
* (e.g. #1199 session invalidation) MUST call this directly — `LaunchSpec.route`
|
|
25
|
+
* is `undefined` on subscription launches and unsuitable for comparison.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveRoute(model?: string): Route;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the gateway config dir.
|
|
30
|
+
*
|
|
31
|
+
* Precedence (nullish only — an explicit empty string wins over the env var):
|
|
32
|
+
* explicit option > `GENERACY_CLAUDE_GATEWAY_CONFIG_DIR` > default.
|
|
33
|
+
* Called once per plugin construction, not per launch.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveGatewayConfigDir(explicit?: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Raised when a gateway-routed model is launched but the gateway config dir has
|
|
38
|
+
* no `settings.json` — the CLI would silently fall back to the subscription
|
|
39
|
+
* config and fail to reach the gateway.
|
|
40
|
+
*/
|
|
41
|
+
export declare class GatewayRouteUnavailableError extends Error {
|
|
42
|
+
readonly name = "GatewayRouteUnavailableError";
|
|
43
|
+
readonly model: string;
|
|
44
|
+
readonly gatewayConfigDir: string;
|
|
45
|
+
constructor(model: string, gatewayConfigDir: string);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Assert the gateway config dir is provisioned, throwing otherwise.
|
|
49
|
+
*
|
|
50
|
+
* - dir in the positive cache → return without touching the filesystem
|
|
51
|
+
* - `<dir>/settings.json` exists → cache the dir + return
|
|
52
|
+
* - `<dir>/settings.json` absent → throw `GatewayRouteUnavailableError`
|
|
53
|
+
*/
|
|
54
|
+
export declare function assertGatewayProvisioned(model: string, gatewayConfigDir: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Test-only: clear the positive provision cache. Not part of the public API.
|
|
57
|
+
*/
|
|
58
|
+
export declare function _resetGatewayProvisionCacheForTests(): void;
|
|
59
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/launch/route.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,MAAM,MAAM,KAAK,GAAG,cAAc,GAAG,SAAS,CAAC;AAE/C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AAEvE;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,IAAI,kCAAkC;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;gBAEtB,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM;CAQpD;AAUD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAOtF;AAED;;GAEG;AACH,wBAAgB,mCAAmC,IAAI,IAAI,CAE1D"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Default location of the gateway config dir. The gateway `settings.json` is
|
|
5
|
+
* provisioned out-of-band; this feature only checks for its presence.
|
|
6
|
+
*/
|
|
7
|
+
export const DEFAULT_GATEWAY_CONFIG_DIR = '/home/node/.claude-gateway';
|
|
8
|
+
/**
|
|
9
|
+
* Resolve the launch route purely from the model name.
|
|
10
|
+
*
|
|
11
|
+
* A provider-qualified model (containing `/`, e.g. `openai/gpt-5.5`) routes to
|
|
12
|
+
* the gateway; a bare Anthropic id/alias (`opus`, `claude-sonnet-4-5[1m]`) —
|
|
13
|
+
* and an absent model — routes to the subscription config dir.
|
|
14
|
+
*
|
|
15
|
+
* Pure: no I/O, no env reads, no cache. Consumers needing route comparison
|
|
16
|
+
* (e.g. #1199 session invalidation) MUST call this directly — `LaunchSpec.route`
|
|
17
|
+
* is `undefined` on subscription launches and unsuitable for comparison.
|
|
18
|
+
*/
|
|
19
|
+
export function resolveRoute(model) {
|
|
20
|
+
return model !== undefined && model.includes('/') ? 'gateway' : 'subscription';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Resolve the gateway config dir.
|
|
24
|
+
*
|
|
25
|
+
* Precedence (nullish only — an explicit empty string wins over the env var):
|
|
26
|
+
* explicit option > `GENERACY_CLAUDE_GATEWAY_CONFIG_DIR` > default.
|
|
27
|
+
* Called once per plugin construction, not per launch.
|
|
28
|
+
*/
|
|
29
|
+
export function resolveGatewayConfigDir(explicit) {
|
|
30
|
+
return explicit ?? process.env.GENERACY_CLAUDE_GATEWAY_CONFIG_DIR ?? DEFAULT_GATEWAY_CONFIG_DIR;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Raised when a gateway-routed model is launched but the gateway config dir has
|
|
34
|
+
* no `settings.json` — the CLI would silently fall back to the subscription
|
|
35
|
+
* config and fail to reach the gateway.
|
|
36
|
+
*/
|
|
37
|
+
export class GatewayRouteUnavailableError extends Error {
|
|
38
|
+
name = 'GatewayRouteUnavailableError';
|
|
39
|
+
model;
|
|
40
|
+
gatewayConfigDir;
|
|
41
|
+
constructor(model, gatewayConfigDir) {
|
|
42
|
+
super(`Model "${model}" requires the gateway route, but ${join(gatewayConfigDir, 'settings.json')} was not found. ` +
|
|
43
|
+
`Provision the gateway config dir (see GENERACY_LLM_GATEWAY_URL) or use an Anthropic model.`);
|
|
44
|
+
this.model = model;
|
|
45
|
+
this.gatewayConfigDir = gatewayConfigDir;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Process-lifetime, positive-only cache of gateway config dirs already
|
|
50
|
+
* confirmed to hold a `settings.json`. Keyed by dir path. A missing dir is
|
|
51
|
+
* NEVER cached, so provisioning takes effect on the next launch without an
|
|
52
|
+
* invalidation step.
|
|
53
|
+
*/
|
|
54
|
+
const provisionedDirs = new Set();
|
|
55
|
+
/**
|
|
56
|
+
* Assert the gateway config dir is provisioned, throwing otherwise.
|
|
57
|
+
*
|
|
58
|
+
* - dir in the positive cache → return without touching the filesystem
|
|
59
|
+
* - `<dir>/settings.json` exists → cache the dir + return
|
|
60
|
+
* - `<dir>/settings.json` absent → throw `GatewayRouteUnavailableError`
|
|
61
|
+
*/
|
|
62
|
+
export function assertGatewayProvisioned(model, gatewayConfigDir) {
|
|
63
|
+
if (provisionedDirs.has(gatewayConfigDir))
|
|
64
|
+
return;
|
|
65
|
+
if (existsSync(join(gatewayConfigDir, 'settings.json'))) {
|
|
66
|
+
provisionedDirs.add(gatewayConfigDir);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
throw new GatewayRouteUnavailableError(model, gatewayConfigDir);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Test-only: clear the positive provision cache. Not part of the public API.
|
|
73
|
+
*/
|
|
74
|
+
export function _resetGatewayProvisionCacheForTests() {
|
|
75
|
+
provisionedDirs.clear();
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/launch/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;A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M,UAAU,mCAAmC;IACjD,eAAe,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC"}
|
package/dist/launch/types.d.ts
CHANGED
|
@@ -69,18 +69,34 @@ export interface MergeConflictIntent {
|
|
|
69
69
|
effort?: Effort;
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
|
-
* Intent for
|
|
73
|
-
*
|
|
74
|
-
*
|
|
72
|
+
* Intent for an engine-driven review pass (#1124). Routes through the same
|
|
73
|
+
* launcher plumbing as `merge-conflict`. The engine builds the review charter
|
|
74
|
+
* in-process and passes it as the prompt.
|
|
75
75
|
*/
|
|
76
|
-
export interface
|
|
77
|
-
kind: '
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
/** Full prompt
|
|
76
|
+
export interface ReviewIntent {
|
|
77
|
+
kind: 'review';
|
|
78
|
+
/** For logging/tracing */
|
|
79
|
+
issueNumber: number;
|
|
80
|
+
/** Full charter prompt (built by ReviewExecutor via buildReviewCharter) */
|
|
81
|
+
prompt: string;
|
|
82
|
+
/** Provider breadcrumb (dispatch reads LaunchRequest.provider). */
|
|
83
|
+
provider?: string;
|
|
84
|
+
/** Optional model override, provider-interpreted. */
|
|
85
|
+
model?: string;
|
|
86
|
+
/** Optional reasoning-effort override, provider-interpreted. */
|
|
87
|
+
effort?: Effort;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Intent for an engine-driven remediation pass (#1128). Mirrors `ReviewIntent`:
|
|
91
|
+
* the engine builds the remediation charter in-process and passes it as the
|
|
92
|
+
* prompt; routes through the same launcher plumbing as `review`.
|
|
93
|
+
*/
|
|
94
|
+
export interface RemediateIntent {
|
|
95
|
+
kind: 'remediate';
|
|
96
|
+
/** For logging/tracing */
|
|
97
|
+
issueNumber: number;
|
|
98
|
+
/** Full charter prompt (built by RemediateExecutor via buildRemediateCharter) */
|
|
81
99
|
prompt: string;
|
|
82
|
-
/** 64-hex SHA-256 identity of the failing evidence — surfaces in logs. */
|
|
83
|
-
evidenceHash: string;
|
|
84
100
|
/** Provider breadcrumb (dispatch reads LaunchRequest.provider). */
|
|
85
101
|
provider?: string;
|
|
86
102
|
/** Optional model override, provider-interpreted. */
|
|
@@ -119,5 +135,5 @@ export interface InvokeIntent {
|
|
|
119
135
|
/**
|
|
120
136
|
* Union of all Claude Code-specific intent types.
|
|
121
137
|
*/
|
|
122
|
-
export type ClaudeCodeIntent = PhaseIntent | PrFeedbackIntent |
|
|
138
|
+
export type ClaudeCodeIntent = PhaseIntent | PrFeedbackIntent | MergeConflictIntent | ReviewIntent | RemediateIntent | ConversationTurnIntent | InvokeIntent;
|
|
123
139
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/launch/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,+BAA+B;IAC/B,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;IAC9D,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IACh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C;IACzC,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,CAAC;IACf,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,WAAW,GACX,gBAAgB,GAChB,mBAAmB,GACnB,YAAY,GACZ,eAAe,GACf,sBAAsB,GACtB,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@generacy-ai/generacy-plugin-claude-code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Claude Code agent platform plugin for Generacy - invokes Claude Code agents in isolated Docker containers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|