@ai-matrx/desktop-protocol 0.6.0 → 0.10.0
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/CHANGELOG.md +66 -0
- package/README.md +13 -0
- package/dist/client.cjs +272 -42
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +9 -2
- package/dist/client.d.ts +9 -2
- package/dist/client.js +272 -42
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +776 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1048 -5
- package/dist/index.d.ts +1048 -5
- package/dist/index.js +776 -5
- package/dist/index.js.map +1 -1
- package/dist/react.d.cts +305 -1
- package/dist/react.d.ts +305 -1
- package/dist/{registry-jTmq1CsI.d.cts → registry-B3NqARgh.d.cts} +1314 -3
- package/dist/{registry-jTmq1CsI.d.ts → registry-B3NqARgh.d.ts} +1314 -3
- package/generated/desktop-protocol.schema.json +4554 -0
- package/package.json +3 -1
- package/scripts/gen_pydantic.py +335 -0
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/schema/primitives.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
var PROTOCOL_MAJOR = 1;
|
|
4
|
-
var PROTOCOL_MINOR =
|
|
4
|
+
var PROTOCOL_MINOR = 2;
|
|
5
5
|
var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
|
|
6
6
|
var ProtocolVersion = z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
|
|
7
7
|
var RequestId = z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
|
|
@@ -60,7 +60,22 @@ var ErrorReason = z2.enum([
|
|
|
60
60
|
"resource_expired",
|
|
61
61
|
"control_taken",
|
|
62
62
|
// another client of the same user took control
|
|
63
|
-
"window_exhausted"
|
|
63
|
+
"window_exhausted",
|
|
64
|
+
// 1.2 (REASONS_SINCE): the `models` capability and its supervised Python service
|
|
65
|
+
"runtime_not_installed",
|
|
66
|
+
// NOT_FOUND: install the inference runtime first (models.install)
|
|
67
|
+
"model_not_installed",
|
|
68
|
+
// NOT_FOUND: that model's weights are not on the device
|
|
69
|
+
"unsupported_media",
|
|
70
|
+
// INVALID_PARAMS: the file is not audio or video the decoder reads
|
|
71
|
+
"download_failed",
|
|
72
|
+
// install could not fetch a package or model file
|
|
73
|
+
"service_starting",
|
|
74
|
+
// RESOURCE_BUSY (retryable): the service is starting or restarting
|
|
75
|
+
"service_restarted",
|
|
76
|
+
// RESOURCE_GONE: the service died while this request ran
|
|
77
|
+
"service_failed"
|
|
78
|
+
// INTERNAL: the service could not be started (see models.status)
|
|
64
79
|
]);
|
|
65
80
|
var FsPatchEditFailure = z2.strictObject({ edit_index: nonNegInt, reason: z2.string().max(300) });
|
|
66
81
|
var ProtocolErrorBody = z2.strictObject({
|
|
@@ -686,6 +701,254 @@ var RelayCallEnvelope = z9.strictObject({
|
|
|
686
701
|
});
|
|
687
702
|
var RelayStatusResponse = RelayDeviceStatusEvent;
|
|
688
703
|
|
|
704
|
+
// src/schema/models.ts
|
|
705
|
+
import { z as z10 } from "zod";
|
|
706
|
+
var TranscriptionModelId = z10.enum(["tiny", "base", "small", "large-v3-turbo"]);
|
|
707
|
+
var MlRuntimeState = z10.enum(["not_installed", "installing", "installed", "failed"]);
|
|
708
|
+
var MlInstallPhase = z10.enum(["packages", "model", "verifying"]);
|
|
709
|
+
var MlInstallProgress = z10.strictObject({
|
|
710
|
+
phase: MlInstallPhase,
|
|
711
|
+
/** What is being fetched now: a package or a model file name. */
|
|
712
|
+
item: z10.string().max(200),
|
|
713
|
+
bytes_done: nonNegInt,
|
|
714
|
+
/** Null while the total is not known yet. */
|
|
715
|
+
bytes_total: nonNegInt.nullable()
|
|
716
|
+
});
|
|
717
|
+
var TranscriptionModelInfo = z10.strictObject({
|
|
718
|
+
id: TranscriptionModelId,
|
|
719
|
+
/** Download size of the weights. */
|
|
720
|
+
size_bytes: nonNegInt,
|
|
721
|
+
multilingual: z10.boolean(),
|
|
722
|
+
installed: z10.boolean()
|
|
723
|
+
});
|
|
724
|
+
var TranscriptSegment = z10.strictObject({
|
|
725
|
+
start_s: z10.number().min(0),
|
|
726
|
+
end_s: z10.number().min(0),
|
|
727
|
+
text: z10.string().max(4e3)
|
|
728
|
+
});
|
|
729
|
+
var MlStatusParams = z10.strictObject({});
|
|
730
|
+
var MlStatusResult = z10.strictObject({
|
|
731
|
+
runtime: MlRuntimeState,
|
|
732
|
+
/** Non-null while runtime or model files are being installed. */
|
|
733
|
+
install: MlInstallProgress.nullable(),
|
|
734
|
+
/** The last install failure, one human line; null when the last install succeeded or none ran. */
|
|
735
|
+
error: z10.string().max(300).nullable(),
|
|
736
|
+
/** Where inference runs once the runtime is installed: `cuda` only when a usable GPU is present. */
|
|
737
|
+
accelerator: z10.enum(["cpu", "cuda"]),
|
|
738
|
+
models: z10.array(TranscriptionModelInfo).max(16),
|
|
739
|
+
default_model: TranscriptionModelId
|
|
740
|
+
});
|
|
741
|
+
var ModelsInstallParams = z10.strictObject({ model: TranscriptionModelId.optional() });
|
|
742
|
+
var ModelsInstallResult = z10.strictObject({ model: TranscriptionModelId, elapsed_ms: nonNegInt });
|
|
743
|
+
var ModelsTranscribeParams = z10.strictObject({
|
|
744
|
+
path: AbsPath,
|
|
745
|
+
model: TranscriptionModelId.optional(),
|
|
746
|
+
language: z10.string().regex(/^[a-z]{2,3}$/).optional(),
|
|
747
|
+
task: z10.enum(["transcribe", "translate"]).default("transcribe")
|
|
748
|
+
});
|
|
749
|
+
var ModelsTranscribeResult = z10.strictObject({
|
|
750
|
+
text: z10.string().max(4e5),
|
|
751
|
+
language: z10.string().max(8),
|
|
752
|
+
language_probability: z10.number().min(0).max(1),
|
|
753
|
+
duration_s: z10.number().min(0),
|
|
754
|
+
model: TranscriptionModelId,
|
|
755
|
+
segments: z10.array(TranscriptSegment).max(2e4),
|
|
756
|
+
elapsed_ms: nonNegInt
|
|
757
|
+
});
|
|
758
|
+
var MlProgress = z10.strictObject({
|
|
759
|
+
kind: z10.enum(["install", "transcribe"]),
|
|
760
|
+
/** 0–1 when known (transcribe: audio covered so far; install: bytes so far). */
|
|
761
|
+
fraction: z10.number().min(0).max(1).nullable(),
|
|
762
|
+
install: MlInstallProgress.nullable(),
|
|
763
|
+
/** The segment just transcribed (transcribe only): text appears as it is recognised. */
|
|
764
|
+
segment: TranscriptSegment.nullable()
|
|
765
|
+
});
|
|
766
|
+
var MlServiceState = z10.enum(["starting", "ready", "restarting", "failed", "stopped"]);
|
|
767
|
+
var MlServiceStatus = z10.strictObject({
|
|
768
|
+
state: MlServiceState,
|
|
769
|
+
pid: nonNegInt.nullable(),
|
|
770
|
+
/** Restarts since the app started (crashes, missed health checks). */
|
|
771
|
+
restarts: nonNegInt,
|
|
772
|
+
/** The bundled interpreter's version once the service has answered, e.g. "3.13.15". */
|
|
773
|
+
python: z10.string().max(32).nullable(),
|
|
774
|
+
/** Why the service is restarting or failed, one human line. */
|
|
775
|
+
error: z10.string().max(300).nullable()
|
|
776
|
+
});
|
|
777
|
+
var ModelsStatusParams = z10.strictObject({});
|
|
778
|
+
var ModelsStatusResult = z10.strictObject({
|
|
779
|
+
service: MlServiceStatus,
|
|
780
|
+
/** Null until the service has answered (starting, restarting, failed). */
|
|
781
|
+
transcription: MlStatusResult.nullable()
|
|
782
|
+
});
|
|
783
|
+
var ModelsProgressEvent = z10.strictObject({ request_id: RequestId, progress: MlProgress });
|
|
784
|
+
|
|
785
|
+
// src/schema/apps.ts
|
|
786
|
+
import { z as z11 } from "zod";
|
|
787
|
+
var AppKey = z11.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);
|
|
788
|
+
var AppProfileId = z11.string().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/);
|
|
789
|
+
var AppProfileLocator = z11.string().min(1).max(512).regex(/^[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}(\/[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}){0,7}$/);
|
|
790
|
+
var AppSupport = z11.enum(["supported", "partial", "unsupported"]);
|
|
791
|
+
var AppFeatureStatus = z11.strictObject({
|
|
792
|
+
status: AppSupport,
|
|
793
|
+
/** One line, set whenever status is not "supported". */
|
|
794
|
+
reason: z11.string().max(140).nullable()
|
|
795
|
+
});
|
|
796
|
+
var AppInfo = z11.strictObject({
|
|
797
|
+
app_key: AppKey,
|
|
798
|
+
name: z11.string().max(64),
|
|
799
|
+
installed: z11.boolean(),
|
|
800
|
+
/** The app's own version string, or null when it is not installed or does not say. */
|
|
801
|
+
version: z11.string().max(64).nullable(),
|
|
802
|
+
/** The install found (an .app bundle, an .exe, a binary), or null. */
|
|
803
|
+
location: AbsPath.nullable(),
|
|
804
|
+
/** Open the app at all on this OS. */
|
|
805
|
+
open: AppFeatureStatus,
|
|
806
|
+
/** Separate profiles (one account each) on this OS. */
|
|
807
|
+
profiles: AppFeatureStatus,
|
|
808
|
+
/** Plan usage read from the app's own files on this OS. */
|
|
809
|
+
usage: AppFeatureStatus
|
|
810
|
+
});
|
|
811
|
+
var AppUsageReading = z11.strictObject({
|
|
812
|
+
window: z11.enum(["five_hour", "weekly", "extra"]),
|
|
813
|
+
/** 0–100 for five_hour and weekly; extra-usage spend as a percent of its cap (may pass 100). */
|
|
814
|
+
percent: z11.number().min(0).max(1e4),
|
|
815
|
+
/** When the app recorded it. */
|
|
816
|
+
sampled_at_ms: epochMs,
|
|
817
|
+
/** True when the window has rolled over since the sample, so the figure has reset. */
|
|
818
|
+
reset_since: z11.boolean()
|
|
819
|
+
});
|
|
820
|
+
var AppProfile = z11.strictObject({
|
|
821
|
+
/** The row's id; null for a folder found on disk that no row names yet. */
|
|
822
|
+
id: AppProfileId.nullable(),
|
|
823
|
+
app_key: AppKey,
|
|
824
|
+
display_name: z11.string().min(1).max(120),
|
|
825
|
+
/** The account the person means to be signed in here; null when not stated (never guessed). */
|
|
826
|
+
account_identity: z11.string().min(3).max(320).nullable(),
|
|
827
|
+
profile_locator: AppProfileLocator.nullable(),
|
|
828
|
+
/** The device the row is tied to; null when the row names none. */
|
|
829
|
+
device_id: DeviceId.nullable(),
|
|
830
|
+
/** The folder this profile resolves to on this device; null for a row tied to another device. */
|
|
831
|
+
folder: AbsPath.nullable(),
|
|
832
|
+
/** The folder exists on this device. */
|
|
833
|
+
on_disk: z11.boolean(),
|
|
834
|
+
/** An instance with this profile is running; null when it could not be determined. */
|
|
835
|
+
running: z11.boolean().nullable(),
|
|
836
|
+
/** Usage the app recorded for this profile; null when the app exposes none here. */
|
|
837
|
+
usage: z11.array(AppUsageReading).nullable(),
|
|
838
|
+
last_opened_ms: epochMs.nullable()
|
|
839
|
+
});
|
|
840
|
+
var AppsListParams = z11.strictObject({});
|
|
841
|
+
var AppsListResult = z11.strictObject({ apps: z11.array(AppInfo) });
|
|
842
|
+
var AppsProfilesListParams = z11.strictObject({
|
|
843
|
+
/** Only this app's profiles; every app's when absent. */
|
|
844
|
+
app_key: AppKey.optional()
|
|
845
|
+
});
|
|
846
|
+
var AppsProfilesListResult = z11.strictObject({
|
|
847
|
+
profiles: z11.array(AppProfile),
|
|
848
|
+
/**
|
|
849
|
+
* Whether the saved rows could be read: false while signed out or offline, when only folders
|
|
850
|
+
* found on disk are listed.
|
|
851
|
+
*/
|
|
852
|
+
registry: z11.enum(["ok", "signed_out", "unavailable"])
|
|
853
|
+
});
|
|
854
|
+
var AppsProfilesSaveParams = z11.strictObject({
|
|
855
|
+
id: AppProfileId.optional(),
|
|
856
|
+
app_key: AppKey,
|
|
857
|
+
display_name: z11.string().min(1).max(120),
|
|
858
|
+
account_identity: z11.string().min(3).max(320).nullable(),
|
|
859
|
+
/** On create: the folder to use (one found on disk), or null for the app's default profile. Ignored on update. */
|
|
860
|
+
profile_locator: AppProfileLocator.nullable(),
|
|
861
|
+
/** On create with profile_locator null: make a new folder named after display_name instead. */
|
|
862
|
+
new_folder: z11.boolean().default(false)
|
|
863
|
+
});
|
|
864
|
+
var AppsProfilesSaveResult = AppProfile;
|
|
865
|
+
var AppsProfilesRemoveParams = z11.strictObject({ id: AppProfileId });
|
|
866
|
+
var AppsProfilesRemoveResult = z11.strictObject({ removed: z11.boolean() });
|
|
867
|
+
var AppsOpenParams = z11.strictObject({
|
|
868
|
+
app_key: AppKey,
|
|
869
|
+
profile_id: AppProfileId.optional()
|
|
870
|
+
});
|
|
871
|
+
var AppsOpenResult = z11.strictObject({
|
|
872
|
+
/** True when an instance with this profile was already running; it is brought forward. */
|
|
873
|
+
already_running: z11.boolean(),
|
|
874
|
+
folder: AbsPath.nullable()
|
|
875
|
+
});
|
|
876
|
+
|
|
877
|
+
// src/schema/service.ts
|
|
878
|
+
import { z as z12 } from "zod";
|
|
879
|
+
var SERVICE_MAX_FRAME_BYTES = 16777216;
|
|
880
|
+
var ServiceName = z12.enum(["ml"]);
|
|
881
|
+
var ContractHash = z12.string().regex(/^[0-9a-f]{64}$/);
|
|
882
|
+
var ServiceToken = z12.string().regex(/^[A-Za-z0-9_-]{43}$/);
|
|
883
|
+
var ServiceRequestId = u32;
|
|
884
|
+
var ServiceHello = z12.strictObject({ type: z12.literal("hello"), token: ServiceToken, contract: ContractHash });
|
|
885
|
+
var ServiceWelcome = z12.strictObject({
|
|
886
|
+
type: z12.literal("welcome"),
|
|
887
|
+
service: ServiceName,
|
|
888
|
+
contract: ContractHash,
|
|
889
|
+
pid: nonNegInt,
|
|
890
|
+
/** The interpreter's version, e.g. "3.13.15". */
|
|
891
|
+
python: z12.string().max(32),
|
|
892
|
+
/** Every op this service serves; must equal SERVICES[service] exactly. */
|
|
893
|
+
ops: z12.array(z12.string().min(1).max(64)).max(64)
|
|
894
|
+
});
|
|
895
|
+
var ServiceRequest = z12.strictObject({
|
|
896
|
+
type: z12.literal("request"),
|
|
897
|
+
id: ServiceRequestId,
|
|
898
|
+
op: z12.string().min(1).max(64),
|
|
899
|
+
params: z12.unknown()
|
|
900
|
+
// validated by the service against SERVICES[service][op].params
|
|
901
|
+
});
|
|
902
|
+
var ServiceResponse = z12.strictObject({
|
|
903
|
+
type: z12.literal("response"),
|
|
904
|
+
id: ServiceRequestId,
|
|
905
|
+
result: z12.unknown()
|
|
906
|
+
// validated by the core against SERVICES[service][op].result
|
|
907
|
+
});
|
|
908
|
+
var ServiceErrorMsg = z12.strictObject({ type: z12.literal("error"), id: ServiceRequestId, error: ProtocolErrorBody });
|
|
909
|
+
var ServiceProgressMsg = z12.strictObject({ type: z12.literal("progress"), id: ServiceRequestId, progress: z12.unknown() });
|
|
910
|
+
var ServiceCancel = z12.strictObject({ type: z12.literal("cancel"), id: ServiceRequestId });
|
|
911
|
+
var ServicePing = z12.strictObject({ type: z12.literal("ping"), id: ServiceRequestId });
|
|
912
|
+
var ServicePong = z12.strictObject({
|
|
913
|
+
type: z12.literal("pong"),
|
|
914
|
+
id: ServiceRequestId,
|
|
915
|
+
/** Requests running now. */
|
|
916
|
+
busy: nonNegInt
|
|
917
|
+
});
|
|
918
|
+
var ServiceShutdown = z12.strictObject({ type: z12.literal("shutdown") });
|
|
919
|
+
var CoreToServiceMsg = z12.discriminatedUnion("type", [ServiceHello, ServiceRequest, ServiceCancel, ServicePing, ServiceShutdown]);
|
|
920
|
+
var ServiceToCoreMsg = z12.discriminatedUnion("type", [ServiceWelcome, ServiceResponse, ServiceErrorMsg, ServiceProgressMsg, ServicePong]);
|
|
921
|
+
|
|
922
|
+
// src/schema/tools.ts
|
|
923
|
+
import { z as z13 } from "zod";
|
|
924
|
+
var ToolLevel = z13.enum(["programmatic", "protocol", "chat"]);
|
|
925
|
+
var ToolOutcome = z13.enum(["pass", "fail", "skip"]);
|
|
926
|
+
var ToolPlatform = z13.enum(["darwin", "win32", "linux"]);
|
|
927
|
+
var ToolTransport = z13.enum(["in_process", "localhost", "relay", "agent"]);
|
|
928
|
+
var ToolName = z13.string().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/);
|
|
929
|
+
var ToolLevelResult = z13.strictObject({
|
|
930
|
+
tool: ToolName,
|
|
931
|
+
level: ToolLevel,
|
|
932
|
+
platform: ToolPlatform,
|
|
933
|
+
transport: ToolTransport,
|
|
934
|
+
outcome: ToolOutcome,
|
|
935
|
+
/** True when the caller sat on a different network from the device (a phone on cellular, CI). */
|
|
936
|
+
remote_network: z13.boolean(),
|
|
937
|
+
/** One line: what was asserted, or why it failed. Never a token, a file's contents or a path under a real home. */
|
|
938
|
+
detail: z13.string().max(500),
|
|
939
|
+
/** The harness that produced it, e.g. `matrx-desktop test/tools/programmatic.test.ts`. */
|
|
940
|
+
suite: z13.string().min(1).max(200),
|
|
941
|
+
/** The test case inside the suite. */
|
|
942
|
+
test: z13.string().min(1).max(300),
|
|
943
|
+
run_at_ms: z13.int().min(0)
|
|
944
|
+
});
|
|
945
|
+
var ToolResultsFile = z13.strictObject({
|
|
946
|
+
schema: z13.literal("matrx.tool-results.v1"),
|
|
947
|
+
/** The producing repo's commit (short or full SHA). */
|
|
948
|
+
commit: z13.string().min(4).max(64),
|
|
949
|
+
results: z13.array(ToolLevelResult).max(1e4)
|
|
950
|
+
});
|
|
951
|
+
|
|
689
952
|
// src/schema/registry.ts
|
|
690
953
|
var FS_ERR = ["NOT_FOUND", "PERMISSION_DENIED_OS", "INVALID_PARAMS", "RESOURCE_BUSY", "INTERNAL"];
|
|
691
954
|
var OPS = {
|
|
@@ -712,7 +975,17 @@ var OPS = {
|
|
|
712
975
|
"session.attach": { params: SessionAttachParams, result: SessionAttachResult, kind: "stream", since: "1.0", errors: ["RESOURCE_GONE", "AUTH_FORBIDDEN", "RESOURCE_BUSY"] },
|
|
713
976
|
"session.detach": { params: SessionDetachParams, result: SessionDetachResult, kind: "unary", since: "1.0", errors: ["RESOURCE_GONE"] },
|
|
714
977
|
"session.release": { params: SessionReleaseParams, result: SessionReleaseResult, kind: "unary", since: "1.0", errors: ["RESOURCE_GONE", "AUTH_FORBIDDEN"] },
|
|
715
|
-
"session.list": { params: SessionListParams, result: SessionListResult, kind: "unary", since: "1.0", errors: ["INTERNAL"] }
|
|
978
|
+
"session.list": { params: SessionListParams, result: SessionListResult, kind: "unary", since: "1.0", errors: ["INTERNAL"] },
|
|
979
|
+
// Local models (SPEC §6), served by the `ml` Python service through SERVICES below.
|
|
980
|
+
"models.status": { params: ModelsStatusParams, result: ModelsStatusResult, kind: "unary", since: "1.2", errors: ["INTERNAL"] },
|
|
981
|
+
"models.install": { params: ModelsInstallParams, result: ModelsInstallResult, kind: "unary", since: "1.2", errors: ["RESOURCE_BUSY", "RESOURCE_GONE", "TIMEOUT", "CANCELLED", "INTERNAL"] },
|
|
982
|
+
"models.transcribe": { params: ModelsTranscribeParams, result: ModelsTranscribeResult, kind: "unary", since: "1.2", errors: ["NOT_FOUND", "INVALID_PARAMS", "PERMISSION_DENIED_OS", "RESOURCE_BUSY", "RESOURCE_GONE", "CANCELLED", "PAYLOAD_TOO_LARGE", "INTERNAL"] },
|
|
983
|
+
// Desktop apps and their profiles (SPEC §6 apps); profiles are rows in users.desktop_app_profile.
|
|
984
|
+
"apps.list": { params: AppsListParams, result: AppsListResult, kind: "unary", since: "1.2", errors: ["INTERNAL"] },
|
|
985
|
+
"apps.profiles.list": { params: AppsProfilesListParams, result: AppsProfilesListResult, kind: "unary", since: "1.2", errors: ["NOT_FOUND", "INVALID_PARAMS", "INTERNAL"] },
|
|
986
|
+
"apps.profiles.save": { params: AppsProfilesSaveParams, result: AppsProfilesSaveResult, kind: "unary", since: "1.2", errors: ["AUTH_REQUIRED", "AUTH_FORBIDDEN", "NOT_FOUND", "INVALID_PARAMS", "CONFLICT", "PLATFORM_UNSUPPORTED", "DEVICE_OFFLINE", "INTERNAL"] },
|
|
987
|
+
"apps.profiles.remove": { params: AppsProfilesRemoveParams, result: AppsProfilesRemoveResult, kind: "unary", since: "1.2", errors: ["AUTH_REQUIRED", "AUTH_FORBIDDEN", "NOT_FOUND", "DEVICE_OFFLINE", "INTERNAL"] },
|
|
988
|
+
"apps.open": { params: AppsOpenParams, result: AppsOpenResult, kind: "unary", since: "1.2", errors: ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "AUTH_REQUIRED", "DEVICE_OFFLINE", "INTERNAL"] }
|
|
716
989
|
};
|
|
717
990
|
var EVENTS = {
|
|
718
991
|
"fs.changed": FsChangedEvent,
|
|
@@ -720,9 +993,20 @@ var EVENTS = {
|
|
|
720
993
|
"exec.title": ExecTitleEvent,
|
|
721
994
|
"exec.cwd": ExecCwdEvent,
|
|
722
995
|
"session.control_changed": SessionControlChangedEvent,
|
|
996
|
+
"models.progress": ModelsProgressEvent,
|
|
723
997
|
"relay.device_status": RelayDeviceStatusEvent,
|
|
724
998
|
"relay.auth_expiring": RelayAuthExpiringEvent
|
|
725
999
|
};
|
|
1000
|
+
var SERVICES = {
|
|
1001
|
+
ml: {
|
|
1002
|
+
progress: MlProgress,
|
|
1003
|
+
ops: {
|
|
1004
|
+
"ml.status": { params: MlStatusParams, result: MlStatusResult },
|
|
1005
|
+
"ml.install": { params: ModelsInstallParams, result: ModelsInstallResult },
|
|
1006
|
+
"ml.transcribe": { params: ModelsTranscribeParams, result: ModelsTranscribeResult }
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
726
1010
|
var NAMED_SCHEMAS = {
|
|
727
1011
|
ProtocolVersion,
|
|
728
1012
|
RequestId,
|
|
@@ -811,6 +1095,39 @@ var NAMED_SCHEMAS = {
|
|
|
811
1095
|
SessionListParams,
|
|
812
1096
|
SessionListResult,
|
|
813
1097
|
SessionControlChangedEvent,
|
|
1098
|
+
TranscriptionModelId,
|
|
1099
|
+
MlRuntimeState,
|
|
1100
|
+
MlInstallPhase,
|
|
1101
|
+
MlInstallProgress,
|
|
1102
|
+
TranscriptionModelInfo,
|
|
1103
|
+
TranscriptSegment,
|
|
1104
|
+
MlStatusParams,
|
|
1105
|
+
MlStatusResult,
|
|
1106
|
+
ModelsInstallParams,
|
|
1107
|
+
ModelsInstallResult,
|
|
1108
|
+
ModelsTranscribeParams,
|
|
1109
|
+
ModelsTranscribeResult,
|
|
1110
|
+
MlProgress,
|
|
1111
|
+
MlServiceState,
|
|
1112
|
+
MlServiceStatus,
|
|
1113
|
+
ModelsStatusParams,
|
|
1114
|
+
ModelsStatusResult,
|
|
1115
|
+
ModelsProgressEvent,
|
|
1116
|
+
ServiceName,
|
|
1117
|
+
ContractHash,
|
|
1118
|
+
ServiceToken,
|
|
1119
|
+
ServiceHello,
|
|
1120
|
+
ServiceWelcome,
|
|
1121
|
+
ServiceRequest,
|
|
1122
|
+
ServiceResponse,
|
|
1123
|
+
ServiceErrorMsg,
|
|
1124
|
+
ServiceProgressMsg,
|
|
1125
|
+
ServiceCancel,
|
|
1126
|
+
ServicePing,
|
|
1127
|
+
ServicePong,
|
|
1128
|
+
ServiceShutdown,
|
|
1129
|
+
CoreToServiceMsg,
|
|
1130
|
+
ServiceToCoreMsg,
|
|
814
1131
|
RelayDeviceStatusEvent,
|
|
815
1132
|
RelayAuthExpiringEvent,
|
|
816
1133
|
RelayCallRequest,
|
|
@@ -819,7 +1136,31 @@ var NAMED_SCHEMAS = {
|
|
|
819
1136
|
RelayCallEnvelope,
|
|
820
1137
|
RelayHopEnvelopeHeader,
|
|
821
1138
|
RelayHopConnectionEnd,
|
|
822
|
-
CloseCodeValue
|
|
1139
|
+
CloseCodeValue,
|
|
1140
|
+
ToolLevel,
|
|
1141
|
+
ToolOutcome,
|
|
1142
|
+
ToolPlatform,
|
|
1143
|
+
ToolTransport,
|
|
1144
|
+
ToolName,
|
|
1145
|
+
ToolLevelResult,
|
|
1146
|
+
ToolResultsFile,
|
|
1147
|
+
AppKey,
|
|
1148
|
+
AppProfileId,
|
|
1149
|
+
AppProfileLocator,
|
|
1150
|
+
AppSupport,
|
|
1151
|
+
AppFeatureStatus,
|
|
1152
|
+
AppInfo,
|
|
1153
|
+
AppUsageReading,
|
|
1154
|
+
AppProfile,
|
|
1155
|
+
AppsListParams,
|
|
1156
|
+
AppsListResult,
|
|
1157
|
+
AppsProfilesListParams,
|
|
1158
|
+
AppsProfilesListResult,
|
|
1159
|
+
AppsProfilesSaveParams,
|
|
1160
|
+
AppsProfilesRemoveParams,
|
|
1161
|
+
AppsProfilesRemoveResult,
|
|
1162
|
+
AppsOpenParams,
|
|
1163
|
+
AppsOpenResult
|
|
823
1164
|
};
|
|
824
1165
|
|
|
825
1166
|
// src/versioning.ts
|
|
@@ -832,6 +1173,15 @@ var FIELDS_SINCE = {
|
|
|
832
1173
|
var NULL_SINCE = {
|
|
833
1174
|
"RelayDeviceStatusEvent.since_ms": { since: "1.1", olderPeersGet: 0 }
|
|
834
1175
|
};
|
|
1176
|
+
var REASONS_SINCE = {
|
|
1177
|
+
runtime_not_installed: "1.2",
|
|
1178
|
+
model_not_installed: "1.2",
|
|
1179
|
+
unsupported_media: "1.2",
|
|
1180
|
+
download_failed: "1.2",
|
|
1181
|
+
service_starting: "1.2",
|
|
1182
|
+
service_restarted: "1.2",
|
|
1183
|
+
service_failed: "1.2"
|
|
1184
|
+
};
|
|
835
1185
|
function statusForPeer(status, version) {
|
|
836
1186
|
const rule = NULL_SINCE["RelayDeviceStatusEvent.since_ms"];
|
|
837
1187
|
return status.since_ms === null && !knows(version, rule.since) ? { ...status, since_ms: rule.olderPeersGet } : status;
|
|
@@ -880,20 +1230,389 @@ function forPeer(op, part, value, version) {
|
|
|
880
1230
|
if (value === null || typeof value !== "object") return value;
|
|
881
1231
|
const body = value;
|
|
882
1232
|
if (body.data === void 0) return value;
|
|
883
|
-
|
|
1233
|
+
let data = strip(body.data, FIELDS_SINCE["ProtocolErrorBody.data"], version);
|
|
1234
|
+
const reason = data.reason;
|
|
1235
|
+
const reasonSince = typeof reason === "string" ? REASONS_SINCE[reason] : void 0;
|
|
1236
|
+
if (reasonSince && !knows(version, reasonSince)) {
|
|
1237
|
+
const { reason: _dropped, ...rest } = data;
|
|
1238
|
+
data = rest;
|
|
1239
|
+
}
|
|
884
1240
|
return data === body.data ? value : { ...body, data };
|
|
885
1241
|
}
|
|
886
1242
|
var VERSIONED_RESULT_OPS = [...RESULT_PATH.keys()];
|
|
1243
|
+
|
|
1244
|
+
// src/contract.ts
|
|
1245
|
+
var CONTRACT_SHA256 = "ef9fd8c8ab611bf450730452a6cf48a4ebd566218b6e17e2834ef030fc2044cb";
|
|
1246
|
+
|
|
1247
|
+
// src/close-policy.ts
|
|
1248
|
+
var CLOSE_RULES = {
|
|
1249
|
+
[CloseCode.NORMAL]: { action: "reconnect", error: ["DEVICE_OFFLINE", "Connection closed"] },
|
|
1250
|
+
[CloseCode.GOING_AWAY]: { action: "reconnect_now", error: ["DEVICE_OFFLINE", "Connection lost"] },
|
|
1251
|
+
[CloseCode.ABNORMAL]: { action: "reconnect_now", error: ["DEVICE_OFFLINE", "Connection lost"] },
|
|
1252
|
+
[CloseCode.DEVICE_RECONNECTED]: { action: "reconnect_now", error: ["DEVICE_OFFLINE", "Device reconnected"] },
|
|
1253
|
+
[CloseCode.TRY_AGAIN_LATER]: { action: "reconnect", error: ["DEVICE_OFFLINE", "Relay busy; retrying"] },
|
|
1254
|
+
[CloseCode.AUTH_INVALID]: { action: "reauth", outcome: "signed_out", error: ["AUTH_INVALID", "Sign-in was not accepted"] },
|
|
1255
|
+
[CloseCode.AUTH_FORBIDDEN]: { action: "stop", outcome: "not_owned", error: ["AUTH_FORBIDDEN", "Not this device's owner"] },
|
|
1256
|
+
[CloseCode.DEVICE_NOT_FOUND]: { action: "stop", outcome: "removed", error: ["NOT_FOUND", "Device not found"] },
|
|
1257
|
+
[CloseCode.AUTH_EXPIRED]: { action: "reauth", outcome: "signed_out", error: ["AUTH_EXPIRED", "Sign-in expired"] },
|
|
1258
|
+
[CloseCode.REPLACED]: { action: "stop", outcome: "replaced", error: ["CONFLICT", "Replaced by a newer connection"] },
|
|
1259
|
+
[CloseCode.DEVICE_REVOKED]: { action: "stop", outcome: "revoked", error: ["AUTH_DEVICE_REVOKED", "This device was revoked"] },
|
|
1260
|
+
// A malformed message, or a connection the relay lost track of: a fresh socket starts clean.
|
|
1261
|
+
[CloseCode.PROTOCOL_ERROR]: { action: "reconnect", error: ["PROTOCOL_ERROR", "Connection reset by the relay"] },
|
|
1262
|
+
[CloseCode.UPGRADE_REQUIRED]: { action: "stop", outcome: "upgrade_required", error: ["PROTOCOL_VERSION_UNSUPPORTED", "Protocol upgrade required"] }
|
|
1263
|
+
};
|
|
1264
|
+
var UNKNOWN = { action: "reconnect", error: ["DEVICE_OFFLINE", "Connection lost"] };
|
|
1265
|
+
function closeRule(code) {
|
|
1266
|
+
if (code === null || code === void 0) return CLOSE_RULES[CloseCode.ABNORMAL];
|
|
1267
|
+
return CLOSE_RULES[code] ?? UNKNOWN;
|
|
1268
|
+
}
|
|
1269
|
+
function isTerminalClose(code) {
|
|
1270
|
+
return closeRule(code).action === "stop";
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
// src/tools/catalog.ts
|
|
1274
|
+
var TOOL_GROUPS = [
|
|
1275
|
+
{ id: "files_shell", order: 1, title: "Files and shell", owner: "core" },
|
|
1276
|
+
{ id: "os_control", order: 2, title: "Computer control", owner: "core" },
|
|
1277
|
+
{ id: "personal_automation", order: 3, title: "Personal apps and automation", owner: "core" },
|
|
1278
|
+
{ id: "tools_service", order: 4, title: "Documents, OCR and entities", owner: "python_tools" },
|
|
1279
|
+
{ id: "ml_service", order: 5, title: "Speech", owner: "python_ml" },
|
|
1280
|
+
{ id: "windows_admin", order: 6, title: "Windows administration", owner: "core" }
|
|
1281
|
+
];
|
|
1282
|
+
var ALL = ["darwin", "win32", "linux"];
|
|
1283
|
+
var TOOL_CATALOG = [
|
|
1284
|
+
// ── 1. Files and shell (core `fs`, `exec`; the cloud sandbox's agent tools) ──────────────────
|
|
1285
|
+
{ name: "fs_read", group: "files_shell", state: "built", path: "sandbox_proxy", ops: ["fs.read"], platforms: ALL, summary: "Read a file, paged" },
|
|
1286
|
+
{ name: "fs_write", group: "files_shell", state: "built", path: "sandbox_proxy", ops: ["fs.read", "fs.write"], platforms: ALL, summary: "Create or overwrite a file" },
|
|
1287
|
+
{ name: "fs_edit", group: "files_shell", state: "built", path: "sandbox_proxy", ops: ["fs.read", "fs.patch"], platforms: ALL, summary: "Replace one exact string" },
|
|
1288
|
+
{ name: "fs_patch", group: "files_shell", state: "built", path: "sandbox_proxy", ops: ["fs.read", "fs.patch"], platforms: ALL, summary: "Apply several exact edits at once" },
|
|
1289
|
+
{ name: "fs_list", group: "files_shell", state: "built", path: "sandbox_proxy", ops: ["fs.list"], platforms: ALL, summary: "List a folder" },
|
|
1290
|
+
{ name: "fs_mkdir", group: "files_shell", state: "built", path: "sandbox_proxy", ops: ["fs.mkdir"], platforms: ALL, summary: "Create a folder" },
|
|
1291
|
+
{ name: "fs_search", group: "files_shell", state: "built", path: "sandbox_proxy", ops: ["fs.search_paths", "fs.search_content"], platforms: ALL, summary: "Find files by name or content" },
|
|
1292
|
+
{ name: "shell_execute", group: "files_shell", state: "built", path: "sandbox_proxy", ops: ["exec.run"], platforms: ALL, summary: "Run a command in a folder" },
|
|
1293
|
+
{ name: "shell_python", group: "files_shell", state: "built", path: "sandbox_proxy", ops: ["exec.run"], platforms: ALL, summary: "Run a Python script" },
|
|
1294
|
+
{
|
|
1295
|
+
name: "git_ingest",
|
|
1296
|
+
group: "files_shell",
|
|
1297
|
+
state: "broken",
|
|
1298
|
+
path: "server",
|
|
1299
|
+
ops: [],
|
|
1300
|
+
platforms: ALL,
|
|
1301
|
+
summary: "Digest a repository",
|
|
1302
|
+
note: "Armed with the files tools, but a local path is read on the server, not the bound device"
|
|
1303
|
+
},
|
|
1304
|
+
{ name: "shell_job", group: "files_shell", state: "planned", path: "device_op", ops: ["exec.job.start", "exec.job.output", "exec.job.stop"], platforms: ALL, summary: "Background commands: start, read output, stop" },
|
|
1305
|
+
// ── 2. Computer control (TS owners) ──────────────────────────────────────────────────────────
|
|
1306
|
+
{ name: "desktop_process", group: "os_control", state: "planned", path: "device_op", ops: ["proc.list", "proc.ports", "proc.kill", "proc.launch_app", "proc.focus_app", "proc.installed_apps"], platforms: ALL, summary: "Processes, ports and apps" },
|
|
1307
|
+
{ name: "desktop_system", group: "os_control", state: "planned", path: "device_op", ops: ["sysinfo.get", "system.open_url", "system.open_path", "system.notify"], platforms: ALL, summary: "System facts, open, notify" },
|
|
1308
|
+
{ name: "desktop_clipboard", group: "os_control", state: "planned", path: "device_op", ops: ["clipboard.read", "clipboard.write"], platforms: ALL, summary: "Read and write the clipboard" },
|
|
1309
|
+
{ name: "desktop_screen", group: "os_control", state: "planned", path: "device_op", ops: ["screen.list", "screen.capture"], platforms: ALL, summary: "Displays and screenshots" },
|
|
1310
|
+
{ name: "desktop_window", group: "os_control", state: "planned", path: "device_op", ops: ["window.list", "window.focus", "window.move", "window.minimize"], platforms: ALL, summary: "Find, focus and arrange windows" },
|
|
1311
|
+
{ name: "desktop_input", group: "os_control", state: "planned", path: "device_op", ops: ["input.type_text", "input.hotkey", "input.mouse_click", "input.mouse_move"], platforms: ALL, summary: "Keyboard and mouse" },
|
|
1312
|
+
{ name: "desktop_audio", group: "os_control", state: "planned", path: "device_op", ops: ["audio.devices", "audio.record", "audio.play"], platforms: ALL, summary: "Audio devices, record, play" },
|
|
1313
|
+
{ name: "desktop_power", group: "os_control", state: "planned", path: "device_op", ops: ["power.status", "power.prevent_sleep"], platforms: ALL, summary: "Battery and keep awake" },
|
|
1314
|
+
{ name: "desktop_resources", group: "os_control", state: "planned", path: "device_op", ops: ["resources.snapshot", "resources.top"], platforms: ALL, summary: "CPU, memory and disk use" },
|
|
1315
|
+
{ name: "fs_watch", group: "os_control", state: "planned", path: "device_op", ops: ["fs.watch"], platforms: ALL, summary: "Watch a folder for changes" },
|
|
1316
|
+
// ── 3. Personal apps and automation ──────────────────────────────────────────────────────────
|
|
1317
|
+
{ name: "desktop_automation", group: "personal_automation", state: "planned", path: "device_op", ops: ["automation.script"], platforms: ["darwin", "win32"], summary: "AppleScript on a Mac, PowerShell on Windows" },
|
|
1318
|
+
{ name: "desktop_mail", group: "personal_automation", state: "planned", path: "device_op", ops: ["mail.accounts", "mail.list", "mail.send"], platforms: ["darwin"], summary: "The Mail app" },
|
|
1319
|
+
{ name: "desktop_messages", group: "personal_automation", state: "planned", path: "device_op", ops: ["messages.conversations", "messages.list", "messages.send"], platforms: ["darwin"], summary: "The Messages app" },
|
|
1320
|
+
{ name: "desktop_contacts", group: "personal_automation", state: "planned", path: "device_op", ops: ["contacts.search", "contacts.get"], platforms: ["darwin"], summary: "Contacts" },
|
|
1321
|
+
{ name: "desktop_calendar", group: "personal_automation", state: "planned", path: "device_op", ops: ["calendar.list", "calendar.create", "reminders.list", "reminders.create"], platforms: ["darwin"], summary: "Calendar and reminders" },
|
|
1322
|
+
{ name: "desktop_photos", group: "personal_automation", state: "planned", path: "device_op", ops: ["photos.search", "photos.get"], platforms: ["darwin"], summary: "Photos library" },
|
|
1323
|
+
{ name: "desktop_location", group: "personal_automation", state: "planned", path: "device_op", ops: ["location.get"], platforms: ["darwin", "win32"], summary: "Where the computer is" },
|
|
1324
|
+
{ name: "desktop_net", group: "personal_automation", state: "planned", path: "device_op", ops: ["net.info", "net.wifi", "net.bluetooth", "net.devices", "net.mdns", "net.scan", "net.download"], platforms: ALL, summary: "Local network and downloads" },
|
|
1325
|
+
// ── 4. Python `tools` service ────────────────────────────────────────────────────────────────
|
|
1326
|
+
{ name: "desktop_documents", group: "tools_service", state: "planned", path: "device_op", ops: ["tools.pdf_extract", "tools.office_generate", "tools.ocr", "tools.image_resize"], platforms: ALL, summary: "PDF text, Office files, OCR, images" },
|
|
1327
|
+
{ name: "desktop_entities", group: "tools_service", state: "planned", path: "device_op", ops: ["tools.ner", "tools.pii"], platforms: ALL, summary: "Names and private data, found on the device" },
|
|
1328
|
+
// ── 5. Python `ml` service ───────────────────────────────────────────────────────────────────
|
|
1329
|
+
{ name: "desktop_transcribe", group: "ml_service", state: "planned", path: "device_op", ops: ["models.transcribe", "models.speech_locales"], platforms: ALL, summary: "Speech to text on the device" },
|
|
1330
|
+
// ── 6. Windows administration ────────────────────────────────────────────────────────────────
|
|
1331
|
+
{ name: "desktop_windows_admin", group: "windows_admin", state: "planned", path: "device_op", ops: ["windows.registry_read", "windows.registry_write", "windows.services", "windows.service_control", "windows.event_log", "windows.features"], platforms: ["win32"], summary: "Registry, services, event log" }
|
|
1332
|
+
];
|
|
1333
|
+
var tool = (name) => ({ kind: "tool", tool: name });
|
|
1334
|
+
var dropped = (reason) => ({ kind: "dropped", reason });
|
|
1335
|
+
var SHELL_COVERS = "Done with shell_execute (mv, cp, rm, tar), as every coding agent does";
|
|
1336
|
+
var CLOUD_SCRAPER = "The cloud scraper and research tools run with this computer as their network (the `proxy` capability)";
|
|
1337
|
+
var LEGACY_ACTIONS = {
|
|
1338
|
+
"local_file.read": tool("fs_read"),
|
|
1339
|
+
"local_file.write": tool("fs_write"),
|
|
1340
|
+
"local_file.edit": tool("fs_edit"),
|
|
1341
|
+
"local_file.move": dropped(SHELL_COVERS),
|
|
1342
|
+
"local_file.copy": dropped(SHELL_COVERS),
|
|
1343
|
+
"local_file.delete": dropped(SHELL_COVERS),
|
|
1344
|
+
"local_file.rename": dropped(SHELL_COVERS),
|
|
1345
|
+
"local_file.mkdir": tool("fs_mkdir"),
|
|
1346
|
+
"local_file.glob": tool("fs_search"),
|
|
1347
|
+
"local_file.grep": tool("fs_search"),
|
|
1348
|
+
"local_file.list": tool("fs_list"),
|
|
1349
|
+
"local_file.places": dropped("The device's home and folders reach the agent in its binding briefing (sysinfo.get)"),
|
|
1350
|
+
"local_file.find": tool("fs_search"),
|
|
1351
|
+
"local_file.semantic_find": dropped("Needs a local embedding index; returns with file sync's index, not before"),
|
|
1352
|
+
"local_shell.run": tool("shell_execute"),
|
|
1353
|
+
"local_shell.output": tool("shell_job"),
|
|
1354
|
+
"local_shell.stop": tool("shell_job"),
|
|
1355
|
+
"local_window.list": tool("desktop_window"),
|
|
1356
|
+
"local_window.focus": tool("desktop_window"),
|
|
1357
|
+
"local_window.move": tool("desktop_window"),
|
|
1358
|
+
"local_window.minimize": tool("desktop_window"),
|
|
1359
|
+
"local_process.list": tool("desktop_process"),
|
|
1360
|
+
"local_process.ports": tool("desktop_process"),
|
|
1361
|
+
"local_process.launch_app": tool("desktop_process"),
|
|
1362
|
+
"local_process.kill": tool("desktop_process"),
|
|
1363
|
+
"local_process.focus_app": tool("desktop_process"),
|
|
1364
|
+
"local_process.terminals": dropped("Matrx 2 terminals are exec sessions; the person's own terminal windows are not the agent's"),
|
|
1365
|
+
"local_process.tail_terminal": dropped("Matrx 2 terminals are exec sessions; the person's own terminal windows are not the agent's"),
|
|
1366
|
+
"local_process.installed_apps": tool("desktop_process"),
|
|
1367
|
+
"local_input.type_text": tool("desktop_input"),
|
|
1368
|
+
"local_input.hotkey": tool("desktop_input"),
|
|
1369
|
+
"local_input.mouse_click": tool("desktop_input"),
|
|
1370
|
+
"local_input.mouse_move": tool("desktop_input"),
|
|
1371
|
+
"local_audio.devices": tool("desktop_audio"),
|
|
1372
|
+
"local_audio.record": tool("desktop_audio"),
|
|
1373
|
+
"local_audio.play": tool("desktop_audio"),
|
|
1374
|
+
"local_audio.transcribe": tool("desktop_transcribe"),
|
|
1375
|
+
"local_audio.transcribe_with_speech": tool("desktop_transcribe"),
|
|
1376
|
+
"local_audio.speech_locales": tool("desktop_transcribe"),
|
|
1377
|
+
"local_clipboard.read": tool("desktop_clipboard"),
|
|
1378
|
+
"local_clipboard.write": tool("desktop_clipboard"),
|
|
1379
|
+
"local_screen.screenshot": tool("desktop_screen"),
|
|
1380
|
+
"local_screen.list": tool("desktop_screen"),
|
|
1381
|
+
"local_screen.capture_book": dropped("A one-off loop of screenshot plus page turn; the agent composes it from desktop_screen and desktop_input"),
|
|
1382
|
+
"local_system.info": tool("desktop_system"),
|
|
1383
|
+
"local_system.open_url": tool("desktop_system"),
|
|
1384
|
+
"local_system.open_path": tool("desktop_system"),
|
|
1385
|
+
"local_system.notify": tool("desktop_system"),
|
|
1386
|
+
"local_browser.navigate": dropped("The browser agent is the extension (matrx-extend) and the cloud browser; a second Playwright on the device duplicates it"),
|
|
1387
|
+
"local_browser.click": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
|
|
1388
|
+
"local_browser.type_text": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
|
|
1389
|
+
"local_browser.extract": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
|
|
1390
|
+
"local_browser.screenshot": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
|
|
1391
|
+
"local_browser.eval": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
|
|
1392
|
+
"local_browser.tabs": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
|
|
1393
|
+
"local_browser.close": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
|
|
1394
|
+
"local_web.fetch": dropped(CLOUD_SCRAPER),
|
|
1395
|
+
"local_web.fetch_with_browser": dropped(CLOUD_SCRAPER),
|
|
1396
|
+
"local_web.scrape": dropped(CLOUD_SCRAPER),
|
|
1397
|
+
"local_web.search": dropped(CLOUD_SCRAPER),
|
|
1398
|
+
"local_web.research": dropped(CLOUD_SCRAPER),
|
|
1399
|
+
"local_web.download": tool("desktop_net"),
|
|
1400
|
+
"local_web.upload": dropped("Uploads are cloud files (matrx-files) and file sync, one upload path"),
|
|
1401
|
+
"local_net.info": tool("desktop_net"),
|
|
1402
|
+
"local_net.scan": tool("desktop_net"),
|
|
1403
|
+
"local_net.port_scan": tool("desktop_net"),
|
|
1404
|
+
"local_net.mdns_discover": tool("desktop_net"),
|
|
1405
|
+
"local_net.wifi_networks": tool("desktop_net"),
|
|
1406
|
+
"local_net.bluetooth_devices": tool("desktop_net"),
|
|
1407
|
+
"local_net.connected_devices": tool("desktop_net"),
|
|
1408
|
+
"local_monitor.resources": tool("desktop_resources"),
|
|
1409
|
+
"local_monitor.battery": tool("desktop_power"),
|
|
1410
|
+
"local_monitor.disk_usage": tool("desktop_resources"),
|
|
1411
|
+
"local_monitor.top_processes": tool("desktop_resources"),
|
|
1412
|
+
"local_monitor.watch_directory": tool("fs_watch"),
|
|
1413
|
+
"local_monitor.watch_events": tool("fs_watch"),
|
|
1414
|
+
"local_monitor.stop_watch": tool("fs_watch"),
|
|
1415
|
+
"local_monitor.heartbeat": dropped("The relay's device status replaces the heartbeat"),
|
|
1416
|
+
"local_schedule.create": dropped("One scheduler: the platform's runs the agent on time and reaches the device through the relay"),
|
|
1417
|
+
"local_schedule.list": dropped("One scheduler: the platform's runs the agent on time and reaches the device through the relay"),
|
|
1418
|
+
"local_schedule.cancel": dropped("One scheduler: the platform's runs the agent on time and reaches the device through the relay"),
|
|
1419
|
+
"local_schedule.prevent_sleep": tool("desktop_power"),
|
|
1420
|
+
"local_documents.list": dropped("matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge"),
|
|
1421
|
+
"local_documents.folders": dropped("matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge"),
|
|
1422
|
+
"local_documents.read": dropped("matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge"),
|
|
1423
|
+
"local_documents.write": dropped("matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge"),
|
|
1424
|
+
"local_documents.search": dropped("matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge"),
|
|
1425
|
+
"local_media.ocr": tool("desktop_documents"),
|
|
1426
|
+
"local_media.resize": tool("desktop_documents"),
|
|
1427
|
+
"local_media.pdf_extract": tool("desktop_documents"),
|
|
1428
|
+
"local_media.office_generate": tool("desktop_documents"),
|
|
1429
|
+
"local_media.archive_create": dropped(SHELL_COVERS),
|
|
1430
|
+
"local_media.archive_extract": dropped(SHELL_COVERS),
|
|
1431
|
+
"local_ner.entities": tool("desktop_entities"),
|
|
1432
|
+
"local_ner.pii": tool("desktop_entities"),
|
|
1433
|
+
"local_mac_apps.applescript": tool("desktop_automation"),
|
|
1434
|
+
"local_mac_apps.list_emails": tool("desktop_mail"),
|
|
1435
|
+
"local_mac_apps.send_email": tool("desktop_mail"),
|
|
1436
|
+
"local_mac_apps.email_accounts": tool("desktop_mail"),
|
|
1437
|
+
"local_mac_apps.list_messages": tool("desktop_messages"),
|
|
1438
|
+
"local_mac_apps.list_conversations": tool("desktop_messages"),
|
|
1439
|
+
"local_mac_apps.send_message": tool("desktop_messages"),
|
|
1440
|
+
"local_mac_apps.search_contacts": tool("desktop_contacts"),
|
|
1441
|
+
"local_mac_apps.get_contact": tool("desktop_contacts"),
|
|
1442
|
+
"local_mac_apps.list_events": tool("desktop_calendar"),
|
|
1443
|
+
"local_mac_apps.create_event": tool("desktop_calendar"),
|
|
1444
|
+
"local_mac_apps.list_reminders": tool("desktop_calendar"),
|
|
1445
|
+
"local_mac_apps.create_reminder": tool("desktop_calendar"),
|
|
1446
|
+
"local_mac_apps.search_photos": tool("desktop_photos"),
|
|
1447
|
+
"local_mac_apps.get_photo": tool("desktop_photos"),
|
|
1448
|
+
"local_mac_apps.location": tool("desktop_location"),
|
|
1449
|
+
"local_windows_ps.run": tool("desktop_automation"),
|
|
1450
|
+
"local_windows_ps.get_env": dropped("Read with shell_execute; a per-command env rides exec.run"),
|
|
1451
|
+
"local_windows_ps.set_env": dropped("Changing the person's persistent environment is not an agent tool"),
|
|
1452
|
+
"local_windows_ps.registry_read": tool("desktop_windows_admin"),
|
|
1453
|
+
"local_windows_ps.registry_write": tool("desktop_windows_admin"),
|
|
1454
|
+
"local_windows_ps.service_list": tool("desktop_windows_admin"),
|
|
1455
|
+
"local_windows_ps.service_control": tool("desktop_windows_admin"),
|
|
1456
|
+
"local_windows_ps.event_log": tool("desktop_windows_admin"),
|
|
1457
|
+
"local_windows_ps.windows_features": tool("desktop_windows_admin")
|
|
1458
|
+
};
|
|
1459
|
+
var LEGACY_DISPATCHERS = [
|
|
1460
|
+
"local_file",
|
|
1461
|
+
"local_shell",
|
|
1462
|
+
"local_window",
|
|
1463
|
+
"local_process",
|
|
1464
|
+
"local_input",
|
|
1465
|
+
"local_audio",
|
|
1466
|
+
"local_clipboard",
|
|
1467
|
+
"local_screen",
|
|
1468
|
+
"local_system",
|
|
1469
|
+
"local_browser",
|
|
1470
|
+
"local_web",
|
|
1471
|
+
"local_net",
|
|
1472
|
+
"local_monitor",
|
|
1473
|
+
"local_schedule",
|
|
1474
|
+
"local_documents",
|
|
1475
|
+
"local_media",
|
|
1476
|
+
"local_ner",
|
|
1477
|
+
"local_mac_apps",
|
|
1478
|
+
"local_windows_ps"
|
|
1479
|
+
];
|
|
1480
|
+
function builtOps() {
|
|
1481
|
+
return TOOL_CATALOG.filter((t) => t.state === "built").flatMap((t) => t.ops);
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
// src/tools/status.ts
|
|
1485
|
+
var TOOL_LEVELS = ["programmatic", "protocol", "chat"];
|
|
1486
|
+
var TOOL_PLATFORMS = ["darwin", "win32", "linux"];
|
|
1487
|
+
var REQUIRED = {
|
|
1488
|
+
programmatic: [{ label: "in process", ok: (e) => e.transport === "in_process" }],
|
|
1489
|
+
protocol: [
|
|
1490
|
+
{ label: "localhost", ok: (e) => e.transport === "localhost" },
|
|
1491
|
+
{ label: "relay", ok: (e) => e.transport === "relay" },
|
|
1492
|
+
{ label: "relay from another network", ok: (e) => e.transport === "relay" && e.remote_network }
|
|
1493
|
+
],
|
|
1494
|
+
chat: [{ label: "a real agent in a real chat", ok: (e) => e.transport === "agent" }]
|
|
1495
|
+
};
|
|
1496
|
+
function cellFor(tool2, platform, level, evidence) {
|
|
1497
|
+
if (!tool2.platforms.includes(platform)) return { state: "unsupported", missing: [], last_run_at_ms: null, evidence: [] };
|
|
1498
|
+
const latest = /* @__PURE__ */ new Map();
|
|
1499
|
+
for (const e of evidence) {
|
|
1500
|
+
const key = `${e.suite}\0${e.test}\0${e.transport}\0${e.remote_network}`;
|
|
1501
|
+
const prev = latest.get(key);
|
|
1502
|
+
if (!prev || prev.run_at_ms < e.run_at_ms) latest.set(key, e);
|
|
1503
|
+
}
|
|
1504
|
+
const runs = [...latest.values()].filter((e) => e.outcome !== "skip").sort((a, b) => b.run_at_ms - a.run_at_ms);
|
|
1505
|
+
const last = runs[0]?.run_at_ms ?? null;
|
|
1506
|
+
if (tool2.state === "planned" && runs.length === 0) return { state: "not_built", missing: [], last_run_at_ms: null, evidence: [] };
|
|
1507
|
+
if (runs.length === 0) return { state: "untested", missing: REQUIRED[level].map((r) => r.label), last_run_at_ms: null, evidence: [...latest.values()] };
|
|
1508
|
+
if (runs.some((e) => e.outcome === "fail")) return { state: "fail", missing: [], last_run_at_ms: last, evidence: runs };
|
|
1509
|
+
const missing = REQUIRED[level].filter((r) => !runs.some((e) => e.outcome === "pass" && r.ok(e))).map((r) => r.label);
|
|
1510
|
+
return { state: missing.length === 0 ? "pass" : "partial", missing, last_run_at_ms: last, evidence: runs };
|
|
1511
|
+
}
|
|
1512
|
+
function buildToolStatus(files, opts) {
|
|
1513
|
+
const parsed = files.map((f, i) => {
|
|
1514
|
+
const r = ToolResultsFile.safeParse(f);
|
|
1515
|
+
if (!r.success) throw new Error(`tool results file #${i} is off-contract: ${r.error.issues[0]?.path.join(".")} ${r.error.issues[0]?.message}`);
|
|
1516
|
+
return r.data;
|
|
1517
|
+
});
|
|
1518
|
+
const known = new Set(TOOL_CATALOG.map((t) => t.name));
|
|
1519
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
1520
|
+
for (const file of parsed) {
|
|
1521
|
+
for (const r of file.results) {
|
|
1522
|
+
if (!known.has(r.tool)) throw new Error(`a result names ${r.tool}, which is not in the tool catalog`);
|
|
1523
|
+
const key = `${r.tool}|${r.platform}|${r.level}`;
|
|
1524
|
+
const list = byKey.get(key) ?? [];
|
|
1525
|
+
list.push({ suite: r.suite, test: r.test, transport: r.transport, outcome: r.outcome, remote_network: r.remote_network, commit: file.commit, run_at_ms: r.run_at_ms, detail: r.detail });
|
|
1526
|
+
byKey.set(key, list);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
const groupOrder = new Map(TOOL_GROUPS.map((g) => [g.id, g.order]));
|
|
1530
|
+
const tools = [...TOOL_CATALOG].sort((a, b) => (groupOrder.get(a.group) ?? 99) - (groupOrder.get(b.group) ?? 99));
|
|
1531
|
+
const rows2 = tools.map((tool2) => {
|
|
1532
|
+
const cells = {};
|
|
1533
|
+
const working = {};
|
|
1534
|
+
for (const platform of TOOL_PLATFORMS) {
|
|
1535
|
+
const perLevel = {};
|
|
1536
|
+
for (const level of TOOL_LEVELS) perLevel[level] = cellFor(tool2, platform, level, byKey.get(`${tool2.name}|${platform}|${level}`) ?? []);
|
|
1537
|
+
cells[platform] = perLevel;
|
|
1538
|
+
working[platform] = TOOL_LEVELS.every((l) => perLevel[l].state === "pass");
|
|
1539
|
+
}
|
|
1540
|
+
return { tool: tool2.name, group: tool2.group, tool_state: tool2.state, summary: tool2.summary, note: tool2.note ?? null, cells, working };
|
|
1541
|
+
});
|
|
1542
|
+
const totals = {};
|
|
1543
|
+
for (const platform of TOOL_PLATFORMS) {
|
|
1544
|
+
const onPlatform = TOOL_CATALOG.filter((t) => t.platforms.includes(platform));
|
|
1545
|
+
totals[platform] = {
|
|
1546
|
+
working: rows2.filter((r) => r.working[platform]).length,
|
|
1547
|
+
built: onPlatform.filter((t) => t.state !== "planned").length,
|
|
1548
|
+
tools: onPlatform.length
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
const commits = [...new Set(parsed.map((f) => f.commit))].sort();
|
|
1552
|
+
return { schema: "matrx.tool-status.v1", generated_at_ms: opts.generatedAtMs, commits, rows: rows2, totals };
|
|
1553
|
+
}
|
|
1554
|
+
var MARK = { pass: "\u2713", partial: "\u25D0", fail: "\u2717", untested: "\xB7", not_built: "\u2014", unsupported: " " };
|
|
1555
|
+
function renderToolStatusMarkdown(status) {
|
|
1556
|
+
const lines = [
|
|
1557
|
+
"<!-- GENERATED by `pnpm tools:status` from test results. Never edit by hand. -->",
|
|
1558
|
+
"# Local tools: status",
|
|
1559
|
+
"",
|
|
1560
|
+
`Generated ${new Date(status.generated_at_ms).toISOString()} from commits ${status.commits.join(", ") || "none"}.`,
|
|
1561
|
+
"",
|
|
1562
|
+
"\u2713 pass \xB7 \u25D0 passing so far, a required proof missing \xB7 \u2717 fail \xB7 `\xB7` untested \xB7 \u2014 not built. Levels: P programmatic, R protocol, C chat.",
|
|
1563
|
+
"",
|
|
1564
|
+
"| Platform | Working | Built | Tools |",
|
|
1565
|
+
"|---|---|---|---|",
|
|
1566
|
+
...TOOL_PLATFORMS.map((p) => `| ${p} | ${status.totals[p].working} | ${status.totals[p].built} | ${status.totals[p].tools} |`),
|
|
1567
|
+
""
|
|
1568
|
+
];
|
|
1569
|
+
for (const group of TOOL_GROUPS) {
|
|
1570
|
+
const rows2 = status.rows.filter((r) => r.group === group.id);
|
|
1571
|
+
if (rows2.length === 0) continue;
|
|
1572
|
+
lines.push(`## ${group.order}. ${group.title}`, "", "| Tool | darwin P R C | win32 P R C | linux P R C | Missing |", "|---|---|---|---|---|");
|
|
1573
|
+
for (const r of rows2) {
|
|
1574
|
+
const cols2 = TOOL_PLATFORMS.map((p) => TOOL_LEVELS.map((l) => MARK[r.cells[p][l].state]).join(" "));
|
|
1575
|
+
const missing = /* @__PURE__ */ new Set();
|
|
1576
|
+
for (const p of TOOL_PLATFORMS) for (const l of TOOL_LEVELS) for (const m of r.cells[p][l].missing) if (r.cells[p][l].state !== "untested") missing.add(`${p} ${l}: ${m}`);
|
|
1577
|
+
const name = r.tool_state === "broken" ? `${r.tool} (broken: ${r.note ?? ""})` : r.tool;
|
|
1578
|
+
lines.push(`| ${name} | ${cols2.join(" | ")} | ${[...missing].join("; ")} |`);
|
|
1579
|
+
}
|
|
1580
|
+
lines.push("");
|
|
1581
|
+
}
|
|
1582
|
+
return lines.join("\n");
|
|
1583
|
+
}
|
|
887
1584
|
export {
|
|
888
1585
|
AbsPath,
|
|
1586
|
+
AppFeatureStatus,
|
|
1587
|
+
AppInfo,
|
|
1588
|
+
AppKey,
|
|
1589
|
+
AppProfile,
|
|
1590
|
+
AppProfileId,
|
|
1591
|
+
AppProfileLocator,
|
|
1592
|
+
AppSupport,
|
|
1593
|
+
AppUsageReading,
|
|
1594
|
+
AppsListParams,
|
|
1595
|
+
AppsListResult,
|
|
1596
|
+
AppsOpenParams,
|
|
1597
|
+
AppsOpenResult,
|
|
1598
|
+
AppsProfilesListParams,
|
|
1599
|
+
AppsProfilesListResult,
|
|
1600
|
+
AppsProfilesRemoveParams,
|
|
1601
|
+
AppsProfilesRemoveResult,
|
|
1602
|
+
AppsProfilesSaveParams,
|
|
1603
|
+
AppsProfilesSaveResult,
|
|
889
1604
|
BEARER_PREFIX,
|
|
890
1605
|
BROADCAST_CID,
|
|
1606
|
+
CLOSE_RULES,
|
|
1607
|
+
CONTRACT_SHA256,
|
|
891
1608
|
CancelMsg,
|
|
892
1609
|
ClientToCoreMsg,
|
|
893
1610
|
ClientType,
|
|
894
1611
|
CloseCode,
|
|
895
1612
|
CloseCodeValue,
|
|
1613
|
+
ContractHash,
|
|
896
1614
|
CoreToClientMsg,
|
|
1615
|
+
CoreToServiceMsg,
|
|
897
1616
|
CreditMsg,
|
|
898
1617
|
DEFAULT_MAX_FRAME_PAYLOAD_BYTES,
|
|
899
1618
|
DEFAULT_MAX_MESSAGE_BYTES,
|
|
@@ -963,7 +1682,24 @@ export {
|
|
|
963
1682
|
FsWriteParams,
|
|
964
1683
|
FsWriteResult,
|
|
965
1684
|
HelloMsg,
|
|
1685
|
+
LEGACY_ACTIONS,
|
|
1686
|
+
LEGACY_DISPATCHERS,
|
|
966
1687
|
Limits,
|
|
1688
|
+
MlInstallPhase,
|
|
1689
|
+
MlInstallProgress,
|
|
1690
|
+
MlProgress,
|
|
1691
|
+
MlRuntimeState,
|
|
1692
|
+
MlServiceState,
|
|
1693
|
+
MlServiceStatus,
|
|
1694
|
+
MlStatusParams,
|
|
1695
|
+
MlStatusResult,
|
|
1696
|
+
ModelsInstallParams,
|
|
1697
|
+
ModelsInstallResult,
|
|
1698
|
+
ModelsProgressEvent,
|
|
1699
|
+
ModelsStatusParams,
|
|
1700
|
+
ModelsStatusResult,
|
|
1701
|
+
ModelsTranscribeParams,
|
|
1702
|
+
ModelsTranscribeResult,
|
|
967
1703
|
NAMED_SCHEMAS,
|
|
968
1704
|
NULL_SINCE,
|
|
969
1705
|
OPS,
|
|
@@ -977,6 +1713,7 @@ export {
|
|
|
977
1713
|
ProtocolErrorBody,
|
|
978
1714
|
ProtocolVersion,
|
|
979
1715
|
PtyInfo,
|
|
1716
|
+
REASONS_SINCE,
|
|
980
1717
|
RELAY_CALL_HELLO_ID,
|
|
981
1718
|
RELAY_CALL_REQUEST_ID,
|
|
982
1719
|
RELAY_CALL_VERSION_HEADER,
|
|
@@ -995,7 +1732,22 @@ export {
|
|
|
995
1732
|
ResourceId,
|
|
996
1733
|
ResourceInfo,
|
|
997
1734
|
ResponseMsg,
|
|
1735
|
+
SERVICES,
|
|
1736
|
+
SERVICE_MAX_FRAME_BYTES,
|
|
998
1737
|
SUBPROTOCOL,
|
|
1738
|
+
ServiceCancel,
|
|
1739
|
+
ServiceErrorMsg,
|
|
1740
|
+
ServiceHello,
|
|
1741
|
+
ServiceName,
|
|
1742
|
+
ServicePing,
|
|
1743
|
+
ServicePong,
|
|
1744
|
+
ServiceProgressMsg,
|
|
1745
|
+
ServiceRequest,
|
|
1746
|
+
ServiceResponse,
|
|
1747
|
+
ServiceShutdown,
|
|
1748
|
+
ServiceToCoreMsg,
|
|
1749
|
+
ServiceToken,
|
|
1750
|
+
ServiceWelcome,
|
|
999
1751
|
SessionAttachParams,
|
|
1000
1752
|
SessionAttachResult,
|
|
1001
1753
|
SessionControlChangedEvent,
|
|
@@ -1010,10 +1762,27 @@ export {
|
|
|
1010
1762
|
StreamMsg,
|
|
1011
1763
|
SysinfoGetParams,
|
|
1012
1764
|
SysinfoGetResult,
|
|
1765
|
+
TOOL_CATALOG,
|
|
1766
|
+
TOOL_GROUPS,
|
|
1767
|
+
TOOL_LEVELS,
|
|
1768
|
+
TOOL_PLATFORMS,
|
|
1769
|
+
ToolLevel,
|
|
1770
|
+
ToolLevelResult,
|
|
1771
|
+
ToolName,
|
|
1772
|
+
ToolOutcome,
|
|
1773
|
+
ToolPlatform,
|
|
1774
|
+
ToolResultsFile,
|
|
1775
|
+
ToolTransport,
|
|
1776
|
+
TranscriptSegment,
|
|
1777
|
+
TranscriptionModelId,
|
|
1778
|
+
TranscriptionModelInfo,
|
|
1013
1779
|
VERSIONED_RESULT_OPS,
|
|
1014
1780
|
Welcome,
|
|
1015
1781
|
announcedVersion,
|
|
1016
1782
|
assertFrameHeader,
|
|
1783
|
+
buildToolStatus,
|
|
1784
|
+
builtOps,
|
|
1785
|
+
closeRule,
|
|
1017
1786
|
compareVersions,
|
|
1018
1787
|
connectionEndFrame,
|
|
1019
1788
|
decodeFrame,
|
|
@@ -1023,10 +1792,12 @@ export {
|
|
|
1023
1792
|
hasFlag,
|
|
1024
1793
|
isConnectionEnd,
|
|
1025
1794
|
isDesktopProtocolError,
|
|
1795
|
+
isTerminalClose,
|
|
1026
1796
|
knows,
|
|
1027
1797
|
negotiate,
|
|
1028
1798
|
nonNegInt,
|
|
1029
1799
|
readCid,
|
|
1800
|
+
renderToolStatusMarkdown,
|
|
1030
1801
|
stampCid,
|
|
1031
1802
|
statusForPeer,
|
|
1032
1803
|
u32,
|