@moxxy/sdk 0.1.0 → 0.1.2
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.
- package/README.md +239 -0
- package/dist/command-sync.d.ts +23 -0
- package/dist/command-sync.d.ts.map +1 -0
- package/dist/command-sync.js +36 -0
- package/dist/command-sync.js.map +1 -0
- package/dist/loop-helpers.d.ts +68 -0
- package/dist/loop-helpers.d.ts.map +1 -0
- package/dist/loop-helpers.js +283 -0
- package/dist/loop-helpers.js.map +1 -0
- package/dist/loop.d.ts +106 -0
- package/dist/loop.d.ts.map +1 -0
- package/dist/loop.js +2 -0
- package/dist/loop.js.map +1 -0
- package/dist/plugin-kind.d.ts +10 -0
- package/dist/plugin-kind.d.ts.map +1 -0
- package/dist/plugin-kind.js +31 -0
- package/dist/plugin-kind.js.map +1 -0
- package/dist/schemas.d.ts +24 -24
- package/package.json +49 -13
package/README.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://moxxy.ai">
|
|
3
|
+
<img src="https://moxxy.ai/logo-gradient.svg" alt="moxxy" width="160" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h1 align="center">@moxxy/sdk</h1>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<strong>Typed public surface for the moxxy framework.</strong><br/>
|
|
11
|
+
Zero runtime deps. The contract every plugin, channel, and provider speaks.
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://www.npmjs.com/package/@moxxy/sdk">
|
|
16
|
+
<img src="https://img.shields.io/npm/v/@moxxy/sdk?logo=npm&logoColor=white" alt="npm" />
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://nodejs.org">
|
|
19
|
+
<img src="https://img.shields.io/badge/node-%3E%3D20.10-brightgreen?logo=node.js&logoColor=white" alt="Node ≥20.10" />
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://www.typescriptlang.org">
|
|
22
|
+
<img src="https://img.shields.io/badge/TypeScript-strict-3178C6?logo=typescript&logoColor=white" alt="TypeScript" />
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://github.com/moxxy-ai/new_moxxy/actions/workflows/ci.yml">
|
|
25
|
+
<img src="https://github.com/moxxy-ai/new_moxxy/actions/workflows/ci.yml/badge.svg" alt="CI" />
|
|
26
|
+
</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
<p align="center">
|
|
30
|
+
<a href="#-installation">Install</a>
|
|
31
|
+
·
|
|
32
|
+
<a href="#-quickstart">Quickstart</a>
|
|
33
|
+
·
|
|
34
|
+
<a href="https://moxxy.ai">Docs</a>
|
|
35
|
+
·
|
|
36
|
+
<a href="#-what-the-sdk-gives-you">Surface</a>
|
|
37
|
+
·
|
|
38
|
+
<a href="#-authoring-a-plugin">Plugin guide</a>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## ✨ What this package is
|
|
44
|
+
|
|
45
|
+
`@moxxy/sdk` is the **typed contract** between moxxy and everything that plugs into it: providers, modes (loop strategies), tools, channels, compactors, cache strategies, isolators, transcribers, view renderers, tunnel providers, agents, commands, skills.
|
|
46
|
+
|
|
47
|
+
It exports:
|
|
48
|
+
|
|
49
|
+
- `define*({…})` factories — the only blessed way to author each kind of block.
|
|
50
|
+
- The `MoxxyEvent` union — every event the runtime can emit or replay.
|
|
51
|
+
- `ClientSession`, `SessionLike` — the views channels and modes see.
|
|
52
|
+
- Lifecycle hook signatures (`onTurnStart`, `onAssistantMessage`, …).
|
|
53
|
+
- Helper utilities that don't drag the runtime along — token accounting, compactor helpers, schema → JSON schema, tool gating, embedding cache, retryable-error classification.
|
|
54
|
+
|
|
55
|
+
It is the **only** moxxy package safe to depend on from a published plugin. `@moxxy/core` is the runtime — plugins never import it.
|
|
56
|
+
|
|
57
|
+
| | |
|
|
58
|
+
|---|---|
|
|
59
|
+
| 🧩 **Zero runtime deps** | The package builds without pulling anything into your bundle. `zod` is a `peerDependency`. |
|
|
60
|
+
| 🔌 **One contract, every block** | Same shape for tools, channels, providers, compactors, … — once you've written one plugin you know how to write the next. |
|
|
61
|
+
| 🛡 **Strict TypeScript** | Types-as-docs. `defineTool` is generic on its zod schema so handlers are fully inferred. |
|
|
62
|
+
| 🪶 **Type-only views** | `SessionLike` exposes what a channel needs without exposing the registry internals — keeps coupling honest. |
|
|
63
|
+
| 📜 **Event-log first** | Every block is reactive over a single typed event stream — no hidden globals, easy to record/replay. |
|
|
64
|
+
|
|
65
|
+
## 🚀 Installation
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
npm install @moxxy/sdk zod
|
|
69
|
+
# or: pnpm add @moxxy/sdk zod
|
|
70
|
+
# or: yarn add @moxxy/sdk zod
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`zod` is declared as a `peerDependency` — the SDK doesn't ship it so your plugin and the host agree on one copy.
|
|
74
|
+
|
|
75
|
+
**Requirements**: Node.js ≥ 20.10. Strict TypeScript recommended.
|
|
76
|
+
|
|
77
|
+
## ⚡ Quickstart
|
|
78
|
+
|
|
79
|
+
A tool plugin in nine lines:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { definePlugin, defineTool, z } from '@moxxy/sdk';
|
|
83
|
+
|
|
84
|
+
export default definePlugin({
|
|
85
|
+
name: '@acme/moxxy-plugin-greet',
|
|
86
|
+
tools: [
|
|
87
|
+
defineTool({
|
|
88
|
+
name: 'greet',
|
|
89
|
+
description: 'Return a greeting for the given name.',
|
|
90
|
+
inputSchema: z.object({ name: z.string() }),
|
|
91
|
+
handler: ({ name }) => `Hello, ${name}!`,
|
|
92
|
+
}),
|
|
93
|
+
],
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Add a `"moxxy"` block to your `package.json` and moxxy auto-discovers it:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"moxxy": { "plugin": { "entry": "./dist/index.js", "kind": "tools" } }
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
That's it. `moxxy plugins list` (or any TUI session) will see your tool on next launch.
|
|
106
|
+
|
|
107
|
+
## 🧩 What the SDK gives you
|
|
108
|
+
|
|
109
|
+
### `define*` factories
|
|
110
|
+
|
|
111
|
+
| Factory | Defines |
|
|
112
|
+
|---|---|
|
|
113
|
+
| `definePlugin` | A bundle of any of the below, the discoverable unit |
|
|
114
|
+
| `defineTool` | A callable tool, zod-typed input, optional `permission` / `isolation` / `compact` presentation |
|
|
115
|
+
| `defineProvider` | An LLM backend (Anthropic / OpenAI / custom) |
|
|
116
|
+
| `defineMode` | A loop strategy (`tool-use`, `plan-execute`, `bmad`, …) — the agent's iteration topology |
|
|
117
|
+
| `defineCompactor` | Context-window compaction strategy (summarise / drop / hybrid) |
|
|
118
|
+
| `defineCacheStrategy` | Where to place provider cache breakpoints |
|
|
119
|
+
| `defineChannel` | A user-facing surface (TUI / HTTP / Telegram / web / …) |
|
|
120
|
+
| `defineCommand` | A `/slash` command surfaced in every channel that hosts commands |
|
|
121
|
+
| `defineSkill` | A prompt-only Markdown skill (frontmatter + body) |
|
|
122
|
+
| `defineAgent` | A subagent kind dispatchable from the parent loop |
|
|
123
|
+
| `defineTranscriber` | A speech-to-text backend wired into every audio-capable channel |
|
|
124
|
+
| `definePermission` | A permission rule contributed to the resolver chain |
|
|
125
|
+
| `defineViewRenderer` | A target for the agent-authored UI primitives |
|
|
126
|
+
| `defineTunnelProvider` | A public-URL tunnel (cloudflared / ngrok / …) for HTTP channels |
|
|
127
|
+
| `defineIsolator` *(via `@moxxy/plugin-security`)* | A capability sandbox; the SDK exports the `Isolator` interface and the `ISOLATION_RANK` ordering |
|
|
128
|
+
|
|
129
|
+
### Types & events
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
import type {
|
|
133
|
+
MoxxyEvent, // discriminated union of every event in the log
|
|
134
|
+
EventLogReader, // stable view over the session's event log
|
|
135
|
+
ClientSession, // what channels and slash-commands see
|
|
136
|
+
SessionLike, // what modes / providers / tools see
|
|
137
|
+
PendingToolCall,
|
|
138
|
+
PermissionDecision,
|
|
139
|
+
ApprovalRequest, ApprovalDecision,
|
|
140
|
+
ToolDef, ProviderDef, ModeDef, CompactorDef, CacheStrategyDef,
|
|
141
|
+
Plugin, PluginSpec,
|
|
142
|
+
Skill, SkillDef, SkillFrontmatter, SkillScope,
|
|
143
|
+
} from '@moxxy/sdk';
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Helpers
|
|
147
|
+
|
|
148
|
+
- **`zodToJsonSchema`** — convert a zod schema to JSON Schema for provider tool calls.
|
|
149
|
+
- **`isRetryableError`** / **`toFriendlyError`** — classify provider errors uniformly.
|
|
150
|
+
- **`estimateContextTokens`**, **`runCompactionIfNeeded`** — compactor scaffolding.
|
|
151
|
+
- **`CachedEmbeddingProvider`** — wrap any `EmbeddingProvider` with on-disk caching.
|
|
152
|
+
- **`dispatchToolCall`** — invoke a tool through the full gating + permission + isolation pipeline.
|
|
153
|
+
- **`summarizeSessionTokensFromEvents`**, **`summarizeTokensByModel`** — pure token accounting over the event log.
|
|
154
|
+
|
|
155
|
+
### Lifecycle hooks
|
|
156
|
+
|
|
157
|
+
A plugin can declare optional hooks: `onSessionStart`, `onTurnStart`, `onAssistantMessage`, `onToolResult`, `onError`, `onCompact`, `onSessionEnd`. All are strongly typed and fire in plugin-registration order. The SDK exposes the hook context types; the runtime in `@moxxy/core` is responsible for actually invoking them.
|
|
158
|
+
|
|
159
|
+
## 🛠 Authoring a plugin
|
|
160
|
+
|
|
161
|
+
A tool plugin (minimum surface):
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
import { definePlugin, defineTool, z } from '@moxxy/sdk';
|
|
165
|
+
|
|
166
|
+
export default definePlugin({
|
|
167
|
+
name: '@acme/moxxy-plugin-weather',
|
|
168
|
+
tools: [
|
|
169
|
+
defineTool({
|
|
170
|
+
name: 'get_weather',
|
|
171
|
+
description: 'Fetch current weather for a city.',
|
|
172
|
+
inputSchema: z.object({ city: z.string() }),
|
|
173
|
+
// Handler args are inferred from the zod schema.
|
|
174
|
+
handler: async ({ city }, ctx) => {
|
|
175
|
+
const res = await fetch(`https://wttr.in/${encodeURIComponent(city)}?format=j1`);
|
|
176
|
+
return res.json();
|
|
177
|
+
},
|
|
178
|
+
// Optional: gate the call, declare capabilities, customise compact display.
|
|
179
|
+
permission: { action: 'prompt' },
|
|
180
|
+
isolation: { capabilities: { net: { allow: ['wttr.in'] } } },
|
|
181
|
+
compact: { verb: 'Reading weather', subject: ({ city }) => city },
|
|
182
|
+
}),
|
|
183
|
+
],
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
A provider plugin:
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
import { definePlugin, defineProvider, type ProviderDef } from '@moxxy/sdk';
|
|
191
|
+
|
|
192
|
+
const myProvider: ProviderDef = defineProvider({
|
|
193
|
+
name: 'my-llm',
|
|
194
|
+
models: [{ id: 'flagship', contextWindow: 200_000 }],
|
|
195
|
+
async *stream(ctx) { /* yield MoxxyEvent values */ },
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
export default definePlugin({
|
|
199
|
+
name: '@acme/moxxy-provider-my-llm',
|
|
200
|
+
providers: [myProvider],
|
|
201
|
+
});
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
A mode (loop strategy):
|
|
205
|
+
|
|
206
|
+
```ts
|
|
207
|
+
import { definePlugin, defineMode, type ModeContext, type MoxxyEvent } from '@moxxy/sdk';
|
|
208
|
+
|
|
209
|
+
async function* runMyMode(ctx: ModeContext): AsyncIterable<MoxxyEvent> {
|
|
210
|
+
// emit events, call providers, dispatch tools — return when the turn ends.
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export default definePlugin({
|
|
214
|
+
name: '@acme/moxxy-mode-my',
|
|
215
|
+
modes: [defineMode({
|
|
216
|
+
name: 'my-mode',
|
|
217
|
+
description: 'One-line summary surfaced in the /mode picker.',
|
|
218
|
+
run: runMyMode,
|
|
219
|
+
})],
|
|
220
|
+
});
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Per-block author guides (skill, plugin, tool, channel, provider, loop strategy, compactor, cache strategy) live in the monorepo at [`.claude/agents/`](https://github.com/moxxy-ai/new_moxxy/tree/main/.claude/agents).
|
|
224
|
+
|
|
225
|
+
## 🏛 Architectural rules
|
|
226
|
+
|
|
227
|
+
- **`@moxxy/sdk` has zero internal deps.** Enforced in CI via `pnpm check:deps`.
|
|
228
|
+
- **`@moxxy/core` doesn't import any plugin.** Plugins flow into core through the SDK only.
|
|
229
|
+
- **Plugins never import `@moxxy/core`.** If you find yourself wanting to, the missing piece belongs in the SDK.
|
|
230
|
+
|
|
231
|
+
These three invariants are what keep the framework swappable.
|
|
232
|
+
|
|
233
|
+
## 📚 Docs
|
|
234
|
+
|
|
235
|
+
Full docs at **[docs.moxxy.ai](https://docs.moxxy.ai)** — concepts, plugin author guides, channel guides, recipes.
|
|
236
|
+
|
|
237
|
+
## 📝 License
|
|
238
|
+
|
|
239
|
+
TBD.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const COMMAND_SESSION_ACTION_SUBTYPE: "command.session_action";
|
|
2
|
+
export declare const COMMAND_STATE_CHANGED_SUBTYPE: "command.state_changed";
|
|
3
|
+
export type CommandOriginChannel = 'tui' | 'office' | (string & {});
|
|
4
|
+
export type CommandTarget = 'session';
|
|
5
|
+
export interface CommandSyncBasePayload {
|
|
6
|
+
readonly command: string;
|
|
7
|
+
readonly target: CommandTarget;
|
|
8
|
+
readonly origin_channel: CommandOriginChannel;
|
|
9
|
+
readonly origin_id: string;
|
|
10
|
+
readonly notice?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface CommandSessionActionPayload extends CommandSyncBasePayload {
|
|
13
|
+
readonly action: 'new';
|
|
14
|
+
}
|
|
15
|
+
export interface CommandStateChangedPayload extends CommandSyncBasePayload {
|
|
16
|
+
readonly action: 'model_changed' | 'loop_changed';
|
|
17
|
+
readonly provider?: string;
|
|
18
|
+
readonly model?: string;
|
|
19
|
+
readonly loop?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function isCommandSessionActionPayload(value: unknown): value is CommandSessionActionPayload;
|
|
22
|
+
export declare function isCommandStateChangedPayload(value: unknown): value is CommandStateChangedPayload;
|
|
23
|
+
//# sourceMappingURL=command-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-sync.d.ts","sourceRoot":"","sources":["../src/command-sync.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,EAAG,wBAAiC,CAAC;AAChF,eAAO,MAAM,6BAA6B,EAAG,uBAAgC,CAAC;AAE9E,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AACpE,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC;AAEtC,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,2BAA4B,SAAQ,sBAAsB;IACzE,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;CACxB;AAED,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;IACxE,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,cAAc,CAAC;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAqBD,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,2BAA2B,CAGtC;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,0BAA0B,CAcrC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const COMMAND_SESSION_ACTION_SUBTYPE = 'command.session_action';
|
|
2
|
+
export const COMMAND_STATE_CHANGED_SUBTYPE = 'command.state_changed';
|
|
3
|
+
function asRecord(value) {
|
|
4
|
+
return value && typeof value === 'object' && !Array.isArray(value)
|
|
5
|
+
? value
|
|
6
|
+
: null;
|
|
7
|
+
}
|
|
8
|
+
function hasBasePayload(value) {
|
|
9
|
+
return (typeof value.command === 'string' &&
|
|
10
|
+
value.command.trim().length > 0 &&
|
|
11
|
+
value.target === 'session' &&
|
|
12
|
+
typeof value.origin_channel === 'string' &&
|
|
13
|
+
value.origin_channel.trim().length > 0 &&
|
|
14
|
+
typeof value.origin_id === 'string' &&
|
|
15
|
+
value.origin_id.trim().length > 0 &&
|
|
16
|
+
(value.notice === undefined || typeof value.notice === 'string'));
|
|
17
|
+
}
|
|
18
|
+
export function isCommandSessionActionPayload(value) {
|
|
19
|
+
const record = asRecord(value);
|
|
20
|
+
return Boolean(record && hasBasePayload(record) && record.action === 'new');
|
|
21
|
+
}
|
|
22
|
+
export function isCommandStateChangedPayload(value) {
|
|
23
|
+
const record = asRecord(value);
|
|
24
|
+
if (!record || !hasBasePayload(record))
|
|
25
|
+
return false;
|
|
26
|
+
if (record.action === 'model_changed') {
|
|
27
|
+
return ((record.provider === undefined || typeof record.provider === 'string') &&
|
|
28
|
+
typeof record.model === 'string' &&
|
|
29
|
+
record.model.trim().length > 0);
|
|
30
|
+
}
|
|
31
|
+
if (record.action === 'loop_changed') {
|
|
32
|
+
return typeof record.loop === 'string' && record.loop.trim().length > 0;
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=command-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-sync.js","sourceRoot":"","sources":["../src/command-sync.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,8BAA8B,GAAG,wBAAiC,CAAC;AAChF,MAAM,CAAC,MAAM,6BAA6B,GAAG,uBAAgC,CAAC;AAwB9E,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAChE,CAAC,CAAC,KAAgC;QAClC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,SAAS,cAAc,CAAC,KAA8B;IACpD,OAAO,CACL,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;QACjC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAC/B,KAAK,CAAC,MAAM,KAAK,SAAS;QAC1B,OAAO,KAAK,CAAC,cAAc,KAAK,QAAQ;QACxC,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QACtC,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ;QACnC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QACjC,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CACjE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,KAAc;IAEd,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,OAAO,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,KAAc;IAEd,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IACrD,IAAI,MAAM,CAAC,MAAM,KAAK,eAAe,EAAE,CAAC;QACtC,OAAO,CACL,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC;YACtE,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ;YAChC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAC/B,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,cAAc,EAAE,CAAC;QACrC,OAAO,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ProviderMessage } from './provider.js';
|
|
2
|
+
import type { LoopContext } from './loop.js';
|
|
3
|
+
import type { StopReason } from './provider-utils.js';
|
|
4
|
+
import type { Skill } from './skill.js';
|
|
5
|
+
/**
|
|
6
|
+
* Shared bits used by every loop strategy: a typed tool-use struct and a
|
|
7
|
+
* common stream-collection helper that runs `onBeforeProviderCall` hooks
|
|
8
|
+
* and reduces a provider stream down to `{text, toolUses, stopReason}`.
|
|
9
|
+
*
|
|
10
|
+
* Lives in core (not in each loop package) so a new loop strategy stays
|
|
11
|
+
* consistent — and so behavioral fixes here propagate. Previously
|
|
12
|
+
* loop-plan-execute had its own copy that skipped the hook (audit bug).
|
|
13
|
+
*/
|
|
14
|
+
export interface CollectedToolUse {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly input: unknown;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Compose a model-facing system prompt that includes any base prompt
|
|
21
|
+
* plus a COMPACT skill index (name + description + triggers only).
|
|
22
|
+
*
|
|
23
|
+
* Lazy-loading design: the body is intentionally NOT inlined. The model
|
|
24
|
+
* matches user intent against the description/triggers, then calls the
|
|
25
|
+
* `load_skill` tool to fetch the body of the skill it picked. This keeps
|
|
26
|
+
* the system prompt small even with many skills installed and avoids
|
|
27
|
+
* paying for skill bodies the model never actually follows.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildSystemPromptWithSkills(baseSystemPrompt: string | undefined, skills: ReadonlyArray<Skill>): string | undefined;
|
|
30
|
+
export interface ProjectMessagesOptions {
|
|
31
|
+
/** Optional system prompt; emitted as the first message when set. */
|
|
32
|
+
readonly systemPrompt?: string;
|
|
33
|
+
/** Optional trailing user message — useful for plan-execute's "Focus on this step now: X". */
|
|
34
|
+
readonly trailingUserText?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Project the session's event log to a flat list of ProviderMessages
|
|
38
|
+
* suitable for handing to `provider.stream`. Used by every loop strategy.
|
|
39
|
+
*
|
|
40
|
+
* Handles user_prompt, assistant_message, tool_call_requested (grouped
|
|
41
|
+
* into a single assistant message of tool_use blocks), and tool_result.
|
|
42
|
+
* Other event types are passed through as a no-op.
|
|
43
|
+
*
|
|
44
|
+
* Note: this is the minimal projection used by loop strategies. Core's
|
|
45
|
+
* `selectMessages` is a richer variant that also honors compaction events
|
|
46
|
+
* and attachments; the simpler form here lives in the SDK so loop plugins
|
|
47
|
+
* stay independent of core.
|
|
48
|
+
*/
|
|
49
|
+
export declare function projectMessagesFromLog(ctx: Pick<LoopContext, 'log'>, opts?: ProjectMessagesOptions): ProviderMessage[];
|
|
50
|
+
export interface StreamResult {
|
|
51
|
+
readonly text: string;
|
|
52
|
+
readonly toolUses: ReadonlyArray<CollectedToolUse>;
|
|
53
|
+
readonly stopReason: StopReason;
|
|
54
|
+
readonly error: {
|
|
55
|
+
readonly message: string;
|
|
56
|
+
readonly retryable: boolean;
|
|
57
|
+
} | null;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Pulls a provider stream, emits `assistant_chunk` events for text deltas,
|
|
61
|
+
* collects tool_use blocks, and returns the final `{text, toolUses, stopReason}`.
|
|
62
|
+
* Runs `onBeforeProviderCall` lifecycle hooks before the call.
|
|
63
|
+
*/
|
|
64
|
+
export declare function collectProviderStream(ctx: LoopContext, messages: ReadonlyArray<ProviderMessage>, opts?: {
|
|
65
|
+
iteration?: number;
|
|
66
|
+
includeTools?: boolean;
|
|
67
|
+
}): Promise<StreamResult>;
|
|
68
|
+
//# sourceMappingURL=loop-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-helpers.d.ts","sourceRoot":"","sources":["../src/loop-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA+B,eAAe,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC;;;;;;;;GAQG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACzC,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,GAC3B,MAAM,GAAG,SAAS,CAoBpB;AAED,MAAM,WAAW,sBAAsB;IACrC,qEAAqE;IACrE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,8FAA8F;IAC9F,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAiCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAC7B,IAAI,GAAE,sBAA2B,GAChC,eAAe,EAAE,CAoInB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACnD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CAClF;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,aAAa,CAAC,eAAe,CAAC,EACxC,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACxD,OAAO,CAAC,YAAY,CAAC,CAoFvB"}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compose a model-facing system prompt that includes any base prompt
|
|
3
|
+
* plus a COMPACT skill index (name + description + triggers only).
|
|
4
|
+
*
|
|
5
|
+
* Lazy-loading design: the body is intentionally NOT inlined. The model
|
|
6
|
+
* matches user intent against the description/triggers, then calls the
|
|
7
|
+
* `load_skill` tool to fetch the body of the skill it picked. This keeps
|
|
8
|
+
* the system prompt small even with many skills installed and avoids
|
|
9
|
+
* paying for skill bodies the model never actually follows.
|
|
10
|
+
*/
|
|
11
|
+
export function buildSystemPromptWithSkills(baseSystemPrompt, skills) {
|
|
12
|
+
if (skills.length === 0)
|
|
13
|
+
return baseSystemPrompt;
|
|
14
|
+
const header = `## Available skills\n\n` +
|
|
15
|
+
`Each line below is a pre-authored playbook for a specific intent. ` +
|
|
16
|
+
`When the user's request matches one of these (by name, description, ` +
|
|
17
|
+
`or triggers), call \`load_skill({ name: "<skill-name>" })\` FIRST to ` +
|
|
18
|
+
`fetch the full instructions, then follow them verbatim. Prefer using ` +
|
|
19
|
+
`a skill over re-deriving the workflow with ad-hoc tools.\n`;
|
|
20
|
+
const entries = skills
|
|
21
|
+
.map((s) => {
|
|
22
|
+
const fm = s.frontmatter;
|
|
23
|
+
const triggerHint = fm.triggers?.length
|
|
24
|
+
? ` (triggers: ${fm.triggers.map((t) => `"${t}"`).join(', ')})`
|
|
25
|
+
: '';
|
|
26
|
+
return `- **${fm.name}** — ${fm.description}${triggerHint}`;
|
|
27
|
+
})
|
|
28
|
+
.join('\n');
|
|
29
|
+
const skillBlock = `${header}\n${entries}`;
|
|
30
|
+
return baseSystemPrompt ? `${baseSystemPrompt}\n\n${skillBlock}` : skillBlock;
|
|
31
|
+
}
|
|
32
|
+
function activeCompactionRanges(events) {
|
|
33
|
+
return events
|
|
34
|
+
.filter((event) => event.type === 'compaction' &&
|
|
35
|
+
event.tokensSaved > 0 &&
|
|
36
|
+
event.summary.trim().length > 0 &&
|
|
37
|
+
event.replacedRange[0] <= event.replacedRange[1])
|
|
38
|
+
.map((event) => ({
|
|
39
|
+
from: event.replacedRange[0],
|
|
40
|
+
to: event.replacedRange[1],
|
|
41
|
+
summary: event.summary,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
function eventInCompactionRange(seq, ranges) {
|
|
45
|
+
for (const range of ranges) {
|
|
46
|
+
if (seq >= range.from && seq <= range.to)
|
|
47
|
+
return range;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Project the session's event log to a flat list of ProviderMessages
|
|
53
|
+
* suitable for handing to `provider.stream`. Used by every loop strategy.
|
|
54
|
+
*
|
|
55
|
+
* Handles user_prompt, assistant_message, tool_call_requested (grouped
|
|
56
|
+
* into a single assistant message of tool_use blocks), and tool_result.
|
|
57
|
+
* Other event types are passed through as a no-op.
|
|
58
|
+
*
|
|
59
|
+
* Note: this is the minimal projection used by loop strategies. Core's
|
|
60
|
+
* `selectMessages` is a richer variant that also honors compaction events
|
|
61
|
+
* and attachments; the simpler form here lives in the SDK so loop plugins
|
|
62
|
+
* stay independent of core.
|
|
63
|
+
*/
|
|
64
|
+
export function projectMessagesFromLog(ctx, opts = {}) {
|
|
65
|
+
const messages = [];
|
|
66
|
+
if (opts.systemPrompt) {
|
|
67
|
+
messages.push({ role: 'system', content: [{ type: 'text', text: opts.systemPrompt }] });
|
|
68
|
+
}
|
|
69
|
+
const allEvents = ctx.log.slice();
|
|
70
|
+
const compactions = activeCompactionRanges(allEvents);
|
|
71
|
+
const emittedCompactions = new Set();
|
|
72
|
+
// Pre-scan: build the set of callIds that have a matching tool_result
|
|
73
|
+
// (or tool_call_denied) somewhere in the log. Used to synthesize a
|
|
74
|
+
// fallback `[interrupted]` tool_result for orphan tool_use blocks
|
|
75
|
+
// when the assistant message gets flushed.
|
|
76
|
+
//
|
|
77
|
+
// Without this fallback the provider rejects the whole conversation
|
|
78
|
+
// with "assistant message with 'tool_calls' must be followed by tool
|
|
79
|
+
// messages responding to each 'tool_call_id'". Orphans typically
|
|
80
|
+
// appear after a cancelled turn, an aborted process, or a tool
|
|
81
|
+
// exception that bypassed the loop's tool_result emit path.
|
|
82
|
+
const resolvedCallIds = new Set();
|
|
83
|
+
for (const e of allEvents) {
|
|
84
|
+
if (e.type === 'tool_result' || e.type === 'tool_call_denied') {
|
|
85
|
+
resolvedCallIds.add(e.callId);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
let pendingAssistant = null;
|
|
89
|
+
const flush = () => {
|
|
90
|
+
if (!pendingAssistant)
|
|
91
|
+
return;
|
|
92
|
+
const flushed = pendingAssistant;
|
|
93
|
+
messages.push(flushed);
|
|
94
|
+
pendingAssistant = null;
|
|
95
|
+
// Synthesize fallback tool_result messages for any tool_use blocks
|
|
96
|
+
// whose callId never resolved in the event log. Has to land
|
|
97
|
+
// immediately after the assistant message (and before any
|
|
98
|
+
// subsequent user_prompt / assistant_message) so the provider sees
|
|
99
|
+
// a clean assistant→tool-result chain.
|
|
100
|
+
for (const block of flushed.content) {
|
|
101
|
+
if (block.type === 'tool_use' && !resolvedCallIds.has(block.id)) {
|
|
102
|
+
messages.push({
|
|
103
|
+
role: 'tool_result',
|
|
104
|
+
content: [
|
|
105
|
+
{
|
|
106
|
+
type: 'tool_result',
|
|
107
|
+
toolUseId: block.id,
|
|
108
|
+
content: '[tool call did not return a result — possibly interrupted or cancelled]',
|
|
109
|
+
isError: true,
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
});
|
|
113
|
+
// Mark synthesized so we don't double-emit if the same orphan
|
|
114
|
+
// appears in multiple groups (defensive — shouldn't normally
|
|
115
|
+
// happen since each tool_call_requested has a unique callId).
|
|
116
|
+
resolvedCallIds.add(block.id);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
for (const e of allEvents) {
|
|
121
|
+
const compaction = eventInCompactionRange(e.seq, compactions);
|
|
122
|
+
if (compaction) {
|
|
123
|
+
if (!emittedCompactions.has(compaction)) {
|
|
124
|
+
emittedCompactions.add(compaction);
|
|
125
|
+
flush();
|
|
126
|
+
messages.push({
|
|
127
|
+
role: 'user',
|
|
128
|
+
content: [{ type: 'text', text: `[summary of earlier turns]\n${compaction.summary}` }],
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
switch (e.type) {
|
|
134
|
+
case 'user_prompt': {
|
|
135
|
+
flush();
|
|
136
|
+
const blocks = [{ type: 'text', text: e.text }];
|
|
137
|
+
if (e.attachments) {
|
|
138
|
+
for (const att of e.attachments) {
|
|
139
|
+
if (att.kind === 'image') {
|
|
140
|
+
blocks.push({
|
|
141
|
+
type: 'image',
|
|
142
|
+
mediaType: att.mediaType ?? 'image/png',
|
|
143
|
+
data: att.content,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
blocks.push({
|
|
148
|
+
type: 'text',
|
|
149
|
+
text: `[${att.kind}${att.name ? ` ${att.name}` : ''}]\n${att.content}`,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
messages.push({ role: 'user', content: blocks });
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
case 'assistant_message':
|
|
158
|
+
flush();
|
|
159
|
+
messages.push({ role: 'assistant', content: [{ type: 'text', text: e.content }] });
|
|
160
|
+
break;
|
|
161
|
+
case 'tool_call_requested': {
|
|
162
|
+
pendingAssistant ??= { role: 'assistant', content: [] };
|
|
163
|
+
pendingAssistant.content.push({
|
|
164
|
+
type: 'tool_use',
|
|
165
|
+
id: e.callId,
|
|
166
|
+
name: e.name,
|
|
167
|
+
input: e.input,
|
|
168
|
+
});
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
case 'tool_result': {
|
|
172
|
+
flush();
|
|
173
|
+
const text = e.error
|
|
174
|
+
? `[error:${e.error.kind}] ${e.error.message}`
|
|
175
|
+
: typeof e.output === 'string'
|
|
176
|
+
? e.output
|
|
177
|
+
: JSON.stringify(e.output ?? '');
|
|
178
|
+
messages.push({
|
|
179
|
+
role: 'tool_result',
|
|
180
|
+
content: [{ type: 'tool_result', toolUseId: e.callId, content: text, isError: !e.ok }],
|
|
181
|
+
});
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
default:
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
flush();
|
|
189
|
+
if (opts.trailingUserText) {
|
|
190
|
+
messages.push({ role: 'user', content: [{ type: 'text', text: opts.trailingUserText }] });
|
|
191
|
+
}
|
|
192
|
+
return messages;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Pulls a provider stream, emits `assistant_chunk` events for text deltas,
|
|
196
|
+
* collects tool_use blocks, and returns the final `{text, toolUses, stopReason}`.
|
|
197
|
+
* Runs `onBeforeProviderCall` lifecycle hooks before the call.
|
|
198
|
+
*/
|
|
199
|
+
export async function collectProviderStream(ctx, messages, opts = {}) {
|
|
200
|
+
const req = {
|
|
201
|
+
model: ctx.model,
|
|
202
|
+
system: ctx.systemPrompt,
|
|
203
|
+
messages,
|
|
204
|
+
...(opts.includeTools === false ? {} : { tools: ctx.tools.list() }),
|
|
205
|
+
signal: ctx.signal,
|
|
206
|
+
};
|
|
207
|
+
const transformed = await ctx.hooks.dispatchBeforeProviderCall(req, {
|
|
208
|
+
sessionId: ctx.sessionId,
|
|
209
|
+
cwd: '',
|
|
210
|
+
log: ctx.log,
|
|
211
|
+
env: {},
|
|
212
|
+
turnId: ctx.turnId,
|
|
213
|
+
iteration: opts.iteration ?? 0,
|
|
214
|
+
});
|
|
215
|
+
let text = '';
|
|
216
|
+
const toolUses = new Map();
|
|
217
|
+
let stopReason = 'end_turn';
|
|
218
|
+
let error = null;
|
|
219
|
+
let stream;
|
|
220
|
+
try {
|
|
221
|
+
stream = ctx.provider.stream(transformed);
|
|
222
|
+
}
|
|
223
|
+
catch (err) {
|
|
224
|
+
return {
|
|
225
|
+
text: '',
|
|
226
|
+
toolUses: [],
|
|
227
|
+
stopReason: 'error',
|
|
228
|
+
error: { message: err instanceof Error ? err.message : String(err), retryable: false },
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
try {
|
|
232
|
+
for await (const event of stream) {
|
|
233
|
+
switch (event.type) {
|
|
234
|
+
case 'text_delta': {
|
|
235
|
+
text += event.delta;
|
|
236
|
+
await ctx.emit({
|
|
237
|
+
type: 'assistant_chunk',
|
|
238
|
+
sessionId: ctx.sessionId,
|
|
239
|
+
turnId: ctx.turnId,
|
|
240
|
+
source: 'model',
|
|
241
|
+
delta: event.delta,
|
|
242
|
+
});
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
case 'tool_use_start': {
|
|
246
|
+
toolUses.set(event.id, { name: event.name });
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
case 'tool_use_end': {
|
|
250
|
+
const existing = toolUses.get(event.id) ?? {};
|
|
251
|
+
toolUses.set(event.id, { ...existing, input: event.input });
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
case 'message_end': {
|
|
255
|
+
stopReason = event.stopReason;
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
case 'error': {
|
|
259
|
+
error = { message: event.message, retryable: event.retryable };
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
case 'message_start':
|
|
263
|
+
case 'tool_use_delta':
|
|
264
|
+
default:
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
catch (err) {
|
|
270
|
+
error = {
|
|
271
|
+
message: err instanceof Error ? err.message : String(err),
|
|
272
|
+
retryable: false,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
const finalToolUses = [];
|
|
276
|
+
for (const [id, partial] of toolUses) {
|
|
277
|
+
if (!partial.name)
|
|
278
|
+
continue;
|
|
279
|
+
finalToolUses.push({ id, name: partial.name, input: partial.input ?? {} });
|
|
280
|
+
}
|
|
281
|
+
return { text, toolUses: finalToolUses, stopReason, error };
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=loop-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-helpers.js","sourceRoot":"","sources":["../src/loop-helpers.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;GASG;AACH,MAAM,UAAU,2BAA2B,CACzC,gBAAoC,EACpC,MAA4B;IAE5B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,gBAAgB,CAAC;IACjD,MAAM,MAAM,GACV,yBAAyB;QACzB,oEAAoE;QAC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,KAAK,CAAC,UAAU,CAAC;oBAC9B,MAAM;gBACR,CAAC;gBACD,KAAK,OAAO,CAAC,CAAC,CAAC;oBACb,KAAK,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;oBAC/D,MAAM;gBACR,CAAC;gBACD,KAAK,eAAe,CAAC;gBACrB,KAAK,gBAAgB,CAAC;gBACtB;oBACE,MAAM;YACV,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,KAAK,GAAG;YACN,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;YACzD,SAAS,EAAE,KAAK;SACjB,CAAC;IACJ,CAAC;IAED,MAAM,aAAa,GAAuB,EAAE,CAAC;IAC7C,KAAK,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,QAAQ,EAAE,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,IAAI;YAAE,SAAS;QAC5B,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;AAC9D,CAAC"}
|
package/dist/loop.d.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { CompactorDef } from './compactor.js';
|
|
2
|
+
import type { EmittedEvent, MoxxyEvent } from './events.js';
|
|
3
|
+
import type { HookDispatcher } from './hooks.js';
|
|
4
|
+
import type { SessionId, TurnId } from './ids.js';
|
|
5
|
+
import type { EventLogReader } from './log.js';
|
|
6
|
+
import type { PermissionResolver } from './permission.js';
|
|
7
|
+
import type { LLMProvider } from './provider.js';
|
|
8
|
+
import type { Skill } from './skill.js';
|
|
9
|
+
import type { SubagentSpawner } from './subagent.js';
|
|
10
|
+
import type { ToolDef } from './tool.js';
|
|
11
|
+
export interface ToolRegistry {
|
|
12
|
+
list(): ReadonlyArray<ToolDef>;
|
|
13
|
+
get(name: string): ToolDef | undefined;
|
|
14
|
+
execute(name: string, input: unknown, signal: AbortSignal, opts?: ToolExecuteOpts): Promise<unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface ToolExecuteOpts {
|
|
17
|
+
readonly callId?: string;
|
|
18
|
+
readonly sessionId?: string;
|
|
19
|
+
readonly turnId?: string;
|
|
20
|
+
readonly log?: EventLogReader;
|
|
21
|
+
readonly cwd?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SkillRegistry {
|
|
24
|
+
list(): ReadonlyArray<Skill>;
|
|
25
|
+
get(id: string): Skill | undefined;
|
|
26
|
+
byName(name: string): Skill | undefined;
|
|
27
|
+
filterByTriggers(prompt: string): ReadonlyArray<Skill>;
|
|
28
|
+
}
|
|
29
|
+
export interface PluginHostHandle {
|
|
30
|
+
list(): ReadonlyArray<{
|
|
31
|
+
name: string;
|
|
32
|
+
version: string;
|
|
33
|
+
loaded: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
reload(): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export interface LoopContext {
|
|
38
|
+
readonly sessionId: SessionId;
|
|
39
|
+
readonly turnId: TurnId;
|
|
40
|
+
readonly model: string;
|
|
41
|
+
readonly systemPrompt?: string;
|
|
42
|
+
readonly provider: LLMProvider;
|
|
43
|
+
readonly tools: ToolRegistry;
|
|
44
|
+
readonly skills: SkillRegistry;
|
|
45
|
+
readonly log: EventLogReader;
|
|
46
|
+
readonly compactor: CompactorDef | null;
|
|
47
|
+
readonly permissions: PermissionResolver;
|
|
48
|
+
/**
|
|
49
|
+
* Optional generic "ask the user a question" gate. Any loop strategy can
|
|
50
|
+
* call this to surface a checkpoint to the user — plan-execute uses it
|
|
51
|
+
* after producing a plan, but a code-execution loop could use it for
|
|
52
|
+
* "run this command?" or a refactor loop for "apply this diff?". When
|
|
53
|
+
* absent (headless / non-TTY), strategies should proceed as if the user
|
|
54
|
+
* picked the default option, or fail closed depending on the strategy.
|
|
55
|
+
*/
|
|
56
|
+
readonly approval?: ApprovalResolver;
|
|
57
|
+
readonly hooks: HookDispatcher;
|
|
58
|
+
readonly pluginHost: PluginHostHandle;
|
|
59
|
+
readonly signal: AbortSignal;
|
|
60
|
+
readonly maxIterations?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Spawn one or more child agents that share the parent's registries
|
|
63
|
+
* but run in isolation. Children stream their events back to the
|
|
64
|
+
* parent log as `plugin_event` records with `subagent_*` subtypes.
|
|
65
|
+
* Absent in synthetic test contexts that don't model a full Session.
|
|
66
|
+
*/
|
|
67
|
+
readonly subagents?: SubagentSpawner;
|
|
68
|
+
emit(event: EmittedEvent): Promise<MoxxyEvent>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Generic approval-dialog request. The TUI renders `title` as the header,
|
|
72
|
+
* `body` as a verbatim block (plan text, diff, command preview, etc.), and
|
|
73
|
+
* a single-select list of `options`. An option may set `requestsText` so
|
|
74
|
+
* the dialog prompts for follow-up text after selection (e.g. redraft
|
|
75
|
+
* feedback). `kind` is a loose tag the dialog/CLI can use for styling.
|
|
76
|
+
*/
|
|
77
|
+
export interface ApprovalRequest {
|
|
78
|
+
readonly title: string;
|
|
79
|
+
readonly body: string;
|
|
80
|
+
readonly options: ReadonlyArray<ApprovalOption>;
|
|
81
|
+
readonly defaultOptionId?: string;
|
|
82
|
+
readonly kind?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface ApprovalOption {
|
|
85
|
+
readonly id: string;
|
|
86
|
+
readonly label: string;
|
|
87
|
+
readonly hotkey?: string;
|
|
88
|
+
readonly description?: string;
|
|
89
|
+
readonly requestsText?: boolean;
|
|
90
|
+
readonly textPrompt?: string;
|
|
91
|
+
readonly danger?: boolean;
|
|
92
|
+
}
|
|
93
|
+
export interface ApprovalDecision {
|
|
94
|
+
readonly optionId: string;
|
|
95
|
+
/** Free-text follow-up the user typed when the option had `requestsText: true`. */
|
|
96
|
+
readonly text?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface ApprovalResolver {
|
|
99
|
+
readonly name: string;
|
|
100
|
+
confirm(req: ApprovalRequest): Promise<ApprovalDecision>;
|
|
101
|
+
}
|
|
102
|
+
export interface LoopStrategyDef {
|
|
103
|
+
readonly name: string;
|
|
104
|
+
run(ctx: LoopContext): AsyncIterable<MoxxyEvent>;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=loop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../src/loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,WAAW,YAAY;IAC3B,IAAI,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,G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C,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mFAAmF;IACnF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC1D;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,GAAG,EAAE,WAAW,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;CAClD"}
|
package/dist/loop.js
ADDED
package/dist/loop.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop.js","sourceRoot":"","sources":["../src/loop.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const PLUGIN_KINDS: readonly ["tools", "provider", "mode", "compactor", "cache-strategy", "view-renderer", "tunnel-provider", "mcp", "cli", "channel", "hooks", "agent", "command", "transcriber", "ui"];
|
|
2
|
+
export type PluginKind = (typeof PLUGIN_KINDS)[number];
|
|
3
|
+
export interface PluginKindCarrier {
|
|
4
|
+
readonly kind?: PluginKind | ReadonlyArray<PluginKind>;
|
|
5
|
+
}
|
|
6
|
+
export declare function pluginKindList(kind: PluginKindCarrier['kind']): ReadonlyArray<PluginKind>;
|
|
7
|
+
export declare function isPureUiPluginManifest(manifest: PluginKindCarrier): boolean;
|
|
8
|
+
/** True when the manifest declares `kind: 'ui'` (alone or alongside others). */
|
|
9
|
+
export declare function isUiPluginManifest(manifest: PluginKindCarrier): boolean;
|
|
10
|
+
//# sourceMappingURL=plugin-kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-kind.d.ts","sourceRoot":"","sources":["../src/plugin-kind.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,sLAgBf,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;CACxD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,CAGzF;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAG3E;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAEvE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const PLUGIN_KINDS = [
|
|
2
|
+
'tools',
|
|
3
|
+
'provider',
|
|
4
|
+
'mode',
|
|
5
|
+
'compactor',
|
|
6
|
+
'cache-strategy',
|
|
7
|
+
'view-renderer',
|
|
8
|
+
'tunnel-provider',
|
|
9
|
+
'mcp',
|
|
10
|
+
'cli',
|
|
11
|
+
'channel',
|
|
12
|
+
'hooks',
|
|
13
|
+
'agent',
|
|
14
|
+
'command',
|
|
15
|
+
'transcriber',
|
|
16
|
+
'ui',
|
|
17
|
+
];
|
|
18
|
+
export function pluginKindList(kind) {
|
|
19
|
+
if (!kind)
|
|
20
|
+
return [];
|
|
21
|
+
return typeof kind === 'string' ? [kind] : kind;
|
|
22
|
+
}
|
|
23
|
+
export function isPureUiPluginManifest(manifest) {
|
|
24
|
+
const kinds = pluginKindList(manifest.kind);
|
|
25
|
+
return kinds.length === 1 && kinds[0] === 'ui';
|
|
26
|
+
}
|
|
27
|
+
/** True when the manifest declares `kind: 'ui'` (alone or alongside others). */
|
|
28
|
+
export function isUiPluginManifest(manifest) {
|
|
29
|
+
return pluginKindList(manifest.kind).includes('ui');
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=plugin-kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-kind.js","sourceRoot":"","sources":["../src/plugin-kind.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,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;IACb,IAAI;CACI,CAAC;AAQX,MAAM,UAAU,cAAc,CAAC,IAA+B;IAC5D,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,QAA2B;IAChE,MAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AACjD,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,kBAAkB,CAAC,QAA2B;IAC5D,OAAO,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC"}
|
package/dist/schemas.d.ts
CHANGED
|
@@ -9,20 +9,20 @@ export declare const requirementSchema: z.ZodObject<{
|
|
|
9
9
|
hint: z.ZodOptional<z.ZodString>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
name: string;
|
|
12
|
-
kind: "
|
|
13
|
-
hint?: string | undefined;
|
|
14
|
-
reason?: string | undefined;
|
|
12
|
+
kind: "provider" | "mode" | "compactor" | "channel" | "agent" | "command" | "transcriber" | "plugin" | "tool" | "runtime";
|
|
15
13
|
version?: string | undefined;
|
|
14
|
+
reason?: string | undefined;
|
|
16
15
|
state?: "registered" | "active" | "ready" | undefined;
|
|
17
16
|
optional?: boolean | undefined;
|
|
17
|
+
hint?: string | undefined;
|
|
18
18
|
}, {
|
|
19
19
|
name: string;
|
|
20
|
-
kind: "
|
|
21
|
-
hint?: string | undefined;
|
|
22
|
-
reason?: string | undefined;
|
|
20
|
+
kind: "provider" | "mode" | "compactor" | "channel" | "agent" | "command" | "transcriber" | "plugin" | "tool" | "runtime";
|
|
23
21
|
version?: string | undefined;
|
|
22
|
+
reason?: string | undefined;
|
|
24
23
|
state?: "registered" | "active" | "ready" | undefined;
|
|
25
24
|
optional?: boolean | undefined;
|
|
25
|
+
hint?: string | undefined;
|
|
26
26
|
}>;
|
|
27
27
|
/**
|
|
28
28
|
* Optional schedule block on a skill. When present, the scheduler
|
|
@@ -135,11 +135,11 @@ export declare const pluginManifestSchema: z.ZodObject<{
|
|
|
135
135
|
skills: z.ZodOptional<z.ZodString>;
|
|
136
136
|
}, "strip", z.ZodTypeAny, {
|
|
137
137
|
entry: string;
|
|
138
|
-
kind?: "
|
|
138
|
+
kind?: "tools" | "provider" | "mode" | "compactor" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber" | ("tools" | "provider" | "mode" | "compactor" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber")[] | undefined;
|
|
139
139
|
skills?: string | undefined;
|
|
140
140
|
}, {
|
|
141
141
|
entry: string;
|
|
142
|
-
kind?: "
|
|
142
|
+
kind?: "tools" | "provider" | "mode" | "compactor" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber" | ("tools" | "provider" | "mode" | "compactor" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber")[] | undefined;
|
|
143
143
|
skills?: string | undefined;
|
|
144
144
|
}>;
|
|
145
145
|
/**
|
|
@@ -159,11 +159,11 @@ export declare const moxxyPackageSchema: z.ZodObject<{
|
|
|
159
159
|
skills: z.ZodOptional<z.ZodString>;
|
|
160
160
|
}, "strip", z.ZodTypeAny, {
|
|
161
161
|
entry: string;
|
|
162
|
-
kind?: "
|
|
162
|
+
kind?: "tools" | "provider" | "mode" | "compactor" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber" | ("tools" | "provider" | "mode" | "compactor" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber")[] | undefined;
|
|
163
163
|
skills?: string | undefined;
|
|
164
164
|
}, {
|
|
165
165
|
entry: string;
|
|
166
|
-
kind?: "
|
|
166
|
+
kind?: "tools" | "provider" | "mode" | "compactor" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber" | ("tools" | "provider" | "mode" | "compactor" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber")[] | undefined;
|
|
167
167
|
skills?: string | undefined;
|
|
168
168
|
}>>;
|
|
169
169
|
requirements: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -176,50 +176,50 @@ export declare const moxxyPackageSchema: z.ZodObject<{
|
|
|
176
176
|
hint: z.ZodOptional<z.ZodString>;
|
|
177
177
|
}, "strip", z.ZodTypeAny, {
|
|
178
178
|
name: string;
|
|
179
|
-
kind: "
|
|
180
|
-
hint?: string | undefined;
|
|
181
|
-
reason?: string | undefined;
|
|
179
|
+
kind: "provider" | "mode" | "compactor" | "channel" | "agent" | "command" | "transcriber" | "plugin" | "tool" | "runtime";
|
|
182
180
|
version?: string | undefined;
|
|
181
|
+
reason?: string | undefined;
|
|
183
182
|
state?: "registered" | "active" | "ready" | undefined;
|
|
184
183
|
optional?: boolean | undefined;
|
|
184
|
+
hint?: string | undefined;
|
|
185
185
|
}, {
|
|
186
186
|
name: string;
|
|
187
|
-
kind: "
|
|
188
|
-
hint?: string | undefined;
|
|
189
|
-
reason?: string | undefined;
|
|
187
|
+
kind: "provider" | "mode" | "compactor" | "channel" | "agent" | "command" | "transcriber" | "plugin" | "tool" | "runtime";
|
|
190
188
|
version?: string | undefined;
|
|
189
|
+
reason?: string | undefined;
|
|
191
190
|
state?: "registered" | "active" | "ready" | undefined;
|
|
192
191
|
optional?: boolean | undefined;
|
|
192
|
+
hint?: string | undefined;
|
|
193
193
|
}>, "many">>;
|
|
194
194
|
}, "strip", z.ZodTypeAny, {
|
|
195
195
|
plugin?: {
|
|
196
196
|
entry: string;
|
|
197
|
-
kind?: "
|
|
197
|
+
kind?: "tools" | "provider" | "mode" | "compactor" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber" | ("tools" | "provider" | "mode" | "compactor" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber")[] | undefined;
|
|
198
198
|
skills?: string | undefined;
|
|
199
199
|
} | undefined;
|
|
200
200
|
requirements?: {
|
|
201
201
|
name: string;
|
|
202
|
-
kind: "
|
|
203
|
-
hint?: string | undefined;
|
|
204
|
-
reason?: string | undefined;
|
|
202
|
+
kind: "provider" | "mode" | "compactor" | "channel" | "agent" | "command" | "transcriber" | "plugin" | "tool" | "runtime";
|
|
205
203
|
version?: string | undefined;
|
|
204
|
+
reason?: string | undefined;
|
|
206
205
|
state?: "registered" | "active" | "ready" | undefined;
|
|
207
206
|
optional?: boolean | undefined;
|
|
207
|
+
hint?: string | undefined;
|
|
208
208
|
}[] | undefined;
|
|
209
209
|
}, {
|
|
210
210
|
plugin?: {
|
|
211
211
|
entry: string;
|
|
212
|
-
kind?: "
|
|
212
|
+
kind?: "tools" | "provider" | "mode" | "compactor" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber" | ("tools" | "provider" | "mode" | "compactor" | "cache-strategy" | "view-renderer" | "tunnel-provider" | "mcp" | "cli" | "channel" | "hooks" | "agent" | "command" | "transcriber")[] | undefined;
|
|
213
213
|
skills?: string | undefined;
|
|
214
214
|
} | undefined;
|
|
215
215
|
requirements?: {
|
|
216
216
|
name: string;
|
|
217
|
-
kind: "
|
|
218
|
-
hint?: string | undefined;
|
|
219
|
-
reason?: string | undefined;
|
|
217
|
+
kind: "provider" | "mode" | "compactor" | "channel" | "agent" | "command" | "transcriber" | "plugin" | "tool" | "runtime";
|
|
220
218
|
version?: string | undefined;
|
|
219
|
+
reason?: string | undefined;
|
|
221
220
|
state?: "registered" | "active" | "ready" | undefined;
|
|
222
221
|
optional?: boolean | undefined;
|
|
222
|
+
hint?: string | undefined;
|
|
223
223
|
}[] | undefined;
|
|
224
224
|
}>;
|
|
225
225
|
export type SkillFrontmatterInput = z.infer<typeof skillFrontmatterSchema>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moxxy/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Typed public surface for the moxxy framework: event types, define* factories, lifecycle hook signatures.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"moxxy",
|
|
7
|
+
"agent",
|
|
8
|
+
"agents",
|
|
9
|
+
"agent-framework",
|
|
10
|
+
"ai",
|
|
11
|
+
"llm",
|
|
12
|
+
"anthropic",
|
|
13
|
+
"claude",
|
|
14
|
+
"openai",
|
|
15
|
+
"gpt",
|
|
16
|
+
"plugin",
|
|
17
|
+
"plugin-sdk",
|
|
18
|
+
"sdk",
|
|
19
|
+
"tools",
|
|
20
|
+
"tool-use",
|
|
21
|
+
"mcp",
|
|
22
|
+
"typescript",
|
|
23
|
+
"zero-deps"
|
|
24
|
+
],
|
|
25
|
+
"homepage": "https://moxxy.ai",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/moxxy-ai/new_moxxy/issues"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/moxxy-ai/new_moxxy.git",
|
|
32
|
+
"directory": "packages/sdk"
|
|
33
|
+
},
|
|
34
|
+
"author": "Michal Makowski <michal.makowski97@gmail.com>",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=20.10.0"
|
|
38
|
+
},
|
|
39
|
+
"sideEffects": false,
|
|
5
40
|
"type": "module",
|
|
6
41
|
"main": "./dist/index.js",
|
|
7
42
|
"types": "./dist/index.d.ts",
|
|
@@ -13,26 +48,27 @@
|
|
|
13
48
|
},
|
|
14
49
|
"files": [
|
|
15
50
|
"dist",
|
|
16
|
-
"src"
|
|
51
|
+
"src",
|
|
52
|
+
"README.md"
|
|
17
53
|
],
|
|
18
54
|
"publishConfig": {
|
|
19
55
|
"access": "public"
|
|
20
56
|
},
|
|
21
|
-
"peerDependencies": {
|
|
22
|
-
"zod": "^3.24.0"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"typescript": "^5.7.3",
|
|
26
|
-
"vitest": "^2.1.8",
|
|
27
|
-
"zod": "^3.24.0",
|
|
28
|
-
"@moxxy/tsconfig": "0.0.0",
|
|
29
|
-
"@moxxy/vitest-preset": "0.0.0"
|
|
30
|
-
},
|
|
31
57
|
"scripts": {
|
|
32
58
|
"build": "tsc -p tsconfig.json",
|
|
33
59
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
34
60
|
"test": "vitest run",
|
|
35
61
|
"test:watch": "vitest",
|
|
36
62
|
"clean": "rm -rf dist .turbo"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"zod": "catalog:"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@moxxy/tsconfig": "workspace:*",
|
|
69
|
+
"@moxxy/vitest-preset": "workspace:*",
|
|
70
|
+
"typescript": "catalog:",
|
|
71
|
+
"vitest": "catalog:",
|
|
72
|
+
"zod": "catalog:"
|
|
37
73
|
}
|
|
38
|
-
}
|
|
74
|
+
}
|