@bradygaster/squad-sdk 0.7.0 → 0.8.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 +296 -296
- package/dist/adapter/client.d.ts +225 -0
- package/dist/adapter/client.d.ts.map +1 -0
- package/dist/adapter/client.js +397 -0
- package/dist/adapter/client.js.map +1 -0
- package/dist/adapter/errors.d.ts +260 -0
- package/dist/adapter/errors.d.ts.map +1 -0
- package/dist/adapter/errors.js +362 -0
- package/dist/adapter/errors.js.map +1 -0
- package/dist/adapter/types.d.ts +779 -0
- package/dist/adapter/types.d.ts.map +1 -0
- package/dist/adapter/types.js +11 -0
- package/dist/adapter/types.js.map +1 -0
- package/dist/agents/charter-compiler.d.ts +102 -0
- package/dist/agents/charter-compiler.d.ts.map +1 -0
- package/dist/agents/charter-compiler.js +157 -0
- package/dist/agents/charter-compiler.js.map +1 -0
- package/dist/agents/history-shadow.d.ts +80 -0
- package/dist/agents/history-shadow.d.ts.map +1 -0
- package/dist/agents/history-shadow.js +239 -0
- package/dist/agents/history-shadow.js.map +1 -0
- package/dist/agents/index.d.ts +68 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +74 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/lifecycle.d.ts +138 -0
- package/dist/agents/lifecycle.d.ts.map +1 -0
- package/dist/agents/lifecycle.js +258 -0
- package/dist/agents/lifecycle.js.map +1 -0
- package/dist/agents/model-selector.d.ts +80 -0
- package/dist/agents/model-selector.d.ts.map +1 -0
- package/dist/agents/model-selector.js +198 -0
- package/dist/agents/model-selector.js.map +1 -0
- package/dist/agents/onboarding.d.ts +65 -0
- package/dist/agents/onboarding.d.ts.map +1 -0
- package/dist/agents/onboarding.js +373 -0
- package/dist/agents/onboarding.js.map +1 -0
- package/dist/build/bundle.d.ts +32 -0
- package/dist/build/bundle.d.ts.map +1 -0
- package/dist/build/bundle.js +97 -0
- package/dist/build/bundle.js.map +1 -0
- package/dist/build/ci-pipeline.d.ts +51 -0
- package/dist/build/ci-pipeline.d.ts.map +1 -0
- package/dist/build/ci-pipeline.js +180 -0
- package/dist/build/ci-pipeline.js.map +1 -0
- package/dist/build/github-dist.d.ts +37 -0
- package/dist/build/github-dist.d.ts.map +1 -0
- package/dist/build/github-dist.js +117 -0
- package/dist/build/github-dist.js.map +1 -0
- package/dist/build/index.d.ts +11 -0
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/index.js +11 -0
- package/dist/build/index.js.map +1 -0
- package/dist/build/install-migration.d.ts +28 -0
- package/dist/build/install-migration.d.ts.map +1 -0
- package/dist/build/install-migration.js +103 -0
- package/dist/build/install-migration.js.map +1 -0
- package/dist/build/npm-package.d.ts +54 -0
- package/dist/build/npm-package.d.ts.map +1 -0
- package/dist/build/npm-package.js +128 -0
- package/dist/build/npm-package.js.map +1 -0
- package/dist/build/release.d.ts +108 -0
- package/dist/build/release.d.ts.map +1 -0
- package/dist/build/release.js +295 -0
- package/dist/build/release.js.map +1 -0
- package/dist/build/versioning.d.ts +38 -0
- package/dist/build/versioning.d.ts.map +1 -0
- package/dist/build/versioning.js +113 -0
- package/dist/build/versioning.js.map +1 -0
- package/dist/casting/casting-engine.d.ts +60 -0
- package/dist/casting/casting-engine.d.ts.map +1 -0
- package/dist/casting/casting-engine.js +223 -0
- package/dist/casting/casting-engine.js.map +1 -0
- package/dist/casting/casting-history.d.ts +54 -0
- package/dist/casting/casting-history.d.ts.map +1 -0
- package/dist/casting/casting-history.js +63 -0
- package/dist/casting/casting-history.js.map +1 -0
- package/dist/casting/index.d.ts +46 -0
- package/dist/casting/index.d.ts.map +1 -0
- package/dist/casting/index.js +37 -0
- package/dist/casting/index.js.map +1 -0
- package/dist/client/event-bus.d.ts +29 -0
- package/dist/client/event-bus.d.ts.map +1 -0
- package/dist/client/event-bus.js +53 -0
- package/dist/client/event-bus.js.map +1 -0
- package/dist/client/index.d.ts +100 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +170 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/session-pool.d.ts +66 -0
- package/dist/client/session-pool.d.ts.map +1 -0
- package/dist/client/session-pool.js +145 -0
- package/dist/client/session-pool.js.map +1 -0
- package/dist/config/agent-doc.d.ts +43 -0
- package/dist/config/agent-doc.d.ts.map +1 -0
- package/dist/config/agent-doc.js +158 -0
- package/dist/config/agent-doc.js.map +1 -0
- package/dist/config/agent-source.d.ts +95 -0
- package/dist/config/agent-source.d.ts.map +1 -0
- package/dist/config/agent-source.js +274 -0
- package/dist/config/agent-source.js.map +1 -0
- package/dist/config/doc-sync.d.ts +66 -0
- package/dist/config/doc-sync.d.ts.map +1 -0
- package/dist/config/doc-sync.js +270 -0
- package/dist/config/doc-sync.js.map +1 -0
- package/dist/config/feature-audit.d.ts +49 -0
- package/dist/config/feature-audit.d.ts.map +1 -0
- package/dist/config/feature-audit.js +148 -0
- package/dist/config/feature-audit.js.map +1 -0
- package/dist/config/index.d.ts +15 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +15 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/init.d.ts +61 -0
- package/dist/config/init.d.ts.map +1 -0
- package/dist/config/init.js +369 -0
- package/dist/config/init.js.map +1 -0
- package/dist/config/legacy-fallback.d.ts +83 -0
- package/dist/config/legacy-fallback.d.ts.map +1 -0
- package/dist/config/legacy-fallback.js +212 -0
- package/dist/config/legacy-fallback.js.map +1 -0
- package/dist/config/markdown-migration.d.ts +157 -0
- package/dist/config/markdown-migration.d.ts.map +1 -0
- package/dist/config/markdown-migration.js +434 -0
- package/dist/config/markdown-migration.js.map +1 -0
- package/dist/config/migration.d.ts +123 -0
- package/dist/config/migration.d.ts.map +1 -0
- package/dist/config/migration.js +273 -0
- package/dist/config/migration.js.map +1 -0
- package/dist/config/migrations/index.d.ts +36 -0
- package/dist/config/migrations/index.d.ts.map +1 -0
- package/dist/config/migrations/index.js +216 -0
- package/dist/config/migrations/index.js.map +1 -0
- package/dist/config/models.d.ts +134 -0
- package/dist/config/models.d.ts.map +1 -0
- package/dist/config/models.js +354 -0
- package/dist/config/models.js.map +1 -0
- package/dist/config/routing.d.ts +118 -0
- package/dist/config/routing.d.ts.map +1 -0
- package/dist/config/routing.js +247 -0
- package/dist/config/routing.js.map +1 -0
- package/dist/config/schema.d.ts +72 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +63 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/coordinator/coordinator.d.ts +82 -0
- package/dist/coordinator/coordinator.d.ts.map +1 -0
- package/dist/coordinator/coordinator.js +174 -0
- package/dist/coordinator/coordinator.js.map +1 -0
- package/dist/coordinator/direct-response.d.ts +83 -0
- package/dist/coordinator/direct-response.d.ts.map +1 -0
- package/dist/coordinator/direct-response.js +187 -0
- package/dist/coordinator/direct-response.js.map +1 -0
- package/dist/coordinator/fan-out.d.ts +83 -0
- package/dist/coordinator/fan-out.d.ts.map +1 -0
- package/dist/coordinator/fan-out.js +161 -0
- package/dist/coordinator/fan-out.js.map +1 -0
- package/dist/coordinator/index.d.ts +47 -0
- package/dist/coordinator/index.d.ts.map +1 -0
- package/dist/coordinator/index.js +54 -0
- package/dist/coordinator/index.js.map +1 -0
- package/dist/coordinator/response-tiers.d.ts +49 -0
- package/dist/coordinator/response-tiers.d.ts.map +1 -0
- package/dist/coordinator/response-tiers.js +149 -0
- package/dist/coordinator/response-tiers.js.map +1 -0
- package/dist/hooks/index.d.ts +103 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +279 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +24 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/marketplace/backend.d.ts +35 -0
- package/dist/marketplace/backend.d.ts.map +1 -0
- package/dist/marketplace/backend.js +99 -0
- package/dist/marketplace/backend.js.map +1 -0
- package/dist/marketplace/browser.d.ts +33 -0
- package/dist/marketplace/browser.d.ts.map +1 -0
- package/dist/marketplace/browser.js +97 -0
- package/dist/marketplace/browser.js.map +1 -0
- package/dist/marketplace/extension-adapter.d.ts +51 -0
- package/dist/marketplace/extension-adapter.d.ts.map +1 -0
- package/dist/marketplace/extension-adapter.js +81 -0
- package/dist/marketplace/extension-adapter.js.map +1 -0
- package/dist/marketplace/index.d.ts +51 -0
- package/dist/marketplace/index.d.ts.map +1 -0
- package/dist/marketplace/index.js +108 -0
- package/dist/marketplace/index.js.map +1 -0
- package/dist/marketplace/packaging.d.ts +25 -0
- package/dist/marketplace/packaging.d.ts.map +1 -0
- package/dist/marketplace/packaging.js +117 -0
- package/dist/marketplace/packaging.js.map +1 -0
- package/dist/marketplace/schema.d.ts +50 -0
- package/dist/marketplace/schema.d.ts.map +1 -0
- package/dist/marketplace/schema.js +120 -0
- package/dist/marketplace/schema.js.map +1 -0
- package/dist/marketplace/security.d.ts +26 -0
- package/dist/marketplace/security.d.ts.map +1 -0
- package/dist/marketplace/security.js +199 -0
- package/dist/marketplace/security.js.map +1 -0
- package/dist/parsers.d.ts +15 -0
- package/dist/parsers.d.ts.map +1 -0
- package/dist/parsers.js +15 -0
- package/dist/parsers.js.map +1 -0
- package/dist/ralph/index.d.ts +56 -0
- package/dist/ralph/index.d.ts.map +1 -0
- package/dist/ralph/index.js +61 -0
- package/dist/ralph/index.js.map +1 -0
- package/dist/resolution.d.ts +47 -0
- package/dist/resolution.d.ts.map +1 -0
- package/dist/resolution.js +106 -0
- package/dist/resolution.js.map +1 -0
- package/dist/runtime/benchmarks.d.ts +121 -0
- package/dist/runtime/benchmarks.d.ts.map +1 -0
- package/dist/runtime/benchmarks.js +251 -0
- package/dist/runtime/benchmarks.js.map +1 -0
- package/dist/runtime/config.d.ts +313 -0
- package/dist/runtime/config.d.ts.map +1 -0
- package/dist/runtime/config.js +466 -0
- package/dist/runtime/config.js.map +1 -0
- package/dist/runtime/cost-tracker.d.ts +73 -0
- package/dist/runtime/cost-tracker.d.ts.map +1 -0
- package/dist/runtime/cost-tracker.js +157 -0
- package/dist/runtime/cost-tracker.js.map +1 -0
- package/dist/runtime/event-bus.d.ts +190 -0
- package/dist/runtime/event-bus.d.ts.map +1 -0
- package/dist/runtime/event-bus.js +218 -0
- package/dist/runtime/event-bus.js.map +1 -0
- package/dist/runtime/health.d.ts +66 -0
- package/dist/runtime/health.d.ts.map +1 -0
- package/dist/runtime/health.js +111 -0
- package/dist/runtime/health.js.map +1 -0
- package/dist/runtime/i18n.d.ts +54 -0
- package/dist/runtime/i18n.d.ts.map +1 -0
- package/dist/runtime/i18n.js +126 -0
- package/dist/runtime/i18n.js.map +1 -0
- package/dist/runtime/offline.d.ts +64 -0
- package/dist/runtime/offline.d.ts.map +1 -0
- package/dist/runtime/offline.js +108 -0
- package/dist/runtime/offline.js.map +1 -0
- package/dist/runtime/streaming.d.ts +97 -0
- package/dist/runtime/streaming.d.ts.map +1 -0
- package/dist/runtime/streaming.js +156 -0
- package/dist/runtime/streaming.js.map +1 -0
- package/dist/runtime/telemetry.d.ts +82 -0
- package/dist/runtime/telemetry.d.ts.map +1 -0
- package/dist/runtime/telemetry.js +120 -0
- package/dist/runtime/telemetry.js.map +1 -0
- package/dist/sharing/agent-repo.d.ts +33 -0
- package/dist/sharing/agent-repo.d.ts.map +1 -0
- package/dist/sharing/agent-repo.js +79 -0
- package/dist/sharing/agent-repo.js.map +1 -0
- package/dist/sharing/cache.d.ts +36 -0
- package/dist/sharing/cache.d.ts.map +1 -0
- package/dist/sharing/cache.js +85 -0
- package/dist/sharing/cache.js.map +1 -0
- package/dist/sharing/conflicts.d.ts +32 -0
- package/dist/sharing/conflicts.d.ts.map +1 -0
- package/dist/sharing/conflicts.js +121 -0
- package/dist/sharing/conflicts.js.map +1 -0
- package/dist/sharing/export.d.ts +50 -0
- package/dist/sharing/export.d.ts.map +1 -0
- package/dist/sharing/export.js +156 -0
- package/dist/sharing/export.js.map +1 -0
- package/dist/sharing/history-split.d.ts +34 -0
- package/dist/sharing/history-split.d.ts.map +1 -0
- package/dist/sharing/history-split.js +101 -0
- package/dist/sharing/history-split.js.map +1 -0
- package/dist/sharing/import.d.ts +37 -0
- package/dist/sharing/import.d.ts.map +1 -0
- package/dist/sharing/import.js +138 -0
- package/dist/sharing/import.js.map +1 -0
- package/dist/sharing/index.d.ts +11 -0
- package/dist/sharing/index.d.ts.map +1 -0
- package/dist/sharing/index.js +11 -0
- package/dist/sharing/index.js.map +1 -0
- package/dist/sharing/versioning.d.ts +32 -0
- package/dist/sharing/versioning.d.ts.map +1 -0
- package/dist/sharing/versioning.js +64 -0
- package/dist/sharing/versioning.js.map +1 -0
- package/dist/skills/index.d.ts +49 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +85 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/skill-loader.d.ts +56 -0
- package/dist/skills/skill-loader.d.ts.map +1 -0
- package/dist/skills/skill-loader.js +106 -0
- package/dist/skills/skill-loader.js.map +1 -0
- package/dist/skills/skill-source.d.ts +63 -0
- package/dist/skills/skill-source.d.ts.map +1 -0
- package/dist/skills/skill-source.js +199 -0
- package/dist/skills/skill-source.js.map +1 -0
- package/dist/tools/index.d.ts +87 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +419 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types.d.ts +43 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/normalize-eol.d.ts +6 -0
- package/dist/utils/normalize-eol.d.ts.map +1 -0
- package/dist/utils/normalize-eol.js +8 -0
- package/dist/utils/normalize-eol.js.map +1 -0
- package/package.json +115 -63
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Error Hierarchy and Telemetry (M0-6, Issue #78)
|
|
3
|
+
*
|
|
4
|
+
* Wraps Copilot SDK errors with Squad-specific context and diagnostic information.
|
|
5
|
+
* Provides a comprehensive error hierarchy for SDK-specific exceptions.
|
|
6
|
+
* Includes basic telemetry hooks for latency tracking and error rate monitoring.
|
|
7
|
+
*
|
|
8
|
+
* @module adapter/errors
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Error severity levels for classification and routing.
|
|
12
|
+
*/
|
|
13
|
+
export declare enum ErrorSeverity {
|
|
14
|
+
/** Informational — no action needed, logged for awareness */
|
|
15
|
+
INFO = "info",
|
|
16
|
+
/** Warning — degraded functionality but operation can continue */
|
|
17
|
+
WARNING = "warning",
|
|
18
|
+
/** Error — operation failed but system remains stable */
|
|
19
|
+
ERROR = "error",
|
|
20
|
+
/** Critical — system stability at risk, requires immediate attention */
|
|
21
|
+
CRITICAL = "critical"
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Error categories for diagnostic routing.
|
|
25
|
+
*/
|
|
26
|
+
export declare enum ErrorCategory {
|
|
27
|
+
/** SDK connection or communication errors */
|
|
28
|
+
SDK_CONNECTION = "sdk_connection",
|
|
29
|
+
/** Session lifecycle errors (create, resume, close) */
|
|
30
|
+
SESSION_LIFECYCLE = "session_lifecycle",
|
|
31
|
+
/** Tool execution failures */
|
|
32
|
+
TOOL_EXECUTION = "tool_execution",
|
|
33
|
+
/** Model API call failures */
|
|
34
|
+
MODEL_API = "model_api",
|
|
35
|
+
/** Configuration errors */
|
|
36
|
+
CONFIGURATION = "configuration",
|
|
37
|
+
/** Authentication and authorization failures */
|
|
38
|
+
AUTH = "auth",
|
|
39
|
+
/** Rate limiting and quota errors */
|
|
40
|
+
RATE_LIMIT = "rate_limit",
|
|
41
|
+
/** Internal Squad runtime errors */
|
|
42
|
+
RUNTIME = "runtime",
|
|
43
|
+
/** Validation errors (invalid input) */
|
|
44
|
+
VALIDATION = "validation",
|
|
45
|
+
/** Unknown or uncategorized errors */
|
|
46
|
+
UNKNOWN = "unknown"
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Diagnostic context for error reporting.
|
|
50
|
+
* Includes metadata to help identify and resolve issues.
|
|
51
|
+
*/
|
|
52
|
+
export interface ErrorContext {
|
|
53
|
+
/** Session ID where error occurred (if applicable) */
|
|
54
|
+
sessionId?: string;
|
|
55
|
+
/** Agent name (if applicable) */
|
|
56
|
+
agentName?: string;
|
|
57
|
+
/** Tool name (if tool execution error) */
|
|
58
|
+
toolName?: string;
|
|
59
|
+
/** Model being used (if model API error) */
|
|
60
|
+
model?: string;
|
|
61
|
+
/** Operation being performed when error occurred */
|
|
62
|
+
operation?: string;
|
|
63
|
+
/** Additional diagnostic data */
|
|
64
|
+
metadata?: Record<string, unknown>;
|
|
65
|
+
/** Stack trace from original error */
|
|
66
|
+
originalStack?: string;
|
|
67
|
+
/** Timestamp when error occurred */
|
|
68
|
+
timestamp: Date;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Base error class for all Squad SDK errors.
|
|
72
|
+
* Wraps SDK exceptions with Squad context and diagnostic information.
|
|
73
|
+
*/
|
|
74
|
+
export declare class SquadError extends Error {
|
|
75
|
+
readonly severity: ErrorSeverity;
|
|
76
|
+
readonly category: ErrorCategory;
|
|
77
|
+
readonly context: ErrorContext;
|
|
78
|
+
readonly recoverable: boolean;
|
|
79
|
+
readonly originalError?: Error;
|
|
80
|
+
/**
|
|
81
|
+
* Create a new Squad error.
|
|
82
|
+
*
|
|
83
|
+
* @param message - User-friendly error message
|
|
84
|
+
* @param severity - Error severity level
|
|
85
|
+
* @param category - Error category for routing
|
|
86
|
+
* @param context - Diagnostic context
|
|
87
|
+
* @param recoverable - Whether the operation can be retried
|
|
88
|
+
* @param originalError - Original SDK error (if wrapping)
|
|
89
|
+
*/
|
|
90
|
+
constructor(message: string, severity: ErrorSeverity, category: ErrorCategory, context: ErrorContext, recoverable?: boolean, originalError?: Error);
|
|
91
|
+
/**
|
|
92
|
+
* Convert error to JSON for logging/telemetry.
|
|
93
|
+
*/
|
|
94
|
+
toJSON(): Record<string, unknown>;
|
|
95
|
+
/**
|
|
96
|
+
* Get user-friendly error message with context.
|
|
97
|
+
*/
|
|
98
|
+
getUserMessage(): string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* SDK connection error — failed to connect to Copilot SDK.
|
|
102
|
+
*/
|
|
103
|
+
export declare class SDKConnectionError extends SquadError {
|
|
104
|
+
constructor(message: string, context: ErrorContext, originalError?: Error);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Session lifecycle error — failed to create, resume, or close a session.
|
|
108
|
+
*/
|
|
109
|
+
export declare class SessionLifecycleError extends SquadError {
|
|
110
|
+
constructor(message: string, context: ErrorContext, recoverable?: boolean, originalError?: Error);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Tool execution error — custom tool failed during execution.
|
|
114
|
+
*/
|
|
115
|
+
export declare class ToolExecutionError extends SquadError {
|
|
116
|
+
constructor(message: string, context: ErrorContext, originalError?: Error);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Model API error — LLM API call failed.
|
|
120
|
+
*/
|
|
121
|
+
export declare class ModelAPIError extends SquadError {
|
|
122
|
+
constructor(message: string, context: ErrorContext, recoverable?: boolean, originalError?: Error);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Configuration error — invalid or missing configuration.
|
|
126
|
+
*/
|
|
127
|
+
export declare class ConfigurationError extends SquadError {
|
|
128
|
+
constructor(message: string, context: ErrorContext, originalError?: Error);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Authentication error — auth failure (token, permissions).
|
|
132
|
+
*/
|
|
133
|
+
export declare class AuthenticationError extends SquadError {
|
|
134
|
+
constructor(message: string, context: ErrorContext, originalError?: Error);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Rate limit error — API rate limit exceeded.
|
|
138
|
+
*/
|
|
139
|
+
export declare class RateLimitError extends SquadError {
|
|
140
|
+
readonly retryAfter?: number;
|
|
141
|
+
constructor(message: string, context: ErrorContext, retryAfter?: number, originalError?: Error);
|
|
142
|
+
getUserMessage(): string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Runtime error — internal Squad runtime failure.
|
|
146
|
+
*/
|
|
147
|
+
export declare class RuntimeError extends SquadError {
|
|
148
|
+
constructor(message: string, context: ErrorContext, originalError?: Error);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Validation error — invalid input or parameters.
|
|
152
|
+
*/
|
|
153
|
+
export declare class ValidationError extends SquadError {
|
|
154
|
+
constructor(message: string, context: ErrorContext, originalError?: Error);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Factory for creating Squad errors from SDK errors.
|
|
158
|
+
* Maps SDK error patterns to appropriate Squad error types.
|
|
159
|
+
*/
|
|
160
|
+
export declare class ErrorFactory {
|
|
161
|
+
/**
|
|
162
|
+
* Wrap an SDK error with Squad context.
|
|
163
|
+
* Automatically detects error type and maps to appropriate Squad error class.
|
|
164
|
+
*
|
|
165
|
+
* @param error - Original SDK error
|
|
166
|
+
* @param context - Squad diagnostic context
|
|
167
|
+
* @returns Squad error with full context
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* try {
|
|
172
|
+
* await session.sendMessage({ prompt: 'Hello' });
|
|
173
|
+
* } catch (err) {
|
|
174
|
+
* throw ErrorFactory.wrap(err, {
|
|
175
|
+
* sessionId: 'abc-123',
|
|
176
|
+
* operation: 'sendMessage',
|
|
177
|
+
* timestamp: new Date()
|
|
178
|
+
* });
|
|
179
|
+
* }
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
static wrap(error: unknown, context: Partial<ErrorContext>): SquadError;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Telemetry data point for tracking operations.
|
|
186
|
+
*/
|
|
187
|
+
export interface TelemetryPoint {
|
|
188
|
+
/** Operation name */
|
|
189
|
+
operation: string;
|
|
190
|
+
/** Duration in milliseconds */
|
|
191
|
+
duration: number;
|
|
192
|
+
/** Success or failure */
|
|
193
|
+
success: boolean;
|
|
194
|
+
/** Error category (if failed) */
|
|
195
|
+
errorCategory?: ErrorCategory;
|
|
196
|
+
/** Session ID */
|
|
197
|
+
sessionId?: string;
|
|
198
|
+
/** Agent name */
|
|
199
|
+
agentName?: string;
|
|
200
|
+
/** Additional metadata */
|
|
201
|
+
metadata?: Record<string, unknown>;
|
|
202
|
+
/** Timestamp */
|
|
203
|
+
timestamp: Date;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Telemetry handler function.
|
|
207
|
+
*/
|
|
208
|
+
export type TelemetryHandler = (point: TelemetryPoint) => void | Promise<void>;
|
|
209
|
+
/**
|
|
210
|
+
* Telemetry collector for tracking latency and error rates.
|
|
211
|
+
*
|
|
212
|
+
* Usage:
|
|
213
|
+
* ```typescript
|
|
214
|
+
* const telemetry = new TelemetryCollector();
|
|
215
|
+
*
|
|
216
|
+
* // Register handler
|
|
217
|
+
* telemetry.onData((point) => {
|
|
218
|
+
* console.log(`${point.operation}: ${point.duration}ms`);
|
|
219
|
+
* });
|
|
220
|
+
*
|
|
221
|
+
* // Track operation
|
|
222
|
+
* const stopwatch = telemetry.start('session.create', { sessionId: 'abc-123' });
|
|
223
|
+
* try {
|
|
224
|
+
* await createSession();
|
|
225
|
+
* stopwatch.success();
|
|
226
|
+
* } catch (err) {
|
|
227
|
+
* stopwatch.failure(err);
|
|
228
|
+
* }
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
export declare class TelemetryCollector {
|
|
232
|
+
private handlers;
|
|
233
|
+
/**
|
|
234
|
+
* Register a telemetry data handler.
|
|
235
|
+
*
|
|
236
|
+
* @param handler - Handler function to receive telemetry points
|
|
237
|
+
* @returns Unsubscribe function
|
|
238
|
+
*/
|
|
239
|
+
onData(handler: TelemetryHandler): () => void;
|
|
240
|
+
/**
|
|
241
|
+
* Start tracking an operation.
|
|
242
|
+
*
|
|
243
|
+
* @param operation - Operation name
|
|
244
|
+
* @param context - Additional context
|
|
245
|
+
* @returns Stopwatch object with success/failure methods
|
|
246
|
+
*/
|
|
247
|
+
start(operation: string, context?: {
|
|
248
|
+
sessionId?: string;
|
|
249
|
+
agentName?: string;
|
|
250
|
+
metadata?: Record<string, unknown>;
|
|
251
|
+
}): {
|
|
252
|
+
success: () => void;
|
|
253
|
+
failure: (error: unknown) => void;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Clear all handlers.
|
|
257
|
+
*/
|
|
258
|
+
clear(): void;
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/adapter/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;GAEG;AACH,oBAAY,aAAa;IACvB,6DAA6D;IAC7D,IAAI,SAAS;IACb,kEAAkE;IAClE,OAAO,YAAY;IACnB,yDAAyD;IACzD,KAAK,UAAU;IACf,wEAAwE;IACxE,QAAQ,aAAa;CACtB;AAED;;GAEG;AACH,oBAAY,aAAa;IACvB,6CAA6C;IAC7C,cAAc,mBAAmB;IACjC,uDAAuD;IACvD,iBAAiB,sBAAsB;IACvC,8BAA8B;IAC9B,cAAc,mBAAmB;IACjC,8BAA8B;IAC9B,SAAS,cAAc;IACvB,2BAA2B;IAC3B,aAAa,kBAAkB;IAC/B,gDAAgD;IAChD,IAAI,SAAS;IACb,qCAAqC;IACrC,UAAU,eAAe;IACzB,oCAAoC;IACpC,OAAO,YAAY;IACnB,wCAAwC;IACxC,UAAU,eAAe;IACzB,sCAAsC;IACtC,OAAO,YAAY;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,C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AyB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,iCAAiC;IACjC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,gBAAgB;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAoC;IAEpD;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,IAAI;IAK7C;;;;;;OAMG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG;QAClH,OAAO,EAAE,MAAM,IAAI,CAAC;QACpB,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;KACnC;IAsCD;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Error Hierarchy and Telemetry (M0-6, Issue #78)
|
|
3
|
+
*
|
|
4
|
+
* Wraps Copilot SDK errors with Squad-specific context and diagnostic information.
|
|
5
|
+
* Provides a comprehensive error hierarchy for SDK-specific exceptions.
|
|
6
|
+
* Includes basic telemetry hooks for latency tracking and error rate monitoring.
|
|
7
|
+
*
|
|
8
|
+
* @module adapter/errors
|
|
9
|
+
*/
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Base Error Types
|
|
12
|
+
// ============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* Error severity levels for classification and routing.
|
|
15
|
+
*/
|
|
16
|
+
export var ErrorSeverity;
|
|
17
|
+
(function (ErrorSeverity) {
|
|
18
|
+
/** Informational — no action needed, logged for awareness */
|
|
19
|
+
ErrorSeverity["INFO"] = "info";
|
|
20
|
+
/** Warning — degraded functionality but operation can continue */
|
|
21
|
+
ErrorSeverity["WARNING"] = "warning";
|
|
22
|
+
/** Error — operation failed but system remains stable */
|
|
23
|
+
ErrorSeverity["ERROR"] = "error";
|
|
24
|
+
/** Critical — system stability at risk, requires immediate attention */
|
|
25
|
+
ErrorSeverity["CRITICAL"] = "critical";
|
|
26
|
+
})(ErrorSeverity || (ErrorSeverity = {}));
|
|
27
|
+
/**
|
|
28
|
+
* Error categories for diagnostic routing.
|
|
29
|
+
*/
|
|
30
|
+
export var ErrorCategory;
|
|
31
|
+
(function (ErrorCategory) {
|
|
32
|
+
/** SDK connection or communication errors */
|
|
33
|
+
ErrorCategory["SDK_CONNECTION"] = "sdk_connection";
|
|
34
|
+
/** Session lifecycle errors (create, resume, close) */
|
|
35
|
+
ErrorCategory["SESSION_LIFECYCLE"] = "session_lifecycle";
|
|
36
|
+
/** Tool execution failures */
|
|
37
|
+
ErrorCategory["TOOL_EXECUTION"] = "tool_execution";
|
|
38
|
+
/** Model API call failures */
|
|
39
|
+
ErrorCategory["MODEL_API"] = "model_api";
|
|
40
|
+
/** Configuration errors */
|
|
41
|
+
ErrorCategory["CONFIGURATION"] = "configuration";
|
|
42
|
+
/** Authentication and authorization failures */
|
|
43
|
+
ErrorCategory["AUTH"] = "auth";
|
|
44
|
+
/** Rate limiting and quota errors */
|
|
45
|
+
ErrorCategory["RATE_LIMIT"] = "rate_limit";
|
|
46
|
+
/** Internal Squad runtime errors */
|
|
47
|
+
ErrorCategory["RUNTIME"] = "runtime";
|
|
48
|
+
/** Validation errors (invalid input) */
|
|
49
|
+
ErrorCategory["VALIDATION"] = "validation";
|
|
50
|
+
/** Unknown or uncategorized errors */
|
|
51
|
+
ErrorCategory["UNKNOWN"] = "unknown";
|
|
52
|
+
})(ErrorCategory || (ErrorCategory = {}));
|
|
53
|
+
/**
|
|
54
|
+
* Base error class for all Squad SDK errors.
|
|
55
|
+
* Wraps SDK exceptions with Squad context and diagnostic information.
|
|
56
|
+
*/
|
|
57
|
+
export class SquadError extends Error {
|
|
58
|
+
severity;
|
|
59
|
+
category;
|
|
60
|
+
context;
|
|
61
|
+
recoverable;
|
|
62
|
+
originalError;
|
|
63
|
+
/**
|
|
64
|
+
* Create a new Squad error.
|
|
65
|
+
*
|
|
66
|
+
* @param message - User-friendly error message
|
|
67
|
+
* @param severity - Error severity level
|
|
68
|
+
* @param category - Error category for routing
|
|
69
|
+
* @param context - Diagnostic context
|
|
70
|
+
* @param recoverable - Whether the operation can be retried
|
|
71
|
+
* @param originalError - Original SDK error (if wrapping)
|
|
72
|
+
*/
|
|
73
|
+
constructor(message, severity, category, context, recoverable = false, originalError) {
|
|
74
|
+
super(message);
|
|
75
|
+
this.name = 'SquadError';
|
|
76
|
+
this.severity = severity;
|
|
77
|
+
this.category = category;
|
|
78
|
+
this.context = context;
|
|
79
|
+
this.recoverable = recoverable;
|
|
80
|
+
this.originalError = originalError;
|
|
81
|
+
// Maintain proper stack trace
|
|
82
|
+
if (Error.captureStackTrace) {
|
|
83
|
+
Error.captureStackTrace(this, this.constructor);
|
|
84
|
+
}
|
|
85
|
+
// Preserve original stack if available
|
|
86
|
+
if (originalError?.stack) {
|
|
87
|
+
this.context.originalStack = originalError.stack;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Convert error to JSON for logging/telemetry.
|
|
92
|
+
*/
|
|
93
|
+
toJSON() {
|
|
94
|
+
return {
|
|
95
|
+
name: this.name,
|
|
96
|
+
message: this.message,
|
|
97
|
+
severity: this.severity,
|
|
98
|
+
category: this.category,
|
|
99
|
+
recoverable: this.recoverable,
|
|
100
|
+
context: this.context,
|
|
101
|
+
stack: this.stack,
|
|
102
|
+
originalError: this.originalError?.message
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get user-friendly error message with context.
|
|
107
|
+
*/
|
|
108
|
+
getUserMessage() {
|
|
109
|
+
const parts = [this.message];
|
|
110
|
+
if (this.context.sessionId) {
|
|
111
|
+
parts.push(`(Session: ${this.context.sessionId})`);
|
|
112
|
+
}
|
|
113
|
+
if (this.context.agentName) {
|
|
114
|
+
parts.push(`(Agent: ${this.context.agentName})`);
|
|
115
|
+
}
|
|
116
|
+
if (this.recoverable) {
|
|
117
|
+
parts.push('— This error is recoverable. You may retry the operation.');
|
|
118
|
+
}
|
|
119
|
+
return parts.join(' ');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// ============================================================================
|
|
123
|
+
// Specific Error Types
|
|
124
|
+
// ============================================================================
|
|
125
|
+
/**
|
|
126
|
+
* SDK connection error — failed to connect to Copilot SDK.
|
|
127
|
+
*/
|
|
128
|
+
export class SDKConnectionError extends SquadError {
|
|
129
|
+
constructor(message, context, originalError) {
|
|
130
|
+
super(message, ErrorSeverity.ERROR, ErrorCategory.SDK_CONNECTION, context, true, originalError);
|
|
131
|
+
this.name = 'SDKConnectionError';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Session lifecycle error — failed to create, resume, or close a session.
|
|
136
|
+
*/
|
|
137
|
+
export class SessionLifecycleError extends SquadError {
|
|
138
|
+
constructor(message, context, recoverable = false, originalError) {
|
|
139
|
+
super(message, ErrorSeverity.ERROR, ErrorCategory.SESSION_LIFECYCLE, context, recoverable, originalError);
|
|
140
|
+
this.name = 'SessionLifecycleError';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Tool execution error — custom tool failed during execution.
|
|
145
|
+
*/
|
|
146
|
+
export class ToolExecutionError extends SquadError {
|
|
147
|
+
constructor(message, context, originalError) {
|
|
148
|
+
super(message, ErrorSeverity.ERROR, ErrorCategory.TOOL_EXECUTION, context, false, originalError);
|
|
149
|
+
this.name = 'ToolExecutionError';
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Model API error — LLM API call failed.
|
|
154
|
+
*/
|
|
155
|
+
export class ModelAPIError extends SquadError {
|
|
156
|
+
constructor(message, context, recoverable = true, originalError) {
|
|
157
|
+
super(message, ErrorSeverity.ERROR, ErrorCategory.MODEL_API, context, recoverable, originalError);
|
|
158
|
+
this.name = 'ModelAPIError';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Configuration error — invalid or missing configuration.
|
|
163
|
+
*/
|
|
164
|
+
export class ConfigurationError extends SquadError {
|
|
165
|
+
constructor(message, context, originalError) {
|
|
166
|
+
super(message, ErrorSeverity.ERROR, ErrorCategory.CONFIGURATION, context, false, originalError);
|
|
167
|
+
this.name = 'ConfigurationError';
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Authentication error — auth failure (token, permissions).
|
|
172
|
+
*/
|
|
173
|
+
export class AuthenticationError extends SquadError {
|
|
174
|
+
constructor(message, context, originalError) {
|
|
175
|
+
super(message, ErrorSeverity.CRITICAL, ErrorCategory.AUTH, context, false, originalError);
|
|
176
|
+
this.name = 'AuthenticationError';
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Rate limit error — API rate limit exceeded.
|
|
181
|
+
*/
|
|
182
|
+
export class RateLimitError extends SquadError {
|
|
183
|
+
retryAfter;
|
|
184
|
+
constructor(message, context, retryAfter, originalError) {
|
|
185
|
+
super(message, ErrorSeverity.WARNING, ErrorCategory.RATE_LIMIT, context, true, originalError);
|
|
186
|
+
this.name = 'RateLimitError';
|
|
187
|
+
this.retryAfter = retryAfter;
|
|
188
|
+
}
|
|
189
|
+
getUserMessage() {
|
|
190
|
+
const baseMessage = super.getUserMessage();
|
|
191
|
+
if (this.retryAfter) {
|
|
192
|
+
return `${baseMessage} Retry after ${this.retryAfter} seconds.`;
|
|
193
|
+
}
|
|
194
|
+
return baseMessage;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Runtime error — internal Squad runtime failure.
|
|
199
|
+
*/
|
|
200
|
+
export class RuntimeError extends SquadError {
|
|
201
|
+
constructor(message, context, originalError) {
|
|
202
|
+
super(message, ErrorSeverity.CRITICAL, ErrorCategory.RUNTIME, context, false, originalError);
|
|
203
|
+
this.name = 'RuntimeError';
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Validation error — invalid input or parameters.
|
|
208
|
+
*/
|
|
209
|
+
export class ValidationError extends SquadError {
|
|
210
|
+
constructor(message, context, originalError) {
|
|
211
|
+
super(message, ErrorSeverity.ERROR, ErrorCategory.VALIDATION, context, false, originalError);
|
|
212
|
+
this.name = 'ValidationError';
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// ============================================================================
|
|
216
|
+
// Error Factory
|
|
217
|
+
// ============================================================================
|
|
218
|
+
/**
|
|
219
|
+
* Factory for creating Squad errors from SDK errors.
|
|
220
|
+
* Maps SDK error patterns to appropriate Squad error types.
|
|
221
|
+
*/
|
|
222
|
+
export class ErrorFactory {
|
|
223
|
+
/**
|
|
224
|
+
* Wrap an SDK error with Squad context.
|
|
225
|
+
* Automatically detects error type and maps to appropriate Squad error class.
|
|
226
|
+
*
|
|
227
|
+
* @param error - Original SDK error
|
|
228
|
+
* @param context - Squad diagnostic context
|
|
229
|
+
* @returns Squad error with full context
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```typescript
|
|
233
|
+
* try {
|
|
234
|
+
* await session.sendMessage({ prompt: 'Hello' });
|
|
235
|
+
* } catch (err) {
|
|
236
|
+
* throw ErrorFactory.wrap(err, {
|
|
237
|
+
* sessionId: 'abc-123',
|
|
238
|
+
* operation: 'sendMessage',
|
|
239
|
+
* timestamp: new Date()
|
|
240
|
+
* });
|
|
241
|
+
* }
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
static wrap(error, context) {
|
|
245
|
+
const fullContext = {
|
|
246
|
+
timestamp: new Date(),
|
|
247
|
+
...context
|
|
248
|
+
};
|
|
249
|
+
const originalError = error instanceof Error ? error : undefined;
|
|
250
|
+
const message = originalError?.message ?? String(error);
|
|
251
|
+
// Pattern matching on error message to categorize
|
|
252
|
+
if (message.includes('connection') || message.includes('ECONNREFUSED') || message.includes('ETIMEDOUT')) {
|
|
253
|
+
return new SDKConnectionError(`Failed to connect to Copilot SDK: ${message}`, fullContext, originalError);
|
|
254
|
+
}
|
|
255
|
+
if (message.includes('session') && (message.includes('create') || message.includes('resume'))) {
|
|
256
|
+
return new SessionLifecycleError(`Session lifecycle error: ${message}`, fullContext, true, originalError);
|
|
257
|
+
}
|
|
258
|
+
if (message.includes('auth') || message.includes('token') || message.includes('unauthorized')) {
|
|
259
|
+
return new AuthenticationError(`Authentication failed: ${message}`, fullContext, originalError);
|
|
260
|
+
}
|
|
261
|
+
if (message.includes('rate limit') || message.includes('429') || message.includes('quota')) {
|
|
262
|
+
const retryMatch = message.match(/retry after (\d+)/i);
|
|
263
|
+
const retryAfter = retryMatch ? parseInt(retryMatch[1], 10) : undefined;
|
|
264
|
+
return new RateLimitError(`Rate limit exceeded: ${message}`, fullContext, retryAfter, originalError);
|
|
265
|
+
}
|
|
266
|
+
if (message.includes('model') || message.includes('API') || message.includes('provider')) {
|
|
267
|
+
return new ModelAPIError(`Model API error: ${message}`, fullContext, true, originalError);
|
|
268
|
+
}
|
|
269
|
+
if (message.includes('config') || message.includes('invalid') || message.includes('missing')) {
|
|
270
|
+
return new ConfigurationError(`Configuration error: ${message}`, fullContext, originalError);
|
|
271
|
+
}
|
|
272
|
+
if (context.toolName) {
|
|
273
|
+
return new ToolExecutionError(`Tool execution failed: ${message}`, fullContext, originalError);
|
|
274
|
+
}
|
|
275
|
+
// Default to generic Squad error
|
|
276
|
+
return new SquadError(message, ErrorSeverity.ERROR, ErrorCategory.UNKNOWN, fullContext, false, originalError);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Telemetry collector for tracking latency and error rates.
|
|
281
|
+
*
|
|
282
|
+
* Usage:
|
|
283
|
+
* ```typescript
|
|
284
|
+
* const telemetry = new TelemetryCollector();
|
|
285
|
+
*
|
|
286
|
+
* // Register handler
|
|
287
|
+
* telemetry.onData((point) => {
|
|
288
|
+
* console.log(`${point.operation}: ${point.duration}ms`);
|
|
289
|
+
* });
|
|
290
|
+
*
|
|
291
|
+
* // Track operation
|
|
292
|
+
* const stopwatch = telemetry.start('session.create', { sessionId: 'abc-123' });
|
|
293
|
+
* try {
|
|
294
|
+
* await createSession();
|
|
295
|
+
* stopwatch.success();
|
|
296
|
+
* } catch (err) {
|
|
297
|
+
* stopwatch.failure(err);
|
|
298
|
+
* }
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
export class TelemetryCollector {
|
|
302
|
+
handlers = new Set();
|
|
303
|
+
/**
|
|
304
|
+
* Register a telemetry data handler.
|
|
305
|
+
*
|
|
306
|
+
* @param handler - Handler function to receive telemetry points
|
|
307
|
+
* @returns Unsubscribe function
|
|
308
|
+
*/
|
|
309
|
+
onData(handler) {
|
|
310
|
+
this.handlers.add(handler);
|
|
311
|
+
return () => this.handlers.delete(handler);
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Start tracking an operation.
|
|
315
|
+
*
|
|
316
|
+
* @param operation - Operation name
|
|
317
|
+
* @param context - Additional context
|
|
318
|
+
* @returns Stopwatch object with success/failure methods
|
|
319
|
+
*/
|
|
320
|
+
start(operation, context) {
|
|
321
|
+
const startTime = Date.now();
|
|
322
|
+
const timestamp = new Date();
|
|
323
|
+
const record = (success, errorCategory) => {
|
|
324
|
+
const duration = Date.now() - startTime;
|
|
325
|
+
const point = {
|
|
326
|
+
operation,
|
|
327
|
+
duration,
|
|
328
|
+
success,
|
|
329
|
+
errorCategory,
|
|
330
|
+
sessionId: context?.sessionId,
|
|
331
|
+
agentName: context?.agentName,
|
|
332
|
+
metadata: context?.metadata,
|
|
333
|
+
timestamp
|
|
334
|
+
};
|
|
335
|
+
for (const handler of this.handlers) {
|
|
336
|
+
try {
|
|
337
|
+
const result = handler(point);
|
|
338
|
+
if (result instanceof Promise) {
|
|
339
|
+
result.catch((err) => console.error('Telemetry handler error:', err));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
catch (err) {
|
|
343
|
+
console.error('Telemetry handler error:', err);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
return {
|
|
348
|
+
success: () => record(true),
|
|
349
|
+
failure: (error) => {
|
|
350
|
+
const category = error instanceof SquadError ? error.category : ErrorCategory.UNKNOWN;
|
|
351
|
+
record(false, category);
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Clear all handlers.
|
|
357
|
+
*/
|
|
358
|
+
clear() {
|
|
359
|
+
this.handlers.clear();
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/adapter/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAN,IAAY,aASX;AATD,WAAY,aAAa;IACvB,6DAA6D;IAC7D,8BAAa,CAAA;IACb,kEAAkE;IAClE,oCAAmB,CAAA;IACnB,yDAAyD;IACzD,gCAAe,CAAA;IACf,wEAAwE;IACxE,sCAAqB,CAAA;A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