@agentuity/core 3.0.0-alpha.6 → 3.0.0-alpha.7
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/AGENTS.md +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/services/coder/api-reference.d.ts.map +1 -1
- package/dist/services/coder/api-reference.js +30 -1
- package/dist/services/coder/api-reference.js.map +1 -1
- package/dist/services/coder/client.d.ts +5 -1
- package/dist/services/coder/client.d.ts.map +1 -1
- package/dist/services/coder/client.js +8 -1
- package/dist/services/coder/client.js.map +1 -1
- package/dist/services/coder/index.d.ts +2 -2
- package/dist/services/coder/index.d.ts.map +1 -1
- package/dist/services/coder/index.js +1 -1
- package/dist/services/coder/index.js.map +1 -1
- package/dist/services/coder/protocol.d.ts +65 -0
- package/dist/services/coder/protocol.d.ts.map +1 -1
- package/dist/services/coder/protocol.js +8 -0
- package/dist/services/coder/protocol.js.map +1 -1
- package/dist/services/coder/sessions.d.ts +22 -0
- package/dist/services/coder/sessions.d.ts.map +1 -1
- package/dist/services/coder/sessions.js +10 -1
- package/dist/services/coder/sessions.js.map +1 -1
- package/dist/services/coder/sse.d.ts +2 -2
- package/dist/services/coder/sse.d.ts.map +1 -1
- package/dist/services/coder/sse.js +290 -178
- package/dist/services/coder/sse.js.map +1 -1
- package/dist/services/coder/types.d.ts +554 -0
- package/dist/services/coder/types.d.ts.map +1 -1
- package/dist/services/coder/types.js +138 -0
- package/dist/services/coder/types.js.map +1 -1
- package/dist/services/index.d.ts +0 -2
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +0 -2
- package/dist/services/index.js.map +1 -1
- package/dist/services/sandbox/run.d.ts.map +1 -1
- package/dist/services/sandbox/run.js +15 -2
- package/dist/services/sandbox/run.js.map +1 -1
- package/package.json +2 -16
- package/src/index.ts +0 -15
- package/src/services/coder/api-reference.ts +31 -0
- package/src/services/coder/client.ts +12 -0
- package/src/services/coder/index.ts +3 -0
- package/src/services/coder/protocol.ts +12 -0
- package/src/services/coder/sessions.ts +26 -0
- package/src/services/coder/sse.ts +343 -184
- package/src/services/coder/types.ts +179 -0
- package/src/services/index.ts +0 -2
- package/src/services/sandbox/run.ts +13 -2
- package/dist/services/auth/index.d.ts +0 -7
- package/dist/services/auth/index.d.ts.map +0 -1
- package/dist/services/auth/index.js +0 -7
- package/dist/services/auth/index.js.map +0 -1
- package/dist/services/auth/types.d.ts +0 -192
- package/dist/services/auth/types.d.ts.map +0 -1
- package/dist/services/auth/types.js +0 -11
- package/dist/services/auth/types.js.map +0 -1
- package/dist/services/eval/api-reference.d.ts +0 -4
- package/dist/services/eval/api-reference.d.ts.map +0 -1
- package/dist/services/eval/api-reference.js +0 -121
- package/dist/services/eval/api-reference.js.map +0 -1
- package/dist/services/eval/events.d.ts +0 -93
- package/dist/services/eval/events.d.ts.map +0 -1
- package/dist/services/eval/events.js +0 -24
- package/dist/services/eval/events.js.map +0 -1
- package/dist/services/eval/get.d.ts +0 -36
- package/dist/services/eval/get.d.ts.map +0 -1
- package/dist/services/eval/get.js +0 -23
- package/dist/services/eval/get.js.map +0 -1
- package/dist/services/eval/index.d.ts +0 -6
- package/dist/services/eval/index.d.ts.map +0 -1
- package/dist/services/eval/index.js +0 -6
- package/dist/services/eval/index.js.map +0 -1
- package/dist/services/eval/list.d.ts +0 -50
- package/dist/services/eval/list.d.ts.map +0 -1
- package/dist/services/eval/list.js +0 -32
- package/dist/services/eval/list.js.map +0 -1
- package/dist/services/eval/run-get.d.ts +0 -48
- package/dist/services/eval/run-get.d.ts.map +0 -1
- package/dist/services/eval/run-get.js +0 -29
- package/dist/services/eval/run-get.js.map +0 -1
- package/dist/services/eval/run-list.d.ts +0 -70
- package/dist/services/eval/run-list.d.ts.map +0 -1
- package/dist/services/eval/run-list.js +0 -42
- package/dist/services/eval/run-list.js.map +0 -1
- package/dist/webrtc.d.ts +0 -243
- package/dist/webrtc.d.ts.map +0 -1
- package/dist/webrtc.js +0 -5
- package/dist/webrtc.js.map +0 -1
- package/dist/workbench-config.d.ts +0 -62
- package/dist/workbench-config.d.ts.map +0 -1
- package/dist/workbench-config.js +0 -58
- package/dist/workbench-config.js.map +0 -1
- package/dist/workbench.d.ts +0 -2
- package/dist/workbench.d.ts.map +0 -1
- package/dist/workbench.js +0 -2
- package/dist/workbench.js.map +0 -1
- package/src/services/auth/index.ts +0 -19
- package/src/services/auth/types.ts +0 -223
- package/src/services/eval/api-reference.ts +0 -124
- package/src/services/eval/events.ts +0 -92
- package/src/services/eval/get.ts +0 -33
- package/src/services/eval/index.ts +0 -29
- package/src/services/eval/list.ts +0 -49
- package/src/services/eval/run-get.ts +0 -39
- package/src/services/eval/run-list.ts +0 -59
- package/src/webrtc.ts +0 -259
- package/src/workbench-config.ts +0 -79
- package/src/workbench.ts +0 -1
package/dist/webrtc.d.ts
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebRTC signaling types shared between server and client.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* SDP (Session Description Protocol) description for WebRTC negotiation.
|
|
6
|
-
*/
|
|
7
|
-
export interface SDPDescription {
|
|
8
|
-
type: 'offer' | 'answer' | 'pranswer' | 'rollback';
|
|
9
|
-
sdp?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* ICE (Interactive Connectivity Establishment) candidate for NAT traversal.
|
|
13
|
-
*/
|
|
14
|
-
export interface ICECandidate {
|
|
15
|
-
candidate?: string;
|
|
16
|
-
sdpMid?: string | null;
|
|
17
|
-
sdpMLineIndex?: number | null;
|
|
18
|
-
usernameFragment?: string | null;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Signaling message protocol for WebRTC peer communication.
|
|
22
|
-
*
|
|
23
|
-
* Message types:
|
|
24
|
-
* - `join`: Client requests to join a room
|
|
25
|
-
* - `joined`: Server confirms join with peer ID and existing peers
|
|
26
|
-
* - `peer-joined`: Server notifies when another peer joins the room
|
|
27
|
-
* - `peer-left`: Server notifies when a peer leaves the room
|
|
28
|
-
* - `sdp`: SDP offer/answer exchange between peers
|
|
29
|
-
* - `ice`: ICE candidate exchange between peers
|
|
30
|
-
* - `error`: Error message from server
|
|
31
|
-
*/
|
|
32
|
-
export type SignalMessage = {
|
|
33
|
-
t: 'join';
|
|
34
|
-
roomId: string;
|
|
35
|
-
} | {
|
|
36
|
-
t: 'joined';
|
|
37
|
-
peerId: string;
|
|
38
|
-
roomId: string;
|
|
39
|
-
peers: string[];
|
|
40
|
-
} | {
|
|
41
|
-
t: 'peer-joined';
|
|
42
|
-
peerId: string;
|
|
43
|
-
} | {
|
|
44
|
-
t: 'peer-left';
|
|
45
|
-
peerId: string;
|
|
46
|
-
} | {
|
|
47
|
-
t: 'sdp';
|
|
48
|
-
from: string;
|
|
49
|
-
to?: string;
|
|
50
|
-
description: SDPDescription;
|
|
51
|
-
} | {
|
|
52
|
-
t: 'ice';
|
|
53
|
-
from: string;
|
|
54
|
-
to?: string;
|
|
55
|
-
candidate: ICECandidate;
|
|
56
|
-
} | {
|
|
57
|
-
t: 'error';
|
|
58
|
-
message: string;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated Use `SignalMessage` instead. Alias for backwards compatibility.
|
|
62
|
-
*/
|
|
63
|
-
export type SignalMsg = SignalMessage;
|
|
64
|
-
/**
|
|
65
|
-
* WebRTC connection states for the frontend state machine.
|
|
66
|
-
*
|
|
67
|
-
* State transitions:
|
|
68
|
-
* - idle → connecting: connect() called
|
|
69
|
-
* - connecting → signaling: WebSocket opened, joined room
|
|
70
|
-
* - connecting → idle: error or cancel
|
|
71
|
-
* - signaling → negotiating: peer joined, SDP exchange started
|
|
72
|
-
* - signaling → idle: hangup or WebSocket closed
|
|
73
|
-
* - negotiating → connected: ICE complete, media flowing
|
|
74
|
-
* - negotiating → signaling: peer left during negotiation
|
|
75
|
-
* - negotiating → idle: error or hangup
|
|
76
|
-
* - connected → negotiating: renegotiation needed
|
|
77
|
-
* - connected → signaling: peer left
|
|
78
|
-
* - connected → idle: hangup or WebSocket closed
|
|
79
|
-
*/
|
|
80
|
-
export type WebRTCConnectionState = 'idle' | 'connecting' | 'signaling' | 'negotiating' | 'connected';
|
|
81
|
-
/**
|
|
82
|
-
* Reasons for disconnection.
|
|
83
|
-
*/
|
|
84
|
-
export type WebRTCDisconnectReason = 'hangup' | 'error' | 'peer-left' | 'timeout';
|
|
85
|
-
/**
|
|
86
|
-
* Configuration for creating a data channel.
|
|
87
|
-
*/
|
|
88
|
-
export interface DataChannelConfig {
|
|
89
|
-
/** Unique label for the channel */
|
|
90
|
-
label: string;
|
|
91
|
-
/** Whether messages are ordered (default: true) */
|
|
92
|
-
ordered?: boolean;
|
|
93
|
-
/** Maximum retransmit time in milliseconds */
|
|
94
|
-
maxPacketLifeTime?: number;
|
|
95
|
-
/** Maximum number of retransmissions */
|
|
96
|
-
maxRetransmits?: number;
|
|
97
|
-
/** Sub-protocol name */
|
|
98
|
-
protocol?: string;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Message types for data channel communication.
|
|
102
|
-
*/
|
|
103
|
-
export type DataChannelMessage = {
|
|
104
|
-
type: 'string';
|
|
105
|
-
data: string;
|
|
106
|
-
} | {
|
|
107
|
-
type: 'binary';
|
|
108
|
-
data: ArrayBuffer;
|
|
109
|
-
} | {
|
|
110
|
-
type: 'json';
|
|
111
|
-
data: unknown;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Data channel state.
|
|
115
|
-
*/
|
|
116
|
-
export type DataChannelState = 'connecting' | 'open' | 'closing' | 'closed';
|
|
117
|
-
/**
|
|
118
|
-
* Normalized connection quality summary.
|
|
119
|
-
* Derived from RTCPeerConnection.getStats() for easy consumption.
|
|
120
|
-
*/
|
|
121
|
-
export interface ConnectionQualitySummary {
|
|
122
|
-
/** Round-trip time in milliseconds */
|
|
123
|
-
rtt?: number;
|
|
124
|
-
/** Packet loss percentage (0-100) */
|
|
125
|
-
packetLossPercent?: number;
|
|
126
|
-
/** Jitter in milliseconds (audio) */
|
|
127
|
-
jitter?: number;
|
|
128
|
-
/** Current bitrate in bits per second */
|
|
129
|
-
bitrate?: {
|
|
130
|
-
audio?: {
|
|
131
|
-
inbound?: number;
|
|
132
|
-
outbound?: number;
|
|
133
|
-
};
|
|
134
|
-
video?: {
|
|
135
|
-
inbound?: number;
|
|
136
|
-
outbound?: number;
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
/** Video metrics */
|
|
140
|
-
video?: {
|
|
141
|
-
framesPerSecond?: number;
|
|
142
|
-
framesDropped?: number;
|
|
143
|
-
frameWidth?: number;
|
|
144
|
-
frameHeight?: number;
|
|
145
|
-
};
|
|
146
|
-
/** ICE candidate pair info */
|
|
147
|
-
candidatePair?: {
|
|
148
|
-
localType?: string;
|
|
149
|
-
remoteType?: string;
|
|
150
|
-
protocol?: string;
|
|
151
|
-
usingRelay?: boolean;
|
|
152
|
-
};
|
|
153
|
-
/** Timestamp when stats were collected */
|
|
154
|
-
timestamp: number;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Recording options for MediaRecorder.
|
|
158
|
-
*/
|
|
159
|
-
export interface RecordingOptions {
|
|
160
|
-
/** MIME type for recording (default: 'video/webm;codecs=vp9,opus' or 'audio/webm;codecs=opus') */
|
|
161
|
-
mimeType?: string;
|
|
162
|
-
/** Audio bits per second */
|
|
163
|
-
audioBitsPerSecond?: number;
|
|
164
|
-
/** Video bits per second */
|
|
165
|
-
videoBitsPerSecond?: number;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Recording handle for controlling an active recording.
|
|
169
|
-
*/
|
|
170
|
-
export interface RecordingHandle {
|
|
171
|
-
/** Stop recording and get the blob */
|
|
172
|
-
stop(): Promise<Blob>;
|
|
173
|
-
/** Pause recording */
|
|
174
|
-
pause(): void;
|
|
175
|
-
/** Resume recording */
|
|
176
|
-
resume(): void;
|
|
177
|
-
/** Current recording state */
|
|
178
|
-
readonly state: RecordingState;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Recording state.
|
|
182
|
-
*/
|
|
183
|
-
export type RecordingState = 'inactive' | 'recording' | 'paused';
|
|
184
|
-
/**
|
|
185
|
-
* Abstract track source interface for custom media sources.
|
|
186
|
-
* Implementations can provide camera, screen share, or custom tracks.
|
|
187
|
-
*
|
|
188
|
-
* Note: This interface is implemented in @agentuity/frontend where
|
|
189
|
-
* browser APIs (MediaStream) are available.
|
|
190
|
-
*/
|
|
191
|
-
export interface TrackSource {
|
|
192
|
-
/** Get the media stream from this source (returns browser MediaStream) */
|
|
193
|
-
getStream(): Promise<unknown>;
|
|
194
|
-
/** Stop the source and release resources */
|
|
195
|
-
stop(): void;
|
|
196
|
-
/** Source type identifier */
|
|
197
|
-
readonly type: 'user-media' | 'display-media' | 'custom';
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Callbacks for WebRTC signaling server events.
|
|
201
|
-
* All callbacks are optional - only subscribe to events you care about.
|
|
202
|
-
*/
|
|
203
|
-
export interface WebRTCSignalingCallbacks {
|
|
204
|
-
/**
|
|
205
|
-
* Called when a new room is created.
|
|
206
|
-
* @param roomId - The room ID
|
|
207
|
-
*/
|
|
208
|
-
onRoomCreated?: (roomId: string) => void;
|
|
209
|
-
/**
|
|
210
|
-
* Called when a room is destroyed (last peer left).
|
|
211
|
-
* @param roomId - The room ID
|
|
212
|
-
*/
|
|
213
|
-
onRoomDestroyed?: (roomId: string) => void;
|
|
214
|
-
/**
|
|
215
|
-
* Called when a peer joins a room.
|
|
216
|
-
* @param peerId - The peer's ID
|
|
217
|
-
* @param roomId - The room ID
|
|
218
|
-
*/
|
|
219
|
-
onPeerJoin?: (peerId: string, roomId: string) => void;
|
|
220
|
-
/**
|
|
221
|
-
* Called when a peer leaves a room.
|
|
222
|
-
* @param peerId - The peer's ID
|
|
223
|
-
* @param roomId - The room ID
|
|
224
|
-
* @param reason - Why the peer left
|
|
225
|
-
*/
|
|
226
|
-
onPeerLeave?: (peerId: string, roomId: string, reason: 'disconnect' | 'kicked') => void;
|
|
227
|
-
/**
|
|
228
|
-
* Called when a signaling message is relayed.
|
|
229
|
-
* @param type - Message type ('sdp' or 'ice')
|
|
230
|
-
* @param from - Sender peer ID
|
|
231
|
-
* @param to - Target peer ID (undefined for broadcast)
|
|
232
|
-
* @param roomId - The room ID
|
|
233
|
-
*/
|
|
234
|
-
onMessage?: (type: 'sdp' | 'ice', from: string, to: string | undefined, roomId: string) => void;
|
|
235
|
-
/**
|
|
236
|
-
* Called when an error occurs.
|
|
237
|
-
* @param error - The error that occurred
|
|
238
|
-
* @param peerId - The peer ID if applicable
|
|
239
|
-
* @param roomId - The room ID if applicable
|
|
240
|
-
*/
|
|
241
|
-
onError?: (error: Error, peerId?: string, roomId?: string) => void;
|
|
242
|
-
}
|
|
243
|
-
//# sourceMappingURL=webrtc.d.ts.map
|
package/dist/webrtc.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webrtc.d.ts","sourceRoot":"","sources":["../src/webrtc.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;IACnD,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,aAAa,GACtB;IAAE,CAAC,EAAE,MAAM,CAAC;IA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GAAG,QAAQ,KAAK,IAAI,CAAC;IAExF;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhG;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACnE"}
|
package/dist/webrtc.js
DELETED
package/dist/webrtc.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webrtc.js","sourceRoot":"","sources":["../src/webrtc.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
export declare const WorkbenchConfigError: {
|
|
2
|
-
new (args?: {
|
|
3
|
-
cause?: unknown;
|
|
4
|
-
} | undefined): import("./error.ts").RichError & {
|
|
5
|
-
readonly _tag: "WorkbenchConfigError";
|
|
6
|
-
} & Readonly<Record<string, never>>;
|
|
7
|
-
readonly defaultMessage?: string;
|
|
8
|
-
} & (<Shape extends {
|
|
9
|
-
[x: string]: any;
|
|
10
|
-
} = Record<string, never>>() => {
|
|
11
|
-
new (args?: (Shape extends Record<string, never> ? {
|
|
12
|
-
cause?: unknown;
|
|
13
|
-
} : Shape & {
|
|
14
|
-
cause?: unknown;
|
|
15
|
-
}) | undefined): import("./error.ts").RichError & {
|
|
16
|
-
readonly _tag: "WorkbenchConfigError";
|
|
17
|
-
} & Readonly<Shape>;
|
|
18
|
-
readonly defaultMessage?: string;
|
|
19
|
-
});
|
|
20
|
-
export declare const WorkbenchNotFoundError: {
|
|
21
|
-
new (args?: {
|
|
22
|
-
cause?: unknown;
|
|
23
|
-
} | undefined): import("./error.ts").RichError & {
|
|
24
|
-
readonly _tag: "WorkbenchNotFoundError";
|
|
25
|
-
} & Readonly<Record<string, never>>;
|
|
26
|
-
readonly defaultMessage?: string;
|
|
27
|
-
} & (<Shape extends {
|
|
28
|
-
[x: string]: any;
|
|
29
|
-
} = Record<string, never>>() => {
|
|
30
|
-
new (args?: (Shape extends Record<string, never> ? {
|
|
31
|
-
cause?: unknown;
|
|
32
|
-
} : Shape & {
|
|
33
|
-
cause?: unknown;
|
|
34
|
-
}) | undefined): import("./error.ts").RichError & {
|
|
35
|
-
readonly _tag: "WorkbenchNotFoundError";
|
|
36
|
-
} & Readonly<Shape>;
|
|
37
|
-
readonly defaultMessage?: string;
|
|
38
|
-
});
|
|
39
|
-
/**
|
|
40
|
-
* Workbench configuration utilities shared across packages
|
|
41
|
-
*/
|
|
42
|
-
export interface WorkbenchConfig {
|
|
43
|
-
route?: string;
|
|
44
|
-
headers?: Record<string, string>;
|
|
45
|
-
apiKey?: string;
|
|
46
|
-
baseUrl?: string | null;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Encode workbench config to base64 for environment variable storage
|
|
50
|
-
*/
|
|
51
|
-
export declare function encodeWorkbenchConfig(config: WorkbenchConfig): string;
|
|
52
|
-
/**
|
|
53
|
-
* Decode workbench config from base64 environment variable
|
|
54
|
-
* Throws error if config is invalid
|
|
55
|
-
*/
|
|
56
|
-
export declare function decodeWorkbenchConfig(encoded: string): WorkbenchConfig;
|
|
57
|
-
/**
|
|
58
|
-
* Get workbench config from build-time variable
|
|
59
|
-
* Throws error if config is not available or invalid
|
|
60
|
-
*/
|
|
61
|
-
export declare function getWorkbenchConfig(): WorkbenchConfig;
|
|
62
|
-
//# sourceMappingURL=workbench-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workbench-config.d.ts","sourceRoot":"","sources":["../src/workbench-config.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;EAGhC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;EAGlC,CAAC;AAEF;;GAEG;AAEH,MAAM,WAAW,eAAe;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CASrE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAsBtE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CASpD"}
|
package/dist/workbench-config.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { StructuredError } from "./error.js";
|
|
2
|
-
export const WorkbenchConfigError = StructuredError('WorkbenchConfigError', 'The workbench configuration is invalid');
|
|
3
|
-
export const WorkbenchNotFoundError = StructuredError('WorkbenchNotFoundError', 'Workbench config not found - build process did not inline config');
|
|
4
|
-
/**
|
|
5
|
-
* Encode workbench config to base64 for environment variable storage
|
|
6
|
-
*/
|
|
7
|
-
export function encodeWorkbenchConfig(config) {
|
|
8
|
-
const json = JSON.stringify(config);
|
|
9
|
-
// Use Node.js Buffer if available (build-time), otherwise browser btoa (shouldn't be called in browser)
|
|
10
|
-
if (typeof Buffer !== 'undefined') {
|
|
11
|
-
return Buffer.from(json).toString('base64');
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
return btoa(json);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Decode workbench config from base64 environment variable
|
|
19
|
-
* Throws error if config is invalid
|
|
20
|
-
*/
|
|
21
|
-
export function decodeWorkbenchConfig(encoded) {
|
|
22
|
-
try {
|
|
23
|
-
let json;
|
|
24
|
-
// Use appropriate decoding method based on environment
|
|
25
|
-
if (typeof Buffer !== 'undefined') {
|
|
26
|
-
// Node.js environment (build-time)
|
|
27
|
-
json = Buffer.from(encoded, 'base64').toString('utf-8');
|
|
28
|
-
}
|
|
29
|
-
else if (typeof atob !== 'undefined') {
|
|
30
|
-
// Browser environment (runtime)
|
|
31
|
-
json = atob(encoded);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
throw new Error('No base64 decoding method available');
|
|
35
|
-
}
|
|
36
|
-
const config = JSON.parse(json);
|
|
37
|
-
return config;
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
throw new WorkbenchConfigError({
|
|
41
|
-
cause: error,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Get workbench config from build-time variable
|
|
47
|
-
* Throws error if config is not available or invalid
|
|
48
|
-
*/
|
|
49
|
-
export function getWorkbenchConfig() {
|
|
50
|
-
// This will be replaced at build time by Bun's define mechanism
|
|
51
|
-
// @ts-expect-error - AGENTUITY_WORKBENCH_CONFIG_INLINE will be replaced at build time
|
|
52
|
-
if (typeof AGENTUITY_WORKBENCH_CONFIG_INLINE === 'undefined') {
|
|
53
|
-
throw new WorkbenchNotFoundError();
|
|
54
|
-
}
|
|
55
|
-
// @ts-expect-error - AGENTUITY_WORKBENCH_CONFIG_INLINE will be replaced at build time
|
|
56
|
-
return decodeWorkbenchConfig(AGENTUITY_WORKBENCH_CONFIG_INLINE);
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=workbench-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workbench-config.js","sourceRoot":"","sources":["../src/workbench-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAClD,sBAAsB,EACtB,wCAAwC,CACxC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,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AAC;QAC9D,MAAM,IAAI,sBAAsB,EAAE,CAAC;IACpC,CAAC;IAED,sFAAsF;IACtF,OAAO,qBAAqB,CAAC,iCAAiC,CAAC,CAAC;AACjE,CAAC"}
|
package/dist/workbench.d.ts
DELETED
package/dist/workbench.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workbench.d.ts","sourceRoot":"","sources":["../src/workbench.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
package/dist/workbench.js
DELETED
package/dist/workbench.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workbench.js","sourceRoot":"","sources":["../src/workbench.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Authentication service types.
|
|
3
|
-
*
|
|
4
|
-
* @module services/auth
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export type {
|
|
8
|
-
AuthUser,
|
|
9
|
-
AuthSession,
|
|
10
|
-
AuthContext,
|
|
11
|
-
AuthOrgContext,
|
|
12
|
-
AuthApiKeyPermissions,
|
|
13
|
-
AuthApiKeyContext,
|
|
14
|
-
AuthMethod,
|
|
15
|
-
AgentuityAuth,
|
|
16
|
-
AuthOrgHelpers,
|
|
17
|
-
AuthApiKeyHelpers,
|
|
18
|
-
AuthInterface,
|
|
19
|
-
} from './types.ts';
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core authentication types for Agentuity.
|
|
3
|
-
*
|
|
4
|
-
* These types are defined in @agentuity/core to avoid circular dependencies
|
|
5
|
-
* and allow packages like @agentuity/runtime to use auth types without
|
|
6
|
-
* pulling in heavy dependencies like drizzle-orm.
|
|
7
|
-
*
|
|
8
|
-
* @module services/auth/types
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
// =============================================================================
|
|
12
|
-
// Canonical User/Session Types
|
|
13
|
-
// =============================================================================
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Canonical authenticated user type for Agentuity Auth.
|
|
17
|
-
*
|
|
18
|
-
* Common fields include:
|
|
19
|
-
* - `id` – Stable user identifier
|
|
20
|
-
* - `email` – Primary email address
|
|
21
|
-
* - `name` – Display name
|
|
22
|
-
* - `image` – Avatar URL (if configured)
|
|
23
|
-
* - `createdAt` / `updatedAt` – Timestamps
|
|
24
|
-
*/
|
|
25
|
-
export interface AuthUser {
|
|
26
|
-
id: string;
|
|
27
|
-
email: string;
|
|
28
|
-
name?: string | null;
|
|
29
|
-
image?: string | null;
|
|
30
|
-
createdAt?: Date | string;
|
|
31
|
-
updatedAt?: Date | string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Auth session type with organization plugin fields.
|
|
36
|
-
*/
|
|
37
|
-
export interface AuthSession {
|
|
38
|
-
id: string;
|
|
39
|
-
userId: string;
|
|
40
|
-
expiresAt: Date | string;
|
|
41
|
-
/** Active organization ID from the organization plugin */
|
|
42
|
-
activeOrganizationId?: string;
|
|
43
|
-
ipAddress?: string | null;
|
|
44
|
-
userAgent?: string | null;
|
|
45
|
-
createdAt?: Date | string;
|
|
46
|
-
updatedAt?: Date | string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Auth context containing user, session, and org data.
|
|
51
|
-
* This is the full auth context available on AgentContext.auth and c.var.auth.
|
|
52
|
-
* Session may be null for API key authentication.
|
|
53
|
-
*/
|
|
54
|
-
export interface AuthContext<TUser = AuthUser, TSession = AuthSession | null> {
|
|
55
|
-
user: TUser;
|
|
56
|
-
session: TSession;
|
|
57
|
-
org: AuthOrgContext | null;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Organization context from the organization plugin.
|
|
62
|
-
*/
|
|
63
|
-
export interface AuthOrgContext {
|
|
64
|
-
/** Organization ID */
|
|
65
|
-
id: string;
|
|
66
|
-
/** Organization slug (URL-friendly identifier) */
|
|
67
|
-
slug?: string | null;
|
|
68
|
-
/** Organization display name */
|
|
69
|
-
name?: string | null;
|
|
70
|
-
/** Member's role in this organization (e.g., 'owner', 'admin', 'member') */
|
|
71
|
-
role?: string | null;
|
|
72
|
-
/** Member ID for this user in this organization */
|
|
73
|
-
memberId?: string | null;
|
|
74
|
-
/** Organization metadata (if enabled) */
|
|
75
|
-
metadata?: unknown;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// =============================================================================
|
|
79
|
-
// API Key Types
|
|
80
|
-
// =============================================================================
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* API key permissions format.
|
|
84
|
-
* Maps resource names to arrays of allowed actions.
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```typescript
|
|
88
|
-
* const permissions: AuthApiKeyPermissions = {
|
|
89
|
-
* project: ['read', 'write'],
|
|
90
|
-
* user: ['read'],
|
|
91
|
-
* admin: ['*'], // wildcard - all actions
|
|
92
|
-
* };
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
export interface AuthApiKeyPermissions {
|
|
96
|
-
[key: string]: string[];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* API key context when request is authenticated via API key.
|
|
101
|
-
*/
|
|
102
|
-
export interface AuthApiKeyContext {
|
|
103
|
-
/** API key ID */
|
|
104
|
-
id: string;
|
|
105
|
-
/** Display name of the API key */
|
|
106
|
-
name?: string | null;
|
|
107
|
-
/** Permissions associated with this API key */
|
|
108
|
-
permissions: AuthApiKeyPermissions;
|
|
109
|
-
/** User ID the API key belongs to */
|
|
110
|
-
userId?: string | null;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Authentication method used for the current request.
|
|
115
|
-
*/
|
|
116
|
-
export type AuthMethod = 'session' | 'api-key' | 'bearer';
|
|
117
|
-
|
|
118
|
-
// =============================================================================
|
|
119
|
-
// Auth Interface
|
|
120
|
-
// =============================================================================
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Generic authentication interface exposed on Hono context.
|
|
124
|
-
*
|
|
125
|
-
* This type is intentionally provider-agnostic.
|
|
126
|
-
*
|
|
127
|
-
* @typeParam TUser - Domain user type (defaults to unknown for flexibility).
|
|
128
|
-
* @typeParam TRaw - Underlying auth context (defaults to unknown for flexibility).
|
|
129
|
-
*/
|
|
130
|
-
export interface AgentuityAuth<TUser = unknown, TRaw = unknown> {
|
|
131
|
-
/** Get the authenticated user, throws if not authenticated */
|
|
132
|
-
getUser(): Promise<TUser>;
|
|
133
|
-
|
|
134
|
-
/** Get the raw JWT token */
|
|
135
|
-
getToken(): Promise<string | null>;
|
|
136
|
-
|
|
137
|
-
/** Raw provider-specific auth object or auth context */
|
|
138
|
-
raw: TRaw;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Organization helpers available on the auth context.
|
|
143
|
-
*/
|
|
144
|
-
export interface AuthOrgHelpers {
|
|
145
|
-
/** Active organization context if available, null otherwise */
|
|
146
|
-
org: AuthOrgContext | null;
|
|
147
|
-
|
|
148
|
-
/** Returns active org or null (never throws) */
|
|
149
|
-
getOrg(): Promise<AuthOrgContext | null>;
|
|
150
|
-
|
|
151
|
-
/** Convenience accessor for the member's role on the active org */
|
|
152
|
-
getOrgRole(): Promise<string | null>;
|
|
153
|
-
|
|
154
|
-
/** True if the current member's role is one of the provided roles */
|
|
155
|
-
hasOrgRole(...roles: string[]): Promise<boolean>;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* API key helpers available on the auth context.
|
|
160
|
-
*/
|
|
161
|
-
export interface AuthApiKeyHelpers {
|
|
162
|
-
/** How this request was authenticated */
|
|
163
|
-
authMethod: AuthMethod;
|
|
164
|
-
|
|
165
|
-
/** API key context when request is authenticated via API key, null otherwise */
|
|
166
|
-
apiKey: AuthApiKeyContext | null;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Check if the API key has the required permissions.
|
|
170
|
-
* All specified actions must be present for the resource.
|
|
171
|
-
* Supports '*' wildcard which matches any action.
|
|
172
|
-
*
|
|
173
|
-
* @param resource - The resource to check (e.g., 'project', 'user')
|
|
174
|
-
* @param actions - Actions required (e.g., 'read', 'write')
|
|
175
|
-
* @returns true if all actions are permitted, false otherwise
|
|
176
|
-
*
|
|
177
|
-
* @example
|
|
178
|
-
* ```typescript
|
|
179
|
-
* // Check for specific permission
|
|
180
|
-
* if (c.var.auth.hasPermission('project', 'write')) { ... }
|
|
181
|
-
*
|
|
182
|
-
* // Check for multiple permissions (all required)
|
|
183
|
-
* if (c.var.auth.hasPermission('project', 'read', 'write')) { ... }
|
|
184
|
-
* ```
|
|
185
|
-
*/
|
|
186
|
-
hasPermission(resource: string, ...actions: string[]): boolean;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Full authentication interface available on `c.var.auth` and `ctx.auth`.
|
|
191
|
-
*
|
|
192
|
-
* This is the primary interface you'll use to access authentication data
|
|
193
|
-
* in your route handlers and agents. It provides:
|
|
194
|
-
*
|
|
195
|
-
* - User data via `getUser()`
|
|
196
|
-
* - Organization helpers via `getOrg()`, `getOrgRole()`, `hasOrgRole()`
|
|
197
|
-
* - API key helpers via `apiKey`, `hasPermission()`
|
|
198
|
-
* - Token access via `getToken()`
|
|
199
|
-
*
|
|
200
|
-
* @example Route handler
|
|
201
|
-
* ```typescript
|
|
202
|
-
* app.get('/api/profile', async (c) => {
|
|
203
|
-
* const user = await c.var.auth.getUser();
|
|
204
|
-
* const org = await c.var.auth.getOrg();
|
|
205
|
-
* return c.json({ user, org });
|
|
206
|
-
* });
|
|
207
|
-
* ```
|
|
208
|
-
*
|
|
209
|
-
* @example Agent handler
|
|
210
|
-
* ```typescript
|
|
211
|
-
* handler: async (ctx, input) => {
|
|
212
|
-
* if (!ctx.auth) return { error: 'Unauthorized' };
|
|
213
|
-
* const user = await ctx.auth.getUser();
|
|
214
|
-
* return { message: `Hello, ${user.email}!` };
|
|
215
|
-
* }
|
|
216
|
-
* ```
|
|
217
|
-
*
|
|
218
|
-
* @typeParam TUser - User type (extends AuthUser, defaults to AuthUser)
|
|
219
|
-
*/
|
|
220
|
-
export interface AuthInterface<TUser extends AuthUser = AuthUser>
|
|
221
|
-
extends AgentuityAuth<TUser, AuthContext<TUser>>,
|
|
222
|
-
AuthOrgHelpers,
|
|
223
|
-
AuthApiKeyHelpers {}
|