@dhf-claude/grix 0.1.9 → 0.1.11

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.
@@ -6,7 +6,7 @@
6
6
  "name": "Aibot"
7
7
  },
8
8
  "homepage": "https://grix.dhf.pub",
9
- "repository": "https://github.com/askie/clawpool-claude",
9
+ "repository": "https://github.com/askie/grix-claude",
10
10
  "license": "MIT",
11
11
  "keywords": [
12
12
  "claude-code",
package/dist/daemon.js CHANGED
@@ -15674,17 +15674,17 @@ var init_package = __esm({
15674
15674
  "package.json"() {
15675
15675
  package_default = {
15676
15676
  name: "@dhf-claude/grix",
15677
- version: "0.1.9",
15677
+ version: "0.1.11",
15678
15678
  description: "Claude Code channel plugin for Aibot Grix",
15679
15679
  type: "module",
15680
15680
  repository: {
15681
15681
  type: "git",
15682
- url: "git+https://github.com/askie/clawpool-claude.git"
15682
+ url: "git+ssh://git@github.com/askie/grix-claude.git"
15683
15683
  },
15684
15684
  bugs: {
15685
- url: "https://github.com/askie/clawpool-claude/issues"
15685
+ url: "https://github.com/askie/grix-claude/issues"
15686
15686
  },
15687
- homepage: "https://github.com/askie/clawpool-claude#readme",
15687
+ homepage: "https://github.com/askie/grix-claude#readme",
15688
15688
  publishConfig: {
15689
15689
  access: "public"
15690
15690
  },
@@ -15945,6 +15945,13 @@ function withOptionalString(target, key, value) {
15945
15945
  target[key] = normalized;
15946
15946
  }
15947
15947
  }
15948
+ function normalizeSessionActivityKind(value) {
15949
+ const normalized = normalizeString20(value);
15950
+ if (!normalized || normalized === "composing") {
15951
+ return "typing";
15952
+ }
15953
+ return normalized;
15954
+ }
15948
15955
  function buildAuthPayload(config) {
15949
15956
  const clientVersion = normalizeString20(config?.clientVersion) || pluginVersion;
15950
15957
  const hostVersion = normalizeString20(config?.hostVersion) || clientVersion;
@@ -15973,7 +15980,7 @@ function buildSessionActivityPayload({
15973
15980
  }) {
15974
15981
  const payload = {
15975
15982
  session_id: normalizeString20(sessionID),
15976
- kind: normalizeString20(kind),
15983
+ kind: normalizeSessionActivityKind(kind),
15977
15984
  active: active === true
15978
15985
  };
15979
15986
  if (Number.isFinite(Number(ttlMs)) && Number(ttlMs) > 0) {
@@ -18896,6 +18903,11 @@ var init_runtime = __esm({
18896
18903
  if (normalizedMsg) {
18897
18904
  payload.msg = normalizedMsg;
18898
18905
  }
18906
+ this.stopTypingForEvent({
18907
+ eventID: event.event_id,
18908
+ sessionID: event.session_id,
18909
+ msgID: event.msg_id
18910
+ });
18899
18911
  this.aibotClient.sendEventResult(payload);
18900
18912
  this.trace({
18901
18913
  stage: "event_result_sent",
@@ -19196,6 +19208,33 @@ var init_runtime = __esm({
19196
19208
  msg_id: event.msg_id
19197
19209
  });
19198
19210
  }
19211
+ stopTypingForEvent({
19212
+ eventID,
19213
+ sessionID = "",
19214
+ msgID = ""
19215
+ } = {}) {
19216
+ const normalizedEventID = normalizeString32(eventID);
19217
+ const normalizedSessionID = normalizeString32(sessionID) || this.messageDeliveryStore.getRememberedSessionID(normalizedEventID);
19218
+ if (!normalizedEventID || !normalizedSessionID || typeof this.aibotClient?.setSessionComposing !== "function") {
19219
+ return;
19220
+ }
19221
+ try {
19222
+ this.aibotClient.setSessionComposing({
19223
+ sessionID: normalizedSessionID,
19224
+ kind: "typing",
19225
+ active: false,
19226
+ refMsgID: normalizeString32(msgID),
19227
+ refEventID: normalizedEventID
19228
+ });
19229
+ } catch (error) {
19230
+ this.trace({
19231
+ stage: "event_typing_stop_failed",
19232
+ event_id: normalizedEventID,
19233
+ session_id: normalizedSessionID,
19234
+ error: error instanceof Error ? error.message : String(error)
19235
+ }, "error");
19236
+ }
19237
+ }
19199
19238
  async shouldResumeClaudeSession(binding) {
19200
19239
  const claudeSessionID = normalizeString32(binding?.claude_session_id);
19201
19240
  const cwd = normalizeString32(binding?.cwd);
@@ -20122,6 +20161,12 @@ var init_runtime = __esm({
20122
20161
  const nextPayload = this.buildForwardedWorkerEventResult(payload, failureOptions);
20123
20162
  await this.recordWorkerEventResultObserved(nextPayload);
20124
20163
  await this.notifyWorkerEventResultFailure(nextPayload, failureOptions);
20164
+ const record = this.getPendingEvent(nextPayload?.event_id);
20165
+ this.stopTypingForEvent({
20166
+ eventID: nextPayload?.event_id,
20167
+ sessionID: nextPayload?.session_id || record?.sessionID,
20168
+ msgID: record?.msgID
20169
+ });
20125
20170
  this.aibotClient.sendEventResult(nextPayload);
20126
20171
  await this.handleEventCompleted(nextPayload?.event_id);
20127
20172
  return nextPayload;
@@ -20791,12 +20836,13 @@ var init_runtime = __esm({
20791
20836
  if (!event.event_id || !event.session_id || !event.msg_id) {
20792
20837
  return;
20793
20838
  }
20839
+ this.ack(event);
20794
20840
  const queue = this.sessionQueues.ensure(event.session_id);
20795
- queue.run(() => this.handleEvent(rawPayload)).catch((err) => {
20841
+ queue.run(() => this.handleEvent(rawPayload, { alreadyAcked: true })).catch((err) => {
20796
20842
  this.trace({ stage: "handle_event_error", session_id: event.session_id, event_id: event.event_id, error: String(err?.message ?? err) }, "error");
20797
20843
  });
20798
20844
  }
20799
- async handleEvent(rawPayload) {
20845
+ async handleEvent(rawPayload, { alreadyAcked = false } = {}) {
20800
20846
  const event = normalizeInboundEventPayload(rawPayload);
20801
20847
  if (!event.event_id || !event.session_id || !event.msg_id) {
20802
20848
  return;
@@ -20808,7 +20854,9 @@ var init_runtime = __esm({
20808
20854
  msg_id: event.msg_id,
20809
20855
  sender_id: event.sender_id
20810
20856
  });
20811
- this.ack(event);
20857
+ if (!alreadyAcked) {
20858
+ this.ack(event);
20859
+ }
20812
20860
  if (isRecordOnlyMirror(event)) {
20813
20861
  this.trace({
20814
20862
  stage: "event_mirrored_record_only",
@@ -21256,7 +21304,8 @@ __export(main_exports, {
21256
21304
  notifyWorkerReady: () => notifyWorkerReady,
21257
21305
  run: () => run,
21258
21306
  shouldIgnoreWorkerStatusUpdate: () => shouldIgnoreWorkerStatusUpdate,
21259
- shouldNotifyWorkerReady: () => shouldNotifyWorkerReady
21307
+ shouldNotifyWorkerReady: () => shouldNotifyWorkerReady,
21308
+ shouldPreserveWorkerStatusOnRegister: () => shouldPreserveWorkerStatusOnRegister
21260
21309
  });
21261
21310
  import process15 from "node:process";
21262
21311
  function usage() {
@@ -21338,6 +21387,21 @@ function shouldIgnoreWorkerStatusUpdate(previousBinding, payload) {
21338
21387
  }
21339
21388
  return false;
21340
21389
  }
21390
+ function shouldPreserveWorkerStatusOnRegister(previousBinding, payload) {
21391
+ if (!previousBinding) {
21392
+ return false;
21393
+ }
21394
+ if (shouldIgnoreWorkerStatusUpdate(previousBinding, payload)) {
21395
+ return false;
21396
+ }
21397
+ const currentStatus = normalizeString35(previousBinding.worker_status);
21398
+ if (currentStatus !== "connected" && currentStatus !== "ready") {
21399
+ return false;
21400
+ }
21401
+ return Boolean(
21402
+ normalizeString35(previousBinding.worker_control_url) && normalizeString35(previousBinding.worker_control_token)
21403
+ );
21404
+ }
21341
21405
  function buildWorkerReadyNoticeText(binding) {
21342
21406
  return "claude ready! please retry again.";
21343
21407
  }
@@ -21435,6 +21499,27 @@ async function run(argv = [], env = process15.env) {
21435
21499
  if (!existing) {
21436
21500
  return { ok: false, reason: "binding_not_found" };
21437
21501
  }
21502
+ if (shouldIgnoreWorkerStatusUpdate(existing, payload)) {
21503
+ logger.trace({
21504
+ stage: "worker_register_ignored_stale",
21505
+ aibot_session_id: aibotSessionID,
21506
+ worker_id: payload?.worker_id,
21507
+ claude_session_id: payload?.claude_session_id,
21508
+ expected_worker_id: existing?.worker_id,
21509
+ expected_claude_session_id: existing?.claude_session_id
21510
+ }, { level: "error" });
21511
+ return { ok: true };
21512
+ }
21513
+ if (shouldPreserveWorkerStatusOnRegister(existing, payload)) {
21514
+ logger.trace({
21515
+ stage: "worker_register_preserved_existing_status",
21516
+ aibot_session_id: aibotSessionID,
21517
+ worker_id: payload?.worker_id,
21518
+ claude_session_id: payload?.claude_session_id,
21519
+ worker_status: existing?.worker_status
21520
+ });
21521
+ return { ok: true };
21522
+ }
21438
21523
  await bindingRegistry.markWorkerStarting(aibotSessionID, {
21439
21524
  workerID,
21440
21525
  workerPid,
package/dist/index.js CHANGED
@@ -25776,8 +25776,8 @@ function createWorkerApp({ env = process4.env } = {}) {
25776
25776
  await elicitationStore.init();
25777
25777
  await interactionService.restoreEventState();
25778
25778
  await bridge.startControlServer();
25779
- await mcp.connect(new StdioServerTransport());
25780
25779
  if (!bridge.isDaemonBridgeActive()) {
25780
+ await mcp.connect(new StdioServerTransport());
25781
25781
  logger.info("worker started without daemon bridge for MCP health checks");
25782
25782
  return;
25783
25783
  }
@@ -25787,6 +25787,7 @@ function createWorkerApp({ env = process4.env } = {}) {
25787
25787
  pid: process4.pid
25788
25788
  });
25789
25789
  await bridge.sendConnectedStatus();
25790
+ await mcp.connect(new StdioServerTransport());
25790
25791
  interactionService.startDispatchPumps();
25791
25792
  logger.info("worker connected in daemon bridge mode");
25792
25793
  },
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@dhf-claude/grix",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Claude Code channel plugin for Aibot Grix",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/askie/clawpool-claude.git"
8
+ "url": "git+ssh://git@github.com/askie/grix-claude.git"
9
9
  },
10
10
  "bugs": {
11
- "url": "https://github.com/askie/clawpool-claude/issues"
11
+ "url": "https://github.com/askie/grix-claude/issues"
12
12
  },
13
- "homepage": "https://github.com/askie/clawpool-claude#readme",
13
+ "homepage": "https://github.com/askie/grix-claude#readme",
14
14
  "publishConfig": {
15
15
  "access": "public"
16
16
  },