@moxxy/sdk 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -73
- package/dist/client-session.d.ts +10 -0
- package/dist/client-session.d.ts.map +1 -1
- package/dist/compactor-helpers.d.ts +4 -1
- package/dist/compactor-helpers.d.ts.map +1 -1
- package/dist/compactor-helpers.js +50 -21
- package/dist/compactor-helpers.js.map +1 -1
- package/dist/define.d.ts +6 -0
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js +9 -0
- package/dist/define.js.map +1 -1
- package/dist/embedding.d.ts +17 -0
- package/dist/embedding.d.ts.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/fs-utils.d.ts +27 -0
- package/dist/fs-utils.d.ts.map +1 -0
- package/dist/fs-utils.js +44 -0
- package/dist/fs-utils.js.map +1 -0
- package/dist/http-utils.d.ts +16 -0
- package/dist/http-utils.d.ts.map +1 -0
- package/dist/http-utils.js +40 -0
- package/dist/http-utils.js.map +1 -0
- package/dist/index.d.ts +15 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/mode-helpers.d.ts +58 -0
- package/dist/mode-helpers.d.ts.map +1 -1
- package/dist/mode-helpers.js +119 -0
- package/dist/mode-helpers.js.map +1 -1
- package/dist/mode.d.ts +34 -0
- package/dist/mode.d.ts.map +1 -1
- package/dist/mutex.d.ts +15 -0
- package/dist/mutex.d.ts.map +1 -0
- package/dist/mutex.js +15 -0
- package/dist/mutex.js.map +1 -0
- package/dist/plugin.d.ts +36 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/provider-utils.d.ts +6 -0
- package/dist/provider-utils.d.ts.map +1 -1
- package/dist/provider-utils.js +8 -0
- package/dist/provider-utils.js.map +1 -1
- package/dist/requirements.d.ts +1 -1
- package/dist/requirements.d.ts.map +1 -1
- package/dist/resolvers.d.ts +52 -0
- package/dist/resolvers.d.ts.map +1 -0
- package/dist/resolvers.js +123 -0
- package/dist/resolvers.js.map +1 -0
- package/dist/schemas.d.ts +28 -28
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +2 -0
- package/dist/schemas.js.map +1 -1
- package/dist/session-like.d.ts +98 -2
- package/dist/session-like.d.ts.map +1 -1
- package/dist/synthesizer.d.ts +63 -0
- package/dist/synthesizer.d.ts.map +1 -0
- package/dist/synthesizer.js +21 -0
- package/dist/synthesizer.js.map +1 -0
- package/dist/tool.d.ts +13 -0
- package/dist/tool.d.ts.map +1 -1
- package/dist/voice.d.ts +36 -0
- package/dist/voice.d.ts.map +1 -0
- package/dist/voice.js +82 -0
- package/dist/voice.js.map +1 -0
- package/dist/workflow.d.ts +144 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +14 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +14 -14
- package/src/client-session.ts +11 -0
- package/src/compactor-helpers.test.ts +41 -0
- package/src/compactor-helpers.ts +53 -19
- package/src/define.ts +15 -0
- package/src/embedding.ts +18 -0
- package/src/errors.ts +3 -0
- package/src/fs-utils.test.ts +61 -0
- package/src/fs-utils.ts +55 -0
- package/src/http-utils.test.ts +36 -0
- package/src/http-utils.ts +40 -0
- package/src/index.ts +69 -3
- package/src/mode-helpers.ts +169 -0
- package/src/mode.ts +35 -0
- package/src/mutex.test.ts +36 -0
- package/src/mutex.ts +31 -0
- package/src/plugin.ts +36 -1
- package/src/provider-utils.ts +9 -0
- package/src/requirements.ts +1 -0
- package/src/resolvers.test.ts +45 -0
- package/src/resolvers.ts +164 -0
- package/src/schemas.ts +2 -0
- package/src/session-like.ts +100 -2
- package/src/stuck-loop.test.ts +42 -0
- package/src/synthesizer.ts +67 -0
- package/src/tool.ts +13 -0
- package/src/voice.ts +103 -0
- package/src/workflow.ts +165 -0
- package/dist/command-sync.d.ts +0 -23
- package/dist/command-sync.d.ts.map +0 -1
- package/dist/command-sync.js +0 -36
- package/dist/command-sync.js.map +0 -1
- package/dist/loop-helpers.d.ts +0 -68
- package/dist/loop-helpers.d.ts.map +0 -1
- package/dist/loop-helpers.js +0 -283
- package/dist/loop-helpers.js.map +0 -1
- package/dist/loop.d.ts +0 -106
- package/dist/loop.d.ts.map +0 -1
- package/dist/loop.js +0 -2
- package/dist/loop.js.map +0 -1
- package/dist/plugin-kind.d.ts +0 -10
- package/dist/plugin-kind.d.ts.map +0 -1
- package/dist/plugin-kind.js +0 -31
- package/dist/plugin-kind.js.map +0 -1
package/dist/session-like.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MoxxyEvent, UserPromptAttachment } from './events.js';
|
|
2
2
|
import type { SessionId, TurnId } from './ids.js';
|
|
3
3
|
import type { EventLogReader } from './log.js';
|
|
4
|
-
import type { ApprovalResolver } from './mode.js';
|
|
4
|
+
import type { ApprovalResolver, ModeBadge } from './mode.js';
|
|
5
5
|
import type { PermissionResolver } from './permission.js';
|
|
6
6
|
import type { ModelDescriptor } from './provider.js';
|
|
7
7
|
import type { ToolCompactPresentation } from './tool.js';
|
|
@@ -37,10 +37,22 @@ export interface RunTurnOptions {
|
|
|
37
37
|
export interface SessionLogReader extends EventLogReader {
|
|
38
38
|
subscribe(fn: (event: MoxxyEvent) => void | Promise<void>): () => void;
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
40
|
+
/** How a provider authenticates. UIs use this to decide whether to
|
|
41
|
+
* show an API-key field or kick off an OAuth flow. */
|
|
42
|
+
export type ProviderAuthKind = 'api-key' | 'oauth';
|
|
43
|
+
/** Serializable provider metadata (models + context windows + auth)
|
|
44
|
+
* for display. */
|
|
41
45
|
export interface ProviderInfo {
|
|
42
46
|
readonly name: string;
|
|
43
47
|
readonly models: ReadonlyArray<ModelDescriptor>;
|
|
48
|
+
/** 'oauth' when the provider declares an oauth login on its plugin
|
|
49
|
+
* definition, 'api-key' otherwise. Defaults to 'api-key' for
|
|
50
|
+
* providers that don't declare. */
|
|
51
|
+
readonly authKind: ProviderAuthKind;
|
|
52
|
+
/** True when the provider's plugin can list its models live (e.g.
|
|
53
|
+
* via /v1/models). Lets the desktop's model picker show a
|
|
54
|
+
* "Fetch live" affordance only where it makes sense. */
|
|
55
|
+
readonly supportsLiveModelDiscovery: boolean;
|
|
44
56
|
}
|
|
45
57
|
/** Serializable tool metadata for status lines / slash menus / compact rendering. */
|
|
46
58
|
export interface ToolInfo {
|
|
@@ -76,6 +88,13 @@ export interface SessionInfo {
|
|
|
76
88
|
readonly activeProvider: string | null;
|
|
77
89
|
readonly providers: ReadonlyArray<ProviderInfo>;
|
|
78
90
|
readonly activeMode: string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Presentation hint for the active mode, when it advertises one (see
|
|
93
|
+
* {@link ModeBadge}). Lets channels render a persistent accent badge for
|
|
94
|
+
* autonomous modes like goal mode. `null` when no mode is active or the
|
|
95
|
+
* active mode declares no badge.
|
|
96
|
+
*/
|
|
97
|
+
readonly activeModeBadge: ModeBadge | null;
|
|
79
98
|
readonly modes: ReadonlyArray<string>;
|
|
80
99
|
readonly tools: ReadonlyArray<ToolInfo>;
|
|
81
100
|
readonly skills: ReadonlyArray<SkillInfo>;
|
|
@@ -85,6 +104,69 @@ export interface SessionInfo {
|
|
|
85
104
|
readonly hasTranscriber: boolean;
|
|
86
105
|
/** Name of the active transcriber, or null. Lets a thin client proxy STT. */
|
|
87
106
|
readonly activeTranscriber: string | null;
|
|
107
|
+
/** Whether any text-to-speech backend is registered. */
|
|
108
|
+
readonly hasSynthesizer: boolean;
|
|
109
|
+
/** Name of the active synthesizer, or null. Lets a thin client proxy TTS
|
|
110
|
+
* (the desktop routes "Read aloud" through it; null → OS voice fallback). */
|
|
111
|
+
readonly activeSynthesizer: string | null;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Resolves a provider's stored credentials (vault tokens / API keys) into the
|
|
115
|
+
* config object `providers.setActive` needs. The host installs one on a local
|
|
116
|
+
* Session at boot; it is undefined across a `RemoteSession` transport (a closure
|
|
117
|
+
* can't cross the wire — the runner side resolves credentials there instead).
|
|
118
|
+
*/
|
|
119
|
+
export type CredentialResolver = (providerName: string) => Promise<Record<string, unknown>>;
|
|
120
|
+
/** One server's status in {@link McpAdminView.listServers}. */
|
|
121
|
+
export interface McpServerStatusView {
|
|
122
|
+
readonly name: string;
|
|
123
|
+
readonly enabled: boolean;
|
|
124
|
+
readonly connected: boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The slice of the MCP admin API a channel needs to drive the MCP picker and
|
|
128
|
+
* status line. Present on a local Session when the MCP admin plugin is wired;
|
|
129
|
+
* a `RemoteSession` leaves {@link SessionLike.mcpAdmin} undefined and the UI
|
|
130
|
+
* degrades gracefully.
|
|
131
|
+
*/
|
|
132
|
+
export interface McpAdminView {
|
|
133
|
+
enableAndAttach(name: string): Promise<{
|
|
134
|
+
toolNames: ReadonlyArray<string>;
|
|
135
|
+
} | null>;
|
|
136
|
+
detach(name: string): Promise<boolean>;
|
|
137
|
+
listServers(): Promise<ReadonlyArray<McpServerStatusView>>;
|
|
138
|
+
}
|
|
139
|
+
/** One workflow's summary for the `/workflows` modal. */
|
|
140
|
+
export interface WorkflowSummaryView {
|
|
141
|
+
readonly name: string;
|
|
142
|
+
readonly description: string;
|
|
143
|
+
readonly enabled: boolean;
|
|
144
|
+
readonly scope: string;
|
|
145
|
+
readonly steps: number;
|
|
146
|
+
/** Human-readable trigger summary, e.g. `cron(0 8 * * *)` or `on-demand`. */
|
|
147
|
+
readonly triggers: string;
|
|
148
|
+
}
|
|
149
|
+
/** Result of running a workflow from the modal. */
|
|
150
|
+
export interface WorkflowRunView {
|
|
151
|
+
readonly ok: boolean;
|
|
152
|
+
readonly output: string;
|
|
153
|
+
readonly error?: string;
|
|
154
|
+
readonly steps: ReadonlyArray<{
|
|
155
|
+
readonly id: string;
|
|
156
|
+
readonly status: string;
|
|
157
|
+
readonly error?: string;
|
|
158
|
+
}>;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The slice of the workflows API a channel needs to drive the `/workflows`
|
|
162
|
+
* modal (list, enable/disable toggle, run). Present on a local Session when
|
|
163
|
+
* `@moxxy/plugin-workflows` is wired; a `RemoteSession` leaves
|
|
164
|
+
* {@link SessionLike.workflows} undefined and the UI degrades gracefully.
|
|
165
|
+
*/
|
|
166
|
+
export interface WorkflowsView {
|
|
167
|
+
list(): Promise<ReadonlyArray<WorkflowSummaryView>>;
|
|
168
|
+
setEnabled(name: string, enabled: boolean): Promise<void>;
|
|
169
|
+
run(name: string): Promise<WorkflowRunView>;
|
|
88
170
|
}
|
|
89
171
|
/**
|
|
90
172
|
* The session surface a `Channel` depends on, decoupled from whether the
|
|
@@ -107,5 +189,19 @@ export interface SessionLike {
|
|
|
107
189
|
/** Wire-friendly registry snapshot for rendering. */
|
|
108
190
|
getInfo(): SessionInfo;
|
|
109
191
|
close(reason?: string): Promise<void>;
|
|
192
|
+
/**
|
|
193
|
+
* Live runtime capabilities present only on an in-process Session; a
|
|
194
|
+
* `RemoteSession` thin client leaves them undefined, so callers MUST guard.
|
|
195
|
+
* For plain display prefer the serializable {@link getInfo} snapshot — these
|
|
196
|
+
* are for the mutate/guard paths a channel drives (provider switch, MCP picker).
|
|
197
|
+
*/
|
|
198
|
+
/** Providers whose credentials resolved this session (live, mutable). */
|
|
199
|
+
readyProviders?: Set<string>;
|
|
200
|
+
/** Re-resolves a provider's credentials before `providers.setActive`. */
|
|
201
|
+
credentialResolver?: CredentialResolver;
|
|
202
|
+
/** MCP admin slice backing the MCP picker / status line. */
|
|
203
|
+
mcpAdmin?: McpAdminView;
|
|
204
|
+
/** Workflows slice backing the `/workflows` modal. */
|
|
205
|
+
workflows?: WorkflowsView;
|
|
110
206
|
}
|
|
111
207
|
//# sourceMappingURL=session-like.d.ts.map
|
|
@@ -1 +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;
|
|
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,SAAS,EAAE,MAAM,WAAW,CAAC;AAC7D,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,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAC3D;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,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CAAC,eAAe,CAAC,CAAC;CAC7C;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;IAC1E,qBAAqB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC1D,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAC;IAC7D,qDAAqD;IACrD,OAAO,IAAI,WAAW,CAAC;IACvB,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtC;;;;;OAKG;IACH,yEAAyE;IACzE,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,sDAAsD;IACtD,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthesizers convert text into spoken audio (text-to-speech). They are the
|
|
3
|
+
* symmetric counterpart to {@link Transcriber} (speech-to-text): a separate,
|
|
4
|
+
* swappable capability so a user can pair any text provider with a dedicated
|
|
5
|
+
* TTS backend (the OS voice, ElevenLabs, OpenAI, a local engine, …).
|
|
6
|
+
*
|
|
7
|
+
* Plugins register a `SynthesizerDef` via `PluginSpec.synthesizers`. The core
|
|
8
|
+
* `SynthesizerRegistry` holds them; surfaces that read aloud (the desktop's
|
|
9
|
+
* "Read aloud" button, a future voice channel) call
|
|
10
|
+
* `session.synthesizers.getActive()` (or `tryGetActive()`) to turn text into
|
|
11
|
+
* audio. There is at most one *active* synthesizer at a time; when none is
|
|
12
|
+
* active the caller degrades gracefully (the desktop falls back to the
|
|
13
|
+
* browser/OS `speechSynthesis`).
|
|
14
|
+
*
|
|
15
|
+
* The user swaps the active synthesizer by asking the agent ("use ElevenLabs
|
|
16
|
+
* for read-aloud") — there is no settings UI. The agent activates a registered
|
|
17
|
+
* synthesizer (a plugin it authored/installed self-activates in `onInit`, or it
|
|
18
|
+
* calls a set-active tool); switching back to the OS voice deactivates it.
|
|
19
|
+
*/
|
|
20
|
+
export interface SynthesizeOptions {
|
|
21
|
+
/** Preferred voice id/name, when the backend supports selection. */
|
|
22
|
+
readonly voice?: string;
|
|
23
|
+
/** BCP-47 language hint (e.g. `en`, `pl`). */
|
|
24
|
+
readonly language?: string;
|
|
25
|
+
/** Speaking rate multiplier (1.0 = normal), when supported. */
|
|
26
|
+
readonly rate?: number;
|
|
27
|
+
/** Cancellation signal — callers propagate a stop/abort here. */
|
|
28
|
+
readonly signal?: AbortSignal;
|
|
29
|
+
}
|
|
30
|
+
export interface SynthesisResult {
|
|
31
|
+
/** Encoded audio bytes ready to play (e.g. an mp3/wav/ogg payload). */
|
|
32
|
+
readonly audio: Uint8Array;
|
|
33
|
+
/** MIME type of {@link audio}, e.g. `audio/mpeg`, `audio/wav`, `audio/ogg`. */
|
|
34
|
+
readonly mimeType: string;
|
|
35
|
+
}
|
|
36
|
+
export interface Synthesizer {
|
|
37
|
+
/** Short stable name, e.g. `elevenlabs`. */
|
|
38
|
+
readonly name: string;
|
|
39
|
+
synthesize(text: string, opts?: SynthesizeOptions): Promise<SynthesisResult>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Context handed to {@link SynthesizerDef.create} when the registry activates a
|
|
43
|
+
* synthesizer. `getSecret` reads a vault secret (the API key) the same way a
|
|
44
|
+
* tool handler does via `ctx.getSecret` — so an authored TTS plugin never has
|
|
45
|
+
* to touch `process.env`, and the key never enters the model's context.
|
|
46
|
+
*/
|
|
47
|
+
export interface SynthesizerCreateContext {
|
|
48
|
+
/** Per-synthesizer config (e.g. from `session.synthesizers.setActive(name, config)`). */
|
|
49
|
+
readonly config: Record<string, unknown>;
|
|
50
|
+
/** Read a named vault secret, or null if unset / no vault is wired. */
|
|
51
|
+
readonly getSecret?: (name: string) => Promise<string | null>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Plugin-side definition. Mirrors `TranscriberDef`: a `create(ctx)` factory the
|
|
55
|
+
* registry calls when this synthesizer is activated.
|
|
56
|
+
*/
|
|
57
|
+
export interface SynthesizerDef {
|
|
58
|
+
readonly name: string;
|
|
59
|
+
/** Optional human-readable label for UI surfaces. */
|
|
60
|
+
readonly displayName?: string;
|
|
61
|
+
create(ctx: SynthesizerCreateContext): Synthesizer;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=synthesizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesizer.d.ts","sourceRoot":"","sources":["../src/synthesizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,iBAAiB;IAChC,oEAAoE;IACpE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC9E;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,yFAAyF;IACzF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,uEAAuE;IACvE,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC/D;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,MAAM,CAAC,GAAG,EAAE,wBAAwB,GAAG,WAAW,CAAC;CACpD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthesizers convert text into spoken audio (text-to-speech). They are the
|
|
3
|
+
* symmetric counterpart to {@link Transcriber} (speech-to-text): a separate,
|
|
4
|
+
* swappable capability so a user can pair any text provider with a dedicated
|
|
5
|
+
* TTS backend (the OS voice, ElevenLabs, OpenAI, a local engine, …).
|
|
6
|
+
*
|
|
7
|
+
* Plugins register a `SynthesizerDef` via `PluginSpec.synthesizers`. The core
|
|
8
|
+
* `SynthesizerRegistry` holds them; surfaces that read aloud (the desktop's
|
|
9
|
+
* "Read aloud" button, a future voice channel) call
|
|
10
|
+
* `session.synthesizers.getActive()` (or `tryGetActive()`) to turn text into
|
|
11
|
+
* audio. There is at most one *active* synthesizer at a time; when none is
|
|
12
|
+
* active the caller degrades gracefully (the desktop falls back to the
|
|
13
|
+
* browser/OS `speechSynthesis`).
|
|
14
|
+
*
|
|
15
|
+
* The user swaps the active synthesizer by asking the agent ("use ElevenLabs
|
|
16
|
+
* for read-aloud") — there is no settings UI. The agent activates a registered
|
|
17
|
+
* synthesizer (a plugin it authored/installed self-activates in `onInit`, or it
|
|
18
|
+
* calls a set-active tool); switching back to the OS voice deactivates it.
|
|
19
|
+
*/
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=synthesizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesizer.js","sourceRoot":"","sources":["../src/synthesizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG"}
|
package/dist/tool.d.ts
CHANGED
|
@@ -116,6 +116,19 @@ export interface ToolContext {
|
|
|
116
116
|
* `caps.subprocess` + optional `caps.commands` allowlist.
|
|
117
117
|
*/
|
|
118
118
|
readonly exec?: BrokeredExec;
|
|
119
|
+
/**
|
|
120
|
+
* Read a named secret from the host's secret store (the vault) at call
|
|
121
|
+
* time. Present when the session is wired with a vault-backed resolver
|
|
122
|
+
* (the CLI/runner does this). Returns the plaintext value, or `null` if
|
|
123
|
+
* no such secret exists.
|
|
124
|
+
*
|
|
125
|
+
* This is the blessed way for a tool/plugin to consume an API key or
|
|
126
|
+
* token: the plaintext only ever reaches the handler that asks for it —
|
|
127
|
+
* it is never placed in the model's context or in `process.env`. Store
|
|
128
|
+
* the secret once via `/vault set NAME …` (or the desktop Secrets UI),
|
|
129
|
+
* then read it here, e.g. `const key = await ctx.getSecret('ELEVENLABS_API_KEY')`.
|
|
130
|
+
*/
|
|
131
|
+
readonly getSecret?: (name: string) => Promise<string | null>;
|
|
119
132
|
}
|
|
120
133
|
/**
|
|
121
134
|
* Optional presentation hint for compact rendering in TUI/chat surfaces.
|
package/dist/tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,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E,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,UAAU,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACnF,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,iBAAiB,CAAC;CACxC"}
|
package/dist/voice.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Voice / transcription helpers shared across surfaces.
|
|
3
|
+
*
|
|
4
|
+
* The TUI's voice-input infrastructure used to inline the same logic
|
|
5
|
+
* with a `Codex`-specific name baked in. Pulled out here as
|
|
6
|
+
* *agnostic* helpers that take a transcriber name as input, so the
|
|
7
|
+
* desktop, TUI, and any future channel can mirror the same flow:
|
|
8
|
+
*
|
|
9
|
+
* - Is the session ready to transcribe? Check via the requirements
|
|
10
|
+
* API for a named transcriber. (`checkTranscriberReady`)
|
|
11
|
+
* - Activate any registered transcriber lazily. Returns the active
|
|
12
|
+
* transcriber instance. (`resolveTranscriber`)
|
|
13
|
+
* - "Just give me whatever works" — try a list of candidates in
|
|
14
|
+
* order, or fall back to the first registered one. (`pickFirstAvailableTranscriber`)
|
|
15
|
+
*/
|
|
16
|
+
import type { ClientSession } from './client-session.js';
|
|
17
|
+
import type { MoxxyRequirement, RequirementCheck } from './requirements.js';
|
|
18
|
+
import type { Transcriber } from './transcriber.js';
|
|
19
|
+
/** Probe whether a *named* transcriber is ready: registered, with any
|
|
20
|
+
* declared upstream requirements satisfied. The optional `requires`
|
|
21
|
+
* list lets channels gate on additional provider / auth runtimes
|
|
22
|
+
* (the Codex transcriber e.g. depends on the `openai-codex` provider
|
|
23
|
+
* + its OAuth runtime). */
|
|
24
|
+
export declare function checkTranscriberReady(session: ClientSession, transcriberName: string, requires?: ReadonlyArray<MoxxyRequirement>): RequirementCheck;
|
|
25
|
+
/** Activate a transcriber by name, lazily. Returns the active instance
|
|
26
|
+
* ready to `.transcribe(...)`. Throws if no such transcriber is
|
|
27
|
+
* registered, or a *different* one is already active. */
|
|
28
|
+
export declare function resolveTranscriber(session: ClientSession, transcriberName: string): Transcriber;
|
|
29
|
+
/** "Just pick a transcriber that works."
|
|
30
|
+
*
|
|
31
|
+
* Tries each name in `candidates` in order — first one that can be
|
|
32
|
+
* activated wins. Returns null if none can be activated, so callers
|
|
33
|
+
* can degrade gracefully (hide their mic button, show a "no voice
|
|
34
|
+
* configured" tip, …) instead of throwing. */
|
|
35
|
+
export declare function pickFirstAvailableTranscriber(session: ClientSession, candidates: ReadonlyArray<string>): Transcriber | null;
|
|
36
|
+
//# sourceMappingURL=voice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice.d.ts","sourceRoot":"","sources":["../src/voice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;4BAI4B;AAC5B,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,aAAa,EACtB,eAAe,EAAE,MAAM,EACvB,QAAQ,GAAE,aAAa,CAAC,gBAAgB,CAAM,GAC7C,gBAAgB,CAqBlB;AAED;;0DAE0D;AAC1D,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,aAAa,EACtB,eAAe,EAAE,MAAM,GACtB,WAAW,CAcb;AAED;;;;;+CAK+C;AAC/C,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,aAAa,EACtB,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,GAChC,WAAW,GAAG,IAAI,CAepB"}
|
package/dist/voice.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Voice / transcription helpers shared across surfaces.
|
|
3
|
+
*
|
|
4
|
+
* The TUI's voice-input infrastructure used to inline the same logic
|
|
5
|
+
* with a `Codex`-specific name baked in. Pulled out here as
|
|
6
|
+
* *agnostic* helpers that take a transcriber name as input, so the
|
|
7
|
+
* desktop, TUI, and any future channel can mirror the same flow:
|
|
8
|
+
*
|
|
9
|
+
* - Is the session ready to transcribe? Check via the requirements
|
|
10
|
+
* API for a named transcriber. (`checkTranscriberReady`)
|
|
11
|
+
* - Activate any registered transcriber lazily. Returns the active
|
|
12
|
+
* transcriber instance. (`resolveTranscriber`)
|
|
13
|
+
* - "Just give me whatever works" — try a list of candidates in
|
|
14
|
+
* order, or fall back to the first registered one. (`pickFirstAvailableTranscriber`)
|
|
15
|
+
*/
|
|
16
|
+
/** Probe whether a *named* transcriber is ready: registered, with any
|
|
17
|
+
* declared upstream requirements satisfied. The optional `requires`
|
|
18
|
+
* list lets channels gate on additional provider / auth runtimes
|
|
19
|
+
* (the Codex transcriber e.g. depends on the `openai-codex` provider
|
|
20
|
+
* + its OAuth runtime). */
|
|
21
|
+
export function checkTranscriberReady(session, transcriberName, requires = []) {
|
|
22
|
+
const baseline = [
|
|
23
|
+
{ kind: 'transcriber', name: transcriberName },
|
|
24
|
+
...requires,
|
|
25
|
+
];
|
|
26
|
+
const check = session.requirements.check(baseline);
|
|
27
|
+
const activeName = session.transcribers.getActiveName();
|
|
28
|
+
if (!activeName || activeName === transcriberName)
|
|
29
|
+
return check;
|
|
30
|
+
const conflict = {
|
|
31
|
+
requirement: {
|
|
32
|
+
kind: 'transcriber',
|
|
33
|
+
name: transcriberName,
|
|
34
|
+
state: 'active',
|
|
35
|
+
hint: `Switch active transcriber to ${transcriberName}.`,
|
|
36
|
+
},
|
|
37
|
+
code: 'inactive',
|
|
38
|
+
message: `Required active transcriber ${transcriberName}; active is ${activeName}`,
|
|
39
|
+
hint: `Switch active transcriber to ${transcriberName}.`,
|
|
40
|
+
};
|
|
41
|
+
return { ready: false, issues: [conflict, ...check.issues] };
|
|
42
|
+
}
|
|
43
|
+
/** Activate a transcriber by name, lazily. Returns the active instance
|
|
44
|
+
* ready to `.transcribe(...)`. Throws if no such transcriber is
|
|
45
|
+
* registered, or a *different* one is already active. */
|
|
46
|
+
export function resolveTranscriber(session, transcriberName) {
|
|
47
|
+
const activeName = session.transcribers.getActiveName();
|
|
48
|
+
if (activeName && activeName !== transcriberName) {
|
|
49
|
+
throw new Error(`Another transcriber is already active: ${activeName}.`);
|
|
50
|
+
}
|
|
51
|
+
if (activeName === transcriberName)
|
|
52
|
+
return session.transcribers.getActive();
|
|
53
|
+
if (session.transcribers.has(transcriberName)) {
|
|
54
|
+
return session.transcribers.setActive(transcriberName);
|
|
55
|
+
}
|
|
56
|
+
throw new Error(`No transcriber registered as ${transcriberName}. Configure one via your moxxy plugins.`);
|
|
57
|
+
}
|
|
58
|
+
/** "Just pick a transcriber that works."
|
|
59
|
+
*
|
|
60
|
+
* Tries each name in `candidates` in order — first one that can be
|
|
61
|
+
* activated wins. Returns null if none can be activated, so callers
|
|
62
|
+
* can degrade gracefully (hide their mic button, show a "no voice
|
|
63
|
+
* configured" tip, …) instead of throwing. */
|
|
64
|
+
export function pickFirstAvailableTranscriber(session, candidates) {
|
|
65
|
+
// If something's already active, just hand that back — never fight
|
|
66
|
+
// a user-chosen activation.
|
|
67
|
+
const existing = session.transcribers.tryGetActive();
|
|
68
|
+
if (existing)
|
|
69
|
+
return existing;
|
|
70
|
+
for (const name of candidates) {
|
|
71
|
+
try {
|
|
72
|
+
return resolveTranscriber(session, name);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// Wrong-active errors don't apply here (we just returned early),
|
|
76
|
+
// so any throw is "this candidate isn't registered" — keep
|
|
77
|
+
// trying.
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=voice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice.js","sourceRoot":"","sources":["../src/voice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH;;;;4BAI4B;AAC5B,MAAM,UAAU,qBAAqB,CACnC,OAAsB,EACtB,eAAuB,EACvB,WAA4C,EAAE;IAE9C,MAAM,QAAQ,GAAoC;QAChD,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,EAAE;QAC9C,GAAG,QAAQ;KACZ,CAAC;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC;IACxD,IAAI,CAAC,UAAU,IAAI,UAAU,KAAK,eAAe;QAAE,OAAO,KAAK,CAAC;IAEhE,MAAM,QAAQ,GAAqB;QACjC,WAAW,EAAE;YACX,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,gCAAgC,eAAe,GAAG;SACzD;QACD,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,+BAA+B,eAAe,eAAe,UAAU,EAAE;QAClF,IAAI,EAAE,gCAAgC,eAAe,GAAG;KACzD,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;AAC/D,CAAC;AAED;;0DAE0D;AAC1D,MAAM,UAAU,kBAAkB,CAChC,OAAsB,EACtB,eAAuB;IAEvB,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC;IACxD,IAAI,UAAU,IAAI,UAAU,KAAK,eAAe,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CACb,0CAA0C,UAAU,GAAG,CACxD,CAAC;IACJ,CAAC;IACD,IAAI,UAAU,KAAK,eAAe;QAAE,OAAO,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC;IAC5E,IAAI,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;QAC9C,OAAO,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACzD,CAAC;IACD,MAAM,IAAI,KAAK,CACb,gCAAgC,eAAe,yCAAyC,CACzF,CAAC;AACJ,CAAC;AAED;;;;;+CAK+C;AAC/C,MAAM,UAAU,6BAA6B,CAC3C,OAAsB,EACtB,UAAiC;IAEjC,mEAAmE;IACnE,4BAA4B;IAC5B,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;IACrD,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,IAAI,CAAC;YACH,OAAO,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC3C,CAAC;QAAC,MAAM,CAAC;YACP,iEAAiE;YACjE,2DAA2D;YAC3D,UAAU;QACZ,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflows — saved, parameterized, schedulable/event-triggered DAGs whose
|
|
3
|
+
* steps run a skill, a free-form prompt, a tool, or a nested workflow, piping
|
|
4
|
+
* each step's output into the next. A workflow is an *artifact* (authored like
|
|
5
|
+
* a skill, discovered from disk); the strategy that *executes* it is a
|
|
6
|
+
* swappable block — {@link WorkflowExecutorDef} — registered into the
|
|
7
|
+
* `WorkflowExecutorRegistry` and selected by name, mirroring modes/compactors.
|
|
8
|
+
*
|
|
9
|
+
* These are the shared structural types. The zod schema that validates
|
|
10
|
+
* on-disk YAML lives in `@moxxy/plugin-workflows`; its parsed output is
|
|
11
|
+
* assignable to {@link Workflow}.
|
|
12
|
+
*/
|
|
13
|
+
import type { Skill } from './skill.js';
|
|
14
|
+
import type { SubagentSpawner } from './subagent.js';
|
|
15
|
+
/** What fires a workflow. Omit `on` entirely for an on-demand-only workflow. */
|
|
16
|
+
export interface WorkflowTrigger {
|
|
17
|
+
/** Cron / one-shot time trigger, dispatched by `@moxxy/plugin-scheduler`. */
|
|
18
|
+
readonly schedule?: {
|
|
19
|
+
readonly cron?: string;
|
|
20
|
+
readonly runAt?: number | string;
|
|
21
|
+
readonly timeZone?: string;
|
|
22
|
+
};
|
|
23
|
+
/** Run when the named workflow(s) complete successfully (EventLog-driven). */
|
|
24
|
+
readonly afterWorkflow?: string | ReadonlyArray<string>;
|
|
25
|
+
/** Run when files matching the glob(s) under cwd change (fs.watch-driven). */
|
|
26
|
+
readonly fileChanged?: string | ReadonlyArray<string>;
|
|
27
|
+
/** Named webhook provider whose delivery fires this workflow. */
|
|
28
|
+
readonly webhook?: string;
|
|
29
|
+
}
|
|
30
|
+
/** How a failed step is handled: abort the workflow, skip past it, or retry. */
|
|
31
|
+
export type WorkflowStepErrorMode = 'fail' | 'continue' | 'retry';
|
|
32
|
+
/**
|
|
33
|
+
* One node in the DAG. Exactly one *action* key is set
|
|
34
|
+
* (`skill` | `prompt` | `tool` | `workflow`). `input` is the templated prompt
|
|
35
|
+
* for skill/prompt actions; `args` are the templated arguments for
|
|
36
|
+
* tool/workflow actions. `needs` are the upstream step ids this step depends on.
|
|
37
|
+
*/
|
|
38
|
+
export interface WorkflowStep {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly skill?: string;
|
|
41
|
+
readonly prompt?: string;
|
|
42
|
+
readonly tool?: string;
|
|
43
|
+
readonly workflow?: string;
|
|
44
|
+
readonly input?: string;
|
|
45
|
+
readonly args?: Record<string, unknown>;
|
|
46
|
+
readonly needs: ReadonlyArray<string>;
|
|
47
|
+
/** Condition DSL; when it evaluates false the step is skipped. */
|
|
48
|
+
readonly when?: string;
|
|
49
|
+
readonly onError: WorkflowStepErrorMode;
|
|
50
|
+
readonly retries: number;
|
|
51
|
+
readonly label?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface WorkflowInputSpec {
|
|
54
|
+
readonly default?: unknown;
|
|
55
|
+
readonly description?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface WorkflowDelivery {
|
|
58
|
+
/** Soft hint for delivery target — e.g. "telegram", "inbox". */
|
|
59
|
+
readonly channel?: string;
|
|
60
|
+
/** Also drop the final output into `~/.moxxy/inbox/`. Default true. */
|
|
61
|
+
readonly inbox: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface Workflow {
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly description: string;
|
|
66
|
+
readonly version: number;
|
|
67
|
+
/**
|
|
68
|
+
* When false the workflow is inert: triggers (schedule/event) never fire it
|
|
69
|
+
* and it is excluded from auto-runs, but it stays listable and can still be
|
|
70
|
+
* run explicitly. Toggled from the `/workflows` command.
|
|
71
|
+
*/
|
|
72
|
+
readonly enabled: boolean;
|
|
73
|
+
readonly inputs: Record<string, WorkflowInputSpec>;
|
|
74
|
+
readonly on?: WorkflowTrigger;
|
|
75
|
+
readonly delivery?: WorkflowDelivery;
|
|
76
|
+
/** Max steps to run concurrently in one ready-set round. */
|
|
77
|
+
readonly concurrency: number;
|
|
78
|
+
readonly steps: ReadonlyArray<WorkflowStep>;
|
|
79
|
+
}
|
|
80
|
+
/** Minimal tool surface a step needs — structurally a subset of `ToolRegistry`. */
|
|
81
|
+
export interface WorkflowToolRunner {
|
|
82
|
+
get(name: string): unknown | undefined;
|
|
83
|
+
execute(name: string, input: unknown, signal: AbortSignal): Promise<unknown>;
|
|
84
|
+
}
|
|
85
|
+
/** Look up sibling artifacts by name during a run. */
|
|
86
|
+
export interface WorkflowLookup {
|
|
87
|
+
skill(name: string): Skill | undefined;
|
|
88
|
+
workflow(name: string): Workflow | undefined;
|
|
89
|
+
}
|
|
90
|
+
/** Lifecycle subtypes an executor emits as `plugin_event`s (mirrors plan_*). */
|
|
91
|
+
export type WorkflowEventSubtype = 'workflow_started' | 'workflow_step_started' | 'workflow_step_completed' | 'workflow_step_skipped' | 'workflow_step_failed' | 'workflow_completed' | 'workflow_failed';
|
|
92
|
+
/**
|
|
93
|
+
* Everything an executor needs to run a workflow, supplied by the caller.
|
|
94
|
+
* The in-turn `workflow_run` tool wires `spawner` from `ctx.subagents`; the
|
|
95
|
+
* autonomous runner builds one from an isolated session. Kept free of core
|
|
96
|
+
* imports so the executor stays in a plugin.
|
|
97
|
+
*/
|
|
98
|
+
export interface WorkflowRunDeps {
|
|
99
|
+
readonly spawner: SubagentSpawner;
|
|
100
|
+
readonly tools: WorkflowToolRunner;
|
|
101
|
+
readonly lookup: WorkflowLookup;
|
|
102
|
+
readonly signal: AbortSignal;
|
|
103
|
+
/** Resolved input values (defaults already applied) for this run. */
|
|
104
|
+
readonly inputs?: Record<string, unknown>;
|
|
105
|
+
/** Free-form description of what fired the run (for `{{ trigger }}`). */
|
|
106
|
+
readonly trigger?: string;
|
|
107
|
+
/** Wall-clock source. Injected so tests are deterministic. */
|
|
108
|
+
readonly now?: () => number;
|
|
109
|
+
/** Emit a workflow lifecycle event. No-op when omitted. */
|
|
110
|
+
readonly emit?: (subtype: WorkflowEventSubtype, payload: unknown) => void | Promise<void>;
|
|
111
|
+
readonly logger?: {
|
|
112
|
+
warn?(msg: string, meta?: Record<string, unknown>): void;
|
|
113
|
+
info?(msg: string, meta?: Record<string, unknown>): void;
|
|
114
|
+
};
|
|
115
|
+
/** Nested-workflow recursion depth; executors guard against runaway nesting. */
|
|
116
|
+
readonly depth?: number;
|
|
117
|
+
}
|
|
118
|
+
export type WorkflowStepStatus = 'completed' | 'skipped' | 'failed';
|
|
119
|
+
export interface WorkflowStepResult {
|
|
120
|
+
readonly id: string;
|
|
121
|
+
readonly status: WorkflowStepStatus;
|
|
122
|
+
readonly output: string;
|
|
123
|
+
readonly error?: string;
|
|
124
|
+
readonly startedAt: number;
|
|
125
|
+
readonly endedAt: number;
|
|
126
|
+
}
|
|
127
|
+
export interface WorkflowRunResult {
|
|
128
|
+
readonly ok: boolean;
|
|
129
|
+
readonly steps: ReadonlyArray<WorkflowStepResult>;
|
|
130
|
+
/** Output of the terminal (sink) step(s) — what delivery sends. */
|
|
131
|
+
readonly output: string;
|
|
132
|
+
readonly error?: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* A swappable workflow-execution strategy. v1 ships one (`dag`); a plugin can
|
|
136
|
+
* register alternatives (parallel-heavy, dry-run, …) and the active one is
|
|
137
|
+
* selected by name via `session.workflowExecutors.setActive(name)`.
|
|
138
|
+
*/
|
|
139
|
+
export interface WorkflowExecutorDef {
|
|
140
|
+
readonly name: string;
|
|
141
|
+
readonly description?: string;
|
|
142
|
+
run(workflow: Workflow, deps: WorkflowRunDeps): Promise<WorkflowRunResult>;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAClB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,KAAK,CAAC,E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AC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAClD,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC5E"}
|
package/dist/workflow.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflows — saved, parameterized, schedulable/event-triggered DAGs whose
|
|
3
|
+
* steps run a skill, a free-form prompt, a tool, or a nested workflow, piping
|
|
4
|
+
* each step's output into the next. A workflow is an *artifact* (authored like
|
|
5
|
+
* a skill, discovered from disk); the strategy that *executes* it is a
|
|
6
|
+
* swappable block — {@link WorkflowExecutorDef} — registered into the
|
|
7
|
+
* `WorkflowExecutorRegistry` and selected by name, mirroring modes/compactors.
|
|
8
|
+
*
|
|
9
|
+
* These are the shared structural types. The zod schema that validates
|
|
10
|
+
* on-disk YAML lives in `@moxxy/plugin-workflows`; its parsed output is
|
|
11
|
+
* assignable to {@link Workflow}.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moxxy/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Typed public surface for the moxxy framework: event types, define* factories, lifecycle hook signatures.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"moxxy",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
],
|
|
25
25
|
"homepage": "https://moxxy.ai",
|
|
26
26
|
"bugs": {
|
|
27
|
-
"url": "https://github.com/moxxy-ai/
|
|
27
|
+
"url": "https://github.com/moxxy-ai/moxxy/issues"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/moxxy-ai/
|
|
31
|
+
"url": "git+https://github.com/moxxy-ai/moxxy.git",
|
|
32
32
|
"directory": "packages/sdk"
|
|
33
33
|
},
|
|
34
34
|
"author": "Michal Makowski <michal.makowski97@gmail.com>",
|
|
@@ -54,21 +54,21 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"zod": "^3.24.0"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"typescript": "^5.7.3",
|
|
62
|
+
"vitest": "^2.1.8",
|
|
63
|
+
"zod": "^3.24.0",
|
|
64
|
+
"@moxxy/tsconfig": "0.0.0",
|
|
65
|
+
"@moxxy/vitest-preset": "0.0.0"
|
|
66
|
+
},
|
|
57
67
|
"scripts": {
|
|
58
68
|
"build": "tsc -p tsconfig.json",
|
|
59
69
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
60
70
|
"test": "vitest run",
|
|
61
71
|
"test:watch": "vitest",
|
|
62
72
|
"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:"
|
|
73
73
|
}
|
|
74
|
-
}
|
|
74
|
+
}
|