chatroom-cli 1.2.0 → 1.2.1

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 (2) hide show
  1. package/dist/index.js +32 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11152,18 +11152,22 @@ var init_cli = __esm(() => {
11152
11152
  });
11153
11153
 
11154
11154
  // ../../services/backend/config/errorCodes.ts
11155
- var BACKEND_ERROR_CODES, FATAL_ERROR_CODES;
11155
+ var BACKEND_ERROR_CODES, FATAL_ERROR_CODES, NON_FATAL_ERROR_CODES;
11156
11156
  var init_errorCodes = __esm(() => {
11157
11157
  BACKEND_ERROR_CODES = {
11158
11158
  PARTICIPANT_NOT_FOUND: "PARTICIPANT_NOT_FOUND",
11159
11159
  CHATROOM_NOT_FOUND: "CHATROOM_NOT_FOUND",
11160
- SESSION_INVALID: "SESSION_INVALID"
11160
+ SESSION_INVALID: "SESSION_INVALID",
11161
+ CONTEXT_NO_HANDOFF_SINCE_LAST_CONTEXT: "CONTEXT_NO_HANDOFF_SINCE_LAST_CONTEXT"
11161
11162
  };
11162
11163
  FATAL_ERROR_CODES = [
11163
11164
  BACKEND_ERROR_CODES.PARTICIPANT_NOT_FOUND,
11164
11165
  BACKEND_ERROR_CODES.CHATROOM_NOT_FOUND,
11165
11166
  BACKEND_ERROR_CODES.SESSION_INVALID
11166
11167
  ];
11168
+ NON_FATAL_ERROR_CODES = [
11169
+ BACKEND_ERROR_CODES.CONTEXT_NO_HANDOFF_SINCE_LAST_CONTEXT
11170
+ ];
11167
11171
  });
11168
11172
 
11169
11173
  // ../../services/backend/prompts/base/cli/get-next-task/command.ts
@@ -12888,6 +12892,24 @@ async function newContext(chatroomId, options, deps) {
12888
12892
  console.log(`
12889
12893
  \uD83D\uDCCC This context is now pinned for all agents in this chatroom.`);
12890
12894
  } catch (err) {
12895
+ const errData = err.data;
12896
+ if (errData?.code === "CONTEXT_NO_HANDOFF_SINCE_LAST_CONTEXT" && errData.existingContext) {
12897
+ const { content, createdAt, createdBy } = errData.existingContext;
12898
+ console.error(`❌ Cannot create new context: no handoff sent since last context was created.`);
12899
+ console.error(`
12900
+ \uD83D\uDCCC Current Context (resume from here):`);
12901
+ console.error(` Created by: ${sanitizeForTerminal(createdBy)}`);
12902
+ console.error(` Created at: ${new Date(createdAt).toLocaleString()}`);
12903
+ console.error(` Content:`);
12904
+ const safeContent = sanitizeForTerminal(content);
12905
+ console.error(safeContent.split(`
12906
+ `).map((l) => ` ${l}`).join(`
12907
+ `));
12908
+ console.error(`
12909
+ \uD83D\uDCA1 Send a handoff first, then create a new context.`);
12910
+ process.exit(1);
12911
+ return;
12912
+ }
12891
12913
  console.error(`❌ Failed to create context: ${err.message}`);
12892
12914
  process.exit(1);
12893
12915
  return;
@@ -14174,6 +14196,14 @@ Run any chatroom command first to register this machine,`);
14174
14196
  }
14175
14197
  const client2 = await getConvexClient();
14176
14198
  const typedSessionId = sessionId;
14199
+ const validation = await client2.query(api.cliAuth.validateSession, { sessionId: typedSessionId });
14200
+ if (!validation.valid) {
14201
+ console.error(`❌ Session invalid: ${validation.reason}`);
14202
+ console.error(`
14203
+ Run: chatroom auth login`);
14204
+ releaseLock();
14205
+ process.exit(1);
14206
+ }
14177
14207
  const config3 = loadMachineConfig();
14178
14208
  const remoteAgentService = new OpenCodeAgentService;
14179
14209
  const availableModels = await discoverModels(remoteAgentService);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chatroom-cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "CLI for multi-agent chatroom collaboration",
5
5
  "type": "module",
6
6
  "bin": {