@cjhyy/code-shell-server 0.9.39 → 0.9.41

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.
@@ -18,6 +18,9 @@ export declare class ApprovalLeases {
18
18
  add(approval: HubApproval): void;
19
19
  get(requestId: string): HubApproval | undefined;
20
20
  snapshot(): HubApproval[];
21
+ /** Read-only companion to snapshot; expired reservations are displayed free.
22
+ * Submitted decisions remain excluded until their worker ACK resolves/retries. */
23
+ snapshotLeases(): ApprovalLease[];
21
24
  claim(requestId: string, holderId: string): ApprovalLease;
22
25
  /** Hold until worker acknowledgement; expiry must never permit duplicate decisions. */
23
26
  submit(requestId: string, holderId: string): HubApproval;
@@ -28,6 +28,18 @@ export class ApprovalLeases {
28
28
  .filter((entry) => !entry.submitted)
29
29
  .map((entry) => entry.approval);
30
30
  }
31
+ /** Read-only companion to snapshot; expired reservations are displayed free.
32
+ * Submitted decisions remain excluded until their worker ACK resolves/retries. */
33
+ snapshotLeases() {
34
+ const now = this.now();
35
+ return [...this.entries.values()]
36
+ .filter((entry) => !entry.submitted)
37
+ .map((entry) => ({
38
+ requestId: entry.approval.requestId,
39
+ holderId: entry.expiresAt > now ? entry.holderId : null,
40
+ expiresAt: entry.expiresAt > now ? entry.expiresAt : null,
41
+ }));
42
+ }
31
43
  claim(requestId, holderId) {
32
44
  this.sweep();
33
45
  const entry = this.entries.get(requestId);
@@ -8,7 +8,7 @@ export declare const REMOTE_LINK_ADAPTERS: ({
8
8
  id: "github";
9
9
  name: "GitHub";
10
10
  group: "repositories";
11
- actions: readonly ["list_repositories", "get_readme", "get_file", "list_issues", "get_issue", "list_pull_requests", "get_pull_request", "create_issue", "update_issue", "get_repository", "get_starred", "set_starred"];
11
+ actions: readonly ["list_repositories", "get_readme", "get_file", "list_issues", "get_issue", "list_pull_requests", "get_pull_request", "list_pull_request_files", "list_pull_request_commits", "get_commit", "create_issue", "update_issue", "get_repository", "get_starred", "set_starred"];
12
12
  } | {
13
13
  methodId: string;
14
14
  authModeId: string;
@@ -40,7 +40,7 @@ export declare const REMOTE_LINK_ADAPTERS: ({
40
40
  id: "slack";
41
41
  name: "Slack";
42
42
  group: "channels";
43
- actions: readonly ["list_channels", "get_channel_history"];
43
+ actions: readonly ["list_channels", "get_channel_history", "get_message", "get_thread"];
44
44
  } | {
45
45
  methodId: string;
46
46
  authModeId: string;
@@ -734,6 +734,30 @@ export async function startHeadlessServer(opts) {
734
734
  log("tab.frame_dropped", { reason: "not jsonrpc", raw: previewLine(line) });
735
735
  return;
736
736
  }
737
+ if (hubAuth && parsed.method === "serve/approval.snapshot") {
738
+ const id = parsed.id;
739
+ if (!((typeof id === "string" && id.length > 0 && id.length <= 512) ||
740
+ (typeof id === "number" && Number.isSafeInteger(id)))) {
741
+ sendToTab(ws, hostQueryError(null, -32600, "request id required"), "approval-snapshot");
742
+ }
743
+ else if (parsed.params !== undefined &&
744
+ (!parsed.params ||
745
+ typeof parsed.params !== "object" ||
746
+ Array.isArray(parsed.params) ||
747
+ Object.keys(parsed.params).length !== 0)) {
748
+ sendToTab(ws, hostQueryError(id, -32602, "snapshot takes no parameters"), "approval-snapshot");
749
+ }
750
+ else {
751
+ // Same authenticated workspace scope as the upgrade snapshot. No
752
+ // lease mutation, worker start, approval submission or new authority.
753
+ sendToTab(ws, JSON.stringify({
754
+ jsonrpc: "2.0",
755
+ id,
756
+ result: { approvals: leases.snapshot(), leases: leases.snapshotLeases() },
757
+ }), "approval-snapshot");
758
+ }
759
+ return;
760
+ }
737
761
  if (hubAuth &&
738
762
  (parsed.method === "serve/approval.claim" || parsed.method === "serve/approval.release")) {
739
763
  const requestId = parsed.params?.requestId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cjhyy/code-shell-server",
3
- "version": "0.9.39",
3
+ "version": "0.9.41",
4
4
  "description": "CodeShell server transport layer — mobile remote HTTP/WS host, pairing, passcode gate, tunnel, rooms, uploads, and session/attachment services. Electron-free; precursor of the auth gateway.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -61,13 +61,13 @@
61
61
  "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
62
62
  },
63
63
  "dependencies": {
64
- "@cjhyy/code-shell-capability-coding": "0.9.39",
65
- "@cjhyy/code-shell-core": "0.9.39",
66
- "@cjhyy/code-shell-web": "0.9.39",
64
+ "@cjhyy/code-shell-capability-coding": "0.9.41",
65
+ "@cjhyy/code-shell-core": "0.9.41",
66
+ "@cjhyy/code-shell-web": "0.9.41",
67
67
  "@modelcontextprotocol/sdk": "^1.31.0",
68
68
  "@types/ws": "^8.18.1",
69
69
  "ws": "^8.21.0",
70
- "@cjhyy/code-shell-link": "0.9.39"
70
+ "@cjhyy/code-shell-link": "0.9.41"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=20.10"