@agentick/angular 0.0.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/LICENSE +21 -0
- package/README.md +61 -0
- package/dist/agentick.service.d.ts +210 -0
- package/dist/agentick.service.d.ts.map +1 -0
- package/dist/agentick.service.js +354 -0
- package/dist/agentick.service.js.map +1 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +132 -0
- package/dist/index.js.map +1 -0
- package/dist/tentickle.service.d.ts +210 -0
- package/dist/tentickle.service.d.ts.map +1 -0
- package/dist/tentickle.service.js +354 -0
- package/dist/tentickle.service.js.map +1 -0
- package/dist/types.d.ts +74 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +41 -0
- package/src/agentick.service.spec.ts +133 -0
- package/src/agentick.service.ts +424 -0
- package/src/index.ts +146 -0
- package/src/types.ts +99 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agentick/angular - Modern Angular bindings for Agentick
|
|
3
|
+
*
|
|
4
|
+
* Uses Angular signals for reactive state with RxJS interop for compatibility.
|
|
5
|
+
*
|
|
6
|
+
* @example Standalone setup
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { TENTICKLE_CONFIG } from '@agentick/angular';
|
|
9
|
+
*
|
|
10
|
+
* bootstrapApplication(AppComponent, {
|
|
11
|
+
* providers: [
|
|
12
|
+
* { provide: TENTICKLE_CONFIG, useValue: { baseUrl: 'https://api.example.com' } },
|
|
13
|
+
* ],
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example Component with signals (recommended)
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { Component, inject } from '@angular/core';
|
|
20
|
+
* import { AgentickService } from '@agentick/angular';
|
|
21
|
+
*
|
|
22
|
+
* @Component({
|
|
23
|
+
* selector: 'app-chat',
|
|
24
|
+
* standalone: true,
|
|
25
|
+
* template: `
|
|
26
|
+
* <div class="response">
|
|
27
|
+
* {{ agentick.text() }}
|
|
28
|
+
* @if (agentick.isStreaming()) {
|
|
29
|
+
* <span class="cursor">|</span>
|
|
30
|
+
* }
|
|
31
|
+
* </div>
|
|
32
|
+
* <input #input />
|
|
33
|
+
* <button (click)="send(input.value); input.value = ''">Send</button>
|
|
34
|
+
* `,
|
|
35
|
+
* })
|
|
36
|
+
* export class ChatComponent {
|
|
37
|
+
* agentick = inject(AgentickService);
|
|
38
|
+
*
|
|
39
|
+
* constructor() {
|
|
40
|
+
* this.agentick.subscribe("conv-123");
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* async send(message: string) {
|
|
44
|
+
* const handle = this.agentick.send(message);
|
|
45
|
+
* await handle.result;
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example With RxJS (for legacy or complex reactive flows)
|
|
51
|
+
* ```typescript
|
|
52
|
+
* @Component({
|
|
53
|
+
* template: `
|
|
54
|
+
* <div>{{ text$ | async }}</div>
|
|
55
|
+
* `,
|
|
56
|
+
* })
|
|
57
|
+
* export class LegacyComponent {
|
|
58
|
+
* agentick = inject(AgentickService);
|
|
59
|
+
* text$ = this.agentick.text$;
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example Multiple agents with separate instances
|
|
64
|
+
* ```typescript
|
|
65
|
+
* import { provideAgentick, AgentickService } from '@agentick/angular';
|
|
66
|
+
*
|
|
67
|
+
* // Each component gets its own service instance
|
|
68
|
+
* @Component({
|
|
69
|
+
* selector: 'app-support-chat',
|
|
70
|
+
* standalone: true,
|
|
71
|
+
* providers: [provideAgentick({ baseUrl: '/api/support-agent' })],
|
|
72
|
+
* template: `<div>{{ agentick.text() }}</div>`,
|
|
73
|
+
* })
|
|
74
|
+
* export class SupportChatComponent {
|
|
75
|
+
* agentick = inject(AgentickService);
|
|
76
|
+
* }
|
|
77
|
+
*
|
|
78
|
+
* @Component({
|
|
79
|
+
* selector: 'app-sales-chat',
|
|
80
|
+
* standalone: true,
|
|
81
|
+
* providers: [provideAgentick({ baseUrl: '/api/sales-agent' })],
|
|
82
|
+
* template: `<div>{{ agentick.text() }}</div>`,
|
|
83
|
+
* })
|
|
84
|
+
* export class SalesChatComponent {
|
|
85
|
+
* agentick = inject(AgentickService);
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* ## Signals (Primary API)
|
|
90
|
+
*
|
|
91
|
+
* | Signal | Type | Description |
|
|
92
|
+
* |--------|------|-------------|
|
|
93
|
+
* | `connectionState()` | `ConnectionState` | Connection state |
|
|
94
|
+
* | `sessionId()` | `string \| undefined` | Active session ID |
|
|
95
|
+
* | `streamingText()` | `StreamingTextState` | Text + isStreaming |
|
|
96
|
+
* | `text()` | `string` | Just the text (computed) |
|
|
97
|
+
* | `isStreaming()` | `boolean` | Whether streaming (computed) |
|
|
98
|
+
*
|
|
99
|
+
* ## RxJS Observables (Compatibility)
|
|
100
|
+
*
|
|
101
|
+
* | Observable | Type | Description |
|
|
102
|
+
* |------------|------|-------------|
|
|
103
|
+
* | `connectionState$` | `ConnectionState` | Connection state |
|
|
104
|
+
* | `isConnected$` | `boolean` | Whether connected |
|
|
105
|
+
* | `streamingText$` | `StreamingTextState` | Text + isStreaming |
|
|
106
|
+
* | `text$` | `string` | Just the text |
|
|
107
|
+
* | `isStreaming$` | `boolean` | Whether streaming |
|
|
108
|
+
* | `events$` | `StreamEvent | SessionStreamEvent` | All stream events |
|
|
109
|
+
* | `result$` | `Result` | Execution results |
|
|
110
|
+
*
|
|
111
|
+
* ## Methods
|
|
112
|
+
*
|
|
113
|
+
* | Method | Description |
|
|
114
|
+
* |--------|-------------|
|
|
115
|
+
* | `session(sessionId)` | Get cold accessor |
|
|
116
|
+
* | `subscribe(sessionId)` | Subscribe (hot) |
|
|
117
|
+
* | `unsubscribe()` | Unsubscribe active session |
|
|
118
|
+
* | `send(input)` | Send message |
|
|
119
|
+
* | `abort(reason?)` | Abort execution |
|
|
120
|
+
* | `close()` | Close active session |
|
|
121
|
+
* | `channel(name)` | Get channel accessor |
|
|
122
|
+
* | `channel$(name)` | Get channel as Observable |
|
|
123
|
+
* | `eventsOfType(...types)` | Filter events by type |
|
|
124
|
+
* | `clearStreamingText()` | Clear accumulated text |
|
|
125
|
+
*
|
|
126
|
+
* @module @agentick/angular
|
|
127
|
+
*/
|
|
128
|
+
export { AgentickService, TENTICKLE_CONFIG, provideAgentick } from "./agentick.service";
|
|
129
|
+
export type { AgentickConfig, TransportConfig, AgentickClient, ConnectionState, StreamEvent, SessionStreamEvent, ClientExecutionHandle, StreamingTextState, ClientTransport, } from "./types";
|
|
130
|
+
export { createClient } from "@agentick/client";
|
|
131
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8HG;AAGH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGxF,YAAY,EACV,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAChB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agentick/angular - Modern Angular bindings for Agentick
|
|
3
|
+
*
|
|
4
|
+
* Uses Angular signals for reactive state with RxJS interop for compatibility.
|
|
5
|
+
*
|
|
6
|
+
* @example Standalone setup
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { TENTICKLE_CONFIG } from '@agentick/angular';
|
|
9
|
+
*
|
|
10
|
+
* bootstrapApplication(AppComponent, {
|
|
11
|
+
* providers: [
|
|
12
|
+
* { provide: TENTICKLE_CONFIG, useValue: { baseUrl: 'https://api.example.com' } },
|
|
13
|
+
* ],
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example Component with signals (recommended)
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { Component, inject } from '@angular/core';
|
|
20
|
+
* import { AgentickService } from '@agentick/angular';
|
|
21
|
+
*
|
|
22
|
+
* @Component({
|
|
23
|
+
* selector: 'app-chat',
|
|
24
|
+
* standalone: true,
|
|
25
|
+
* template: `
|
|
26
|
+
* <div class="response">
|
|
27
|
+
* {{ agentick.text() }}
|
|
28
|
+
* @if (agentick.isStreaming()) {
|
|
29
|
+
* <span class="cursor">|</span>
|
|
30
|
+
* }
|
|
31
|
+
* </div>
|
|
32
|
+
* <input #input />
|
|
33
|
+
* <button (click)="send(input.value); input.value = ''">Send</button>
|
|
34
|
+
* `,
|
|
35
|
+
* })
|
|
36
|
+
* export class ChatComponent {
|
|
37
|
+
* agentick = inject(AgentickService);
|
|
38
|
+
*
|
|
39
|
+
* constructor() {
|
|
40
|
+
* this.agentick.subscribe("conv-123");
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* async send(message: string) {
|
|
44
|
+
* const handle = this.agentick.send(message);
|
|
45
|
+
* await handle.result;
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example With RxJS (for legacy or complex reactive flows)
|
|
51
|
+
* ```typescript
|
|
52
|
+
* @Component({
|
|
53
|
+
* template: `
|
|
54
|
+
* <div>{{ text$ | async }}</div>
|
|
55
|
+
* `,
|
|
56
|
+
* })
|
|
57
|
+
* export class LegacyComponent {
|
|
58
|
+
* agentick = inject(AgentickService);
|
|
59
|
+
* text$ = this.agentick.text$;
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example Multiple agents with separate instances
|
|
64
|
+
* ```typescript
|
|
65
|
+
* import { provideAgentick, AgentickService } from '@agentick/angular';
|
|
66
|
+
*
|
|
67
|
+
* // Each component gets its own service instance
|
|
68
|
+
* @Component({
|
|
69
|
+
* selector: 'app-support-chat',
|
|
70
|
+
* standalone: true,
|
|
71
|
+
* providers: [provideAgentick({ baseUrl: '/api/support-agent' })],
|
|
72
|
+
* template: `<div>{{ agentick.text() }}</div>`,
|
|
73
|
+
* })
|
|
74
|
+
* export class SupportChatComponent {
|
|
75
|
+
* agentick = inject(AgentickService);
|
|
76
|
+
* }
|
|
77
|
+
*
|
|
78
|
+
* @Component({
|
|
79
|
+
* selector: 'app-sales-chat',
|
|
80
|
+
* standalone: true,
|
|
81
|
+
* providers: [provideAgentick({ baseUrl: '/api/sales-agent' })],
|
|
82
|
+
* template: `<div>{{ agentick.text() }}</div>`,
|
|
83
|
+
* })
|
|
84
|
+
* export class SalesChatComponent {
|
|
85
|
+
* agentick = inject(AgentickService);
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* ## Signals (Primary API)
|
|
90
|
+
*
|
|
91
|
+
* | Signal | Type | Description |
|
|
92
|
+
* |--------|------|-------------|
|
|
93
|
+
* | `connectionState()` | `ConnectionState` | Connection state |
|
|
94
|
+
* | `sessionId()` | `string \| undefined` | Active session ID |
|
|
95
|
+
* | `streamingText()` | `StreamingTextState` | Text + isStreaming |
|
|
96
|
+
* | `text()` | `string` | Just the text (computed) |
|
|
97
|
+
* | `isStreaming()` | `boolean` | Whether streaming (computed) |
|
|
98
|
+
*
|
|
99
|
+
* ## RxJS Observables (Compatibility)
|
|
100
|
+
*
|
|
101
|
+
* | Observable | Type | Description |
|
|
102
|
+
* |------------|------|-------------|
|
|
103
|
+
* | `connectionState$` | `ConnectionState` | Connection state |
|
|
104
|
+
* | `isConnected$` | `boolean` | Whether connected |
|
|
105
|
+
* | `streamingText$` | `StreamingTextState` | Text + isStreaming |
|
|
106
|
+
* | `text$` | `string` | Just the text |
|
|
107
|
+
* | `isStreaming$` | `boolean` | Whether streaming |
|
|
108
|
+
* | `events$` | `StreamEvent | SessionStreamEvent` | All stream events |
|
|
109
|
+
* | `result$` | `Result` | Execution results |
|
|
110
|
+
*
|
|
111
|
+
* ## Methods
|
|
112
|
+
*
|
|
113
|
+
* | Method | Description |
|
|
114
|
+
* |--------|-------------|
|
|
115
|
+
* | `session(sessionId)` | Get cold accessor |
|
|
116
|
+
* | `subscribe(sessionId)` | Subscribe (hot) |
|
|
117
|
+
* | `unsubscribe()` | Unsubscribe active session |
|
|
118
|
+
* | `send(input)` | Send message |
|
|
119
|
+
* | `abort(reason?)` | Abort execution |
|
|
120
|
+
* | `close()` | Close active session |
|
|
121
|
+
* | `channel(name)` | Get channel accessor |
|
|
122
|
+
* | `channel$(name)` | Get channel as Observable |
|
|
123
|
+
* | `eventsOfType(...types)` | Filter events by type |
|
|
124
|
+
* | `clearStreamingText()` | Clear accumulated text |
|
|
125
|
+
*
|
|
126
|
+
* @module @agentick/angular
|
|
127
|
+
*/
|
|
128
|
+
// Service, token, and provider factory
|
|
129
|
+
export { AgentickService, TENTICKLE_CONFIG, provideAgentick } from "./agentick.service";
|
|
130
|
+
// Re-export createClient for advanced usage
|
|
131
|
+
export { createClient } from "@agentick/client";
|
|
132
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8HG;AAEH,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAexF,4CAA4C;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TentickleService - Modern Angular service for Tentickle.
|
|
3
|
+
*
|
|
4
|
+
* Uses Angular signals for reactive state management with RxJS interop.
|
|
5
|
+
*
|
|
6
|
+
* @module @tentickle/angular/service
|
|
7
|
+
*/
|
|
8
|
+
import { InjectionToken, type OnDestroy } from "@angular/core";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
import { type TentickleClient, type ConnectionState, type StreamEvent, type StreamingTextState, type SessionStreamEvent, type SessionAccessor, type ClientExecutionHandle } from "@tentickle/client";
|
|
11
|
+
import type { TentickleConfig } from "./types";
|
|
12
|
+
/**
|
|
13
|
+
* Injection token for Tentickle configuration.
|
|
14
|
+
*/
|
|
15
|
+
export declare const TENTICKLE_CONFIG: InjectionToken<TentickleConfig>;
|
|
16
|
+
/**
|
|
17
|
+
* Provides TentickleService with configuration at component level.
|
|
18
|
+
*
|
|
19
|
+
* Use this to create isolated service instances for different components,
|
|
20
|
+
* each with their own connection and state.
|
|
21
|
+
*
|
|
22
|
+
* @example Multiple agents in one app
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Each component gets its own TentickleService instance
|
|
25
|
+
*
|
|
26
|
+
* @Component({
|
|
27
|
+
* selector: 'app-support-chat',
|
|
28
|
+
* providers: [provideTentickle({ baseUrl: '/api/support-agent' })],
|
|
29
|
+
* template: `<div>{{ tentickle.text() }}</div>`,
|
|
30
|
+
* })
|
|
31
|
+
* export class SupportChatComponent {
|
|
32
|
+
* tentickle = inject(TentickleService);
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* @Component({
|
|
36
|
+
* selector: 'app-sales-chat',
|
|
37
|
+
* providers: [provideTentickle({ baseUrl: '/api/sales-agent' })],
|
|
38
|
+
* template: `<div>{{ tentickle.text() }}</div>`,
|
|
39
|
+
* })
|
|
40
|
+
* export class SalesChatComponent {
|
|
41
|
+
* tentickle = inject(TentickleService);
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @param config - Configuration for this service instance
|
|
46
|
+
* @returns Provider array to spread into component's providers
|
|
47
|
+
*/
|
|
48
|
+
export declare function provideTentickle(config: TentickleConfig): (typeof TentickleService | {
|
|
49
|
+
provide: InjectionToken<TentickleConfig>;
|
|
50
|
+
useValue: TentickleConfig;
|
|
51
|
+
})[];
|
|
52
|
+
/**
|
|
53
|
+
* Modern Angular service for Tentickle.
|
|
54
|
+
*
|
|
55
|
+
* Uses signals for state, with RxJS observables available for compatibility.
|
|
56
|
+
*
|
|
57
|
+
* @example Standalone setup
|
|
58
|
+
* ```typescript
|
|
59
|
+
* import { TentickleService, TENTICKLE_CONFIG } from '@tentickle/angular';
|
|
60
|
+
*
|
|
61
|
+
* bootstrapApplication(AppComponent, {
|
|
62
|
+
* providers: [
|
|
63
|
+
* { provide: TENTICKLE_CONFIG, useValue: { baseUrl: 'https://api.example.com' } },
|
|
64
|
+
* ],
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example Component with signals
|
|
69
|
+
* ```typescript
|
|
70
|
+
* @Component({
|
|
71
|
+
* template: `
|
|
72
|
+
* @if (tentickle.isConnected()) {
|
|
73
|
+
* <div class="response">
|
|
74
|
+
* {{ tentickle.text() }}
|
|
75
|
+
* @if (tentickle.isStreaming()) {
|
|
76
|
+
* <span class="cursor">|</span>
|
|
77
|
+
* }
|
|
78
|
+
* </div>
|
|
79
|
+
* <input #input />
|
|
80
|
+
* <button (click)="send(input.value)">Send</button>
|
|
81
|
+
* } @else {
|
|
82
|
+
* <p>Connecting...</p>
|
|
83
|
+
* }
|
|
84
|
+
* `,
|
|
85
|
+
* })
|
|
86
|
+
* export class ChatComponent {
|
|
87
|
+
* tentickle = inject(TentickleService);
|
|
88
|
+
*
|
|
89
|
+
* constructor() {
|
|
90
|
+
* this.tentickle.subscribe("conv-123");
|
|
91
|
+
* }
|
|
92
|
+
*
|
|
93
|
+
* async send(message: string) {
|
|
94
|
+
* const handle = this.tentickle.send(message);
|
|
95
|
+
* await handle.result;
|
|
96
|
+
* }
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @example With RxJS (for compatibility)
|
|
101
|
+
* ```typescript
|
|
102
|
+
* @Component({
|
|
103
|
+
* template: `{{ text$ | async }}`,
|
|
104
|
+
* })
|
|
105
|
+
* export class LegacyComponent {
|
|
106
|
+
* tentickle = inject(TentickleService);
|
|
107
|
+
* text$ = this.tentickle.text$;
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare class TentickleService implements OnDestroy {
|
|
112
|
+
private readonly client;
|
|
113
|
+
private readonly destroy$;
|
|
114
|
+
private currentSession?;
|
|
115
|
+
/** Current connection state */
|
|
116
|
+
readonly connectionState: import("@angular/core").WritableSignal<ConnectionState>;
|
|
117
|
+
/** Current session ID */
|
|
118
|
+
readonly sessionId: import("@angular/core").WritableSignal<string | undefined>;
|
|
119
|
+
/** Connection error, if any */
|
|
120
|
+
readonly error: import("@angular/core").WritableSignal<Error | undefined>;
|
|
121
|
+
/** Streaming text state from the client */
|
|
122
|
+
readonly streamingText: import("@angular/core").WritableSignal<StreamingTextState>;
|
|
123
|
+
/** Whether currently connected */
|
|
124
|
+
readonly isConnected: import("@angular/core").Signal<boolean>;
|
|
125
|
+
/** Whether currently connecting */
|
|
126
|
+
readonly isConnecting: import("@angular/core").Signal<boolean>;
|
|
127
|
+
/** Current streaming text */
|
|
128
|
+
readonly text: import("@angular/core").Signal<string>;
|
|
129
|
+
/** Whether currently streaming */
|
|
130
|
+
readonly isStreaming: import("@angular/core").Signal<boolean>;
|
|
131
|
+
/** Observable of connection state (for RxJS users) */
|
|
132
|
+
readonly connectionState$: Observable<ConnectionState>;
|
|
133
|
+
/** Observable of whether connected (for RxJS users) */
|
|
134
|
+
readonly isConnected$: Observable<boolean>;
|
|
135
|
+
/** Observable of streaming text state (for RxJS users) */
|
|
136
|
+
readonly streamingText$: Observable<StreamingTextState>;
|
|
137
|
+
/** Observable of just the text (for RxJS users) */
|
|
138
|
+
readonly text$: Observable<string>;
|
|
139
|
+
/** Observable of whether streaming (for RxJS users) */
|
|
140
|
+
readonly isStreaming$: Observable<boolean>;
|
|
141
|
+
/** Subject for raw stream events */
|
|
142
|
+
private readonly eventsSubject;
|
|
143
|
+
/** Observable of all stream events */
|
|
144
|
+
readonly events$: Observable<StreamEvent | SessionStreamEvent>;
|
|
145
|
+
/** Subject for execution results */
|
|
146
|
+
private readonly resultSubject;
|
|
147
|
+
/** Observable of execution results */
|
|
148
|
+
readonly result$: Observable<{
|
|
149
|
+
response: string;
|
|
150
|
+
outputs: Record<string, unknown>;
|
|
151
|
+
usage: {
|
|
152
|
+
inputTokens: number;
|
|
153
|
+
outputTokens: number;
|
|
154
|
+
totalTokens: number;
|
|
155
|
+
};
|
|
156
|
+
stopReason?: string;
|
|
157
|
+
}>;
|
|
158
|
+
/**
|
|
159
|
+
* Creates a new TentickleService.
|
|
160
|
+
*
|
|
161
|
+
* @param configOrInjected - Config passed directly (for testing) or undefined to use DI
|
|
162
|
+
*/
|
|
163
|
+
constructor(configOrInjected?: TentickleConfig);
|
|
164
|
+
private setupSubscriptions;
|
|
165
|
+
/**
|
|
166
|
+
* Get a cold session accessor.
|
|
167
|
+
*/
|
|
168
|
+
session(sessionId: string): SessionAccessor;
|
|
169
|
+
/**
|
|
170
|
+
* Subscribe to a session and make it the active session.
|
|
171
|
+
*/
|
|
172
|
+
subscribe(sessionId: string): SessionAccessor;
|
|
173
|
+
/**
|
|
174
|
+
* Unsubscribe from the active session.
|
|
175
|
+
*/
|
|
176
|
+
unsubscribe(): void;
|
|
177
|
+
/**
|
|
178
|
+
* Send a message to the session.
|
|
179
|
+
*/
|
|
180
|
+
send(input: Parameters<TentickleClient["send"]>[0]): ClientExecutionHandle;
|
|
181
|
+
/**
|
|
182
|
+
* Abort the current execution.
|
|
183
|
+
*/
|
|
184
|
+
abort(reason?: string): Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Close the active session on the server.
|
|
187
|
+
*/
|
|
188
|
+
close(): Promise<void>;
|
|
189
|
+
/**
|
|
190
|
+
* Clear the accumulated streaming text.
|
|
191
|
+
*/
|
|
192
|
+
clearStreamingText(): void;
|
|
193
|
+
/**
|
|
194
|
+
* Get a channel accessor for custom pub/sub.
|
|
195
|
+
*/
|
|
196
|
+
channel(name: string): import("@tentickle/client").ChannelAccessor;
|
|
197
|
+
/**
|
|
198
|
+
* Create an Observable from a channel.
|
|
199
|
+
*/
|
|
200
|
+
channel$(name: string): Observable<{
|
|
201
|
+
type: string;
|
|
202
|
+
payload: unknown;
|
|
203
|
+
}>;
|
|
204
|
+
/**
|
|
205
|
+
* Filter events by type.
|
|
206
|
+
*/
|
|
207
|
+
eventsOfType(...types: StreamEvent["type"][]): Observable<StreamEvent>;
|
|
208
|
+
ngOnDestroy(): void;
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=tentickle.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tentickle.service.d.ts","sourceRoot":"","sources":["../src/tentickle.service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,cAAc,EACd,KAAK,SAAS,EAIf,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,UAAU,EAA8B,MAAM,MAAM,CAAC;AAC9D,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,K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