@generacy-ai/generacy-plugin-claude-code 0.0.0-preview-20260304013206

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.
Files changed (62) hide show
  1. package/LICENSE +191 -0
  2. package/dist/container/container-manager.d.ts +82 -0
  3. package/dist/container/container-manager.d.ts.map +1 -0
  4. package/dist/container/container-manager.js +420 -0
  5. package/dist/container/container-manager.js.map +1 -0
  6. package/dist/container/types.d.ts +160 -0
  7. package/dist/container/types.d.ts.map +1 -0
  8. package/dist/container/types.js +24 -0
  9. package/dist/container/types.js.map +1 -0
  10. package/dist/errors.d.ts +106 -0
  11. package/dist/errors.d.ts.map +1 -0
  12. package/dist/errors.js +180 -0
  13. package/dist/errors.js.map +1 -0
  14. package/dist/index.d.ts +16 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +21 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/invocation/invoker.d.ts +59 -0
  19. package/dist/invocation/invoker.d.ts.map +1 -0
  20. package/dist/invocation/invoker.js +271 -0
  21. package/dist/invocation/invoker.js.map +1 -0
  22. package/dist/invocation/types.d.ts +129 -0
  23. package/dist/invocation/types.d.ts.map +1 -0
  24. package/dist/invocation/types.js +57 -0
  25. package/dist/invocation/types.js.map +1 -0
  26. package/dist/plugin/claude-code-plugin.d.ts +144 -0
  27. package/dist/plugin/claude-code-plugin.d.ts.map +1 -0
  28. package/dist/plugin/claude-code-plugin.js +416 -0
  29. package/dist/plugin/claude-code-plugin.js.map +1 -0
  30. package/dist/schemas.d.ts +198 -0
  31. package/dist/schemas.d.ts.map +1 -0
  32. package/dist/schemas.js +75 -0
  33. package/dist/schemas.js.map +1 -0
  34. package/dist/session/session-manager.d.ts +117 -0
  35. package/dist/session/session-manager.d.ts.map +1 -0
  36. package/dist/session/session-manager.js +243 -0
  37. package/dist/session/session-manager.js.map +1 -0
  38. package/dist/session/session.d.ts +99 -0
  39. package/dist/session/session.d.ts.map +1 -0
  40. package/dist/session/session.js +271 -0
  41. package/dist/session/session.js.map +1 -0
  42. package/dist/session/types.d.ts +107 -0
  43. package/dist/session/types.d.ts.map +1 -0
  44. package/dist/session/types.js +33 -0
  45. package/dist/session/types.js.map +1 -0
  46. package/dist/streaming/output-parser.d.ts +91 -0
  47. package/dist/streaming/output-parser.d.ts.map +1 -0
  48. package/dist/streaming/output-parser.js +321 -0
  49. package/dist/streaming/output-parser.js.map +1 -0
  50. package/dist/streaming/output-stream.d.ts +45 -0
  51. package/dist/streaming/output-stream.d.ts.map +1 -0
  52. package/dist/streaming/output-stream.js +222 -0
  53. package/dist/streaming/output-stream.js.map +1 -0
  54. package/dist/streaming/types.d.ts +89 -0
  55. package/dist/streaming/types.d.ts.map +1 -0
  56. package/dist/streaming/types.js +47 -0
  57. package/dist/streaming/types.js.map +1 -0
  58. package/dist/types.d.ts +267 -0
  59. package/dist/types.d.ts.map +1 -0
  60. package/dist/types.js +33 -0
  61. package/dist/types.js.map +1 -0
  62. package/package.json +58 -0
@@ -0,0 +1,106 @@
1
+ /**
2
+ * @generacy-ai/generacy-plugin-claude-code
3
+ *
4
+ * Custom error classes for the Claude Code plugin.
5
+ * Implements fail-fast error handling with rich classification.
6
+ */
7
+ import type { ErrorCode, SessionStatus, TerminationReason } from './types.js';
8
+ /**
9
+ * Base error class for all plugin errors.
10
+ */
11
+ export declare class PluginError extends Error {
12
+ /** Error classification code */
13
+ readonly code: ErrorCode;
14
+ /** Whether this error is transient (retryable) */
15
+ readonly isTransient: boolean;
16
+ /** Additional error context */
17
+ readonly context?: unknown;
18
+ constructor(message: string, code: ErrorCode, isTransient: boolean, context?: unknown);
19
+ /**
20
+ * Convert to InvocationError format for API responses.
21
+ */
22
+ toInvocationError(): {
23
+ code: ErrorCode;
24
+ isTransient: boolean;
25
+ message: string;
26
+ context: unknown;
27
+ };
28
+ }
29
+ /**
30
+ * Error thrown when a session is not found in the session manager.
31
+ */
32
+ export declare class SessionNotFoundError extends PluginError {
33
+ /** The session ID that was not found */
34
+ readonly sessionId: string;
35
+ constructor(sessionId: string);
36
+ }
37
+ /**
38
+ * Error thrown when an operation is attempted on a session in an invalid state.
39
+ */
40
+ export declare class SessionInvalidStateError extends PluginError {
41
+ /** The session ID */
42
+ readonly sessionId: string;
43
+ /** The current state of the session */
44
+ readonly currentState: SessionStatus;
45
+ /** The expected states for the operation */
46
+ readonly expectedStates: SessionStatus[];
47
+ constructor(sessionId: string, currentState: SessionStatus, expectedStates: SessionStatus[], operation: string);
48
+ }
49
+ /**
50
+ * Error thrown when a Docker container fails to start.
51
+ */
52
+ export declare class ContainerStartError extends PluginError {
53
+ /** The Docker image that failed to start */
54
+ readonly image: string;
55
+ /** The underlying Docker error message */
56
+ readonly dockerError?: string;
57
+ constructor(image: string, dockerError?: string);
58
+ }
59
+ /**
60
+ * Error thrown when an operation requires a running container but it's not running.
61
+ */
62
+ export declare class ContainerNotRunningError extends PluginError {
63
+ /** The session ID */
64
+ readonly sessionId: string;
65
+ /** The container ID (if known) */
66
+ readonly containerId?: string;
67
+ /** The reason the container stopped */
68
+ readonly reason?: TerminationReason;
69
+ constructor(sessionId: string, containerId?: string, reason?: TerminationReason);
70
+ }
71
+ /**
72
+ * Error thrown when an invocation times out.
73
+ */
74
+ export declare class InvocationTimeoutError extends PluginError {
75
+ /** The session ID */
76
+ readonly sessionId: string;
77
+ /** The invocation ID */
78
+ readonly invocationId: string;
79
+ /** The timeout value in milliseconds */
80
+ readonly timeoutMs: number;
81
+ constructor(sessionId: string, invocationId: string, timeoutMs: number);
82
+ }
83
+ /**
84
+ * Error thrown when an invocation fails with an error from Claude Code.
85
+ */
86
+ export declare class InvocationFailedError extends PluginError {
87
+ /** The session ID */
88
+ readonly sessionId: string;
89
+ /** The invocation ID */
90
+ readonly invocationId: string;
91
+ /** Exit code from the process */
92
+ readonly exitCode: number;
93
+ /** Error output from stderr */
94
+ readonly stderr?: string;
95
+ constructor(sessionId: string, invocationId: string, exitCode: number, stderr?: string);
96
+ }
97
+ /**
98
+ * Check if an error is a plugin error.
99
+ */
100
+ export declare function isPluginError(error: unknown): error is PluginError;
101
+ /**
102
+ * Wrap any error as a PluginError.
103
+ * Preserves PluginError instances, wraps others as UNKNOWN.
104
+ */
105
+ export declare function wrapError(error: unknown): PluginError;
106
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE9E;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,gCAAgC;IAChC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAEzB,kDAAkD;IAClD,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAE9B,+BAA+B;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;gBAGzB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,EACf,WAAW,EAAE,OAAO,EACpB,OAAO,CAAC,EAAE,OAAO;IAYnB;;OAEG;IACH,iBAAiB;;;;;;CAQlB;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,WAAW;IACnD,wCAAwC;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,SAAS,EAAE,MAAM;CAU9B;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,WAAW;IACvD,qBAAqB;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,uCAAuC;IACvC,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;IAErC,4CAA4C;IAC5C,QAAQ,CAAC,cAAc,EAAE,aAAa,EAAE,CAAC;gBAGvC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,aAAa,EAC3B,cAAc,EAAE,aAAa,EAAE,EAC/B,SAAS,EAAE,MAAM;CAap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,EAChB,MAAM,CAAC,EAAE,MAAM;CA2BlB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CASrD"}
package/dist/errors.js ADDED
@@ -0,0 +1,180 @@
1
+ /**
2
+ * @generacy-ai/generacy-plugin-claude-code
3
+ *
4
+ * Custom error classes for the Claude Code plugin.
5
+ * Implements fail-fast error handling with rich classification.
6
+ */
7
+ /**
8
+ * Base error class for all plugin errors.
9
+ */
10
+ export class PluginError extends Error {
11
+ /** Error classification code */
12
+ code;
13
+ /** Whether this error is transient (retryable) */
14
+ isTransient;
15
+ /** Additional error context */
16
+ context;
17
+ constructor(message, code, isTransient, context) {
18
+ super(message);
19
+ this.name = 'PluginError';
20
+ this.code = code;
21
+ this.isTransient = isTransient;
22
+ this.context = context;
23
+ // Maintains proper stack trace for where our error was thrown
24
+ Error.captureStackTrace?.(this, this.constructor);
25
+ }
26
+ /**
27
+ * Convert to InvocationError format for API responses.
28
+ */
29
+ toInvocationError() {
30
+ return {
31
+ code: this.code,
32
+ isTransient: this.isTransient,
33
+ message: this.message,
34
+ context: this.context,
35
+ };
36
+ }
37
+ }
38
+ /**
39
+ * Error thrown when a session is not found in the session manager.
40
+ */
41
+ export class SessionNotFoundError extends PluginError {
42
+ /** The session ID that was not found */
43
+ sessionId;
44
+ constructor(sessionId) {
45
+ super(`Session not found: ${sessionId}`, 'UNKNOWN', false, { sessionId });
46
+ this.name = 'SessionNotFoundError';
47
+ this.sessionId = sessionId;
48
+ }
49
+ }
50
+ /**
51
+ * Error thrown when an operation is attempted on a session in an invalid state.
52
+ */
53
+ export class SessionInvalidStateError extends PluginError {
54
+ /** The session ID */
55
+ sessionId;
56
+ /** The current state of the session */
57
+ currentState;
58
+ /** The expected states for the operation */
59
+ expectedStates;
60
+ constructor(sessionId, currentState, expectedStates, operation) {
61
+ super(`Cannot ${operation} session ${sessionId}: expected state ${expectedStates.join(' or ')}, but was ${currentState}`, 'UNKNOWN', false, { sessionId, currentState, expectedStates, operation });
62
+ this.name = 'SessionInvalidStateError';
63
+ this.sessionId = sessionId;
64
+ this.currentState = currentState;
65
+ this.expectedStates = expectedStates;
66
+ }
67
+ }
68
+ /**
69
+ * Error thrown when a Docker container fails to start.
70
+ */
71
+ export class ContainerStartError extends PluginError {
72
+ /** The Docker image that failed to start */
73
+ image;
74
+ /** The underlying Docker error message */
75
+ dockerError;
76
+ constructor(image, dockerError) {
77
+ const message = dockerError
78
+ ? `Failed to start container from image ${image}: ${dockerError}`
79
+ : `Failed to start container from image ${image}`;
80
+ super(message, 'CONTAINER_CRASHED', true, { image, dockerError });
81
+ this.name = 'ContainerStartError';
82
+ this.image = image;
83
+ this.dockerError = dockerError;
84
+ }
85
+ }
86
+ /**
87
+ * Error thrown when an operation requires a running container but it's not running.
88
+ */
89
+ export class ContainerNotRunningError extends PluginError {
90
+ /** The session ID */
91
+ sessionId;
92
+ /** The container ID (if known) */
93
+ containerId;
94
+ /** The reason the container stopped */
95
+ reason;
96
+ constructor(sessionId, containerId, reason) {
97
+ const message = containerId
98
+ ? `Container ${containerId} for session ${sessionId} is not running`
99
+ : `No running container for session ${sessionId}`;
100
+ super(message, 'CONTAINER_CRASHED', false, { sessionId, containerId, reason });
101
+ this.name = 'ContainerNotRunningError';
102
+ this.sessionId = sessionId;
103
+ this.containerId = containerId;
104
+ this.reason = reason;
105
+ }
106
+ }
107
+ /**
108
+ * Error thrown when an invocation times out.
109
+ */
110
+ export class InvocationTimeoutError extends PluginError {
111
+ /** The session ID */
112
+ sessionId;
113
+ /** The invocation ID */
114
+ invocationId;
115
+ /** The timeout value in milliseconds */
116
+ timeoutMs;
117
+ constructor(sessionId, invocationId, timeoutMs) {
118
+ super(`Invocation ${invocationId} timed out after ${timeoutMs}ms`, 'API_TIMEOUT', true, { sessionId, invocationId, timeoutMs });
119
+ this.name = 'InvocationTimeoutError';
120
+ this.sessionId = sessionId;
121
+ this.invocationId = invocationId;
122
+ this.timeoutMs = timeoutMs;
123
+ }
124
+ }
125
+ /**
126
+ * Error thrown when an invocation fails with an error from Claude Code.
127
+ */
128
+ export class InvocationFailedError extends PluginError {
129
+ /** The session ID */
130
+ sessionId;
131
+ /** The invocation ID */
132
+ invocationId;
133
+ /** Exit code from the process */
134
+ exitCode;
135
+ /** Error output from stderr */
136
+ stderr;
137
+ constructor(sessionId, invocationId, exitCode, stderr) {
138
+ const message = stderr
139
+ ? `Invocation ${invocationId} failed with exit code ${exitCode}: ${stderr}`
140
+ : `Invocation ${invocationId} failed with exit code ${exitCode}`;
141
+ // Determine error code based on exit code and stderr content
142
+ let code = 'UNKNOWN';
143
+ let isTransient = false;
144
+ if (stderr) {
145
+ if (stderr.includes('rate limit') || stderr.includes('429')) {
146
+ code = 'RATE_LIMITED';
147
+ isTransient = true;
148
+ }
149
+ else if (stderr.includes('auth') || stderr.includes('401') || stderr.includes('403')) {
150
+ code = 'AUTH_FAILED';
151
+ isTransient = false;
152
+ }
153
+ }
154
+ super(message, code, isTransient, { sessionId, invocationId, exitCode, stderr });
155
+ this.name = 'InvocationFailedError';
156
+ this.sessionId = sessionId;
157
+ this.invocationId = invocationId;
158
+ this.exitCode = exitCode;
159
+ this.stderr = stderr;
160
+ }
161
+ }
162
+ /**
163
+ * Check if an error is a plugin error.
164
+ */
165
+ export function isPluginError(error) {
166
+ return error instanceof PluginError;
167
+ }
168
+ /**
169
+ * Wrap any error as a PluginError.
170
+ * Preserves PluginError instances, wraps others as UNKNOWN.
171
+ */
172
+ export function wrapError(error) {
173
+ if (error instanceof PluginError) {
174
+ return error;
175
+ }
176
+ const message = error instanceof Error ? error.message : String(error);
177
+ const context = error instanceof Error ? { originalError: error.name, stack: error.stack } : undefined;
178
+ return new PluginError(message, 'UNKNOWN', false, context);
179
+ }
180
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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AAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAEvG,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @generacy-ai/generacy-plugin-claude-code
3
+ *
4
+ * Claude Code agent platform plugin for Generacy.
5
+ * Provides a thin interface for invoking Claude Code agents in isolated Docker containers.
6
+ */
7
+ export type { Session, SessionStatus, SessionState, TerminationReason, InternalSession, ContainerConfig, Mount, ResourceLimits, InvokeParams, InvokeOptions, InvocationResult, OutputChunk, OutputChunkType, OutputMetadata, UrgencyLevel, QuestionPayload, InvocationError, ErrorCode, ClaudeCodePluginInterface, } from './types.js';
8
+ export { isQuestionChunk, isErrorChunk, isSessionRunning, isSessionTerminated, } from './types.js';
9
+ export { MountSchema, ResourceLimitsSchema, ContainerConfigSchema, InvokeOptionsSchema, InvokeParamsSchema, } from './schemas.js';
10
+ export { PluginError, SessionNotFoundError, SessionInvalidStateError, ContainerStartError, ContainerNotRunningError, InvocationTimeoutError, InvocationFailedError, isPluginError, wrapError, } from './errors.js';
11
+ export { ClaudeCodePlugin } from './plugin/claude-code-plugin.js';
12
+ export type { ClaudeCodePluginOptions } from './plugin/claude-code-plugin.js';
13
+ export { createOutputStream, createOutputStreamFromData, collectOutputChunks, findQuestion, filterChunksByType, waitForCompletion, } from './streaming/output-stream.js';
14
+ export { OutputParser } from './streaming/output-parser.js';
15
+ export { buildClaudeCommand, buildModeCommand, DEFAULT_INVOCATION_TIMEOUT_MS, DEFAULT_MAX_TURNS, } from './invocation/types.js';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @generacy-ai/generacy-plugin-claude-code
3
+ *
4
+ * Claude Code agent platform plugin for Generacy.
5
+ * Provides a thin interface for invoking Claude Code agents in isolated Docker containers.
6
+ */
7
+ // Type guards
8
+ export { isQuestionChunk, isErrorChunk, isSessionRunning, isSessionTerminated, } from './types.js';
9
+ // Validation schemas
10
+ export { MountSchema, ResourceLimitsSchema, ContainerConfigSchema, InvokeOptionsSchema, InvokeParamsSchema, } from './schemas.js';
11
+ // Error classes
12
+ export { PluginError, SessionNotFoundError, SessionInvalidStateError, ContainerStartError, ContainerNotRunningError, InvocationTimeoutError, InvocationFailedError, isPluginError, wrapError, } from './errors.js';
13
+ // Plugin class and options
14
+ export { ClaudeCodePlugin } from './plugin/claude-code-plugin.js';
15
+ // Streaming utilities
16
+ export { createOutputStream, createOutputStreamFromData, collectOutputChunks, findQuestion, filterChunksByType, waitForCompletion, } from './streaming/output-stream.js';
17
+ // Output parser
18
+ export { OutputParser } from './streaming/output-parser.js';
19
+ // Invocation utilities
20
+ export { buildClaudeCommand, buildModeCommand, DEFAULT_INVOCATION_TIMEOUT_MS, DEFAULT_MAX_TURNS, } from './invocation/types.js';
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,MAAM,gCAAgC,CAAC;AAGlE,sBAAsB;AACtB,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAEtC,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,uBAAuB;AACvB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,6BAA6B,EAC7B,iBAAiB,GAClB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @generacy-ai/generacy-plugin-claude-code
3
+ *
4
+ * Invoker class for executing Claude Code commands.
5
+ */
6
+ import type { Logger } from 'pino';
7
+ import type { ContainerManager } from '../container/container-manager.js';
8
+ import type { Session } from '../session/session.js';
9
+ import type { InvokeOptions, InvocationResult, OutputChunk } from '../types.js';
10
+ import type { InvocationData, CommandResult, SetModeOptions } from './types.js';
11
+ /**
12
+ * Invoker class for executing Claude Code commands in containers.
13
+ */
14
+ export declare class Invoker {
15
+ private readonly containerManager;
16
+ private readonly logger;
17
+ private readonly invocations;
18
+ constructor(containerManager: ContainerManager, logger: Logger);
19
+ /**
20
+ * Execute an invocation in a session's container.
21
+ */
22
+ invoke(session: Session, prompt: string, options?: InvokeOptions): Promise<InvocationResult>;
23
+ /**
24
+ * Set the Agency mode in a container.
25
+ */
26
+ setMode(sessionId: string, mode: string, options?: SetModeOptions): Promise<void>;
27
+ /**
28
+ * Execute a command in a container.
29
+ */
30
+ executeCommand(sessionId: string, cmd: string[], options?: {
31
+ timeout?: number;
32
+ onOutput?: (chunk: OutputChunk) => void;
33
+ }): Promise<CommandResult>;
34
+ /**
35
+ * Get invocation data by ID.
36
+ */
37
+ getInvocation(invocationId: string): InvocationData | undefined;
38
+ /**
39
+ * Get all invocations for a session.
40
+ */
41
+ getSessionInvocations(sessionId: string): InvocationData[];
42
+ /**
43
+ * Clean up invocations for a session.
44
+ */
45
+ cleanupSession(sessionId: string): void;
46
+ /**
47
+ * Handle an output chunk during execution.
48
+ */
49
+ private handleOutputChunk;
50
+ /**
51
+ * Get the current executing invocation for a session.
52
+ */
53
+ private getCurrentInvocation;
54
+ /**
55
+ * Build an InvocationResult from command result.
56
+ */
57
+ private buildResult;
58
+ }
59
+ //# sourceMappingURL=invoker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoker.d.ts","sourceRoot":"","sources":["../../src/invocation/invoker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAKrD,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,WAAW,EACZ,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EACV,cAAc,EAEd,aAAa,EACb,cAAc,EACf,MAAM,YAAY,CAAC;AAQpB;;GAEG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IACpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0C;gBAE1D,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM;IAK9D;;OAEG;IACG,MAAM,CACV,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,gBAAgB,CAAC;IA8G5B;;OAEG;IACG,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBjG;;OAEG;IACG,cAAc,CAClB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EAAE,EACb,OAAO,GAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB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