@talex-touch/utils 1.0.42 → 1.0.45
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/.eslintcache +1 -0
- package/__tests__/cloud-sync-sdk.test.ts +442 -0
- package/__tests__/icons/icons.test.ts +84 -0
- package/__tests__/plugin-sdk-lifecycle.test.ts +130 -0
- package/__tests__/power-sdk.test.ts +143 -0
- package/__tests__/preset-export-types.test.ts +108 -0
- package/__tests__/search/fuzzy-match.test.ts +137 -0
- package/__tests__/transport/port-policy.test.ts +44 -0
- package/__tests__/transport-domain-sdks.test.ts +152 -0
- package/__tests__/types/update.test.ts +67 -0
- package/account/account-sdk.ts +915 -0
- package/account/index.ts +2 -0
- package/account/types.ts +321 -0
- package/analytics/client.ts +136 -0
- package/analytics/index.ts +2 -0
- package/analytics/types.ts +156 -0
- package/animation/auto-resize.ts +322 -0
- package/animation/window-node.ts +26 -19
- package/auth/clerk-types.ts +12 -30
- package/auth/index.ts +0 -2
- package/auth/useAuthState.ts +6 -14
- package/base/index.ts +2 -0
- package/base/log-level.ts +105 -0
- package/channel/index.ts +170 -69
- package/cloud-sync/cloud-sync-sdk.ts +450 -0
- package/cloud-sync/index.ts +1 -0
- package/common/file-scan-utils.ts +17 -9
- package/common/index.ts +4 -0
- package/common/logger/index.ts +46 -0
- package/common/logger/logger-manager.ts +303 -0
- package/common/logger/module-logger.ts +270 -0
- package/common/logger/transport-logger.ts +234 -0
- package/common/logger/types.ts +93 -0
- package/common/search/gather.ts +48 -6
- package/common/search/index.ts +8 -0
- package/common/storage/constants.ts +13 -0
- package/common/storage/entity/app-settings.ts +245 -0
- package/common/storage/entity/index.ts +3 -0
- package/common/storage/entity/layout-atom-types.ts +147 -0
- package/common/storage/entity/openers.ts +1 -0
- package/common/storage/entity/preset-cloud-api.ts +132 -0
- package/common/storage/entity/preset-export-types.ts +256 -0
- package/common/storage/entity/shortcut-settings.ts +1 -0
- package/common/storage/shortcut-storage.ts +11 -0
- package/common/utils/clone-diagnostics.ts +105 -0
- package/common/utils/file.ts +16 -8
- package/common/utils/index.ts +6 -2
- package/common/utils/payload-preview.ts +173 -0
- package/common/utils/polling.ts +167 -13
- package/common/utils/safe-path.ts +103 -0
- package/common/utils/safe-shell.ts +115 -0
- package/common/utils/task-queue.ts +4 -1
- package/core-box/builder/tuff-builder.ts +0 -1
- package/core-box/index.ts +1 -1
- package/core-box/recommendation.ts +38 -1
- package/core-box/tuff/tuff-dsl.ts +32 -0
- package/electron/download-manager.ts +10 -7
- package/electron/env-tool.ts +42 -40
- package/electron/index.ts +0 -1
- package/env/index.ts +156 -0
- package/eslint.config.js +55 -0
- package/i18n/index.ts +62 -0
- package/i18n/locales/en.json +226 -0
- package/i18n/locales/zh.json +226 -0
- package/i18n/message-keys.ts +236 -0
- package/i18n/resolver.ts +181 -0
- package/icons/index.ts +257 -0
- package/icons/svg.ts +69 -0
- package/index.ts +9 -1
- package/intelligence/client.ts +72 -42
- package/market/constants.ts +9 -5
- package/market/index.ts +1 -1
- package/market/types.ts +19 -4
- package/package.json +15 -5
- package/permission/index.ts +143 -46
- package/permission/legacy.ts +26 -0
- package/permission/registry.ts +304 -0
- package/permission/types.ts +164 -0
- package/plugin/channel.ts +68 -39
- package/plugin/index.ts +80 -7
- package/plugin/install.ts +3 -0
- package/plugin/log/types.ts +22 -5
- package/plugin/node/logger-manager.ts +11 -3
- package/plugin/node/logger.ts +24 -17
- package/plugin/preload.ts +25 -2
- package/plugin/providers/index.ts +4 -4
- package/plugin/providers/market-client.ts +6 -3
- package/plugin/providers/npm-provider.ts +22 -7
- package/plugin/providers/tpex-provider.ts +22 -8
- package/plugin/sdk/box-items.ts +14 -0
- package/plugin/sdk/box-sdk.ts +64 -0
- package/plugin/sdk/channel.ts +119 -4
- package/plugin/sdk/clipboard.ts +26 -12
- package/plugin/sdk/cloud-sync.ts +113 -0
- package/plugin/sdk/common.ts +19 -11
- package/plugin/sdk/core-box.ts +6 -15
- package/plugin/sdk/division-box.ts +160 -65
- package/plugin/sdk/examples/storage-onDidChange-example.js +5 -2
- package/plugin/sdk/feature-sdk.ts +111 -76
- package/plugin/sdk/flow.ts +146 -45
- package/plugin/sdk/hooks/bridge.ts +13 -6
- package/plugin/sdk/hooks/life-cycle.ts +35 -16
- package/plugin/sdk/index.ts +14 -3
- package/plugin/sdk/intelligence.ts +87 -0
- package/plugin/sdk/meta/README.md +179 -0
- package/plugin/sdk/meta-sdk.ts +244 -0
- package/plugin/sdk/notification.ts +9 -0
- package/plugin/sdk/plugin-info.ts +64 -0
- package/plugin/sdk/power.ts +155 -0
- package/plugin/sdk/recommend.ts +21 -0
- package/plugin/sdk/service/index.ts +12 -8
- package/plugin/sdk/sqlite.ts +141 -0
- package/plugin/sdk/storage.ts +2 -6
- package/plugin/sdk/system.ts +2 -9
- package/plugin/sdk/temp-files.ts +41 -0
- package/plugin/sdk/touch-sdk.ts +18 -0
- package/plugin/sdk/types.ts +44 -4
- package/plugin/sdk/window/index.ts +12 -9
- package/plugin/sdk-version.ts +231 -0
- package/preload/renderer.ts +3 -2
- package/renderer/hooks/arg-mapper.ts +16 -2
- package/renderer/hooks/index.ts +13 -0
- package/renderer/hooks/initialize.ts +2 -1
- package/renderer/hooks/use-agent-market-sdk.ts +7 -0
- package/renderer/hooks/use-agent-market.ts +106 -0
- package/renderer/hooks/use-agents-sdk.ts +7 -0
- package/renderer/hooks/use-app-sdk.ts +7 -0
- package/renderer/hooks/use-channel.ts +33 -4
- package/renderer/hooks/use-download-sdk.ts +21 -0
- package/renderer/hooks/use-intelligence-sdk.ts +7 -0
- package/renderer/hooks/use-intelligence-stats.ts +290 -0
- package/renderer/hooks/use-intelligence.ts +55 -214
- package/renderer/hooks/use-market-sdk.ts +16 -0
- package/renderer/hooks/use-notification-sdk.ts +7 -0
- package/renderer/hooks/use-permission-sdk.ts +7 -0
- package/renderer/hooks/use-permission.ts +325 -0
- package/renderer/hooks/use-platform-sdk.ts +7 -0
- package/renderer/hooks/use-plugin-sdk.ts +16 -0
- package/renderer/hooks/use-settings-sdk.ts +7 -0
- package/renderer/hooks/use-update-sdk.ts +21 -0
- package/renderer/index.ts +1 -0
- package/renderer/ref.ts +19 -10
- package/renderer/shared/components/SharedPluginDetailContent.vue +84 -0
- package/renderer/shared/components/SharedPluginDetailHeader.vue +116 -0
- package/renderer/shared/components/SharedPluginDetailMetaList.vue +39 -0
- package/renderer/shared/components/SharedPluginDetailReadme.vue +45 -0
- package/renderer/shared/components/SharedPluginDetailVersions.vue +98 -0
- package/renderer/shared/components/index.ts +5 -0
- package/renderer/shared/components/shims-vue.d.ts +5 -0
- package/renderer/shared/index.ts +2 -0
- package/renderer/shared/plugin-detail.ts +62 -0
- package/renderer/storage/app-settings.ts +3 -1
- package/renderer/storage/base-storage.ts +508 -82
- package/renderer/storage/intelligence-storage.ts +31 -40
- package/renderer/storage/openers.ts +3 -1
- package/renderer/storage/storage-subscription.ts +126 -42
- package/renderer/touch-sdk/env.ts +10 -10
- package/renderer/touch-sdk/index.ts +114 -18
- package/renderer/touch-sdk/terminal.ts +24 -13
- package/search/feature-matcher.ts +279 -0
- package/search/fuzzy-match.ts +64 -34
- package/search/index.ts +10 -0
- package/search/levenshtein-utils.ts +17 -11
- package/transport/errors.ts +310 -0
- package/transport/event/builder.ts +378 -0
- package/transport/event/index.ts +7 -0
- package/transport/event/types.ts +292 -0
- package/transport/events/index.ts +2690 -0
- package/transport/events/meta-overlay.ts +79 -0
- package/transport/events/types/agents.ts +177 -0
- package/transport/events/types/app-index.ts +20 -0
- package/transport/events/types/app.ts +475 -0
- package/transport/events/types/box-item.ts +222 -0
- package/transport/events/types/clipboard.ts +80 -0
- package/transport/events/types/core-box.ts +534 -0
- package/transport/events/types/device-idle.ts +7 -0
- package/transport/events/types/division-box.ts +99 -0
- package/transport/events/types/download.ts +115 -0
- package/transport/events/types/file-index.ts +84 -0
- package/transport/events/types/flow.ts +149 -0
- package/transport/events/types/index.ts +70 -0
- package/transport/events/types/market.ts +39 -0
- package/transport/events/types/meta-overlay.ts +184 -0
- package/transport/events/types/notification.ts +140 -0
- package/transport/events/types/permission.ts +90 -0
- package/transport/events/types/platform.ts +8 -0
- package/transport/events/types/plugin.ts +631 -0
- package/transport/events/types/sentry.ts +20 -0
- package/transport/events/types/storage.ts +208 -0
- package/transport/events/types/transport.ts +60 -0
- package/transport/events/types/tray.ts +16 -0
- package/transport/events/types/update.ts +78 -0
- package/transport/index.ts +141 -0
- package/transport/main.ts +2 -0
- package/transport/prelude.ts +208 -0
- package/transport/sdk/constants.ts +29 -0
- package/transport/sdk/domains/agents-market.ts +47 -0
- package/transport/sdk/domains/agents.ts +62 -0
- package/transport/sdk/domains/app.ts +48 -0
- package/transport/sdk/domains/disposable.ts +35 -0
- package/transport/sdk/domains/download.ts +139 -0
- package/transport/sdk/domains/index.ts +13 -0
- package/transport/sdk/domains/intelligence.ts +616 -0
- package/transport/sdk/domains/market.ts +35 -0
- package/transport/sdk/domains/notification.ts +62 -0
- package/transport/sdk/domains/permission.ts +85 -0
- package/transport/sdk/domains/platform.ts +19 -0
- package/transport/sdk/domains/plugin.ts +144 -0
- package/transport/sdk/domains/settings.ts +102 -0
- package/transport/sdk/domains/update.ts +64 -0
- package/transport/sdk/index.ts +60 -0
- package/transport/sdk/main-transport.ts +710 -0
- package/transport/sdk/main.ts +9 -0
- package/transport/sdk/plugin-transport.ts +654 -0
- package/transport/sdk/port-policy.ts +38 -0
- package/transport/sdk/renderer-transport.ts +1165 -0
- package/transport/types.ts +605 -0
- package/types/agent.ts +399 -0
- package/types/cloud-sync.ts +157 -0
- package/types/division-box.ts +31 -31
- package/types/download.ts +1 -0
- package/types/flow.ts +63 -12
- package/types/icon.ts +2 -1
- package/types/index.ts +5 -0
- package/types/intelligence.ts +166 -173
- package/types/modules/base.ts +2 -0
- package/types/path-browserify.d.ts +5 -0
- package/types/platform.ts +12 -0
- package/types/startup-info.ts +32 -0
- package/types/touch-app-core.ts +8 -8
- package/types/update.ts +94 -1
- package/vitest.config.ts +25 -0
- package/auth/useClerkConfig.ts +0 -40
- package/auth/useClerkProvider.ts +0 -52
package/types/agent.ts
ADDED
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intelligence Agents Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Core types for the Agent system that provides intelligent automation
|
|
5
|
+
* capabilities built on top of IntelligenceSDK.
|
|
6
|
+
*
|
|
7
|
+
* @module agent
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// Core Types
|
|
13
|
+
// ============================================================================
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* JSON Schema for validation
|
|
17
|
+
*/
|
|
18
|
+
export interface JsonSchema {
|
|
19
|
+
type: 'object' | 'array' | 'string' | 'number' | 'boolean' | 'null'
|
|
20
|
+
properties?: Record<string, JsonSchema>
|
|
21
|
+
items?: JsonSchema
|
|
22
|
+
required?: string[]
|
|
23
|
+
description?: string
|
|
24
|
+
default?: unknown
|
|
25
|
+
enum?: unknown[]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Agent execution status
|
|
30
|
+
*/
|
|
31
|
+
export enum AgentStatus {
|
|
32
|
+
IDLE = 'idle',
|
|
33
|
+
RUNNING = 'running',
|
|
34
|
+
PAUSED = 'paused',
|
|
35
|
+
COMPLETED = 'completed',
|
|
36
|
+
FAILED = 'failed',
|
|
37
|
+
CANCELLED = 'cancelled',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Agent permission types
|
|
42
|
+
*/
|
|
43
|
+
export enum AgentPermission {
|
|
44
|
+
FILE_READ = 'file:read',
|
|
45
|
+
FILE_WRITE = 'file:write',
|
|
46
|
+
FILE_DELETE = 'file:delete',
|
|
47
|
+
NETWORK_ACCESS = 'network:access',
|
|
48
|
+
SYSTEM_EXEC = 'system:exec',
|
|
49
|
+
INTELLIGENCE_INVOKE = 'intelligence:invoke',
|
|
50
|
+
CLIPBOARD_READ = 'clipboard:read',
|
|
51
|
+
CLIPBOARD_WRITE = 'clipboard:write',
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// ============================================================================
|
|
55
|
+
// Agent Descriptor & Configuration
|
|
56
|
+
// ============================================================================
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Agent capability descriptor
|
|
60
|
+
*/
|
|
61
|
+
export interface AgentCapability {
|
|
62
|
+
/** Unique capability ID */
|
|
63
|
+
id: string
|
|
64
|
+
/** Capability type */
|
|
65
|
+
type: 'action' | 'query' | 'workflow' | 'chat'
|
|
66
|
+
/** Human-readable name */
|
|
67
|
+
name: string
|
|
68
|
+
/** Description of what this capability does */
|
|
69
|
+
description: string
|
|
70
|
+
/** Input schema */
|
|
71
|
+
inputSchema?: JsonSchema
|
|
72
|
+
/** Output schema */
|
|
73
|
+
outputSchema?: JsonSchema
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Reference to a tool that an agent can use
|
|
78
|
+
*/
|
|
79
|
+
export interface AgentToolRef {
|
|
80
|
+
/** Tool ID */
|
|
81
|
+
toolId: string
|
|
82
|
+
/** Whether the tool is required */
|
|
83
|
+
required?: boolean
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Agent configuration
|
|
88
|
+
*/
|
|
89
|
+
export interface AgentConfig {
|
|
90
|
+
/** Maximum execution time in ms */
|
|
91
|
+
timeout?: number
|
|
92
|
+
/** Maximum retries on failure */
|
|
93
|
+
maxRetries?: number
|
|
94
|
+
/** Required permissions */
|
|
95
|
+
permissions?: AgentPermission[]
|
|
96
|
+
/** Custom configuration */
|
|
97
|
+
[key: string]: unknown
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Agent descriptor - defines what an agent can do
|
|
102
|
+
*/
|
|
103
|
+
export interface AgentDescriptor {
|
|
104
|
+
/** Unique agent ID */
|
|
105
|
+
id: string
|
|
106
|
+
/** Human-readable name */
|
|
107
|
+
name: string
|
|
108
|
+
/** Description of the agent */
|
|
109
|
+
description: string
|
|
110
|
+
/** Agent version */
|
|
111
|
+
version: string
|
|
112
|
+
/** Agent icon (carbon icon name) */
|
|
113
|
+
icon?: string
|
|
114
|
+
/** Agent category */
|
|
115
|
+
category?: 'file' | 'search' | 'data' | 'workflow' | 'custom'
|
|
116
|
+
/** Available capabilities */
|
|
117
|
+
capabilities: AgentCapability[]
|
|
118
|
+
/** Tools this agent can use */
|
|
119
|
+
tools?: AgentToolRef[]
|
|
120
|
+
/** Default configuration */
|
|
121
|
+
config?: AgentConfig
|
|
122
|
+
/** Whether the agent is enabled */
|
|
123
|
+
enabled?: boolean
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ============================================================================
|
|
127
|
+
// Task & Execution
|
|
128
|
+
// ============================================================================
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Agent execution context
|
|
132
|
+
*/
|
|
133
|
+
export interface AgentContext {
|
|
134
|
+
/** Session ID for conversation tracking */
|
|
135
|
+
sessionId?: string
|
|
136
|
+
/** Previous messages in conversation */
|
|
137
|
+
messages?: AgentMessage[]
|
|
138
|
+
/** Working directory for file operations */
|
|
139
|
+
workingDirectory?: string
|
|
140
|
+
/** Custom context data */
|
|
141
|
+
metadata?: Record<string, unknown>
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Message in agent conversation
|
|
146
|
+
*/
|
|
147
|
+
export interface AgentMessage {
|
|
148
|
+
role: 'user' | 'assistant' | 'system' | 'tool'
|
|
149
|
+
content: string
|
|
150
|
+
timestamp?: number
|
|
151
|
+
toolCallId?: string
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Agent task definition
|
|
156
|
+
*/
|
|
157
|
+
export interface AgentTask {
|
|
158
|
+
/** Unique task ID (auto-generated if not provided) */
|
|
159
|
+
id?: string
|
|
160
|
+
/** Target agent ID */
|
|
161
|
+
agentId: string
|
|
162
|
+
/** Task type */
|
|
163
|
+
type: 'execute' | 'plan' | 'chat'
|
|
164
|
+
/** Capability to invoke (for execute type) */
|
|
165
|
+
capabilityId?: string
|
|
166
|
+
/** Task input */
|
|
167
|
+
input: unknown
|
|
168
|
+
/** Execution context */
|
|
169
|
+
context?: AgentContext
|
|
170
|
+
/** Task priority (1-10, higher = more urgent) */
|
|
171
|
+
priority?: number
|
|
172
|
+
/** Timeout in ms */
|
|
173
|
+
timeout?: number
|
|
174
|
+
/** Caller identifier */
|
|
175
|
+
caller?: string
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Tool call request from agent
|
|
180
|
+
*/
|
|
181
|
+
export interface AgentToolCall {
|
|
182
|
+
id: string
|
|
183
|
+
toolId: string
|
|
184
|
+
input: unknown
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Agent execution trace step
|
|
189
|
+
*/
|
|
190
|
+
export interface AgentTraceStep {
|
|
191
|
+
type: 'thought' | 'tool_call' | 'tool_result' | 'output'
|
|
192
|
+
timestamp: number
|
|
193
|
+
content: string
|
|
194
|
+
toolCall?: AgentToolCall
|
|
195
|
+
toolResult?: unknown
|
|
196
|
+
error?: string
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Agent usage statistics
|
|
201
|
+
*/
|
|
202
|
+
export interface AgentUsage {
|
|
203
|
+
promptTokens: number
|
|
204
|
+
completionTokens: number
|
|
205
|
+
totalTokens: number
|
|
206
|
+
toolCalls: number
|
|
207
|
+
duration: number
|
|
208
|
+
cost?: number
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Agent execution result
|
|
213
|
+
*/
|
|
214
|
+
export interface AgentResult {
|
|
215
|
+
/** Whether execution was successful */
|
|
216
|
+
success: boolean
|
|
217
|
+
/** Task ID */
|
|
218
|
+
taskId: string
|
|
219
|
+
/** Agent ID */
|
|
220
|
+
agentId: string
|
|
221
|
+
/** Result output */
|
|
222
|
+
output?: unknown
|
|
223
|
+
/** Error message if failed */
|
|
224
|
+
error?: string
|
|
225
|
+
/** Execution status */
|
|
226
|
+
status: AgentStatus
|
|
227
|
+
/** Usage statistics */
|
|
228
|
+
usage?: AgentUsage
|
|
229
|
+
/** Execution trace */
|
|
230
|
+
trace?: AgentTraceStep[]
|
|
231
|
+
/** Timestamp */
|
|
232
|
+
timestamp: number
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// ============================================================================
|
|
236
|
+
// Tools
|
|
237
|
+
// ============================================================================
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Tool execution context
|
|
241
|
+
*/
|
|
242
|
+
export interface ToolContext {
|
|
243
|
+
/** Task ID */
|
|
244
|
+
taskId: string
|
|
245
|
+
/** Agent ID */
|
|
246
|
+
agentId: string
|
|
247
|
+
/** Working directory */
|
|
248
|
+
workingDirectory?: string
|
|
249
|
+
/** Abort signal */
|
|
250
|
+
signal?: AbortSignal
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Agent tool definition
|
|
255
|
+
*/
|
|
256
|
+
export interface AgentTool {
|
|
257
|
+
/** Unique tool ID */
|
|
258
|
+
id: string
|
|
259
|
+
/** Human-readable name */
|
|
260
|
+
name: string
|
|
261
|
+
/** Tool description (used in LLM prompts) */
|
|
262
|
+
description: string
|
|
263
|
+
/** Tool category */
|
|
264
|
+
category?: string
|
|
265
|
+
/** Input schema */
|
|
266
|
+
inputSchema: JsonSchema
|
|
267
|
+
/** Output schema */
|
|
268
|
+
outputSchema?: JsonSchema
|
|
269
|
+
/** Required permissions */
|
|
270
|
+
permissions?: AgentPermission[]
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Tool execution result
|
|
275
|
+
*/
|
|
276
|
+
export interface ToolResult {
|
|
277
|
+
success: boolean
|
|
278
|
+
output?: unknown
|
|
279
|
+
error?: string
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// ============================================================================
|
|
283
|
+
// Scheduler & Queue
|
|
284
|
+
// ============================================================================
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Task queue item
|
|
288
|
+
*/
|
|
289
|
+
export interface QueuedTask {
|
|
290
|
+
task: AgentTask
|
|
291
|
+
priority: number
|
|
292
|
+
enqueuedAt: number
|
|
293
|
+
status: AgentStatus
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Scheduler statistics
|
|
298
|
+
*/
|
|
299
|
+
export interface SchedulerStats {
|
|
300
|
+
queueLength: number
|
|
301
|
+
activeTasks: number
|
|
302
|
+
completedTasks: number
|
|
303
|
+
failedTasks: number
|
|
304
|
+
averageWaitTime: number
|
|
305
|
+
averageExecutionTime: number
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// ============================================================================
|
|
309
|
+
// Events & IPC
|
|
310
|
+
// ============================================================================
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Agent event types
|
|
314
|
+
*/
|
|
315
|
+
export type AgentEventType
|
|
316
|
+
= | 'task:started'
|
|
317
|
+
| 'task:progress'
|
|
318
|
+
| 'task:completed'
|
|
319
|
+
| 'task:failed'
|
|
320
|
+
| 'task:cancelled'
|
|
321
|
+
| 'tool:called'
|
|
322
|
+
| 'tool:result'
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Agent event payload
|
|
326
|
+
*/
|
|
327
|
+
export interface AgentEvent {
|
|
328
|
+
type: AgentEventType
|
|
329
|
+
taskId: string
|
|
330
|
+
agentId: string
|
|
331
|
+
timestamp: number
|
|
332
|
+
data?: unknown
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Task progress update
|
|
337
|
+
*/
|
|
338
|
+
export interface TaskProgress {
|
|
339
|
+
taskId: string
|
|
340
|
+
agentId: string
|
|
341
|
+
progress: number // 0-100
|
|
342
|
+
step: string
|
|
343
|
+
details?: string
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// ============================================================================
|
|
347
|
+
// Plan & Workflow
|
|
348
|
+
// ============================================================================
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Agent plan step
|
|
352
|
+
*/
|
|
353
|
+
export interface AgentPlanStep {
|
|
354
|
+
id: string
|
|
355
|
+
description: string
|
|
356
|
+
toolId?: string
|
|
357
|
+
input?: unknown
|
|
358
|
+
dependsOn?: string[]
|
|
359
|
+
status?: AgentStatus
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Agent execution plan
|
|
364
|
+
*/
|
|
365
|
+
export interface AgentPlan {
|
|
366
|
+
taskId: string
|
|
367
|
+
agentId: string
|
|
368
|
+
steps: AgentPlanStep[]
|
|
369
|
+
estimatedDuration?: number
|
|
370
|
+
createdAt: number
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// ============================================================================
|
|
374
|
+
// Memory & Context
|
|
375
|
+
// ============================================================================
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Memory entry
|
|
379
|
+
*/
|
|
380
|
+
export interface MemoryEntry {
|
|
381
|
+
id: string
|
|
382
|
+
type: 'short_term' | 'long_term'
|
|
383
|
+
content: string
|
|
384
|
+
embedding?: number[]
|
|
385
|
+
metadata?: Record<string, unknown>
|
|
386
|
+
createdAt: number
|
|
387
|
+
accessedAt: number
|
|
388
|
+
importance?: number
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Memory query options
|
|
393
|
+
*/
|
|
394
|
+
export interface MemoryQueryOptions {
|
|
395
|
+
type?: 'short_term' | 'long_term'
|
|
396
|
+
limit?: number
|
|
397
|
+
minImportance?: number
|
|
398
|
+
semanticQuery?: string
|
|
399
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
export type SyncErrorCode =
|
|
2
|
+
| 'QUOTA_STORAGE_EXCEEDED'
|
|
3
|
+
| 'QUOTA_OBJECT_EXCEEDED'
|
|
4
|
+
| 'QUOTA_ITEM_EXCEEDED'
|
|
5
|
+
| 'QUOTA_DEVICE_EXCEEDED'
|
|
6
|
+
| 'SYNC_INVALID_CURSOR'
|
|
7
|
+
| 'SYNC_INVALID_PAYLOAD'
|
|
8
|
+
| 'SYNC_INVALID_TOKEN'
|
|
9
|
+
| 'SYNC_TOKEN_EXPIRED'
|
|
10
|
+
| 'DEVICE_NOT_AUTHORIZED'
|
|
11
|
+
|
|
12
|
+
export interface QuotaInfo {
|
|
13
|
+
plan_tier?: string
|
|
14
|
+
limits: {
|
|
15
|
+
storage_limit_bytes: number
|
|
16
|
+
object_limit: number
|
|
17
|
+
item_limit: number
|
|
18
|
+
device_limit: number
|
|
19
|
+
}
|
|
20
|
+
usage: {
|
|
21
|
+
used_storage_bytes: number
|
|
22
|
+
used_objects: number
|
|
23
|
+
used_devices: number
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface EvictedDeviceInfo {
|
|
28
|
+
device_id: string
|
|
29
|
+
device_name?: string | null
|
|
30
|
+
platform?: string | null
|
|
31
|
+
last_seen_at?: string | null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface SyncItemInput {
|
|
35
|
+
item_id: string
|
|
36
|
+
type: string
|
|
37
|
+
schema_version: number
|
|
38
|
+
payload_enc?: string | null
|
|
39
|
+
payload_ref?: string | null
|
|
40
|
+
meta_plain?: Record<string, unknown> | null
|
|
41
|
+
payload_size?: number | null
|
|
42
|
+
updated_at: string
|
|
43
|
+
deleted_at?: string | null
|
|
44
|
+
op_seq: number
|
|
45
|
+
op_hash: string
|
|
46
|
+
op_type: 'upsert' | 'delete'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface SyncItemOutput {
|
|
50
|
+
item_id: string
|
|
51
|
+
type: string
|
|
52
|
+
schema_version: number
|
|
53
|
+
payload_enc: string | null
|
|
54
|
+
payload_ref: string | null
|
|
55
|
+
meta_plain: Record<string, unknown> | null
|
|
56
|
+
payload_size: number | null
|
|
57
|
+
updated_at: string
|
|
58
|
+
deleted_at: string | null
|
|
59
|
+
device_id: string | null
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface SyncOplogItem {
|
|
63
|
+
cursor: number
|
|
64
|
+
item_id: string
|
|
65
|
+
op_seq: number
|
|
66
|
+
op_hash: string
|
|
67
|
+
op_type: 'upsert' | 'delete'
|
|
68
|
+
updated_at: string
|
|
69
|
+
device_id: string
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface ConflictItem {
|
|
73
|
+
item_id: string
|
|
74
|
+
server_updated_at: string
|
|
75
|
+
server_device_id: string | null
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface HandshakeResponse {
|
|
79
|
+
sync_token: string
|
|
80
|
+
sync_token_expires_at: string
|
|
81
|
+
server_cursor: number
|
|
82
|
+
device_id: string
|
|
83
|
+
quotas: QuotaInfo
|
|
84
|
+
evicted_devices?: EvictedDeviceInfo[]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface PushResponse {
|
|
88
|
+
ack_cursor: number
|
|
89
|
+
conflicts: ConflictItem[]
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface PullResponse {
|
|
93
|
+
items: SyncItemOutput[]
|
|
94
|
+
oplog: SyncOplogItem[]
|
|
95
|
+
next_cursor: number
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface UploadResponse {
|
|
99
|
+
blob_id: string
|
|
100
|
+
object_key: string
|
|
101
|
+
sha256: string
|
|
102
|
+
size_bytes: number
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface QuotaValidateResponse {
|
|
106
|
+
ok: boolean
|
|
107
|
+
code: SyncErrorCode | null
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface KeyRegisterResponse {
|
|
111
|
+
keyring_id: string
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface KeyRotateResponse {
|
|
115
|
+
rotated_at: string
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface KeyringMeta {
|
|
119
|
+
keyring_id: string
|
|
120
|
+
device_id: string
|
|
121
|
+
key_type: string
|
|
122
|
+
rotated_at: string | null
|
|
123
|
+
created_at: string
|
|
124
|
+
has_recovery_code: boolean
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface KeyringSecret {
|
|
128
|
+
keyring_id: string
|
|
129
|
+
device_id: string
|
|
130
|
+
key_type: string
|
|
131
|
+
encrypted_key: string
|
|
132
|
+
rotated_at: string | null
|
|
133
|
+
created_at: string
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface KeysListResponse {
|
|
137
|
+
keyrings: KeyringMeta[]
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface KeysIssueDeviceResponse {
|
|
141
|
+
keyring_id: string
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface KeysRecoverDeviceResponse {
|
|
145
|
+
keyrings: KeyringSecret[]
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface DeviceAttestPayload {
|
|
149
|
+
machine_code_hash: string
|
|
150
|
+
fingerprint_hash?: string
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface DeviceAttestResponse {
|
|
154
|
+
ok: boolean
|
|
155
|
+
device_id: string
|
|
156
|
+
updated_at: string
|
|
157
|
+
}
|