@cadenya/cadenya 1.3.1 → 1.4.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/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8 -1
- package/dist/client.js.map +1 -1
- package/dist/types.d.ts +19 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +10 -2
- package/src/types.ts +22 -3
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface ClientOptions {
|
|
|
35
35
|
* Defaults to 60000; a non-finite or <= 0 value disables the deadline.
|
|
36
36
|
*/
|
|
37
37
|
timeout?: number;
|
|
38
|
-
/**
|
|
38
|
+
/** Additional request headers. Browsers supply their own User-Agent by default. */
|
|
39
39
|
defaultHeaders?: Record<string, string>;
|
|
40
40
|
/** Custom fetch implementation. */
|
|
41
41
|
fetch?: typeof fetch;
|
|
@@ -85,7 +85,7 @@ export class Cadenya {
|
|
|
85
85
|
authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),
|
|
86
86
|
maxRetries: options.maxRetries ?? 0,
|
|
87
87
|
timeout: options.timeout,
|
|
88
|
-
defaultHeaders: { '
|
|
88
|
+
defaultHeaders: { ...nodeUserAgent('cadenya-typescript/1.3.0 (api 1.0)'), ...options.defaultHeaders },
|
|
89
89
|
fetch: options.fetch,
|
|
90
90
|
logger: options.logger,
|
|
91
91
|
logLevel: options.logLevel,
|
|
@@ -112,6 +112,14 @@ export class Cadenya {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
// Browser-authored User-Agent headers require CORS permission. Only Node-compatible
|
|
116
|
+
// runtimes receive the SDK default; browsers and workers use their native header.
|
|
117
|
+
function nodeUserAgent(value: string): Record<string, string> {
|
|
118
|
+
const nodeVersion = (globalThis as { process?: { versions?: { node?: string } } })
|
|
119
|
+
.process?.versions?.node;
|
|
120
|
+
return nodeVersion ? { 'User-Agent': value } : {};
|
|
121
|
+
}
|
|
122
|
+
|
|
115
123
|
function readEnv(name: string): string | undefined {
|
|
116
124
|
const env = (globalThis as { process?: { env?: Record<string, string | undefined> } })
|
|
117
125
|
.process?.env;
|
package/src/types.ts
CHANGED
|
@@ -2499,6 +2499,10 @@ export interface ObjectiveError {
|
|
|
2499
2499
|
}
|
|
2500
2500
|
|
|
2501
2501
|
export interface ObjectiveEvent {
|
|
2502
|
+
/**
|
|
2503
|
+
* Durable events use objevt_ IDs, the only IDs accepted as reconnect
|
|
2504
|
+
* cursors. Live-only heartbeats use hb_ IDs and have no SSE id: field.
|
|
2505
|
+
*/
|
|
2502
2506
|
metadata: OperationMetadata;
|
|
2503
2507
|
data: ObjectiveEventData;
|
|
2504
2508
|
contextWindowId: string;
|
|
@@ -2538,7 +2542,8 @@ export type ObjectiveEventData =
|
|
|
2538
2542
|
| ObjectiveEventData_Notice
|
|
2539
2543
|
| ObjectiveEventData_TimedOut
|
|
2540
2544
|
| ObjectiveEventData_Reasoning
|
|
2541
|
-
| ObjectiveEventData_StateChanged
|
|
2545
|
+
| ObjectiveEventData_StateChanged
|
|
2546
|
+
| ObjectiveEventData_Heartbeat;
|
|
2542
2547
|
|
|
2543
2548
|
export interface ObjectiveEventInfo {
|
|
2544
2549
|
objective?: OperationMetadata;
|
|
@@ -2596,6 +2601,15 @@ export interface ObjectiveFinalized {
|
|
|
2596
2601
|
output?: Record<string, unknown>;
|
|
2597
2602
|
}
|
|
2598
2603
|
|
|
2604
|
+
/**
|
|
2605
|
+
* ObjectiveHeartbeat reports recent execution liveness. It is transient:
|
|
2606
|
+
* delivered only on live streams, never stored in event history or delivered
|
|
2607
|
+
* to webhooks. Its hb_ event ID is not a reconnect cursor. Heartbeats do not
|
|
2608
|
+
* change objective state or promise progress from the model.
|
|
2609
|
+
*/
|
|
2610
|
+
export interface ObjectiveHeartbeat {
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2599
2613
|
/**
|
|
2600
2614
|
* ObjectiveInfo provides read-only aggregated statistics about an objective's execution
|
|
2601
2615
|
*/
|
|
@@ -4860,7 +4874,7 @@ export type WebhookDeliveryDataStatus = 'WEBHOOK_DELIVERY_STATUS_UNSPECIFIED' |
|
|
|
4860
4874
|
/**
|
|
4861
4875
|
* The type of objective event that triggered this webhook delivery
|
|
4862
4876
|
*/
|
|
4863
|
-
export type WebhookDeliveryDataEventType = 'OBJECTIVE_EVENT_TYPE_UNSPECIFIED' | 'OBJECTIVE_EVENT_TYPE_USER_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVAL_REQUESTED' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVED' | 'OBJECTIVE_EVENT_TYPE_TOOL_DENIED' | 'OBJECTIVE_EVENT_TYPE_TOOL_CALLED' | 'OBJECTIVE_EVENT_TYPE_ERROR' | 'OBJECTIVE_EVENT_TYPE_ASSISTANT_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_RESULT' | 'OBJECTIVE_EVENT_TYPE_TOOL_ERROR' | 'OBJECTIVE_EVENT_TYPE_CONTEXT_WINDOW_COMPACTED' | 'OBJECTIVE_EVENT_TYPE_MEMORY_READ' | 'OBJECTIVE_EVENT_TYPE_CANCELLED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_SPAWNED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_UPDATED' | 'OBJECTIVE_EVENT_TYPE_FINALIZED' | 'OBJECTIVE_EVENT_TYPE_NOTICE' | 'OBJECTIVE_EVENT_TYPE_TIMED_OUT' | 'OBJECTIVE_EVENT_TYPE_REASONING' | 'OBJECTIVE_EVENT_TYPE_STATE_CHANGED';
|
|
4877
|
+
export type WebhookDeliveryDataEventType = 'OBJECTIVE_EVENT_TYPE_UNSPECIFIED' | 'OBJECTIVE_EVENT_TYPE_USER_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVAL_REQUESTED' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVED' | 'OBJECTIVE_EVENT_TYPE_TOOL_DENIED' | 'OBJECTIVE_EVENT_TYPE_TOOL_CALLED' | 'OBJECTIVE_EVENT_TYPE_ERROR' | 'OBJECTIVE_EVENT_TYPE_ASSISTANT_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_RESULT' | 'OBJECTIVE_EVENT_TYPE_TOOL_ERROR' | 'OBJECTIVE_EVENT_TYPE_CONTEXT_WINDOW_COMPACTED' | 'OBJECTIVE_EVENT_TYPE_MEMORY_READ' | 'OBJECTIVE_EVENT_TYPE_CANCELLED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_SPAWNED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_UPDATED' | 'OBJECTIVE_EVENT_TYPE_FINALIZED' | 'OBJECTIVE_EVENT_TYPE_NOTICE' | 'OBJECTIVE_EVENT_TYPE_TIMED_OUT' | 'OBJECTIVE_EVENT_TYPE_REASONING' | 'OBJECTIVE_EVENT_TYPE_STATE_CHANGED' | 'OBJECTIVE_EVENT_TYPE_HEARTBEAT';
|
|
4864
4878
|
|
|
4865
4879
|
export interface WebhookDeliveryData {
|
|
4866
4880
|
/**
|
|
@@ -5559,6 +5573,11 @@ export interface ObjectiveEventData_StateChanged {
|
|
|
5559
5573
|
stateChanged: ObjectiveStateChanged;
|
|
5560
5574
|
}
|
|
5561
5575
|
|
|
5576
|
+
export interface ObjectiveEventData_Heartbeat {
|
|
5577
|
+
type: 'heartbeat';
|
|
5578
|
+
heartbeat: ObjectiveHeartbeat;
|
|
5579
|
+
}
|
|
5580
|
+
|
|
5562
5581
|
export interface CallableTool_Tool {
|
|
5563
5582
|
type: 'tool';
|
|
5564
5583
|
tool: ResourceMetadata;
|
|
@@ -5822,7 +5841,7 @@ export type AgentServiceListAgentsVariationSelectionMode = 'VARIATION_SELECTION_
|
|
|
5822
5841
|
|
|
5823
5842
|
export type AgentServiceListAgentFeedbackSentiment = 'FEEDBACK_SENTIMENT_UNSPECIFIED' | 'FEEDBACK_SENTIMENT_POSITIVE' | 'FEEDBACK_SENTIMENT_NEGATIVE';
|
|
5824
5843
|
|
|
5825
|
-
export type AgentServiceListAgentWebhookDeliveriesEventType = 'OBJECTIVE_EVENT_TYPE_UNSPECIFIED' | 'OBJECTIVE_EVENT_TYPE_USER_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVAL_REQUESTED' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVED' | 'OBJECTIVE_EVENT_TYPE_TOOL_DENIED' | 'OBJECTIVE_EVENT_TYPE_TOOL_CALLED' | 'OBJECTIVE_EVENT_TYPE_ERROR' | 'OBJECTIVE_EVENT_TYPE_ASSISTANT_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_RESULT' | 'OBJECTIVE_EVENT_TYPE_TOOL_ERROR' | 'OBJECTIVE_EVENT_TYPE_CONTEXT_WINDOW_COMPACTED' | 'OBJECTIVE_EVENT_TYPE_MEMORY_READ' | 'OBJECTIVE_EVENT_TYPE_CANCELLED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_SPAWNED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_UPDATED' | 'OBJECTIVE_EVENT_TYPE_FINALIZED' | 'OBJECTIVE_EVENT_TYPE_NOTICE' | 'OBJECTIVE_EVENT_TYPE_TIMED_OUT' | 'OBJECTIVE_EVENT_TYPE_REASONING' | 'OBJECTIVE_EVENT_TYPE_STATE_CHANGED';
|
|
5844
|
+
export type AgentServiceListAgentWebhookDeliveriesEventType = 'OBJECTIVE_EVENT_TYPE_UNSPECIFIED' | 'OBJECTIVE_EVENT_TYPE_USER_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVAL_REQUESTED' | 'OBJECTIVE_EVENT_TYPE_TOOL_APPROVED' | 'OBJECTIVE_EVENT_TYPE_TOOL_DENIED' | 'OBJECTIVE_EVENT_TYPE_TOOL_CALLED' | 'OBJECTIVE_EVENT_TYPE_ERROR' | 'OBJECTIVE_EVENT_TYPE_ASSISTANT_MESSAGE' | 'OBJECTIVE_EVENT_TYPE_TOOL_RESULT' | 'OBJECTIVE_EVENT_TYPE_TOOL_ERROR' | 'OBJECTIVE_EVENT_TYPE_CONTEXT_WINDOW_COMPACTED' | 'OBJECTIVE_EVENT_TYPE_MEMORY_READ' | 'OBJECTIVE_EVENT_TYPE_CANCELLED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_SPAWNED' | 'OBJECTIVE_EVENT_TYPE_SUB_AGENT_UPDATED' | 'OBJECTIVE_EVENT_TYPE_FINALIZED' | 'OBJECTIVE_EVENT_TYPE_NOTICE' | 'OBJECTIVE_EVENT_TYPE_TIMED_OUT' | 'OBJECTIVE_EVENT_TYPE_REASONING' | 'OBJECTIVE_EVENT_TYPE_STATE_CHANGED' | 'OBJECTIVE_EVENT_TYPE_HEARTBEAT';
|
|
5826
5845
|
|
|
5827
5846
|
export type MemoryServiceListMemoryLayersType = 'MEMORY_LAYER_TYPE_UNSPECIFIED' | 'MEMORY_LAYER_TYPE_EPISODIC' | 'MEMORY_LAYER_TYPE_SKILLS';
|
|
5828
5847
|
|