@galaxy-stack/ai-coder-core 0.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 (197) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +131 -0
  3. package/dist/approval/approval-policy.d.ts +31 -0
  4. package/dist/approval/approval-policy.d.ts.map +1 -0
  5. package/dist/approval/approval-policy.js +179 -0
  6. package/dist/approval/approval-policy.js.map +1 -0
  7. package/dist/approval/index.d.ts +2 -0
  8. package/dist/approval/index.d.ts.map +1 -0
  9. package/dist/approval/index.js +2 -0
  10. package/dist/approval/index.js.map +1 -0
  11. package/dist/context/attachment-types.d.ts +35 -0
  12. package/dist/context/attachment-types.d.ts.map +1 -0
  13. package/dist/context/attachment-types.js +9 -0
  14. package/dist/context/attachment-types.js.map +1 -0
  15. package/dist/context/checkpoint.d.ts +194 -0
  16. package/dist/context/checkpoint.d.ts.map +1 -0
  17. package/dist/context/checkpoint.js +921 -0
  18. package/dist/context/checkpoint.js.map +1 -0
  19. package/dist/context/context-manager.d.ts +153 -0
  20. package/dist/context/context-manager.d.ts.map +1 -0
  21. package/dist/context/context-manager.js +541 -0
  22. package/dist/context/context-manager.js.map +1 -0
  23. package/dist/context/context-profile.d.ts +42 -0
  24. package/dist/context/context-profile.d.ts.map +1 -0
  25. package/dist/context/context-profile.js +102 -0
  26. package/dist/context/context-profile.js.map +1 -0
  27. package/dist/context/index.d.ts +7 -0
  28. package/dist/context/index.d.ts.map +1 -0
  29. package/dist/context/index.js +7 -0
  30. package/dist/context/index.js.map +1 -0
  31. package/dist/context/token-ledger.d.ts +102 -0
  32. package/dist/context/token-ledger.d.ts.map +1 -0
  33. package/dist/context/token-ledger.js +205 -0
  34. package/dist/context/token-ledger.js.map +1 -0
  35. package/dist/context/tool-output.d.ts +46 -0
  36. package/dist/context/tool-output.d.ts.map +1 -0
  37. package/dist/context/tool-output.js +82 -0
  38. package/dist/context/tool-output.js.map +1 -0
  39. package/dist/deterministic-order.d.ts +3 -0
  40. package/dist/deterministic-order.d.ts.map +1 -0
  41. package/dist/deterministic-order.js +5 -0
  42. package/dist/deterministic-order.js.map +1 -0
  43. package/dist/index.d.ts +19 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +19 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/ports/approval-port.d.ts +29 -0
  48. package/dist/ports/approval-port.d.ts.map +1 -0
  49. package/dist/ports/approval-port.js +9 -0
  50. package/dist/ports/approval-port.js.map +1 -0
  51. package/dist/ports/artifact-port.d.ts +66 -0
  52. package/dist/ports/artifact-port.d.ts.map +1 -0
  53. package/dist/ports/artifact-port.js +9 -0
  54. package/dist/ports/artifact-port.js.map +1 -0
  55. package/dist/ports/capability-port.d.ts +62 -0
  56. package/dist/ports/capability-port.d.ts.map +1 -0
  57. package/dist/ports/capability-port.js +9 -0
  58. package/dist/ports/capability-port.js.map +1 -0
  59. package/dist/ports/coding-model-port.d.ts +12 -0
  60. package/dist/ports/coding-model-port.d.ts.map +1 -0
  61. package/dist/ports/coding-model-port.js +9 -0
  62. package/dist/ports/coding-model-port.js.map +1 -0
  63. package/dist/ports/command-port.d.ts +94 -0
  64. package/dist/ports/command-port.d.ts.map +1 -0
  65. package/dist/ports/command-port.js +9 -0
  66. package/dist/ports/command-port.js.map +1 -0
  67. package/dist/ports/execution-context.d.ts +30 -0
  68. package/dist/ports/execution-context.d.ts.map +1 -0
  69. package/dist/ports/execution-context.js +11 -0
  70. package/dist/ports/execution-context.js.map +1 -0
  71. package/dist/ports/git-port.d.ts +27 -0
  72. package/dist/ports/git-port.d.ts.map +1 -0
  73. package/dist/ports/git-port.js +9 -0
  74. package/dist/ports/git-port.js.map +1 -0
  75. package/dist/ports/host-adapter.d.ts +36 -0
  76. package/dist/ports/host-adapter.d.ts.map +1 -0
  77. package/dist/ports/host-adapter.js +9 -0
  78. package/dist/ports/host-adapter.js.map +1 -0
  79. package/dist/ports/index.d.ts +16 -0
  80. package/dist/ports/index.d.ts.map +1 -0
  81. package/dist/ports/index.js +16 -0
  82. package/dist/ports/index.js.map +1 -0
  83. package/dist/ports/pagination.d.ts +17 -0
  84. package/dist/ports/pagination.d.ts.map +1 -0
  85. package/dist/ports/pagination.js +9 -0
  86. package/dist/ports/pagination.js.map +1 -0
  87. package/dist/ports/persistence-port.d.ts +59 -0
  88. package/dist/ports/persistence-port.d.ts.map +1 -0
  89. package/dist/ports/persistence-port.js +9 -0
  90. package/dist/ports/persistence-port.js.map +1 -0
  91. package/dist/ports/port-result.d.ts +29 -0
  92. package/dist/ports/port-result.d.ts.map +1 -0
  93. package/dist/ports/port-result.js +20 -0
  94. package/dist/ports/port-result.js.map +1 -0
  95. package/dist/ports/preview-port.d.ts +27 -0
  96. package/dist/ports/preview-port.d.ts.map +1 -0
  97. package/dist/ports/preview-port.js +9 -0
  98. package/dist/ports/preview-port.js.map +1 -0
  99. package/dist/ports/research-port.d.ts +40 -0
  100. package/dist/ports/research-port.d.ts.map +1 -0
  101. package/dist/ports/research-port.js +9 -0
  102. package/dist/ports/research-port.js.map +1 -0
  103. package/dist/ports/trace-port.d.ts +26 -0
  104. package/dist/ports/trace-port.d.ts.map +1 -0
  105. package/dist/ports/trace-port.js +9 -0
  106. package/dist/ports/trace-port.js.map +1 -0
  107. package/dist/ports/workspace-port.d.ts +126 -0
  108. package/dist/ports/workspace-port.d.ts.map +1 -0
  109. package/dist/ports/workspace-port.js +9 -0
  110. package/dist/ports/workspace-port.js.map +1 -0
  111. package/dist/prompt/index.d.ts +2 -0
  112. package/dist/prompt/index.d.ts.map +1 -0
  113. package/dist/prompt/index.js +2 -0
  114. package/dist/prompt/index.js.map +1 -0
  115. package/dist/prompt/prompt-assembler.d.ts +114 -0
  116. package/dist/prompt/prompt-assembler.d.ts.map +1 -0
  117. package/dist/prompt/prompt-assembler.js +363 -0
  118. package/dist/prompt/prompt-assembler.js.map +1 -0
  119. package/dist/retrieval/evidence.d.ts +41 -0
  120. package/dist/retrieval/evidence.d.ts.map +1 -0
  121. package/dist/retrieval/evidence.js +48 -0
  122. package/dist/retrieval/evidence.js.map +1 -0
  123. package/dist/retrieval/index.d.ts +4 -0
  124. package/dist/retrieval/index.d.ts.map +1 -0
  125. package/dist/retrieval/index.js +4 -0
  126. package/dist/retrieval/index.js.map +1 -0
  127. package/dist/retrieval/lexical-retriever.d.ts +56 -0
  128. package/dist/retrieval/lexical-retriever.d.ts.map +1 -0
  129. package/dist/retrieval/lexical-retriever.js +128 -0
  130. package/dist/retrieval/lexical-retriever.js.map +1 -0
  131. package/dist/retrieval/retrieval-policy.d.ts +25 -0
  132. package/dist/retrieval/retrieval-policy.d.ts.map +1 -0
  133. package/dist/retrieval/retrieval-policy.js +71 -0
  134. package/dist/retrieval/retrieval-policy.js.map +1 -0
  135. package/dist/runtime/completion-gate.d.ts +75 -0
  136. package/dist/runtime/completion-gate.d.ts.map +1 -0
  137. package/dist/runtime/completion-gate.js +114 -0
  138. package/dist/runtime/completion-gate.js.map +1 -0
  139. package/dist/runtime/index.d.ts +7 -0
  140. package/dist/runtime/index.d.ts.map +1 -0
  141. package/dist/runtime/index.js +7 -0
  142. package/dist/runtime/index.js.map +1 -0
  143. package/dist/runtime/run-controller.d.ts +55 -0
  144. package/dist/runtime/run-controller.d.ts.map +1 -0
  145. package/dist/runtime/run-controller.js +2673 -0
  146. package/dist/runtime/run-controller.js.map +1 -0
  147. package/dist/runtime/runtime-error.d.ts +7 -0
  148. package/dist/runtime/runtime-error.d.ts.map +1 -0
  149. package/dist/runtime/runtime-error.js +11 -0
  150. package/dist/runtime/runtime-error.js.map +1 -0
  151. package/dist/runtime/runtime-types.d.ts +303 -0
  152. package/dist/runtime/runtime-types.d.ts.map +1 -0
  153. package/dist/runtime/runtime-types.js +2 -0
  154. package/dist/runtime/runtime-types.js.map +1 -0
  155. package/dist/runtime/state-machine.d.ts +27 -0
  156. package/dist/runtime/state-machine.d.ts.map +1 -0
  157. package/dist/runtime/state-machine.js +68 -0
  158. package/dist/runtime/state-machine.js.map +1 -0
  159. package/dist/runtime/trace-emitter.d.ts +17 -0
  160. package/dist/runtime/trace-emitter.d.ts.map +1 -0
  161. package/dist/runtime/trace-emitter.js +91 -0
  162. package/dist/runtime/trace-emitter.js.map +1 -0
  163. package/dist/tools/coding-messages.d.ts +112 -0
  164. package/dist/tools/coding-messages.d.ts.map +1 -0
  165. package/dist/tools/coding-messages.js +20 -0
  166. package/dist/tools/coding-messages.js.map +1 -0
  167. package/dist/tools/index.d.ts +7 -0
  168. package/dist/tools/index.d.ts.map +1 -0
  169. package/dist/tools/index.js +7 -0
  170. package/dist/tools/index.js.map +1 -0
  171. package/dist/tools/json-schema.d.ts +18 -0
  172. package/dist/tools/json-schema.d.ts.map +1 -0
  173. package/dist/tools/json-schema.js +299 -0
  174. package/dist/tools/json-schema.js.map +1 -0
  175. package/dist/tools/settings-types.d.ts +41 -0
  176. package/dist/tools/settings-types.d.ts.map +1 -0
  177. package/dist/tools/settings-types.js +88 -0
  178. package/dist/tools/settings-types.js.map +1 -0
  179. package/dist/tools/tool-effect-profile.d.ts +44 -0
  180. package/dist/tools/tool-effect-profile.d.ts.map +1 -0
  181. package/dist/tools/tool-effect-profile.js +157 -0
  182. package/dist/tools/tool-effect-profile.js.map +1 -0
  183. package/dist/tools/tool-registry-types.d.ts +72 -0
  184. package/dist/tools/tool-registry-types.d.ts.map +1 -0
  185. package/dist/tools/tool-registry-types.js +9 -0
  186. package/dist/tools/tool-registry-types.js.map +1 -0
  187. package/dist/tools/tool-registry.d.ts +155 -0
  188. package/dist/tools/tool-registry.d.ts.map +1 -0
  189. package/dist/tools/tool-registry.js +599 -0
  190. package/dist/tools/tool-registry.js.map +1 -0
  191. package/dist/tools/tool-registry.schema.json +144 -0
  192. package/docs/ARCHITECTURE.md +259 -0
  193. package/docs/HOST_CONFORMANCE.md +210 -0
  194. package/docs/PROMPT_CONTRACT.md +123 -0
  195. package/docs/TOOL_EFFECT_PROFILE.md +77 -0
  196. package/docs/TOOL_REGISTRY_COMPARISON.md +358 -0
  197. package/package.json +76 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Public barrel for the platform-neutral Galaxy AI Coder runtime.
7
+ */
8
+ export * from "./ports/index.js";
9
+ export * from "./approval/index.js";
10
+ export * from "./context/index.js";
11
+ export * from "./prompt/index.js";
12
+ export * from "./retrieval/index.js";
13
+ export * from "./runtime/index.js";
14
+ export * from "./tools/json-schema.js";
15
+ export * from "./tools/settings-types.js";
16
+ export * from "./tools/tool-effect-profile.js";
17
+ export * from "./tools/tool-registry-types.js";
18
+ export * from "./tools/tool-registry.js";
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Correlated, cancellable host-side approval contract.
7
+ */
8
+ import type { AiCoderToolDescriptor } from "../tools/tool-registry-types.js";
9
+ import type { AiCoderApprovalProfile } from "../tools/settings-types.js";
10
+ import type { ToolExecutionContext } from "./execution-context.js";
11
+ import type { PortResult } from "./port-result.js";
12
+ export type AiCoderApprovalScope = "once" | "run" | "workspace";
13
+ export type AiCoderApprovalRequest = Readonly<{
14
+ approvalProfile: AiCoderApprovalProfile;
15
+ argumentsValue: Readonly<Record<string, unknown>>;
16
+ reason: string;
17
+ requestId: string;
18
+ suggestedScope: AiCoderApprovalScope;
19
+ tool: AiCoderToolDescriptor;
20
+ }>;
21
+ export type AiCoderApprovalDecision = Readonly<{
22
+ approved: boolean;
23
+ decidedAt: string;
24
+ reason?: string;
25
+ scope: AiCoderApprovalScope;
26
+ }>;
27
+ /** Missing, failed, timed-out, or canceled callbacks must be treated as denial. */
28
+ export type ApprovalPort = (request: AiCoderApprovalRequest, context: ToolExecutionContext) => Promise<PortResult<AiCoderApprovalDecision>>;
29
+ //# sourceMappingURL=approval-port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approval-port.d.ts","sourceRoot":"","sources":["../../src/ports/approval-port.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,KAAK,GAAG,WAAW,CAAC;AAEhE,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,eAAe,EAAE,sBAAsB,CAAC;IACxC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,oBAAoB,CAAC;IACrC,IAAI,EAAE,qBAAqB,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC7C,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,oBAAoB,CAAC;CAC7B,CAAC,CAAC;AAEH,mFAAmF;AACnF,MAAM,MAAM,YAAY,GAAG,CACzB,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,oBAAoB,KAC1B,OAAO,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Correlated, cancellable host-side approval contract.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=approval-port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approval-port.js","sourceRoot":"","sources":["../../src/ports/approval-port.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Bounded artifact storage shared by checkpoints and oversized tool output.
7
+ */
8
+ import type { RunExecutionContext } from "./execution-context.js";
9
+ import type { PaginationRequest, PaginationResult } from "./pagination.js";
10
+ import type { PortResult } from "./port-result.js";
11
+ export type ArtifactRegisterInput = Readonly<{
12
+ byteLength: number;
13
+ contentSha256: string;
14
+ kind: string;
15
+ locator: string;
16
+ metadata?: Readonly<Record<string, unknown>>;
17
+ mimeType: string;
18
+ retention?: "temporary" | "default" | "durable";
19
+ }>;
20
+ export type ArtifactCreateTextInput = Readonly<{
21
+ content: string;
22
+ kind: string;
23
+ metadata?: Readonly<Record<string, unknown>>;
24
+ mimeType: string;
25
+ name?: string;
26
+ retention?: "temporary" | "default" | "durable";
27
+ }>;
28
+ export type ArtifactRegisterResult = Readonly<{
29
+ byteLength: number;
30
+ contentSha256: string;
31
+ id: string;
32
+ mimeType: string;
33
+ locator?: string;
34
+ }>;
35
+ export type ArtifactReadTextResult = Readonly<{
36
+ content: string;
37
+ contentSha256?: string;
38
+ mimeType: string;
39
+ pagination: PaginationResult;
40
+ }>;
41
+ export type ArtifactListEntry = Readonly<{
42
+ createdAt: string;
43
+ id: string;
44
+ kind: string;
45
+ metadata?: Readonly<Record<string, unknown>>;
46
+ mimeType: string;
47
+ }>;
48
+ export type ArtifactListResult = Readonly<{
49
+ artifacts: readonly ArtifactListEntry[];
50
+ pagination: PaginationResult;
51
+ }>;
52
+ export interface ArtifactPort {
53
+ readonly artifacts: Readonly<{
54
+ createText(input: ArtifactCreateTextInput, context: RunExecutionContext): Promise<PortResult<ArtifactRegisterResult>>;
55
+ register(input: ArtifactRegisterInput, context: RunExecutionContext): Promise<PortResult<ArtifactRegisterResult>>;
56
+ list(input: PaginationRequest & Readonly<{
57
+ kind?: string;
58
+ }>, context: RunExecutionContext): Promise<PortResult<ArtifactListResult>>;
59
+ readText(input: Readonly<{
60
+ cursor?: string;
61
+ id: string;
62
+ maxBytes?: number;
63
+ }>, context: RunExecutionContext): Promise<PortResult<ArtifactReadTextResult>>;
64
+ }>;
65
+ }
66
+ //# sourceMappingURL=artifact-port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-port.d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EACnE,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC,CAAC;KAChD,CAAC,CAAC;CACJ"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Bounded artifact storage shared by checkpoints and oversized tool output.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=artifact-port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-port.js","sourceRoot":"","sources":["../../src/ports/artifact-port.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Provider-neutral capability discovery and evidence contract.
7
+ */
8
+ import type { RunExecutionContext } from "./execution-context.js";
9
+ import type { PortResult } from "./port-result.js";
10
+ export type CapabilityState = "supported" | "unsupported" | "unknown";
11
+ export type ThinkingCapability = "none" | "optional" | "required" | "unknown";
12
+ export type ModelIdentity = Readonly<{
13
+ baseUrl: string;
14
+ digest?: string;
15
+ model: string;
16
+ provider: string;
17
+ runtimeVersion?: string;
18
+ tag?: string;
19
+ }>;
20
+ export type CapabilityEvidence = Readonly<{
21
+ observedAt: string;
22
+ source: "provider_api" | "runtime_probe" | "catalog" | "static_fallback";
23
+ verified: boolean;
24
+ }>;
25
+ export type ResolvedCapability<T> = Readonly<{
26
+ declared: T;
27
+ effective: T;
28
+ reason: string;
29
+ verified: T | "not_probed";
30
+ }>;
31
+ export type ModelCapabilities = Readonly<{
32
+ contextWindow?: number;
33
+ evidence: readonly CapabilityEvidence[];
34
+ identity: ModelIdentity;
35
+ input: Readonly<{
36
+ audio: CapabilityState;
37
+ image: CapabilityState;
38
+ text: CapabilityState;
39
+ video: CapabilityState;
40
+ }>;
41
+ maxImages?: number;
42
+ maxOutputTokens?: number;
43
+ output: Readonly<{
44
+ image: CapabilityState;
45
+ text: CapabilityState;
46
+ }>;
47
+ parallelToolCalling: CapabilityState;
48
+ preserveThinking: CapabilityState;
49
+ streaming: CapabilityState;
50
+ structuredOutput: CapabilityState;
51
+ supportedImageMimeTypes?: readonly string[];
52
+ thinking: ThinkingCapability;
53
+ tokenCounting: CapabilityState;
54
+ toolCalling: CapabilityState;
55
+ }>;
56
+ export type CapabilityRequest = ModelIdentity & Readonly<{
57
+ forceProbe?: boolean;
58
+ }>;
59
+ export interface CapabilityPort {
60
+ resolve(request: CapabilityRequest, context: RunExecutionContext): Promise<PortResult<ModelCapabilities>>;
61
+ }
62
+ //# sourceMappingURL=capability-port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-port.d.ts","sourceRoot":"","sources":["../../src/ports/capability-port.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;AAE9E,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,cAAc,GAAG,eAAe,GAAG,SA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O,CACL,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC;CAC3C"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Provider-neutral capability discovery and evidence contract.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=capability-port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-port.js","sourceRoot":"","sources":["../../src/ports/capability-port.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Port alias for the provider-neutral coding model adapter.
7
+ */
8
+ import type { CodingModelAdapter } from "../tools/coding-messages.js";
9
+ export type { CodingAssistantMessage, CodingMessage, CodingModelAdapter, CodingRoundEvent, CodingRoundRequest, CodingSystemMessage, CodingTokenCount, CodingTokenCountInput, CodingTokenUsage, CodingToolCall, CodingToolDefinition, CodingToolResultMessage, CodingUserMessage, } from "../tools/coding-messages.js";
10
+ export { CodingProviderError } from "../tools/coding-messages.js";
11
+ export type CodingModelPort = CodingModelAdapter;
12
+ //# sourceMappingURL=coding-model-port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coding-model-port.d.ts","sourceRoot":"","sources":["../../src/ports/coding-model-port.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,YAAY,EACV,sBAAsB,EACtB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Port alias for the provider-neutral coding model adapter.
7
+ */
8
+ export { CodingProviderError } from "../tools/coding-messages.js";
9
+ //# sourceMappingURL=coding-model-port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coding-model-port.js","sourceRoot":"","sources":["../../src/ports/coding-model-port.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoBH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Cancellable bounded command execution and supervised terminal sessions.
7
+ */
8
+ import type { ToolExecutionContext } from "./execution-context.js";
9
+ import type { PaginationRequest, PaginationResult } from "./pagination.js";
10
+ import type { PortResult } from "./port-result.js";
11
+ export type CommandExitStatus = "exited" | "timed_out" | "canceled";
12
+ export type CommandRunResult = Readonly<{
13
+ command: string;
14
+ durationMs: number;
15
+ exitCode: number | null;
16
+ status: CommandExitStatus;
17
+ stderr: string;
18
+ stderrArtifactId?: string;
19
+ stderrTruncated: boolean;
20
+ stdout: string;
21
+ stdoutArtifactId?: string;
22
+ stdoutTruncated: boolean;
23
+ }>;
24
+ export type CommandSessionStartResult = Readonly<{
25
+ sessionId: string;
26
+ startedAt: string;
27
+ }>;
28
+ export type CommandSessionReadResult = Readonly<{
29
+ pagination: Readonly<{
30
+ stderr: PaginationResult;
31
+ stdout: PaginationResult;
32
+ }>;
33
+ status: "running" | CommandExitStatus;
34
+ stderr: string;
35
+ stderrArtifactId?: string;
36
+ stderrTruncated: boolean;
37
+ stdout: string;
38
+ stdoutArtifactId?: string;
39
+ stdoutTruncated: boolean;
40
+ }>;
41
+ export type CommandSessionListEntry = Readonly<{
42
+ command: string;
43
+ sessionId: string;
44
+ startedAt: string;
45
+ status: "running" | CommandExitStatus;
46
+ }>;
47
+ export interface CommandRunnerPort {
48
+ run(input: Readonly<{
49
+ command: string;
50
+ cwd?: string;
51
+ env?: Readonly<Record<string, string>>;
52
+ maxOutputBytes?: number;
53
+ timeoutMs?: number;
54
+ }>, context: ToolExecutionContext): Promise<PortResult<CommandRunResult>>;
55
+ }
56
+ export interface CommandSessionPort {
57
+ start(input: Readonly<{
58
+ command: string;
59
+ cwd?: string;
60
+ env?: Readonly<Record<string, string>>;
61
+ maxOutputBytes?: number;
62
+ }>, context: ToolExecutionContext): Promise<PortResult<CommandSessionStartResult>>;
63
+ read(input: Readonly<{
64
+ maxChars?: number;
65
+ sessionId: string;
66
+ stderrCursor?: string;
67
+ stdoutCursor?: string;
68
+ }>, context: ToolExecutionContext): Promise<PortResult<CommandSessionReadResult>>;
69
+ write(input: Readonly<{
70
+ input: string;
71
+ sessionId: string;
72
+ }>, context: ToolExecutionContext): Promise<PortResult<Readonly<{
73
+ accepted: boolean;
74
+ }>>>;
75
+ interrupt(input: Readonly<{
76
+ sessionId: string;
77
+ }>, context: ToolExecutionContext): Promise<PortResult<Readonly<{
78
+ interrupted: boolean;
79
+ }>>>;
80
+ kill(input: Readonly<{
81
+ sessionId: string;
82
+ }>, context: ToolExecutionContext): Promise<PortResult<Readonly<{
83
+ killed: boolean;
84
+ }>>>;
85
+ list(input: PaginationRequest, context: ToolExecutionContext): Promise<PortResult<Readonly<{
86
+ pagination: PaginationResult;
87
+ sessions: readonly CommandSessionListEntry[];
88
+ }>>>;
89
+ }
90
+ /** Convenience type for hosts that deliberately expose both capabilities. */
91
+ export type CommandPort = CommandRunnerPort & Readonly<{
92
+ session: CommandSessionPort;
93
+ }>;
94
+ //# sourceMappingURL=command-port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-port.d.ts","sourceRoot":"","sources":["../../src/ports/command-port.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,QAAQ,CAAC;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC9C,UAAU,EAAE,QAAQ,CAAC;QACnB,MAAM,EAAE,gBAAgB,CAAC;QACzB,MAAM,EAAE,gBAAgB,CAAC;KAC1B,CAAC,CAAC;IACH,MAAM,EAAE,SAAS,GAAG,iBAAiB,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MA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191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Cancellable bounded command execution and supervised terminal sessions.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=command-port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-port.js","sourceRoot":"","sources":["../../src/ports/command-port.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-28
5
+ * @modify date 2026-08-28
6
+ * @desc Correlation, policy, cancellation, and deadline metadata carried by every host operation.
7
+ */
8
+ export type AiCoderTaskMode = "auto" | "scaffold" | "refactor" | "review_only" | "validate_only";
9
+ /**
10
+ * Context shared by all operations in one run. `deadline` is an absolute Unix
11
+ * timestamp in milliseconds so adapters cannot accidentally reset the budget.
12
+ */
13
+ export type RunExecutionContext = Readonly<{
14
+ deadline: number;
15
+ mode: AiCoderTaskMode;
16
+ runId: string;
17
+ signal: AbortSignal;
18
+ taskId: string;
19
+ workspaceRoot: string;
20
+ }>;
21
+ /**
22
+ * Context for one routed tool call. The idempotency key is generated by the
23
+ * core, never by the model, and remains stable across safe retries.
24
+ */
25
+ export type ToolExecutionContext = RunExecutionContext & Readonly<{
26
+ idempotencyKey: string;
27
+ toolCallId: string;
28
+ }>;
29
+ export declare function isExecutionCanceled(context: RunExecutionContext, now?: number): boolean;
30
+ //# sourceMappingURL=execution-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-context.d.ts","sourceRoot":"","sources":["../../src/ports/execution-context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,UAAU,GACV,UAAU,GACV,aAAa,GACb,eAAe,CAAC;AAEpB;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,GACpD,QAAQ,CAAC;IACP,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEL,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,mBAAmB,EAC5B,GAAG,SAAa,GACf,OAAO,CAET"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-28
5
+ * @modify date 2026-08-28
6
+ * @desc Correlation, policy, cancellation, and deadline metadata carried by every host operation.
7
+ */
8
+ export function isExecutionCanceled(context, now = Date.now()) {
9
+ return context.signal.aborted || now >= context.deadline;
10
+ }
11
+ //# sourceMappingURL=execution-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-context.js","sourceRoot":"","sources":["../../src/ports/execution-context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgCH,MAAM,UAAU,mBAAmB,CACjC,OAA4B,EAC5B,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IAEhB,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Bounded read-only Git operations. Mutations remain approval-gated commands.
7
+ */
8
+ import type { ToolExecutionContext } from "./execution-context.js";
9
+ import type { PaginationRequest, PaginationResult } from "./pagination.js";
10
+ import type { PortResult } from "./port-result.js";
11
+ export type GitCommandResult = Readonly<{
12
+ pagination: PaginationResult;
13
+ stderr: string;
14
+ stdout: string;
15
+ }>;
16
+ export interface GitPort {
17
+ status(input: PaginationRequest & Readonly<{
18
+ paths?: readonly string[];
19
+ }>, context: ToolExecutionContext): Promise<PortResult<GitCommandResult>>;
20
+ diff(input: PaginationRequest & Readonly<{
21
+ paths?: readonly string[];
22
+ }>, context: ToolExecutionContext): Promise<PortResult<GitCommandResult>>;
23
+ log(input: PaginationRequest & Readonly<{
24
+ paths?: readonly string[];
25
+ }>, context: ToolExecutionContext): Promise<PortResult<GitCommandResult>>;
26
+ }
27
+ //# sourceMappingURL=git-port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-port.d.ts","sourceRoot":"","sources":["../../src/ports/git-port.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,MAAM,WAAW,OAAO;IACtB,MAAM,CACJ,KAAK,EAAE,iBAAiB,GAAG,QAAQ,CAAC;QAAE,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC,EAClE,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACzC,IAAI,CACF,KAAK,EAAE,iBAAiB,GAAG,QAAQ,CAAC;QAAE,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC,EAClE,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACzC,GAAG,CACD,KAAK,EAAE,iBAAiB,GAAG,QAAQ,CAAC;QAAE,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC,EAClE,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;CAC1C"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Bounded read-only Git operations. Mutations remain approval-gated commands.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=git-port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-port.js","sourceRoot":"","sources":["../../src/ports/git-port.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Interface-segregated host capabilities consumed by the single-agent runtime.
7
+ */
8
+ import type { ApprovalPort } from "./approval-port.js";
9
+ import type { ArtifactPort } from "./artifact-port.js";
10
+ import type { CodingModelPort } from "./coding-model-port.js";
11
+ import type { CommandRunnerPort, CommandSessionPort } from "./command-port.js";
12
+ import type { GitPort } from "./git-port.js";
13
+ import type { PersistencePort } from "./persistence-port.js";
14
+ import type { PreviewPort } from "./preview-port.js";
15
+ import type { ResearchPort } from "./research-port.js";
16
+ import type { TracePort } from "./trace-port.js";
17
+ import type { WorkspaceReaderPort, WorkspaceWriterPort } from "./workspace-port.js";
18
+ export type RequiredHostPorts = Readonly<{
19
+ codingModel: CodingModelPort;
20
+ workspaceReader: WorkspaceReaderPort;
21
+ }>;
22
+ /** Optional ports are absent—not stubs—when a host cannot safely implement them. */
23
+ export type OptionalHostPorts = Readonly<{
24
+ approval?: ApprovalPort;
25
+ artifact?: ArtifactPort;
26
+ command?: CommandRunnerPort;
27
+ commandSession?: CommandSessionPort;
28
+ git?: GitPort;
29
+ persistence?: PersistencePort;
30
+ preview?: PreviewPort;
31
+ research?: ResearchPort;
32
+ trace?: TracePort;
33
+ workspaceWriter?: WorkspaceWriterPort;
34
+ }>;
35
+ export type HostAdapter = RequiredHostPorts & OptionalHostPorts;
36
+ //# sourceMappingURL=host-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-adapter.d.ts","sourceRoot":"","sources":["../../src/ports/host-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,WAAW,EAAE,eAAe,CAAC;IAC7B,eAAe,EAAE,mBAAmB,CAAC;CACtC,CAAC,CAAC;AAEH,oFAAoF;AACpF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,eAAe,CAAC,EAAE,mBAAmB,CAAC;CACvC,CAAC,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG,iBAAiB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-21
5
+ * @modify date 2026-08-28
6
+ * @desc Interface-segregated host capabilities consumed by the single-agent runtime.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=host-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-adapter.js","sourceRoot":"","sources":["../../src/ports/host-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,16 @@
1
+ export * from "./approval-port.js";
2
+ export * from "./artifact-port.js";
3
+ export * from "./capability-port.js";
4
+ export * from "./coding-model-port.js";
5
+ export * from "./command-port.js";
6
+ export * from "./execution-context.js";
7
+ export * from "./git-port.js";
8
+ export * from "./host-adapter.js";
9
+ export * from "./pagination.js";
10
+ export * from "./persistence-port.js";
11
+ export * from "./port-result.js";
12
+ export * from "./preview-port.js";
13
+ export * from "./research-port.js";
14
+ export * from "./trace-port.js";
15
+ export * from "./workspace-port.js";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ports/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,16 @@
1
+ export * from "./approval-port.js";
2
+ export * from "./artifact-port.js";
3
+ export * from "./capability-port.js";
4
+ export * from "./coding-model-port.js";
5
+ export * from "./command-port.js";
6
+ export * from "./execution-context.js";
7
+ export * from "./git-port.js";
8
+ export * from "./host-adapter.js";
9
+ export * from "./pagination.js";
10
+ export * from "./persistence-port.js";
11
+ export * from "./port-result.js";
12
+ export * from "./preview-port.js";
13
+ export * from "./research-port.js";
14
+ export * from "./trace-port.js";
15
+ export * from "./workspace-port.js";
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ports/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-28
5
+ * @modify date 2026-08-28
6
+ * @desc Opaque cursor contracts shared by bounded host operations.
7
+ */
8
+ export type PaginationRequest = Readonly<{
9
+ cursor?: string;
10
+ limit?: number;
11
+ }>;
12
+ export type PaginationResult = Readonly<{
13
+ hasMore: boolean;
14
+ nextCursor?: string;
15
+ }>;
16
+ export declare const END_OF_PAGE: PaginationResult;
17
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/ports/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,gBAAoD,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author Bùi Trọng Hiếu
3
+ * @email kevinbui210191@gmail.com
4
+ * @create date 2026-08-28
5
+ * @modify date 2026-08-28
6
+ * @desc Opaque cursor contracts shared by bounded host operations.
7
+ */
8
+ export const END_OF_PAGE = Object.freeze({ hasMore: false });
9
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/ports/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,MAAM,CAAC,MAAM,WAAW,GAAqB,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC"}