@celljs/ai-coding-agent 0.0.0-stage → 4.1.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.
Files changed (171) hide show
  1. package/README.md +225 -2
  2. package/cell.yml +16 -0
  3. package/esm/node/application-lifecycle.d.ts +7 -0
  4. package/esm/node/application-lifecycle.js +25 -0
  5. package/esm/node/application-lifecycle.js.map +1 -0
  6. package/esm/node/coding-agent-protocol.d.ts +92 -0
  7. package/esm/node/coding-agent-protocol.js +8 -0
  8. package/esm/node/coding-agent-protocol.js.map +1 -0
  9. package/esm/node/error/errors.d.ts +22 -0
  10. package/esm/node/error/errors.js +25 -0
  11. package/esm/node/error/errors.js.map +1 -0
  12. package/esm/node/error/index.d.ts +1 -0
  13. package/esm/node/error/index.js +2 -0
  14. package/esm/node/error/index.js.map +1 -0
  15. package/esm/node/event/agent-event-util.d.ts +1 -0
  16. package/esm/node/event/agent-event-util.js +3 -0
  17. package/esm/node/event/agent-event-util.js.map +1 -0
  18. package/esm/node/event/index.d.ts +1 -0
  19. package/esm/node/event/index.js +2 -0
  20. package/esm/node/event/index.js.map +1 -0
  21. package/esm/node/index.d.ts +8 -0
  22. package/esm/node/index.js +10 -0
  23. package/esm/node/index.js.map +1 -0
  24. package/esm/node/module.d.ts +3 -0
  25. package/esm/node/module.js +4 -0
  26. package/esm/node/module.js.map +1 -0
  27. package/esm/node/pi/index.d.ts +2 -0
  28. package/esm/node/pi/index.js +3 -0
  29. package/esm/node/pi/index.js.map +1 -0
  30. package/esm/node/pi/pi-sdk-util.d.ts +9 -0
  31. package/esm/node/pi/pi-sdk-util.js +20 -0
  32. package/esm/node/pi/pi-sdk-util.js.map +1 -0
  33. package/esm/node/pi/pi-types.d.ts +10 -0
  34. package/esm/node/pi/pi-types.js +2 -0
  35. package/esm/node/pi/pi-types.js.map +1 -0
  36. package/esm/node/runtime/index.d.ts +1 -0
  37. package/esm/node/runtime/index.js +2 -0
  38. package/esm/node/runtime/index.js.map +1 -0
  39. package/esm/node/runtime/model-runtime-provider.d.ts +11 -0
  40. package/esm/node/runtime/model-runtime-provider.js +67 -0
  41. package/esm/node/runtime/model-runtime-provider.js.map +1 -0
  42. package/esm/node/session/agent-session-factory.d.ts +23 -0
  43. package/esm/node/session/agent-session-factory.js +178 -0
  44. package/esm/node/session/agent-session-factory.js.map +1 -0
  45. package/esm/node/session/agent-session-manager.d.ts +16 -0
  46. package/esm/node/session/agent-session-manager.js +72 -0
  47. package/esm/node/session/agent-session-manager.js.map +1 -0
  48. package/esm/node/session/index.d.ts +2 -0
  49. package/esm/node/session/index.js +3 -0
  50. package/esm/node/session/index.js.map +1 -0
  51. package/esm/node/test/faux-models.d.ts +28 -0
  52. package/esm/node/test/faux-models.js +39 -0
  53. package/esm/node/test/faux-models.js.map +1 -0
  54. package/esm/node/test/index.d.ts +2 -0
  55. package/esm/node/test/index.js +3 -0
  56. package/esm/node/test/index.js.map +1 -0
  57. package/esm/node/test/test-container.d.ts +18 -0
  58. package/esm/node/test/test-container.js +25 -0
  59. package/esm/node/test/test-container.js.map +1 -0
  60. package/esm/package.json +3 -0
  61. package/lib/node/application-lifecycle.d.ts +8 -0
  62. package/lib/node/application-lifecycle.d.ts.map +1 -0
  63. package/lib/node/application-lifecycle.js +28 -0
  64. package/lib/node/application-lifecycle.js.map +1 -0
  65. package/lib/node/coding-agent-protocol.d.ts +93 -0
  66. package/lib/node/coding-agent-protocol.d.ts.map +1 -0
  67. package/lib/node/coding-agent-protocol.js +11 -0
  68. package/lib/node/coding-agent-protocol.js.map +1 -0
  69. package/lib/node/error/errors.d.ts +23 -0
  70. package/lib/node/error/errors.d.ts.map +1 -0
  71. package/lib/node/error/errors.js +32 -0
  72. package/lib/node/error/errors.js.map +1 -0
  73. package/lib/node/error/index.d.ts +2 -0
  74. package/lib/node/error/index.d.ts.map +1 -0
  75. package/lib/node/error/index.js +18 -0
  76. package/lib/node/error/index.js.map +1 -0
  77. package/lib/node/event/agent-event-util.d.ts +2 -0
  78. package/lib/node/event/agent-event-util.d.ts.map +1 -0
  79. package/lib/node/event/agent-event-util.js +7 -0
  80. package/lib/node/event/agent-event-util.js.map +1 -0
  81. package/lib/node/event/agent-event-util.spec.d.ts +2 -0
  82. package/lib/node/event/agent-event-util.spec.d.ts.map +1 -0
  83. package/lib/node/event/agent-event-util.spec.js +85 -0
  84. package/lib/node/event/agent-event-util.spec.js.map +1 -0
  85. package/lib/node/event/index.d.ts +2 -0
  86. package/lib/node/event/index.d.ts.map +1 -0
  87. package/lib/node/event/index.js +18 -0
  88. package/lib/node/event/index.js.map +1 -0
  89. package/lib/node/index.d.ts +9 -0
  90. package/lib/node/index.d.ts.map +1 -0
  91. package/lib/node/index.js +28 -0
  92. package/lib/node/index.js.map +1 -0
  93. package/lib/node/module.d.ts +4 -0
  94. package/lib/node/module.d.ts.map +1 -0
  95. package/lib/node/module.js +6 -0
  96. package/lib/node/module.js.map +1 -0
  97. package/lib/node/pi/index.d.ts +3 -0
  98. package/lib/node/pi/index.d.ts.map +1 -0
  99. package/lib/node/pi/index.js +19 -0
  100. package/lib/node/pi/index.js.map +1 -0
  101. package/lib/node/pi/pi-sdk-util.d.ts +10 -0
  102. package/lib/node/pi/pi-sdk-util.d.ts.map +1 -0
  103. package/lib/node/pi/pi-sdk-util.js +23 -0
  104. package/lib/node/pi/pi-sdk-util.js.map +1 -0
  105. package/lib/node/pi/pi-types.d.ts +11 -0
  106. package/lib/node/pi/pi-types.d.ts.map +1 -0
  107. package/lib/node/pi/pi-types.js +3 -0
  108. package/lib/node/pi/pi-types.js.map +1 -0
  109. package/lib/node/runtime/index.d.ts +2 -0
  110. package/lib/node/runtime/index.d.ts.map +1 -0
  111. package/lib/node/runtime/index.js +18 -0
  112. package/lib/node/runtime/index.js.map +1 -0
  113. package/lib/node/runtime/model-runtime-provider.d.ts +12 -0
  114. package/lib/node/runtime/model-runtime-provider.d.ts.map +1 -0
  115. package/lib/node/runtime/model-runtime-provider.js +70 -0
  116. package/lib/node/runtime/model-runtime-provider.js.map +1 -0
  117. package/lib/node/session/agent-session-builtins.spec.d.ts +2 -0
  118. package/lib/node/session/agent-session-builtins.spec.d.ts.map +1 -0
  119. package/lib/node/session/agent-session-builtins.spec.js +55 -0
  120. package/lib/node/session/agent-session-builtins.spec.js.map +1 -0
  121. package/lib/node/session/agent-session-factory.d.ts +24 -0
  122. package/lib/node/session/agent-session-factory.d.ts.map +1 -0
  123. package/lib/node/session/agent-session-factory.js +181 -0
  124. package/lib/node/session/agent-session-factory.js.map +1 -0
  125. package/lib/node/session/agent-session-manager.d.ts +17 -0
  126. package/lib/node/session/agent-session-manager.d.ts.map +1 -0
  127. package/lib/node/session/agent-session-manager.js +75 -0
  128. package/lib/node/session/agent-session-manager.js.map +1 -0
  129. package/lib/node/session/agent-session-manager.spec.d.ts +33 -0
  130. package/lib/node/session/agent-session-manager.spec.d.ts.map +1 -0
  131. package/lib/node/session/agent-session-manager.spec.js +203 -0
  132. package/lib/node/session/agent-session-manager.spec.js.map +1 -0
  133. package/lib/node/session/index.d.ts +3 -0
  134. package/lib/node/session/index.d.ts.map +1 -0
  135. package/lib/node/session/index.js +19 -0
  136. package/lib/node/session/index.js.map +1 -0
  137. package/lib/node/test/faux-models.d.ts +29 -0
  138. package/lib/node/test/faux-models.d.ts.map +1 -0
  139. package/lib/node/test/faux-models.js +43 -0
  140. package/lib/node/test/faux-models.js.map +1 -0
  141. package/lib/node/test/index.d.ts +3 -0
  142. package/lib/node/test/index.d.ts.map +1 -0
  143. package/lib/node/test/index.js +19 -0
  144. package/lib/node/test/index.js.map +1 -0
  145. package/lib/node/test/test-container.d.ts +19 -0
  146. package/lib/node/test/test-container.d.ts.map +1 -0
  147. package/lib/node/test/test-container.js +28 -0
  148. package/lib/node/test/test-container.js.map +1 -0
  149. package/package.json +96 -4
  150. package/src/node/application-lifecycle.ts +13 -0
  151. package/src/node/coding-agent-protocol.ts +106 -0
  152. package/src/node/error/errors.ts +32 -0
  153. package/src/node/error/index.ts +1 -0
  154. package/src/node/event/agent-event-util.spec.ts +95 -0
  155. package/src/node/event/agent-event-util.ts +2 -0
  156. package/src/node/event/index.ts +1 -0
  157. package/src/node/index.ts +9 -0
  158. package/src/node/module.ts +4 -0
  159. package/src/node/pi/index.ts +2 -0
  160. package/src/node/pi/pi-sdk-util.ts +25 -0
  161. package/src/node/pi/pi-types.ts +12 -0
  162. package/src/node/runtime/index.ts +1 -0
  163. package/src/node/runtime/model-runtime-provider.ts +50 -0
  164. package/src/node/session/agent-session-builtins.spec.ts +59 -0
  165. package/src/node/session/agent-session-factory.ts +175 -0
  166. package/src/node/session/agent-session-manager.spec.ts +198 -0
  167. package/src/node/session/agent-session-manager.ts +64 -0
  168. package/src/node/session/index.ts +2 -0
  169. package/src/node/test/faux-models.ts +54 -0
  170. package/src/node/test/index.ts +2 -0
  171. package/src/node/test/test-container.ts +36 -0
@@ -0,0 +1,93 @@
1
+ import type { AgentSession, ExtensionAPI, McpServerConfig, ModelRuntime, ThinkingLevel } from './pi';
2
+ export declare const ModelRuntimeProvider: unique symbol;
3
+ export declare const ModelRuntimeContribution: unique symbol;
4
+ export declare const AgentExtension: unique symbol;
5
+ export declare const AgentSessionFactory: unique symbol;
6
+ export declare const AgentSessionManager: unique symbol;
7
+ /** Configuration key of {@link CodingAgentOptions}. */
8
+ export declare const CODING_AGENT_OPTIONS = "cell.ai.codingAgent";
9
+ /** `cell.ai.codingAgent`. Names follow the options of pi's `createAgentSession()`. */
10
+ export interface CodingAgentOptions {
11
+ /** Working directory of sessions: tools act here and project resources are found here. Default: the process directory. */
12
+ cwd?: string;
13
+ /** pi's global directory (auth.json, models.json, settings.json, extensions, skills). Default: `~/.pi/agent`. */
14
+ agentDir?: string;
15
+ /** `<provider>/<model id>`. Default: pi's settings, then the first model with credentials. */
16
+ model?: string;
17
+ thinkingLevel?: ThinkingLevel;
18
+ /** Allowlist of tool names; `*` matches any characters. Default: read, bash, edit, write and extension tools. */
19
+ tools?: string[];
20
+ excludeTools?: string[];
21
+ /** Replaces pi's system prompt. */
22
+ systemPrompt?: string;
23
+ /** Appended to the system prompt. */
24
+ appendSystemPrompt?: string;
25
+ /** Load extensions, skills, prompt templates and AGENTS.md from cwd and agentDir as the pi CLI does. Default: true. */
26
+ discoverResources?: boolean;
27
+ /** Write sessions as JSONL files where the pi CLI keeps them (`pi --resume` lists them). Default: false. */
28
+ persistSessions?: boolean;
29
+ /** Let the model runtime refresh model catalogs over the network when it is created. Default: false. */
30
+ allowModelNetwork?: boolean;
31
+ /** pi's MCP client: the servers of mcp.json (agentDir, and the project once trusted) plus `servers`. */
32
+ mcp?: CodingAgentMcpOptions;
33
+ /** pi's codemode tool: the model writes JavaScript that calls tools in a sandbox. `only` hides the tools codemode can call. Default: off. */
34
+ codemode?: 'off' | 'on' | 'only';
35
+ /** pi's tool_search tool, which finds tools that are not declared to the model. Default: false. */
36
+ toolSearch?: boolean;
37
+ /** API keys by provider id, e.g. `anthropic: "${ env.MY_KEY }"`. Empty values are ignored. */
38
+ apiKeys?: Record<string, string | undefined>;
39
+ }
40
+ export interface CodingAgentMcpOptions {
41
+ /** Default: false. */
42
+ enabled?: boolean;
43
+ /** MCP servers by name, in the `mcpServers` format of mcp.json (`command`/`args`/`env`, or `url`/`headers`). */
44
+ servers?: Record<string, McpServerConfig>;
45
+ /** How long the first prompt waits for servers with `direct` exposure that are still connecting. Default: 10000. */
46
+ startupWaitMs?: number;
47
+ }
48
+ /** Options of one session; they override `cell.ai.codingAgent`. */
49
+ export type AgentSessionOptions = Pick<CodingAgentOptions, 'cwd' | 'model' | 'thinkingLevel' | 'tools' | 'excludeTools' | 'systemPrompt' | 'appendSystemPrompt'>;
50
+ export interface AgentSessionInfo {
51
+ id: string;
52
+ cwd: string;
53
+ /** `<provider>/<model id>`, undefined when no model is available. */
54
+ model?: string;
55
+ thinkingLevel: ThinkingLevel;
56
+ streaming: boolean;
57
+ messageCount: number;
58
+ createdAt: number;
59
+ }
60
+ /** The pi model runtime (catalogs and credentials) shared by all sessions. */
61
+ export interface ModelRuntimeProvider {
62
+ provide(): Promise<ModelRuntime>;
63
+ }
64
+ /** Configures the model runtime once it is created: register providers, set credentials. */
65
+ export interface ModelRuntimeContribution {
66
+ configure(runtime: ModelRuntime): void | Promise<void>;
67
+ }
68
+ /**
69
+ * A pi extension as a Cell component: `register` runs for each new session with pi's `ExtensionAPI`
70
+ * (`registerTool`, `registerCommand`, `on(event)`, ...), and the component can use injected services.
71
+ */
72
+ export interface AgentExtension {
73
+ /** Name in pi's diagnostics. Default: the class name. */
74
+ readonly name?: string;
75
+ register(pi: ExtensionAPI): void | Promise<void>;
76
+ }
77
+ /** Creates pi sessions from `cell.ai.codingAgent`, the model runtime and the {@link AgentExtension}s. */
78
+ export interface AgentSessionFactory {
79
+ create(options?: AgentSessionOptions): Promise<AgentSession>;
80
+ }
81
+ /** Live sessions of the application, by pi's session id. They are disposed when the application stops. */
82
+ export interface AgentSessionManager {
83
+ create(options?: AgentSessionOptions): Promise<AgentSession>;
84
+ /** Throws {@link AgentSessionNotFoundError} for an unknown id. */
85
+ get(id: string): AgentSession;
86
+ find(id: string): AgentSession | undefined;
87
+ info(id: string): AgentSessionInfo;
88
+ list(): AgentSessionInfo[];
89
+ /** Aborts the running work of the session and forgets it. */
90
+ dispose(id: string): void;
91
+ disposeAll(): void;
92
+ }
93
+ //# sourceMappingURL=coding-agent-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coding-agent-protocol.d.ts","sourceRoot":"","sources":["../../src/node/coding-agent-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAErG,eAAO,MAAM,oBAAoB,eAAiC,CAAC;AACnE,eAAO,MAAM,wBAAwB,eAAqC,CAAC;AAC3E,eAAO,MAAM,cAAc,eAA2B,CAAC;AACvD,eAAO,MAAM,mBAAmB,eAAgC,CAAC;A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G,gBAAgB,CAAC;IACnC,IAAI,IAAI,gBAAgB,EAAE,CAAC;IAC3B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,IAAI,IAAI,CAAC;CACtB"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CODING_AGENT_OPTIONS = exports.AgentSessionManager = exports.AgentSessionFactory = exports.AgentExtension = exports.ModelRuntimeContribution = exports.ModelRuntimeProvider = void 0;
4
+ exports.ModelRuntimeProvider = Symbol('ModelRuntimeProvider');
5
+ exports.ModelRuntimeContribution = Symbol('ModelRuntimeContribution');
6
+ exports.AgentExtension = Symbol('AgentExtension');
7
+ exports.AgentSessionFactory = Symbol('AgentSessionFactory');
8
+ exports.AgentSessionManager = Symbol('AgentSessionManager');
9
+ /** Configuration key of {@link CodingAgentOptions}. */
10
+ exports.CODING_AGENT_OPTIONS = 'cell.ai.codingAgent';
11
+ //# sourceMappingURL=coding-agent-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coding-agent-protocol.js","sourceRoot":"","sources":["../../src/node/coding-agent-protocol.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AACtD,QAAA,wBAAwB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAC9D,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAC1C,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACpD,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAEjE,uDAAuD;AAC1C,QAAA,oBAAoB,GAAG,qBAAqB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { CustomError } from '@celljs/core';
2
+ export declare class CodingAgentError extends CustomError {
3
+ }
4
+ export declare class AgentSessionNotFoundError extends CodingAgentError {
5
+ readonly sessionId: string;
6
+ constructor(sessionId: string);
7
+ }
8
+ export declare class AgentModelNotFoundError extends CodingAgentError {
9
+ readonly model: string;
10
+ readonly available: string[];
11
+ constructor(model: string, available: string[]);
12
+ }
13
+ export declare class AgentExtensionError extends CodingAgentError {
14
+ readonly errors: {
15
+ path: string;
16
+ error: string;
17
+ }[];
18
+ constructor(errors: {
19
+ path: string;
20
+ error: string;
21
+ }[]);
22
+ }
23
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/node/error/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,qBAAa,gBAAiB,SAAQ,WAAW;CAAG;AAEpD,qBAAa,yBAA0B,SAAQ,gBAAgB;IAC/C,QAAQ,CAAC,SAAS,EAAE,MAAM;IAAtC,YAAqB,SAAS,EAAE,MAAM,EAIrC;CACJ;AAED,qBAAa,uBAAwB,SAAQ,gBAAgB;IAErD,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE;IAFhC,YACa,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EAAE,EAS/B;CACJ;AAED,qBAAa,mBAAoB,SAAQ,gBAAgB;IACzC,QAAQ,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE;IAA9D,YAAqB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,EAE7D;CACJ"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AgentExtensionError = exports.AgentModelNotFoundError = exports.AgentSessionNotFoundError = exports.CodingAgentError = void 0;
4
+ const core_1 = require("@celljs/core");
5
+ class CodingAgentError extends core_1.CustomError {
6
+ }
7
+ exports.CodingAgentError = CodingAgentError;
8
+ class AgentSessionNotFoundError extends CodingAgentError {
9
+ constructor(sessionId) {
10
+ super(`No agent session was found with the id ${sessionId}. Create one with AgentSessionManager.create(); sessions live in memory and end when the application stops.`);
11
+ this.sessionId = sessionId;
12
+ }
13
+ }
14
+ exports.AgentSessionNotFoundError = AgentSessionNotFoundError;
15
+ class AgentModelNotFoundError extends CodingAgentError {
16
+ constructor(model, available) {
17
+ super(`The model ${model} is not known to pi. Use "<provider>/<model id>"${available.length
18
+ ? `, one of: ${available.join(', ')}`
19
+ : '; no model has credentials yet: set the API key of a provider (e.g. ANTHROPIC_API_KEY) or cell.ai.codingAgent.apiKeys'}.`);
20
+ this.model = model;
21
+ this.available = available;
22
+ }
23
+ }
24
+ exports.AgentModelNotFoundError = AgentModelNotFoundError;
25
+ class AgentExtensionError extends CodingAgentError {
26
+ constructor(errors) {
27
+ super(`Agent extensions failed to load: ${errors.map(e => `${e.path}: ${e.error}`).join('; ')}`);
28
+ this.errors = errors;
29
+ }
30
+ }
31
+ exports.AgentExtensionError = AgentExtensionError;
32
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/node/error/errors.ts"],"names":[],"mappings":";;;AAAA,uCAA2C;AAE3C,sBAA8B,SAAQ,kBAAW;CAAG;;AAEpD,+BAAuC,SAAQ,gBAAgB;IAC3D,YAAqB,SAAiB;QAClC,KAAK,CACD,0CAA0C,SAAS,6GAA6G,CACnK,CAAC;yBAHe,SAAS;IAI9B,CAAC;CACJ;;AAED,6BAAqC,SAAQ,gBAAgB;IACzD,YACa,KAAa,EACb,SAAmB;QAE5B,KAAK,CACD,aAAa,KAAK,mDACd,SAAS,CAAC,MAAM;YACZ,CAAC,CAAC,aAAa,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACrC,CAAC,CAAC,uHACV,GAAG,CACN,CAAC;qBATO,KAAK;yBACL,SAAS;IAStB,CAAC;CACJ;;AAED,yBAAiC,SAAQ,gBAAgB;IACrD,YAAqB,MAAyC;QAC1D,KAAK,CAAC,oCAAoC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;sBADhF,MAAM;IAE3B,CAAC;CACJ"}
@@ -0,0 +1,2 @@
1
+ export * from './errors';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/error/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./errors"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/error/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
@@ -0,0 +1,2 @@
1
+ export { type AgentErrorEvent, type AgentEventSource, AgentEventUtil, type AgentWireEvent, type EventStreamResponse } from '@celljs/ai-agent';
2
+ //# sourceMappingURL=agent-event-util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-event-util.d.ts","sourceRoot":"","sources":["../../../src/node/event/agent-event-util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AgentEventUtil = void 0;
4
+ // Events of coding agent sessions have the shape of pi-agent-core's, so @celljs/ai-agent's streaming serves both.
5
+ var ai_agent_1 = require("@celljs/ai-agent");
6
+ Object.defineProperty(exports, "AgentEventUtil", { enumerable: true, get: function () { return ai_agent_1.AgentEventUtil; } });
7
+ //# sourceMappingURL=agent-event-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-event-util.js","sourceRoot":"","sources":["../../../src/node/event/agent-event-util.ts"],"names":[],"mappings":";;;AAAA,kHAAkH;AAClH,6CAA8I;AAAxF,0GAAA,cAAc,OAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=agent-event-util.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-event-util.spec.d.ts","sourceRoot":"","sources":["../../../src/node/event/agent-event-util.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const bun_test_1 = require("bun:test");
4
+ const chai_1 = require("chai");
5
+ const coding_agent_protocol_1 = require("../coding-agent-protocol");
6
+ const test_1 = require("../test");
7
+ const agent_event_util_1 = require("./agent-event-util");
8
+ class RecordingResponse {
9
+ constructor() {
10
+ this.headers = {};
11
+ this.chunks = '';
12
+ this.writableEnded = false;
13
+ }
14
+ setHeader(name, value) {
15
+ this.headers[name.toLowerCase()] = value;
16
+ }
17
+ write(chunk) {
18
+ (0, chai_1.expect)(this.writableEnded).to.equal(false);
19
+ this.chunks += chunk;
20
+ }
21
+ end() {
22
+ this.writableEnded = true;
23
+ }
24
+ get frames() {
25
+ return this.chunks
26
+ .split('\n\n')
27
+ .filter(Boolean)
28
+ .map(frame => {
29
+ const [event, data] = frame.split('\n');
30
+ return { event: event.slice('event: '.length), data: JSON.parse(data.slice('data: '.length)) };
31
+ });
32
+ }
33
+ }
34
+ (0, bun_test_1.describe)('AgentEventUtil', () => {
35
+ let test;
36
+ (0, bun_test_1.afterEach)(() => test === null || test === void 0 ? void 0 : test.container.get(coding_agent_protocol_1.AgentSessionManager).disposeAll());
37
+ (0, bun_test_1.describe)('toWire', () => {
38
+ const usage = { input: 1, output: 2 };
39
+ const update = (assistantMessageEvent) => ({ type: 'message_update', message: { role: 'assistant', usage, content: [] }, assistantMessageEvent });
40
+ (0, bun_test_1.it)('keeps the delta and the usage of message_update', () => {
41
+ const wire = agent_event_util_1.AgentEventUtil.toWire(update({ type: 'text_delta', contentIndex: 0, delta: 'Hi', partial: { content: [] } }));
42
+ (0, chai_1.expect)(wire).to.deep.equal({ type: 'message_update', usage, assistantMessageEvent: { type: 'text_delta', contentIndex: 0, delta: 'Hi' } });
43
+ });
44
+ (0, bun_test_1.it)('names the tool of toolcall_start', () => {
45
+ const partial = {
46
+ content: [
47
+ { type: 'text', text: '' },
48
+ { type: 'toolCall', id: 'call-1', name: 'greet', arguments: {} },
49
+ ],
50
+ };
51
+ const wire = agent_event_util_1.AgentEventUtil.toWire(update({ type: 'toolcall_start', contentIndex: 1, partial }));
52
+ (0, chai_1.expect)(wire.assistantMessageEvent).to.deep.equal({ type: 'toolcall_start', contentIndex: 1, id: 'call-1', toolName: 'greet' });
53
+ });
54
+ (0, bun_test_1.it)('leaves other events unchanged', () => {
55
+ const event = { type: 'agent_settled', aborted: false };
56
+ (0, chai_1.expect)(agent_event_util_1.AgentEventUtil.toWire(event)).to.equal(event);
57
+ });
58
+ });
59
+ (0, bun_test_1.describe)('stream', () => {
60
+ (0, bun_test_1.it)('writes the events of a run as Server-Sent Events and ends the response', async () => {
61
+ test = await (0, test_1.createTestContainer)();
62
+ test.faux.reply('Hello from pi');
63
+ const session = await test.container.get(coding_agent_protocol_1.AgentSessionManager).create();
64
+ const response = new RecordingResponse();
65
+ await agent_event_util_1.AgentEventUtil.stream(session, response, () => session.prompt('hi'));
66
+ (0, chai_1.expect)(response.headers['content-type']).to.equal('text/event-stream; charset=utf-8');
67
+ (0, chai_1.expect)(response.writableEnded).to.equal(true);
68
+ const frames = response.frames;
69
+ (0, chai_1.expect)(frames[0].event).to.equal('agent_start');
70
+ (0, chai_1.expect)(frames[frames.length - 1]).to.deep.equal({ event: 'agent_settled', data: { type: 'agent_settled', aborted: false } });
71
+ const deltas = frames.filter(f => { var _a; return ((_a = f.data.assistantMessageEvent) === null || _a === void 0 ? void 0 : _a.type) === 'text_delta'; });
72
+ (0, chai_1.expect)(deltas.map(f => f.data.assistantMessageEvent.delta).join('')).to.equal('Hello from pi');
73
+ (0, chai_1.expect)(frames.every(f => { var _a; return f.event === f.data.type && !((_a = f.data.assistantMessageEvent) === null || _a === void 0 ? void 0 : _a.partial); })).to.equal(true);
74
+ });
75
+ (0, bun_test_1.it)('sends an error event when the run fails', async () => {
76
+ test = await (0, test_1.createTestContainer)();
77
+ const session = await test.container.get(coding_agent_protocol_1.AgentSessionManager).create();
78
+ const response = new RecordingResponse();
79
+ await agent_event_util_1.AgentEventUtil.stream(session, response, () => Promise.reject(new Error('no credits')));
80
+ (0, chai_1.expect)(response.frames).to.deep.equal([{ event: 'error', data: { type: 'error', message: 'no credits' } }]);
81
+ (0, chai_1.expect)(response.writableEnded).to.equal(true);
82
+ });
83
+ });
84
+ });
85
+ //# sourceMappingURL=agent-event-util.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-event-util.spec.js","sourceRoot":"","sources":["../../../src/node/event/agent-event-util.spec.ts"],"names":[],"mappings":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E;YACrD,IAAI,GAAG,MAAM,IAAA,0BAAmB,GAAE,CAAC;YACnC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAsB,2CAAmB,CAAC,CAAC,MAAM,EAAE,CAAC;YAC5F,MAAM,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAC;YACzC,MAAM,iCAAc,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC9F,IAAA,aAAM,EAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;YAC5G,IAAA,aAAM,EAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './agent-event-util';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/event/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./agent-event-util"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/event/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
@@ -0,0 +1,9 @@
1
+ export { AgentTool } from '@celljs/ai-agent';
2
+ export * from './application-lifecycle';
3
+ export * from './coding-agent-protocol';
4
+ export * from './error';
5
+ export * from './event';
6
+ export * from './pi';
7
+ export * from './runtime';
8
+ export * from './session';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC;AACrB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.AgentTool = void 0;
18
+ // Tools are written once, as @celljs/ai-agent's AgentTool components, for agents and coding agent sessions.
19
+ var ai_agent_1 = require("@celljs/ai-agent");
20
+ Object.defineProperty(exports, "AgentTool", { enumerable: true, get: function () { return ai_agent_1.AgentTool; } });
21
+ __exportStar(require("./application-lifecycle"), exports);
22
+ __exportStar(require("./coding-agent-protocol"), exports);
23
+ __exportStar(require("./error"), exports);
24
+ __exportStar(require("./event"), exports);
25
+ __exportStar(require("./pi"), exports);
26
+ __exportStar(require("./runtime"), exports);
27
+ __exportStar(require("./session"), exports);
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4GAA4G;AAC5G,6CAA6C;AAApC,qGAAA,SAAS,OAAA;AAClB,0DAAwC;AACxC,0DAAwC;AACxC,0CAAwB;AACxB,0CAAwB;AACxB,uCAAqB;AACrB,4CAA0B;AAC1B,4CAA0B"}
@@ -0,0 +1,4 @@
1
+ import './index';
2
+ declare const _default: import("inversify").interfaces.ContainerModule;
3
+ export default _default;
4
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@celljs/core");
4
+ require("./index");
5
+ exports.default = (0, core_1.autoBind)();
6
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":";;AAAA,uCAAwC;AACxC,mBAAiB;kBAEF,IAAA,eAAQ,GAAE"}
@@ -0,0 +1,3 @@
1
+ export * from './pi-sdk-util';
2
+ export * from './pi-types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/pi/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./pi-sdk-util"), exports);
18
+ __exportStar(require("./pi-types"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/pi/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,6CAA2B"}
@@ -0,0 +1,10 @@
1
+ /** The module namespace of `@earendil-works/pi-coding-agent`. */
2
+ export type PiSdk = typeof import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } });
3
+ export declare namespace PiSdkUtil {
4
+ /**
5
+ * Loads pi once. pi is an ES module package, so both builds of this package load it with a dynamic
6
+ * `import()`, which also keeps it out of the startup of applications that never create a session.
7
+ */
8
+ function load(): Promise<PiSdk>;
9
+ }
10
+ //# sourceMappingURL=pi-sdk-util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi-sdk-util.d.ts","sourceRoot":"","sources":["../../../src/node/pi/pi-sdk-util.ts"],"names":[],"mappings":"AAEA,iEAAiE;AACjE,MAAM,MAAM,KAAK,GAAG,cAAc,iCAAiC,EAAU,UAAE,iBAAiB,EAAE,QAAQ,IAAE,CAAE,CAAC;AAE/G,yBAAiB,SAAS,CAAC;IAGvB;;;OAGG;IACH,SAAgB,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,CAWrC;CACJ"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PiSdkUtil = void 0;
4
+ const error_1 = require("../error");
5
+ var PiSdkUtil;
6
+ (function (PiSdkUtil) {
7
+ let sdk;
8
+ /**
9
+ * Loads pi once. pi is an ES module package, so both builds of this package load it with a dynamic
10
+ * `import()`, which also keeps it out of the startup of applications that never create a session.
11
+ */
12
+ function load() {
13
+ if (!sdk) {
14
+ sdk = import('@earendil-works/pi-coding-agent').catch(cause => {
15
+ sdk = undefined;
16
+ throw new error_1.CodingAgentError('Cannot load @earendil-works/pi-coding-agent. Install it next to @celljs/ai-coding-agent; it needs Node.js >= 22.19.0 or Bun.', { cause });
17
+ });
18
+ }
19
+ return sdk;
20
+ }
21
+ PiSdkUtil.load = load;
22
+ })(PiSdkUtil || (exports.PiSdkUtil = PiSdkUtil = {}));
23
+ //# sourceMappingURL=pi-sdk-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi-sdk-util.js","sourceRoot":"","sources":["../../../src/node/pi/pi-sdk-util.ts"],"names":[],"mappings":";;;AAAA,oCAA4C;AAK5C,IAAiB,SAAS,CAmBzB;AAnBD,WAAiB,SAAS;IACtB,IAAI,GAA+B,CAAC;IAEpC;;;OAGG;IACH,SAAgB,IAAI;QAChB,IAAI,CAAC,GAAG,EAAE,CAAC;YACP,GAAG,GAAG,MAAM,CAAC,iCAAiC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBAC1D,GAAG,GAAG,SAAS,CAAC;gBAChB,MAAM,IAAI,wBAAgB,CACtB,8HAA8H,EAC9H,EAAE,KAAK,EAAE,CACZ,CAAC;YACN,CAAC,CAAC,CAAC;QACP,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAXe,UAAA,IAAI,OAWnB,CAAA;AACL,CAAC,EAnBgB,SAAS,aAAT,SAAS,GAAT,SAAS,QAmBzB"}
@@ -0,0 +1,11 @@
1
+ export type AgentSession = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).AgentSession;
2
+ export type ModelRuntime = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).ModelRuntime;
3
+ export type AgentSessionEvent = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).AgentSessionEvent;
4
+ export type JsonAgentSessionEvent = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).JsonAgentSessionEvent;
5
+ export type ExtensionAPI = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).ExtensionAPI;
6
+ export type ExtensionFactory = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).ExtensionFactory;
7
+ export type ToolDefinition = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).ToolDefinition;
8
+ export type McpServerConfig = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).McpServerConfig;
9
+ export type ThinkingLevel = AgentSession['thinkingLevel'];
10
+ export type Model = NonNullable<AgentSession['model']>;
11
+ //# sourceMappingURL=pi-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi-types.d.ts","sourceRoot":"","sources":["../../../src/node/pi/pi-types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,OAAO,iCAAiC,EAAU,UAAE,iBAAiB,EAAE,QAAQ,IAAE,EAAG,YAAY,CAAC;AAC5H,MAAM,MAAM,YAAY,GAAG,OAAO,iCAAiC,EAAU,UAAE,iBAAiB,EAAE,QAAQ,IAAE,EAAG,YAAY,CAAC;AAC5H,MAAM,MAAM,iBAAiB,GAAG,OAAO,iCAAiC,EAAU,UAAE,iBAAiB,EAAE,QAAQ,IAAE,EAAG,iBAAiB,CAAC;AACtI,MAAM,MAAM,qBAAqB,GAAG,OAAO,iCAAiC,EAAU,UAAE,iBAAiB,EAAE,QAAQ,IAAE,EAAG,qBAAqB,CAAC;AAC9I,MAAM,MAAM,YAAY,GAAG,OAAO,iCAAiC,EAAU,UAAE,iBAAiB,EAAE,QAAQ,IAAE,EAAG,YAAY,CAAC;AAC5H,MAAM,MAAM,gBAAgB,GAAG,OAAO,iCAAiC,EAAU,UAAE,iBAAiB,EAAE,QAAQ,IAAE,EAAG,gBAAgB,CAAC;AACpI,MAAM,MAAM,cAAc,GAAG,OAAO,iCAAiC,EAAU,UAAE,iBAAiB,EAAE,QAAQ,IAAE,EAAG,cAAc,CAAC;AAChI,MAAM,MAAM,eAAe,GAAG,OAAO,iCAAiC,EAAU,UAAE,iBAAiB,EAAE,QAAQ,IAAE,EAAG,eAAe,CAAC;AAClI,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;AAC1D,MAAM,MAAM,KAAK,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=pi-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi-types.js","sourceRoot":"","sources":["../../../src/node/pi/pi-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './model-runtime-provider';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./model-runtime-provider"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/runtime/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC"}
@@ -0,0 +1,12 @@
1
+ import { type PiOptions } from '@celljs/ai-pi';
2
+ import { type CodingAgentOptions, ModelRuntimeContribution, ModelRuntimeProvider } from '../coding-agent-protocol';
3
+ import { type ModelRuntime } from '../pi';
4
+ export declare class DefaultModelRuntimeProvider implements ModelRuntimeProvider {
5
+ protected readonly options?: CodingAgentOptions;
6
+ protected readonly piOptions?: PiOptions;
7
+ protected readonly contributions: ModelRuntimeContribution[];
8
+ protected runtime?: Promise<ModelRuntime>;
9
+ provide(): Promise<ModelRuntime>;
10
+ protected doProvide(): Promise<ModelRuntime>;
11
+ }
12
+ //# sourceMappingURL=model-runtime-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-runtime-provider.d.ts","sourceRoot":"","sources":["../../../src/node/runtime/model-runtime-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAwB,KAAK,kBAAkB,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACzI,OAAO,EAAE,KAAK,YAAY,EAAa,MAAM,OAAO,CAAC;AAErD,qBACa,2BAA4B,YAAW,oBAAoB;IAEpE,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAGhD,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAIzC,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,wBAAwB,EAAE,CAAM;IAElE,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE1C,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC,CAW/B;IAED,UAAgB,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC,CAejD;CACJ"}