@moxxy/sdk 0.8.0 → 0.9.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 +32 -11
- package/dist/cache-strategy.d.ts +9 -0
- package/dist/cache-strategy.d.ts.map +1 -1
- package/dist/compactor-helpers.d.ts.map +1 -1
- package/dist/compactor-helpers.js +5 -0
- package/dist/compactor-helpers.js.map +1 -1
- package/dist/compactor.d.ts +10 -0
- package/dist/compactor.d.ts.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/mode-helpers.d.ts +9 -0
- package/dist/mode-helpers.d.ts.map +1 -1
- package/dist/mode-helpers.js +9 -1
- package/dist/mode-helpers.js.map +1 -1
- package/dist/provider.d.ts +10 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/session-like.d.ts +32 -0
- package/dist/session-like.d.ts.map +1 -1
- package/dist/subagent.d.ts +15 -0
- package/dist/subagent.d.ts.map +1 -1
- package/dist/tunnel.d.ts +31 -7
- package/dist/tunnel.d.ts.map +1 -1
- package/dist/tunnel.js +153 -1
- package/dist/tunnel.js.map +1 -1
- package/dist/view-renderer.d.ts +15 -0
- package/dist/view-renderer.d.ts.map +1 -1
- package/dist/view-renderer.js +24 -0
- package/dist/view-renderer.js.map +1 -1
- package/dist/workflow.d.ts +73 -6
- package/dist/workflow.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/cache-strategy.ts +9 -0
- package/src/compactor-helpers.ts +5 -0
- package/src/compactor.ts +10 -0
- package/src/index.ts +19 -8
- package/src/mode-helpers.ts +18 -1
- package/src/provider.ts +10 -0
- package/src/session-like.ts +29 -0
- package/src/subagent.ts +16 -0
- package/src/tunnel.test.ts +78 -0
- package/src/tunnel.ts +172 -0
- package/src/view-renderer.ts +22 -0
- package/src/workflow.ts +82 -5
- package/dist/voice.d.ts +0 -36
- package/dist/voice.d.ts.map +0 -1
- package/dist/voice.js +0 -82
- package/dist/voice.js.map +0 -1
- package/src/voice.ts +0 -103
package/dist/voice.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
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
|
package/dist/voice.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/src/voice.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
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
|
-
|
|
17
|
-
import type { ClientSession } from './client-session.js';
|
|
18
|
-
import type {
|
|
19
|
-
MoxxyRequirement,
|
|
20
|
-
RequirementCheck,
|
|
21
|
-
RequirementIssue,
|
|
22
|
-
} from './requirements.js';
|
|
23
|
-
import type { Transcriber } from './transcriber.js';
|
|
24
|
-
|
|
25
|
-
/** Probe whether a *named* transcriber is ready: registered, with any
|
|
26
|
-
* declared upstream requirements satisfied. The optional `requires`
|
|
27
|
-
* list lets channels gate on additional provider / auth runtimes
|
|
28
|
-
* (the Codex transcriber e.g. depends on the `openai-codex` provider
|
|
29
|
-
* + its OAuth runtime). */
|
|
30
|
-
export function checkTranscriberReady(
|
|
31
|
-
session: ClientSession,
|
|
32
|
-
transcriberName: string,
|
|
33
|
-
requires: ReadonlyArray<MoxxyRequirement> = [],
|
|
34
|
-
): RequirementCheck {
|
|
35
|
-
const baseline: ReadonlyArray<MoxxyRequirement> = [
|
|
36
|
-
{ kind: 'transcriber', name: transcriberName },
|
|
37
|
-
...requires,
|
|
38
|
-
];
|
|
39
|
-
const check = session.requirements.check(baseline);
|
|
40
|
-
const activeName = session.transcribers.getActiveName();
|
|
41
|
-
if (!activeName || activeName === transcriberName) return check;
|
|
42
|
-
|
|
43
|
-
const conflict: RequirementIssue = {
|
|
44
|
-
requirement: {
|
|
45
|
-
kind: 'transcriber',
|
|
46
|
-
name: transcriberName,
|
|
47
|
-
state: 'active',
|
|
48
|
-
hint: `Switch active transcriber to ${transcriberName}.`,
|
|
49
|
-
},
|
|
50
|
-
code: 'inactive',
|
|
51
|
-
message: `Required active transcriber ${transcriberName}; active is ${activeName}`,
|
|
52
|
-
hint: `Switch active transcriber to ${transcriberName}.`,
|
|
53
|
-
};
|
|
54
|
-
return { ready: false, issues: [conflict, ...check.issues] };
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** Activate a transcriber by name, lazily. Returns the active instance
|
|
58
|
-
* ready to `.transcribe(...)`. Throws if no such transcriber is
|
|
59
|
-
* registered, or a *different* one is already active. */
|
|
60
|
-
export function resolveTranscriber(
|
|
61
|
-
session: ClientSession,
|
|
62
|
-
transcriberName: string,
|
|
63
|
-
): Transcriber {
|
|
64
|
-
const activeName = session.transcribers.getActiveName();
|
|
65
|
-
if (activeName && activeName !== transcriberName) {
|
|
66
|
-
throw new Error(
|
|
67
|
-
`Another transcriber is already active: ${activeName}.`,
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
if (activeName === transcriberName) return session.transcribers.getActive();
|
|
71
|
-
if (session.transcribers.has(transcriberName)) {
|
|
72
|
-
return session.transcribers.setActive(transcriberName);
|
|
73
|
-
}
|
|
74
|
-
throw new Error(
|
|
75
|
-
`No transcriber registered as ${transcriberName}. Configure one via your moxxy plugins.`,
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/** "Just pick a transcriber that works."
|
|
80
|
-
*
|
|
81
|
-
* Tries each name in `candidates` in order — first one that can be
|
|
82
|
-
* activated wins. Returns null if none can be activated, so callers
|
|
83
|
-
* can degrade gracefully (hide their mic button, show a "no voice
|
|
84
|
-
* configured" tip, …) instead of throwing. */
|
|
85
|
-
export function pickFirstAvailableTranscriber(
|
|
86
|
-
session: ClientSession,
|
|
87
|
-
candidates: ReadonlyArray<string>,
|
|
88
|
-
): Transcriber | null {
|
|
89
|
-
// If something's already active, just hand that back — never fight
|
|
90
|
-
// a user-chosen activation.
|
|
91
|
-
const existing = session.transcribers.tryGetActive();
|
|
92
|
-
if (existing) return existing;
|
|
93
|
-
for (const name of candidates) {
|
|
94
|
-
try {
|
|
95
|
-
return resolveTranscriber(session, name);
|
|
96
|
-
} catch {
|
|
97
|
-
// Wrong-active errors don't apply here (we just returned early),
|
|
98
|
-
// so any throw is "this candidate isn't registered" — keep
|
|
99
|
-
// trying.
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return null;
|
|
103
|
-
}
|