@dinoxx/dinox-cli 2.3.0 → 2.5.2

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.
Files changed (53) hide show
  1. package/README.md +17 -3
  2. package/dist/cli.js +2 -0
  3. package/dist/commands/gateway/index.d.ts +4 -0
  4. package/dist/commands/gateway/index.js +300 -0
  5. package/dist/commands/schema/renderSkills.js +4 -0
  6. package/dist/commands/schema/spec.js +2 -0
  7. package/dist/config/paths.d.ts +1 -0
  8. package/dist/config/paths.js +1 -1
  9. package/dist/daemon/server.d.ts +1 -0
  10. package/dist/daemon/server.js +41 -0
  11. package/dist/gateway/adapters/acp.d.ts +47 -0
  12. package/dist/gateway/adapters/acp.js +302 -0
  13. package/dist/gateway/adapters/echo.d.ts +12 -0
  14. package/dist/gateway/adapters/echo.js +51 -0
  15. package/dist/gateway/adapters/index.d.ts +9 -0
  16. package/dist/gateway/adapters/index.js +31 -0
  17. package/dist/gateway/assistantProjection.d.ts +32 -0
  18. package/dist/gateway/assistantProjection.js +193 -0
  19. package/dist/gateway/config.d.ts +60 -0
  20. package/dist/gateway/config.js +291 -0
  21. package/dist/gateway/conversationContext.d.ts +44 -0
  22. package/dist/gateway/conversationContext.js +75 -0
  23. package/dist/gateway/detect.d.ts +40 -0
  24. package/dist/gateway/detect.js +145 -0
  25. package/dist/gateway/deviceHost.d.ts +91 -0
  26. package/dist/gateway/deviceHost.js +641 -0
  27. package/dist/gateway/keepAwake.d.ts +24 -0
  28. package/dist/gateway/keepAwake.js +64 -0
  29. package/dist/gateway/mcpServer.d.ts +4 -0
  30. package/dist/gateway/mcpServer.js +138 -0
  31. package/dist/gateway/protocol.d.ts +116 -0
  32. package/dist/gateway/protocol.js +182 -0
  33. package/dist/gateway/runExecutor.d.ts +91 -0
  34. package/dist/gateway/runExecutor.js +422 -0
  35. package/dist/gateway/service.d.ts +30 -0
  36. package/dist/gateway/service.js +112 -0
  37. package/dist/gateway/streamPublisher.d.ts +33 -0
  38. package/dist/gateway/streamPublisher.js +93 -0
  39. package/dist/gateway/threadStore.d.ts +222 -0
  40. package/dist/gateway/threadStore.js +597 -0
  41. package/dist/gateway/types.d.ts +136 -0
  42. package/dist/gateway/types.js +10 -0
  43. package/dist/gateway/workspaceFolders.d.ts +33 -0
  44. package/dist/gateway/workspaceFolders.js +129 -0
  45. package/dist/vendor/electron/domain/properties.js +12 -1
  46. package/dist/vendor/electron/domain/saved-views.js +4 -1
  47. package/dist/vendor/electron/shared/external-types.d.ts +18 -0
  48. package/dist/vendor/electron/shared/note-properties.d.ts +16 -0
  49. package/dist/vendor/electron/shared/note-properties.js +45 -0
  50. package/dist/vendor/electron/shared/powersync-read-models.d.ts +7 -1
  51. package/dist/vendor/electron/shared/remote-device-agent.d.ts +373 -0
  52. package/dist/vendor/electron/shared/remote-device-agent.js +191 -0
  53. package/package.json +5 -2
@@ -0,0 +1,91 @@
1
+ import { wsconnect } from '@nats-io/nats-core';
2
+ import type { AbstractPowerSyncDatabase } from '@powersync/common';
3
+ import type { GatewaySettingsPatch } from './config.js';
4
+ import type { GatewayAdapter, GatewayDefinition } from './types.js';
5
+ export declare const DEFAULT_NATS_CREDENTIALS_URL = "https://aisdk.chatgo.pro/api/nats/credentials";
6
+ type Logger = (message: string, details?: Record<string, unknown>) => void;
7
+ export type DeviceHostState = 'idle' | 'connecting' | 'connected' | 'reconnecting' | 'error';
8
+ export type DeviceHostStatus = {
9
+ gatewayId: string;
10
+ name: string;
11
+ deviceId: string;
12
+ kind: string;
13
+ state: DeviceHostState;
14
+ connectedAt: string | null;
15
+ lastError: string | null;
16
+ busyThreadIds: string[];
17
+ agentName: string | null;
18
+ };
19
+ export type DeviceHostDeps = {
20
+ gateway: GatewayDefinition;
21
+ db: AbstractPowerSyncDatabase;
22
+ userId: string;
23
+ authorization: string;
24
+ adapter: GatewayAdapter;
25
+ appVersion: string;
26
+ log: Logger;
27
+ credentialsUrl?: string;
28
+ connect?: typeof wsconnect;
29
+ fetchImpl?: typeof fetch;
30
+ /** Saves a settings change from the app and applies it to `gateway`; absent, settings are read-only. */
31
+ updateSettings?: (change: GatewaySettingsPatch) => Promise<void>;
32
+ /** Keeps the computer awake while a turn runs; returns the release. */
33
+ keepAwake?: () => () => void;
34
+ };
35
+ /**
36
+ * Hosts one gateway as a `dinox.remote-device.v2` device over NATS, the same
37
+ * contract Dinox desktop serves, so the app drives it with no client changes.
38
+ * Each gateway is its own device id (the credential service scopes a desktop
39
+ * credential to a single device subtree).
40
+ */
41
+ export declare class GatewayDeviceHost {
42
+ private readonly deps;
43
+ private readonly executor;
44
+ private connection;
45
+ private subscriptions;
46
+ private userNo;
47
+ private state;
48
+ private connectedAt;
49
+ private lastError;
50
+ private generation;
51
+ private attempt;
52
+ private presenceSequence;
53
+ private presenceTimer;
54
+ private refreshTimer;
55
+ private reconnectTimer;
56
+ private stopped;
57
+ private retryBlocked;
58
+ private readonly ackCache;
59
+ /** Latest event per run while offline; the snapshot model makes older ones redundant. */
60
+ private readonly pendingEvents;
61
+ constructor(deps: DeviceHostDeps);
62
+ start(): void;
63
+ stop(): Promise<void>;
64
+ status(): DeviceHostStatus;
65
+ private connect;
66
+ private watchConnection;
67
+ private scheduleReconnect;
68
+ /** Short-lived credentials: reconnect with fresh ones before they expire (runs keep going). */
69
+ private scheduleCredentialRefresh;
70
+ private disconnect;
71
+ private fetchCredentials;
72
+ private deviceInfo;
73
+ private subscribe;
74
+ private publishPresence;
75
+ private publishRunEvent;
76
+ private flushPendingEvents;
77
+ private handleDiscover;
78
+ /** Only the gateway's own queries are served; desktop queries (skills, workspace) are not advertised. */
79
+ private handleQuery;
80
+ private settingsResult;
81
+ private changeSettings;
82
+ private listFolders;
83
+ private agentConfig;
84
+ private handleInfo;
85
+ private respondAck;
86
+ private cacheAck;
87
+ private handleRunRequest;
88
+ private handleCancel;
89
+ private handleApprove;
90
+ }
91
+ export {};