happy-coder 0.7.2 → 0.9.0-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/dist/index.cjs +699 -439
- package/dist/index.mjs +700 -440
- package/dist/lib.d.cts +75 -71
- package/dist/lib.d.mts +75 -71
- package/package.json +11 -9
package/dist/lib.d.cts
CHANGED
|
@@ -288,6 +288,79 @@ declare const RawJSONLinesSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
288
288
|
}, z.ZodTypeAny, "passthrough">>]>;
|
|
289
289
|
type RawJSONLines = z.infer<typeof RawJSONLinesSchema>;
|
|
290
290
|
|
|
291
|
+
type RpcHandler<T = any, R = any> = (data: T) => R | Promise<R>;
|
|
292
|
+
declare class ApiSessionClient extends EventEmitter {
|
|
293
|
+
private readonly token;
|
|
294
|
+
private readonly secret;
|
|
295
|
+
readonly sessionId: string;
|
|
296
|
+
private metadata;
|
|
297
|
+
private metadataVersion;
|
|
298
|
+
private agentState;
|
|
299
|
+
private agentStateVersion;
|
|
300
|
+
private socket;
|
|
301
|
+
private pendingMessages;
|
|
302
|
+
private pendingMessageCallback;
|
|
303
|
+
private rpcHandlers;
|
|
304
|
+
private agentStateLock;
|
|
305
|
+
private metadataLock;
|
|
306
|
+
constructor(token: string, secret: Uint8Array, session: Session);
|
|
307
|
+
onUserMessage(callback: (data: UserMessage) => void): void;
|
|
308
|
+
/**
|
|
309
|
+
* Send message to session
|
|
310
|
+
* @param body - Message body (can be MessageContent or raw content for agent messages)
|
|
311
|
+
*/
|
|
312
|
+
sendClaudeSessionMessage(body: RawJSONLines): void;
|
|
313
|
+
sendSessionEvent(event: {
|
|
314
|
+
type: 'switch';
|
|
315
|
+
mode: 'local' | 'remote';
|
|
316
|
+
} | {
|
|
317
|
+
type: 'message';
|
|
318
|
+
message: string;
|
|
319
|
+
} | {
|
|
320
|
+
type: 'permission-mode-changed';
|
|
321
|
+
mode: 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';
|
|
322
|
+
}, id?: string): void;
|
|
323
|
+
/**
|
|
324
|
+
* Send a ping message to keep the connection alive
|
|
325
|
+
*/
|
|
326
|
+
keepAlive(thinking: boolean, mode: 'local' | 'remote'): void;
|
|
327
|
+
/**
|
|
328
|
+
* Send session death message
|
|
329
|
+
*/
|
|
330
|
+
sendSessionDeath(): void;
|
|
331
|
+
/**
|
|
332
|
+
* Send usage data to the server
|
|
333
|
+
*/
|
|
334
|
+
sendUsageData(usage: Usage): void;
|
|
335
|
+
/**
|
|
336
|
+
* Update session metadata
|
|
337
|
+
* @param handler - Handler function that returns the updated metadata
|
|
338
|
+
*/
|
|
339
|
+
updateMetadata(handler: (metadata: Metadata) => Metadata): void;
|
|
340
|
+
/**
|
|
341
|
+
* Update session agent state
|
|
342
|
+
* @param handler - Handler function that returns the updated agent state
|
|
343
|
+
*/
|
|
344
|
+
updateAgentState(handler: (metadata: AgentState) => AgentState): void;
|
|
345
|
+
/**
|
|
346
|
+
* Set a custom RPC handler for a specific method with encrypted arguments and responses
|
|
347
|
+
* @param method - The method name to handle
|
|
348
|
+
* @param handler - The handler function to call when the method is invoked
|
|
349
|
+
*/
|
|
350
|
+
setHandler<T = any, R = any>(method: string, handler: RpcHandler<T, R>): void;
|
|
351
|
+
/**
|
|
352
|
+
* Re-register all RPC handlers after reconnection
|
|
353
|
+
*/
|
|
354
|
+
private reregisterHandlers;
|
|
355
|
+
/**
|
|
356
|
+
* Wait for socket buffer to flush
|
|
357
|
+
*/
|
|
358
|
+
flush(): Promise<void>;
|
|
359
|
+
close(): Promise<void>;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';
|
|
363
|
+
|
|
291
364
|
/**
|
|
292
365
|
* Usage data type from Claude
|
|
293
366
|
*/
|
|
@@ -521,81 +594,12 @@ type AgentState = {
|
|
|
521
594
|
completedAt: number;
|
|
522
595
|
status: 'canceled' | 'denied' | 'approved';
|
|
523
596
|
reason?: string;
|
|
597
|
+
mode?: PermissionMode;
|
|
598
|
+
allowTools?: string[];
|
|
524
599
|
};
|
|
525
600
|
};
|
|
526
601
|
};
|
|
527
602
|
|
|
528
|
-
type RpcHandler<T = any, R = any> = (data: T) => R | Promise<R>;
|
|
529
|
-
declare class ApiSessionClient extends EventEmitter {
|
|
530
|
-
private readonly token;
|
|
531
|
-
private readonly secret;
|
|
532
|
-
readonly sessionId: string;
|
|
533
|
-
private metadata;
|
|
534
|
-
private metadataVersion;
|
|
535
|
-
private agentState;
|
|
536
|
-
private agentStateVersion;
|
|
537
|
-
private socket;
|
|
538
|
-
private pendingMessages;
|
|
539
|
-
private pendingMessageCallback;
|
|
540
|
-
private rpcHandlers;
|
|
541
|
-
private agentStateLock;
|
|
542
|
-
private metadataLock;
|
|
543
|
-
constructor(token: string, secret: Uint8Array, session: Session);
|
|
544
|
-
onUserMessage(callback: (data: UserMessage) => void): void;
|
|
545
|
-
/**
|
|
546
|
-
* Send message to session
|
|
547
|
-
* @param body - Message body (can be MessageContent or raw content for agent messages)
|
|
548
|
-
*/
|
|
549
|
-
sendClaudeSessionMessage(body: RawJSONLines): void;
|
|
550
|
-
sendSessionEvent(event: {
|
|
551
|
-
type: 'switch';
|
|
552
|
-
mode: 'local' | 'remote';
|
|
553
|
-
} | {
|
|
554
|
-
type: 'message';
|
|
555
|
-
message: string;
|
|
556
|
-
} | {
|
|
557
|
-
type: 'permission-mode-changed';
|
|
558
|
-
mode: 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';
|
|
559
|
-
}, id?: string): void;
|
|
560
|
-
/**
|
|
561
|
-
* Send a ping message to keep the connection alive
|
|
562
|
-
*/
|
|
563
|
-
keepAlive(thinking: boolean, mode: 'local' | 'remote'): void;
|
|
564
|
-
/**
|
|
565
|
-
* Send session death message
|
|
566
|
-
*/
|
|
567
|
-
sendSessionDeath(): void;
|
|
568
|
-
/**
|
|
569
|
-
* Send usage data to the server
|
|
570
|
-
*/
|
|
571
|
-
sendUsageData(usage: Usage): void;
|
|
572
|
-
/**
|
|
573
|
-
* Update session metadata
|
|
574
|
-
* @param handler - Handler function that returns the updated metadata
|
|
575
|
-
*/
|
|
576
|
-
updateMetadata(handler: (metadata: Metadata) => Metadata): void;
|
|
577
|
-
/**
|
|
578
|
-
* Update session agent state
|
|
579
|
-
* @param handler - Handler function that returns the updated agent state
|
|
580
|
-
*/
|
|
581
|
-
updateAgentState(handler: (metadata: AgentState) => AgentState): void;
|
|
582
|
-
/**
|
|
583
|
-
* Set a custom RPC handler for a specific method with encrypted arguments and responses
|
|
584
|
-
* @param method - The method name to handle
|
|
585
|
-
* @param handler - The handler function to call when the method is invoked
|
|
586
|
-
*/
|
|
587
|
-
setHandler<T = any, R = any>(method: string, handler: RpcHandler<T, R>): void;
|
|
588
|
-
/**
|
|
589
|
-
* Re-register all RPC handlers after reconnection
|
|
590
|
-
*/
|
|
591
|
-
private reregisterHandlers;
|
|
592
|
-
/**
|
|
593
|
-
* Wait for socket buffer to flush
|
|
594
|
-
*/
|
|
595
|
-
flush(): Promise<void>;
|
|
596
|
-
close(): Promise<void>;
|
|
597
|
-
}
|
|
598
|
-
|
|
599
603
|
/**
|
|
600
604
|
* Daemon-specific types (not related to API/server communication)
|
|
601
605
|
*/
|
package/dist/lib.d.mts
CHANGED
|
@@ -288,6 +288,79 @@ declare const RawJSONLinesSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
288
288
|
}, z.ZodTypeAny, "passthrough">>]>;
|
|
289
289
|
type RawJSONLines = z.infer<typeof RawJSONLinesSchema>;
|
|
290
290
|
|
|
291
|
+
type RpcHandler<T = any, R = any> = (data: T) => R | Promise<R>;
|
|
292
|
+
declare class ApiSessionClient extends EventEmitter {
|
|
293
|
+
private readonly token;
|
|
294
|
+
private readonly secret;
|
|
295
|
+
readonly sessionId: string;
|
|
296
|
+
private metadata;
|
|
297
|
+
private metadataVersion;
|
|
298
|
+
private agentState;
|
|
299
|
+
private agentStateVersion;
|
|
300
|
+
private socket;
|
|
301
|
+
private pendingMessages;
|
|
302
|
+
private pendingMessageCallback;
|
|
303
|
+
private rpcHandlers;
|
|
304
|
+
private agentStateLock;
|
|
305
|
+
private metadataLock;
|
|
306
|
+
constructor(token: string, secret: Uint8Array, session: Session);
|
|
307
|
+
onUserMessage(callback: (data: UserMessage) => void): void;
|
|
308
|
+
/**
|
|
309
|
+
* Send message to session
|
|
310
|
+
* @param body - Message body (can be MessageContent or raw content for agent messages)
|
|
311
|
+
*/
|
|
312
|
+
sendClaudeSessionMessage(body: RawJSONLines): void;
|
|
313
|
+
sendSessionEvent(event: {
|
|
314
|
+
type: 'switch';
|
|
315
|
+
mode: 'local' | 'remote';
|
|
316
|
+
} | {
|
|
317
|
+
type: 'message';
|
|
318
|
+
message: string;
|
|
319
|
+
} | {
|
|
320
|
+
type: 'permission-mode-changed';
|
|
321
|
+
mode: 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';
|
|
322
|
+
}, id?: string): void;
|
|
323
|
+
/**
|
|
324
|
+
* Send a ping message to keep the connection alive
|
|
325
|
+
*/
|
|
326
|
+
keepAlive(thinking: boolean, mode: 'local' | 'remote'): void;
|
|
327
|
+
/**
|
|
328
|
+
* Send session death message
|
|
329
|
+
*/
|
|
330
|
+
sendSessionDeath(): void;
|
|
331
|
+
/**
|
|
332
|
+
* Send usage data to the server
|
|
333
|
+
*/
|
|
334
|
+
sendUsageData(usage: Usage): void;
|
|
335
|
+
/**
|
|
336
|
+
* Update session metadata
|
|
337
|
+
* @param handler - Handler function that returns the updated metadata
|
|
338
|
+
*/
|
|
339
|
+
updateMetadata(handler: (metadata: Metadata) => Metadata): void;
|
|
340
|
+
/**
|
|
341
|
+
* Update session agent state
|
|
342
|
+
* @param handler - Handler function that returns the updated agent state
|
|
343
|
+
*/
|
|
344
|
+
updateAgentState(handler: (metadata: AgentState) => AgentState): void;
|
|
345
|
+
/**
|
|
346
|
+
* Set a custom RPC handler for a specific method with encrypted arguments and responses
|
|
347
|
+
* @param method - The method name to handle
|
|
348
|
+
* @param handler - The handler function to call when the method is invoked
|
|
349
|
+
*/
|
|
350
|
+
setHandler<T = any, R = any>(method: string, handler: RpcHandler<T, R>): void;
|
|
351
|
+
/**
|
|
352
|
+
* Re-register all RPC handlers after reconnection
|
|
353
|
+
*/
|
|
354
|
+
private reregisterHandlers;
|
|
355
|
+
/**
|
|
356
|
+
* Wait for socket buffer to flush
|
|
357
|
+
*/
|
|
358
|
+
flush(): Promise<void>;
|
|
359
|
+
close(): Promise<void>;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';
|
|
363
|
+
|
|
291
364
|
/**
|
|
292
365
|
* Usage data type from Claude
|
|
293
366
|
*/
|
|
@@ -521,81 +594,12 @@ type AgentState = {
|
|
|
521
594
|
completedAt: number;
|
|
522
595
|
status: 'canceled' | 'denied' | 'approved';
|
|
523
596
|
reason?: string;
|
|
597
|
+
mode?: PermissionMode;
|
|
598
|
+
allowTools?: string[];
|
|
524
599
|
};
|
|
525
600
|
};
|
|
526
601
|
};
|
|
527
602
|
|
|
528
|
-
type RpcHandler<T = any, R = any> = (data: T) => R | Promise<R>;
|
|
529
|
-
declare class ApiSessionClient extends EventEmitter {
|
|
530
|
-
private readonly token;
|
|
531
|
-
private readonly secret;
|
|
532
|
-
readonly sessionId: string;
|
|
533
|
-
private metadata;
|
|
534
|
-
private metadataVersion;
|
|
535
|
-
private agentState;
|
|
536
|
-
private agentStateVersion;
|
|
537
|
-
private socket;
|
|
538
|
-
private pendingMessages;
|
|
539
|
-
private pendingMessageCallback;
|
|
540
|
-
private rpcHandlers;
|
|
541
|
-
private agentStateLock;
|
|
542
|
-
private metadataLock;
|
|
543
|
-
constructor(token: string, secret: Uint8Array, session: Session);
|
|
544
|
-
onUserMessage(callback: (data: UserMessage) => void): void;
|
|
545
|
-
/**
|
|
546
|
-
* Send message to session
|
|
547
|
-
* @param body - Message body (can be MessageContent or raw content for agent messages)
|
|
548
|
-
*/
|
|
549
|
-
sendClaudeSessionMessage(body: RawJSONLines): void;
|
|
550
|
-
sendSessionEvent(event: {
|
|
551
|
-
type: 'switch';
|
|
552
|
-
mode: 'local' | 'remote';
|
|
553
|
-
} | {
|
|
554
|
-
type: 'message';
|
|
555
|
-
message: string;
|
|
556
|
-
} | {
|
|
557
|
-
type: 'permission-mode-changed';
|
|
558
|
-
mode: 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';
|
|
559
|
-
}, id?: string): void;
|
|
560
|
-
/**
|
|
561
|
-
* Send a ping message to keep the connection alive
|
|
562
|
-
*/
|
|
563
|
-
keepAlive(thinking: boolean, mode: 'local' | 'remote'): void;
|
|
564
|
-
/**
|
|
565
|
-
* Send session death message
|
|
566
|
-
*/
|
|
567
|
-
sendSessionDeath(): void;
|
|
568
|
-
/**
|
|
569
|
-
* Send usage data to the server
|
|
570
|
-
*/
|
|
571
|
-
sendUsageData(usage: Usage): void;
|
|
572
|
-
/**
|
|
573
|
-
* Update session metadata
|
|
574
|
-
* @param handler - Handler function that returns the updated metadata
|
|
575
|
-
*/
|
|
576
|
-
updateMetadata(handler: (metadata: Metadata) => Metadata): void;
|
|
577
|
-
/**
|
|
578
|
-
* Update session agent state
|
|
579
|
-
* @param handler - Handler function that returns the updated agent state
|
|
580
|
-
*/
|
|
581
|
-
updateAgentState(handler: (metadata: AgentState) => AgentState): void;
|
|
582
|
-
/**
|
|
583
|
-
* Set a custom RPC handler for a specific method with encrypted arguments and responses
|
|
584
|
-
* @param method - The method name to handle
|
|
585
|
-
* @param handler - The handler function to call when the method is invoked
|
|
586
|
-
*/
|
|
587
|
-
setHandler<T = any, R = any>(method: string, handler: RpcHandler<T, R>): void;
|
|
588
|
-
/**
|
|
589
|
-
* Re-register all RPC handlers after reconnection
|
|
590
|
-
*/
|
|
591
|
-
private reregisterHandlers;
|
|
592
|
-
/**
|
|
593
|
-
* Wait for socket buffer to flush
|
|
594
|
-
*/
|
|
595
|
-
flush(): Promise<void>;
|
|
596
|
-
close(): Promise<void>;
|
|
597
|
-
}
|
|
598
|
-
|
|
599
603
|
/**
|
|
600
604
|
* Daemon-specific types (not related to API/server communication)
|
|
601
605
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "happy-coder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0-0",
|
|
4
4
|
"description": "Claude Code session sharing CLI",
|
|
5
5
|
"author": "Kirill Dubovitskiy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,18 +50,14 @@
|
|
|
50
50
|
"test": "yarn build && vitest run",
|
|
51
51
|
"test:watch": "vitest",
|
|
52
52
|
"test:integration-test-env": "yarn build && tsx --env-file .env.integration-test node_modules/.bin/vitest run",
|
|
53
|
-
"dev": "yarn build && npx tsx src/index.ts",
|
|
53
|
+
"dev": "yarn build && DEBUG=1 npx tsx src/index.ts",
|
|
54
54
|
"dev:local-server": "yarn build && tsx --env-file .env.dev-local-server src/index.ts",
|
|
55
55
|
"dev:integration-test-env": "yarn build && tsx --env-file .env.integration-test src/index.ts",
|
|
56
56
|
"prepublishOnly": "yarn build && yarn test",
|
|
57
|
-
"
|
|
58
|
-
"patch:publish": "yarn build && npm version patch && npm publish",
|
|
59
|
-
"version:prerelease": "yarn build && npm version prerelease --preid=beta",
|
|
60
|
-
"publish:prerelease": "npm publish --tag beta",
|
|
61
|
-
"beta:publish": "yarn version:prerelease && yarn publish:prerelease"
|
|
57
|
+
"release": "release-it"
|
|
62
58
|
},
|
|
63
59
|
"dependencies": {
|
|
64
|
-
"@anthropic-ai/claude-code": "^1.0.
|
|
60
|
+
"@anthropic-ai/claude-code": "^1.0.89",
|
|
65
61
|
"@anthropic-ai/sdk": "^0.56.0",
|
|
66
62
|
"@modelcontextprotocol/sdk": "^1.15.1",
|
|
67
63
|
"@stablelib/base64": "^2.0.1",
|
|
@@ -90,6 +86,7 @@
|
|
|
90
86
|
"eslint": "^9",
|
|
91
87
|
"eslint-config-prettier": "^10",
|
|
92
88
|
"pkgroll": "^2.14.2",
|
|
89
|
+
"release-it": "^19.0.4",
|
|
93
90
|
"shx": "^0.3.3",
|
|
94
91
|
"ts-node": "^10",
|
|
95
92
|
"tsx": "^4.20.3",
|
|
@@ -97,7 +94,12 @@
|
|
|
97
94
|
"vitest": "^3.2.4"
|
|
98
95
|
},
|
|
99
96
|
"resolutions": {
|
|
100
|
-
"whatwg-url": "14.2.0"
|
|
97
|
+
"whatwg-url": "14.2.0",
|
|
98
|
+
"parse-path": "7.0.3",
|
|
99
|
+
"@types/parse-path": "7.0.3"
|
|
100
|
+
},
|
|
101
|
+
"publishConfig": {
|
|
102
|
+
"registry": "https://registry.npmjs.org"
|
|
101
103
|
},
|
|
102
104
|
"packageManager": "yarn@1.22.22"
|
|
103
105
|
}
|