@lark-codem/codem-cli 0.1.269-dev.100103562624.0.geaa0d89 → 0.1.269-dev.100103606023.0.g8481580
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 +8 -8
- package/profile/runtime-logs.js +24 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-codem/codem-cli",
|
|
3
|
-
"version": "0.1.269-dev.
|
|
3
|
+
"version": "0.1.269-dev.100103606023.0.g8481580",
|
|
4
4
|
"codemServiceManagementProtocol": 3,
|
|
5
5
|
"codemProfileProtocol": 1,
|
|
6
6
|
"type": "module",
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@lark-codem/codem-core": "0.8.86-dev.
|
|
32
|
+
"@lark-codem/codem-core": "0.8.86-dev.100103606023.0.gd23c9f9",
|
|
33
33
|
"zod": "3.25.76",
|
|
34
34
|
"@lark-codem/lark-cli": "0.1.1"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@lark-codem/codem-cli-darwin-arm64": "0.1.269-dev.
|
|
38
|
-
"@lark-codem/codem-cli-darwin-x64": "0.1.269-dev.
|
|
39
|
-
"@lark-codem/codem-cli-linux-arm64": "0.1.269-dev.
|
|
40
|
-
"@lark-codem/codem-cli-linux-x64": "0.1.269-dev.
|
|
41
|
-
"@lark-codem/codem-cli-win32-arm64": "0.1.269-dev.
|
|
42
|
-
"@lark-codem/codem-cli-win32-x64": "0.1.269-dev.
|
|
37
|
+
"@lark-codem/codem-cli-darwin-arm64": "0.1.269-dev.100103606023.0.g8481580",
|
|
38
|
+
"@lark-codem/codem-cli-darwin-x64": "0.1.269-dev.100103606023.0.g8481580",
|
|
39
|
+
"@lark-codem/codem-cli-linux-arm64": "0.1.269-dev.100103606023.0.g8481580",
|
|
40
|
+
"@lark-codem/codem-cli-linux-x64": "0.1.269-dev.100103606023.0.g8481580",
|
|
41
|
+
"@lark-codem/codem-cli-win32-arm64": "0.1.269-dev.100103606023.0.g8481580",
|
|
42
|
+
"@lark-codem/codem-cli-win32-x64": "0.1.269-dev.100103606023.0.g8481580"
|
|
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", "serial_number", "platform_uuid", "network_adapters"],
|
|
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",
|
|
@@ -37,16 +51,18 @@ const STRING_FIELDS = new Set([
|
|
|
37
51
|
"error_class", "error_code", "error_kind", "error_type", "code", "signal", "stop_reason",
|
|
38
52
|
"terminal_event", "event_type", "actor_type", "source", "trigger", "hook_id", "hook_event",
|
|
39
53
|
"target_version", "cli_version", "core_version", "version", "previous_state", "state",
|
|
40
|
-
"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"
|
|
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",
|
|
55
|
+
"operation_id", "entrypoint"
|
|
41
56
|
]);
|
|
42
57
|
const VALUE_FIELDS = new Set([
|
|
58
|
+
"session_retained",
|
|
43
59
|
...new Set(Object.values(OBSERVATION_METRICS).flat()),
|
|
44
60
|
"pid", "exit_code", "duration_ms", "elapsed_ms", "wait_ms", "run_ms", "total_ms", "took_ms",
|
|
45
61
|
"attempt", "attempts", "attempt_count", "retryable", "http_status", "active_task_count",
|
|
46
62
|
"pending_event_count", "pending_command_ack_count", "next_retry_ms", "consecutive_failures",
|
|
47
63
|
"outage_duration_ms", "startup_duration_ms", "failed_attempts", "active_runs", "completed",
|
|
48
64
|
"delivered", "result_delivered", "queued_behind_existing", "expected", "timed_out",
|
|
49
|
-
"force_exit_ms", "teardown_ceiling_ms", "recovered", "count", "ms_since_process_start", "owner_pid", "consumed", "delivery_attempt", "ack_deadline_ms", "command_to_bridge_ms", "size_bytes", "before", "after", "omitted_detail_count", "opened", "selected", "foreground"
|
|
65
|
+
"force_exit_ms", "teardown_ceiling_ms", "recovered", "count", "ms_since_process_start", "owner_pid", "consumed", "delivery_attempt", "ack_deadline_ms", "command_to_bridge_ms", "size_bytes", "source_size_bytes", "processed_bytes", "before", "after", "omitted_detail_count", "opened", "selected", "foreground"
|
|
50
66
|
]);
|
|
51
67
|
|
|
52
68
|
function token(value) {
|
|
@@ -227,7 +243,10 @@ export class RuntimeLogReporter {
|
|
|
227
243
|
...Object.fromEntries(["stage", "error_class", "error_code", "error_kind", "outcome"].filter((key) => safeFields[key]).map((key) => [key, safeFields[key]]))
|
|
228
244
|
};
|
|
229
245
|
if (OBSERVATION_EVENTS.has(category.event)) {
|
|
230
|
-
|
|
246
|
+
const trustedDevice = TRUSTED_DEVICE_EVENTS.has(category.event);
|
|
247
|
+
// Keep arbitrary upstream error codes in logs, not metric dimensions.
|
|
248
|
+
if (trustedDevice) for (const key of ["stage", "error_class", "error_code", "error_kind", "outcome"]) delete category[key];
|
|
249
|
+
for (const [key, values] of Object.entries(trustedDevice ? TRUSTED_DEVICE_DIMENSIONS : OBSERVATION_DIMENSIONS)) {
|
|
231
250
|
if (safeFields[key]) category[key] = values.includes(safeFields[key]) ? safeFields[key] : "unknown";
|
|
232
251
|
}
|
|
233
252
|
}
|