happy-coder 0.6.4 → 0.7.1-beta.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.
- package/dist/index.cjs +1354 -690
- package/dist/index.mjs +1360 -696
- package/dist/lib.cjs +3 -11
- package/dist/lib.d.cts +162 -14
- package/dist/lib.d.mts +162 -14
- package/dist/lib.mjs +1 -1
- package/dist/{types-Dz5kZrVh.mjs → types-BZC9-exR.mjs} +413 -43
- package/dist/{types-BDtHM1DY.cjs → types-CzvFvJwf.cjs} +458 -89
- package/package.json +16 -8
package/dist/lib.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var types = require('./types-
|
|
3
|
+
var types = require('./types-CzvFvJwf.cjs');
|
|
4
4
|
require('axios');
|
|
5
5
|
require('chalk');
|
|
6
6
|
require('fs');
|
|
@@ -20,13 +20,5 @@ require('expo-server-sdk');
|
|
|
20
20
|
exports.ApiClient = types.ApiClient;
|
|
21
21
|
exports.ApiSessionClient = types.ApiSessionClient;
|
|
22
22
|
exports.RawJSONLinesSchema = types.RawJSONLinesSchema;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
get: function () { return types.configuration; }
|
|
26
|
-
});
|
|
27
|
-
exports.initLoggerWithGlobalConfiguration = types.initLoggerWithGlobalConfiguration;
|
|
28
|
-
exports.initializeConfiguration = types.initializeConfiguration;
|
|
29
|
-
Object.defineProperty(exports, "logger", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () { return types.logger; }
|
|
32
|
-
});
|
|
23
|
+
exports.configuration = types.configuration;
|
|
24
|
+
exports.logger = types.logger;
|
package/dist/lib.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
|
+
import { ChildProcess } from 'child_process';
|
|
3
4
|
import { ExpoPushMessage } from 'expo-server-sdk';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -323,6 +324,90 @@ declare const SessionSchema: z.ZodObject<{
|
|
|
323
324
|
agentState?: any;
|
|
324
325
|
}>;
|
|
325
326
|
type Session = z.infer<typeof SessionSchema>;
|
|
327
|
+
/**
|
|
328
|
+
* Machine metadata - static information (rarely changes)
|
|
329
|
+
*/
|
|
330
|
+
declare const MachineMetadataSchema: z.ZodObject<{
|
|
331
|
+
host: z.ZodString;
|
|
332
|
+
platform: z.ZodString;
|
|
333
|
+
happyCliVersion: z.ZodString;
|
|
334
|
+
homeDir: z.ZodString;
|
|
335
|
+
happyHomeDir: z.ZodString;
|
|
336
|
+
}, "strip", z.ZodTypeAny, {
|
|
337
|
+
host: string;
|
|
338
|
+
platform: string;
|
|
339
|
+
happyCliVersion: string;
|
|
340
|
+
homeDir: string;
|
|
341
|
+
happyHomeDir: string;
|
|
342
|
+
}, {
|
|
343
|
+
host: string;
|
|
344
|
+
platform: string;
|
|
345
|
+
happyCliVersion: string;
|
|
346
|
+
homeDir: string;
|
|
347
|
+
happyHomeDir: string;
|
|
348
|
+
}>;
|
|
349
|
+
type MachineMetadata = z.infer<typeof MachineMetadataSchema>;
|
|
350
|
+
/**
|
|
351
|
+
* Daemon state - dynamic runtime information (frequently updated)
|
|
352
|
+
*/
|
|
353
|
+
declare const DaemonStateSchema: z.ZodObject<{
|
|
354
|
+
status: z.ZodUnion<[z.ZodEnum<["running", "shutting-down"]>, z.ZodString]>;
|
|
355
|
+
pid: z.ZodOptional<z.ZodNumber>;
|
|
356
|
+
httpPort: z.ZodOptional<z.ZodNumber>;
|
|
357
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
358
|
+
shutdownRequestedAt: z.ZodOptional<z.ZodNumber>;
|
|
359
|
+
shutdownSource: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["mobile-app", "cli", "os-signal", "unknown"]>, z.ZodString]>>;
|
|
360
|
+
}, "strip", z.ZodTypeAny, {
|
|
361
|
+
status: string;
|
|
362
|
+
pid?: number | undefined;
|
|
363
|
+
httpPort?: number | undefined;
|
|
364
|
+
startedAt?: number | undefined;
|
|
365
|
+
shutdownRequestedAt?: number | undefined;
|
|
366
|
+
shutdownSource?: string | undefined;
|
|
367
|
+
}, {
|
|
368
|
+
status: string;
|
|
369
|
+
pid?: number | undefined;
|
|
370
|
+
httpPort?: number | undefined;
|
|
371
|
+
startedAt?: number | undefined;
|
|
372
|
+
shutdownRequestedAt?: number | undefined;
|
|
373
|
+
shutdownSource?: string | undefined;
|
|
374
|
+
}>;
|
|
375
|
+
type DaemonState = z.infer<typeof DaemonStateSchema>;
|
|
376
|
+
/**
|
|
377
|
+
* Machine information - similar to Session
|
|
378
|
+
*/
|
|
379
|
+
declare const MachineSchema: z.ZodObject<{
|
|
380
|
+
id: z.ZodString;
|
|
381
|
+
metadata: z.ZodAny;
|
|
382
|
+
metadataVersion: z.ZodNumber;
|
|
383
|
+
daemonState: z.ZodNullable<z.ZodAny>;
|
|
384
|
+
daemonStateVersion: z.ZodNumber;
|
|
385
|
+
active: z.ZodBoolean;
|
|
386
|
+
activeAt: z.ZodNumber;
|
|
387
|
+
createdAt: z.ZodNumber;
|
|
388
|
+
updatedAt: z.ZodNumber;
|
|
389
|
+
}, "strip", z.ZodTypeAny, {
|
|
390
|
+
id: string;
|
|
391
|
+
createdAt: number;
|
|
392
|
+
updatedAt: number;
|
|
393
|
+
metadataVersion: number;
|
|
394
|
+
daemonStateVersion: number;
|
|
395
|
+
active: boolean;
|
|
396
|
+
activeAt: number;
|
|
397
|
+
metadata?: any;
|
|
398
|
+
daemonState?: any;
|
|
399
|
+
}, {
|
|
400
|
+
id: string;
|
|
401
|
+
createdAt: number;
|
|
402
|
+
updatedAt: number;
|
|
403
|
+
metadataVersion: number;
|
|
404
|
+
daemonStateVersion: number;
|
|
405
|
+
active: boolean;
|
|
406
|
+
activeAt: number;
|
|
407
|
+
metadata?: any;
|
|
408
|
+
daemonState?: any;
|
|
409
|
+
}>;
|
|
410
|
+
type Machine = z.infer<typeof MachineSchema>;
|
|
326
411
|
declare const UserMessageSchema: z.ZodObject<{
|
|
327
412
|
role: z.ZodLiteral<"user">;
|
|
328
413
|
content: z.ZodObject<{
|
|
@@ -414,6 +499,10 @@ type Metadata = {
|
|
|
414
499
|
tools?: string[];
|
|
415
500
|
slashCommands?: string[];
|
|
416
501
|
homeDir?: string;
|
|
502
|
+
happyHomeDir?: string;
|
|
503
|
+
startedFromDaemon?: boolean;
|
|
504
|
+
hostPid?: number;
|
|
505
|
+
startedBy?: 'daemon' | 'terminal';
|
|
417
506
|
};
|
|
418
507
|
type AgentState = {
|
|
419
508
|
controlledByUser?: boolean | null | undefined;
|
|
@@ -507,6 +596,59 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
507
596
|
close(): Promise<void>;
|
|
508
597
|
}
|
|
509
598
|
|
|
599
|
+
/**
|
|
600
|
+
* Daemon-specific types (not related to API/server communication)
|
|
601
|
+
*/
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Session tracking for daemon
|
|
605
|
+
*/
|
|
606
|
+
interface TrackedSession {
|
|
607
|
+
startedBy: 'daemon' | string;
|
|
608
|
+
happySessionId?: string;
|
|
609
|
+
happySessionMetadataFromLocalWebhook?: Metadata;
|
|
610
|
+
pid: number;
|
|
611
|
+
childProcess?: ChildProcess;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* WebSocket client for machine/daemon communication with Happy server
|
|
616
|
+
* Similar to ApiSessionClient but for machine-scoped connections
|
|
617
|
+
*/
|
|
618
|
+
|
|
619
|
+
type MachineRpcHandlers = {
|
|
620
|
+
spawnSession: (directory: string, sessionId?: string) => Promise<TrackedSession | null>;
|
|
621
|
+
stopSession: (sessionId: string) => boolean;
|
|
622
|
+
requestShutdown: () => void;
|
|
623
|
+
};
|
|
624
|
+
declare class ApiMachineClient {
|
|
625
|
+
private token;
|
|
626
|
+
private secret;
|
|
627
|
+
private machine;
|
|
628
|
+
private socket;
|
|
629
|
+
private keepAliveInterval;
|
|
630
|
+
private spawnSession?;
|
|
631
|
+
private stopSession?;
|
|
632
|
+
private requestShutdown?;
|
|
633
|
+
constructor(token: string, secret: Uint8Array, machine: Machine);
|
|
634
|
+
setRPCHandlers({ spawnSession, stopSession, requestShutdown }: MachineRpcHandlers): void;
|
|
635
|
+
/**
|
|
636
|
+
* Update machine metadata
|
|
637
|
+
* Currently unused, changes from the mobile client are more likely
|
|
638
|
+
* for example to set a custom name.
|
|
639
|
+
*/
|
|
640
|
+
updateMachineMetadata(handler: (metadata: MachineMetadata | null) => MachineMetadata): Promise<void>;
|
|
641
|
+
/**
|
|
642
|
+
* Update daemon state (runtime info) - similar to session updateAgentState
|
|
643
|
+
* Simplified without lock - relies on backoff for retry
|
|
644
|
+
*/
|
|
645
|
+
updateDaemonState(handler: (state: DaemonState | null) => DaemonState): Promise<void>;
|
|
646
|
+
connect(): void;
|
|
647
|
+
private startKeepAlive;
|
|
648
|
+
private stopKeepAlive;
|
|
649
|
+
shutdown(): void;
|
|
650
|
+
}
|
|
651
|
+
|
|
510
652
|
interface PushToken {
|
|
511
653
|
id: string;
|
|
512
654
|
token: string;
|
|
@@ -550,15 +692,21 @@ declare class ApiClient {
|
|
|
550
692
|
state: AgentState | null;
|
|
551
693
|
}): Promise<Session>;
|
|
552
694
|
/**
|
|
553
|
-
*
|
|
554
|
-
*
|
|
555
|
-
* @returns Session client
|
|
695
|
+
* Get machine by ID from the server
|
|
696
|
+
* Returns the current machine state from the server with decrypted metadata and daemonState
|
|
556
697
|
*/
|
|
557
|
-
|
|
698
|
+
getMachine(machineId: string): Promise<Machine | null>;
|
|
558
699
|
/**
|
|
559
|
-
*
|
|
560
|
-
*
|
|
700
|
+
* Register or update machine with the server
|
|
701
|
+
* Returns the current machine state from the server with decrypted metadata and daemonState
|
|
561
702
|
*/
|
|
703
|
+
createOrReturnExistingAsIs(opts: {
|
|
704
|
+
machineId: string;
|
|
705
|
+
metadata: MachineMetadata;
|
|
706
|
+
daemonState: DaemonState;
|
|
707
|
+
}): Promise<Machine>;
|
|
708
|
+
sessionSyncClient(session: Session): ApiSessionClient;
|
|
709
|
+
machineSyncClient(machine: Machine): ApiMachineClient;
|
|
562
710
|
push(): PushNotificationClient;
|
|
563
711
|
}
|
|
564
712
|
|
|
@@ -570,6 +718,7 @@ declare class ApiClient {
|
|
|
570
718
|
*/
|
|
571
719
|
declare class Logger {
|
|
572
720
|
readonly logFilePathPromise: Promise<string>;
|
|
721
|
+
private dangerouslyUnencryptedServerLoggingUrl;
|
|
573
722
|
constructor(logFilePathPromise?: Promise<string>);
|
|
574
723
|
localTimezoneTimestamp(): string;
|
|
575
724
|
debug(message: string, ...args: unknown[]): void;
|
|
@@ -577,10 +726,10 @@ declare class Logger {
|
|
|
577
726
|
info(message: string, ...args: unknown[]): void;
|
|
578
727
|
infoDeveloper(message: string, ...args: unknown[]): void;
|
|
579
728
|
private logToConsole;
|
|
729
|
+
private sendToRemoteServer;
|
|
580
730
|
private logToFile;
|
|
581
731
|
}
|
|
582
732
|
declare let logger: Logger;
|
|
583
|
-
declare function initLoggerWithGlobalConfiguration(): void;
|
|
584
733
|
|
|
585
734
|
/**
|
|
586
735
|
* Global configuration for happy CLI
|
|
@@ -590,17 +739,16 @@ declare function initLoggerWithGlobalConfiguration(): void;
|
|
|
590
739
|
*/
|
|
591
740
|
declare class Configuration {
|
|
592
741
|
readonly serverUrl: string;
|
|
593
|
-
readonly installationLocation: 'global' | 'local';
|
|
594
742
|
readonly isDaemonProcess: boolean;
|
|
595
|
-
readonly
|
|
743
|
+
readonly happyHomeDir: string;
|
|
596
744
|
readonly logsDir: string;
|
|
597
745
|
readonly daemonLogsDir: string;
|
|
598
746
|
readonly settingsFile: string;
|
|
599
747
|
readonly privateKeyFile: string;
|
|
600
|
-
readonly
|
|
601
|
-
constructor(
|
|
748
|
+
readonly daemonStateFile: string;
|
|
749
|
+
constructor();
|
|
602
750
|
}
|
|
603
|
-
declare
|
|
604
|
-
declare function initializeConfiguration(location: 'global' | 'local' | string): void;
|
|
751
|
+
declare const configuration: Configuration;
|
|
605
752
|
|
|
606
|
-
export { ApiClient, ApiSessionClient,
|
|
753
|
+
export { ApiClient, ApiSessionClient, RawJSONLinesSchema, configuration, logger };
|
|
754
|
+
export type { RawJSONLines };
|
package/dist/lib.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
|
+
import { ChildProcess } from 'child_process';
|
|
3
4
|
import { ExpoPushMessage } from 'expo-server-sdk';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -323,6 +324,90 @@ declare const SessionSchema: z.ZodObject<{
|
|
|
323
324
|
agentState?: any;
|
|
324
325
|
}>;
|
|
325
326
|
type Session = z.infer<typeof SessionSchema>;
|
|
327
|
+
/**
|
|
328
|
+
* Machine metadata - static information (rarely changes)
|
|
329
|
+
*/
|
|
330
|
+
declare const MachineMetadataSchema: z.ZodObject<{
|
|
331
|
+
host: z.ZodString;
|
|
332
|
+
platform: z.ZodString;
|
|
333
|
+
happyCliVersion: z.ZodString;
|
|
334
|
+
homeDir: z.ZodString;
|
|
335
|
+
happyHomeDir: z.ZodString;
|
|
336
|
+
}, "strip", z.ZodTypeAny, {
|
|
337
|
+
host: string;
|
|
338
|
+
platform: string;
|
|
339
|
+
happyCliVersion: string;
|
|
340
|
+
homeDir: string;
|
|
341
|
+
happyHomeDir: string;
|
|
342
|
+
}, {
|
|
343
|
+
host: string;
|
|
344
|
+
platform: string;
|
|
345
|
+
happyCliVersion: string;
|
|
346
|
+
homeDir: string;
|
|
347
|
+
happyHomeDir: string;
|
|
348
|
+
}>;
|
|
349
|
+
type MachineMetadata = z.infer<typeof MachineMetadataSchema>;
|
|
350
|
+
/**
|
|
351
|
+
* Daemon state - dynamic runtime information (frequently updated)
|
|
352
|
+
*/
|
|
353
|
+
declare const DaemonStateSchema: z.ZodObject<{
|
|
354
|
+
status: z.ZodUnion<[z.ZodEnum<["running", "shutting-down"]>, z.ZodString]>;
|
|
355
|
+
pid: z.ZodOptional<z.ZodNumber>;
|
|
356
|
+
httpPort: z.ZodOptional<z.ZodNumber>;
|
|
357
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
358
|
+
shutdownRequestedAt: z.ZodOptional<z.ZodNumber>;
|
|
359
|
+
shutdownSource: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["mobile-app", "cli", "os-signal", "unknown"]>, z.ZodString]>>;
|
|
360
|
+
}, "strip", z.ZodTypeAny, {
|
|
361
|
+
status: string;
|
|
362
|
+
pid?: number | undefined;
|
|
363
|
+
httpPort?: number | undefined;
|
|
364
|
+
startedAt?: number | undefined;
|
|
365
|
+
shutdownRequestedAt?: number | undefined;
|
|
366
|
+
shutdownSource?: string | undefined;
|
|
367
|
+
}, {
|
|
368
|
+
status: string;
|
|
369
|
+
pid?: number | undefined;
|
|
370
|
+
httpPort?: number | undefined;
|
|
371
|
+
startedAt?: number | undefined;
|
|
372
|
+
shutdownRequestedAt?: number | undefined;
|
|
373
|
+
shutdownSource?: string | undefined;
|
|
374
|
+
}>;
|
|
375
|
+
type DaemonState = z.infer<typeof DaemonStateSchema>;
|
|
376
|
+
/**
|
|
377
|
+
* Machine information - similar to Session
|
|
378
|
+
*/
|
|
379
|
+
declare const MachineSchema: z.ZodObject<{
|
|
380
|
+
id: z.ZodString;
|
|
381
|
+
metadata: z.ZodAny;
|
|
382
|
+
metadataVersion: z.ZodNumber;
|
|
383
|
+
daemonState: z.ZodNullable<z.ZodAny>;
|
|
384
|
+
daemonStateVersion: z.ZodNumber;
|
|
385
|
+
active: z.ZodBoolean;
|
|
386
|
+
activeAt: z.ZodNumber;
|
|
387
|
+
createdAt: z.ZodNumber;
|
|
388
|
+
updatedAt: z.ZodNumber;
|
|
389
|
+
}, "strip", z.ZodTypeAny, {
|
|
390
|
+
id: string;
|
|
391
|
+
createdAt: number;
|
|
392
|
+
updatedAt: number;
|
|
393
|
+
metadataVersion: number;
|
|
394
|
+
daemonStateVersion: number;
|
|
395
|
+
active: boolean;
|
|
396
|
+
activeAt: number;
|
|
397
|
+
metadata?: any;
|
|
398
|
+
daemonState?: any;
|
|
399
|
+
}, {
|
|
400
|
+
id: string;
|
|
401
|
+
createdAt: number;
|
|
402
|
+
updatedAt: number;
|
|
403
|
+
metadataVersion: number;
|
|
404
|
+
daemonStateVersion: number;
|
|
405
|
+
active: boolean;
|
|
406
|
+
activeAt: number;
|
|
407
|
+
metadata?: any;
|
|
408
|
+
daemonState?: any;
|
|
409
|
+
}>;
|
|
410
|
+
type Machine = z.infer<typeof MachineSchema>;
|
|
326
411
|
declare const UserMessageSchema: z.ZodObject<{
|
|
327
412
|
role: z.ZodLiteral<"user">;
|
|
328
413
|
content: z.ZodObject<{
|
|
@@ -414,6 +499,10 @@ type Metadata = {
|
|
|
414
499
|
tools?: string[];
|
|
415
500
|
slashCommands?: string[];
|
|
416
501
|
homeDir?: string;
|
|
502
|
+
happyHomeDir?: string;
|
|
503
|
+
startedFromDaemon?: boolean;
|
|
504
|
+
hostPid?: number;
|
|
505
|
+
startedBy?: 'daemon' | 'terminal';
|
|
417
506
|
};
|
|
418
507
|
type AgentState = {
|
|
419
508
|
controlledByUser?: boolean | null | undefined;
|
|
@@ -507,6 +596,59 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
507
596
|
close(): Promise<void>;
|
|
508
597
|
}
|
|
509
598
|
|
|
599
|
+
/**
|
|
600
|
+
* Daemon-specific types (not related to API/server communication)
|
|
601
|
+
*/
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Session tracking for daemon
|
|
605
|
+
*/
|
|
606
|
+
interface TrackedSession {
|
|
607
|
+
startedBy: 'daemon' | string;
|
|
608
|
+
happySessionId?: string;
|
|
609
|
+
happySessionMetadataFromLocalWebhook?: Metadata;
|
|
610
|
+
pid: number;
|
|
611
|
+
childProcess?: ChildProcess;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* WebSocket client for machine/daemon communication with Happy server
|
|
616
|
+
* Similar to ApiSessionClient but for machine-scoped connections
|
|
617
|
+
*/
|
|
618
|
+
|
|
619
|
+
type MachineRpcHandlers = {
|
|
620
|
+
spawnSession: (directory: string, sessionId?: string) => Promise<TrackedSession | null>;
|
|
621
|
+
stopSession: (sessionId: string) => boolean;
|
|
622
|
+
requestShutdown: () => void;
|
|
623
|
+
};
|
|
624
|
+
declare class ApiMachineClient {
|
|
625
|
+
private token;
|
|
626
|
+
private secret;
|
|
627
|
+
private machine;
|
|
628
|
+
private socket;
|
|
629
|
+
private keepAliveInterval;
|
|
630
|
+
private spawnSession?;
|
|
631
|
+
private stopSession?;
|
|
632
|
+
private requestShutdown?;
|
|
633
|
+
constructor(token: string, secret: Uint8Array, machine: Machine);
|
|
634
|
+
setRPCHandlers({ spawnSession, stopSession, requestShutdown }: MachineRpcHandlers): void;
|
|
635
|
+
/**
|
|
636
|
+
* Update machine metadata
|
|
637
|
+
* Currently unused, changes from the mobile client are more likely
|
|
638
|
+
* for example to set a custom name.
|
|
639
|
+
*/
|
|
640
|
+
updateMachineMetadata(handler: (metadata: MachineMetadata | null) => MachineMetadata): Promise<void>;
|
|
641
|
+
/**
|
|
642
|
+
* Update daemon state (runtime info) - similar to session updateAgentState
|
|
643
|
+
* Simplified without lock - relies on backoff for retry
|
|
644
|
+
*/
|
|
645
|
+
updateDaemonState(handler: (state: DaemonState | null) => DaemonState): Promise<void>;
|
|
646
|
+
connect(): void;
|
|
647
|
+
private startKeepAlive;
|
|
648
|
+
private stopKeepAlive;
|
|
649
|
+
shutdown(): void;
|
|
650
|
+
}
|
|
651
|
+
|
|
510
652
|
interface PushToken {
|
|
511
653
|
id: string;
|
|
512
654
|
token: string;
|
|
@@ -550,15 +692,21 @@ declare class ApiClient {
|
|
|
550
692
|
state: AgentState | null;
|
|
551
693
|
}): Promise<Session>;
|
|
552
694
|
/**
|
|
553
|
-
*
|
|
554
|
-
*
|
|
555
|
-
* @returns Session client
|
|
695
|
+
* Get machine by ID from the server
|
|
696
|
+
* Returns the current machine state from the server with decrypted metadata and daemonState
|
|
556
697
|
*/
|
|
557
|
-
|
|
698
|
+
getMachine(machineId: string): Promise<Machine | null>;
|
|
558
699
|
/**
|
|
559
|
-
*
|
|
560
|
-
*
|
|
700
|
+
* Register or update machine with the server
|
|
701
|
+
* Returns the current machine state from the server with decrypted metadata and daemonState
|
|
561
702
|
*/
|
|
703
|
+
createOrReturnExistingAsIs(opts: {
|
|
704
|
+
machineId: string;
|
|
705
|
+
metadata: MachineMetadata;
|
|
706
|
+
daemonState: DaemonState;
|
|
707
|
+
}): Promise<Machine>;
|
|
708
|
+
sessionSyncClient(session: Session): ApiSessionClient;
|
|
709
|
+
machineSyncClient(machine: Machine): ApiMachineClient;
|
|
562
710
|
push(): PushNotificationClient;
|
|
563
711
|
}
|
|
564
712
|
|
|
@@ -570,6 +718,7 @@ declare class ApiClient {
|
|
|
570
718
|
*/
|
|
571
719
|
declare class Logger {
|
|
572
720
|
readonly logFilePathPromise: Promise<string>;
|
|
721
|
+
private dangerouslyUnencryptedServerLoggingUrl;
|
|
573
722
|
constructor(logFilePathPromise?: Promise<string>);
|
|
574
723
|
localTimezoneTimestamp(): string;
|
|
575
724
|
debug(message: string, ...args: unknown[]): void;
|
|
@@ -577,10 +726,10 @@ declare class Logger {
|
|
|
577
726
|
info(message: string, ...args: unknown[]): void;
|
|
578
727
|
infoDeveloper(message: string, ...args: unknown[]): void;
|
|
579
728
|
private logToConsole;
|
|
729
|
+
private sendToRemoteServer;
|
|
580
730
|
private logToFile;
|
|
581
731
|
}
|
|
582
732
|
declare let logger: Logger;
|
|
583
|
-
declare function initLoggerWithGlobalConfiguration(): void;
|
|
584
733
|
|
|
585
734
|
/**
|
|
586
735
|
* Global configuration for happy CLI
|
|
@@ -590,17 +739,16 @@ declare function initLoggerWithGlobalConfiguration(): void;
|
|
|
590
739
|
*/
|
|
591
740
|
declare class Configuration {
|
|
592
741
|
readonly serverUrl: string;
|
|
593
|
-
readonly installationLocation: 'global' | 'local';
|
|
594
742
|
readonly isDaemonProcess: boolean;
|
|
595
|
-
readonly
|
|
743
|
+
readonly happyHomeDir: string;
|
|
596
744
|
readonly logsDir: string;
|
|
597
745
|
readonly daemonLogsDir: string;
|
|
598
746
|
readonly settingsFile: string;
|
|
599
747
|
readonly privateKeyFile: string;
|
|
600
|
-
readonly
|
|
601
|
-
constructor(
|
|
748
|
+
readonly daemonStateFile: string;
|
|
749
|
+
constructor();
|
|
602
750
|
}
|
|
603
|
-
declare
|
|
604
|
-
declare function initializeConfiguration(location: 'global' | 'local' | string): void;
|
|
751
|
+
declare const configuration: Configuration;
|
|
605
752
|
|
|
606
|
-
export { ApiClient, ApiSessionClient,
|
|
753
|
+
export { ApiClient, ApiSessionClient, RawJSONLinesSchema, configuration, logger };
|
|
754
|
+
export type { RawJSONLines };
|
package/dist/lib.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration,
|
|
1
|
+
export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-BZC9-exR.mjs';
|
|
2
2
|
import 'axios';
|
|
3
3
|
import 'chalk';
|
|
4
4
|
import 'fs';
|