@kvell007/embed-labs-cli 0.1.0-alpha.97 → 0.1.0-alpha.99

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.
@@ -0,0 +1,2137 @@
1
+ import { type ApiResponse } from "@embed-labs/protocol";
2
+ import { type OptimizationReportCategory, type OptimizationSeverity } from "@embed-labs/shared-schemas";
3
+ import { type LocalCompileOptions, type LocalCompileResult, type LocalToolchainInstallOptions, type LocalToolchainInstallResult, type LocalToolchainListOptions, type LocalToolchainListResult, type LocalToolchainUninstallOptions, type LocalToolchainUninstallResult } from "./local-toolchain.js";
4
+ export interface AgentCliArgs {
5
+ command: string[];
6
+ flags: Record<string, string | boolean | Array<string | boolean>>;
7
+ passthrough?: string[];
8
+ }
9
+ export interface AgentInstallationIdentityStatusSnapshot {
10
+ local_agent_ready: boolean;
11
+ identity_scope: "local_installation";
12
+ uses_local_installation_identity: true;
13
+ installation_id?: string;
14
+ installation_integrity?: string;
15
+ local_identity_profile?: string;
16
+ }
17
+ export interface AgentIdentitySetupGuidance {
18
+ required: true;
19
+ message: string;
20
+ identity_command: string;
21
+ status_command: string;
22
+ steps: string[];
23
+ }
24
+ interface AgentIdentityGateIssue {
25
+ code: "device_binding_required" | "tool_integrity_check_failed" | "installation_identity_required";
26
+ message: string;
27
+ remediation: string;
28
+ }
29
+ export interface AgentRuntimeDependencies {
30
+ installationIdentityStatus(): Promise<AgentInstallationIdentityStatusSnapshot>;
31
+ bridgeGet<T>(path: string): Promise<ApiResponse<T>>;
32
+ bridgePost<T>(path: string, body: unknown): Promise<ApiResponse<T>>;
33
+ cloudGet<T>(path: string, options?: {
34
+ signal?: AbortSignal;
35
+ }): Promise<ApiResponse<T>>;
36
+ cloudPost<T>(path: string, body: unknown, options?: {
37
+ signal?: AbortSignal;
38
+ headers?: Record<string, string>;
39
+ }): Promise<ApiResponse<T>>;
40
+ listLocalToolchainEnvironments?(options: LocalToolchainListOptions): Promise<LocalToolchainListResult>;
41
+ installLocalToolchain?(options: LocalToolchainInstallOptions): Promise<LocalToolchainInstallResult>;
42
+ uninstallLocalToolchain?(options: LocalToolchainUninstallOptions): Promise<LocalToolchainUninstallResult>;
43
+ compileTaishanPiSingleFile?(options: LocalCompileOptions): Promise<LocalCompileResult>;
44
+ adminConsoleUrl: string;
45
+ bridgeUrl: string;
46
+ clientName: string;
47
+ clientVersion: string;
48
+ }
49
+ export interface LocalAgentRunResult {
50
+ runtime: "embedlabs-local-agent";
51
+ session_id: string;
52
+ prompt: string;
53
+ intent: AgentIntent;
54
+ answer: string;
55
+ prompt_assembly: AgentPromptAssembly;
56
+ model_invocation: AgentModelInvocationTrace;
57
+ session_adapter: AgentSessionAdapterTrace;
58
+ installation_identity: AgentInstallationIdentityAdapterTrace;
59
+ local_execution: AgentLocalExecutionTrace;
60
+ next_commands?: AgentNextCommand[];
61
+ installation_identity_status: AgentInstallationIdentityStatusSnapshot;
62
+ memory: AgentMemorySummary;
63
+ memory_context: AgentMemoryContext;
64
+ memory_suggestions?: AgentMemorySuggestion[];
65
+ response_preferences?: AgentResponsePreference[];
66
+ bridge?: AgentBridgeSnapshot;
67
+ report?: AgentReportUploadResult;
68
+ secondary_reports?: AgentReportUploadResult[];
69
+ advisories?: AgentRunAdvisory[];
70
+ public_experience: AgentPublicExperienceSummary;
71
+ maintainer?: AgentMaintainerResult;
72
+ auto_sync?: AgentSyncResult;
73
+ persistence_warnings?: AgentPersistenceWarning[];
74
+ identity_setup?: AgentIdentitySetupGuidance;
75
+ session_path: string;
76
+ }
77
+ export interface AgentRunAdvisory {
78
+ code: string;
79
+ source: "secondary_report" | "local_persistence" | "model_config";
80
+ severity: "info" | "warning";
81
+ affects_primary_action: false;
82
+ message: string;
83
+ remediation?: string;
84
+ report_id?: string;
85
+ report_status?: "uploaded" | "pending" | "failed";
86
+ target?: "memory" | "session" | "skill_candidate" | "report";
87
+ path_ref?: string;
88
+ }
89
+ interface AgentPersistenceWarning {
90
+ code: "local_persistence_unavailable";
91
+ message: string;
92
+ target: "memory" | "session" | "skill_candidate" | "report";
93
+ path_ref: string;
94
+ error_code?: string;
95
+ remediation: string;
96
+ }
97
+ interface AgentModelRuntimeInvalidToolCall {
98
+ requested_name: string;
99
+ requested_name_sha256: string;
100
+ arguments_sha256?: string;
101
+ }
102
+ interface AgentModelRuntimeResult {
103
+ enabled: boolean;
104
+ mode: "disabled_by_default" | "explicit_openai_compatible";
105
+ provider_kind: "embedlabs.local_openai_compatible_runtime_provider";
106
+ provider_contract: "embedlabs.model_runtime_provider.v1";
107
+ replacement_target: "upstream_model_runtime_provider";
108
+ request_endpoint_path: "/chat/completions";
109
+ streaming_requested: true;
110
+ model_request_count: number;
111
+ network_call_performed: boolean;
112
+ response_state: "not_enabled" | "missing_model_config" | "completed" | "failed";
113
+ response_source: "none" | "openai_compatible_response";
114
+ streaming_response?: AgentModelStreamingResponseSummary;
115
+ answer?: string;
116
+ assistant_message_sha256?: string;
117
+ tool_call_count: number;
118
+ dispatched_tool_call_count: number;
119
+ tool_call_dispatch_state: "not_enabled" | "no_tool_calls" | "first_high_level_action_dispatched" | "side_effect_approval_stripped" | "invalid_tool_call" | "failed";
120
+ dispatched_actions?: Array<{
121
+ action_id: AgentActionId;
122
+ ok: boolean;
123
+ summary_sha256: string;
124
+ approval_from_model_ignored: boolean;
125
+ }>;
126
+ invalid_tool_call?: AgentModelRuntimeInvalidToolCall;
127
+ tool_result_summary?: {
128
+ requested: boolean;
129
+ state: "not_requested" | "completed" | "failed";
130
+ message_count: number;
131
+ tool_result_sha256?: string;
132
+ final_answer_sha256?: string;
133
+ streaming_response?: AgentModelStreamingResponseSummary;
134
+ };
135
+ error?: {
136
+ code: string;
137
+ message: string;
138
+ };
139
+ privacy_boundary: {
140
+ local_provider_credentials_only: true;
141
+ request_body_not_persisted: true;
142
+ raw_model_response_not_persisted: true;
143
+ raw_prompt_trace_stored: false;
144
+ credential_material_exported: false;
145
+ no_platform_auth_gate: true;
146
+ };
147
+ }
148
+ interface AgentModelStreamingResponseSummary {
149
+ requested: true;
150
+ format: "sse" | "json";
151
+ incremental_reader: boolean;
152
+ chunk_count: number;
153
+ raw_response_persisted: false;
154
+ }
155
+ interface AgentSessionAdapterTrace {
156
+ kind: "embedlabs.upstream_session_adapter";
157
+ schema_version: 1;
158
+ provider_kind: "embedlabs.local_session_provider";
159
+ provider_contract: "embedlabs.session_provider.v1";
160
+ provider_replacement_target: "upstream_session_provider";
161
+ storage_home: "~/.embedlabs/agent/sessions";
162
+ storage_format: "json_session_files";
163
+ session_id: string;
164
+ session_ref: string;
165
+ session_path_hash: string;
166
+ index_source: "readUpstreamCompatibleSessionIndex";
167
+ index_contract: "upstream_compatible_session_index";
168
+ search_target: "upstream_session_search";
169
+ lifecycle: {
170
+ create: "persist_after_agent_turn";
171
+ update: "rewrite_after_memory_summary";
172
+ index_refresh: "readUpstreamCompatibleSessionIndex_on_demand";
173
+ search: "local_session_index_search";
174
+ };
175
+ search_strategy: {
176
+ kind: "safe_local_session_index";
177
+ source: "readUpstreamCompatibleSessionIndex";
178
+ target: "upstream_session_search";
179
+ prompt_material: "redacted_prompt_excerpt";
180
+ execution_summary: "compact_local_execution_trace";
181
+ max_index_entries: 200;
182
+ };
183
+ write_policy: {
184
+ prompt_storage: "redacted_prompt";
185
+ answer_storage: "local_agent_answer";
186
+ raw_model_response_storage: "disabled";
187
+ public_upload_path: "redacted_public_reports_only";
188
+ };
189
+ prompt_storage: "redacted_prompt";
190
+ privacy_boundary: {
191
+ local_only: true;
192
+ raw_prompt_exported_by_default: false;
193
+ raw_personal_memory_uploaded_by_default: false;
194
+ absolute_paths_exported: false;
195
+ };
196
+ }
197
+ interface AgentInstallationIdentityAdapterTrace {
198
+ kind: "embedlabs.upstream_installation_identity_adapter";
199
+ schema_version: 1;
200
+ provider_kind: "embedlabs.local_installation_identity_provider";
201
+ provider_contract: "embedlabs.installation_identity_provider.v1";
202
+ provider_replacement_target: "upstream_profile_identity_provider";
203
+ identity_kind: "embedlabs.local_installation_identity";
204
+ installation_id: string;
205
+ profile: "default";
206
+ storage_home: "~/.embedlabs/agent";
207
+ installation_ref: "installation.json";
208
+ installation_path_hash: string;
209
+ fingerprint_version: "v1";
210
+ fingerprint_integrity: "ok" | "failed" | "missing";
211
+ fingerprint_hash?: string;
212
+ current_fingerprint_hash?: string;
213
+ fingerprint_source?: string;
214
+ current_fingerprint_source?: string;
215
+ key_algorithm?: "ed25519";
216
+ public_key_sha256?: string;
217
+ public_key_configured: boolean;
218
+ local_keypair_configured: boolean;
219
+ platform: string;
220
+ arch: string;
221
+ hostname_hash?: string;
222
+ copied_installation_policy: "fingerprint_mismatch_requires_reinitialize";
223
+ memory_scope: "local_personal_memory_by_installation";
224
+ public_experience_scope: "redacted_reports_attributed_by_installation";
225
+ privacy_boundary: {
226
+ local_only: true;
227
+ raw_hardware_id_exported: false;
228
+ identity_key_material_exported: false;
229
+ user_model_key_uploaded: false;
230
+ uses_local_installation_identity: true;
231
+ };
232
+ }
233
+ interface AgentPromptAssemblyModelConfig {
234
+ adapter_kind: "embedlabs.upstream_model_provider_config_adapter";
235
+ schema_version: 1;
236
+ profile_source: "embedlabs_local_config";
237
+ provider_key_storage: "local_config_or_env";
238
+ upstream_concepts: ["provider", "profile", "base_url", "model", "local_key_reference"];
239
+ config_path: string;
240
+ default_profile: string;
241
+ selected_profile?: string;
242
+ configured: boolean;
243
+ provider?: string;
244
+ model?: string;
245
+ base_url?: string;
246
+ api_key: "set" | "env" | "missing";
247
+ api_key_env?: string;
248
+ agent_runtime: {
249
+ enabled: boolean;
250
+ activation_source: "local_model_config" | "env_override" | "disabled";
251
+ mode: "local_openai_compatible";
252
+ };
253
+ privacy: "local_only_no_key_exported";
254
+ }
255
+ interface AgentProfileProviderAdapterTrace {
256
+ kind: "embedlabs.upstream_profile_provider_adapter";
257
+ schema_version: 1;
258
+ provider_kind: "embedlabs.local_profile_provider";
259
+ provider_contract: "embedlabs.profile_provider.v1";
260
+ provider_replacement_target: "upstream_profile_provider";
261
+ storage_home: "~/.embedlabs/agent";
262
+ scope: "installation_local_profiles";
263
+ model_config_source: "embedlabs_local_config";
264
+ installation_profile_source: "embedlabs.local_installation_identity";
265
+ board_profile_source: "local_personal_memory_profiles";
266
+ selected_model_profile: string;
267
+ installation_profile: "default";
268
+ profile_context_entry_count: number;
269
+ board_profile_context_entries: number;
270
+ profile_types: [
271
+ "model_provider_profile",
272
+ "installation_profile",
273
+ "board_memory_profile"
274
+ ];
275
+ lifecycle: {
276
+ read: "prompt_assembly_profile_resolution";
277
+ write: "local_config_and_memory_profile_writes";
278
+ upstream_sync: "adapter_boundary_only_until_upstream_runtime";
279
+ };
280
+ write_policy: {
281
+ model_provider_profiles_local_config_only: true;
282
+ installation_profile_local_only: true;
283
+ board_profiles_personal_memory_only: true;
284
+ public_promotion_requires_owner_review: true;
285
+ };
286
+ privacy_boundary: {
287
+ local_only: true;
288
+ model_credentials_uploaded: false;
289
+ raw_hardware_id_exported: false;
290
+ raw_personal_memory_uploaded_by_default: false;
291
+ uses_local_installation_identity: true;
292
+ };
293
+ }
294
+ interface AgentModelInvocationTrace {
295
+ kind: "embedlabs.upstream_model_invocation_adapter";
296
+ schema_version: 1;
297
+ provider_kind: "embedlabs.local_model_invocation_provider";
298
+ provider_contract: "embedlabs.model_invocation_provider.v1";
299
+ provider_replacement_target: "upstream_model_runtime_provider";
300
+ config_adapter: "embedlabs.upstream_model_provider_config_adapter";
301
+ config_source: "embedlabs_local_config";
302
+ selected_profile: string;
303
+ configured: boolean;
304
+ provider?: string;
305
+ model?: string;
306
+ base_url?: string;
307
+ request_preflight_state: "ready" | "missing_model_config";
308
+ request_contract: "openai_chat_completions_compatible";
309
+ request_endpoint_path: "/chat/completions";
310
+ payload_contract: "embedlabs.messages_with_high_level_actions.v1";
311
+ tool_schema_source: "prompt_assembly.tool_registry";
312
+ local_credentials_source: "local_config_or_env";
313
+ streaming_supported: true;
314
+ request_preview: {
315
+ method: "POST";
316
+ message_source: "prompt_assembly";
317
+ message_count: 3;
318
+ memory_prompt_context: "sanitized_summary_only";
319
+ memory_prompt_context_entries: number;
320
+ memory_prompt_context_sha256: string;
321
+ chat_session_context: "bounded_sanitized_turn_summaries" | "none";
322
+ chat_session_context_entries: number;
323
+ chat_session_context_sha256?: string;
324
+ tool_count: number;
325
+ tool_schema_format: "openai_chat_completions_tools";
326
+ tool_schema_contract: "embedlabs.high_level_action_tools.v1";
327
+ tool_schema_sha256: string;
328
+ tool_choice: "auto";
329
+ stream: true;
330
+ redacted_body_contract: "model_tool_request_without_raw_prompt_or_credentials";
331
+ redacted_body_sha256: string;
332
+ includes_raw_prompt: false;
333
+ includes_credential_material: false;
334
+ };
335
+ dry_run_fixture: {
336
+ enabled: true;
337
+ response_contract: "openai_chat_completion_response_fixture";
338
+ response_source: "local_deterministic_fixture";
339
+ response_id_prefix: "chatcmpl_embedlabs_fixture";
340
+ choice_count: 1;
341
+ finish_reason: "stop";
342
+ assistant_message_source: "agent_answer";
343
+ assistant_message_sha256: string;
344
+ tool_call_count: 0;
345
+ parsed_output_kind: "assistant_message";
346
+ response_preview: {
347
+ object: "chat.completion";
348
+ message_role: "assistant";
349
+ choice_index: 0;
350
+ usage_policy: "not_recorded_for_fixture";
351
+ redacted_response_contract: "openai_chat_completion_without_raw_content";
352
+ redacted_response_sha256: string;
353
+ };
354
+ includes_raw_model_response: false;
355
+ network_required: false;
356
+ };
357
+ runtime_result: AgentModelRuntimeResult;
358
+ runtime_activation: {
359
+ current_state: "dry_run_preflight_only" | "explicit_runtime_enabled";
360
+ next_provider: "audited_upstream_model_runtime_provider";
361
+ activation_gate: "owner_review_plus_smoke_before_network_calls";
362
+ required_capabilities: [
363
+ "streaming_chat_completions",
364
+ "tool_call_dispatch_to_embedlabs_high_level_actions",
365
+ "local_provider_credentials_read_at_call_time",
366
+ "redacted_request_response_tracing"
367
+ ];
368
+ forbidden_behaviors: [
369
+ "remote_embedlabs_model_proxy_by_default",
370
+ "raw_prompt_or_credential_trace_storage",
371
+ "remote_service_gate_for_local_agent",
372
+ "low_level_mcp_tools_exposed_to_model"
373
+ ];
374
+ };
375
+ invocation_state: "skipped_deterministic_loop" | "completed_explicit_local_model_runtime" | "failed_explicit_local_model_runtime";
376
+ reason: "current_loop_uses_high_level_deterministic_actions" | "explicit_local_model_runtime_opt_in";
377
+ network_call_performed: boolean;
378
+ remote_embedlabs_model_used: false;
379
+ credential_material_exported: false;
380
+ privacy_boundary: {
381
+ local_provider_credentials_only: true;
382
+ raw_prompt_uploaded_by_default: false;
383
+ no_platform_auth_gate: true;
384
+ no_cloud_model_proxy: true;
385
+ };
386
+ }
387
+ interface AgentPromptAssembly {
388
+ kind: "embedlabs.upstream_prompt_assembly";
389
+ mode: "upstream_adapter";
390
+ generated_at: string;
391
+ local_only: true;
392
+ prompt_sha256: string;
393
+ intent_id: AgentIntent["id"];
394
+ model_config: AgentPromptAssemblyModelConfig;
395
+ profile_provider: AgentProfileProviderAdapterTrace;
396
+ tool_registry: AgentToolRegistryAdapterTrace;
397
+ context: {
398
+ memory_source: "local_personal_memory";
399
+ memory_context_entries: number;
400
+ memory_source_labels: string[];
401
+ memory_prompt_context: AgentPromptMemoryContext;
402
+ chat_session_context?: AgentChatSessionPromptContext;
403
+ available_action_count: number;
404
+ allowed_action_ids: AgentActionId[];
405
+ bridge?: {
406
+ runtime: "go-local-bridge";
407
+ endpoints: ["/healthz", "/v1/devices"];
408
+ ok: boolean;
409
+ board_count?: number;
410
+ device_count?: number;
411
+ error_code?: string;
412
+ };
413
+ };
414
+ upstream_adapter: {
415
+ upstream_reference: string;
416
+ audited_version: string;
417
+ audited_tag: string;
418
+ direct_upstream_source_imported: false;
419
+ next_step: "replace_deterministic_planner_with_upstream_backed_loop";
420
+ };
421
+ privacy_boundary: {
422
+ user_model_key_uploaded: false;
423
+ raw_personal_memory_uploaded: false;
424
+ raw_prompt_uploaded_by_default: false;
425
+ board_state_source: "go-local-bridge";
426
+ };
427
+ }
428
+ interface AgentPromptMemoryContext {
429
+ kind: "embedlabs.upstream_memory_prompt_context_adapter";
430
+ schema_version: 1;
431
+ provider_kind: "embedlabs.local_personal_memory_provider";
432
+ source: "local_personal_memory";
433
+ injection_mode: "sanitized_summary_only";
434
+ max_entries: 5;
435
+ included_entries: number;
436
+ entries: AgentPromptMemoryEntry[];
437
+ prompt_fragment_sha256: string;
438
+ privacy_boundary: {
439
+ raw_personal_memory_included: false;
440
+ absolute_paths_included: false;
441
+ user_model_key_included: false;
442
+ local_file_refs_are_symbolic: true;
443
+ };
444
+ }
445
+ interface AgentPromptMemoryEntry {
446
+ kind: AgentMemoryContextEntry["kind"];
447
+ title: string;
448
+ summary?: string;
449
+ source_label: string;
450
+ source_ref: string;
451
+ source_hash?: string;
452
+ relevance_score: number;
453
+ matched_terms: string[];
454
+ board_id?: string;
455
+ intent?: string;
456
+ privacy_scope: "local_personal_memory";
457
+ }
458
+ interface AgentToolRegistryAdapterTrace {
459
+ kind: "embedlabs.upstream_tool_registry_adapter";
460
+ schema_version: 1;
461
+ provider_kind: "embedlabs.high_level_action_registry_provider";
462
+ provider_contract: "embedlabs.tool_registry_provider.v1";
463
+ provider_replacement_target: "upstream_tool_registry_provider";
464
+ source_catalog: "AGENT_ACTION_CATALOG";
465
+ registry_contract: "embedlabs.high_level_action_registry.v1";
466
+ action_surface: "embedlabs_high_level_actions";
467
+ action_count: number;
468
+ allowed_action_ids: AgentActionId[];
469
+ tool_schema_format: "openai_chat_completions_tools";
470
+ tool_schema_contract: "embedlabs.high_level_action_tools.v1";
471
+ tool_schema_count: number;
472
+ tool_schema_sha256: string;
473
+ openai_tools: AgentOpenAIChatToolSchema[];
474
+ mcp_visibility: "internal_compatibility_only";
475
+ low_level_tool_policy: {
476
+ expose_low_level_mcp_tools_to_model: false;
477
+ hardware_state_source: "go-local-bridge";
478
+ board_facts_source: "boardpack";
479
+ side_effects_fail_closed: true;
480
+ };
481
+ }
482
+ interface AgentOpenAIChatToolSchema {
483
+ type: "function";
484
+ function: {
485
+ name: AgentActionId;
486
+ description: string;
487
+ parameters: {
488
+ type: "object";
489
+ additionalProperties: false;
490
+ required: string[];
491
+ properties: Record<string, AgentOpenAIChatToolProperty>;
492
+ };
493
+ };
494
+ }
495
+ interface AgentOpenAIChatToolProperty {
496
+ type: "string" | "boolean" | "number" | "array" | "object";
497
+ description: string;
498
+ enum?: string[];
499
+ default?: string | number | boolean;
500
+ items?: {
501
+ type: "string";
502
+ };
503
+ additionalProperties?: true;
504
+ "x-embedlabs-source": AgentActionInputSchema["source"];
505
+ "x-embedlabs-sensitive"?: true;
506
+ "x-embedlabs-aliases"?: string[];
507
+ }
508
+ export interface AgentStatusResult {
509
+ runtime: "embedlabs-local-agent";
510
+ client: {
511
+ name: string;
512
+ version: string;
513
+ platform: string;
514
+ arch: string;
515
+ };
516
+ model: AgentStatusModelSummary;
517
+ installation: AgentInstallationStatus;
518
+ memory: AgentMemorySummary;
519
+ persistence: AgentPersistenceStatus;
520
+ memory_provider_status: AgentMemoryProviderStatus;
521
+ action_registry_status: AgentActionRegistryStatus;
522
+ upstream_adapter: AgentUpstreamAdapterSummary;
523
+ plugin_integrations: AgentPluginIntegrationSummary;
524
+ closed_loop: AgentClosedLoopReadiness;
525
+ bridge: AgentBridgeSnapshot;
526
+ public_experience: AgentPublicExperienceSummary;
527
+ next_commands?: AgentNextCommand[];
528
+ }
529
+ interface AgentActionRegistryStatus {
530
+ kind: "embedlabs.agent_action_registry_status";
531
+ readiness: "ready";
532
+ provider_kind: AgentToolRegistryAdapterTrace["provider_kind"];
533
+ provider_contract: AgentToolRegistryAdapterTrace["provider_contract"];
534
+ provider_replacement_target: AgentToolRegistryAdapterTrace["provider_replacement_target"];
535
+ source_catalog: AgentToolRegistryAdapterTrace["source_catalog"];
536
+ registry_contract: AgentToolRegistryAdapterTrace["registry_contract"];
537
+ action_surface: AgentToolRegistryAdapterTrace["action_surface"];
538
+ action_count: number;
539
+ allowed_action_ids: AgentActionId[];
540
+ tool_schema_format: AgentToolRegistryAdapterTrace["tool_schema_format"];
541
+ tool_schema_contract: AgentToolRegistryAdapterTrace["tool_schema_contract"];
542
+ tool_schema_count: number;
543
+ tool_schema_sha256: string;
544
+ mcp_visibility: AgentToolRegistryAdapterTrace["mcp_visibility"];
545
+ low_level_tool_policy: AgentToolRegistryAdapterTrace["low_level_tool_policy"];
546
+ privacy_boundary: {
547
+ low_level_mcp_tools_exposed_to_model: false;
548
+ raw_tool_schema_body_exposed_in_status: false;
549
+ hardware_state_source: "go-local-bridge";
550
+ board_facts_source: "boardpack";
551
+ };
552
+ }
553
+ interface AgentClosedLoopReadiness {
554
+ kind: "embedlabs.agent_closed_loop_readiness";
555
+ local_identity_ready: boolean;
556
+ memory_ready: boolean;
557
+ agent_persistence_ready: boolean;
558
+ bridge_inventory_ready: boolean;
559
+ plugin_transport_ready: boolean;
560
+ plugin_installation_ready: boolean;
561
+ plugin_install_required: boolean;
562
+ plugin_update_required: boolean;
563
+ plugin_missing_targets: Array<"codex" | "opencode" | "trae">;
564
+ plugin_stale_targets: Array<"codex" | "opencode" | "trae">;
565
+ plugin_unwritable_targets: Array<"codex" | "opencode" | "trae">;
566
+ model_config_ready: boolean;
567
+ public_report_queue_ready: boolean;
568
+ admin_review_ready: boolean;
569
+ admin_review_state: "ready" | "sync_required" | "no_reports";
570
+ maintainer_handoff_ready: boolean;
571
+ maintainer_handoff_state: "ready" | "sync_required" | "no_reports";
572
+ board_count: number;
573
+ pending_report_count: number;
574
+ local_tool_loop_ready: boolean;
575
+ native_agent_runtime_ready: boolean;
576
+ minimum_loop_ready: boolean;
577
+ retained_plugin_targets: Array<"codex" | "opencode" | "trae">;
578
+ blocking_reasons: string[];
579
+ advisory_warnings: string[];
580
+ next_commands?: AgentNextCommand[];
581
+ }
582
+ interface AgentPersistenceStatus {
583
+ kind: "embedlabs.agent_persistence_status";
584
+ readiness: "ready" | "warning";
585
+ home: string;
586
+ writable: boolean;
587
+ directories: Array<{
588
+ key: "memory" | "sessions" | "skills" | "reports" | "maintainer_tasks";
589
+ status: "ready" | "warning";
590
+ reason: "writable" | "missing" | "not_directory" | "not_writable";
591
+ error_code?: string;
592
+ }>;
593
+ warning_count: number;
594
+ remediation?: string;
595
+ next_commands?: AgentNextCommand[];
596
+ privacy_boundary: {
597
+ raw_agent_home_exported: false;
598
+ write_probe_content_exported: false;
599
+ };
600
+ }
601
+ interface AgentPluginIntegrationSummary {
602
+ kind: "embedlabs.ide_plugin_integrations";
603
+ mode: "native_agent_compatibility_transport";
604
+ default_tool_surface: "agent_first_six_tools";
605
+ mcp_server_name: "embed-labs";
606
+ default_visible_tools: [
607
+ "embedlabs_agent_status",
608
+ "embedlabs_action_schema",
609
+ "embedlabs_action_run",
610
+ "embedlabs_chat",
611
+ "embedlabs_plugin_update_check",
612
+ "embedlabs_plugin_update"
613
+ ];
614
+ local_identity_only: true;
615
+ normal_user_entrypoint: "plugin_install_then_high_level_agent_actions";
616
+ retained_targets: AgentPluginIntegrationTarget[];
617
+ install_all_command: string;
618
+ update_all_command: string;
619
+ installation_health: AgentPluginInstallationHealth;
620
+ privacy_boundary: {
621
+ plugin_stores_provider_key: false;
622
+ plugin_uploads_raw_source: false;
623
+ plugin_routes_through_local_agent: true;
624
+ low_level_tools_hidden_by_default: true;
625
+ };
626
+ }
627
+ interface AgentPluginIntegrationTarget {
628
+ id: "codex" | "opencode" | "trae";
629
+ display_name: string;
630
+ role: "ide_agent_transport";
631
+ default_tool_profile: "agent";
632
+ routes_through_local_agent: true;
633
+ requires_platform_token: false;
634
+ install_command: string;
635
+ update_command: string;
636
+ installed?: boolean;
637
+ installed_version?: string;
638
+ local_integrity?: AgentPluginLocalIntegrity;
639
+ target_write_access?: AgentPluginTargetWriteAccess;
640
+ target_path?: string;
641
+ }
642
+ interface AgentPluginInstallationHealth {
643
+ ready: boolean;
644
+ install_required: boolean;
645
+ update_required: boolean;
646
+ missing_targets: Array<"codex" | "opencode" | "trae">;
647
+ stale_targets: Array<"codex" | "opencode" | "trae">;
648
+ unwritable_targets: Array<"codex" | "opencode" | "trae">;
649
+ install_command?: string;
650
+ repair_command?: string;
651
+ }
652
+ interface AgentPluginLocalIntegrity {
653
+ status: "ok" | "not_installed" | "source_missing" | "source_checkout_stale" | "not_checked";
654
+ update_required: boolean;
655
+ summary: string;
656
+ }
657
+ interface AgentPluginTargetWriteAccess {
658
+ writable: boolean;
659
+ checked_path: string;
660
+ error_code?: string;
661
+ remediation?: string;
662
+ }
663
+ interface AgentStatusModelSummary {
664
+ kind: "embedlabs.local_model_config";
665
+ config_source: "embedlabs_local_config";
666
+ configured: boolean;
667
+ default_profile: string;
668
+ selected_profile?: string;
669
+ provider?: string;
670
+ model?: string;
671
+ api_key: "set" | "missing";
672
+ base_url: "configured" | "default" | "missing";
673
+ agent_runtime: {
674
+ enabled: boolean;
675
+ activation_source: "local_model_config" | "env_override" | "disabled";
676
+ mode: "local_openai_compatible";
677
+ };
678
+ privacy_boundary: {
679
+ provider_key_storage: "local_config_or_env";
680
+ provider_key_exported: false;
681
+ config_path_exported: false;
682
+ upstream_adapter_details_exported: false;
683
+ };
684
+ }
685
+ interface AgentUpstreamAdapterSummary {
686
+ kind: "embedlabs.upstream_adapter_status";
687
+ mode: "compatible_export";
688
+ available: true;
689
+ local_only: true;
690
+ raw_personal_memory_uploaded_by_default: false;
691
+ export_command: string;
692
+ audit_command: string;
693
+ audited_reference: {
694
+ version: string;
695
+ tag: string;
696
+ release_label_date: string;
697
+ published_at: string;
698
+ main_sha: string;
699
+ main_committed_at: string;
700
+ main_message: string;
701
+ main_ahead_of_latest_release: boolean;
702
+ license: "MIT";
703
+ audit_scope: "latest_named_release";
704
+ };
705
+ compatible_concepts: string[];
706
+ forbidden_takeover: string[];
707
+ upgrade_gates: string[];
708
+ }
709
+ export interface AgentIdentityResult {
710
+ action: "status" | "init";
711
+ reset: boolean;
712
+ installation: AgentInstallationStatus;
713
+ quarantined_personal_memory?: AgentPersonalMemoryQuarantineResult;
714
+ next_commands?: AgentNextCommand[];
715
+ }
716
+ interface AgentPersonalMemoryQuarantineResult {
717
+ reason: "copied_installation_fingerprint_mismatch";
718
+ quarantine_dir: string;
719
+ moved_dirs: string[];
720
+ }
721
+ interface AgentInstallationStatus {
722
+ kind: "embedlabs.local_installation_identity";
723
+ installation_id: string;
724
+ profile: "default";
725
+ installation_file: string;
726
+ memory_home: string;
727
+ fingerprint_version: "v1";
728
+ fingerprint_hash?: string;
729
+ current_fingerprint_hash?: string;
730
+ fingerprint_source?: string;
731
+ current_fingerprint_source?: string;
732
+ key_algorithm?: "ed25519";
733
+ public_key_sha256?: string;
734
+ public_key_configured: boolean;
735
+ private_key_configured: boolean;
736
+ integrity: "ok" | "failed" | "missing";
737
+ platform: string;
738
+ arch: string;
739
+ hostname_hash?: string;
740
+ copied_installation_policy: "fingerprint_mismatch_requires_reinitialize";
741
+ remediation?: string;
742
+ }
743
+ interface AgentPublicExperienceSummary {
744
+ reports_dir: string;
745
+ total_reports: number;
746
+ pending_reports: number;
747
+ failed_reports: number;
748
+ uploaded_reports: number;
749
+ superseded_reports?: number;
750
+ sync_required: boolean;
751
+ pending_summary?: AgentPublicExperienceQueueSummary;
752
+ latest_report_id?: string;
753
+ latest_report_status?: string;
754
+ latest_report_category?: string;
755
+ latest_report_title?: string;
756
+ latest_optimization_item_id?: string;
757
+ latest_admin_review_url?: string;
758
+ latest_create_fix_candidate_command?: string;
759
+ current_report_id?: string;
760
+ current_report_status?: string;
761
+ current_report_category?: string;
762
+ current_report_title?: string;
763
+ current_report_optimization_item_id?: string;
764
+ current_report_admin_review_url?: string;
765
+ current_report_create_fix_candidate_command?: string;
766
+ }
767
+ interface AgentPublicExperienceQueueSummary {
768
+ pending_by_category: AgentPublicExperienceQueueBucket[];
769
+ pending_by_severity: AgentPublicExperienceQueueBucket[];
770
+ pending_by_component: AgentPublicExperienceQueueBucket[];
771
+ pending_by_board: AgentPublicExperienceQueueBucket[];
772
+ pending_by_variant: AgentPublicExperienceQueueBucket[];
773
+ pending_by_action: AgentPublicExperienceQueueBucket[];
774
+ pending_by_capability: AgentPublicExperienceQueueBucket[];
775
+ pending_error_codes: AgentPublicExperienceQueueBucket[];
776
+ }
777
+ interface AgentPublicExperienceQueueBucket {
778
+ value: string;
779
+ count: number;
780
+ }
781
+ export interface AgentMemoryResult {
782
+ action: "show" | "status" | "export" | "clear" | "search" | "refine";
783
+ memory: AgentMemorySummary;
784
+ detail?: AgentMemoryDetail;
785
+ detail_limit?: number;
786
+ status?: AgentMemoryProviderStatus;
787
+ search?: AgentMemorySearchResult;
788
+ skill_candidate?: AgentMemorySkillCandidateRefinementResult;
789
+ exported_path?: string;
790
+ cleared?: boolean;
791
+ }
792
+ interface AgentMemoryProviderStatus {
793
+ schema_version: 1;
794
+ kind: "embedlabs.agent_memory_provider_status";
795
+ readiness: "ready" | "identity_required" | "integrity_failed";
796
+ provider: AgentMemoryProviderAdapterTrace;
797
+ storage: {
798
+ home: "~/.embedlabs/agent";
799
+ memory_dir: "memory";
800
+ sessions_dir: "sessions";
801
+ skills_dir: "skills";
802
+ reports_dir: "reports";
803
+ maintainer_tasks_dir: "maintainer-tasks";
804
+ };
805
+ counts: {
806
+ profile_memory_count: number;
807
+ workflow_memory_count: number;
808
+ failure_memory_count: number;
809
+ session_count: number;
810
+ skill_count: number;
811
+ maintainer_task_count: number;
812
+ pending_report_count: number;
813
+ failed_report_count: number;
814
+ };
815
+ installation_identity?: AgentMemorySummary["installation_identity"];
816
+ issue?: {
817
+ code: AgentIdentityGateIssue["code"];
818
+ message: string;
819
+ remediation: string;
820
+ };
821
+ available_commands: string[];
822
+ upstream_compatible_concepts: [
823
+ "memory_provider",
824
+ "session_search",
825
+ "profile_memory",
826
+ "workflow_memory",
827
+ "failure_distillation",
828
+ "skill_refinement"
829
+ ];
830
+ privacy_boundary: {
831
+ local_only: true;
832
+ raw_personal_memory_uploaded_by_default: false;
833
+ raw_source_uploaded_by_default: false;
834
+ public_upload_uses_redacted_reports: true;
835
+ memory_status_exposes_raw_entries: false;
836
+ };
837
+ next_commands?: AgentNextCommand[];
838
+ }
839
+ interface AgentMemoryDetail {
840
+ profiles: AgentMemoryProfileSummary[];
841
+ workflows: AgentMemoryWorkflowSummary[];
842
+ failures: AgentMemoryFailureSummary[];
843
+ skill_candidates: AgentMemorySkillCandidateSummary[];
844
+ recent_sessions: Array<{
845
+ session_id: string;
846
+ prompt_excerpt?: string;
847
+ intent?: string;
848
+ created_at?: string;
849
+ }>;
850
+ }
851
+ interface AgentMemoryProfileSummary {
852
+ profile_type?: string;
853
+ title?: string;
854
+ board_id?: string;
855
+ build_profile?: string;
856
+ toolchain_mode?: string;
857
+ channel?: string;
858
+ version?: string;
859
+ source_basename?: string;
860
+ output_basename?: string;
861
+ usage_count?: number;
862
+ last_seen_at?: string;
863
+ summary?: string;
864
+ connection_transports?: string[];
865
+ connection_habit_count?: number;
866
+ }
867
+ interface AgentMemoryWorkflowSummary {
868
+ workflow_id?: string;
869
+ action_id?: string;
870
+ board_id?: string;
871
+ observed_at?: string;
872
+ summary?: string;
873
+ }
874
+ interface AgentMemoryFailureSummary {
875
+ failure_id?: string;
876
+ action_id?: string;
877
+ board_id?: string;
878
+ observed_at?: string;
879
+ summary?: string;
880
+ error?: string;
881
+ }
882
+ interface AgentMemorySkillCandidateSummary {
883
+ name: string;
884
+ title?: string;
885
+ kind?: string;
886
+ component?: string;
887
+ status?: "candidate" | "reviewed" | "rejected";
888
+ reviewed_at?: string;
889
+ updated_at?: string;
890
+ path: string;
891
+ path_hash?: string;
892
+ }
893
+ interface AgentMemorySkillCandidateRefinementResult extends AgentMemorySkillCandidateSummary {
894
+ action: "refine";
895
+ notes?: string;
896
+ privacy_boundary: {
897
+ local_only: true;
898
+ raw_skill_body_uploaded_by_default: false;
899
+ auto_activate_allowed: false;
900
+ requires_owner_review_for_product_promotion: true;
901
+ };
902
+ }
903
+ interface AgentMemorySearchResult {
904
+ schema_version: number;
905
+ kind: "embedlabs.agent_memory_search";
906
+ query: string;
907
+ terms: string[];
908
+ limit: number;
909
+ total_matches: number;
910
+ indexed_counts: {
911
+ memory_files: number;
912
+ skill_files: number;
913
+ session_files: number;
914
+ };
915
+ results: AgentMemorySearchEntry[];
916
+ privacy_boundary: {
917
+ local_only: true;
918
+ raw_personal_memory_uploaded_by_default: false;
919
+ public_upload_uses_redacted_reports: true;
920
+ };
921
+ }
922
+ interface AgentMemorySearchEntry {
923
+ kind: "profile" | "workflow" | "failure" | "skill_candidate" | "session";
924
+ title: string;
925
+ summary?: string;
926
+ source_ref: string;
927
+ score: number;
928
+ matched_terms: string[];
929
+ board_id?: string;
930
+ action_id?: string;
931
+ intent?: string;
932
+ observed_at?: string;
933
+ privacy_scope: "local_personal_memory";
934
+ }
935
+ interface AgentMemoryContextEntry {
936
+ kind: "profile" | "workflow" | "failure" | "skill_candidate" | "recent_session";
937
+ title: string;
938
+ summary?: string;
939
+ path: string;
940
+ path_hash?: string;
941
+ relevance_score: number;
942
+ matched_terms: string[];
943
+ board_id?: string;
944
+ intent?: string;
945
+ last_seen_at?: string;
946
+ metadata?: Record<string, unknown>;
947
+ privacy_scope: "local_personal_memory";
948
+ }
949
+ interface AgentMemorySuggestion {
950
+ kind: "build_project" | "install_toolchain" | "deploy_app" | "flash_image" | "capture_signal" | "query_board_knowledge" | "general";
951
+ title: string;
952
+ detail: string;
953
+ source_entry_title: string;
954
+ privacy_scope: "local_personal_memory";
955
+ }
956
+ interface AgentResponsePreference {
957
+ kind: "language" | "brevity" | "general";
958
+ value: "zh" | "concise" | string;
959
+ detail: string;
960
+ source_entry_title: string;
961
+ privacy_scope: "local_personal_memory";
962
+ }
963
+ interface AgentMemoryContext {
964
+ schema_version: number;
965
+ kind: "embedlabs.agent_memory_context";
966
+ adapter_kind: "embedlabs.upstream_memory_context_adapter";
967
+ adapter_schema_version: 1;
968
+ provider: AgentMemoryProviderAdapterTrace;
969
+ provider_source: "embedlabs_local_personal_memory";
970
+ storage_home: "~/.embedlabs/agent";
971
+ upstream_concepts: [
972
+ "memory_provider",
973
+ "session_search",
974
+ "profile_memory",
975
+ "workflow_memory",
976
+ "failure_distillation"
977
+ ];
978
+ generated_at: string;
979
+ source: "local_personal_memory";
980
+ query: {
981
+ intent_id: string;
982
+ prompt_terms: string[];
983
+ board_template_hint?: string;
984
+ };
985
+ entries: AgentMemoryContextEntry[];
986
+ counts: {
987
+ profiles_considered: number;
988
+ workflows_considered: number;
989
+ failures_considered: number;
990
+ skill_candidates_considered: number;
991
+ sessions_considered: number;
992
+ };
993
+ privacy_boundary: {
994
+ local_only: true;
995
+ raw_personal_memory_uploaded_by_default: false;
996
+ public_upload_uses_redacted_reports: true;
997
+ };
998
+ }
999
+ interface AgentMemoryProviderAdapterTrace {
1000
+ kind: "embedlabs.upstream_memory_provider_adapter";
1001
+ schema_version: 1;
1002
+ provider_kind: "embedlabs.local_personal_memory_provider";
1003
+ provider_contract: "embedlabs.memory_provider.v1";
1004
+ provider_replacement_target: "upstream_memory_provider";
1005
+ storage_home: "~/.embedlabs/agent";
1006
+ scope: "installation_local_personal_memory";
1007
+ lifecycle: {
1008
+ prefetch: "synchronous_local_relevance_search";
1009
+ turn_sync: "session_persist_after_turn";
1010
+ extraction: "explicit_agent_memory_and_workflow_writes";
1011
+ provider_tools: "disabled_until_upstream_runtime";
1012
+ };
1013
+ query_strategy: {
1014
+ kind: "bounded_local_relevance_search";
1015
+ max_entries: 12;
1016
+ sources: ["profile_memory", "workflow_memory", "failure_memory", "skill_candidates", "session_index"];
1017
+ ranking: "matched_terms_plus_intent_and_recency";
1018
+ };
1019
+ write_policy: {
1020
+ automatic_public_promotion: false;
1021
+ personal_memory_only: true;
1022
+ public_reports_must_be_redacted: true;
1023
+ };
1024
+ privacy_boundary: {
1025
+ local_only: true;
1026
+ raw_personal_memory_uploaded_by_default: false;
1027
+ raw_source_uploaded_by_default: false;
1028
+ absolute_paths_exported: false;
1029
+ user_model_key_uploaded: false;
1030
+ };
1031
+ }
1032
+ export interface AgentReportResult {
1033
+ action: "list" | "submit";
1034
+ reports: AgentStoredReportSummary[];
1035
+ pagination?: AgentReportPagination;
1036
+ submitted?: AgentReportUploadResult;
1037
+ installation_identity_status?: AgentInstallationIdentityStatusSnapshot;
1038
+ identity_setup?: AgentIdentitySetupGuidance;
1039
+ next_commands?: AgentNextCommand[];
1040
+ }
1041
+ interface AgentReportPagination {
1042
+ total: number;
1043
+ returned: number;
1044
+ limit: number;
1045
+ offset: number;
1046
+ has_more: boolean;
1047
+ all: boolean;
1048
+ next_page_command?: string;
1049
+ previous_page_command?: string;
1050
+ }
1051
+ export interface AgentSyncResult {
1052
+ pending_before: number;
1053
+ pending_after?: number;
1054
+ selected: number;
1055
+ selected_reports?: AgentSyncSelectedReportSummary[];
1056
+ uploaded: number;
1057
+ failed: number;
1058
+ persistence_warning_count?: number;
1059
+ uploaded_with_persistence_warning?: number;
1060
+ local_state_update_failed?: boolean;
1061
+ reports: AgentReportUploadResult[];
1062
+ next_commands?: AgentNextCommand[];
1063
+ trigger?: "manual" | "auto";
1064
+ upload_mode?: "none" | "batch" | "single";
1065
+ telemetry_events_generated: number;
1066
+ telemetry_events_uploaded: number;
1067
+ timed_out?: boolean;
1068
+ timeout_ms?: number;
1069
+ upload_diagnostics?: AgentSyncUploadDiagnostics;
1070
+ error?: {
1071
+ code: string;
1072
+ message: string;
1073
+ remediation?: string;
1074
+ };
1075
+ }
1076
+ interface AgentSyncUploadDiagnostics {
1077
+ cloud_upload_required: boolean;
1078
+ local_agent_workflows_continue: boolean;
1079
+ pending_reports_kept_local: boolean;
1080
+ diagnostic_command: string;
1081
+ retry_command?: string;
1082
+ summary: string;
1083
+ }
1084
+ interface AgentSyncSelectedReportSummary {
1085
+ report_id: string;
1086
+ status: AgentEffectiveReportStatus;
1087
+ title?: string;
1088
+ category?: string;
1089
+ severity?: string;
1090
+ component?: string;
1091
+ board_id?: string;
1092
+ variant_id?: string;
1093
+ action_id?: string;
1094
+ capability_id?: string;
1095
+ error_code?: string;
1096
+ }
1097
+ export interface AgentUpstreamAuditResult {
1098
+ action: "audit";
1099
+ ok: boolean;
1100
+ checked_at: string;
1101
+ repository: string;
1102
+ docs: string;
1103
+ latest_release: {
1104
+ title?: string;
1105
+ version?: string;
1106
+ tag?: string;
1107
+ release_label_date?: string;
1108
+ published_at?: string;
1109
+ html_url?: string;
1110
+ };
1111
+ main: {
1112
+ sha?: string;
1113
+ committed_at?: string;
1114
+ message?: string;
1115
+ };
1116
+ main_ahead_of_latest_release: boolean;
1117
+ license: {
1118
+ spdx_id?: string;
1119
+ name?: string;
1120
+ html_url?: string;
1121
+ };
1122
+ self_evolution: {
1123
+ repository: string;
1124
+ plan: string;
1125
+ reuse_boundary: "reference_only_owner_reviewed";
1126
+ darwinian_code_license_boundary: "AGPL v3 external reference only";
1127
+ };
1128
+ checks: Array<{
1129
+ name: string;
1130
+ ok: boolean;
1131
+ detail: string;
1132
+ }>;
1133
+ next_commands: AgentNextCommand[];
1134
+ }
1135
+ export interface AgentChatResult {
1136
+ mode: "one_shot" | "interactive" | "session";
1137
+ turns: LocalAgentRunResult[];
1138
+ chat_session?: AgentChatSessionRecord;
1139
+ next_commands?: AgentNextCommand[];
1140
+ }
1141
+ interface AgentChatSessionTurnRef {
1142
+ turn_index: number;
1143
+ turn_session_id: string;
1144
+ turn_session_ref: string;
1145
+ turn_session_path_hash: string;
1146
+ prompt_sha256: string;
1147
+ prompt_excerpt?: string;
1148
+ intent_id: AgentIntent["id"];
1149
+ answer_sha256: string;
1150
+ model_invocation_state: AgentModelInvocationTrace["invocation_state"];
1151
+ memory_context_entries: number;
1152
+ created_at: string;
1153
+ }
1154
+ interface AgentChatSessionRecord {
1155
+ kind: "embedlabs.agent_chat_session";
1156
+ schema_version: 1;
1157
+ adapter_kind: "embedlabs.upstream_session_adapter";
1158
+ provider_kind: "embedlabs.local_session_provider";
1159
+ provider_contract: "embedlabs.session_provider.v1";
1160
+ provider_replacement_target: "upstream_session_provider";
1161
+ chat_session_id: string;
1162
+ session_ref: string;
1163
+ session_path: string;
1164
+ session_path_hash: string;
1165
+ storage_home: "~/.embedlabs/agent/sessions";
1166
+ mode: "local_persistent_chat";
1167
+ created_at: string;
1168
+ updated_at: string;
1169
+ turn_count: number;
1170
+ turns: AgentChatSessionTurnRef[];
1171
+ privacy_boundary: {
1172
+ local_only: true;
1173
+ raw_prompt_exported_by_default: false;
1174
+ raw_model_response_storage: false;
1175
+ raw_personal_memory_uploaded_by_default: false;
1176
+ public_upload_path: "redacted_public_reports_only";
1177
+ };
1178
+ }
1179
+ interface AgentChatSessionPromptContext {
1180
+ kind: "embedlabs.upstream_chat_session_prompt_context_adapter";
1181
+ schema_version: 1;
1182
+ provider_kind: "embedlabs.local_session_provider";
1183
+ source: "local_chat_session";
1184
+ injection_mode: "bounded_sanitized_turn_summaries";
1185
+ max_turns: 6;
1186
+ chat_session_id: string;
1187
+ session_ref: string;
1188
+ turn_count: number;
1189
+ included_turns: number;
1190
+ entries: AgentChatSessionPromptEntry[];
1191
+ prompt_fragment_sha256: string;
1192
+ privacy_boundary: {
1193
+ local_only: true;
1194
+ raw_prompt_included: false;
1195
+ raw_model_response_included: false;
1196
+ raw_personal_memory_included: false;
1197
+ user_model_key_included: false;
1198
+ public_upload_payload_included: false;
1199
+ };
1200
+ }
1201
+ interface AgentChatSessionPromptEntry {
1202
+ turn_index: number;
1203
+ turn_session_ref: string;
1204
+ prompt_sha256: string;
1205
+ prompt_excerpt?: string;
1206
+ intent_id: AgentIntent["id"];
1207
+ answer_sha256: string;
1208
+ model_invocation_state: AgentModelInvocationTrace["invocation_state"];
1209
+ memory_context_entries: number;
1210
+ }
1211
+ export interface AgentActionResult {
1212
+ action: "list" | "schema" | "describe" | "run";
1213
+ actions?: AgentActionDefinition[];
1214
+ action_id?: AgentActionId;
1215
+ definition?: AgentActionDefinition;
1216
+ execution?: AgentActionExecution;
1217
+ report?: AgentReportUploadResult;
1218
+ public_experience?: AgentPublicExperienceSummary;
1219
+ next_commands?: AgentNextCommand[];
1220
+ }
1221
+ export interface AgentMaintainerResult {
1222
+ action: "list" | "show" | "pull" | "plan" | "repair-start" | "repair-context" | "repair-draft" | "repair-generate-patch" | "repair-apply" | "repair-execute" | "repair-finish" | "submit-result" | "review-run" | "release-candidates" | "readiness" | "readiness-decision";
1223
+ installation_identity_status: AgentInstallationIdentityStatusSnapshot;
1224
+ total?: number;
1225
+ limit?: number;
1226
+ offset?: number;
1227
+ tasks?: AgentMaintainerTaskSummary[];
1228
+ task?: AgentMaintainerTaskSummary;
1229
+ detail?: unknown;
1230
+ reports?: unknown[];
1231
+ run?: AgentMaintainerTaskRunSummary;
1232
+ review?: Record<string, unknown>;
1233
+ candidates?: Record<string, unknown>[];
1234
+ candidate?: Record<string, unknown>;
1235
+ readiness_bundle?: Record<string, unknown>;
1236
+ decision?: Record<string, unknown>;
1237
+ publication_boundary?: Record<string, unknown>;
1238
+ maintainer_handoff?: Record<string, unknown>;
1239
+ pulled_path?: string;
1240
+ plan?: AgentMaintainerRepairPlan;
1241
+ plan_path?: string;
1242
+ submitted_run?: AgentMaintainerTaskRunSummary;
1243
+ result_path?: string;
1244
+ review_path?: string;
1245
+ readiness_path?: string;
1246
+ readiness_decision_path?: string;
1247
+ repair_session?: AgentMaintainerRepairSession;
1248
+ repair_session_path?: string;
1249
+ repair_context?: AgentMaintainerRepairContextBundle;
1250
+ repair_context_path?: string;
1251
+ repair_draft?: AgentMaintainerPatchDraftBundle;
1252
+ repair_draft_path?: string;
1253
+ generated_patch?: AgentMaintainerGeneratedPatchBundle;
1254
+ generated_patch_path?: string;
1255
+ repair_apply?: AgentMaintainerPatchApplyBundle;
1256
+ repair_apply_path?: string;
1257
+ repair_execute?: AgentMaintainerRepairExecuteBundle;
1258
+ repair_execute_path?: string;
1259
+ release_candidate?: AgentMaintainerReleaseCandidate;
1260
+ next_commands?: AgentNextCommand[];
1261
+ }
1262
+ type AgentActionId = "detect_board" | "query_board_knowledge" | "install_toolchain" | "build_project" | "flash_image" | "deploy_app" | "debug_board" | "capture_signal" | "manage_board_pack" | "submit_report" | "create_fix_candidate";
1263
+ interface AgentActionDefinition {
1264
+ action_id: AgentActionId;
1265
+ title: string;
1266
+ status: "available" | "planned";
1267
+ risk: "read_only" | "cloud_report" | "writes_local_files" | "hardware_mutation" | "maintainer_only";
1268
+ description: string;
1269
+ required_inputs: string[];
1270
+ optional_inputs: string[];
1271
+ input_schema: AgentActionInputSchema[];
1272
+ safety: AgentActionSafetyContract;
1273
+ routes_to: string[];
1274
+ }
1275
+ interface AgentActionInputSchema {
1276
+ name: string;
1277
+ type: "string" | "boolean" | "number" | "path" | "string[]" | "object";
1278
+ required: boolean;
1279
+ source: "prompt" | "cli_flag" | "local_bridge_inventory" | "local_memory_hint" | "board_pack" | "admin_review" | "execution_layer";
1280
+ description: string;
1281
+ aliases?: string[];
1282
+ values?: string[];
1283
+ default?: string | number | boolean;
1284
+ sensitive?: boolean;
1285
+ }
1286
+ interface AgentActionSafetyContract {
1287
+ approval_required: boolean;
1288
+ target_selection: "not_applicable" | "single_or_explicit" | "explicit_for_side_effects" | "admin_confirmed_item";
1289
+ side_effects: Array<"none" | "local_files" | "hardware_io" | "hardware_flash" | "cloud_report" | "maintainer_task">;
1290
+ must_not_infer: string[];
1291
+ report_on_failure: boolean;
1292
+ }
1293
+ interface AgentActionExecution {
1294
+ action_id: AgentActionId;
1295
+ ok: boolean;
1296
+ summary: string;
1297
+ installation_identity_status?: AgentInstallationIdentityStatusSnapshot;
1298
+ selection?: AgentActionSelectionSummary;
1299
+ bridge?: AgentBridgeSnapshot;
1300
+ board?: AgentBridgeBoardSummary;
1301
+ boards?: AgentBridgeBoardSummary[];
1302
+ knowledge?: AgentKnowledgeSearchSummary;
1303
+ knowledge_source?: "cloud_board_pack" | "local_board_pack_fallback";
1304
+ cloud_error?: {
1305
+ code: string;
1306
+ message: string;
1307
+ remediation?: string;
1308
+ };
1309
+ report?: AgentReportUploadResult;
1310
+ toolchain?: AgentToolchainInstallSummary;
1311
+ toolchain_operation?: AgentToolchainOperationSummary;
1312
+ build?: AgentBuildSummary;
1313
+ flash?: AgentFlashSummary;
1314
+ deploy?: AgentDeploySummary;
1315
+ fix_candidate?: AgentMaintainerTaskSummary;
1316
+ board_pack?: AgentBoardPackSummary;
1317
+ tool_results?: AgentToolResultSummary[];
1318
+ next_actions?: AgentActionId[];
1319
+ next_commands?: AgentNextCommand[];
1320
+ error?: {
1321
+ code: string;
1322
+ message: string;
1323
+ remediation?: string;
1324
+ };
1325
+ }
1326
+ interface AgentActionSelectionSummary {
1327
+ kind: "embedlabs.agent_action_selection";
1328
+ action_id: AgentActionId;
1329
+ template_id?: string;
1330
+ template_source?: "explicit" | "prompt_text" | "bridge_inventory" | "local_profile";
1331
+ memory_ref?: string;
1332
+ memory_path_hash?: string;
1333
+ privacy_scope?: "local_personal_memory";
1334
+ }
1335
+ export interface AgentNextCommand {
1336
+ label: string;
1337
+ command: string;
1338
+ description?: string;
1339
+ }
1340
+ interface AgentMaintainerReleaseCandidate {
1341
+ schema_version: 1;
1342
+ kind: "embedlabs.maintainer_release_candidate";
1343
+ generated_at: string;
1344
+ maintainer_task_id: string;
1345
+ optimization_item_id?: string;
1346
+ maintainer_task_run_id?: string;
1347
+ title?: string;
1348
+ status: "candidate_ready" | "candidate_failed";
1349
+ summary: string;
1350
+ changed_files: Array<{
1351
+ path: string;
1352
+ source?: string;
1353
+ }>;
1354
+ test_evidence: Array<Record<string, unknown>>;
1355
+ failure_report?: Record<string, unknown>;
1356
+ risk_flags: string[];
1357
+ owner_review: {
1358
+ required: true;
1359
+ next_actions: string[];
1360
+ review_commands: AgentNextCommand[];
1361
+ };
1362
+ publication_boundary: {
1363
+ auto_publish_allowed: false;
1364
+ npm_publish_allowed: false;
1365
+ server_deploy_allowed: false;
1366
+ production_release_allowed: false;
1367
+ owner_explicit_release_required: true;
1368
+ };
1369
+ release_gate: AgentMaintainerReleaseGate;
1370
+ }
1371
+ interface AgentToolchainInstallSummary {
1372
+ board_id: string;
1373
+ version: string;
1374
+ channel: string;
1375
+ host: string;
1376
+ mode: string;
1377
+ install_root: string;
1378
+ release_root: string;
1379
+ validation_ok: boolean;
1380
+ summary_for_user?: string;
1381
+ }
1382
+ interface AgentToolchainOperationSummary {
1383
+ operation: "list" | "install" | "update" | "uninstall";
1384
+ board_id?: string;
1385
+ channel?: string;
1386
+ metadata_source?: "built_in" | "local_override";
1387
+ metadata_root?: string;
1388
+ install_root?: string;
1389
+ environment_count?: number;
1390
+ installed_count?: number;
1391
+ update_count?: number;
1392
+ environments?: Array<{
1393
+ board_id: string;
1394
+ display_name: string;
1395
+ status: string;
1396
+ local_version?: string;
1397
+ server_version?: string;
1398
+ version_source?: "server_manifest" | "built_in_manifest";
1399
+ download_metadata_status?: "metadata_available" | "metadata_unavailable";
1400
+ modes?: string[];
1401
+ install_command?: string;
1402
+ update_command?: string;
1403
+ uninstall_command?: string;
1404
+ }>;
1405
+ removed?: boolean;
1406
+ removed_paths?: string[];
1407
+ removed_registry_entry?: boolean;
1408
+ registry_path?: string;
1409
+ observed_at?: string;
1410
+ }
1411
+ interface AgentBoardPackSummary {
1412
+ operation: "list" | "show";
1413
+ source?: "cloud_board_pack_catalog" | "local_board_pack_catalog_fallback";
1414
+ observed_at?: string;
1415
+ profile_count: number;
1416
+ template_id?: string;
1417
+ profiles?: AgentBoardPackProfileSummary[];
1418
+ profile?: AgentBoardPackProfileSummary;
1419
+ }
1420
+ interface AgentBoardPackProfileSummary {
1421
+ template_id: string;
1422
+ board_id?: string;
1423
+ variant_id?: string;
1424
+ hardware_profile_id?: string;
1425
+ display_name?: string;
1426
+ support_level?: string;
1427
+ method_count: number;
1428
+ knowledge_file_count: number;
1429
+ build_template_id?: string;
1430
+ local_toolchain_status?: "installed" | "available" | "update_available" | "unsupported_host";
1431
+ local_toolchain_version?: string;
1432
+ server_toolchain_version?: string;
1433
+ toolchain_version_source?: "server_manifest" | "built_in_manifest";
1434
+ toolchain_metadata_status?: "metadata_available" | "metadata_unavailable";
1435
+ install_modes?: string[];
1436
+ toolchain_install_command?: string;
1437
+ toolchain_update_command?: string;
1438
+ toolchain_uninstall_command?: string;
1439
+ }
1440
+ interface AgentBuildSummary {
1441
+ board_id: string;
1442
+ operation: string;
1443
+ source_path: string;
1444
+ artifact_path: string;
1445
+ artifact_size_bytes: number;
1446
+ artifact_sha256: string;
1447
+ manifest_path?: string;
1448
+ }
1449
+ interface AgentFlashSummary {
1450
+ board_id: string;
1451
+ profile_id?: string;
1452
+ artifact_kind?: string;
1453
+ artifact_source?: string;
1454
+ plan_id?: string;
1455
+ ready: boolean;
1456
+ destructive?: boolean;
1457
+ approval_required?: boolean;
1458
+ summary?: string;
1459
+ artifact_path?: string;
1460
+ image_dir?: string;
1461
+ partition?: string;
1462
+ target_volume_path?: string;
1463
+ missing_tools?: string[];
1464
+ missing_files?: string[];
1465
+ warnings?: unknown[];
1466
+ errors?: unknown[];
1467
+ job?: AgentBridgeJobSummary;
1468
+ }
1469
+ interface AgentBridgeJobSummary {
1470
+ local_job_id: string;
1471
+ state: string;
1472
+ kind: string;
1473
+ progress_stage?: string;
1474
+ progress_text?: string;
1475
+ progress_percent?: number;
1476
+ output_tail?: string[];
1477
+ error?: {
1478
+ code: string;
1479
+ message: string;
1480
+ remediation?: string;
1481
+ };
1482
+ }
1483
+ interface AgentDeploySummary {
1484
+ board_id: string;
1485
+ host: string;
1486
+ user?: string;
1487
+ artifact_path: string;
1488
+ remote_path?: string;
1489
+ remote_dir?: string;
1490
+ remote_file?: string;
1491
+ deployed?: boolean;
1492
+ ran?: boolean;
1493
+ run_status?: string;
1494
+ run_command?: string;
1495
+ wrapper_script?: string;
1496
+ run_script?: string;
1497
+ wrapper_remote_path?: string;
1498
+ remote_pid?: string;
1499
+ app_pid?: string;
1500
+ wrapper_pid?: string;
1501
+ log_path?: string;
1502
+ output_tail?: string[];
1503
+ observed_at?: string;
1504
+ }
1505
+ interface AgentMaintainerTaskSummary {
1506
+ maintainer_task_id: string;
1507
+ optimization_item_id: string;
1508
+ status: string;
1509
+ title: string;
1510
+ branch_name?: string;
1511
+ context_bundle_ref?: string;
1512
+ reused_existing?: boolean;
1513
+ item_status?: string;
1514
+ created_at?: string;
1515
+ updated_at?: string;
1516
+ }
1517
+ interface AgentMaintainerTaskRunSummary {
1518
+ maintainer_task_run_id: string;
1519
+ maintainer_task_id: string;
1520
+ status: string;
1521
+ summary: string;
1522
+ changed_file_count: number;
1523
+ test_result_count: number;
1524
+ created_at?: string;
1525
+ }
1526
+ interface AgentMaintainerReleaseGate {
1527
+ owner_release_required: boolean;
1528
+ auto_release_allowed: boolean;
1529
+ release_command_allowed: boolean;
1530
+ publish_allowed: boolean;
1531
+ deploy_allowed: boolean;
1532
+ production_release_allowed: boolean;
1533
+ owner_explicit_publish_instruction_required: boolean;
1534
+ allowed_until_owner_release: string[];
1535
+ prohibited_actions: string[];
1536
+ next_owner_action: string;
1537
+ }
1538
+ interface AgentMaintainerRepairPlan {
1539
+ schema_version: number;
1540
+ kind: "embedlabs.maintainer_repair_plan";
1541
+ maintainer_task_id: string;
1542
+ optimization_item_id: string;
1543
+ title: string;
1544
+ generated_at: string;
1545
+ source: {
1546
+ bundle_path?: string;
1547
+ fetched_from_cloud: boolean;
1548
+ };
1549
+ issue_summary: {
1550
+ category?: string;
1551
+ severity?: string;
1552
+ board_id?: string;
1553
+ affected_component?: string;
1554
+ report_count?: number;
1555
+ tags: string[];
1556
+ };
1557
+ candidate_areas: AgentMaintainerCandidateArea[];
1558
+ context_evidence?: AgentMaintainerContextEvidence[];
1559
+ test_plan: AgentMaintainerTestStep[];
1560
+ execution_boundary: {
1561
+ read_only_plan: boolean;
1562
+ requires_owner_approved_task: boolean;
1563
+ auto_release_allowed: boolean;
1564
+ release_gate: AgentMaintainerReleaseGate;
1565
+ next_step: string;
1566
+ };
1567
+ }
1568
+ interface AgentMaintainerRepairSession {
1569
+ schema_version: number;
1570
+ kind: "embedlabs.maintainer_repair_session";
1571
+ repair_session_id: string;
1572
+ maintainer_task_id: string;
1573
+ optimization_item_id: string;
1574
+ title: string;
1575
+ started_at: string;
1576
+ plan_path: string;
1577
+ git: {
1578
+ cwd: string;
1579
+ repo_root?: string;
1580
+ head?: string;
1581
+ status_short?: string;
1582
+ available: boolean;
1583
+ error?: string;
1584
+ };
1585
+ candidate_areas: AgentMaintainerCandidateArea[];
1586
+ context_evidence?: AgentMaintainerContextEvidence[];
1587
+ test_plan: AgentMaintainerTestStep[];
1588
+ execution_boundary: {
1589
+ task_id_required: boolean;
1590
+ plan_required: boolean;
1591
+ auto_release_allowed: boolean;
1592
+ submit_result_required: boolean;
1593
+ release_gate: AgentMaintainerReleaseGate;
1594
+ next_step: string;
1595
+ };
1596
+ }
1597
+ interface AgentMaintainerRepairContextBundle {
1598
+ schema_version: number;
1599
+ kind: "embedlabs.maintainer_repair_context_bundle";
1600
+ generated_at: string;
1601
+ maintainer_task_id: string;
1602
+ optimization_item_id: string;
1603
+ repair_session_id: string;
1604
+ repair_session_path: string;
1605
+ title: string;
1606
+ git: AgentMaintainerRepairSession["git"];
1607
+ candidate_areas: AgentMaintainerCandidateArea[];
1608
+ context_evidence: AgentMaintainerContextEvidence[];
1609
+ file_contexts: AgentMaintainerFileContext[];
1610
+ test_plan: AgentMaintainerTestStep[];
1611
+ limits: {
1612
+ max_files: number;
1613
+ max_file_bytes: number;
1614
+ max_snippets_per_file: number;
1615
+ max_snippet_chars: number;
1616
+ };
1617
+ execution_boundary: {
1618
+ read_only_context: boolean;
1619
+ task_id_required: boolean;
1620
+ auto_edit_allowed: boolean;
1621
+ auto_release_allowed: boolean;
1622
+ release_gate: AgentMaintainerReleaseGate;
1623
+ next_step: string;
1624
+ };
1625
+ }
1626
+ interface AgentMaintainerPatchDraftBundle {
1627
+ schema_version: number;
1628
+ kind: "embedlabs.maintainer_patch_draft_bundle";
1629
+ generated_at: string;
1630
+ maintainer_task_id: string;
1631
+ optimization_item_id: string;
1632
+ repair_session_id: string;
1633
+ repair_context_path: string;
1634
+ title: string;
1635
+ instructions: string;
1636
+ allowed_targets: Array<{
1637
+ path: string;
1638
+ directory: boolean;
1639
+ }>;
1640
+ file_contexts: Array<{
1641
+ path: string;
1642
+ kind: AgentMaintainerFileContext["kind"];
1643
+ exists: boolean;
1644
+ snippet_count: number;
1645
+ truncated?: boolean;
1646
+ }>;
1647
+ test_plan: AgentMaintainerTestStep[];
1648
+ suggested_patch_path: string;
1649
+ repair_prompt: string;
1650
+ execution_boundary: {
1651
+ task_id_required: boolean;
1652
+ context_required: boolean;
1653
+ read_only_draft: boolean;
1654
+ auto_edit_allowed: boolean;
1655
+ auto_commit_allowed: boolean;
1656
+ auto_release_allowed: boolean;
1657
+ generated_patch_requires_repair_apply: boolean;
1658
+ release_gate: AgentMaintainerReleaseGate;
1659
+ next_step: string;
1660
+ };
1661
+ }
1662
+ interface AgentMaintainerGeneratedPatchBundle {
1663
+ schema_version: number;
1664
+ kind: "embedlabs.maintainer_generated_patch_bundle";
1665
+ generated_at: string;
1666
+ maintainer_task_id: string;
1667
+ optimization_item_id: string;
1668
+ repair_session_id: string;
1669
+ repair_draft_path: string;
1670
+ repair_context_path: string;
1671
+ patch_path: string;
1672
+ patch_sha256?: string;
1673
+ patch_size_bytes?: number;
1674
+ source: "patch_text" | "patch_file";
1675
+ touched_files: AgentMaintainerPatchTouchedFile[];
1676
+ violations: AgentMaintainerPatchViolation[];
1677
+ execution_boundary: {
1678
+ task_id_required: boolean;
1679
+ draft_required: boolean;
1680
+ allowed_paths_enforced: boolean;
1681
+ writes_patch_file_only: boolean;
1682
+ auto_apply_allowed: boolean;
1683
+ auto_commit_allowed: boolean;
1684
+ auto_release_allowed: boolean;
1685
+ release_gate: AgentMaintainerReleaseGate;
1686
+ next_step: string;
1687
+ };
1688
+ }
1689
+ interface AgentMaintainerFileContext {
1690
+ path: string;
1691
+ kind: "file" | "directory" | "missing" | "skipped";
1692
+ exists: boolean;
1693
+ size_bytes?: number;
1694
+ truncated?: boolean;
1695
+ sha256?: string;
1696
+ matched_terms: string[];
1697
+ snippets?: Array<{
1698
+ start_line: number;
1699
+ end_line: number;
1700
+ text: string;
1701
+ }>;
1702
+ entries?: string[];
1703
+ reason?: string;
1704
+ }
1705
+ interface AgentMaintainerPatchApplyBundle {
1706
+ schema_version: number;
1707
+ kind: "embedlabs.maintainer_patch_apply_bundle";
1708
+ generated_at: string;
1709
+ maintainer_task_id: string;
1710
+ optimization_item_id: string;
1711
+ repair_session_id: string;
1712
+ repair_context_path: string;
1713
+ patch_path: string;
1714
+ approved: boolean;
1715
+ applied: boolean;
1716
+ touched_files: AgentMaintainerPatchTouchedFile[];
1717
+ violations: AgentMaintainerPatchViolation[];
1718
+ git_check: AgentMaintainerGitApplyResult;
1719
+ git_apply?: AgentMaintainerGitApplyResult;
1720
+ execution_boundary: {
1721
+ task_id_required: boolean;
1722
+ context_required: boolean;
1723
+ patch_required: boolean;
1724
+ owner_approval_required_for_apply: boolean;
1725
+ auto_commit_allowed: boolean;
1726
+ auto_release_allowed: boolean;
1727
+ release_gate: AgentMaintainerReleaseGate;
1728
+ next_step: string;
1729
+ };
1730
+ }
1731
+ interface AgentMaintainerRepairExecuteBundle {
1732
+ schema_version: number;
1733
+ kind: "embedlabs.maintainer_repair_execute_bundle";
1734
+ generated_at: string;
1735
+ maintainer_task_id: string;
1736
+ optimization_item_id?: string;
1737
+ approved: boolean;
1738
+ dry_run: boolean;
1739
+ repair_apply_path?: string;
1740
+ repair_finish_path?: string;
1741
+ submitted_run_id?: string;
1742
+ status: "validated" | "applied_and_submitted" | "failed";
1743
+ error?: {
1744
+ code: string;
1745
+ message: string;
1746
+ remediation?: string;
1747
+ };
1748
+ execution_boundary: {
1749
+ task_id_required: boolean;
1750
+ approve_required_for_apply: boolean;
1751
+ session_required_for_finish: boolean;
1752
+ auto_commit_allowed: boolean;
1753
+ auto_release_allowed: boolean;
1754
+ release_gate: AgentMaintainerReleaseGate;
1755
+ next_step: string;
1756
+ };
1757
+ }
1758
+ interface AgentMaintainerPatchTouchedFile {
1759
+ path: string;
1760
+ allowed_by_context: boolean;
1761
+ source: "patch_header";
1762
+ matched_context_path?: string;
1763
+ }
1764
+ interface AgentMaintainerPatchViolation {
1765
+ code: string;
1766
+ message: string;
1767
+ path?: string;
1768
+ }
1769
+ interface AgentMaintainerGitApplyResult {
1770
+ ok: boolean;
1771
+ command: string;
1772
+ stdout_tail?: string;
1773
+ stderr_tail?: string;
1774
+ error?: string;
1775
+ }
1776
+ interface AgentMaintainerCandidateArea {
1777
+ kind: "cli" | "cloud_api" | "database" | "local_bridge" | "board_pack" | "plugin" | "test" | "docs";
1778
+ path: string;
1779
+ exists: boolean;
1780
+ reason: string;
1781
+ confidence: "high" | "medium" | "low";
1782
+ }
1783
+ interface AgentMaintainerContextEvidence {
1784
+ evidence_id: string;
1785
+ kind: "optimization_item" | "cloud_agent_recommendation" | "report_sample" | "candidate_path" | "repo_search" | "test_gate";
1786
+ title: string;
1787
+ summary: string;
1788
+ confidence: "high" | "medium" | "low";
1789
+ path?: string;
1790
+ paths?: string[];
1791
+ matched_terms?: string[];
1792
+ report_id?: string;
1793
+ command?: string;
1794
+ metadata?: Record<string, unknown>;
1795
+ }
1796
+ interface AgentMaintainerTestStep {
1797
+ command: string;
1798
+ reason: string;
1799
+ required: boolean;
1800
+ }
1801
+ interface AgentToolResultSummary {
1802
+ capability_id: string;
1803
+ ok: boolean;
1804
+ summary?: string;
1805
+ result?: unknown;
1806
+ error?: {
1807
+ code: string;
1808
+ message: string;
1809
+ remediation?: string;
1810
+ };
1811
+ }
1812
+ interface AgentKnowledgeSearchSummary {
1813
+ template_id: string;
1814
+ board_id?: string;
1815
+ query: string;
1816
+ match_count: number;
1817
+ matches: AgentKnowledgeMatchSummary[];
1818
+ }
1819
+ interface AgentKnowledgeMatchSummary {
1820
+ source?: string;
1821
+ path?: string;
1822
+ title?: string;
1823
+ score?: number;
1824
+ excerpt?: string;
1825
+ }
1826
+ type AgentIntentCategory = OptimizationReportCategory | "status_check";
1827
+ interface AgentIntent {
1828
+ id: "detect_board" | "current_board_status" | "query_board_knowledge" | "install_toolchain" | "build_project" | "flash_image" | "deploy_app" | "debug_board" | "capture_signal" | "manage_board_pack" | "remember_preference" | "submit_report" | "create_fix_candidate" | "maintainer_pull" | "maintainer_plan" | "maintainer_repair_start" | "maintainer_repair_context" | "maintainer_repair_draft" | "maintainer_repair_generate_patch" | "maintainer_repair_apply" | "maintainer_repair_execute" | "maintainer_repair_finish" | "maintainer_submit_result" | "unsupported";
1829
+ title: string;
1830
+ category: AgentIntentCategory;
1831
+ severity: OptimizationSeverity;
1832
+ }
1833
+ interface AgentBridgeSnapshot {
1834
+ ok: boolean;
1835
+ health?: Record<string, unknown>;
1836
+ inventory?: AgentBridgeInventorySummary;
1837
+ device_count?: number;
1838
+ board_count?: number;
1839
+ summary?: string;
1840
+ error?: {
1841
+ code: string;
1842
+ message: string;
1843
+ remediation?: string;
1844
+ };
1845
+ }
1846
+ interface AgentLocalExecutionTrace {
1847
+ kind: "embedlabs.agent_local_execution_trace";
1848
+ loop_adapter: AgentLoopAdapterTrace;
1849
+ planner_adapter: AgentPlannerAdapterTrace;
1850
+ identity: {
1851
+ source: "local_installation_identity";
1852
+ identity_scope: "local_installation";
1853
+ uses_local_installation_identity: true;
1854
+ };
1855
+ memory: {
1856
+ source: "local_personal_memory";
1857
+ context_entry_count: number;
1858
+ source_labels: string[];
1859
+ };
1860
+ action: {
1861
+ intent_id: AgentIntent["id"];
1862
+ resolved_action_id: string;
1863
+ state: "executed" | "planned";
1864
+ };
1865
+ bridge?: {
1866
+ runtime: "go-local-bridge";
1867
+ endpoints: ["/healthz", "/v1/devices"];
1868
+ ok: boolean;
1869
+ board_count?: number;
1870
+ device_count?: number;
1871
+ error_code?: string;
1872
+ };
1873
+ inventory?: {
1874
+ board_count: number;
1875
+ device_count: number;
1876
+ board_ids: string[];
1877
+ local_device_ids: string[];
1878
+ };
1879
+ public_report?: {
1880
+ report_id: string;
1881
+ status: "uploaded" | "pending";
1882
+ optimization_item_id?: string;
1883
+ };
1884
+ }
1885
+ interface AgentLoopAdapterTrace {
1886
+ kind: "embedlabs.upstream_agent_loop_adapter";
1887
+ schema_version: 1;
1888
+ mode: "deterministic_local_agent_loop";
1889
+ upstream_loop: "not_imported";
1890
+ replacement_target: "upstream_agent_loop";
1891
+ provider_kind: "embedlabs.deterministic_agent_loop_provider";
1892
+ provider_contract: "embedlabs.agent_loop_provider.v1";
1893
+ provider_replacement_target: "upstream_agent_loop_provider";
1894
+ execution_owner: "embedlabs";
1895
+ input_sources: [
1896
+ "prompt_assembly",
1897
+ "model_provider_config",
1898
+ "local_profile_provider",
1899
+ "local_installation_identity",
1900
+ "local_memory_context",
1901
+ "planner_decision",
1902
+ "go_local_bridge_inventory",
1903
+ "boardpack_action_catalog"
1904
+ ];
1905
+ model_provider_config_adapter: "embedlabs.upstream_model_provider_config_adapter";
1906
+ memory_context_adapter: "embedlabs.upstream_memory_context_adapter";
1907
+ memory_provider_adapter: "embedlabs.upstream_memory_provider_adapter";
1908
+ profile_provider_adapter: "embedlabs.upstream_profile_provider_adapter";
1909
+ planner_adapter: "embedlabs.upstream_planner_adapter";
1910
+ action_state: "executed" | "planned";
1911
+ side_effect_boundary: {
1912
+ execution_layer: "embedlabs_high_level_actions";
1913
+ hardware_runtime: "go-local-bridge";
1914
+ board_facts_source: "boardpack";
1915
+ cloud_use: "redacted_public_reports_only";
1916
+ no_cloud_compile: true;
1917
+ no_platform_auth_gate: true;
1918
+ no_auto_publish: true;
1919
+ };
1920
+ }
1921
+ interface AgentPlannerAdapterTrace {
1922
+ kind: "embedlabs.upstream_planner_adapter";
1923
+ schema_version: 1;
1924
+ mode: "deterministic_router";
1925
+ upstream_loop: "not_imported";
1926
+ replacement_target: "upstream_agent_loop";
1927
+ input_sources: ["prompt", "local_memory_context", "action_catalog", "go_local_bridge_inventory"];
1928
+ allowed_action_ids: AgentActionId[];
1929
+ decision: AgentPlannerDecisionTrace;
1930
+ resolved_action_id: string;
1931
+ routed_through_allowed_action: boolean;
1932
+ safety_policy: {
1933
+ high_level_actions_only: true;
1934
+ hardware_state_source: "go-local-bridge";
1935
+ board_facts_source: "boardpack";
1936
+ fail_closed_side_effects: true;
1937
+ no_web_board_facts: true;
1938
+ };
1939
+ }
1940
+ interface AgentPlannerDecisionTrace {
1941
+ kind: "embedlabs.upstream_planner_decision";
1942
+ schema_version: 1;
1943
+ mode: "deterministic_intent_adapter";
1944
+ producer: AgentPlannerDecisionProducerTrace;
1945
+ intent_id: AgentIntent["id"];
1946
+ route_found: boolean;
1947
+ action_id?: AgentActionId;
1948
+ arguments: Record<string, unknown>;
1949
+ argument_keys: string[];
1950
+ argument_source: "flagsFromPrompt" | "none";
1951
+ prompt_sha256: string;
1952
+ privacy_boundary: {
1953
+ prompt_text_included: false;
1954
+ arguments_local_only: true;
1955
+ secrets_redacted_for_trace: true;
1956
+ };
1957
+ }
1958
+ interface AgentPlannerDecisionProducerTrace {
1959
+ kind: "embedlabs.upstream_planner_decision_producer";
1960
+ schema_version: 1;
1961
+ mode: "deterministic_detect_intent";
1962
+ upstream_loop: "not_imported";
1963
+ replacement_target: "upstream_agent_loop";
1964
+ output_contract: "embedlabs.upstream_planner_decision";
1965
+ input_sources: ["prompt", "local_memory_context", "intent_rules", "action_route_table", "flagsFromPrompt"];
1966
+ memory_context: {
1967
+ source: "local_personal_memory";
1968
+ entries: number;
1969
+ entry_kinds: AgentMemoryContextEntry["kind"][];
1970
+ available_to_producer: true;
1971
+ used_for_rule_selection: false;
1972
+ replacement_expectation: "upstream_agent_loop_can_use_memory_context";
1973
+ };
1974
+ privacy_boundary: {
1975
+ prompt_text_included: false;
1976
+ prompt_hash_only: true;
1977
+ user_model_key_used: false;
1978
+ };
1979
+ }
1980
+ interface AgentBridgeInventorySummary {
1981
+ observed_at?: string;
1982
+ inventory_seq?: number;
1983
+ summary_for_user?: string;
1984
+ summary_for_user_zh?: string;
1985
+ status_text?: string;
1986
+ status_text_zh?: string;
1987
+ board_status?: unknown;
1988
+ device_count: number;
1989
+ board_count: number;
1990
+ boards: AgentBridgeBoardSummary[];
1991
+ warnings: string[];
1992
+ }
1993
+ interface AgentBridgeBoardSummary {
1994
+ local_device_id?: string;
1995
+ device_id?: string;
1996
+ board_id?: string;
1997
+ raw_board_id?: string;
1998
+ template_id?: string;
1999
+ variant_id?: string;
2000
+ kind?: string;
2001
+ display_name?: string;
2002
+ status?: string;
2003
+ connected?: boolean;
2004
+ runtime_ready?: boolean;
2005
+ reachable?: boolean;
2006
+ host?: string;
2007
+ ssh_host?: string;
2008
+ tcp_endpoint?: string;
2009
+ bridge_url?: string;
2010
+ browser_url?: string;
2011
+ ui_url?: string;
2012
+ monitor?: Record<string, unknown>;
2013
+ details?: Record<string, unknown>;
2014
+ identity?: Record<string, unknown>;
2015
+ locators?: Array<Record<string, unknown>>;
2016
+ capabilities?: string[];
2017
+ summary_for_user?: string;
2018
+ summary_for_user_zh?: string;
2019
+ state_summary?: string;
2020
+ state_summary_zh?: string;
2021
+ }
2022
+ interface AgentMemorySummary {
2023
+ home: string;
2024
+ memory_dir: string;
2025
+ sessions_dir: string;
2026
+ skills_dir: string;
2027
+ reports_dir: string;
2028
+ maintainer_tasks_dir: string;
2029
+ installation_id: string;
2030
+ profile_memory_count: number;
2031
+ workflow_memory_count: number;
2032
+ failure_memory_count: number;
2033
+ session_count: number;
2034
+ skill_count: number;
2035
+ maintainer_task_count: number;
2036
+ maintainer_task_summary: AgentMaintainerTaskQueueSummary;
2037
+ pending_report_count: number;
2038
+ failed_report_count: number;
2039
+ installation_identity?: {
2040
+ kind: "embedlabs.local_installation_identity";
2041
+ fingerprint_version: "v1";
2042
+ fingerprint_hash?: string;
2043
+ public_key_sha256?: string;
2044
+ key_algorithm?: "ed25519";
2045
+ integrity: "ok" | "failed" | "missing";
2046
+ };
2047
+ }
2048
+ interface AgentMaintainerTaskQueueSummary {
2049
+ total: number;
2050
+ task_bundles: number;
2051
+ unreadable: number;
2052
+ by_status: AgentMaintainerTaskQueueBucket[];
2053
+ latest_task_id?: string;
2054
+ latest_status?: string;
2055
+ latest_kind?: string;
2056
+ latest_optimization_item_id?: string;
2057
+ latest_file_ref?: string;
2058
+ latest_created_at?: string;
2059
+ latest_updated_at?: string;
2060
+ latest_task_bundle_id?: string;
2061
+ latest_task_bundle_status?: string;
2062
+ latest_task_bundle_optimization_item_id?: string;
2063
+ latest_task_bundle_file_ref?: string;
2064
+ latest_task_bundle_created_at?: string;
2065
+ latest_task_bundle_updated_at?: string;
2066
+ latest_run_id?: string;
2067
+ latest_run_status?: string;
2068
+ latest_run_task_id?: string;
2069
+ latest_run_file_ref?: string;
2070
+ latest_run_observed_at?: string;
2071
+ }
2072
+ interface AgentMaintainerTaskQueueBucket {
2073
+ value: string;
2074
+ count: number;
2075
+ }
2076
+ interface AgentReportUploadResult {
2077
+ ok: boolean;
2078
+ report_id: string;
2079
+ report_path: string;
2080
+ uploaded_at?: string;
2081
+ optimization_item_id?: string;
2082
+ admin_review_url?: string;
2083
+ create_fix_candidate_command?: string;
2084
+ persistence_warning?: AgentPersistenceWarning;
2085
+ error?: {
2086
+ code: string;
2087
+ message: string;
2088
+ remediation?: string;
2089
+ };
2090
+ }
2091
+ type AgentStoredReportStatus = "pending" | "uploaded" | "failed";
2092
+ type AgentEffectiveReportStatus = AgentStoredReportStatus | "superseded";
2093
+ interface AgentStoredReportSummary {
2094
+ report_id: string;
2095
+ status: AgentEffectiveReportStatus;
2096
+ created_at: string;
2097
+ updated_at: string;
2098
+ title?: string;
2099
+ category?: string;
2100
+ severity?: string;
2101
+ component?: string;
2102
+ board_id?: string;
2103
+ variant_id?: string;
2104
+ action_id?: string;
2105
+ capability_id?: string;
2106
+ optimization_item_id?: string;
2107
+ admin_review_url?: string;
2108
+ create_fix_candidate_command?: string;
2109
+ error_code?: string;
2110
+ path: string;
2111
+ }
2112
+ export declare function runLocalAgent(deps: AgentRuntimeDependencies, args: AgentCliArgs): Promise<ApiResponse<LocalAgentRunResult>>;
2113
+ export declare function agentStatus(deps: AgentRuntimeDependencies, args: AgentCliArgs): Promise<ApiResponse<AgentStatusResult>>;
2114
+ export declare function agentLocalIdentitySnapshot(deps: AgentRuntimeDependencies): Promise<AgentInstallationIdentityStatusSnapshot>;
2115
+ export declare function agentLocalIdentitySnapshotReadOnly(): Promise<AgentInstallationIdentityStatusSnapshot>;
2116
+ export declare function agentIdentity(deps: AgentRuntimeDependencies, args: AgentCliArgs): Promise<ApiResponse<AgentIdentityResult>>;
2117
+ export declare function agentAction(deps: AgentRuntimeDependencies, args: AgentCliArgs): Promise<ApiResponse<AgentActionResult>>;
2118
+ export declare function agentMaintainer(deps: AgentRuntimeDependencies, args: AgentCliArgs): Promise<ApiResponse<AgentMaintainerResult>>;
2119
+ export declare function agentMemory(deps: AgentRuntimeDependencies, args: AgentCliArgs): Promise<ApiResponse<AgentMemoryResult>>;
2120
+ export declare function agentReport(deps: AgentRuntimeDependencies, args: AgentCliArgs): Promise<ApiResponse<AgentReportResult>>;
2121
+ export declare function agentSync(deps: AgentRuntimeDependencies, args: AgentCliArgs): Promise<ApiResponse<AgentSyncResult>>;
2122
+ export declare function agentUpstream(_deps: AgentRuntimeDependencies, args: AgentCliArgs): Promise<ApiResponse<AgentUpstreamAuditResult>>;
2123
+ export declare function agentChat(deps: AgentRuntimeDependencies, args: AgentCliArgs): Promise<ApiResponse<AgentChatResult>>;
2124
+ export declare function renderLocalAgentRunResult(result: LocalAgentRunResult): string;
2125
+ export declare function renderLocalAgentRunBriefResult(result: LocalAgentRunResult): string;
2126
+ export declare function renderAgentStatus(result: AgentStatusResult): string;
2127
+ export declare function renderAgentIdentity(result: AgentIdentityResult): string;
2128
+ export declare function renderAgentAction(result: AgentActionResult): string;
2129
+ export declare function renderAgentMaintainer(result: AgentMaintainerResult): string;
2130
+ export declare function renderAgentMemory(result: AgentMemoryResult): string;
2131
+ export declare function renderAgentReport(result: AgentReportResult): string;
2132
+ export declare function renderAgentSync(result: AgentSyncResult): string;
2133
+ export declare function renderAgentUpstream(result: AgentUpstreamAuditResult): string;
2134
+ export declare function renderAgentChat(result: AgentChatResult): string;
2135
+ export declare function renderAgentChatBrief(result: AgentChatResult): string;
2136
+ export declare function agentPublicExperienceUploadHeadersReadOnly(method: "POST", path: string, body: unknown): Promise<Record<string, string>>;
2137
+ export {};