@moxxy/sdk 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 (211) hide show
  1. package/dist/agent.d.ts +39 -0
  2. package/dist/agent.d.ts.map +1 -0
  3. package/dist/agent.js +2 -0
  4. package/dist/agent.js.map +1 -0
  5. package/dist/cache-strategy.d.ts +35 -0
  6. package/dist/cache-strategy.d.ts.map +1 -0
  7. package/dist/cache-strategy.js +2 -0
  8. package/dist/cache-strategy.js.map +1 -0
  9. package/dist/channel.d.ts +146 -0
  10. package/dist/channel.d.ts.map +1 -0
  11. package/dist/channel.js +2 -0
  12. package/dist/channel.js.map +1 -0
  13. package/dist/client-session.d.ts +83 -0
  14. package/dist/client-session.d.ts.map +1 -0
  15. package/dist/client-session.js +2 -0
  16. package/dist/client-session.js.map +1 -0
  17. package/dist/command.d.ts +90 -0
  18. package/dist/command.d.ts.map +1 -0
  19. package/dist/command.js +15 -0
  20. package/dist/command.js.map +1 -0
  21. package/dist/compactor-helpers.d.ts +34 -0
  22. package/dist/compactor-helpers.d.ts.map +1 -0
  23. package/dist/compactor-helpers.js +156 -0
  24. package/dist/compactor-helpers.js.map +1 -0
  25. package/dist/compactor.d.ts +20 -0
  26. package/dist/compactor.d.ts.map +1 -0
  27. package/dist/compactor.js +2 -0
  28. package/dist/compactor.js.map +1 -0
  29. package/dist/define.d.ts +51 -0
  30. package/dist/define.d.ts.map +1 -0
  31. package/dist/define.js +71 -0
  32. package/dist/define.js.map +1 -0
  33. package/dist/elision-helpers.d.ts +27 -0
  34. package/dist/elision-helpers.d.ts.map +1 -0
  35. package/dist/elision-helpers.js +109 -0
  36. package/dist/elision-helpers.js.map +1 -0
  37. package/dist/elision-state.d.ts +49 -0
  38. package/dist/elision-state.d.ts.map +1 -0
  39. package/dist/elision-state.js +144 -0
  40. package/dist/elision-state.js.map +1 -0
  41. package/dist/embedding-cache.d.ts +32 -0
  42. package/dist/embedding-cache.d.ts.map +1 -0
  43. package/dist/embedding-cache.js +0 -0
  44. package/dist/embedding-cache.js.map +1 -0
  45. package/dist/embedding.d.ts +21 -0
  46. package/dist/embedding.d.ts.map +1 -0
  47. package/dist/embedding.js +2 -0
  48. package/dist/embedding.js.map +1 -0
  49. package/dist/errors.d.ts +81 -0
  50. package/dist/errors.d.ts.map +1 -0
  51. package/dist/errors.js +241 -0
  52. package/dist/errors.js.map +1 -0
  53. package/dist/events.d.ts +193 -0
  54. package/dist/events.d.ts.map +1 -0
  55. package/dist/events.js +2 -0
  56. package/dist/events.js.map +1 -0
  57. package/dist/hooks.d.ts +52 -0
  58. package/dist/hooks.d.ts.map +1 -0
  59. package/dist/hooks.js +2 -0
  60. package/dist/hooks.js.map +1 -0
  61. package/dist/ids.d.ts +18 -0
  62. package/dist/ids.d.ts.map +1 -0
  63. package/dist/ids.js +7 -0
  64. package/dist/ids.js.map +1 -0
  65. package/dist/index.d.ts +45 -0
  66. package/dist/index.d.ts.map +1 -0
  67. package/dist/index.js +18 -0
  68. package/dist/index.js.map +1 -0
  69. package/dist/install-hints.d.ts +26 -0
  70. package/dist/install-hints.d.ts.map +1 -0
  71. package/dist/install-hints.js +15 -0
  72. package/dist/install-hints.js.map +1 -0
  73. package/dist/isolation.d.ts +125 -0
  74. package/dist/isolation.d.ts.map +1 -0
  75. package/dist/isolation.js +11 -0
  76. package/dist/isolation.js.map +1 -0
  77. package/dist/log.d.ts +11 -0
  78. package/dist/log.d.ts.map +1 -0
  79. package/dist/log.js +2 -0
  80. package/dist/log.js.map +1 -0
  81. package/dist/mode-helpers.d.ts +99 -0
  82. package/dist/mode-helpers.d.ts.map +1 -0
  83. package/dist/mode-helpers.js +368 -0
  84. package/dist/mode-helpers.js.map +1 -0
  85. package/dist/mode.d.ts +133 -0
  86. package/dist/mode.d.ts.map +1 -0
  87. package/dist/mode.js +2 -0
  88. package/dist/mode.js.map +1 -0
  89. package/dist/permission.d.ts +35 -0
  90. package/dist/permission.d.ts.map +1 -0
  91. package/dist/permission.js +2 -0
  92. package/dist/permission.js.map +1 -0
  93. package/dist/plugin.d.ts +88 -0
  94. package/dist/plugin.d.ts.map +1 -0
  95. package/dist/plugin.js +2 -0
  96. package/dist/plugin.js.map +1 -0
  97. package/dist/provider-utils.d.ts +40 -0
  98. package/dist/provider-utils.d.ts.map +1 -0
  99. package/dist/provider-utils.js +163 -0
  100. package/dist/provider-utils.js.map +1 -0
  101. package/dist/provider.d.ts +219 -0
  102. package/dist/provider.d.ts.map +1 -0
  103. package/dist/provider.js +2 -0
  104. package/dist/provider.js.map +1 -0
  105. package/dist/requirements.d.ts +22 -0
  106. package/dist/requirements.d.ts.map +1 -0
  107. package/dist/requirements.js +2 -0
  108. package/dist/requirements.js.map +1 -0
  109. package/dist/schemas.d.ts +228 -0
  110. package/dist/schemas.d.ts.map +1 -0
  111. package/dist/schemas.js +88 -0
  112. package/dist/schemas.js.map +1 -0
  113. package/dist/session-like.d.ts +111 -0
  114. package/dist/session-like.d.ts.map +1 -0
  115. package/dist/session-like.js +2 -0
  116. package/dist/session-like.js.map +1 -0
  117. package/dist/skill.d.ts +30 -0
  118. package/dist/skill.d.ts.map +1 -0
  119. package/dist/skill.js +2 -0
  120. package/dist/skill.js.map +1 -0
  121. package/dist/subagent.d.ts +45 -0
  122. package/dist/subagent.d.ts.map +1 -0
  123. package/dist/subagent.js +11 -0
  124. package/dist/subagent.js.map +1 -0
  125. package/dist/token-accounting.d.ts +73 -0
  126. package/dist/token-accounting.d.ts.map +1 -0
  127. package/dist/token-accounting.js +129 -0
  128. package/dist/token-accounting.js.map +1 -0
  129. package/dist/tool-dispatch.d.ts +19 -0
  130. package/dist/tool-dispatch.d.ts.map +1 -0
  131. package/dist/tool-dispatch.js +118 -0
  132. package/dist/tool-dispatch.js.map +1 -0
  133. package/dist/tool-gating.d.ts +32 -0
  134. package/dist/tool-gating.d.ts.map +1 -0
  135. package/dist/tool-gating.js +83 -0
  136. package/dist/tool-gating.js.map +1 -0
  137. package/dist/tool.d.ts +166 -0
  138. package/dist/tool.d.ts.map +1 -0
  139. package/dist/tool.js +2 -0
  140. package/dist/tool.js.map +1 -0
  141. package/dist/transcriber.d.ts +64 -0
  142. package/dist/transcriber.d.ts.map +1 -0
  143. package/dist/transcriber.js +21 -0
  144. package/dist/transcriber.js.map +1 -0
  145. package/dist/tunnel.d.ts +25 -0
  146. package/dist/tunnel.d.ts.map +1 -0
  147. package/dist/tunnel.js +2 -0
  148. package/dist/tunnel.js.map +1 -0
  149. package/dist/type-contracts.d.ts +2 -0
  150. package/dist/type-contracts.d.ts.map +1 -0
  151. package/dist/type-contracts.js +4 -0
  152. package/dist/type-contracts.js.map +1 -0
  153. package/dist/types.test-d.d.ts +2 -0
  154. package/dist/types.test-d.d.ts.map +1 -0
  155. package/dist/types.test-d.js +22 -0
  156. package/dist/types.test-d.js.map +1 -0
  157. package/dist/view-renderer.d.ts +97 -0
  158. package/dist/view-renderer.d.ts.map +1 -0
  159. package/dist/view-renderer.js +72 -0
  160. package/dist/view-renderer.js.map +1 -0
  161. package/package.json +38 -0
  162. package/src/agent.ts +38 -0
  163. package/src/cache-strategy.ts +39 -0
  164. package/src/channel.ts +158 -0
  165. package/src/client-session.ts +88 -0
  166. package/src/command.ts +86 -0
  167. package/src/compactor-helpers.test.ts +206 -0
  168. package/src/compactor-helpers.ts +163 -0
  169. package/src/compactor.ts +20 -0
  170. package/src/define.test.ts +76 -0
  171. package/src/define.ts +113 -0
  172. package/src/elision-helpers.ts +143 -0
  173. package/src/elision-state.ts +170 -0
  174. package/src/embedding-cache.ts +0 -0
  175. package/src/embedding.ts +22 -0
  176. package/src/errors.test.ts +176 -0
  177. package/src/errors.ts +308 -0
  178. package/src/events.ts +250 -0
  179. package/src/hooks.ts +54 -0
  180. package/src/ids.ts +16 -0
  181. package/src/index.ts +304 -0
  182. package/src/install-hints.ts +43 -0
  183. package/src/isolation.ts +148 -0
  184. package/src/log.ts +11 -0
  185. package/src/loop-helpers.test.ts +78 -0
  186. package/src/mode-helpers.ts +483 -0
  187. package/src/mode.ts +139 -0
  188. package/src/package-root.test.ts +40 -0
  189. package/src/permission.ts +37 -0
  190. package/src/plugin.ts +92 -0
  191. package/src/provider-utils.test.ts +84 -0
  192. package/src/provider-utils.ts +171 -0
  193. package/src/provider.ts +195 -0
  194. package/src/requirements.ts +35 -0
  195. package/src/schemas.test.ts +106 -0
  196. package/src/schemas.ts +97 -0
  197. package/src/session-like.ts +118 -0
  198. package/src/skill.ts +34 -0
  199. package/src/subagent.ts +46 -0
  200. package/src/token-accounting.test.ts +93 -0
  201. package/src/token-accounting.ts +202 -0
  202. package/src/token-efficiency.test.ts +459 -0
  203. package/src/tool-dispatch.ts +137 -0
  204. package/src/tool-gating.ts +107 -0
  205. package/src/tool.ts +175 -0
  206. package/src/transcriber.ts +71 -0
  207. package/src/tunnel.ts +26 -0
  208. package/src/type-contracts.ts +4 -0
  209. package/src/types.test-d.ts +29 -0
  210. package/src/view-renderer.test.ts +90 -0
  211. package/src/view-renderer.ts +156 -0
@@ -0,0 +1,228 @@
1
+ import { z } from 'zod';
2
+ export declare const requirementSchema: z.ZodObject<{
3
+ kind: z.ZodEnum<["plugin", "provider", "tool", "transcriber", "mode", "compactor", "channel", "agent", "command", "runtime"]>;
4
+ name: z.ZodString;
5
+ state: z.ZodOptional<z.ZodEnum<["registered", "active", "ready"]>>;
6
+ version: z.ZodOptional<z.ZodString>;
7
+ optional: z.ZodOptional<z.ZodBoolean>;
8
+ reason: z.ZodOptional<z.ZodString>;
9
+ hint: z.ZodOptional<z.ZodString>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ name: string;
12
+ kind: "tool" | "plugin" | "compactor" | "provider" | "mode" | "channel" | "agent" | "command" | "transcriber" | "runtime";
13
+ hint?: string | undefined;
14
+ reason?: string | undefined;
15
+ version?: string | undefined;
16
+ state?: "registered" | "active" | "ready" | undefined;
17
+ optional?: boolean | undefined;
18
+ }, {
19
+ name: string;
20
+ kind: "tool" | "plugin" | "compactor" | "provider" | "mode" | "channel" | "agent" | "command" | "transcriber" | "runtime";
21
+ hint?: string | undefined;
22
+ reason?: string | undefined;
23
+ version?: string | undefined;
24
+ state?: "registered" | "active" | "ready" | undefined;
25
+ optional?: boolean | undefined;
26
+ }>;
27
+ /**
28
+ * Optional schedule block on a skill. When present, the scheduler
29
+ * plugin (if installed) automatically registers a recurring or one-shot
30
+ * trigger that runs the skill body as a prompt. Either `cron` or
31
+ * `runAt` must be set; supplying both is rejected by the scheduler.
32
+ */
33
+ export declare const skillScheduleSchema: z.ZodEffects<z.ZodObject<{
34
+ cron: z.ZodOptional<z.ZodString>;
35
+ runAt: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
36
+ timeZone: z.ZodOptional<z.ZodString>;
37
+ channel: z.ZodOptional<z.ZodString>;
38
+ enabled: z.ZodOptional<z.ZodBoolean>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ channel?: string | undefined;
41
+ cron?: string | undefined;
42
+ runAt?: string | number | undefined;
43
+ timeZone?: string | undefined;
44
+ enabled?: boolean | undefined;
45
+ }, {
46
+ channel?: string | undefined;
47
+ cron?: string | undefined;
48
+ runAt?: string | number | undefined;
49
+ timeZone?: string | undefined;
50
+ enabled?: boolean | undefined;
51
+ }>, {
52
+ channel?: string | undefined;
53
+ cron?: string | undefined;
54
+ runAt?: string | number | undefined;
55
+ timeZone?: string | undefined;
56
+ enabled?: boolean | undefined;
57
+ }, {
58
+ channel?: string | undefined;
59
+ cron?: string | undefined;
60
+ runAt?: string | number | undefined;
61
+ timeZone?: string | undefined;
62
+ enabled?: boolean | undefined;
63
+ }>;
64
+ export declare const skillFrontmatterSchema: z.ZodObject<{
65
+ name: z.ZodString;
66
+ description: z.ZodString;
67
+ triggers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
68
+ 'allowed-tools': z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
69
+ version: z.ZodOptional<z.ZodString>;
70
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
71
+ /** Opt the skill into automatic recurring/one-shot execution. */
72
+ schedule: z.ZodOptional<z.ZodEffects<z.ZodObject<{
73
+ cron: z.ZodOptional<z.ZodString>;
74
+ runAt: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
75
+ timeZone: z.ZodOptional<z.ZodString>;
76
+ channel: z.ZodOptional<z.ZodString>;
77
+ enabled: z.ZodOptional<z.ZodBoolean>;
78
+ }, "strip", z.ZodTypeAny, {
79
+ channel?: string | undefined;
80
+ cron?: string | undefined;
81
+ runAt?: string | number | undefined;
82
+ timeZone?: string | undefined;
83
+ enabled?: boolean | undefined;
84
+ }, {
85
+ channel?: string | undefined;
86
+ cron?: string | undefined;
87
+ runAt?: string | number | undefined;
88
+ timeZone?: string | undefined;
89
+ enabled?: boolean | undefined;
90
+ }>, {
91
+ channel?: string | undefined;
92
+ cron?: string | undefined;
93
+ runAt?: string | number | undefined;
94
+ timeZone?: string | undefined;
95
+ enabled?: boolean | undefined;
96
+ }, {
97
+ channel?: string | undefined;
98
+ cron?: string | undefined;
99
+ runAt?: string | number | undefined;
100
+ timeZone?: string | undefined;
101
+ enabled?: boolean | undefined;
102
+ }>>;
103
+ }, "strip", z.ZodTypeAny, {
104
+ name: string;
105
+ description: string;
106
+ version?: string | undefined;
107
+ triggers?: string[] | undefined;
108
+ 'allowed-tools'?: string[] | undefined;
109
+ tags?: string[] | undefined;
110
+ schedule?: {
111
+ channel?: string | undefined;
112
+ cron?: string | undefined;
113
+ runAt?: string | number | undefined;
114
+ timeZone?: string | undefined;
115
+ enabled?: boolean | undefined;
116
+ } | undefined;
117
+ }, {
118
+ name: string;
119
+ description: string;
120
+ version?: string | undefined;
121
+ triggers?: string[] | undefined;
122
+ 'allowed-tools'?: string[] | undefined;
123
+ tags?: string[] | undefined;
124
+ schedule?: {
125
+ channel?: string | undefined;
126
+ cron?: string | undefined;
127
+ runAt?: string | number | undefined;
128
+ timeZone?: string | undefined;
129
+ enabled?: boolean | undefined;
130
+ } | undefined;
131
+ }>;
132
+ export declare const pluginManifestSchema: z.ZodObject<{
133
+ entry: z.ZodString;
134
+ kind: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["tools", "provider", "mode", "compactor", "cache-strategy", "view-renderer", "tunnel-provider", "mcp", "cli", "channel", "hooks", "agent", "command", "transcriber"]>, z.ZodArray<z.ZodEnum<["tools", "provider", "mode", "compactor", "cache-strategy", "view-renderer", "tunnel-provider", "mcp", "cli", "channel", "hooks", "agent", "command", "transcriber"]>, "many">]>>;
135
+ skills: z.ZodOptional<z.ZodString>;
136
+ }, "strip", z.ZodTypeAny, {
137
+ entry: string;
138
+ kind?: "compactor" | "tools" | "provider" | "mode" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber" | ("compactor" | "tools" | "provider" | "mode" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber")[] | undefined;
139
+ skills?: string | undefined;
140
+ }, {
141
+ entry: string;
142
+ kind?: "compactor" | "tools" | "provider" | "mode" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber" | ("compactor" | "tools" | "provider" | "mode" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber")[] | undefined;
143
+ skills?: string | undefined;
144
+ }>;
145
+ /**
146
+ * Shape of a package's `moxxy` field in package.json.
147
+ *
148
+ * - `plugin` — the per-package plugin manifest (`entry`, `kind`, `skills`).
149
+ * When omitted the package is not treated as a moxxy plugin.
150
+ * - `requirements` — declarative prerequisites that gate plugin
151
+ * registration and drive load-order toposort. This is the SINGLE place
152
+ * requirements may be authored; per-tool/per-transcriber/per-anything
153
+ * runtime declarations were removed in favor of static analysis.
154
+ */
155
+ export declare const moxxyPackageSchema: z.ZodObject<{
156
+ plugin: z.ZodOptional<z.ZodObject<{
157
+ entry: z.ZodString;
158
+ kind: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["tools", "provider", "mode", "compactor", "cache-strategy", "view-renderer", "tunnel-provider", "mcp", "cli", "channel", "hooks", "agent", "command", "transcriber"]>, z.ZodArray<z.ZodEnum<["tools", "provider", "mode", "compactor", "cache-strategy", "view-renderer", "tunnel-provider", "mcp", "cli", "channel", "hooks", "agent", "command", "transcriber"]>, "many">]>>;
159
+ skills: z.ZodOptional<z.ZodString>;
160
+ }, "strip", z.ZodTypeAny, {
161
+ entry: string;
162
+ kind?: "compactor" | "tools" | "provider" | "mode" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber" | ("compactor" | "tools" | "provider" | "mode" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber")[] | undefined;
163
+ skills?: string | undefined;
164
+ }, {
165
+ entry: string;
166
+ kind?: "compactor" | "tools" | "provider" | "mode" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber" | ("compactor" | "tools" | "provider" | "mode" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber")[] | undefined;
167
+ skills?: string | undefined;
168
+ }>>;
169
+ requirements: z.ZodOptional<z.ZodArray<z.ZodObject<{
170
+ kind: z.ZodEnum<["plugin", "provider", "tool", "transcriber", "mode", "compactor", "channel", "agent", "command", "runtime"]>;
171
+ name: z.ZodString;
172
+ state: z.ZodOptional<z.ZodEnum<["registered", "active", "ready"]>>;
173
+ version: z.ZodOptional<z.ZodString>;
174
+ optional: z.ZodOptional<z.ZodBoolean>;
175
+ reason: z.ZodOptional<z.ZodString>;
176
+ hint: z.ZodOptional<z.ZodString>;
177
+ }, "strip", z.ZodTypeAny, {
178
+ name: string;
179
+ kind: "tool" | "plugin" | "compactor" | "provider" | "mode" | "channel" | "agent" | "command" | "transcriber" | "runtime";
180
+ hint?: string | undefined;
181
+ reason?: string | undefined;
182
+ version?: string | undefined;
183
+ state?: "registered" | "active" | "ready" | undefined;
184
+ optional?: boolean | undefined;
185
+ }, {
186
+ name: string;
187
+ kind: "tool" | "plugin" | "compactor" | "provider" | "mode" | "channel" | "agent" | "command" | "transcriber" | "runtime";
188
+ hint?: string | undefined;
189
+ reason?: string | undefined;
190
+ version?: string | undefined;
191
+ state?: "registered" | "active" | "ready" | undefined;
192
+ optional?: boolean | undefined;
193
+ }>, "many">>;
194
+ }, "strip", z.ZodTypeAny, {
195
+ plugin?: {
196
+ entry: string;
197
+ kind?: "compactor" | "tools" | "provider" | "mode" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber" | ("compactor" | "tools" | "provider" | "mode" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber")[] | undefined;
198
+ skills?: string | undefined;
199
+ } | undefined;
200
+ requirements?: {
201
+ name: string;
202
+ kind: "tool" | "plugin" | "compactor" | "provider" | "mode" | "channel" | "agent" | "command" | "transcriber" | "runtime";
203
+ hint?: string | undefined;
204
+ reason?: string | undefined;
205
+ version?: string | undefined;
206
+ state?: "registered" | "active" | "ready" | undefined;
207
+ optional?: boolean | undefined;
208
+ }[] | undefined;
209
+ }, {
210
+ plugin?: {
211
+ entry: string;
212
+ kind?: "compactor" | "tools" | "provider" | "mode" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber" | ("compactor" | "tools" | "provider" | "mode" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber")[] | undefined;
213
+ skills?: string | undefined;
214
+ } | undefined;
215
+ requirements?: {
216
+ name: string;
217
+ kind: "tool" | "plugin" | "compactor" | "provider" | "mode" | "channel" | "agent" | "command" | "transcriber" | "runtime";
218
+ hint?: string | undefined;
219
+ reason?: string | undefined;
220
+ version?: string | undefined;
221
+ state?: "registered" | "active" | "ready" | undefined;
222
+ optional?: boolean | undefined;
223
+ }[] | undefined;
224
+ }>;
225
+ export type SkillFrontmatterInput = z.infer<typeof skillFrontmatterSchema>;
226
+ export type PluginManifestInput = z.infer<typeof pluginManifestSchema>;
227
+ export type MoxxyPackageInput = z.infer<typeof moxxyPackageSchema>;
228
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;EAmB5B,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY5B,CAAC;AAEL,eAAO,MAAM,sBAAsB;;;;;;;IAOjC,iEAAiE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEjE,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAM/B,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG7B,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC3E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,88 @@
1
+ import { z } from 'zod';
2
+ const pluginKindSchema = z.enum([
3
+ 'tools',
4
+ 'provider',
5
+ 'mode',
6
+ 'compactor',
7
+ 'cache-strategy',
8
+ 'view-renderer',
9
+ 'tunnel-provider',
10
+ 'mcp',
11
+ 'cli',
12
+ 'channel',
13
+ 'hooks',
14
+ 'agent',
15
+ 'command',
16
+ 'transcriber',
17
+ ]);
18
+ export const requirementSchema = z.object({
19
+ kind: z.enum([
20
+ 'plugin',
21
+ 'provider',
22
+ 'tool',
23
+ 'transcriber',
24
+ 'mode',
25
+ 'compactor',
26
+ 'channel',
27
+ 'agent',
28
+ 'command',
29
+ 'runtime',
30
+ ]),
31
+ name: z.string().min(1),
32
+ state: z.enum(['registered', 'active', 'ready']).optional(),
33
+ version: z.string().min(1).optional(),
34
+ optional: z.boolean().optional(),
35
+ reason: z.string().min(1).optional(),
36
+ hint: z.string().min(1).optional(),
37
+ });
38
+ /**
39
+ * Optional schedule block on a skill. When present, the scheduler
40
+ * plugin (if installed) automatically registers a recurring or one-shot
41
+ * trigger that runs the skill body as a prompt. Either `cron` or
42
+ * `runAt` must be set; supplying both is rejected by the scheduler.
43
+ */
44
+ export const skillScheduleSchema = z
45
+ .object({
46
+ cron: z.string().min(1).optional(),
47
+ runAt: z
48
+ .union([z.number().int(), z.string().min(1)])
49
+ .optional(),
50
+ timeZone: z.string().min(1).optional(),
51
+ channel: z.string().min(1).optional(),
52
+ enabled: z.boolean().optional(),
53
+ })
54
+ .refine((v) => !!v.cron || v.runAt !== undefined, {
55
+ message: 'schedule needs either `cron` or `runAt`',
56
+ });
57
+ export const skillFrontmatterSchema = z.object({
58
+ name: z.string().min(1).max(120).regex(/^[a-z0-9][a-z0-9-]*$/, 'name must be slug-like'),
59
+ description: z.string().min(1).max(240),
60
+ triggers: z.array(z.string().min(1)).optional(),
61
+ 'allowed-tools': z.array(z.string().min(1)).optional(),
62
+ version: z.string().optional(),
63
+ tags: z.array(z.string().min(1)).optional(),
64
+ /** Opt the skill into automatic recurring/one-shot execution. */
65
+ schedule: skillScheduleSchema.optional(),
66
+ });
67
+ export const pluginManifestSchema = z.object({
68
+ entry: z.string().min(1),
69
+ kind: z
70
+ .union([pluginKindSchema, z.array(pluginKindSchema)])
71
+ .optional(),
72
+ skills: z.string().optional(),
73
+ });
74
+ /**
75
+ * Shape of a package's `moxxy` field in package.json.
76
+ *
77
+ * - `plugin` — the per-package plugin manifest (`entry`, `kind`, `skills`).
78
+ * When omitted the package is not treated as a moxxy plugin.
79
+ * - `requirements` — declarative prerequisites that gate plugin
80
+ * registration and drive load-order toposort. This is the SINGLE place
81
+ * requirements may be authored; per-tool/per-transcriber/per-anything
82
+ * runtime declarations were removed in favor of static analysis.
83
+ */
84
+ export const moxxyPackageSchema = z.object({
85
+ plugin: pluginManifestSchema.optional(),
86
+ requirements: z.array(requirementSchema).optional(),
87
+ });
88
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9B,OAAO;IACP,UAAU;IACV,MAAM;IACN,WAAW;IACX,gBAAgB;IAChB,eAAe;IACf,iBAAiB;IACjB,KAAK;IACL,KAAK;IACL,SAAS;IACT,OAAO;IACP,OAAO;IACP,SAAS;IACT,aAAa;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;QACX,QAAQ;QACR,UAAU;QACV,MAAM;QACN,aAAa;QACb,MAAM;QACN,WAAW;QACX,SAAS;QACT,OAAO;QACP,SAAS;QACT,SAAS;KACV,CAAC;IACF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CA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AAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IACvC,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE;CACpD,CAAC,CAAC"}
@@ -0,0 +1,111 @@
1
+ import type { MoxxyEvent, UserPromptAttachment } from './events.js';
2
+ import type { SessionId, TurnId } from './ids.js';
3
+ import type { EventLogReader } from './log.js';
4
+ import type { ApprovalResolver } from './mode.js';
5
+ import type { PermissionResolver } from './permission.js';
6
+ import type { ModelDescriptor } from './provider.js';
7
+ import type { ToolCompactPresentation } from './tool.js';
8
+ /**
9
+ * Options accepted by `SessionLike.runTurn`. Defined here (rather than in
10
+ * `@moxxy/core`) so the runner client and any consumer can reference it
11
+ * without importing the runtime. `@moxxy/core` re-exports it.
12
+ */
13
+ export interface RunTurnOptions {
14
+ readonly model?: string;
15
+ readonly systemPrompt?: string;
16
+ readonly maxIterations?: number;
17
+ /**
18
+ * Per-turn abort signal. Aborting it cancels this turn without tainting
19
+ * the session's own controller (e.g. "user hit Esc on a runaway loop").
20
+ */
21
+ readonly signal?: AbortSignal;
22
+ /** Inline attachments shipped alongside the prompt (images, audio, stdin). */
23
+ readonly attachments?: ReadonlyArray<UserPromptAttachment>;
24
+ /**
25
+ * Pre-minted turn id. When omitted, `runTurn` mints one. The runner passes
26
+ * this so it can return the id to the client *before* the turn starts and
27
+ * associate per-turn permission prompts with the originating client.
28
+ */
29
+ readonly turnId?: TurnId;
30
+ }
31
+ /**
32
+ * The read side of the event log plus the live subscription a channel needs
33
+ * to render in real time. A `RemoteSession` backs this with a local mirror
34
+ * fed by the runner's event stream; a local `Session` backs it with the real
35
+ * `EventLog`.
36
+ */
37
+ export interface SessionLogReader extends EventLogReader {
38
+ subscribe(fn: (event: MoxxyEvent) => void | Promise<void>): () => void;
39
+ }
40
+ /** Serializable provider metadata (models + context windows) for display. */
41
+ export interface ProviderInfo {
42
+ readonly name: string;
43
+ readonly models: ReadonlyArray<ModelDescriptor>;
44
+ }
45
+ /** Serializable tool metadata for status lines / slash menus / compact rendering. */
46
+ export interface ToolInfo {
47
+ readonly name: string;
48
+ readonly description: string;
49
+ /** Compact presentation hint (plain data - crosses the wire intact). */
50
+ readonly compact?: ToolCompactPresentation;
51
+ }
52
+ /** Serializable skill metadata. */
53
+ export interface SkillInfo {
54
+ readonly id: string;
55
+ readonly name: string;
56
+ }
57
+ /** Serializable slash-command metadata for the picker / `/help`. */
58
+ export interface CommandInfo {
59
+ readonly name: string;
60
+ readonly description: string;
61
+ readonly aliases?: ReadonlyArray<string>;
62
+ readonly channels?: ReadonlyArray<string>;
63
+ readonly pendingNotice?: string;
64
+ }
65
+ /**
66
+ * A wire-friendly snapshot of a session's registries - everything a channel
67
+ * needs to *render* (status line, pickers, slash suggestions) without
68
+ * reaching into live registry objects (`LLMProvider`, `ModeDef`, `ToolDef`)
69
+ * whose methods can't cross a transport. A local `Session` builds it from its
70
+ * registries; a `RemoteSession` fetches it from the runner and refreshes it
71
+ * when the runner reports `info.changed`.
72
+ */
73
+ export interface SessionInfo {
74
+ readonly sessionId: SessionId;
75
+ readonly cwd: string;
76
+ readonly activeProvider: string | null;
77
+ readonly providers: ReadonlyArray<ProviderInfo>;
78
+ readonly activeMode: string | null;
79
+ readonly modes: ReadonlyArray<string>;
80
+ readonly tools: ReadonlyArray<ToolInfo>;
81
+ readonly skills: ReadonlyArray<SkillInfo>;
82
+ readonly commands: ReadonlyArray<CommandInfo>;
83
+ /** Provider names the runner has activated (credentials resolved). */
84
+ readonly readyProviders: ReadonlyArray<string>;
85
+ readonly hasTranscriber: boolean;
86
+ /** Name of the active transcriber, or null. Lets a thin client proxy STT. */
87
+ readonly activeTranscriber: string | null;
88
+ }
89
+ /**
90
+ * The session surface a `Channel` depends on, decoupled from whether the
91
+ * session runs in-process (`@moxxy/core`'s `Session`) or is a thin-client
92
+ * proxy (`RemoteSession` from `@moxxy/runner`). The same channel code drives
93
+ * both - the runner/thin-client split hinges on this interface.
94
+ *
95
+ * Behavioral methods (`runTurn`, resolvers, `close`) and the live event log
96
+ * are the contract; richer registry *behavior* (executing a tool, streaming a
97
+ * provider) stays server-side and is never exposed here. For display, use the
98
+ * serializable `getInfo()` snapshot instead of live registry objects.
99
+ */
100
+ export interface SessionLike {
101
+ readonly id: SessionId;
102
+ readonly cwd: string;
103
+ readonly log: SessionLogReader;
104
+ runTurn(prompt: string, opts?: RunTurnOptions): AsyncIterable<MoxxyEvent>;
105
+ setPermissionResolver(resolver: PermissionResolver): void;
106
+ setApprovalResolver(resolver: ApprovalResolver | null): void;
107
+ /** Wire-friendly registry snapshot for rendering. */
108
+ getInfo(): SessionInfo;
109
+ close(reason?: string): Promise<void>;
110
+ }
111
+ //# sourceMappingURL=session-like.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-like.d.ts","sourceRoot":"","sources":["../src/session-like.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEzD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ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CAAC;CACvC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=session-like.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-like.js","sourceRoot":"","sources":["../src/session-like.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import type { SkillId } from './ids.js';
2
+ export interface SkillSchedule {
3
+ readonly cron?: string;
4
+ readonly runAt?: number | string;
5
+ readonly timeZone?: string;
6
+ readonly channel?: string;
7
+ readonly enabled?: boolean;
8
+ }
9
+ export interface SkillFrontmatter {
10
+ readonly name: string;
11
+ readonly description: string;
12
+ readonly triggers?: ReadonlyArray<string>;
13
+ readonly 'allowed-tools'?: ReadonlyArray<string>;
14
+ readonly version?: string;
15
+ readonly tags?: ReadonlyArray<string>;
16
+ readonly schedule?: SkillSchedule;
17
+ }
18
+ export type SkillScope = 'project' | 'user' | 'plugin' | 'builtin';
19
+ export interface Skill {
20
+ readonly id: SkillId;
21
+ readonly path: string;
22
+ readonly scope: SkillScope;
23
+ readonly frontmatter: SkillFrontmatter;
24
+ readonly body: string;
25
+ }
26
+ export interface SkillDef {
27
+ readonly frontmatter: SkillFrontmatter;
28
+ readonly body: string;
29
+ }
30
+ //# sourceMappingURL=skill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC;CACnC;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEnE,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
package/dist/skill.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=skill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.js","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":""}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Subagent primitives — let a running loop strategy or tool spawn one or
3
+ * more child agents that share the parent's tools / skills / providers /
4
+ * permissions but have an isolated event log and (typically) a focused
5
+ * task prompt. Children stream their work back to the parent log as
6
+ * `plugin_event` records with `subagent_*` subtypes, so the TUI and other
7
+ * subscribers can render progress live without waiting for the final
8
+ * message.
9
+ */
10
+ import type { SessionId } from './ids.js';
11
+ import type { StopReason } from './provider-utils.js';
12
+ export interface SubagentSpec {
13
+ /** The user message the child sees as its prompt. */
14
+ readonly prompt: string;
15
+ /** Optional system prompt override for the child. */
16
+ readonly systemPrompt?: string;
17
+ /** Override model id; defaults to the parent's active model. */
18
+ readonly model?: string;
19
+ /** Mode name to run inside the child (default: `'tool-use'`). */
20
+ readonly mode?: string;
21
+ /** Per-child iteration cap (default 50). */
22
+ readonly maxIterations?: number;
23
+ /** Restrict the child to these tools by name. Omit for full inheritance. */
24
+ readonly allowedTools?: ReadonlyArray<string>;
25
+ /** Human-readable label surfaced in `subagent_*` event payloads. */
26
+ readonly label?: string;
27
+ }
28
+ export interface SubagentResult {
29
+ readonly label: string;
30
+ readonly childSessionId: SessionId;
31
+ /** The child's final assistant text (or last non-empty text if it ended on a tool call). */
32
+ readonly text: string;
33
+ readonly stopReason: StopReason;
34
+ /** Populated when the child loop errored fatally or threw. */
35
+ readonly error?: {
36
+ readonly message: string;
37
+ };
38
+ }
39
+ export interface SubagentSpawner {
40
+ /** Run a single child to completion. */
41
+ spawn(spec: SubagentSpec): Promise<SubagentResult>;
42
+ /** Run N children in parallel; resolves with results in input order. */
43
+ spawnAll(specs: ReadonlyArray<SubagentSpec>): Promise<ReadonlyArray<SubagentResult>>;
44
+ }
45
+ //# sourceMappingURL=subagent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagent.d.ts","sourceRoot":"","sources":["../src/subagent.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,YAAY;IAC3B,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,4EAA4E;IAC5E,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9C,oEAAoE;IACpE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,cAAc,EAAE,SAAS,CAAC;IACnC,4FAA4F;IAC5F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C;AAED,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACnD,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC;CACtF"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Subagent primitives — let a running loop strategy or tool spawn one or
3
+ * more child agents that share the parent's tools / skills / providers /
4
+ * permissions but have an isolated event log and (typically) a focused
5
+ * task prompt. Children stream their work back to the parent log as
6
+ * `plugin_event` records with `subagent_*` subtypes, so the TUI and other
7
+ * subscribers can render progress live without waiting for the final
8
+ * message.
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=subagent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagent.js","sourceRoot":"","sources":["../src/subagent.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,73 @@
1
+ import type { MoxxyEvent } from './events.js';
2
+ import type { EventLogReader } from './log.js';
3
+ import type { TokenUsage } from './provider.js';
4
+ /** Partial `provider_response` fields for a given usage; `{}` when usage is absent. */
5
+ export declare function usageEventFields(usage?: TokenUsage): {
6
+ inputTokens?: number;
7
+ outputTokens?: number;
8
+ cacheReadTokens?: number;
9
+ cacheCreationTokens?: number;
10
+ };
11
+ export interface SessionTokenSummary {
12
+ /** Number of provider calls that reported usage. */
13
+ readonly calls: number;
14
+ /** Sum of non-cached input tokens (billed 1.0x). */
15
+ readonly totalInput: number;
16
+ /** Sum of cache-read tokens (billed 0.1x). */
17
+ readonly totalCacheRead: number;
18
+ /** Sum of cache-creation/write tokens (billed 1.25x). */
19
+ readonly totalCacheCreation: number;
20
+ /** Sum of output tokens. */
21
+ readonly totalOutput: number;
22
+ /** Total prompt tokens fed to the model across the session (input + reads + writes). */
23
+ readonly totalPrompt: number;
24
+ /** cacheRead / totalPrompt — fraction of prompt served from cache. */
25
+ readonly cacheHitRate: number;
26
+ /** Billed-equivalent input cost (read 0.1x + write 1.25x + plain 1.0x), in token units. */
27
+ readonly billedInputEq: number;
28
+ /** What the input would cost with no caching (every prompt token at 1.0x). */
29
+ readonly uncachedInputEq: number;
30
+ /** 1 - billedInputEq/uncachedInputEq — fraction of input cost saved by caching. */
31
+ readonly savedRatio: number;
32
+ /**
33
+ * False only when caching is clearly broken: across enough calls the provider
34
+ * is *writing* cache (cacheCreation > 0) but almost never *reading* it back —
35
+ * the signature of an unstable prefix silently paying the 1.25x write tax.
36
+ * True when caching works OR is simply off (no writes) — so this never
37
+ * false-alarms a deliberately disabled cache.
38
+ */
39
+ readonly cacheEffective: boolean;
40
+ }
41
+ /** Fold `provider_response` events into cumulative per-session token totals. */
42
+ export declare function summarizeSessionTokens(log: EventLogReader): SessionTokenSummary;
43
+ /**
44
+ * Same as {@link summarizeSessionTokens} but over a raw event array — for
45
+ * channels (e.g. the TUI) that hold the materialized event stream rather than
46
+ * an `EventLogReader`.
47
+ */
48
+ export declare function summarizeSessionTokensFromEvents(events: ReadonlyArray<MoxxyEvent>): SessionTokenSummary;
49
+ /**
50
+ * Raw per-model token totals — the shape persisted to the cross-session usage
51
+ * aggregate (`~/.moxxy/usage.json`). Unlike {@link SessionTokenSummary} this
52
+ * carries no derived/cost fields: it's a plain additive counter so totals from
53
+ * many sessions can be summed without re-deriving ratios.
54
+ */
55
+ export interface ModelUsageTotals {
56
+ /** Provider calls that reported usage for this model. */
57
+ readonly calls: number;
58
+ readonly inputTokens: number;
59
+ readonly outputTokens: number;
60
+ readonly cacheReadTokens: number;
61
+ readonly cacheCreationTokens: number;
62
+ }
63
+ /** Add two {@link ModelUsageTotals} field-wise (for merging session deltas into the aggregate). */
64
+ export declare function addModelTotals(a: ModelUsageTotals, b: ModelUsageTotals): ModelUsageTotals;
65
+ /**
66
+ * Fold `provider_response` events into per-model token totals, keyed by
67
+ * `"<provider>/<model>"` (the same model id can be served by more than one
68
+ * provider, so both pin the key). Used by the usage-stats plugin to compute a
69
+ * session's contribution and by the `/usage` panel to render the lifetime
70
+ * breakdown.
71
+ */
72
+ export declare function summarizeTokensByModel(events: ReadonlyArray<MoxxyEvent>): Record<string, ModelUsageTotals>;
73
+ //# sourceMappingURL=token-accounting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-accounting.d.ts","sourceRoot":"","sources":["../src/token-accounting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAyB,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAmBhD,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG;IACpD,WAAW,CAAC,EAAE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