@framers/agentos-ext-voice-telnyx 0.1.5 → 0.2.1
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 +11 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -25
- package/dist/index.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This pack gives an agent a phone call tool and voice provider using the `telnyx`
|
|
|
8
8
|
npm install @framers/agentos-ext-voice-telnyx
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Peer dependency: `@framers/agentos
|
|
11
|
+
Peer dependency: `@framers/agentos`, at the minimum version declared by this package.
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
@@ -45,6 +45,7 @@ Credentials resolve from direct options, then `options.secrets`, then the listed
|
|
|
45
45
|
| `webhookBaseUrl` | None | None | No | `undefined` |
|
|
46
46
|
| `priority` | None | None | No | `50` |
|
|
47
47
|
| `secrets` | Map containing the secret ids above | None | No | `undefined` |
|
|
48
|
+
| `callManager` | None | None | No | Exposed pack-owned manager |
|
|
48
49
|
|
|
49
50
|
## Tools
|
|
50
51
|
|
|
@@ -64,7 +65,7 @@ Credentials resolve from direct options, then `options.secrets`, then the listed
|
|
|
64
65
|
|
|
65
66
|
## Notes
|
|
66
67
|
|
|
67
|
-
The package requires Node.js `>=22`. Activation dynamically loads the SDK and initializes the service. Deactivation disposes the
|
|
68
|
+
The package requires Node.js `>=22`. Activation dynamically loads the SDK and initializes the service. Deactivation disposes only the original pack-owned manager and releases the SDK client reference.
|
|
68
69
|
|
|
69
70
|
The tool has side effects: `call` places a phone call, `speak` sends a TTS command and `hangup` ends a call. Runtime checks require `toNumber` for `call`, `callId` and `message` for `speak`, and `callId` for `hangup` or `status`. The schema requires only `action`.
|
|
70
71
|
|
|
@@ -74,6 +75,14 @@ The provider parses call initiation, answer, hangup, machine detection and strea
|
|
|
74
75
|
|
|
75
76
|
The pack registers `voice-provider` named `telnyx` and delegates call management to `CallManager`. Its files do not start an HTTP webhook listener or implement a media socket server.
|
|
76
77
|
|
|
78
|
+
## Host call manager binding
|
|
79
|
+
|
|
80
|
+
The returned pack exposes the manager used by its call tool through `binding.manager`. Supply `options.callManager` to use a host-owned manager; otherwise the exposed default belongs to the pack. `binding.setManager(next)` registers the same provider on the replacement and changes subsequent tool operations. The host drains or transfers active calls before rebinding; no call state is migrated by the binding.
|
|
81
|
+
|
|
82
|
+
The voice-provider descriptor preserves the raw Telnyx provider and adds a read-only `binding` property. Registry consumers and the returned pack therefore reach the same manager and tool handler. Deactivation disposes only the originally pack-owned manager, including when it has been replaced. Host-owned managers are never disposed by this extension. Construction places no carrier call.
|
|
83
|
+
|
|
84
|
+
This repair does not change the legacy carrier protocol, signature policy or callback behavior. Use the core carrier profile explicitly for its durable guarantees. The declared core peer floor is required for this binding API.
|
|
85
|
+
|
|
77
86
|
## License
|
|
78
87
|
|
|
79
88
|
Apache-2.0
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module @framers/agentos-ext-voice-telnyx
|
|
8
8
|
*/
|
|
9
|
-
import type
|
|
9
|
+
import { CallManager, type ExtensionContext, type ExtensionPack } from '@framers/agentos';
|
|
10
|
+
import { type VoiceProviderBinding } from '@framers/agentos/io/channels/telephony/CallManager';
|
|
11
|
+
import { TelnyxVoiceProvider } from './TelnyxVoiceProvider';
|
|
10
12
|
export interface TelnyxVoiceOptions {
|
|
11
13
|
/** Telnyx API v2 key (overrides secrets/env). */
|
|
12
14
|
apiKey?: string;
|
|
@@ -20,8 +22,20 @@ export interface TelnyxVoiceOptions {
|
|
|
20
22
|
webhookBaseUrl?: string;
|
|
21
23
|
/** Priority for extension descriptor ordering. */
|
|
22
24
|
priority?: number;
|
|
25
|
+
/** Host-owned manager. The default manager belongs to this pack and is exposed through binding. */
|
|
26
|
+
callManager?: CallManager;
|
|
23
27
|
}
|
|
24
|
-
|
|
28
|
+
/** A raw Telnyx provider carrying the call tool's shared manager binding. */
|
|
29
|
+
export type BoundTelnyxVoiceProvider = TelnyxVoiceProvider & {
|
|
30
|
+
readonly binding: VoiceProviderBinding;
|
|
31
|
+
};
|
|
32
|
+
/** Telnyx pack with explicit host access to the call tool's manager. */
|
|
33
|
+
export interface TelnyxVoicePack extends ExtensionPack {
|
|
34
|
+
/** Rebinding affects every subsequent tool operation. */
|
|
35
|
+
readonly binding: VoiceProviderBinding;
|
|
36
|
+
}
|
|
37
|
+
/** Construct the provider and manager binding without initiating a carrier call. */
|
|
38
|
+
export declare function createExtensionPack(context: ExtensionContext): TelnyxVoicePack;
|
|
25
39
|
export { TelnyxVoiceService, type TelnyxServiceConfig } from './TelnyxVoiceService';
|
|
26
40
|
export { TelnyxVoiceProvider } from './TelnyxVoiceProvider';
|
|
27
41
|
export { TelnyxVoiceCallTool, type VoiceCallToolHandler } from './tools/voiceCall';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAqB,KAAK,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAElH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAO5D,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mGAAmG;IACnG,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,6EAA6E;AAC7E,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAA;CAAE,CAAC;AACxG,wEAAwE;AACxE,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC;CACxC;AAuDD,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAgD9E;AAID,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACnF,eAAe,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.TelnyxVoiceCallTool = exports.TelnyxVoiceProvider = exports.TelnyxVoiceService = void 0;
|
|
13
13
|
exports.createExtensionPack = createExtensionPack;
|
|
14
14
|
const agentos_1 = require("@framers/agentos");
|
|
15
|
+
const CallManager_1 = require("@framers/agentos/io/channels/telephony/CallManager");
|
|
15
16
|
const TelnyxVoiceService_1 = require("./TelnyxVoiceService");
|
|
16
17
|
const TelnyxVoiceProvider_1 = require("./TelnyxVoiceProvider");
|
|
17
18
|
const voiceCall_1 = require("./tools/voiceCall");
|
|
@@ -53,6 +54,7 @@ function resolveFromNumber(options) {
|
|
|
53
54
|
// ============================================================================
|
|
54
55
|
// Factory
|
|
55
56
|
// ============================================================================
|
|
57
|
+
/** Construct the provider and manager binding without initiating a carrier call. */
|
|
56
58
|
function createExtensionPack(context) {
|
|
57
59
|
const options = (context.options ?? {});
|
|
58
60
|
const apiKey = resolveApiKey(options, options.secrets);
|
|
@@ -68,34 +70,16 @@ function createExtensionPack(context) {
|
|
|
68
70
|
// Create service and provider
|
|
69
71
|
const service = new TelnyxVoiceService_1.TelnyxVoiceService(config);
|
|
70
72
|
const provider = new TelnyxVoiceProvider_1.TelnyxVoiceProvider(service, config);
|
|
71
|
-
|
|
72
|
-
const callManager = new agentos_1.CallManager({
|
|
73
|
+
const ownedManager = options.callManager ? undefined : new agentos_1.CallManager({
|
|
73
74
|
provider: { provider: 'telnyx', config: { apiKey, connectionId, fromNumber: fromNumber ?? '' } },
|
|
74
|
-
webhookBaseUrl: options.webhookBaseUrl,
|
|
75
|
-
defaultMode: 'conversation',
|
|
75
|
+
webhookBaseUrl: options.webhookBaseUrl, defaultMode: 'conversation',
|
|
76
76
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
async initiateCall(toNumber, message, mode) {
|
|
81
|
-
return callManager.initiateCall({ toNumber, message, mode });
|
|
82
|
-
},
|
|
83
|
-
speakText(callId, text) {
|
|
84
|
-
callManager.speakText(callId, text);
|
|
85
|
-
},
|
|
86
|
-
async hangupCall(callId) {
|
|
87
|
-
await callManager.hangupCall(callId);
|
|
88
|
-
},
|
|
89
|
-
getCallStatus(callId) {
|
|
90
|
-
return callManager.getCall(callId);
|
|
91
|
-
},
|
|
92
|
-
getActiveCalls() {
|
|
93
|
-
return callManager.getActiveCalls();
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
const voiceCallTool = new voiceCall_1.TelnyxVoiceCallTool(toolHandler);
|
|
77
|
+
const binding = (0, CallManager_1.bindVoiceProvider)(provider, options.callManager ?? ownedManager);
|
|
78
|
+
Object.defineProperty(provider, 'binding', { value: binding, enumerable: false, writable: false });
|
|
79
|
+
const voiceCallTool = new voiceCall_1.TelnyxVoiceCallTool(binding.toolHandler);
|
|
97
80
|
const priority = options.priority ?? 50;
|
|
98
81
|
return {
|
|
82
|
+
binding,
|
|
99
83
|
name: '@framers/agentos-ext-voice-telnyx',
|
|
100
84
|
version: '0.1.0',
|
|
101
85
|
descriptors: [
|
|
@@ -107,7 +91,7 @@ function createExtensionPack(context) {
|
|
|
107
91
|
context.logger?.info('[TelnyxVoice] Extension activated');
|
|
108
92
|
},
|
|
109
93
|
onDeactivate: async () => {
|
|
110
|
-
|
|
94
|
+
ownedManager?.dispose();
|
|
111
95
|
await service.shutdown();
|
|
112
96
|
context.logger?.info('[TelnyxVoice] Extension deactivated');
|
|
113
97
|
},
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;;;GAOG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;;;GAOG;;;AA2FH,kDAgDC;AAzID,8CAA0F;AAC1F,oFAAkH;AAClH,6DAAoF;AACpF,+DAA4D;AAC5D,iDAAwD;AA+BxD,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E,SAAS,aAAa,CACpB,OAA2B,EAC3B,OAAgC;IAEhC,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC;IAC1C,IAAI,OAAO,EAAE,CAAC,eAAe,CAAC;QAAE,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC;IAEhE,KAAK,MAAM,OAAO,IAAI,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,EAAE,CAAC;QAC9D,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;YAAE,OAAO,OAAO,CAAC,GAAG,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;YACX,EAAE,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE;YACzE,EAAE,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE;SACnF;QACD,UAAU,EAAE,KAAK,IAAI,EAAE;YACrB,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;YAC3B,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,mCAAmC,CAAC,CAAC;QAC5D,CAAC;QACD,YAAY,EAAE,KAAK,IAAI,EAAE;YACvB,YAAY,EAAE,OAAO,EAAE,CAAC;YACxB,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;YACzB,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,qCAAqC,CAAC,CAAC;QAC9D,CAAC;KACF,CAAC;AACJ,CAAC;AAED,mBAAmB;AAEnB,2DAAoF;AAA3E,wHAAA,kBAAkB,OAAA;AAC3B,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,+CAAmF;AAA1E,gHAAA,mBAAmB,OAAA;AAC5B,kBAAe,mBAAmB,CAAC"}
|
package/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
|
|
3
3
|
"id": "com.framers.voice.telnyx",
|
|
4
4
|
"name": "Telnyx Voice Call Extension",
|
|
5
|
-
"version": "0.1
|
|
5
|
+
"version": "0.2.1",
|
|
6
6
|
"description": "Telnyx telephony provider for voice calls via Call Control v2 — outbound/inbound calls, TTS speak commands, and bidirectional media streaming.",
|
|
7
7
|
"categories": ["voice", "telephony"],
|
|
8
8
|
"platforms": ["telnyx"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@framers/agentos-ext-voice-telnyx",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Telnyx voice call provider for AgentOS — outbound/inbound calls via Telnyx Call Control v2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
"manifest.json"
|
|
22
22
|
],
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@framers/agentos": ">=0.
|
|
24
|
+
"@framers/agentos": ">=0.13.104"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"telnyx": "^2.0.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^20.0.0",
|
|
31
|
-
"typescript": "^
|
|
31
|
+
"typescript": "^6.0.3",
|
|
32
32
|
"vitest": "^3.2.7",
|
|
33
|
-
"@framers/agentos": "^0.
|
|
33
|
+
"@framers/agentos": "^0.15.67"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=22"
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"bugs": {
|
|
45
45
|
"url": "https://github.com/framerslab/agentos-extensions/issues"
|
|
46
46
|
},
|
|
47
|
+
"gitHead": "6397d0f3417f6a74ad2fdcd666fd0634e832fb40",
|
|
47
48
|
"scripts": {
|
|
48
49
|
"build": "tsc",
|
|
49
50
|
"dev": "tsc --watch",
|