@agentxjs/types 0.0.9 → 0.2.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 (86) hide show
  1. package/dist/Agent-BXUYGlWZ.d.cts +510 -0
  2. package/dist/Agent-CaSxMF_E.d.ts +510 -0
  3. package/dist/CommandEvent-CbXzPolX.d.ts +495 -0
  4. package/dist/CommandEvent-DCdk7lzX.d.cts +495 -0
  5. package/dist/Container-DR-1g44i.d.ts +641 -0
  6. package/dist/Container-dBDOcjhk.d.cts +641 -0
  7. package/dist/ContentPart-CqOh-rI1.d.ts +19 -0
  8. package/dist/ContentPart-DEFnYXCU.d.cts +19 -0
  9. package/dist/DriveableEvent-Bj7nn-Uk.d.ts +161 -0
  10. package/dist/DriveableEvent-CCMC1h_C.d.cts +161 -0
  11. package/dist/ErrorMessage-BoIh3MIO.d.cts +24 -0
  12. package/dist/ErrorMessage-BoIh3MIO.d.ts +24 -0
  13. package/dist/ImageRecord-Cn0VcJWk.d.cts +71 -0
  14. package/dist/ImageRecord-Cn0VcJWk.d.ts +71 -0
  15. package/dist/LoggerFactory-DZtw0M7U.d.cts +129 -0
  16. package/dist/LoggerFactory-DZtw0M7U.d.ts +129 -0
  17. package/dist/Message-Crh81uLL.d.cts +45 -0
  18. package/dist/Message-DWQUt647.d.ts +45 -0
  19. package/dist/Persistence-BQkdKomV.d.ts +230 -0
  20. package/dist/Persistence-Dr70FEBh.d.cts +230 -0
  21. package/dist/StopReason-D4DthB1h.d.cts +39 -0
  22. package/dist/StopReason-D4DthB1h.d.ts +39 -0
  23. package/dist/SystemEvent-CPvvxdMQ.d.cts +159 -0
  24. package/dist/SystemEvent-CPvvxdMQ.d.ts +159 -0
  25. package/dist/ToolResultMessage-CDG2L7Zv.d.ts +332 -0
  26. package/dist/ToolResultMessage-CRKMSf5d.d.cts +332 -0
  27. package/dist/agent-internal.cjs +19 -0
  28. package/dist/agent-internal.cjs.map +1 -0
  29. package/dist/agent-internal.d.cts +52 -0
  30. package/dist/agent-internal.d.ts +52 -0
  31. package/dist/agent-internal.js +1 -0
  32. package/dist/agent-internal.js.map +1 -0
  33. package/dist/agent.cjs +70 -0
  34. package/dist/agent.cjs.map +1 -0
  35. package/dist/agent.d.cts +229 -0
  36. package/dist/agent.d.ts +229 -0
  37. package/dist/agent.js +41 -0
  38. package/dist/agent.js.map +1 -0
  39. package/dist/agentx.cjs +38 -0
  40. package/dist/agentx.cjs.map +1 -0
  41. package/dist/agentx.d.cts +311 -0
  42. package/dist/agentx.d.ts +311 -0
  43. package/dist/agentx.js +12 -0
  44. package/dist/agentx.js.map +1 -0
  45. package/dist/chunk-2QHAIM3V.js +1 -0
  46. package/dist/chunk-2QHAIM3V.js.map +1 -0
  47. package/dist/common.cjs +19 -0
  48. package/dist/common.cjs.map +1 -0
  49. package/dist/common.d.cts +43 -0
  50. package/dist/common.d.ts +43 -0
  51. package/dist/common.js +2 -0
  52. package/dist/common.js.map +1 -0
  53. package/dist/event.cjs +184 -0
  54. package/dist/event.cjs.map +1 -0
  55. package/dist/event.d.cts +769 -0
  56. package/dist/event.d.ts +769 -0
  57. package/dist/event.js +134 -0
  58. package/dist/event.js.map +1 -0
  59. package/dist/index-CjFNcCxR.d.cts +299 -0
  60. package/dist/index-usKuk41S.d.ts +299 -0
  61. package/dist/index.cjs +2 -185
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/index.d.cts +8 -5267
  64. package/dist/index.d.ts +8 -5267
  65. package/dist/index.js +1 -150
  66. package/dist/index.js.map +1 -1
  67. package/dist/network.cjs +19 -0
  68. package/dist/network.cjs.map +1 -0
  69. package/dist/network.d.cts +168 -0
  70. package/dist/network.d.ts +168 -0
  71. package/dist/network.js +1 -0
  72. package/dist/network.js.map +1 -0
  73. package/dist/runtime-internal.cjs +19 -0
  74. package/dist/runtime-internal.cjs.map +1 -0
  75. package/dist/runtime-internal.d.cts +943 -0
  76. package/dist/runtime-internal.d.ts +943 -0
  77. package/dist/runtime-internal.js +1 -0
  78. package/dist/runtime-internal.js.map +1 -0
  79. package/dist/runtime.cjs +19 -0
  80. package/dist/runtime.cjs.map +1 -0
  81. package/dist/runtime.d.cts +217 -0
  82. package/dist/runtime.d.ts +217 -0
  83. package/dist/runtime.js +1 -0
  84. package/dist/runtime.js.map +1 -0
  85. package/package.json +82 -10
  86. package/LICENSE +0 -21
package/dist/index.js CHANGED
@@ -1,151 +1,2 @@
1
- // src/common/logger/LogLevel.ts
2
- var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
3
- LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
4
- LogLevel2[LogLevel2["INFO"] = 1] = "INFO";
5
- LogLevel2[LogLevel2["WARN"] = 2] = "WARN";
6
- LogLevel2[LogLevel2["ERROR"] = 3] = "ERROR";
7
- LogLevel2[LogLevel2["SILENT"] = 4] = "SILENT";
8
- return LogLevel2;
9
- })(LogLevel || {});
10
-
11
- // src/llm/StopReason.ts
12
- function isStopReason(value) {
13
- return [
14
- "end_turn",
15
- "max_tokens",
16
- "tool_use",
17
- "stop_sequence",
18
- "content_filter",
19
- "error",
20
- "other"
21
- ].includes(value);
22
- }
23
-
24
- // src/mcp/McpProtocol.ts
25
- var LATEST_PROTOCOL_VERSION = "2025-06-18";
26
- var SUPPORTED_PROTOCOL_VERSIONS = ["2025-06-18", "2025-03-26", "2024-11-05"];
27
-
28
- // src/guards/MessageGuards.ts
29
- function isUserMessage(message) {
30
- return message.subtype === "user";
31
- }
32
- function isAssistantMessage(message) {
33
- return message.subtype === "assistant";
34
- }
35
- function isSystemMessage(message) {
36
- return message.subtype === "system";
37
- }
38
- function isToolCallMessage(message) {
39
- return message.subtype === "tool-call";
40
- }
41
- function isToolResultMessage(message) {
42
- return message.subtype === "tool-result";
43
- }
44
-
45
- // src/guards/ContentPartGuards.ts
46
- function isTextPart(part) {
47
- return part.type === "text";
48
- }
49
- function isThinkingPart(part) {
50
- return part.type === "thinking";
51
- }
52
- function isImagePart(part) {
53
- return part.type === "image";
54
- }
55
- function isFilePart(part) {
56
- return part.type === "file";
57
- }
58
- function isToolCallPart(part) {
59
- return part.type === "tool-call";
60
- }
61
- function isToolResultPart(part) {
62
- return part.type === "tool-result";
63
- }
64
-
65
- // src/guards/EventGuards.ts
66
- var STATE_EVENT_TYPE_NAMES = [
67
- "agent_initializing",
68
- "agent_ready",
69
- "agent_destroyed",
70
- "conversation_queued",
71
- "conversation_start",
72
- "conversation_thinking",
73
- "conversation_responding",
74
- "conversation_end",
75
- "conversation_interrupted",
76
- "tool_planned",
77
- "tool_executing",
78
- "tool_completed",
79
- "tool_failed",
80
- "error_occurred"
81
- ];
82
- var STATE_EVENT_TYPES = new Set(STATE_EVENT_TYPE_NAMES);
83
- var MESSAGE_EVENT_TYPE_NAMES = [
84
- "user_message",
85
- "assistant_message",
86
- "tool_call_message",
87
- "tool_result_message"
88
- ];
89
- var MESSAGE_EVENT_TYPES = new Set(MESSAGE_EVENT_TYPE_NAMES);
90
- var ERROR_EVENT_TYPE_NAMES = ["error"];
91
- var ERROR_EVENT_TYPES = new Set(ERROR_EVENT_TYPE_NAMES);
92
- var TURN_EVENT_TYPE_NAMES = ["turn_request", "turn_response"];
93
- var TURN_EVENT_TYPES = new Set(TURN_EVENT_TYPE_NAMES);
94
- var STREAM_EVENT_TYPE_NAMES = [
95
- "message_start",
96
- "message_delta",
97
- "message_stop",
98
- "text_content_block_start",
99
- "text_delta",
100
- "text_content_block_stop",
101
- "tool_use_content_block_start",
102
- "input_json_delta",
103
- "tool_use_content_block_stop",
104
- "tool_call",
105
- "tool_result",
106
- "interrupted"
107
- ];
108
- var STREAM_EVENT_TYPES = new Set(STREAM_EVENT_TYPE_NAMES);
109
- function isStateEvent(event) {
110
- return "type" in event && STATE_EVENT_TYPES.has(event.type);
111
- }
112
- function isMessageEvent(event) {
113
- return "type" in event && MESSAGE_EVENT_TYPES.has(event.type);
114
- }
115
- function isTurnEvent(event) {
116
- return "type" in event && TURN_EVENT_TYPES.has(event.type);
117
- }
118
- function isStreamEvent(event) {
119
- return "type" in event && STREAM_EVENT_TYPES.has(event.type);
120
- }
121
- function isErrorEvent(event) {
122
- return "type" in event && ERROR_EVENT_TYPES.has(event.type);
123
- }
124
- export {
125
- ERROR_EVENT_TYPE_NAMES,
126
- LATEST_PROTOCOL_VERSION,
127
- LogLevel,
128
- MESSAGE_EVENT_TYPE_NAMES,
129
- STATE_EVENT_TYPE_NAMES,
130
- STREAM_EVENT_TYPE_NAMES,
131
- SUPPORTED_PROTOCOL_VERSIONS,
132
- TURN_EVENT_TYPE_NAMES,
133
- isAssistantMessage,
134
- isErrorEvent,
135
- isFilePart,
136
- isImagePart,
137
- isMessageEvent,
138
- isStateEvent,
139
- isStopReason,
140
- isStreamEvent,
141
- isSystemMessage,
142
- isTextPart,
143
- isThinkingPart,
144
- isToolCallMessage,
145
- isToolCallPart,
146
- isToolResultMessage,
147
- isToolResultPart,
148
- isTurnEvent,
149
- isUserMessage
150
- };
1
+ import "./chunk-2QHAIM3V.js";
151
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common/logger/LogLevel.ts","../src/llm/StopReason.ts","../src/mcp/McpProtocol.ts","../src/guards/MessageGuards.ts","../src/guards/ContentPartGuards.ts","../src/guards/EventGuards.ts"],"sourcesContent":["/**\n * LogLevel - Standard log level enumeration\n *\n * Defines the severity levels for logging.\n */\n\nexport enum LogLevel {\n DEBUG = 0,\n INFO = 1,\n WARN = 2,\n ERROR = 3,\n SILENT = 4,\n}\n","/**\n * Reason why the LLM stopped generating\n *\n * Based on common stop reasons across multiple LLM providers:\n * - Anthropic Claude: end_turn, max_tokens, tool_use, stop_sequence\n * - OpenAI: stop, length, tool_calls, content_filter\n * - Vercel AI SDK: stop, length, tool-calls, content-filter, error, other\n */\nexport type StopReason =\n /**\n * Natural completion - model decided to stop\n */\n | \"end_turn\"\n\n /**\n * Reached maximum token limit\n */\n | \"max_tokens\"\n\n /**\n * Model requested tool usage\n */\n | \"tool_use\"\n\n /**\n * Encountered a custom stop sequence\n */\n | \"stop_sequence\"\n\n /**\n * Content filter triggered\n */\n | \"content_filter\"\n\n /**\n * Error occurred during generation\n */\n | \"error\"\n\n /**\n * Other/unknown reason\n */\n | \"other\";\n\n/**\n * Type guard to check if a string is a valid StopReason\n */\nexport function isStopReason(value: string): value is StopReason {\n return [\n \"end_turn\",\n \"max_tokens\",\n \"tool_use\",\n \"stop_sequence\",\n \"content_filter\",\n \"error\",\n \"other\",\n ].includes(value);\n}\n","/**\n * MCP Protocol Version\n *\n * Model Context Protocol version constants.\n * Based on the official MCP specification.\n */\nexport const LATEST_PROTOCOL_VERSION = \"2025-06-18\" as const;\n\nexport const SUPPORTED_PROTOCOL_VERSIONS = [\"2025-06-18\", \"2025-03-26\", \"2024-11-05\"] as const;\n\nexport type McpProtocolVersion = (typeof SUPPORTED_PROTOCOL_VERSIONS)[number];\n","import type { Message } from \"~/message/Message\";\nimport type { UserMessage } from \"~/message/UserMessage\";\nimport type { AssistantMessage } from \"~/message/AssistantMessage\";\nimport type { SystemMessage } from \"~/message/SystemMessage\";\nimport type { ToolCallMessage } from \"~/message/ToolCallMessage\";\nimport type { ToolResultMessage } from \"~/message/ToolResultMessage\";\n\n/**\n * Type guard for UserMessage\n */\nexport function isUserMessage(message: Message): message is UserMessage {\n return message.subtype === \"user\";\n}\n\n/**\n * Type guard for AssistantMessage (text response, not tool call)\n */\nexport function isAssistantMessage(message: Message): message is AssistantMessage {\n return message.subtype === \"assistant\";\n}\n\n/**\n * Type guard for SystemMessage\n */\nexport function isSystemMessage(message: Message): message is SystemMessage {\n return message.subtype === \"system\";\n}\n\n/**\n * Type guard for ToolCallMessage\n */\nexport function isToolCallMessage(message: Message): message is ToolCallMessage {\n return message.subtype === \"tool-call\";\n}\n\n/**\n * Type guard for ToolResultMessage\n */\nexport function isToolResultMessage(message: Message): message is ToolResultMessage {\n return message.subtype === \"tool-result\";\n}\n","import type { ContentPart } from \"~/message/parts/ContentPart\";\nimport type { TextPart } from \"~/message/parts/TextPart\";\nimport type { ThinkingPart } from \"~/message/parts/ThinkingPart\";\nimport type { ImagePart } from \"~/message/parts/ImagePart\";\nimport type { FilePart } from \"~/message/parts/FilePart\";\nimport type { ToolCallPart } from \"~/message/parts/ToolCallPart\";\nimport type { ToolResultPart } from \"~/message/parts/ToolResultPart\";\n\n/**\n * Type guard for TextPart\n */\nexport function isTextPart(part: ContentPart): part is TextPart {\n return part.type === \"text\";\n}\n\n/**\n * Type guard for ThinkingPart\n */\nexport function isThinkingPart(part: ContentPart): part is ThinkingPart {\n return part.type === \"thinking\";\n}\n\n/**\n * Type guard for ImagePart\n */\nexport function isImagePart(part: ContentPart): part is ImagePart {\n return part.type === \"image\";\n}\n\n/**\n * Type guard for FilePart\n */\nexport function isFilePart(part: ContentPart): part is FilePart {\n return part.type === \"file\";\n}\n\n/**\n * Type guard for ToolCallPart\n */\nexport function isToolCallPart(part: ContentPart): part is ToolCallPart {\n return part.type === \"tool-call\";\n}\n\n/**\n * Type guard for ToolResultPart\n */\nexport function isToolResultPart(part: ContentPart): part is ToolResultPart {\n return part.type === \"tool-result\";\n}\n","/**\n * Event Type Guards\n *\n * Runtime type guards for event classification.\n */\n\nimport type { AgentOutput } from \"~/agent/AgentOutput\";\nimport type { StateEventType } from \"~/event/state\";\nimport type { StreamEventType } from \"~/event/stream\";\nimport type { MessageEventType } from \"~/event/message\";\nimport type { TurnEventType } from \"~/event/turn\";\nimport type { ErrorEvent } from \"~/event/error\";\n\n/**\n * State event type names (single source of truth)\n */\nexport const STATE_EVENT_TYPE_NAMES = [\n \"agent_initializing\",\n \"agent_ready\",\n \"agent_destroyed\",\n \"conversation_queued\",\n \"conversation_start\",\n \"conversation_thinking\",\n \"conversation_responding\",\n \"conversation_end\",\n \"conversation_interrupted\",\n \"tool_planned\",\n \"tool_executing\",\n \"tool_completed\",\n \"tool_failed\",\n \"error_occurred\",\n] as const;\n\nconst STATE_EVENT_TYPES = new Set<string>(STATE_EVENT_TYPE_NAMES);\n\n/**\n * Message event type names (single source of truth)\n */\nexport const MESSAGE_EVENT_TYPE_NAMES = [\n \"user_message\",\n \"assistant_message\",\n \"tool_call_message\",\n \"tool_result_message\",\n] as const;\n\nconst MESSAGE_EVENT_TYPES = new Set<string>(MESSAGE_EVENT_TYPE_NAMES);\n\n/**\n * Error event type names (single source of truth)\n * Error is independent from 4-layer hierarchy, transportable via SSE\n */\nexport const ERROR_EVENT_TYPE_NAMES = [\"error\"] as const;\n\nconst ERROR_EVENT_TYPES = new Set<string>(ERROR_EVENT_TYPE_NAMES);\n\n/**\n * Turn event type names (single source of truth)\n */\nexport const TURN_EVENT_TYPE_NAMES = [\"turn_request\", \"turn_response\"] as const;\n\nconst TURN_EVENT_TYPES = new Set<string>(TURN_EVENT_TYPE_NAMES);\n\n/**\n * Stream event type names (single source of truth)\n */\nexport const STREAM_EVENT_TYPE_NAMES = [\n \"message_start\",\n \"message_delta\",\n \"message_stop\",\n \"text_content_block_start\",\n \"text_delta\",\n \"text_content_block_stop\",\n \"tool_use_content_block_start\",\n \"input_json_delta\",\n \"tool_use_content_block_stop\",\n \"tool_call\",\n \"tool_result\",\n \"interrupted\",\n] as const;\n\nconst STREAM_EVENT_TYPES = new Set<string>(STREAM_EVENT_TYPE_NAMES);\n\n/**\n * Check if event is a StateEvent\n */\nexport function isStateEvent(event: AgentOutput): event is StateEventType {\n return \"type\" in event && STATE_EVENT_TYPES.has(event.type);\n}\n\n/**\n * Check if event is a MessageEvent\n */\nexport function isMessageEvent(event: AgentOutput): event is MessageEventType {\n return \"type\" in event && MESSAGE_EVENT_TYPES.has(event.type);\n}\n\n/**\n * Check if event is a TurnEvent\n */\nexport function isTurnEvent(event: AgentOutput): event is TurnEventType {\n return \"type\" in event && TURN_EVENT_TYPES.has(event.type);\n}\n\n/**\n * Check if event is a StreamEvent\n */\nexport function isStreamEvent(event: AgentOutput): event is StreamEventType {\n return \"type\" in event && STREAM_EVENT_TYPES.has(event.type);\n}\n\n/**\n * Check if event is an ErrorEvent\n */\nexport function isErrorEvent(event: AgentOutput): event is ErrorEvent {\n return \"type\" in event && ERROR_EVENT_TYPES.has(event.type);\n}\n"],"mappings":";AAMO,IAAK,WAAL,kBAAKA,cAAL;AACL,EAAAA,oBAAA,WAAQ,KAAR;AACA,EAAAA,oBAAA,UAAO,KAAP;AACA,EAAAA,oBAAA,UAAO,KAAP;AACA,EAAAA,oBAAA,WAAQ,KAAR;AACA,EAAAA,oBAAA,YAAS,KAAT;AALU,SAAAA;AAAA,GAAA;;;ACyCL,SAAS,aAAa,OAAoC;AAC/D,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,SAAS,KAAK;AAClB;;;ACnDO,IAAM,0BAA0B;AAEhC,IAAM,8BAA8B,CAAC,cAAc,cAAc,YAAY;;;ACE7E,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,YAAY;AAC7B;AAKO,SAAS,mBAAmB,SAA+C;AAChF,SAAO,QAAQ,YAAY;AAC7B;AAKO,SAAS,gBAAgB,SAA4C;AAC1E,SAAO,QAAQ,YAAY;AAC7B;AAKO,SAAS,kBAAkB,SAA8C;AAC9E,SAAO,QAAQ,YAAY;AAC7B;AAKO,SAAS,oBAAoB,SAAgD;AAClF,SAAO,QAAQ,YAAY;AAC7B;;;AC7BO,SAAS,WAAW,MAAqC;AAC9D,SAAO,KAAK,SAAS;AACvB;AAKO,SAAS,eAAe,MAAyC;AACtE,SAAO,KAAK,SAAS;AACvB;AAKO,SAAS,YAAY,MAAsC;AAChE,SAAO,KAAK,SAAS;AACvB;AAKO,SAAS,WAAW,MAAqC;AAC9D,SAAO,KAAK,SAAS;AACvB;AAKO,SAAS,eAAe,MAAyC;AACtE,SAAO,KAAK,SAAS;AACvB;AAKO,SAAS,iBAAiB,MAA2C;AAC1E,SAAO,KAAK,SAAS;AACvB;;;AChCO,IAAM,yBAAyB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,oBAAoB,IAAI,IAAY,sBAAsB;AAKzD,IAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,sBAAsB,IAAI,IAAY,wBAAwB;AAM7D,IAAM,yBAAyB,CAAC,OAAO;AAE9C,IAAM,oBAAoB,IAAI,IAAY,sBAAsB;AAKzD,IAAM,wBAAwB,CAAC,gBAAgB,eAAe;AAErE,IAAM,mBAAmB,IAAI,IAAY,qBAAqB;AAKvD,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,qBAAqB,IAAI,IAAY,uBAAuB;AAK3D,SAAS,aAAa,OAA6C;AACxE,SAAO,UAAU,SAAS,kBAAkB,IAAI,MAAM,IAAI;AAC5D;AAKO,SAAS,eAAe,OAA+C;AAC5E,SAAO,UAAU,SAAS,oBAAoB,IAAI,MAAM,IAAI;AAC9D;AAKO,SAAS,YAAY,OAA4C;AACtE,SAAO,UAAU,SAAS,iBAAiB,IAAI,MAAM,IAAI;AAC3D;AAKO,SAAS,cAAc,OAA8C;AAC1E,SAAO,UAAU,SAAS,mBAAmB,IAAI,MAAM,IAAI;AAC7D;AAKO,SAAS,aAAa,OAAyC;AACpE,SAAO,UAAU,SAAS,kBAAkB,IAAI,MAAM,IAAI;AAC5D;","names":["LogLevel"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/network/index.ts
17
+ var network_exports = {};
18
+ module.exports = __toCommonJS(network_exports);
19
+ //# sourceMappingURL=network.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/network/index.ts"],"sourcesContent":["/**\n * Network types\n */\n\nexport type {\n Unsubscribe,\n MinimalHTTPServer,\n ChannelConnection,\n ChannelServer,\n ChannelClient,\n ChannelClientOptions,\n ChannelServerOptions,\n} from \"./Channel\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Network Channel Abstraction
3
+ *
4
+ * Provides transport-agnostic interfaces for client-server communication.
5
+ * Can be implemented with WebSocket, HTTP/2, gRPC, etc.
6
+ */
7
+ /**
8
+ * Minimal HTTP server interface for attaching WebSocket
9
+ * Avoids Node.js dependency in types package
10
+ */
11
+ interface MinimalHTTPServer {
12
+ on(event: "upgrade", listener: (request: any, socket: any, head: any) => void): void;
13
+ }
14
+ /**
15
+ * Unsubscribe function type
16
+ */
17
+ type Unsubscribe = () => void;
18
+ /**
19
+ * Channel connection (server-side representation of a client)
20
+ */
21
+ interface ChannelConnection {
22
+ /**
23
+ * Unique connection ID
24
+ */
25
+ readonly id: string;
26
+ /**
27
+ * Send message to this client
28
+ */
29
+ send(message: string): void;
30
+ /**
31
+ * Register message handler
32
+ */
33
+ onMessage(handler: (message: string) => void): Unsubscribe;
34
+ /**
35
+ * Register close handler
36
+ */
37
+ onClose(handler: () => void): Unsubscribe;
38
+ /**
39
+ * Register error handler
40
+ */
41
+ onError(handler: (error: Error) => void): Unsubscribe;
42
+ /**
43
+ * Close this connection
44
+ */
45
+ close(): void;
46
+ }
47
+ /**
48
+ * Channel server (accepts connections)
49
+ */
50
+ interface ChannelServer {
51
+ /**
52
+ * Start listening on a port (standalone mode)
53
+ */
54
+ listen(port: number, host?: string): Promise<void>;
55
+ /**
56
+ * Attach to an existing HTTP server
57
+ */
58
+ attach(server: MinimalHTTPServer, path?: string): void;
59
+ /**
60
+ * Register connection handler
61
+ */
62
+ onConnection(handler: (connection: ChannelConnection) => void): Unsubscribe;
63
+ /**
64
+ * Broadcast message to all connected clients
65
+ */
66
+ broadcast(message: string): void;
67
+ /**
68
+ * Close server and all connections
69
+ */
70
+ close(): Promise<void>;
71
+ /**
72
+ * Dispose resources
73
+ */
74
+ dispose(): Promise<void>;
75
+ }
76
+ /**
77
+ * Channel client (connects to server)
78
+ */
79
+ interface ChannelClient {
80
+ /**
81
+ * Connection state
82
+ */
83
+ readonly readyState: "connecting" | "open" | "closing" | "closed";
84
+ /**
85
+ * Connect to server
86
+ */
87
+ connect(): Promise<void>;
88
+ /**
89
+ * Send message to server
90
+ */
91
+ send(message: string): void;
92
+ /**
93
+ * Register message handler
94
+ */
95
+ onMessage(handler: (message: string) => void): Unsubscribe;
96
+ /**
97
+ * Register open handler
98
+ */
99
+ onOpen(handler: () => void): Unsubscribe;
100
+ /**
101
+ * Register close handler
102
+ */
103
+ onClose(handler: () => void): Unsubscribe;
104
+ /**
105
+ * Register error handler
106
+ */
107
+ onError(handler: (error: Error) => void): Unsubscribe;
108
+ /**
109
+ * Close connection
110
+ */
111
+ close(): void;
112
+ /**
113
+ * Dispose resources
114
+ */
115
+ dispose(): void;
116
+ }
117
+ /**
118
+ * Channel client factory options
119
+ */
120
+ interface ChannelClientOptions {
121
+ /**
122
+ * Server URL
123
+ */
124
+ serverUrl: string;
125
+ /**
126
+ * Enable auto-reconnect (default: true in browser, false in Node.js)
127
+ */
128
+ autoReconnect?: boolean;
129
+ /**
130
+ * Min reconnection delay in ms (default: 1000)
131
+ */
132
+ minReconnectionDelay?: number;
133
+ /**
134
+ * Max reconnection delay in ms (default: 10000)
135
+ */
136
+ maxReconnectionDelay?: number;
137
+ /**
138
+ * Max retry attempts (default: Infinity)
139
+ */
140
+ maxRetries?: number;
141
+ /**
142
+ * Connection timeout in ms (default: 4000)
143
+ */
144
+ connectionTimeout?: number;
145
+ /**
146
+ * Enable debug logging (default: false)
147
+ */
148
+ debug?: boolean;
149
+ }
150
+ /**
151
+ * Channel server factory options
152
+ */
153
+ interface ChannelServerOptions {
154
+ /**
155
+ * Enable heartbeat/ping-pong (default: true)
156
+ */
157
+ heartbeat?: boolean;
158
+ /**
159
+ * Heartbeat interval in ms (default: 30000)
160
+ */
161
+ heartbeatInterval?: number;
162
+ /**
163
+ * Enable debug logging (default: false)
164
+ */
165
+ debug?: boolean;
166
+ }
167
+
168
+ export type { ChannelClient, ChannelClientOptions, ChannelConnection, ChannelServer, ChannelServerOptions, MinimalHTTPServer, Unsubscribe };
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Network Channel Abstraction
3
+ *
4
+ * Provides transport-agnostic interfaces for client-server communication.
5
+ * Can be implemented with WebSocket, HTTP/2, gRPC, etc.
6
+ */
7
+ /**
8
+ * Minimal HTTP server interface for attaching WebSocket
9
+ * Avoids Node.js dependency in types package
10
+ */
11
+ interface MinimalHTTPServer {
12
+ on(event: "upgrade", listener: (request: any, socket: any, head: any) => void): void;
13
+ }
14
+ /**
15
+ * Unsubscribe function type
16
+ */
17
+ type Unsubscribe = () => void;
18
+ /**
19
+ * Channel connection (server-side representation of a client)
20
+ */
21
+ interface ChannelConnection {
22
+ /**
23
+ * Unique connection ID
24
+ */
25
+ readonly id: string;
26
+ /**
27
+ * Send message to this client
28
+ */
29
+ send(message: string): void;
30
+ /**
31
+ * Register message handler
32
+ */
33
+ onMessage(handler: (message: string) => void): Unsubscribe;
34
+ /**
35
+ * Register close handler
36
+ */
37
+ onClose(handler: () => void): Unsubscribe;
38
+ /**
39
+ * Register error handler
40
+ */
41
+ onError(handler: (error: Error) => void): Unsubscribe;
42
+ /**
43
+ * Close this connection
44
+ */
45
+ close(): void;
46
+ }
47
+ /**
48
+ * Channel server (accepts connections)
49
+ */
50
+ interface ChannelServer {
51
+ /**
52
+ * Start listening on a port (standalone mode)
53
+ */
54
+ listen(port: number, host?: string): Promise<void>;
55
+ /**
56
+ * Attach to an existing HTTP server
57
+ */
58
+ attach(server: MinimalHTTPServer, path?: string): void;
59
+ /**
60
+ * Register connection handler
61
+ */
62
+ onConnection(handler: (connection: ChannelConnection) => void): Unsubscribe;
63
+ /**
64
+ * Broadcast message to all connected clients
65
+ */
66
+ broadcast(message: string): void;
67
+ /**
68
+ * Close server and all connections
69
+ */
70
+ close(): Promise<void>;
71
+ /**
72
+ * Dispose resources
73
+ */
74
+ dispose(): Promise<void>;
75
+ }
76
+ /**
77
+ * Channel client (connects to server)
78
+ */
79
+ interface ChannelClient {
80
+ /**
81
+ * Connection state
82
+ */
83
+ readonly readyState: "connecting" | "open" | "closing" | "closed";
84
+ /**
85
+ * Connect to server
86
+ */
87
+ connect(): Promise<void>;
88
+ /**
89
+ * Send message to server
90
+ */
91
+ send(message: string): void;
92
+ /**
93
+ * Register message handler
94
+ */
95
+ onMessage(handler: (message: string) => void): Unsubscribe;
96
+ /**
97
+ * Register open handler
98
+ */
99
+ onOpen(handler: () => void): Unsubscribe;
100
+ /**
101
+ * Register close handler
102
+ */
103
+ onClose(handler: () => void): Unsubscribe;
104
+ /**
105
+ * Register error handler
106
+ */
107
+ onError(handler: (error: Error) => void): Unsubscribe;
108
+ /**
109
+ * Close connection
110
+ */
111
+ close(): void;
112
+ /**
113
+ * Dispose resources
114
+ */
115
+ dispose(): void;
116
+ }
117
+ /**
118
+ * Channel client factory options
119
+ */
120
+ interface ChannelClientOptions {
121
+ /**
122
+ * Server URL
123
+ */
124
+ serverUrl: string;
125
+ /**
126
+ * Enable auto-reconnect (default: true in browser, false in Node.js)
127
+ */
128
+ autoReconnect?: boolean;
129
+ /**
130
+ * Min reconnection delay in ms (default: 1000)
131
+ */
132
+ minReconnectionDelay?: number;
133
+ /**
134
+ * Max reconnection delay in ms (default: 10000)
135
+ */
136
+ maxReconnectionDelay?: number;
137
+ /**
138
+ * Max retry attempts (default: Infinity)
139
+ */
140
+ maxRetries?: number;
141
+ /**
142
+ * Connection timeout in ms (default: 4000)
143
+ */
144
+ connectionTimeout?: number;
145
+ /**
146
+ * Enable debug logging (default: false)
147
+ */
148
+ debug?: boolean;
149
+ }
150
+ /**
151
+ * Channel server factory options
152
+ */
153
+ interface ChannelServerOptions {
154
+ /**
155
+ * Enable heartbeat/ping-pong (default: true)
156
+ */
157
+ heartbeat?: boolean;
158
+ /**
159
+ * Heartbeat interval in ms (default: 30000)
160
+ */
161
+ heartbeatInterval?: number;
162
+ /**
163
+ * Enable debug logging (default: false)
164
+ */
165
+ debug?: boolean;
166
+ }
167
+
168
+ export type { ChannelClient, ChannelClientOptions, ChannelConnection, ChannelServer, ChannelServerOptions, MinimalHTTPServer, Unsubscribe };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=network.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/runtime/internal/index.ts
17
+ var internal_exports = {};
18
+ module.exports = __toCommonJS(internal_exports);
19
+ //# sourceMappingURL=runtime-internal.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/runtime/internal/index.ts"],"sourcesContent":["/**\n * Runtime Internal Types\n *\n * Internal implementation types for runtime layer.\n * These are used by runtime implementers, not end users.\n *\n * ## Structure\n *\n * ```\n * internal/\n * ├── container/\n * │ ├── Container # Agent lifecycle management\n * │ ├── llm/ # LLM connection (LLM, LLMConfig, TokenUsage...)\n * │ └── sandbox/ # Isolated environment\n * │ ├── Sandbox # Workdir + MCP access\n * │ ├── workdir/ # File system operations\n * │ └── mcp/ # MCP tools, resources, prompts\n * │\n * ├── environment/\n * │ ├── Environment # External world abstraction\n * │ ├── Receptor # Event producer (LLM → DriveableEvent)\n * │ └── Effector # Action executor (ToolCall → ToolResult)\n * │\n * ├── session/\n * │ └── Session # Message persistence per Agent\n * │\n * ├── event/\n * │ └── SystemBus # Central event bus\n * │\n * └── persistence/\n * ├── Persistence # Storage facade\n * ├── Repository # Flat storage interface\n * └── record/ # Storage schema types\n * ```\n *\n * @packageDocumentation\n */\n\n// ============================================================================\n// Container\n// ============================================================================\n\nexport type { Container } from \"./container/Container\";\n\n// Sandbox\nexport type { Sandbox } from \"./container/sandbox/Sandbox\";\nexport type { Workdir } from \"./container/sandbox/workdir/Workdir\";\nexport type {\n McpServerInfo,\n McpTool,\n McpResource,\n McpPrompt,\n McpRequest,\n McpTransportConfig,\n McpProtocolVersion,\n} from \"./container/sandbox/mcp\";\n\n// LLM\nexport type {\n LLM,\n LLMConfig,\n LLMProvider,\n LLMRequest,\n LLMResponse,\n StreamChunk,\n StopReason,\n TokenUsage,\n} from \"./container/llm\";\n\n// ============================================================================\n// Environment\n// ============================================================================\n\nexport type { Environment } from \"./environment/Environment\";\nexport type { Receptor } from \"./environment/Receptor\";\nexport type { Effector } from \"./environment/Effector\";\n\n// ============================================================================\n// Session\n// ============================================================================\n\nexport type { Session } from \"./session/Session\";\n\n// ============================================================================\n// Event Bus (Runtime internal)\n// ============================================================================\n\nexport type { SystemBus, BusEventHandler, SubscribeOptions, Unsubscribe } from \"./event/SystemBus\";\nexport type { SystemBusProducer } from \"./event/SystemBusProducer\";\nexport type { SystemBusConsumer } from \"./event/SystemBusConsumer\";\n\n// ============================================================================\n// Event Handler\n// ============================================================================\n\nexport type { ErrorContext } from \"./EventHandler\";\n\n// ============================================================================\n// Persistence\n// ============================================================================\n\nexport * from \"./persistence\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}