@botiverse/raft-computer 0.0.62 → 0.0.64
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/dist/index.js +16462 -1617
- package/dist/lib/index.d.ts +45 -38
- package/dist/lib/index.js +15020 -337
- package/package.json +5 -3
package/dist/lib/index.d.ts
CHANGED
|
@@ -493,6 +493,36 @@ type MigrationDetection = {
|
|
|
493
493
|
kind: "server-unavailable";
|
|
494
494
|
};
|
|
495
495
|
|
|
496
|
+
type ComputerTraceSurface = "server" | "daemon" | "web" | "computer";
|
|
497
|
+
type ComputerTraceSpanKind = "server" | "client" | "internal" | "producer" | "consumer";
|
|
498
|
+
type ComputerTraceStatus = "ok" | "error" | "cancelled";
|
|
499
|
+
type ComputerTraceAttributes = Record<string, unknown>;
|
|
500
|
+
type ComputerTraceClientSource = "daemon" | "computer.cli" | "computer.menu-bar";
|
|
501
|
+
interface ComputerTraceContext {
|
|
502
|
+
traceId: string;
|
|
503
|
+
spanId: string;
|
|
504
|
+
parentSpanId: string | null;
|
|
505
|
+
traceFlags: string;
|
|
506
|
+
}
|
|
507
|
+
interface ComputerStartSpanOptions {
|
|
508
|
+
parent?: ComputerTraceContext | null;
|
|
509
|
+
surface: ComputerTraceSurface;
|
|
510
|
+
kind?: ComputerTraceSpanKind;
|
|
511
|
+
attrs?: ComputerTraceAttributes;
|
|
512
|
+
startTimeMs?: number;
|
|
513
|
+
}
|
|
514
|
+
interface ComputerEndSpanOptions {
|
|
515
|
+
attrs?: ComputerTraceAttributes;
|
|
516
|
+
}
|
|
517
|
+
interface ComputerActiveSpan {
|
|
518
|
+
readonly context: ComputerTraceContext;
|
|
519
|
+
addEvent(name: string, attrs?: ComputerTraceAttributes): void;
|
|
520
|
+
end(status?: ComputerTraceStatus, options?: ComputerEndSpanOptions): void;
|
|
521
|
+
}
|
|
522
|
+
interface ComputerTracer {
|
|
523
|
+
startSpan(name: string, options: ComputerStartSpanOptions): ComputerActiveSpan;
|
|
524
|
+
}
|
|
525
|
+
|
|
496
526
|
type ComputerApiEvent = {
|
|
497
527
|
kind: "login.device-code";
|
|
498
528
|
verifyUrl: string;
|
|
@@ -1423,47 +1453,24 @@ interface ComputerApi {
|
|
|
1423
1453
|
* IPC-vs-disk decision: when a service is running, mutations route through it
|
|
1424
1454
|
* via IPC so the supervisor's in-memory runner state stays consistent; when no
|
|
1425
1455
|
* service is up (cold boot) the disk-only lib-pure handlers apply directly.
|
|
1426
|
-
*/
|
|
1427
|
-
declare function createComputerApi(slockHome: string): ComputerApi;
|
|
1428
|
-
|
|
1429
|
-
/**
|
|
1430
|
-
* One Computer trace line. INTENTIONALLY shaped as `@slock-ai/shared`'s
|
|
1431
|
-
* canonical `TraceEvent` (`{ name, timeMs, attrs? }`) so the forthcoming shared
|
|
1432
|
-
* trace-client can route these through the real `Tracer` / `TraceSink` with ZERO
|
|
1433
|
-
* format reconciliation. We MIRROR the shape rather than import the type — that
|
|
1434
|
-
* keeps this interim file sink from pulling `@slock-ai/shared` into the Computer
|
|
1435
|
-
* package early; the shared-client work (B) replaces this helper's internals
|
|
1436
|
-
* (file-append → `Tracer.startSpan` + `TraceSink.record`) while the emitted
|
|
1437
|
-
* shape stays identical.
|
|
1438
1456
|
*
|
|
1439
|
-
*
|
|
1440
|
-
*
|
|
1441
|
-
*
|
|
1457
|
+
* The single-writer ops (reset / upgrade routing) are spanned through the
|
|
1458
|
+
* caller-injected `opts.tracer` (default `noopTracer`, so untraced callers /
|
|
1459
|
+
* tests are zero-side-effect). The CALLER owns `source` attribution — the CLI
|
|
1460
|
+
* injects a `computer.cli` trace-client, the menu-bar a `computer.menu-bar`
|
|
1461
|
+
* one — so the same lib code attributes correctly across both surfaces.
|
|
1442
1462
|
*/
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
timeMs: number;
|
|
1448
|
-
/** structured attributes (== shared `TraceAttributes`) */
|
|
1449
|
-
attrs?: Record<string, unknown>;
|
|
1450
|
-
}
|
|
1451
|
-
/**
|
|
1452
|
-
* Best-effort append of one `ComputerTraceEvent` JSON line to the Computer trace
|
|
1453
|
-
* sink (`run/trace.jsonl`). NEVER throws or blocks the traced operation — any fs
|
|
1454
|
-
* error is swallowed.
|
|
1455
|
-
*/
|
|
1456
|
-
declare function traceEvent(slockHome: string, event: ComputerTraceEvent): Promise<void>;
|
|
1463
|
+
declare function createComputerApi(slockHome: string, opts?: {
|
|
1464
|
+
tracer?: ComputerTracer;
|
|
1465
|
+
}): ComputerApi;
|
|
1466
|
+
|
|
1457
1467
|
/**
|
|
1458
|
-
*
|
|
1459
|
-
*
|
|
1460
|
-
*
|
|
1468
|
+
* Build the env-gated Computer trace client for a given emitting `source`
|
|
1469
|
+
* (CLI vs menu-bar). Both surfaces share this so their spans land in the same
|
|
1470
|
+
* `<computerDir>/traces/` sink with consistent gating. `SLOCK_COMPUTER_LOCAL_TRACE=0`
|
|
1471
|
+
* disables (default on, mirrors the daemon); any setup failure falls back to noop.
|
|
1461
1472
|
*/
|
|
1462
|
-
declare function
|
|
1463
|
-
method: string;
|
|
1464
|
-
decision: string;
|
|
1465
|
-
timeMs?: number;
|
|
1466
|
-
}): Promise<void>;
|
|
1473
|
+
declare function createComputerTracer(slockHome: string, source: ComputerTraceClientSource): ComputerTracer;
|
|
1467
1474
|
|
|
1468
1475
|
/**
|
|
1469
1476
|
* Read the Computer-level aggregate status from `installRoot`. Identical
|
|
@@ -1509,4 +1516,4 @@ declare function userSessionPath(slockHome: string): string;
|
|
|
1509
1516
|
|
|
1510
1517
|
declare const COMPUTER_VERSION: string;
|
|
1511
1518
|
|
|
1512
|
-
export { type AttachInput, type AttachResult, COMPUTER_VERSION, type ComputerApi, type ComputerApiEvent, ComputerError, ComputerServiceError, type ComputerStatusReport, type
|
|
1519
|
+
export { type AttachInput, type AttachResult, COMPUTER_VERSION, type ComputerActiveSpan, type ComputerApi, type ComputerApiEvent, type ComputerEndSpanOptions, ComputerError, ComputerServiceError, type ComputerStartSpanOptions, type ComputerStatusReport, type ComputerTraceAttributes, type ComputerTraceClientSource, type ComputerTraceContext, type ComputerTraceSpanKind, type ComputerTraceStatus, type ComputerTraceSurface, type ComputerTracer, type ConnectService, type ConnectServiceOptions, DEFAULT_UPGRADE_BASE_URL, type DaemonState, IPC_ERROR_CODES, type IpcErrorCode, type LegacyMachineCandidate, type LegacyMachineRosterClient, type LegacyMachineRosterEntry, type LegacyMachineRosterResult, LegacyMachinesClient, type ListRunnersResult, type LoginInput, type LoginResult, MIGRATION_DETECTION_KINDS, MIGRATION_FRESH_TRIGGERS, type ManualPathValidation, type MigrationDetection, type MigrationDetectionKind, type MigrationFreshTrigger, type PickerSelection, RUNNER_STATE_VALUES, type RequestMethodMap, type RequestOptions, type ResetRunnerResult, type ResetServiceResult, type RunnerListItem as RunnerInfo, type RunnerListPerServer, type RunnerState, type RunnerStatusResult, SERVICE_STATE_VALUES, STATE_READER_ERROR_CODES, type ServerHealth, type ServerStatusRow, ServersClient, type ServiceClient, ServiceClientError, type ServiceEvent, type ServiceState, type ServiceStatusResult, StateReaderError, type StateReaderErrorCode, UPGRADE_ERROR_CODES, type UpgradeBundle, type UpgradeErrorCode, type UpgradeLogEntry, type UpgradeLogEntryErr, type UpgradeLogEntryOk, type UpgradeStartResult, type UpgradeTrigger, type UserServerEntry, type UserServersResult, assertUpgradeLogEntry, connectService, createComputerApi, createComputerTracer, detectLegacyMigration, fetchCdnLatestVersion, isComputerError, isIpcErrorCode, isMigrationDetectionKind, isRunnerState, isServiceState, listRunners, pickMigrationCandidateFromInput, readRunnerStatus, readServiceStatus, userSessionPath, validateManualMigratePath };
|