@lark-codem/codem-cli 0.1.259-dev.100103378021.0.g63415ff → 0.1.259-dev.100103444619.0.gb1d755f
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/package.json +7 -7
- package/profile/runtime-logs.js +21 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-codem/codem-cli",
|
|
3
|
-
"version": "0.1.259-dev.
|
|
3
|
+
"version": "0.1.259-dev.100103444619.0.gb1d755f",
|
|
4
4
|
"codemServiceManagementProtocol": 3,
|
|
5
5
|
"codemProfileProtocol": 1,
|
|
6
6
|
"type": "module",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"@lark-codem/lark-cli": "0.1.1"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@lark-codem/codem-cli-darwin-arm64": "0.1.259-dev.
|
|
38
|
-
"@lark-codem/codem-cli-darwin-x64": "0.1.259-dev.
|
|
39
|
-
"@lark-codem/codem-cli-linux-arm64": "0.1.259-dev.
|
|
40
|
-
"@lark-codem/codem-cli-linux-x64": "0.1.259-dev.
|
|
41
|
-
"@lark-codem/codem-cli-win32-arm64": "0.1.259-dev.
|
|
42
|
-
"@lark-codem/codem-cli-win32-x64": "0.1.259-dev.
|
|
37
|
+
"@lark-codem/codem-cli-darwin-arm64": "0.1.259-dev.100103444619.0.gb1d755f",
|
|
38
|
+
"@lark-codem/codem-cli-darwin-x64": "0.1.259-dev.100103444619.0.gb1d755f",
|
|
39
|
+
"@lark-codem/codem-cli-linux-arm64": "0.1.259-dev.100103444619.0.gb1d755f",
|
|
40
|
+
"@lark-codem/codem-cli-linux-x64": "0.1.259-dev.100103444619.0.gb1d755f",
|
|
41
|
+
"@lark-codem/codem-cli-win32-arm64": "0.1.259-dev.100103444619.0.gb1d755f",
|
|
42
|
+
"@lark-codem/codem-cli-win32-x64": "0.1.259-dev.100103444619.0.gb1d755f"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=18"
|
package/profile/runtime-logs.js
CHANGED
|
@@ -10,7 +10,15 @@ const CAPACITY = 256;
|
|
|
10
10
|
const BATCH_SIZE = 32;
|
|
11
11
|
const INTERVAL_MS = 10_000;
|
|
12
12
|
const REQUEST_TIMEOUT_MS = 3_000;
|
|
13
|
-
const
|
|
13
|
+
const TRUSTED_DEVICE_EVENTS = new Set(["host_identity_collection", "host_identity_command", "host_session_attempt", "host_session_expired", "trusted_device_admission_blocked", "trusted_device_admission_recovered"]);
|
|
14
|
+
const TRUSTED_DEVICE_PHASES = ["auth", "identity", "provider", "host_key", "activation_state", "activation_apply", "activation_sign", "activation_complete", "credential_resolve", "session_apply", "session_sign", "session_complete", "trusted_device"];
|
|
15
|
+
const TRUSTED_DEVICE_DIMENSIONS = {
|
|
16
|
+
phase: TRUSTED_DEVICE_PHASES,
|
|
17
|
+
operation: ["create", "renew", "recovery", "platform_identity", "network_interfaces", "network_ports"],
|
|
18
|
+
outcome: ["success", "partial", "failed", "ready", "not_registered", "no_auth", "reset", "blocked", "invalid", "verified", "not_required", "absent", "expired"],
|
|
19
|
+
failure_kind: ["none", "timeout", "exec_failed", "invalid_json", "empty_identity", "read_failed", "authorization", "unknown"]
|
|
20
|
+
};
|
|
21
|
+
const OBSERVATION_EVENTS = new Set(["command_delivery_observed", "command_admission", "runtime_capability_probe", "command_ack", "command_observation_closed", "diagnostic_reporter_health", ...TRUSTED_DEVICE_EVENTS]);
|
|
14
22
|
const OBSERVATION_DIMENSIONS = {
|
|
15
23
|
phase: ["resolve_binary", "build_env", "host_capabilities", "parse_capabilities", "strict_resume", "verify_binding", "prepare", "persist_state", "trusted_device", "request", "validate_response", "apply_response"],
|
|
16
24
|
reason: ["runtime_unavailable", "runtime_environment_failed", "capability_probe_failed", "runtime_binary_changed", "strict_resume_unsupported", "turn_context_unsupported", "active_run_protocol_mismatch", "trusted_device_blocked", "shutting_down_handoff", "handoff_target_not_active", "duplicate_inflight", "handler_inflight", "prepare_exception_unknown", "capacity", "stopped", "replaced", "scope_changed", "queue_removed", "local_rejected"],
|
|
@@ -22,6 +30,12 @@ const OBSERVATION_DIMENSIONS = {
|
|
|
22
30
|
timing_origin: ["observed", "restored_unknown"]
|
|
23
31
|
};
|
|
24
32
|
const OBSERVATION_METRICS = {
|
|
33
|
+
host_identity_collection: ["duration_ms", "field_error_count"],
|
|
34
|
+
host_identity_command: ["duration_ms", "timeout_ms"],
|
|
35
|
+
host_session_attempt: ["elapsed_ms", "next_retry_ms", "consecutive_failures", "session_remaining_ms", ...TRUSTED_DEVICE_PHASES.map(phase => `${phase}_duration_ms`)],
|
|
36
|
+
host_session_expired: ["expired_for_ms", "consecutive_failures", "next_retry_ms"],
|
|
37
|
+
trusted_device_admission_blocked: ["elapsed_ms", "blocked_response_count"],
|
|
38
|
+
trusted_device_admission_recovered: ["elapsed_ms", "blocked_response_count"],
|
|
25
39
|
command_delivery_observed: ["attempt_delta", "suppressed_count"],
|
|
26
40
|
command_admission: ["attempt_delta", "suppressed_count", "deferred_age_ms", "deferred_duration_ms"],
|
|
27
41
|
runtime_capability_probe: ["probe_duration_ms"],
|
|
@@ -29,7 +43,7 @@ const OBSERVATION_METRICS = {
|
|
|
29
43
|
command_observation_closed: ["omitted_detail_count", "pending_command_ack_count", "deferred_count"],
|
|
30
44
|
diagnostic_reporter_health: ["dropped_delta", "upload_failure_delta", "pending_event_count"]
|
|
31
45
|
};
|
|
32
|
-
const EXTRA_FIELDS = ["observation_id", "runtime_client_instance_id", "command_id", "delivery_id", "probe_id", "sync_id", "transport_request_id"];
|
|
46
|
+
const EXTRA_FIELDS = ["observation_id", "runtime_client_instance_id", "command_id", "delivery_id", "probe_id", "sync_id", "transport_request_id", "attempt_id"];
|
|
33
47
|
const STRING_FIELDS = new Set([
|
|
34
48
|
...EXTRA_FIELDS, "command_type", "ack_status", "ack_outcome", "readback_scope", "timing_origin", "required_capability",
|
|
35
49
|
"request_id", "command_id", "session_id", "task_id", "dispatch_id", "event_id", "sync_id",
|
|
@@ -40,6 +54,7 @@ const STRING_FIELDS = new Set([
|
|
|
40
54
|
"failure_kind", "failure_impact", "failure_type", "failure_subtype", "failure_code", "failure_status", "delay_source", "mode", "provider", "name", "termination", "interaction_id", "interaction_kind", "owner_state", "artifact_id", "resource_type", "delivery_mode", "host", "scheme", "tool_call_id", "tool_name", "background_task_id", "model", "artifact_kind", "codem_user_id", "device_id", "operation", "foreground_error_code"
|
|
41
55
|
]);
|
|
42
56
|
const VALUE_FIELDS = new Set([
|
|
57
|
+
"session_retained",
|
|
43
58
|
...new Set(Object.values(OBSERVATION_METRICS).flat()),
|
|
44
59
|
"pid", "exit_code", "duration_ms", "elapsed_ms", "wait_ms", "run_ms", "total_ms", "took_ms",
|
|
45
60
|
"attempt", "attempts", "attempt_count", "retryable", "http_status", "active_task_count",
|
|
@@ -227,7 +242,10 @@ export class RuntimeLogReporter {
|
|
|
227
242
|
...Object.fromEntries(["stage", "error_class", "error_code", "error_kind", "outcome"].filter((key) => safeFields[key]).map((key) => [key, safeFields[key]]))
|
|
228
243
|
};
|
|
229
244
|
if (OBSERVATION_EVENTS.has(category.event)) {
|
|
230
|
-
|
|
245
|
+
const trustedDevice = TRUSTED_DEVICE_EVENTS.has(category.event);
|
|
246
|
+
// Keep arbitrary upstream error codes in logs, not metric dimensions.
|
|
247
|
+
if (trustedDevice) for (const key of ["stage", "error_class", "error_code", "error_kind", "outcome"]) delete category[key];
|
|
248
|
+
for (const [key, values] of Object.entries(trustedDevice ? TRUSTED_DEVICE_DIMENSIONS : OBSERVATION_DIMENSIONS)) {
|
|
231
249
|
if (safeFields[key]) category[key] = values.includes(safeFields[key]) ? safeFields[key] : "unknown";
|
|
232
250
|
}
|
|
233
251
|
}
|